@veltdev/sdk-dev 4.6.2-beta.1 → 4.6.2-beta.2
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/app/models/data/user.data.model.d.ts +5 -0
- package/package.json +1 -1
- package/velt.js +3 -3
package/velt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SNIPPYLY_VERSION = '4.6.2-beta.
|
|
1
|
+
var SNIPPYLY_VERSION = '4.6.2-beta.2';
|
|
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 DSe=Object.create;var GA=Object.defineProperty,wSe=Object.defineProperties,OSe=Object.getOwnPropertyDescriptor,ASe=Object.getOwnPropertyDescriptors,PSe=Object.getOwnPropertyNames,zA=Object.getOwnPropertySymbols,WY=Object.getPrototypeOf,v8=Object.prototype.hasOwnProperty,qY=Object.prototype.propertyIsEnumerable,MSe=Reflect.get;var GY=(i,o,n)=>o in i?GA(i,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[o]=n,E=(i,o)=>{for(var n in o||={})v8.call(o,n)&&GY(i,n,o[n]);if(zA)for(var n of zA(o))qY.call(o,n)&&GY(i,n,o[n]);return i},T=(i,o)=>wSe(i,ASe(o));var ly=(i,o)=>{var n={};for(var e in i)v8.call(i,e)&&o.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&zA)for(var e of zA(i))o.indexOf(e)<0&&qY.call(i,e)&&(n[e]=i[e]);return n};var kSe=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),WA=(i,o)=>{for(var n in o)GA(i,n,{get:o[n],enumerable:!0})},RSe=(i,o,n,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of PSe(o))!v8.call(i,t)&&t!==n&&GA(i,t,{get:()=>o[t],enumerable:!(e=OSe(o,t))||e.enumerable});return i};var YY=(i,o,n)=>(n=i!=null?DSe(WY(i)):{},RSe(o||!i||!i.__esModule?GA(n,"default",{value:i,enumerable:!0}):n,i));var kp=(i,o,n)=>MSe(WY(i),n,o);var Q=(i,o,n)=>new Promise((e,t)=>{var r=c=>{try{s(n.next(c))}catch(p){t(p)}},a=c=>{try{s(n.throw(c))}catch(p){t(p)}},s=c=>c.done?e(c.value):Promise.resolve(c.value).then(r,a);s((n=n.apply(i,o)).next())});var mY=kSe((u3o,dY)=>{"use strict";var Dt={};Dt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Dt.localCName=Dt.generateIdentifier();Dt.splitLines=function(i){return i.trim().split(`
|
|
@@ -204,7 +204,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
204
204
|
<img src="${o||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
|
|
205
205
|
</a>
|
|
206
206
|
`}};var Wg=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new co}};var X9=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new co}};var MI=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var qg=class{constructor(){this.pageInfo=new co}},kI=(function(i){return i.Start="start",i.End="end",i})(kI||{}),DC=(function(i){return i.Avatar="avatar",i.Label="label",i})(DC||{});var Q9=class{constructor(){this.sources=[],this.playerState=new RI}},RI=class{constructor(){this.volume=1}};var NI=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new co}};var bp=class{constructor(){this.visibility="private"}};var J9=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new co,this.isReactionResolverUsed=!1}};var eR=class{};var Ys=(function(i){return i.EDITOR="editor",i.VIEWER="viewer",i})(Ys||{}),ko=(function(i){return i.DOES_NOT_EXIST="does_not_exist",i.PERMISSION_DENIED="permission_denied",i.SOMETHING_WENT_WRONG="something_went_wrong",i})(ko||{});var Rt=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.config$=new ve(null),this.disableLogsConfig$=new ve({warnings:!0,suppressAll:!1}),this.apiKey$=new ve(""),this.baseFeatureAllowList=[],this.sf$=new ve(!1),this.sdkType$=new ve("core"),this.logsEnabled$=new ve(!0),this.safeEval$=new ve(!1),this.encryptionProvider$=new ve(null);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(r=>{this.analyticsService.updateDefaultProperties({sdkType:r})},r=>{this.loggingService.catch("Error in ConfigService sdkType$: ",r)}),this.logsEnabled$.subscribe(r=>{r?this.loggingService.enableLogs():this.loggingService.disableLogs(),nt.logsEnabled=r},r=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",r)})}catch(r){this.loggingService.catch("Error in ConfigService constructor: ",r)}}initConfig(e){try{e.featureAllowList?.length||(e.featureAllowList=Object.values(Re)),this.baseFeatureAllowList=e.featureAllowList?.slice(),this.config$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService initConfig: ",t)}}setApiKey(e){this.apiKey$.next(e)}getApiKey(){return this.apiKey$.value}getApiKey$(){return this.apiKey$.asObservable()}getConfig(){return this.config$.value}getConfig$(){return this.config$.asObservable()}disableFeatures(e){try{let t=this.config$.value;t&&(e?.length?t.featureAllowList=this.baseFeatureAllowList.filter(r=>!e.includes(r)):t.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(t)}catch(t){this.loggingService.catch("Error in ConfigService disableFeatures: ",t)}}setSF(e){try{this.sf$.next(e),this.analyticsService.setSF(e)}catch(t){this.loggingService.catch("Error in ConfigService setSF: ",t)}}getSF(){try{return this.sf$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSF: ",e),!1}}getSF$(){try{return this.sf$.asObservable().pipe(vt(Kt))}catch(e){return this.loggingService.catch("Error in ConfigService getSF$: ",e),se(!1)}}setSdkType(e){try{this.sdkType$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService setSdkType: ",t)}}getSdkType(){try{return this.sdkType$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSdkType: ",e),"core"}}getSdkType$(){try{return this.sdkType$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSdkType$: ",e),se("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableLogs: ",e)}}disableLogs(e){try{e&&this.disableLogsConfig$.next({warnings:e.warnings??!0,suppressAll:e.suppressAll??!1}),e?.warnings!==!1&&this.logsEnabled$.next(!1)}catch(t){this.loggingService.catch("Error in ConfigService disableLogs: ",t)}}getDisableLogsConfig(){return this.disableLogsConfig$.value}getDisableLogsConfig$(){return this.disableLogsConfig$.asObservable()}getApiProxyDomain(){try{return this.config$.value?.apiProxyDomain}catch(e){this.loggingService.catch("Error in ConfigService getApiProxyDomain: ",e);return}}enableSafeEval(){try{this.safeEval$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableSafeEval: ",e)}}disableSafeEval(){try{this.safeEval$.next(!1)}catch(e){this.loggingService.catch("Error in ConfigService disableSafeEval: ",e)}}getSafeEval(){try{return this.safeEval$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSafeEval: ",e),!1}}getSafeEval$(){try{return this.safeEval$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSafeEval$: ",e),se(!1)}}setEncryptionProvider(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;"),this.encryptionProvider$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService setEncryptionProvider: ",t)}}getEncryptionProvider(){try{return this.encryptionProvider$.value}catch(e){return this.loggingService.catch("Error in ConfigService getEncryptionProvider: ",e),null}}getEncryptionProvider$(){try{return this.encryptionProvider$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getEncryptionProvider$: ",e),se(null)}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var npe=(()=>{let o=class o{constructor(e){this.loggingService=e,this.initLocalStorageData()}initLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: initLocalStorageData","color: green;"),this.getLocalStorageData(),this.getSessionStorageData()}getLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStorageData","color: green;");try{let e=localStorage?.getItem(U.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new vf;return this.setLocalStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getLocalStorageData:",e),new vf}}setLocalStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(e){let t=JSON.stringify(e);localStorage?.setItem(U.LOCALSTORAGE_DATA_ID,t)}}catch(t){this.loggingService.catch("Error in setLocalStorageData:",t)}}deleteLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteLocalStorageData","color: green;"),localStorage?.removeItem(U.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let e=sessionStorage?.getItem(U.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new vf;return this.setSessionStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getSessionStorageData:",e),new vf}}setSessionStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(e){let t=JSON.stringify(e);sessionStorage?.setItem(U.LOCALSTORAGE_DATA_ID,t)}}catch(t){this.loggingService.catch("Error in setSessionStorageData:",t)}}deleteSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteSessionStorageData","color: green;");try{sessionStorage?.removeItem(U.LOCALSTORAGE_DATA_ID)}catch(e){this.loggingService.catch("Error in deleteSessionStorageData:",e)}}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var dm=(()=>{let o=class o{constructor(e,t){this.localStorageService=e,this.loggingService=t,this.avatarList=[{userId:"1",name:"Bear",photoUrl:"https://snippyly.com/assets/avatars/avatar-bear.svg",type:"anonymous"},{userId:"2",name:"Beaver",photoUrl:"https://snippyly.com/assets/avatars/avatar-beaver.svg",type:"anonymous"},{userId:"3",name:"Bunny",photoUrl:"https://snippyly.com/assets/avatars/avatar-bunny.svg",type:"anonymous"},{userId:"4",name:"Cat",photoUrl:"https://snippyly.com/assets/avatars/avatar-cat.svg",type:"anonymous"},{userId:"5",name:"Cow",photoUrl:"https://snippyly.com/assets/avatars/avatar-cow.svg",type:"anonymous"},{userId:"6",name:"Dinosaur",photoUrl:"https://snippyly.com/assets/avatars/avatar-dinosaur.svg",type:"anonymous"},{userId:"7",name:"Elephant",photoUrl:"https://snippyly.com/assets/avatars/avatar-elephant.svg",type:"anonymous"},{userId:"8",name:"Monkey",photoUrl:"https://snippyly.com/assets/avatars/avatar-monkey.svg",type:"anonymous"},{userId:"9",name:"Hedgehog",photoUrl:"https://snippyly.com/assets/avatars/avatar-hedgehog.svg",type:"anonymous"},{userId:"10",name:"Hippo",photoUrl:"https://snippyly.com/assets/avatars/avatar-hippo.svg",type:"anonymous"},{userId:"11",name:"Horse",photoUrl:"https://snippyly.com/assets/avatars/avatar-horse.svg",type:"anonymous"},{userId:"12",name:"Kitten",photoUrl:"https://snippyly.com/assets/avatars/avatar-kitten.svg",type:"anonymous"},{userId:"13",name:"Octopus",photoUrl:"https://snippyly.com/assets/avatars/avatar-octopus.svg",type:"anonymous"},{userId:"14",name:"Oink",photoUrl:"https://snippyly.com/assets/avatars/avatar-oink.svg",type:"anonymous"},{userId:"15",name:"Panda",photoUrl:"https://snippyly.com/assets/avatars/avatar-panda.svg",type:"anonymous"},{userId:"16",name:"Penguin",photoUrl:"https://snippyly.com/assets/avatars/avatar-penguin.svg",type:"anonymous"},{userId:"17",name:"Rabbit",photoUrl:"https://snippyly.com/assets/avatars/avatar-rabbit.svg",type:"anonymous"},{userId:"18",name:"Tiger",photoUrl:"https://snippyly.com/assets/avatars/avatar-tiger.svg",type:"anonymous"}],this.loggingService.log("%c[WB] Creating SERVICE AvatarService","color: blue;")}getSessionAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionAvatar","color: green;");try{let e=new Vo,t=this.localStorageService.getSessionStorageData();if(t.snippylyAvatar)e=t.snippylyAvatar;else{let r=this.generateUserAvatar();t.snippylyAvatar=r,this.localStorageService.setSessionStorageData(t)}return e}catch(e){return this.loggingService.catch("Error in getSessionAvatar:",e),new Vo}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let e=Math.floor(Math.random()*this.avatarList.length),t=this.avatarList[e];return t.color=this.generateUserColor(),t}catch(e){return this.loggingService.catch("Error in generateUserAvatar:",e),this.avatarList[0]}}generateUserColor(e){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserColor","color: green;");try{if(e)return U.AVATAR_COLOR_LIST[e%U.AVATAR_COLOR_LIST.length];let t=Math.floor(Math.random()*U.AVATAR_COLOR_LIST.length);return U.AVATAR_COLOR_LIST[t]}catch(t){return this.loggingService.catch("Error in generateUserColor:",t),""}}generateUserImage(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserImage","color: green;");try{return this.getSessionAvatar().photoUrl}catch(e){return this.loggingService.catch("Error in generateUserImage:",e),""}}};o.\u0275fac=function(t){return new(t||o)(ee(npe),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var ns=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new tt),this.actionSubjects.get(e)?.next(t)}catch(r){this.loggingService.catch("Error in CoreActionsService triggerAction: ",r)}}onAction(e){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new tt);let t=this.actionSubjects.get(e);return t?t.asObservable():se(null)}catch(t){return this.loggingService.catch("Error in CoreActionsService onAction: ",t),se(null)}}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var{entries:mpe,setPrototypeOf:ipe,isFrozen:xNe,getPrototypeOf:TNe,getOwnPropertyDescriptor:DNe}=Object,{freeze:ys,seal:lc,create:BW}=Object,{apply:VW,construct:UW}=typeof Reflect<"u"&&Reflect;ys||(ys=function(o){return o});lc||(lc=function(o){return o});VW||(VW=function(o,n){for(var e=arguments.length,t=new Array(e>2?e-2:0),r=2;r<e;r++)t[r-2]=arguments[r];return o.apply(n,t)});UW||(UW=function(o){for(var n=arguments.length,e=new Array(n>1?n-1:0),t=1;t<n;t++)e[t-1]=arguments[t];return new o(...e)});var tR=Ss(Array.prototype.forEach),wNe=Ss(Array.prototype.lastIndexOf),ope=Ss(Array.prototype.pop),LI=Ss(Array.prototype.push),ONe=Ss(Array.prototype.splice),iR=Ss(String.prototype.toLowerCase),MW=Ss(String.prototype.toString),kW=Ss(String.prototype.match),BI=Ss(String.prototype.replace),ANe=Ss(String.prototype.indexOf),PNe=Ss(String.prototype.trim),pd=Ss(Object.prototype.hasOwnProperty),_s=Ss(RegExp.prototype.test),VI=MNe(TypeError);function Ss(i){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var n=arguments.length,e=new Array(n>1?n-1:0),t=1;t<n;t++)e[t-1]=arguments[t];return VW(i,o,e)}}function MNe(i){return function(){for(var o=arguments.length,n=new Array(o),e=0;e<o;e++)n[e]=arguments[e];return UW(i,n)}}function ui(i,o){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:iR;ipe&&ipe(i,null);let e=o.length;for(;e--;){let t=o[e];if(typeof t=="string"){let r=n(t);r!==t&&(xNe(o)||(o[e]=r),t=r)}i[t]=!0}return i}function kNe(i){for(let o=0;o<i.length;o++)pd(i,o)||(i[o]=null);return i}function Ip(i){let o=BW(null);for(let[n,e]of mpe(i))pd(i,n)&&(Array.isArray(e)?o[n]=kNe(e):e&&typeof e=="object"&&e.constructor===Object?o[n]=Ip(e):o[n]=e);return o}function UI(i,o){for(;i!==null;){let e=DNe(i,o);if(e){if(e.get)return Ss(e.get);if(typeof e.value=="function")return Ss(e.value)}i=TNe(i)}function n(){return null}return n}var rpe=ys(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),RW=ys(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),NW=ys(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),RNe=ys(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),FW=ys(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),NNe=ys(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ape=ys(["#text"]),spe=ys(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),LW=ys(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),lpe=ys(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),nR=ys(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),FNe=lc(/\{\{[\w\W]*|[\w\W]*\}\}/gm),LNe=lc(/<%[\w\W]*|[\w\W]*%>/gm),BNe=lc(/\$\{[\w\W]*/gm),VNe=lc(/^data-[\-\w.\u00B7-\uFFFF]+$/),UNe=lc(/^aria-[\-\w]+$/),ppe=lc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jNe=lc(/^(?:\w+script|data):/i),$Ne=lc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gpe=lc(/^html$/i),HNe=lc(/^[a-z][.\w]*(-[.\w]+)+$/i),cpe=Object.freeze({__proto__:null,ARIA_ATTR:UNe,ATTR_WHITESPACE:$Ne,CUSTOM_ELEMENT:HNe,DATA_ATTR:VNe,DOCTYPE_NAME:gpe,ERB_EXPR:LNe,IS_ALLOWED_URI:ppe,IS_SCRIPT_OR_DATA:jNe,MUSTACHE_EXPR:FNe,TMPLIT_EXPR:BNe}),jI={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},zNe=function(){return typeof window>"u"?null:window},GNe=function(o,n){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let e=null,t="data-tt-policy-suffix";n&&n.hasAttribute(t)&&(e=n.getAttribute(t));let r="dompurify"+(e?"#"+e:"");try{return o.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},dpe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function upe(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zNe(),o=ln=>upe(ln);if(o.version="3.3.0",o.removed=[],!i||!i.document||i.document.nodeType!==jI.document||!i.Element)return o.isSupported=!1,o;let{document:n}=i,e=n,t=e.currentScript,{DocumentFragment:r,HTMLTemplateElement:a,Node:s,Element:c,NodeFilter:p,NamedNodeMap:g=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:f,DOMParser:I,trustedTypes:D}=i,N=c.prototype,G=UI(N,"cloneNode"),z=UI(N,"remove"),J=UI(N,"nextSibling"),ce=UI(N,"childNodes"),ye=UI(N,"parentNode");if(typeof a=="function"){let ln=n.createElement("template");ln.content&&ln.content.ownerDocument&&(n=ln.content.ownerDocument)}let Oe,$e="",{implementation:Be,createNodeIterator:be,createDocumentFragment:Se,getElementsByTagName:Ae}=n,{importNode:Ce}=e,he=dpe();o.isSupported=typeof mpe=="function"&&typeof ye=="function"&&Be&&Be.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:we,ERB_EXPR:Ne,TMPLIT_EXPR:to,DATA_ATTR:_t,ARIA_ATTR:St,IS_SCRIPT_OR_DATA:yt,ATTR_WHITESPACE:Nt,CUSTOM_ELEMENT:Wt}=cpe,{IS_ALLOWED_URI:Ht}=cpe,Zt=null,bi=ui({},[...rpe,...RW,...NW,...FW,...ape]),Jt=null,Jn=ui({},[...spe,...LW,...lpe,...nR]),Wi=Object.seal(BW(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xm=null,To=null,Na=Object.seal(BW(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ya=!0,il=!0,vc=!1,Af=!0,_d=!1,wp=!0,Cc=!1,Pf=!1,Mf=!1,Op=!1,_u=!1,yu=!1,kf=!0,z1=!1,c8="user-content-",Su=!0,Tm=!1,yd={},Zo=null,ea=ui({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),bu=null,G1=ui({},["audio","video","img","source","image","track"]),Rf=null,wA=ui({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sd="http://www.w3.org/1998/Math/MathML",Iu="http://www.w3.org/2000/svg",kl="http://www.w3.org/1999/xhtml",bd=kl,W1=!1,q1=null,Y1=ui({},[Sd,Iu,kl],MW),Eu=ui({},["mi","mo","mn","ms","mtext"]),xu=ui({},["annotation-xml"]),Tu=ui({},["title","style","font","a","script"]),Dm=null,K1=["application/xhtml+xml","text/html"],wm="text/html",gr=null,_c=null,OA=n.createElement("form"),Ap=function(Ve){return Ve instanceof RegExp||Ve instanceof Function},Nf=function(){let Ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(_c&&_c===Ve)){if((!Ve||typeof Ve!="object")&&(Ve={}),Ve=Ip(Ve),Dm=K1.indexOf(Ve.PARSER_MEDIA_TYPE)===-1?wm:Ve.PARSER_MEDIA_TYPE,gr=Dm==="application/xhtml+xml"?MW:iR,Zt=pd(Ve,"ALLOWED_TAGS")?ui({},Ve.ALLOWED_TAGS,gr):bi,Jt=pd(Ve,"ALLOWED_ATTR")?ui({},Ve.ALLOWED_ATTR,gr):Jn,q1=pd(Ve,"ALLOWED_NAMESPACES")?ui({},Ve.ALLOWED_NAMESPACES,MW):Y1,Rf=pd(Ve,"ADD_URI_SAFE_ATTR")?ui(Ip(wA),Ve.ADD_URI_SAFE_ATTR,gr):wA,bu=pd(Ve,"ADD_DATA_URI_TAGS")?ui(Ip(G1),Ve.ADD_DATA_URI_TAGS,gr):G1,Zo=pd(Ve,"FORBID_CONTENTS")?ui({},Ve.FORBID_CONTENTS,gr):ea,xm=pd(Ve,"FORBID_TAGS")?ui({},Ve.FORBID_TAGS,gr):Ip({}),To=pd(Ve,"FORBID_ATTR")?ui({},Ve.FORBID_ATTR,gr):Ip({}),yd=pd(Ve,"USE_PROFILES")?Ve.USE_PROFILES:!1,ya=Ve.ALLOW_ARIA_ATTR!==!1,il=Ve.ALLOW_DATA_ATTR!==!1,vc=Ve.ALLOW_UNKNOWN_PROTOCOLS||!1,Af=Ve.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_d=Ve.SAFE_FOR_TEMPLATES||!1,wp=Ve.SAFE_FOR_XML!==!1,Cc=Ve.WHOLE_DOCUMENT||!1,Op=Ve.RETURN_DOM||!1,_u=Ve.RETURN_DOM_FRAGMENT||!1,yu=Ve.RETURN_TRUSTED_TYPE||!1,Mf=Ve.FORCE_BODY||!1,kf=Ve.SANITIZE_DOM!==!1,z1=Ve.SANITIZE_NAMED_PROPS||!1,Su=Ve.KEEP_CONTENT!==!1,Tm=Ve.IN_PLACE||!1,Ht=Ve.ALLOWED_URI_REGEXP||ppe,bd=Ve.NAMESPACE||kl,Eu=Ve.MATHML_TEXT_INTEGRATION_POINTS||Eu,xu=Ve.HTML_INTEGRATION_POINTS||xu,Wi=Ve.CUSTOM_ELEMENT_HANDLING||{},Ve.CUSTOM_ELEMENT_HANDLING&&Ap(Ve.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Wi.tagNameCheck=Ve.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Ve.CUSTOM_ELEMENT_HANDLING&&Ap(Ve.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Wi.attributeNameCheck=Ve.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Ve.CUSTOM_ELEMENT_HANDLING&&typeof Ve.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Wi.allowCustomizedBuiltInElements=Ve.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),_d&&(il=!1),_u&&(Op=!0),yd&&(Zt=ui({},ape),Jt=[],yd.html===!0&&(ui(Zt,rpe),ui(Jt,spe)),yd.svg===!0&&(ui(Zt,RW),ui(Jt,LW),ui(Jt,nR)),yd.svgFilters===!0&&(ui(Zt,NW),ui(Jt,LW),ui(Jt,nR)),yd.mathMl===!0&&(ui(Zt,FW),ui(Jt,lpe),ui(Jt,nR))),Ve.ADD_TAGS&&(typeof Ve.ADD_TAGS=="function"?Na.tagCheck=Ve.ADD_TAGS:(Zt===bi&&(Zt=Ip(Zt)),ui(Zt,Ve.ADD_TAGS,gr))),Ve.ADD_ATTR&&(typeof Ve.ADD_ATTR=="function"?Na.attributeCheck=Ve.ADD_ATTR:(Jt===Jn&&(Jt=Ip(Jt)),ui(Jt,Ve.ADD_ATTR,gr))),Ve.ADD_URI_SAFE_ATTR&&ui(Rf,Ve.ADD_URI_SAFE_ATTR,gr),Ve.FORBID_CONTENTS&&(Zo===ea&&(Zo=Ip(Zo)),ui(Zo,Ve.FORBID_CONTENTS,gr)),Su&&(Zt["#text"]=!0),Cc&&ui(Zt,["html","head","body"]),Zt.table&&(ui(Zt,["tbody"]),delete xm.tbody),Ve.TRUSTED_TYPES_POLICY){if(typeof Ve.TRUSTED_TYPES_POLICY.createHTML!="function")throw VI('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Ve.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw VI('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Oe=Ve.TRUSTED_TYPES_POLICY,$e=Oe.createHTML("")}else Oe===void 0&&(Oe=GNe(D,t)),Oe!==null&&typeof $e=="string"&&($e=Oe.createHTML(""));ys&&ys(Ve),_c=Ve}},ta=ui({},[...RW,...NW,...RNe]),Z1=ui({},[...FW,...NNe]),Du=function(Ve){let At=ye(Ve);(!At||!At.tagName)&&(At={namespaceURI:bd,tagName:"template"});let Xt=iR(Ve.tagName),uo=iR(At.tagName);return q1[Ve.namespaceURI]?Ve.namespaceURI===Iu?At.namespaceURI===kl?Xt==="svg":At.namespaceURI===Sd?Xt==="svg"&&(uo==="annotation-xml"||Eu[uo]):!!ta[Xt]:Ve.namespaceURI===Sd?At.namespaceURI===kl?Xt==="math":At.namespaceURI===Iu?Xt==="math"&&xu[uo]:!!Z1[Xt]:Ve.namespaceURI===kl?At.namespaceURI===Iu&&!xu[uo]||At.namespaceURI===Sd&&!Eu[uo]?!1:!Z1[Xt]&&(Tu[Xt]||!ta[Xt]):!!(Dm==="application/xhtml+xml"&&q1[Ve.namespaceURI]):!1},Fa=function(Ve){LI(o.removed,{element:Ve});try{ye(Ve).removeChild(Ve)}catch{z(Ve)}},Om=function(Ve,At){try{LI(o.removed,{attribute:At.getAttributeNode(Ve),from:At})}catch{LI(o.removed,{attribute:null,from:At})}if(At.removeAttribute(Ve),Ve==="is")if(Op||_u)try{Fa(At)}catch{}else try{At.setAttribute(Ve,"")}catch{}},AA=function(Ve){let At=null,Xt=null;if(Mf)Ve="<remove></remove>"+Ve;else{let Ro=kW(Ve,/^[\r\n\t ]+/);Xt=Ro&&Ro[0]}Dm==="application/xhtml+xml"&&bd===kl&&(Ve='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Ve+"</body></html>");let uo=Oe?Oe.createHTML(Ve):Ve;if(bd===kl)try{At=new I().parseFromString(uo,Dm)}catch{}if(!At||!At.documentElement){At=Be.createDocument(bd,"template",null);try{At.documentElement.innerHTML=W1?$e:uo}catch{}}let na=At.body||At.documentElement;return Ve&&Xt&&na.insertBefore(n.createTextNode(Xt),na.childNodes[0]||null),bd===kl?Ae.call(At,Cc?"html":"body")[0]:Cc?At.documentElement:na},Am=function(Ve){return be.call(Ve.ownerDocument||Ve,Ve,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},X1=function(Ve){return Ve instanceof f&&(typeof Ve.nodeName!="string"||typeof Ve.textContent!="string"||typeof Ve.removeChild!="function"||!(Ve.attributes instanceof g)||typeof Ve.removeAttribute!="function"||typeof Ve.setAttribute!="function"||typeof Ve.namespaceURI!="string"||typeof Ve.insertBefore!="function"||typeof Ve.hasChildNodes!="function")},PA=function(Ve){return typeof s=="function"&&Ve instanceof s};function Os(ln,Ve,At){tR(ln,Xt=>{Xt.call(o,Ve,At,_c)})}let Q1=function(Ve){let At=null;if(Os(he.beforeSanitizeElements,Ve,null),X1(Ve))return Fa(Ve),!0;let Xt=gr(Ve.nodeName);if(Os(he.uponSanitizeElement,Ve,{tagName:Xt,allowedTags:Zt}),wp&&Ve.hasChildNodes()&&!PA(Ve.firstElementChild)&&_s(/<[/\w!]/g,Ve.innerHTML)&&_s(/<[/\w!]/g,Ve.textContent)||Ve.nodeType===jI.progressingInstruction||wp&&Ve.nodeType===jI.comment&&_s(/<[/\w]/g,Ve.data))return Fa(Ve),!0;if(!(Na.tagCheck instanceof Function&&Na.tagCheck(Xt))&&(!Zt[Xt]||xm[Xt])){if(!xm[Xt]&&wu(Xt)&&(Wi.tagNameCheck instanceof RegExp&&_s(Wi.tagNameCheck,Xt)||Wi.tagNameCheck instanceof Function&&Wi.tagNameCheck(Xt)))return!1;if(Su&&!Zo[Xt]){let uo=ye(Ve)||Ve.parentNode,na=ce(Ve)||Ve.childNodes;if(na&&uo){let Ro=na.length;for(let Sa=Ro-1;Sa>=0;--Sa){let ol=G(na[Sa],!0);ol.__removalCount=(Ve.__removalCount||0)+1,uo.insertBefore(ol,J(Ve))}}}return Fa(Ve),!0}return Ve instanceof c&&!Du(Ve)||(Xt==="noscript"||Xt==="noembed"||Xt==="noframes")&&_s(/<\/no(script|embed|frames)/i,Ve.innerHTML)?(Fa(Ve),!0):(_d&&Ve.nodeType===jI.text&&(At=Ve.textContent,tR([we,Ne,to],uo=>{At=BI(At,uo," ")}),Ve.textContent!==At&&(LI(o.removed,{element:Ve.cloneNode()}),Ve.textContent=At)),Os(he.afterSanitizeElements,Ve,null),!1)},Ff=function(Ve,At,Xt){if(kf&&(At==="id"||At==="name")&&(Xt in n||Xt in OA))return!1;if(!(il&&!To[At]&&_s(_t,At))){if(!(ya&&_s(St,At))){if(!(Na.attributeCheck instanceof Function&&Na.attributeCheck(At,Ve))){if(!Jt[At]||To[At]){if(!(wu(Ve)&&(Wi.tagNameCheck instanceof RegExp&&_s(Wi.tagNameCheck,Ve)||Wi.tagNameCheck instanceof Function&&Wi.tagNameCheck(Ve))&&(Wi.attributeNameCheck instanceof RegExp&&_s(Wi.attributeNameCheck,At)||Wi.attributeNameCheck instanceof Function&&Wi.attributeNameCheck(At,Ve))||At==="is"&&Wi.allowCustomizedBuiltInElements&&(Wi.tagNameCheck instanceof RegExp&&_s(Wi.tagNameCheck,Xt)||Wi.tagNameCheck instanceof Function&&Wi.tagNameCheck(Xt))))return!1}else if(!Rf[At]){if(!_s(Ht,BI(Xt,Nt,""))){if(!((At==="src"||At==="xlink:href"||At==="href")&&Ve!=="script"&&ANe(Xt,"data:")===0&&bu[Ve])){if(!(vc&&!_s(yt,BI(Xt,Nt,"")))){if(Xt)return!1}}}}}}}return!0},wu=function(Ve){return Ve!=="annotation-xml"&&kW(Ve,Wt)},yc=function(Ve){Os(he.beforeSanitizeAttributes,Ve,null);let{attributes:At}=Ve;if(!At||X1(Ve))return;let Xt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Jt,forceKeepAttr:void 0},uo=At.length;for(;uo--;){let na=At[uo],{name:Ro,namespaceURI:Sa,value:ol}=na,Rl=gr(Ro),Sc=ol,ur=Ro==="value"?Sc:PNe(Sc);if(Xt.attrName=Rl,Xt.attrValue=ur,Xt.keepAttr=!0,Xt.forceKeepAttr=void 0,Os(he.uponSanitizeAttribute,Ve,Xt),ur=Xt.attrValue,z1&&(Rl==="id"||Rl==="name")&&(Om(Ro,Ve),ur=c8+ur),wp&&_s(/((--!?|])>)|<\/(style|title|textarea)/i,ur)){Om(Ro,Ve);continue}if(Rl==="attributename"&&kW(ur,"href")){Om(Ro,Ve);continue}if(Xt.forceKeepAttr)continue;if(!Xt.keepAttr){Om(Ro,Ve);continue}if(!Af&&_s(/\/>/i,ur)){Om(Ro,Ve);continue}_d&&tR([we,Ne,to],J1=>{ur=BI(ur,J1," ")});let kA=gr(Ve.nodeName);if(!Ff(kA,Rl,ur)){Om(Ro,Ve);continue}if(Oe&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Sa)switch(D.getAttributeType(kA,Rl)){case"TrustedHTML":{ur=Oe.createHTML(ur);break}case"TrustedScriptURL":{ur=Oe.createScriptURL(ur);break}}if(ur!==Sc)try{Sa?Ve.setAttributeNS(Sa,Ro,ur):Ve.setAttribute(Ro,ur),X1(Ve)?Fa(Ve):ope(o.removed)}catch{Om(Ro,Ve)}}Os(he.afterSanitizeAttributes,Ve,null)},MA=function ln(Ve){let At=null,Xt=Am(Ve);for(Os(he.beforeSanitizeShadowDOM,Ve,null);At=Xt.nextNode();)Os(he.uponSanitizeShadowNode,At,null),Q1(At),yc(At),At.content instanceof r&&ln(At.content);Os(he.afterSanitizeShadowDOM,Ve,null)};return o.sanitize=function(ln){let Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},At=null,Xt=null,uo=null,na=null;if(W1=!ln,W1&&(ln="<!-->"),typeof ln!="string"&&!PA(ln))if(typeof ln.toString=="function"){if(ln=ln.toString(),typeof ln!="string")throw VI("dirty is not a string, aborting")}else throw VI("toString is not a function");if(!o.isSupported)return ln;if(Pf||Nf(Ve),o.removed=[],typeof ln=="string"&&(Tm=!1),Tm){if(ln.nodeName){let ol=gr(ln.nodeName);if(!Zt[ol]||xm[ol])throw VI("root node is forbidden and cannot be sanitized in-place")}}else if(ln instanceof s)At=AA("<!---->"),Xt=At.ownerDocument.importNode(ln,!0),Xt.nodeType===jI.element&&Xt.nodeName==="BODY"||Xt.nodeName==="HTML"?At=Xt:At.appendChild(Xt);else{if(!Op&&!_d&&!Cc&&ln.indexOf("<")===-1)return Oe&&yu?Oe.createHTML(ln):ln;if(At=AA(ln),!At)return Op?null:yu?$e:""}At&&Mf&&Fa(At.firstChild);let Ro=Am(Tm?ln:At);for(;uo=Ro.nextNode();)Q1(uo),yc(uo),uo.content instanceof r&&MA(uo.content);if(Tm)return ln;if(Op){if(_u)for(na=Se.call(At.ownerDocument);At.firstChild;)na.appendChild(At.firstChild);else na=At;return(Jt.shadowroot||Jt.shadowrootmode)&&(na=Ce.call(e,na,!0)),na}let Sa=Cc?At.outerHTML:At.innerHTML;return Cc&&Zt["!doctype"]&&At.ownerDocument&&At.ownerDocument.doctype&&At.ownerDocument.doctype.name&&_s(gpe,At.ownerDocument.doctype.name)&&(Sa="<!DOCTYPE "+At.ownerDocument.doctype.name+`>
|
|
207
|
-
`+Sa),_d&&tR([we,Ne,to],ol=>{Sa=BI(Sa,ol," ")}),Oe&&yu?Oe.createHTML(Sa):Sa},o.setConfig=function(){let ln=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nf(ln),Pf=!0},o.clearConfig=function(){_c=null,Pf=!1},o.isValidAttribute=function(ln,Ve,At){_c||Nf({});let Xt=gr(ln),uo=gr(Ve);return Ff(Xt,uo,At)},o.addHook=function(ln,Ve){typeof Ve=="function"&&LI(he[ln],Ve)},o.removeHook=function(ln,Ve){if(Ve!==void 0){let At=wNe(he[ln],Ve);return At===-1?void 0:ONe(he[ln],At,1)[0]}return ope(he[ln])},o.removeHooks=function(ln){he[ln]=[]},o.removeAllHooks=function(){he=dpe()},o}var $I=upe();var hpe={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},Le=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.rendererFactory2=t,this.loggingService=r,this.sanitizer=a,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new ve(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new ve([]),this.mousedown=!1,this.windowMouseDown$=new tt,this.windowPointerMove$=new ve(null),this.windowPointerUp$=new ve(null),this.documentSelectionChange$=new ve(null),this.windowClick$=new ve(null),this.windowScroll$=new ve(null),this.windowResize$=new ve(null),this.windowKeyupBackspace$=new ve(null),this.windowKeyupDelete$=new ve(null),this.windowKeyupEsc$=new ve(null),this.windowPopState$=new ve(null),this.documentClick$=new ve(null),this.documentClickSubject$=new tt,this.documentFocus$=new ve(null),this.windowKeydownShift$=new ve(null),this.windowKeyupShift$=new ve(null),this.mutation$=new ve(null),this.childListMutation$=new ve(null),this.networkStatus$=new ve(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new ve({}),this.selectedAnnotationsLocationMap$=new ve({}),this.recordingInProgress$=new ve({}),this.deleteAnnotations$=new ve([]),this.pinHighlighterClass$=new ve(null),this.dialogOpenedInSidebar$=new ve(!1),this.textHighlighterClass$=new ve(null),this.commentPinHighlighter$=new ve(!1),this.deviceInfo$=new ve(new Yn),this.customCss$=new ve(null),this.mutationObserver=null,this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=s=>{try{let c=[];return s.forEach(p=>{if(!Gi(p))if(p instanceof HTMLElement){if(p.className.includes("cdk-overlay-container")||p.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(p.className.includes("cdk-overlay")){let g=!1;p.childNodes.forEach(f=>{Gi(f)&&(g=!0)}),g||c.push(p)}else c.push(p)}else c.push(p)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let s=this.calculateScreenSize();this.currentScreenSize$=new ve(s),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Ti(),tn(([c,p])=>{try{let g=p.filter(I=>!c.includes(I)),f=c.filter(I=>!p.includes(I));f.length&&f.map(D=>document.getElementById(D)).filter(D=>D).forEach(D=>{this.unlistenElementScroll&&this.unlistenElementScroll[D.id]&&this.unlistenElementScroll[D.id]()}),g.length&&g.map(D=>document.getElementById(D)).filter(D=>D).forEach(D=>{this.unlistenElementScroll[D.id]=this.renderer.listen(D,"scroll",N=>{let G=this.calculateScreenSize();this.currentScreenSize$.next(G)})})}catch(g){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",g)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?Ule("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):jle("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(s){this.loggingService.catch("Error in DomService constructor: ",s)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}setDynamicIdPatterns(e){try{let t=e.map(r=>typeof r=="string"?new RegExp(r):r).filter(Boolean);t.length&&(this.dynamicIdPatterns=t)}catch(t){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",t)}}isLikelyDynamicId(e){try{return e?this.dynamicIdPatterns.some(t=>t.test(e)):!1}catch{return!1}}getStableAttributes(e){try{let t={};if(!e.getAttributeNames)return t;let r=new Set(["id","class","style"]);return e.getAttributeNames().forEach(s=>{if(r.has(s)||s.includes("snippyly")||s.includes("velt"))return;let c=e.getAttribute(s);c&&c.length<=256&&(t[s]=c)}),t}catch{return{}}}buildStableElementSelector(e,t){try{if(Object.keys(t).length===0)return;let a=[e.tagName?.toLowerCase()],s=["data-","aria-","role","name","title","type"];return Object.keys(t).sort((p,g)=>{let f=s.findIndex(D=>p.startsWith(D)),I=s.findIndex(D=>g.startsWith(D));return(f===-1?99:f)-(I===-1?99:I)}).slice(0,4).forEach(p=>{let g=CSS.escape(t[p]);a.push(`[${p}="${g}"]`)}),a.join("")}catch{return}}getVisibleText(e,t=400){try{let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a="",s,c=0;for(;(s=r.nextNode())&&a.length<t;){let p=(s.textContent||"").replace(/\s+/g," ").trim();if(p&&(a+=(a?" ":"")+p),c++,c>100)break}return a.slice(0,t)}catch{return""}}hashText(e){try{return wle(e)}catch{return}}generateRobustXPath(e,t){try{let r=t?.maxDepth||10,a=t?.useAbsolutePath||!1,s=[],c=e,p=0;for(;c&&c!==document.documentElement&&p<r;){let D=this.buildRobustXPathSegment(c);if(D&&(s.unshift(D),this.isStrongAnchorSegment(D)))break;c=c.parentElement,p++}if(s.length===0)return;let f=(a?"/":"//")+s.join("/");return s.some(D=>D.includes("[@")||D.includes("[contains(@class"))?f:void 0}catch{return}}buildRobustXPathSegment(e){try{let t=e.tagName.toLowerCase(),r=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let I of r){let D=e.getAttribute(I);if(D)return`${t}[@${I}=${this.escapeXPathValue(D)}]`}let a=Array.from(e.attributes).filter(I=>I.name.startsWith("data-")&&!I.name.includes("snippyly")&&!I.name.includes("velt")&&I.value.length<100).sort((I,D)=>I.value.length-D.value.length);if(a.length>0){let I=a[0];return`${t}[@${I.name}=${this.escapeXPathValue(I.value)}]`}let s=e.getAttribute("role");if(s)return`${t}[@role=${this.escapeXPathValue(s)}]`;let c=e.getAttribute("aria-label");if(c&&c.length<50)return`${t}[@aria-label=${this.escapeXPathValue(c)}]`;let p=e.getAttribute("name");if(p)return`${t}[@name=${this.escapeXPathValue(p)}]`;let g=e.getAttribute("type");if(g)return`${t}[@type=${this.escapeXPathValue(g)}]`;let f=Array.from(e.classList||[]).filter(I=>I.length>0&&I.length<40&&!I.includes("yui")&&!I.includes("velt")&&!I.includes("snippyly")&&!this.excludeClassList.includes(I)).slice(0,2);if(f.length>0){let I=f.map(D=>`contains(@class, ${this.escapeXPathValue(D)})`).join(" and ");return`${t}[${I}]`}if(e.parentElement){let I=Array.from(e.parentElement.children).filter(D=>D.tagName===e.tagName);if(I.length>1){let D=I.indexOf(e)+1;return`${t}[${D}]`}}return t}catch{return}}isStrongAnchorSegment(e){try{return!!(["main","navigation","banner","contentinfo","complementary","search"].some(a=>e.includes(`[@role='${a}']`))||["data-region","data-instanceid","data-activityid"].some(a=>e.includes(`[@${a}=`)))}catch{return!1}}escapeXPathValue(e,t=!0){try{return e.includes("'")?e.includes('"')?`concat(${e.split("'").map(s=>`'${s}'`).join(`,"'",`)})`:t?`"${e}"`:e:t?`'${e}'`:e}catch{try{return`concat(${e.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return t?`'${e}'`:e}}}getElementFromRobustXPath(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}generateAnchorRecord(e,t){try{let r=this.generateAnchorRecordForElement(e,t),a=null;if(e.parentElement&&e.parentElement instanceof HTMLElement&&Di(e.parentElement)&&e.parentElement!==document.body&&(a=e.parentElement),r&&a){let s=this.generateAnchorRecordForElement(a,t);s&&(r.parent=s)}return r}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",r),null}}generateAnchorRecordForElement(e,t){try{if(!e)return null;let r=e,a=r.tagName?.toUpperCase();if(!a)return null;let s=r.id&&!this.isLikelyDynamicId(r.id)?r.id:void 0,c=this.getStableAttributes(r),p=this.buildStableElementSelector(r,c),g=this.getVisibleText(r),f=this.hashText(g||""),I=this.generateRobustXPath(r),D=this.getXPath(r),N=this.getXPath(r,!0),G=this.getXPath(r,!0,!0);return{version:"1.0",id:s,tagName:a,elementSelector:p,robustXPath:I||void 0,xPath:D||void 0,fXPath:N||void 0,cfXPath:G||void 0,contentHash:f?{value:f,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",r),null}}resolveAnchorRecord(e){try{let t=[],r=null,a=(f,I,D=0)=>{let N=[],G=D;if(N.push({method:I,score:D}),e.tagName&&f.tagName?.toUpperCase()===e.tagName&&(G+=10,N.push({method:"tagName-match",score:10})),e.contentHash?.value){let z=this.getVisibleText(f);this.hashText(z)===e.contentHash.value&&(G+=30,N.push({method:"contentHash-match",score:30}))}t.push({el:f,score:G,by:I,scoreBreakdown:N})};if(e.id){let f=document.querySelectorAll(`#${CSS.escape(e.id)}`);if(f.length===1)return{element:f[0],matchedBy:"id",score:90};f.length>1&&f.forEach(I=>a(I,"id-duplicate",70))}if(e.elementSelector){let f=document.querySelectorAll(e.elementSelector);if(f.length===1)return{element:f[0],matchedBy:"element-selector",score:80};f.forEach(I=>a(I,"element-selector-duplicate",60))}if(e.robustXPath){let f=this.getElementFromRobustXPath(e.robustXPath);f&&a(f,"robustXPath",50)}e?.parent&&(r=this.resolveAnchorRecord(e.parent),r.element&&r.element.querySelectorAll(e.tagName?.toLowerCase()||"*").forEach(I=>a(I,"parent+tag",40)));let s=(f,I,D)=>{if(!f)return;let N=this.getElementFromXPath(f);N&&a(N,I||"xpath",D||30)};if(s(e.xPath,"xPath",30),s(e.cfXPath,"cfXPath",30),s(e.fXPath,"fXPath",30),e.contentHash?.value&&t.length===0){let I=D=>{let N=0;for(let G=0;G<D.length&&N<400;G++){let z=D[G];if(N++,!this.isElementVisible(z))continue;let J=this.getVisibleText(z),ce=this.hashText(J);ce&&ce===e.contentHash?.value&&a(z,"contentHash",15)}};if(r?.element&&r?.element instanceof Element){let D=r?.element?.querySelectorAll("*");I(D)}}if(!t.length)return{element:null};t.sort((f,I)=>I.score-f.score);let c=t[0].score,p=t.filter(f=>f.score===c);if(p.length>1){let f=[{path:e.xPath,label:"xPath"},{path:e.cfXPath,label:"cfXPath"},{path:e.fXPath,label:"fXPath"}];for(let I of f)if(I.path){let D=this.getElementFromXPath(I.path);if(D){let N=p.find(G=>G.el===D);if(N)return{element:N.el,matchedBy:`${N.by}+position`,score:N.score,scoreBreakdown:N.scoreBreakdown}}}}let g=t[0];return{element:g.el,matchedBy:g.by,score:g.score,scoreBreakdown:g.scoreBreakdown}}catch(t){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",t),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(de(e=>{e?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentFocus()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe(),this.onDocumentClick()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(t){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",t)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===U.VELT_IGNORE_CHANGE_DETECTION))return;let r=t.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(c=>{let p=c;if(typeof p.getAttribute=="function"){let g=p.getAttribute(U.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(g!==null&&g!==""){let f=this.xpathCacheId.get(g);f!==void 0&&(this.xpathCacheId.delete(g),this.xpathCache.delete(f))}}}),Gi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...t.filter(a=>a.type==="attributes").filter(a=>!Gi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(U.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(U.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{a.target?.closest(c)&&(s=!1)}),s}),r=r.filter(a=>a.target&&Di(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(t){this.loggingService.catch("Error in DomService change detection: ",t)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{Fo(hi(window,"offline").pipe(de(()=>!1)),hi(window,"online").pipe(de(()=>!0)),new Ut(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let t=this.calculateScreenSize();this.deviceInfo$.next(new Yn),this.currentScreenSize$.next(t)})}catch(e){this.loggingService.catch("Error in DomService onWindowResize: ",e)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",e)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",e=>{this.windowScroll$.next(e);let t=this.calculateScreenSize();this.currentScreenSize$.next(t)})}catch(e){this.loggingService.catch("Error in DomService onWindowScroll: ",e)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",e)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",e=>{this.mousedown=!0,this.windowMouseDown$.next(e),this.setPointerPosition(e)})}catch(e){this.loggingService.catch("Error in DomService onPointerDown: ",e)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",e=>{this.windowClick$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowClick: ",e)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",e)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",e)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",e)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",e)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",e)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",e=>{this.windowKeyupEsc$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",e)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",e)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",e=>{this.windowPopState$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowPopState: ",e)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",e)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=e=>{e?.target?.tagName?.toLowerCase()!==U.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return hi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Nl}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",e=>{this.windowPointerMove$.next(e),this.mouseMoveEvent=e})}catch(e){this.loggingService.catch("Error in DomService addPointerMoveListener: ",e)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",e)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",e=>{this.windowPointerUp$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",e)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",e=>{this.documentSelectionChange$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",e)}}updateCurrentMousePosition(e){try{if(this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY,this.currentMousePosition.clientX=e.clientX,this.currentMousePosition.clientY=e.clientY,e.target){let t=this.getXPath(e.target),r=e.target;if(t?.includes("name()='svg'")){let f=this.getXPath(t);f&&(r=f.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,c=e.clientY-a.y,p=s*100/(a.width||1),g=c*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:g,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(t){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",t)}}getTargetElementForCursorPosition(e,t=!0,r=!1,a=!0,s,c=!0,p){try{let g=e,f=g?.touches?.length?g.touches[0]?.clientX:g?.clientX,I=g?.touches?.length?g.touches[0]?.clientY:g?.clientY;p&&(f=p.clientX,I=p.clientY);let D=this.getBackgroundElement(f,I,t,r);if(D&&s&&typeof s=="function"&&(D=s(D)),D){let N=this.getXPath(D),G=this.getXPath(D,!0),z=D.getBoundingClientRect(),J=f-z.x,ce=I-z.y,ye=J*100/(z.width||1),Oe=ce*100/(z.height||1),$e={xpath:N,fXpath:G,leftPercentage:ye,topPercentage:Oe};if(a){let Be=this.getXPath(D,!0,!0);$e.cfXpath=Be}if(c){let Be=this.generateAnchorRecord(D);Be&&($e.anchor=Be)}return $e}else return null}catch(g){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",g),null}}getBackgroundElement(e,t,r=!0,a=!1){try{let s=document.elementsFromPoint(e,t),c=[];s.forEach(g=>{Gi(g)?c=[]:Di(g)&&c.push(g)}),a&&(c=c.filter(g=>this.isElementVisibleOnScreen(g)));let p=0;return r||c?.forEach((g,f)=>{g.tagName.toLowerCase()==="svg"&&(p=f)}),c[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,t){try{let r=document.elementsFromPoint(e,t),a=[];return r.forEach(s=>{Gi(s)&&Di(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(t){this.loggingService.catch("Error in DomService setPointerPosition: ",t)}}getCurrentWindowSize$(e){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let e=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),t=this.currentMousePosition?.pageX||e.x+200,r=Math.min(t,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(e,t,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,U.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),c=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(U.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,r,a=!1){try{e&&(this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(U.VELT_SELECTION_COLOR)&&e.style.setProperty(U.VELT_SELECTION_COLOR,t),r&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(U.VELT_SELECTION_COLOR),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(U.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(U.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,t=!1,r=!1,a){try{let s=this.calculateXPath(e,t,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let c=s.split("/"),p=!1;c.forEach((g,f)=>{g.includes("svg")&&(p=!0),p&&(c[f]="svg:"+g)}),s=c.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,t,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!t)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let c=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(c){let p=this.calculateXPath(e.parentNode,t,r,a)+"/"+e.tagName.toLowerCase(),g=Array.from(e.parentNode?.children||[]).filter(f=>f.nodeType===1&&f.tagName===e.tagName?f.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===c:!1);if(g.length>1){let f=g.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${f}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(c){return c.tagName==e.tagName});return this.calculateXPath(e.parentNode,t,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}getElementFromXPath(e,t=document){try{if(this.xpathCache.has(e)){let a=this.xpathCache.get(e);if(a!==void 0&&document.contains(a))return a;this.xpathCache.delete(e)}let r=this.getXPath(e,!1,!1,t);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=on();a.setAttribute(U.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}getElementFromTargetElement(e){try{let t=null;if(e?.anchor){let r=this.resolveAnchorRecord(e.anchor);r?.element&&(t=r.element)}else e?.xpath?t=this.getElementFromXPath(e.xpath):e?.cfXpath?t=this.getElementFromXPath(e.cfXpath):e?.fXpath&&(t=this.getElementFromXPath(e.fXpath));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",t),null}}getElementFromTargetTextRange(e){try{let t=null;if(e?.commonAncestorContainerAnchor){let r=this.resolveAnchorRecord(e.commonAncestorContainerAnchor);r?.element&&(t=r.element)}else e?.commonAncestorContainer&&(t=this.getElementFromXPath(e.commonAncestorContainer));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",t),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],t=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let r=new MI;return r.screenWidth=Math.max(...t),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new MI}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(I=>{I.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(I=>{I.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(I=>{I?.parentNode?.insertBefore(document.createTextNode(I?.textContent),I),I.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),g;for(;g=p.nextNode();)g?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(t){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",t),e}}mergeAdjacentTextNodes(e){try{let t=e.firstChild;for(;t;){if(t.nodeType===Node.TEXT_NODE){let r=t.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)t.textContent+=r.textContent,r.remove(),r=t.nextSibling}t=t.nextSibling}}catch(t){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",t)}}findLongestNode(e){try{for(let t=e.length-1;t>=0;t--){if(e[t]?.scrollHeight&&e[t]?.clientHeight){let r=Math.max(e[t]?.scrollHeight,e[t]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=e[t]}e[t]?.childNodes?.length&&this.findLongestNode(e[t]?.childNodes)}}catch(t){this.loggingService.catch("Error in DomService findLongestNode: ",t)}}resetSelectedAnnotationsMap(e=!0,t){try{let r=Array.from(document.querySelectorAll(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(f=>f.classList.contains("velt-annotation-draft-checked")?(f.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(f,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(f,"velt-comment-dialog-shake"),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||f.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(f,"velt-annotation-draft-checked")},100),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(f=>f),c=Object.keys(this.getRecordingInProgress()||{});s=[...s,...c];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let f=[];Object.keys(p).forEach(I=>{if(p[I]?.type==="tag"){let D=p[I];D?.to?.length||s.includes(I)||f.push(D)}else p[I]?.comments?.length||s.includes(I)||f.push(p[I])}),this.deleteAnnotations$.next(f),this.deleteAnnotations$.next([])}let g={};Object.keys(p).forEach(f=>{if(s.includes(f)&&(g[f]=p[f]),t)switch(t){case"comment":["comment","videoPin"].includes(p[f]?.type)||(g[f]=p[f]);break;default:p[f]?.type!==t&&(g[f]=p[f]);break}}),Object.keys(g).forEach(f=>{let I=g[f]?.multiThreadAnnotationId;I&&!g[I]&&(g[I]={annotationId:I,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(g)&&this.selectedAnnotationsMap$.next(g),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(T(E({},this.recordingInProgress$.value),{[e]:t}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${U.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${U.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let t=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(t).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(t[a].type)&&(r[a]=t[a]);break;default:t[a].type===e&&(r[a]=t[a]);break}}),r}else return t}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",t),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(de(t=>{if(e){let r={};return Object.keys(t).forEach(a=>{t[a].type===e&&(r[a]=t[a])}),r}else return t}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(de(e=>Object.values(e)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(e){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",e),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(e,t,r,a=!1,s){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let c=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),p=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));c[e.annotationId]&&!a?delete c[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(c={}),c[e.annotationId]=e,p[e.annotationId]=t,s=e?.multiThreadAnnotationId||s,s&&(c[s]={annotationId:s,type:"multiThread"},p[s]=t)),this.selectedAnnotationsMap$.next(c),Object.keys(p).forEach(g=>{c[g]||delete p[g]}),this.selectedAnnotationsLocationMap$.next(p)}catch(c){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",c)}}setSelectedAnnotationLocation(e,t){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==t&&(r[e]=t,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let t=this.selectedAnnotationsMap$.value;e.forEach(r=>{t[r.annotationId]&&(t[r.annotationId]=r)}),this.selectedAnnotationsMap$.next(t)}catch(t){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",t)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),se([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService onDomChange$: ",t),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(e,t){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===t){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==t)if(e?.closest("svg"))for(;a&&a!==t;){let c=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let g=p.getBoundingClientRect(),f=a.getBoundingClientRect();r.offsetLeft+=f.left-g.left,r.offsetTop+=f.top-g.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===t){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let c=window.getComputedStyle(a);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:t,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return t>0||r>0||a<window.innerHeight&&s>0}else return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisible: ",t),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let t=e,r=window.getComputedStyle(t);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",t),!1}}getClickAndDragPointsObservable(){return new Ut(e=>{let t=hi(document,"mousedown").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=hi(document,"mousemove").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=hi(document,"mouseup").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),c=t.pipe(fe(p=>r.pipe(Ti(),de(([g,f])=>({startPoint:p,prevPoint:g,curPoint:f})),fo(a)))).subscribe(e);return()=>c.unsubscribe()})}drawRectangle(e,t){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),c=Math.min(e.x,t.x),p=Math.min(e.y,t.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${c}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let t={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let c=this.getTextXPath(r);this.isXpathWithId(c)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let c=this.getElementFromXPath(t.commonAncestorContainer);if(c){t.commonAncestorContainerFXpath=this.getXPath(c,!0),t.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let p=this.generateAnchorRecord(c);p&&(t.commonAncestorContainerAnchor=p)}}return t.text=e.toString(),t.occurrence=Jh(a,0,e.startContainer,e.startOffset,e.toString())+1,t}catch(t){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",t);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let t=1,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&t++,r=r.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(t){this.loggingService.catch("Error in DomService getTextXPath: ",t);return}}getHostElement(e){try{if(U.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.parentElement:e.parentElement}let t=e.closest("svg");return t?t?.parentElement:e}catch(t){return this.loggingService.catch("Error in DomService getHostElement: ",t),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(t){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",t),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(t){return this.loggingService.catch("Error in DomService isXpathWithId: ",t),!1}}getListedElements({elementIds:e,elementClassNames:t,elementQuerySelectors:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let c=document.getElementById(e[s]);c&&a.push(c)}if(t?.length)for(let s=0;s<t.length;s++){let c=document.getElementsByClassName(t[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}if(r?.length)for(let s=0;s<r.length;s++){let c=document.querySelectorAll(r[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementById(t[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementsByClassName(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.querySelectorAll(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(t)||e.classList?.add(t))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(t)&&e.classList?.remove(t)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,t,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(t)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(t){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",t)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(e){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",e),!1}}setCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(e)}catch(t){this.loggingService.catch("Error in DomService setCustomCss: ",t)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getCustomCss$: ",e),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let t=this.customCss$.value;if(t){let r=e?.shadowRoot?.querySelector(`[${U.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(U.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(U.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(t){this.loggingService.catch("Error in DomService injectCustomCss: ",t)}}trimCommentHtml(e){try{let t=document.createElement("div");t.innerHTML=e,this.removeEmptyElements(t);let r=t.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(t){return this.loggingService.catch("Error in DomService trimCommentHtml: ",t),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var t=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.childNodes.forEach(t=>{t.nodeType===Node.TEXT_NODE?t.nodeValue=t.nodeValue?.replace(/\s+/g," ").trim()??"":t.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(t)})}catch(t){this.loggingService.catch("Error in DomService normalizeWhitespace: ",t)}}sanitizeHtml(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),$I.sanitize(e,hpe)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return $I.sanitize(e,hpe)}catch(t){return this.loggingService.catch("Error in DomService sanitizeSvg: ",t),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new Yn;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new Yn)}}getTabId(){try{let e=sessionStorage.getItem(U.SESSION_STORAGE.VELT_TAB_ID);!e&&this.tabId&&(e=this.tabId,sessionStorage.setItem(U.SESSION_STORAGE.VELT_TAB_ID,e)),!this.tabId&&e&&(this.tabId=e);let t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=on(),this.tabId=e,sessionStorage.setItem(U.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}catch(t){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",t)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo: ",e),new Yn}}isMobileDevice(){try{return new Yn().getDeviceType()===lr.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new Yn().getDeviceType()===lr.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new Yn().getDeviceType()===lr.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var t=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(r=>{t.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?t.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&t.appendChild(document.createTextNode(r.nodeValue))}),t}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let t=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",t)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(t){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",t)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(c=>{s.setAttribute(c.name,c.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new Yn().getDeviceType()===lr.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Xo),ee(y),ee(pl))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ue=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.afAuth=e,this.configService=t,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=c,this.analyticsService=p,this.loggingService=g,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new Vo,this.firebaseConfig$=new ve(null),this.advancedQueries$=new ve(null),this.planDetails$=new ve(null),this.signOutPreviousUser$=new ve(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=ei(this.afAuth).pipe(no(this.afAuth.currentUser),Ti(),fe(([f,I])=>this.domService.onNetworkStatusChange$().pipe(Fe(D=>D),ot(1),de(()=>({previousUser:f,currentUser:I}))))).subscribe(D=>Q(this,[D],function*({previousUser:f,currentUser:I}){if(!I&&f){let N=f?.stsTokenManager?.expirationTime,G=new Date().getTime(),z=N-G;G>N&&(this.analyticsService.trackEvent(Z.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(Z.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(Z.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(vt(Kt)).subscribe(f=>{let I=Er(f);this.coreActionsService.triggerAction(Un.USER_UPDATE,I),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Un.USER_UPDATE,payload:{user:I}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}setApiKey(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",e);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=e,this.configService.setApiKey(this.apiKey),t||(t=new U9),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||ei(this.afAuth).pipe(ot(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield sp(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&(s=yield this.updateUserWithColorAndTextColor(s),this.initializeClient(s,this.userOptions$?.value?T(E({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin"))}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService: ",t)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(t){this.loggingService.catch("Error in setDocService: ",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in setContactService: ",t)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(t){this.loggingService.catch("Error in setIamService: ",t)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(t){this.loggingService.catch("Error in setAreaService: ",t)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService: ",t)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(t){this.loggingService.catch("Error in setReactionService: ",t)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(t){this.loggingService.catch("Error in setRecorderAnnotationService: ",t)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(t){this.loggingService.catch("Error in setViewsService: ",t)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService: ",t)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;if(!e.user)return null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let r=yield iz(()=>window.Velt.identify(e.user,E(E({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}),e.retryConfig||{retryCount:0,retryDelay:0});return r&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(Un.ERROR).pipe(Fe(a=>a.code==="token_expired"),ot(10)).subscribe(a=>Q(this,null,function*(){if(a.code==="token_expired"){let s=this.docService?.getDocumentIds()?.map(D=>({id:D.clientDocumentId}))??[],c=this.docService?.getOptionsFromDocumentPaths()??void 0,p=[],g=this.docService?.getLocation();g&&p.push(g.location);let f=this.docService?.getLocations();f&&Object.values(f).forEach(D=>{p.push(D.location)}),(yield iz(()=>Q(this,null,function*(){try{let D=yield e.generateToken?.();return D?window.Velt.identify(e.user,E(E({},e.options||{}),D&&{authToken:D}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:s,options:c,source:"internal"}),yield this.docService?.setLocations({locations:p,source:"internal",options:{appendLocation:!g}}))}}))),r}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}setUserToStorage(e){return Q(this,null,function*(){try{if(e){let t=yield Il(e,e?.userId??"");localStorage.setItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER,t)}}catch(t){this.loggingService.catch("Error in setUserToStorage: ",t)}})}getUserFromStorage(e){return Q(this,null,function*(){try{let t=localStorage.getItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER);return t?yield $0(t,e?.userId??""):null}catch(t){return this.loggingService.catch("Error in getUserFromStorage: ",t),null}})}updateUserWithColorAndTextColor(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(e??{})),r=yield this.getUserFromStorage(t);return!r||Object.keys(r).length===0?(delete t?.color,delete t?.textColor,t):(r?.color&&(t.color=r?.color),r?.textColor&&(t.textColor=r?.textColor),t)}catch(t){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",t),e}})}updateUserIfRequired(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let t=yield this.getUserFromStorage(e),r={};if(e.color&&e.color!==t?.color&&(r.color=e.color),e.textColor&&e.textColor!==t?.textColor&&(r.textColor=e.textColor),Object.keys(r).length>0&&e.clientOrganizationId){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));sd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e.clientOrganizationId},user:T(E({},r),{userId:e.userId})},getSdkProxy:a,userId:e?.userId??""})}}catch(t){this.loggingService.catch("Error in updateUserIfRequired: ",t)}})}initializeClient(e,t,r,a,s){return Q(this,null,function*(){try{if(this.loggingService.logPerf(`[PERF] identify() called at ${performance.now().toFixed(2)}ms`),this.autoLoginRequired=!1,this.userOptions$.next(t),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=G0(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let c=yield ei(this.afAuth).pipe(ot(1)).toPromise().catch(g=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),c){let g=yield sp(c,!0).catch(D=>null);if(!g)return;let{user:f,firebaseConfig:I}=g.claims;if(c?.uid!==e?.userSnippylyId||e?.groupId!==f?.groupId||e?.organizationId!==f?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,I)||this.forceReLoginRequiredForCommentViews(e))localStorage.setItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield sp(c,!0).catch(J=>null);if(!D)return;let{firebaseConfig:N,user:G,advancedQueries:z}=D.claims;yield this.updateUserIfRequired(e),this.validateOrganizationId(e),this.setFirebaseConfig(N),this.setAdvancedQueries(z),G&&(this.providedUser.isAdmin=!!G.isAdmin),this.initializeSignedInUser(c,a,e),p=!1,this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let g=Ki(this.functions,Zi({url:Dn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),f=ga(),I=(yield g({apiKey:this.apiKey,user:e,version:f,authToken:t?.authToken}))?.data;if(I.error){if(this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_FAILED,T(E({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:I.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},I),{source:s}),!0,e.userSnippylyId,e.userId),I.error&&typeof I.error=="string")if(I.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(Un.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries.",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(Un.ERROR,D),this.analyticsService.trackEvent(Z.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}else{let D=I;this.coreActionsService.triggerAction(Un.ERROR,D)}throw I}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),I.firebaseConfig){this.setFirebaseConfig(I.firebaseConfig),yield this.signInWithCustomToken(e,I.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield sp(this.afAuth.currentUser,!0).catch(z=>null);if(!D)return;let{user:N,advancedQueries:G}=D.claims;this.setAdvancedQueries(G),this.providedUser.isAdmin=!!N?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a,e)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=ga();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}isVersion4Point5(){try{let e=ga();if(e){let t=e.split("."),r=parseInt(t[0]||"0"),a=parseInt(t[1]||"0"),s=parseInt(t[2]||"0");if(r>=4&&a>=5)return r===4&&a===5&&s===0?!e.toLowerCase().includes("beta"):!0}return!1}catch(e){return this.loggingService.catch("Error in isVersion4Point5: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(U.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",t),!1}}forceReLoginRequiredForCommentViews(e){try{let t=this.isVersion4Point5(),r=!1;try{let a=localStorage.getItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);a&&(r=JSON.parse(a))}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",t),!1}}forceReLoginRequiredForRegion(e,t){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!t?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:E(E({},Dn.firebaseConfig),e)})}catch(t){this.loggingService.catch("Error in setFirebaseConfig: ",t)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(U.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}catch(t){this.loggingService.catch("Error in setAdvancedQueries: ",t)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled$(){return dn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(de(()=>this.getAdvancedQueriesEnabled()),zn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),ei(this.afAuth).pipe(fe(e=>e?this.user$.asObservable():se(null)),vt(Kt))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let t=this.user$.value;if(e.userId&&e.userId!==t?.userId||e?.groupId&&e?.groupId!==t?.groupId||e?.organizationId&&e?.organizationId!==t?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=E(E({},this.providedUser),e),t){let r=E(E({},t),e);this.updateUserInternally(r)}}catch(t){this.loggingService.catch("Error in updateUser: ",t)}}signInWithCustomToken(e,t,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return oie(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let a=new Vo;a.userSnippylyId=e.uid,a.type="signedIn",r&&(a=E(E({},a),r)),this.setUserToStorage(a),this.mergeUserWithProvidedUserData(a,t)}catch(a){this.loggingService.catch("Error in initializeSignedInUser: ",a)}}mergeUserWithProvidedUserData(e,t){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.externalUserDataProviderAvailable()){let a=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0});a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=E(E({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?.color||this.providedUser?.color||this.getUserAvatarColor(e.userId),e.textColor=r?.textColor||this.providedUser?.textColor||this.getUserTextColor(e.userId),e.initial=r?.initial||this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let t=Object.assign({},e);delete t.contacts,this.analyticsService.identifyUser(e.userSnippylyId,t,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||this.getPlanDetailsFromDb();try{if(this.userPermissionService?.isPermissionProviderAvailable()&&e.clientOrganizationId){let r=[{userId:e.userId,resource:{id:e.clientOrganizationId,type:Mo.ORGANIZATION,source:qo.IDENTIFY,organizationId:e.clientOrganizationId}}],a=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:qo.IDENTIFY,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:r}}),yield this.userPermissionService?.onResourceAccessRequired({requests:r,uniqueId:a,userId:e.userId,methodName:qo.IDENTIFY,fromCache:!1})}}catch(r){this.loggingService.catch("Error in updateUserInternally: ",r)}this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(t){this.loggingService.catch("Error in updateUserInternally: ",t)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let t=JSON.parse(JSON.stringify(e)),r=T(E({},t),{lastUpdated:new Date})}catch(t){this.loggingService.catch("Error in updateUserToFirebase: ",t)}}getPlanDetailsFromDb(){return Q(this,null,function*(){try{this.getPlanDetailsCalled=!0;let t=yield Ki(this.functions,Zi({url:Dn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:ga(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(Z.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(t?.data||{planInfo:null,isPlanExpired:!1}),t}catch(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Fe(e=>!!e),de(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,t){try{this.preSignOutFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(t.metadata=e,this.userOrganization$.next(t)):this.userOrganization$.next(null)}catch(t){this.loggingService.catch("Error in setUserOrganization: ",t)}}setOrganizationUserGroups(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===t?.metadata?.organizationId&&(t.groups=e,this.userOrganization$.next(t))}catch(t){this.loggingService.catch("Error in setUserOrganizationGroups: ",t)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(fe(e=>e?this.userOrganization$.asObservable().pipe(de(t=>t?.metadata?.organizationId===e.organizationId?t:null)):se(null)))}signOutUser(e="internal"){return Q(this,null,function*(){try{e==="external"&&this.onRetrySubscription?.unsubscribe(),this.userPermissionService?.revokeAccessOnUserLogout(),yield this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let t=yield ei(this.afAuth).pipe(ot(1)).toPromise().catch(r=>null);if(t){this.resetServicesCache(),this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(t)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.user$.next(null),yield im(1e3),rie(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(t){this.loggingService.catch("Error in signOutUser: ",t)}})}isFeatureAllowed(e){return eo(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let t=JSON.parse(JSON.stringify(e));return delete t.contacts,t}else return null}catch(t){return this.loggingService.catch("Error in getUserWithoutContacts: ",t),null}}getUserForClient(e){try{return Er(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(Rn(e)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(e){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(e){try{e.forEach(t=>{try{t?.color||(t.color=this.getUserAvatarColor(t?.userId)),t?.textColor||(t.textColor=this.getUserTextColor(t?.userId)),!t?.initial&&(t?.name||t?.email)&&(t.initial=t.name?.charAt(0).toUpperCase()||t.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};o.\u0275fac=function(t){return new(t||o)(ee(Ai),ee(Rt),ee(dm),ee(ns),ee(Le),ee(Io),ee(et),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var mm=class{constructor({apiKey:o,documentId:n,organizationId:e,folderId:t,veltFolderId:r,clientDocumentId:a,clientOrganizationId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.folderId=t,this.veltFolderId=r,this.clientDocumentId=a,this.clientOrganizationId=s,a&&(this.documentId=Ir(a)),s&&(this.organizationId=Ja(s)),t&&(this.folderId=t,this.veltFolderId=ji(t)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var oR=class{constructor({apiKey:o,documentId:n,organizationId:e,clientDocumentId:t,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.veltFolderId=s,t&&(this.documentId=Ir(t)),r&&(this.organizationId=Ja(r)),a&&(this.folderId=a,this.veltFolderId=ji(a)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${U.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var rR=class{};var bn=(()=>{let o=class o{constructor(e,t){this.authService=e,this.loggingService=t,this.db$=new ve(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(mM(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ks=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new ve(null),this.commentAnnotationById$=new ve({}),this.fieldsToRemove=[],this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig),r.config?.fieldsToRemove&&(this.fieldsToRemove=r.config.fieldsToRemove))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((c,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return s(),c({});let f={},I=[...new Set(e.commentAnnotationIds||[])],D=T(E({},e),{commentAnnotationIds:I});Q(this,null,function*(){try{if(I.length>0||e.documentIds?.length||e.folderId){let G=ad(()=>g?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(z=>r?{}:(s(),z&&z.statusCode!==200?(this.loggingService.catch(z?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):z?.data)).catch(z=>{throw s(),z});try{f=(yield G)||{},this.analyticsService.trackEvent(Z.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:I});let z={};Object.entries(f).forEach(([J,ce])=>{let ye=this.commentAnnotationById$.value?.[J];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ce)&&(z[J]=ce):z[J]=ce}),Object.keys(z).length>0&&this.commentAnnotationById$.next(E(E({},this.commentAnnotationById$.getValue()),z)),c(z)}catch(z){r||p(z),c(f)}}else s(),c({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",t),{}}})}saveCommentAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let t=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=E(E({},r),e.commentAnnotation);let a=yield ad(()=>t?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=E({},a);delete s?.[e],this.commentAnnotationById$._value=s;let c=yield ad(()=>r?.delete({commentAnnotationId:e.toString(),metadata:t,event:Oa.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",t);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",e),this.fieldsToRemove}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",t)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var pm=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((c,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return s(),c({});let f={},I=[...new Set(e.reactionAnnotationIds||[])],D=T(E({},e),{reactionAnnotationIds:I});Q(this,null,function*(){try{if(I.length>0||e.documentIds?.length||e.folderId){let G=ad(()=>g?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(z=>r?{}:(s(),z&&z.statusCode!==200?(this.loggingService.catch(z?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):z?.data)).catch(z=>{throw s(),z});try{f=(yield G)||{},this.analyticsService.trackEvent(Z.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:I});let z={};Object.entries(f).forEach(([J,ce])=>{let ye=this.reactionAnnotationById$.value?.[J];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ce)&&(z[J]=ce):z[J]=ce}),Object.keys(z).length>0&&this.reactionAnnotationById$.next(E(E({},this.reactionAnnotationById$.getValue()),z)),c(z)}catch(z){r||p(z),c(f)}}else s(),c({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",t),{}}})}saveReactionAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let t=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=E(E({},r),e);let a={reactionAnnotation:e,event:Oa.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield ad(()=>t?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=E({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let c=yield ad(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:t,event:Oa.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",t);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",t)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var rt=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.analyticsService=e,this.authService=t,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=c,this.commentResolverService=p,this.reactionResolverService=g,this.coreActionsService=f,this.functions=I,this.documentPaths$=new ve(null),this.docContext$=new ve(null),this.documentIds$=new ve([]),this.organizationConfig$=new ve(null),this.firestorePaths$=new ve(null),this.location$=new ve(null),this.excludedLocationIds$=new ve([]),this.organizationMetadata$=new ve(null),this.documentMetadata$=new ve(null),this.locationMetadata$=new ve(null),this.customerMetadata$=new ve(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new ve({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new ve({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new tt,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe($o(this.DEBOUNCE_TIME)).subscribe({next:D=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(D.documentId,D.clientOrganizationId,D.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:D=>{this.loggingService.catch("Error in setDocumentId subscription:",D),this.queueSize--}}),this.databaseService.getDb().pipe(Fe(D=>!!D),ot(1)).subscribe(D=>{D&&(this.db=D)}),this.configService.getApiKey$().subscribe(D=>{if(this.apiKey=D,this.apiKey){if(!this.isCustomDocId){let N=Tk(window.location.href);this.currentUrl=N}this.analyticsService.updateDefaultProperties({apiKey:D})}}),this.authService.getUser$().subscribe(D=>Q(this,null,function*(){if(D&&(this.analyticsService.updateDefaultProperties({organizationId:D?.organizationId,clientOrganizationId:D?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&D?.organizationId&&this.documentPaths$.value?.organizationId!==D?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(N=>({id:N.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),D?.organizationId&&D?.clientOrganizationId)){let N={organizationId:D?.organizationId,clientOrganizationId:D?.clientOrganizationId};this.getOrganizationConfig()||this.organizationConfig$.next({organizationId:D?.organizationId,clientOrganizationId:D?.clientOrganizationId}),yield this.updateOrganizationMetadata(N)}})),this.documentPaths$.subscribe(D=>{let N={documentId:D?.documentId,clientDocumentId:D?.clientDocumentId,folderId:D?.folderId,allDocuments:D?.allDocuments,veltFolderId:D?.veltFolderId};D?.organizationId&&(N.organizationId=D.organizationId,N.clientOrganizationId=D.clientOrganizationId),this.analyticsService.updateDefaultProperties(N),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(D=>{this.analyticsService.updateDefaultProperties({clientLocation:D?.location,locationId:D?.locationId})}),this.organizationMetadata$.subscribe(D=>{this.authService.setUserOrganization(D?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Fe(D=>!!D),ot(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(D){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",D)}},D=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",D)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(D){this.loggingService.catch("Error in DocService constructor:",D)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,organizationId:this.documentPaths$.value?.clientOrganizationId}:null}catch(e){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",e),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.organizationConfig$.next(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(e=>e.location)].filter(e=>e!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setCommonDbService(e){try{this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService:",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService:",t)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService:",t)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=Tk(location.href);this.currentUrl!==e&&(this.currentUrl=e,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowPopstate: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let e=Tk(location.href);this.currentUrl!==e&&(this.currentUrl=e,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowClick: ",e)}}setDocument(s){return Q(this,arguments,function*({documentId:e,documentMetadata:t,options:r,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),a==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pa.SET_DOCUMENTS,source:a,payload:{documentId:e,documentMetadata:t,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:E({organizationId:t?.organizationId},r??{}),source:a})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}shouldSetDocumentsAgain(e,t={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentPaths$.value?.clientDocumentId,a=t?.rootDocumentId??e[0]?.id,s=this.documentIds$.value.map(g=>g.clientDocumentId),c=YH(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(g=>s.includes(g.id))||!gi(c,t)||r!==a}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:t=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,c=`${Rn(s)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:c,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(s){return Q(this,arguments,function*({documents:e,options:t,source:r="internal",skipPermissionValidation:a=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:r}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pa.SET_DOCUMENTS,source:r,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:r,skipPermissionValidation:a})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}setRootDocument(r){return Q(this,arguments,function*({document:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Pa.SET_ROOT_DOCUMENT,source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(c=>c.clientDocumentId);if(!s.includes(e.id)){let c=[...s.map(g=>({id:g})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:c,setClientDocumentMetadataMap:!0});this.documentIds$.next(p)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocContext(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let t=JSON.parse(JSON.stringify(e??null));this.docContext$.next(t)}catch(t){this.loggingService.catch("Error in setDocContext: ",t)}}getDocContext(){return this.docContext$.getValue()}getProcessedDocContext(){return Jle(this.getDocContext())}filterRelevantDocuments(a){return Q(this,arguments,function*({options:e,documentIds:t,skipPermissionValidation:r=!1}){try{let s=this.authService.getUser();return!s||!this.commonDbService?.shouldUseFirestore()||(t=yield this.fetchDocumentsFromFolder(e,t,s),yield this.handlePermissionProvider(e,t,s),t=yield this.filterDocumentsByPermissions(e,t,s,r),t=t.slice(0,50)),t}catch(s){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",s),t}})}fetchDocumentsFromFolder(e,t,r){return Q(this,null,function*(){if(!e?.folderId||!e?.allDocuments)return t;try{let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield sd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:e?.organizationId??r?.clientOrganizationId,folderId:e?.folderId}},getSdkProxy:a,userId:r?.userId??""}))?.data?.forEach(c=>{t.find(p=>p.clientDocumentId===c.id)||t.push({documentId:Ir(c.id),clientDocumentId:c.id})})}catch(a){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",a)}return t})}buildPermissionRequests(e,t,r){try{let a=[];return e.organizationId&&e.organizationId!==r.clientOrganizationId&&a.push({userId:r.userId,resource:{id:e.organizationId,type:Mo.ORGANIZATION,source:qo.SET_DOCUMENTS,organizationId:e.organizationId}}),e.folderId&&a.push({userId:r.userId,resource:{id:e.folderId,type:Mo.FOLDER,source:qo.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}}),t&&t.forEach(s=>{a.push({userId:r.userId,resource:{id:s.clientDocumentId,type:Mo.DOCUMENT,source:qo.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}})}),e?.context&&this.userPermissionService?.getIsContextEnabled()&&ece({input:e?.context}).forEach(c=>{let p=JSON.stringify(c.access);a.push({userId:r.userId,resource:{id:p,type:Mo.CONTEXT,source:qo.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??"",context:c}})}),a}catch(a){return this.loggingService.catch("Error in buildPermissionRequests:",a),[]}}processAccessibleContexts(e,t){try{if(!e?.success||!e?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let r=e.data.filter(a=>a.type===Mo.CONTEXT&&a.hasAccess).map(a=>a.resourceId);if(r?.length){let a=t.filter(c=>r.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),s=tce({input:a});s?.access&&this.setDocContext(s)}}catch(r){this.loggingService.catch("Error in processAccessibleContexts:",r)}}handlePermissionProvider(e,t,r){return Q(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{let a=this.buildPermissionRequests(e,t,r),s=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:qo.SET_DOCUMENTS,uniqueId:s,timestamp:new Date().getTime(),source:"internal",payload:{requests:a}});let c=yield this.userPermissionService?.onResourceAccessRequired({requests:a,uniqueId:s,methodName:qo.SET_DOCUMENTS,fromCache:!1});this.processAccessibleContexts(c,a)}catch(a){this.loggingService.catch("Error in handlePermissionProvider:",a)}})}filterDocumentsByPermissions(e,t,r,a=!1){return Q(this,null,function*(){if(a)return t;let s=this.currentValidationToken,c=[...t];return s&&this.validatePermissionsInBackground(e,t,r,s),c})}validatePermissionsInBackground(e,t,r,a){let s=e?.organizationId??r?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:t.map(c=>c.clientDocumentId),folderIds:e?.folderId?[e?.folderId]:[]}).then(c=>{if(this.currentValidationToken===a&&c){this.userPermissionService?.setCurrentUserPermissions(c);let p=[];Object.entries(c?.[r.userId]?.documents??{}).forEach(([g,f])=>{f?.errorCode===ko.PERMISSION_DENIED&&p.push(g)}),s&&c?.[r.userId]?.organization?.[s]?.errorCode===ko.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),e?.folderId&&c?.[r.userId]?.folders?.[e?.folderId]?.errorCode===ko.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${e?.folderId}`,void 0,void 0,!0),p.length>0&&(this.loggingService.catch(`User does not have access to documents: ${p.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(p,r,a))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(e,t,r){try{if(this.currentValidationToken!==r)return;let a=this.documentPaths$.value;this.coreActionsService.triggerAction(Un.ERROR,{event:Z.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:e,userId:t.userId,timestamp:new Date().getTime()});let s=this.documentIds$.value||[],c=s.filter(p=>!e.includes(p.clientDocumentId));c.length!==s.length&&(c.length>0?this.setDocuments({documents:c.map(p=>({id:p.clientDocumentId})),options:{organizationId:a?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(Un.ERROR,{event:Z.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:e,userId:t.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(a){this.loggingService.catch("Error in handleDeniedDocumentAccess:",a)}}addUserInfoToOrganization(r){return Q(this,arguments,function*({organizationId:e,user:t}){try{let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield sd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e},user:t},getSdkProxy:a,userId:t?.userId??""})}catch(a){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",a)}})}setDocumentsImpl(s){return Q(this,arguments,function*({documents:e,options:t,source:r,skipPermissionValidation:a=!1}){try{let c=t?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,YH(T(E({},t),{organizationId:c})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let p=on();this.currentValidationToken=p;let g=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(g?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let f=this.authService.getUser();if(!f){this.draftDocuments=e,this.draftOptions=t;return}if(this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1}),this.addUserInfoToOrganization({organizationId:t?.organizationId??f?.clientOrganizationId??"",user:f}),g=yield this.filterRelevantDocuments({options:t,documentIds:g,skipPermissionValidation:a}),this.documentIds$.next(g),g?.length){let I=g[0]?.clientDocumentId;t?.rootDocumentId&&g.find(D=>D.clientDocumentId===t?.rootDocumentId)&&(I=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:I,clientOrganizationId:t?.organizationId,options:t})}return}catch(c){this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}setDocumentId(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:r}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pa.SET_DOCUMENT_ID,source:r,payload:{documentId:e,clientOrganizationId:t}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:t},source:r})}catch(s){this.loggingService.catch("Error in setDocumentId:",s);return}})}debounceSetDocuments(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),c=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||c>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,t,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:t,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,t,r){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let s=this.currentDocumentId;if(this.apiKey){let c=`${Rn(e)}`,p=r?.folderId,g=r?.folderId?ji(r?.folderId):void 0,f=r?.locationId,I=r?.allDocuments,D=a?.organizationId?t?Et(t):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(N=>N.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(N=>N.clientDocumentId),organizationId:t??a?.clientOrganizationId??""})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let N=new H9,G=new rR;N.clientDocumentId=e,G.clientDocumentId=e,N.folderId=p,G.folderId=p,N.locationId=f,G.locationId=f,N.allDocuments=I,G.allDocuments=I,N.veltFolderId=g,G.veltFolderId=g,N.documentId=c,G.documentId=c,D&&(N.organizationId=D,N.clientOrganizationId=t??a?.clientOrganizationId,G.organizationId=D,G.clientOrganizationId=t??a?.clientOrganizationId);let z=`${this.apiKey}`,J=`apiKey/${this.apiKey}`;D&&(z=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${N.organizationId}`,J=`${J}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${N.organizationId}`),G.organization=`apiKey/${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,G.document=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,N.presence=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,N.cursor=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,N.comment=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,G.comment=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,N.multiThread=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,G.multiThread=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,N.tag=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,N.area=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,G.area=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}`,N.arrow=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,N.selection=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,N.audioHuddle=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,N.huddle=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,N.recorder=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,G.recorder=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,N.flock=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,N.syncVideoPlayer=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,N.liveState=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,N.liveStateSingleEditorMode=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,N.reaction=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,G.reaction=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,N.crdt=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,G.crdt=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,N.customerMetadata=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,N.views=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,G.notificationViews=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,G.documentViews=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,G.locationViews=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,N.notifications=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,N.metadata=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,N.users=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,N.documentIam=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,N.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,N.groupContacts=`${z}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,N.globalContacts=`${z}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,N.logins=`${z}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,N.userFeedback=`${z}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,N.userReportBugs=`${z}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,N.userContactUs=`${z}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(N.organizationMetadata=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,N.organizationIam=`${z}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,N.organizationGroups=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,N.organizationNotifications=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(N.organizationNotificationsWithDocumentId=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,N.heartbeatByDocument=`${z}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),N.organizationNotificationsLastNotificationTimestamp=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,N.organizationNotificationsUsers=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,N.heartbeat=`${z}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),G.organizationUsers=`${J}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,G.users=`${J}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,G.documentUsers=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,G.notificationDocs=`${J}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,G.notificationUsers=`${J}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,!this.documentPaths$.value&&this.loggingService.logPerf(`[PERF] documentPaths$ FIRST SET at ${performance.now().toFixed(2)}ms`),this.documentPaths$.next(N),this.firestorePaths$.next(G),N?.clientOrganizationId&&N?.organizationId&&!(N?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&N?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.organizationConfig$.next({organizationId:N?.organizationId,clientOrganizationId:N?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:e}}),this.analyticsService.trackEvent(Z.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Pa.UNSET_DOCUMENT_ID,source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),this.userPermissionService?.revokeAccessOnDocumentUnset(),t&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(Z.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments({source:e,unsetDocumentPaths:t=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:Pa.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[t,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(t){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",t)}})}fetchOrganizationMetadata(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig()),this.db&&e?.organizationId){let t=e?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:t,field:"metadata"}}).then(r=>{r&&!r?.errorCode&&this.organizationMetadata$.next(T(E({},this.organizationMetadata$.value),{[t]:r}))}).catch(r=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",r)})}}catch(t){this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)}})}fetchDocumentMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!t)return;if(this.commonDbService?.shouldUseFirestore()){let a=t?.folderId,s=[],c={organizationId:t?.clientOrganizationId,folderId:a},p=[],g=20;for(let I=0;I<e.length;I+=g)p.push(e.slice(I,I+g));p.forEach(I=>{let D=JSON.parse(JSON.stringify(c));D.documentIds=I.map(N=>N.clientDocumentId),s.push(this.fetchDocuments(D))});let f={};s.length>0&&(yield Promise.all(s).then(I=>{I?.forEach(D=>{D?.forEach(N=>{N?.metadata?.documentId&&(f[N.metadata.documentId]=N.metadata)})}),this.setAllDocumentMetadata(E(E({},this.documentMetadata$.value),f))}).catch(I=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",I)}))}else r?.[t?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:t?.organizationId,documentId:t?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.setDocumentMetadata(a.documentId,a)}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(t){this.loggingService.catch("Error in fetchDocumentMetadata: ",t)}})}fetchLocationMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,t=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],c={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a},p=[],g=20;for(let I=0;I<t.length;I+=g)p.push(t.slice(I,I+g));p.forEach(I=>{let D=JSON.parse(JSON.stringify(c));D.documentIds=I.map(N=>N.clientDocumentId),s.push(this.fetchLocations(D))});let f=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(I=>{I?.forEach(D=>{D?.forEach(N=>{N?.metadata?.documentId&&(f[N.metadata.documentId]=T(E({},f?.[N.metadata.documentId]??{}),{[N.location.id]:N}))})}),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}).catch(I=>{this.loggingService.catch("Error in fetchLocationMetadata: ",I)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(zn(t=>se(null))).subscribe(t=>{this.customerMetadata$.next(t?.data)}))}catch(e){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",e)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(de(e=>e?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(e){try{return`${Rn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${Et(e)}`}catch(t){return this.loggingService.catch("Error in generateOrganizationId: ",t),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:Pa.SET_LOCATION,payload:{locations:[e],options:void 0}}),this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return Q(this,arguments,function*({locations:e,options:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:r}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Pa.SET_LOCATIONS,source:r,payload:{locations:e,options:t}}),this.setLocationsImpl({locations:e,options:t})}catch(s){this.loggingService.catch("Error in setLocations: ",s)}})}getValidLocations(e){try{let t=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&t.push(r)}}),t}catch(t){this.loggingService.catch("Error in getValidLocations: ",t)}return e}setRootLocation(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Pa.SET_ROOT_LOCATION,source:t,payload:{location:e}});let a=Object.values(this.locations$.value).map(s=>s.location).filter(s=>String(s.id)!==String(e.id));this.setLocationsImpl({locations:[e,...a],options:{rootLocationId:e.id}})}catch(a){this.loggingService.catch("Error in DocService setRootLocation:",a)}})}setLocationsImpl({locations:e,options:t}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0)return;if(!this.authService.getUser()){!t?.appendLocation&&e.length>0&&(this.draftLocationMap.options=T(E(E({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=E(E({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),s=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(f=>f.location.id)].filter(f=>f!==void 0);let p;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(f=>f.id===t?.rootLocationId),!p)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${t?.rootLocationId} not found in locations.`);return}if(t?.appendLocation){if(p){let f=tr(p),I=Rn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}}else{p||(p=a[0]);let f=tr(p),I=Rn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}let g=[];return a.slice(t?.appendLocation?0:1).forEach(f=>{if(f.id!==this.location$.value?.location.id){let I=E({},f),D=this.locations$.value;f?.id&&Object.keys(D).forEach(J=>{let ce=D[J];ce.location?.id===f.id&&(I=E(E({},ce.location),f),delete D?.[J])});let N=this.genarateLocationId(I),G={locationId:N,location:I};I.id&&s.push({locationId:N,location:I}),g.push(G);let z=T(E({},D),{[N]:G});this.locations$.next(z)}}),this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Pa.SET_LOCATIONS,payload:{locations:a,options:t}}),this.analyticsService.trackEvent(Z.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),g}catch(r){this.loggingService.catch("Error in setLocationImpl: ",r);return}}addLocation({location:e,source:t="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Pa.ADD_LOCATION,source:t,payload:{locations:[e],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(r){this.loggingService.catch("Error in DocService addLocation:",r);return}}removeLocation({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:Pa.REMOVE_LOCATION,payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],t)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations({locations:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Pa.REMOVE_LOCATIONS,source:t,payload:{locations:e}}),this.removeLocationsImpl(e,t)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationsImpl(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:t},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(Z.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}unsetLocationIds(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Pa.UNSET_LOCATION_IDS,source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(r=>{this.getLocation()?.location.id===r&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==r))),this.removeCustomLocationId(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Pa.REMOVE_LOCATIONS_SUCCESS,source:t,payload:{locationIds:e}}),this.analyticsService.trackEvent(Z.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetLocationIds: ",r)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(t){this.loggingService.catch("Error in excludeLocationIds: ",t)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(e){return Q(this,null,function*(){try{!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig());let t=e?.organizationId,r=this.documentPaths$.value;if(this.db&&t&&r?.documentId){if(this.organizationMetadata$.value?.[t])return;let s=new eR;s.apiKey=this.configService?.getApiKey()??"",s.organizationId=t,s.clientOrganizationId=e?.clientOrganizationId,this.userPermissionService?.hasEditAccess({organizationId:t})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:t,documentId:r?.documentId??""}})),yield this.fetchOrganizationMetadata(e)}}catch(t){this.loggingService.catch("Error in updateOrganizationMetadata: ",t)}})}updateFolderMetadata(){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let e=this.documentPaths$.value;if(!e?.veltFolderId||!e?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:e?.veltFolderId??""}}))?.metadata){let r={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:e?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield sd({methodName:"createFolder",data:{type:"createFolder",metadata:r},getSdkProxy:a,userId:this.authService.getUser()?.userId??""})}}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let t=this.getDocumentIds();t.find(a=>a.documentId===e.documentId)||t.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let r=t.map(a=>Q(this,null,function*(){let s=new $9;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=E(E({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=E(E({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=Mi();let c=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let g=!0,f=this.documentMetadata$.value?.[a.documentId];if(c&&p){let I=this.getDocumentMetadata(a?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}}));I?.clientDocumentId&&!I?.errorCode?I?.folderId&&(I?.folderId!==c||I?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),g=!1):I?.folderId===c?(c&&(s.folderId=c),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${c??""}`),g=!1):(c&&(s.folderId=c),p&&(s.veltFolderId=p))}if(f){let I={};Object.entries(s).forEach(([D,N])=>{I[D]=N}),gi(I,f)&&(g=!1)}g&&this.userPermissionService?.hasEditAccess({documentId:a?.documentId??"",folderId:e?.allDocuments&&e?.veltFolderId?e?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(r),yield this.fetchDocumentMetadata(t)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let r=this.getDocumentIds();r.find(a=>a.documentId===t.documentId)||r.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}});s?.errorCode&&(s={});let c=[];for(let p of e){let g=new q9;g.locationId=p?.locationId,g.veltLocationId=zH(p?.location?.id??""),g.location=p?.location,g.pageInfo=Mi(),g?.pageInfo?.deviceInfo&&delete g?.pageInfo?.deviceInfo;let f=T(E({},s),{[U.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(E({},s[U.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:g})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let I=this.locationMetadata$.value;if(I||(I={}),p?.location?.id){let D=I?.[a.documentId],N=D?.[p?.location?.id??""];I&&(D||(I[a.documentId]={}),N||(I[a.documentId][p?.location?.id??""]={}),I[a.documentId][p?.location?.id??""]=T(E({},N),{location:p?.location})),Object.keys(I||{}).length>0&&this.locationMetadata$.next(I)}}yield Promise.allSettled(c)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Rn(JSON.stringify(tr(e))):0}catch(t){return this.loggingService.catch("Error in genarateLocationId: ",t),0}}removeCustomLocation(e,t="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(E({},a)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}removeCustomLocationId(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let r=this.locations$.value;Object.entries(r).forEach(([a,s])=>{s.location.id===e&&(delete r[a],this.locations$.next(E({},r)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.id!==e)))})}catch(r){this.loggingService.catch("Error in DocService removeCustomLocationId:",r)}}getLocationByClientLocationId(e){try{let t=this.getLocation()?.location;if(t?.id===e)return t;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(t=s.location)})}return t}catch(t){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",t);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,t=document.querySelectorAll(`[${U.ATTRIBUTES.VELT_LOCATION}]`),r=[];t.forEach(a=>{let s=a.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(s){let c=JSON.parse(s),p=this.genarateLocationId(c);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(E({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let t=null;if(e?.getAttribute(U.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${U.ATTRIBUTES.VELT_LOCATION}]`),t){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);return{locationId:this.genarateLocationId(a),location:a}}}return null}catch(t){return this.loggingService.catch("Error in DocService getLocationFromElement:",t),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let e={};return document.querySelectorAll(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let c={id:a},p=this.genarateLocationId(c);e[a]={element:r,location:{locationId:p,location:c}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let t;if(t=e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(t){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",t),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${U.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(U.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(t){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",t),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadata:",t),null}}getAllDocumentMetadata$(e){return this.getAllDocumentMetadataMap$().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),vt(Kt))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(de(e=>e||{}),vt(Kt))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},t={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(t[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(c=>{let p=e?.[c.documentId];p&&(t[c.documentId]=p)});else if(this.documentPaths$.value?.documentId){let c=e?.[this.documentPaths$.value?.documentId];c&&(t[this.documentPaths$.value?.documentId]=c)}}return Object.values(t)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),vt(Kt))}setDocumentMetadata(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let r=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));r[e]=t,this.documentMetadata$.next(r)}catch(r){this.loggingService.catch("Error in DocService setDocumentMetadata:",r)}}setAllDocumentMetadata(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(e)}catch(t){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",t)}}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(de(t=>t?.[e]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(de(e=>e||{}),vt(Kt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(vt(Kt))}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,t){try{switch(e){case"area":return;case"comment":return t?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(t.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return t?.commentAnnotationId?this.commentService?.getAnnotationById(t.commentAnnotationId)?.metadata:void 0;default:return}}catch(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:t}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=t||r.documentId,c=this.getDocumentMetadata(s);if(!c)return;let p=c?.folderId,g=c?.veltFolderId;return E(E({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),g?{veltFolderId:g}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,t){try{let r,a;t?.element?r=this.getAdditionalDocumentIdFromElement(t.element)||void 0:t?.clientDocumentId&&(r=t.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,t),c=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||c||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:t}){try{return e&&(e=this.generateDocumentId(e)),t&&(t=this.generateOrganizationId(t)),{documentId:e,organizationId:t}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=ji(e?.folderId);r.push(ht("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ht("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchDocuments:",t),[]}})}fetchLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=ji(e?.folderId);r.push(ht("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ht("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchLocations:",t),[]}})}updateDocuments(e){return Q(this,null,function*(){try{if(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,documents:a,folderId:s}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let c=Ja(r);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let p=[],g=this.documentMetadata$.value??{};for(let f of a)if(f?.documentId){f.organizationId=c,f.clientOrganizationId=r,f.clientDocumentId=f.documentId;let I=Ir(f.documentId);f.documentId=I,f.apiKey=this.configService.getApiKey()??void 0,(s||this.documentPaths$.value?.folderId)&&(f.folderId=s||this.documentPaths$.value?.folderId,f.veltFolderId=ji(s||this.documentPaths$.value?.folderId||""));let D=()=>{if(s&&this.documentPaths$.value?.folderId&&s!==this.documentPaths$.value?.folderId)return;let G=g?.[I];G?g[I]=E(E({},G),f):g[I]=f},N=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:I,organizationId:c,field:"metadata"}});if(N?.errorCode&&(N={}),N&&N.apiKey&&N.folderId&&s&&N.folderId!=f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists with different folderId: ${N.folderId}`);continue}if(N&&N.apiKey&&!N.folderId&&f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists, move this document to folder with REST API`);continue}D(),f&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:f?.documentId??""})&&p.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{organizationId:c,documentId:I}}))}yield Promise.all(p),this.setAllDocumentMetadata(g)}catch(t){return this.loggingService.catch("Error in DocService updateDocuments:",t),[]}})}updateLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(f=>f.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=s.map(f=>Ir(f)),p=[],g=this.locationMetadata$.value;g||(g={}),c.forEach(f=>{a.forEach(I=>{let D=this.location$.value;if(I?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:I}),I?.id){delete I?.metadata;let N=zH(I.id),G=g?.[f],z=G?.[I.id];g&&(G||(g[f]={}),z||(g[f][I.id]={}),g[f][I.id]=T(E({},z),{location:I})),I&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:I})),properties:{organizationId:Ja(r),documentId:f,id:N}}))}})}),yield Promise.all(p),Object.keys(g||{}).length>0&&this.locationMetadata$.next(g)}catch(t){return this.loggingService.catch("Error in DocService updateLocations:",t),[]}})}fetchFolders(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let c=ji(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[ht("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(fe(e=>e?this.documentPaths$.pipe(fe(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(de(r=>r?.data?.docIamConfig??r?.data),vt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?Ei.RESTRICTED:Ei.PUBLIC:e&&e.documentAccessType?e.documentAccessType:Ei.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),Ei.PUBLIC}}changeDocumentAccessType(e){return Q(this,null,function*(){try{let t=this.documentPaths$.value;if(t){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",field:"docIamConfig"}});if(r?.errorCode)return;switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case Ei.PUBLIC:r.features.all.restricted=!1;break;case Ei.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??""}})}}catch(t){this.loggingService.catch("Error in DocService changeDocumentAccessType:",t)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(E(E({},this.uiState.value),e))}catch(t){this.loggingService.catch("Error in DocService setUIState:",t)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(bn),ee(Le),ee(Rt),ee(y),ee(Ks),ee(pm),ee(ns),ee(Io))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Fn=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.authService=t,this.docService=r,this.loggingService=a,this.resolveOrganizationUsers=new ve(!0),this.resolveFolderUsers=new ve(!0),this.resolveDocumentUsers=new ve(!0),this.unresolvedUsers=new ve([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new Tn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(c){this.loggingService.catch("Error in UsersService getUserById:",c);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Fe(s=>!!s),fe(()=>this.getUnresolvedUsers$().pipe(Fe(s=>s.length>0),$o(300),ot(20),fe(s=>{let c=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:c,isCollection:!0,useQuery:!0,firestoreQuery:[_i(ht("user.userId","in",s.slice(0,20)))]}}).pipe(de(p=>p?.data),tn(p=>{if(p&&typeof p=="object"){delete p.undefined,delete p.null;let g=Object.values(p??{});this.setUserByIds(g.map(I=>I.user));let f=s.filter(I=>!g.some(D=>D.user.userId===I));f.length!==s.length&&this.setUnresolvedUsers(f)}})):se([])})))).subscribe()}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in UsersService setCommonDbService:",t)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}isResolverForFeatureDisabled(e){let t=this.userDataProvider$.getValue();try{switch(e){case"allOrganizationUsers":return t?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return t?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return t?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(r){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",r),!1}}resolveUsers(c){return Q(this,arguments,function*({userIds:e,forceResolve:t,feature:r,organizationId:a,skipUserCheck:s=!1}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let p=!1;if(r&&(p=this.isResolverForFeatureDisabled(r)),p)return{};{let g={},f=[],I={};if(e?.forEach(D=>{let N=this.getUserById(D);N?g[D]=N:this.userByIdCalled$.getValue()[D]?t&&f.push(D):(f.push(D),this.userByIdCalled$.next(T(E({},this.userByIdCalled$.getValue()),{[D]:!0})))}),f.length>0){let D={};try{let N,G=new Promise((z,J)=>{N=setTimeout(()=>{J(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});D=yield Promise.race([this.getUsersFromDB({userIds:f,organizationId:a,skipUserCheck:s}).finally(()=>{clearTimeout(N)}),G]),this.analyticsService.trackEvent(Z.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:f})}catch(N){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",N,{userIds:f})}finally{f?.forEach(N=>{if(!D[N]){let G=new Set([...this.getUnresolvedUsers(),N]);this.unresolvedUsers.next(Array.from(G)),D[N]={userId:N,name:`User ${N}`}}})}Object.entries(D).forEach(([N,G])=>{G&&(g[N]=D?.[N],I[N]=D?.[N])})}return Object.keys(I).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(I)),this.userById$.next(E(E({},this.userById$.getValue()),I))),g}}catch(p){return this.loggingService.catch("Error in UsersService resolveUsers:",p),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(e){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",e),[]}}setUnresolvedUsers(e){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(e)){let t=JSON.parse(JSON.stringify(e));this.unresolvedUsers.next(t)}}catch(t){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",t)}}getUsersFromDB(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let s=this.userDataProvider$.getValue();if(s)return s.get(e);if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:r}))??[],p={};return c.forEach(g=>{g.forEach(f=>{f?.user?.userId&&(p[f.user.userId]=f.user)})}),p}catch(s){return this.loggingService.catch("Error in UsersService getUsersFromDB:",s),{}}})}getUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){try{if(!e?.length)return[];let s=[];for(let g=0;g<e.length;g+=30)s.push(e.slice(g,g+30));let c=s.map((g,f)=>Q(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ht("user.userId","in",g)],skipUserCheck:r}}))||[]}catch(I){return this.loggingService.catch(`Error in batch ${f+1}:`,I),[]}}));return yield Promise.all(c)}catch(s){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",s),[]}})}getTemporaryUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,resourceIds:r}){try{if(!e?.length||!r?.length)return[];let s=[];for(let G=0;G<e.length;G+=30)s.push(e.slice(G,G+30));let c=[];for(let G=0;G<r.length;G+=30)c.push(r.slice(G,G+30));let p=[],g=0,f=(G,z)=>Q(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[_i(ht("userId","in",G),ht("veltResourceId","in",z))]}}))??[])||[]}catch(J){return this.loggingService.catch(`Error in batch ${g+1}:`,J),[]}});for(let G of s)for(let z of c)p.push(f(G,z)),g++;return(yield Promise.all(p)).flat().filter((G,z,J)=>z===J.findIndex(ce=>ce.userId===G.userId&&ce.resourceId===G.resourceId))}catch(s){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",s),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable().pipe(vt(Kt))}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserByIds(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;");let t=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));e.forEach(r=>{t[r.userId]=E(E({},t?.[r.userId]??{}),r)}),this.userById$.next(t)}catch(t){this.loggingService.catch("Error in UsersService setUserByIds:",t)}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;"),this.userDataProvider$.next(e),e.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),e.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),e.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(t){this.loggingService.catch("Error in UsersService setUserDataProvider:",t)}}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",e),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var fpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",t),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",t),e}}formatAreaData(e){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",t),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",t),e}}formatArrowData(e){try{return this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: formatArrowData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Yg=class{static getFirestoreProdDbName(o,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(n){return nt.error("Error in isTestingDb:",n),!1}}};var Kg=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new ve(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let t=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield ad(()=>t?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(Z.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(t){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",t);return}})}deleteAttachment(r){return Q(this,arguments,function*({attachmentId:e,metadata:t}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield ad(()=>a?.delete({attachmentId:e,metadata:t,event:Oa.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",t)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Zg=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=c,this.attachmentResolverService=p,this.coreActionsService=g,this.notificationActionTypeMap={[$t.NEWLY_ADDED]:Oa.COMMENT_ANNOTATION_ADD,[$t.ADDED]:Oa.COMMENT_ADD,[$t.UPDATED]:Oa.COMMENT_UPDATE,[$t.DELETED]:Oa.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",t)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let r of e){if(r?.from?.userId&&t.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&t.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&t.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&t.add(s?.userId)}if(r?.assignedTo?.userId&&t.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&t.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.unsubscribedUsers))a.user.userId&&t.add(a.user.userId)}return Array.from(t)}catch(t){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",t),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.comments)for(let t of e?.comments){if(t?.from?.userId){let a=this.usersService.getUserById(t?.from?.userId);a&&(t.from=a)}t?.to&&(t.to=t?.to?.map(a=>{if(a?.userId){let s=this.usersService.getUserById(a?.userId);if(s)return E(E({},a),s)}return a})),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(t?.taggedUserContacts?.filter((a,s,c)=>c.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(od(`{{${a.userId}}}`),"g");t.commentText?.includes(`@User ${a.userId}`)&&(s=new RegExp(od(`@User ${a.userId}`),"g")),t.commentText=t.commentText?.replaceAll(s,a.text),t.commentHtml=t.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let t=this.usersService.getUserById(e?.assignedTo?.userId);t&&(e.assignedTo=t)}if(e?.subscribedUsers)for(let t of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let t of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",t),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(t=>{t?.commentText&&t?.commentText?.length>0&&(t.isCommentTextAvailable=!0)}),e?.viewedBy&&delete e.viewedBy,e?.comments&&e.comments.forEach(t=>{t?.reactionAnnotations&&delete t.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let t of Object.keys(e?.subscribedUsers))e.subscribedUsers[t].user={userId:e?.subscribedUsers[t].user.userId};if(e?.unsubscribedUsers)for(let t of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[t].user={userId:e?.unsubscribedUsers[t].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(t=>this.formatCommentThreadData(t))),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",t),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(s=>{let c=t?.comments?.[s?.commentId];if(c){s.commentHtml=c?.commentHtml,s.commentText=c?.commentText;let p=c?.attachments;r&&p&&s.attachments?.forEach(g=>{let f=g?.attachmentId;p?.[f]&&(g.name=p?.[f]?.name,g.url=p?.[f]?.url)})}}),t?.targetTextRange?.text&&e?.targetTextRange&&(e.targetTextRange.text=t?.targetTextRange?.text),a?.length>0&&a.forEach(s=>{t?.[s]&&(e[s]=t[s])})),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",t),e}}mergeLocationWithCommentAnnotations(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(t);return r?!gi(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!0}}stripCommentsFromAnnotationData({comment:e}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let t=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!t)return e;let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=new md;if(Object.assign(a,e),a.isCommentResolverUsed=t,r){let s=a.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));a.attachments=s}return delete a?.commentHtml,delete a?.commentText,a}catch(t){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",t),e}}stripCommentAnnotationData({data:e,actionType:t,commentId:r}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove(),c;t&&(c=this.notificationActionTypeMap?.[t]);let p={},g=null,f=!1;if(e&&e.annotationId){let D=e.annotationId;p[D]=E(E(E(E({annotationId:D,metadata:K0(e.metadata??{}),comments:{}},e?.from&&{from:e?.from}),e?.assignedTo&&{assignedTo:e?.assignedTo}),e?.resolvedByUserId&&{resolvedByUserId:e?.resolvedByUserId}),e?.targetTextRange?.text&&{targetTextRange:{text:e?.targetTextRange?.text}}),delete e?.targetTextRange?.text,s?.length>0&&s.forEach(G=>{e?.[G]&&(p[D][G]=e[G],delete e[G])}),e.comments?.forEach(G=>{if(G.commentId){let z;a&&(z={},G.attachments?.forEach(J=>{z[J.attachmentId]={attachmentId:J.attachmentId,name:J.name,url:J.url}})),p[D].comments[G.commentId]=E(E(E(E(E(E({commentId:G.commentId},G?.commentHtml&&{commentHtml:G?.commentHtml}),G?.commentText&&{commentText:G?.commentText}),z&&{attachments:z}),G?.from&&{from:G?.from}),G?.to&&{to:G?.to}),G?.taggedUserContacts&&{taggedUserContacts:G?.taggedUserContacts})}}),f=this.isCommentsDataChanged(p[D],D);let N=new Wo;Object.assign(N,e),N.comments=e.comments?.map(G=>this.stripCommentsFromAnnotationData({comment:G}))||[],g=N}let I=g?.comments?.find(D=>D.commentId===r);return I?.isDraft&&(c=g?.comments?.length&&g?.comments?.length>0?Oa.COMMENT_ADD:Oa.COMMENT_ANNOTATION_ADD),{strippedData:f&&(t||I?.isDraft)?p:null,originalData:g,eventType:c}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?.userId?T(E({},r),{contact:{userId:r.contact.userId}}):r));let t=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(c=>c.text===r.text)===a)||[];t.forEach(r=>{if(r?.text&&r?.contact?.userId){let a=new RegExp(od(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),t.forEach(r=>{r?.text&&r?.contact?.userId&&(r.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}getDeniedForYouUsers(t){return Q(this,arguments,function*({extraData:e}){try{let r=Object.values(e?.annotationData?.subscribedUsers||{}).map(s=>s.user.userId)??[],a=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&r.length){let s=e?.metadata?.clientDocumentId,c=[];r.forEach(f=>{if(c.push({userId:f,resource:{id:s,type:Mo.DOCUMENT,source:qo.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??""}}),e?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()){let I=JSON.stringify(e?.annotationData?.context?.access);c.push({userId:f,resource:{id:I,type:Mo.CONTEXT,source:qo.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:{access:e?.annotationData?.context?.access}}})}});let p=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:qo.SET_NOTIFICATIONS,uniqueId:p,timestamp:new Date().getTime(),source:"internal",payload:{requests:c}});let g=yield this.userPermissionService?.onResourceAccessRequired({requests:c,uniqueId:p,methodName:qo.SET_NOTIFICATIONS});g?.success&&g?.data?.length&&g.data.forEach(f=>{f.hasAccess||a.push(f.userId)})}return a}catch(r){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",r),[]}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let p=Sk(this.authService.getFirebaseConfig()?.firebaseOptions),g=Ki(this.functions,Zi({url:Dn.cloudFunction?.[p]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let G=r?.targetAnnotationData?.commentId;if(G){let z=e?.comments?.find(J=>J?.commentId===G);z&&(r.targetAnnotationData=z)}try{let z=this.stripCommentAnnotationData({data:r.annotationData,actionType:r?.actionType??$t.NEWLY_ADDED});z?.originalData&&(r.annotationData=this.formatCommentData(z.originalData)),r?.targetAnnotationData&&(r.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:r.targetAnnotationData})))}catch(z){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",z)}}let f=Yg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),I=yield this.getDeniedForYouUsers({extraData:r}),D={path:t??"",data:e??{},dbId:f??"",notificationData:r||void 0,notificationURL:Dn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:ga(),deniedForYouUsers:I,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),metadata:s},N=yield Il(D,this.authService.getUser()?.userId??"");yield g({veltData:N})}catch(p){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",p)}})}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn),ee(Ue),ee(Io),ee(Rt),ee(Ks),ee(Kg),ee(ns))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let t=new Set;if(e?.length)for(let r of e)r?.user?.userId&&t.add(r?.user?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",t),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);if(t){let r=t;e?.user&&typeof e.user=="object"&&(r=E(E({},r),e.user)),e=T(E({},e),{user:r})}}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var _pe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let t=new Set;for(let r of e)r?.userId&&t.add(r?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",t),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=E(E({},e),t))}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",t),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let t=["userId","comment","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","targetElement","position","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var lR=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let r of e)r?.userId&&t.add(r?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",t),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=E(E({},e),t))}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",t),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",t),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",t),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",t),e}}resolveUsersFromHuddleMessages(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers({userIds:t});for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var cR=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromLiveStateCustom(e){try{let t=new Set;return e?.updatedBy&&t.add(e?.updatedBy?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",t),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let t=this.usersService.getUserById(e?.updatedBy?.userId);t&&(e.updatedBy=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",t),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",t),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let t=new Set;for(let r of e)r?.updatedBy?.userId&&t.add(r?.updatedBy?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",t),[]}}getUserIdsToResolveFromLiveStates(e){try{let t=new Set;return e?.default?.singleEditorMode?.editor?.userId&&t.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",t),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(e){try{let t=new Set;return e?.editor?.userId&&t.add(e?.editor?.userId),e?.requestEditorAccess?.user?.userId&&t.add(e?.requestEditorAccess?.user?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",t),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);t&&(e.default.singleEditorMode.editor=t)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);t&&(e.default.singleEditorMode.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",t),e}}mergeSingleEditorLiveStateDataWithUser(e){try{if(e?.editor?.userId){let t=this.usersService.getUserById(e?.editor?.userId);t&&(e.editor=t)}if(e?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.requestEditorAccess?.user?.userId);t&&(e.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",t),e}}resolveAndMergeSingleEditorLiveStateDataWithUser(e){return Q(this,null,function*(){try{let t=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:e}});return t.length?(yield this.usersService.resolveUsers({userIds:t}),this.mergeSingleEditorLiveStateDataWithUser(e)):e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",t),e}})}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",t),e}}mergeLiveStateCustomsWithUsers(e){try{for(let t of e)if(t?.updatedBy?.userId){let r=this.usersService.getUserById(t?.updatedBy?.userId);r&&(t.updatedBy=r)}return e}catch(t){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromMultiThreads(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",t),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",t),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var OC=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId),r?.transcription?.from?.userId&&t.add(r?.transcription?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.transcription?.from?.userId){let t=this.usersService.getUserById(e?.transcription?.from?.userId);t&&(e.transcription.from=t)}return e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",t),e}}formatRecorderData(e,t){try{return e.transcription=e?.transcription?T(E({},e.transcription),{lastUpdated:t}):void 0,this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.transcription?.from?.userId&&(e.transcription.from={userId:e.transcription.from.userId})),e}catch(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",t),e}}encryptRecorderAnnotation(e){return Q(this,null,function*(){try{return yield Il(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var dR=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=c}getUserIdsToResolveFromNotifications(e){try{let t=new Set;for(let r of e){let{notification:a}=r;switch(a?.actionUser?.userId&&t.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let c of s)t.add(c)}break}}return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),r=e?.raw?.targetAnnotationData?.commentId,a=t?.comments?.[r]?.commentText,s=t?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",t),e}}mergeLocationWithNotification(e,t){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:t}=e;if(t?.actionUser?.userId){let r=this.usersService.getUserById(t?.actionUser?.userId);r&&(t.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(t.displayHeadlineMessageTemplateData.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(t.displayHeadlineMessageTemplateData.recipientUser=r)}switch(t?.notificationSource){case"comment":t?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(t?.notificationSourceData);break}return e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",t),e}}formatNotification(e,t){try{switch(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),this.usersService.userDataProviderAvailable()&&e?.actionUser&&(e.actionUser={userId:e.actionUser.userId}),e.notificationSource){case"comment":this.commentUtilsService.formatCommentData(e.annotationData),this.commentUtilsService.formatCommentThreadData(e.targetAnnotationData);break;case"recorder":this.recorderUtilsService.formatRecorderData(e.annotationData,t);break}return e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let t=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&t.push(r.notification.targetAnnotationId)}),t}catch(t){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",t),[]}}handleNotificationEncryption(t){return Q(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Il(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(t){return new(t||o)(ee(Zg),ee(OC),ee(y),ee(Fn),ee(Ue),ee(Ks))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Epe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let r of e)r?.userId&&t.add(r?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",t),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=E(E({},e),t))}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",t),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var xpe=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.reactions)a?.from?.userId&&t.add(a?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{let s=Sk(this.authService.getFirebaseConfig()?.firebaseOptions),c=Ki(this.functions,Zi({url:Dn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),p=Yg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),g=this.authService.getUser()?.userId??"",f={path:t??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:ga()},I=yield Il(f,g);yield c({veltData:I})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.reactions?.length){for(let t of e?.reactions)if(t?.from?.userId){let r=this.usersService.getUserById(t?.from?.userId);r&&(t.from=r)}}}return e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",t),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(t=>(this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t)),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",t),e}}isReactionDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let r=this.reactionAnnotationsResolverService.getReactionAnnotationById(t);return r?!gi(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let t={};if(e&&e.annotationId){let r=e.annotationId;if(t[r]=E({annotationId:r,metadata:K0(e.metadata??{}),icon:e.icon},e?.from&&{from:e?.from}),!this.isReactionDataChanged(t[r],r))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:t,originalData:e}}catch(t){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",t),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return e;let t=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return t&&t.icon&&(e.icon=t.icon),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn),ee(Ue),ee(Io),ee(Rt),ee(pm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Tpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromSelections(e){try{let t=new Set;for(let r of e)r?.user?.userId&&t.add(r.user.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",t),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);t&&(e.user=t)}return e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",t),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromTags(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r.from.userId),r?.to?.length)for(let a of r.to)a?.userId&&t.add(a.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",t),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e?.to?.length&&(e.to=e.to.map(t=>{if(t?.userId){let r=this.usersService.getUserById(t?.userId);r&&(t=r)}return t})),e}catch(t){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",t),e}}formatTagData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to?.length&&(e.to=e.to.map(t=>(t?.userId&&(t={userId:t.userId}),t)))),e}catch(t){return this.loggingService.catch("Error in TagUtilsService formatTagData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var gm=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D,N,G,z,J,ce,ye,Oe,$e){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=c,this.liveStateUtilsService=p,this.loggingService=g,this.multiThreadUtilsService=f,this.notificationUtilsService=I,this.presenceUtilsService=D,this.reactionUtilsService=N,this.recorderUtilsService=G,this.selectionUtilsService=z,this.tagUtilsService=J,this.usersService=ce,this.docService=ye,this.commentAnnotationsResolverService=Oe,this.reactionAnnotationsResolverService=$e}getErrorForGetRequests({feature:e,error:t}){try{switch(e){case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(t?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",r),null}}getFirestorePath({feature:e,properties:t,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:c,folderId:p}=t;c||(c=r?.organizationId);let g=new oR({apiKey:a,documentId:s?`${s}`:"",organizationId:c?`${c}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allPermissionsUsers":return g?.permissionsUsers?`${g?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&g?.comment?`${g?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&g?.area?`${g?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&g?.area?`${g?.area}`:void 0;case"allDocuments":return g?.document?`${g?.document}`:void 0;case"allLocations":return g?.location?`${g?.location}`:void 0;case"allFolders":return g?.folder?`${g?.folder}`:void 0;case"folder":return g?.folder&&t.folderId?`${g?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&g?.reaction?`${g?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"recorderTrackEvent":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return g?.organization?`${g?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&g?.folder?`${g?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&g?.location&&t?.id?`${g?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return g?.users?`${g?.users}`:void 0;case"allFolderUsers":return g?.users?`${g?.users}`:void 0;case"allOrganizationGroups":return g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return g?.users?`${g?.users}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&g?.notificationViews?`${g?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&g?.documentViews?`${g?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&g?.documentViews?`${g?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&g?.locationViews?`${g?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&g?.locationViews?`${g?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&g?.docNotification?`${g?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.docNotification?`${g?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allUserNotifications":return t?.userId&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return U.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return U.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return U.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return U.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return U.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return U.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return U.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return U.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(t){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",t);return}}getDocumentPath({feature:e,properties:t,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:c,organizationId:p}=t;p||(p=r?.organizationId);let g=new mm({apiKey:a,documentId:c?`${c}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!s&&t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&g?.globalContacts?`${g?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&g?.globalContacts?`${g?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&g?.logins?`${g?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}`:void 0;case"customerMetadata":return g?.customerMetadata?`${g?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&g?.arrow?`${g?.arrow}`:void 0;case"arrow":return t?.documentId&&g?.arrow&&t.id?`${g?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&g?.cursor?`${g?.cursor}`:void 0;case"cursor":return t?.documentId&&g?.cursor&&t.id?`${g?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&g?.flock&&t.id?`${g?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&g?.flock&&t.id?`${g?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&g?.huddle?`${g?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&g?.huddle?`${g?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&g?.huddle?`${g?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&g?.huddle?`${g?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&g?.liveState?`${g?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&g?.liveState?`${g?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&g?.liveStateSingleEditorMode?`${g?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&g?.presence&&t?.userId?`${g?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&g?.presence?`${g?.presence}`:void 0;case"workspaceIam":return g?.workspaceIam?`${g?.workspaceIam}`:void 0;case"selection":return t?.documentId&&g?.selection&&t?.userId?`${g?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&g?.selection?`${g?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&g?.syncVideoPlayer?`${g?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&g?.tag?`${g?.tag}`:void 0;case"tag":return t?.documentId&&g?.tag&&t?.id?`${g?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&g?.userContactUs?`${g?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&g?.userFeedback?`${g?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&g?.userReportBugs?`${g?.userReportBugs}`:void 0;case"comment":return!s&&t?.documentId&&t?.id&&g?.comment?`${g?.comment}${t?.id}`:void 0;case"allMultiThreads":return!s&&t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return!s&&t?.documentId&&g?.crdt?`${g?.crdt}`:void 0;case"crdtData":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&g?.crdt&&t?.id&&t?.versionId?`${g?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!s&&t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&t?.id&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}`:void 0;case"allDocuments":return!s&&g?.docs&&t?.documentId?`${g?.docs}/${t?.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&t?.documentId&&g?.area?`${g?.area}`:void 0;case"area":return!s&&t?.id&&g?.area?`${g?.area}${t?.id}`:void 0;case"folder":return!s&&t?.folderId&&g?.folder?`${g?.folder}${t?.folderId}`:void 0;case"documentUserAccess":return!s&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!s&&t?.documentId&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&g?.organizationIam?`${g?.organizationIam}users/`:void 0;case"reaction":return!s&&t?.id&&g?.reaction?`${g?.reaction}${t?.id}`:void 0;case"allReactions":return!s&&t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return!s&&t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}${t?.id}`:void 0;case"allRecorders":return!s&&t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"organizationMetadata":return!s&&g?.organizationMetadata?`${g?.organizationMetadata}`:void 0;case"heartbeat":return t?.id&&g?.heartbeat?`${g?.heartbeat}${t?.id}`:void 0;case"allHeartbeats":return g?.heartbeat?`${g?.heartbeat}`:void 0;case"heartbeatByDocument":return t?.id&&g?.heartbeatByDocument?`${g?.heartbeatByDocument}${t?.id}`:void 0;case"allHeartbeatsByDocument":return g?.heartbeatByDocument?`${g?.heartbeatByDocument}`:void 0;case"documentAccessType":return!s&&g?.documentIam?`${g?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&g?.metadata?`${g?.metadata}`:void 0;case"allDocumentViews":return!s&&t?.documentId&&g?.views?`${g?.views}documentViews/`:void 0;case"documentViews":return!s&&t?.documentId&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}`:void 0;case"allLocationViews":return!s&&t?.documentId&&g?.views?`${g?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&t?.id&&t?.user&&g?.views?`${g?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/location`:void 0;case"location":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(c){return Q(this,arguments,function*({feature:e,data:t,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(t)));break}case"allArrows":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(t)));break}case"allCursors":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(t)));break}case"allComments":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(t)));break}case"allDocumentUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allFolderUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allOrganizationUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allMultiThreads":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(t)));break}case"allDocNotifications":{t&&typeof t=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(t)?t:Object.values(t)));break}case"allUserNotifications":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(t)));break}case"allPresence":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(t)));break}case"allRecorders":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(t)));break}case"allReactions":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(t)));break}case"allTags":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(t)));break}case"allHuddleAttendees":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(t)));break}case"liveStateCustom":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(t));break}case"allLiveStateCustoms":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(t)));break}case"allLiveStates":{t&&typeof t=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(t));break}case"liveStateSingleEditorMode":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return t}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),t}})}mergeCommentAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(t){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:t,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(c,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):t;case"allArrows":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):t;case"allCursors":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):t;case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):t;case"allDocumentUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allFolderUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allOrganizationUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allMultiThreads":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):t;case"allDocNotifications":return t&&typeof t=="object"?t?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):t;case"allUserNotifications":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):t;case"allPresence":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):t;case"allRecorders":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):t;case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):t;case"allTags":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):t;case"allHuddleAttendees":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):t;case"liveStateCustom":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(t):t;case"allLiveStateCustoms":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):t;case"allLiveStates":return t&&typeof t=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(t):t;case"liveStateSingleEditorMode":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):t;default:return t}return t}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),t}}mergeCommentAnnotationsWithData$({data:e,feature:t}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(de(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:t}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(de(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:t}){try{return this.usersService.getUserById$().pipe(de(()=>{let r=this.mergeUsersWithData({feature:e,data:t?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:t?.operation??null}:{data:r,operation:t?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(t)}}mergeLocationMetadataWithData$({data:e,feature:t}){try{return this.docService.getLocationMetadata$().pipe(de(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:t,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,r),se(e)}}handleDataStripping({feature:e,data:t,actionType:r,commentId:a}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:r,commentId:a});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",s),{originalData:t,strippedData:null}}}formatData({feature:e,data:t,properties:r,offset:a,isRealtimeDb:s}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof t=="object"&&(t=JSON.parse(JSON.stringify(t)));let c=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return s?t:{metadata:t};case"documentCommentMetadata":return t;case"cursor":return this.cursorUtilsService.formatCursorUserData(t);case"comment":return this.commentUtilsService.formatCommentData(t);case"area":return this.areaUtilsService.formatAreaData(t);case"arrow":return this.arrowUtilsService.formatArrowData(t);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(t);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(t);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(t);case"reaction":return this.reactionUtilsService.formatReactionData(t);case"recorder":return this.recorderUtilsService.formatRecorderData(t,c);case"notificationViewsTimestamp":return{views:{[r.user??""]:t}};case"documentUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"documentDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"documentMetadataViews":return s?t:{metadata:t};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(t);case"locationMetadataViews":return s?t:{metadata:t};case"locationUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"locationDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"locationViews":return s?t:{location:t};case"docNotificationViews":return s?t:{views:t.views};case"userNotificationViews":return s?t:{views:t.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(t);case"selection":return this.selectionUtilsService.formatSelectionData(t);case"tag":return this.tagUtilsService.formatTagData(t);default:return t}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),t}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:t,subscriber:r,operation:a=null}){try{let c=yield this.modifyData({feature:e,data:t});r.next({data:c,operation:a})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:t,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(t.type==="removed")return!Object.keys(r??{}).includes(t.doc.id);if(r?.[t.doc.id]){let a=t.doc.data(),s=r?.[t.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return Q(this,arguments,function*({feature:e,data:t}){try{return yield this.formatResponse({feature:e,data:t})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),t}})}addMetadata(e,t){try{return e&&typeof e=="object"&&!Array.isArray(e)?T(E({},e),{metadata:e?.metadata??{documentId:t?.documentId,organizationId:t?.organizationId,apiKey:t?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return Q(this,arguments,function*({feature:e,data:t,observablesCache:r,eventType:a,id:s,operation:c=null}){try{let f={comment:"allComments",reaction:"allReactions"}[e];if(!f)return null;let I=t?.metadata?.documentId,D=t?.metadata?.veltFolderId;return Object.keys(r).filter(N=>N.includes(f)&&(!I||N.includes(I)||D&&N.includes(D))).forEach(N=>{let G=r[N]?.subject?.getValue()??{};a==="DELETE"?s&&G?.data?.[s]&&(delete G?.data?.[s],r[N]?.subject&&r[N].subject.next({data:G?.data,operation:c})):r[N]?.subject?.next({data:T(E({},G?.data),{[t?.annotationId]:t}),operation:c})}),null}catch(g){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",g),null}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s})}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",p),e}})}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:t,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}rtdbDefaultTransactionCallback(e,t){try{let r=E({},e||{});return Object.entries(t).forEach(([a,s])=>{s==null?delete r[a]:r[a]=s}),r}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",r),e}}};o.\u0275fac=function(t){return new(t||o)(ee(fpe),ee(vpe),ee(Zg),ee(Cpe),ee(_pe),ee(lR),ee(cR),ee(y),ee(bpe),ee(dR),ee(Epe),ee(xpe),ee(OC),ee(Tpe),ee(Dpe),ee(Fn),ee(rt),ee(Ks),ee(pm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var wpe=(()=>{let o=class o{constructor(e,t,r){this.configService=e,this.authService=t,this.loggingService=r,this.firestore$=new ve(null);try{dn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Fe(([a,s])=>!!a&&!!s),ot(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(M9(Yg.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||M9("DocumentIdDb");if(e){let t=OI(e,"generateDocumentId");return SC(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(t){return new(t||o)(ee(Rt),ee(Ue),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var gn=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.authService=e,this.commonDbUtilsService=t,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=c,this.docService=p,this.usersService=g,this.commentAnnotationsResolverService=f,this.reactionAnnotationsResolverService=I,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(D=>{if(D){this.db=D;let N=Pi(D,".info/serverTimeOffset");this.offsetListener=Ig(N,G=>{let z=G.val();this.offset=z})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,t])=>{t?.subject?.complete(),t?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(e,t){return Q(this,null,function*(){try{if(this.db){let r=Pi(this.db,e);return yl(r).update(t)}return Promise.resolve()}catch(r){return this.loggingService.catch("Error in setupOnDisconnect:",r),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){dn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([t,r])=>!!t),ot(1),tn(([t,r])=>{e({db:t,firestore:r})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,r,a,s,c){return Q(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(f=>Q(this,[f],function*({db:p,firestore:g}){let I;t?.skipFirestore||(I=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let N,G;try{D&&(N=Pi(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{I?.includes("/organizations")&&g&&I&&(G=SC(g,`${I}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield r({dbRef:N,firestoreRef:G,data:a,firestorePath:I}),c&&c({firestoreAvailable:!!g})}catch(N){this.loggingService.catch(`Error in ${e} operation: `,N),s&&s(N)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,g=>Q(this,null,function*(){if(g.dbRef){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Bh(g.dbRef,()=>JSON.parse(JSON.stringify(f))):yield p0(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:D,eventType:N}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??r?.targetCommentId});if(e==="comment"){let G=null;I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:N,commentId:c?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null;I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:g.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield Jme(this.firestore,G=>Q(this,null,function*(){G.set(g.firestoreRef,f)}))):yield PW(g.firestoreRef,f)}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in setData for ${e}`,g)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,g=>Q(this,null,function*(){if(g.dbRef&&!r?.skipRtdb){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Bh(g.dbRef,I=>{let D;return r?.rtdbTransactionCallback?D=r.rtdbTransactionCallback(I,f):D=this.commonDbUtilsService.rtdbDefaultTransactionCallback(I,f),JSON.parse(JSON.stringify(D))}):yield vM(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:D,eventType:N}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(e==="comment"){let G=null;I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:N,commentId:c?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null;I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:g.firestorePath??""}))}else yield PW(g.firestoreRef,f,{merge:!0})}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in updateData for ${e}`,g)}})}deleteData(s){return Q(this,arguments,function*({feature:e,properties:t,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:t?.id,operation:{type:"removed",ids:[t?.id]}}),this.performDatabaseOperation(e,t,c=>Q(this,null,function*(){c.dbRef&&(yield fM(c.dbRef));try{if(c.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE",metadata:t?.metadata}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else yield Yme(c.firestoreRef)}catch(p){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(c){this.loggingService.catch(`Error in deleteData for ${e}`,c)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=on()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),on()||"noDocumentId"}}queryData(r){return Q(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();return!e||!t?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,t):yield this.handleRtdbQuery(e,t)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,t){return Q(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=OI(this.firestore,r);t?.useCollectionGroup&&(a=wW(this.firestore,r));let s=t?.firestoreQuery??[],c=AW(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount)try{let p=yield Zme(c).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,g),null));return p?p.data().count:0}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,p),0}else try{let p=yield Qme(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,f),null));if(!p)return[];let g=p.docs.map(f=>f.data());try{return yield this.commonDbUtilsService.modifyData({feature:e,data:g})}catch(f){return this.loggingService.catch(`Error in modifyData for ${e}`,f),g}}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,p),[]}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,t){return Q(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=Pi(this.db,r),s=t?.rtdbQuery??[],c=n$(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let p=yield e$(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,f),null));if(!p)return[];let g=p.val();return g?t?.skipObjectValues?g:Object.values(g??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return Q(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();if(t?.skipFirestore&&(a=!1),!e||!t)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield Xme(SC(this.firestore,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=c.data();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,c),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{if(!this.authService.getUser())return{};let c=yield e$(Pi(this.db,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=c.val();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:t}){let r=this.shouldUseFirestore();t?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(t)}`;return dn([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Fe(s=>!!s))]).pipe(Fe(([s,c])=>s?r&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),fe(([s,c])=>{try{if(r&&c){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let f=this.handleFirestoreListener(e,t,c).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.firestoreSubscriptions[a]=f}return new Ut(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let f=this.handleRealtimeDbListener(e,t,s).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.rtdbSubscriptions[a]=f}return new Ut(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.rtdbSubscriptions[a]?.unsubscribe(),delete this.rtdbSubscriptions?.[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache?.[a]))}})}return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Bu(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,t,r){let a=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}),s=`${e}-${JSON.stringify(t)}`;return a?new Ut(c=>{let p=t.isCollection?this.setupCollectionListener(r,a,e,c,t):this.setupDocumentListener(r,a,e,c,t);return()=>{c.complete(),c.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(fe(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:c})),fe(c=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:e}):se(c)),fe(c=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:e}):se(c)),vt(Kt)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,t,r,a,s){let c=`${r}-${JSON.stringify(s)}`,p=OI(e,t);if(s?.useCollectionGroup&&(p=wW(e,t)),s?.useQuery&&s?.firestoreQuery){let I=s?.firestoreQuery??[];p=AW(p,...I)}let g=!0,f=[];return r==="allComments"&&this.loggingService.logPerf(`[PERF] allComments listener started at ${performance.now().toFixed(2)}ms`),OW(p,I=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),N=null,G=!1;I?.docChanges()?.length?I.docChanges().forEach(z=>{["allComments","allReactions"].includes(r)&&!g&&z.type!=="removed"&&f.push(z.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:z,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(G=!0,Object.assign(D,this.handleCollectionChange(z,D)),z.type==="removed"&&(N||(N={type:z.type,ids:[]}),N.ids.push(z.doc.id)))}):G=!0,G&&(["allComments","allReactions"].includes(r)&&f?.length&&(this.commonDbUtilsService.resolveAnnotations({data:f,feature:r}),f=[]),r==="allComments"&&g&&Object.keys(D).length>0&&this.loggingService.logPerf(`[PERF] allComments first snapshot received at ${performance.now().toFixed(2)}ms, entries count: ${Object.keys(D).length}`),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:N})),g=!1}catch(D){this.handleListenerError(D,r,a)}},I=>this.handleListenerError(I,r,a))}handleCollectionChange(e,t){switch(e.type){case"added":case"modified":t[e.doc.id]=e.doc.data();break;case"removed":delete t?.[e.doc.id];break}return t}setupDocumentListener(e,t,r,a,s){let c=SC(e,t);return OW(c,p=>{try{let g=p.data()||{};s?.field&&(g=g?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:g,subscriber:a,operation:null})}catch(g){this.handleListenerError(g,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,t,r){this.loggingService.catch(`Firestore listener error for ${t}:`,e)}handleRealtimeDbListener(e,t,r){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),se({});let s=Pi(r,a);if(t?.useQuery&&t?.rtdbQuery){let c=t?.rtdbQuery??[];s=n$(s,...c)}return this.objectValFromChildEvents(s,e).pipe(zn(c=>(this.loggingService.catch(`RTDB listener error for ${e}:`,c),se({}))),de(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((g,[f,I])=>(g[f]=this.commonDbUtilsService.addMetadata(I,t),g),{}):this.commonDbUtilsService.addMetadata(c,t))),fe(c=>this.commonDbUtilsService.modifyData({feature:e,data:c})),fe(c=>this.usersService.getUserById$().pipe(de(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:c}),operation:null})))))}objectValFromChildEvents(e,t){return new Ut(r=>{let a={},s=!1,c=null,p=z=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,z),r.error(z)}catch{}},g=z=>{try{if(!gi(z,c)){let J=JSON.parse(JSON.stringify(z));c=J,r.next(J)}}catch{}},f=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},I=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},D=z=>{try{z.key&&(delete a[z.key],s&&g(E({},a)))}catch{}},N=z=>{try{if(!s){let J=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};c=J,r.next(J),s=!0}}catch{}};dre(e,f,p),mre(e,I,p),pre(e,D,p);let G=Ig(e,N,p,{onlyOnce:!0});return()=>{try{G&&typeof G=="function"&&G(),hM(e,"child_added",f),hM(e,"child_changed",I),hM(e,"child_removed",D)}catch{}}})}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(gm),ee(y),ee(wpe),ee(bn),ee(Rt),ee(rt),ee(Fn),ee(Ks),ee(pm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var yi=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=c,this.commonDbService=p,this.usersService=g,this.db=fs(),this.internalUserContacts$=new ve([]),this.userGlobalContact$=new ve(!1),this.userGroupContact$=new ve(null),this.users$=new ve([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userAccessFields$=new ve({}),this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new tt,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([zi.ALL]),this.customUserContacts$=new ve(null),this.customUserContactsConfig$=new ve({merge:!1}),this.currentOrganizationUserIAM$=new ve(null),this.userContacts$=new ve([]),this.userSnippylyIdContacts$=new ve(null),this.usersByOrganizationId$=new ve({}),this.temporaryUserIds$=new ve([]),this.usersByOrganizationIdAndDocumentId$=new ve({}),this.usersByOrganizationIdAndFolderId$=new ve({}),this.userById$=new ve({}),this.authService.setContactService(this),this.authService.getUser$().pipe(fe(f=>this.docService.getDocumentPaths$().pipe(tn(I=>{this.documentPaths=I}),de(()=>f)))).subscribe(f=>Q(this,null,function*(){if(this.user=f,f&&this.documentPaths)if(!f?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(f),this.setLoggedInUser(f),yield this.moveGlobalContactUserFromEmailToUserIdPath(f),this.updateUserInGlobalContactsIfAvailable(f),f?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(f?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let I=this.userPermissionService?.getCurrentUserPermissions(),D=this.documentPaths.folderId,N=!0;D&&I?.[f?.userId]?.folders?.[D]?.errorCode===ko.PERMISSION_DENIED&&(N=!1),this.getOrganizationContactsFromDb$(),N&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0}),f=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",f)}),this.databaseService.getDb().pipe(Fe(f=>!!f),ot(1)).subscribe(f=>{f&&(this.db=f)},f=>{this.loggingService.catch("Error in ContactService constructor getDb: ",f)}),this.getOrganizationGroups$().subscribe(f=>{this.authService.setOrganizationUserGroups(f)}),dn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([f,I,D])=>{I?D?.merge?this.userContacts$.next([...f||[],...I||[]]):this.userContacts$.next(I||[]):this.userContacts$.next(f||[])}),this.getUserContacts$().subscribe(f=>{try{f?.forEach(I=>{let D=I?.userSnippylyId||G0(this.configService.getApiKey(),I.userId);D&&this.userSnippylyIdContacts$.next(T(E({},this.userSnippylyIdContacts$.value),{[D]:I}))})}catch{}})}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.next([]),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(t){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",t)}}checkIfUserGlobalContact(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}return!1}catch(t){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",t),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(E({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let t=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let c=r.contacts[s];if(c?.userId){let p=Et(c?.userId);a[p]=c}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}})}}}}catch(t){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",t)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{if(!this.userPermissionService?.getIsContextEnabled())return;let t=this.getUserAccessFields();e.forEach(r=>{t[r.user.userId]=r.accessFields||[]}),this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new Vo;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}}))}}}catch(t){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",t)}})}setLoggedInUserPrivateContacts(e,t){try{if(e?.userId&&this.documentPaths?.logins){let r,a=t?.filter(c=>c?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(c=>{if(c?.userId){let p=Et(c?.userId);r[p]=c}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let t=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});t&&Object.keys(t??{}).forEach(r=>Q(this,null,function*(){let a=t[r];a?.email&&a?.userId&&Et(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return Q(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(ot(1)).subscribe(t=>Q(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Ei.PUBLIC)r=!0;else if(a===Ei.RESTRICTED){let s=Et(this.user?.userId);if(t?.users?.[s]&&(r=!0),this.user?.email){let c=Et(this.user?.email);t?.users?.[c]&&(r=!0)}}if(r){let s=new bp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,t){try{let r=t?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>Q(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in ContactService removeGroupContacts: ",t)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let t={};e.forEach(r=>{r?.userId?(!r?.email||!t[r.email])&&(t[r.userId]=r):r?.email&&(!r?.userId||!t[r.userId])&&(t[r.email]=r)}),e=Object.values(t??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:t,documentId:r,veltFolderId:a}=e||{};return t&&r?dn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(de(([s,c,p,g,f,I,D,N])=>{let G={},z=!1;I&&!I?.merge&&(z=!0);let J=Be=>D.some(be=>Be.includes(be)),ce=J([zi.ALL,zi.ORGANIZATION])?Object.keys(s?.[t]||{}):[],ye=a?J([zi.ALL,zi.FOLDER])?Object.keys(c?.[t]?.[a]||{}):[]:[],Oe=J([zi.ALL,zi.DOCUMENT])?Object.keys(p?.[t]?.[r]||{}):[];if([...ce,...ye||[],...Oe,...N].forEach(Be=>{let be=g?.[Be];be&&(G[Be]=be)}),f){let{merge:Be,options:be}=I||{},{organizationId:Se,documentId:Ae,folderId:Ce}=be||{},he=Ce?ji(Ce):void 0;(!Se||Se===t)&&(!Ae||Ae===r)&&(!he||he===a)&&(Be||(G={}),f.forEach(we=>{we?.userId&&(G[we.userId]=we)}))}return Object.values(G??{})})):this.userContacts$.asObservable().pipe(de(s=>s))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Fe(e=>!!e),fe(e=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),tn(t=>{this.documentPaths=t}),de(()=>e))),fe(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),tn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(de(r=>r?.data),tn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Et(e?.userId)}}).pipe(de(r=>r?.data),tn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),Fo(...t).pipe(fo(this.authService.getUser$().pipe(Fe(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable().pipe(vt(Kt))}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(fe(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(t=>t?.data),tn(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(fe(e=>e?.organizationId?this.userById$.pipe(de(t=>{let r={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(de(t=>{let r={};return t.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(de(t=>t.find(r=>r.email===e)))}getUserByEmail(e){return this.users?.find(t=>t.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(t=>t.email===e)}getUserByUserId$(e){return this.users$.pipe(de(t=>t.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe(Fe(t=>!!t),de(t=>t?.organizationId)).subscribe(t=>Q(this,null,function*(){if(t&&e){let r=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ht("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(r?.length){let a=yield this.usersService.resolveUsers({userIds:r.map(s=>s?.userId)});if(a){let s={};Object.entries(a).forEach(([p,g])=>{s[p]=g}),this.userById$.next(E(E({},this.userById$.value),s));let c=new Set([...this.temporaryUserIds$.value,...Object.keys(s)]);this.temporaryUserIds$.next(Array.from(c))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveOrganizationUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),t?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0,useQuery:!0,firestoreQuery:[_i(F9(ht("organizationIds","array-contains-any",[r]),ht("viewerOrganizationIds","array-contains-any",[r]))),Xi("id")]}}).pipe(de(a=>a?.data),de(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserAccessFields(s),this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveFolderUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[_i(F9(ht("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),ht("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),Xi("id")]}}).pipe(de(s=>s?.data)),a.pipe(de(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let c=Object.values(s??{});this.setUserAccessFields(c),this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(Fe(r=>!!r),tn(r=>{this.documentPaths=r}),de(()=>t))),fe(t=>this.usersService.getResolveDocumentUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(fe(r=>{let a=r?.length>0?r.map(g=>g.documentId):[this.documentPaths?.documentId??""];if(a.some(g=>!g)||!this.documentPaths)return se();let s=se([]),c={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId);let p=[];for(let g=0;g<a.length;g+=U.LISTENER_BATCH_SIZE)p.push(a.slice(g,g+U.LISTENER_BATCH_SIZE));return s=dn(p.map(g=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(E({},c),{firestoreQuery:[_i(F9(ht("documentIds","array-contains-any",g),ht("viewerDocumentIds","array-contains-any",g))),Xi("id")]})}).pipe(Tr()))).pipe(de(g=>Qr(g)?.data)),s.pipe(de(g=>{if(g){typeof g=="object"&&(g?.undefined&&delete g.undefined,g?.null&&delete g.null);let f=Object.values(g??{});this.setUserAccessFields(f),this.setUserDocumentContacts(f)}else this.setUserDocumentContacts([])}))})):se():se())),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),this.usersService.setUserByIds(a),t){let s={};s[t]={};let c={};e.forEach(p=>{s[t][p.user.userId]=p,c[p.user.userId]=p.user}),this.userById$.next(E(E({},this.userById$.value),c)),this.usersByOrganizationId$.next(T(E({},this.usersByOrganizationId$.value),{[t]:s[t]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{let t=e?.map(s=>s?.user);this.userFolderContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.folderIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndFolderId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",t)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{let t=e?.map(s=>s?.user);this.userDocumentContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.documentIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndDocumentId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",t)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(zi.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(zi.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(zi.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(zi.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let t=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(t)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>{if(this.setUserOrganizationGroups([]),!t)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(de(a=>a?.data),de(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",t)}}onContactSelected(e){try{if(e?.userId){let t=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Ei.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:r,isDocumentContact:t,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let t={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(t)}}catch(t){this.loggingService.catch("Error in ContactService onContactSelected: ",t)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereLabel: ",t)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereDescription: ",t)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(t){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",t)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(t=>e.includes(t))}updateContactList(e,t){return Q(this,null,function*(){try{this.analyticsService.trackEvent(Z.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(E({},e?.options),{documentId:t,organizationId:r})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(fe(e=>e?dn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(de(([t,r,a,s,c])=>{let p={};p.organizationUsers=t?.map(f=>this.convertToClientUser(f)),p.folderUsers=r?.map(f=>this.convertToClientUser(f)),p.documentUsers=a?.map(f=>this.convertToClientUser(f)),p.updatedContactList=c?.map(f=>this.convertToClientUser(f));let g=[];return s?.forEach(f=>{let I=this.convertToClientUserGroup(f,p.organizationUsers||[]);I&&g.push(I)}),p.userGroups=g,p}),vt(Kt)):se(null)),zn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,t){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(s=>{if(s?.userId){let c=Et(s.userId);a[c]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(t){return this.loggingService.catch("Error in ContactService convertToClientUser: ",t),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(Rt),ee(bn),ee(rt),ee(y),ee(gn),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ope=i=>{try{let o={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return $I.sanitize(i,o)}catch(o){return nt.catch("Error in File utils sanitizeSvg: ",o),""}},Ape=i=>{try{return i.name.split(".").slice(0,-1).join(".")}catch(o){nt.catch("Error in File utils getFileName: ",o);return}},HW=i=>{try{return/(?:\.([^.]+))?$/.exec(i?.name)[1]}catch(o){nt.catch("Error in File utils getFileExtension: ",o);return}},Ppe=(i,o)=>{try{let n=i.slice(0,-1,i.type);return new File([n],o+"."+HW(i),{type:i.type})}catch(n){nt.catch("Error in File utils updateFile: ",n);return}},Mpe=i=>new Promise((o,n)=>{let e=new FileReader;e.readAsDataURL(i),e.onload=()=>{o(e.result)},e.onerror=t=>{n(t)}}),zW={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Xg=(()=>{let o=class o{constructor(e,t,r,a){this.authService=e,this.configService=t,this.loggingService=r,this.attachmentResolverService=a,this.storage=Ib();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=Ib(void 0,s?.firebaseOptions?.storageBucket))},s=>{this.loggingService.catch("Error in StorageService constructor: ",s)})}catch(s){this.loggingService.catch("Error in StorageService constructor:",s)}}createAttachment({path:e,file:t}){try{let r=new bC;r.name=t.name;let a=Ppe(t,`${r.attachmentId}_${Ape(t)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=t.size,r.type=HW(t),r?.type&&(r.mimeType=zW[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}sanitizeSvgFile(e){return Q(this,null,function*(){if(e.type===zW.svg)try{let t=yield e.text(),r=Ope(t);return new File([r],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(s){return Q(this,arguments,function*({attachment:e,file:t,resolve:r,reject:a}){try{let c=Eb(this.storage,e.bucketPath),p=w$(c,t,{cacheControl:"public,max-age=3600"});p.on("state_changed",g=>{let f=g.bytesTransferred/g.totalBytes*100},g=>{a(g)},()=>{D$(p.snapshot.ref).then(g=>{e.url=g,r(e)})})}catch(c){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",c),a(c)}})}uploadToResolver(c){return Q(this,arguments,function*({file:e,attachment:t,metadata:r,resolve:a,reject:s}){try{r.attachmentId=t.attachmentId;let p={attachmentId:t.attachmentId,name:t.name,file:e,metadata:r,mimeType:t.mimeType},g=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:Oa.ATTACHMENT_ADD});g&&g.data?.url?(t.url=g.data?.url,a(t)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:t,useAttachmentResolver:r,metadata:a}){return new Promise((s,c)=>Q(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let p=yield this.sanitizeSvgFile(t),g=this.createAttachment({path:e,file:p});if(!g)throw new Error("Attachment not created");r?this.uploadToResolver({file:p,attachment:g,metadata:a,resolve:s,reject:c}):this.uploadAttachmentToStorage({attachment:g,file:p,resolve:s,reject:c})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),c(p)}}))}uploadChunk(e,t,r){return new Promise((a,s)=>{try{if(this.apiKey){let c=`${this.apiKey}/${e}/${t.name}`,p=Eb(this.storage,c),g=w$(p,t,{cacheControl:"public,max-age=3600"});g.on("state_changed",f=>{let I=f.bytesTransferred/f.totalBytes*100},f=>{s(f)},()=>{D$(g.snapshot.ref).then(f=>{a(f)}).catch(f=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,f),s(f)})})}else{let c=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",c),s(c)}}catch(c){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,c),s(c)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let r=t.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(U.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(s),a.remove()},t.onerror=()=>{window.open(e.url,"_blank")},t.open("GET",e.url),t.send()}}catch(t){this.loggingService.catch("Error in StorageService downloadAttachment: ",t)}}deleteAttachment({attachment:e,metadata:t,useAttachmentResolver:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t}).then(()=>{a(null)}).catch(c=>{s(c)});else{let c=Eb(this.storage,e.bucketPath);T$(c).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,r)=>{let a=Eb(this.storage,e);T$(a).then(()=>{t(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(Rt),ee(y),ee(Kg))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var In=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=c,this.loggingService=p,this.commonDbService=g,this.documentIAM$=new ve(null),this.workspaceIAM$=new ve(null),this.roles$=new ve([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Fe(f=>!!f),ot(1)).subscribe(f=>{f&&(this.getUser(),this.getDocumentPaths())},f=>{this.loggingService.catch("Error in CommentService getDb subscription: ",f)}),this.getRole$().pipe(ot(1)).subscribe(f=>{this.authService?.getUser()&&!f&&this.analyticsService.trackEvent(Z.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(f=>{f?.accessType&&this.contactService.setDocumentAccessType(f.accessType)})}catch(f){this.loggingService.catch("Error in IamService constructor: ",f)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Fe(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(Fe(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new j9;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(zn(e=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(de(e=>!!e),vt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(de(e=>e?.length?e:U.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(de(e=>e?.features),fe(e=>this.getRole$().pipe(de(t=>(t===so.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(fe(()=>this.documentIAM$.pipe(Fe(t=>!!t),fe(()=>this.workspaceIAM$.pipe(de(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(fe(()=>this.configService.getSF$()),fe(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),fe(()=>this.configService.getSF()?this.documentIAM$.pipe(Fe(e=>!!e),vt(Kt)):se(null)),fe(()=>this.workspaceIAM$.pipe(vt(Kt))),de(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return so.ADMIN;if(!e)return this.user?.isAdmin?so.ADMIN:so.COMMENTER;let t=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Ei.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Ei.PUBLIC:null){case Ei.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||so.COMMENTER;break;case Ei.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}return t}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(de(e=>e===so.ADMIN),vt())}isUserAdmin(){try{return this.getRole()===so.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[Et(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[Et(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[Et(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[Et(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(yi),ee(bn),ee(rt),ee(Rt),ee(y),ee(gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bs=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.authService=e,this.docService=t,this.loggingService=r,this.commonDbService=a,this.usersService=s,this.commentUtilsService=c,this.coreActionsService=p,this.functions=g,this.configService=f,this.contactService=I,this.currentUserPermissions$=new ve(null),this.permissionsCache$=new ve(null),this.permissionProvider$=new ve(null);try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(D){this.loggingService.catch("Error in UserPermissionService constructor:",D)}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(U.DEFAULT_VELT_CONTEXT))return!0;let r=this.contactService.getUserAccessFieldsByUserId(e);return r?t.every(a=>r.includes(a)):!0}catch(r){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",r),!1}}organizationDetails(e){return Q(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:ko.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:ko.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:ko.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(r){return Q(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:ko.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:ko.DOES_NOT_EXIST,error:!0};let s=this.docService.getDocumentMetadata(e)??{};return this.docService.setDocumentMetadata(e,E(E({},s),a?.metadata??{})),{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:ko.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(r){return Q(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:ko.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:ko.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:ko.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let r=yield this.validateResources(t),[a,s]=yield this.fetchUserPermissionsFromDB(t),c=this.buildPermissionsResponse(t,r,a,s);return!e&&Object.keys(c).length>0&&this.setCurrentUserPermissions(c),c}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),r=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:r.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?Ja(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a,clientOrganizationId:s}=e,c=[],p=[];a&&(c.push(this.organizationDetails(a)),p.push({id:s??"",type:"organization"})),t.forEach(f=>{c.push(this.folderDetails({folderId:ji(f),organizationId:a??""})),p.push({id:f,type:"folder"})}),r.forEach(f=>{c.push(this.documentDetails({documentId:Ir(f),organizationId:a??""})),p.push({id:f,type:"document"})});let g=yield Promise.allSettled(c);return this.processValidationResults(g,p)})}processValidationResults(e,t){let r=[],a=[],s,c=e.map((p,g)=>({result:p,metadata:t[g]})).filter(({result:p})=>p.status==="rejected"||p.status==="fulfilled"&&p.value.error);for(let{result:p,metadata:g}of c){let f=p.status==="fulfilled"?p.value.errorCode??ko.SOMETHING_WENT_WRONG:ko.SOMETHING_WENT_WRONG,I={id:g.id,errorCode:f};switch(g.type){case"organization":if(s=I,f===ko.DOES_NOT_EXIST)throw new Error(`Organization with id '${g.id}' does not exist`);break;case"folder":r.push(I);break;case"document":a.push(I);break}}return{failedFolderIds:r,failedDocumentIds:a,failedOrganizationId:s}}fetchUserPermissionsFromDB(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a}=e,s=[this.authService.getUser()?.userId??""],c=[...t.map(f=>ji(f)),...r.map(f=>Ir(f)),a??""],[p,g]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:s,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:s,organizationId:a,resourceIds:c})]);return[p.status==="fulfilled"?p.value:[],g.status==="fulfilled"?g.value:[]]})}buildPermissionsResponse(e,t,r,a){let{folderIds:s,documentIds:c,clientOrganizationId:p,organizationId:g}=e,{failedFolderIds:f,failedDocumentIds:I,failedOrganizationId:D}=t,N={};return this.processRegularUserPermissions(N,r,s,c,p??"",g??"",f,I,D),this.processTemporaryUserPermissions(N,a),N}processRegularUserPermissions(e,t,r,a,s,c,p,g,f){for(let I of t)for(let D of I)D?.user?.userId&&(e[D.user.userId]=T(E({},r.length&&{folders:this.buildFolderPermissions(r,D,p)}),{documents:this.buildDocumentPermissions(a,D,g),organization:{[s]:this.buildOrganizationPermission(c,D,f)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case ko.DOES_NOT_EXIST:return`${t} does not exist`;case ko.PERMISSION_DENIED:return`User does not have access to ${t}`;case ko.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(r){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",r),"Something went wrong"}}buildFolderPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"folder"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerFolderIds?.includes(ji(s))?Ys.VIEWER:Ys.EDITOR},a},{})}buildDocumentPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"document"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerDocumentIds?.includes(Ir(s))?Ys.VIEWER:Ys.EDITOR},a},{})}buildOrganizationPermission(e,t,r){return r?{error:this.getErrorMessage(r.errorCode,"organization"),errorCode:r.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?Ys.VIEWER:Ys.EDITOR}}processTemporaryUserPermissions(e,t){for(let r of t)if(r?.userId)switch(this.ensureUserPermissionStructure(e,r.userId),r.type){case"folder":this.addTemporaryFolderPermission(e,r);break;case"document":this.addTemporaryDocumentPermission(e,r);break;case"organization":this.addTemporaryOrganizationPermission(e,r);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].folders||(e[r].folders={}),e[r].folders[a]||(e[r].folders[a]={accessRole:s??Ys.EDITOR,expiresAt:c})}addTemporaryDocumentPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].documents||(e[r].documents={}),e[r].documents[a]={accessRole:s??Ys.EDITOR,expiresAt:c}}addTemporaryOrganizationPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].organization||(e[r].organization={}),e[r].organization[a]={accessRole:s??Ys.EDITOR,expiresAt:c}}hasEditAccess({organizationId:e,folderId:t,documentId:r}){try{let a=!0,s=this.getCurrentUserPermissionsWithServerIds(),c=this.authService.getUser()?.userId??"";return s&&(e&&typeof e=="string"&&s?.[c]?.organization?.[e]&&(s?.[c]?.organization?.[e]?.accessRole===Ys.VIEWER||s?.[c]?.organization?.[e]?.errorCode===ko.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&s?.[c]?.folders?.[t]&&(s?.[c]?.folders?.[t]?.accessRole===Ys.VIEWER||s?.[c]?.folders?.[t]?.errorCode===ko.PERMISSION_DENIED)&&(a=!1),r&&typeof r=="string"&&s?.[c]?.documents?.[r]&&(s?.[c]?.documents?.[r]?.accessRole===Ys.VIEWER||s?.[c]?.documents?.[r]?.errorCode===ko.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(vt(Kt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),r=this.authService.getUser()?.userId??"";if(t?.[r]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[r]?.organization?.[a]){let s=Ja(a);t[r].organization&&(t[r].organization[s]=t[r].organization[a],delete t[r].organization[a])}t?.[r]?.folders&&(t[r].folders=Object.fromEntries(Object.entries(t?.[r]?.folders??{}).map(([s,c])=>[ji(s),c]))),t?.[r]?.documents&&(t[r].documents=Object.fromEntries(Object.entries(t?.[r]?.documents??{}).map(([s,c])=>[Ir(s),c])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(de(e=>this.refactorPermissionsWithServerIds(e)),vt(Kt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;"),this.currentUserPermissions$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return Q(this,null,function*(){try{if(this.isRevokeAccessOnUserLogoutEnabled){let e=[],t=this.authService.getUser()?.userId??"";(this.getPermissionsCache()??[]).forEach(a=>{a.userId===t&&a.hasAccess&&(a.type===Mo.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&e.push(T(E({},a),{hasAccess:!1})):e.push(T(E({},a),{hasAccess:!1})))}),e.length>0&&(this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:on(),methodName:qo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:e}}),this.setPermissionsCache([]),yield this.revokeAccess({requests:e,userId:this.authService.getUser()?.userId??""}))}}catch(e){this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",e)}})}revokeAccessOnDocumentUnset(){return Q(this,null,function*(){try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let e=[],t=this.docService.getDocumentIds(),r=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.docService.getDocumentPaths()?.folderId??"",s=this.authService.getUser()?.userId??"",c=this.getPermissionsCache()??[];t.forEach(g=>{c.find(f=>f.resourceId===g.clientDocumentId&&f.type===Mo.DOCUMENT&&f.organizationId===r&&f.userId===s)&&(e.push({userId:s,resourceId:g.clientDocumentId,organizationId:r,type:Mo.DOCUMENT,hasAccess:!1}),c=c.filter(f=>!(f.resourceId===g.clientDocumentId&&f.type===Mo.DOCUMENT&&f.organizationId===r&&f.userId===s)))}),a&&c.find(g=>g.resourceId===a&&g.type===Mo.FOLDER&&g.organizationId===r&&g.userId===s)&&(e.push({userId:s,resourceId:a,organizationId:r,type:Mo.FOLDER,hasAccess:!1}),c=c.filter(g=>!(g.resourceId===a&&g.type===Mo.FOLDER&&g.organizationId===r&&g.userId===s))),r&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&c.find(g=>g.resourceId===r&&g.type===Mo.ORGANIZATION&&g.organizationId===r&&g.userId===s)&&(e.push({userId:s,resourceId:r,organizationId:r,type:Mo.ORGANIZATION,hasAccess:!1}),c=c.filter(g=>!(g.resourceId===r&&g.type===Mo.ORGANIZATION&&g.organizationId===r&&g.userId===s)));let p=on();this.setPermissionsCache(c),e.length>0&&(this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:qo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:e}}),yield this.revokeAccess({requests:e,userId:s}))}}catch(e){this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",e)}})}getAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield sd({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield sd({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}onResourceAccessRequired(c){return Q(this,arguments,function*({requests:e,uniqueId:t,methodName:r,userId:a,fromCache:s=!0}){try{if(!e?.length)return;let p=[],g=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&s&&(e.forEach(f=>{let I=g?.find(D=>D.resourceId===f.resource.id&&D.type===f.resource.type&&D.userId===f.userId&&D.organizationId===f.resource.organizationId);I&&p.push(I)}),p.length>0&&(e=e.filter(f=>!p.find(I=>I.resourceId===f.resource.id&&I.type===f.resource.type&&I.userId===f.userId&&I.organizationId===f.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{requests:e,fromCache:s}});let f=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{result:f}}),f?.success&&f?.data?.length&&(this.setPermissionsCache([...g,...f.data]),f.data=[...p,...f.data]),f}else if(p.length>0)return this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{results:p}}),{data:p,success:!0,statusCode:200};return}catch(p){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",p),this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{error:p,requests:e,fromCache:s}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let s=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(s,a)});let r=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(r)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(rt),ee(y),ee(gn),ee(Fn),ee(Zg),ee(ns),ee(Io),ee(Rt),ee(yi))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vn=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D,N,G,z,J,ce,ye,Oe){this.afAuth=e,this.analyticsService=t,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=c,this.commentUtilsService=p,this.commentAnnotationsResolverService=g,this.databaseService=f,this.docService=I,this.domService=D,this.iamService=N,this.loggingService=G,this.notificationUtilsService=z,this.usersService=J,this.functions=ce,this.userPermissionService=ye,this.coreActionsService=Oe,this.db=fs(),this.notificationsDb=fs(void 0,Dn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.userNotificationsFromServer$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.currentDocumentOnly$=new ve(!1),this.notificationViews$=new ve({}),this.notificationsByIdMap$=new ve(new Map),this.historyPanelVisible$=new ve(!1),this.notificationsForYou$=new ve(null),this.notificationsByDocumentIdMap$=new ve(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new ve(null),this.maxNotificationDays$=new ve(15),this.tabConfig$=new ve({people:{enable:!1}}),this.settingsConfig$=new ve(null),this.muteAllNotifications$=new ve(!1),this.enableSettings$=new ve(!1),this.selfNotifications$=new ve(!1),this.settingsInitialConfig$=new ve([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]),this.notificationsPanelVisible$=new ve(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Fe($e=>!!$e),ot(1)).subscribe($e=>{$e&&(this.db=$e,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},$e=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",$e)}),this.authService.getUser$().subscribe($e=>{$e?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Be=>{this.notificationsByDocumentIdSubscription[Be]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe($e=>{if($e){let Be=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys($e||{}).forEach(be=>{let Se=Be?.[be]?.notifications;Se?.length&&Se.forEach(Ae=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Ae},$e)?.notification})}),this.notificationsByDocumentIdMap$.next(Be)}})}catch($e){this.loggingService.catch("Error in NotificationService constructor: ",$e)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([r,a])=>{t[r]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=Et(this.authService.getUser()?.userId??""),r=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:e?.documentId,userId:t}});if(r?.notificationsConfig)this.setDBConfigDataToInitialConfig(r?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let a={};this.settingsInitialConfig$.getValue().forEach(c=>{if(c.enable){let p=c?.values?.find(g=>g.id===c.default);a[c.id]=p||c?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(a).forEach(c=>{s[c]=a[c].id}),yield this.updateSettingsConfigToDb(s)}}catch(t){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",t)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=Et(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Fe(t=>t===!0),fe(()=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),fe(t=>Do(this.getInitialConfigFromDB(t)).pipe(fe(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:t?.documentId,userId:e}}).pipe(de(r=>{r?.data?.notificationsConfig&&!gi(r?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(r?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.setUserNotificationsFromServer([]),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(fe(()=>this.getCurrentDocumentOnly$().pipe(fe(e=>e?this.docService.getDocumentPaths$().pipe(de(t=>{})):se(void 0)))),tn(()=>{this.notificationsByDocumentIdMap$.next(null)}),fe(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Ti(),de(([e,t])=>{let r=e?.map(g=>g.documentId),a=t?.map(g=>g.documentId),s=r?.filter(g=>!a?.includes(g)),c=a?.map(g=>({documentId:g,timestamp:t?.find(f=>f.documentId===g)?.timestamp})).filter(g=>!r?.includes(g.documentId)),p=a?.map(g=>{let f=t?.find(I=>I.documentId===g)?.timestamp;return{documentId:g,timestamp:f}}).filter(g=>{let f=e?.find(I=>I.documentId===g.documentId)?.timestamp;return f&&g.timestamp&&f!==g.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(g=>{this.removeNotificationsForDocumentId(g)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})))).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(de(r=>{let a=null,s=this.configService.getApiKey(),c=r?.organizationId||t?.organizationId;return s&&c&&(a=new mm({apiKey:s,organizationId:c})),{user:t,documentPaths:a}}))),fe(t=>{let{user:r,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return se(null);if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-c);let p=s.getTime(),g=[_i(ht("timestamp",">=",p),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[ht("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(g.push(Xi("timestamp","desc")),g.push(N9(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:g}}).pipe(de(f=>f?.data),de(f=>{let I=[];return Object.keys(f||{}).forEach(D=>{let N=this.commonDbService.shouldUseFirestore()?f[D]?.timestamp??0:f[D],G=this.commonDbService.shouldUseFirestore()?f[D]?.deletedNotification??!1:!1;if(G&&G.id&&G?.timestamp===N){let z=G.id,J=f[D]?.metadata?.documentId,ce=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ye=ce?.[J]??{documentMetadata:null,notifications:[]},Oe=ye.notifications??[],$e=Oe?.findIndex(Be=>Be.id===z);$e!==-1&&(Oe.splice($e,1),this.notificationsByDocumentIdMap$.next(T(E({},ce),{[J]:T(E({},ye),{notifications:Oe})})))}I.push({documentId:D,timestamp:N})}),I}),zn(f=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",f),se([]))))}return se(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),se([])}}fetchNotificationsForDocumentIds(e,t=15){return Q(this,null,function*(){try{if(e?.length){let r=Ki(this.functions,Zi({url:Dn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let s=this.getStartAtTimestamp(),c={};if(e.forEach(Oe=>{if(Oe?.documentId){let $e=this.getAllowedDocumentMetadataByDocumentId(Oe.documentId);$e&&(c[Oe.documentId]=$e)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let Oe=[];if(e.forEach(Ae=>{this.docService.getDocumentMetadata(Ae.documentId)||Oe.push(Ae.documentId)}),Oe.length){let Ae=this.authService.getUser(),Ce=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let he=yield sd({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Ae?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:Oe},getSdkProxy:Ce,userId:Ae?.userId??""});if(he?.data?.length){let we={};he.data.forEach(Ne=>{Ne?.documentId&&(we[Ne.documentId]=Ne)}),this.docService.setAllDocumentMetadata(E(E({},this.docService.getAllDocumentMetadataMap()),we))}}catch(he){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",he)}}let $e=[],Be=[];e.forEach(Ae=>{let Ce=this.docService.getDocumentMetadata(Ae.documentId);Ce?.clientDocumentId?$e.push({userId:this.authService.getUser()?.userId??"",resource:{id:Ce.clientDocumentId,type:Mo.DOCUMENT,source:qo.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):Be.push(Ae.documentId)}),Be.length&&(e=e.filter(Ae=>!Be.includes(Ae.documentId)));let be=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:be,methodName:qo.GET_NOTIFICATIONS,source:"internal",payload:{requests:$e}});let Se=yield this.userPermissionService?.onResourceAccessRequired({requests:$e,uniqueId:be,methodName:qo.GET_NOTIFICATIONS});Se?.success&&Se?.data?.length?Se.data.forEach(Ae=>{!Ae.hasAccess&&Ae.resourceId&&(e=e.filter(Ce=>Ce.documentId!==Ir(Ae.resourceId)))}):e=[]}catch(Oe){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",Oe),e=[]}if(!e.length)return[];let p=this.userPermissionService?.getPermissionsCache()?.filter(Oe=>Oe.type===Mo.CONTEXT),g={organizationId:a,documentIds:e.filter(Oe=>!!Oe.documentId&&!!Oe.timestamp).map(Oe=>({documentId:Oe.documentId,timestamp:Oe.timestamp??0})),timestamp:s,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:p,retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},f=yield this.notificationUtilsService.handleNotificationEncryption({data:g}),I=yield r({veltData:f}),D=I?.data?.data?.veltData||{},N=I?.data?.data?.veltAdditionalData||{},G="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),z=yield $0(D,G),{userNotifications:J=[],userNotificationIdsInDocNotifications:ce=[],permissionResults:ye=[]}=yield $0(N,G);if(this.userPermissionService?.getIsContextEnabled()){let Oe=[...this.userPermissionService?.getPermissionsCache()??[],...ye??[]];this.userPermissionService?.setPermissionsCache(Oe)}if(z&&typeof z=="object"){let Oe=this.usersService.userDataProviderAvailable(),$e=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Be=[],be=[];Object.keys(z).forEach((Se,Ae)=>{let Ce=z[Se].documentMetadata;if(Ce){let we=this.allowedDocumentMetadataMap$.value||{};(!we?.[Se]||!gi(we?.[Se],Ce))&&this.allowedDocumentMetadataMap$.next(T(E({},we),{[Se]:Ce}))}let he=z[Se].notifications||[];he.forEach(we=>{ce.includes(we.notificationId)&&!J.find(Ne=>Ne.notificationId===we.notificationId)&&J.push(JSON.parse(JSON.stringify(we))),we.notification=this.getClientNotificationObject(we)}),this.setNotificationForDocumentIdInCache(Se,Ce,he),Oe&&(Be.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldAwait:!0,forceResolve:!0})),Be.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldAwait:!0,forceResolve:!0}))),$e&&(be.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldCommentAnnotationsResolverAwait:!0})),be.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldCommentAnnotationsResolverAwait:!0})))}),this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer(),...J]),Oe&&Promise.all(Be).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:z?.[Se]?.notifications||[]});Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})}),$e&&Promise.all(be).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=z?.[Se]?.notifications?.reduce((he,we)=>(he[we.notificationId]=we,he),{});Ce=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Ce}),Ce=Object.values(Ce??{}),Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t.filter((r,a,s)=>a===s.findIndex(c=>c.notificationId===r.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(s);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),g=p?.[e]?.notifications||[],f=this.docService.getLocationMetadatas(),I=r?.map(G=>{let z=G?.notification;return z?(z.metadata&&(z.metadata.documentName=t?.documentName||z.metadata.documentName,z.metadata.organizationMetadata=c||z.metadata.organizationMetadata,z.metadata.documentMetadata=t||z.metadata.documentMetadata),f&&(z=this.notificationUtilsService.mergeLocationWithNotification({notification:z},f)?.notification),z):null})?.filter(G=>!!G)||[],D=new Map(g.map(G=>[G.id,G]));I.forEach(G=>{D.set(G.id,G)});let N=Array.from(D.values()).sort((G,z)=>(z.timestamp||0)-(G.timestamp||0));this.notificationsByDocumentIdMap$.next(T(E({},p),{[e]:{notifications:N,documentMetadata:t}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let t=this.notificationsByDocumentIdMap$.getValue();delete t?.[e],this.notificationsByDocumentIdMap$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",t)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(fe(e=>se(e).pipe(de(t=>{let r=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable();if(r||a){let c=t?.reduce((p,g)=>(p[g.notificationId]=g,p),{});r&&(c=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:c||[]})),a&&(c=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:c||[]})),t=Object.values(c??{})}return t.forEach(c=>{c.notification=this.getClientNotificationObject(c)}),t.sort((c,p)=>p.timestamp-c.timestamp),t.map(c=>c.notification).filter(c=>!!c)}),fe(t=>{let r={data:t?.reduce((a,s)=>(a[s.id]={notification:s},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:r,feature:"allUserNotifications"}).pipe(de(a=>Object.values(a?.data||{}).map(s=>s?.notification)))}))),fe(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(de(()=>e))}),fe(e=>this.allowedDocumentMetadataMap$.pipe(de(()=>e))),de(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=s||t.metadata.organizationMetadata,t.metadata.documentMetadata=a||t.metadata.documentMetadata}return t})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(JSON.parse(JSON.stringify(e))):this.notificationsForYou$.next([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=Rn(e)),t&&typeof t=="object"){let s=tr(t);r=Rn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return ei(this.afAuth).pipe(Fe(s=>!!s),fe(s=>this.isFeatureAllowed({firebaseUser:s})),fe(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(de(c=>(s.featureAllowed=c,s))):se(s)),fe(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(fe(c=>this.docService.getDocumentPaths$().pipe(de(p=>(this.documentPaths=p,c.documentPaths=p,c)))),fe(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>T(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>T(E({},t),{user:r})))),fe(t=>eo(t.config,t.user,Re.NOTIFICATION)?se(T(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Pi(this.db,`${e?r+"/"+U.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+U.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return uM(a).pipe(zn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),de(s=>{let c=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(f=>{let I=s?.raw[f];I?.id&&c.push(I)}),c.forEach(f=>{f.id&&p.set(f.id,f)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(p);let g=[];s?.processed&&Object.keys(s?.processed||{}).forEach(f=>{let I=s?.processed[f];I?.id&&g.push(I)}),this.processedNotifications$.next(g),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),r;e?.email&&(r=Et(e?.email));let a;e?.userId&&(a=Et(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let g=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(g=!0);let f={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:g,notificationSourceData:p.notificationSourceData},I=this.getRawNotificationById(f.id);if(I?.metadata&&(f.metadata={apiKey:I.metadata.apiKey,organizationId:I.metadata.organizationId,clientOrganizationId:I.metadata.clientOrganizationId,documentId:I.metadata.documentId,clientDocumentId:I.metadata.clientDocumentId,location:I?.location,locationId:I?.locationId}),f?.notificationSource==="comment"&&f?.targetAnnotationId){let D=this.commentService?.getAnnotationById(f.targetAnnotationId);D||I?.annotationData&&(D=I.annotationData),D&&(f.notificationSourceData=this.commentService?.getCommentAnnotationForClient(D))}s.set(p.id,f)}}),s.forEach((p,g)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[g]?.views?.[e?.userSnippylyId],s.set(g,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:r,views:a,notification:s}){try{let c=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&c){let g=null;c?.email&&(g=Et(c?.email));let f=null;c?.userId&&(f=Et(c?.userId));let I=!1,D=!0;(g&&p.notifyUsers?.[g]||f&&p.notifyUsersByUserId?.[f])&&(I=!0),f&&a?.[f]&&(D=!1);let N={id:p.id};if(s?N=T(E(E({},N),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:I,isUnread:D}):N={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:I,isUnread:D,metadata:r},N?.notificationSource==="comment"&&N?.targetAnnotationId){let G=this.commentService?.getAnnotationById(N.targetAnnotationId);G||s?.notificationSourceData&&(G=s?.notificationSourceData),G||t?.annotationData&&(G=t.annotationData),G&&(N.notificationSourceData=this.commentService?.getCommentAnnotationForClient(G))}return t?.targetAnnotationData?.isCommentResolverUsed&&(N.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),N}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(de(e=>e?Object.keys(e??{}).map(t=>{let r=e[t].notifications||[],a=r.filter(c=>c.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,r)=>r.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(de(e=>{let t=null;return e?(t=[],e.forEach(r=>{r.notifications.forEach(a=>{t?.push(a)})}),t?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,r=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=t?.documentId?new mm({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),g=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(g))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=Pi(this.notificationsDb),r=this.processNotificationData(e);oM(t,JSON.parse(JSON.stringify(r)))}catch(t){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",t)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(e){return this.authService.getUser$().pipe(fe(t=>t?t.organizationId?this.getAllNotifications$().pipe(fe(r=>this.notificationsForYou$.pipe(de(a=>{if(r||a){let s=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(r||[]).forEach(c=>{c.id&&s.set(c.id,c)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(c=>{c.id&&!s.has(c.id)&&s.set(c.id,c)}),Array.from(s.values()).sort((c,p)=>(p.timestamp||0)-(c.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(de(r=>Array.from(r.values())),de(r=>r.sort((a,s)=>s.timestamp-a.timestamp)),Vu()):se(null)),vt(Kt))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(t){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",t);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(t){this.loggingService.catch("Error in NotificationService setNotificationViews: ",t)}}getNotificationHeadlineMessage(e){try{let t=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,c=r.replace(s,(p,g)=>(g==="actionUser"||g==="recipientUser")&&a[g]?t?.email&&a[g].email===t?.email||t?.userId&&a[g]?.userId===t?.userId?"You":a[g].name||a[g].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[g]?a[g]:p);return this.domService.sanitizeHtml(c)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",t),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let t=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);t=t?.replaceAll(`{{${r.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>'),t=t?.replaceAll(`@User ${r.userId}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(t)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",t),""}}setHistoryPanelVisibility(e,t=!1,r=!1){try{e?document.querySelector(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()));if(e?.length){for(let c=0;c<e.length;c+=50){let g=e.slice(c,c+50).filter(D=>D?.id),f=g.map(D=>this.setNotificationAsRead({notification:D,userNotifications:JSON.parse(JSON.stringify(t))})),I=yield Promise.all(f);g.forEach((D,N)=>{let G=I[N];if(!G.some(J=>J.notificationId===D.id))t=t.filter(J=>J.notificationId!==D.id);else{let J=t.find(ye=>ye.notificationId===D.id),ce=G.find(ye=>ye.notificationId===D.id);J&&ce?.views&&(J.views=ce.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(c=>{let p=c.metadata?.documentId;if(p&&a?.[p]){let g=a?.[p]?.notifications||[],f=g.find(I=>I.id===c.id);f&&(f.isUnread=!1),a[p].notifications=g}}),this.notificationsByDocumentIdMap$.next(a),!gi(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(ot(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(de(e=>e?.filter(r=>r?.isUnread)?.length??null),fe(e=>this.getNotifications$().pipe(de(t=>{let r=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(r){return Q(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let s=Et(a?.userId),{metadata:c}=e;if(c){let{apiKey:p,organizationId:g,documentId:f}=c;if(p&&g&&f&&s){let I=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p}});I?.notificationId&&(I?.views?.[s]||(I.views||(I.views={}),I.views[s]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p},data:I})));let D=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}});if(D?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}}),t=t.filter(N=>N.notificationId!==e.id);else if(!D?.views?.[s]){D.views||(D.views={}),D.views[s]={timestamp:Date.now()};let N=t.find(G=>G.notificationId===e.id);N&&(N.views=D.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:s,documentId:f,organizationId:g},data:D})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(ot(1)).subscribe(t=>{if(t){let r=t.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}catch(t){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",t)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(t){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",t),null}}setSettingsConfig(e){try{this.enableSettings$.value&&this.settingsConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",t)}}setSettingsConfigWithDB(e){try{this.enableSettings$.value&&(this.settingsConfig$.next(e),this.updateSettingsConfigToDb())}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",t)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}enableSelfNotifications(){try{this.selfNotifications$.value!==!0&&this.selfNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSelfNotifications: ",e)}}disableSelfNotifications(){try{this.selfNotifications$.value!==!1&&this.selfNotifications$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSelfNotifications: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let t=!1;if(e.forEach(r=>{["email","inbox"].includes(r.id)&&(t=!r.values?.every(a=>["ALL","NONE","MINE"].includes(a.id)))}),t){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",t)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return Q(this,null,function*(){try{let t=Et(this.authService.getUser()?.userId??""),r=this.docService.getDocumentPaths(),a={apiKey:this.configService.getApiKey(),organizationId:r?.organizationId,documentId:r?.documentId,clientOrganizationId:r?.clientOrganizationId,clientDocumentId:r?.clientDocumentId,userId:t,clientUserId:this.authService.getUser()?.userId};t&&r?.documentId&&this.getEnableSettings()&&this.enableSettings$.value&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:r.documentId,userId:t},data:{id:r.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:a}}))}catch(t){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",t)}})}openNotificationsPanel(){try{this.notificationsPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService openNotificationsPanel: ",e)}}closeNotificationsPanel(){try{this.notificationsPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService closeNotificationsPanel: ",e)}}getNotificationsPanelVisible$(){return this.notificationsPanelVisible$.asObservable()}getNotificationsPanelVisible(){return this.notificationsPanelVisible$.value}};o.\u0275fac=function(t){return new(t||o)(ee(Ai),ee(et),ee(Ue),ee(Rt),ee(gn),ee(gm),ee(Zg),ee(Ks),ee(bn),ee(rt),ee(Le),ee(In),ee(y),ee(dR),ee(Fn),ee(Io),ee(bs),ee(ns))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var jo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new ve(U.CommentAnnotationStatusMap),this._customPriorityMap=new ve(U.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(U.CommentCategoryMap);try{let t=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let r=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(U.CommentAnnotationStatusMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(U.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",t)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(U.CommentAnnotationPriorityMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(U.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r}),this._customPriorityMap.next(t),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",t)}}setCustomCategories(e){try{let t={};e.forEach(r=>{t[r.id]=r}),this._customCategoryMap.next(t),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",t)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return U.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return U.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(t)return t.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[U.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),r=t.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=t.find(([c,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=t.find(([c,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[1]);break}}return e}catch(t){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",t),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=U.CommentAnnotationPriorityMap[e.priority])}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",t)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(t=>U.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var gd=(()=>{let o=class o{constructor(e,t,r){this.domService=e,this.loggingService=t,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,t){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return t&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${t}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(t=>{let r=e[t];if(r.svg)this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${t}" />`;this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[t]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(t){this.loggingService.catch("Error in EmojiService setEmojiList: ",t)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
207
|
+
`+Sa),_d&&tR([we,Ne,to],ol=>{Sa=BI(Sa,ol," ")}),Oe&&yu?Oe.createHTML(Sa):Sa},o.setConfig=function(){let ln=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nf(ln),Pf=!0},o.clearConfig=function(){_c=null,Pf=!1},o.isValidAttribute=function(ln,Ve,At){_c||Nf({});let Xt=gr(ln),uo=gr(Ve);return Ff(Xt,uo,At)},o.addHook=function(ln,Ve){typeof Ve=="function"&&LI(he[ln],Ve)},o.removeHook=function(ln,Ve){if(Ve!==void 0){let At=wNe(he[ln],Ve);return At===-1?void 0:ONe(he[ln],At,1)[0]}return ope(he[ln])},o.removeHooks=function(ln){he[ln]=[]},o.removeAllHooks=function(){he=dpe()},o}var $I=upe();var hpe={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},Le=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.rendererFactory2=t,this.loggingService=r,this.sanitizer=a,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new ve(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new ve([]),this.mousedown=!1,this.windowMouseDown$=new tt,this.windowPointerMove$=new ve(null),this.windowPointerUp$=new ve(null),this.documentSelectionChange$=new ve(null),this.windowClick$=new ve(null),this.windowScroll$=new ve(null),this.windowResize$=new ve(null),this.windowKeyupBackspace$=new ve(null),this.windowKeyupDelete$=new ve(null),this.windowKeyupEsc$=new ve(null),this.windowPopState$=new ve(null),this.documentClick$=new ve(null),this.documentClickSubject$=new tt,this.documentFocus$=new ve(null),this.windowKeydownShift$=new ve(null),this.windowKeyupShift$=new ve(null),this.mutation$=new ve(null),this.childListMutation$=new ve(null),this.networkStatus$=new ve(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new ve({}),this.selectedAnnotationsLocationMap$=new ve({}),this.recordingInProgress$=new ve({}),this.deleteAnnotations$=new ve([]),this.pinHighlighterClass$=new ve(null),this.dialogOpenedInSidebar$=new ve(!1),this.textHighlighterClass$=new ve(null),this.commentPinHighlighter$=new ve(!1),this.deviceInfo$=new ve(new Yn),this.customCss$=new ve(null),this.mutationObserver=null,this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=s=>{try{let c=[];return s.forEach(p=>{if(!Gi(p))if(p instanceof HTMLElement){if(p.className.includes("cdk-overlay-container")||p.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(p.className.includes("cdk-overlay")){let g=!1;p.childNodes.forEach(f=>{Gi(f)&&(g=!0)}),g||c.push(p)}else c.push(p)}else c.push(p)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let s=this.calculateScreenSize();this.currentScreenSize$=new ve(s),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Ti(),tn(([c,p])=>{try{let g=p.filter(I=>!c.includes(I)),f=c.filter(I=>!p.includes(I));f.length&&f.map(D=>document.getElementById(D)).filter(D=>D).forEach(D=>{this.unlistenElementScroll&&this.unlistenElementScroll[D.id]&&this.unlistenElementScroll[D.id]()}),g.length&&g.map(D=>document.getElementById(D)).filter(D=>D).forEach(D=>{this.unlistenElementScroll[D.id]=this.renderer.listen(D,"scroll",N=>{let G=this.calculateScreenSize();this.currentScreenSize$.next(G)})})}catch(g){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",g)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?Ule("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):jle("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(s){this.loggingService.catch("Error in DomService constructor: ",s)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}setDynamicIdPatterns(e){try{let t=e.map(r=>typeof r=="string"?new RegExp(r):r).filter(Boolean);t.length&&(this.dynamicIdPatterns=t)}catch(t){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",t)}}isLikelyDynamicId(e){try{return e?this.dynamicIdPatterns.some(t=>t.test(e)):!1}catch{return!1}}getStableAttributes(e){try{let t={};if(!e.getAttributeNames)return t;let r=new Set(["id","class","style"]);return e.getAttributeNames().forEach(s=>{if(r.has(s)||s.includes("snippyly")||s.includes("velt"))return;let c=e.getAttribute(s);c&&c.length<=256&&(t[s]=c)}),t}catch{return{}}}buildStableElementSelector(e,t){try{if(Object.keys(t).length===0)return;let a=[e.tagName?.toLowerCase()],s=["data-","aria-","role","name","title","type"];return Object.keys(t).sort((p,g)=>{let f=s.findIndex(D=>p.startsWith(D)),I=s.findIndex(D=>g.startsWith(D));return(f===-1?99:f)-(I===-1?99:I)}).slice(0,4).forEach(p=>{let g=CSS.escape(t[p]);a.push(`[${p}="${g}"]`)}),a.join("")}catch{return}}getVisibleText(e,t=400){try{let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a="",s,c=0;for(;(s=r.nextNode())&&a.length<t;){let p=(s.textContent||"").replace(/\s+/g," ").trim();if(p&&(a+=(a?" ":"")+p),c++,c>100)break}return a.slice(0,t)}catch{return""}}hashText(e){try{return wle(e)}catch{return}}generateRobustXPath(e,t){try{let r=t?.maxDepth||10,a=t?.useAbsolutePath||!1,s=[],c=e,p=0;for(;c&&c!==document.documentElement&&p<r;){let D=this.buildRobustXPathSegment(c);if(D&&(s.unshift(D),this.isStrongAnchorSegment(D)))break;c=c.parentElement,p++}if(s.length===0)return;let f=(a?"/":"//")+s.join("/");return s.some(D=>D.includes("[@")||D.includes("[contains(@class"))?f:void 0}catch{return}}buildRobustXPathSegment(e){try{let t=e.tagName.toLowerCase(),r=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let I of r){let D=e.getAttribute(I);if(D)return`${t}[@${I}=${this.escapeXPathValue(D)}]`}let a=Array.from(e.attributes).filter(I=>I.name.startsWith("data-")&&!I.name.includes("snippyly")&&!I.name.includes("velt")&&I.value.length<100).sort((I,D)=>I.value.length-D.value.length);if(a.length>0){let I=a[0];return`${t}[@${I.name}=${this.escapeXPathValue(I.value)}]`}let s=e.getAttribute("role");if(s)return`${t}[@role=${this.escapeXPathValue(s)}]`;let c=e.getAttribute("aria-label");if(c&&c.length<50)return`${t}[@aria-label=${this.escapeXPathValue(c)}]`;let p=e.getAttribute("name");if(p)return`${t}[@name=${this.escapeXPathValue(p)}]`;let g=e.getAttribute("type");if(g)return`${t}[@type=${this.escapeXPathValue(g)}]`;let f=Array.from(e.classList||[]).filter(I=>I.length>0&&I.length<40&&!I.includes("yui")&&!I.includes("velt")&&!I.includes("snippyly")&&!this.excludeClassList.includes(I)).slice(0,2);if(f.length>0){let I=f.map(D=>`contains(@class, ${this.escapeXPathValue(D)})`).join(" and ");return`${t}[${I}]`}if(e.parentElement){let I=Array.from(e.parentElement.children).filter(D=>D.tagName===e.tagName);if(I.length>1){let D=I.indexOf(e)+1;return`${t}[${D}]`}}return t}catch{return}}isStrongAnchorSegment(e){try{return!!(["main","navigation","banner","contentinfo","complementary","search"].some(a=>e.includes(`[@role='${a}']`))||["data-region","data-instanceid","data-activityid"].some(a=>e.includes(`[@${a}=`)))}catch{return!1}}escapeXPathValue(e,t=!0){try{return e.includes("'")?e.includes('"')?`concat(${e.split("'").map(s=>`'${s}'`).join(`,"'",`)})`:t?`"${e}"`:e:t?`'${e}'`:e}catch{try{return`concat(${e.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return t?`'${e}'`:e}}}getElementFromRobustXPath(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}generateAnchorRecord(e,t){try{let r=this.generateAnchorRecordForElement(e,t),a=null;if(e.parentElement&&e.parentElement instanceof HTMLElement&&Di(e.parentElement)&&e.parentElement!==document.body&&(a=e.parentElement),r&&a){let s=this.generateAnchorRecordForElement(a,t);s&&(r.parent=s)}return r}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",r),null}}generateAnchorRecordForElement(e,t){try{if(!e)return null;let r=e,a=r.tagName?.toUpperCase();if(!a)return null;let s=r.id&&!this.isLikelyDynamicId(r.id)?r.id:void 0,c=this.getStableAttributes(r),p=this.buildStableElementSelector(r,c),g=this.getVisibleText(r),f=this.hashText(g||""),I=this.generateRobustXPath(r),D=this.getXPath(r),N=this.getXPath(r,!0),G=this.getXPath(r,!0,!0);return{version:"1.0",id:s,tagName:a,elementSelector:p,robustXPath:I||void 0,xPath:D||void 0,fXPath:N||void 0,cfXPath:G||void 0,contentHash:f?{value:f,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",r),null}}resolveAnchorRecord(e){try{let t=[],r=null,a=(f,I,D=0)=>{let N=[],G=D;if(N.push({method:I,score:D}),e.tagName&&f.tagName?.toUpperCase()===e.tagName&&(G+=10,N.push({method:"tagName-match",score:10})),e.contentHash?.value){let z=this.getVisibleText(f);this.hashText(z)===e.contentHash.value&&(G+=30,N.push({method:"contentHash-match",score:30}))}t.push({el:f,score:G,by:I,scoreBreakdown:N})};if(e.id){let f=document.querySelectorAll(`#${CSS.escape(e.id)}`);if(f.length===1)return{element:f[0],matchedBy:"id",score:90};f.length>1&&f.forEach(I=>a(I,"id-duplicate",70))}if(e.elementSelector){let f=document.querySelectorAll(e.elementSelector);if(f.length===1)return{element:f[0],matchedBy:"element-selector",score:80};f.forEach(I=>a(I,"element-selector-duplicate",60))}if(e.robustXPath){let f=this.getElementFromRobustXPath(e.robustXPath);f&&a(f,"robustXPath",50)}e?.parent&&(r=this.resolveAnchorRecord(e.parent),r.element&&r.element.querySelectorAll(e.tagName?.toLowerCase()||"*").forEach(I=>a(I,"parent+tag",40)));let s=(f,I,D)=>{if(!f)return;let N=this.getElementFromXPath(f);N&&a(N,I||"xpath",D||30)};if(s(e.xPath,"xPath",30),s(e.cfXPath,"cfXPath",30),s(e.fXPath,"fXPath",30),e.contentHash?.value&&t.length===0){let I=D=>{let N=0;for(let G=0;G<D.length&&N<400;G++){let z=D[G];if(N++,!this.isElementVisible(z))continue;let J=this.getVisibleText(z),ce=this.hashText(J);ce&&ce===e.contentHash?.value&&a(z,"contentHash",15)}};if(r?.element&&r?.element instanceof Element){let D=r?.element?.querySelectorAll("*");I(D)}}if(!t.length)return{element:null};t.sort((f,I)=>I.score-f.score);let c=t[0].score,p=t.filter(f=>f.score===c);if(p.length>1){let f=[{path:e.xPath,label:"xPath"},{path:e.cfXPath,label:"cfXPath"},{path:e.fXPath,label:"fXPath"}];for(let I of f)if(I.path){let D=this.getElementFromXPath(I.path);if(D){let N=p.find(G=>G.el===D);if(N)return{element:N.el,matchedBy:`${N.by}+position`,score:N.score,scoreBreakdown:N.scoreBreakdown}}}}let g=t[0];return{element:g.el,matchedBy:g.by,score:g.score,scoreBreakdown:g.scoreBreakdown}}catch(t){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",t),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(de(e=>{e?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentFocus()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe(),this.onDocumentClick()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(t){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",t)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===U.VELT_IGNORE_CHANGE_DETECTION))return;let r=t.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(c=>{let p=c;if(typeof p.getAttribute=="function"){let g=p.getAttribute(U.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(g!==null&&g!==""){let f=this.xpathCacheId.get(g);f!==void 0&&(this.xpathCacheId.delete(g),this.xpathCache.delete(f))}}}),Gi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...t.filter(a=>a.type==="attributes").filter(a=>!Gi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(U.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(U.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{a.target?.closest(c)&&(s=!1)}),s}),r=r.filter(a=>a.target&&Di(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(t){this.loggingService.catch("Error in DomService change detection: ",t)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{Fo(hi(window,"offline").pipe(de(()=>!1)),hi(window,"online").pipe(de(()=>!0)),new Ut(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let t=this.calculateScreenSize();this.deviceInfo$.next(new Yn),this.currentScreenSize$.next(t)})}catch(e){this.loggingService.catch("Error in DomService onWindowResize: ",e)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",e)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",e=>{this.windowScroll$.next(e);let t=this.calculateScreenSize();this.currentScreenSize$.next(t)})}catch(e){this.loggingService.catch("Error in DomService onWindowScroll: ",e)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",e)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",e=>{this.mousedown=!0,this.windowMouseDown$.next(e),this.setPointerPosition(e)})}catch(e){this.loggingService.catch("Error in DomService onPointerDown: ",e)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",e=>{this.windowClick$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowClick: ",e)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",e)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",e)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",e)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",e)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",e)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",e=>{this.windowKeyupEsc$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",e)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",e)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",e=>{this.windowPopState$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowPopState: ",e)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",e)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=e=>{e?.target?.tagName?.toLowerCase()!==U.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return hi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Nl}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",e=>{this.windowPointerMove$.next(e),this.mouseMoveEvent=e})}catch(e){this.loggingService.catch("Error in DomService addPointerMoveListener: ",e)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",e)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",e=>{this.windowPointerUp$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",e)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",e=>{this.documentSelectionChange$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",e)}}updateCurrentMousePosition(e){try{if(this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY,this.currentMousePosition.clientX=e.clientX,this.currentMousePosition.clientY=e.clientY,e.target){let t=this.getXPath(e.target),r=e.target;if(t?.includes("name()='svg'")){let f=this.getXPath(t);f&&(r=f.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,c=e.clientY-a.y,p=s*100/(a.width||1),g=c*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:g,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(t){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",t)}}getTargetElementForCursorPosition(e,t=!0,r=!1,a=!0,s,c=!0,p){try{let g=e,f=g?.touches?.length?g.touches[0]?.clientX:g?.clientX,I=g?.touches?.length?g.touches[0]?.clientY:g?.clientY;p&&(f=p.clientX,I=p.clientY);let D=this.getBackgroundElement(f,I,t,r);if(D&&s&&typeof s=="function"&&(D=s(D)),D){let N=this.getXPath(D),G=this.getXPath(D,!0),z=D.getBoundingClientRect(),J=f-z.x,ce=I-z.y,ye=J*100/(z.width||1),Oe=ce*100/(z.height||1),$e={xpath:N,fXpath:G,leftPercentage:ye,topPercentage:Oe};if(a){let Be=this.getXPath(D,!0,!0);$e.cfXpath=Be}if(c){let Be=this.generateAnchorRecord(D);Be&&($e.anchor=Be)}return $e}else return null}catch(g){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",g),null}}getBackgroundElement(e,t,r=!0,a=!1){try{let s=document.elementsFromPoint(e,t),c=[];s.forEach(g=>{Gi(g)?c=[]:Di(g)&&c.push(g)}),a&&(c=c.filter(g=>this.isElementVisibleOnScreen(g)));let p=0;return r||c?.forEach((g,f)=>{g.tagName.toLowerCase()==="svg"&&(p=f)}),c[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,t){try{let r=document.elementsFromPoint(e,t),a=[];return r.forEach(s=>{Gi(s)&&Di(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(t){this.loggingService.catch("Error in DomService setPointerPosition: ",t)}}getCurrentWindowSize$(e){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let e=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),t=this.currentMousePosition?.pageX||e.x+200,r=Math.min(t,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(e,t,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,U.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),c=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(U.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,r,a=!1){try{e&&(this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(U.VELT_SELECTION_COLOR)&&e.style.setProperty(U.VELT_SELECTION_COLOR,t),r&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(U.VELT_SELECTION_COLOR),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(U.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(U.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,t=!1,r=!1,a){try{let s=this.calculateXPath(e,t,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let c=s.split("/"),p=!1;c.forEach((g,f)=>{g.includes("svg")&&(p=!0),p&&(c[f]="svg:"+g)}),s=c.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,t,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!t)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let c=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(c){let p=this.calculateXPath(e.parentNode,t,r,a)+"/"+e.tagName.toLowerCase(),g=Array.from(e.parentNode?.children||[]).filter(f=>f.nodeType===1&&f.tagName===e.tagName?f.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===c:!1);if(g.length>1){let f=g.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${f}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(c){return c.tagName==e.tagName});return this.calculateXPath(e.parentNode,t,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}getElementFromXPath(e,t=document){try{if(this.xpathCache.has(e)){let a=this.xpathCache.get(e);if(a!==void 0&&document.contains(a))return a;this.xpathCache.delete(e)}let r=this.getXPath(e,!1,!1,t);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=on();a.setAttribute(U.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}getElementFromTargetElement(e){try{let t=null;if(e?.anchor){let r=this.resolveAnchorRecord(e.anchor);r?.element&&(t=r.element)}else e?.xpath?t=this.getElementFromXPath(e.xpath):e?.cfXpath?t=this.getElementFromXPath(e.cfXpath):e?.fXpath&&(t=this.getElementFromXPath(e.fXpath));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",t),null}}getElementFromTargetTextRange(e){try{let t=null;if(e?.commonAncestorContainerAnchor){let r=this.resolveAnchorRecord(e.commonAncestorContainerAnchor);r?.element&&(t=r.element)}else e?.commonAncestorContainer&&(t=this.getElementFromXPath(e.commonAncestorContainer));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",t),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],t=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let r=new MI;return r.screenWidth=Math.max(...t),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new MI}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(I=>{I.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(I=>{I.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(I=>{I?.parentNode?.insertBefore(document.createTextNode(I?.textContent),I),I.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),g;for(;g=p.nextNode();)g?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(t){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",t),e}}mergeAdjacentTextNodes(e){try{let t=e.firstChild;for(;t;){if(t.nodeType===Node.TEXT_NODE){let r=t.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)t.textContent+=r.textContent,r.remove(),r=t.nextSibling}t=t.nextSibling}}catch(t){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",t)}}findLongestNode(e){try{for(let t=e.length-1;t>=0;t--){if(e[t]?.scrollHeight&&e[t]?.clientHeight){let r=Math.max(e[t]?.scrollHeight,e[t]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=e[t]}e[t]?.childNodes?.length&&this.findLongestNode(e[t]?.childNodes)}}catch(t){this.loggingService.catch("Error in DomService findLongestNode: ",t)}}resetSelectedAnnotationsMap(e=!0,t){try{let r=Array.from(document.querySelectorAll(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(f=>f.classList.contains("velt-annotation-draft-checked")?(f.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(f,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(f,"velt-comment-dialog-shake"),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||f.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(f,"velt-annotation-draft-checked")},100),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(f=>f),c=Object.keys(this.getRecordingInProgress()||{});s=[...s,...c];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let f=[];Object.keys(p).forEach(I=>{if(p[I]?.type==="tag"){let D=p[I];D?.to?.length||s.includes(I)||f.push(D)}else p[I]?.comments?.length||s.includes(I)||f.push(p[I])}),this.deleteAnnotations$.next(f),this.deleteAnnotations$.next([])}let g={};Object.keys(p).forEach(f=>{if(s.includes(f)&&(g[f]=p[f]),t)switch(t){case"comment":["comment","videoPin"].includes(p[f]?.type)||(g[f]=p[f]);break;default:p[f]?.type!==t&&(g[f]=p[f]);break}}),Object.keys(g).forEach(f=>{let I=g[f]?.multiThreadAnnotationId;I&&!g[I]&&(g[I]={annotationId:I,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(g)&&this.selectedAnnotationsMap$.next(g),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(T(E({},this.recordingInProgress$.value),{[e]:t}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${U.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${U.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let t=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(t).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(t[a].type)&&(r[a]=t[a]);break;default:t[a].type===e&&(r[a]=t[a]);break}}),r}else return t}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",t),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(de(t=>{if(e){let r={};return Object.keys(t).forEach(a=>{t[a].type===e&&(r[a]=t[a])}),r}else return t}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(de(e=>Object.values(e)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(e){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",e),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(e,t,r,a=!1,s){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let c=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),p=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));c[e.annotationId]&&!a?delete c[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(c={}),c[e.annotationId]=e,p[e.annotationId]=t,s=e?.multiThreadAnnotationId||s,s&&(c[s]={annotationId:s,type:"multiThread"},p[s]=t)),this.selectedAnnotationsMap$.next(c),Object.keys(p).forEach(g=>{c[g]||delete p[g]}),this.selectedAnnotationsLocationMap$.next(p)}catch(c){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",c)}}setSelectedAnnotationLocation(e,t){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==t&&(r[e]=t,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let t=this.selectedAnnotationsMap$.value;e.forEach(r=>{t[r.annotationId]&&(t[r.annotationId]=r)}),this.selectedAnnotationsMap$.next(t)}catch(t){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",t)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),se([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService onDomChange$: ",t),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(e,t){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===t){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==t)if(e?.closest("svg"))for(;a&&a!==t;){let c=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let g=p.getBoundingClientRect(),f=a.getBoundingClientRect();r.offsetLeft+=f.left-g.left,r.offsetTop+=f.top-g.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===t){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let c=window.getComputedStyle(a);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:t,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return t>0||r>0||a<window.innerHeight&&s>0}else return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisible: ",t),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let t=e,r=window.getComputedStyle(t);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",t),!1}}getClickAndDragPointsObservable(){return new Ut(e=>{let t=hi(document,"mousedown").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=hi(document,"mousemove").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=hi(document,"mouseup").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),c=t.pipe(fe(p=>r.pipe(Ti(),de(([g,f])=>({startPoint:p,prevPoint:g,curPoint:f})),fo(a)))).subscribe(e);return()=>c.unsubscribe()})}drawRectangle(e,t){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),c=Math.min(e.x,t.x),p=Math.min(e.y,t.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${c}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let t={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let c=this.getTextXPath(r);this.isXpathWithId(c)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let c=this.getElementFromXPath(t.commonAncestorContainer);if(c){t.commonAncestorContainerFXpath=this.getXPath(c,!0),t.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let p=this.generateAnchorRecord(c);p&&(t.commonAncestorContainerAnchor=p)}}return t.text=e.toString(),t.occurrence=Jh(a,0,e.startContainer,e.startOffset,e.toString())+1,t}catch(t){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",t);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let t=1,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&t++,r=r.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(t){this.loggingService.catch("Error in DomService getTextXPath: ",t);return}}getHostElement(e){try{if(U.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.parentElement:e.parentElement}let t=e.closest("svg");return t?t?.parentElement:e}catch(t){return this.loggingService.catch("Error in DomService getHostElement: ",t),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(t){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",t),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(t){return this.loggingService.catch("Error in DomService isXpathWithId: ",t),!1}}getListedElements({elementIds:e,elementClassNames:t,elementQuerySelectors:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let c=document.getElementById(e[s]);c&&a.push(c)}if(t?.length)for(let s=0;s<t.length;s++){let c=document.getElementsByClassName(t[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}if(r?.length)for(let s=0;s<r.length;s++){let c=document.querySelectorAll(r[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementById(t[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementsByClassName(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.querySelectorAll(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(t)||e.classList?.add(t))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(t)&&e.classList?.remove(t)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,t,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(t)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(t){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",t)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(e){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",e),!1}}setCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(e)}catch(t){this.loggingService.catch("Error in DomService setCustomCss: ",t)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getCustomCss$: ",e),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let t=this.customCss$.value;if(t){let r=e?.shadowRoot?.querySelector(`[${U.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(U.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(U.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(t){this.loggingService.catch("Error in DomService injectCustomCss: ",t)}}trimCommentHtml(e){try{let t=document.createElement("div");t.innerHTML=e,this.removeEmptyElements(t);let r=t.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(t){return this.loggingService.catch("Error in DomService trimCommentHtml: ",t),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var t=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.childNodes.forEach(t=>{t.nodeType===Node.TEXT_NODE?t.nodeValue=t.nodeValue?.replace(/\s+/g," ").trim()??"":t.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(t)})}catch(t){this.loggingService.catch("Error in DomService normalizeWhitespace: ",t)}}sanitizeHtml(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),$I.sanitize(e,hpe)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return $I.sanitize(e,hpe)}catch(t){return this.loggingService.catch("Error in DomService sanitizeSvg: ",t),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new Yn;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new Yn)}}getTabId(){try{let e=sessionStorage.getItem(U.SESSION_STORAGE.VELT_TAB_ID);!e&&this.tabId&&(e=this.tabId,sessionStorage.setItem(U.SESSION_STORAGE.VELT_TAB_ID,e)),!this.tabId&&e&&(this.tabId=e);let t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=on(),this.tabId=e,sessionStorage.setItem(U.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}catch(t){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",t)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo: ",e),new Yn}}isMobileDevice(){try{return new Yn().getDeviceType()===lr.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new Yn().getDeviceType()===lr.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new Yn().getDeviceType()===lr.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var t=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(r=>{t.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?t.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&t.appendChild(document.createTextNode(r.nodeValue))}),t}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let t=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",t)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(t){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",t)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(c=>{s.setAttribute(c.name,c.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new Yn().getDeviceType()===lr.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Xo),ee(y),ee(pl))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ue=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.afAuth=e,this.configService=t,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=c,this.analyticsService=p,this.loggingService=g,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new Vo,this.firebaseConfig$=new ve(null),this.advancedQueries$=new ve(null),this.planDetails$=new ve(null),this.signOutPreviousUser$=new ve(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=ei(this.afAuth).pipe(no(this.afAuth.currentUser),Ti(),fe(([f,I])=>this.domService.onNetworkStatusChange$().pipe(Fe(D=>D),ot(1),de(()=>({previousUser:f,currentUser:I}))))).subscribe(D=>Q(this,[D],function*({previousUser:f,currentUser:I}){if(!I&&f){let N=f?.stsTokenManager?.expirationTime,G=new Date().getTime(),z=N-G;G>N&&(this.analyticsService.trackEvent(Z.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(Z.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(Z.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(vt(Kt)).subscribe(f=>{let I=Er(f);this.coreActionsService.triggerAction(Un.USER_UPDATE,I),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Un.USER_UPDATE,payload:{user:I}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}setApiKey(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",e);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=e,this.configService.setApiKey(this.apiKey),t||(t=new U9),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||ei(this.afAuth).pipe(ot(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield sp(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&(s=yield this.updateUserWithColorAndTextColor(s),this.initializeClient(s,this.userOptions$?.value?T(E({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin"))}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService: ",t)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(t){this.loggingService.catch("Error in setDocService: ",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in setContactService: ",t)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(t){this.loggingService.catch("Error in setIamService: ",t)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(t){this.loggingService.catch("Error in setAreaService: ",t)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService: ",t)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(t){this.loggingService.catch("Error in setReactionService: ",t)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(t){this.loggingService.catch("Error in setRecorderAnnotationService: ",t)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(t){this.loggingService.catch("Error in setViewsService: ",t)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService: ",t)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;if(!e.user)return null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let r=yield iz(()=>window.Velt.identify(e.user,E(E({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}).catch(a=>(e.onError&&typeof e.onError=="function"&&e.onError(a),Promise.reject(a))),e.retryConfig||{retryCount:0,retryDelay:0});return r&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(Un.ERROR).pipe(Fe(a=>a.code==="token_expired"),ot(10)).subscribe(a=>Q(this,null,function*(){if(a.code==="token_expired"){let s=this.docService?.getDocumentIds()?.map(D=>({id:D.clientDocumentId}))??[],c=this.docService?.getOptionsFromDocumentPaths()??void 0,p=[],g=this.docService?.getLocation();g&&p.push(g.location);let f=this.docService?.getLocations();f&&Object.values(f).forEach(D=>{p.push(D.location)}),(yield iz(()=>Q(this,null,function*(){try{let D=yield e.generateToken?.();return D?window.Velt.identify(e.user,E(E({},e.options||{}),D&&{authToken:D}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:s,options:c,source:"internal"}),yield this.docService?.setLocations({locations:p,source:"internal",options:{appendLocation:!g}}))}}))),r}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}setUserToStorage(e){return Q(this,null,function*(){try{if(e){let t=yield Il(e,e?.userId??"");localStorage.setItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER,t)}}catch(t){this.loggingService.catch("Error in setUserToStorage: ",t)}})}getUserFromStorage(e){return Q(this,null,function*(){try{let t=localStorage.getItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER);return t?yield $0(t,e?.userId??""):null}catch(t){return this.loggingService.catch("Error in getUserFromStorage: ",t),null}})}updateUserWithColorAndTextColor(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(e??{})),r=yield this.getUserFromStorage(t);return!r||Object.keys(r).length===0?(delete t?.color,delete t?.textColor,t):(r?.color&&(t.color=r?.color),r?.textColor&&(t.textColor=r?.textColor),t)}catch(t){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",t),e}})}updateUserIfRequired(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let t=yield this.getUserFromStorage(e),r={};if(e.color&&e.color!==t?.color&&(r.color=e.color),e.textColor&&e.textColor!==t?.textColor&&(r.textColor=e.textColor),Object.keys(r).length>0&&e.clientOrganizationId){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));sd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e.clientOrganizationId},user:T(E({},r),{userId:e.userId})},getSdkProxy:a,userId:e?.userId??""})}}catch(t){this.loggingService.catch("Error in updateUserIfRequired: ",t)}})}initializeClient(e,t,r,a,s){return Q(this,null,function*(){try{if(this.loggingService.logPerf(`[PERF] identify() called at ${performance.now().toFixed(2)}ms`),this.autoLoginRequired=!1,this.userOptions$.next(t),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=G0(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let c=yield ei(this.afAuth).pipe(ot(1)).toPromise().catch(g=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),c){let g=yield sp(c,!0).catch(D=>null);if(!g)return;let{user:f,firebaseConfig:I}=g.claims;if(c?.uid!==e?.userSnippylyId||e?.groupId!==f?.groupId||e?.organizationId!==f?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,I)||this.forceReLoginRequiredForCommentViews(e))localStorage.setItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield sp(c,!0).catch(J=>null);if(!D)return;let{firebaseConfig:N,user:G,advancedQueries:z}=D.claims;yield this.updateUserIfRequired(e),this.validateOrganizationId(e),this.setFirebaseConfig(N),this.setAdvancedQueries(z),G&&(this.providedUser.isAdmin=!!G.isAdmin),this.initializeSignedInUser(c,a,e),p=!1,this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let g=Ki(this.functions,Zi({url:Dn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),f=ga(),I=(yield g({apiKey:this.apiKey,user:e,version:f,authToken:t?.authToken}))?.data;if(I.error){if(this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_FAILED,T(E({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:I.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},I),{source:s}),!0,e.userSnippylyId,e.userId),I.error&&typeof I.error=="string")if(I.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(Un.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries.",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(Un.ERROR,D),this.analyticsService.trackEvent(Z.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}else{let D=I;this.coreActionsService.triggerAction(Un.ERROR,D)}throw I}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(Z.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),I.firebaseConfig){this.setFirebaseConfig(I.firebaseConfig),yield this.signInWithCustomToken(e,I.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield sp(this.afAuth.currentUser,!0).catch(z=>null);if(!D)return;let{user:N,advancedQueries:G}=D.claims;this.setAdvancedQueries(G),this.providedUser.isAdmin=!!N?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a,e)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),t?.throwError?Promise.reject(c):Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=ga();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}isVersion4Point5(){try{let e=ga();if(e){let t=e.split("."),r=parseInt(t[0]||"0"),a=parseInt(t[1]||"0"),s=parseInt(t[2]||"0");if(r>=4&&a>=5)return r===4&&a===5&&s===0?!e.toLowerCase().includes("beta"):!0}return!1}catch(e){return this.loggingService.catch("Error in isVersion4Point5: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(U.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",t),!1}}forceReLoginRequiredForCommentViews(e){try{let t=this.isVersion4Point5(),r=!1;try{let a=localStorage.getItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);a&&(r=JSON.parse(a))}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",t),!1}}forceReLoginRequiredForRegion(e,t){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!t?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:E(E({},Dn.firebaseConfig),e)})}catch(t){this.loggingService.catch("Error in setFirebaseConfig: ",t)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(U.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}catch(t){this.loggingService.catch("Error in setAdvancedQueries: ",t)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled$(){return dn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(de(()=>this.getAdvancedQueriesEnabled()),zn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),ei(this.afAuth).pipe(fe(e=>e?this.user$.asObservable():se(null)),vt(Kt))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let t=this.user$.value;if(e.userId&&e.userId!==t?.userId||e?.groupId&&e?.groupId!==t?.groupId||e?.organizationId&&e?.organizationId!==t?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=E(E({},this.providedUser),e),t){let r=E(E({},t),e);this.updateUserInternally(r)}}catch(t){this.loggingService.catch("Error in updateUser: ",t)}}signInWithCustomToken(e,t,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return oie(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let a=new Vo;a.userSnippylyId=e.uid,a.type="signedIn",r&&(a=E(E({},a),r)),this.setUserToStorage(a),this.mergeUserWithProvidedUserData(a,t)}catch(a){this.loggingService.catch("Error in initializeSignedInUser: ",a)}}mergeUserWithProvidedUserData(e,t){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.externalUserDataProviderAvailable()){let a=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0});a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=E(E({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?.color||this.providedUser?.color||this.getUserAvatarColor(e.userId),e.textColor=r?.textColor||this.providedUser?.textColor||this.getUserTextColor(e.userId),e.initial=r?.initial||this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let t=Object.assign({},e);delete t.contacts,this.analyticsService.identifyUser(e.userSnippylyId,t,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||this.getPlanDetailsFromDb();try{if(this.userPermissionService?.isPermissionProviderAvailable()&&e.clientOrganizationId){let r=[{userId:e.userId,resource:{id:e.clientOrganizationId,type:Mo.ORGANIZATION,source:qo.IDENTIFY,organizationId:e.clientOrganizationId}}],a=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:qo.IDENTIFY,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:r}}),yield this.userPermissionService?.onResourceAccessRequired({requests:r,uniqueId:a,userId:e.userId,methodName:qo.IDENTIFY,fromCache:!1})}}catch(r){this.loggingService.catch("Error in updateUserInternally: ",r)}this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(t){this.loggingService.catch("Error in updateUserInternally: ",t)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let t=JSON.parse(JSON.stringify(e)),r=T(E({},t),{lastUpdated:new Date})}catch(t){this.loggingService.catch("Error in updateUserToFirebase: ",t)}}getPlanDetailsFromDb(){return Q(this,null,function*(){try{this.getPlanDetailsCalled=!0;let t=yield Ki(this.functions,Zi({url:Dn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:ga(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(Z.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(t?.data||{planInfo:null,isPlanExpired:!1}),t}catch(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Fe(e=>!!e),de(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,t){try{this.preSignOutFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(t.metadata=e,this.userOrganization$.next(t)):this.userOrganization$.next(null)}catch(t){this.loggingService.catch("Error in setUserOrganization: ",t)}}setOrganizationUserGroups(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===t?.metadata?.organizationId&&(t.groups=e,this.userOrganization$.next(t))}catch(t){this.loggingService.catch("Error in setUserOrganizationGroups: ",t)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(fe(e=>e?this.userOrganization$.asObservable().pipe(de(t=>t?.metadata?.organizationId===e.organizationId?t:null)):se(null)))}signOutUser(e="internal"){return Q(this,null,function*(){try{e==="external"&&this.onRetrySubscription?.unsubscribe(),this.userPermissionService?.revokeAccessOnUserLogout(),yield this.analyticsService.trackEvent(Z.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let t=yield ei(this.afAuth).pipe(ot(1)).toPromise().catch(r=>null);if(t){this.resetServicesCache(),this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(t)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.user$.next(null),yield im(1e3),rie(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(t){this.loggingService.catch("Error in signOutUser: ",t)}})}isFeatureAllowed(e){return eo(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let t=JSON.parse(JSON.stringify(e));return delete t.contacts,t}else return null}catch(t){return this.loggingService.catch("Error in getUserWithoutContacts: ",t),null}}getUserForClient(e){try{return Er(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(Rn(e)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(e){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(e){try{e.forEach(t=>{try{t?.color||(t.color=this.getUserAvatarColor(t?.userId)),t?.textColor||(t.textColor=this.getUserTextColor(t?.userId)),!t?.initial&&(t?.name||t?.email)&&(t.initial=t.name?.charAt(0).toUpperCase()||t.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};o.\u0275fac=function(t){return new(t||o)(ee(Ai),ee(Rt),ee(dm),ee(ns),ee(Le),ee(Io),ee(et),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var mm=class{constructor({apiKey:o,documentId:n,organizationId:e,folderId:t,veltFolderId:r,clientDocumentId:a,clientOrganizationId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.folderId=t,this.veltFolderId=r,this.clientDocumentId=a,this.clientOrganizationId=s,a&&(this.documentId=Ir(a)),s&&(this.organizationId=Ja(s)),t&&(this.folderId=t,this.veltFolderId=ji(t)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var oR=class{constructor({apiKey:o,documentId:n,organizationId:e,clientDocumentId:t,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.veltFolderId=s,t&&(this.documentId=Ir(t)),r&&(this.organizationId=Ja(r)),a&&(this.folderId=a,this.veltFolderId=ji(a)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${U.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var rR=class{};var bn=(()=>{let o=class o{constructor(e,t){this.authService=e,this.loggingService=t,this.db$=new ve(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(mM(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ks=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new ve(null),this.commentAnnotationById$=new ve({}),this.fieldsToRemove=[],this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig),r.config?.fieldsToRemove&&(this.fieldsToRemove=r.config.fieldsToRemove))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((c,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return s(),c({});let f={},I=[...new Set(e.commentAnnotationIds||[])],D=T(E({},e),{commentAnnotationIds:I});Q(this,null,function*(){try{if(I.length>0||e.documentIds?.length||e.folderId){let G=ad(()=>g?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(z=>r?{}:(s(),z&&z.statusCode!==200?(this.loggingService.catch(z?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):z?.data)).catch(z=>{throw s(),z});try{f=(yield G)||{},this.analyticsService.trackEvent(Z.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:I});let z={};Object.entries(f).forEach(([J,ce])=>{let ye=this.commentAnnotationById$.value?.[J];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ce)&&(z[J]=ce):z[J]=ce}),Object.keys(z).length>0&&this.commentAnnotationById$.next(E(E({},this.commentAnnotationById$.getValue()),z)),c(z)}catch(z){r||p(z),c(f)}}else s(),c({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",t),{}}})}saveCommentAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let t=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=E(E({},r),e.commentAnnotation);let a=yield ad(()=>t?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=E({},a);delete s?.[e],this.commentAnnotationById$._value=s;let c=yield ad(()=>r?.delete({commentAnnotationId:e.toString(),metadata:t,event:Oa.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",t);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",e),this.fieldsToRemove}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",t)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var pm=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((c,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return s(),c({});let f={},I=[...new Set(e.reactionAnnotationIds||[])],D=T(E({},e),{reactionAnnotationIds:I});Q(this,null,function*(){try{if(I.length>0||e.documentIds?.length||e.folderId){let G=ad(()=>g?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(z=>r?{}:(s(),z&&z.statusCode!==200?(this.loggingService.catch(z?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):z?.data)).catch(z=>{throw s(),z});try{f=(yield G)||{},this.analyticsService.trackEvent(Z.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:I});let z={};Object.entries(f).forEach(([J,ce])=>{let ye=this.reactionAnnotationById$.value?.[J];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ce)&&(z[J]=ce):z[J]=ce}),Object.keys(z).length>0&&this.reactionAnnotationById$.next(E(E({},this.reactionAnnotationById$.getValue()),z)),c(z)}catch(z){r||p(z),c(f)}}else s(),c({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",t),{}}})}saveReactionAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let t=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=E(E({},r),e);let a={reactionAnnotation:e,event:Oa.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield ad(()=>t?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=E({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let c=yield ad(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:t,event:Oa.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return c&&c.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",t);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",t)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var rt=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.analyticsService=e,this.authService=t,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=c,this.commentResolverService=p,this.reactionResolverService=g,this.coreActionsService=f,this.functions=I,this.documentPaths$=new ve(null),this.docContext$=new ve(null),this.documentIds$=new ve([]),this.organizationConfig$=new ve(null),this.firestorePaths$=new ve(null),this.location$=new ve(null),this.excludedLocationIds$=new ve([]),this.organizationMetadata$=new ve(null),this.documentMetadata$=new ve(null),this.locationMetadata$=new ve(null),this.customerMetadata$=new ve(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new ve({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new ve({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new tt,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe($o(this.DEBOUNCE_TIME)).subscribe({next:D=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(D.documentId,D.clientOrganizationId,D.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:D=>{this.loggingService.catch("Error in setDocumentId subscription:",D),this.queueSize--}}),this.databaseService.getDb().pipe(Fe(D=>!!D),ot(1)).subscribe(D=>{D&&(this.db=D)}),this.configService.getApiKey$().subscribe(D=>{if(this.apiKey=D,this.apiKey){if(!this.isCustomDocId){let N=Tk(window.location.href);this.currentUrl=N}this.analyticsService.updateDefaultProperties({apiKey:D})}}),this.authService.getUser$().subscribe(D=>Q(this,null,function*(){if(D&&(this.analyticsService.updateDefaultProperties({organizationId:D?.organizationId,clientOrganizationId:D?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&D?.organizationId&&this.documentPaths$.value?.organizationId!==D?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(N=>({id:N.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),D?.organizationId&&D?.clientOrganizationId)){let N={organizationId:D?.organizationId,clientOrganizationId:D?.clientOrganizationId};this.getOrganizationConfig()||this.organizationConfig$.next({organizationId:D?.organizationId,clientOrganizationId:D?.clientOrganizationId}),yield this.updateOrganizationMetadata(N)}})),this.documentPaths$.subscribe(D=>{let N={documentId:D?.documentId,clientDocumentId:D?.clientDocumentId,folderId:D?.folderId,allDocuments:D?.allDocuments,veltFolderId:D?.veltFolderId};D?.organizationId&&(N.organizationId=D.organizationId,N.clientOrganizationId=D.clientOrganizationId),this.analyticsService.updateDefaultProperties(N),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(D=>{this.analyticsService.updateDefaultProperties({clientLocation:D?.location,locationId:D?.locationId})}),this.organizationMetadata$.subscribe(D=>{this.authService.setUserOrganization(D?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Fe(D=>!!D),ot(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(D){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",D)}},D=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",D)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(D){this.loggingService.catch("Error in DocService constructor:",D)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,organizationId:this.documentPaths$.value?.clientOrganizationId}:null}catch(e){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",e),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.organizationConfig$.next(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(e=>e.location)].filter(e=>e!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setCommonDbService(e){try{this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService:",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService:",t)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService:",t)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=Tk(location.href);this.currentUrl!==e&&(this.currentUrl=e,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowPopstate: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let e=Tk(location.href);this.currentUrl!==e&&(this.currentUrl=e,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowClick: ",e)}}setDocument(s){return Q(this,arguments,function*({documentId:e,documentMetadata:t,options:r,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),a==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pa.SET_DOCUMENTS,source:a,payload:{documentId:e,documentMetadata:t,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:E({organizationId:t?.organizationId},r??{}),source:a})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}shouldSetDocumentsAgain(e,t={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentPaths$.value?.clientDocumentId,a=t?.rootDocumentId??e[0]?.id,s=this.documentIds$.value.map(g=>g.clientDocumentId),c=YH(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(g=>s.includes(g.id))||!gi(c,t)||r!==a}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:t=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,c=`${Rn(s)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:c,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(s){return Q(this,arguments,function*({documents:e,options:t,source:r="internal",skipPermissionValidation:a=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:r}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pa.SET_DOCUMENTS,source:r,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:r,skipPermissionValidation:a})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}setRootDocument(r){return Q(this,arguments,function*({document:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Pa.SET_ROOT_DOCUMENT,source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(c=>c.clientDocumentId);if(!s.includes(e.id)){let c=[...s.map(g=>({id:g})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:c,setClientDocumentMetadataMap:!0});this.documentIds$.next(p)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocContext(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let t=JSON.parse(JSON.stringify(e??null));this.docContext$.next(t)}catch(t){this.loggingService.catch("Error in setDocContext: ",t)}}getDocContext(){return this.docContext$.getValue()}getProcessedDocContext(){return Jle(this.getDocContext())}filterRelevantDocuments(a){return Q(this,arguments,function*({options:e,documentIds:t,skipPermissionValidation:r=!1}){try{let s=this.authService.getUser();return!s||!this.commonDbService?.shouldUseFirestore()||(t=yield this.fetchDocumentsFromFolder(e,t,s),yield this.handlePermissionProvider(e,t,s),t=yield this.filterDocumentsByPermissions(e,t,s,r),t=t.slice(0,50)),t}catch(s){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",s),t}})}fetchDocumentsFromFolder(e,t,r){return Q(this,null,function*(){if(!e?.folderId||!e?.allDocuments)return t;try{let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield sd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:e?.organizationId??r?.clientOrganizationId,folderId:e?.folderId}},getSdkProxy:a,userId:r?.userId??""}))?.data?.forEach(c=>{t.find(p=>p.clientDocumentId===c.id)||t.push({documentId:Ir(c.id),clientDocumentId:c.id})})}catch(a){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",a)}return t})}buildPermissionRequests(e,t,r){try{let a=[];return e.organizationId&&e.organizationId!==r.clientOrganizationId&&a.push({userId:r.userId,resource:{id:e.organizationId,type:Mo.ORGANIZATION,source:qo.SET_DOCUMENTS,organizationId:e.organizationId}}),e.folderId&&a.push({userId:r.userId,resource:{id:e.folderId,type:Mo.FOLDER,source:qo.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}}),t&&t.forEach(s=>{a.push({userId:r.userId,resource:{id:s.clientDocumentId,type:Mo.DOCUMENT,source:qo.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}})}),e?.context&&this.userPermissionService?.getIsContextEnabled()&&ece({input:e?.context}).forEach(c=>{let p=JSON.stringify(c.access);a.push({userId:r.userId,resource:{id:p,type:Mo.CONTEXT,source:qo.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??"",context:c}})}),a}catch(a){return this.loggingService.catch("Error in buildPermissionRequests:",a),[]}}processAccessibleContexts(e,t){try{if(!e?.success||!e?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let r=e.data.filter(a=>a.type===Mo.CONTEXT&&a.hasAccess).map(a=>a.resourceId);if(r?.length){let a=t.filter(c=>r.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),s=tce({input:a});s?.access&&this.setDocContext(s)}}catch(r){this.loggingService.catch("Error in processAccessibleContexts:",r)}}handlePermissionProvider(e,t,r){return Q(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{let a=this.buildPermissionRequests(e,t,r),s=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:qo.SET_DOCUMENTS,uniqueId:s,timestamp:new Date().getTime(),source:"internal",payload:{requests:a}});let c=yield this.userPermissionService?.onResourceAccessRequired({requests:a,uniqueId:s,methodName:qo.SET_DOCUMENTS,fromCache:!1});this.processAccessibleContexts(c,a)}catch(a){this.loggingService.catch("Error in handlePermissionProvider:",a)}})}filterDocumentsByPermissions(e,t,r,a=!1){return Q(this,null,function*(){if(a)return t;let s=this.currentValidationToken,c=[...t];return s&&this.validatePermissionsInBackground(e,t,r,s),c})}validatePermissionsInBackground(e,t,r,a){let s=e?.organizationId??r?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:t.map(c=>c.clientDocumentId),folderIds:e?.folderId?[e?.folderId]:[]}).then(c=>{if(this.currentValidationToken===a&&c){this.userPermissionService?.setCurrentUserPermissions(c);let p=[];Object.entries(c?.[r.userId]?.documents??{}).forEach(([g,f])=>{f?.errorCode===ko.PERMISSION_DENIED&&p.push(g)}),s&&c?.[r.userId]?.organization?.[s]?.errorCode===ko.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),e?.folderId&&c?.[r.userId]?.folders?.[e?.folderId]?.errorCode===ko.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${e?.folderId}`,void 0,void 0,!0),p.length>0&&(this.loggingService.catch(`User does not have access to documents: ${p.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(p,r,a))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(e,t,r){try{if(this.currentValidationToken!==r)return;let a=this.documentPaths$.value;this.coreActionsService.triggerAction(Un.ERROR,{event:Z.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:e,userId:t.userId,timestamp:new Date().getTime()});let s=this.documentIds$.value||[],c=s.filter(p=>!e.includes(p.clientDocumentId));c.length!==s.length&&(c.length>0?this.setDocuments({documents:c.map(p=>({id:p.clientDocumentId})),options:{organizationId:a?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(Un.ERROR,{event:Z.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:e,userId:t.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(a){this.loggingService.catch("Error in handleDeniedDocumentAccess:",a)}}addUserInfoToOrganization(r){return Q(this,arguments,function*({organizationId:e,user:t}){try{let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield sd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e},user:t},getSdkProxy:a,userId:t?.userId??""})}catch(a){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",a)}})}setDocumentsImpl(s){return Q(this,arguments,function*({documents:e,options:t,source:r,skipPermissionValidation:a=!1}){try{let c=t?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,YH(T(E({},t),{organizationId:c})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let p=on();this.currentValidationToken=p;let g=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(g?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let f=this.authService.getUser();if(!f){this.draftDocuments=e,this.draftOptions=t;return}if(this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1}),this.addUserInfoToOrganization({organizationId:t?.organizationId??f?.clientOrganizationId??"",user:f}),g=yield this.filterRelevantDocuments({options:t,documentIds:g,skipPermissionValidation:a}),this.documentIds$.next(g),g?.length){let I=g[0]?.clientDocumentId;t?.rootDocumentId&&g.find(D=>D.clientDocumentId===t?.rootDocumentId)&&(I=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:I,clientOrganizationId:t?.organizationId,options:t})}return}catch(c){this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}setDocumentId(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:r}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Pa.SET_DOCUMENT_ID,source:r,payload:{documentId:e,clientOrganizationId:t}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:t},source:r})}catch(s){this.loggingService.catch("Error in setDocumentId:",s);return}})}debounceSetDocuments(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),c=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||c>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,t,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:t,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,t,r){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let s=this.currentDocumentId;if(this.apiKey){let c=`${Rn(e)}`,p=r?.folderId,g=r?.folderId?ji(r?.folderId):void 0,f=r?.locationId,I=r?.allDocuments,D=a?.organizationId?t?Et(t):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(N=>N.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(N=>N.clientDocumentId),organizationId:t??a?.clientOrganizationId??""})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let N=new H9,G=new rR;N.clientDocumentId=e,G.clientDocumentId=e,N.folderId=p,G.folderId=p,N.locationId=f,G.locationId=f,N.allDocuments=I,G.allDocuments=I,N.veltFolderId=g,G.veltFolderId=g,N.documentId=c,G.documentId=c,D&&(N.organizationId=D,N.clientOrganizationId=t??a?.clientOrganizationId,G.organizationId=D,G.clientOrganizationId=t??a?.clientOrganizationId);let z=`${this.apiKey}`,J=`apiKey/${this.apiKey}`;D&&(z=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${N.organizationId}`,J=`${J}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${N.organizationId}`),G.organization=`apiKey/${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,G.document=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,N.presence=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,N.cursor=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,N.comment=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,G.comment=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,N.multiThread=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,G.multiThread=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,N.tag=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,N.area=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,G.area=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}`,N.arrow=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,N.selection=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,N.audioHuddle=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,N.huddle=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,N.recorder=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,G.recorder=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,N.flock=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,N.syncVideoPlayer=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,N.liveState=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,N.liveStateSingleEditorMode=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,N.reaction=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,G.reaction=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,N.crdt=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,G.crdt=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,N.customerMetadata=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,N.views=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,G.notificationViews=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,G.documentViews=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,G.locationViews=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,N.notifications=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,N.metadata=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,N.users=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,N.documentIam=`${z}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,N.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,N.groupContacts=`${z}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,N.globalContacts=`${z}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,N.logins=`${z}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,N.userFeedback=`${z}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,N.userReportBugs=`${z}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,N.userContactUs=`${z}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(N.organizationMetadata=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,N.organizationIam=`${z}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,N.organizationGroups=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,N.organizationNotifications=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(N.organizationNotificationsWithDocumentId=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,N.heartbeatByDocument=`${z}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),N.organizationNotificationsLastNotificationTimestamp=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,N.organizationNotificationsUsers=`${z}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,N.heartbeat=`${z}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),G.organizationUsers=`${J}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,G.users=`${J}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,G.documentUsers=`${J}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,G.notificationDocs=`${J}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,G.notificationUsers=`${J}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,!this.documentPaths$.value&&this.loggingService.logPerf(`[PERF] documentPaths$ FIRST SET at ${performance.now().toFixed(2)}ms`),this.documentPaths$.next(N),this.firestorePaths$.next(G),N?.clientOrganizationId&&N?.organizationId&&!(N?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&N?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.organizationConfig$.next({organizationId:N?.organizationId,clientOrganizationId:N?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:e}}),this.analyticsService.trackEvent(Z.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Pa.UNSET_DOCUMENT_ID,source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),this.userPermissionService?.revokeAccessOnDocumentUnset(),t&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(Z.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments({source:e,unsetDocumentPaths:t=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:Pa.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[t,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(t){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",t)}})}fetchOrganizationMetadata(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig()),this.db&&e?.organizationId){let t=e?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:t,field:"metadata"}}).then(r=>{r&&!r?.errorCode&&this.organizationMetadata$.next(T(E({},this.organizationMetadata$.value),{[t]:r}))}).catch(r=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",r)})}}catch(t){this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)}})}fetchDocumentMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!t)return;if(this.commonDbService?.shouldUseFirestore()){let a=t?.folderId,s=[],c={organizationId:t?.clientOrganizationId,folderId:a},p=[],g=20;for(let I=0;I<e.length;I+=g)p.push(e.slice(I,I+g));p.forEach(I=>{let D=JSON.parse(JSON.stringify(c));D.documentIds=I.map(N=>N.clientDocumentId),s.push(this.fetchDocuments(D))});let f={};s.length>0&&(yield Promise.all(s).then(I=>{I?.forEach(D=>{D?.forEach(N=>{N?.metadata?.documentId&&(f[N.metadata.documentId]=N.metadata)})}),this.setAllDocumentMetadata(E(E({},this.documentMetadata$.value),f))}).catch(I=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",I)}))}else r?.[t?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:t?.organizationId,documentId:t?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.setDocumentMetadata(a.documentId,a)}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(t){this.loggingService.catch("Error in fetchDocumentMetadata: ",t)}})}fetchLocationMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,t=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],c={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a},p=[],g=20;for(let I=0;I<t.length;I+=g)p.push(t.slice(I,I+g));p.forEach(I=>{let D=JSON.parse(JSON.stringify(c));D.documentIds=I.map(N=>N.clientDocumentId),s.push(this.fetchLocations(D))});let f=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(I=>{I?.forEach(D=>{D?.forEach(N=>{N?.metadata?.documentId&&(f[N.metadata.documentId]=T(E({},f?.[N.metadata.documentId]??{}),{[N.location.id]:N}))})}),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}).catch(I=>{this.loggingService.catch("Error in fetchLocationMetadata: ",I)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(zn(t=>se(null))).subscribe(t=>{this.customerMetadata$.next(t?.data)}))}catch(e){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",e)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(de(e=>e?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(e){try{return`${Rn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${Et(e)}`}catch(t){return this.loggingService.catch("Error in generateOrganizationId: ",t),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:Pa.SET_LOCATION,payload:{locations:[e],options:void 0}}),this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return Q(this,arguments,function*({locations:e,options:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:r}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Pa.SET_LOCATIONS,source:r,payload:{locations:e,options:t}}),this.setLocationsImpl({locations:e,options:t})}catch(s){this.loggingService.catch("Error in setLocations: ",s)}})}getValidLocations(e){try{let t=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&t.push(r)}}),t}catch(t){this.loggingService.catch("Error in getValidLocations: ",t)}return e}setRootLocation(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Pa.SET_ROOT_LOCATION,source:t,payload:{location:e}});let a=Object.values(this.locations$.value).map(s=>s.location).filter(s=>String(s.id)!==String(e.id));this.setLocationsImpl({locations:[e,...a],options:{rootLocationId:e.id}})}catch(a){this.loggingService.catch("Error in DocService setRootLocation:",a)}})}setLocationsImpl({locations:e,options:t}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0)return;if(!this.authService.getUser()){!t?.appendLocation&&e.length>0&&(this.draftLocationMap.options=T(E(E({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=E(E({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),s=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(f=>f.location.id)].filter(f=>f!==void 0);let p;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(f=>f.id===t?.rootLocationId),!p)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${t?.rootLocationId} not found in locations.`);return}if(t?.appendLocation){if(p){let f=tr(p),I=Rn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}}else{p||(p=a[0]);let f=tr(p),I=Rn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}let g=[];return a.slice(t?.appendLocation?0:1).forEach(f=>{if(f.id!==this.location$.value?.location.id){let I=E({},f),D=this.locations$.value;f?.id&&Object.keys(D).forEach(J=>{let ce=D[J];ce.location?.id===f.id&&(I=E(E({},ce.location),f),delete D?.[J])});let N=this.genarateLocationId(I),G={locationId:N,location:I};I.id&&s.push({locationId:N,location:I}),g.push(G);let z=T(E({},D),{[N]:G});this.locations$.next(z)}}),this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Pa.SET_LOCATIONS,payload:{locations:a,options:t}}),this.analyticsService.trackEvent(Z.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),g}catch(r){this.loggingService.catch("Error in setLocationImpl: ",r);return}}addLocation({location:e,source:t="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Pa.ADD_LOCATION,source:t,payload:{locations:[e],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(r){this.loggingService.catch("Error in DocService addLocation:",r);return}}removeLocation({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:Pa.REMOVE_LOCATION,payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],t)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations({locations:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Pa.REMOVE_LOCATIONS,source:t,payload:{locations:e}}),this.removeLocationsImpl(e,t)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationsImpl(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:t},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(Z.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}unsetLocationIds(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Pa.UNSET_LOCATION_IDS,source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(Z.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(r=>{this.getLocation()?.location.id===r&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==r))),this.removeCustomLocationId(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction(Un.INIT_UPDATE,{event:Z.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Pa.REMOVE_LOCATIONS_SUCCESS,source:t,payload:{locationIds:e}}),this.analyticsService.trackEvent(Z.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetLocationIds: ",r)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(t){this.loggingService.catch("Error in excludeLocationIds: ",t)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(e){return Q(this,null,function*(){try{!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig());let t=e?.organizationId,r=this.documentPaths$.value;if(this.db&&t&&r?.documentId){if(this.organizationMetadata$.value?.[t])return;let s=new eR;s.apiKey=this.configService?.getApiKey()??"",s.organizationId=t,s.clientOrganizationId=e?.clientOrganizationId,this.userPermissionService?.hasEditAccess({organizationId:t})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:t,documentId:r?.documentId??""}})),yield this.fetchOrganizationMetadata(e)}}catch(t){this.loggingService.catch("Error in updateOrganizationMetadata: ",t)}})}updateFolderMetadata(){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let e=this.documentPaths$.value;if(!e?.veltFolderId||!e?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:e?.veltFolderId??""}}))?.metadata){let r={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:e?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield sd({methodName:"createFolder",data:{type:"createFolder",metadata:r},getSdkProxy:a,userId:this.authService.getUser()?.userId??""})}}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let t=this.getDocumentIds();t.find(a=>a.documentId===e.documentId)||t.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let r=t.map(a=>Q(this,null,function*(){let s=new $9;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=E(E({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=E(E({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=Mi();let c=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let g=!0,f=this.documentMetadata$.value?.[a.documentId];if(c&&p){let I=this.getDocumentMetadata(a?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}}));I?.clientDocumentId&&!I?.errorCode?I?.folderId&&(I?.folderId!==c||I?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),g=!1):I?.folderId===c?(c&&(s.folderId=c),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${c??""}`),g=!1):(c&&(s.folderId=c),p&&(s.veltFolderId=p))}if(f){let I={};Object.entries(s).forEach(([D,N])=>{I[D]=N}),gi(I,f)&&(g=!1)}g&&this.userPermissionService?.hasEditAccess({documentId:a?.documentId??"",folderId:e?.allDocuments&&e?.veltFolderId?e?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(r),yield this.fetchDocumentMetadata(t)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let r=this.getDocumentIds();r.find(a=>a.documentId===t.documentId)||r.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}});s?.errorCode&&(s={});let c=[];for(let p of e){let g=new q9;g.locationId=p?.locationId,g.veltLocationId=zH(p?.location?.id??""),g.location=p?.location,g.pageInfo=Mi(),g?.pageInfo?.deviceInfo&&delete g?.pageInfo?.deviceInfo;let f=T(E({},s),{[U.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(E({},s[U.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:g})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let I=this.locationMetadata$.value;if(I||(I={}),p?.location?.id){let D=I?.[a.documentId],N=D?.[p?.location?.id??""];I&&(D||(I[a.documentId]={}),N||(I[a.documentId][p?.location?.id??""]={}),I[a.documentId][p?.location?.id??""]=T(E({},N),{location:p?.location})),Object.keys(I||{}).length>0&&this.locationMetadata$.next(I)}}yield Promise.allSettled(c)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Rn(JSON.stringify(tr(e))):0}catch(t){return this.loggingService.catch("Error in genarateLocationId: ",t),0}}removeCustomLocation(e,t="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(E({},a)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}removeCustomLocationId(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let r=this.locations$.value;Object.entries(r).forEach(([a,s])=>{s.location.id===e&&(delete r[a],this.locations$.next(E({},r)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.id!==e)))})}catch(r){this.loggingService.catch("Error in DocService removeCustomLocationId:",r)}}getLocationByClientLocationId(e){try{let t=this.getLocation()?.location;if(t?.id===e)return t;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(t=s.location)})}return t}catch(t){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",t);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,t=document.querySelectorAll(`[${U.ATTRIBUTES.VELT_LOCATION}]`),r=[];t.forEach(a=>{let s=a.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(s){let c=JSON.parse(s),p=this.genarateLocationId(c);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(E({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let t=null;if(e?.getAttribute(U.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${U.ATTRIBUTES.VELT_LOCATION}]`),t){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);return{locationId:this.genarateLocationId(a),location:a}}}return null}catch(t){return this.loggingService.catch("Error in DocService getLocationFromElement:",t),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let e={};return document.querySelectorAll(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let c={id:a},p=this.genarateLocationId(c);e[a]={element:r,location:{locationId:p,location:c}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let t;if(t=e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(t){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",t),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${U.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(U.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(t){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",t),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadata:",t),null}}getAllDocumentMetadata$(e){return this.getAllDocumentMetadataMap$().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),vt(Kt))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(de(e=>e||{}),vt(Kt))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},t={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(t[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(c=>{let p=e?.[c.documentId];p&&(t[c.documentId]=p)});else if(this.documentPaths$.value?.documentId){let c=e?.[this.documentPaths$.value?.documentId];c&&(t[this.documentPaths$.value?.documentId]=c)}}return Object.values(t)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),vt(Kt))}setDocumentMetadata(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let r=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));r[e]=t,this.documentMetadata$.next(r)}catch(r){this.loggingService.catch("Error in DocService setDocumentMetadata:",r)}}setAllDocumentMetadata(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(e)}catch(t){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",t)}}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(de(t=>t?.[e]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(de(e=>e||{}),vt(Kt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(vt(Kt))}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,t){try{switch(e){case"area":return;case"comment":return t?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(t.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return t?.commentAnnotationId?this.commentService?.getAnnotationById(t.commentAnnotationId)?.metadata:void 0;default:return}}catch(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:t}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=t||r.documentId,c=this.getDocumentMetadata(s);if(!c)return;let p=c?.folderId,g=c?.veltFolderId;return E(E({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),g?{veltFolderId:g}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,t){try{let r,a;t?.element?r=this.getAdditionalDocumentIdFromElement(t.element)||void 0:t?.clientDocumentId&&(r=t.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,t),c=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||c||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:t}){try{return e&&(e=this.generateDocumentId(e)),t&&(t=this.generateOrganizationId(t)),{documentId:e,organizationId:t}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=ji(e?.folderId);r.push(ht("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ht("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchDocuments:",t),[]}})}fetchLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=ji(e?.folderId);r.push(ht("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ht("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchLocations:",t),[]}})}updateDocuments(e){return Q(this,null,function*(){try{if(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,documents:a,folderId:s}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let c=Ja(r);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let p=[],g=this.documentMetadata$.value??{};for(let f of a)if(f?.documentId){f.organizationId=c,f.clientOrganizationId=r,f.clientDocumentId=f.documentId;let I=Ir(f.documentId);f.documentId=I,f.apiKey=this.configService.getApiKey()??void 0,(s||this.documentPaths$.value?.folderId)&&(f.folderId=s||this.documentPaths$.value?.folderId,f.veltFolderId=ji(s||this.documentPaths$.value?.folderId||""));let D=()=>{if(s&&this.documentPaths$.value?.folderId&&s!==this.documentPaths$.value?.folderId)return;let G=g?.[I];G?g[I]=E(E({},G),f):g[I]=f},N=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:I,organizationId:c,field:"metadata"}});if(N?.errorCode&&(N={}),N&&N.apiKey&&N.folderId&&s&&N.folderId!=f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists with different folderId: ${N.folderId}`);continue}if(N&&N.apiKey&&!N.folderId&&f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists, move this document to folder with REST API`);continue}D(),f&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:f?.documentId??""})&&p.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{organizationId:c,documentId:I}}))}yield Promise.all(p),this.setAllDocumentMetadata(g)}catch(t){return this.loggingService.catch("Error in DocService updateDocuments:",t),[]}})}updateLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(f=>f.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=s.map(f=>Ir(f)),p=[],g=this.locationMetadata$.value;g||(g={}),c.forEach(f=>{a.forEach(I=>{let D=this.location$.value;if(I?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:I}),I?.id){delete I?.metadata;let N=zH(I.id),G=g?.[f],z=G?.[I.id];g&&(G||(g[f]={}),z||(g[f][I.id]={}),g[f][I.id]=T(E({},z),{location:I})),I&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:I})),properties:{organizationId:Ja(r),documentId:f,id:N}}))}})}),yield Promise.all(p),Object.keys(g||{}).length>0&&this.locationMetadata$.next(g)}catch(t){return this.loggingService.catch("Error in DocService updateLocations:",t),[]}})}fetchFolders(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let c=ji(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[ht("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(fe(e=>e?this.documentPaths$.pipe(fe(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(de(r=>r?.data?.docIamConfig??r?.data),vt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?Ei.RESTRICTED:Ei.PUBLIC:e&&e.documentAccessType?e.documentAccessType:Ei.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),Ei.PUBLIC}}changeDocumentAccessType(e){return Q(this,null,function*(){try{let t=this.documentPaths$.value;if(t){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",field:"docIamConfig"}});if(r?.errorCode)return;switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case Ei.PUBLIC:r.features.all.restricted=!1;break;case Ei.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??""}})}}catch(t){this.loggingService.catch("Error in DocService changeDocumentAccessType:",t)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(E(E({},this.uiState.value),e))}catch(t){this.loggingService.catch("Error in DocService setUIState:",t)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(bn),ee(Le),ee(Rt),ee(y),ee(Ks),ee(pm),ee(ns),ee(Io))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Fn=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.authService=t,this.docService=r,this.loggingService=a,this.resolveOrganizationUsers=new ve(!0),this.resolveFolderUsers=new ve(!0),this.resolveDocumentUsers=new ve(!0),this.unresolvedUsers=new ve([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new Tn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(c){this.loggingService.catch("Error in UsersService getUserById:",c);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Fe(s=>!!s),fe(()=>this.getUnresolvedUsers$().pipe(Fe(s=>s.length>0),$o(300),ot(20),fe(s=>{let c=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:c,isCollection:!0,useQuery:!0,firestoreQuery:[_i(ht("user.userId","in",s.slice(0,20)))]}}).pipe(de(p=>p?.data),tn(p=>{if(p&&typeof p=="object"){delete p.undefined,delete p.null;let g=Object.values(p??{});this.setUserByIds(g.map(I=>I.user));let f=s.filter(I=>!g.some(D=>D.user.userId===I));f.length!==s.length&&this.setUnresolvedUsers(f)}})):se([])})))).subscribe()}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in UsersService setCommonDbService:",t)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}isResolverForFeatureDisabled(e){let t=this.userDataProvider$.getValue();try{switch(e){case"allOrganizationUsers":return t?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return t?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return t?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(r){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",r),!1}}resolveUsers(c){return Q(this,arguments,function*({userIds:e,forceResolve:t,feature:r,organizationId:a,skipUserCheck:s=!1}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let p=!1;if(r&&(p=this.isResolverForFeatureDisabled(r)),p)return{};{let g={},f=[],I={};if(e?.forEach(D=>{let N=this.getUserById(D);N?g[D]=N:this.userByIdCalled$.getValue()[D]?t&&f.push(D):(f.push(D),this.userByIdCalled$.next(T(E({},this.userByIdCalled$.getValue()),{[D]:!0})))}),f.length>0){let D={};try{let N,G=new Promise((z,J)=>{N=setTimeout(()=>{J(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});D=yield Promise.race([this.getUsersFromDB({userIds:f,organizationId:a,skipUserCheck:s}).finally(()=>{clearTimeout(N)}),G]),this.analyticsService.trackEvent(Z.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:f})}catch(N){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",N,{userIds:f})}finally{f?.forEach(N=>{if(!D[N]){let G=new Set([...this.getUnresolvedUsers(),N]);this.unresolvedUsers.next(Array.from(G)),D[N]={userId:N,name:`User ${N}`}}})}Object.entries(D).forEach(([N,G])=>{G&&(g[N]=D?.[N],I[N]=D?.[N])})}return Object.keys(I).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(I)),this.userById$.next(E(E({},this.userById$.getValue()),I))),g}}catch(p){return this.loggingService.catch("Error in UsersService resolveUsers:",p),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(e){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",e),[]}}setUnresolvedUsers(e){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(e)){let t=JSON.parse(JSON.stringify(e));this.unresolvedUsers.next(t)}}catch(t){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",t)}}getUsersFromDB(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let s=this.userDataProvider$.getValue();if(s)return s.get(e);if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:r}))??[],p={};return c.forEach(g=>{g.forEach(f=>{f?.user?.userId&&(p[f.user.userId]=f.user)})}),p}catch(s){return this.loggingService.catch("Error in UsersService getUsersFromDB:",s),{}}})}getUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){try{if(!e?.length)return[];let s=[];for(let g=0;g<e.length;g+=30)s.push(e.slice(g,g+30));let c=s.map((g,f)=>Q(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ht("user.userId","in",g)],skipUserCheck:r}}))||[]}catch(I){return this.loggingService.catch(`Error in batch ${f+1}:`,I),[]}}));return yield Promise.all(c)}catch(s){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",s),[]}})}getTemporaryUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,resourceIds:r}){try{if(!e?.length||!r?.length)return[];let s=[];for(let G=0;G<e.length;G+=30)s.push(e.slice(G,G+30));let c=[];for(let G=0;G<r.length;G+=30)c.push(r.slice(G,G+30));let p=[],g=0,f=(G,z)=>Q(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[_i(ht("userId","in",G),ht("veltResourceId","in",z))]}}))??[])||[]}catch(J){return this.loggingService.catch(`Error in batch ${g+1}:`,J),[]}});for(let G of s)for(let z of c)p.push(f(G,z)),g++;return(yield Promise.all(p)).flat().filter((G,z,J)=>z===J.findIndex(ce=>ce.userId===G.userId&&ce.resourceId===G.resourceId))}catch(s){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",s),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable().pipe(vt(Kt))}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserByIds(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;");let t=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));e.forEach(r=>{t[r.userId]=E(E({},t?.[r.userId]??{}),r)}),this.userById$.next(t)}catch(t){this.loggingService.catch("Error in UsersService setUserByIds:",t)}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;"),this.userDataProvider$.next(e),e.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),e.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),e.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(t){this.loggingService.catch("Error in UsersService setUserDataProvider:",t)}}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",e),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var fpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",t),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",t),e}}formatAreaData(e){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",t),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",t),e}}formatArrowData(e){try{return this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: formatArrowData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Yg=class{static getFirestoreProdDbName(o,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(n){return nt.error("Error in isTestingDb:",n),!1}}};var Kg=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new ve(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let t=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield ad(()=>t?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(Z.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(t){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",t);return}})}deleteAttachment(r){return Q(this,arguments,function*({attachmentId:e,metadata:t}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield ad(()=>a?.delete({attachmentId:e,metadata:t,event:Oa.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Z.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",t)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(et))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Zg=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=c,this.attachmentResolverService=p,this.coreActionsService=g,this.notificationActionTypeMap={[$t.NEWLY_ADDED]:Oa.COMMENT_ANNOTATION_ADD,[$t.ADDED]:Oa.COMMENT_ADD,[$t.UPDATED]:Oa.COMMENT_UPDATE,[$t.DELETED]:Oa.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",t)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let r of e){if(r?.from?.userId&&t.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&t.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&t.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&t.add(s?.userId)}if(r?.assignedTo?.userId&&t.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&t.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.unsubscribedUsers))a.user.userId&&t.add(a.user.userId)}return Array.from(t)}catch(t){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",t),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.comments)for(let t of e?.comments){if(t?.from?.userId){let a=this.usersService.getUserById(t?.from?.userId);a&&(t.from=a)}t?.to&&(t.to=t?.to?.map(a=>{if(a?.userId){let s=this.usersService.getUserById(a?.userId);if(s)return E(E({},a),s)}return a})),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(t?.taggedUserContacts?.filter((a,s,c)=>c.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(od(`{{${a.userId}}}`),"g");t.commentText?.includes(`@User ${a.userId}`)&&(s=new RegExp(od(`@User ${a.userId}`),"g")),t.commentText=t.commentText?.replaceAll(s,a.text),t.commentHtml=t.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let t=this.usersService.getUserById(e?.assignedTo?.userId);t&&(e.assignedTo=t)}if(e?.subscribedUsers)for(let t of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let t of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",t),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(t=>{t?.commentText&&t?.commentText?.length>0&&(t.isCommentTextAvailable=!0)}),e?.viewedBy&&delete e.viewedBy,e?.comments&&e.comments.forEach(t=>{t?.reactionAnnotations&&delete t.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let t of Object.keys(e?.subscribedUsers))e.subscribedUsers[t].user={userId:e?.subscribedUsers[t].user.userId};if(e?.unsubscribedUsers)for(let t of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[t].user={userId:e?.unsubscribedUsers[t].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(t=>this.formatCommentThreadData(t))),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",t),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(s=>{let c=t?.comments?.[s?.commentId];if(c){s.commentHtml=c?.commentHtml,s.commentText=c?.commentText;let p=c?.attachments;r&&p&&s.attachments?.forEach(g=>{let f=g?.attachmentId;p?.[f]&&(g.name=p?.[f]?.name,g.url=p?.[f]?.url)})}}),t?.targetTextRange?.text&&e?.targetTextRange&&(e.targetTextRange.text=t?.targetTextRange?.text),a?.length>0&&a.forEach(s=>{t?.[s]&&(e[s]=t[s])})),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",t),e}}mergeLocationWithCommentAnnotations(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(t);return r?!gi(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!0}}stripCommentsFromAnnotationData({comment:e}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let t=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!t)return e;let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=new md;if(Object.assign(a,e),a.isCommentResolverUsed=t,r){let s=a.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));a.attachments=s}return delete a?.commentHtml,delete a?.commentText,a}catch(t){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",t),e}}stripCommentAnnotationData({data:e,actionType:t,commentId:r}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove(),c;t&&(c=this.notificationActionTypeMap?.[t]);let p={},g=null,f=!1;if(e&&e.annotationId){let D=e.annotationId;p[D]=E(E(E(E({annotationId:D,metadata:K0(e.metadata??{}),comments:{}},e?.from&&{from:e?.from}),e?.assignedTo&&{assignedTo:e?.assignedTo}),e?.resolvedByUserId&&{resolvedByUserId:e?.resolvedByUserId}),e?.targetTextRange?.text&&{targetTextRange:{text:e?.targetTextRange?.text}}),delete e?.targetTextRange?.text,s?.length>0&&s.forEach(G=>{e?.[G]&&(p[D][G]=e[G],delete e[G])}),e.comments?.forEach(G=>{if(G.commentId){let z;a&&(z={},G.attachments?.forEach(J=>{z[J.attachmentId]={attachmentId:J.attachmentId,name:J.name,url:J.url}})),p[D].comments[G.commentId]=E(E(E(E(E(E({commentId:G.commentId},G?.commentHtml&&{commentHtml:G?.commentHtml}),G?.commentText&&{commentText:G?.commentText}),z&&{attachments:z}),G?.from&&{from:G?.from}),G?.to&&{to:G?.to}),G?.taggedUserContacts&&{taggedUserContacts:G?.taggedUserContacts})}}),f=this.isCommentsDataChanged(p[D],D);let N=new Wo;Object.assign(N,e),N.comments=e.comments?.map(G=>this.stripCommentsFromAnnotationData({comment:G}))||[],g=N}let I=g?.comments?.find(D=>D.commentId===r);return I?.isDraft&&(c=g?.comments?.length&&g?.comments?.length>0?Oa.COMMENT_ADD:Oa.COMMENT_ANNOTATION_ADD),{strippedData:f&&(t||I?.isDraft)?p:null,originalData:g,eventType:c}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?.userId?T(E({},r),{contact:{userId:r.contact.userId}}):r));let t=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(c=>c.text===r.text)===a)||[];t.forEach(r=>{if(r?.text&&r?.contact?.userId){let a=new RegExp(od(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),t.forEach(r=>{r?.text&&r?.contact?.userId&&(r.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}getDeniedForYouUsers(t){return Q(this,arguments,function*({extraData:e}){try{let r=Object.values(e?.annotationData?.subscribedUsers||{}).map(s=>s.user.userId)??[],a=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&r.length){let s=e?.metadata?.clientDocumentId,c=[];r.forEach(f=>{if(c.push({userId:f,resource:{id:s,type:Mo.DOCUMENT,source:qo.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??""}}),e?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()){let I=JSON.stringify(e?.annotationData?.context?.access);c.push({userId:f,resource:{id:I,type:Mo.CONTEXT,source:qo.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:{access:e?.annotationData?.context?.access}}})}});let p=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:qo.SET_NOTIFICATIONS,uniqueId:p,timestamp:new Date().getTime(),source:"internal",payload:{requests:c}});let g=yield this.userPermissionService?.onResourceAccessRequired({requests:c,uniqueId:p,methodName:qo.SET_NOTIFICATIONS});g?.success&&g?.data?.length&&g.data.forEach(f=>{f.hasAccess||a.push(f.userId)})}return a}catch(r){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",r),[]}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let p=Sk(this.authService.getFirebaseConfig()?.firebaseOptions),g=Ki(this.functions,Zi({url:Dn.cloudFunction?.[p]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let G=r?.targetAnnotationData?.commentId;if(G){let z=e?.comments?.find(J=>J?.commentId===G);z&&(r.targetAnnotationData=z)}try{let z=this.stripCommentAnnotationData({data:r.annotationData,actionType:r?.actionType??$t.NEWLY_ADDED});z?.originalData&&(r.annotationData=this.formatCommentData(z.originalData)),r?.targetAnnotationData&&(r.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:r.targetAnnotationData})))}catch(z){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",z)}}let f=Yg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),I=yield this.getDeniedForYouUsers({extraData:r}),D={path:t??"",data:e??{},dbId:f??"",notificationData:r||void 0,notificationURL:Dn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:ga(),deniedForYouUsers:I,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),metadata:s},N=yield Il(D,this.authService.getUser()?.userId??"");yield g({veltData:N})}catch(p){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",p)}})}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn),ee(Ue),ee(Io),ee(Rt),ee(Ks),ee(Kg),ee(ns))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let t=new Set;if(e?.length)for(let r of e)r?.user?.userId&&t.add(r?.user?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",t),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);if(t){let r=t;e?.user&&typeof e.user=="object"&&(r=E(E({},r),e.user)),e=T(E({},e),{user:r})}}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var _pe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let t=new Set;for(let r of e)r?.userId&&t.add(r?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",t),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=E(E({},e),t))}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",t),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let t=["userId","comment","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","targetElement","position","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var lR=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let r of e)r?.userId&&t.add(r?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",t),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=E(E({},e),t))}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",t),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",t),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",t),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",t),e}}resolveUsersFromHuddleMessages(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers({userIds:t});for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var cR=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromLiveStateCustom(e){try{let t=new Set;return e?.updatedBy&&t.add(e?.updatedBy?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",t),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let t=this.usersService.getUserById(e?.updatedBy?.userId);t&&(e.updatedBy=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",t),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",t),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let t=new Set;for(let r of e)r?.updatedBy?.userId&&t.add(r?.updatedBy?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",t),[]}}getUserIdsToResolveFromLiveStates(e){try{let t=new Set;return e?.default?.singleEditorMode?.editor?.userId&&t.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",t),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(e){try{let t=new Set;return e?.editor?.userId&&t.add(e?.editor?.userId),e?.requestEditorAccess?.user?.userId&&t.add(e?.requestEditorAccess?.user?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",t),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);t&&(e.default.singleEditorMode.editor=t)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);t&&(e.default.singleEditorMode.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",t),e}}mergeSingleEditorLiveStateDataWithUser(e){try{if(e?.editor?.userId){let t=this.usersService.getUserById(e?.editor?.userId);t&&(e.editor=t)}if(e?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.requestEditorAccess?.user?.userId);t&&(e.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",t),e}}resolveAndMergeSingleEditorLiveStateDataWithUser(e){return Q(this,null,function*(){try{let t=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:e}});return t.length?(yield this.usersService.resolveUsers({userIds:t}),this.mergeSingleEditorLiveStateDataWithUser(e)):e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",t),e}})}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",t),e}}mergeLiveStateCustomsWithUsers(e){try{for(let t of e)if(t?.updatedBy?.userId){let r=this.usersService.getUserById(t?.updatedBy?.userId);r&&(t.updatedBy=r)}return e}catch(t){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromMultiThreads(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",t),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",t),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var OC=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId),r?.transcription?.from?.userId&&t.add(r?.transcription?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.transcription?.from?.userId){let t=this.usersService.getUserById(e?.transcription?.from?.userId);t&&(e.transcription.from=t)}return e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",t),e}}formatRecorderData(e,t){try{return e.transcription=e?.transcription?T(E({},e.transcription),{lastUpdated:t}):void 0,this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.transcription?.from?.userId&&(e.transcription.from={userId:e.transcription.from.userId})),e}catch(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",t),e}}encryptRecorderAnnotation(e){return Q(this,null,function*(){try{return yield Il(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var dR=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=c}getUserIdsToResolveFromNotifications(e){try{let t=new Set;for(let r of e){let{notification:a}=r;switch(a?.actionUser?.userId&&t.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let c of s)t.add(c)}break}}return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),r=e?.raw?.targetAnnotationData?.commentId,a=t?.comments?.[r]?.commentText,s=t?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",t),e}}mergeLocationWithNotification(e,t){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:t}=e;if(t?.actionUser?.userId){let r=this.usersService.getUserById(t?.actionUser?.userId);r&&(t.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(t.displayHeadlineMessageTemplateData.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(t.displayHeadlineMessageTemplateData.recipientUser=r)}switch(t?.notificationSource){case"comment":t?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(t?.notificationSourceData);break}return e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",t),e}}formatNotification(e,t){try{switch(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),this.usersService.userDataProviderAvailable()&&e?.actionUser&&(e.actionUser={userId:e.actionUser.userId}),e.notificationSource){case"comment":this.commentUtilsService.formatCommentData(e.annotationData),this.commentUtilsService.formatCommentThreadData(e.targetAnnotationData);break;case"recorder":this.recorderUtilsService.formatRecorderData(e.annotationData,t);break}return e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let t=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&t.push(r.notification.targetAnnotationId)}),t}catch(t){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",t),[]}}handleNotificationEncryption(t){return Q(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Il(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(t){return new(t||o)(ee(Zg),ee(OC),ee(y),ee(Fn),ee(Ue),ee(Ks))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Epe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let r of e)r?.userId&&t.add(r?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",t),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=E(E({},e),t))}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",t),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var xpe=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.reactions)a?.from?.userId&&t.add(a?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{let s=Sk(this.authService.getFirebaseConfig()?.firebaseOptions),c=Ki(this.functions,Zi({url:Dn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),p=Yg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),g=this.authService.getUser()?.userId??"",f={path:t??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:ga()},I=yield Il(f,g);yield c({veltData:I})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.reactions?.length){for(let t of e?.reactions)if(t?.from?.userId){let r=this.usersService.getUserById(t?.from?.userId);r&&(t.from=r)}}}return e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",t),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(t=>(this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t)),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",t),e}}isReactionDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let r=this.reactionAnnotationsResolverService.getReactionAnnotationById(t);return r?!gi(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let t={};if(e&&e.annotationId){let r=e.annotationId;if(t[r]=E({annotationId:r,metadata:K0(e.metadata??{}),icon:e.icon},e?.from&&{from:e?.from}),!this.isReactionDataChanged(t[r],r))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:t,originalData:e}}catch(t){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",t),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return e;let t=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return t&&t.icon&&(e.icon=t.icon),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn),ee(Ue),ee(Io),ee(Rt),ee(pm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Tpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromSelections(e){try{let t=new Set;for(let r of e)r?.user?.userId&&t.add(r.user.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",t),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);t&&(e.user=t)}return e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",t),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromTags(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r.from.userId),r?.to?.length)for(let a of r.to)a?.userId&&t.add(a.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",t),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e?.to?.length&&(e.to=e.to.map(t=>{if(t?.userId){let r=this.usersService.getUserById(t?.userId);r&&(t=r)}return t})),e}catch(t){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",t),e}}formatTagData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to?.length&&(e.to=e.to.map(t=>(t?.userId&&(t={userId:t.userId}),t)))),e}catch(t){return this.loggingService.catch("Error in TagUtilsService formatTagData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var gm=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D,N,G,z,J,ce,ye,Oe,$e){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=c,this.liveStateUtilsService=p,this.loggingService=g,this.multiThreadUtilsService=f,this.notificationUtilsService=I,this.presenceUtilsService=D,this.reactionUtilsService=N,this.recorderUtilsService=G,this.selectionUtilsService=z,this.tagUtilsService=J,this.usersService=ce,this.docService=ye,this.commentAnnotationsResolverService=Oe,this.reactionAnnotationsResolverService=$e}getErrorForGetRequests({feature:e,error:t}){try{switch(e){case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(t?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",r),null}}getFirestorePath({feature:e,properties:t,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:c,folderId:p}=t;c||(c=r?.organizationId);let g=new oR({apiKey:a,documentId:s?`${s}`:"",organizationId:c?`${c}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allPermissionsUsers":return g?.permissionsUsers?`${g?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&g?.comment?`${g?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&g?.area?`${g?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&g?.area?`${g?.area}`:void 0;case"allDocuments":return g?.document?`${g?.document}`:void 0;case"allLocations":return g?.location?`${g?.location}`:void 0;case"allFolders":return g?.folder?`${g?.folder}`:void 0;case"folder":return g?.folder&&t.folderId?`${g?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&g?.reaction?`${g?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"recorderTrackEvent":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return g?.organization?`${g?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&g?.folder?`${g?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&g?.location&&t?.id?`${g?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return g?.users?`${g?.users}`:void 0;case"allFolderUsers":return g?.users?`${g?.users}`:void 0;case"allOrganizationGroups":return g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return g?.users?`${g?.users}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&g?.notificationViews?`${g?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&g?.documentViews?`${g?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&g?.documentViews?`${g?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&g?.locationViews?`${g?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&g?.locationViews?`${g?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&g?.docNotification?`${g?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.docNotification?`${g?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allUserNotifications":return t?.userId&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return U.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return U.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return U.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return U.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return U.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return U.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return U.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return U.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(t){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",t);return}}getDocumentPath({feature:e,properties:t,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:c,organizationId:p}=t;p||(p=r?.organizationId);let g=new mm({apiKey:a,documentId:c?`${c}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!s&&t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&g?.globalContacts?`${g?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&g?.globalContacts?`${g?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&g?.logins?`${g?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}`:void 0;case"customerMetadata":return g?.customerMetadata?`${g?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&g?.arrow?`${g?.arrow}`:void 0;case"arrow":return t?.documentId&&g?.arrow&&t.id?`${g?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&g?.cursor?`${g?.cursor}`:void 0;case"cursor":return t?.documentId&&g?.cursor&&t.id?`${g?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&g?.flock&&t.id?`${g?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&g?.flock&&t.id?`${g?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&g?.huddle?`${g?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&g?.huddle?`${g?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&g?.huddle?`${g?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&g?.huddle?`${g?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&g?.liveState?`${g?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&g?.liveState?`${g?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&g?.liveStateSingleEditorMode?`${g?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&g?.presence&&t?.userId?`${g?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&g?.presence?`${g?.presence}`:void 0;case"workspaceIam":return g?.workspaceIam?`${g?.workspaceIam}`:void 0;case"selection":return t?.documentId&&g?.selection&&t?.userId?`${g?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&g?.selection?`${g?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&g?.syncVideoPlayer?`${g?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&g?.tag?`${g?.tag}`:void 0;case"tag":return t?.documentId&&g?.tag&&t?.id?`${g?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&g?.userContactUs?`${g?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&g?.userFeedback?`${g?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&g?.userReportBugs?`${g?.userReportBugs}`:void 0;case"comment":return!s&&t?.documentId&&t?.id&&g?.comment?`${g?.comment}${t?.id}`:void 0;case"allMultiThreads":return!s&&t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return!s&&t?.documentId&&g?.crdt?`${g?.crdt}`:void 0;case"crdtData":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&g?.crdt&&t?.id&&t?.versionId?`${g?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!s&&t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&t?.id&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}`:void 0;case"allDocuments":return!s&&g?.docs&&t?.documentId?`${g?.docs}/${t?.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&t?.documentId&&g?.area?`${g?.area}`:void 0;case"area":return!s&&t?.id&&g?.area?`${g?.area}${t?.id}`:void 0;case"folder":return!s&&t?.folderId&&g?.folder?`${g?.folder}${t?.folderId}`:void 0;case"documentUserAccess":return!s&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!s&&t?.documentId&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&g?.organizationIam?`${g?.organizationIam}users/`:void 0;case"reaction":return!s&&t?.id&&g?.reaction?`${g?.reaction}${t?.id}`:void 0;case"allReactions":return!s&&t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return!s&&t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}${t?.id}`:void 0;case"allRecorders":return!s&&t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"organizationMetadata":return!s&&g?.organizationMetadata?`${g?.organizationMetadata}`:void 0;case"heartbeat":return t?.id&&g?.heartbeat?`${g?.heartbeat}${t?.id}`:void 0;case"allHeartbeats":return g?.heartbeat?`${g?.heartbeat}`:void 0;case"heartbeatByDocument":return t?.id&&g?.heartbeatByDocument?`${g?.heartbeatByDocument}${t?.id}`:void 0;case"allHeartbeatsByDocument":return g?.heartbeatByDocument?`${g?.heartbeatByDocument}`:void 0;case"documentAccessType":return!s&&g?.documentIam?`${g?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&g?.metadata?`${g?.metadata}`:void 0;case"allDocumentViews":return!s&&t?.documentId&&g?.views?`${g?.views}documentViews/`:void 0;case"documentViews":return!s&&t?.documentId&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}`:void 0;case"allLocationViews":return!s&&t?.documentId&&g?.views?`${g?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&t?.id&&t?.user&&g?.views?`${g?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/location`:void 0;case"location":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(c){return Q(this,arguments,function*({feature:e,data:t,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(t)));break}case"allArrows":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(t)));break}case"allCursors":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(t)));break}case"allComments":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(t)));break}case"allDocumentUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allFolderUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allOrganizationUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allMultiThreads":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(t)));break}case"allDocNotifications":{t&&typeof t=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(t)?t:Object.values(t)));break}case"allUserNotifications":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(t)));break}case"allPresence":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(t)));break}case"allRecorders":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(t)));break}case"allReactions":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(t)));break}case"allTags":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(t)));break}case"allHuddleAttendees":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(t)));break}case"liveStateCustom":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(t));break}case"allLiveStateCustoms":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(t)));break}case"allLiveStates":{t&&typeof t=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(t));break}case"liveStateSingleEditorMode":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return t}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),t}})}mergeCommentAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(t){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:t,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(c,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):t;case"allArrows":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):t;case"allCursors":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):t;case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):t;case"allDocumentUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allFolderUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allOrganizationUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allMultiThreads":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):t;case"allDocNotifications":return t&&typeof t=="object"?t?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):t;case"allUserNotifications":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):t;case"allPresence":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):t;case"allRecorders":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):t;case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):t;case"allTags":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):t;case"allHuddleAttendees":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):t;case"liveStateCustom":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(t):t;case"allLiveStateCustoms":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):t;case"allLiveStates":return t&&typeof t=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(t):t;case"liveStateSingleEditorMode":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):t;default:return t}return t}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),t}}mergeCommentAnnotationsWithData$({data:e,feature:t}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(de(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:t}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(de(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:t}){try{return this.usersService.getUserById$().pipe(de(()=>{let r=this.mergeUsersWithData({feature:e,data:t?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:t?.operation??null}:{data:r,operation:t?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(t)}}mergeLocationMetadataWithData$({data:e,feature:t}){try{return this.docService.getLocationMetadata$().pipe(de(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:t,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),vt(Kt))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,r),se(e)}}handleDataStripping({feature:e,data:t,actionType:r,commentId:a}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:r,commentId:a});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",s),{originalData:t,strippedData:null}}}formatData({feature:e,data:t,properties:r,offset:a,isRealtimeDb:s}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof t=="object"&&(t=JSON.parse(JSON.stringify(t)));let c=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return s?t:{metadata:t};case"documentCommentMetadata":return t;case"cursor":return this.cursorUtilsService.formatCursorUserData(t);case"comment":return this.commentUtilsService.formatCommentData(t);case"area":return this.areaUtilsService.formatAreaData(t);case"arrow":return this.arrowUtilsService.formatArrowData(t);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(t);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(t);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(t);case"reaction":return this.reactionUtilsService.formatReactionData(t);case"recorder":return this.recorderUtilsService.formatRecorderData(t,c);case"notificationViewsTimestamp":return{views:{[r.user??""]:t}};case"documentUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"documentDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"documentMetadataViews":return s?t:{metadata:t};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(t);case"locationMetadataViews":return s?t:{metadata:t};case"locationUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"locationDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"locationViews":return s?t:{location:t};case"docNotificationViews":return s?t:{views:t.views};case"userNotificationViews":return s?t:{views:t.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(t);case"selection":return this.selectionUtilsService.formatSelectionData(t);case"tag":return this.tagUtilsService.formatTagData(t);default:return t}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),t}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:t,subscriber:r,operation:a=null}){try{let c=yield this.modifyData({feature:e,data:t});r.next({data:c,operation:a})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:t,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(t.type==="removed")return!Object.keys(r??{}).includes(t.doc.id);if(r?.[t.doc.id]){let a=t.doc.data(),s=r?.[t.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return Q(this,arguments,function*({feature:e,data:t}){try{return yield this.formatResponse({feature:e,data:t})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),t}})}addMetadata(e,t){try{return e&&typeof e=="object"&&!Array.isArray(e)?T(E({},e),{metadata:e?.metadata??{documentId:t?.documentId,organizationId:t?.organizationId,apiKey:t?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return Q(this,arguments,function*({feature:e,data:t,observablesCache:r,eventType:a,id:s,operation:c=null}){try{let f={comment:"allComments",reaction:"allReactions"}[e];if(!f)return null;let I=t?.metadata?.documentId,D=t?.metadata?.veltFolderId;return Object.keys(r).filter(N=>N.includes(f)&&(!I||N.includes(I)||D&&N.includes(D))).forEach(N=>{let G=r[N]?.subject?.getValue()??{};a==="DELETE"?s&&G?.data?.[s]&&(delete G?.data?.[s],r[N]?.subject&&r[N].subject.next({data:G?.data,operation:c})):r[N]?.subject?.next({data:T(E({},G?.data),{[t?.annotationId]:t}),operation:c})}),null}catch(g){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",g),null}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s})}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",p),e}})}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:t,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}rtdbDefaultTransactionCallback(e,t){try{let r=E({},e||{});return Object.entries(t).forEach(([a,s])=>{s==null?delete r[a]:r[a]=s}),r}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",r),e}}};o.\u0275fac=function(t){return new(t||o)(ee(fpe),ee(vpe),ee(Zg),ee(Cpe),ee(_pe),ee(lR),ee(cR),ee(y),ee(bpe),ee(dR),ee(Epe),ee(xpe),ee(OC),ee(Tpe),ee(Dpe),ee(Fn),ee(rt),ee(Ks),ee(pm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var wpe=(()=>{let o=class o{constructor(e,t,r){this.configService=e,this.authService=t,this.loggingService=r,this.firestore$=new ve(null);try{dn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Fe(([a,s])=>!!a&&!!s),ot(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(M9(Yg.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||M9("DocumentIdDb");if(e){let t=OI(e,"generateDocumentId");return SC(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(t){return new(t||o)(ee(Rt),ee(Ue),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var gn=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.authService=e,this.commonDbUtilsService=t,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=c,this.docService=p,this.usersService=g,this.commentAnnotationsResolverService=f,this.reactionAnnotationsResolverService=I,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(D=>{if(D){this.db=D;let N=Pi(D,".info/serverTimeOffset");this.offsetListener=Ig(N,G=>{let z=G.val();this.offset=z})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,t])=>{t?.subject?.complete(),t?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(e,t){return Q(this,null,function*(){try{if(this.db){let r=Pi(this.db,e);return yl(r).update(t)}return Promise.resolve()}catch(r){return this.loggingService.catch("Error in setupOnDisconnect:",r),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){dn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([t,r])=>!!t),ot(1),tn(([t,r])=>{e({db:t,firestore:r})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,r,a,s,c){return Q(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(f=>Q(this,[f],function*({db:p,firestore:g}){let I;t?.skipFirestore||(I=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let N,G;try{D&&(N=Pi(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{I?.includes("/organizations")&&g&&I&&(G=SC(g,`${I}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield r({dbRef:N,firestoreRef:G,data:a,firestorePath:I}),c&&c({firestoreAvailable:!!g})}catch(N){this.loggingService.catch(`Error in ${e} operation: `,N),s&&s(N)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,g=>Q(this,null,function*(){if(g.dbRef){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Bh(g.dbRef,()=>JSON.parse(JSON.stringify(f))):yield p0(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:D,eventType:N}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??r?.targetCommentId});if(e==="comment"){let G=null;I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:N,commentId:c?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null;I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:g.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield Jme(this.firestore,G=>Q(this,null,function*(){G.set(g.firestoreRef,f)}))):yield PW(g.firestoreRef,f)}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in setData for ${e}`,g)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,g=>Q(this,null,function*(){if(g.dbRef&&!r?.skipRtdb){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Bh(g.dbRef,I=>{let D;return r?.rtdbTransactionCallback?D=r.rtdbTransactionCallback(I,f):D=this.commonDbUtilsService.rtdbDefaultTransactionCallback(I,f),JSON.parse(JSON.stringify(D))}):yield vM(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:D,eventType:N}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(e==="comment"){let G=null;I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:N,commentId:c?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null;I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:g.firestorePath??""}))}else yield PW(g.firestoreRef,f,{merge:!0})}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in updateData for ${e}`,g)}})}deleteData(s){return Q(this,arguments,function*({feature:e,properties:t,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:t?.id,operation:{type:"removed",ids:[t?.id]}}),this.performDatabaseOperation(e,t,c=>Q(this,null,function*(){c.dbRef&&(yield fM(c.dbRef));try{if(c.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE",metadata:t?.metadata}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else yield Yme(c.firestoreRef)}catch(p){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(c){this.loggingService.catch(`Error in deleteData for ${e}`,c)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=on()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),on()||"noDocumentId"}}queryData(r){return Q(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();return!e||!t?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,t):yield this.handleRtdbQuery(e,t)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,t){return Q(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=OI(this.firestore,r);t?.useCollectionGroup&&(a=wW(this.firestore,r));let s=t?.firestoreQuery??[],c=AW(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount)try{let p=yield Zme(c).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,g),null));return p?p.data().count:0}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,p),0}else try{let p=yield Qme(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,f),null));if(!p)return[];let g=p.docs.map(f=>f.data());try{return yield this.commonDbUtilsService.modifyData({feature:e,data:g})}catch(f){return this.loggingService.catch(`Error in modifyData for ${e}`,f),g}}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,p),[]}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,t){return Q(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=Pi(this.db,r),s=t?.rtdbQuery??[],c=n$(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let p=yield e$(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,f),null));if(!p)return[];let g=p.val();return g?t?.skipObjectValues?g:Object.values(g??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return Q(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();if(t?.skipFirestore&&(a=!1),!e||!t)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield Xme(SC(this.firestore,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=c.data();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,c),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{if(!this.authService.getUser())return{};let c=yield e$(Pi(this.db,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=c.val();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:t}){let r=this.shouldUseFirestore();t?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(t)}`;return dn([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Fe(s=>!!s))]).pipe(Fe(([s,c])=>s?r&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),fe(([s,c])=>{try{if(r&&c){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let f=this.handleFirestoreListener(e,t,c).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.firestoreSubscriptions[a]=f}return new Ut(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let f=this.handleRealtimeDbListener(e,t,s).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.rtdbSubscriptions[a]=f}return new Ut(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.rtdbSubscriptions[a]?.unsubscribe(),delete this.rtdbSubscriptions?.[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache?.[a]))}})}return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Bu(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,t,r){let a=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}),s=`${e}-${JSON.stringify(t)}`;return a?new Ut(c=>{let p=t.isCollection?this.setupCollectionListener(r,a,e,c,t):this.setupDocumentListener(r,a,e,c,t);return()=>{c.complete(),c.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(fe(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:c})),fe(c=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:e}):se(c)),fe(c=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:e}):se(c)),vt(Kt)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,t,r,a,s){let c=`${r}-${JSON.stringify(s)}`,p=OI(e,t);if(s?.useCollectionGroup&&(p=wW(e,t)),s?.useQuery&&s?.firestoreQuery){let I=s?.firestoreQuery??[];p=AW(p,...I)}let g=!0,f=[];return r==="allComments"&&this.loggingService.logPerf(`[PERF] allComments listener started at ${performance.now().toFixed(2)}ms`),OW(p,I=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),N=null,G=!1;I?.docChanges()?.length?I.docChanges().forEach(z=>{["allComments","allReactions"].includes(r)&&!g&&z.type!=="removed"&&f.push(z.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:z,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(G=!0,Object.assign(D,this.handleCollectionChange(z,D)),z.type==="removed"&&(N||(N={type:z.type,ids:[]}),N.ids.push(z.doc.id)))}):G=!0,G&&(["allComments","allReactions"].includes(r)&&f?.length&&(this.commonDbUtilsService.resolveAnnotations({data:f,feature:r}),f=[]),r==="allComments"&&g&&Object.keys(D).length>0&&this.loggingService.logPerf(`[PERF] allComments first snapshot received at ${performance.now().toFixed(2)}ms, entries count: ${Object.keys(D).length}`),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:N})),g=!1}catch(D){this.handleListenerError(D,r,a)}},I=>this.handleListenerError(I,r,a))}handleCollectionChange(e,t){switch(e.type){case"added":case"modified":t[e.doc.id]=e.doc.data();break;case"removed":delete t?.[e.doc.id];break}return t}setupDocumentListener(e,t,r,a,s){let c=SC(e,t);return OW(c,p=>{try{let g=p.data()||{};s?.field&&(g=g?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:g,subscriber:a,operation:null})}catch(g){this.handleListenerError(g,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,t,r){this.loggingService.catch(`Firestore listener error for ${t}:`,e)}handleRealtimeDbListener(e,t,r){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),se({});let s=Pi(r,a);if(t?.useQuery&&t?.rtdbQuery){let c=t?.rtdbQuery??[];s=n$(s,...c)}return this.objectValFromChildEvents(s,e).pipe(zn(c=>(this.loggingService.catch(`RTDB listener error for ${e}:`,c),se({}))),de(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((g,[f,I])=>(g[f]=this.commonDbUtilsService.addMetadata(I,t),g),{}):this.commonDbUtilsService.addMetadata(c,t))),fe(c=>this.commonDbUtilsService.modifyData({feature:e,data:c})),fe(c=>this.usersService.getUserById$().pipe(de(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:c}),operation:null})))))}objectValFromChildEvents(e,t){return new Ut(r=>{let a={},s=!1,c=null,p=z=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,z),r.error(z)}catch{}},g=z=>{try{if(!gi(z,c)){let J=JSON.parse(JSON.stringify(z));c=J,r.next(J)}}catch{}},f=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},I=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},D=z=>{try{z.key&&(delete a[z.key],s&&g(E({},a)))}catch{}},N=z=>{try{if(!s){let J=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};c=J,r.next(J),s=!0}}catch{}};dre(e,f,p),mre(e,I,p),pre(e,D,p);let G=Ig(e,N,p,{onlyOnce:!0});return()=>{try{G&&typeof G=="function"&&G(),hM(e,"child_added",f),hM(e,"child_changed",I),hM(e,"child_removed",D)}catch{}}})}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(gm),ee(y),ee(wpe),ee(bn),ee(Rt),ee(rt),ee(Fn),ee(Ks),ee(pm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var yi=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=c,this.commonDbService=p,this.usersService=g,this.db=fs(),this.internalUserContacts$=new ve([]),this.userGlobalContact$=new ve(!1),this.userGroupContact$=new ve(null),this.users$=new ve([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userAccessFields$=new ve({}),this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new tt,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([zi.ALL]),this.customUserContacts$=new ve(null),this.customUserContactsConfig$=new ve({merge:!1}),this.currentOrganizationUserIAM$=new ve(null),this.userContacts$=new ve([]),this.userSnippylyIdContacts$=new ve(null),this.usersByOrganizationId$=new ve({}),this.temporaryUserIds$=new ve([]),this.usersByOrganizationIdAndDocumentId$=new ve({}),this.usersByOrganizationIdAndFolderId$=new ve({}),this.userById$=new ve({}),this.authService.setContactService(this),this.authService.getUser$().pipe(fe(f=>this.docService.getDocumentPaths$().pipe(tn(I=>{this.documentPaths=I}),de(()=>f)))).subscribe(f=>Q(this,null,function*(){if(this.user=f,f&&this.documentPaths)if(!f?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(f),this.setLoggedInUser(f),yield this.moveGlobalContactUserFromEmailToUserIdPath(f),this.updateUserInGlobalContactsIfAvailable(f),f?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(f?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let I=this.userPermissionService?.getCurrentUserPermissions(),D=this.documentPaths.folderId,N=!0;D&&I?.[f?.userId]?.folders?.[D]?.errorCode===ko.PERMISSION_DENIED&&(N=!1),this.getOrganizationContactsFromDb$(),N&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0}),f=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",f)}),this.databaseService.getDb().pipe(Fe(f=>!!f),ot(1)).subscribe(f=>{f&&(this.db=f)},f=>{this.loggingService.catch("Error in ContactService constructor getDb: ",f)}),this.getOrganizationGroups$().subscribe(f=>{this.authService.setOrganizationUserGroups(f)}),dn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([f,I,D])=>{I?D?.merge?this.userContacts$.next([...f||[],...I||[]]):this.userContacts$.next(I||[]):this.userContacts$.next(f||[])}),this.getUserContacts$().subscribe(f=>{try{f?.forEach(I=>{let D=I?.userSnippylyId||G0(this.configService.getApiKey(),I.userId);D&&this.userSnippylyIdContacts$.next(T(E({},this.userSnippylyIdContacts$.value),{[D]:I}))})}catch{}})}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.next([]),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(t){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",t)}}checkIfUserGlobalContact(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}return!1}catch(t){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",t),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(E({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let t=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let c=r.contacts[s];if(c?.userId){let p=Et(c?.userId);a[p]=c}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}})}}}}catch(t){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",t)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{if(!this.userPermissionService?.getIsContextEnabled())return;let t=this.getUserAccessFields();e.forEach(r=>{t[r.user.userId]=r.accessFields||[]}),this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new Vo;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}}))}}}catch(t){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",t)}})}setLoggedInUserPrivateContacts(e,t){try{if(e?.userId&&this.documentPaths?.logins){let r,a=t?.filter(c=>c?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(c=>{if(c?.userId){let p=Et(c?.userId);r[p]=c}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let t=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});t&&Object.keys(t??{}).forEach(r=>Q(this,null,function*(){let a=t[r];a?.email&&a?.userId&&Et(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return Q(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(ot(1)).subscribe(t=>Q(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Ei.PUBLIC)r=!0;else if(a===Ei.RESTRICTED){let s=Et(this.user?.userId);if(t?.users?.[s]&&(r=!0),this.user?.email){let c=Et(this.user?.email);t?.users?.[c]&&(r=!0)}}if(r){let s=new bp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,t){try{let r=t?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>Q(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in ContactService removeGroupContacts: ",t)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let t={};e.forEach(r=>{r?.userId?(!r?.email||!t[r.email])&&(t[r.userId]=r):r?.email&&(!r?.userId||!t[r.userId])&&(t[r.email]=r)}),e=Object.values(t??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:t,documentId:r,veltFolderId:a}=e||{};return t&&r?dn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(de(([s,c,p,g,f,I,D,N])=>{let G={},z=!1;I&&!I?.merge&&(z=!0);let J=Be=>D.some(be=>Be.includes(be)),ce=J([zi.ALL,zi.ORGANIZATION])?Object.keys(s?.[t]||{}):[],ye=a?J([zi.ALL,zi.FOLDER])?Object.keys(c?.[t]?.[a]||{}):[]:[],Oe=J([zi.ALL,zi.DOCUMENT])?Object.keys(p?.[t]?.[r]||{}):[];if([...ce,...ye||[],...Oe,...N].forEach(Be=>{let be=g?.[Be];be&&(G[Be]=be)}),f){let{merge:Be,options:be}=I||{},{organizationId:Se,documentId:Ae,folderId:Ce}=be||{},he=Ce?ji(Ce):void 0;(!Se||Se===t)&&(!Ae||Ae===r)&&(!he||he===a)&&(Be||(G={}),f.forEach(we=>{we?.userId&&(G[we.userId]=we)}))}return Object.values(G??{})})):this.userContacts$.asObservable().pipe(de(s=>s))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Fe(e=>!!e),fe(e=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),tn(t=>{this.documentPaths=t}),de(()=>e))),fe(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),tn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(de(r=>r?.data),tn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Et(e?.userId)}}).pipe(de(r=>r?.data),tn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),Fo(...t).pipe(fo(this.authService.getUser$().pipe(Fe(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable().pipe(vt(Kt))}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(fe(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(t=>t?.data),tn(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(fe(e=>e?.organizationId?this.userById$.pipe(de(t=>{let r={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(de(t=>{let r={};return t.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(de(t=>t.find(r=>r.email===e)))}getUserByEmail(e){return this.users?.find(t=>t.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(t=>t.email===e)}getUserByUserId$(e){return this.users$.pipe(de(t=>t.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe(Fe(t=>!!t),de(t=>t?.organizationId)).subscribe(t=>Q(this,null,function*(){if(t&&e){let r=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ht("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(r?.length){let a=yield this.usersService.resolveUsers({userIds:r.map(s=>s?.userId)});if(a){let s={};Object.entries(a).forEach(([p,g])=>{s[p]=g}),this.userById$.next(E(E({},this.userById$.value),s));let c=new Set([...this.temporaryUserIds$.value,...Object.keys(s)]);this.temporaryUserIds$.next(Array.from(c))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveOrganizationUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),t?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0,useQuery:!0,firestoreQuery:[_i(F9(ht("organizationIds","array-contains-any",[r]),ht("viewerOrganizationIds","array-contains-any",[r]))),Xi("id")]}}).pipe(de(a=>a?.data),de(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserAccessFields(s),this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveFolderUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[_i(F9(ht("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),ht("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),Xi("id")]}}).pipe(de(s=>s?.data)),a.pipe(de(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let c=Object.values(s??{});this.setUserAccessFields(c),this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(Fe(r=>!!r),tn(r=>{this.documentPaths=r}),de(()=>t))),fe(t=>this.usersService.getResolveDocumentUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(fe(r=>{let a=r?.length>0?r.map(g=>g.documentId):[this.documentPaths?.documentId??""];if(a.some(g=>!g)||!this.documentPaths)return se();let s=se([]),c={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId);let p=[];for(let g=0;g<a.length;g+=U.LISTENER_BATCH_SIZE)p.push(a.slice(g,g+U.LISTENER_BATCH_SIZE));return s=dn(p.map(g=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(E({},c),{firestoreQuery:[_i(F9(ht("documentIds","array-contains-any",g),ht("viewerDocumentIds","array-contains-any",g))),Xi("id")]})}).pipe(Tr()))).pipe(de(g=>Qr(g)?.data)),s.pipe(de(g=>{if(g){typeof g=="object"&&(g?.undefined&&delete g.undefined,g?.null&&delete g.null);let f=Object.values(g??{});this.setUserAccessFields(f),this.setUserDocumentContacts(f)}else this.setUserDocumentContacts([])}))})):se():se())),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),this.usersService.setUserByIds(a),t){let s={};s[t]={};let c={};e.forEach(p=>{s[t][p.user.userId]=p,c[p.user.userId]=p.user}),this.userById$.next(E(E({},this.userById$.value),c)),this.usersByOrganizationId$.next(T(E({},this.usersByOrganizationId$.value),{[t]:s[t]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{let t=e?.map(s=>s?.user);this.userFolderContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.folderIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndFolderId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",t)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{let t=e?.map(s=>s?.user);this.userDocumentContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.documentIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndDocumentId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",t)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(zi.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(zi.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(zi.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(zi.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let t=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(t)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>{if(this.setUserOrganizationGroups([]),!t)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(de(a=>a?.data),de(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",t)}}onContactSelected(e){try{if(e?.userId){let t=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Ei.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:r,isDocumentContact:t,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let t={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(t)}}catch(t){this.loggingService.catch("Error in ContactService onContactSelected: ",t)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereLabel: ",t)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereDescription: ",t)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([zi.ALL,zi.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(t){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",t)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(t=>e.includes(t))}updateContactList(e,t){return Q(this,null,function*(){try{this.analyticsService.trackEvent(Z.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(E({},e?.options),{documentId:t,organizationId:r})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(fe(e=>e?dn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(de(([t,r,a,s,c])=>{let p={};p.organizationUsers=t?.map(f=>this.convertToClientUser(f)),p.folderUsers=r?.map(f=>this.convertToClientUser(f)),p.documentUsers=a?.map(f=>this.convertToClientUser(f)),p.updatedContactList=c?.map(f=>this.convertToClientUser(f));let g=[];return s?.forEach(f=>{let I=this.convertToClientUserGroup(f,p.organizationUsers||[]);I&&g.push(I)}),p.userGroups=g,p}),vt(Kt)):se(null)),zn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,t){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(s=>{if(s?.userId){let c=Et(s.userId);a[c]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(t){return this.loggingService.catch("Error in ContactService convertToClientUser: ",t),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(Rt),ee(bn),ee(rt),ee(y),ee(gn),ee(Fn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ope=i=>{try{let o={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return $I.sanitize(i,o)}catch(o){return nt.catch("Error in File utils sanitizeSvg: ",o),""}},Ape=i=>{try{return i.name.split(".").slice(0,-1).join(".")}catch(o){nt.catch("Error in File utils getFileName: ",o);return}},HW=i=>{try{return/(?:\.([^.]+))?$/.exec(i?.name)[1]}catch(o){nt.catch("Error in File utils getFileExtension: ",o);return}},Ppe=(i,o)=>{try{let n=i.slice(0,-1,i.type);return new File([n],o+"."+HW(i),{type:i.type})}catch(n){nt.catch("Error in File utils updateFile: ",n);return}},Mpe=i=>new Promise((o,n)=>{let e=new FileReader;e.readAsDataURL(i),e.onload=()=>{o(e.result)},e.onerror=t=>{n(t)}}),zW={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Xg=(()=>{let o=class o{constructor(e,t,r,a){this.authService=e,this.configService=t,this.loggingService=r,this.attachmentResolverService=a,this.storage=Ib();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=Ib(void 0,s?.firebaseOptions?.storageBucket))},s=>{this.loggingService.catch("Error in StorageService constructor: ",s)})}catch(s){this.loggingService.catch("Error in StorageService constructor:",s)}}createAttachment({path:e,file:t}){try{let r=new bC;r.name=t.name;let a=Ppe(t,`${r.attachmentId}_${Ape(t)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=t.size,r.type=HW(t),r?.type&&(r.mimeType=zW[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}sanitizeSvgFile(e){return Q(this,null,function*(){if(e.type===zW.svg)try{let t=yield e.text(),r=Ope(t);return new File([r],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(s){return Q(this,arguments,function*({attachment:e,file:t,resolve:r,reject:a}){try{let c=Eb(this.storage,e.bucketPath),p=w$(c,t,{cacheControl:"public,max-age=3600"});p.on("state_changed",g=>{let f=g.bytesTransferred/g.totalBytes*100},g=>{a(g)},()=>{D$(p.snapshot.ref).then(g=>{e.url=g,r(e)})})}catch(c){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",c),a(c)}})}uploadToResolver(c){return Q(this,arguments,function*({file:e,attachment:t,metadata:r,resolve:a,reject:s}){try{r.attachmentId=t.attachmentId;let p={attachmentId:t.attachmentId,name:t.name,file:e,metadata:r,mimeType:t.mimeType},g=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:Oa.ATTACHMENT_ADD});g&&g.data?.url?(t.url=g.data?.url,a(t)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:t,useAttachmentResolver:r,metadata:a}){return new Promise((s,c)=>Q(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let p=yield this.sanitizeSvgFile(t),g=this.createAttachment({path:e,file:p});if(!g)throw new Error("Attachment not created");r?this.uploadToResolver({file:p,attachment:g,metadata:a,resolve:s,reject:c}):this.uploadAttachmentToStorage({attachment:g,file:p,resolve:s,reject:c})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),c(p)}}))}uploadChunk(e,t,r){return new Promise((a,s)=>{try{if(this.apiKey){let c=`${this.apiKey}/${e}/${t.name}`,p=Eb(this.storage,c),g=w$(p,t,{cacheControl:"public,max-age=3600"});g.on("state_changed",f=>{let I=f.bytesTransferred/f.totalBytes*100},f=>{s(f)},()=>{D$(g.snapshot.ref).then(f=>{a(f)}).catch(f=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,f),s(f)})})}else{let c=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",c),s(c)}}catch(c){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,c),s(c)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let r=t.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(U.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(s),a.remove()},t.onerror=()=>{window.open(e.url,"_blank")},t.open("GET",e.url),t.send()}}catch(t){this.loggingService.catch("Error in StorageService downloadAttachment: ",t)}}deleteAttachment({attachment:e,metadata:t,useAttachmentResolver:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t}).then(()=>{a(null)}).catch(c=>{s(c)});else{let c=Eb(this.storage,e.bucketPath);T$(c).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,r)=>{let a=Eb(this.storage,e);T$(a).then(()=>{t(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(Rt),ee(y),ee(Kg))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var In=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=c,this.loggingService=p,this.commonDbService=g,this.documentIAM$=new ve(null),this.workspaceIAM$=new ve(null),this.roles$=new ve([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Fe(f=>!!f),ot(1)).subscribe(f=>{f&&(this.getUser(),this.getDocumentPaths())},f=>{this.loggingService.catch("Error in CommentService getDb subscription: ",f)}),this.getRole$().pipe(ot(1)).subscribe(f=>{this.authService?.getUser()&&!f&&this.analyticsService.trackEvent(Z.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(f=>{f?.accessType&&this.contactService.setDocumentAccessType(f.accessType)})}catch(f){this.loggingService.catch("Error in IamService constructor: ",f)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Fe(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(Fe(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new j9;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(zn(e=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(de(e=>!!e),vt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(de(e=>e?.length?e:U.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(de(e=>e?.features),fe(e=>this.getRole$().pipe(de(t=>(t===so.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(fe(()=>this.documentIAM$.pipe(Fe(t=>!!t),fe(()=>this.workspaceIAM$.pipe(de(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(fe(()=>this.configService.getSF$()),fe(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),fe(()=>this.configService.getSF()?this.documentIAM$.pipe(Fe(e=>!!e),vt(Kt)):se(null)),fe(()=>this.workspaceIAM$.pipe(vt(Kt))),de(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return so.ADMIN;if(!e)return this.user?.isAdmin?so.ADMIN:so.COMMENTER;let t=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Ei.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Ei.PUBLIC:null){case Ei.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||so.COMMENTER;break;case Ei.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}return t}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(de(e=>e===so.ADMIN),vt())}isUserAdmin(){try{return this.getRole()===so.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[Et(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[Et(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[Et(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[Et(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(yi),ee(bn),ee(rt),ee(Rt),ee(y),ee(gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bs=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.authService=e,this.docService=t,this.loggingService=r,this.commonDbService=a,this.usersService=s,this.commentUtilsService=c,this.coreActionsService=p,this.functions=g,this.configService=f,this.contactService=I,this.currentUserPermissions$=new ve(null),this.permissionsCache$=new ve(null),this.permissionProvider$=new ve(null);try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(D){this.loggingService.catch("Error in UserPermissionService constructor:",D)}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(U.DEFAULT_VELT_CONTEXT))return!0;let r=this.contactService.getUserAccessFieldsByUserId(e);return r?t.every(a=>r.includes(a)):!0}catch(r){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",r),!1}}organizationDetails(e){return Q(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:ko.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:ko.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:ko.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(r){return Q(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:ko.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:ko.DOES_NOT_EXIST,error:!0};let s=this.docService.getDocumentMetadata(e)??{};return this.docService.setDocumentMetadata(e,E(E({},s),a?.metadata??{})),{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:ko.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(r){return Q(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:ko.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:ko.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:ko.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let r=yield this.validateResources(t),[a,s]=yield this.fetchUserPermissionsFromDB(t),c=this.buildPermissionsResponse(t,r,a,s);return!e&&Object.keys(c).length>0&&this.setCurrentUserPermissions(c),c}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),r=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:r.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?Ja(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a,clientOrganizationId:s}=e,c=[],p=[];a&&(c.push(this.organizationDetails(a)),p.push({id:s??"",type:"organization"})),t.forEach(f=>{c.push(this.folderDetails({folderId:ji(f),organizationId:a??""})),p.push({id:f,type:"folder"})}),r.forEach(f=>{c.push(this.documentDetails({documentId:Ir(f),organizationId:a??""})),p.push({id:f,type:"document"})});let g=yield Promise.allSettled(c);return this.processValidationResults(g,p)})}processValidationResults(e,t){let r=[],a=[],s,c=e.map((p,g)=>({result:p,metadata:t[g]})).filter(({result:p})=>p.status==="rejected"||p.status==="fulfilled"&&p.value.error);for(let{result:p,metadata:g}of c){let f=p.status==="fulfilled"?p.value.errorCode??ko.SOMETHING_WENT_WRONG:ko.SOMETHING_WENT_WRONG,I={id:g.id,errorCode:f};switch(g.type){case"organization":if(s=I,f===ko.DOES_NOT_EXIST)throw new Error(`Organization with id '${g.id}' does not exist`);break;case"folder":r.push(I);break;case"document":a.push(I);break}}return{failedFolderIds:r,failedDocumentIds:a,failedOrganizationId:s}}fetchUserPermissionsFromDB(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a}=e,s=[this.authService.getUser()?.userId??""],c=[...t.map(f=>ji(f)),...r.map(f=>Ir(f)),a??""],[p,g]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:s,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:s,organizationId:a,resourceIds:c})]);return[p.status==="fulfilled"?p.value:[],g.status==="fulfilled"?g.value:[]]})}buildPermissionsResponse(e,t,r,a){let{folderIds:s,documentIds:c,clientOrganizationId:p,organizationId:g}=e,{failedFolderIds:f,failedDocumentIds:I,failedOrganizationId:D}=t,N={};return this.processRegularUserPermissions(N,r,s,c,p??"",g??"",f,I,D),this.processTemporaryUserPermissions(N,a),N}processRegularUserPermissions(e,t,r,a,s,c,p,g,f){for(let I of t)for(let D of I)D?.user?.userId&&(e[D.user.userId]=T(E({},r.length&&{folders:this.buildFolderPermissions(r,D,p)}),{documents:this.buildDocumentPermissions(a,D,g),organization:{[s]:this.buildOrganizationPermission(c,D,f)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case ko.DOES_NOT_EXIST:return`${t} does not exist`;case ko.PERMISSION_DENIED:return`User does not have access to ${t}`;case ko.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(r){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",r),"Something went wrong"}}buildFolderPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"folder"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerFolderIds?.includes(ji(s))?Ys.VIEWER:Ys.EDITOR},a},{})}buildDocumentPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"document"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerDocumentIds?.includes(Ir(s))?Ys.VIEWER:Ys.EDITOR},a},{})}buildOrganizationPermission(e,t,r){return r?{error:this.getErrorMessage(r.errorCode,"organization"),errorCode:r.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?Ys.VIEWER:Ys.EDITOR}}processTemporaryUserPermissions(e,t){for(let r of t)if(r?.userId)switch(this.ensureUserPermissionStructure(e,r.userId),r.type){case"folder":this.addTemporaryFolderPermission(e,r);break;case"document":this.addTemporaryDocumentPermission(e,r);break;case"organization":this.addTemporaryOrganizationPermission(e,r);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].folders||(e[r].folders={}),e[r].folders[a]||(e[r].folders[a]={accessRole:s??Ys.EDITOR,expiresAt:c})}addTemporaryDocumentPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].documents||(e[r].documents={}),e[r].documents[a]={accessRole:s??Ys.EDITOR,expiresAt:c}}addTemporaryOrganizationPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].organization||(e[r].organization={}),e[r].organization[a]={accessRole:s??Ys.EDITOR,expiresAt:c}}hasEditAccess({organizationId:e,folderId:t,documentId:r}){try{let a=!0,s=this.getCurrentUserPermissionsWithServerIds(),c=this.authService.getUser()?.userId??"";return s&&(e&&typeof e=="string"&&s?.[c]?.organization?.[e]&&(s?.[c]?.organization?.[e]?.accessRole===Ys.VIEWER||s?.[c]?.organization?.[e]?.errorCode===ko.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&s?.[c]?.folders?.[t]&&(s?.[c]?.folders?.[t]?.accessRole===Ys.VIEWER||s?.[c]?.folders?.[t]?.errorCode===ko.PERMISSION_DENIED)&&(a=!1),r&&typeof r=="string"&&s?.[c]?.documents?.[r]&&(s?.[c]?.documents?.[r]?.accessRole===Ys.VIEWER||s?.[c]?.documents?.[r]?.errorCode===ko.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(vt(Kt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),r=this.authService.getUser()?.userId??"";if(t?.[r]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[r]?.organization?.[a]){let s=Ja(a);t[r].organization&&(t[r].organization[s]=t[r].organization[a],delete t[r].organization[a])}t?.[r]?.folders&&(t[r].folders=Object.fromEntries(Object.entries(t?.[r]?.folders??{}).map(([s,c])=>[ji(s),c]))),t?.[r]?.documents&&(t[r].documents=Object.fromEntries(Object.entries(t?.[r]?.documents??{}).map(([s,c])=>[Ir(s),c])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(de(e=>this.refactorPermissionsWithServerIds(e)),vt(Kt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;"),this.currentUserPermissions$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===EC.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return Q(this,null,function*(){try{if(this.isRevokeAccessOnUserLogoutEnabled){let e=[],t=this.authService.getUser()?.userId??"";(this.getPermissionsCache()??[]).forEach(a=>{a.userId===t&&a.hasAccess&&(a.type===Mo.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&e.push(T(E({},a),{hasAccess:!1})):e.push(T(E({},a),{hasAccess:!1})))}),e.length>0&&(this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:on(),methodName:qo.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:e}}),this.setPermissionsCache([]),yield this.revokeAccess({requests:e,userId:this.authService.getUser()?.userId??""}))}}catch(e){this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",e)}})}revokeAccessOnDocumentUnset(){return Q(this,null,function*(){try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let e=[],t=this.docService.getDocumentIds(),r=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.docService.getDocumentPaths()?.folderId??"",s=this.authService.getUser()?.userId??"",c=this.getPermissionsCache()??[];t.forEach(g=>{c.find(f=>f.resourceId===g.clientDocumentId&&f.type===Mo.DOCUMENT&&f.organizationId===r&&f.userId===s)&&(e.push({userId:s,resourceId:g.clientDocumentId,organizationId:r,type:Mo.DOCUMENT,hasAccess:!1}),c=c.filter(f=>!(f.resourceId===g.clientDocumentId&&f.type===Mo.DOCUMENT&&f.organizationId===r&&f.userId===s)))}),a&&c.find(g=>g.resourceId===a&&g.type===Mo.FOLDER&&g.organizationId===r&&g.userId===s)&&(e.push({userId:s,resourceId:a,organizationId:r,type:Mo.FOLDER,hasAccess:!1}),c=c.filter(g=>!(g.resourceId===a&&g.type===Mo.FOLDER&&g.organizationId===r&&g.userId===s))),r&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&c.find(g=>g.resourceId===r&&g.type===Mo.ORGANIZATION&&g.organizationId===r&&g.userId===s)&&(e.push({userId:s,resourceId:r,organizationId:r,type:Mo.ORGANIZATION,hasAccess:!1}),c=c.filter(g=>!(g.resourceId===r&&g.type===Mo.ORGANIZATION&&g.organizationId===r&&g.userId===s)));let p=on();this.setPermissionsCache(c),e.length>0&&(this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:qo.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:e}}),yield this.revokeAccess({requests:e,userId:s}))}}catch(e){this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",e)}})}getAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield sd({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield sd({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}onResourceAccessRequired(c){return Q(this,arguments,function*({requests:e,uniqueId:t,methodName:r,userId:a,fromCache:s=!0}){try{if(!e?.length)return;let p=[],g=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&s&&(e.forEach(f=>{let I=g?.find(D=>D.resourceId===f.resource.id&&D.type===f.resource.type&&D.userId===f.userId&&D.organizationId===f.resource.organizationId);I&&p.push(I)}),p.length>0&&(e=e.filter(f=>!p.find(I=>I.resourceId===f.resource.id&&I.type===f.resource.type&&I.userId===f.userId&&I.organizationId===f.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{requests:e,fromCache:s}});let f=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{result:f}}),f?.success&&f?.data?.length&&(this.setPermissionsCache([...g,...f.data]),f.data=[...p,...f.data]),f}else if(p.length>0)return this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{results:p}}),{data:p,success:!0,statusCode:200};return}catch(p){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",p),this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{error:p,requests:e,fromCache:s}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let s=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(s,a)});let r=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(r)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(rt),ee(y),ee(gn),ee(Fn),ee(Zg),ee(ns),ee(Io),ee(Rt),ee(yi))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vn=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D,N,G,z,J,ce,ye,Oe){this.afAuth=e,this.analyticsService=t,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=c,this.commentUtilsService=p,this.commentAnnotationsResolverService=g,this.databaseService=f,this.docService=I,this.domService=D,this.iamService=N,this.loggingService=G,this.notificationUtilsService=z,this.usersService=J,this.functions=ce,this.userPermissionService=ye,this.coreActionsService=Oe,this.db=fs(),this.notificationsDb=fs(void 0,Dn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.userNotificationsFromServer$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.currentDocumentOnly$=new ve(!1),this.notificationViews$=new ve({}),this.notificationsByIdMap$=new ve(new Map),this.historyPanelVisible$=new ve(!1),this.notificationsForYou$=new ve(null),this.notificationsByDocumentIdMap$=new ve(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new ve(null),this.maxNotificationDays$=new ve(15),this.tabConfig$=new ve({people:{enable:!1}}),this.settingsConfig$=new ve(null),this.muteAllNotifications$=new ve(!1),this.enableSettings$=new ve(!1),this.selfNotifications$=new ve(!1),this.settingsInitialConfig$=new ve([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]),this.notificationsPanelVisible$=new ve(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Fe($e=>!!$e),ot(1)).subscribe($e=>{$e&&(this.db=$e,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},$e=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",$e)}),this.authService.getUser$().subscribe($e=>{$e?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Be=>{this.notificationsByDocumentIdSubscription[Be]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe($e=>{if($e){let Be=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys($e||{}).forEach(be=>{let Se=Be?.[be]?.notifications;Se?.length&&Se.forEach(Ae=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Ae},$e)?.notification})}),this.notificationsByDocumentIdMap$.next(Be)}})}catch($e){this.loggingService.catch("Error in NotificationService constructor: ",$e)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([r,a])=>{t[r]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=Et(this.authService.getUser()?.userId??""),r=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:e?.documentId,userId:t}});if(r?.notificationsConfig)this.setDBConfigDataToInitialConfig(r?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let a={};this.settingsInitialConfig$.getValue().forEach(c=>{if(c.enable){let p=c?.values?.find(g=>g.id===c.default);a[c.id]=p||c?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(a).forEach(c=>{s[c]=a[c].id}),yield this.updateSettingsConfigToDb(s)}}catch(t){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",t)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=Et(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Fe(t=>t===!0),fe(()=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),fe(t=>Do(this.getInitialConfigFromDB(t)).pipe(fe(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:t?.documentId,userId:e}}).pipe(de(r=>{r?.data?.notificationsConfig&&!gi(r?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(r?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.setUserNotificationsFromServer([]),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(fe(()=>this.getCurrentDocumentOnly$().pipe(fe(e=>e?this.docService.getDocumentPaths$().pipe(de(t=>{})):se(void 0)))),tn(()=>{this.notificationsByDocumentIdMap$.next(null)}),fe(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Ti(),de(([e,t])=>{let r=e?.map(g=>g.documentId),a=t?.map(g=>g.documentId),s=r?.filter(g=>!a?.includes(g)),c=a?.map(g=>({documentId:g,timestamp:t?.find(f=>f.documentId===g)?.timestamp})).filter(g=>!r?.includes(g.documentId)),p=a?.map(g=>{let f=t?.find(I=>I.documentId===g)?.timestamp;return{documentId:g,timestamp:f}}).filter(g=>{let f=e?.find(I=>I.documentId===g.documentId)?.timestamp;return f&&g.timestamp&&f!==g.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(g=>{this.removeNotificationsForDocumentId(g)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})))).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(de(r=>{let a=null,s=this.configService.getApiKey(),c=r?.organizationId||t?.organizationId;return s&&c&&(a=new mm({apiKey:s,organizationId:c})),{user:t,documentPaths:a}}))),fe(t=>{let{user:r,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return se(null);if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-c);let p=s.getTime(),g=[_i(ht("timestamp",">=",p),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[ht("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(g.push(Xi("timestamp","desc")),g.push(N9(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:g}}).pipe(de(f=>f?.data),de(f=>{let I=[];return Object.keys(f||{}).forEach(D=>{let N=this.commonDbService.shouldUseFirestore()?f[D]?.timestamp??0:f[D],G=this.commonDbService.shouldUseFirestore()?f[D]?.deletedNotification??!1:!1;if(G&&G.id&&G?.timestamp===N){let z=G.id,J=f[D]?.metadata?.documentId,ce=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ye=ce?.[J]??{documentMetadata:null,notifications:[]},Oe=ye.notifications??[],$e=Oe?.findIndex(Be=>Be.id===z);$e!==-1&&(Oe.splice($e,1),this.notificationsByDocumentIdMap$.next(T(E({},ce),{[J]:T(E({},ye),{notifications:Oe})})))}I.push({documentId:D,timestamp:N})}),I}),zn(f=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",f),se([]))))}return se(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),se([])}}fetchNotificationsForDocumentIds(e,t=15){return Q(this,null,function*(){try{if(e?.length){let r=Ki(this.functions,Zi({url:Dn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let s=this.getStartAtTimestamp(),c={};if(e.forEach(Oe=>{if(Oe?.documentId){let $e=this.getAllowedDocumentMetadataByDocumentId(Oe.documentId);$e&&(c[Oe.documentId]=$e)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let Oe=[];if(e.forEach(Ae=>{this.docService.getDocumentMetadata(Ae.documentId)||Oe.push(Ae.documentId)}),Oe.length){let Ae=this.authService.getUser(),Ce=Ki(this.functions,Zi({url:Dn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let he=yield sd({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Ae?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:Oe},getSdkProxy:Ce,userId:Ae?.userId??""});if(he?.data?.length){let we={};he.data.forEach(Ne=>{Ne?.documentId&&(we[Ne.documentId]=Ne)}),this.docService.setAllDocumentMetadata(E(E({},this.docService.getAllDocumentMetadataMap()),we))}}catch(he){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",he)}}let $e=[],Be=[];e.forEach(Ae=>{let Ce=this.docService.getDocumentMetadata(Ae.documentId);Ce?.clientDocumentId?$e.push({userId:this.authService.getUser()?.userId??"",resource:{id:Ce.clientDocumentId,type:Mo.DOCUMENT,source:qo.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):Be.push(Ae.documentId)}),Be.length&&(e=e.filter(Ae=>!Be.includes(Ae.documentId)));let be=on();this.coreActionsService.triggerAction(Un.PERMISSION_PROVIDER,{event:Z.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:be,methodName:qo.GET_NOTIFICATIONS,source:"internal",payload:{requests:$e}});let Se=yield this.userPermissionService?.onResourceAccessRequired({requests:$e,uniqueId:be,methodName:qo.GET_NOTIFICATIONS});Se?.success&&Se?.data?.length?Se.data.forEach(Ae=>{!Ae.hasAccess&&Ae.resourceId&&(e=e.filter(Ce=>Ce.documentId!==Ir(Ae.resourceId)))}):e=[]}catch(Oe){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",Oe),e=[]}if(!e.length)return[];let p=this.userPermissionService?.getPermissionsCache()?.filter(Oe=>Oe.type===Mo.CONTEXT),g={organizationId:a,documentIds:e.filter(Oe=>!!Oe.documentId&&!!Oe.timestamp).map(Oe=>({documentId:Oe.documentId,timestamp:Oe.timestamp??0})),timestamp:s,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:p,retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},f=yield this.notificationUtilsService.handleNotificationEncryption({data:g}),I=yield r({veltData:f}),D=I?.data?.data?.veltData||{},N=I?.data?.data?.veltAdditionalData||{},G="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),z=yield $0(D,G),{userNotifications:J=[],userNotificationIdsInDocNotifications:ce=[],permissionResults:ye=[]}=yield $0(N,G);if(this.userPermissionService?.getIsContextEnabled()){let Oe=[...this.userPermissionService?.getPermissionsCache()??[],...ye??[]];this.userPermissionService?.setPermissionsCache(Oe)}if(z&&typeof z=="object"){let Oe=this.usersService.userDataProviderAvailable(),$e=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Be=[],be=[];Object.keys(z).forEach((Se,Ae)=>{let Ce=z[Se].documentMetadata;if(Ce){let we=this.allowedDocumentMetadataMap$.value||{};(!we?.[Se]||!gi(we?.[Se],Ce))&&this.allowedDocumentMetadataMap$.next(T(E({},we),{[Se]:Ce}))}let he=z[Se].notifications||[];he.forEach(we=>{ce.includes(we.notificationId)&&!J.find(Ne=>Ne.notificationId===we.notificationId)&&J.push(JSON.parse(JSON.stringify(we))),we.notification=this.getClientNotificationObject(we)}),this.setNotificationForDocumentIdInCache(Se,Ce,he),Oe&&(Be.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldAwait:!0,forceResolve:!0})),Be.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldAwait:!0,forceResolve:!0}))),$e&&(be.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldCommentAnnotationsResolverAwait:!0})),be.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldCommentAnnotationsResolverAwait:!0})))}),this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer(),...J]),Oe&&Promise.all(Be).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:z?.[Se]?.notifications||[]});Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})}),$e&&Promise.all(be).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=z?.[Se]?.notifications?.reduce((he,we)=>(he[we.notificationId]=we,he),{});Ce=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Ce}),Ce=Object.values(Ce??{}),Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t.filter((r,a,s)=>a===s.findIndex(c=>c.notificationId===r.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(s);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),g=p?.[e]?.notifications||[],f=this.docService.getLocationMetadatas(),I=r?.map(G=>{let z=G?.notification;return z?(z.metadata&&(z.metadata.documentName=t?.documentName||z.metadata.documentName,z.metadata.organizationMetadata=c||z.metadata.organizationMetadata,z.metadata.documentMetadata=t||z.metadata.documentMetadata),f&&(z=this.notificationUtilsService.mergeLocationWithNotification({notification:z},f)?.notification),z):null})?.filter(G=>!!G)||[],D=new Map(g.map(G=>[G.id,G]));I.forEach(G=>{D.set(G.id,G)});let N=Array.from(D.values()).sort((G,z)=>(z.timestamp||0)-(G.timestamp||0));this.notificationsByDocumentIdMap$.next(T(E({},p),{[e]:{notifications:N,documentMetadata:t}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let t=this.notificationsByDocumentIdMap$.getValue();delete t?.[e],this.notificationsByDocumentIdMap$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",t)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(fe(e=>se(e).pipe(de(t=>{let r=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable();if(r||a){let c=t?.reduce((p,g)=>(p[g.notificationId]=g,p),{});r&&(c=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:c||[]})),a&&(c=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:c||[]})),t=Object.values(c??{})}return t.forEach(c=>{c.notification=this.getClientNotificationObject(c)}),t.sort((c,p)=>p.timestamp-c.timestamp),t.map(c=>c.notification).filter(c=>!!c)}),fe(t=>{let r={data:t?.reduce((a,s)=>(a[s.id]={notification:s},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:r,feature:"allUserNotifications"}).pipe(de(a=>Object.values(a?.data||{}).map(s=>s?.notification)))}))),fe(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(de(()=>e))}),fe(e=>this.allowedDocumentMetadataMap$.pipe(de(()=>e))),de(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=s||t.metadata.organizationMetadata,t.metadata.documentMetadata=a||t.metadata.documentMetadata}return t})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(JSON.parse(JSON.stringify(e))):this.notificationsForYou$.next([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=Rn(e)),t&&typeof t=="object"){let s=tr(t);r=Rn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return ei(this.afAuth).pipe(Fe(s=>!!s),fe(s=>this.isFeatureAllowed({firebaseUser:s})),fe(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(de(c=>(s.featureAllowed=c,s))):se(s)),fe(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(fe(c=>this.docService.getDocumentPaths$().pipe(de(p=>(this.documentPaths=p,c.documentPaths=p,c)))),fe(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>T(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>T(E({},t),{user:r})))),fe(t=>eo(t.config,t.user,Re.NOTIFICATION)?se(T(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Pi(this.db,`${e?r+"/"+U.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+U.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return uM(a).pipe(zn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),de(s=>{let c=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(f=>{let I=s?.raw[f];I?.id&&c.push(I)}),c.forEach(f=>{f.id&&p.set(f.id,f)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(p);let g=[];s?.processed&&Object.keys(s?.processed||{}).forEach(f=>{let I=s?.processed[f];I?.id&&g.push(I)}),this.processedNotifications$.next(g),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),r;e?.email&&(r=Et(e?.email));let a;e?.userId&&(a=Et(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let g=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(g=!0);let f={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:g,notificationSourceData:p.notificationSourceData},I=this.getRawNotificationById(f.id);if(I?.metadata&&(f.metadata={apiKey:I.metadata.apiKey,organizationId:I.metadata.organizationId,clientOrganizationId:I.metadata.clientOrganizationId,documentId:I.metadata.documentId,clientDocumentId:I.metadata.clientDocumentId,location:I?.location,locationId:I?.locationId}),f?.notificationSource==="comment"&&f?.targetAnnotationId){let D=this.commentService?.getAnnotationById(f.targetAnnotationId);D||I?.annotationData&&(D=I.annotationData),D&&(f.notificationSourceData=this.commentService?.getCommentAnnotationForClient(D))}s.set(p.id,f)}}),s.forEach((p,g)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[g]?.views?.[e?.userSnippylyId],s.set(g,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:r,views:a,notification:s}){try{let c=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&c){let g=null;c?.email&&(g=Et(c?.email));let f=null;c?.userId&&(f=Et(c?.userId));let I=!1,D=!0;(g&&p.notifyUsers?.[g]||f&&p.notifyUsersByUserId?.[f])&&(I=!0),f&&a?.[f]&&(D=!1);let N={id:p.id};if(s?N=T(E(E({},N),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:I,isUnread:D}):N={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:I,isUnread:D,metadata:r},N?.notificationSource==="comment"&&N?.targetAnnotationId){let G=this.commentService?.getAnnotationById(N.targetAnnotationId);G||s?.notificationSourceData&&(G=s?.notificationSourceData),G||t?.annotationData&&(G=t.annotationData),G&&(N.notificationSourceData=this.commentService?.getCommentAnnotationForClient(G))}return t?.targetAnnotationData?.isCommentResolverUsed&&(N.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),N}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(de(e=>e?Object.keys(e??{}).map(t=>{let r=e[t].notifications||[],a=r.filter(c=>c.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,r)=>r.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(de(e=>{let t=null;return e?(t=[],e.forEach(r=>{r.notifications.forEach(a=>{t?.push(a)})}),t?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,r=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=t?.documentId?new mm({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),g=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(g))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=Pi(this.notificationsDb),r=this.processNotificationData(e);oM(t,JSON.parse(JSON.stringify(r)))}catch(t){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",t)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(e){return this.authService.getUser$().pipe(fe(t=>t?t.organizationId?this.getAllNotifications$().pipe(fe(r=>this.notificationsForYou$.pipe(de(a=>{if(r||a){let s=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(r||[]).forEach(c=>{c.id&&s.set(c.id,c)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(c=>{c.id&&!s.has(c.id)&&s.set(c.id,c)}),Array.from(s.values()).sort((c,p)=>(p.timestamp||0)-(c.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(de(r=>Array.from(r.values())),de(r=>r.sort((a,s)=>s.timestamp-a.timestamp)),Vu()):se(null)),vt(Kt))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(t){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",t);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(t){this.loggingService.catch("Error in NotificationService setNotificationViews: ",t)}}getNotificationHeadlineMessage(e){try{let t=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,c=r.replace(s,(p,g)=>(g==="actionUser"||g==="recipientUser")&&a[g]?t?.email&&a[g].email===t?.email||t?.userId&&a[g]?.userId===t?.userId?"You":a[g].name||a[g].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[g]?a[g]:p);return this.domService.sanitizeHtml(c)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",t),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let t=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);t=t?.replaceAll(`{{${r.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>'),t=t?.replaceAll(`@User ${r.userId}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(t)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",t),""}}setHistoryPanelVisibility(e,t=!1,r=!1){try{e?document.querySelector(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Z.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()));if(e?.length){for(let c=0;c<e.length;c+=50){let g=e.slice(c,c+50).filter(D=>D?.id),f=g.map(D=>this.setNotificationAsRead({notification:D,userNotifications:JSON.parse(JSON.stringify(t))})),I=yield Promise.all(f);g.forEach((D,N)=>{let G=I[N];if(!G.some(J=>J.notificationId===D.id))t=t.filter(J=>J.notificationId!==D.id);else{let J=t.find(ye=>ye.notificationId===D.id),ce=G.find(ye=>ye.notificationId===D.id);J&&ce?.views&&(J.views=ce.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(c=>{let p=c.metadata?.documentId;if(p&&a?.[p]){let g=a?.[p]?.notifications||[],f=g.find(I=>I.id===c.id);f&&(f.isUnread=!1),a[p].notifications=g}}),this.notificationsByDocumentIdMap$.next(a),!gi(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(ot(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(de(e=>e?.filter(r=>r?.isUnread)?.length??null),fe(e=>this.getNotifications$().pipe(de(t=>{let r=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(r){return Q(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let s=Et(a?.userId),{metadata:c}=e;if(c){let{apiKey:p,organizationId:g,documentId:f}=c;if(p&&g&&f&&s){let I=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p}});I?.notificationId&&(I?.views?.[s]||(I.views||(I.views={}),I.views[s]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p},data:I})));let D=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}});if(D?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}}),t=t.filter(N=>N.notificationId!==e.id);else if(!D?.views?.[s]){D.views||(D.views={}),D.views[s]={timestamp:Date.now()};let N=t.find(G=>G.notificationId===e.id);N&&(N.views=D.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:s,documentId:f,organizationId:g},data:D})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(ot(1)).subscribe(t=>{if(t){let r=t.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}catch(t){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",t)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(t){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",t),null}}setSettingsConfig(e){try{this.enableSettings$.value&&this.settingsConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",t)}}setSettingsConfigWithDB(e){try{this.enableSettings$.value&&(this.settingsConfig$.next(e),this.updateSettingsConfigToDb())}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",t)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}enableSelfNotifications(){try{this.selfNotifications$.value!==!0&&this.selfNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSelfNotifications: ",e)}}disableSelfNotifications(){try{this.selfNotifications$.value!==!1&&this.selfNotifications$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSelfNotifications: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let t=!1;if(e.forEach(r=>{["email","inbox"].includes(r.id)&&(t=!r.values?.every(a=>["ALL","NONE","MINE"].includes(a.id)))}),t){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",t)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return Q(this,null,function*(){try{let t=Et(this.authService.getUser()?.userId??""),r=this.docService.getDocumentPaths(),a={apiKey:this.configService.getApiKey(),organizationId:r?.organizationId,documentId:r?.documentId,clientOrganizationId:r?.clientOrganizationId,clientDocumentId:r?.clientDocumentId,userId:t,clientUserId:this.authService.getUser()?.userId};t&&r?.documentId&&this.getEnableSettings()&&this.enableSettings$.value&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:r.documentId,userId:t},data:{id:r.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:a}}))}catch(t){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",t)}})}openNotificationsPanel(){try{this.notificationsPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService openNotificationsPanel: ",e)}}closeNotificationsPanel(){try{this.notificationsPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService closeNotificationsPanel: ",e)}}getNotificationsPanelVisible$(){return this.notificationsPanelVisible$.asObservable()}getNotificationsPanelVisible(){return this.notificationsPanelVisible$.value}};o.\u0275fac=function(t){return new(t||o)(ee(Ai),ee(et),ee(Ue),ee(Rt),ee(gn),ee(gm),ee(Zg),ee(Ks),ee(bn),ee(rt),ee(Le),ee(In),ee(y),ee(dR),ee(Fn),ee(Io),ee(bs),ee(ns))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var jo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new ve(U.CommentAnnotationStatusMap),this._customPriorityMap=new ve(U.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(U.CommentCategoryMap);try{let t=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let r=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(U.CommentAnnotationStatusMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(U.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",t)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(U.CommentAnnotationPriorityMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(U.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r}),this._customPriorityMap.next(t),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",t)}}setCustomCategories(e){try{let t={};e.forEach(r=>{t[r.id]=r}),this._customCategoryMap.next(t),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",t)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return U.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return U.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(t)return t.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[U.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),r=t.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=t.find(([c,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=t.find(([c,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[1]);break}}return e}catch(t){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",t),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=U.CommentAnnotationPriorityMap[e.priority])}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",t)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(t=>U.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var gd=(()=>{let o=class o{constructor(e,t,r){this.domService=e,this.loggingService=t,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,t){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return t&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${t}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(t=>{let r=e[t];if(r.svg)this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${t}" />`;this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[t]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(t){this.loggingService.catch("Error in EmojiService setEmojiList: ",t)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
208
208
|
<path d="M35.8477 11.6603L40.4962 5.23427" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
209
209
|
<path d="M21.8298 11.617L17.4655 6.02428" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
210
210
|
<path d="M28.7568 9.77682L28.7761 1" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -515,7 +515,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
515
515
|
Provide one more option
|
|
516
516
|
<|im_end|>
|
|
517
517
|
`),a}catch(a){return this.loggingService.catch("Error in RewriterService getChatGPTPrompt: ",a),""}}removeChatGPTPlaceholders(e){try{let t=["<|im_start|>","<|im_start>","<im_start|>","<im_start>","<|im_end|>","<|im_end>","<im_end|>","<im_end>","<|end|>","<|end>","<end|>","<end>","<|start|>","<|start>","<start|>","<start>"],r=e;return t.forEach(a=>{let s=a.replace(/\|/g,"\\|");r=r?.replace(new RegExp(s,"g"),"")}),r}catch(t){return this.loggingService.catch("Error in RewriterService removeChatGPTPlaceholders: ",t),""}}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Ue),ee(Rt),ee(Le),ee(y),ee(Io))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var UR=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: RewriterElement","color: blue;"),this.enableRewriter=this._enableRewriter,this.disableRewriter=this._disableRewriter}_enableRewriter(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableLiveRewriter","color: green;");try{this.trackEvent(Z.Events.Rewriter.ENABLE_REWRITER_TRIGGERED),this.getService(vd).enableRewriter()}catch(o){this.getService(y).catch("Error in enableLiveRewriter: ",o)}}_disableRewriter(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableRewriter","color: green;");try{this.trackEvent(Z.Events.Rewriter.DISABLE_REWRITER_TRIGGERED),this.getService(vd).disableRewriter()}catch(o){this.getService(y).catch("Error in disableRewriter: ",o)}}};var PFe=()=>({}),Yo=(()=>{let o=class o{constructor(){this.height=void 0,this.width=void 0,this.borderRadius=void 0,this.customClass=void 0,this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-skeleton-loader-internal"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{height:"height",width:"width",borderRadius:"borderRadius",customClass:"customClass",customStyles:"customStyles"},standalone:!1,decls:2,vars:11,consts:[[1,"skeleton-loader",3,"ngStyle"]],template:function(t,r){t&1&&(_(0,"div",0),te(1),b()),t&2&&(Lo(r.customClass),at("--velt-skeleton-loader-height",r.height||"100%")("--velt-skeleton-loader-width",r.width||"100%")("--velt-skeleton-loader-border-radius",r.borderRadius||"inherit"),d("ngStyle",r.customStyles||pt(10,PFe)),m(),_e(" ","\u200E ",`
|
|
518
|
-
`))},dependencies:[Xm],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let i=o;return i})();var MFe=["userAvatarRef"],kFe=["*"];function RFe(i,o){if(i&1&&(_(0,"div",7),w(1,"span",8),b()),i&2){let n=l(2).ngIf,e=l();at("background-color",n.background||"#625DF5"),x("data-testid",e.componentId+"-initial-container"),m(),at("color",n.textColor||"#FFFFFF"),x("data-modal-author-initial",n.initial)("data-testid",e.componentId+"-initial")}}function NFe(i,o){if(i&1){let n=Y();_(0,"img",9),W("error",function(){F(n);let t=l(3);return L(t.onImageLoadError())})("load",function(){F(n);let t=l(3);return L(t.onImageLoaded())}),b()}if(i&2){let n=l(2).ngIf,e=l();at("display",n.imgLoaded?"":"none !important"),d("src",n.src,hn),x("alt","User avatar")("data-testid",e.componentId+"-image")}}function FFe(i,o){if(i&1&&(v(0),_(1,"div",4,1),u(3,RFe,2,7,"div",5)(4,NFe,1,5,"ng-template",6),Vt(5),b(),C()),i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId+"-container")("aria-label","User avatar"),m(2),d("ngIf",!n.imgLoaded),m(),d("ngIf",!n.imgLoadError)}}function LFe(i,o){if(i&1&&w(0,"velt-skeleton-loader-internal",10),i&2){let n=l().ngIf;d("height",n.size?n.size+"px":"100%")("width",n.size?n.size+"px":"100%")}}function BFe(i,o){if(i&1&&(v(0),u(1,FFe,6,4,"ng-container",3)(2,LFe,1,2,"ng-template",null,0,xe),C()),i&2){let n=o.ngIf,e=me(3);m(),d("ngIf",n.imgLoaded||(n==null||n.user==null?null:n.user.photoUrl)||(n==null||n.user==null?null:n.user.name)||(n==null||n.user==null?null:n.user.email)||(n==null?null:n.initial))("ngIfElse",e)}}var Qn=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.elementRef=r,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new R(null),this.componentConfigSignal=Ee({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(E({},r),{[t]:e[t].currentValue}),r))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(r=>(r=T(E({},r),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),r)),this.componentConfigSignal.update(r=>(r=T(E({},r),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(E({},r),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(E({},r),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),r))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=T(E({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=T(E({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Ue),h(y),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,r){if(t&1&&it(MFe,5),t&2){let a;Xe(a=Qe())&&(r.userAvatarRef=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},standalone:!1,features:[Ze],ngContentSelectors:kFe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,r){t&1&&(jt(),u(0,BFe,4,2,"ng-container",2)),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,Yo],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%]{display:flex}[_nghost-%COMP%]:empty{display:none}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let i=o;return i})();var VFe=["selectionElementPortalOverlay"],UFe=()=>["velt-overlay-panel"],jFe=i=>[i];function $Fe(i,o){if(i&1&&(v(0),_(1,"span",10),te(2),P(3,"translate"),b(),C()),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(5);m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color),x("data-testid",r.componentId+"-user-name-"+t),m(),Ge(M(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function HFe(i,o){if(i&1&&(v(0),u(1,$Fe,4,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function zFe(i,o){if(i&1&&(_(0,"span",11),te(1),b()),i&2){let n=l(4).ngIf,e=l();at("--velt-selection-color",(n.selections[0]==null||n.selections[0].user==null?null:n.selections[0].user.color)||"white"),x("data-testid",e.componentId+"-additional-count")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" additional users"),m(),_e("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function GFe(i,o){if(i&1&&(v(0),_(1,"div",7),P(2,"translate"),u(3,HFe,2,1,"ng-container",8)(4,zFe,2,5,"span",9),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),x("data-testid",e.componentId+"-label-container")("aria-label",M(2,4,"Selected users")),m(2),d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function WFe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",13),C()),i&2){let n=l(),e=n.$implicit,t=n.index;m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),d("size",20)("user",e==null?null:e.user)}}function qFe(i,o){if(i&1&&(v(0),u(1,WFe,2,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function YFe(i,o){if(i&1&&(_(0,"div",14),P(1,"translate"),_(2,"span",15),te(3),b()()),i&2){let n=l(4).ngIf,e=l();at("--velt-selection-user-index",n.selections==null?null:n.selections.length)("background-color",(n.selections[(n.selections==null?null:n.selections.length)-1]==null||n.selections[(n.selections==null?null:n.selections.length)-1].user==null?null:n.selections[(n.selections==null?null:n.selections.length)-1].user.color)||"white"),x("data-testid",e.componentId+"-additional-avatars")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" "+M(1,7,"additional users")),m(3),_e("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function KFe(i,o){if(i&1&&u(0,qFe,2,1,"ng-container",8)(1,YFe,4,9,"div",12),i&2){let n=l(3).ngIf,e=l();d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function ZFe(i,o){if(i&1&&u(0,GFe,5,6,"ng-container",6)(1,KFe,2,2,"ng-template",null,2,xe),i&2){let n=me(2),e=l(2).ngIf,t=l();d("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",n)}}function XFe(i,o){if(i&1&&(v(0),w(1,"div",4,0),u(3,ZFe,3,2,"ng-template",5,1,xe),C()),i&2){let n=me(2),e=l().ngIf,t=l();m(),at("top",(e==null||e.position==null?null:e.position.top)+t.offsetTop,"px")("left",(e==null||e.position==null?null:e.position.left)+t.offsetLeft,"px"),d("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),x("data-testid",t.componentId),m(2),d("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",pt(13,UFe))("cdkConnectedOverlayPositions",A(14,jFe,e==null?null:e.overlayPosition))}}function QFe(i,o){if(i&1&&(v(0),u(1,XFe,5,16,"ng-container",3),C()),i&2){let n=o.ngIf;m(),d("ngIf",n==null?null:n.position)}}var $pe=(()=>{let o=class o{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,r){this.loggingService=e,this.selectionService=t,this.elementRef=r,this._highlight=new qg,this.position=null,this.userIndicatorTypes=DC,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=Ee({userIndicatorPosition:kI.End,userIndicatorType:DC.Avatar,position:null,overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},selections:[]}),this.veltElement=!0,this.componentId="velt-selection-element";try{this.loggingService.log("%c[WB] Creating CLASS: SelectionElementPortalComponent","color: blue;");let a=this.selectionService.getUserIndicatorPosition(),s=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(c=>(c=T(E({},c),{userIndicatorPosition:a,userIndicatorType:s}),c)),this.setOverlayPosition(a)}catch(a){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",a)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","complementary"),e.setAttribute("aria-label","Selection portal")}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent setupA11yAttributes:",e)}}setSelections(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=E({},t),t.selections.push(e),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent addSelection: ",t)}}ngAfterViewInit(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: ngAfterViewInit","color: green;"),this.updateOverlayPosition()}catch(e){this.loggingService.catch("Error in ngAfterViewInit: ",e)}}setOverlayPosition(e){try{switch(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e){case"start":this.componentConfigSignal.update(t=>(t=T(E({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=T(E({},t),{overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"}}),t))}this.updateOverlayPosition()}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setOverlayPosition: ",t)}}updateOverlayPosition(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: updateOverlayPosition","color: green;"),this.selectionElementPortalOverlay&&this.selectionElementPortalOverlay?.overlayRef?.updatePosition()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent updateOverlayPosition: ",e)}}calculatePosition(){try{if(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: calculatePosition","color: green;"),this.highlight?.targetElement){let e=tI(this.highlight.targetElement);if(e){let t=e.iterateNext(),r,a=null,s=null;try{r=JSON.parse(t?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),s=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(p=>(p=T(E({},p),{userIndicatorPosition:a,userIndicatorType:s}),p))}catch{}let c;if(r?.horizontal&&(c=r.horizontal),a==="start"?c="top-start":c="top-right",t){let p=t.getBoundingClientRect();if(p&&p.width&&p.height)switch(c){case"left":this.position={top:p.height/2-16,left:-4};break;case"left-start":this.position={top:0,left:-4};break;case"top-start":this.position={top:-32,left:0};break;case"top-right":this.position={top:-32,left:p.width};break;case"bottom-left":this.position={top:p.height+4,left:0};break;case"bottom-right":this.position={top:p.height+4,left:p.width-32};break;case"center-left":this.position={top:p.height/2-16,left:-32};break;case"center-right":this.position={top:p.height/2-16,left:p.width+4};break;default:this.position={top:-32,left:p.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=T(E({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Xs),h(R))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,r){if(t&1&&it(VFe,5),t&2){let a;Xe(a=Qe())&&(r.selectionElementPortalOverlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{highlight:"highlight",offsetLeft:"offsetLeft",offsetTop:"offsetTop"},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["selectionElementPortalOverlay","cdkConnectedOverlay"],["defaultAvatarTypeTemplate",""],[4,"ngIf"],["cdkOverlayOrigin","","role","presentation",1,"selection-element-portal",3,"id"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions"],[4,"ngIf","ngIfElse"],["role","list",1,"velt-live-selection-element-user-name-container"],[4,"ngFor","ngForOf"],["class","velt-live-selection-element-user-name-plus","role","listitem",3,"--velt-selection-color",4,"ngIf"],["role","listitem",1,"velt-live-selection-element-user-name"],["role","listitem",1,"velt-live-selection-element-user-name-plus"],["class","photo-container","role","listitem",3,"--velt-selection-user-index","background-color",4,"ngIf"],[1,"photo-container","selection-user-avatar",3,"size","user"],["role","listitem",1,"photo-container"],[1,"s-selection-element-avatar-initial"]],template:function(t,r){t&1&&u(0,QFe,2,1,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[bt,X,cn,an,Qn,pe],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);position:absolute;top:0;left:0;box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert}.selection-element-portal[_ngcontent-%COMP%]{display:none;position:absolute;top:0;left:0;white-space:nowrap;z-index:1;font-size:var(--velt-font-size-xs)}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border-radius:50%;color:var(--velt-light-mode-white);border:2px solid var(--velt-selection-color);margin-left:-5px;z-index:calc(var(--velt-selection-user-index, 0) * -1)}.photo-container[_ngcontent-%COMP%] .s-selection-element-avatar-initial[_ngcontent-%COMP%]{color:var(--velt-light-mode-white)}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover} snippyly-user-avatar.selection-user-avatar .s-user-avatar-initial{font-size:var(--velt-font-size-md)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-xs);margin-top:5px}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);font-size:var(--velt-spacing-md);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name-plus[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-x);font-size:var(--velt-font-size-xs);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}"],changeDetection:0});let i=o;return i})();var BC=(i,o)=>{try{let n=eLe(i),e=[],t=[];return n.forEach(r=>{r?.parentElement?.closest(U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?r?.parentElement?.normalize():t.push(r)}),t.forEach(r=>{let a=tLe(r,o);a&&e.push(a)}),e}catch(n){return nt.catch("Error in highlighter highlightRange: ",n),[]}},eLe=i=>{try{if(i.collapsed)return[];let o=i.commonAncestorContainer;if(i.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(o=i.commonAncestorContainer.parentElement),!o)return[];let n=[],e=o.ownerDocument.createNodeIterator(o,NodeFilter.SHOW_TEXT),t,r=!1;for(;t=e.nextNode();)if(i.intersectsNode(t)){let a=t?.length;i.startContainer===t&&i.startOffset>0&&(t.splitText(i.startOffset),r=!0),i.endContainer===t&&i.endOffset<a&&t.splitText(i.endOffset),n.push(t)}return r&&n.shift(),n}catch(o){return nt.catch("Error in highlighter getTextNodesInRange: ",o),[]}},tLe=(i,o)=>{try{let n=document.createElement(o||U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return i.parentElement?.replaceChild(n,i),n.appendChild(i),n}catch(n){return nt.catch("Error in highlighter highlightNode: ",n),null}};var Xs=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D){this.afAuth=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.domService=c,this.componentFactoryResolver=p,this.injector=g,this.appRef=f,this.loggingService=I,this.commonDbService=D,this.documentPaths=null,this.textSelections={},this.enableSelections$=new ve(!1),this.userIndicatorEnabled$=new ve(!0),this.userIndicatorPosition$=new ve(kI.End),this.userIndicatorType$=new ve(DC.Avatar),this.defaultElementsTrackingEnabled$=new ve(!0),this.defaultStylingEnabled$=new ve(!0),this.elementSelections={},this.databaseService.getDb().pipe(Fe(N=>!!N),ot(1)).subscribe(N=>{N&&this.updateOnDocumentFocusChange()},N=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",N)}),this.docService.getDocumentPaths$().subscribe(N=>{this.documentPaths=N},N=>{this.loggingService.catch("Error in SelectionService getDocumentPaths subscription: ",N)}),this.domService.onDocumentClick$().subscribe(N=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&N?.target&&!window.getSelection()?.toString()){let G=this.getSelectionEnabledElement(N.target);if(G&&!Gi(G)){let z=this.domService.getXPath(G);if(z){let J=new qg;J.type="click",J.targetElement=z,this.setSelection(J)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",G)}},N=>{this.loggingService.catch("Error in SelectionService onDocumentClick$ subscription: ",N)}),this.domService.onDocumentFocus$().subscribe(N=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&N?.target){let G=this.getSelectionEnabledElement(N.target);if(G&&!Gi(G)){let z=this.domService.getXPath(G);if(z){let J=new qg;J.type="focus",J.targetElement=z,this.setSelection(J)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",G)}},N=>{this.loggingService.catch("Error in SelectionService onDocumentFocus$ subscription: ",N)}),this.domService.onWindowKeyupEsc$().subscribe(N=>{this.removeSelection()},N=>{this.loggingService.catch("Error in SelectionService onWindowKeyupEsc$ subscription: ",N)}),this.enableSelections$.pipe(fe(()=>this.isFeatureAllowed$({})),Fe(N=>N?.config&&N?.user)).subscribe(N=>{(!N?.featureAllowed||!this.enableSelections$.value)&&this.removeSelection()},N=>{this.loggingService.catch("Error in SelectionService enableSelections$ subscription: ",N)}),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&window.getSelection()?.toString()){let N=window.getSelection()?.getRangeAt(0);if(N.commonAncestorContainer&&!N?.collapsed){let G=kle([N]),z=new qg;z.type="selection",z.targetTextRange=G?.length?G[0]:null,this.setSelection(z)}}}catch(N){this.loggingService.catch("Error in SelectionService onSelectionChange$: ",N)}},N=>{this.loggingService.catch("Error in SelectionService onSelectionChange$ subscription: ",N)}),this.authService.getUser$().subscribe(N=>{this.user=N},N=>{this.loggingService.catch("Error in SelectionService getUser$ subscription: ",N)}),this.getSelectionsOnCurrentDocument().pipe(Ti()).subscribe(([N,G])=>{try{if(N){let z=[];Object.keys(N).forEach(J=>{let ce=N[J],ye=G?G[J]:null;!gi(ce,ye)&&J!==this.getUserIdHash(this.user)&&z.push(ce)}),z.forEach(J=>{if(J.targetElement){let ce=this.elementSelections[J?.targetElement]?.portalRef,Oe=(this.elementSelections[J?.targetElement]?.selections||[]).filter($e=>this.getUserIdHash($e.user)!==this.getUserIdHash(J?.user));Oe?.length?(ce.instance.setSelections(Oe.slice()),this.elementSelections[J?.targetElement].selections=Oe.slice(),this.highlightElement(Oe[0])):(this.removeHighlightFromElement(J),this.removeSelectionElement(J))}else J.targetTextRange&&this.removeHighlightFromText(J)})}if(G){let z=[];Object.keys(G).forEach(J=>{let ce=N?N[J]:null,ye=G[J];!gi(ce,ye)&&J!==this.getUserIdHash(this.user)&&z.push(ye)}),z.forEach(J=>{J.targetElement?(this.highlightElement(J),this.getUserIndicatorEnabled()&&this.setElementHighlight(J)):J.targetTextRange&&this.highlightText(J)})}}catch(z){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",z)}},N=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",N)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}isFeatureAllowed(){return eo(this.configService.getConfig(),this.authService.getUser(),Re.LIVE_SELECTION)}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.user&&document.visibilityState==="hidden"&&this.removeSelection()})}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}getSelectionsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getSelectionsOnCurrentDocument","color: green;"),ei(this.afAuth).pipe(Fe(e=>!!e),fe(e=>this.isFeatureAllowed$({firebaseUser:e})),fe(e=>e.featureAllowed?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(de(r=>(this.documentPaths=r,t)))),fe(t=>t?.user?t?.user?.isAnonymous?se(null):this.documentPaths?this.databaseService.getDb().pipe(Fe(r=>!!r),fe(r=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(a=>a?.data)):se(null))):se(null):se(null))):se(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>T(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>(this.user=r,T(E({},t),{user:r}))))),fe(t=>eo(t.config,t.user,Re.LIVE_SELECTION)?se(T(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),se(T(E({},t),{featureAllowed:!1})))),vt((t,r)=>t?.featureAllowed===r?.featureAllowed))}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in SelectionService setSelection: ",t)}}removeSelection(){try{this.user?.userId&&this.documentPaths?.selection&&this.commonDbService.deleteData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in SelectionService removeSelection: ",e)}}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=["input","textarea","select","button"],s;try{r?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(s=JSON.parse(r?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!s||s?.border)&&this.domService.highlightUserElement(r,e?.user?.color,e?.user?.name,this.getDefaultStylingEnabled())}}}catch(t){this.loggingService.catch("Error in SelectionService highlightElement: ",t)}}removeHighlightFromElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();r&&this.domService.removeHighlightUserFromElement(r)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=H0(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),r=new Range;try{r.setStart(t[0].textNode,t[0].startOffset||0),r.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(r.toString()===e.targetTextRange?.text){let a=BC(r,U.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),s=[],c=this.getSelectionUserMarker(e.user);if(a&&a.length&&(a.forEach(p=>{p?.textContent?.trim()&&(this.domService.addClassToElement(p,p.tagName?.toLowerCase()),this.domService.addClassToElement(p,U.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(p,U.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&p.style.setProperty(U.VELT_SELECTION_COLOR,e.user?.color+"55"),s.push({element:p,textNode:p.childNodes[0]}))}),c)){let p=a.filter(f=>f?.textContent?.trim()),g=p?.length?p[p?.length-1]:null;g&&g.parentNode.insertBefore(c,g.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:s,marker:c}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(r=>{r?.element&&r?.textNode&&r.element.replaceWith(r.textNode),r.textNode&&r.textNode.parentNode?.normalize()}),this.textSelections[t]?.marker&&this.textSelections[t]?.marker?.remove())}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromText: ",t)}}getSelectionUserMarker(e){try{let t=document.createElement("span");t.classList.add("snippyly-user-marker","active"),t.setAttribute("data-name",e?.name+""),t.style.setProperty("--velt-selection-marker-color",e?.color||"#000");let r=document.createElement("span");r.classList.add("snippyly-user-marker-line");let a=document.createElement("span");return a.classList.add("snippyly-user-marker-dot"),r.appendChild(a),t.appendChild(r),setTimeout(()=>{t?.classList?.remove("active")},1e3),t}catch(t){return this.loggingService.catch("Error in SelectionService getSelectionUserMarker: ",t),null}}signOutUser(e){return new Promise((t,r)=>{try{this.documentPaths?.selection&&e?this.commonDbService.getData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&this.commonDbService.deleteData({feature:"selection",errorCallback:s=>{r(s)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(a=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",a),r(a)}):t(null)}catch(a){this.loggingService.catch("Error in SelectionService signOutUser:",a),r(a)}})}enableSelections(e){try{this.enableSelections$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService enableSelections: ",t)}}enableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!0)return;this.userIndicatorEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableUserIndicator: ",e)}}disableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!1)return;this.userIndicatorEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableUserIndicator: ",e)}}getUserIndicatorEnabled$(){return this.userIndicatorEnabled$.asObservable()}getUserIndicatorEnabled(){return this.userIndicatorEnabled$.value}setUserIndicatorPosition(e){try{this.userIndicatorPosition$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorPosition: ",t)}}getUserIndicatorPosition$(){return this.userIndicatorPosition$.asObservable()}getUserIndicatorPosition(){return this.userIndicatorPosition$.value}setUserIndicatorType(e){try{this.userIndicatorType$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorType: ",t)}}getUserIndicatorType$(){return this.userIndicatorType$.asObservable()}getUserIndicatorType(){return this.userIndicatorType$.value}enableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!0)return;this.defaultElementsTrackingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultElementsTracking: ",e)}}disableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!1)return;this.defaultElementsTrackingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultElementsTracking: ",e)}}getDefaultElementsTrackingEnabled$(){return this.defaultElementsTrackingEnabled$.asObservable()}getDefaultElementsTrackingEnabled(){return this.defaultElementsTrackingEnabled$.value}enableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!0)return;this.defaultStylingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultStyling: ",e)}}disableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!1)return;this.defaultStylingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultStyling: ",e)}}getDefaultStylingEnabled$(){return this.defaultStylingEnabled$.asObservable()}getDefaultStylingEnabled(){return this.defaultStylingEnabled$.value}getSelectionEnabledElement(e){try{let t=this.getDefaultElementsTrackingEnabled();return t&&U.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:KH(e,t)}catch(t){return this.loggingService.catch("Error in SelectionService isElementAllowed: ",t),null}}setElementHighlight(e){try{if(!this.elementSelections[e.targetElement])this.setSelectionElement(e);else{let t=this.elementSelections[e.targetElement].portalRef;this.elementSelections[e.targetElement].selections?.find(a=>this.getUserIdHash(a.user)===this.getUserIdHash(e?.user))||(t.instance.addSelection(e),this.elementSelections[e.targetElement].selections.push(e))}}catch(t){this.loggingService.catch("Error in SelectionService setElementSelection: ",t)}}setSelectionElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=this.domService.getHostElement(r),s=new rr($pe),c=new ar(a,this.appRef,this.injector),p=c.attach(s);p.instance.highlight=e,p.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:c,selectionElementPortal:s,portalRef:p,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:r,selectionHostElement:a,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:r,selectionHostElement:a}=this.elementSelections[e.targetElement],s=this.domService.getElementOffset(r,a);t.instance.offsetLeft=s.offsetLeft,t.instance.offsetTop=s.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(r=>r.targetElement);Object.keys(this.elementSelections).forEach(r=>{if(!t.includes(r)){let a=this.elementSelections[r];a&&(a.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(a.selectionHostElement)),delete this.elementSelections[r]}})}catch(t){this.loggingService.catch("Error in SelectionService checkElementHighlightsToRemove: ",t)}}removeSelectionElement(e){try{let t=this.elementSelections[e.targetElement];t&&(t.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(t.selectionHostElement)),delete this.elementSelections[e.targetElement]}catch(t){this.loggingService.catch("Error in SelectionService removeSelectionElement: ",t)}}getUserIdHash(e){try{return e?.userId?Et(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}};o.\u0275fac=function(t){return new(t||o)(ee(Ai),ee(Ue),ee(Rt),ee(bn),ee(rt),ee(Le),ee(Ao),ee(Ct),ee(ni),ee(y),ee(gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var jR=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: SelectionElement","color: blue;"),this.enableLiveSelection=this._enableLiveSelection,this.disableLiveSelection=this._disableLiveSelection,this.enableUserIndicator=this._enableUserIndicator,this.disableUserIndicator=this._disableUserIndicator,this.setUserIndicatorPosition=this._setUserIndicatorPosition,this.setUserIndicatorType=this._setUserIndicatorType,this.enableDefaultElementsTracking=this._enableDefaultElementsTracking,this.disableDefaultElementsTracking=this._disableDefaultElementsTracking,this.enableDefaultStyling=this._enableDefaultStyling,this.disableDefaultStyling=this._disableDefaultStyling,this.getLiveSelectionData=this._getLiveSelectionData}_enableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(Xs).enableSelections(!0)}catch(o){this.getService(y).catch("Error in enableLiveSelection: ",o)}}_disableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(Xs).enableSelections(!1)}catch(o){this.getService(y).catch("Error in disableLiveSelection: ",o)}}_enableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(Xs).enableUserIndicator()}catch(o){this.getService(y).catch("Error in _enableUserIndicator: ",o)}}_disableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(Xs).disableUserIndicator()}catch(o){this.getService(y).catch("Error in _disableUserIndicator: ",o)}}_setUserIndicatorPosition(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(Z.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(Xs).setUserIndicatorPosition(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorPosition: ",n)}}_setUserIndicatorType(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(Z.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(Xs).setUserIndicatorType(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorType: ",n)}}_enableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Xs).enableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _enableDefaultElementsTracking: ",o)}}_disableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Xs).disableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _disableDefaultElementsTracking: ",o)}}_enableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Xs).enableDefaultStyling()}catch(o){this.getService(y).catch("Error in _enableDefaultStyling: ",o)}}_disableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Xs).disableDefaultStyling()}catch(o){this.getService(y).catch("Error in _disableDefaultStyling: ",o)}}_getLiveSelectionData(){this.getService(y).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(Z.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(Xs).getSelectionsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getLiveSelectionData: ",o),se(null)}}};var os=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D,N,G,z,J){this.analyticsService=e,this.configService=t,this.docService=r,this.databaseService=a,this.authService=s,this.domService=c,this.afAuth=p,this.iamService=g,this.avatarService=f,this.contactService=I,this.storageService=D,this.dialog=N,this.loggingService=G,this.notificationService=z,this.commonDbService=J,this.tagAnnotations$=new ve({}),this.tagAnnotationsByDocumentId$=new ve({}),this.documentPaths=null,this.allowedElementIds$=new ve([]),this.addTagMode$=new ve(!1),this.enableTextTags$=new ve(!1),this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.databaseService.getDb().pipe(Fe(ce=>!!ce),ot(1)).subscribe(ce=>{ce&&this.getDocumentPaths()},ce=>{this.loggingService.catch("Error in TagService getDb subscription: ",ce)}),this.domService.onWindowPointerMove$().subscribe(ce=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let ye=this.domService.getBackgroundElement(ce.clientX,ce.clientY);ye&&(this.isElementInsideAllowedElements(ye)?bk(ce.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=ye,this.domService.highlightElement(this.hightlightElement,U.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ce=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",ce)}),this.domService.onWindowKeyupEsc$().subscribe(ce=>{this.addTagMode$.value&&this.disableAddTagMode()},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",ce)}),this.domService.onDocumentClick$().subscribe(ce=>{if(ce&&this.addTagMode$.value){if(ce.preventDefault(),ce.stopPropagation(),!bk(ce.target)){let ye=this.domService.getBackgroundElement(ce.clientX,ce.clientY);ye&&this.isElementInsideAllowedElements(ye)&&this.addTag(ce)}this.disableAddTagMode()}},ce=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",ce)}),this.addTagMode$.subscribe(ce=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),ce?this.domService.addClassToElement(document.body,"snippyly-add-tag-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-tag-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ce=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",ce)}),this.domService.onWindowKeyupBackspace$().subscribe(ce=>{this.deleteTagPinAnnotations("keyupBackspace")},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",ce)}),this.domService.onWindowKeyupDelete$().subscribe(ce=>{this.deleteTagPinAnnotations("keyupDelete")},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ce)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ce=>{ce?.length&&(ce?.filter(Oe=>Oe.type==="tag")).forEach(Oe=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(Oe)}))},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ce)})}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){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let a,s;try{if(e&&(s=Rn(e)),t&&typeof t=="object"){let c=tr(t);a=Rn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",c)}return ei(this.afAuth).pipe(Fe(c=>!!c),fe(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),fe(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(de(p=>(c.featureAllowed=p,c))):se(c)),fe(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(de(p=>(c.featureAllowed=!p,c))):se(c)),fe(c=>c.featureAllowed?se(c).pipe(fe(p=>this.docService.getDocumentPaths$().pipe(de(g=>(this.documentPaths=g,p.documentPaths=g,p)))),fe(p=>this.getDataFromDocumentId(s).pipe(de(g=>(p.annotations=g||[],E({},p))))),fe(p=>this.docService.getLocation$().pipe(de(g=>(p.location=g,p)))),fe(p=>this.docService.getLocations$().pipe(de(g=>(p.customLocations=g,p)))),de(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let g=[];return a?g.push(a):(g.push(p?.location?.locationId),g.push(...Object.values(p?.customLocations||[]).map(f=>f.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,g),p}}),fe(p=>r?se(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(de(()=>p)):se(p)),fe(p=>r?se(p):p?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(de(()=>p)):se(p)),de(p=>(p?.filteredAnnotations?.forEach(g=>{this.calculateTagAnnotationPosition(g)}),p)),fe(p=>p?.filteredAnnotations?se(p?.filteredAnnotations||[]):se([]))):se([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>T(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>T(E({},t),{user:r})))),fe(t=>eo(t.config,t.user,Re.TAG)?se(T(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),se(T(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(t=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),de(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),this.setTagAnnotationsByDocumentId(e||this.documentPaths?.documentId,a),a})):se([])))}setTagAnnotationsByDocumentId(e,t){try{e&&this.tagAnnotationsByDocumentId$.next(T(E({},this.tagAnnotationsByDocumentId$.value),{[e]:t}))}catch(r){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",r)}}filterAnnotationsByLocationIds(e,t){try{return e.filter(r=>t.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",r),[]}}calculateTagAnnotationPosition(e){try{if(e.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let r=t.iterateNext();if(r&&Di(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:c}=kg(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(t){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",t)}}filterPinAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let a=e?Object.values(e):[];a.forEach((c,p)=>{c?.annotationId&&(c.annotationIndex=p+1)});let s=[];if(t)r?s=a.filter(c=>c.locationId===r):s=a.slice();else{let c=this.docService.getLocation();c&&c.locationId?s=a.filter(p=>p.locationId===c.locationId):s=a.filter(p=>!p.locationId)}return s}catch(a){return this.loggingService.catch("Error in TagService filterPinAnnotations:",a),[]}}addTag(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let r=this.authService.getUser();if(r)if(r.isReadOnly||r.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let a=new NI;a.from=r,a.color=U.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:c}=this.domService.getTopLeftPosition();a.positionX=s,a.positionY=c;let p=this.domService.getCurrentWindowSizeValue();if(a.screenWidth=p.screenWidth,a.screenHeight=p.screenHeight,a.screenScrollHeight=p.screenScrollHeight,a.taggedElementPath="",e&&(a.targetElement=this.domService.getTargetElementForCursorPosition(e)),t&&(a.targetTextRange=t),a?.targetElement?.xpath){let g=this.domService.getXPath(a.targetElement.xpath);if(g){let f=g.iterateNext();f&&(Di(f)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=Mi(),a.pageInfo&&(a.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(a)}}catch(r){this.loggingService.catch("Error in TagService addTag: ",r)}}setLocationToTagAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let r;e.targetElement?.xpath?r=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetTextRange?.commonAncestorContainer&&(r=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation({location:a,source:"internal"});s?.[0]&&(e.locationId=s[0].locationId,e.location=s[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",t)}}saveTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(r=>{if(this.documentPaths?.tag){e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.tagUrl=this.generateTagUrl(e));let a=JSON.parse(JSON.stringify(e));return a.position=null,this.domService.toggleAnnotationSelection(a),e.targetTextRange&&sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(Z.Events.Tag.TAG_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService saveTagToDb: ",t)}}updateTag(e,t=!1,r){try{r&&this.setLocationToTagAnnotation(e),t&&this.updateNotificationsDatabase(e,eI.UPDATED),this.updateTagToDb(e)}catch(a){this.loggingService.catch("Error in TagService updateTag: ",a)}}resolveTag(e){try{e.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,eI.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(Z.Events.Tag.TAG_RESOLVED,{annotationId:e.annotationId})}catch(t){this.loggingService.catch("Error in TagService resolveTag: ",t)}}updateTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(e?.targetElement?.xpath){let t=this.domService.getXPath(e.targetElement.xpath);if(t){let r=t.iterateNext();r&&(Di(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(r=>{if(this.documentPaths?.tag&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService updateTagToDb: ",t)}}deleteTagPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),r=this.authService.getUser(),a=[];Object.keys(t).forEach(s=>Q(this,null,function*(){let c=t[s];c.type==="tag"&&r&&c.from&&(r?.isAdmin||c.from.userId===r.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Z.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(Ma,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(ot(1)).subscribe(s=>{s&&(a.forEach(c=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${U.SNIPPYLY_HIGHLIGHT}]`).forEach(p=>{this.domService.removeHighlightFromElement(p)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(t){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",t)}}deleteTagPinAnnotation(e){return this.authService.isFeatureAllowed(Re.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,eI.DELETED),this.analyticsService.trackEvent(Z.Events.Tag.TAG_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(Re.TAG)?(this.analyticsService.trackEvent(Z.Events.Tag.TAG_ADD_MODE_ENABLED),this.addTagMode$.next(!0)):this.loggingService.catch("Error in TagService enableAddTagMode: ","Tag feature is not enabled.")}disableAddTagMode(){this.analyticsService.trackEvent(Z.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(e){this.enableTextTags$.next(e)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",t),!1}}attachTag(e,t=[]){let r=ua(e,t);if(r){let a=this.domService.getXPath(r),s=this.getTagPinAnnotationObject();s&&(s.targetElement={xpath:a,topPercentage:50,leftPercentage:90},this.saveTagToDb(s))}}getTagPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let t=new NI;t.from=e,t.color=U.DEFAULT_ANNOTATION_COLOR,t.resolved=!1,t.lastUpdated=this.timestamp;let{topPositionX:r,topPositionY:a}=this.domService.getTopLeftPosition();t.positionX=r,t.positionY=a;let s=this.domService.getCurrentWindowSizeValue();t.screenWidth=s.screenWidth,t.screenHeight=s.screenHeight,t.screenScrollHeight=s.screenScrollHeight,t.taggedElementPath="";let c=this.docService.getLocation();return c&&(t.locationId=c.locationId,t.location=c.location),t}return null}updateNotificationsDatabase(e,t){try{let r={annotationData:e,actionType:t,notificationSource:"tag"};this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",r)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getTagUrl(e){try{return e?.pageInfo?.tagUrl?e.pageInfo.tagUrl:(e?.pageInfo||(e.pageInfo=Mi(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.tagUrl=this.generateTagUrl(e),this.updateTag(e),e.pageInfo?.tagUrl)}catch(t){this.loggingService.catch("Error in TagService getTagUrl: ",t);return}}uploadFile(e,t){let r=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(r=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`),this.storageService.uploadFile({path:r,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateTagUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(U.URL_PARAMS.TAG_ID),t.searchParams.append(U.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Rt),ee(rt),ee(bn),ee(Ue),ee(Le),ee(Ai),ee(In),ee(dm),ee(yi),ee(Xg),ee(ao),ee(y),ee(vn),ee(gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var $R=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: TagElement","color: blue;"),this.getAllTagAnnotations=this._getAllTagAnnotations,this.deleteTag=this._deleteTag,this.allowedElementIds=this._allowedElementIds,this.attachTag=this._attachTag,this.addTagModeChange=this._addTagModeChange}_getAllTagAnnotations(o,n){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Z.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:n}}),this.getService(os).getAllTagAnnotations(o,n)}catch(e){return this.getService(y).catch("Error in _getLiveTagsOnCurrentDocument: ",e),se(null)}}_deleteTag(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(Z.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(os).deleteTagPinAnnotations("tagElement")}catch(o){this.getService(y).catch("Error in _deleteTag: ",o)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Z.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(os).setAllowedElementIds(o)}catch(n){this.getService(y).catch("Error in allowedElementIds: ",n)}}_attachTag(o){this.getService(y).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(Z.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(os).attachTag(o,["id","data-id"])}catch(n){this.getService(y).catch("Error in _attachTag: ",n)}}_addTagModeChange(){this.getService(y).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(Z.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(os).addTagModeChange()}catch(o){return this.getService(y).catch("Error in _addTagModeChange: ",o),se(!1)}}};var HR=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.getUniqueViewsByUser=this._getUniqueViewsByUser,this.getUniqueViewsByDate=this._getUniqueViewsByDate}_getUniqueViewsByUser(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByUser","color: green;");try{return this.trackEvent(Z.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(xs).getUniqueViewsByUser(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByUser: ",n),se({})}}_getUniqueViewsByDate(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByDate","color: green;");try{return this.trackEvent(Z.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(xs).getUniqueViewsByDate(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByDate: ",n),se({})}}};var qI=(()=>{let o=class o{constructor(e,t){this.docService=e,this.loggingService=t}updateDocuments(e){return Q(this,null,function*(){try{return yield this.docService.updateDocuments(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateDocuments: ",t),null}})}updateLocations(e){return Q(this,null,function*(){try{return yield this.docService.updateLocations(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateLocations: ",t),null}})}fetchDocuments(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchDocuments(e),r=[];return t.forEach(a=>{let s=a?.docIamConfig??{},c=a?.metadata??{};c.disabled=!!s?.disabled,c.id=c?.clientDocumentId,c.documentId=c?.clientDocumentId,delete c?.clientDocumentId,c.organizationId=c?.clientOrganizationId,delete c?.clientOrganizationId,delete c?.pageInfo,delete c?.veltFolderId,r.push(c)}),{data:r.reduce((a,s)=>(s?.documentId&&(a[s.documentId]=s),a),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchDocuments: ",t),{data:null}}})}fetchFolders(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchFolders(e),r=t?.parentFolders?.map(s=>{let c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E({},c)});return{data:(t?.data?.map(s=>{let c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E(E({},c),e?.folderId?{subFolders:r}:{})})).reduce((s,c)=>(c?.folderId&&(s[c.folderId]=c),s),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var zR=(()=>{let o=class o{constructor(e,t,r,a,s){this.authService=e,this.coreActionsService=t,this.docService=r,this.iamService=a,this.loggingService=s,this.veltInitState$=new ve(void 0);try{this.loggingService.log("%c[WB] Creating CLASS: VeltService","color: blue;");let c=this.authService.getUser$(),p=this.docService.getDocumentPaths$(),g=this.iamService.isUserAllowed$();dn([c,p,g]).subscribe(([f,I,D])=>{f&&I&&D?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(f=>{this.coreActionsService.triggerAction(Un.DOCUMENT_INIT,f)})}catch(c){this.loggingService.catch("Error in VeltService constructor: ",c)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(vt())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),se(void 0)}}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(ns),ee(rt),ee(In),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var GR=class{constructor(o){this.injector=o,this.initConfig=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: initConfig","color: green;");try{n?typeof n!="string"?this.getService(y).catch("Error in initConfig: ","Apikey must be string."):n?.trim()?this.getService(Ue).setApiKey(n?.trim(),e):this.getService(y).catch("Error in initConfig: ","Apikey is not provided."):this.getService(y).catch("Error in initConfig: ","Apikey is not provided.")}catch(t){this.getService(y).catch("Error in initConfig: ",t)}},this.identify=(n,e,t)=>(this.getService(y).log("%c[WB] Calling FUNCTION: identify","color: green;"),new Promise((r,a)=>{try{typeof n=="object"&&(n=JSON.parse(JSON.stringify(n)));let s=this.getService(Rt).getApiKey(),c=G0(s,n.userId);if(t?.ha||this.getService(et).trackEvent(Z.Events.Core.IDENTIFY,{apiKey:s,clientUserId:n.userId,snippylyUserId:c,forceReset:e?.forceReset,user:this.getService(Ue).getUserWithoutContacts(n),source:"client",fromProvider:t?.fromProvider},!0,c,n?.userId),!(n&&n.userId))this.getService(y).catch("Error in identify: ","Missing userId in config data."),r(null);else if(typeof n.userId!="string")this.getService(y).catch("Error in identify: ","userId must be string."),r(null);else if(n?.groupId&&typeof n?.groupId!="string")this.getService(y).catch("Error in identify: ","groupId must be string."),r(null);else{if(n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let g=n.groupId;n.clientGroupId=g,n.groupId=Et(g)}if(n?.organizationId){let g=n.organizationId;n.clientOrganizationId=g,n.organizationId=Et(g)}delete n.isAdmin;let p=U.REGEX_URL_FOR_USER_NAME;n?.name&&p.test(n?.name)&&(n.name=n.name?.split(".")?.slice(0,-1)?.join(".")),n.clientUserName=n.name,n?.name&&n?.name?.length>30&&(n.name=n.name.slice(0,30)),this.getService(Ue).initializeClient(n,e||{},new Date().getTime(),void 0,"external").then(g=>{let f;try{g&&(f=JSON.parse(JSON.stringify(g)))}catch{}r(f)}).catch(g=>{this.getService(y).catch("Error in identify: ",g),r(null)})}}catch(s){this.getService(y).catch("Error in identify: ",s),r(null)}})),this.updateUser=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{if(this.getService(y).catch("DEPRECATED: ","'updateUser' method is deprecated."),n&&typeof n=="object"){if(n=JSON.parse(JSON.stringify(n)),n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let e=n.groupId;n.clientGroupId=e,n.groupId=Et(e)}delete n.isAdmin,this.getService(Ue).updateUser(n)}else this.getService(y).catch("Error in updateUser: ","Invalid user object provided.")}catch(e){this.getService(y).catch("Error in updateUser: ",e)}},this.signOutUser=n=>(this.getService(y).log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),n?.ha||this.trackEvent(Z.Events.Core.SIGN_OUT_USER_TRIGGERED),new Promise((e,t)=>Q(this,null,function*(){try{yield this.getService(Ue).signOutUser("external"),e(null)}catch(r){this.getService(y).catch("Error in signOutUser: ",r),e(null)}}))),this.setDocument=(n,e,t,r)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocument","color: green;");try{r?.ha||this.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,documentMetadata:e,methodName:"setDocument",source:"external"}}),n&&n.trim()?(e&&(typeof e=="object"?e=JSON.parse(JSON.stringify(e)):this.getService(y).catch("Error in setDocument: ","Invalid documentMetadata provided.")),yield this.getService(rt).setDocument({documentId:n,documentMetadata:e,options:t,source:"external"})):this.getService(y).catch("Error in setDocument: ","Invalid document id provided.")}catch(a){this.getService(y).catch("Error in setDocument: ",a)}}),this.setDocumentId=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocumentId","color: green;");try{if(t?.ha||this.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,organizationId:e,methodName:"setDocumentId",source:"external"}}),n&&n.trim())return yield this.getService(rt).setDocumentId({documentId:n,clientOrganizationId:e,source:"external"});this.getService(y).catch("Error in setDocumentId: ","Invalid document id provided.")}catch(r){this.getService(y).catch("Error in setDocumentId: ",r)}}),this.setDocuments=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocuments","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:n,options:e,methodName:"setDocuments",source:"external"}}),typeof n=="object"&&n instanceof Array?(n=JSON.parse(JSON.stringify(n)),n=n.filter(r=>typeof r=="object"&&r!==null&&r.id?.trim()),n.length?yield this.getService(rt).setDocuments({documents:n,options:e,source:"external"}):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")}catch(r){this.getService(y).catch("Error in setDocuments: ",r)}}),this.setRootDocument=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootDocument","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,{payload:{document:n,methodName:"setRootDocument",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(rt).setRootDocument({document:n,source:"external"}):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")}catch(t){this.getService(y).catch("Error in setRootDocument: ",t)}}),this.unsetDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{n?.ha||this.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(rt).unsetDocumentId({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocumentId: ",e)}},this.unsetDocuments=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{n?.ha||this.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(rt).unsetDocuments({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocuments: ",e)}},this.fetchDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchDocuments","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:n}}),this.getService(qI).fetchDocuments(n)}catch(t){return this.getService(y).catch("Error in fetchDocuments: ",t),Promise.resolve({data:null})}},this.updateDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateDocuments","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:n}}),this.getService(qI).updateDocuments(n)}catch(t){return this.getService(y).catch("Error in updateDocuments: ",t),Promise.resolve({data:null})}},this.updateLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateLocations","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:n}}),this.getService(qI).updateLocations(n)}catch(t){return this.getService(y).catch("Error in updateLocations: ",t),Promise.resolve({data:null})}},this.fetchFolders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchFolders","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:n}}),this.getService(qI).fetchFolders(n)}catch(t){return this.getService(y).catch("Error in fetchFolders: ",t),Promise.resolve({data:null})}},this.setUserDataProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setUserDataProvider","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(Fn).setUserDataProvider(n)}catch(t){this.getService(y).catch("Error in setUserDataProvider: ",t)}},this.setDataProviders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setDataProviders","color: green;");try{if(e?.ha||this.trackEvent(Z.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),n.comment&&this.getService(Ks).setCommentAnnotationDataProvider(n.comment),n.user&&this.getService(Fn).setUserDataProvider(n.user),n.reaction&&this.getService(pm).setReactionAnnotationDataProvider(n.reaction),n.attachment)if(n.comment)this.getService(Kg).setAttachmentDataProvider(n.attachment);else throw new Error("Comment data provider is required for attachment data provider")}catch(t){this.getService(y).catch("Error in setDataProviders: ",t)}},this.setPermissionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setPermissionProvider","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_PERMISSION_PROVIDER_TRIGGERED),this.getService(bs).setPermissionProvider(n)}catch(t){this.getService(y).catch("Error in setPermissionProvider: ",t)}},this.setEncryptionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_ENCRYPTION_PROVIDER_TRIGGERED),this.getService(Rt).setEncryptionProvider(n)}catch(t){this.getService(y).catch("Error in setEncryptionProvider: ",t)}},this.setVeltAuthProvider=n=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{return yield this.getService(Ue).setVeltAuthProvider(n)}catch(e){return this.getService(y).catch("Error in setVeltAuthProvider: ",e),null}}),this.getDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocumentId","color: green;");try{return n?.ha||this.trackEvent(Z.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(rt).getDocumentId()}catch(e){this.getService(y).catch("Error in getDocumentId: ",e)}},this.setLocation=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocation","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,appendLocation:e,methodName:"setLocation",source:"external"}}),n&&typeof n=="object"?e?this.getService(rt).addLocation({location:n,source:"external"}):yield this.getService(rt).setLocation({location:n,source:"external"}):this.getService(y).catch("Error in setLocation: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocation: ",r)}}),this.setRootLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootLocation","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:n,methodName:"setRootLocation",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(rt).setRootLocation({location:n,source:"external"}):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")}catch(t){this.getService(y).catch("Error in setRootLocation: ",t)}}),this.setLocations=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocations","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:n,options:e,methodName:"setLocations",source:"external"}}),n&&Array.isArray(n)?yield this.getService(rt).setLocations({locations:n,options:e,source:"external"}):this.getService(y).catch("Error in setLocations: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocations: ",r)}}),this.addLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addLocation","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,methodName:"addLocation",source:"external"}}),n&&typeof n=="object"?this.getService(rt).addLocation({location:n,source:"external"}):this.getService(y).catch("Error in addLocation: ","Invalid location params provided.")}catch(t){this.getService(y).catch("Error in addLocation: ",t)}}),this.setScrollableElementsIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setScrollableElementsIds","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:n}}),n?this.getService(Le).setScrollableElementsIds(n):this.getService(y).catch("Error in setScrollableElementsIds: ","Invalid ids provided.")}catch(t){this.getService(y).catch("Error in setScrollableElementsIds: ",t)}},this.removeLocation=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocation","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:n},methodName:"removeLocation",source:"external"}),this.getService(rt).removeLocation({location:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocation: ",t)}},this.removeLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocations","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:n},methodName:"removeLocations",source:"external"}),this.getService(rt).removeLocations({locations:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocations: ",t)}},this.unsetLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:n},methodName:"unsetLocationIds",source:"external"}),this.getService(rt).unsetLocationIds(n,"external")}catch(t){this.getService(y).catch("Error in unsetLocationIds: ",t)}},this.excludeLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: excludeLocationIds","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:n}}),typeof n=="object"&&n instanceof Array&&(n=n.filter(t=>typeof t=="string"),this.getService(rt).excludeLocationIds(n))}catch(t){this.getService(y).catch("Error in excludeLocationIds: ",t)}},this.updateContactList=(n,e,t)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateContactList","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:n,config:e}}),typeof n=="object"&&n instanceof Array&&(!e||e&&typeof e=="object")&&(n=JSON.parse(JSON.stringify(n)),this.getService(yi).updateContactList(n,e))}catch(r){this.getService(y).catch("Error in updateContactList: ",r)}},this.removeScrollableElementsIds=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeScrollableElementsIds","color: green;");try{n?.ha||this.trackEvent(Z.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Le).removeScrollableElementsIds()}catch(e){this.getService(y).catch("Error in removeScrollableElementsIds: ",e)}},this.getPresenceElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getPresenceElement","color: green;");try{let e=new FR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getPresenceElement: ",e),null}},this.getCursorElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCursorElement","color: green;");try{let e=new wR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCursorElement: ",e),null}},this.getCommentElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCommentElement","color: green;");try{let e=new SR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCommentElement: ",e),null}},this.getTagElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getTagElement","color: green;");try{let e=new $R(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getTagElement: ",e),null}},this.getSelectionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getSelectionElement","color: green;");try{let e=new jR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getSelectionElement: ",e),null}},this.getRecorderElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRecorderElement","color: green;");try{let e=new BR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRecorderElement: ",e),null}},this.getContactElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getContactElement","color: green;");try{let e=new bR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getContactElement: ",e),null}},this.getRewriterElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRewriterElement","color: green;");try{let e=new UR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRewriterElement: ",e),null}},this.getHuddleElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getHuddleElement","color: green;");try{let e=new AR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getHuddleElement: ",e),null}},this.getLiveStateSyncElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getLiveStateSyncElement","color: green;");try{let e=new kR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getLiveStateSyncElement: ",e),null}},this.getArrowElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getArrowElement","color: green;");try{let e=new vR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getArrowElement: ",e),null}},this.getViewsElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getViewsElement","color: green;");try{let e=new HR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getViewsElement: ",e),null}},this.getNotificationElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getNotificationElement","color: green;");try{let e=new NR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getNotificationElement: ",e),null}},this.getAutocompleteElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAutocompleteElement","color: green;");try{let e=new _R(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAutocompleteElement: ",e),null}},this.getDocElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocElement","color: green;");try{let e=new OR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getDocElement: ",e),null}},this.getAreaElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAreaElement","color: green;");try{let e=new hR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAreaElement: ",e),null}},this.getReactionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getReactionElement","color: green;");try{let e=new LR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getReactionElement: ",e),null}},this.getCrdtElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCrdtElement","color: green;");try{let e=new IR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCrdtElement: ",e),null}},this.getMetadata=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(Z.Events.Core.GET_METADATA_TRIGGERED),this.getService(Zs).getGlobalMetadata()}catch(e){return this.getService(y).catch("Error in getMetadata: ",e),null}}),this.fetchDebugInfo=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(Z.Events.Core.FETCH_DEBUG_INFO_TRIGGERED),this.getService(Zs).getDebugInfo()}catch(e){return this.getService(y).catch("Error in fetchDebugInfo: ",e),null}}),this.getDebugInfo=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_DEBUG_INFO_TRIGGERED),this.getService(Zs).getDebugInfo$()}catch(e){return this.getService(y).catch("Error in getDebugInfo: ",e),se(null)}},this.disableFeatures=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:n}}),this.getService(Rt).disableFeatures(n)}catch(t){this.getService(y).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:n}}),this.getService(Ye).setDarkMode(n)}catch(t){this.getService(y).catch("Error in setDarkMode: ",t)}},this.enableLogs=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Rt).enableLogs()}catch(e){this.getService(y).catch("Error in enableLogs: ",e)}},this.disableLogs=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Rt).disableLogs(n)}catch(t){this.getService(y).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(In).isUserAllowed$()}catch(e){return this.getService(y).catch("Error in isUserAllowed$: ",e),se(!1)}},this.getUser=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.GET_USER_TRIGGERED);let e=this.getService(Ue).getUser();if(e&&typeof e=="object"){let t=JSON.parse(JSON.stringify(e));return t?.clientOrganizationId&&(t.organizationId=t.clientOrganizationId,delete t.clientOrganizationId),t?.clientGroupId&&(t.groupId=t.clientGroupId,delete t.clientGroupId),delete t.userSnippylyId,t}else return null}catch(e){return this.getService(y).catch("Error in getUser: ",e),null}},this.getCurrentUser=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_CURRENT_USER_TRIGGERED),this.getService(Ue).getUser$().pipe(de(e=>Er(e)))}catch(e){return this.getService(y).catch("Error in getCurrentUser: ",e),se(null)}},this.getHeartbeat=(n,e)=>{try{return e?.ha||this.trackEvent(Z.Events.Core.GET_HEARTBEAT_TRIGGERED),this.getService(MR).getHeartbeat(n)}catch(t){return this.getService(y).catch("Error in getHeartbeat: ",t),se({data:null})}},this.getUserRole$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(In).getRole$()}catch(e){return this.getService(y).catch("Error in getUserRole$: ",e),se("")}},this.getUserPermissions=(n,e)=>Q(this,null,function*(){try{return e?.ha||this.trackEvent(Z.Events.Core.GET_USER_PERMISSIONS_TRIGGERED,{payload:{request:n,source:"external"}}),this.getService(bs).getUserPermissions(n)}catch(t){return this.getService(y).catch("Error in getUserPermissions$: ",t),{}}}),this.getFeaturesAccessLevelIam$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(In).getFeaturesAccessLevel$()}catch(e){return this.getService(y).catch("Error in getFeaturesAccessLevel$: ",e),se(void 0)}},this.isPlanExpired$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.IS_PLAN_EXPIRED_TRIGGERED),this.getService(Ue).isPlanExpired$()}catch(e){return this.getService(y).catch("Error in isPlanExpired$: ",e),se(!1)}},this.getCustomerMetadata$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(rt).getCustomerMetadata$()}catch(e){return this.getService(y).catch("Error in getCustomerMetadata$: ",e),se(null)}},this.getDocumentMetadata=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(rt).getDocumentMetadata$()}catch(e){return this.getService(y).catch("Error in getDocumentMetadata: ",e),se(null)}},this.getVeltInitState=n=>{try{return n?.ha,this.getService(zR).getVeltInitState$()}catch(e){return this.getService(y).catch("Error in getVeltInitState: ",e),se(void 0)}},this.removeVeltContent=(n,e)=>{try{return e?.ha||this.trackEvent(Z.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Le).removeSnippylyContent(n)}catch(t){return this.getService(y).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(y).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Le).setCustomCss(n)}catch(t){this.getService(y).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:n}}),this.getService(Ml).setLanguage(n)}catch(t){this.getService(y).catch("Error in setLanguage: ",t)}},this.setTranslations=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:n}}),this.getService(Ml).setTranslations(n)}catch(t){this.getService(y).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ml).enableAutoTranslation()}catch(e){this.getService(y).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ml).disableAutoTranslation()}catch(e){this.getService(y).catch("Error in disableAutoTranslation: ",e)}},this.sf=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SF_TRIGGERED,{payload:{value:n}}),n?(document.querySelector(U.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(U.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Rt).setSF(n):this.getService(Rt).setSF(n)}catch(t){this.getService(y).catch("Error in sf: ",t)}},this.st=(n,e)=>{try{e?.ha,this.getService(Rt).setSdkType(n)}catch(t){this.getService(y).catch("Error in st: ",t)}},this.getService=n=>this.injector.get(n),this.on=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return e?.ha,this.getService(ns).onAction(n)}catch(t){return this.getService(y).catch("Error in on: ",t),se(null)}},this.setUiState=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:n}}),this.getService(rt).setUIState(n)}catch(t){this.getService(y).catch("Error in setUiState: ",t)}},this.getUiState=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(rt).getUIState$()}catch(e){return this.getService(y).catch("Error in getUiState: ",e),se({})}},this.enableSafeEval=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.ENABLE_SAFE_EVAL_TRIGGERED),this.getService(Rt).enableSafeEval()}catch(e){this.getService(y).catch("Error in enableSafeEval: ",e)}},this.disableSafeEval=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.DISABLE_SAFE_EVAL_TRIGGERED),this.getService(Rt).disableSafeEval()}catch(e){this.getService(y).catch("Error in disableSafeEval: ",e)}},this.resetVeltButtonState=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:n}}),this.getService(RC).resetVeltButtonState(n)}catch(t){this.getService(y).catch("Error in resetVeltButtonState: ",t)}},this.getService(y).log("%c[WB] Creating CLASS: Snippyly","color: blue;")}trackEvent(o,n={},e=!0){try{n||(n={}),n=T(E({},n),{source:"external"}),this.getService(et).trackAuthenticatedEvent(o,n,e)}catch(t){this.getService(y).catch("Error in _trackEvent: ",t);return}}};var Hpe=(()=>{let o=class o{constructor(){this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-external-styles"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,r){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}.cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}.cdk-overlay-dark-backdrop{background:#00000052}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}html{--velt-base-rem-unit: 1}velt-wireframe{display:none!important}:root{--legacy-velt-neutral-0: #000000;--legacy-velt-neutral-1: #141416;--legacy-velt-neutral-2: #23262F;--legacy-velt-neutral-3: #353945;--legacy-velt-neutral-4: #777E90;--legacy-velt-neutral-5: #B1B5C3;--legacy-velt-neutral-6: #E6E8EC;--legacy-velt-neutral-7: #F4F5F6;--legacy-velt-neutral-8: #FCFCFD;--legacy-velt-neutral-9: #FFFFFF;--legacy-velt-dark-1: #141416;--legacy-velt-dark-2: #222226;--legacy-velt-dark-3: #303034;--legacy-velt-dark-4: #404044;--legacy-velt-dark-5: #59595F;--legacy-velt-dark-6: #80808A;--legacy-velt-dark-7: #91919C;--legacy-velt-dark-8: #E5E5E9;--legacy-velt-primary-color: var(--legacy-velt-dark-1);--legacy-velt-primary-dark-color: var(--legacy-velt-dark-8);--legacy-velt-secondary-color: var(--legacy-velt-neutral-4);--legacy-velt-secondary-dark-color: var(--legacy-velt-dark-7);--legacy-velt-bg-color: var(--legacy-velt-neutral-8);--legacy-velt-bg-dark-color: var(--legacy-velt-dark-1);--legacy-velt-border-color: var(--legacy-velt-neutral-6);--legacy-velt-border-dark-color: var(--legacy-velt-dark-3);--legacy-velt-grey-2-color: #D4D6DF;--legacy-velt-grey-2-dark-color: var(--legacy-velt-dark-4);--legacy-velt-grey-4-color: #989898;--legacy-velt-grey-4-dark-color: var(--legacy-velt-dark-6);--legacy-velt-status-open-color: #625DF5;--legacy-velt-status-in-progress-color: #ECB000;--legacy-velt-status-resolved-color: #00C48C;--legacy-velt-purple: #625DF5;--legacy-velt-orange: #ECB000;--legacy-velt-green: #0DCF82;--legacy-velt-blue: #0d6efd;--legacy-velt-primary-btn-color: var(--legacy-velt-purple);--legacy-velt-hyperlink-color: var(--legacy-velt-purple);--legacy-velt-grey-btn-color: var(--legacy-velt-neutral-5);--legacy-velt-header-btn-color: var(--legacy-velt-neutral-3);--legacy-velt-dropdown-item-color: var(--legacy-velt-neutral-2);--legacy-velt-avatar-size: 2rem;--velt-default-font-family: sans-serif;--Icon-Size-Small: 12px;--Icon-Size-Medium: 16px;--Icon-Size-Large: 24px}:root[data-velt-theme=dark]{--legacy-velt-primary-color: var(--legacy-velt-primary-dark-color);--legacy-velt-secondary-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-border-color: var(--legacy-velt-border-dark-color);--legacy-velt-grey-2-color: var(--legacy-velt-grey-2-dark-color);--legacy-velt-grey-4-color: var(--legacy-velt-grey-4-dark-color);--legacy-velt-primary-btn-color: var(--legacy-velt-border-dark-color);--legacy-velt-hyperlink-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-grey-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-header-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-dropdown-item-color: var(--legacy-velt-secondary-dark-color)}:root{--legacy-velt-tool-padding: 6px;--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-3);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}:root[data-velt-theme=dark],:root:not(data-velt-theme) velt-comment-tool[dark],:root:not(data-velt-theme) velt-sidebar-button[dark],:root:not(data-velt-theme) velt-arrow-tool[dark],:root:not(data-velt-theme) velt-reaction-tool[dark],:root:not(data-velt-theme) velt-huddle-tool[dark],:root:not(data-velt-theme) velt-recorder-tool[dark],:root:not(data-velt-theme) velt-user-invite-tool[dark],:root:not(data-velt-theme) velt-user-request-tool[dark],:root:not(data-velt-theme) velt-notifications-tool[dark],:root:not(data-velt-theme) app-recorder-all-tool-menu[dark],:root:not(data-velt-theme) snippyly-recording-preview-steps-dialog[dark],:root:not(data-velt-theme) snippyly-recorder-control-panel-internal[dark],:root:not(data-velt-theme) snippyly-recorder-player-internal[dark],:root:not(data-velt-theme) velt-recorder-player-expanded[dark]:root:not(data-velt-theme) app-transcription-panel[dark]{--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-2);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-5);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-user-avatar,velt-user-avatar{--legacy-velt-user-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-user-avatar-initial-font-size: .8}snippyly-follow-overlay,velt-follow-overlay{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-color);--legacy-velt-follow-overlay-btn-color: var(--legacy-velt-neutral-6);--legacy-velt-follow-overlay-btn-hover-color: var(--legacy-velt-neutral-5);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-color)}snippyly-follow-overlay[dark],velt-follow-overlay[dark]{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-dark-color);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-dark-color)}snippyly-cursor,velt-cursor{--legacy-velt-cursor-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-cursor-video-size: 4.2rem}snippyly-reaction-tool,velt-reaction-tool,app-reaction-tool{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #8F95B2;--legacy-velt-reaction-tool-hover-bg-color: #EAE8F9;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-reaction-tool[dark],velt-reaction-tool[dark],app-reaction-tool[dark]{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #EAE8F9;--legacy-velt-reaction-tool-hover-bg-color: #8F95B2;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}velt-view-analytics-dialog{--legacy-velt-view-analytics-dialog-bg-color: #FFF;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(0, 0, 0, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #111;--legacy-velt-view-analytics-dialog-total-views-text-color: #625DF5;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: #F4F3FF;--legacy-velt-view-analytics-dialog-user-name-color: #4C5366;--legacy-velt-view-analytics-dialog-user-timestamp-color: #959595;--legacy-velt-view-analytics-dialog-back-btn-color: #8F95B2}velt-view-analytics-dialog[dark]{--legacy-velt-view-analytics-dialog-bg-color: #131229;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(255, 255, 255, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #FFF;--legacy-velt-view-analytics-dialog-total-views-text-color: #9491F8;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: rgba(244, 243, 255, .06);--legacy-velt-view-analytics-dialog-user-name-color: #FFF;--legacy-velt-view-analytics-dialog-user-timestamp-color: rgba(255, 255, 255, .4)}velt-reaction-pin-tooltip-internal{--Surface-Neutral-0: #FFF;--Surface-Neutral-2: #F5F5F5;--Surface-Neutral-3: #F0F0F0;--Text-Neutral-0: #0A0A0A;--Text-Neutral-3: #292929;--Text-Neutral-5: #525252;--Text-Neutral-9: #999;--Text-Brand-Primary: #625DF5}velt-reaction-pin-tooltip-internal[dark]{--Surface-Neutral-0: #0F0F0F;--Surface-Neutral-2: #1F1F1F;--Surface-Neutral-3: #2F2F2F;--Text-Neutral-0: #FFF;--Text-Neutral-3: #E0E0E0;--Text-Neutral-5: #C2C2C2;--Text-Neutral-9: #ADADAD;--Text-Brand-Primary: #9491F8}:root{--velt-border-radius-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-3xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-full: calc((5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xs: calc((.625rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xs: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-sm: calc((.875rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-md: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-lg: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xl: calc((1.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-light-mode-green: #0DCF82;--velt-light-mode-magenta: #A259FE;--velt-light-mode-amber: #FF7162;--velt-light-mode-purple: #625DF5;--velt-light-mode-cyan: #4BC9F0;--velt-light-mode-orange: #FE965C;--velt-light-mode-black: #080808;--velt-light-mode-white: #FFFFFF;--velt-light-mode-gray: #EBEBEB;--velt-light-mode-error: #FF7162;--velt-light-mode-error-hover: #DE5041;--velt-light-mode-error-foreground: #FFFFFF;--velt-light-mode-error-light: #FFF4F2;--velt-light-mode-error-transparent: rgba(255, 113, 98, .08);--velt-light-mode-warning: #FFCD2E;--velt-light-mode-warning-hover: #C69400;--velt-light-mode-warning-foreground: #474747;--velt-light-mode-warning-light: #FFFBEE;--velt-light-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-light-mode-success: #198F65;--velt-light-mode-success-hover: #006B41;--velt-light-mode-success-foreground: #FFFFFF;--velt-light-mode-success-light: #EDF6F3;--velt-light-mode-success-transparent: rgba(25, 143, 101, .08);--velt-light-mode-accent: #625DF5;--velt-light-mode-accent-text: #625DF5;--velt-light-mode-accent-hover: #534FCF;--velt-light-mode-accent-foreground: #FFFFFF;--velt-light-mode-accent-light: #F2F2FE;--velt-light-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-light-mode-text-0: #0A0A0A;--velt-light-mode-text-1: #141414;--velt-light-mode-text-2: #1F1F1F;--velt-light-mode-text-3: #292929;--velt-light-mode-text-4: #3D3D3D;--velt-light-mode-text-5: #525252;--velt-light-mode-text-6: #666666;--velt-light-mode-text-7: #7A7A7A;--velt-light-mode-text-8: #858585;--velt-light-mode-text-9: #999999;--velt-light-mode-text-10: #B8B8B8;--velt-light-mode-text-11: #A3A3A3;--velt-light-mode-text-12: #8F8F8F;--velt-light-mode-background-0: #FFFFFF;--velt-light-mode-background-1: #FAFAFA;--velt-light-mode-background-2: #F5F5F5;--velt-light-mode-background-3: #F0F0F0;--velt-light-mode-background-4: #EBEBEB;--velt-light-mode-background-5: #E5E5E5;--velt-light-mode-background-6: #E0E0E0;--velt-light-mode-background-7: #DBDBDB;--velt-light-mode-background-8: #D6D6D6;--velt-light-mode-background-9: #D1D1D1;--velt-light-mode-background-10: #CCCCCC;--velt-light-mode-border-0: #FFFFFF;--velt-light-mode-border-1: #FAFAFA;--velt-light-mode-border-2: #F5F5F5;--velt-light-mode-border-3: #F0F0F0;--velt-light-mode-border-4: #EBEBEB;--velt-light-mode-border-5: #E5E5E5;--velt-light-mode-border-6: #E0E0E0;--velt-light-mode-border-7: #DBDBDB;--velt-light-mode-border-8: #D6D6D6;--velt-light-mode-border-9: #D1D1D1;--velt-light-mode-border-10: #CCCCCC;--velt-light-mode-background-transparent: rgba(255, 255, 255, .8);--velt-light-mode-border-transparent: rgba(0, 0, 0, .16);--velt-light-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-dark-mode-green: #0DCF82;--velt-dark-mode-magenta: #A259FE;--velt-dark-mode-amber: #FF7162;--velt-dark-mode-purple: #625DF5;--velt-dark-mode-cyan: #4BC9F0;--velt-dark-mode-orange: #FE965C;--velt-dark-mode-black: #080808;--velt-dark-mode-white: #FFFFFF;--velt-dark-mode-gray: #EBEBEB;--velt-dark-mode-error: #FF7162;--velt-dark-mode-error-hover: #DE5041;--velt-dark-mode-error-foreground: #FFFFFF;--velt-dark-mode-error-light: #FFF4F2;--velt-dark-mode-error-transparent: rgba(255, 113, 98, .08);--velt-dark-mode-warning: #FFCD2E;--velt-dark-mode-warning-hover: #C69400;--velt-dark-mode-warning-foreground: #474747;--velt-dark-mode-warning-light: #FFFBEE;--velt-dark-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-dark-mode-success: #198F65;--velt-dark-mode-success-hover: #006B41;--velt-dark-mode-success-foreground: #FFFFFF;--velt-dark-mode-success-light: #EDF6F3;--velt-dark-mode-success-transparent: rgba(25, 143, 101, .08);--velt-dark-mode-accent: #625DF5;--velt-dark-mode-accent-text: #9491F8;--velt-dark-mode-accent-hover: #534FCF;--velt-dark-mode-accent-foreground: #FFFFFF;--velt-dark-mode-accent-light: #F2F2FE;--velt-dark-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-dark-mode-text-0: #FFFFFF;--velt-dark-mode-text-1: #F5F5F5;--velt-dark-mode-text-2: #EBEBEB;--velt-dark-mode-text-3: #E0E0E0;--velt-dark-mode-text-4: #D6D6D6;--velt-dark-mode-text-5: #C2C2C2;--velt-dark-mode-text-6: #ADADAD;--velt-dark-mode-text-7: #8F8F8F;--velt-dark-mode-text-8: #7A7A7A;--velt-dark-mode-text-9: #666666;--velt-dark-mode-text-10: #525252;--velt-dark-mode-text-11: #474747;--velt-dark-mode-text-12: #3D3D3D;--velt-dark-mode-background-0: #0F0F0F;--velt-dark-mode-background-1: #1A1A1A;--velt-dark-mode-background-2: #1F1F1F;--velt-dark-mode-background-3: #242424;--velt-dark-mode-background-4: #292929;--velt-dark-mode-background-5: #2E2E2E;--velt-dark-mode-background-6: #333333;--velt-dark-mode-background-7: #383838;--velt-dark-mode-background-8: #3D3D3D;--velt-dark-mode-background-9: #424242;--velt-dark-mode-background-10: #474747;--velt-dark-mode-border-0: #0F0F0F;--velt-dark-mode-border-1: #1A1A1A;--velt-dark-mode-border-2: #1F1F1F;--velt-dark-mode-border-3: #242424;--velt-dark-mode-border-4: #292929;--velt-dark-mode-border-5: #2E2E2E;--velt-dark-mode-border-6: #333333;--velt-dark-mode-border-7: #383838;--velt-dark-mode-border-8: #3D3D3D;--velt-dark-mode-border-9: #424242;--velt-dark-mode-border-10: #474747;--velt-dark-mode-background-transparent: rgba(0, 0, 0, .8);--velt-dark-mode-border-transparent: rgba(255, 255, 255, .16);--velt-dark-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-comment-pin-z-index: 2147483557;--velt-arrow-z-index: 2147483557;--velt-recorder-player-z-index: 2147483557;--velt-cursor-z-index: 2147483647;--velt-persistent-comment-frame-z-index: 2147483647;--velt-toast-popup-z-index: 2147483647;--velt-live-state-sync-overlay-z-index: 2147483647;--velt-follow-mode-overlay-z-index: 2147483647;--velt-comments-minimap-z-index: 2147483637;--velt-global-overlay-z-index: 2147483637}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}.cdk-overlay-container{z-index:var(--velt-global-overlay-z-index)!important}.cdk-overlay-container .velt-overlay-panel.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.velt-overlay-panel{background-color:transparent;border:none;box-shadow:none}.velt-overlay-panel.mat-mdc-tooltip-panel .mat-mdc-tooltip{color:#fff;background-color:#0b0b0b;border:1px solid #eeeeee;border-radius:4px;padding:8px 12px;font-size:14px}.velt-menu.mat-mdc-menu-panel{box-shadow:none}video.flip{transform:rotateY(180deg);-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}body[data-velt-huddle-on-cursor-mode] .cdk-overlay-container{z-index:calc(var(--velt-global-overlay-z-index, 2147483637) - 1)!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor){cursor:none!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor) *{cursor:none!important}body.snippyly-add-comment-mode,body.snippyly-add-comment-mode *{-webkit-user-select:none!important;user-select:none!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true][data-velt-iframe-container-static=true]{position:relative!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true]:before{content:""!important;position:absolute!important;inset:0!important;z-index:1!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] [data-velt-element=true]:not(snippyly-comment-text-portal):not(velt-recorder-control-panel):not([data-velt-screen-recorder-panel=true]){display:none!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight{color:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:inherit!important;background-color:inherit!important;cursor:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{background-color:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight snippyly-comment-text-portal,body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight velt-comment-text-portal{font-family:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-annotation-number{display:none!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)){opacity:1!important;visibility:visible!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)) snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{opacity:.2!important}[data-snippyly-comment-pin-host][data-snippyly-comment-pin-host-static],[data-snippyly-tag-pin-host][data-snippyly-tag-pin-host-static],[data-snippyly-recorder-pin-host][data-snippyly-recorder-pin-host-static],[data-snippyly-arrow-pin-host][data-snippyly-arrow-pin-host-static],[data-snippyly-area-pin-host][data-snippyly-area-pin-host-static],[data-velt-comment-pin-host][data-velt-comment-pin-host-static],[data-velt-tag-pin-host][data-velt-tag-pin-host-static],[data-velt-recorder-pin-host][data-velt-recorder-pin-host-static],[data-velt-arrow-pin-host][data-velt-arrow-pin-host-static],[data-velt-area-pin-host][data-velt-area-pin-host-static]{position:relative}[data-velt-comment-pin-host][data-velt-comment-pin-active=true],[data-velt-area-pin-host][data-velt-area-pin-active=true]{opacity:1!important;visibility:visible!important}.s-display-none,.velt-display-none{display:none!important}.s-flex,.velt-display-flex{display:flex!important}.velt-items-center{align-items:center!important}.s-background-blur-1{-webkit-backdrop-filter:blur(4px)!important;backdrop-filter:blur(4px)!important}.s-background-blur-2{-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.s-background-blur-3{-webkit-backdrop-filter:blur(12px)!important;backdrop-filter:blur(12px)!important}.s-background-blur-4{-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}.s-tooltip{position:relative!important}.s-tooltip .s-tooltiptext{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:120%!important;background-color:var(--legacy-velt-bg-color);border:1px solid var(--legacy-velt-border-color);color:var(--legacy-velt-primary-color)!important;text-align:left!important;padding:.5em .75em!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:2em!important;box-shadow:var(--legacy-velt-box-shadow)!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important;left:50%!important;transform:translate(-50%)!important}.s-tooltip .s-tooltiptext:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;border-left:1px solid var(--legacy-velt-border-color);border-top:1px solid var(--legacy-velt-border-color);background-color:var(--legacy-velt-bg-color);border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important}.s-tooltip .s-tooltiptext:before{content:" ";position:absolute;top:0;left:50%;width:24px;height:24px;transform:translate(-50%,-41%);background:transparent}.s-tooltip .s-tooltiptext.left{top:50%!important;right:120%!important;transform:translateY(-50%)!important}.s-tooltip .s-tooltiptext.left:after{transform:translate(41%,-50%) rotate(45deg)!important;transform-origin:center!important;left:unset!important;right:0!important;top:50%!important}.s-tooltip .s-tooltiptext.left.top{top:100%!important;transform:translateY(-45%)!important}.s-tooltip .s-tooltiptext.left.top:after{transform:translate(41%,66%) rotate(45deg)!important;top:0!important}.s-tooltip:hover .s-tooltiptext{visibility:visible!important;opacity:1!important}.s-tooltip-light .s-tooltiptext{background-color:#fff!important;color:#000!important;box-shadow:0 2px 8px -2px #9f9f9f!important}.s-tooltip-light .s-tooltiptext:after{background-color:#fff!important}.s-tooltip-link{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-cursor-pointer,.velt-cursor-pointer{cursor:pointer!important}.s-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;transform:translateZ(0);backface-visibility:hidden;perspective:1000px}@keyframes 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)}}app-render-timer-wrapper{width:100%;height:100%}velt-comment-text[comment-available=true]{color:var(--Constant-Warning---Text, #E2A600);background-color:#e2a6001a;border-bottom:1px solid #E2A600}
|
|
518
|
+
`))},dependencies:[Xm],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let i=o;return i})();var MFe=["userAvatarRef"],kFe=["*"];function RFe(i,o){if(i&1&&(_(0,"div",7),w(1,"span",8),b()),i&2){let n=l(2).ngIf,e=l();at("background-color",n.background||"#625DF5"),x("data-testid",e.componentId+"-initial-container"),m(),at("color",n.textColor||"#FFFFFF"),x("data-modal-author-initial",n.initial)("data-testid",e.componentId+"-initial")}}function NFe(i,o){if(i&1){let n=Y();_(0,"img",9),W("error",function(){F(n);let t=l(3);return L(t.onImageLoadError())})("load",function(){F(n);let t=l(3);return L(t.onImageLoaded())}),b()}if(i&2){let n=l(2).ngIf,e=l();at("display",n.imgLoaded?"":"none !important"),d("src",n.src,hn),x("alt","User avatar")("data-testid",e.componentId+"-image")}}function FFe(i,o){if(i&1&&(v(0),_(1,"div",4,1),u(3,RFe,2,7,"div",5)(4,NFe,1,5,"ng-template",6),Vt(5),b(),C()),i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId+"-container")("aria-label","User avatar"),m(2),d("ngIf",!n.imgLoaded),m(),d("ngIf",!n.imgLoadError)}}function LFe(i,o){if(i&1&&w(0,"velt-skeleton-loader-internal",10),i&2){let n=l().ngIf;d("height",n.size?n.size+"px":"100%")("width",n.size?n.size+"px":"100%")}}function BFe(i,o){if(i&1&&(v(0),u(1,FFe,6,4,"ng-container",3)(2,LFe,1,2,"ng-template",null,0,xe),C()),i&2){let n=o.ngIf,e=me(3);m(),d("ngIf",n.imgLoaded||(n==null||n.user==null?null:n.user.photoUrl)||(n==null||n.user==null?null:n.user.name)||(n==null||n.user==null?null:n.user.email)||(n==null?null:n.initial))("ngIfElse",e)}}var Qn=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.elementRef=r,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new R(null),this.componentConfigSignal=Ee({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(E({},r),{[t]:e[t].currentValue}),r))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(r=>(r=T(E({},r),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),r)),this.componentConfigSignal.update(r=>(r=T(E({},r),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(E({},r),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(E({},r),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),r))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=T(E({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=T(E({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Ue),h(y),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,r){if(t&1&&it(MFe,5),t&2){let a;Xe(a=Qe())&&(r.userAvatarRef=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},standalone:!1,features:[Ze],ngContentSelectors:kFe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,r){t&1&&(jt(),u(0,BFe,4,2,"ng-container",2)),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,Yo],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%]{display:flex}[_nghost-%COMP%]:empty{display:none}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let i=o;return i})();var VFe=["selectionElementPortalOverlay"],UFe=()=>["velt-overlay-panel"],jFe=i=>[i];function $Fe(i,o){if(i&1&&(v(0),_(1,"span",10),te(2),P(3,"translate"),b(),C()),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(5);m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color),x("data-testid",r.componentId+"-user-name-"+t),m(),Ge(M(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function HFe(i,o){if(i&1&&(v(0),u(1,$Fe,4,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function zFe(i,o){if(i&1&&(_(0,"span",11),te(1),b()),i&2){let n=l(4).ngIf,e=l();at("--velt-selection-color",(n.selections[0]==null||n.selections[0].user==null?null:n.selections[0].user.color)||"white"),x("data-testid",e.componentId+"-additional-count")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" additional users"),m(),_e("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function GFe(i,o){if(i&1&&(v(0),_(1,"div",7),P(2,"translate"),u(3,HFe,2,1,"ng-container",8)(4,zFe,2,5,"span",9),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),x("data-testid",e.componentId+"-label-container")("aria-label",M(2,4,"Selected users")),m(2),d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function WFe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",13),C()),i&2){let n=l(),e=n.$implicit,t=n.index;m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),d("size",20)("user",e==null?null:e.user)}}function qFe(i,o){if(i&1&&(v(0),u(1,WFe,2,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function YFe(i,o){if(i&1&&(_(0,"div",14),P(1,"translate"),_(2,"span",15),te(3),b()()),i&2){let n=l(4).ngIf,e=l();at("--velt-selection-user-index",n.selections==null?null:n.selections.length)("background-color",(n.selections[(n.selections==null?null:n.selections.length)-1]==null||n.selections[(n.selections==null?null:n.selections.length)-1].user==null?null:n.selections[(n.selections==null?null:n.selections.length)-1].user.color)||"white"),x("data-testid",e.componentId+"-additional-avatars")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" "+M(1,7,"additional users")),m(3),_e("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function KFe(i,o){if(i&1&&u(0,qFe,2,1,"ng-container",8)(1,YFe,4,9,"div",12),i&2){let n=l(3).ngIf,e=l();d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function ZFe(i,o){if(i&1&&u(0,GFe,5,6,"ng-container",6)(1,KFe,2,2,"ng-template",null,2,xe),i&2){let n=me(2),e=l(2).ngIf,t=l();d("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",n)}}function XFe(i,o){if(i&1&&(v(0),w(1,"div",4,0),u(3,ZFe,3,2,"ng-template",5,1,xe),C()),i&2){let n=me(2),e=l().ngIf,t=l();m(),at("top",(e==null||e.position==null?null:e.position.top)+t.offsetTop,"px")("left",(e==null||e.position==null?null:e.position.left)+t.offsetLeft,"px"),d("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),x("data-testid",t.componentId),m(2),d("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",pt(13,UFe))("cdkConnectedOverlayPositions",A(14,jFe,e==null?null:e.overlayPosition))}}function QFe(i,o){if(i&1&&(v(0),u(1,XFe,5,16,"ng-container",3),C()),i&2){let n=o.ngIf;m(),d("ngIf",n==null?null:n.position)}}var $pe=(()=>{let o=class o{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,r){this.loggingService=e,this.selectionService=t,this.elementRef=r,this._highlight=new qg,this.position=null,this.userIndicatorTypes=DC,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=Ee({userIndicatorPosition:kI.End,userIndicatorType:DC.Avatar,position:null,overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},selections:[]}),this.veltElement=!0,this.componentId="velt-selection-element";try{this.loggingService.log("%c[WB] Creating CLASS: SelectionElementPortalComponent","color: blue;");let a=this.selectionService.getUserIndicatorPosition(),s=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(c=>(c=T(E({},c),{userIndicatorPosition:a,userIndicatorType:s}),c)),this.setOverlayPosition(a)}catch(a){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",a)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","complementary"),e.setAttribute("aria-label","Selection portal")}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent setupA11yAttributes:",e)}}setSelections(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=E({},t),t.selections.push(e),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent addSelection: ",t)}}ngAfterViewInit(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: ngAfterViewInit","color: green;"),this.updateOverlayPosition()}catch(e){this.loggingService.catch("Error in ngAfterViewInit: ",e)}}setOverlayPosition(e){try{switch(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e){case"start":this.componentConfigSignal.update(t=>(t=T(E({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=T(E({},t),{overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"}}),t))}this.updateOverlayPosition()}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setOverlayPosition: ",t)}}updateOverlayPosition(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: updateOverlayPosition","color: green;"),this.selectionElementPortalOverlay&&this.selectionElementPortalOverlay?.overlayRef?.updatePosition()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent updateOverlayPosition: ",e)}}calculatePosition(){try{if(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: calculatePosition","color: green;"),this.highlight?.targetElement){let e=tI(this.highlight.targetElement);if(e){let t=e.iterateNext(),r,a=null,s=null;try{r=JSON.parse(t?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),s=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(p=>(p=T(E({},p),{userIndicatorPosition:a,userIndicatorType:s}),p))}catch{}let c;if(r?.horizontal&&(c=r.horizontal),a==="start"?c="top-start":c="top-right",t){let p=t.getBoundingClientRect();if(p&&p.width&&p.height)switch(c){case"left":this.position={top:p.height/2-16,left:-4};break;case"left-start":this.position={top:0,left:-4};break;case"top-start":this.position={top:-32,left:0};break;case"top-right":this.position={top:-32,left:p.width};break;case"bottom-left":this.position={top:p.height+4,left:0};break;case"bottom-right":this.position={top:p.height+4,left:p.width-32};break;case"center-left":this.position={top:p.height/2-16,left:-32};break;case"center-right":this.position={top:p.height/2-16,left:p.width+4};break;default:this.position={top:-32,left:p.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=T(E({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Xs),h(R))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,r){if(t&1&&it(VFe,5),t&2){let a;Xe(a=Qe())&&(r.selectionElementPortalOverlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{highlight:"highlight",offsetLeft:"offsetLeft",offsetTop:"offsetTop"},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["selectionElementPortalOverlay","cdkConnectedOverlay"],["defaultAvatarTypeTemplate",""],[4,"ngIf"],["cdkOverlayOrigin","","role","presentation",1,"selection-element-portal",3,"id"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions"],[4,"ngIf","ngIfElse"],["role","list",1,"velt-live-selection-element-user-name-container"],[4,"ngFor","ngForOf"],["class","velt-live-selection-element-user-name-plus","role","listitem",3,"--velt-selection-color",4,"ngIf"],["role","listitem",1,"velt-live-selection-element-user-name"],["role","listitem",1,"velt-live-selection-element-user-name-plus"],["class","photo-container","role","listitem",3,"--velt-selection-user-index","background-color",4,"ngIf"],[1,"photo-container","selection-user-avatar",3,"size","user"],["role","listitem",1,"photo-container"],[1,"s-selection-element-avatar-initial"]],template:function(t,r){t&1&&u(0,QFe,2,1,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[bt,X,cn,an,Qn,pe],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);position:absolute;top:0;left:0;box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert}.selection-element-portal[_ngcontent-%COMP%]{display:none;position:absolute;top:0;left:0;white-space:nowrap;z-index:1;font-size:var(--velt-font-size-xs)}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border-radius:50%;color:var(--velt-light-mode-white);border:2px solid var(--velt-selection-color);margin-left:-5px;z-index:calc(var(--velt-selection-user-index, 0) * -1)}.photo-container[_ngcontent-%COMP%] .s-selection-element-avatar-initial[_ngcontent-%COMP%]{color:var(--velt-light-mode-white)}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover} snippyly-user-avatar.selection-user-avatar .s-user-avatar-initial{font-size:var(--velt-font-size-md)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-xs);margin-top:5px}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);font-size:var(--velt-spacing-md);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name-plus[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-x);font-size:var(--velt-font-size-xs);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}"],changeDetection:0});let i=o;return i})();var BC=(i,o)=>{try{let n=eLe(i),e=[],t=[];return n.forEach(r=>{r?.parentElement?.closest(U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?r?.parentElement?.normalize():t.push(r)}),t.forEach(r=>{let a=tLe(r,o);a&&e.push(a)}),e}catch(n){return nt.catch("Error in highlighter highlightRange: ",n),[]}},eLe=i=>{try{if(i.collapsed)return[];let o=i.commonAncestorContainer;if(i.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(o=i.commonAncestorContainer.parentElement),!o)return[];let n=[],e=o.ownerDocument.createNodeIterator(o,NodeFilter.SHOW_TEXT),t,r=!1;for(;t=e.nextNode();)if(i.intersectsNode(t)){let a=t?.length;i.startContainer===t&&i.startOffset>0&&(t.splitText(i.startOffset),r=!0),i.endContainer===t&&i.endOffset<a&&t.splitText(i.endOffset),n.push(t)}return r&&n.shift(),n}catch(o){return nt.catch("Error in highlighter getTextNodesInRange: ",o),[]}},tLe=(i,o)=>{try{let n=document.createElement(o||U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return i.parentElement?.replaceChild(n,i),n.appendChild(i),n}catch(n){return nt.catch("Error in highlighter highlightNode: ",n),null}};var Xs=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D){this.afAuth=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.domService=c,this.componentFactoryResolver=p,this.injector=g,this.appRef=f,this.loggingService=I,this.commonDbService=D,this.documentPaths=null,this.textSelections={},this.enableSelections$=new ve(!1),this.userIndicatorEnabled$=new ve(!0),this.userIndicatorPosition$=new ve(kI.End),this.userIndicatorType$=new ve(DC.Avatar),this.defaultElementsTrackingEnabled$=new ve(!0),this.defaultStylingEnabled$=new ve(!0),this.elementSelections={},this.databaseService.getDb().pipe(Fe(N=>!!N),ot(1)).subscribe(N=>{N&&this.updateOnDocumentFocusChange()},N=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",N)}),this.docService.getDocumentPaths$().subscribe(N=>{this.documentPaths=N},N=>{this.loggingService.catch("Error in SelectionService getDocumentPaths subscription: ",N)}),this.domService.onDocumentClick$().subscribe(N=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&N?.target&&!window.getSelection()?.toString()){let G=this.getSelectionEnabledElement(N.target);if(G&&!Gi(G)){let z=this.domService.getXPath(G);if(z){let J=new qg;J.type="click",J.targetElement=z,this.setSelection(J)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",G)}},N=>{this.loggingService.catch("Error in SelectionService onDocumentClick$ subscription: ",N)}),this.domService.onDocumentFocus$().subscribe(N=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&N?.target){let G=this.getSelectionEnabledElement(N.target);if(G&&!Gi(G)){let z=this.domService.getXPath(G);if(z){let J=new qg;J.type="focus",J.targetElement=z,this.setSelection(J)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",G)}},N=>{this.loggingService.catch("Error in SelectionService onDocumentFocus$ subscription: ",N)}),this.domService.onWindowKeyupEsc$().subscribe(N=>{this.removeSelection()},N=>{this.loggingService.catch("Error in SelectionService onWindowKeyupEsc$ subscription: ",N)}),this.enableSelections$.pipe(fe(()=>this.isFeatureAllowed$({})),Fe(N=>N?.config&&N?.user)).subscribe(N=>{(!N?.featureAllowed||!this.enableSelections$.value)&&this.removeSelection()},N=>{this.loggingService.catch("Error in SelectionService enableSelections$ subscription: ",N)}),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&window.getSelection()?.toString()){let N=window.getSelection()?.getRangeAt(0);if(N.commonAncestorContainer&&!N?.collapsed){let G=kle([N]),z=new qg;z.type="selection",z.targetTextRange=G?.length?G[0]:null,this.setSelection(z)}}}catch(N){this.loggingService.catch("Error in SelectionService onSelectionChange$: ",N)}},N=>{this.loggingService.catch("Error in SelectionService onSelectionChange$ subscription: ",N)}),this.authService.getUser$().subscribe(N=>{this.user=N},N=>{this.loggingService.catch("Error in SelectionService getUser$ subscription: ",N)}),this.getSelectionsOnCurrentDocument().pipe(Ti()).subscribe(([N,G])=>{try{if(N){let z=[];Object.keys(N).forEach(J=>{let ce=N[J],ye=G?G[J]:null;!gi(ce,ye)&&J!==this.getUserIdHash(this.user)&&z.push(ce)}),z.forEach(J=>{if(J.targetElement){let ce=this.elementSelections[J?.targetElement]?.portalRef,Oe=(this.elementSelections[J?.targetElement]?.selections||[]).filter($e=>this.getUserIdHash($e.user)!==this.getUserIdHash(J?.user));Oe?.length?(ce.instance.setSelections(Oe.slice()),this.elementSelections[J?.targetElement].selections=Oe.slice(),this.highlightElement(Oe[0])):(this.removeHighlightFromElement(J),this.removeSelectionElement(J))}else J.targetTextRange&&this.removeHighlightFromText(J)})}if(G){let z=[];Object.keys(G).forEach(J=>{let ce=N?N[J]:null,ye=G[J];!gi(ce,ye)&&J!==this.getUserIdHash(this.user)&&z.push(ye)}),z.forEach(J=>{J.targetElement?(this.highlightElement(J),this.getUserIndicatorEnabled()&&this.setElementHighlight(J)):J.targetTextRange&&this.highlightText(J)})}}catch(z){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",z)}},N=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",N)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}isFeatureAllowed(){return eo(this.configService.getConfig(),this.authService.getUser(),Re.LIVE_SELECTION)}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.user&&document.visibilityState==="hidden"&&this.removeSelection()})}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}getSelectionsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getSelectionsOnCurrentDocument","color: green;"),ei(this.afAuth).pipe(Fe(e=>!!e),fe(e=>this.isFeatureAllowed$({firebaseUser:e})),fe(e=>e.featureAllowed?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(de(r=>(this.documentPaths=r,t)))),fe(t=>t?.user?t?.user?.isAnonymous?se(null):this.documentPaths?this.databaseService.getDb().pipe(Fe(r=>!!r),fe(r=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(a=>a?.data)):se(null))):se(null):se(null))):se(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>T(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>(this.user=r,T(E({},t),{user:r}))))),fe(t=>eo(t.config,t.user,Re.LIVE_SELECTION)?se(T(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),se(T(E({},t),{featureAllowed:!1})))),vt((t,r)=>t?.featureAllowed===r?.featureAllowed))}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in SelectionService setSelection: ",t)}}removeSelection(){try{this.user?.userId&&this.documentPaths?.selection&&this.commonDbService.deleteData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in SelectionService removeSelection: ",e)}}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=["input","textarea","select","button"],s;try{r?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(s=JSON.parse(r?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!s||s?.border)&&this.domService.highlightUserElement(r,e?.user?.color,e?.user?.name,this.getDefaultStylingEnabled())}}}catch(t){this.loggingService.catch("Error in SelectionService highlightElement: ",t)}}removeHighlightFromElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();r&&this.domService.removeHighlightUserFromElement(r)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=H0(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),r=new Range;try{r.setStart(t[0].textNode,t[0].startOffset||0),r.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(r.toString()===e.targetTextRange?.text){let a=BC(r,U.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),s=[],c=this.getSelectionUserMarker(e.user);if(a&&a.length&&(a.forEach(p=>{p?.textContent?.trim()&&(this.domService.addClassToElement(p,p.tagName?.toLowerCase()),this.domService.addClassToElement(p,U.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(p,U.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&p.style.setProperty(U.VELT_SELECTION_COLOR,e.user?.color+"55"),s.push({element:p,textNode:p.childNodes[0]}))}),c)){let p=a.filter(f=>f?.textContent?.trim()),g=p?.length?p[p?.length-1]:null;g&&g.parentNode.insertBefore(c,g.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:s,marker:c}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(r=>{r?.element&&r?.textNode&&r.element.replaceWith(r.textNode),r.textNode&&r.textNode.parentNode?.normalize()}),this.textSelections[t]?.marker&&this.textSelections[t]?.marker?.remove())}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromText: ",t)}}getSelectionUserMarker(e){try{let t=document.createElement("span");t.classList.add("snippyly-user-marker","active"),t.setAttribute("data-name",e?.name+""),t.style.setProperty("--velt-selection-marker-color",e?.color||"#000");let r=document.createElement("span");r.classList.add("snippyly-user-marker-line");let a=document.createElement("span");return a.classList.add("snippyly-user-marker-dot"),r.appendChild(a),t.appendChild(r),setTimeout(()=>{t?.classList?.remove("active")},1e3),t}catch(t){return this.loggingService.catch("Error in SelectionService getSelectionUserMarker: ",t),null}}signOutUser(e){return new Promise((t,r)=>{try{this.documentPaths?.selection&&e?this.commonDbService.getData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&this.commonDbService.deleteData({feature:"selection",errorCallback:s=>{r(s)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(a=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",a),r(a)}):t(null)}catch(a){this.loggingService.catch("Error in SelectionService signOutUser:",a),r(a)}})}enableSelections(e){try{this.enableSelections$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService enableSelections: ",t)}}enableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!0)return;this.userIndicatorEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableUserIndicator: ",e)}}disableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!1)return;this.userIndicatorEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableUserIndicator: ",e)}}getUserIndicatorEnabled$(){return this.userIndicatorEnabled$.asObservable()}getUserIndicatorEnabled(){return this.userIndicatorEnabled$.value}setUserIndicatorPosition(e){try{this.userIndicatorPosition$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorPosition: ",t)}}getUserIndicatorPosition$(){return this.userIndicatorPosition$.asObservable()}getUserIndicatorPosition(){return this.userIndicatorPosition$.value}setUserIndicatorType(e){try{this.userIndicatorType$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorType: ",t)}}getUserIndicatorType$(){return this.userIndicatorType$.asObservable()}getUserIndicatorType(){return this.userIndicatorType$.value}enableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!0)return;this.defaultElementsTrackingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultElementsTracking: ",e)}}disableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!1)return;this.defaultElementsTrackingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultElementsTracking: ",e)}}getDefaultElementsTrackingEnabled$(){return this.defaultElementsTrackingEnabled$.asObservable()}getDefaultElementsTrackingEnabled(){return this.defaultElementsTrackingEnabled$.value}enableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!0)return;this.defaultStylingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultStyling: ",e)}}disableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!1)return;this.defaultStylingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultStyling: ",e)}}getDefaultStylingEnabled$(){return this.defaultStylingEnabled$.asObservable()}getDefaultStylingEnabled(){return this.defaultStylingEnabled$.value}getSelectionEnabledElement(e){try{let t=this.getDefaultElementsTrackingEnabled();return t&&U.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:KH(e,t)}catch(t){return this.loggingService.catch("Error in SelectionService isElementAllowed: ",t),null}}setElementHighlight(e){try{if(!this.elementSelections[e.targetElement])this.setSelectionElement(e);else{let t=this.elementSelections[e.targetElement].portalRef;this.elementSelections[e.targetElement].selections?.find(a=>this.getUserIdHash(a.user)===this.getUserIdHash(e?.user))||(t.instance.addSelection(e),this.elementSelections[e.targetElement].selections.push(e))}}catch(t){this.loggingService.catch("Error in SelectionService setElementSelection: ",t)}}setSelectionElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=this.domService.getHostElement(r),s=new rr($pe),c=new ar(a,this.appRef,this.injector),p=c.attach(s);p.instance.highlight=e,p.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:c,selectionElementPortal:s,portalRef:p,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:r,selectionHostElement:a,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:r,selectionHostElement:a}=this.elementSelections[e.targetElement],s=this.domService.getElementOffset(r,a);t.instance.offsetLeft=s.offsetLeft,t.instance.offsetTop=s.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(r=>r.targetElement);Object.keys(this.elementSelections).forEach(r=>{if(!t.includes(r)){let a=this.elementSelections[r];a&&(a.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(a.selectionHostElement)),delete this.elementSelections[r]}})}catch(t){this.loggingService.catch("Error in SelectionService checkElementHighlightsToRemove: ",t)}}removeSelectionElement(e){try{let t=this.elementSelections[e.targetElement];t&&(t.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(t.selectionHostElement)),delete this.elementSelections[e.targetElement]}catch(t){this.loggingService.catch("Error in SelectionService removeSelectionElement: ",t)}}getUserIdHash(e){try{return e?.userId?Et(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}};o.\u0275fac=function(t){return new(t||o)(ee(Ai),ee(Ue),ee(Rt),ee(bn),ee(rt),ee(Le),ee(Ao),ee(Ct),ee(ni),ee(y),ee(gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var jR=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: SelectionElement","color: blue;"),this.enableLiveSelection=this._enableLiveSelection,this.disableLiveSelection=this._disableLiveSelection,this.enableUserIndicator=this._enableUserIndicator,this.disableUserIndicator=this._disableUserIndicator,this.setUserIndicatorPosition=this._setUserIndicatorPosition,this.setUserIndicatorType=this._setUserIndicatorType,this.enableDefaultElementsTracking=this._enableDefaultElementsTracking,this.disableDefaultElementsTracking=this._disableDefaultElementsTracking,this.enableDefaultStyling=this._enableDefaultStyling,this.disableDefaultStyling=this._disableDefaultStyling,this.getLiveSelectionData=this._getLiveSelectionData}_enableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(Xs).enableSelections(!0)}catch(o){this.getService(y).catch("Error in enableLiveSelection: ",o)}}_disableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(Xs).enableSelections(!1)}catch(o){this.getService(y).catch("Error in disableLiveSelection: ",o)}}_enableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(Xs).enableUserIndicator()}catch(o){this.getService(y).catch("Error in _enableUserIndicator: ",o)}}_disableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(Xs).disableUserIndicator()}catch(o){this.getService(y).catch("Error in _disableUserIndicator: ",o)}}_setUserIndicatorPosition(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(Z.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(Xs).setUserIndicatorPosition(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorPosition: ",n)}}_setUserIndicatorType(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(Z.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(Xs).setUserIndicatorType(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorType: ",n)}}_enableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Xs).enableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _enableDefaultElementsTracking: ",o)}}_disableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Xs).disableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _disableDefaultElementsTracking: ",o)}}_enableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(Z.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Xs).enableDefaultStyling()}catch(o){this.getService(y).catch("Error in _enableDefaultStyling: ",o)}}_disableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(Z.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Xs).disableDefaultStyling()}catch(o){this.getService(y).catch("Error in _disableDefaultStyling: ",o)}}_getLiveSelectionData(){this.getService(y).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(Z.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(Xs).getSelectionsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getLiveSelectionData: ",o),se(null)}}};var os=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,D,N,G,z,J){this.analyticsService=e,this.configService=t,this.docService=r,this.databaseService=a,this.authService=s,this.domService=c,this.afAuth=p,this.iamService=g,this.avatarService=f,this.contactService=I,this.storageService=D,this.dialog=N,this.loggingService=G,this.notificationService=z,this.commonDbService=J,this.tagAnnotations$=new ve({}),this.tagAnnotationsByDocumentId$=new ve({}),this.documentPaths=null,this.allowedElementIds$=new ve([]),this.addTagMode$=new ve(!1),this.enableTextTags$=new ve(!1),this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.databaseService.getDb().pipe(Fe(ce=>!!ce),ot(1)).subscribe(ce=>{ce&&this.getDocumentPaths()},ce=>{this.loggingService.catch("Error in TagService getDb subscription: ",ce)}),this.domService.onWindowPointerMove$().subscribe(ce=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let ye=this.domService.getBackgroundElement(ce.clientX,ce.clientY);ye&&(this.isElementInsideAllowedElements(ye)?bk(ce.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=ye,this.domService.highlightElement(this.hightlightElement,U.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ce=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",ce)}),this.domService.onWindowKeyupEsc$().subscribe(ce=>{this.addTagMode$.value&&this.disableAddTagMode()},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",ce)}),this.domService.onDocumentClick$().subscribe(ce=>{if(ce&&this.addTagMode$.value){if(ce.preventDefault(),ce.stopPropagation(),!bk(ce.target)){let ye=this.domService.getBackgroundElement(ce.clientX,ce.clientY);ye&&this.isElementInsideAllowedElements(ye)&&this.addTag(ce)}this.disableAddTagMode()}},ce=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",ce)}),this.addTagMode$.subscribe(ce=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),ce?this.domService.addClassToElement(document.body,"snippyly-add-tag-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-tag-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ce=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",ce)}),this.domService.onWindowKeyupBackspace$().subscribe(ce=>{this.deleteTagPinAnnotations("keyupBackspace")},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",ce)}),this.domService.onWindowKeyupDelete$().subscribe(ce=>{this.deleteTagPinAnnotations("keyupDelete")},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ce)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ce=>{ce?.length&&(ce?.filter(Oe=>Oe.type==="tag")).forEach(Oe=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(Oe)}))},ce=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ce)})}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){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let a,s;try{if(e&&(s=Rn(e)),t&&typeof t=="object"){let c=tr(t);a=Rn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",c)}return ei(this.afAuth).pipe(Fe(c=>!!c),fe(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),fe(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(de(p=>(c.featureAllowed=p,c))):se(c)),fe(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(de(p=>(c.featureAllowed=!p,c))):se(c)),fe(c=>c.featureAllowed?se(c).pipe(fe(p=>this.docService.getDocumentPaths$().pipe(de(g=>(this.documentPaths=g,p.documentPaths=g,p)))),fe(p=>this.getDataFromDocumentId(s).pipe(de(g=>(p.annotations=g||[],E({},p))))),fe(p=>this.docService.getLocation$().pipe(de(g=>(p.location=g,p)))),fe(p=>this.docService.getLocations$().pipe(de(g=>(p.customLocations=g,p)))),de(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let g=[];return a?g.push(a):(g.push(p?.location?.locationId),g.push(...Object.values(p?.customLocations||[]).map(f=>f.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,g),p}}),fe(p=>r?se(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(de(()=>p)):se(p)),fe(p=>r?se(p):p?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(de(()=>p)):se(p)),de(p=>(p?.filteredAnnotations?.forEach(g=>{this.calculateTagAnnotationPosition(g)}),p)),fe(p=>p?.filteredAnnotations?se(p?.filteredAnnotations||[]):se([]))):se([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>T(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>T(E({},t),{user:r})))),fe(t=>eo(t.config,t.user,Re.TAG)?se(T(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),se(T(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(t=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),de(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),this.setTagAnnotationsByDocumentId(e||this.documentPaths?.documentId,a),a})):se([])))}setTagAnnotationsByDocumentId(e,t){try{e&&this.tagAnnotationsByDocumentId$.next(T(E({},this.tagAnnotationsByDocumentId$.value),{[e]:t}))}catch(r){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",r)}}filterAnnotationsByLocationIds(e,t){try{return e.filter(r=>t.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",r),[]}}calculateTagAnnotationPosition(e){try{if(e.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let r=t.iterateNext();if(r&&Di(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:c}=kg(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(t){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",t)}}filterPinAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let a=e?Object.values(e):[];a.forEach((c,p)=>{c?.annotationId&&(c.annotationIndex=p+1)});let s=[];if(t)r?s=a.filter(c=>c.locationId===r):s=a.slice();else{let c=this.docService.getLocation();c&&c.locationId?s=a.filter(p=>p.locationId===c.locationId):s=a.filter(p=>!p.locationId)}return s}catch(a){return this.loggingService.catch("Error in TagService filterPinAnnotations:",a),[]}}addTag(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let r=this.authService.getUser();if(r)if(r.isReadOnly||r.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let a=new NI;a.from=r,a.color=U.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:c}=this.domService.getTopLeftPosition();a.positionX=s,a.positionY=c;let p=this.domService.getCurrentWindowSizeValue();if(a.screenWidth=p.screenWidth,a.screenHeight=p.screenHeight,a.screenScrollHeight=p.screenScrollHeight,a.taggedElementPath="",e&&(a.targetElement=this.domService.getTargetElementForCursorPosition(e)),t&&(a.targetTextRange=t),a?.targetElement?.xpath){let g=this.domService.getXPath(a.targetElement.xpath);if(g){let f=g.iterateNext();f&&(Di(f)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=Mi(),a.pageInfo&&(a.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(a)}}catch(r){this.loggingService.catch("Error in TagService addTag: ",r)}}setLocationToTagAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let r;e.targetElement?.xpath?r=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetTextRange?.commonAncestorContainer&&(r=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation({location:a,source:"internal"});s?.[0]&&(e.locationId=s[0].locationId,e.location=s[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",t)}}saveTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(r=>{if(this.documentPaths?.tag){e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.tagUrl=this.generateTagUrl(e));let a=JSON.parse(JSON.stringify(e));return a.position=null,this.domService.toggleAnnotationSelection(a),e.targetTextRange&&sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(Z.Events.Tag.TAG_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService saveTagToDb: ",t)}}updateTag(e,t=!1,r){try{r&&this.setLocationToTagAnnotation(e),t&&this.updateNotificationsDatabase(e,eI.UPDATED),this.updateTagToDb(e)}catch(a){this.loggingService.catch("Error in TagService updateTag: ",a)}}resolveTag(e){try{e.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,eI.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(Z.Events.Tag.TAG_RESOLVED,{annotationId:e.annotationId})}catch(t){this.loggingService.catch("Error in TagService resolveTag: ",t)}}updateTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(e?.targetElement?.xpath){let t=this.domService.getXPath(e.targetElement.xpath);if(t){let r=t.iterateNext();r&&(Di(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(r=>{if(this.documentPaths?.tag&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService updateTagToDb: ",t)}}deleteTagPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),r=this.authService.getUser(),a=[];Object.keys(t).forEach(s=>Q(this,null,function*(){let c=t[s];c.type==="tag"&&r&&c.from&&(r?.isAdmin||c.from.userId===r.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Z.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(Ma,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(ot(1)).subscribe(s=>{s&&(a.forEach(c=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${U.SNIPPYLY_HIGHLIGHT}]`).forEach(p=>{this.domService.removeHighlightFromElement(p)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(t){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",t)}}deleteTagPinAnnotation(e){return this.authService.isFeatureAllowed(Re.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,eI.DELETED),this.analyticsService.trackEvent(Z.Events.Tag.TAG_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(Re.TAG)?(this.analyticsService.trackEvent(Z.Events.Tag.TAG_ADD_MODE_ENABLED),this.addTagMode$.next(!0)):this.loggingService.catch("Error in TagService enableAddTagMode: ","Tag feature is not enabled.")}disableAddTagMode(){this.analyticsService.trackEvent(Z.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(e){this.enableTextTags$.next(e)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",t),!1}}attachTag(e,t=[]){let r=ua(e,t);if(r){let a=this.domService.getXPath(r),s=this.getTagPinAnnotationObject();s&&(s.targetElement={xpath:a,topPercentage:50,leftPercentage:90},this.saveTagToDb(s))}}getTagPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let t=new NI;t.from=e,t.color=U.DEFAULT_ANNOTATION_COLOR,t.resolved=!1,t.lastUpdated=this.timestamp;let{topPositionX:r,topPositionY:a}=this.domService.getTopLeftPosition();t.positionX=r,t.positionY=a;let s=this.domService.getCurrentWindowSizeValue();t.screenWidth=s.screenWidth,t.screenHeight=s.screenHeight,t.screenScrollHeight=s.screenScrollHeight,t.taggedElementPath="";let c=this.docService.getLocation();return c&&(t.locationId=c.locationId,t.location=c.location),t}return null}updateNotificationsDatabase(e,t){try{let r={annotationData:e,actionType:t,notificationSource:"tag"};this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",r)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getTagUrl(e){try{return e?.pageInfo?.tagUrl?e.pageInfo.tagUrl:(e?.pageInfo||(e.pageInfo=Mi(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.tagUrl=this.generateTagUrl(e),this.updateTag(e),e.pageInfo?.tagUrl)}catch(t){this.loggingService.catch("Error in TagService getTagUrl: ",t);return}}uploadFile(e,t){let r=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(r=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`),this.storageService.uploadFile({path:r,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateTagUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(U.URL_PARAMS.TAG_ID),t.searchParams.append(U.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(ee(et),ee(Rt),ee(rt),ee(bn),ee(Ue),ee(Le),ee(Ai),ee(In),ee(dm),ee(yi),ee(Xg),ee(ao),ee(y),ee(vn),ee(gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var $R=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: TagElement","color: blue;"),this.getAllTagAnnotations=this._getAllTagAnnotations,this.deleteTag=this._deleteTag,this.allowedElementIds=this._allowedElementIds,this.attachTag=this._attachTag,this.addTagModeChange=this._addTagModeChange}_getAllTagAnnotations(o,n){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Z.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:n}}),this.getService(os).getAllTagAnnotations(o,n)}catch(e){return this.getService(y).catch("Error in _getLiveTagsOnCurrentDocument: ",e),se(null)}}_deleteTag(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(Z.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(os).deleteTagPinAnnotations("tagElement")}catch(o){this.getService(y).catch("Error in _deleteTag: ",o)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Z.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(os).setAllowedElementIds(o)}catch(n){this.getService(y).catch("Error in allowedElementIds: ",n)}}_attachTag(o){this.getService(y).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(Z.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(os).attachTag(o,["id","data-id"])}catch(n){this.getService(y).catch("Error in _attachTag: ",n)}}_addTagModeChange(){this.getService(y).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(Z.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(os).addTagModeChange()}catch(o){return this.getService(y).catch("Error in _addTagModeChange: ",o),se(!1)}}};var HR=class extends di{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.getUniqueViewsByUser=this._getUniqueViewsByUser,this.getUniqueViewsByDate=this._getUniqueViewsByDate}_getUniqueViewsByUser(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByUser","color: green;");try{return this.trackEvent(Z.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(xs).getUniqueViewsByUser(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByUser: ",n),se({})}}_getUniqueViewsByDate(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByDate","color: green;");try{return this.trackEvent(Z.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(xs).getUniqueViewsByDate(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByDate: ",n),se({})}}};var qI=(()=>{let o=class o{constructor(e,t){this.docService=e,this.loggingService=t}updateDocuments(e){return Q(this,null,function*(){try{return yield this.docService.updateDocuments(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateDocuments: ",t),null}})}updateLocations(e){return Q(this,null,function*(){try{return yield this.docService.updateLocations(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateLocations: ",t),null}})}fetchDocuments(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchDocuments(e),r=[];return t.forEach(a=>{let s=a?.docIamConfig??{},c=a?.metadata??{};c.disabled=!!s?.disabled,c.id=c?.clientDocumentId,c.documentId=c?.clientDocumentId,delete c?.clientDocumentId,c.organizationId=c?.clientOrganizationId,delete c?.clientOrganizationId,delete c?.pageInfo,delete c?.veltFolderId,r.push(c)}),{data:r.reduce((a,s)=>(s?.documentId&&(a[s.documentId]=s),a),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchDocuments: ",t),{data:null}}})}fetchFolders(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchFolders(e),r=t?.parentFolders?.map(s=>{let c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E({},c)});return{data:(t?.data?.map(s=>{let c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E(E({},c),e?.folderId?{subFolders:r}:{})})).reduce((s,c)=>(c?.folderId&&(s[c.folderId]=c),s),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var zR=(()=>{let o=class o{constructor(e,t,r,a,s){this.authService=e,this.coreActionsService=t,this.docService=r,this.iamService=a,this.loggingService=s,this.veltInitState$=new ve(void 0);try{this.loggingService.log("%c[WB] Creating CLASS: VeltService","color: blue;");let c=this.authService.getUser$(),p=this.docService.getDocumentPaths$(),g=this.iamService.isUserAllowed$();dn([c,p,g]).subscribe(([f,I,D])=>{f&&I&&D?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(f=>{this.coreActionsService.triggerAction(Un.DOCUMENT_INIT,f)})}catch(c){this.loggingService.catch("Error in VeltService constructor: ",c)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(vt())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),se(void 0)}}};o.\u0275fac=function(t){return new(t||o)(ee(Ue),ee(ns),ee(rt),ee(In),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var GR=class{constructor(o){this.injector=o,this.initConfig=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: initConfig","color: green;");try{n?typeof n!="string"?this.getService(y).catch("Error in initConfig: ","Apikey must be string."):n?.trim()?this.getService(Ue).setApiKey(n?.trim(),e):this.getService(y).catch("Error in initConfig: ","Apikey is not provided."):this.getService(y).catch("Error in initConfig: ","Apikey is not provided.")}catch(t){this.getService(y).catch("Error in initConfig: ",t)}},this.identify=(n,e,t)=>(this.getService(y).log("%c[WB] Calling FUNCTION: identify","color: green;"),new Promise((r,a)=>{try{typeof n=="object"&&(n=JSON.parse(JSON.stringify(n)));let s=this.getService(Rt).getApiKey(),c=G0(s,n.userId);if(t?.ha||this.getService(et).trackEvent(Z.Events.Core.IDENTIFY,{apiKey:s,clientUserId:n.userId,snippylyUserId:c,forceReset:e?.forceReset,user:this.getService(Ue).getUserWithoutContacts(n),source:"client",fromProvider:t?.fromProvider},!0,c,n?.userId),!(n&&n.userId))this.getService(y).catch("Error in identify: ","Missing userId in config data."),e?.throwError?a("Missing userId in config data."):r(null);else if(typeof n.userId!="string")this.getService(y).catch("Error in identify: ","userId must be string."),e?.throwError?a("userId must be string."):r(null);else if(n?.groupId&&typeof n?.groupId!="string")this.getService(y).catch("Error in identify: ","groupId must be string."),e?.throwError?a("groupId must be string."):r(null);else{if(n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let g=n.groupId;n.clientGroupId=g,n.groupId=Et(g)}if(n?.organizationId){let g=n.organizationId;n.clientOrganizationId=g,n.organizationId=Et(g)}delete n.isAdmin;let p=U.REGEX_URL_FOR_USER_NAME;n?.name&&p.test(n?.name)&&(n.name=n.name?.split(".")?.slice(0,-1)?.join(".")),n.clientUserName=n.name,n?.name&&n?.name?.length>30&&(n.name=n.name.slice(0,30)),this.getService(Ue).initializeClient(n,e||{},new Date().getTime(),void 0,"external").then(g=>{let f;try{g&&(f=JSON.parse(JSON.stringify(g)))}catch{}r(f)}).catch(g=>{this.getService(y).catch("Error in identify: ",g),e?.throwError?a(g):r(null)})}}catch(s){this.getService(y).catch("Error in identify: ",s),e?.throwError?a(s):r(null)}})),this.updateUser=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{if(this.getService(y).catch("DEPRECATED: ","'updateUser' method is deprecated."),n&&typeof n=="object"){if(n=JSON.parse(JSON.stringify(n)),n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let e=n.groupId;n.clientGroupId=e,n.groupId=Et(e)}delete n.isAdmin,this.getService(Ue).updateUser(n)}else this.getService(y).catch("Error in updateUser: ","Invalid user object provided.")}catch(e){this.getService(y).catch("Error in updateUser: ",e)}},this.signOutUser=n=>(this.getService(y).log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),n?.ha||this.trackEvent(Z.Events.Core.SIGN_OUT_USER_TRIGGERED),new Promise((e,t)=>Q(this,null,function*(){try{yield this.getService(Ue).signOutUser("external"),e(null)}catch(r){this.getService(y).catch("Error in signOutUser: ",r),e(null)}}))),this.setDocument=(n,e,t,r)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocument","color: green;");try{r?.ha||this.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,documentMetadata:e,methodName:"setDocument",source:"external"}}),n&&n.trim()?(e&&(typeof e=="object"?e=JSON.parse(JSON.stringify(e)):this.getService(y).catch("Error in setDocument: ","Invalid documentMetadata provided.")),yield this.getService(rt).setDocument({documentId:n,documentMetadata:e,options:t,source:"external"})):this.getService(y).catch("Error in setDocument: ","Invalid document id provided.")}catch(a){this.getService(y).catch("Error in setDocument: ",a)}}),this.setDocumentId=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocumentId","color: green;");try{if(t?.ha||this.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,organizationId:e,methodName:"setDocumentId",source:"external"}}),n&&n.trim())return yield this.getService(rt).setDocumentId({documentId:n,clientOrganizationId:e,source:"external"});this.getService(y).catch("Error in setDocumentId: ","Invalid document id provided.")}catch(r){this.getService(y).catch("Error in setDocumentId: ",r)}}),this.setDocuments=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocuments","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:n,options:e,methodName:"setDocuments",source:"external"}}),typeof n=="object"&&n instanceof Array?(n=JSON.parse(JSON.stringify(n)),n=n.filter(r=>typeof r=="object"&&r!==null&&r.id?.trim()),n.length?yield this.getService(rt).setDocuments({documents:n,options:e,source:"external"}):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")}catch(r){this.getService(y).catch("Error in setDocuments: ",r)}}),this.setRootDocument=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootDocument","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,{payload:{document:n,methodName:"setRootDocument",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(rt).setRootDocument({document:n,source:"external"}):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")}catch(t){this.getService(y).catch("Error in setRootDocument: ",t)}}),this.unsetDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{n?.ha||this.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(rt).unsetDocumentId({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocumentId: ",e)}},this.unsetDocuments=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{n?.ha||this.trackEvent(Z.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(rt).unsetDocuments({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocuments: ",e)}},this.fetchDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchDocuments","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:n}}),this.getService(qI).fetchDocuments(n)}catch(t){return this.getService(y).catch("Error in fetchDocuments: ",t),Promise.resolve({data:null})}},this.updateDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateDocuments","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:n}}),this.getService(qI).updateDocuments(n)}catch(t){return this.getService(y).catch("Error in updateDocuments: ",t),Promise.resolve({data:null})}},this.updateLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateLocations","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:n}}),this.getService(qI).updateLocations(n)}catch(t){return this.getService(y).catch("Error in updateLocations: ",t),Promise.resolve({data:null})}},this.fetchFolders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchFolders","color: green;");try{return e?.ha||this.trackEvent(Z.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:n}}),this.getService(qI).fetchFolders(n)}catch(t){return this.getService(y).catch("Error in fetchFolders: ",t),Promise.resolve({data:null})}},this.setUserDataProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setUserDataProvider","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(Fn).setUserDataProvider(n)}catch(t){this.getService(y).catch("Error in setUserDataProvider: ",t)}},this.setDataProviders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setDataProviders","color: green;");try{if(e?.ha||this.trackEvent(Z.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),n.comment&&this.getService(Ks).setCommentAnnotationDataProvider(n.comment),n.user&&this.getService(Fn).setUserDataProvider(n.user),n.reaction&&this.getService(pm).setReactionAnnotationDataProvider(n.reaction),n.attachment)if(n.comment)this.getService(Kg).setAttachmentDataProvider(n.attachment);else throw new Error("Comment data provider is required for attachment data provider")}catch(t){this.getService(y).catch("Error in setDataProviders: ",t)}},this.setPermissionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setPermissionProvider","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_PERMISSION_PROVIDER_TRIGGERED),this.getService(bs).setPermissionProvider(n)}catch(t){this.getService(y).catch("Error in setPermissionProvider: ",t)}},this.setEncryptionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_ENCRYPTION_PROVIDER_TRIGGERED),this.getService(Rt).setEncryptionProvider(n)}catch(t){this.getService(y).catch("Error in setEncryptionProvider: ",t)}},this.setVeltAuthProvider=n=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{return yield this.getService(Ue).setVeltAuthProvider(n)}catch(e){return this.getService(y).catch("Error in setVeltAuthProvider: ",e),null}}),this.getDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocumentId","color: green;");try{return n?.ha||this.trackEvent(Z.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(rt).getDocumentId()}catch(e){this.getService(y).catch("Error in getDocumentId: ",e)}},this.setLocation=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocation","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,appendLocation:e,methodName:"setLocation",source:"external"}}),n&&typeof n=="object"?e?this.getService(rt).addLocation({location:n,source:"external"}):yield this.getService(rt).setLocation({location:n,source:"external"}):this.getService(y).catch("Error in setLocation: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocation: ",r)}}),this.setRootLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootLocation","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:n,methodName:"setRootLocation",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(rt).setRootLocation({location:n,source:"external"}):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")}catch(t){this.getService(y).catch("Error in setRootLocation: ",t)}}),this.setLocations=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocations","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:n,options:e,methodName:"setLocations",source:"external"}}),n&&Array.isArray(n)?yield this.getService(rt).setLocations({locations:n,options:e,source:"external"}):this.getService(y).catch("Error in setLocations: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocations: ",r)}}),this.addLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addLocation","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,methodName:"addLocation",source:"external"}}),n&&typeof n=="object"?this.getService(rt).addLocation({location:n,source:"external"}):this.getService(y).catch("Error in addLocation: ","Invalid location params provided.")}catch(t){this.getService(y).catch("Error in addLocation: ",t)}}),this.setScrollableElementsIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setScrollableElementsIds","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:n}}),n?this.getService(Le).setScrollableElementsIds(n):this.getService(y).catch("Error in setScrollableElementsIds: ","Invalid ids provided.")}catch(t){this.getService(y).catch("Error in setScrollableElementsIds: ",t)}},this.removeLocation=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocation","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:n},methodName:"removeLocation",source:"external"}),this.getService(rt).removeLocation({location:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocation: ",t)}},this.removeLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocations","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:n},methodName:"removeLocations",source:"external"}),this.getService(rt).removeLocations({locations:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocations: ",t)}},this.unsetLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:n},methodName:"unsetLocationIds",source:"external"}),this.getService(rt).unsetLocationIds(n,"external")}catch(t){this.getService(y).catch("Error in unsetLocationIds: ",t)}},this.excludeLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: excludeLocationIds","color: green;");try{e?.ha||this.trackEvent(Z.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:n}}),typeof n=="object"&&n instanceof Array&&(n=n.filter(t=>typeof t=="string"),this.getService(rt).excludeLocationIds(n))}catch(t){this.getService(y).catch("Error in excludeLocationIds: ",t)}},this.updateContactList=(n,e,t)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateContactList","color: green;");try{t?.ha||this.trackEvent(Z.Events.Core.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:n,config:e}}),typeof n=="object"&&n instanceof Array&&(!e||e&&typeof e=="object")&&(n=JSON.parse(JSON.stringify(n)),this.getService(yi).updateContactList(n,e))}catch(r){this.getService(y).catch("Error in updateContactList: ",r)}},this.removeScrollableElementsIds=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeScrollableElementsIds","color: green;");try{n?.ha||this.trackEvent(Z.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Le).removeScrollableElementsIds()}catch(e){this.getService(y).catch("Error in removeScrollableElementsIds: ",e)}},this.getPresenceElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getPresenceElement","color: green;");try{let e=new FR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getPresenceElement: ",e),null}},this.getCursorElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCursorElement","color: green;");try{let e=new wR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCursorElement: ",e),null}},this.getCommentElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCommentElement","color: green;");try{let e=new SR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCommentElement: ",e),null}},this.getTagElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getTagElement","color: green;");try{let e=new $R(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getTagElement: ",e),null}},this.getSelectionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getSelectionElement","color: green;");try{let e=new jR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getSelectionElement: ",e),null}},this.getRecorderElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRecorderElement","color: green;");try{let e=new BR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRecorderElement: ",e),null}},this.getContactElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getContactElement","color: green;");try{let e=new bR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getContactElement: ",e),null}},this.getRewriterElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRewriterElement","color: green;");try{let e=new UR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRewriterElement: ",e),null}},this.getHuddleElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getHuddleElement","color: green;");try{let e=new AR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getHuddleElement: ",e),null}},this.getLiveStateSyncElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getLiveStateSyncElement","color: green;");try{let e=new kR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getLiveStateSyncElement: ",e),null}},this.getArrowElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getArrowElement","color: green;");try{let e=new vR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getArrowElement: ",e),null}},this.getViewsElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getViewsElement","color: green;");try{let e=new HR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getViewsElement: ",e),null}},this.getNotificationElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getNotificationElement","color: green;");try{let e=new NR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getNotificationElement: ",e),null}},this.getAutocompleteElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAutocompleteElement","color: green;");try{let e=new _R(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAutocompleteElement: ",e),null}},this.getDocElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocElement","color: green;");try{let e=new OR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getDocElement: ",e),null}},this.getAreaElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAreaElement","color: green;");try{let e=new hR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAreaElement: ",e),null}},this.getReactionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getReactionElement","color: green;");try{let e=new LR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getReactionElement: ",e),null}},this.getCrdtElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCrdtElement","color: green;");try{let e=new IR(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCrdtElement: ",e),null}},this.getMetadata=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(Z.Events.Core.GET_METADATA_TRIGGERED),this.getService(Zs).getGlobalMetadata()}catch(e){return this.getService(y).catch("Error in getMetadata: ",e),null}}),this.fetchDebugInfo=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(Z.Events.Core.FETCH_DEBUG_INFO_TRIGGERED),this.getService(Zs).getDebugInfo()}catch(e){return this.getService(y).catch("Error in fetchDebugInfo: ",e),null}}),this.getDebugInfo=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_DEBUG_INFO_TRIGGERED),this.getService(Zs).getDebugInfo$()}catch(e){return this.getService(y).catch("Error in getDebugInfo: ",e),se(null)}},this.disableFeatures=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:n}}),this.getService(Rt).disableFeatures(n)}catch(t){this.getService(y).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:n}}),this.getService(Ye).setDarkMode(n)}catch(t){this.getService(y).catch("Error in setDarkMode: ",t)}},this.enableLogs=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Rt).enableLogs()}catch(e){this.getService(y).catch("Error in enableLogs: ",e)}},this.disableLogs=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Rt).disableLogs(n)}catch(t){this.getService(y).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(In).isUserAllowed$()}catch(e){return this.getService(y).catch("Error in isUserAllowed$: ",e),se(!1)}},this.getUser=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.GET_USER_TRIGGERED);let e=this.getService(Ue).getUser();if(e&&typeof e=="object"){let t=JSON.parse(JSON.stringify(e));return t?.clientOrganizationId&&(t.organizationId=t.clientOrganizationId,delete t.clientOrganizationId),t?.clientGroupId&&(t.groupId=t.clientGroupId,delete t.clientGroupId),delete t.userSnippylyId,t}else return null}catch(e){return this.getService(y).catch("Error in getUser: ",e),null}},this.getCurrentUser=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_CURRENT_USER_TRIGGERED),this.getService(Ue).getUser$().pipe(de(e=>Er(e)))}catch(e){return this.getService(y).catch("Error in getCurrentUser: ",e),se(null)}},this.getHeartbeat=(n,e)=>{try{return e?.ha||this.trackEvent(Z.Events.Core.GET_HEARTBEAT_TRIGGERED),this.getService(MR).getHeartbeat(n)}catch(t){return this.getService(y).catch("Error in getHeartbeat: ",t),se({data:null})}},this.getUserRole$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(In).getRole$()}catch(e){return this.getService(y).catch("Error in getUserRole$: ",e),se("")}},this.getUserPermissions=(n,e)=>Q(this,null,function*(){try{return e?.ha||this.trackEvent(Z.Events.Core.GET_USER_PERMISSIONS_TRIGGERED,{payload:{request:n,source:"external"}}),this.getService(bs).getUserPermissions(n)}catch(t){return this.getService(y).catch("Error in getUserPermissions$: ",t),{}}}),this.getFeaturesAccessLevelIam$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(In).getFeaturesAccessLevel$()}catch(e){return this.getService(y).catch("Error in getFeaturesAccessLevel$: ",e),se(void 0)}},this.isPlanExpired$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.IS_PLAN_EXPIRED_TRIGGERED),this.getService(Ue).isPlanExpired$()}catch(e){return this.getService(y).catch("Error in isPlanExpired$: ",e),se(!1)}},this.getCustomerMetadata$=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(rt).getCustomerMetadata$()}catch(e){return this.getService(y).catch("Error in getCustomerMetadata$: ",e),se(null)}},this.getDocumentMetadata=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(rt).getDocumentMetadata$()}catch(e){return this.getService(y).catch("Error in getDocumentMetadata: ",e),se(null)}},this.getVeltInitState=n=>{try{return n?.ha,this.getService(zR).getVeltInitState$()}catch(e){return this.getService(y).catch("Error in getVeltInitState: ",e),se(void 0)}},this.removeVeltContent=(n,e)=>{try{return e?.ha||this.trackEvent(Z.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Le).removeSnippylyContent(n)}catch(t){return this.getService(y).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(y).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Le).setCustomCss(n)}catch(t){this.getService(y).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:n}}),this.getService(Ml).setLanguage(n)}catch(t){this.getService(y).catch("Error in setLanguage: ",t)}},this.setTranslations=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:n}}),this.getService(Ml).setTranslations(n)}catch(t){this.getService(y).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ml).enableAutoTranslation()}catch(e){this.getService(y).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ml).disableAutoTranslation()}catch(e){this.getService(y).catch("Error in disableAutoTranslation: ",e)}},this.sf=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SF_TRIGGERED,{payload:{value:n}}),n?(document.querySelector(U.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(U.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Rt).setSF(n):this.getService(Rt).setSF(n)}catch(t){this.getService(y).catch("Error in sf: ",t)}},this.st=(n,e)=>{try{e?.ha,this.getService(Rt).setSdkType(n)}catch(t){this.getService(y).catch("Error in st: ",t)}},this.getService=n=>this.injector.get(n),this.on=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return e?.ha,this.getService(ns).onAction(n)}catch(t){return this.getService(y).catch("Error in on: ",t),se(null)}},this.setUiState=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:n}}),this.getService(rt).setUIState(n)}catch(t){this.getService(y).catch("Error in setUiState: ",t)}},this.getUiState=n=>{try{return n?.ha||this.trackEvent(Z.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(rt).getUIState$()}catch(e){return this.getService(y).catch("Error in getUiState: ",e),se({})}},this.enableSafeEval=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.ENABLE_SAFE_EVAL_TRIGGERED),this.getService(Rt).enableSafeEval()}catch(e){this.getService(y).catch("Error in enableSafeEval: ",e)}},this.disableSafeEval=n=>{try{n?.ha||this.trackEvent(Z.Events.Core.DISABLE_SAFE_EVAL_TRIGGERED),this.getService(Rt).disableSafeEval()}catch(e){this.getService(y).catch("Error in disableSafeEval: ",e)}},this.resetVeltButtonState=(n,e)=>{try{e?.ha||this.trackEvent(Z.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:n}}),this.getService(RC).resetVeltButtonState(n)}catch(t){this.getService(y).catch("Error in resetVeltButtonState: ",t)}},this.getService(y).log("%c[WB] Creating CLASS: Snippyly","color: blue;")}trackEvent(o,n={},e=!0){try{n||(n={}),n=T(E({},n),{source:"external"}),this.getService(et).trackAuthenticatedEvent(o,n,e)}catch(t){this.getService(y).catch("Error in _trackEvent: ",t);return}}};var Hpe=(()=>{let o=class o{constructor(){this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-external-styles"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,r){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}.cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}.cdk-overlay-dark-backdrop{background:#00000052}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}html{--velt-base-rem-unit: 1}velt-wireframe{display:none!important}:root{--legacy-velt-neutral-0: #000000;--legacy-velt-neutral-1: #141416;--legacy-velt-neutral-2: #23262F;--legacy-velt-neutral-3: #353945;--legacy-velt-neutral-4: #777E90;--legacy-velt-neutral-5: #B1B5C3;--legacy-velt-neutral-6: #E6E8EC;--legacy-velt-neutral-7: #F4F5F6;--legacy-velt-neutral-8: #FCFCFD;--legacy-velt-neutral-9: #FFFFFF;--legacy-velt-dark-1: #141416;--legacy-velt-dark-2: #222226;--legacy-velt-dark-3: #303034;--legacy-velt-dark-4: #404044;--legacy-velt-dark-5: #59595F;--legacy-velt-dark-6: #80808A;--legacy-velt-dark-7: #91919C;--legacy-velt-dark-8: #E5E5E9;--legacy-velt-primary-color: var(--legacy-velt-dark-1);--legacy-velt-primary-dark-color: var(--legacy-velt-dark-8);--legacy-velt-secondary-color: var(--legacy-velt-neutral-4);--legacy-velt-secondary-dark-color: var(--legacy-velt-dark-7);--legacy-velt-bg-color: var(--legacy-velt-neutral-8);--legacy-velt-bg-dark-color: var(--legacy-velt-dark-1);--legacy-velt-border-color: var(--legacy-velt-neutral-6);--legacy-velt-border-dark-color: var(--legacy-velt-dark-3);--legacy-velt-grey-2-color: #D4D6DF;--legacy-velt-grey-2-dark-color: var(--legacy-velt-dark-4);--legacy-velt-grey-4-color: #989898;--legacy-velt-grey-4-dark-color: var(--legacy-velt-dark-6);--legacy-velt-status-open-color: #625DF5;--legacy-velt-status-in-progress-color: #ECB000;--legacy-velt-status-resolved-color: #00C48C;--legacy-velt-purple: #625DF5;--legacy-velt-orange: #ECB000;--legacy-velt-green: #0DCF82;--legacy-velt-blue: #0d6efd;--legacy-velt-primary-btn-color: var(--legacy-velt-purple);--legacy-velt-hyperlink-color: var(--legacy-velt-purple);--legacy-velt-grey-btn-color: var(--legacy-velt-neutral-5);--legacy-velt-header-btn-color: var(--legacy-velt-neutral-3);--legacy-velt-dropdown-item-color: var(--legacy-velt-neutral-2);--legacy-velt-avatar-size: 2rem;--velt-default-font-family: sans-serif;--Icon-Size-Small: 12px;--Icon-Size-Medium: 16px;--Icon-Size-Large: 24px}:root[data-velt-theme=dark]{--legacy-velt-primary-color: var(--legacy-velt-primary-dark-color);--legacy-velt-secondary-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-border-color: var(--legacy-velt-border-dark-color);--legacy-velt-grey-2-color: var(--legacy-velt-grey-2-dark-color);--legacy-velt-grey-4-color: var(--legacy-velt-grey-4-dark-color);--legacy-velt-primary-btn-color: var(--legacy-velt-border-dark-color);--legacy-velt-hyperlink-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-grey-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-header-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-dropdown-item-color: var(--legacy-velt-secondary-dark-color)}:root{--legacy-velt-tool-padding: 6px;--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-3);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}:root[data-velt-theme=dark],:root:not(data-velt-theme) velt-comment-tool[dark],:root:not(data-velt-theme) velt-sidebar-button[dark],:root:not(data-velt-theme) velt-arrow-tool[dark],:root:not(data-velt-theme) velt-reaction-tool[dark],:root:not(data-velt-theme) velt-huddle-tool[dark],:root:not(data-velt-theme) velt-recorder-tool[dark],:root:not(data-velt-theme) velt-user-invite-tool[dark],:root:not(data-velt-theme) velt-user-request-tool[dark],:root:not(data-velt-theme) velt-notifications-tool[dark],:root:not(data-velt-theme) app-recorder-all-tool-menu[dark],:root:not(data-velt-theme) snippyly-recording-preview-steps-dialog[dark],:root:not(data-velt-theme) snippyly-recorder-control-panel-internal[dark],:root:not(data-velt-theme) snippyly-recorder-player-internal[dark],:root:not(data-velt-theme) velt-recorder-player-expanded[dark]:root:not(data-velt-theme) app-transcription-panel[dark]{--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-2);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-5);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-user-avatar,velt-user-avatar{--legacy-velt-user-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-user-avatar-initial-font-size: .8}snippyly-follow-overlay,velt-follow-overlay{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-color);--legacy-velt-follow-overlay-btn-color: var(--legacy-velt-neutral-6);--legacy-velt-follow-overlay-btn-hover-color: var(--legacy-velt-neutral-5);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-color)}snippyly-follow-overlay[dark],velt-follow-overlay[dark]{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-dark-color);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-dark-color)}snippyly-cursor,velt-cursor{--legacy-velt-cursor-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-cursor-video-size: 4.2rem}snippyly-reaction-tool,velt-reaction-tool,app-reaction-tool{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #8F95B2;--legacy-velt-reaction-tool-hover-bg-color: #EAE8F9;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-reaction-tool[dark],velt-reaction-tool[dark],app-reaction-tool[dark]{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #EAE8F9;--legacy-velt-reaction-tool-hover-bg-color: #8F95B2;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}velt-view-analytics-dialog{--legacy-velt-view-analytics-dialog-bg-color: #FFF;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(0, 0, 0, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #111;--legacy-velt-view-analytics-dialog-total-views-text-color: #625DF5;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: #F4F3FF;--legacy-velt-view-analytics-dialog-user-name-color: #4C5366;--legacy-velt-view-analytics-dialog-user-timestamp-color: #959595;--legacy-velt-view-analytics-dialog-back-btn-color: #8F95B2}velt-view-analytics-dialog[dark]{--legacy-velt-view-analytics-dialog-bg-color: #131229;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(255, 255, 255, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #FFF;--legacy-velt-view-analytics-dialog-total-views-text-color: #9491F8;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: rgba(244, 243, 255, .06);--legacy-velt-view-analytics-dialog-user-name-color: #FFF;--legacy-velt-view-analytics-dialog-user-timestamp-color: rgba(255, 255, 255, .4)}velt-reaction-pin-tooltip-internal{--Surface-Neutral-0: #FFF;--Surface-Neutral-2: #F5F5F5;--Surface-Neutral-3: #F0F0F0;--Text-Neutral-0: #0A0A0A;--Text-Neutral-3: #292929;--Text-Neutral-5: #525252;--Text-Neutral-9: #999;--Text-Brand-Primary: #625DF5}velt-reaction-pin-tooltip-internal[dark]{--Surface-Neutral-0: #0F0F0F;--Surface-Neutral-2: #1F1F1F;--Surface-Neutral-3: #2F2F2F;--Text-Neutral-0: #FFF;--Text-Neutral-3: #E0E0E0;--Text-Neutral-5: #C2C2C2;--Text-Neutral-9: #ADADAD;--Text-Brand-Primary: #9491F8}:root{--velt-border-radius-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-3xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-full: calc((5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xs: calc((.625rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xs: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-sm: calc((.875rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-md: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-lg: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xl: calc((1.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-light-mode-green: #0DCF82;--velt-light-mode-magenta: #A259FE;--velt-light-mode-amber: #FF7162;--velt-light-mode-purple: #625DF5;--velt-light-mode-cyan: #4BC9F0;--velt-light-mode-orange: #FE965C;--velt-light-mode-black: #080808;--velt-light-mode-white: #FFFFFF;--velt-light-mode-gray: #EBEBEB;--velt-light-mode-error: #FF7162;--velt-light-mode-error-hover: #DE5041;--velt-light-mode-error-foreground: #FFFFFF;--velt-light-mode-error-light: #FFF4F2;--velt-light-mode-error-transparent: rgba(255, 113, 98, .08);--velt-light-mode-warning: #FFCD2E;--velt-light-mode-warning-hover: #C69400;--velt-light-mode-warning-foreground: #474747;--velt-light-mode-warning-light: #FFFBEE;--velt-light-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-light-mode-success: #198F65;--velt-light-mode-success-hover: #006B41;--velt-light-mode-success-foreground: #FFFFFF;--velt-light-mode-success-light: #EDF6F3;--velt-light-mode-success-transparent: rgba(25, 143, 101, .08);--velt-light-mode-accent: #625DF5;--velt-light-mode-accent-text: #625DF5;--velt-light-mode-accent-hover: #534FCF;--velt-light-mode-accent-foreground: #FFFFFF;--velt-light-mode-accent-light: #F2F2FE;--velt-light-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-light-mode-text-0: #0A0A0A;--velt-light-mode-text-1: #141414;--velt-light-mode-text-2: #1F1F1F;--velt-light-mode-text-3: #292929;--velt-light-mode-text-4: #3D3D3D;--velt-light-mode-text-5: #525252;--velt-light-mode-text-6: #666666;--velt-light-mode-text-7: #7A7A7A;--velt-light-mode-text-8: #858585;--velt-light-mode-text-9: #999999;--velt-light-mode-text-10: #B8B8B8;--velt-light-mode-text-11: #A3A3A3;--velt-light-mode-text-12: #8F8F8F;--velt-light-mode-background-0: #FFFFFF;--velt-light-mode-background-1: #FAFAFA;--velt-light-mode-background-2: #F5F5F5;--velt-light-mode-background-3: #F0F0F0;--velt-light-mode-background-4: #EBEBEB;--velt-light-mode-background-5: #E5E5E5;--velt-light-mode-background-6: #E0E0E0;--velt-light-mode-background-7: #DBDBDB;--velt-light-mode-background-8: #D6D6D6;--velt-light-mode-background-9: #D1D1D1;--velt-light-mode-background-10: #CCCCCC;--velt-light-mode-border-0: #FFFFFF;--velt-light-mode-border-1: #FAFAFA;--velt-light-mode-border-2: #F5F5F5;--velt-light-mode-border-3: #F0F0F0;--velt-light-mode-border-4: #EBEBEB;--velt-light-mode-border-5: #E5E5E5;--velt-light-mode-border-6: #E0E0E0;--velt-light-mode-border-7: #DBDBDB;--velt-light-mode-border-8: #D6D6D6;--velt-light-mode-border-9: #D1D1D1;--velt-light-mode-border-10: #CCCCCC;--velt-light-mode-background-transparent: rgba(255, 255, 255, .8);--velt-light-mode-border-transparent: rgba(0, 0, 0, .16);--velt-light-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-dark-mode-green: #0DCF82;--velt-dark-mode-magenta: #A259FE;--velt-dark-mode-amber: #FF7162;--velt-dark-mode-purple: #625DF5;--velt-dark-mode-cyan: #4BC9F0;--velt-dark-mode-orange: #FE965C;--velt-dark-mode-black: #080808;--velt-dark-mode-white: #FFFFFF;--velt-dark-mode-gray: #EBEBEB;--velt-dark-mode-error: #FF7162;--velt-dark-mode-error-hover: #DE5041;--velt-dark-mode-error-foreground: #FFFFFF;--velt-dark-mode-error-light: #FFF4F2;--velt-dark-mode-error-transparent: rgba(255, 113, 98, .08);--velt-dark-mode-warning: #FFCD2E;--velt-dark-mode-warning-hover: #C69400;--velt-dark-mode-warning-foreground: #474747;--velt-dark-mode-warning-light: #FFFBEE;--velt-dark-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-dark-mode-success: #198F65;--velt-dark-mode-success-hover: #006B41;--velt-dark-mode-success-foreground: #FFFFFF;--velt-dark-mode-success-light: #EDF6F3;--velt-dark-mode-success-transparent: rgba(25, 143, 101, .08);--velt-dark-mode-accent: #625DF5;--velt-dark-mode-accent-text: #9491F8;--velt-dark-mode-accent-hover: #534FCF;--velt-dark-mode-accent-foreground: #FFFFFF;--velt-dark-mode-accent-light: #F2F2FE;--velt-dark-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-dark-mode-text-0: #FFFFFF;--velt-dark-mode-text-1: #F5F5F5;--velt-dark-mode-text-2: #EBEBEB;--velt-dark-mode-text-3: #E0E0E0;--velt-dark-mode-text-4: #D6D6D6;--velt-dark-mode-text-5: #C2C2C2;--velt-dark-mode-text-6: #ADADAD;--velt-dark-mode-text-7: #8F8F8F;--velt-dark-mode-text-8: #7A7A7A;--velt-dark-mode-text-9: #666666;--velt-dark-mode-text-10: #525252;--velt-dark-mode-text-11: #474747;--velt-dark-mode-text-12: #3D3D3D;--velt-dark-mode-background-0: #0F0F0F;--velt-dark-mode-background-1: #1A1A1A;--velt-dark-mode-background-2: #1F1F1F;--velt-dark-mode-background-3: #242424;--velt-dark-mode-background-4: #292929;--velt-dark-mode-background-5: #2E2E2E;--velt-dark-mode-background-6: #333333;--velt-dark-mode-background-7: #383838;--velt-dark-mode-background-8: #3D3D3D;--velt-dark-mode-background-9: #424242;--velt-dark-mode-background-10: #474747;--velt-dark-mode-border-0: #0F0F0F;--velt-dark-mode-border-1: #1A1A1A;--velt-dark-mode-border-2: #1F1F1F;--velt-dark-mode-border-3: #242424;--velt-dark-mode-border-4: #292929;--velt-dark-mode-border-5: #2E2E2E;--velt-dark-mode-border-6: #333333;--velt-dark-mode-border-7: #383838;--velt-dark-mode-border-8: #3D3D3D;--velt-dark-mode-border-9: #424242;--velt-dark-mode-border-10: #474747;--velt-dark-mode-background-transparent: rgba(0, 0, 0, .8);--velt-dark-mode-border-transparent: rgba(255, 255, 255, .16);--velt-dark-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-comment-pin-z-index: 2147483557;--velt-arrow-z-index: 2147483557;--velt-recorder-player-z-index: 2147483557;--velt-cursor-z-index: 2147483647;--velt-persistent-comment-frame-z-index: 2147483647;--velt-toast-popup-z-index: 2147483647;--velt-live-state-sync-overlay-z-index: 2147483647;--velt-follow-mode-overlay-z-index: 2147483647;--velt-comments-minimap-z-index: 2147483637;--velt-global-overlay-z-index: 2147483637}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}.cdk-overlay-container{z-index:var(--velt-global-overlay-z-index)!important}.cdk-overlay-container .velt-overlay-panel.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.velt-overlay-panel{background-color:transparent;border:none;box-shadow:none}.velt-overlay-panel.mat-mdc-tooltip-panel .mat-mdc-tooltip{color:#fff;background-color:#0b0b0b;border:1px solid #eeeeee;border-radius:4px;padding:8px 12px;font-size:14px}.velt-menu.mat-mdc-menu-panel{box-shadow:none}video.flip{transform:rotateY(180deg);-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}body[data-velt-huddle-on-cursor-mode] .cdk-overlay-container{z-index:calc(var(--velt-global-overlay-z-index, 2147483637) - 1)!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor){cursor:none!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor) *{cursor:none!important}body.snippyly-add-comment-mode,body.snippyly-add-comment-mode *{-webkit-user-select:none!important;user-select:none!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true][data-velt-iframe-container-static=true]{position:relative!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true]:before{content:""!important;position:absolute!important;inset:0!important;z-index:1!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] [data-velt-element=true]:not(snippyly-comment-text-portal):not(velt-recorder-control-panel):not([data-velt-screen-recorder-panel=true]){display:none!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight{color:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:inherit!important;background-color:inherit!important;cursor:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{background-color:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight snippyly-comment-text-portal,body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight velt-comment-text-portal{font-family:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-annotation-number{display:none!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)){opacity:1!important;visibility:visible!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)) snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{opacity:.2!important}[data-snippyly-comment-pin-host][data-snippyly-comment-pin-host-static],[data-snippyly-tag-pin-host][data-snippyly-tag-pin-host-static],[data-snippyly-recorder-pin-host][data-snippyly-recorder-pin-host-static],[data-snippyly-arrow-pin-host][data-snippyly-arrow-pin-host-static],[data-snippyly-area-pin-host][data-snippyly-area-pin-host-static],[data-velt-comment-pin-host][data-velt-comment-pin-host-static],[data-velt-tag-pin-host][data-velt-tag-pin-host-static],[data-velt-recorder-pin-host][data-velt-recorder-pin-host-static],[data-velt-arrow-pin-host][data-velt-arrow-pin-host-static],[data-velt-area-pin-host][data-velt-area-pin-host-static]{position:relative}[data-velt-comment-pin-host][data-velt-comment-pin-active=true],[data-velt-area-pin-host][data-velt-area-pin-active=true]{opacity:1!important;visibility:visible!important}.s-display-none,.velt-display-none{display:none!important}.s-flex,.velt-display-flex{display:flex!important}.velt-items-center{align-items:center!important}.s-background-blur-1{-webkit-backdrop-filter:blur(4px)!important;backdrop-filter:blur(4px)!important}.s-background-blur-2{-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.s-background-blur-3{-webkit-backdrop-filter:blur(12px)!important;backdrop-filter:blur(12px)!important}.s-background-blur-4{-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}.s-tooltip{position:relative!important}.s-tooltip .s-tooltiptext{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:120%!important;background-color:var(--legacy-velt-bg-color);border:1px solid var(--legacy-velt-border-color);color:var(--legacy-velt-primary-color)!important;text-align:left!important;padding:.5em .75em!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:2em!important;box-shadow:var(--legacy-velt-box-shadow)!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important;left:50%!important;transform:translate(-50%)!important}.s-tooltip .s-tooltiptext:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;border-left:1px solid var(--legacy-velt-border-color);border-top:1px solid var(--legacy-velt-border-color);background-color:var(--legacy-velt-bg-color);border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important}.s-tooltip .s-tooltiptext:before{content:" ";position:absolute;top:0;left:50%;width:24px;height:24px;transform:translate(-50%,-41%);background:transparent}.s-tooltip .s-tooltiptext.left{top:50%!important;right:120%!important;transform:translateY(-50%)!important}.s-tooltip .s-tooltiptext.left:after{transform:translate(41%,-50%) rotate(45deg)!important;transform-origin:center!important;left:unset!important;right:0!important;top:50%!important}.s-tooltip .s-tooltiptext.left.top{top:100%!important;transform:translateY(-45%)!important}.s-tooltip .s-tooltiptext.left.top:after{transform:translate(41%,66%) rotate(45deg)!important;top:0!important}.s-tooltip:hover .s-tooltiptext{visibility:visible!important;opacity:1!important}.s-tooltip-light .s-tooltiptext{background-color:#fff!important;color:#000!important;box-shadow:0 2px 8px -2px #9f9f9f!important}.s-tooltip-light .s-tooltiptext:after{background-color:#fff!important}.s-tooltip-link{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-cursor-pointer,.velt-cursor-pointer{cursor:pointer!important}.s-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;transform:translateZ(0);backface-visibility:hidden;perspective:1000px}@keyframes 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)}}app-render-timer-wrapper{width:100%;height:100%}velt-comment-text[comment-available=true]{color:var(--Constant-Warning---Text, #E2A600);background-color:#e2a6001a;border-bottom:1px solid #E2A600}
|
|
519
519
|
`],encapsulation:2,changeDetection:0});let i=o;return i})();var fm=(()=>{let o=class o{constructor(e){this.loggingService=e,this.toasts$=new ve([])}setToast(e){try{e.id||(e.id=Math.random()),this.toasts$.next([...this.toasts$.value,e]),e.duration&&e.duration>0&&Tc(e.duration).pipe(ot(1)).subscribe(()=>{this.removeToast(e)},t=>{this.loggingService.catch("Error in ToastService setToast timer subscription: ",t)})}catch(t){this.loggingService.catch("Error in ToastService setToast: ",t)}}removeToast(e){try{this.toasts$.next(this.toasts$.value.filter(t=>t.id!==e.id))}catch(t){this.loggingService.catch("Error in ToastService removeToast: ",t)}}getToasts$(){return this.toasts$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function oLe(i,o){i&1&&(le(),_(0,"svg",6),w(1,"path",7),b())}function rLe(i,o){i&1&&(le(),_(0,"svg",6),w(1,"path",8)(2,"path",9),b())}function aLe(i,o){if(i&1){let n=Y();_(0,"div",2),u(1,oLe,2,0,"svg",3)(2,rLe,3,0,"svg",3),te(3),P(4,"translate"),le(),_(5,"svg",4),W("click",function(){let t=F(n).$implicit,r=l();return L(r.removeToast(t))}),w(6,"path",5),b()()}if(i&2){let n=o.$implicit;d("@fade",!0),m(),d("ngIf",n.type==="success"),m(),d("ngIf",n.type==="error"),m(),_e(" ",M(4,4,n.message)," ")}}var zpe=(()=>{let o=class o{constructor(e,t,r){this.loggingService=e,this.toastService=t,this.elementRef=r,this.toasts=[],this.subscriptions=[];try{this.subscriptions.push(this.toastService.getToasts$().subscribe(a=>{this.toasts=a}))}catch(a){console.log(a)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}ngAfterViewInit(){try{setTimeout(()=>{this.moveToastTagToEnd()},5e3)}catch{}}moveToastTagToEnd(){try{let e=this.elementRef?.nativeElement;document.body.appendChild(e)}catch(e){this.loggingService.catch("Error in ToastPopupComponent moveToastTagToEnd: ",e)}}removeToast(e){this.toastService.removeToast(e)}};o.\u0275fac=function(t){return new(t||o)(h(y),h(fm),h(R))},o.\u0275cmp=O({type:o,selectors:[["velt-toast-popup"]],standalone:!1,decls:2,vars:1,consts:[[1,"s-notification-container"],["class","s-notification",4,"ngFor","ngForOf"],[1,"s-notification"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"s-last-item","s-notification-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","#E6E8EC"],["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","M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM17.7071 9.70711C18.0976 9.31658 18.0976 8.68342 17.7071 8.29289C17.3166 7.90237 16.6834 7.90237 16.2929 8.29289L11 13.5858L8.70711 11.2929C8.31658 10.9024 7.68342 10.9024 7.29289 11.2929C6.90237 11.6834 6.90237 12.3166 7.29289 12.7071L10.2929 15.7071C10.6834 16.0976 11.3166 16.0976 11.7071 15.7071L17.7071 9.70711Z","fill","#0DCF82"],["fill-rule","evenodd","clip-rule","evenodd","d","M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.29289 8.29289C8.68342 7.90237 9.31658 7.90237 9.70711 8.29289L12 10.5858L14.2929 8.29289C14.6834 7.90237 15.3166 7.90237 15.7071 8.29289C16.0976 8.68342 16.0976 9.31658 15.7071 9.70711L13.4142 12L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L12 13.4142L9.70711 15.7071C9.31658 16.0976 8.68342 16.0976 8.29289 15.7071C7.90237 15.3166 7.90237 14.6834 8.29289 14.2929L10.5858 12L8.29289 9.70711C7.90237 9.31658 7.90237 8.68342 8.29289 8.29289Z","fill","#FF7162"]],template:function(t,r){t&1&&(_(0,"div",0),u(1,aLe,7,6,"div",1),b()),t&2&&(m(),d("ngForOf",r.toasts))},dependencies:[bt,X,pe],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}.s-notification-container[_ngcontent-%COMP%]{position:fixed!important;top:5%!important;left:50%!important;transform:translate(-50%)!important;display:flex!important;justify-content:center!important;align-items:center!important;z-index:var(--velt-toast-popup-z-index)!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;flex-direction:column!important}.s-notification[_ngcontent-%COMP%]{display:flex!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit))!important;background:#23262f!important;color:#e6e8ec!important;width:calc((30rem + 0px) * var(--velt-base-rem-unit))!important;max-width:90vw!important;align-items:center!important}.s-last-item[_ngcontent-%COMP%]{margin-left:auto!important}.s-notification-close-btn[_ngcontent-%COMP%]{cursor:pointer!important}"],data:{animation:[cH("fade",[WM("false",em({opacity:0})),WM("true",em({opacity:1})),qM("false => true",[em({opacity:0}),GM(1e3,em({opacity:1}))]),qM("true => false",[GM(1e3,em({opacity:0}))])])]},changeDetection:0});let i=o;return i})();var XW=i=>({componentConfigSignal:i}),Gpe=(i,o)=>({condition:i,data:o}),lLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-single-editor-mode-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function cLe(i,o){i&1&&He(0)}function dLe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,cLe,1,0,"ng-container",4),b()),i&2){l(3);let n=me(2);m(),d("ngTemplateOutlet",n)}}function mLe(i,o){if(i&1&&(v(0),u(1,dLe,2,1,"velt-shadow-dom-internal",3),C()),i&2){let n=l().ngIf,e=l(),t=me(2);m(),d("ngIf",n.shadowDom&&!e.template)("ngIfElse",t)}}function pLe(i,o){if(i&1&&(v(0),u(1,mLe,2,2,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,Gpe,n.conditionSignal(),A(1,XW,n.componentConfigSignal)))}}function gLe(i,o){if(i&1&&(v(0),_(1,"div",8),w(2,"velt-single-editor-mode-panel-viewer-text",9)(3,"velt-single-editor-mode-panel-editor-text",9)(4,"velt-single-editor-mode-panel-countdown",9)(5,"velt-single-editor-mode-panel-request-access",9)(6,"velt-single-editor-mode-panel-reject-request",9)(7,"velt-single-editor-mode-panel-edit-here",9),b(),C()),i&2){let n=l(6);m(2),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)}}function uLe(i,o){if(i&1&&(v(0),u(1,gLe,8,6,"ng-container",7),C()),i&2){let n=l(3).ngIf,e=l(2);m(),d("veltDynamicTemplate",$(3,lLe,e.template,A(1,XW,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function hLe(i,o){if(i&1&&(_(0,"div",6),u(1,uLe,2,9,"ng-container",2),b()),i&2){let n=l(2).ngIf,e=l(2);ue("velt-single-editor-mode-panel-container-no-pointer",n.type==="editor")("no-pointer",n.type==="editor"),m(),d("veltIf",k(7,Gpe,e.conditionSignal(),A(5,XW,e.componentConfigSignal)))}}function fLe(i,o){if(i&1&&(v(0),u(1,hLe,2,10,"div",5),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.leaderName!==""||n.type==="editor")}}function vLe(i,o){if(i&1&&(v(0),u(1,fLe,2,1,"ng-container",1),C()),i&2){let n=o.ngIf;m(),d("ngIf",n.singleEditorMode)}}function CLe(i,o){if(i&1&&u(0,vLe,2,1,"ng-container",1),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var Sf=(()=>{let o=class o extends Je{set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(E({},r),{shadowDom:t}),r))}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent _shadowDom: ",t)}}constructor(e,t,r,a,s,c,p){super(e,s,void 0,void 0,void 0,c,a),this.elementRef=e,this.authService=t,this.liveStateService=r,this.loggingService=a,this.themeService=s,this.dynamicDataService=c,this.wireframeService=p,this.subscriptions=[],this.componentConfigSignal=Ee({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,editAccessRequested:!1,leaderName:"",type:"reader",requestEditorAccessCountdown:0,singleEditorLiveStateData:null,singleEditorConfig:null,isUserEditor:null,variant:this.variant,shadowDom:!0,requestEditorAccess:this.requestEditorAccess.bind(this),cancelEditorAccessRequest:this.cancelEditorAccessRequest.bind(this),rejectEditorAccessRequest:this.rejectEditorAccessRequest.bind(this),acceptEditorAccessRequest:this.acceptEditorAccessRequest.bind(this),editCurrentTab:this.editCurrentTab.bind(this)}),this.componentId="velt-single-editor-mode-panel";try{this.loggingService.log("%c[WB] Calling FUNCTION: SingleEditorModePanelComponent constructor","color: green;"),this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(g=>{this.componentConfigSignal.update(f=>T(E({},f),{singleEditorMode:g}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(g=>{this.componentConfigSignal.update(f=>T(E({},f),{defaultSingleEditorUIEnabled:g}))})),this.subscriptions.push(this.liveStateService.getSingleEditorModeConfig$().subscribe(g=>{this.componentConfigSignal.update(f=>T(E({},f),{singleEditorConfig:g}))})),this.subscriptions.push(this.liveStateService.isUserEditor$().subscribe(g=>{this.componentConfigSignal.update(f=>T(E({},f),{isUserEditor:g}))})),this.subscriptions.push(this.liveStateService.getSingleEditorLiveStateData$().subscribe(g=>{let f=this.componentConfigSignal().singleEditorLiveStateData?.requestEditorAccess?.user?.userId,I=g?.requestEditorAccess?.user?.userId;if(f&&I&&f!==I&&this.componentConfigSignal().requestEditorAccessCountdown&&this.removeRequestEditorAccessCountdown(),this.componentConfigSignal.update(D=>T(E({},D),{singleEditorLiveStateData:g})),g){this.componentConfigSignal.update(N=>T(E({},N),{leaderName:g?.editor?.name||g?.editor?.email||""}));let D=this.authService.getUser();D?.userId===g?.editor?.userId?this.componentConfigSignal.update(N=>T(E({},N),{type:"editor"})):this.componentConfigSignal.update(N=>T(E({},N),{type:"reader"})),D?.userId===g?.requestEditorAccess?.user?.userId&&g?.requestEditorAccess?.status==="pending"?this.componentConfigSignal.update(N=>T(E({},N),{editAccessRequested:!0})):this.componentConfigSignal.update(N=>T(E({},N),{editAccessRequested:!1})),this.componentConfigSignal().type==="editor"&&!this.componentConfigSignal().requestEditorAccessCountdown&&g?.requestEditorAccess?.status==="pending"?this.showRequestEditorAccessCountdown():this.removeRequestEditorAccessCountdown()}}))}catch(g){this.loggingService.catch("Error in SingleEditorModePanelComponent constructor: ",g)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-single-editor-mode-panel-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnDestroy: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(E({},r),{[t]:e[t].currentValue}),r))})}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnChanges: ",t)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent setupA11yAttributes:",e)}}showRequestEditorAccessCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showRequestEditorAccessCountdown","color: green;"),this.componentConfigSignal.update(e=>(e=T(E({},e),{requestEditorAccessCountdown:e.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||U.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME}),e)),this.interval=setInterval(()=>{this.componentConfigSignal.update(e=>T(E({},e),{requestEditorAccessCountdown:e.requestEditorAccessCountdown-1})),this.componentConfigSignal().requestEditorAccessCountdown<=0&&clearInterval(this.interval)},1e3)}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent showRequestEditorAccessCountdown: ",e)}}removeRequestEditorAccessCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeRequestEditorAccessCountdown","color: green;"),this.componentConfigSignal.update(e=>T(E({},e),{requestEditorAccessCountdown:0})),clearInterval(this.interval)}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent removeRequestEditorAccessCountdown: ",e)}}requestEditorAccess(){try{this.loggingService.log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;"),this.componentConfigSignal().editAccessRequested||this.liveStateService.requestEditorAccess().subscribe()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent requestEditorAccess: ",e)}}cancelEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;"),this.liveStateService.cancelEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent cancelEditorAccessRequest: ",e)}}acceptEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;"),this.liveStateService.acceptEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent acceptEditorAccessRequest: ",e)}}rejectEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;"),this.liveStateService.rejectEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent rejectEditorAccessRequest: ",e)}}editCurrentTab(){try{this.loggingService.log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;"),this.liveStateService.editCurrentTab()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent editCurrentTab: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(Ue),h(ki),h(y),h(Ye),h(S),h(ze))},o.\u0275cmp=O({type:o,selectors:[["velt-single-editor-mode-panel"]],inputs:{variant:"variant",_shadowDom:[0,"shadowDom","_shadowDom"]},standalone:!1,features:[V([S]),B,Ze],decls:3,vars:1,consts:[["liveStateSyncPanelRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["data-velt-ignore","","class","velt-single-editor-mode-panel-container single-editor-mode-panel-container",3,"velt-single-editor-mode-panel-container-no-pointer","no-pointer",4,"ngIf"],["data-velt-ignore","",1,"velt-single-editor-mode-panel-container","single-editor-mode-panel-container"],[4,"veltDynamicTemplate"],["data-velt-ignore","",1,"velt-single-editor-mode-panel","follow-dialog"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,pLe,2,6,"ng-container",1)(1,CLe,1,1,"ng-template",null,0,xe),t&2&&d("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)}[_nghost-%COMP%]:empty{display:none}[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-single-editor-mode-panel[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);display:flex;justify-content:center;align-items:center;gap:var(--velt-spacing-sm);width:fit-content;padding:var(--velt-spacing-sm) var(--velt-spacing-md);background-color:var(--velt-background-0);color:var(--velt-text-0);border-radius:var(--velt-border-radius-full);box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--velt-border-4)}.velt-single-editor-mode-panel-container.velt-single-editor-mode-panel-container-no-pointer[_ngcontent-%COMP%]{pointer-events:none}"],changeDetection:0});let i=o;return i})();function yLe(i,o){if(i&1&&(v(0),_(1,"div",1),w(2,"velt-single-editor-mode-panel",2),b(),C()),i&2){let n=l(2);m(2),d("variant",n.variant)}}function SLe(i,o){if(i&1&&(v(0),u(1,yLe,3,1,"ng-container",0),C()),i&2){let n=o.ngIf;m(),d("ngIf",n.singleEditorMode&&n.defaultSingleEditorUIEnabled)}}var Wpe=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,void 0,void 0,r,a),this.elementRef=e,this.themeService=t,this.dynamicDataService=r,this.loggingService=a,this.liveStateService=s,this.subscriptions=[],this.componentConfigSignal=Ee({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,variant:this.variant}),this.componentId="velt-live-state-sync-overlay";try{this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(c=>{this.componentConfigSignal.update(p=>T(E({},p),{singleEditorMode:c}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(c=>{this.componentConfigSignal.update(p=>T(E({},p),{defaultSingleEditorUIEnabled:c}))}))}catch(c){this.loggingService.catch("Error in LiveStateSyncOverlayComponent constructor: ",c)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",this.componentId),e.setAttribute("aria-modal","true")}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent setupA11yAttributes: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(Ye),h(S),h(y),h(ki))},o.\u0275cmp=O({type:o,selectors:[["snippyly-live-state-sync-overlay"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","",1,"velt-live-state-sync-overlay-container","live-state-sync-overlay-container"],[3,"variant"]],template:function(t,r){t&1&&u(0,SLe,2,1,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,Sf],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}.velt-live-state-sync-overlay-container{position:fixed;bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));left:50%;transform:translate(-50%);background-color:transparent;z-index:var(--velt-live-state-sync-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}
|
|
520
520
|
`],encapsulation:3,changeDetection:0});let i=o;return i})();var QW=(()=>{let o=class o{set signInButton(e){this.translateService.setLanguage(e)}set translations(e){try{let t=e;if(typeof e=="string"&&(t=JSON.parse(e)),!t||typeof t!="object")return;this.translateService.setTranslations(t)}catch(t){this.loggingService.catch("Error in AppComponent set translations: ",t)}}set _autoTranslation(e){let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.translateService.enableAutoTranslation():this.translateService.disableAutoTranslation()}onResize(e){this.setSnippylyViewportSize()}constructor(e,t,r,a,s,c,p,g,f,I){this.docService=e,this.domService=t,this.loggingService=r,this.viewportRuler=a,this.themeService=s,this.breakpointObserver=c,this.translateService=p,this.notificationService=g,this.veltService=f,this.injector=I,this.snippyly=new GR(this.injector),this.getSnippyly=new Me,this.subscriptions=[],this.veltElement=!0,this.loggingService.log("%c[WB] Creating CLASS: AppComponent","color: blue;");try{this.subscriptions.push(this.docService.getDocumentPaths$().subscribe(()=>{this.domService.removeScrollableElementsIds()},D=>{this.loggingService.catch("Error in AppComponent getDocumentPaths subscription:",D)})),this.updateDeviceType(),this.updateDeviceOrientation(),this.setVeltVersion()}catch(D){this.loggingService.catch("Error in AppComponent constructor:",D)}}ngOnInit(){}ngAfterViewInit(){try{this.domService.setDeviceInfo(),this.setSnippylyViewportSize(),this.getSnippyly.emit(this.snippyly),this.setSnippylyRemBaseUnit(),this.subscriptions.push(this.domService.onWindowResize$().subscribe(()=>{this.setSnippylyRemBaseUnit()})),this.themeService.updateListenerOnConfigChange()}catch(e){this.loggingService.catch("Error in App After view init: ",e)}}setVeltVersion(){try{window?.Velt?.version&&localStorage.setItem(U.LOCAL_STORAGE.VELT_VERSION,window.Velt.version)}catch(e){this.loggingService.catch("Error in AppComponent setVeltVersion: ",e)}}updateDeviceType(){try{Object.values(Vi).forEach(t=>{Yn.Breakpoints[t]=this.breakpointObserver.isMatched(t),this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(r=>{Yn.Breakpoints[t]=r.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceType: ",e)}}updateDeviceOrientation(){try{Object.values(j0).forEach(t=>{Yn.Orientations[t]=window.matchMedia(t).matches,this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(r=>{Yn.Orientations[t]=r.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceOrientation: ",e)}}observeHtmlTagChanges(){}setSnippylyRemBaseUnit(){try{let e=document.documentElement,t=window.getComputedStyle(e),r=16,a=+t.fontSize.replace("px",""),s=a?r/a:1;e.style.setProperty(U.VELT_BASE_REM_UNIT,s+"")}catch(e){this.loggingService.catch("Error in AppComponent setSnippylyRemBaseUnit: ",e)}}setSnippylyViewportSize(){try{setTimeout(()=>{let e=this.viewportRuler.getViewportSize(),t=document.documentElement;t.style.setProperty(U.VELT_VIEWPORT_WIDTH,e.width+"px"),t.style.setProperty(U.VELT_VIEWPORT_HEIGHT,e.height+"px")},100)}catch{}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.themeService.disablePrefersColorScheme()}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(rt),h(Le),h(y),h(Ya),h(Ye),h(Eo),h(Ml),h(vn),h(zR),h(Ct))},o.\u0275cmp=O({type:o,selectors:[["app-root"]],hostVars:1,hostBindings:function(t,r){t&1&&W("resize",function(s){return r.onResize(s)},Uy),t&2&&x("data-velt-element",r.veltElement)},inputs:{snippyly:"snippyly",signInButton:[0,"language","signInButton"],translations:"translations",_autoTranslation:[0,"autoTranslation","_autoTranslation"]},outputs:{getSnippyly:"getSnippyly"},standalone:!1,decls:3,vars:0,template:function(t,r){t&1&&w(0,"app-external-styles")(1,"velt-toast-popup")(2,"snippyly-live-state-sync-overlay")},dependencies:[Hpe,zpe,Wpe],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-highlight-user-text.velt-live-selection-on-text-default{background-color:var(--velt-selection-color, rgba(162, 89, 254, .5333333333))!important} .velt-live-selection-on-element-default{outline:2px solid var(--velt-selection-color, #a259fe)!important} .snippyly-highlight{outline:var(--legacy-velt-comment-pin-highlight, 2px dashed #a259fe)!important} [snippyly-highlight-preview=true]{outline:2px solid green!important} body.snippyly-add-comment-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-comment-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iIzYyNURGNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV8yMDMyXzIzNjgxIiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiLz4KPC9tYXNrPgo8cGF0aCBkPSJNMC4zNTI5NDEgMThDMC4xNTgwMTcgMTggLTYuOTA3MTVlLTA5IDE3Ljg0MiAtMS41NDI3NWUtMDggMTcuNjQ3MUwtMy45MzQwMmUtMDcgOUMtNi4xMDY3M2UtMDcgNC4wMjk0NCA0LjAyOTQ0IC0xLjc2MTMyZS0wNyA5IC0zLjkzNDAyZS0wN1YtMy45MzQwMmUtMDdDMTMuOTcwNiAtNi4xMDY3M2UtMDcgMTggNC4wMjk0NCAxOCA5VjlDMTggMTMuOTcwNiAxMy45NzA2IDE4IDkgMThMMC4zNTI5NDEgMThaIiBmaWxsPSIjMTQxNDE2Ii8+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMjAzMl8yMzY4MSkiLz4KPC9zdmc+Cg==) 0 31,auto} body.snippyly-add-tag-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-tag-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczpieD0iaHR0cHM6Ly9ib3h5LXN2Zy5jb20iPgogIDxlbGxpcHNlIHN0eWxlPSJzdHJva2U6IHJnYigwLCAwLCAwKTsgZmlsbDogcmdiKDE2MiwgODksIDI1NCk7IHBhaW50LW9yZGVyOiBmaWxsOyBzdHJva2Utd2lkdGg6IDBweDsiIGN4PSIxNiIgY3k9IjE2IiByeD0iMTYiIHJ5PSIxNiIvPgogIDxwYXRoIGQ9Ik0gOS4zMzMgMjIgQyA5LjMzMyAyMiA4IDIyIDggMjAuNjY3IEMgOCAxOS4zMzMgOS4zMzMgMTUuMzMzIDE2IDE1LjMzMyBDIDIyLjY2NyAxNS4zMzMgMjQgMTkuMzMzIDI0IDIwLjY2NyBDIDI0IDIyIDIyLjY2NyAyMiAyMi42NjcgMjIgTCA5LjMzMyAyMiBaIE0gMTYgMTQgQyAxOS4wNzkgMTQgMjEuMDA0IDEwLjY2NyAxOS40NjQgOCBDIDE4Ljc1IDYuNzYyIDE3LjQyOSA2IDE2IDYgQyAxMi45MjEgNiAxMC45OTYgOS4zMzMgMTIuNTM2IDEyIEMgMTMuMjUgMTMuMjM3IDE0LjU3MSAxNCAxNiAxNCBaIiBzdHlsZT0iZmlsbDogcmdiKDI1NSwgMjU1LCAyNTUpOyIgYng6b3JpZ2luPSIwLjUgMC41Ii8+Cjwvc3ZnPg==) 16 16,auto!important} body.snippyly-add-arrow-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-arrow-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 15 0,auto!important} .selection-element-portal{display:flex!important} .snippyly-user-marker{cursor:default;display:inline;position:relative} .snippyly-user-marker:after{color:#fff;content:attr(data-name);display:none;font-style:normal;font-weight:400;left:0;line-height:1;opacity:0;position:absolute;top:-30px;transition:opacity .2s linear,transform .3s ease-in-out;white-space:nowrap;z-index:99999;padding:4px!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit));border-radius:8px;font-family:var(--velt-default-font-family, unset);transform:translate(-50%)} .snippyly-user-marker:hover:after, .snippyly-user-marker.active:after{animation:all 1s ease-in-out;display:block;opacity:1} .snippyly-user-marker .snippyly-user-marker-line{bottom:0;height:100%;position:absolute;width:0} .snippyly-user-marker .snippyly-user-marker-line .snippyly-user-marker-dot{border-radius:50%;cursor:default;display:block;height:4px;left:50%;position:absolute;top:-3px;transform:translate(-50%,-50%);width:4px} .snippyly-user-marker:after{background-color:var(--velt-selection-marker-color)!important} .snippyly-user-marker .snippyly-user-marker-line, .snippyly-user-marker .snippyly-user-marker-dot{border:1px solid var(--velt-selection-marker-color)!important;background-color:var(--velt-selection-marker-color)!important} .v-device-info-tooltip-container{display:flex;padding:calc((.25rem + 0px) * var(--velt-base-rem-unit)) calc((.5rem + 0px) * var(--velt-base-rem-unit));margin:calc((.5rem + 0px) * var(--velt-base-rem-unit));align-items:flex-start;flex-direction:column;gap:calc((.2rem + 0px) * var(--velt-base-rem-unit));border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit));background:var(--neutrals-1, #141416);color:var(--neutrals-10, #FFF);font-size:calc((.75rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:400;line-height:normal} .v-device-info-tooltip-container.dark{background:var(--neutrals-3, #353945);color:var(--neutrals-10, #FFF)} .huddle-all-menu-panel{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;background-color:#fff!important;border-radius:8px;color:#000} .huddle-all-menu-panel .mat-mdc-menu-item{background-color:#fff!important;padding:0 calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:40px!important;min-height:40px!important;width:100%!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;gap:8px!important;align-items:center!important;border:0!important;font-weight:unset!important;text-transform:unset!important;font-family:var(--velt-default-font-family, unset)!important} .huddle-all-menu-panel .mat-mdc-menu-item .mat-mdc-menu-item-text{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;gap:8px!important;align-items:center!important;border:0!important;font-weight:unset!important;text-transform:unset!important;font-family:var(--velt-default-font-family, unset)!important} .huddle-all-menu-panel .mat-mdc-menu-item:hover{background-color:#f1f1f1!important} .huddle-all-menu-panel .mat-mdc-menu-item:disabled{color:#c4c4c4!important} .snippyly-huddle-menu-panel-overlay-panel{z-index:2147483617!important} .snippyly-huddle-banner-panel{top:0!important;left:0!important} .snippyly-huddle-banner-panel .huddle-banner{border:1px solid rgba(26,28,30,.1);box-shadow:0 2px 12px #001c3b1f;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;position:fixed;background:#fff;z-index:2;top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;right:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#000} .snippyly-huddle-banner-panel .huddle-banner>div{display:flex} .snippyly-huddle-banner-panel .huddle-banner>div>*{padding:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .title{font-weight:600;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;margin:0!important} .snippyly-huddle-banner-panel .huddle-banner>div .subtitle{font-weight:400;font-size:14px!important;line-height:21px!important;margin:0} .snippyly-huddle-banner-panel .huddle-banner>div .action-btn-container{margin:calc((.75rem + 0px) * var(--velt-base-rem-unit)) 0 calc((.25rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .action-btn-container button{cursor:pointer} .snippyly-huddle-banner-panel .huddle-banner>div .join-btn{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;background:#625df5;border-radius:90px!important;border:0;margin-right:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important;font-weight:700;transition:.2s;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .join-btn:hover{background:#4742dc} .snippyly-huddle-banner-panel .huddle-banner>div .cancel-btn{color:#777e91;background:transparent;border:0;font-weight:700;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .close-btn{cursor:pointer} .velt-recorder-all-tool--menu-panel{overflow:unset!important} .velt-recorder-all-tool--menu-panel .mat-mdc-menu-content{padding:0!important} .v-view-analytics-overlay-panel{z-index:2147483617!important}"],changeDetection:0});let i=o;return i})();var mi=(()=>{let o=class o{constructor(){this.subscriptions=[]}ngAfterViewInit(){this.overlay instanceof cn?this.setOverlayZIndex(this.overlay):this.overlay instanceof Vb?this.setMatAutocompleteZIndex(this.overlay):this.overlay instanceof HTMLElement&&this.setElementZIndex(this.overlay)}setOverlayZIndex(e){this.overlay instanceof cn&&this.subscriptions.push(e.positionChange.pipe(ot(1)).subscribe(()=>{e?.overlayRef&&e?.overlayRef?.hostElement&&this.zIndex&&(e.overlayRef.hostElement.style.zIndex=this.zIndex?.toString())},t=>{}))}setMatAutocompleteZIndex(e){try{this.overlay instanceof Vb&&this.subscriptions.push(e.opened.pipe(ot(1)).subscribe(()=>{setTimeout(()=>{if(e?.panel?.nativeElement){let t=e.panel.nativeElement?.closest(".cdk-overlay-connected-position-bounding-box");t&&(t.style.zIndex=this.zIndex?.toString())}},100)},t=>{}))}catch{}}setElementZIndex(e){try{this.overlay instanceof HTMLElement&&setTimeout(()=>{let t=e?.closest(".cdk-global-overlay-wrapper")||e?.closest(".cdk-overlay-connected-position-bounding-box");t&&this.zIndex&&(t.style.zIndex=this.zIndex?.toString());let a=e?.closest(".cdk-overlay-container")?.querySelector(".cdk-overlay-backdrop");a&&this.backdropZIndex&&(this.originalBackdropZIndex=a.style.zIndex,a.style.zIndex=this.backdropZIndex?.toString(),this.backdropElement=a)},100)}catch{}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.backdropElement&&this.originalBackdropZIndex&&(this.backdropElement.style.zIndex=this.originalBackdropZIndex?.toString())}catch{}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275dir=zt({type:o,selectors:[["","snippylyOverlay",""]],inputs:{overlay:[0,"snippylyOverlay","overlay"],zIndex:[0,"snippylyOverlayZIndex","zIndex"],backdropZIndex:[0,"snippylyOverlayBackdropZIndex","backdropZIndex"]},standalone:!1});let i=o;return i})();var ILe=["*"],ELe=()=>["snippyly-overlay-panel","snippyly-lightbox-overlay-panel","velt-overlay-panel"];function xLe(i,o){if(i&1){let n=Y();_(0,"div",5),W("click",function(t){return F(n),l(2).closeImageInFullScreen(),L(t.stopPropagation())})("pointerdown",function(t){return F(n),L(t.stopPropagation())}),w(1,"img",6),b()}if(i&2){let n=l(2);x("aria-label","Image Preview")("data-testid",n.componentId+"-overlay-container"),m(),d("src",n.src,hn)("alt","Image preview"),x("data-testid",n.componentId+"-image")}}function TLe(i,o){if(i&1&&(v(0),Vt(1),w(2,"div",3,0),u(4,xLe,2,5,"ng-template",4,1,xe),C()),i&2){let n=o.ngIf,e=me(3),t=me(5),r=l();m(2),x("data-testid",r.componentId+"-trigger"),m(2),d("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",n.showImageInFullScreen)("cdkConnectedOverlayPanelClass",pt(7,ELe))("cdkConnectedOverlayDisableClose",!0)("snippylyOverlay",t)("snippylyOverlayZIndex",2147483627)}}var qpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.elementRef=t,this.componentConfigSignal=Ee({showImageInFullScreen:!1}),this.veltElement=!0,this.componentId="velt-lightbox";try{this.loggingService.log("%c[WB] Creating Class: LightboxComponent","color: blue;")}catch(r){this.loggingService.catch("Error in LightboxComponent constructor: ",r)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in LightboxComponent setupA11yAttributes:",e)}}openImageInFullScreen(){try{this.loggingService.log("%c[WB] LightboxComponent FUNCTION: openImageInFullScreen","color: green;"),this.componentConfigSignal.update(e=>(e=T(E({},e),{showImageInFullScreen:!0}),e))}catch(e){this.loggingService.catch("Error in LightboxComponent openImageInFullScreen: ",e)}}closeImageInFullScreen(){try{this.loggingService.log("%c[WB] LightboxComponent FUNCTION: closeImageInFullScreen","color: green;"),this.componentConfigSignal.update(e=>(e=T(E({},e),{showImageInFullScreen:!1}),e))}catch(e){this.loggingService.catch("Error in LightboxComponent closeImageInFullScreen: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-lightbox"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{src:"src"},standalone:!1,ngContentSelectors:ILe,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],[4,"ngIf"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayDisableClose","snippylyOverlay","snippylyOverlayZIndex"],["role","dialog","aria-modal","true","tabindex","-1",1,"snippyly-image-overlay-container",3,"click","pointerdown"],[3,"src","alt"]],template:function(t,r){t&1&&(jt(),u(0,TLe,6,8,"ng-container",2)),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,cn,an,mi],styles:["[_nghost-%COMP%]{display:flex} .snippyly-lightbox-overlay-panel{inset:0!important} .snippyly-lightbox-overlay-panel .snippyly-image-overlay-container{width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;background:#d3d3d37a;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2147483627} .snippyly-lightbox-overlay-panel img{max-width:80vw;max-height:80vh;border-radius:var(--velt-border-radius-sm)}"],changeDetection:0});let i=o;return i})();var DLe=["menuRef"],wLe=["menuTrigger"],OLe=["*"];function ALe(i,o){i&1&&(v(0),w(1,"button",5),C())}var JW=(()=>{let o=class o{constructor(e){this.loggingService=e,this.menuItems=[],this.veltElement=!0}ngOnInit(){}ngAfterViewInit(){try{let e=this.menuTrigger?.nativeElement?.querySelector("[menu-items]");if(e){e.style.display="none";for(let t=0;t<e.children.length;t++){let r=e.children[t];this.menuItems.push(r)}setTimeout(()=>{this.addMenuOptions()},100)}}catch(e){this.loggingService.catch("Error in MenuComponent afterViewInit: ",e)}}ngAfterContentInit(){}addMenuOptions(){try{this.menuRef&&this.menuRef._allItems.forEach((e,t)=>{e._getHostElement()?.appendChild(this.menuItems[t])})}catch(e){this.loggingService.catch("Error in MenuComponent addMenuOptions: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-menu"]],viewQuery:function(t,r){if(t&1&&(it(DLe,5),it(wLe,5)),t&2){let a;Xe(a=Qe())&&(r.menuRef=a.first),Xe(a=Qe())&&(r.menuTrigger=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},standalone:!1,ngContentSelectors:OLe,decls:7,vars:4,consts:[["menuTrigger","","menuTriggerRef","matMenuTrigger"],["menuRef","matMenu"],[3,"matMenuTriggerFor"],[1,"velt-menu","snippyly-menu-panel"],[4,"ngFor","ngForOf"],["mat-menu-item",""]],template:function(t,r){if(t&1&&(jt(),_(0,"div",2,0),Vt(3),b(),_(4,"mat-menu",3,1),u(6,ALe,2,0,"ng-container",4),b()),t&2){let a=me(2),s=me(5);ue("active",a==null?null:a.menuOpen),d("matMenuTriggerFor",s),m(6),d("ngForOf",r.menuItems)}},dependencies:[bt,ec,Sl,wg],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%] *[_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))}[_nghost-%COMP%] *[_ngcontent-%COMP%]:empty{display:revert!important} .snippyly-menu-panel{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;background-color:#fff!important;border-radius:8px!important} .snippyly-menu-panel button{background-color:#fff;padding:0 calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:40px!important;width:100%!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-menu-panel button:hover{background-color:#f1f1f1}"],changeDetection:0});let i=o;return i})();var PLe={provide:mp,useExisting:hr(()=>KI),multi:!0},KI=(()=>{let o=class o extends Ub{};o.\u0275fac=(()=>{let e;return function(r){return(e||(e=za(o)))(r||o)}})(),o.\u0275dir=zt({type:o,selectors:[["","contenteditable","","veltAutocomplete",""]],inputs:{veltAutocomplete:"veltAutocomplete"},exportAs:["snippylyUserSelectorTrigger"],standalone:!1,features:[V([PLe]),B]});let i=o;return i})();var Qs=class{constructor(){this.position={top:-1e3,left:-1e3},this.showAdder=!1,this.createAnnotation=()=>{},this.disabled=!1,this.commentToolEnabled=!0,this.isPlanExpired=!1,this.isUserAllowed=!1,this.enableTextComments=!1,this.user=null,this.rewriterEnabled=!1,this.left=0,this.createRewriter=()=>{},this.selectedWordsCount=0,this.selectedCharactersCount=0,this.MIN_ALLOWED_WORDS_COUNT=3,this.MIN_ALLOWED_CHARACTERS_COUNT=7,this.MAX_ALLOWED_CHARACTERS_COUNT=8e3}};var Ype=i=>({componentConfigSignal:i}),MLe=(i,o)=>({condition:i,data:o}),kLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-tool-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function RLe(i,o){i&1&&He(0)}function NLe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,RLe,1,0,"ng-container",2),b()),i&2){l();let n=me(2);m(),d("ngTemplateOutlet",n)}}function FLe(i,o){i&1&&(_(0,"div",8),le(),_(1,"svg",9)(2,"mask",10),w(3,"path",11),b(),w(4,"path",12)(5,"path",13),b()())}function LLe(i,o){if(i&1){let n=Y();_(0,"div",6),P(1,"translate"),W("pointerdown",function(t){return F(n),l(2).ngIf.createAnnotation(),L(t.stopPropagation())}),u(2,FLe,6,0,"div",7),b()}if(i&2){let n=l(2).ngIf,e=l(2);at("top",n.position.top,"px")("left",n.position.left,"px")("visibility",n.showAdder?"visible":"hidden"),x("data-testid",e.componentId)("role","button")("aria-label",M(1,12,"Add text comment"))("aria-disabled",!n.commentToolEnabled)("tabindex",n.showAdder?0:void 0),m(2),d("veltDynamicTemplate",$(16,kLe,e.template,A(14,Ype,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function BLe(i,o){if(i&1&&(v(0),u(1,LLe,3,22,"div",5),C()),i&2){let n=l().ngIf;m(),d("ngIf",n&&!n.disabled&&n.commentToolEnabled&&!n.isPlanExpired&&n.isUserAllowed&&n.enableTextComments&&(n.user==null?null:n.user.userId)&&!n.rewriterEnabled)}}function VLe(i,o){if(i&1&&(v(0),u(1,BLe,2,1,"ng-container",4),C()),i&2){let n=l(2);m(),d("veltIf",k(3,MLe,n.conditionSignal(),A(1,Ype,n.componentConfigSignal)))}}function ULe(i,o){if(i&1&&u(0,VLe,2,6,"ng-container",3),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var VC=(()=>{let o=class o extends Je{constructor(e,t,r,a,s,c){super(a,s,void 0,r,r.getTextCommentToolDarkMode$(),c,e),this.loggingService=e,this.wireframeService=t,this.commentService=r,this.elementRef=a,this.themeService=s,this.dynamicDataService=c,this.textCommentToolShadowDOM=!1,this.subscriptions=[],this.componentId="velt-text-comment-tool",super.initializeComponentConfigSignal(new Qs),this.subscriptions.push(this.commentService.getTextCommentToolShadowDOM$().subscribe(p=>{this.textCommentToolShadowDOM=p},p=>{this.loggingService.catch("Error in TextCommentToolComponent getTextCommentToolShadowDOM$ subscription: ",p)}))}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),this.subscriptions.push(this.wireframeService.getWireframe$("velt-text-comment-tool-wireframe").subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Add text comment");let t=this.componentConfigSignal();e.setAttribute("aria-disabled",String(!t.commentToolEnabled))}catch(e){this.loggingService.catch("Error in TextCommentToolComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(De),h(R),h(Ye),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-tool"]],standalone:!1,features:[V([S]),B],decls:3,vars:2,consts:[["textCommentContainerRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[4,"ngIf"],[4,"veltIf"],["class","velt-text-comment-tool",3,"top","left","visibility","pointerdown",4,"ngIf"],[1,"velt-text-comment-tool",3,"pointerdown"],["class","velt-text-comment-tool--container",4,"veltDynamicTemplate"],[1,"velt-text-comment-tool--container"],["width","32","height","32","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false"],["id","path-1-inside-1_2032_23681","fill","white"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z","fill","#625DF5"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z","stroke","white","stroke-width","2","mask","url(#path-1-inside-1_2032_23681)"]],template:function(t,r){if(t&1&&u(0,NLe,2,1,"velt-shadow-dom-internal",1)(1,ULe,1,1,"ng-template",null,0,xe),t&2){let a=me(2);d("ngIf",!r.template&&r.textCommentToolShadowDOM)("ngIfElse",a)}},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-text-comment-tool[_ngcontent-%COMP%]{position:fixed;z-index:2147483577;overflow-wrap:break-word;font-size:var(--velt-font-size-xs);text-align:center;visibility:hidden;cursor:pointer}.velt-text-comment-tool[_ngcontent-%COMP%] .velt-text-comment-tool--container[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var Kpe=i=>({componentConfigSignal:i}),$Le=(i,o)=>({condition:i,data:o}),HLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function zLe(i,o){i&1&&He(0)}function GLe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,zLe,1,0,"ng-container",2),b()),i&2){l();let n=me(2);m(),d("ngTemplateOutlet",n)}}function WLe(i,o){if(i&1&&w(0,"app-text-comment-toolbar-comment-annotation",10),i&2){let n=l(6);d("componentConfigSignal",n.componentConfigSignal)}}function qLe(i,o){i&1&&w(0,"app-text-comment-toolbar-divider")}function YLe(i,o){if(i&1&&(_(0,"div",8),u(1,WLe,1,1,"app-text-comment-toolbar-comment-annotation",9)(2,qLe,1,0,"app-text-comment-toolbar-divider",3),w(3,"app-text-comment-toolbar-copywriter",10)(4,"app-text-comment-toolbar-generic",10),b()),i&2){let n=l(3).ngIf,e=l(2);m(),d("ngIf",n.commentToolEnabled),m(),d("ngIf",n.commentToolEnabled),m(),d("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal)}}function KLe(i,o){if(i&1){let n=Y();_(0,"div",6),P(1,"translate"),W("click",function(t){return F(n),L(t.stopPropagation())})("pointerdown",function(t){return F(n),L(t.stopPropagation())})("pointerup",function(t){return F(n),L(t.stopPropagation())}),u(2,YLe,5,4,"div",7),b()}if(i&2){let n=l(2).ngIf,e=l(2);at("top",n.position.top,"px")("left",n.left,"px")("visibility",n.showAdder?"visible":"hidden")("top",n.position.top,"px")("left",n.left,"px")("visibility",n.showAdder?"visible":"hidden"),x("data-testid",e.componentId)("role","toolbar")("aria-label",M(1,17,"Text comment tools"))("aria-hidden",!n.showAdder),m(2),d("veltDynamicTemplate",$(21,HLe,e.template,A(19,Kpe,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function ZLe(i,o){if(i&1&&(v(0),u(1,KLe,3,27,"div",5),C()),i&2){let n=l().ngIf;m(),d("ngIf",n&&!n.disabled&&!n.isPlanExpired&&n.isUserAllowed&&n.enableTextComments&&(n.user==null?null:n.user.userId)&&n.rewriterEnabled)}}function XLe(i,o){if(i&1&&(v(0),u(1,ZLe,2,1,"ng-container",4),C()),i&2){let n=l(2);m(),d("veltIf",k(3,$Le,n.conditionSignal(),A(1,Kpe,n.componentConfigSignal)))}}function QLe(i,o){if(i&1&&u(0,XLe,2,6,"ng-container",3),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var UC=(()=>{let o=class o extends Je{constructor(e,t,r,a,s,c){super(a,s,void 0,r,r.getTextCommentToolbarDarkMode$(),c,e),this.loggingService=e,this.wireframeService=t,this.commentService=r,this.elementRef=a,this.themeService=s,this.dynamicDataService=c,this.textCommentToolbarShadowDOM=!1,this.subscriptions=[],this.componentId="velt-text-comment-toolbar",super.initializeComponentConfigSignal(new Qs),this.subscriptions.push(this.commentService.getTextCommentToolbarShadowDOM$().subscribe(p=>{this.textCommentToolbarShadowDOM=p},p=>{this.loggingService.catch("Error in CommentPinComponent getTextCommentToolbarShadowDOM$ subscription: ",p)}))}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),this.subscriptions.push(this.wireframeService.getWireframe$("velt-text-comment-toolbar-wireframe").subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Text comment tools")}catch(e){this.loggingService.catch("Error in TextCommentToolbarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(De),h(R),h(Ye),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar"]],standalone:!1,features:[V([S]),B],decls:3,vars:2,consts:[["textCommentToolbarContainerRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[4,"ngIf"],[4,"veltIf"],["class","velt-text-comment-toolbar",3,"top","left","visibility","click","pointerdown","pointerup",4,"ngIf"],[1,"velt-text-comment-toolbar",3,"click","pointerdown","pointerup"],["class","velt-text-comment-toolbar--container",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar--container"],[3,"componentConfigSignal",4,"ngIf"],[3,"componentConfigSignal"]],template:function(t,r){if(t&1&&u(0,GLe,2,1,"velt-shadow-dom-internal",1)(1,QLe,1,1,"ng-template",null,0,xe),t&2){let a=me(2);d("ngIf",!r.template&&r.textCommentToolbarShadowDOM)("ngIfElse",a)}},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-text-comment-toolbar[_ngcontent-%COMP%]{position:fixed;z-index:99999;transform:translate(-50%)}.velt-text-comment-toolbar--container[_ngcontent-%COMP%]{width:max-content;display:flex;align-items:center;padding:var(--velt-spacing-xs) var(--velt-spacing-sm);gap:var(--velt-spacing-sm);background:var(--velt-background-0);border:var(--velt-border-4);box-shadow:0 8px 16px #8f95b226;border-radius:var(--velt-border-radius-full);color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var eBe=["commentAdderRef"],Zpe=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.domService=r,this.iamService=a,this.commentService=s,this.loggingService=c,this.rewriterService=p,this.elementRef=g,this.componentConfigSignal=Ee({position:{top:-1e3,left:-1e3},showAdder:!1,createAnnotation:this.createAnnotation.bind(this),disabled:!1,commentToolEnabled:!0,isPlanExpired:!1,isUserAllowed:!1,enableTextComments:!1,user:null,rewriterEnabled:!1,left:0,createRewriter:this.createRewriter.bind(this),selectedWordsCount:0,selectedCharactersCount:0,MIN_ALLOWED_WORDS_COUNT:3,MIN_ALLOWED_CHARACTERS_COUNT:7,MAX_ALLOWED_CHARACTERS_COUNT:8e3,variant:this.variant}),this.allowedElementIds=[],this.selectedCharactersCount=0,this.subscriptions=[],this.veltElement=!0,this.componentId="velt-comment-adder",this.subscriptions.push(this.commentService.getTextCommentMode$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{enableTextComments:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent getTextCommentMode$ subscription: ",f)})),this.subscriptions.push(this.commentService.getAllowedElementIds().subscribe(f=>{this.allowedElementIds=f},f=>{this.loggingService.catch("Error in CommentAdderComponent getAllowedElementIds subscription: ",f)})),this.subscriptions.push(this.commentService.getCommentTool$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{commentToolEnabled:f}),I))})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{disabled:!!f?.all?.disabled}),I))})),this.subscriptions.push(this.authService.getUser$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{user:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent getUser$ subscription: ",f)})),this.subscriptions.push(this.rewriterService.getRewriterEnabled$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{rewriterEnabled:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent getRewriterEnabled$ subscription: ",f)})),this.subscriptions.push(this.iamService.isUserAllowed$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{isUserAllowed:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent isUserAllowed$ subscription: ",f)})),this.subscriptions.push(this.authService.isPlanExpired$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{isPlanExpired:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent isPlanExpired$ subscription: ",f)}))}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(E({},r),{[t]:e[t].currentValue}),r))})}catch(t){this.loggingService.catch("Error in CommentAdderComponent ngOnChanges: ",t)}}ngOnInit(){this.setupA11yAttributes(),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.componentConfigSignal().enableTextComments&&this.componentConfigSignal().user&&!(this.componentConfigSignal().user?.isReadOnly||this.componentConfigSignal().user?.isAnonymous)&&this.authService.isFeatureAllowed(Re.COMMENT)){if(window.getSelection()?.toString()){let e=window.getSelection()?.toString(),t=wk(e||"").join(" ");this.componentConfigSignal.update(r=>(r=T(E({},r),{selectedWordsCount:t?.split(" ").length||0,selectedCharactersCount:t?.length||0}),r))}else this.componentConfigSignal.update(e=>(e=T(E({},e),{selectedWordsCount:0,selectedCharactersCount:0}),e));if(window.getSelection()?.toString()&&!Ak()){let e=window.getSelection()?.getRangeAt(0);e.commonAncestorContainer&&this.commentService.isElementInsideAllowedElements(e.commonAncestorContainer)&&(gp(e.commonAncestorContainer)?this.clearSelection():(this.onSelection(),this.subscribeScrollChange()))}else this.clearSelection()}else this.clearSelection()}catch(e){this.loggingService.catch("Error in CommentAdderComponent onSelectionChange$: ",e)}},e=>{this.loggingService.catch("Error in CommentAdderComponent onSelectionChange$ subscription: ",e)})}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","application"),e.setAttribute("aria-label","Text comment adder")}catch(e){this.loggingService.catch("Error in CommentAdderComponent setupA11yAttributes:",e)}}subscribeScrollChange(){try{this.loggingService.log("%c[WB] Calling FUNCTION: subscribeScrollChange","color: green;"),this.scrollChangeSubscription&&this.scrollChangeSubscription.unsubscribe(),this.scrollChangeSubscription=dn([this.domService.onWindowPointerUp$(),this.domService.getCurrentWindowSize$()]).subscribe(()=>{this.onSelection()})}catch(e){this.loggingService.catch("Error in CommentAdderComponent subscribeScrollChange: ",e)}}onSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onSelection","color: green;");let e=this.domService.getRange();if(e?.commonAncestorContainer){let t=e.getClientRects();if(t.length){let r=t[t.length-1];this.componentConfigSignal.update(a=>(a=T(E({},a),{position:{top:r.y+r.height+(a.rewriterEnabled?16:4),left:r.x+r.width-16}}),a)),this.onPositionUpdate(),this.componentConfigSignal.update(a=>(a=T(E({},a),{showAdder:!0}),a))}else this.clearSelection()}}catch(e){this.loggingService.catch("Error in CommentAdderComponent onSelection: ",e)}}createAnnotation(e,t){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: createAnnotation","color: green;"),yield im(200),this.componentConfigSignal().user){let r=this.domService.getRange(),a=r?this.domService.getTargetTextRangeFromSelectionRange(r):void 0;this.domService.clearTextSelection(),setTimeout(()=>{if(e)this.rewriterService.addRewriter(void 0,a,t);else{let s=r?.commonAncestorContainer;s&&s.nodeType===Node.TEXT_NODE&&(s=s.parentElement);let c=this.commentService.getInlineCommentSectionConfig(s);this.commentService.addComment(void 0,a,void 0,void 0,void 0,void 0,void 0,void 0,c)}},100)}}catch(r){this.loggingService.catch("Error in CommentAdderComponent createAnnotation: ",r)}})}createRewriter(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: createRewriter","color: green;"),this.componentConfigSignal().selectedWordsCount>=this.componentConfigSignal().MIN_ALLOWED_WORDS_COUNT&&this.componentConfigSignal().selectedCharactersCount>=this.componentConfigSignal().MIN_ALLOWED_CHARACTERS_COUNT&&this.componentConfigSignal().selectedCharactersCount<this.componentConfigSignal().MAX_ALLOWED_CHARACTERS_COUNT?(this.createAnnotation(!0,e),e==="copywriter"?this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITE_BUTTON_CLICKED,{charactersSelected:this.componentConfigSignal().selectedCharactersCount,wordsSelected:this.componentConfigSignal().selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()}):this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITE_PROMPT_BUTTON_CLICKED,{charactersSelected:this.componentConfigSignal().selectedCharactersCount,wordsSelected:this.componentConfigSignal().selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()})):this.componentConfigSignal().selectedCharactersCount<this.componentConfigSignal().MIN_ALLOWED_CHARACTERS_COUNT?this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITER_MIN_CHARACTER_NOT_MET,{minCharacterAllowed:this.componentConfigSignal().MIN_ALLOWED_CHARACTERS_COUNT,charactersSelected:this.componentConfigSignal().selectedCharactersCount,isMobileDevice:this.domService.isMobileDevice()}):this.componentConfigSignal().selectedCharactersCount>this.componentConfigSignal().MAX_ALLOWED_CHARACTERS_COUNT&&this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITER_MAX_CHARACTER_NOT_MET,{maxCharacterAllowed:this.componentConfigSignal().MAX_ALLOWED_CHARACTERS_COUNT,charactersSelected:this.componentConfigSignal().selectedCharactersCount,isMobileDevice:this.domService.isMobileDevice()})}catch(t){this.loggingService.catch("Error in CommentAdderComponent createRewriter: ",t)}})}clearSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearSelection","color: green;"),this.componentConfigSignal.update(e=>(e=T(E({},e),{showAdder:!1,position:{top:-1e3,left:-1e3}}),e)),this.onPositionUpdate(),this.scrollChangeSubscription&&this.scrollChangeSubscription.unsubscribe()}catch(e){this.loggingService.catch("Error in CommentAdderComponent clearSelection: ",e)}}onPositionUpdate(){try{let e=this.commentAdderRef?.nativeElement.getBoundingClientRect(),t=0,r=0;e&&(t=e.width/2,r=window.innerWidth-e.width/2);let a=this.componentConfigSignal().position.left;a<t&&(a=t),a>r&&(a=r),this.componentConfigSignal().position.left<0&&(a=this.componentConfigSignal().position.left),this.componentConfigSignal.update(s=>(s=T(E({},s),{left:a}),s))}catch(e){this.loggingService.catch("Error in CommentAdderComponent onPositionUpdate: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in CommentAdderComponent 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 CommentAdderComponent unsubscribe: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(et),h(Ue),h(Le),h(In),h(De),h(y),h(vd),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-adder"]],viewQuery:function(t,r){if(t&1&&it(eBe,5),t&2){let a;Xe(a=Qe())&&(r.commentAdderRef=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{variant:"variant"},standalone:!1,features:[Ze],decls:4,vars:7,consts:[["commentAdderRef",""],[3,"componentConfigSignal"]],template:function(t,r){t&1&&(w(0,"app-text-comment-tool",1),_(1,"div",null,0),w(3,"app-text-comment-toolbar",1),b()),t&2&&(d("componentConfigSignal",r.componentConfigSignal),x("data-testid",r.componentId+"-tool"),m(),x("data-testid",r.componentId+"-toolbar-container")("role","toolbar")("aria-label","Text comment tools")("aria-hidden",!r.componentConfigSignal().showAdder),m(2),d("componentConfigSignal",r.componentConfigSignal))},dependencies:[VC,UC],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);outline:none;margin:0;padding:0;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));-webkit-user-select:none;-ms-user-select:none;user-select:none}*[_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}"],changeDetection:0});let i=o;return i})();var nBe=["overlay"],iBe=()=>["snippyly-overlay-panel","velt-overlay-panel"];function oBe(i,o){if(i&1&&w(0,"span",8),i&2){let n,e=l().ngIf;ue("index-3-digit",(e.commentPinAnnotation==null||e.commentPinAnnotation.annotationNumber==null||(n=e.commentPinAnnotation.annotationNumber.toString())==null?null:n.length)===3),x("data-comment-annotation-number","#"+(e.commentPinAnnotation==null?null:e.commentPinAnnotation.annotationNumber))}}function rBe(i,o){if(i&1){let n=Y();v(0),_(1,"velt-multi-thread-comment-dialog-internal",10),W("saveComment",function(t){F(n);let r=l(3);return L(r.saveComment(t))})("pointerUp",function(t){F(n);let r=l(3);return L(r.togglePinSelection(t))}),b(),C()}if(i&2){let n=l(2).ngIf;m(),d("multiThreadAnnotationId",n.commentPinAnnotation.annotationId)("annotation",n.commentPinAnnotation)("user",n.user)("commentPinSelected",n.commentPinSelected)}}function aBe(i,o){if(i&1){let n=Y();_(0,"snippyly-comment-dialog",11),W("saveComment",function(t){F(n);let r=l(3);return L(r.saveComment(t))}),b()}if(i&2){let n=l(2).ngIf;d("annotation",n.commentPinAnnotation)("user",n.user)("commentPinSelected",n.commentPinSelected)("inlineCommentMode",n.inlineCommentMode)("isInsidePdfViewer",n.isInsidePdfViewer)}}function sBe(i,o){if(i&1&&u(0,rBe,2,4,"ng-container",9)(1,aBe,1,5,"ng-template",null,2,xe),i&2){let n=me(2),e=l().ngIf;d("ngIf",(e==null||e.commentPinAnnotation==null?null:e.commentPinAnnotation.type)==="multiThread")("ngIfElse",n)}}function lBe(i,o){if(i&1){let n=Y();_(0,"snippyly-comment-bottom-sheet",12),W("saveComment",function(t){F(n);let r=l(2);return L(r.saveComment(t))}),b()}if(i&2){let n=l().ngIf;d("annotation",n.commentPinAnnotation)("user",n.user)("isInsidePdfViewer",n.isInsidePdfViewer)}}function cBe(i,o){if(i&1){let n=Y();v(0),_(1,"snippyly-comment-text",4,0),W("pointerover",function(t){return F(n),l().onPointerOver(t),L(t.stopPropagation())})("pointerout",function(){F(n);let t=l();return L(t.onPointerOut())})("pointerdown",function(t){return F(n),L(t.stopPropagation())})("pointerup",function(t){return F(n),l().togglePinSelection(),L(t.stopPropagation())})("touchend",function(t){return F(n),t.stopPropagation(),L(t.preventDefault())})("click",function(t){return F(n),t.stopPropagation(),L(t.preventDefault())}),b(),u(3,oBe,1,3,"span",5)(4,sBe,3,2,"ng-template",6,1,xe)(6,lBe,1,3,"snippyly-comment-bottom-sheet",7),C()}if(i&2){let n=o.ngIf,e=me(2),t=l();m(),ue("inline-comment-mode",n.inlineCommentMode&&!n.isInsidePdfViewer)("selected",n.commentPinHover||n.commentPinSelected),m(2),d("ngIf",n.last&&n.showCommentIndex&&(n.commentPinAnnotation==null?null:n.commentPinAnnotation.annotationNumber)),m(),d("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",(!n.mobileMode||!n.isPhone)&&!n.inboxMode&&!n.streamMode&&(!n.inlineCommentMode||n.isInsidePdfViewer)&&n.floatingCommentsEnabled&&(n.textClicked&&n.commentPinSelected||n.commentPinHover&&!n.commentPinSelected))("cdkConnectedOverlayOffsetY",n.overlayOriginY==="top"?-8:2)("cdkConnectedOverlayPanelClass",pt(15,iBe))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0),m(2),d("ngIf",(n==null?null:n.user)&&n.mobileMode&&n.isPhone&&!n.sidebarVisible&&(!n.inlineCommentMode||n.isInsidePdfViewer)&&!n.inboxMode&&!n.streamMode&&n.floatingCommentsEnabled&&n.textClicked&&n.commentPinSelected)}}var WR=(()=>{let o=class o{onEnter(e){this.onKeyupEnter&&this.onKeyupEnter()}constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.breakpointObserver=r,this.domService=a,this.commentService=s,this.loggingService=c,this.recorderService=p,this.elementRef=g,this.subscriptions=[],this.selectedAnnotationsMap={},this.customScrollableParentEventsListenersSubscriptions=[],this.isDialogOnHoverEnabled=!1,this.componentConfigSignal=Ee({inlineCommentMode:!1,isInsidePdfViewer:!1,commentPinHover:!1,commentPinSelected:!1,first:!1,last:!1,showCommentIndex:!1,commentPinAnnotation:null,isPhone:!1,mobileMode:!1,streamMode:!1,inboxMode:!1,textClicked:!1,floatingCommentsEnabled:!0,sidebarVisible:!1,user:null,overlayOriginX:"start",overlayOriginY:"top"}),this.positions=U.OVERLAY_POSITIONS.map(f=>new li({originX:f.originX,originY:f.originY},{overlayX:f.overlayX,overlayY:f.overlayY})),this.veltElement=!0,this.componentId="velt-comment-text-portal",this.subscriptions.push(this.authService.getUser$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{user:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent getUser$ subscription: ",f)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{sidebarVisible:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent getSidebarVisibility$ subscription: ",f)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{floatingCommentsEnabled:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent showFloatingComments$ subscription: ",f)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{showCommentIndex:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent getShowCommentIndex subscription: ",f)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(f=>{this.isDialogOnHoverEnabled=f},f=>{this.catchError("Error in CommentPinComponent getEnableDialogOnHover subscription: ",f)})),this.subscriptions.push(this.breakpointObserver.observe(Vi.XSmall).subscribe(f=>{let I=!1;f.matches?I=!0:I=!1,this.componentConfigSignal.update(D=>(D=T(E({},D),{isPhone:I}),D))},f=>{this.catchError("Error in CommentTextPortalComponent breakpointObserver subscription: ",f)}))}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentTextPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentTextPortalComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{let e=this.element.childNodes[0];this.element.childNodes[1].childNodes[0].appendChild(e),this.componentConfigSignal.update(r=>{let a=Y0(this.element,U.ATTRIBUTES.VELT_PDF_VIEWER);return r=T(E({},r),{isInsidePdfViewer:a}),r}),this.subscriptions.push(this.overlay?.positionChange?.subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(E({},a),{overlayOriginX:r.connectionPair.originX,overlayOriginY:r.connectionPair.originY}),a))},r=>{this.catchError("Error in CommentTextPortalComponent positionChange subscription: ",r)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(r=>{this.selectedAnnotationsMap=r,this.checkPinSelection()},r=>{this.catchError("Error in CommentTextPortalComponent getSelectedAnnotationsMap$ subscription: ",r)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(E({},a),{streamMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getStreamMode$ subscription: ",r)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(E({},a),{inboxMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getInboxMode subscription: ",r)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(E({},a),{mobileMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getMobileMode$ subscription: ",r)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(E({},a),{inlineCommentMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getInlineCommentMode$ subscription: ",r)})),this.subscriptions.push(this.recorderService.onInitRecording().subscribe(r=>{this.recorderInitConfig=r},r=>{this.catchError("Error in CommentTextPortalComponent onInitRecording subscription: ",r)}))}catch(e){this.catchError("Error in CommentTextPortalComponent AfterViewInit: ",e)}}setFirst(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{first:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setFirst: ",t)}}setLast(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{last:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setLast: ",t)}}setCommentPinAnnotation(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{commentPinAnnotation:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setCommentPinAnnotation: ",t)}}setElement(e){try{this.element=e,this.element?this.customScrollableParents=Pg(this.element):this.customScrollableParents=[],this.addCustomScrollableParentsEventListeners()}catch(t){this.catchError("Error in CommentTextPortalComponent setElement: ",t)}}checkPinSelection(){try{this.selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation?.annotationId]?this.componentConfigSignal.update(e=>(e=T(E({},e),{commentPinSelected:!0}),e)):this.componentConfigSignal.update(e=>(e=T(E({},e),{commentPinSelected:!1,textClicked:!1}),e)),sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID)===this.componentConfigSignal().commentPinAnnotation.annotationId&&this.componentConfigSignal().last&&(this.componentConfigSignal.update(e=>(e=T(E({},e),{textClicked:!0}),e)),sessionStorage.removeItem(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID))}catch(e){this.catchError("Error in CommentTextPortalComponent checkPinSelection: ",e)}}onPointerOver(e){try{if(this.componentConfigSignal().commentPinHover)return;e.buttons?this.componentConfigSignal().commentPinHover&&this.componentConfigSignal.update(t=>(t=T(E({},t),{commentPinHover:!1}),t)):!this.componentConfigSignal().commentPinHover&&this.isDialogOnHoverEnabled&&this.componentConfigSignal.update(t=>(t=T(E({},t),{commentPinHover:!0}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent onPointerOver: ",t)}}onPointerOut(){this.componentConfigSignal.update(e=>(e=T(E({},e),{commentPinHover:!1}),e))}togglePinSelection(e){try{if(this.recorderInitConfig?.isCommentRecording||this.componentConfigSignal().textClicked&&!e)return;let t=e||this.componentConfigSignal().commentPinAnnotation;if(this.selectedAnnotationsMap[t.annotationId])e||(document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):(this.componentConfigSignal.update(a=>(a=T(E({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)));else{let r=document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(r||(r=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),r){let a=r.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let s=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);s&&(s.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.componentConfigSignal.update(a=>(a=T(E({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)}}catch(t){this.catchError("Error in CommentTextPortalComponent togglePinSelection: ",t)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(t){this.catchError("Error in CommentTextPortalComponent saveComment: ",t)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().commentPinAnnotation?.annotationId),this.overlay&&this.overlay?.overlayRef?.updatePosition()}catch(e){this.catchError("Error in CommentTextPortalComponent updateOverlayPosition: ",e)}}addCustomScrollableParentsEventListeners(){try{this.removeCustomScrollableParentsEventListeners(),this.customScrollableParents?.length&&this.customScrollableParents?.forEach(e=>{this.customScrollableParentEventsListenersSubscriptions.push(hi(e,"scroll").subscribe(t=>{this.updateOverlayPosition()},t=>{this.catchError("Error in CommentTextPortalComponent addCustomScrollableParentsEventListeners scroll subscription: ",t)}))})}catch(e){this.catchError("Error in CommentTextPortalComponent addCustomScrollableParentsEventListeners: ",e)}}removeCustomScrollableParentsEventListeners(){try{this.customScrollableParentEventsListenersSubscriptions.map(e=>{e.unsubscribe()}),this.customScrollableParentEventsListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentTextPortalComponent removeCustomScrollableParentsEventListeners: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.removeCustomScrollableParentsEventListeners(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentTextPortalComponent unsubscribe: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(et),h(Ue),h(Eo),h(Le),h(De),h(y),h(Sn),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-text-portal"]],viewQuery:function(t,r){if(t&1&&it(nBe,5),t&2){let a;Xe(a=Qe())&&(r.overlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&1&&W("keyup.enter",function(s){return r.onEnter(s)},ih),t&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],["commentDialogRef",""],[4,"ngIf"],["cdkOverlayOrigin","","data-velt-comment-disabled","true",1,"comment-text-highlight",3,"pointerover","pointerout","pointerdown","pointerup","touchend","click"],["class","comment-annotation-number",3,"index-3-digit",4,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayOffsetY","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],[3,"annotation","user","isInsidePdfViewer","saveComment",4,"ngIf"],[1,"comment-annotation-number"],[4,"ngIf","ngIfElse"],[3,"saveComment","pointerUp","multiThreadAnnotationId","annotation","user","commentPinSelected"],[3,"saveComment","annotation","user","commentPinSelected","inlineCommentMode","isInsidePdfViewer"],[3,"saveComment","annotation","user","isInsidePdfViewer"]],template:function(t,r){t&1&&u(0,cBe,7,16,"ng-container",3),t&2&&d("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%]{box-sizing:border-box;margin:0;padding:0;height:inherit;width:inherit;text-align:inherit;line-height:inherit;font-size:inherit;text-transform:inherit;float:inherit;-webkit-text-fill-color:initial}*[_ngcontent-%COMP%]:empty{display:revert}[_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);font-family:inherit}.comment-text-highlight[_ngcontent-%COMP%]{cursor:pointer} snippyly-text-highlight.snippyly-text-highlight{color:var(--velt-black)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:var(--velt-warning-hover);background-color:var(--velt-warning-transparent);border-bottom:1px solid var(--velt-warning-hover)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:var(--velt-black);background-color:var(--velt-warning)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.inline-comment-mode{background-color:inherit} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.inline-comment-mode.selected{background-color:inherit}.comment-annotation-number[_ngcontent-%COMP%]{border-radius:50%;border:1px solid var(--velt-gray);width:20px;height:20px;font-size:calc((.7rem + 0px) * var(--velt-base-rem-unit));display:inline-flex;justify-content:center;align-items:center;box-sizing:content-box;background:var(--velt-white);color:var(--velt-black);position:relative}.comment-annotation-number.index-3-digit[_ngcontent-%COMP%]{width:32px;height:32px}.comment-annotation-number[_ngcontent-%COMP%]:after{content:attr(data-comment-annotation-number);position:absolute;font-weight:400;letter-spacing:normal;word-spacing:normal}"],changeDetection:0});let i=o;return i})();var qR=(()=>{let o=class o{constructor(e,t,r,a,s,c,p){this.docService=e,this.domService=t,this.commentService=r,this.componentFactoryResolver=a,this.injector=s,this.appRef=c,this.loggingService=p,this.commentsTextById={},this.commonAncestorElementObservers=new Map,this.commonAncestorElementObserverCounts=new Map,this.inlineCommentMode=!1;try{this.commentService.getInlineCommentMode$().subscribe(g=>{this.inlineCommentMode=g})}catch(g){this.loggingService.catch("Error in CommentPinPortalService constructor: ",g)}}updateTextCommentAnnotations(e){try{this.checkToRemoveTextCommentAnnotations(e),e.forEach(t=>{this.updateTextCommentAnnotation(t)})}catch(t){this.loggingService.catch("Error in CommentPinPortalService updateTextCommentAnnotations: ",t)}}updateTextCommentAnnotation(e){let t=this.commentsTextById[e.annotationId];if(t)if(gi(t?.annotation?.targetTextRange,e?.targetTextRange)){let r=!1;t?.texts?.length?t.texts.forEach(a=>{document.body.contains(a?.textNode)||(r=!0)}):r=!0,r?(this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e)):(t.texts.forEach(a=>{a.portalRef&&a.portalRef.instance.setCommentPinAnnotation(e)}),t.annotation=e)}else this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e);else this.getCommonAncestorContainer(e)}getCommonAncestorContainer(e){try{let t=this.domService.getElementFromTargetTextRange(e?.targetTextRange);if(t&&this.domService.isElementVisible(t)){let r=t?.nodeType===Node.ELEMENT_NODE?t:t?.parentElement;this.commentsTextById[e.annotationId]={texts:[],annotation:e,commonAncestorContainer:t,commonAncestorElement:r,commonAncestorText:r?.textContent},this.setTextCommentPortal(e),this.observeCommonAncestorElementChanges(e)}else this.setGhostComment(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService getCommonAncestorContainer: ",t)}}setTextCommentPortal(e){try{let t=this.commentsTextById[e.annotationId];if(t){let r=this.domService.getElementFromTargetTextRange(e?.targetTextRange);if(e?.locationId&&this.docService.getLocation()?.locationId!==e?.locationId){let p=this.docService.getElementMapWithLocation();p[e?.locationId]&&(r=p[e?.locationId]?.element)}let a=r?H0(e.targetTextRange?.text,r,e.targetTextRange?.occurrence):[],s=!1;if(a?.forEach(c=>{c?.textNode?.parentElement?.closest("script")&&(s=!0)}),!s){let c=new Range;try{c.setStart(a[0].textNode,a[0].startOffset||0),c.setEnd(a[a.length-1].textNode,a[a.length-1].endOffset||0)}catch{}if(c.toString()===e.targetTextRange?.text){let p=BC(c),g=[],f=p?.find(I=>!I?.textContent);if(f&&f?.remove(),p=p?.filter(I=>I?.textContent),p&&p.length){let I=-1,D=-1;if(p.forEach((N,G)=>{this.textHighlighterClass?this.domService.addClassToElement(N,this.textHighlighterClass):this.domService.addClassToElement(N,N.tagName?.toLowerCase()),N.setAttribute(U.ATTRIBUTES.VELT_ID,e.annotationId);let z=N.childNodes[0],J=new rr(WR),ce=new ar(N,this.appRef,this.injector),ye=ce.attach(J);ye.instance.setCommentPinAnnotation(e),ye.instance.setElement(N),ye.instance.onKeyupEnter=()=>{this.onCommonAncestorElementChange(e)},I<0&&(I=G),D=G,g.push({host:ce,portal:J,portalRef:ye,element:N,textNode:z})}),I>=0&&g[I]?.portalRef&&g[I].portalRef.instance.setFirst(!0),D>=0&&g[D]?.portalRef&&g[D].portalRef.instance.setLast(!0),t.texts=g,this.inlineCommentMode&&!document.querySelector(`${U.TAGS.VELT_INLINE_COMMENT}[${U.ATTRIBUTES.VELT_INLINE_COMMENT_ID}="${e.annotationId}"]`)){let G=t.texts?.filter(J=>!!J?.element)?.map(J=>J?.element),z=G?.length?G[G.length-1]:null;if(z&&!Y0(z,U.ATTRIBUTES.VELT_PDF_VIEWER)){let ce=z?.parentElement;if(ce){let ye=document.createElement(U.TAGS.VELT_INLINE_COMMENT);ye.setAttribute(U.ATTRIBUTES.VELT_INLINE_COMMENT_ID,e.annotationId),ce.insertAdjacentElement("afterend",ye),t.inlineCommentElement=ye}}}}this.removeGhostComment(e)}else this.setGhostComment(e)}}else this.setGhostComment(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService setTextCommentPortal: ",t)}}checkToRemoveTextCommentAnnotations(e){try{let t=e.map(a=>a.annotationId),r=!1;if(Object.keys(this.commentsTextById).forEach(a=>{t.includes(a)||(this.commentsTextById[a]?.annotation?.targetTextRange&&(r=!0),this.removeTextCommentAnnotation(this.commentsTextById[a].annotation))}),r){let a=[];Object.keys(this.commentsTextById).forEach(s=>{this.commentsTextById[s]?.annotation?.targetTextRange&&(a.push(this.commentsTextById[s]?.annotation),this.removeTextCommentAnnotation(this.commentsTextById[s]?.annotation))}),a?.length&&a.forEach(s=>{this.updateTextCommentAnnotation(s)})}}catch(t){this.loggingService.catch("Error in CommentPinPortalService checkToRemoveTextCommentAnnotations: ",t)}}removeTextCommentAnnotation(e){try{let t=this.commentsTextById[e.annotationId];if(t.texts.forEach(r=>{r?.host&&r.host.detach(),r?.element&&r?.textNode&&r.element.replaceWith(r.textNode),r.textNode&&r.textNode.parentNode?.normalize()}),t.texts?.length){let r=document.querySelectorAll(`${U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`);r?.length&&r.forEach(a=>{let s=a?.parentNode;if(a?.textContent){let c=document.createTextNode(a.textContent);a.replaceWith(c)}s&&s.normalize()})}t?.inlineCommentElement&&t?.inlineCommentElement?.remove(),this.checkToUnsubscribeCommonAncestorElementChanges(e),delete this.commentsTextById[e.annotationId]}catch(t){this.loggingService.catch("Error in CommentPinPortalService removeTextCommentAnnotation: ",t)}}observeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];if(t.commonAncestorElement){let r=this.commonAncestorElementObservers.get(t.commonAncestorElement);if(r)r.annotations.find(a=>a.annotationId===e.annotationId)||r.annotations.push(e);else{let a=new MutationObserver(s=>{let c="";if(Dk(t?.commonAncestorElement).forEach(g=>{g?.parentElement?.closest(".comment-annotation-number")||(c+=g.textContent)}),t?.commonAncestorText!==c&&s.filter(g=>[Node.ELEMENT_NODE,Node.TEXT_NODE].includes(g.target.nodeType)).filter(g=>g.target?.parentElement&&(g?.target?.parentElement?.classList?.contains("comment-text-highlight")||!Gi(g.target?.parentElement))).length){this.commonAncestorElementObservers.get(t.commonAncestorElement)?.annotations?.forEach(N=>{this.onCommonAncestorElementChange(N)});let{count:f,lastUpdated:I}=this.commonAncestorElementObserverCounts.get(t.commonAncestorElement)||{count:0,lastUpdated:0},D=Date.now();this.commonAncestorElementObserverCounts.set(t.commonAncestorElement,{count:D-I<100?f+1:1,lastUpdated:Date.now()}),f>5&&(a.disconnect(),this.loggingService.catch("Failed to detect text changes."))}});a.observe(t.commonAncestorElement,{characterData:!0,subtree:!0}),r={observer:a,annotations:[e]}}this.commonAncestorElementObservers.set(t.commonAncestorElement,r)}}catch(t){this.loggingService.catch("Error in CommentPinPortalService observeCommonAncestorElementChanges: ",t)}}onCommonAncestorElementChange(e){try{let t=this.commentsTextById[e.annotationId];if(t.texts?.length){let r="";t.texts.forEach(f=>r+=f.textNode?.textContent);let a=t.texts[0].textNode,s=[];document.querySelectorAll(`${U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`)?.forEach(f=>{s.push(f)});let c=!1;if(s?.length!==t?.texts?.length&&(c=!0),s?.length){let f="";s.forEach(I=>{f+=I?.textContent||""}),f&&(r=f,c&&this.removeTextCommentAnnotation(e))}let p=Jh(t.commonAncestorContainer,0,a,0,r)+1,g={};g.commonAncestorContainer=e.targetTextRange?.commonAncestorContainer,g.text=r,g.occurrence=p,gi(e.targetTextRange,g)||(t.annotation.targetTextRange=g,this.updateAnnotationToFirebase(t.annotation))}else this.setTextCommentPortal(t.annotation)}catch(t){this.loggingService.catch("Error in CommentPinPortalService onCommonAncestorElementChange: ",t)}}updateAnnotationToFirebase(e){try{this.commentService.updateComment(e,!1,!0)}catch(t){this.loggingService.catch("Error in CommentPinPortalService updateAnnotationToFirebase: ",t)}}checkToUnsubscribeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];if(t.commonAncestorElement){let r=this.commonAncestorElementObservers.get(t.commonAncestorElement);r&&(r.annotations=r?.annotations.filter(a=>a.annotationId!==e.annotationId),r.annotations.length||this.unsubscribeCommonAncestorElementChanges(e))}}catch(t){this.loggingService.catch("Error in CommentPinPortalService checkToUnsubscribeCommonAncestorElementChanges: ",t)}}setGhostComment(e){try{e.ghostComment={},this.commentService.setGhostCommentMessage(e),this.commentService.addAnnotationToGhostCommentAnnotationMap(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService setGhostComment: ",t)}}removeGhostComment(e){try{delete e.ghostComment,this.commentService.removeAnnotationFromGhostCommentAnnotationMap(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService removeGhostComment: ",t)}}onAcceptComment(e){try{let t=this.commentsTextById[e.annotationId];if(t?.texts?.length){let r=t.texts.length-1,a=t.texts[r].textNode;if(a&&a.parentNode){let s=e.comments?.length?e.comments[0]:null,c=q0(s?.replaceContentHtml)?null:s?.replaceContentHtml,p=s?.replaceContentText||s?.commentText||"";if(q0(c)&&!s?.replaceContentText&&(c=s?.commentHtml||""),e?.selectAllContent&&e?.targetElementId){let g=ua(e.targetElementId,["id","data-id"]);g&&(g.innerHTML=this.domService.sanitizeHtml(q0(c)?p||"":c||""))}else{if(c&&c!==p){let g=document.createElement("span");g.innerHTML=this.domService.sanitizeHtml(c||p||""),a.parentNode.replaceChild(g,a),t.texts[r].textNode=g}else t.texts[r].textNode.textContent=p||"";for(let g=0;g<r;g++){let f=t.texts[g].textNode;f&&(f.textContent="")}}this.removeTextCommentAnnotation(e),this.domService.resetSelectedAnnotationsMap()}}}catch(t){this.loggingService.catch("Error in CommentPinPortalService onAcceptComment: ",t)}}unsubscribeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];this.commonAncestorElementObservers.get(t.commonAncestorElement)?.observer?.disconnect(),this.commonAncestorElementObservers.delete(t.commonAncestorElement)}catch(t){this.loggingService.catch("Error in CommentPinPortalService unsubscribeCommonAncestorElementChanges: ",t)}}};o.\u0275fac=function(t){return new(t||o)(ee(rt),ee(Le),ee(De),ee(Ao),ee(Ct),ee(ni),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vm=class{constructor(){this.type="contact"}};var Qpe=i=>({componentConfigSignal:i}),dBe=(i,o)=>({condition:i,data:o}),mBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-description-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),pBe=()=>({});function gBe(i,o){i&1&&He(0)}function uBe(i,o){if(i&1&&(v(0),u(1,gBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(3);m(),d("ngTemplateOutlet",n)}}function hBe(i,o){i&1&&He(0)}function fBe(i,o){if(i&1&&(v(0),u(1,hBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(5);m(),d("ngTemplateOutlet",n)}}function vBe(i,o){i&1&&He(0)}function CBe(i,o){if(i&1&&(v(0),u(1,vBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(7);m(),d("ngTemplateOutlet",n)}}function _Be(i,o){if(i&1&&(v(0),u(1,uBe,2,1,"ng-container",3)(2,fBe,2,1,"ng-container",3)(3,CBe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.type)==="contact"),m(),d("ngIf",(n==null?null:n.type)==="custom"),m(),d("ngIf",(n==null?null:n.type)==="group")}}function yBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;_e(" ",M(1,1,(n==null||n.contact==null?null:n.contact.email)||(n==null?null:n.email))," ")}}function SBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;_e(" ",M(1,1,n==null||n.custom==null||n.custom.custom==null?null:n.custom.custom.description)," ")}}function bBe(i,o){if(i&1&&(v(0),te(1),P(2,"translate"),C()),i&2){let n,e=l(3).ngIf,t=l();m(),_r(" ",(n=t.objectKeys((e==null||e.group==null||e.group.group==null?null:e.group.group.users)||pt(4,pBe)))==null?null:n.length," ",M(2,2,"members")," ")}}function IBe(i,o){if(i&1&&u(0,bBe,3,5,"ng-container",3),i&2){let n=l(2).ngIf;d("ngIf",n==null||n.group==null?null:n.group.group)}}function EBe(i,o){if(i&1&&(v(0),u(1,_Be,4,3,"ng-container",5)(2,yBe,2,3,"ng-template",null,0,xe)(4,SBe,2,3,"ng-template",null,1,xe)(6,IBe,1,1,"ng-template",null,2,xe),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,mBe,e.template,A(1,Qpe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function xBe(i,o){if(i&1&&(v(0),u(1,EBe,8,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,dBe,n.conditionSignal(),A(1,Qpe,n.componentConfigSignal)))}}var ZI=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.objectKeys=Object.keys,super.initializeComponentConfigSignal(new vm)}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipDescriptionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipDescriptionComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-description-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contacEmailRef",""],["customDescriptionRef",""],["groupDescriptionRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"]],template:function(t,r){t&1&&u(0,xBe,2,6,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var Jpe=i=>({componentConfigSignal:i}),TBe=(i,o)=>({condition:i,data:o}),DBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function wBe(i,o){i&1&&He(0)}function OBe(i,o){if(i&1&&(v(0),u(1,wBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(3);m(),d("ngTemplateOutlet",n)}}function ABe(i,o){i&1&&He(0)}function PBe(i,o){if(i&1&&(v(0),u(1,ABe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(5);m(),d("ngTemplateOutlet",n)}}function MBe(i,o){i&1&&He(0)}function kBe(i,o){if(i&1&&(v(0),u(1,MBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(7);m(),d("ngTemplateOutlet",n)}}function RBe(i,o){if(i&1&&(v(0),u(1,OBe,2,1,"ng-container",3)(2,PBe,2,1,"ng-container",3)(3,kBe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.type)==="contact"),m(),d("ngIf",(n==null?null:n.type)==="custom"),m(),d("ngIf",(n==null?null:n.type)==="group")}}function NBe(i,o){if(i&1&&w(0,"snippyly-user-avatar",7),i&2){let n=l(2).ngIf;d("size",32)("user",n==null?null:n.contact)}}function FBe(i,o){if(i&1&&(w(0,"div",11),P(1,"safeSvg")),i&2){let n=l(3).ngIf;d("innerHtml",M(1,1,n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.svg),Ji)}}function LBe(i,o){if(i&1&&w(0,"img",12),i&2){let n=l(3).ngIf;d("src",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.url,hn)}}function BBe(i,o){if(i&1&&(u(0,FBe,2,3,"div",8),_(1,"div",9),u(2,LBe,1,1,"img",10),b()),i&2){let n=l(2).ngIf;d("ngIf",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.svg),m(2),d("ngIf",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.url)}}function VBe(i,o){i&1&&(_(0,"div",13),le(),_(1,"svg",14),w(2,"path",15),b()())}function UBe(i,o){if(i&1&&(v(0),u(1,RBe,4,3,"ng-container",5)(2,NBe,1,2,"ng-template",null,0,xe)(4,BBe,3,2,"ng-template",null,1,xe)(6,VBe,3,0,"ng-template",null,2,xe),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,DBe,e.template,A(1,Jpe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function jBe(i,o){if(i&1&&(v(0),u(1,UBe,8,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,TBe,n.conditionSignal(),A(1,Jpe,n.componentConfigSignal)))}}var XI=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,super.initializeComponentConfigSignal(new vm)}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-icon-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactAvatarRef",""],["customIconRef",""],["groupIconRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"],[1,"comment-dialog-user-avatar",3,"size","user"],["class","velt-autocomplete-chip-tooltip--icon-svg",3,"innerHtml",4,"ngIf"],[1,"velt-autocomplete-chip-tooltip--icon-img"],[3,"src",4,"ngIf"],[1,"velt-autocomplete-chip-tooltip--icon-svg",3,"innerHtml"],[3,"src"],[1,"velt-autocomplete-chip-tooltip--group-icon","velt-autocomplete-chip-tooltip--icon-svg"],["xmlns","http://www.w3.org/2000/svg","fill","rgb(233, 242, 255)","width","16","height","16","viewBox","0 0 16 16",1,"bi","bi-people-fill"],["d","M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6m-5.784 6A2.24 2.24 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.3 6.3 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1zM4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5"]],template:function(t,r){t&1&&u(0,jBe,2,6,"ng-container",3),t&2&&d("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}.velt-autocomplete-chip-tooltip--group-icon[_ngcontent-%COMP%]{width:100%;height:100%;padding:var(--velt-spacing-xs);display:flex;align-items:center;justify-content:center;background:linear-gradient(0deg,#ffffff0a,#ffffff0a),linear-gradient(0deg,#3772ff14,#3772ff14);box-sizing:border-box}.velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%]{display:flex;width:100%;height:100%;align-items:center;justify-content:center;color:var(--velt-text-0)}.velt-autocomplete-chip-tooltip--icon-img[_ngcontent-%COMP%]{display:flex;width:100%;height:100%;align-items:center;justify-content:center}.velt-autocomplete-chip-tooltip--icon-img[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:16px;height:16px;object-fit:cover}"],changeDetection:0});let i=o;return i})();var ege=i=>({componentConfigSignal:i}),$Be=(i,o)=>({condition:i,data:o}),HBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function zBe(i,o){i&1&&He(0)}function GBe(i,o){if(i&1&&(v(0),u(1,zBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(3);m(),d("ngTemplateOutlet",n)}}function WBe(i,o){i&1&&He(0)}function qBe(i,o){if(i&1&&(v(0),u(1,WBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(5);m(),d("ngTemplateOutlet",n)}}function YBe(i,o){i&1&&He(0)}function KBe(i,o){if(i&1&&(v(0),u(1,YBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(7);m(),d("ngTemplateOutlet",n)}}function ZBe(i,o){if(i&1&&(v(0),u(1,GBe,2,1,"ng-container",3)(2,qBe,2,1,"ng-container",3)(3,KBe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.type)==="contact"),m(),d("ngIf",(n==null?null:n.type)==="custom"),m(),d("ngIf",(n==null?null:n.type)==="group")}}function XBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;_e(" ",M(1,1,n==null||n.contact==null?null:n.contact.name)," ")}}function QBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;_e(" ",M(1,1,n==null||n.custom==null||n.custom.custom==null?null:n.custom.custom.name)," ")}}function JBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;_e(" ",M(1,1,(n==null||n.group==null||n.group.group==null||n.group.group.metadata==null?null:n.group.group.metadata.groupName)||(n==null||n.group==null?null:n.group.text))," ")}}function eVe(i,o){if(i&1&&(v(0),u(1,ZBe,4,3,"ng-container",5)(2,XBe,2,3,"ng-template",null,0,xe)(4,QBe,2,3,"ng-template",null,1,xe)(6,JBe,2,3,"ng-template",null,2,xe),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,HBe,e.template,A(1,ege,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tVe(i,o){if(i&1&&(v(0),u(1,eVe,8,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,$Be,n.conditionSignal(),A(1,ege,n.componentConfigSignal)))}}var QI=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,super.initializeComponentConfigSignal(new vm)}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-name-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactNameRef",""],["customNameRef",""],["groupNameRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"]],template:function(t,r){t&1&&u(0,tVe,2,6,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var tge=i=>({componentConfigSignal:i}),nVe=(i,o)=>({condition:i,data:o}),iVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function oVe(i,o){i&1&&He(0)}function rVe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,oVe,1,0,"ng-container",4),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function aVe(i,o){if(i&1&&(_(0,"div",6)(1,"div",7),w(2,"velt-autocomplete-chip-tooltip-icon-internal",8),b(),_(3,"div",9)(4,"div",10),w(5,"velt-autocomplete-chip-tooltip-name-internal",8),b(),_(6,"div",11),w(7,"velt-autocomplete-chip-tooltip-description-internal",8),b()()()),i&2){let n=l(4);m(2),d("componentConfigSignal",n.componentConfigSignal),m(3),d("componentConfigSignal",n.componentConfigSignal),m(2),d("componentConfigSignal",n.componentConfigSignal)}}function sVe(i,o){if(i&1&&u(0,aVe,8,3,"div",5),i&2){let n=l(2).ngIf,e=l();d("veltDynamicTemplate",$(3,iVe,e.template,A(1,tge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function lVe(i,o){if(i&1&&(v(0),u(1,rVe,2,1,"velt-shadow-dom-internal",3)(2,sVe,1,9,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l(2);m(),d("ngIf",e.shadowDom&&!e.template)("ngIfElse",n)}}function cVe(i,o){if(i&1&&(v(0),u(1,lVe,4,2,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,nVe,n.conditionSignal(),A(1,tge,n.componentConfigSignal)))}}var jC=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(r,a,void 0,void 0,void 0,s,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.themeService=a,this.dynamicDataService=s,this.shadowDom=!1,this.subscriptions=[],super.initializeComponentConfigSignal(new vm)}ngOnInit(){try{super.ngOnInit(),this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),this.subscriptions.push(this.wireframeService.getWireframe$("velt-autocomplete-chip-tooltip-wireframe").subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(R),h(Ye),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-internal"]],inputs:{shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["tooltipContainerRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-autocomplete-chip-tooltip",4,"veltDynamicTemplate"],[1,"velt-autocomplete-chip-tooltip"],[1,"velt-autocomplete-chip-tooltip--icon"],[3,"componentConfigSignal"],[1,"velt-autocomplete-chip-tooltip--content"],[1,"velt-autocomplete-chip-tooltip--name"],[1,"velt-autocomplete-chip-tooltip--description"]],template:function(t,r){t&1&&u(0,cVe,2,6,"ng-container",1),t&2&&d("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)}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%]{display:flex;background:var(--velt-background-0);border-radius:var(--velt-border-radius-sm);padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs) 0;box-shadow:0 4px 21px #00000014;gap:var(--velt-spacing-md);max-width:256px;line-height:1.3;align-items:center}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:var(--velt-border-radius-full);overflow:hidden;flex-shrink:0}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{display:flex}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%]{width:100%;height:100%;padding:var(--velt-spacing-xs);display:flex;align-items:center;justify-content:center;background:linear-gradient(0deg,#ffffff0a,#ffffff0a),linear-gradient(0deg,#3772ff14,#3772ff14);box-sizing:border-box}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:100%;height:100%}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%]{display:flex;flex-direction:column}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--name[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);font-weight:400;line-height:21px;text-align:left;word-break:break-word;color:var(--velt-text-0)}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--description[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);font-weight:400;line-height:17px;letter-spacing:.01em;text-align:left;color:var(--velt-text-5);word-break:break-word}"],changeDetection:0});let i=o;return i})();var Js=class{constructor(){this.onOptionClick=()=>{},this.newUserContactError=void 0,this.newUserContact=void 0,this.expandMentionGroups=!1,this.showMentionGroupsFirst=!1,this.showMentionGroupsOnly=!1,this.customGroupsEnabled=!1}},Cm=class{constructor(){this.isGroupHeader=!1,this.isGroupMember=!1,this.isNewContact=!1,this.disabled=!1}};var eq=i=>({$implicit:i}),mVe=(i,o)=>({componentConfigSignal:i,userContact:o}),tq=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-description-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),pVe=(i,o)=>({componentConfigSignal:i,custom:o}),gVe=(i,o)=>({componentConfigSignal:i,group:o}),nge=()=>({});function uVe(i,o){i&1&&He(0)}function hVe(i,o){if(i&1&&(v(0),u(1,uVe,1,0,"ng-container",4),C()),i&2){l();let n=me(5),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,eq,e.selectorItem==null?null:e.selectorItem.contact))}}function fVe(i,o){i&1&&He(0)}function vVe(i,o){if(i&1&&(v(0),u(1,fVe,1,0,"ng-container",4),C()),i&2){l();let n=me(7),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,eq,e.selectorItem==null?null:e.selectorItem.custom))}}function CVe(i,o){i&1&&He(0)}function _Ve(i,o){if(i&1&&(v(0),u(1,CVe,1,0,"ng-container",4),C()),i&2){l();let n=me(9),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,eq,e.selectorItem==null?null:e.selectorItem.group))}}function yVe(i,o){if(i&1&&(_(0,"p",6),te(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);ue("velt-autocomplete-option-description--secondary",(n.name==null?null:n.name.length)>0),x("aria-label",e.field?n[e.field]:n.email),m(),_e(" ",e.field?n[e.field]:M(2,4,n.email)," ")}}function SVe(i,o){if(i&1&&(v(0),u(1,yVe,3,6,"p",5),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,tq,t.template,k(1,mVe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function bVe(i,o){if(i&1&&u(0,SVe,2,10,"ng-container",3),i&2){let n=o.$implicit,e=l(2);d("ngIf",e.field?n==null?null:n[e.field]:(n.email==null?null:n.email.length)>0&&(n.name==null?null:n.name.length)>0)}}function IVe(i,o){if(i&1&&(_(0,"p",6),te(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit;x("aria-label",n.description),m(),_e(" ",M(2,2,n.description)," ")}}function EVe(i,o){if(i&1&&(v(0),u(1,IVe,3,4,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,tq,t.template,k(1,pVe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function xVe(i,o){if(i&1&&u(0,EVe,2,10,"ng-container",3),i&2){let n=o.$implicit;d("ngIf",(n.description==null?null:n.description.length)>0)}}function TVe(i,o){if(i&1&&(_(0,"p",6),te(1),P(2,"translate"),b()),i&2){let n,e,t=l().$implicit,r=l(2);x("aria-label",((n=r.objectKeys((t==null?null:t.users)||pt(5,nge)))==null?null:n.length)+" members"),m(),_r(" ",(e=r.objectKeys((t==null?null:t.users)||pt(6,nge)))==null?null:e.length," ",M(2,3,"members")," ")}}function DVe(i,o){if(i&1&&(v(0),u(1,TVe,3,7,"p",7),C()),i&2){let n=o.$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,tq,t.template,k(1,gVe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function wVe(i,o){if(i&1&&(v(0),u(1,hVe,2,4,"ng-container",3)(2,vVe,2,4,"ng-container",3)(3,_Ve,2,4,"ng-container",3)(4,bVe,1,1,"ng-template",null,0,xe)(6,xVe,1,1,"ng-template",null,1,xe)(8,DVe,2,10,"ng-template",null,2,xe),C()),i&2){let n=l();m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}var JI=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.objectKeys=Object.keys,this.componentId="velt-autocomplete-option-description",super.initializeComponentConfigSignal(new Js)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-description-internal"]],inputs:{selectorItem:"selectorItem",field:"field"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactEmailRef",""],["customDescriptionRef",""],["groupDescriptionRef",""],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","line-height-1 velt-autocomplete-option-description",3,"velt-autocomplete-option-description--secondary",4,"veltDynamicTemplate"],[1,"line-height-1","velt-autocomplete-option-description"],["class","line-height-1 velt-autocomplete-option-description",4,"veltDynamicTemplate"]],template:function(t,r){t&1&&u(0,wVe,10,3,"ng-container",3),t&2&&d("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%]{display:block}.velt-autocomplete-option-description[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--velt-text-8);font-size:var(--velt-font-size-xs);margin:0;line-height:18px}"],changeDetection:0});let i=o;return i})();var OVe=i=>({$implicit:i}),AVe=(i,o,n)=>({componentConfigSignal:i,isNewContact:o,userContact:n}),PVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-error-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function MVe(i,o){i&1&&He(0)}function kVe(i,o){if(i&1&&(v(0),u(1,MVe,1,0,"ng-container",2),C()),i&2){l();let n=me(3),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,OVe,e.selectorItem==null?null:e.selectorItem.contact))}}function RVe(i,o){if(i&1&&(_(0,"div",6)(1,"div",7),le(),_(2,"svg",8),w(3,"path",9)(4,"path",10),b()()()),i&2){let n=l(3).ngIf,e=l();m(),d("title",n.newUserContactError),x("title",n.newUserContactError)("data-testid",e.componentId+"-icon"),m(),x("data-testid",e.componentId+"-svg")}}function NVe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),u(2,RVe,5,4,"div",5),b()),i&2){let n=l().$implicit,e=l().ngIf,t=l();x("aria-label",M(1,3,(e==null?null:e.newUserContactError)||"Invalid contact"))("data-testid",t.componentId),m(2),d("veltDynamicTemplate",$(9,PVe,t.template,je(5,AVe,t.componentConfigSignal,t.isNewContact,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function FVe(i,o){if(i&1&&u(0,NVe,3,15,"div",3),i&2){let n=l().ngIf,e=l();d("ngIf",e.isNewContact&&n.newUserContactError)}}function LVe(i,o){if(i&1&&(v(0),u(1,kVe,2,4,"ng-container",1)(2,FVe,1,1,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact")}}var e2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-autocomplete-error-icon",super.initializeComponentConfigSignal(new Js)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem,isNewContact:this.isNewContact}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-error-icon-internal"]],inputs:{selectorItem:"selectorItem",isNewContact:"isNewContact"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["errorIconRef",""],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["role","alert",4,"ngIf"],["role","alert"],["class","velt-autocomplete-option-error-icon",4,"veltDynamicTemplate"],[1,"velt-autocomplete-option-error-icon"],[1,"s-flex",3,"title"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-exclamation-triangle"],["fill","red","d","M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"],["fill","red","d","M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"]],template:function(t,r){t&1&&u(0,LVe,4,1,"ng-container",1),t&2&&d("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}.velt-autocomplete-option-error-icon[_ngcontent-%COMP%]{margin-inline:var(--velt-spacing-lg)}.velt-autocomplete-option-error-icon[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{background-color:transparent;border:none;padding:0;margin:0;cursor:pointer;outline:none;color:var(--velt-text-1)}"],changeDetection:0});let i=o;return i})();var BVe=(i,o)=>({componentConfigSignal:i,selectorItem:o}),VVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),nq=i=>({$implicit:i});function UVe(i,o){i&1&&He(0)}function jVe(i,o){if(i&1&&(v(0),u(1,UVe,1,0,"ng-container",7),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,nq,e.selectorItem==null?null:e.selectorItem.contact))}}function $Ve(i,o){i&1&&He(0)}function HVe(i,o){if(i&1&&(v(0),u(1,$Ve,1,0,"ng-container",7),C()),i&2){l(2);let n=me(5),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,nq,e.selectorItem==null?null:e.selectorItem.custom))}}function zVe(i,o){i&1&&He(0)}function GVe(i,o){if(i&1&&(v(0),u(1,zVe,1,0,"ng-container",7),C()),i&2){l(2);let n=me(7),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,nq,e.selectorItem==null?null:e.selectorItem.group))}}function WVe(i,o){if(i&1&&(_(0,"div",6),u(1,jVe,2,4,"ng-container",4)(2,HVe,2,4,"ng-container",4)(3,GVe,2,4,"ng-container",4),b()),i&2){let n=l(2);x("data-testid",n.componentId)("aria-label","Option icon"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}function qVe(i,o){if(i&1&&(v(0),le(),_(1,"svg",9),w(2,"path",10),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-contact-at")}}function YVe(i,o){if(i&1&&w(0,"snippyly-user-avatar",11),i&2){let n=l().$implicit,e=l(2);d("size",32)("user",n),x("data-testid",e.componentId+"-contact-avatar")}}function KVe(i,o){if(i&1&&u(0,qVe,3,1,"ng-container",8)(1,YVe,1,3,"ng-template",null,3,xe),i&2){let n=o.$implicit,e=me(2);d("ngIf",(n==null?null:n.visibility)==="here")("ngIfElse",e)}}function ZVe(i,o){if(i&1&&(v(0),w(1,"div",12),P(2,"safeSvg"),C()),i&2){let n=l().$implicit,e=l(2);m(),d("innerHTML",M(2,2,n.icon.svg),Ji),x("data-testid",e.componentId+"-custom-svg")}}function XVe(i,o){if(i&1&&(v(0),w(1,"img",13),C()),i&2){let n=l().$implicit,e=l(2);m(),d("src",n.icon.url,hn),x("alt",(n==null?null:n.description)||"Custom icon")("data-testid",e.componentId+"-custom-img")}}function QVe(i,o){if(i&1&&u(0,ZVe,3,4,"ng-container",4)(1,XVe,2,3,"ng-container",4),i&2){let n=o.$implicit;d("ngIf",n==null||n.icon==null?null:n.icon.svg),m(),d("ngIf",n==null||n.icon==null?null:n.icon.url)}}function JVe(i,o){if(i&1&&(le(),_(0,"svg",14),w(1,"path",15),b()),i&2){let n=l(2);x("data-testid",n.componentId+"-group-icon")}}function eUe(i,o){if(i&1&&(v(0),u(1,WVe,4,5,"div",5)(2,KVe,3,2,"ng-template",null,0,xe)(4,QVe,2,2,"ng-template",null,1,xe)(6,JVe,2,1,"ng-template",null,2,xe),C()),i&2){let n=o.ngIf,e=l();m(),d("veltDynamicTemplate",$(4,VVe,e.template,k(1,BVe,e.componentConfigSignal,e.selectorItem),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}var t2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-autocomplete-icon",super.initializeComponentConfigSignal(new Js)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-icon-internal"]],inputs:{selectorItem:"selectorItem"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactAvatarRef",""],["customAvatarRef",""],["groupAvatarRef",""],["defaultAvatarRef",""],[4,"ngIf"],["class","velt-autocomplete-option-icon","role","img",4,"veltDynamicTemplate"],["role","img",1,"velt-autocomplete-option-icon"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],["xmlns","http://www.w3.org/2000/svg","width","24","height","24","fill","none","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-at"],["fill","currentColor","d","M13.106 7.222c0-2.967-2.249-5.032-5.482-5.032-3.35 0-5.646 2.318-5.646 5.702 0 3.493 2.235 5.708 5.762 5.708.862 0 1.689-.123 2.304-.335v-.862c-.43.199-1.354.328-2.29.328-2.926 0-4.813-1.88-4.813-4.798 0-2.844 1.921-4.881 4.594-4.881 2.735 0 4.608 1.688 4.608 4.156 0 1.682-.554 2.769-1.416 2.769-.492 0-.772-.28-.772-.76V5.206H8.923v.834h-.11c-.266-.595-.881-.964-1.6-.964-1.4 0-2.378 1.162-2.378 2.823 0 1.737.957 2.906 2.379 2.906.8 0 1.415-.39 1.709-1.087h.11c.081.67.703 1.148 1.503 1.148 1.572 0 2.57-1.415 2.57-3.643zm-7.177.704c0-1.197.54-1.907 1.456-1.907.93 0 1.524.738 1.524 1.907S8.308 9.84 7.371 9.84c-.895 0-1.442-.725-1.442-1.914z"],[3,"size","user"],[1,"velt-autocomplete-option-icon--custom-svg",3,"innerHTML"],[1,"velt-autocomplete-option-icon--custom-img",3,"src"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-people-fill"],["d","M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6m-5.784 6A2.24 2.24 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.3 6.3 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1zM4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5"]],template:function(t,r){t&1&&u(0,eUe,8,10,"ng-container",4),t&2&&d("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}.velt-autocomplete-option-icon--placeholder[_ngcontent-%COMP%]{z-index:2;opacity:.8}.velt-autocomplete-option-icon[_ngcontent-%COMP%]{min-width:calc((2.25rem + 0px) * var(--velt-base-rem-unit));width:calc((2.25rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2.25rem + 0px) * var(--velt-base-rem-unit));height:calc((2.25rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border:solid 2px transparent;display:flex;align-items:center;justify-content:center;position:relative;margin-right:var(--velt-spacing-md)}.velt-autocomplete-option-icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:var(--velt-border-radius-full);z-index:2;object-fit:cover}.velt-autocomplete-option-icon[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;z-index:1;border-radius:inherit;background:inherit}.velt-autocomplete-option-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--velt-text-1)}'],changeDetection:0});let i=o;return i})();var iq=i=>({$implicit:i}),tUe=(i,o)=>({componentConfigSignal:i,userContact:o}),oq=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),nUe=(i,o)=>({componentConfigSignal:i,custom:o}),iUe=(i,o)=>({componentConfigSignal:i,group:o});function oUe(i,o){i&1&&He(0)}function rUe(i,o){if(i&1&&(v(0),u(1,oUe,1,0,"ng-container",5),C()),i&2){l();let n=me(5),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,iq,e.selectorItem==null?null:e.selectorItem.contact))}}function aUe(i,o){i&1&&He(0)}function sUe(i,o){if(i&1&&(v(0),u(1,aUe,1,0,"ng-container",5),C()),i&2){l();let n=me(7),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,iq,e.selectorItem==null?null:e.selectorItem.custom))}}function lUe(i,o){i&1&&He(0)}function cUe(i,o){if(i&1&&(v(0),u(1,lUe,1,0,"ng-container",5),C()),i&2){l();let n=me(9),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,iq,e.selectorItem==null?null:e.selectorItem.group))}}function dUe(i,o){if(i&1&&(_(0,"p",8),te(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);x("data-testid",e.componentId+"-contact-text")("aria-label",n.name||n.email),m(),_e(" ",M(2,3,n.name||n.email)," ")}}function mUe(i,o){if(i&1&&(v(0),u(1,dUe,3,5,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,oq,t.template,k(1,tUe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function pUe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function gUe(i,o){if(i&1&&u(0,mUe,2,10,"ng-container",6)(1,pUe,1,0,"ng-template",null,3,xe),i&2){let n=o.$implicit,e=me(2);d("ngIf",(n.name==null?null:n.name.length)>0||(n==null||n.email==null?null:n.email.length)>0)("ngIfElse",e)}}function uUe(i,o){if(i&1&&(_(0,"p",8),te(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);x("data-testid",e.componentId+"-custom-text")("aria-label",n.name),m(),_e(" ",M(2,3,n.name)," ")}}function hUe(i,o){if(i&1&&(v(0),u(1,uUe,3,5,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,oq,t.template,k(1,nUe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function fUe(i,o){if(i&1&&u(0,hUe,2,10,"ng-container",4),i&2){let n=o.$implicit;d("ngIf",(n.name==null?null:n.name.length)>0)}}function vUe(i,o){if(i&1&&(_(0,"p",8),te(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);x("data-testid",e.componentId+"-group-text")("aria-label",n==null||n.metadata==null?null:n.metadata.groupName),m(),_e(" ",M(2,3,n==null||n.metadata==null?null:n.metadata.groupName)," ")}}function CUe(i,o){if(i&1&&(v(0),u(1,vUe,3,5,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,oq,t.template,k(1,iUe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function _Ue(i,o){if(i&1&&u(0,CUe,2,10,"ng-container",4),i&2){let n=o.$implicit;d("ngIf",(n==null||n.metadata==null||n.metadata.groupName==null?null:n.metadata.groupName.length)>0)}}function yUe(i,o){if(i&1&&(v(0),u(1,rUe,2,4,"ng-container",4)(2,sUe,2,4,"ng-container",4)(3,cUe,2,4,"ng-container",4)(4,gUe,3,2,"ng-template",null,0,xe)(6,fUe,1,1,"ng-template",null,1,xe)(8,_Ue,1,1,"ng-template",null,2,xe),C()),i&2){let n=l();m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}var n2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-autocomplete-name",super.initializeComponentConfigSignal(new Js)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-name-internal"]],inputs:{selectorItem:"selectorItem"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactNameRef",""],["customNameRef",""],["groupNameRef",""],["loadingTemplateRef",""],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],["class","line-height-1 velt-autocomplete-option-name","role","option",4,"veltDynamicTemplate"],["role","option",1,"line-height-1","velt-autocomplete-option-name"],["height","21px","width","80px","borderRadius","20px"]],template:function(t,r){t&1&&u(0,yUe,10,3,"ng-container",4),t&2&&d("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}.velt-autocomplete-option-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;color:var(--velt-text-1);font-size:var(--velt-font-size-sm);margin:0;line-height:21px;white-space:nowrap}"],changeDetection:0});let i=o;return i})();var SUe=(i,o,n)=>({componentConfigSignal:i,isNewContact:o,selectorItem:n}),bUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function IUe(i,o){if(i&1&&(_(0,"div",2),w(1,"velt-autocomplete-option-icon-internal",3),_(2,"div",4),w(3,"velt-autocomplete-option-name-internal",3)(4,"velt-autocomplete-option-description-internal",3),b(),w(5,"velt-autocomplete-option-error-icon-internal",5),b()),i&2){let n=l().ngIf,e=l();x("data-testid",e.componentId)("aria-selected",!1)("aria-disabled",!!(n!=null&&n.newUserContactError)),m(),d("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),x("data-testid",e.componentId+"-details"),m(),d("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),d("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),d("selectorItem",e.selectorItem)("isNewContact",e.isNewContact)("componentConfigSignal",e.componentConfigSignal)}}function EUe(i,o){if(i&1&&(v(0),u(1,IUe,6,13,"div",1),C()),i&2){let n=o.ngIf,e=l();m(),d("veltDynamicTemplate",$(5,bUe,e.template,je(1,SUe,e.componentConfigSignal,e.isNewContact,e.selectorItem),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}var $C=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.subscriptions=[],this.componentId="velt-autocomplete-option",super.initializeComponentConfigSignal(new Js)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-autocomplete-option-wireframe";this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem,isNewContact:this.isNewContact}),this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","option"),e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("aria-label",this.getOptionLabel())}catch(e){this.loggingService.catch("Error in AutocompleteOptionComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: red;"),super.ngOnDestroy(),this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnDestroy: ",e)}}getOptionLabel(){try{switch(this.selectorItem?.type){case"contact":return this.getContactLabel();case"custom":return this.selectorItem.custom?.name||"Custom option";case"group":return this.selectorItem.group?.metadata?.groupName||"Group option";default:return"Option"}}catch(e){return this.loggingService.catch("Error in AutocompleteOptionComponent getOptionLabel:",e),"Option"}}getContactLabel(){try{let e=this.selectorItem?.contact,t=e?.name||e?.email||"Contact";return this.isNewContact?`New contact: ${t}`:t}catch(e){return this.loggingService.catch("Error in AutocompleteOptionComponent getContactLabel:",e),"Contact"}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-internal"]],inputs:{selectorItem:"selectorItem",isNewContact:"isNewContact",variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],["class","velt-autocomplete-option--container","role","option",4,"veltDynamicTemplate"],["role","option",1,"velt-autocomplete-option--container"],[3,"selectorItem","componentConfigSignal"],[1,"velt-autocomplete-option--details"],[3,"selectorItem","isNewContact","componentConfigSignal"]],template:function(t,r){t&1&&u(0,EUe,2,11,"ng-container",0),t&2&&d("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%]{width:100%}.velt-autocomplete-option--container[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%}.velt-autocomplete-option--details[_ngcontent-%COMP%]{overflow:hidden;flex-grow:1}"],changeDetection:0});let i=o;return i})();var pr=class{constructor(){this.isAudioPermissionOpen=!1,this.toggleAudioPermission=()=>{},this.selectAudioDevice=()=>{},this.audioDevices=[],this.isVideoPermissionOpen=!1,this.toggleVideoPermission=()=>{},this.selectVideoDevice=()=>{},this.videoDevices=[],this.shadowDom=!1,this.isOpen=!1,this.settingsEmbedded=!1,this.closeVideoDropdown=()=>{},this.closeAudioDropdown=()=>{}}};var TUe=i=>({componentConfigSignal:i}),DUe=(i,o)=>({condition:i,data:o}),wUe=i=>({componentConfigSignal:i,type:"audio"}),OUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-audio-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function AUe(i,o){if(i&1&&(v(0),_(1,"div",5)(2,"div",6),le(),_(3,"svg",7),w(4,"path",8),b()(),ut(),w(5,"velt-media-source-settings-selected-label-internal",9)(6,"velt-media-source-settings-toggle-icon-internal",9),b(),w(7,"velt-media-source-settings-divider-internal",9)(8,"velt-media-source-settings-options-internal",9),C()),i&2){let n=l(4);m(),x("aria-hidden","true"),m(4),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-label"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-toggle"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-divider"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-options")("role","listbox")("aria-label","Audio source options")}}function PUe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),W("clickOutside",function(){F(n);let t=l(2).ngIf;return L(t.closeAudioDropdown())})("click",function(t){F(n);let r=l(2).ngIf;return L(r.toggleAudioPermission(t))}),u(2,AUe,9,15,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();ue("velt-media-source-settings-audio--active",n.isAudioPermissionOpen),x("data-testid",e.componentId)("role","button")("aria-expanded",n.isAudioPermissionOpen)("aria-haspopup","listbox")("aria-label",M(1,9,"Audio settings"))("tabindex",0),m(2),d("veltDynamicTemplate",$(13,OUe,e.template,A(11,wUe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function MUe(i,o){if(i&1&&(v(0),u(1,PUe,3,19,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.settingsVisible==null?null:n.settingsVisible.audio)}}function kUe(i,o){if(i&1&&(v(0),u(1,MUe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,DUe,n.conditionSignal(),A(1,TUe,n.componentConfigSignal)))}}var i2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-media-source-settings-audio",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-audio-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-audio","snippylyClickOutside","",3,"velt-media-source-settings-audio--active","clickOutside","click",4,"ngIf"],["snippylyClickOutside","",1,"velt-media-source-settings-audio",3,"clickOutside","click"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-audio-trigger"],[1,"velt-media-source-settings-audio-trigger-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M3.33301 6.66732C3.33301 7.90499 3.82467 9.09198 4.69984 9.96715C5.57501 10.8423 6.762 11.334 7.99967 11.334M7.99967 11.334C9.23735 11.334 10.4243 10.8423 11.2995 9.96715C12.1747 9.09198 12.6663 7.90499 12.6663 6.66732M7.99967 11.334V14.0007M5.33301 14.0007H10.6663M5.99967 3.33398C5.99967 2.80355 6.21039 2.29484 6.58546 1.91977C6.96053 1.5447 7.46924 1.33398 7.99967 1.33398C8.53011 1.33398 9.03882 1.5447 9.41389 1.91977C9.78896 2.29484 9.99967 2.80355 9.99967 3.33398V6.66732C9.99967 7.19775 9.78896 7.70646 9.41389 8.08153C9.03882 8.4566 8.53011 8.66732 7.99967 8.66732C7.46924 8.66732 6.96053 8.4566 6.58546 8.08153C6.21039 7.70646 5.99967 7.19775 5.99967 6.66732V3.33398Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["type","audio",3,"componentConfigSignal","template"]],template:function(t,r){t&1&&u(0,kUe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:[".velt-media-source-settings-audio[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-md);display:flex;flex-direction:column;align-items:center;box-sizing:border-box}.velt-media-source-settings-audio[_ngcontent-%COMP%]:hover{background:var(--velt-background-3)}.velt-media-source-settings-audio--active[_ngcontent-%COMP%]{background:var(--velt-background-2)}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%] .velt-media-source-settings-audio-trigger-icon[_ngcontent-%COMP%]{padding:1px;color:var(--velt-text-3);display:flex}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%] .velt-media-source-settings-audio-trigger-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{max-width:none}"],changeDetection:0});let i=o;return i})();var RUe=i=>({componentConfigSignal:i}),NUe=(i,o)=>({condition:i,data:o}),FUe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-divider-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function LUe(i,o){if(i&1&&(v(0),w(1,"div",3),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-divider")("role","separator")("aria-orientation","horizontal")("aria-hidden","true")}}function BUe(i,o){if(i&1&&(_(0,"div"),u(1,LUe,2,4,"ng-container",2),b()),i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-divider-container")("role","presentation"),m(),d("veltDynamicTemplate",dt(3,FUe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function VUe(i,o){if(i&1&&(v(0),u(1,BUe,2,8,"div",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function UUe(i,o){if(i&1&&(v(0),u(1,VUe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,NUe,n.conditionSignal(),A(1,RUe,n.componentConfigSignal)))}}var HC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-divider",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-divider-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-divider"]],template:function(t,r){t&1&&u(0,UUe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-media-source-settings-divider[_ngcontent-%COMP%]{width:100%;height:1px;background:var(--velt-background-4);margin-top:var(--velt-spacing-md)}"],changeDetection:0});let i=o;return i})();var jUe=i=>({componentConfigSignal:i}),$Ue=(i,o)=>({condition:i,data:o}),HUe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-options-item-icon-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function zUe(i,o){i&1&&(v(0),le(),_(1,"svg",4),w(2,"path",5),b(),C())}function GUe(i,o){if(i&1&&(v(0),_(1,"div",2),u(2,zUe,3,0,"ng-container",3),b(),C()),i&2){let n=l().ngIf,e=l();m(),ue("selected",e.device.deviceId===(e.type==="audio"?n.selectedAudioDevice==null?null:n.selectedAudioDevice.deviceId:n.selectedVideoDevice==null?null:n.selectedVideoDevice.deviceId)),x("data-testid",e.componentId+"-selected-icon")("role","presentation")("aria-hidden","true"),m(),d("veltDynamicTemplate",dt(6,HUe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function WUe(i,o){if(i&1&&(v(0),u(1,GUe,3,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,$Ue,n.conditionSignal(),A(1,jUe,n.componentConfigSignal)))}}var o2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-options-item-icon",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type,device:this.device}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-item-icon"]],inputs:{type:"type",device:"device"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[1,"velt-media-source-settings-options--selected-icon"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M3.75 9L7.5 12.75L15 5.25","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,WUe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:[".velt-media-source-settings-options--selected-icon[_ngcontent-%COMP%]{visibility:hidden;color:var(--velt-accent-text);display:flex}.velt-media-source-settings-options--selected-icon.selected[_ngcontent-%COMP%]{visibility:visible}"],changeDetection:0});let i=o;return i})();var qUe=i=>({componentConfigSignal:i}),YUe=(i,o)=>({condition:i,data:o}),KUe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-options-item-label-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function ZUe(i,o){if(i&1&&(v(0),_(1,"p"),P(2,"translate"),te(3),P(4,"translate"),b(),C()),i&2){let n=l(2).ngIf,e=l();m(),ue("velt-media-source-settings-options--label-selected",e.device.deviceId===(e.type==="audio"?n.selectedAudioDevice==null?null:n.selectedAudioDevice.deviceId:n.selectedVideoDevice==null?null:n.selectedVideoDevice.deviceId)),x("data-testid",e.componentId+"-device-label")("role","option")("title",M(2,6,e.device.label)),m(2),_e(" ",M(4,8,e.device.label)," ")}}function XUe(i,o){if(i&1&&(v(0),u(1,ZUe,5,10,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",dt(1,KUe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function QUe(i,o){if(i&1&&(v(0),u(1,XUe,2,6,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,YUe,n.conditionSignal(),A(1,qUe,n.componentConfigSignal)))}}var r2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-options-item-label",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type,device:this.device}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-item-label"]],inputs:{type:"type",device:"device"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,r){t&1&&u(0,QUe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["p[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0}.velt-media-source-settings-options--label-selected[_ngcontent-%COMP%]{color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var JUe=i=>({componentConfigSignal:i}),eje=(i,o)=>({condition:i,data:o}),tje=(i,o,n)=>({device:i,type:o,componentConfigSignal:n}),nje=(i,o,n,e,t)=>({template:i,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-options-item-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ije(i,o){if(i&1&&(v(0),w(1,"velt-media-source-settings-options-item-icon",7)(2,"velt-media-source-settings-options-item-label",7),C()),i&2){let n=l().$implicit,e=l(4);m(),d("device",n)("type",e.type)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-option-icon-"+n.deviceId),m(),d("device",n)("type",e.type)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-option-label-"+n.deviceId)}}function oje(i,o){if(i&1){let n=Y();_(0,"div",5),W("click",function(){let t=F(n).$implicit,r=l(3).ngIf,a=l();return L(a.type==="audio"?r.selectAudioDevice(t):r.selectVideoDevice(t))}),u(1,ije,3,8,"ng-container",6),b()}if(i&2){let n=o.$implicit,e=l(3).ngIf,t=l();ue("velt-media-source-settings-options--current-selected",n.deviceId===(t.type==="audio"?e.selectedAudioDevice==null?null:e.selectedAudioDevice.deviceId:e.selectedVideoDevice==null?null:e.selectedVideoDevice.deviceId)),x("data-testid",t.componentId+"-option-"+n.deviceId)("role","option"),m(),d("veltDynamicTemplate",$(9,nje,t.optionTemplate,je(5,tje,n,t.type,t.componentConfigSignal),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function rje(i,o){if(i&1&&(_(0,"div",3),u(1,oje,2,15,"div",4),b()),i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-options")("role","listbox")("aria-orientation","vertical"),m(),d("ngForOf",e.type==="audio"?n.audioDevices:n.videoDevices)}}function aje(i,o){if(i&1&&(v(0),u(1,rje,2,4,"div",2),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function sje(i,o){if(i&1&&(v(0),u(1,aje,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,eje,n.conditionSignal(),A(1,JUe,n.componentConfigSignal)))}}var zC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-options",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{if(this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes(),!this.optionTemplate){let e=this.template?.querySelector("velt-media-source-settings-options-item-wireframe");qe(e)||(this.optionTemplate=e)}}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-options",4,"ngIf"],[1,"velt-media-source-settings-options"],["class","velt-media-source-settings-options-item",3,"velt-media-source-settings-options--current-selected","click",4,"ngFor","ngForOf"],[1,"velt-media-source-settings-options-item",3,"click"],[4,"veltDynamicTemplate"],[3,"device","type","componentConfigSignal"]],template:function(t,r){t&1&&u(0,sje,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-media-source-settings-options[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;align-items:center;max-height:104px;overflow-y:scroll}.velt-media-source-settings-options-item[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer;padding-block:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-sm);color:var(--velt-text-6)}.velt-media-source-settings-options-item[_ngcontent-%COMP%]:not(.velt-media-source-settings-options--current-selected):hover{background:var(--velt-background-4);color:var(--velt-text-0)}.velt-media-source-settings-options--current-selected[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:50%;color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var lje=i=>({componentConfigSignal:i}),cje=(i,o)=>({condition:i,data:o}),dje=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-selected-label-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function mje(i,o){if(i&1&&(v(0),_(1,"p",3),te(2),P(3,"translate"),P(4,"translate"),P(5,"translate"),P(6,"translate"),b(),C()),i&2){let n,e=l(3);m(),x("data-testid",e.componentId+"-selected-device-label")("role","status")("aria-live","polite"),m(),_e(" ",e.type==="audio"?M(3,4,(n=e.componentConfigSignal().selectedAudioDevice)==null?null:n.label)??M(4,6,"No device found"):M(5,8,(n=e.componentConfigSignal().selectedVideoDevice)==null?null:n.label)??M(6,10,"No device found")," ")}}function pje(i,o){if(i&1&&(v(0),u(1,mje,7,12,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",dt(1,dje,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function gje(i,o){if(i&1&&(v(0),u(1,pje,2,6,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,cje,n.conditionSignal(),A(1,lje,n.componentConfigSignal)))}}var GC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-selected-label",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-selected-label-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-label"]],template:function(t,r){t&1&&u(0,gje,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{flex:1}.velt-media-source-settings-label[_ngcontent-%COMP%]{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0;color:var(--velt-text-3)}"],changeDetection:0});let i=o;return i})();var uje=i=>({componentConfigSignal:i}),hje=(i,o)=>({condition:i,data:o}),fje=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-toggle-icon-close-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function vje(i,o){if(i&1&&(v(0),le(),_(1,"svg",3),w(2,"path",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-toggle-icon")("aria-hidden","true")}}function Cje(i,o){if(i&1&&(v(0),u(1,vje,3,2,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",dt(1,fje,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function _je(i,o){if(i&1&&(v(0),u(1,Cje,2,6,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?!n.isAudioPermissionOpen:!n.isVideoPermissionOpen)}}function yje(i,o){if(i&1&&(v(0),u(1,_je,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,hje,n.conditionSignal(),A(1,uje,n.componentConfigSignal)))}}var a2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon-close",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-close-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","presentation",1,"velt-media-source-settings-toggle-icon"],["d","M4 7L9 12L14 7","fill","currentColor"]],template:function(t,r){t&1&&u(0,yje,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}svg[_ngcontent-%COMP%]{max-width:none;color:var(--velt-text-12)}"],changeDetection:0});let i=o;return i})();var Sje=i=>({componentConfigSignal:i}),bje=(i,o)=>({condition:i,data:o}),Ije=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-toggle-icon-open-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function Eje(i,o){if(i&1&&(v(0),le(),_(1,"svg",3),w(2,"path",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-toggle-icon-open")("aria-hidden","true")}}function xje(i,o){if(i&1&&(v(0),u(1,Eje,3,2,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",dt(1,Ije,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Tje(i,o){if(i&1&&(v(0),u(1,xje,2,6,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function Dje(i,o){if(i&1&&(v(0),u(1,Tje,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,bje,n.conditionSignal(),A(1,Sje,n.componentConfigSignal)))}}var s2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon-open",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-open-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","presentation",1,"velt-media-source-settings-toggle-icon-open"],["d","M4 12L9 7L14 12","fill","currentColor"]],template:function(t,r){t&1&&u(0,Dje,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}svg[_ngcontent-%COMP%]{max-width:none;color:var(--velt-text-12)}"],changeDetection:0});let i=o;return i})();var wje=i=>({componentConfigSignal:i}),Oje=(i,o)=>({condition:i,data:o}),Aje=(i,o)=>({componentConfigSignal:i,type:o}),Pje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-toggle-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Mje(i,o){if(i&1&&(v(0),_(1,"div",3),w(2,"velt-media-source-settings-toggle-icon-open-internal",4)(3,"velt-media-source-settings-toggle-icon-close-internal",4),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-toggle-container")("role","presentation")("aria-hidden","true"),m(),d("componentConfigSignal",n.componentConfigSignal)("type",n.type)("template",n.template),x("data-testid",n.componentId+"-toggle-open"),m(),d("componentConfigSignal",n.componentConfigSignal)("type",n.type)("template",n.template),x("data-testid",n.componentId+"-toggle-close")}}function kje(i,o){if(i&1&&(v(0),u(1,Mje,4,11,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(4,Pje,e.template,k(1,Aje,e.componentConfigSignal,e.type),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Rje(i,o){if(i&1&&(v(0),u(1,kje,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Oje,n.conditionSignal(),A(1,wje,n.componentConfigSignal)))}}var WC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings--toggle-icon"],[3,"componentConfigSignal","type","template"]],template:function(t,r){t&1&&u(0,Rje,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var Nje=i=>({componentConfigSignal:i}),Fje=(i,o)=>({condition:i,data:o}),Lje=i=>({componentConfigSignal:i,type:"video"}),Bje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-video-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Vje(i,o){if(i&1&&(v(0),_(1,"div",5)(2,"div",6),le(),_(3,"svg",7),w(4,"path",8)(5,"path",9),b()(),ut(),w(6,"velt-media-source-settings-selected-label-internal",10)(7,"velt-media-source-settings-toggle-icon-internal",10),b(),w(8,"velt-media-source-settings-divider-internal",10)(9,"velt-media-source-settings-options-internal",10),C()),i&2){let n=l(4);m(),x("aria-hidden","true"),m(5),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-label"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-toggle"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-divider"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-options")}}function Uje(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),W("clickOutside",function(){F(n);let t=l(2).ngIf;return L(t.closeVideoDropdown())})("click",function(t){F(n);let r=l(2).ngIf;return L(r.toggleVideoPermission(t))}),u(2,Vje,10,13,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();ue("velt-media-source-settings-video--active",n.isVideoPermissionOpen),x("data-testid",e.componentId)("role","button")("aria-expanded",n.isVideoPermissionOpen)("aria-haspopup","listbox")("aria-label",M(1,9,"Video settings"))("tabindex",0),m(2),d("veltDynamicTemplate",$(13,Bje,e.template,A(11,Lje,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function jje(i,o){if(i&1&&(v(0),u(1,Uje,3,19,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.settingsVisible==null?null:n.settingsVisible.video)}}function $je(i,o){if(i&1&&(v(0),u(1,jje,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Fje,n.conditionSignal(),A(1,Nje,n.componentConfigSignal)))}}var l2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-media-source-settings-video",super.initializeComponentConfigSignal(new pr)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-video-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-video","snippylyClickOutside","",3,"velt-media-source-settings-video--active","clickOutside","click",4,"ngIf"],["snippylyClickOutside","",1,"velt-media-source-settings-video",3,"clickOutside","click"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-video-trigger"],[1,"velt-media-source-settings-video-trigger-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M10 6.66675L13.0353 5.14941C13.1369 5.09864 13.2499 5.07467 13.3633 5.07978C13.4768 5.08489 13.5871 5.11891 13.6837 5.17862C13.7804 5.23832 13.8602 5.32173 13.9155 5.42093C13.9709 5.52012 13.9999 5.63182 14 5.74541V10.2547C13.9999 10.3683 13.9709 10.48 13.9155 10.5792C13.8602 10.6784 13.7804 10.7618 13.6837 10.8215C13.5871 10.8812 13.4768 10.9153 13.3633 10.9204C13.2499 10.9255 13.1369 10.9015 13.0353 10.8507L10 9.33341V6.66675Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["d","M2 5.33333C2 4.97971 2.14048 4.64057 2.39052 4.39052C2.64057 4.14048 2.97971 4 3.33333 4H8.66667C9.02029 4 9.35943 4.14048 9.60948 4.39052C9.85952 4.64057 10 4.97971 10 5.33333V10.6667C10 11.0203 9.85952 11.3594 9.60948 11.6095C9.35943 11.8595 9.02029 12 8.66667 12H3.33333C2.97971 12 2.64057 11.8595 2.39052 11.6095C2.14048 11.3594 2 11.0203 2 10.6667V5.33333Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["type","video",3,"componentConfigSignal","template"]],template:function(t,r){t&1&&u(0,$je,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:[".velt-media-source-settings-video[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-md);display:flex;flex-direction:column;align-items:center;box-sizing:border-box}.velt-media-source-settings-video[_ngcontent-%COMP%]:hover{background:var(--velt-background-3)}.velt-media-source-settings-video--active[_ngcontent-%COMP%]{background:var(--velt-background-2)}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%] .velt-media-source-settings-video-trigger-icon[_ngcontent-%COMP%]{display:flex;padding:1px;color:var(--velt-text-3)}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%] .velt-media-source-settings-video-trigger-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{max-width:none}"],changeDetection:0});let i=o;return i})();var ige=i=>({componentConfigSignal:i}),Hje=(i,o)=>({condition:i,data:o}),zje=(i,o,n,e,t)=>({template:i,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Gje(i,o){i&1&&He(0)}function Wje(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,Gje,1,0,"ng-container",4),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function qje(i,o){if(i&1&&(v(0),_(1,"div",8),w(2,"velt-media-source-settings-audio-internal",9)(3,"velt-media-source-settings-video-internal",9),b(),C()),i&2){let n=l(5);m(),x("role","group")("aria-label","Media settings controls"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-audio")("role","region")("aria-label","Audio settings"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-video")("role","region")("aria-label","Video settings")}}function Yje(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),u(2,qje,4,10,"ng-container",7),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("role","dialog")("aria-label",M(1,5,"Media source settings"))("aria-modal","true"),m(2),d("veltDynamicTemplate",$(9,zje,e.template,A(7,ige,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Kje(i,o){if(i&1&&u(0,Yje,3,15,"div",5),i&2){let n=l(2).ngIf;d("ngIf",n.isOpen||n.settingsEmbedded)}}function Zje(i,o){if(i&1&&(v(0),u(1,Wje,2,1,"velt-shadow-dom-internal",3)(2,Kje,1,1,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l().ngIf,t=l();m(),d("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function Xje(i,o){if(i&1&&(v(0),u(1,Zje,4,2,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,Hje,n.conditionSignal(),A(1,ige,n.componentConfigSignal)))}}var c2=(()=>{let o=class o extends H{constructor(e,t,r,a,s,c){super(a,s,e),this.loggingService=e,this.wireframeService=t,this.devicePermissionService=r,this.elementRef=a,this.dynamicDataService=s,this.recorderService=c,this.isOpen=!1,this.showMicSettings=!0,this.showCamSettings=!0,this.config={},this.shadowDom=!0,this.devices=[],this.defaultMediaSourceOptions=rd(),this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=Ee({toggleAudioPermission:this.toggleAudioPermission.bind(this),selectAudioDevice:this.selectAudioDevice.bind(this),toggleVideoPermission:this.toggleVideoPermission.bind(this),selectVideoDevice:this.selectVideoDevice.bind(this),isAudioPermissionOpen:!1,settingsVisible:{audio:!0,video:!0},selectedAudioDevice:void 0,selectedVideoDevice:void 0,isVideoPermissionOpen:!1,audioDevices:[],videoDevices:[],shadowDom:this.shadowDom,isOpen:this.isOpen,variant:this.variant,settingsEmbedded:!1,closeVideoDropdown:this.closeVideoDropdown.bind(this),closeAudioDropdown:this.closeAudioDropdown.bind(this)}),this.componentId="velt-media-source-settings";try{this.getDevices(),this.subscriptions.push(this.devicePermissionService.getPermissionState$("video").subscribe(p=>{this.getDevices()})),this.subscriptions.push(this.devicePermissionService.getPermissionState$("audio").subscribe(p=>{this.getDevices()})),this.subscriptions.push(this.recorderService.getSettingsEmbedded$().subscribe(p=>{this.componentConfigSignal.update(g=>T(E({},g),{settingsEmbedded:p}))}))}catch(p){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent constructor: ",p)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.updateSettingsVisibility(),this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-media-source-settings-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(E({},r),{[t]:e[t].currentValue}),r))}),(e.showMicSettings||e.showCamSettings)&&this.updateSettingsVisibility()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnDestroy: ",e)}}updateSettingsVisibility(){try{this.componentConfigSignal.update(e=>T(E({},e),{settingsVisible:{audio:this.showMicSettings,video:this.showCamSettings}}))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnChanges: ",e)}}getDevices(){return Q(this,null,function*(){try{let e=new Yn;if(e.getBrowserName()?.toLowerCase()==="safari"||e.getBrowserName()?.toLowerCase()==="firefox")try{let t=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0});t&&t.getTracks().forEach(r=>r.stop())}catch(t){this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices getUserMedia catch: ",t)}navigator.mediaDevices.enumerateDevices().then(t=>{if(this.devices=t.filter(r=>r.kind==="audioinput"||r.kind==="videoinput"),this.componentConfigSignal.update(r=>T(E({},r),{audioDevices:this.devices.filter(a=>a.kind==="audioinput"&&a.deviceId!==""),videoDevices:this.devices.filter(a=>a.kind==="videoinput"&&a.deviceId!=="")})),this.componentConfigSignal().audioDevices.length>0&&!this.componentConfigSignal().selectedAudioDevice){if(this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId){let r=this.componentConfigSignal().audioDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId);r&&this.componentConfigSignal.update(a=>T(E({},a),{selectedAudioDevice:r}))}this.componentConfigSignal().selectedAudioDevice||this.componentConfigSignal.update(r=>T(E({},r),{selectedAudioDevice:this.componentConfigSignal().audioDevices[0]}))}if(this.componentConfigSignal().videoDevices.length>0&&!this.componentConfigSignal().selectedVideoDevice){if(this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId){let r=this.componentConfigSignal().videoDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId);r&&this.componentConfigSignal.update(a=>T(E({},a),{selectedVideoDevice:r}))}this.componentConfigSignal().selectedVideoDevice||this.componentConfigSignal.update(r=>T(E({},r),{selectedVideoDevice:this.componentConfigSignal().videoDevices[0]}))}}).catch(t=>{this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices enumerateDevices catch: ",t)})}catch(e){this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices: ",e)}})}selectAudioDevice(e){try{this.componentConfigSignal.update(t=>T(E({},t),{selectedAudioDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",t)}}selectVideoDevice(e){try{this.componentConfigSignal.update(t=>T(E({},t),{selectedVideoDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectVideoDevice: ",t)}}saveChanges(){try{let e={};this.componentConfigSignal()?.settingsVisible?.audio&&(e.selectedAudioDevice=this.componentConfigSignal()?.selectedAudioDevice),this.componentConfigSignal()?.settingsVisible?.video&&(e.selectedVideoDevice=this.componentConfigSignal()?.selectedVideoDevice),localStorage.setItem(U.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(e||{})),this.defaultMediaSourceOptions=rd(),this.config.mediaConfig.audio||(this.config.mediaConfig.audio={enabled:!1}),this.config.mediaConfig.audio.deviceId=this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId,this.config.mediaConfig.video||(this.config.mediaConfig.video={enabled:!1}),this.config.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId,this.config.updateMediaConfig(this.config.mediaConfig)}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent saveChanges: ",e)}}toggleAudioPermission(e){try{e.stopPropagation(),this.componentConfigSignal().audioDevices.length>0&&this.componentConfigSignal.update(t=>T(E({},t),{isAudioPermissionOpen:!t.isAudioPermissionOpen}))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleAudioPermission: ",t)}}toggleVideoPermission(e){try{e.stopPropagation(),this.componentConfigSignal().videoDevices.length>0&&this.componentConfigSignal.update(t=>(t=T(E({},t),{isVideoPermissionOpen:!t.isVideoPermissionOpen}),t))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleVideoPermission: ",t)}}closeVideoDropdown(){try{this.componentConfigSignal.update(e=>(e=T(E({},e),{isVideoPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeVideoDropdown: ",e)}}closeAudioDropdown(){try{this.componentConfigSignal.update(e=>(e=T(E({},e),{isAudioPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeAudioDropdown: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(um),h(R),h(S),h(Sn))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-internal"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{isOpen:"isOpen",showMicSettings:"showMicSettings",showCamSettings:"showCamSettings",config:"config",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[["mediaSourcePermissionRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-media-source-settings-container",4,"ngIf"],[1,"velt-media-source-settings-container"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,Xje,2,6,"ng-container",1),t&2&&d("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}.velt-media-source-settings[_ngcontent-%COMP%]{position:absolute;left:0;bottom:90px;border-radius:var(--velt-border-radius-lg);background:var(--velt-background-1);display:flex;flex-direction:column;width:366px;font-weight:400;font-size:var(--velt-font-size-xs);line-height:18px;overflow:hidden}"],changeDetection:0});let i=o;return i})();var En=class{constructor(){this.closeDialog=()=>{},this.startCountdown=()=>{},this.toggleAudio=()=>{},this.toggleVideo=()=>{},this.toggleSettings=()=>{},this.cancelCountdown=()=>{},this.updateMediaConfig=()=>{},this.handleOverlayClick=()=>{},this.countdownStarted=!1,this.isSettingsOpen=!1,this.mediaConfig={audio:{enabled:!1},video:{enabled:!1}},this.mediaState={audio:{enabled:!1},video:{enabled:!1}},this.type="video",this.darkMode=!1,this.shadowDom=!0}};var Qje=i=>({componentConfigSignal:i}),Jje=(i,o)=>({condition:i,data:o}),e$e=(i,o)=>({componentConfigSignal:i,variant:o}),t$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-audio-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function n$e(i,o){i&1&&He(0)}function i$e(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,n$e,1,0,"ng-container",5),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function o$e(i,o){if(i&1&&(v(0),_(1,"div",9)(2,"div",10),w(3,"app-recording-preview-steps-dialog-close-button",11),b(),w(4,"app-recording-preview-steps-dialog-timer",11)(5,"app-recording-preview-steps-dialog-waveform",12),_(6,"div",13),w(7,"velt-recording-preview-steps-dialog-settings-panel-internal",12),_(8,"app-recording-preview-steps-dialog-button-panel",11),w(9,"app-recording-preview-steps-dialog-start-recording",11)(10,"velt-recording-preview-steps-dialog-mic-button-internal",11)(11,"app-recording-preview-steps-dialog-settings",11),b(),w(12,"app-recording-preview-steps-dialog-bottom-panel",11),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-overlay"),m(),x("data-testid",n.componentId+"-header"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal),m(),x("data-testid",n.componentId+"-settings")("role","group")("aria-label","Recording settings"),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function r$e(i,o){if(i&1){let n=Y();_(0,"div",7,1),P(2,"translate"),W("pointerdown",function(t){return F(n),L(t.stopPropagation())})("pointerup",function(t){return F(n),L(t.stopPropagation())})("click",function(t){F(n);let r=l(3).ngIf;return L(r.handleOverlayClick(t))}),u(3,o$e,13,28,"ng-container",8),b()}if(i&2){let n=l(4);x("data-testid",n.componentId)("role","dialog")("aria-label",M(2,4,"Audio recording preview")),m(3),d("veltDynamicTemplate",$(9,t$e,n.template,k(6,e$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function a$e(i,o){if(i&1&&u(0,r$e,4,15,"div",6),i&2){let n=l(2).ngIf;d("ngIf",n.type==="audio")}}function s$e(i,o){if(i&1&&(v(0),u(1,i$e,2,1,"velt-shadow-dom-internal",4)(2,a$e,1,1,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l().ngIf,t=l();m(),d("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function l$e(i,o){if(i&1&&(v(0),u(1,s$e,4,2,"ng-container",3),C()),i&2){let n=l();m(),d("veltIf",k(3,Jje,n.conditionSignal(),A(1,Qje,n.componentConfigSignal)))}}var d2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-audio",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-recording-preview-steps-dialog-audio-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-audio"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["audioDialogRef",""],["recordingPreviewDialogRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-recording-preview-audio",3,"pointerdown","pointerup","click",4,"ngIf"],[1,"velt-recording-preview-audio",3,"pointerdown","pointerup","click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-audio--overlay"],[1,"velt-recording-preview-audio--header"],[3,"componentConfigSignal","template","variant"],[3,"componentConfigSignal"],[1,"velt-recording-preview-audio--settings"]],template:function(t,r){t&1&&u(0,l$e,2,6,"ng-container",2),t&2&&d("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%]{width:100%;height:100%}.velt-recording-preview-audio[_ngcontent-%COMP%], .velt-recording-preview-audio--header[_ngcontent-%COMP%]{display:flex}.velt-recording-preview-audio[_ngcontent-%COMP%]{position:relative;width:calc((50rem + 0px) * var(--velt-base-rem-unit));height:calc((30rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}.velt-recording-preview-audio[_ngcontent-%COMP%] .velt-recording-preview-audio--audio-waves[_ngcontent-%COMP%]{transform:scale(1.5);height:100%;z-index:-1}@media screen and (max-width: 768px){.velt-recording-preview-audio[_ngcontent-%COMP%]{width:calc((35rem + 0px) * var(--velt-base-rem-unit));height:calc((25rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}}@media screen and (max-width: 425px){ .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-audio{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));max-width:calc(1 * var(--legacy-velt-viewport-width));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-audio video{height:100%}}.velt-recording-preview-audio--overlay[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--velt-spacing-2xl);content:"";position:absolute;border-radius:var(--velt-border-radius-lg);border:1px solid var(--velt-border-2);background:var(--velt-background-0);z-index:1;inset:0}.velt-recording-preview-audio--header[_ngcontent-%COMP%]{justify-content:flex-end;width:100%;gap:var(--velt-spacing-sm);align-items:center}.velt-recording-preview-audio--settings[_ngcontent-%COMP%]{width:366px;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;position:relative;pointer-events:auto}'],changeDetection:0});let i=o;return i})();var c$e=i=>({componentConfigSignal:i}),d$e=(i,o)=>({condition:i,data:o}),m$e=(i,o)=>({componentConfigSignal:i,variant:o}),p$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-close-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function g$e(i,o){if(i&1&&(v(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function u$e(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),W("click",function(){F(n);let t=l(2).ngIf;return L(t.closeDialog())}),u(2,g$e,4,1,"ng-container",4),b()}if(i&2){let n=l(3);x("data-testid",n.componentId)("aria-label",M(1,3,"Cancel recording")),m(2),d("veltDynamicTemplate",$(8,p$e,n.template,k(5,m$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function h$e(i,o){if(i&1&&(v(0),u(1,u$e,3,14,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.countdownStarted)}}function f$e(i,o){if(i&1&&(v(0),u(1,h$e,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,d$e,n.conditionSignal(),A(1,c$e,n.componentConfigSignal)))}}var m2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-close",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Close recording preview")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-close"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-recording-preview--bottom-panel-close","role","button","tabindex","0",3,"click",4,"ngIf"],["role","button","tabindex","0",1,"velt-recording-preview--bottom-panel-close",3,"click"],[4,"veltDynamicTemplate"],["aria-hidden","true",1,"velt-recording-preview--close"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","img","aria-hidden","true"],["d","M12 3.99805L4 11.998M4 3.99805L12 11.998","stroke","currentColor","stroke-width","1.33333","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,f$e,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:[".velt-recording-preview--close[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm);cursor:pointer;display:flex;color:var(--velt-text-12);transition:all .2s ease}.velt-recording-preview--close[_ngcontent-%COMP%]:hover{color:var(--velt-text-10)}"],changeDetection:0});let i=o;return i})();var v$e=i=>({componentConfigSignal:i}),C$e=(i,o)=>({condition:i,data:o}),_$e=(i,o)=>({componentConfigSignal:i,variant:o}),y$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-countdown-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function S$e(i,o){if(i&1&&(_(0,"div",4),te(1),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("aria-label","Recording starts in "+n.countdown+" seconds"),m(),_e(" ",n.countdown," ")}}function b$e(i,o){if(i&1&&(v(0),u(1,S$e,2,3,"div",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.countdownStarted)}}function I$e(i,o){if(i&1&&(v(0),u(1,b$e,2,1,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,y$e,n.template,k(1,_$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function E$e(i,o){if(i&1&&(v(0),u(1,I$e,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,C$e,n.conditionSignal(),A(1,v$e,n.componentConfigSignal)))}}var p2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-countdown",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-countdown"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-recording-preview--countdown","role","timer","aria-live","polite",4,"ngIf"],["role","timer","aria-live","polite",1,"velt-recording-preview--countdown"]],template:function(t,r){t&1&&u(0,E$e,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:[".velt-recording-preview--countdown[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;font-size:var(--velt-font-size-sm);font-weight:500;color:var(--velt-text-4)}"],changeDetection:0});let i=o;return i})();var x$e=i=>({componentConfigSignal:i}),T$e=(i,o)=>({condition:i,data:o}),rq=(i,o)=>({componentConfigSignal:i,variant:o}),aq=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function D$e(i,o){if(i&1&&(v(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-video")}}function w$e(i,o){if(i&1&&(v(0),u(1,D$e,5,1,"ng-container",4),C()),i&2){let n=l(4);m(),d("veltDynamicTemplate",$(4,aq,n.template,k(1,rq,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function O$e(i,o){if(i&1&&(v(0),_(1,"div",9),le(),_(2,"svg",6),w(3,"path",10),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-screen")}}function A$e(i,o){if(i&1&&(v(0),u(1,O$e,4,1,"ng-container",4),C()),i&2){let n=l(4);m(),d("veltDynamicTemplate",$(4,aq,n.template,k(1,rq,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function P$e(i,o){if(i&1&&(v(0),_(1,"div",11),le(),_(2,"svg",6),w(3,"path",12),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-audio")}}function M$e(i,o){if(i&1&&(v(0),u(1,P$e,4,1,"ng-container",4),C()),i&2){let n=l(4);m(),d("veltDynamicTemplate",$(4,aq,n.template,k(1,rq,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function k$e(i,o){if(i&1&&(v(0)(1,2),_(2,"div"),u(3,w$e,2,10,"ng-container",3)(4,A$e,2,10,"ng-container",3)(5,M$e,2,10,"ng-container",3),b(),C()()),i&2){let n=l(2).ngIf,e=l();m(),d("ngSwitch",n.type),m(),ue("velt-recording-preview--recording-started",n.countdownStarted),x("data-testid",e.componentId),m(),d("ngSwitchCase","video"),m(),d("ngSwitchCase","screen"),m(),d("ngSwitchCase","audio")}}function R$e(i,o){if(i&1&&(v(0),u(1,k$e,6,7,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",!e.type||e.type===n.type)}}function N$e(i,o){if(i&1&&(v(0),u(1,R$e,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,T$e,n.conditionSignal(),A(1,x$e,n.componentConfigSignal)))}}var g2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-icon",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label",`${this.type||""} recording icon`)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-icon"]],inputs:{type:"type",variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"veltDynamicTemplate"],["role","img","aria-label","Video recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M14.6657 10.2226L18.7128 8.19949C18.8483 8.13179 18.9988 8.09983 19.1501 8.10664C19.3014 8.11346 19.4485 8.15882 19.5773 8.23843C19.7062 8.31803 19.8126 8.42924 19.8864 8.56151C19.9602 8.69377 19.9989 8.8427 19.999 8.99415V15.0066C19.9989 15.1581 19.9602 15.307 19.8864 15.4392C19.8126 15.5715 19.7062 15.6827 19.5773 15.7623C19.4485 15.8419 19.3014 15.8873 19.1501 15.8941C18.9988 15.9009 18.8483 15.869 18.7128 15.8013L14.6657 13.7782V10.2226Z","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M3.99902 8.44428C3.99902 7.97279 4.18632 7.5206 4.51972 7.1872C4.85312 6.8538 5.30531 6.6665 5.7768 6.6665H12.8879C13.3594 6.6665 13.8116 6.8538 14.145 7.1872C14.4784 7.5206 14.6657 7.97279 14.6657 8.44428V15.5554C14.6657 16.0269 14.4784 16.4791 14.145 16.8125C13.8116 17.1459 13.3594 17.3332 12.8879 17.3332H5.7768C5.30531 17.3332 4.85312 17.1459 4.51972 16.8125C4.18632 16.4791 3.99902 16.0269 3.99902 15.5554V8.44428Z","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["role","img","aria-label","Screen recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["d","M18.5 12.0004V14.1671C18.5 14.3586 18.4239 14.5423 18.2885 14.6778C18.153 14.8132 17.9693 14.8893 17.7778 14.8893H6.22222C6.03068 14.8893 5.84698 14.8132 5.71153 14.6778C5.57609 14.5423 5.5 14.3586 5.5 14.1671V6.94488C5.5 6.75333 5.57609 6.56963 5.71153 6.43419C5.84698 6.29875 6.03068 6.22266 6.22222 6.22266H12.7222M8.38889 17.7782H15.6111M9.83333 14.8893V17.7782M14.1667 14.8893V17.7782M15.6111 6.22266H18.5M18.5 6.22266V9.11155M18.5 6.22266L14.8889 9.83377","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["role","img","aria-label","Audio recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["d","M7 10.4291C7 11.7552 7.52678 13.027 8.46447 13.9647C9.40215 14.9023 10.6739 15.4291 12 15.4291M12 15.4291C13.3261 15.4291 14.5979 14.9023 15.5355 13.9647C16.4732 13.027 17 11.7552 17 10.4291M12 15.4291V18.2863M9.14286 18.2863H14.8571M9.85714 6.8577C9.85714 6.28938 10.0829 5.74434 10.4848 5.34247C10.8866 4.94061 11.4317 4.71484 12 4.71484C12.5683 4.71484 13.1134 4.94061 13.5152 5.34247C13.9171 5.74434 14.1429 6.28938 14.1429 6.8577V10.4291C14.1429 10.9975 13.9171 11.5425 13.5152 11.9444C13.1134 12.3462 12.5683 12.572 12 12.572C11.4317 12.572 10.8866 12.3462 10.4848 11.9444C10.0829 11.5425 9.85714 10.9975 9.85714 10.4291V6.8577Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,N$e,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:[".velt-recording-preview--bottom-panel-icon[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-full);display:flex;margin-right:var(--velt-spacing-md);color:var(--velt-accent-foreground)}.velt-recording-preview--recording-started[_ngcontent-%COMP%] .velt-recording-preview--bottom-panel-icon[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm)}"],changeDetection:0});let i=o;return i})();var F$e=i=>({componentConfigSignal:i}),L$e=(i,o)=>({condition:i,data:o}),B$e=(i,o)=>({componentConfigSignal:i,variant:o}),V$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function U$e(i,o){if(i&1&&(_(0,"div",6),te(1),P(2,"translate"),w(3,"app-recording-preview-steps-dialog-bottom-panel-countdown",4),b()),i&2){let n=l(4);x("data-testid",n.componentId+"-countdown"),m(),_e(" ",M(2,5,"Starting recording in")," "),m(2),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function j$e(i,o){if(i&1&&(v(0),_(1,"div",3),P(2,"translate"),w(3,"app-recording-preview-steps-dialog-bottom-panel-icon",4),u(4,U$e,4,7,"div",5),w(5,"app-recording-preview-steps-dialog-bottom-panel-close",4),b(),C()),i&2){let n=l(2).ngIf,e=l();m(),ue("velt-recording-preview--recording-started",n.countdownStarted),x("data-testid",e.componentId)("aria-label",M(2,11,"Recording preview bottom panel")),m(2),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),d("ngIf",n.countdownStarted),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function $$e(i,o){if(i&1&&(v(0),u(1,j$e,6,13,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,V$e,n.template,k(1,B$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function H$e(i,o){if(i&1&&(v(0),u(1,$$e,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,L$e,n.conditionSignal(),A(1,F$e,n.componentConfigSignal)))}}var qC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording controls bottom panel")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-recording-preview--bottom-panel"],[3,"componentConfigSignal","template","variant"],["class","velt-recording-preview--countdown","role","status","aria-live","polite",4,"ngIf"],["role","status","aria-live","polite",1,"velt-recording-preview--countdown"]],template:function(t,r){t&1&&u(0,H$e,2,6,"ng-container",0),t&2&&d("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:fixed;bottom:5%}.velt-recording-preview--bottom-panel[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_showAfterDelay .4s forwards}@keyframes _ngcontent-%COMP%_showAfterDelay{0%{opacity:0}99%{opacity:0}to{opacity:1}}.velt-recording-preview--recording-started[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;padding:var(--velt-spacing-xs) var(--velt-spacing-md) var(--velt-spacing-xs) var(--velt-spacing-xs);border-radius:var(--velt-border-radius-3xl);border:1px solid var(--velt-border-2);background:var(--velt-background-0);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.velt-recording-preview--countdown[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;font-size:var(--velt-font-size-sm);font-weight:500;color:var(--velt-text-4);gap:var(--velt-spacing-xs)}"],changeDetection:0});let i=o;return i})();var z$e=["*"],G$e=i=>({componentConfigSignal:i}),W$e=(i,o)=>({condition:i,data:o}),q$e=(i,o)=>({componentConfigSignal:i,variant:o}),Y$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-button-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function K$e(i,o){i&1&&(v(0),Vt(1),C())}function Z$e(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),u(2,K$e,2,0,"ng-container",4),b()),i&2){let n=l(3);x("data-testid",n.componentId)("aria-label",M(1,4,"Recording control buttons"))("aria-orientation","horizontal"),m(2),d("veltDynamicTemplate",$(9,Y$e,n.template,k(6,q$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function X$e(i,o){if(i&1&&(v(0),u(1,Z$e,3,15,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!n.countdownStarted)}}function Q$e(i,o){if(i&1&&(v(0),u(1,X$e,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,W$e,n.conditionSignal(),A(1,G$e,n.componentConfigSignal)))}}var YC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-button-panel",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Recording controls")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-button-panel"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],ngContentSelectors:z$e,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-recording-preview-button-panel","role","toolbar",4,"ngIf"],["role","toolbar",1,"velt-recording-preview-button-panel"],[4,"veltDynamicTemplate"]],template:function(t,r){t&1&&(jt(),u(0,Q$e,2,6,"ng-container",0)),t&2&&d("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}.velt-recording-preview-button-panel[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--velt-spacing-sm);margin-bottom:var(--velt-spacing-lg)}"],changeDetection:0});let i=o;return i})();var J$e=i=>({componentConfigSignal:i}),eHe=(i,o)=>({condition:i,data:o}),tHe=(i,o)=>({componentConfigSignal:i,variant:o}),nHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-off-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function iHe(i,o){if(i&1&&(v(0),le(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function oHe(i,o){if(i&1&&(v(0),u(1,iHe,4,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(4,nHe,n.template,k(1,tHe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function rHe(i,o){if(i&1&&(v(0),u(1,oHe,2,10,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled))}}function aHe(i,o){if(i&1&&(v(0),u(1,rHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,eHe,n.conditionSignal(),A(1,J$e,n.componentConfigSignal)))}}var u2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-camera-button-off",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Camera off"),e.setAttribute("aria-pressed","true"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-off-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["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.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","#FF7162","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,aHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var sHe=i=>({componentConfigSignal:i}),lHe=(i,o)=>({condition:i,data:o}),cHe=(i,o)=>({componentConfigSignal:i,variant:o}),dHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-on-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function mHe(i,o){if(i&1&&(v(0),le(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function pHe(i,o){if(i&1&&(v(0),u(1,mHe,4,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(4,dHe,n.template,k(1,cHe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function gHe(i,o){if(i&1&&(v(0),u(1,pHe,2,10,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.mediaConfig.video==null?null:n.mediaConfig.video.enabled)}}function uHe(i,o){if(i&1&&(v(0),u(1,gHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,lHe,n.conditionSignal(),A(1,sHe,n.componentConfigSignal)))}}var h2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-camera-button-on",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Camera on"),e.setAttribute("aria-pressed","false"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-on-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M16.5 12.3334L20.2942 10.4368C20.4212 10.3733 20.5623 10.3433 20.7042 10.3497C20.846 10.3561 20.9839 10.3986 21.1047 10.4733C21.2255 10.5479 21.3252 10.6522 21.3944 10.7762C21.4636 10.9002 21.4999 11.0398 21.5 11.1818V16.8184C21.4999 16.9604 21.4636 17.1 21.3944 17.224C21.3252 17.348 21.2255 17.4523 21.1047 17.5269C20.9839 17.6016 20.846 17.6441 20.7042 17.6505C20.5623 17.6569 20.4212 17.6269 20.2942 17.5634L16.5 15.6668V12.3334Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 10.6667C6.5 10.2246 6.67559 9.80072 6.98816 9.48816C7.30072 9.17559 7.72464 9 8.16667 9H14.8333C15.2754 9 15.6993 9.17559 16.0118 9.48816C16.3244 9.80072 16.5 10.2246 16.5 10.6667V17.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.6667Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,uHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var hHe=i=>({componentConfigSignal:i}),fHe=(i,o)=>({condition:i,data:o}),vHe=(i,o)=>({componentConfigSignal:i,variant:o}),CHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function _He(i,o){if(i&1&&(v(0),_(1,"div",6),w(2,"velt-recording-preview-steps-dialog-camera-button-on-internal",7)(3,"velt-recording-preview-steps-dialog-camera-button-off-internal",7),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),ue("velt-recording-preview--icon-button-off",!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)),x("data-testid",e.componentId+"-icon-container"),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function yHe(i,o){if(i&1){let n=Y();_(0,"app-device-permission-button",3)(1,"div",4),P(2,"translate"),P(3,"translate"),P(4,"translate"),W("click",function(){F(n);let t=l(2).ngIf;return L(t.toggleVideo())}),u(5,_He,4,9,"ng-container",5),b()()}if(i&2){let n=l(2).ngIf,e=l();d("darkMode",!!n.darkMode),x("data-testid",e.componentId+"-permission-button"),m(),x("data-testid",e.componentId+"-toggle")("aria-label",M(2,6,"Toggle camera")+" "+(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled?M(3,8,"off"):M(4,10,"on")))("aria-pressed",!!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)),m(4),d("veltDynamicTemplate",$(15,CHe,e.template,k(12,vHe,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function SHe(i,o){if(i&1&&(v(0),u(1,yHe,6,21,"app-device-permission-button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.type==="screen")}}function bHe(i,o){if(i&1&&(v(0),u(1,SHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,fHe,n.conditionSignal(),A(1,hHe,n.componentConfigSignal)))}}var f2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,t),this.devicePermissionService=e,this.loggingService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-camera-button",super.initializeComponentConfigSignal(new En)}ngOnChanges(e){try{if(e.componentConfigSignal){let t=this.componentConfigSignal();!t?.mediaState?.video?.enabled&&t.type==="video"&&this.devicePermissionService.openDevicePermissionDeniedDialog("video",{darkMode:!1})}}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent ngOnChanges:",t)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),!this.componentConfigSignal()?.mediaState?.video?.enabled&&this.componentConfigSignal().type==="video"&&this.devicePermissionService.openDevicePermissionDeniedDialog("video",{darkMode:!1})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label","Camera control buttons")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(um),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","video",3,"darkMode",4,"ngIf"],["type","video",3,"darkMode"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],[3,"componentConfigSignal","template","variant"]],template:function(t,r){t&1&&u(0,bHe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}"],changeDetection:0});let i=o;return i})();var oge=i=>({componentConfigSignal:i}),IHe=(i,o)=>({condition:i,data:o}),EHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-off-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xHe(i,o){if(i&1&&(v(0),le(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function THe(i,o){if(i&1&&(v(0),u(1,xHe,4,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(3,EHe,n.template,A(1,oge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function DHe(i,o){if(i&1&&(v(0),u(1,THe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled))}}function wHe(i,o){if(i&1&&(v(0),u(1,DHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,IHe,n.conditionSignal(),A(1,oge,n.componentConfigSignal)))}}var v2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-mic-button-off",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Microphone off"),e.setAttribute("aria-pressed","true"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-off-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["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.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","#FF7162","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,wHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var rge=i=>({componentConfigSignal:i}),OHe=(i,o)=>({condition:i,data:o}),AHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-on-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PHe(i,o){if(i&1&&(v(0),le(),_(1,"svg",3),w(2,"path",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function MHe(i,o){if(i&1&&(v(0),u(1,PHe,3,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(3,AHe,n.template,A(1,rge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function kHe(i,o){if(i&1&&(v(0),u(1,MHe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.mediaConfig.audio==null?null:n.mediaConfig.audio.enabled)}}function RHe(i,o){if(i&1&&(v(0),u(1,kHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,OHe,n.conditionSignal(),A(1,rge,n.componentConfigSignal)))}}var C2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-mic-button-on",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Microphone on"),e.setAttribute("aria-pressed","false"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-on-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M8.16699 12.3332C8.16699 13.8803 8.78157 15.364 9.87554 16.458C10.9695 17.5519 12.4532 18.1665 14.0003 18.1665M14.0003 18.1665C15.5474 18.1665 17.0312 17.5519 18.1251 16.458C19.2191 15.364 19.8337 13.8803 19.8337 12.3332M14.0003 18.1665V21.4998M10.667 21.4998H17.3337M11.5003 8.1665C11.5003 7.50346 11.7637 6.86758 12.2326 6.39874C12.7014 5.9299 13.3373 5.6665 14.0003 5.6665C14.6634 5.6665 15.2993 5.9299 15.7681 6.39874C16.2369 6.86758 16.5003 7.50346 16.5003 8.1665V12.3332C16.5003 12.9962 16.2369 13.6321 15.7681 14.1009C15.2993 14.5698 14.6634 14.8332 14.0003 14.8332C13.3373 14.8332 12.7014 14.5698 12.2326 14.1009C11.7637 13.6321 11.5003 12.9962 11.5003 12.3332V8.1665Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,RHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var NHe=i=>({componentConfigSignal:i}),FHe=(i,o)=>({condition:i,data:o}),LHe=(i,o)=>({componentConfigSignal:i,variant:o}),BHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function VHe(i,o){if(i&1&&(v(0),_(1,"div",5),w(2,"velt-recording-preview-steps-dialog-mic-button-on-internal",6)(3,"velt-recording-preview-steps-dialog-mic-button-off-internal",6),b(),C()),i&2){let n=l(2).ngIf,e=l();m(),ue("velt-recording-preview--icon-button-off",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)),x("data-testid",e.componentId+"-icon-container"),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function UHe(i,o){if(i&1){let n=Y();v(0),_(1,"app-device-permission-button",2)(2,"div",3),P(3,"translate"),P(4,"translate"),P(5,"translate"),W("click",function(){F(n);let t=l().ngIf;return L(t.toggleAudio())})("keydown.enter",function(){F(n);let t=l().ngIf;return L(t.toggleAudio())})("keydown.space",function(){F(n);let t=l().ngIf;return L(t.toggleAudio())}),u(6,VHe,4,9,"ng-container",4),b()(),C()}if(i&2){let n=l().ngIf,e=l();m(),d("darkMode",!!n.darkMode),x("data-testid",e.componentId+"-permission-button"),m(),x("data-testid",e.componentId+"-toggle")("aria-label",M(3,6,"Toggle microphone")+" "+(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled?M(4,8,"off"):M(5,10,"on")))("aria-pressed",!!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)),m(4),d("veltDynamicTemplate",$(15,BHe,e.template,k(12,LHe,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function jHe(i,o){if(i&1&&(v(0),u(1,UHe,7,21,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,FHe,n.conditionSignal(),A(1,NHe,n.componentConfigSignal)))}}var KC=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,t),this.devicePermissionService=e,this.loggingService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-mic-button",super.initializeComponentConfigSignal(new En)}ngOnChanges(e){try{if(e.componentConfigSignal){let t=this.componentConfigSignal();!t?.mediaState?.audio?.enabled&&t.type==="audio"&&this.devicePermissionService.openDevicePermissionDeniedDialog("audio",{darkMode:!1})}}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent ngOnChanges:",t)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),!this.componentConfigSignal()?.mediaState?.audio?.enabled&&this.componentConfigSignal().type==="audio"&&this.devicePermissionService.openDevicePermissionDeniedDialog("audio",{darkMode:!1})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label","Microphone control buttons")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(um),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","audio",3,"darkMode"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],[3,"componentConfigSignal","template","variant"]],template:function(t,r){t&1&&u(0,jHe,2,6,"ng-container",0),t&2&&d("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}.velt-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}"],changeDetection:0});let i=o;return i})();var age=i=>({componentConfigSignal:i}),$He=(i,o)=>({condition:i,data:o}),HHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-settings-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function zHe(i,o){if(i&1&&(v(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon-container"),m(),x("data-testid",n.componentId+"-icon")}}function GHe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),P(2,"translate"),P(3,"translate"),W("click",function(t){F(n);let r=l(2).ngIf;return L(r.toggleSettings(t))})("keydown.enter",function(t){F(n);let r=l(2).ngIf;return L(r.toggleSettings(t))})("keydown.space",function(t){F(n);let r=l(2).ngIf;return L(r.toggleSettings(t))}),u(4,zHe,5,2,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();ue("velt-recording-preview--settings-button-open",n.isSettingsOpen),x("data-testid",e.componentId+"-button")("aria-label",(n.isSettingsOpen?M(1,7,"Close"):M(2,9,"Open"))+" "+M(3,11,"recording settings"))("aria-expanded",n.isSettingsOpen)("aria-controls",e.componentId+"-panel"),m(4),d("veltDynamicTemplate",$(15,HHe,e.template,A(13,age,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function WHe(i,o){if(i&1&&(v(0),u(1,GHe,5,21,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!n.countdownStarted)}}function qHe(i,o){if(i&1&&(v(0),u(1,WHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,$He,n.conditionSignal(),A(1,age,n.componentConfigSignal)))}}var ZC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-settings",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording preview settings")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-settings"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"velt-recording-preview--settings-button-open","click","keydown.enter","keydown.space",4,"ngIf"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--settings-button"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,qHe,2,6,"ng-container",0),t&2&&d("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}.velt-recording-preview--settings-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-full);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--settings-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}.velt-recording-preview--settings-button-open[_ngcontent-%COMP%]{background:var(--velt-background-0);border-radius:var(--velt-border-radius-full)}.velt-recording-preview--settings-button-open[_ngcontent-%COMP%] .velt-recording-preview--settings-button[_ngcontent-%COMP%]{color:var(--velt-accent);border:1.5px solid var(--velt-accent-transparent);background:var(--velt-accent-transparent)}"],changeDetection:0});let i=o;return i})();var sge=i=>({componentConfigSignal:i}),YHe=(i,o)=>({condition:i,data:o}),KHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-start-recording-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ZHe(i,o){if(i&1&&(v(0),_(1,"div",4),te(2),P(3,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-label"),m(),_e(" ",M(3,2,"Start Recording"))}}function XHe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),W("click",function(){F(n);let t=l().ngIf;return L(t.startCountdown())}),u(2,ZHe,4,4,"ng-container",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),ue("disabled",n.type==="video"&&(!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)||!n.mediaState.video.enabled)||n.type==="audio"&&(!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)||!n.mediaState.audio.enabled)),x("data-testid",e.componentId+"-button"),m(),d("veltDynamicTemplate",$(6,KHe,e.template,A(4,sge,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function QHe(i,o){if(i&1&&(v(0),u(1,XHe,3,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,YHe,n.conditionSignal(),A(1,sge,n.componentConfigSignal)))}}var XC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-start-recording",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Start recording")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-start-recording"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-start-button"]],template:function(t,r){t&1&&u(0,QHe,2,6,"ng-container",0),t&2&&d("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}.velt-recording-preview-start-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);padding:var(--velt-spacing-lg) var(--velt-spacing-2xl);font-size:var(--velt-font-size-sm);font-weight:600;transition:all .2s ease;cursor:pointer;width:fit-content;border-radius:var(--velt-border-radius-full);background:var(--velt-accent);color:var(--velt-accent-foreground)}.velt-recording-preview-start-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}.disabled[_ngcontent-%COMP%]{opacity:.5;pointer-events:none}"],changeDetection:0});let i=o;return i})();var JHe=i=>({componentConfigSignal:i}),eze=(i,o)=>({condition:i,data:o}),tze=(i,o)=>({componentConfigSignal:i,variant:o}),nze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-off-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ize(i,o){if(i&1&&(v(0),_(1,"h1",5),P(2,"translate"),te(3),P(4,"translate"),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-text")("aria-label",M(2,3,"Camera is off")),m(2),Ge(M(4,5,"Camera is off"))}}function oze(i,o){if(i&1&&(_(0,"div",3),u(1,ize,5,7,"ng-container",4),b()),i&2){let n=l(3);x("data-testid",n.componentId),m(),d("veltDynamicTemplate",$(5,nze,n.template,k(2,tze,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function rze(i,o){if(i&1&&(v(0),u(1,oze,2,11,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!n.countdownStarted&&(!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)||!n.mediaState.video.enabled))}}function aze(i,o){if(i&1&&(v(0),u(1,rze,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,eze,n.conditionSignal(),A(1,JHe,n.componentConfigSignal)))}}var _2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-camera-off-message",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","alert"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-camera-off-message"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","alert","aria-live","polite","aria-atomic","true",4,"ngIf"],["role","alert","aria-live","polite","aria-atomic","true"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-camera-off-message"]],template:function(t,r){t&1&&u(0,aze,2,6,"ng-container",0),t&2&&d("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}.velt-recording-preview-camera-off-message[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);color:var(--velt-text-0);margin:0}"],changeDetection:0});let i=o;return i})();var lge=i=>({componentConfigSignal:i}),sze=(i,o)=>({condition:i,data:o}),lze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-close-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function cze(i,o){if(i&1&&(v(0),_(1,"div",4),le(),_(2,"svg",5),w(3,"path",6),b()(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-icon-container"),m(),x("data-testid",n.componentId+"-icon")}}function dze(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),P(2,"translate"),W("click",function(){F(n);let t=l().ngIf;return L(t.closeDialog())})("keydown.enter",function(){F(n);let t=l().ngIf;return L(t.closeDialog())})("keydown.space",function(){F(n);let t=l().ngIf;return L(t.closeDialog())}),u(3,cze,4,2,"ng-container",3),b(),C()}if(i&2){let n=l(2);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"Close recording preview")),m(2),d("veltDynamicTemplate",$(7,lze,n.template,A(5,lge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function mze(i,o){if(i&1&&(v(0),u(1,dze,4,13,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,sze,n.conditionSignal(),A(1,lge,n.componentConfigSignal)))}}var QC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-close-button",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCloseButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Close recording preview"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCloseButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-close-button"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true",1,"velt-cursor-pointer"],["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","#fff"]],template:function(t,r){t&1&&u(0,mze,2,6,"ng-container",0),t&2&&d("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}.velt-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:var(--velt-text-4)}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-4);background:var(--velt-background-2)}"],changeDetection:0});let i=o;return i})();var cge=i=>({componentConfigSignal:i}),pze=(i,o)=>({condition:i,data:o}),gze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-cancel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function uze(i,o){if(i&1&&(v(0),_(1,"div",4),te(2),P(3,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-label"),m(),_e(" ",M(3,2,"Cancel")," ")}}function hze(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),W("click",function(){F(n);let t=l().ngIf;return L(t.cancelCountdown())})("keydown.enter",function(){F(n);let t=l().ngIf;return L(t.cancelCountdown())})("keydown.space",function(){F(n);let t=l().ngIf;return L(t.cancelCountdown())}),u(2,uze,4,4,"ng-container",3),b(),C()}if(i&2){let n=l(2);m(),x("data-testid",n.componentId+"-button"),m(),d("veltDynamicTemplate",$(4,gze,n.template,A(2,cge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function fze(i,o){if(i&1&&(v(0),u(1,hze,3,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,pze,n.conditionSignal(),A(1,cge,n.componentConfigSignal)))}}var y2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-timer-cancel",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording countdown cancel controls")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer-cancel"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",1,"velt-recording-preview-timer--cancel-button",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-timer--cancel-button"]],template:function(t,r){t&1&&u(0,fze,2,6,"ng-container",0),t&2&&d("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;bottom:15%}.velt-recording-preview-timer--cancel-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);font-weight:500;font-size:var(--velt-font-size-md);line-height:24px;color:var(--velt-error);text-transform:uppercase;letter-spacing:1.5px;cursor:pointer}.velt-recording-preview-timer--cancel-button[_ngcontent-%COMP%]:hover{color:var(--velt-error-hover)}"],changeDetection:0});let i=o;return i})();var dge=i=>({componentConfigSignal:i}),vze=(i,o)=>({condition:i,data:o}),Cze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-countdown-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function _ze(i,o){if(i&1&&(_(0,"h1",4),te(1),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId+"-value"),m(),_e(" ",n.countdown)}}function yze(i,o){if(i&1&&(v(0),u(1,_ze,2,2,"h1",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.countdown)}}function Sze(i,o){if(i&1&&(v(0),u(1,yze,2,1,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(3,Cze,n.template,A(1,dge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function bze(i,o){if(i&1&&(v(0),u(1,Sze,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,vze,n.conditionSignal(),A(1,dge,n.componentConfigSignal)))}}var S2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-timer-countdown",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","timer"),e.setAttribute("aria-label","Recording countdown timer"),e.setAttribute("aria-live","assertive")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer-countdown"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-recording-preview-timer--countdown","role","timer","aria-live","assertive",4,"ngIf"],["role","timer","aria-live","assertive",1,"velt-recording-preview-timer--countdown"]],template:function(t,r){t&1&&u(0,bze,2,6,"ng-container",0),t&2&&d("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}.velt-recording-preview-timer--countdown[_ngcontent-%COMP%]{font-size:120px;line-height:120px;font-weight:600;color:var(--velt-text-5);margin:0}"],changeDetection:0});let i=o;return i})();var mge=i=>({componentConfigSignal:i}),Ize=(i,o)=>({condition:i,data:o}),Eze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xze(i,o){if(i&1&&(v(0),_(1,"div",3),w(2,"app-recording-preview-steps-dialog-timer-countdown",4)(3,"app-recording-preview-steps-dialog-timer-cancel",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function Tze(i,o){if(i&1&&(v(0),u(1,xze,4,7,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(3,Eze,n.template,A(1,mge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Dze(i,o){if(i&1&&(v(0),u(1,Tze,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.countdownStarted)}}function wze(i,o){if(i&1&&(v(0),u(1,Dze,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Ize,n.conditionSignal(),A(1,mge,n.componentConfigSignal)))}}var JC=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-timer",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording countdown section")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region","aria-live","polite",1,"velt-recording-preview-dialog-timer"],[3,"componentConfigSignal","template","variant"]],template:function(t,r){t&1&&u(0,wze,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-recording-preview-dialog-timer[_ngcontent-%COMP%]{position:relative;width:332px;height:332px;display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-lg);border-radius:100%;flex-direction:column;border:2px solid var(--velt-border-transparent);background:var(--velt-background-transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}"],changeDetection:0});let i=o;return i})();var Oze=i=>({componentConfigSignal:i}),Aze=(i,o)=>({condition:i,data:o}),Pze=(i,o)=>({componentConfigSignal:i,variant:o}),Mze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-video-player-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function kze(i,o){if(i&1&&(v(0),w(1,"video",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("srcObject",n.mediaStream)("volume",0),x("data-testid",e.componentId)}}function Rze(i,o){if(i&1&&(v(0),u(1,kze,2,3,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,Mze,n.template,k(1,Pze,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Nze(i,o){if(i&1&&(v(0),u(1,Rze,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Aze,n.conditionSignal(),A(1,Oze,n.componentConfigSignal)))}}var b2=(()=>{let o=class o extends H{get isScreenStreamAvailable(){return!!this.componentConfigSignal()?.mediaConfig?.screen?.stream}constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-video-player",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Video preview")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-video-player"]],hostVars:2,hostBindings:function(t,r){t&2&&ue("velt-recording-preview-steps-dialog-screen-available",r.isScreenStreamAvailable)},inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["id","player","autoplay","","muted","true","playsinline","","webkit-playsinline","true","x-webkit-airplay","allow","role","application","aria-live","polite",1,"flip","velt-recording-preview-video--player",3,"srcObject","volume"]],template:function(t,r){t&1&&u(0,Nze,2,6,"ng-container",0),t&2&&d("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%]{display:block;width:100%;position:relative}.velt-recording-preview-steps-dialog-screen-available[_nghost-%COMP%]{position:absolute;bottom:20px;left:20px}.velt-recording-preview-steps-dialog-screen-available[_nghost-%COMP%] video[_ngcontent-%COMP%]{width:150px;height:150px;object-fit:cover;border-radius:var(--velt-border-radius-full)}video[_ngcontent-%COMP%]{width:100%;z-index:9999}.velt-recording-preview-video--player[_ngcontent-%COMP%]{object-fit:cover}"],changeDetection:0});let i=o;return i})();var Fze=i=>({componentConfigSignal:i}),Lze=(i,o)=>({condition:i,data:o}),Bze=()=>["video","screen"],Vze=(i,o)=>({componentConfigSignal:i,variant:o}),Uze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-video-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function jze(i,o){i&1&&He(0)}function $ze(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,jze,1,0,"ng-container",5),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function Hze(i,o){if(i&1&&(v(0),w(1,"app-recording-preview-steps-dialog-video-player",9)(2,"app-recording-preview-steps-dialog-screen-player",9),_(3,"div",10)(4,"div",11),w(5,"app-recording-preview-steps-dialog-waveform",9)(6,"app-recording-preview-steps-dialog-close-button",12),b(),w(7,"app-recording-preview-steps-dialog-timer",12)(8,"app-recording-preview-steps-dialog-camera-off-message",12),_(9,"div",13),w(10,"velt-recording-preview-steps-dialog-settings-panel-internal",9),_(11,"app-recording-preview-steps-dialog-button-panel",12),w(12,"app-recording-preview-steps-dialog-start-recording",12)(13,"velt-recording-preview-steps-dialog-mic-button-internal",12)(14,"velt-recording-preview-steps-dialog-camera-button-internal",12)(15,"app-recording-preview-steps-dialog-settings",12),b(),w(16,"app-recording-preview-steps-dialog-bottom-panel",12),b()(),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),x("data-testid",n.componentId+"-overlay"),m(),x("data-testid",n.componentId+"-header"),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),x("data-testid",n.componentId+"-settings"),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function zze(i,o){if(i&1){let n=Y();_(0,"div",7,1),W("pointerdown",function(t){return F(n),L(t.stopPropagation())})("pointerup",function(t){return F(n),L(t.stopPropagation())})("click",function(t){F(n);let r=l(3).ngIf;return L(r.handleOverlayClick(t))}),u(2,Hze,17,34,"ng-container",8),b()}if(i&2){let n=l(4);x("data-testid",n.componentId),m(2),d("veltDynamicTemplate",$(5,Uze,n.template,k(2,Vze,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Gze(i,o){if(i&1&&u(0,zze,3,11,"div",6),i&2){let n=l(2).ngIf;d("ngIf",pt(1,Bze).includes(n.type))}}function Wze(i,o){if(i&1&&(v(0),u(1,$ze,2,1,"velt-shadow-dom-internal",4)(2,Gze,1,2,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l().ngIf,t=l();m(),d("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function qze(i,o){if(i&1&&(v(0),u(1,Wze,4,2,"ng-container",3),C()),i&2){let n=l();m(),d("veltIf",k(3,Lze,n.conditionSignal(),A(1,Fze,n.componentConfigSignal)))}}var I2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-video",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-recording-preview-steps-dialog-video-wireframe";super.ngOnInit(),this.setupA11yAttributes(),this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent OnInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(E({},r),{[t]:e[t].currentValue}),r))})}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Video preview area")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-video"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[["videoDialogRef",""],["recordingPreviewDialogRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["role","dialog","class","velt-recording-preview-video",3,"pointerdown","pointerup","click",4,"ngIf"],["role","dialog",1,"velt-recording-preview-video",3,"pointerdown","pointerup","click"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["role","region","aria-label","Video controls overlay",1,"velt-recording-preview-video--overlay"],["role","region","aria-label","Video header controls",1,"velt-recording-preview-video--header"],[3,"componentConfigSignal","template","variant"],["role","region","aria-label","Recording settings and controls",1,"velt-recording-preview-video--settings"]],template:function(t,r){t&1&&u(0,qze,2,6,"ng-container",2),t&2&&d("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%]{width:100%;height:100%}.velt-recording-preview-video[_ngcontent-%COMP%], .velt-recording-preview-video--header[_ngcontent-%COMP%]{display:flex}.velt-recording-preview-video[_ngcontent-%COMP%]{position:relative;background:var(--velt-background-0);flex-direction:column;align-items:center;overflow:hidden;border-radius:var(--velt-border-radius-lg);width:calc((50rem + 0px) * var(--velt-base-rem-unit));height:calc((30rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}@media screen and (max-width: 768px){.velt-recording-preview-video[_ngcontent-%COMP%]{width:calc((35rem + 0px) * var(--velt-base-rem-unit));height:calc((25rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}}@media screen and (max-width: 425px){ .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-video{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));max-width:calc(1 * var(--legacy-velt-viewport-width));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-video video{height:100%}}.velt-recording-preview-video--overlay[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;padding:var(--velt-spacing-2xl);content:"";position:absolute;border-radius:var(--velt-border-radius-lg);z-index:1;inset:0}.velt-recording-preview-video--header[_ngcontent-%COMP%]{justify-content:space-between;width:100%;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));align-items:flex-start}.velt-recording-preview-video--settings[_ngcontent-%COMP%]{width:366px;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;position:relative}'],changeDetection:0});let i=o;return i})();var pge=i=>({componentConfigSignal:i}),Yze=(i,o)=>({condition:i,data:o}),Kze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-settings-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1}),Zze=()=>["video","screen"];function Xze(i,o){if(i&1&&(v(0),w(1,"velt-media-source-settings-internal",3),P(2,"translate"),C()),i&2){let n=l(2).ngIf;m(),d("showMicSettings",!0)("shadowDom",n.shadowDom)("showCamSettings",pt(8,Zze).includes(n.type))("isOpen",n.isSettingsOpen)("config",n),x("aria-label",M(2,6,"Media source settings"))}}function Qze(i,o){if(i&1&&(v(0),u(1,Xze,3,9,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(3,Kze,n.template,A(1,pge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Jze(i,o){if(i&1&&(v(0),u(1,Qze,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Yze,n.conditionSignal(),A(1,pge,n.componentConfigSignal)))}}var e_=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-settings-panel",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Recording settings panel"),e.setAttribute("aria-modal","true"),e.setAttribute("tabindex","-1"),this.componentConfigSignal().isSettingsOpen?e.setAttribute("aria-hidden","false"):e.setAttribute("aria-hidden","true")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-settings-panel-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","group",3,"showMicSettings","shadowDom","showCamSettings","isOpen","config"]],template:function(t,r){t&1&&u(0,Jze,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var eGe=i=>({componentConfigSignal:i}),tGe=(i,o)=>({condition:i,data:o}),nGe=(i,o)=>({componentConfigSignal:i,variant:o}),iGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-waveform-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function oGe(i,o){if(i&1&&(v(0),w(1,"app-audio-waveform",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("variant",n.type==="audio"?"preview":"preview-mini")("previewStream",e.streamSignal())("muteMic",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)),x("data-testid",e.componentId)}}function rGe(i,o){if(i&1&&(v(0),u(1,oGe,2,4,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,iGe,n.template,k(1,nGe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function aGe(i,o){if(i&1&&(v(0),u(1,rGe,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,tGe,n.conditionSignal(),A(1,eGe,n.componentConfigSignal)))}}var t_=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.streamSignal=Ee(null),this.componentId="velt-recording-preview-steps-dialog-waveform",super.initializeComponentConfigSignal(new En)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.setupAudioElements()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.cleanupAudio()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Audio waveform visualization"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent setupA11yAttributes:",e)}}setupAudioElements(){return Q(this,null,function*(){try{this.audioContext=new AudioContext,this.streamSignal.set(yield navigator.mediaDevices.getUserMedia({audio:!0}))}catch(e){this.loggingService.catch("Error accessing the microphone",e)}})}cleanupAudio(){try{this.audioContext&&(this.audioContext.close(),this.audioContext=null);let e=this.streamSignal();e&&(e.getTracks().forEach(t=>t.stop()),this.streamSignal.set(null))}catch(e){this.loggingService.catch("Error cleaning up audio resources:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-waveform"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","img","aria-live","polite",3,"variant","previewStream","muteMic"]],template:function(t,r){t&1&&u(0,aGe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var gge=i=>({componentConfigSignal:i}),sGe=(i,o)=>({condition:i,data:o}),lGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-comment-annotation-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function cGe(i,o){i&1&&(_(0,"div",5),le(),_(1,"svg",6),w(2,"path",7),b()())}function dGe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),W("pointerdown",function(t){return F(n),l(2).ngIf.createAnnotation(),L(t.stopPropagation())}),u(2,cGe,3,0,"div",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId)("role","button")("aria-label",M(1,5,"Add comment annotation"))("tabindex",n.commentToolEnabled?0:void 0),m(2),d("veltDynamicTemplate",$(9,lGe,e.template,A(7,gge,e.componentConfigSignal),e.componentConfigSignal().variant,e.setIfCondition.bind(e),e.elementRef))}}function mGe(i,o){if(i&1&&(v(0),u(1,dGe,3,15,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.commentToolEnabled)}}function pGe(i,o){if(i&1&&(v(0),u(1,mGe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,sGe,n.conditionSignal(),A(1,gge,n.componentConfigSignal)))}}var E2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-comment-annotation",super.initializeComponentConfigSignal(new Qs)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Add comment annotation")}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(Ye),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-comment-annotation"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"pointerdown",4,"ngIf"],[3,"pointerdown"],["class","velt-cursor-pointer velt-text-comment-toolbar-comment-annotation",4,"veltDynamicTemplate"],[1,"velt-cursor-pointer","velt-text-comment-toolbar-comment-annotation"],["width","32","height","32","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M17.7608 6.03888C21.6888 6.64595 24.7153 9.3481 25.7503 13.1722C26.0832 14.4028 26.0832 16.5981 25.7503 17.8287C24.8136 21.2897 22.3047 23.7986 18.8437 24.7353C18.1546 24.9217 17.6783 24.9695 16.5154 24.9685C14.9367 24.9672 14.1823 24.8254 12.8496 24.2792L12.1364 23.9869L9.93697 24.5342C7.8786 25.0464 7.71866 25.071 7.44436 24.917C6.90064 24.6118 6.90443 24.3818 7.49147 22.0353L8.03021 19.8823L7.73729 19.1677C7.19053 17.8336 7.04867 17.0796 7.04737 15.5005C7.0464 14.3376 7.09415 13.8613 7.28063 13.1722C8.21127 9.73361 10.737 7.1939 14.1308 6.28405C14.9298 6.06985 17.0392 5.92745 17.7608 6.03888ZM14.2233 8.05664C12.9452 8.46912 12.019 9.04056 11.0373 10.0223C9.57907 11.4805 8.85364 13.0991 8.75174 15.1214C8.68947 16.3572 8.85884 17.3544 9.31582 18.4435C9.47381 18.8201 9.65855 19.2624 9.72624 19.4266C9.82922 19.6761 9.78471 19.9865 9.45432 21.3204C9.23688 22.1979 9.06827 22.9251 9.07953 22.9364C9.09079 22.9476 9.81796 22.779 10.6955 22.5616C12.0294 22.2312 12.3398 22.1867 12.5893 22.2897C12.7535 22.3573 13.1958 22.5421 13.5724 22.7001C14.6615 23.1571 15.6587 23.3264 16.8945 23.2642C18.9168 23.1623 20.5354 22.4368 21.9936 20.9786C22.968 20.0042 23.5361 19.0878 23.9685 17.7926C24.2112 17.0656 24.2457 16.7805 24.2457 15.5005C24.2457 14.2204 24.2112 13.9353 23.9685 13.2083C23.5361 11.9132 22.968 10.9967 21.9936 10.0223C20.3414 8.37025 18.566 7.66777 16.2447 7.74769C15.3595 7.77823 14.8403 7.8575 14.2233 8.05664Z","fill","currentColor"]],template:function(t,r){t&1&&u(0,pGe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-text-comment-toolbar-comment-annotation[_ngcontent-%COMP%]{display:flex;color:var(--velt-accent-text)}"],changeDetection:0});let i=o;return i})();var uge=i=>({componentConfigSignal:i}),gGe=(i,o)=>({condition:i,data:o}),uGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-copywriter-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hGe(i,o){if(i&1&&(_(0,"div",11),te(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf;m(),_e(" ",n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?M(2,1,"Select a shorter text"):M(3,3,"Select a longer text")," ")}}function fGe(i,o){if(i&1&&(_(0,"div",4),u(1,hGe,4,5,"div",5),le(),_(2,"svg",6)(3,"g",7),w(4,"path",8),b(),_(5,"defs")(6,"clipPath",9),w(7,"rect",10),b()()(),te(8),P(9,"translate"),b()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(7),_e(" ",M(9,2,"Rewrite")," ")}}function vGe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),P(2,"translate"),W("pointerdown",function(t){return F(n),l().ngIf.createRewriter("copywriter"),L(t.stopPropagation())}),u(3,fGe,10,4,"div",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),ue("velt-text-comment-toolbar-copywriter--disabled",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),x("data-testid",e.componentId)("role","button")("aria-label",M(2,8,"Use AI to rewrite selected text"))("tabindex",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?void 0:0)("aria-disabled",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(2),d("veltDynamicTemplate",$(12,uGe,e.template,A(10,uge,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function CGe(i,o){if(i&1&&(v(0),u(1,vGe,4,18,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,gGe,n.conditionSignal(),A(1,uge,n.componentConfigSignal)))}}var x2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-copywriter",super.initializeComponentConfigSignal(new Qs)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Rewrite text with copywriter");let t=this.componentConfigSignal(),r=t.selectedWordsCount<t.MIN_ALLOWED_WORDS_COUNT||t.selectedCharactersCount<t.MIN_ALLOWED_CHARACTERS_COUNT||t.selectedCharactersCount>t.MAX_ALLOWED_CHARACTERS_COUNT;e.setAttribute("aria-disabled",String(r))}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(Ye),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-copywriter"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"pointerdown"],["class","velt-text-comment-toolbar-copywriter s-tooltip s-tooltip-light",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-copywriter","s-tooltip","s-tooltip-light"],["class","s-tooltiptext","role","tooltip",4,"ngIf"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false",1,"velt-text-comment-toolbar-copywriter--svg"],["clip-path","url(#clip0_3311_3365)"],["d","M6.49994 15.9999C6.34193 16.0007 6.18743 15.9533 6.05709 15.8639C5.92676 15.7746 5.8268 15.6476 5.77057 15.4999L4.52557 12.2624C4.50035 12.1972 4.46178 12.1379 4.41232 12.0885C4.36286 12.039 4.30362 12.0004 4.23838 11.9752L0.999941 10.7293C0.852423 10.6727 0.725541 10.5727 0.63604 10.4424C0.546538 10.3122 0.498626 10.1579 0.498626 9.99991C0.498626 9.8419 0.546538 9.68761 0.63604 9.55739C0.725541 9.42717 0.852423 9.32716 0.999941 9.27054L4.23744 8.02554C4.30268 8.00032 4.36193 7.96175 4.41138 7.91229C4.46084 7.86284 4.49941 7.80359 4.52463 7.73835L5.77057 4.49991C5.82718 4.3524 5.9272 4.22551 6.05742 4.13601C6.18764 4.04651 6.34193 3.9986 6.49994 3.9986C6.65795 3.9986 6.81225 4.04651 6.94246 4.13601C7.07268 4.22551 7.1727 4.3524 7.22932 4.49991L8.47432 7.73741C8.49953 7.80265 8.5381 7.8619 8.58756 7.91136C8.63702 7.96081 8.69627 7.99939 8.7615 8.0246L11.9803 9.26304C12.1338 9.31994 12.266 9.42278 12.359 9.55754C12.452 9.6923 12.5012 9.85244 12.4999 10.0162C12.4976 10.1714 12.4486 10.3224 12.3595 10.4495C12.2703 10.5767 12.1451 10.6741 11.9999 10.7293L8.76244 11.9743C8.6972 11.9995 8.63795 12.0381 8.5885 12.0875C8.53904 12.137 8.50047 12.1962 8.47525 12.2615L7.22932 15.4999C7.17308 15.6476 7.07312 15.7746 6.94279 15.8639C6.81245 15.9533 6.65796 16.0007 6.49994 15.9999ZM2.74994 5.49991C2.6573 5.49991 2.56684 5.47184 2.49047 5.4194C2.4141 5.36696 2.35541 5.29262 2.32213 5.20616L1.79525 3.83616C1.78383 3.8062 1.76621 3.77899 1.74354 3.75632C1.72086 3.73364 1.69365 3.71602 1.66369 3.7046L0.293691 3.17773C0.207247 3.14444 0.132915 3.08574 0.0804885 3.00937C0.0280618 2.933 0 2.84255 0 2.74991C0 2.65728 0.0280618 2.56682 0.0804885 2.49045C0.132915 2.41408 0.207247 2.35539 0.293691 2.3221L1.66369 1.79523C1.69362 1.78375 1.72081 1.76611 1.74347 1.74345C1.76614 1.72078 1.78378 1.6936 1.79525 1.66366L2.31744 0.305851C2.34689 0.225914 2.39757 0.155514 2.46402 0.102216C2.53048 0.0489189 2.6102 0.0147393 2.69463 0.00335107C2.79599 -0.00897073 2.89856 0.0128976 2.98608 0.0654883C3.0736 0.118079 3.14105 0.198382 3.17775 0.293664L3.70463 1.66366C3.7161 1.6936 3.73374 1.72078 3.75641 1.74345C3.77908 1.76611 3.80626 1.78375 3.83619 1.79523L5.20619 2.3221C5.29263 2.35539 5.36697 2.41408 5.41939 2.49045C5.47182 2.56682 5.49988 2.65728 5.49988 2.74991C5.49988 2.84255 5.47182 2.933 5.41939 3.00937C5.36697 3.08574 5.29263 3.14444 5.20619 3.17773L3.83619 3.7046C3.80623 3.71602 3.77902 3.73364 3.75635 3.75632C3.73367 3.77899 3.71605 3.8062 3.70463 3.83616L3.17775 5.20616C3.14447 5.29262 3.08578 5.36696 3.00941 5.4194C2.93304 5.47184 2.84258 5.49991 2.74994 5.49991ZM12.4999 7.99991C12.3989 7.99988 12.3002 7.96923 12.2169 7.91199C12.1336 7.85475 12.0696 7.77362 12.0334 7.67929L11.3196 5.82398C11.3071 5.79128 11.2878 5.76159 11.263 5.73683C11.2383 5.71207 11.2086 5.69278 11.1759 5.68023L9.32057 4.96648C9.22631 4.93016 9.14526 4.86614 9.0881 4.78286C9.03094 4.69957 9.00034 4.60093 9.00034 4.49991C9.00034 4.3989 9.03094 4.30026 9.0881 4.21697C9.14526 4.13369 9.22631 4.06967 9.32057 4.03335L11.1759 3.3196C11.2086 3.30705 11.2383 3.28776 11.263 3.263C11.2878 3.23823 11.3071 3.20854 11.3196 3.17585L12.0281 1.33366C12.0604 1.24655 12.1158 1.16983 12.1882 1.11167C12.2607 1.0535 12.3476 1.01607 12.4396 1.00335C12.5502 0.989962 12.6621 1.0139 12.7576 1.07136C12.8531 1.12883 12.9266 1.21652 12.9665 1.32054L13.6803 3.17585C13.6928 3.20854 13.7121 3.23823 13.7369 3.263C13.7616 3.28776 13.7913 3.30705 13.824 3.3196L15.6793 4.03335C15.7736 4.06967 15.8546 4.13369 15.9118 4.21697C15.9689 4.30026 15.9995 4.3989 15.9995 4.49991C15.9995 4.60093 15.9689 4.69957 15.9118 4.78286C15.8546 4.86614 15.7736 4.93016 15.6793 4.96648L13.824 5.68023C13.7913 5.69278 13.7616 5.71207 13.7369 5.73683C13.7121 5.76159 13.6928 5.79128 13.6803 5.82398L12.9665 7.67929C12.9302 7.77362 12.8663 7.85475 12.783 7.91199C12.6997 7.96923 12.601 7.99988 12.4999 7.99991Z","fill","currentColor"],["id","clip0_3311_3365"],["width","16","height","16","fill","currentColor"],["role","tooltip",1,"s-tooltiptext"]],template:function(t,r){t&1&&u(0,CGe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-text-comment-toolbar-copywriter[_ngcontent-%COMP%]{background:var(--velt-background-2);border-radius:var(--velt-border-radius-full);padding:var(--velt-spacing-2xs) var(--velt-spacing-md);cursor:pointer;color:var(--velt-text-4);display:flex;align-items:center;gap:var(--velt-spacing-sm);font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:normal}.velt-text-comment-toolbar-copywriter[_ngcontent-%COMP%] .velt-text-comment-toolbar-copywriter--svg[_ngcontent-%COMP%]{color:var(--velt-accent-text);padding:var(--velt-spacing-xs)}.velt-text-comment-toolbar-copywriter.velt-text-comment-toolbar-copywriter--disabled[_ngcontent-%COMP%]{cursor:not-allowed;color:var(--velt-gray)}"],changeDetection:0});let i=o;return i})();var hge=i=>({componentConfigSignal:i}),_Ge=(i,o)=>({condition:i,data:o}),yGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-generic-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function SGe(i,o){if(i&1&&(_(0,"div",15),te(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf;m(),_e(" ",n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?M(2,1,"Select a shorter text"):M(3,3,"Select a longer text")," ")}}function bGe(i,o){if(i&1&&(_(0,"div",4),u(1,SGe,4,5,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8)(5,"path",9)(6,"path",10)(7,"path",11)(8,"path",12)(9,"path",13)(10,"path",14),b(),te(11),P(12,"translate"),b()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(10),_e(" ",M(12,2,"Ask ChatGPT")," ")}}function IGe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),W("pointerdown",function(t){return F(n),l().ngIf.createRewriter("generic"),L(t.stopPropagation())}),u(2,bGe,13,4,"div",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),ue("velt-text-comment-toolbar-generic--disabled",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),x("data-testid",e.componentId)("role","separator")("aria-orientation","vertical"),m(),d("veltDynamicTemplate",$(8,yGe,e.template,A(6,hge,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function EGe(i,o){if(i&1&&(v(0),u(1,IGe,3,14,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,_Ge,n.conditionSignal(),A(1,hge,n.componentConfigSignal)))}}var T2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-divider",super.initializeComponentConfigSignal(new Qs)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical")}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarGenericComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(Ye),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-generic"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"pointerdown"],["class","velt-text-comment-toolbar-generic s-tooltip s-tooltip-light",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-generic","s-tooltip","s-tooltip-light"],["class","s-tooltiptext",4,"ngIf"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","role","presentation","aria-hidden","true","focusable","false",1,"velt-text-comment-toolbar-generic--svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M20 6H4C2.89543 6 2 6.89543 2 8V16C2 17.1046 2.89543 18 4 18H20C21.1046 18 22 17.1046 22 16V8C22 6.89543 21.1046 6 20 6ZM4 4C1.79086 4 0 5.79086 0 8V16C0 18.2091 1.79086 20 4 20H20C22.2091 20 24 18.2091 24 16V8C24 5.79086 22.2091 4 20 4H4Z","fill","currentColor"],["d","M16 10C16 9.44772 16.4477 9 17 9H19C19.5523 9 20 9.44772 20 10C20 10.5523 19.5523 11 19 11H17C16.4477 11 16 10.5523 16 10Z","fill","currentColor"],["d","M4 14C4 13.4477 4.44772 13 5 13C5.55228 13 6 13.4477 6 14C6 14.5523 5.55228 15 5 15C4.44772 15 4 14.5523 4 14Z","fill","currentColor"],["d","M8 14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14C16 14.5523 15.5523 15 15 15H9C8.44772 15 8 14.5523 8 14Z","fill","currentColor"],["d","M19 13C18.4477 13 18 13.4477 18 14C18 14.5523 18.4477 15 19 15C19.5523 15 20 14.5523 20 14C20 13.4477 19.5523 13 19 13Z","fill","currentColor"],["d","M13 9C12.4477 9 12 9.44772 12 10C12 10.5523 12.4477 11 13 11C13.5523 11 14 10.5523 14 10C14 9.44772 13.5523 9 13 9Z","fill","currentColor"],["d","M8 10C8 9.44772 8.44772 9 9 9C9.55228 9 10 9.44772 10 10C10 10.5523 9.55228 11 9 11C8.44772 11 8 10.5523 8 10Z","fill","currentColor"],["d","M5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9Z","fill","currentColor"],[1,"s-tooltiptext"]],template:function(t,r){t&1&&u(0,EGe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-text-comment-toolbar-generic[_ngcontent-%COMP%]{background:var(--velt-background-2);border-radius:var(--velt-border-radius-full);padding:var(--velt-spacing-2xs) var(--velt-spacing-md);cursor:pointer;color:var(--velt-text-4);display:flex;align-items:center;gap:var(--velt-spacing-sm);font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:normal}.velt-text-comment-toolbar-generic[_ngcontent-%COMP%] .velt-text-comment-toolbar-generic--svg[_ngcontent-%COMP%]{color:var(--velt-accent-text)}.velt-text-comment-toolbar-generic.velt-text-comment-toolbar-generic--disabled[_ngcontent-%COMP%]{cursor:not-allowed;color:var(--velt-gray)}"],changeDetection:0});let i=o;return i})();var xGe=i=>({componentConfigSignal:i}),TGe=(i,o)=>({condition:i,data:o}),DGe=i=>({componentConfig:i}),wGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-divider-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function OGe(i,o){if(i&1&&(_(0,"div",3),le(),_(1,"svg",4),w(2,"rect",5),b()()),i&2){let n=l(4);x("data-testid",n.componentId)("role","separator")("aria-orientation","vertical")}}function AGe(i,o){if(i&1&&(v(0),u(1,OGe,3,3,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,wGe,e.template,A(1,DGe,n),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function PGe(i,o){if(i&1&&(v(0),u(1,AGe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.commentToolEnabled)}}function MGe(i,o){if(i&1&&(v(0),u(1,PGe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,TGe,n.conditionSignal(),A(1,xGe,n.componentConfigSignal)))}}var D2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-divider",super.initializeComponentConfigSignal(new Qs)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical")}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(Ye),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-divider"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-text-comment-toolbar-divider",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-divider"],["width","1","height","16","viewBox","0 0 1 16","fill","none","xmlns","http://www.w3.org/2000/svg","role","presentation","aria-hidden","true","focusable","false"],["x","1","y","0.5","width","15","height","0.999999","rx","0.5","transform","rotate(90 1 0.5)","fill","currentColor"]],template:function(t,r){t&1&&u(0,MGe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-text-comment-toolbar-divider[_ngcontent-%COMP%]{display:flex;color:var(--velt-border-4)}"],changeDetection:0});let i=o;return i})();var Tp=class{constructor(){this.annotations=[],this.unresolvedAnnotationsCount=0,this.showAvatar=!0,this.unreadCount=0,this.readOnly=!1,this.commentCountType=$H.TOTAL,this.selectedAnnotationsMap={},this.customStatusesShown=!1,this.selectedAnnotationsLocationMap={},this.commentPinSelected=!1,this.groupMatchedComments=!1}};var kGe=i=>({componentConfigSignal:i}),RGe=(i,o)=>({condition:i,data:o}),NGe=(i,o)=>({componentConfigSignal:i,wireframe:o}),FGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function LGe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",3),C()),i&2){let n=l(3).ngIf,e=l();m(),d("user",n==null||n.annotation==null?null:n.annotation.from),x("data-testid",e.componentId+"-user")}}function BGe(i,o){if(i&1&&(v(0),u(1,LGe,2,2,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.showAvatar)&&(n==null||n.annotation==null?null:n.annotation.from))}}function VGe(i,o){if(i&1&&(v(0),u(1,BGe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(4,FGe,e.template,k(1,NGe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function UGe(i,o){if(i&1&&(v(0),u(1,VGe,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,RGe,n.conditionSignal(),A(1,kGe,n.componentConfigSignal)))}}var w2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-bubble-avatar",super.initializeComponentConfigSignal(new Tp)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Comment author avatar")}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-bubble-avatar"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["part","user-avatar",3,"user"]],template:function(t,r){t&1&&u(0,UGe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var jGe=i=>({componentConfigSignal:i}),$Ge=(i,o)=>({condition:i,data:o}),HGe=(i,o)=>({componentConfigSignal:i,wireframe:o}),zGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-comments-count-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function GGe(i,o){if(i&1&&(v(0),te(1),C()),i&2){let n=l(2).ngIf;m(),_e(" ",(n==null?null:n.unresolvedAnnotationsCount)||0," ")}}function WGe(i,o){if(i&1&&(v(0),u(1,GGe,2,1,"ng-container",1),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.unresolvedAnnotationsCount)}}function qGe(i,o){if(i&1&&(v(0),te(1),C()),i&2){let n=l(2).ngIf;m(),_e(" ",n.commentCountType==="total"?(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||0:n.unreadCount||0," ")}}function YGe(i,o){if(i&1&&u(0,qGe,2,1,"ng-container",1),i&2){let n=l().ngIf;d("ngIf",n.commentCountType==="total"&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||n.commentCountType!=="total"&&n.unreadCount)}}function KGe(i,o){if(i&1&&(v(0),u(1,WGe,2,1,"ng-container",4)(2,YGe,1,1,"ng-template",null,0,xe),C()),i&2){let n=o.ngIf,e=me(3);m(),d("ngIf",(n==null||n.annotation==null?null:n.annotation.type)==="multiThread")("ngIfElse",e)}}function ZGe(i,o){if(i&1&&(v(0),u(1,KGe,4,2,"ng-container",1),C()),i&2){let n=l(3);m(),d("ngIf",n.componentConfigSignal())}}function XGe(i,o){if(i&1&&(v(0),u(1,ZGe,2,1,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(4,zGe,e.template,k(1,HGe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function QGe(i,o){if(i&1&&(v(0),u(1,XGe,2,10,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,$Ge,n.conditionSignal(),A(1,jGe,n.componentConfigSignal)))}}var O2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-bubble-count",super.initializeComponentConfigSignal(new Tp)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-bubble-comments-count"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["defaultCommentsCount",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"]],template:function(t,r){t&1&&u(0,QGe,2,6,"ng-container",1),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var fge=(i,o)=>{try{if(i.hasAttribute(o))return i;if(i.children.length===0)return;for(let n=0;n<i.children.length;n++){let e=i.children[n],t=fge(e,o);if(t!==void 0)return t}return}catch(n){nt.catch("Error in utils findInjectionPointByAttribute: ",n)}},vge=(i,o,n)=>{try{let e=fge(i,o);if(e===void 0)return;let t=e.getAttribute(o);if(t===null)return;if(Object.values(U.INJECTION_ATTRIBUTES).includes(o)){if(n===null){e.removeAttribute(t);return}if(t===""){switch(e.tagName.toLowerCase()){case"img":e.src=n;break;case"p":case"a":case"b":case"strong":case"i":case"span":e.innerText=n;break}return}e[t]=n}if(n===null){e.style.removeProperty(t);return}e.style.setProperty(t,n,"important")}catch(e){nt.catch("Error in utils injectAttributeData: ",e)}},n_=i=>{let o={};return i.from?.photoUrl?o[U.INJECTION_ATTRIBUTES.VELT_AVATAR_IMG]=i.from?.photoUrl:o[U.INJECTION_ATTRIBUTES.VELT_AVATAR_IMG]=null,i.priority?o[U.INJECTION_STYLE_PROPS.VELT_COMMENT_PRIORITY_COLOR]=i.priority.color:o[U.INJECTION_STYLE_PROPS.VELT_COMMENT_PRIORITY_COLOR]=null,i.from?.color?o[U.INJECTION_STYLE_PROPS.VELT_AVATAR_COLOR]=i.from?.color:o[U.INJECTION_STYLE_PROPS.VELT_AVATAR_COLOR]=null,o[U.INJECTION_ATTRIBUTES.VELT_COMMENT_LENGTH]=i.comments?.length||0,o};var YR=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this._elementRef=e}ngOnInit(){super.ngOnInit()}ngOnDestroy(){super.ngOnDestroy()}injectAttributeData(e,t){for(let r of Object.keys(t))vge(e,r,t[r])}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["velt-attribute-injector"]],standalone:!1,features:[B],decls:0,vars:0,template:function(t,r){},encapsulation:2,changeDetection:0});let i=o;return i})();var Cge=i=>({componentConfigSignal:i}),JGe=(i,o)=>({condition:i,data:o}),eWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),tWe=(i,o,n)=>({"velt-comment-pin--status-default":i,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":n});function nWe(i,o){i&1&&He(0)}function iWe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,nWe,1,0,"ng-container",2),b()),i&2){l();let n=me(2);m(),d("ngTemplateOutlet",n)}}function oWe(i,o){if(i&1&&(v(0),_(1,"div",8),le(),_(2,"svg",9),w(3,"path",10),b(),ut(),w(4,"app-comment-bubble-comments-count",11),P(5,"translate"),b(),w(6,"app-comment-bubble-avatar",12),P(7,"translate"),C()),i&2){let n=l(3).ngIf,e=l(2);m(),at("--velt-internal-comment-pin-bg-color",(n.annotation==null||n.annotation.status==null?null:n.annotation.status.color)||"var(--velt-accent, #625DF5)"),d("ngClass",je(16,tWe,!n.customStatusesShown&&(n.annotation==null||n.annotation.status==null?null:n.annotation.status.type)==="default",!n.customStatusesShown&&(n.annotation==null||n.annotation.status==null?null:n.annotation.status.type)==="ongoing",!n.customStatusesShown&&(n.annotation==null||n.annotation.status==null?null:n.annotation.status.type)==="terminal")),x("data-testid",e.componentId+"-count-container"),m(),x("data-testid",e.componentId+"-count-icon")("aria-label","Comment bubble containing "+((n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||"0")+" comments"),m(2),d("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-count")("aria-label",((n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||"0")+" "+M(5,12,"comments in this thread")),m(2),d("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-avatar")("aria-label",M(7,14,"Avatar for comment author"))}}function rWe(i,o){if(i&1){let n=Y();v(0),_(1,"velt-comment-dialog-portal-internal",5),W("togglePinSelection",function(t){return F(n),l(4).togglePinSelection(t),L(t.stopPropagation())})("saveComment",function(t){F(n);let r=l(4);return L(r.saveComment(t))})("addComment",function(t){F(n);let r=l(4);return L(r.onAddComment(t))}),_(2,"div",6),W("click",function(t){return F(n),L(t.stopPropagation())})("pointerup",function(t){return F(n),l(4).togglePinSelection(),L(t.stopPropagation())}),u(3,oWe,8,20,"ng-container",7),b()(),C()}if(i&2){let n=l(2).ngIf,e=l(2);m(),d("annotation",n.annotation)("context",n.context)("commentPinType","bubble")("commentPinSelected",n.commentPinSelected)("commentBubbleTargetPinHover",e.commentBubbleTargetPinHover)("targetElement",e.targetElement)("readOnly",n.readOnly)("commentBubbleElementRef",e.elementRef)("user",e.user),x("data-testid",e.componentId+"-dialog-portal"),m(),ue("velt-comment-bubble-hover",e.commentBubbleTargetPinHover)("velt-comment-bubble-open",!!n.selectedAnnotationsMap[n.annotation==null?null:n.annotation.annotationId]),x("data-velt-comment-bubble-comments-count",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||"0")("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(19,eWe,e.template,A(17,Cge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function aWe(i,o){if(i&1&&(v(0),u(1,rWe,4,25,"ng-container",3),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.annotation)}}function sWe(i,o){if(i&1&&(v(0),u(1,aWe,2,1,"ng-container",4),C()),i&2){let n=l(2);m(),d("veltIf",k(3,JGe,n.conditionSignal(),A(1,Cge,n.componentConfigSignal)))}}function lWe(i,o){if(i&1&&u(0,sWe,2,6,"ng-container",3),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var i_=(()=>{let o=class o extends YR{set _targetCommentElementId(e){try{this.targetElementId=e}catch{}}set _commentCountType(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{commentCountType:e}),t))}catch{}}set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.shadowDom=t}catch{}}set commentBubbleTargetPinHoverInput(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.commentBubbleTargetPinHover=!!t}catch(t){this.catchError("Error in CommentBubbleComponent commentBubbleTargetPinHover setter: ",t)}}set showAvatarInput(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(E({},r),{showAvatar:!!t}),r))}catch(t){this.catchError("Error in CommentBubbleComponent showAvatar setter: ",t)}}set avatar(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(E({},r),{showAvatar:!!t}),r))}catch(t){this.catchError("Error in CommentBubbleComponent showAvatar setter: ",t)}}set _folderId(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{folderId:e}),t?.folderId?t.veltFolderId=ji(t.folderId):t.veltFolderId=void 0,t)),this.checkCommentAnnotationAvailable()}catch{}}set _clientDocumentId(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{clientDocumentId:e}),t?.clientDocumentId?t.documentId=this.docService.generateDocumentId(t.clientDocumentId):t.documentId=void 0,t)),this.checkCommentAnnotationAvailable()}catch{}}set _locationId(e){try{this.componentConfigSignal.update(t=>(t=T(E({},t),{locationId:e}),t)),this.checkCommentAnnotationAvailable()}catch{}}set _context(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(r=>(r=T(E({},r),{context:t}),r))}catch{}}set _contextOptions(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(r=>(r=T(E({},r),{contextOptions:t}),r))}catch{}}set readOnly(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(E({},r),{readOnly:!!t}),r))}catch{}}constructor(e,t,r,a,s,c,p,g){super(p,g,s),this.authService=e,this.commentService=t,this.docService=r,this.domService=a,this.loggingService=s,this.wireframeService=c,this.elementRef=p,this.dynamicDataService=g,this.shadowDom=!0,this.darkMode=null,this.commentBubbleTargetPinHover=!1,this.commentAnnotationAvailable=!1,this.objectKeys=Object.keys,this.selectedAnnotationsMap={},this.resolvedCommentsOnDom=!1,this.hasSlotContent=!1,this.componentConfigSignal=Ee(new Tp),this.subscriptions=[],this.veltElement=!0,this.componentId="velt-comment-bubble",this.uniqueComponentId="velt-comment-bubble-"+on(),super.initializeComponentConfigSignal(new Tp);try{this.multiThreadAnnotationId=`temp_${this.uniqueComponentId}`,this.subscriptions.push(this.authService.getUser$().subscribe(f=>{this.user=f},f=>{this.catchError("Error in CommentBubbleComponent getUser$ subscription: ",f)})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{unreadCount:f?.[this.componentConfigSignal().annotation?.annotationId||""]||0}),I))})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{selectedAnnotationsLocationMap:f}),I)),this.checkCommentPinSelected()})),this.subscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{customStatusesShown:f}),I))})),this.subscriptions.push(this.commentService.getGroupMatchedComments$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=T(E({},I),{groupMatchedComments:f}),I))})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(f=>{this.selectedAnnotationsMap=f,this.componentConfigSignal.update(I=>(I=T(E({},I),{selectedAnnotationsMap:f}),I)),this.checkCommentPinSelected()},f=>{this.catchError("Error in CommentBubbleComponent getSelectedAnnotationsMap$ subscription: ",f)}))}catch(f){this.catchError("Error in CommentBubbleComponent constructor: ",f)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-comment-bubble-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.catchError("Error in CommentBubbleComponent OnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentBubbleComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{(this.targetElementId||this.componentConfigSignal().context||this.annotationId)&&this.checkCommentAnnotationAvailable()}catch(e){this.catchError("Error in CommentBubbleComponent AfterViewInit: ",e)}}ngOnChanges(e){try{if(e?.annotationId&&this.annotationId&&this.checkCommentAnnotationAvailable(),(e._context||e.context)&&this.checkCommentAnnotationAvailable(),(e._targetCommentElementId||e.targetElementId)&&this.checkCommentAnnotationAvailable(),e.darkMode){let t=e.darkMode.currentValue;t!==null&&(t!="false"?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"))}}catch(t){this.catchError("Error in CommentBubbleComponent ngOnChanges: ",t)}}handleCustomContent(e){try{let t=e.target;if(t.assignedElements().length>0){this.hasSlotContent=!0;let r=t.assignedElements()[0];this.customContentRef=r,r!==void 0&&this.componentConfigSignal().annotation!==null&&this.componentConfigSignal().annotation!==void 0&&this.injectAttributeData(r,n_(this.componentConfigSignal().annotation))}else this.hasSlotContent=!1,this.customContentRef=void 0}catch(t){this.catchError("Error in CommentBubbleComponent handleCustomContent: ",t)}}checkCommentAnnotationAvailable(){try{this.commentAnnotationSubscription&&this.commentAnnotationSubscription.unsubscribe(),this.removeBubbleCommentAnnotationIds(),this.commentAnnotationAvailable=!1;let e;(this.componentConfigSignal().folderId||this.componentConfigSignal().clientDocumentId)&&(e=this.componentConfigSignal().locationId),!!(this.targetElementId||this.componentConfigSignal().context||this.annotationId||this.componentConfigSignal().folderId||this.componentConfigSignal().documentId||e)?this.commentAnnotationSubscription=this.commentService.getCommentAnnotationsForCommentComponent({type:"bubble",annotationId:this.annotationId,targetElementId:this.targetElementId,context:this.componentConfigSignal().context,contextOptions:this.componentConfigSignal().contextOptions,element:this.elementRef.nativeElement,folderId:this.componentConfigSignal().folderId,documentId:this.componentConfigSignal().documentId,clientDocumentId:this.componentConfigSignal().clientDocumentId,locationId:e}).pipe(fe(r=>this.domService.getSelectedAnnotationsMap$().pipe(de(a=>(this.selectedAnnotationsMap=a,r)))),fe(r=>this.commentService.getResolvedCommentsOnDom$().pipe(de(a=>(this.resolvedCommentsOnDom=a,r))))).subscribe(r=>{let a=this.resolvedCommentsOnDom||this.componentConfigSignal().groupMatchedComments?r?.slice():r?.filter(g=>g.status.type!=="terminal"),s=null,c=!1;if(a?.length&&this.componentConfigSignal().groupMatchedComments&&(c=a?.length>1||!a?.[0]?.isDraft),c){s=new TC,s.annotationId=this.multiThreadAnnotationId,s.isTemporary=!0,s.from=a?.[0]?.from,s.metadata=a?.[0]?.metadata;let g,f=this.componentConfigSignal().locationId;f&&(g=this.docService.getLocationByClientLocationId(f),g||(g={id:f}));let I;g&&(I=this.docService.genarateLocationId(g)),g&&I&&(s.location=g,s.locationId=I),this.componentConfigSignal().context&&(s.context=this.componentConfigSignal().context),this.targetElementId&&(s.targetElementId=this.targetElementId),s.commentAnnotationsMap={},s.commentAnnotations={};for(let D of a||[])D.annotationId&&(s.commentAnnotationsMap||(s.commentAnnotationsMap={}),s.commentAnnotationsMap[D.annotationId]=D,s.commentAnnotations||(s.commentAnnotations={}),s.commentAnnotations[D.annotationId]=!0)}let p=a?.length?a[a?.length-1]:null;s&&(p=s),this.componentConfigSignal.update(g=>(g=T(E({},g),{annotation:p,annotations:a||[]}),g.unresolvedAnnotationsCount=a?.filter(f=>f.status.type!=="terminal")?.length||0,g)),this.resolvedCommentsOnDom||this.componentConfigSignal().annotation?.status?.type!=="terminal"||this.selectedAnnotationsMap[this.componentConfigSignal().annotation?.annotationId]||this.componentConfigSignal.update(g=>(g=T(E({},g),{annotation:null}),g)),this.componentConfigSignal().annotation!==null&&this.customContentRef!==void 0&&this.injectAttributeData(this.customContentRef,n_(this.componentConfigSignal().annotation)),this.veltAnnotationId=this.componentConfigSignal().annotation?.annotationId,this.veltAnnotationIds=r?.map(g=>g?.annotationId).join(","),this.commentService.addBubbleCommentAnnotationIds(r?.map(g=>g?.annotationId)||[]),this.checkCommentPinSelected(),setTimeout(()=>{this.commentService.addBubbleCommentAnnotationIds(r?.map(g=>g?.annotationId)||[])},100)},r=>{this.catchError("Error in CommentBubbleComponent getCommentAnnotationAvailableOnXPath subscription: ",r)}):(this.targetElement=void 0,this.componentConfigSignal.update(r=>(r=T(E({},r),{annotation:null}),r)),this.veltAnnotationId=void 0,this.veltAnnotationIds=void 0,this.selectedAnnotationsMap={})}catch(e){this.catchError("Error in CommentBubbleComponent checkCommentAnnotationAvailable: ",e)}}onAddComment(e){try{this.componentConfigSignal().groupMatchedComments&&e?.annotation?.isDraft&&(this.domService.getSelectedAnnotationsMap()?.[this.multiThreadAnnotationId]||this.domService.toggleAnnotationSelection({annotationId:this.multiThreadAnnotationId,type:"multiThread"},this.componentId))}catch(t){this.catchError("Error in CommentBubbleComponent onAddComment: ",t)}}checkCommentPinSelected(){try{let e=this.componentConfigSignal().selectedAnnotationsMap,t=this.componentConfigSignal().annotation,r=this.componentConfigSignal().selectedAnnotationsLocationMap,a=this.componentId;if(t){let s=!!e[t?.annotationId];if(s)if(t?.isDraft){let c;(this.componentConfigSignal().folderId||this.componentConfigSignal().clientDocumentId||this.componentConfigSignal().locationId||this.componentConfigSignal().context)&&(c=this.commentService.generateComponentIdFromObject({folderId:this.componentConfigSignal().folderId,clientDocumentId:this.componentConfigSignal().clientDocumentId,locationId:this.componentConfigSignal().locationId,context:this.componentConfigSignal().context}));let p=r?.[t.annotationId];c&&p?s=p===c:t?.sourceId&&(s=t?.sourceId===a,s&&this.domService.setSelectedAnnotationLocation(t.annotationId,this.componentId))}else{let c=r?.[t.annotationId];c&&(s=c===this.componentId)}s!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(c=>(c=T(E({},c),{commentPinSelected:s}),c))}}catch(e){this.catchError("Error in CommentBubbleComponent checkCommentPinSelected: ",e)}}togglePinSelection(e){try{let t=e||this.componentConfigSignal().annotation;if(t)if(this.selectedAnnotationsMap[t?.annotationId])document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):this.domService.toggleAnnotationSelection(t,this.componentId);else{let r=document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(r||(r=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),r){let a=r.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let s=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);s&&(s.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(t,this.componentId)}}catch(t){this.catchError("Error in CommentBubbleComponent togglePinSelection: ",t)}}saveComment(e){try{this.componentConfigSignal().annotation&&this.commentService.saveComment(this.componentConfigSignal().annotation,e)}catch(t){this.catchError("Error in CommentBubbleComponent saveComment: ",t)}}removeBubbleCommentAnnotationIds(){try{this.commentService.removeBubbleCommentAnnotationIds(this.veltAnnotationIds?.split(",")||[])}catch(e){this.catchError("Error in CommentBubbleComponent removeBubbleCommentAnnotationIds: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.removeBubbleCommentAnnotationIds(),this.unsubscribe()}catch(e){this.catchError("Error in CommentBubbleComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.commentAnnotationSubscription&&this.commentAnnotationSubscription.unsubscribe(),this.subscriptions=[]}catch(e){this.catchError("Error in CommentBubbleComponent unsubscribe: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(Ue),h(De),h(rt),h(Le),h(y),h(ze),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-bubble"]],hostVars:3,hostBindings:function(t,r){t&2&&x("data-velt-annotation-id",r.veltAnnotationId)("data-velt-annotation-ids",r.veltAnnotationIds)("data-velt-element",r.veltElement)},inputs:{annotationId:"annotationId",_targetCommentElementId:[0,"targetCommentElementId","_targetCommentElementId"],targetElementId:"targetElementId",variant:"variant",_commentCountType:[0,"commentCountType","_commentCountType"],_shadowDom:[0,"shadowDom","_shadowDom"],darkMode:"darkMode",commentBubbleTargetPinHoverInput:[0,"commentBubbleTargetPinHover","commentBubbleTargetPinHoverInput"],showAvatarInput:[0,"showAvatar","showAvatarInput"],avatar:"avatar",_folderId:[0,"folderId","_folderId"],_clientDocumentId:[0,"documentId","_clientDocumentId"],_locationId:[0,"locationId","_locationId"],_context:[0,"context","_context"],_contextOptions:[0,"contextOptions","_contextOptions"],readOnly:"readOnly"},standalone:!1,features:[V([S]),B,Ze],decls:3,vars:2,consts:[["commentBubbleRefRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[4,"ngIf"],[4,"veltIf"],[3,"togglePinSelection","saveComment","addComment","annotation","context","commentPinType","commentPinSelected","commentBubbleTargetPinHover","targetElement","readOnly","commentBubbleElementRef","user"],["part","container","slot","comment-bubble",1,"comment-bubble-container","velt-comment-bubble",3,"click","pointerup"],[4,"veltDynamicTemplate"],["part","count-container",1,"comment-count-container","velt-comment-bubble--count-container",3,"ngClass"],["width","32","height","26","viewBox","0 0 32 26","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill","currentColor","stroke","currentColor","part","count-icon-path","d","M18 1H10C5.02944 1 1 5.02944 1 10V16C1 20.9706 5.02944 25 10 25H26H28.1315C29.7289 25 30.6817 23.2197 29.7956 21.8906L27.5038 18.453C27.1753 17.9602 27 17.3812 27 16.7889V10C27 5.02944 22.9706 1 18 1Z"],["aria-hidden","true","role","status",1,"comment-count","velt-comment-bubble--count",3,"componentConfigSignal"],["aria-hidden","true","role","img",3,"componentConfigSignal"]],template:function(t,r){if(t&1&&u(0,iWe,2,1,"velt-shadow-dom-internal",1)(1,lWe,1,1,"ng-template",null,0,xe),t&2){let a=me(2);d("ngIf",!r.template&&r.shadowDom)("ngIfElse",a)}},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%]{display:inline-flex;--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)}[_nghost-%COMP%]:empty{display:none}[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)}.comment-bubble-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:0;cursor:pointer}.comment-bubble-container.custom-content[_ngcontent-%COMP%]{display:unset;gap:unset}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.625rem;display:flex;justify-content:center;align-items:center;padding-top:1px}.comment-count-container[_ngcontent-%COMP%]{align-items:center;box-sizing:border-box;display:flex;justify-content:left;position:relative;height:calc((1.625rem + 0px) * var(--velt-base-rem-unit));width:calc((2rem + 0px) * var(--velt-base-rem-unit))}.comment-count-container[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--velt-internal-comment-pin-bg-color)}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-default[_ngcontent-%COMP%]{color:var(--velt-accent, var(--velt-internal-comment-pin-bg-color))}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-ongoing[_ngcontent-%COMP%]{color:var(--velt-warning, var(--velt-internal-comment-pin-bg-color))}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-terminal[_ngcontent-%COMP%]{color:var(--velt-success, var(--velt-internal-comment-pin-bg-color))}.comment-count[_ngcontent-%COMP%]{font-size:var(--velt-font-size-2xs);font-weight:600;left:2px;line-height:20px;position:absolute;right:var(--velt-spacing-xs);text-align:center;color:var(--velt-accent-foreground)}"],changeDetection:0});let i=o;return i})();var ke=class{constructor(){this.showReplyComposer=!1,this.addCommentMode=!1,this.moderatorMode=!1,this.enableSignInButton=!1,this.enablePriority=!1,this.enableStatus=!1,this.enableResolve=!1,this.suggestionMode=!1,this.enableUpgradeButton=!1,this.isPlanExpired=!1,this.attachmentNameInMessage=!1,this.isPrivateComment=!1,this.isUserAdmin=!1,this.isPrivateCommentAllowed=!1,this.darkMode=!1,this.showScreenSizeInfo=!1,this.multiThread=!1,this.bottomSheetMode=!1,this.showAllComments=!1,this.showCommentIndex=!1,this.disabled=!1,this.enableAutoCategorize=!1,this.enableAttachment=!1,this.enableReactions=!1,this.screenSharingSupported=!1,this.allowedRecordings=[],this.sidebarButtonOnCommentDialogVisible=!1,this.userMentions=!0,this.deleteOnBackspace=!0,this.recordingSummaryEnabled=!1,this.dialogShadowDOM=!1,this.enterKeyToSubmit=!1,this.isInputFocused=!1,this.showDefault=!0,this.dialogOpenedInSidebar=!1,this.resolveStatusAccessAdminOnly=!1,this.linkCallback=!1,this.readOnly=!1,this.selection=!0,this.newComment="",this.newCommentHTML="",this.showCommentButtons=!1,this.editComment=null,this.editCommentIndex=null,this.optionsMenuOpened=!1,this.selectedUserContacts=[],this.showReplies=!1,this.ghostComment=null,this.enableGhostCommentsMessage=!1,this.hasReactionsByCommentId={},this.unreadCommentsMap=null,this.selectedFiles=[],this.invalidSelectedFiles=[],this.selectedAttachments=[],this.attachmentsToDelete=[],this.uploadingAttachments=!1,this.localRecordedData=[],this.taggedUserContacts=[],this.customList=[],this.toOrganizationUserGroup=[],this.composerInOpenState=!1,this.customChipData=null,this.selectedCustomChipSet=new Set,this.notificationEnabled=!1,this.pageModeComposer=!1,this.playVideoInFullScreen=!0,this.isKnownUser=!1,this.dialogSelectedByKnownUser=!1,this.showGhostCommentMessage=!1,this.showSuggestionModeActions=!1,this.canResolveAnnotation=!1,this.canUnresolveAnnotation=!1,this.getAnnotationDraftAttribute=null,this.assignToMenuOpened=!1,this.commentDialogUniqueId="",this.deviceInfoTooltipPositions=[],this.shortUserName=!0,this.annotationIndex=0,this.userContacts=[],this.annotation=new Wo,this.user=new Vo,this.dialogMode=!0,this.sidebarMode=!1,this.inboxMode=!1,this.inlineCommentMode=!1,this.isInsidePdfViewer=!1,this.locationDisplayName=void 0,this.locationVersion=void 0,this.commentPinSelected=!1,this.fullExpanded=!1,this.commentDialogSelected=!1,this.variant="dialog",this.inlineCommentSectionMode=!1,this.commentComposerMode=!1,this.composerMode=Qh.DEFAULT,this.openDropdownIndexValue=-1,this.reactionToolOpenIndex=-1,this.focusedThreadMode=!1,this.isFocusedThreadEnabled=!1,this.currentDialogView={},this.userContactsBySnippylyId=null,this.seenByUsers=!0,this.isAutocompleteDropdownOpen=!1,this.repliesUniqueUsers=[],this.maxReplyAvatars=3,this.totalReplies=0,this.replyAvatars=!1}};var _ge=i=>({componentConfigSignal:i}),cWe=(i,o)=>({condition:i,data:o}),dWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-all-comment-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function mWe(i,o){if(i&1&&(_(0,"div",5),P(1,"translate"),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b(),ut(),_(5,"div",9),te(6),P(7,"translate"),b()()),i&2){let n=l(4);x("aria-label",M(1,7,"View all comments"))("aria-haspopup",!0)("aria-expanded",!1)("data-testid",n.componentId+"-button"),m(2),x("data-testid",n.componentId+"-icon"),m(3),x("data-testid",n.componentId+"-label"),m(),_e(" ",M(7,9,"All comments"))}}function pWe(i,o){if(i&1){let n=Y();_(0,"div",3),W("click",function(t){F(n);let r=l(2).ngIf;return r==null||r.openAllComments(),L(t.stopPropagation())}),u(1,mWe,8,11,"div",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(4,dWe,e.template,A(2,_ge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function gWe(i,o){if(i&1&&(v(0),u(1,pWe,2,10,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&(n==null?null:n.dialogMode)&&(n==null?null:n.sidebarButtonOnCommentDialogVisible))}}function uWe(i,o){if(i&1&&(v(0),u(1,gWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,cWe,n.conditionSignal(),A(1,_ge,n.componentConfigSignal)))}}var o_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-all-comment",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAllCommentComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAllCommentComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAllCommentComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-all-comment"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"click",4,"ngIf"],[3,"click"],["class","velt-all-comment","role","button","tabindex","0",4,"veltDynamicTemplate"],["role","button","tabindex","0",1,"velt-all-comment"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.83268 12.2505V14.8286L9.05119 12.3358L9.49212 12.3286C11.2454 12.2999 12.8232 12.1234 14.003 11.9439C14.7476 11.8306 15.2649 11.3109 15.3773 10.6585C15.5332 9.75341 15.666 8.60678 15.666 7.33268C15.666 6.05858 15.5332 4.91195 15.3773 4.0069C15.2649 3.35442 14.7476 2.83478 14.003 2.72149C12.7126 2.52515 10.948 2.33268 8.99935 2.33268C7.05074 2.33268 5.28608 2.52515 3.9957 2.72149C3.25113 2.83478 2.73377 3.35442 2.62138 4.00691C2.46548 4.91195 2.33268 6.05858 2.33268 7.33268C2.33268 8.60678 2.46548 9.75341 2.62138 10.6585C2.71897 11.2251 3.1148 11.6792 3.69192 11.8711L4.83268 12.2505ZM0.978897 3.72399C1.22072 2.32008 2.33662 1.28808 3.74499 1.07379C5.09444 0.86846 6.94567 0.666016 8.99935 0.666016C11.053 0.666016 12.9043 0.86846 14.2537 1.07379C15.6621 1.28808 16.778 2.32008 17.0198 3.72399C17.1883 4.70245 17.3327 5.94539 17.3327 7.33268C17.3327 8.71997 17.1883 9.96292 17.0198 10.9414C16.778 12.3453 15.6621 13.3773 14.2537 13.5916C13.0192 13.7794 11.3647 13.9648 9.51941 13.9951L4.42329 17.0064C3.86778 17.3347 3.16602 16.9342 3.16602 16.289V13.4526C2.03815 13.0776 1.18648 12.1465 0.978897 10.9414C0.810359 9.96292 0.666016 8.71997 0.666016 7.33268C0.666016 5.94539 0.810359 4.70245 0.978897 3.72399Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.83268 4.83268C4.37244 4.83268 3.99935 5.20578 3.99935 5.66602C3.99935 6.12625 4.37244 6.49935 4.83268 6.49935H13.166C13.6263 6.49935 13.9993 6.12625 13.9993 5.66602C13.9993 5.20578 13.6263 4.83268 13.166 4.83268H4.83268ZM4.83268 8.16602C4.37244 8.16602 3.99935 8.53911 3.99935 8.99935C3.99935 9.45959 4.37245 9.83268 4.83268 9.83268H8.16602C8.62625 9.83268 8.99935 9.45959 8.99935 8.99935C8.99935 8.53911 8.62625 8.16602 8.16602 8.16602H4.83268Z","fill","currentColor"],[1,"velt-all-comment--button"]],template:function(t,r){t&1&&u(0,uWe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-all-comment[_ngcontent-%COMP%]{gap:var(--velt-spacing-xs);display:flex;flex-direction:row;align-items:center;justify-content:center}.velt-all-comment[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:var(--velt-accent-text)}.velt-all-comment--button[_ngcontent-%COMP%]{position:relative;line-height:1.25em;font-weight:600;display:inline-block;cursor:pointer}"],changeDetection:0});let i=o;return i})();var yge=i=>({componentConfigSignal:i}),fWe=(i,o)=>({condition:i,data:o}),vWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-approve-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function CWe(i,o){if(i&1&&(v(0),w(1,"div",5),_(2,"div",6),te(3),P(4,"translate"),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-fill"),m(),x("data-testid",n.componentId+"-label"),m(),_e(" ",M(4,3,"Approve"))}}function _We(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),W("click",function(t){F(n);let r=l(2).ngIf;return r==null||r.approveCommentPinAnnotation(),L(t.stopPropagation())}),u(2,CWe,5,5,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("aria-label",M(1,4,"Approve comment"))("aria-pressed",!1)("data-testid",e.componentId+"-button"),m(2),d("veltDynamicTemplate",$(8,vWe,e.template,A(6,yge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yWe(i,o){if(i&1&&(v(0),u(1,_We,3,14,"ng-template",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&(n==null?null:n.moderatorMode)&&!(!(n==null||n.annotation==null)&&n.annotation.approved)&&(n==null||n.user==null?null:n.user.isAdmin))}}function SWe(i,o){if(i&1&&(v(0),u(1,yWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,fWe,n.conditionSignal(),A(1,yge,n.componentConfigSignal)))}}var r_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-approve",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogApproveComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogApproveComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogApproveComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-approve"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],["aria-hidden","true",1,"velt-fill"],[1,"velt-flat-button"]],template:function(t,r){t&1&&u(0,SWe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-fill[_ngcontent-%COMP%]{flex-grow:1}.velt-flat-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm) var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-3xl);border:0;color:var(--velt-accent-foreground);font-weight:700;transition:.2s;font-size:var(--velt-font-size-sm);cursor:pointer}.velt-flat-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}"],changeDetection:0});let i=o;return i})();var Sge=i=>({componentConfigSignal:i}),IWe=(i,o)=>({condition:i,data:o}),EWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assign-menu-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xWe(i,o){if(i&1){let n=Y();v(0),_(1,"velt-autocomplete-panel-internal",5),P(2,"translate"),P(3,"translate"),W("optionSelected",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.assignCommentToUser(t))}),b(),C()}if(i&2){let n=l(3).ngIf,e=l();m(),d("darkMode",!!(n!=null&&n.darkMode))("enableOnFocus",!0)("metadata",n==null||n.annotation==null?null:n.annotation.metadata)("placeholder",M(2,6,"Search")),x("aria-label",M(3,8,"Search users"))("data-testid",e.componentId+"-autocomplete")}}function TWe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),W("clickOutside",function(){F(n);let t=l(2).ngIf;return L(t==null?null:t.closeAssignToMenu())}),u(2,xWe,4,10,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,4,"Assign thread"))("aria-modal",!0),m(2),d("veltDynamicTemplate",$(8,EWe,e.template,A(6,Sge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function DWe(i,o){if(i&1&&(v(0),u(1,TWe,3,14,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.assignToMenuOpened)}}function wWe(i,o){if(i&1&&(v(0),u(1,DWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,IWe,n.conditionSignal(),A(1,Sge,n.componentConfigSignal)))}}var A2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-assign-menu",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssignMenuComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssignMenuComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","dialog"),e.setAttribute("aria-label","Assign thread"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssignMenuComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assign-menu"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-header--assign-menu","snippylyClickOutside","","role","dialog",3,"clickOutside",4,"ngIf"],["snippylyClickOutside","","role","dialog",1,"velt-header--assign-menu",3,"clickOutside"],[4,"veltDynamicTemplate"],[3,"optionSelected","darkMode","enableOnFocus","metadata","placeholder"]],template:function(t,r){t&1&&u(0,wWe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}[_nghost-%COMP%] .velt-header--assign-menu{position:absolute;top:100%;width:calc((15rem + 0px) * var(--velt-base-rem-unit));right:0;background:var(--velt-background-0);border:1px solid var(--velt-border-4);border-radius:var(--velt-border-radius-md);padding:var(--velt-spacing-sm);box-sizing:border-box;height:100%;height:unset;line-height:unset;display:flex;gap:var(--velt-spacing-sm);z-index:3}[_nghost-%COMP%] .velt-header--assign-menu velt-autocomplete-panel-internal{width:100%}[_nghost-%COMP%] .velt-header--assign-menu velt-autocomplete-panel-internal input{border:0;font-size:var(--velt-font-size-sm)}"],changeDetection:0});let i=o;return i})();var bge=i=>({componentConfigSignal:i}),OWe=(i,o)=>({condition:i,data:o}),AWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-resolve-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PWe(i,o){if(i&1&&(le(),_(0,"svg",4),w(1,"path",5),b()),i&2){let n=l(4);x("data-testid",n.componentId+"-icon")}}function MWe(i,o){if(i&1){let n=Y();v(0),_(1,"app-resolve-button",2),W("changeStatus",function(t){F(n);let r=l(2).ngIf;return L(r==null?null:r.changeStatus(t))}),u(2,PWe,2,1,"svg",3),b(),C()}if(i&2){let n=l(2).ngIf,e=l();m(),d("darkMode",!!(n!=null&&n.darkMode))("headingMode",!0)("annotation",n==null?null:n.annotation)("sidebarMode",n==null?null:n.sidebarMode),x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(8,AWe,e.template,A(6,bge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kWe(i,o){if(i&1&&(v(0),u(1,MWe,3,14,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.canResolveAnnotation)}}function RWe(i,o){if(i&1&&(v(0),u(1,kWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,OWe,n.conditionSignal(),A(1,bge,n.componentConfigSignal)))}}var P2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-banner-resolve-button",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerResolveButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerResolveButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerResolveButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner-resolve-button"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"changeStatus","darkMode","headingMode","annotation","sidebarMode"],["width","12","height","10","viewBox","0 0 12 10","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false",4,"veltDynamicTemplate"],["width","12","height","10","viewBox","0 0 12 10","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M11.5886 1.07806C11.914 1.4035 11.914 1.93114 11.5886 2.25657L4.92194 8.92324C4.5965 9.24868 4.06886 9.24868 3.74343 8.92324L0.410093 5.58991C0.0846564 5.26447 0.0846564 4.73683 0.410093 4.4114C0.73553 4.08596 1.26317 4.08596 1.5886 4.4114L4.33268 7.15547L10.4101 1.07806C10.7355 0.752625 11.2632 0.752625 11.5886 1.07806Z","fill","currentColor"]],template:function(t,r){t&1&&u(0,RWe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Ige=i=>({componentConfigSignal:i}),NWe=(i,o)=>({condition:i,data:o}),FWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-user-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function LWe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",3),P(2,"translate"),C()),i&2){let n=l(2).ngIf,e=l();m(),d("size",28)("user",n==null||n.annotation==null?null:n.annotation.assignedTo),x("aria-label",M(2,4,"Avatar for assigned user"))("data-testid",e.componentId+"-avatar")}}function BWe(i,o){if(i&1&&(v(0),u(1,LWe,3,6,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,FWe,e.template,A(1,Ige,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function VWe(i,o){if(i&1&&(v(0),u(1,BWe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,NWe,n.conditionSignal(),A(1,Ige,n.componentConfigSignal)))}}var M2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-assignee-banner-avatar",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner-user-avatar"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-assignee-banner--user-avatar",3,"size","user"]],template:function(t,r){t&1&&u(0,VWe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-assignee-banner--user-avatar[_ngcontent-%COMP%]{align-self:center}"],changeDetection:0});let i=o;return i})();var Ege=i=>({componentConfigSignal:i}),UWe=(i,o)=>({condition:i,data:o}),jWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-user-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function $We(i,o){if(i&1&&(_(0,"div",5),P(1,"translate"),te(2),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,3,"Assigned to")+" "+((n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.name)||(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.email))),m(2),_e(" ",M(3,5,(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.name)||(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.email)))}}function HWe(i,o){if(i&1&&(v(0),u(1,$We,4,7,"div",4),C()),i&2){let n=l(2).ngIf,e=me(3);m(),d("ngIf",(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.name)||(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.email))("ngIfElse",e)}}function zWe(i,o){if(i&1&&(v(0),u(1,HWe,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,jWe,e.template,A(1,Ege,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function GWe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",6)}function WWe(i,o){if(i&1&&(v(0),u(1,zWe,2,9,"ng-container",2)(2,GWe,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(3,UWe,n.conditionSignal(),A(1,Ege,n.componentConfigSignal)))}}var k2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-assignee-banner-name",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner-user-name"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-assignee-banner--user-name","role","text",4,"ngIf","ngIfElse"],["role","text",1,"velt-assignee-banner--user-name"],["height","16px","width","80px","borderRadius","8px"]],template:function(t,r){t&1&&u(0,WWe,4,6,"ng-container",1),t&2&&d("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%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-assignee-banner--user-name[_ngcontent-%COMP%]{color:var(--velt-accent-foreground);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}"],changeDetection:0});let i=o;return i})();var xge=i=>({componentConfigSignal:i}),qWe=(i,o)=>({condition:i,data:o}),YWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function KWe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-assignee-banner-resolve-button",7)(2,"app-comment-dialog-assignee-banner-unresolve-button",8),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)}}function ZWe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),w(2,"app-comment-dialog-assignee-banner-user-avatar",4),_(3,"div",5)(4,"div",6),te(5),P(6,"translate"),b(),w(7,"app-comment-dialog-assignee-banner-user-name",4),b(),u(8,KWe,3,2,"ng-container",0),b()),i&2){let n=l(3).ngIf,e=l();at("background-color",n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.color)("--legacy-velt-assignee-banner-color",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.lightColor)||"white")("--legacy-velt-tooltip-button-color",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.lightColor)||"white"),ue("velt-assignee-banner--private-comment-mode",n==null?null:n.isPrivateComment)("private-comment",n==null?null:n.isPrivateComment),x("data-testid",e.componentId)("aria-label",M(1,17,"Comment assignment details")),m(2),d("componentConfigSignal",e.componentConfigSignal),m(),x("data-testid",e.componentId+"-author"),m(2),Ge(M(6,19,"Assigned to:")),m(2),d("componentConfigSignal",e.componentConfigSignal),m(),d("ngIf",!(n!=null&&n.readOnly))}}function XWe(i,o){if(i&1&&(v(0),u(1,ZWe,9,21,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,YWe,e.template,A(1,xge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function QWe(i,o){if(i&1&&(v(0),u(1,XWe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null||n.annotation==null?null:n.annotation.assignedTo)&&!(n!=null&&n.inlineCommentMode))}}function JWe(i,o){if(i&1&&(v(0),u(1,QWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,qWe,n.conditionSignal(),A(1,xge,n.componentConfigSignal)))}}var a_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-assignee-banner",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","region"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-assignee-banner--heading","role","region",3,"velt-assignee-banner--private-comment-mode","private-comment","backgroundColor","--legacy-velt-assignee-banner-color","--legacy-velt-tooltip-button-color",4,"veltDynamicTemplate"],["role","region",1,"velt-assignee-banner--heading"],[3,"componentConfigSignal"],[1,"velt-assignee-banner--author"],[1,"velt-assignee-banner--text"],[1,"velt-assignee-banner--resolve-button",3,"componentConfigSignal"],[1,"velt-assignee-banner--unresolve-button",3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,JWe,2,6,"ng-container",0),t&2&&d("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%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-assignee-banner--heading[_ngcontent-%COMP%]{background:var(--velt-green);margin:calc(var(--velt-spacing-lg) * -1);padding:var(--velt-spacing-lg);color:var(--velt-white);display:flex;align-items:center;justify-content:flex-start;grid-gap:var(--velt-spacing-sm);gap:var(--velt-spacing-sm);margin-bottom:0;border-radius:var(--velt-border-radius-md) var(--velt-border-radius-md) 0 0}.velt-assignee-banner--heading.velt-assignee-banner--private-comment-mode[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--velt-purple) 32%,var(--velt-black) 100%);border-radius:0}.velt-assignee-banner--author[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;overflow:hidden}.velt-assignee-banner--text[_ngcontent-%COMP%]{font-style:normal;font-weight:400;font-size:var(--velt-font-size-xs);line-height:17px;color:var(--velt-accent-foreground)}.velt-assignee-banner--resolve-button[_ngcontent-%COMP%], .velt-assignee-banner--unresolve-button[_ngcontent-%COMP%]{margin-left:auto}"],changeDetection:0});let i=o;return i})();var tqe=["commentContainer"],nqe=i=>({componentConfigSignal:i}),iqe=(i,o)=>({condition:i,data:o}),oqe=(i,o)=>({componentConfigSignal:i,wireframe:o}),rqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-body-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function aqe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-reply-avatars",9),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal)}}function sqe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-hide-reply",9),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-toggle-collapsed")}}function lqe(i,o){if(i&1){let n=Y();_(0,"div",6),W("scroll",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.setMessageScrollOffset(t))}),w(1,"app-comment-dialog-threads",7),_(2,"div",8),u(3,aqe,2,1,"ng-container",1),w(4,"app-comment-dialog-toggle-reply",9),u(5,sqe,2,2,"ng-container",1),b()()}if(i&2){let n=l(3).ngIf,e=l();x("aria-live","polite")("aria-atomic","false")("data-testid",e.componentId+"-scroll-container"),m(),d("componentConfigSignal",e.componentConfigSignal)("wireframe",e.wireframe),x("data-testid",e.componentId+"-threads"),m(),ue("velt-comment-dialog-body--reply-avatars-inline-mode",n.inlineCommentSectionMode),m(),d("ngIf",(n==null?null:n.replyAvatars)&&!(n!=null&&n.commentDialogSelected)&&!(n!=null&&n.readOnly)),m(),d("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-toggle"),m(),d("ngIf",(n==null?null:n.inlineCommentSectionMode)&&!(n!=null&&n.readOnly))}}function cqe(i,o){if(i&1&&(_(0,"div",4,0),P(2,"translate"),u(3,lqe,6,12,"div",5),b()),i&2){let n=l(2).ngIf,e=l();ue("velt-comment-dialog-body--inline-comment-section-mode",n==null?null:n.inlineCommentSectionMode)("velt-comment-dialog-body--closed",!(n!=null&&n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))("velt-comment-dialog-body--focused-thread-mode",n==null?null:n.focusedThreadMode),x("data-testid",e.componentId)("aria-label",M(2,10,"Comment dialog thread"))("aria-expanded",!(!(n!=null&&n.commentDialogSelected)&&(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))),m(3),d("veltDynamicTemplate",$(15,rqe,e.template,k(12,oqe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function dqe(i,o){if(i&1&&(v(0),u(1,cqe,4,21,"div",3),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)}}function mqe(i,o){if(i&1&&(v(0),u(1,dqe,2,1,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,iqe,n.conditionSignal(),A(1,nqe,n.componentConfigSignal)))}}var s_=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.subscriptions=[],this.componentId="velt-comment-dialog-body",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.subscriptions.push(this.componentConfigSignal().scrollToBottom.subscribe(()=>{this.scrollToBottom()}))}catch{}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()}),clearTimeout(this.scrollTimeout)}catch{}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogBodyComponent setupA11yAttributes:",e)}}scrollToBottom(){try{clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.commentContainer?.nativeElement&&this.commentContainer?.nativeElement.scrollTo({top:this.commentContainer.nativeElement.scrollHeight,behavior:"smooth"})},100)}catch(e){this.catchError("Error in CommentDialogBodyComponent scrollToBottom: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-body"]],viewQuery:function(t,r){if(t&1&&it(tqe,5),t&2){let a;Xe(a=Qe())&&(r.commentContainer=a.first)}},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["commentContainer",""],[4,"ngIf"],[4,"veltIf"],["class","velt-body","role","region",3,"velt-comment-dialog-body--inline-comment-section-mode","velt-comment-dialog-body--closed","velt-comment-dialog-body--focused-thread-mode",4,"ngIf"],["role","region",1,"velt-body"],["role","log",3,"scroll",4,"veltDynamicTemplate"],["role","log",3,"scroll"],[3,"componentConfigSignal","wireframe"],[1,"velt-comment-dialog-body--reply-avatars"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,mqe,2,6,"ng-container",1),t&2&&d("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%]:empty{display:none}.velt-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;max-height:250px;position:relative}.velt-body.velt-comment-dialog-body--inline-comment-section-mode[_ngcontent-%COMP%]{max-height:none}.velt-comment-dialog-body--inline-comment-section-mode[_ngcontent-%COMP%] app-comment-dialog-threads[_ngcontent-%COMP%]{max-height:none;overflow:initial}[_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-body--focused-thread-mode[_ngcontent-%COMP%]{width:100%;max-height:none}.velt-comment-dialog-body--focused-thread-mode[_ngcontent-%COMP%] app-comment-dialog-threads[_ngcontent-%COMP%]{max-height:none}.velt-comment-dialog-body--reply-avatars[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;margin-top:var(--velt-spacing-xs)}.velt-comment-dialog-body--reply-avatars-inline-mode[_ngcontent-%COMP%]{margin-left:calc((3rem + 0px) * var(--velt-base-rem-unit));gap:var(--velt-spacing-sm)}"],changeDetection:0});let i=o;return i})();var Tge=i=>({componentConfigSignal:i}),gqe=(i,o)=>({condition:i,data:o}),uqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-category-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hqe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),te(2),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();at("background-color",(n==null||n.annotation==null||n.annotation.commentCategories==null||n.annotation.commentCategories[0]==null?null:n.annotation.commentCategories[0].color)+" !important"),x("data-testid",e.componentId+"-index")("aria-label",M(1,6,"Comment Index")+" "+(n==null||n.annotation==null?null:n.annotation.annotationIndex))("aria-hidden",!0),m(2),_e(" ",M(3,8,n==null?null:n.annotation.commentCategories[0].name))}}function fqe(i,o){if(i&1&&(v(0),u(1,hqe,4,10,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,uqe,e.template,A(1,Tge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vqe(i,o){if(i&1&&(v(0),u(1,fqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.enableAutoCategorize)&&(n==null||n.annotation==null||n.annotation.commentCategories==null?null:n.annotation.commentCategories.length))}}function Cqe(i,o){if(i&1&&(v(0),u(1,vqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,gqe,n.conditionSignal(),A(1,Tge,n.componentConfigSignal)))}}var R2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-comment-category",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogCommentCategoryComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogCommentCategoryComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogCommentCategoryComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-comment-category"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-category",3,"background-color",4,"veltDynamicTemplate"],[1,"velt-comment-category"]],template:function(t,r){t&1&&u(0,Cqe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-comment-category[_ngcontent-%COMP%]{color:var(--velt-white);display:flex;justify-content:center;align-items:center;padding:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-3xl);min-width:calc((1rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:600;font-size:var(--velt-font-size-2xs);font-weight:400;background:var(--velt-gray);box-sizing:border-box}"],changeDetection:0});let i=o;return i})();var Dge=i=>({componentConfigSignal:i}),_qe=(i,o)=>({condition:i,data:o}),yqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-index-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Sqe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),te(2),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,4,"Comment Index")+" "+(n==null||n.annotation==null?null:n.annotation.annotationIndex))("aria-hidden",!0),m(2),_e(" #",n==null||n.annotation==null?null:n.annotation.annotationIndex)}}function bqe(i,o){if(i&1&&(v(0),u(1,Sqe,3,6,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,yqe,e.template,A(1,Dge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Iqe(i,o){if(i&1&&(v(0),u(1,bqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null||n.annotation==null?null:n.annotation.annotationIndex)}}function Eqe(i,o){if(i&1&&(v(0),u(1,Iqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,_qe,n.conditionSignal(),A(1,Dge,n.componentConfigSignal)))}}var KR=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-comment-index",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogCommentIndexComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogCommentIndexComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogCommentIndexComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-comment-index"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-index",4,"veltDynamicTemplate"],[1,"velt-comment-index"]],template:function(t,r){t&1&&u(0,Eqe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-comment-index[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;padding:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-3xl);width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-size:var(--velt-font-size-2xs);box-sizing:border-box;font-weight:400;background:var(--velt-gray);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var wge=i=>({componentConfigSignal:i}),xqe=(i,o)=>({condition:i,data:o}),Tqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-suggestion-status-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Dqe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),P(2,"translate"),te(3),P(4,"translate"),b()),i&2){let n=l(3).ngIf,e=l();ue("velt-comment-suggestion-status--accepted",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentAcceptedStatus==null?null:n.commentAcceptedStatus.id))("velt-comment-suggestion-status--rejected",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentRejectedStatus==null?null:n.commentRejectedStatus.id)),x("data-testid",e.componentId)("aria-label",M(1,7,"Suggestion")+" "+M(2,9,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"")),m(3),_e(" ",M(4,11,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"")," ")}}function wqe(i,o){if(i&1&&(v(0),u(1,Dqe,5,13,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,Tqe,e.template,A(1,wge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Oqe(i,o){if(i&1&&(v(0),u(1,wqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.suggestionMode)&&((n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentAcceptedStatus==null?null:n.commentAcceptedStatus.id)||(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentRejectedStatus==null?null:n.commentRejectedStatus.id)))}}function Aqe(i,o){if(i&1&&(v(0),u(1,Oqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,xqe,n.conditionSignal(),A(1,wge,n.componentConfigSignal)))}}var N2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-comment-suggestion-status",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogCommentSuggestionStatusComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogCommentSuggestionStatusComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogCommentSuggestionStatusComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-comment-suggestion-status"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-suggestion-status","role","status",3,"velt-comment-suggestion-status--accepted","velt-comment-suggestion-status--rejected",4,"veltDynamicTemplate"],["role","status",1,"velt-comment-suggestion-status"]],template:function(t,r){t&1&&u(0,Aqe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-comment-suggestion-status[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;justify-content:center;align-items:center;padding:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-3xl);min-width:calc((1rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:600;font-size:var(--velt-font-size-2xs);font-weight:400;background:var(--velt-gray)}.velt-comment-suggestion-status.velt-comment-suggestion-status--accepted[_ngcontent-%COMP%]{background:var(--velt-success);color:var(--velt-success-foreground)}.velt-comment-suggestion-status.velt-comment-suggestion-status--rejected[_ngcontent-%COMP%]{background:var(--velt-error);color:var(--velt-error-foreground)}"],changeDetection:0});let i=o;return i})();var l_=i=>({componentConfigSignal:i}),Pqe=(i,o)=>({condition:i,data:o}),c_=(i,o)=>({componentName:"velt-comment-dialog-composer-action-button-wireframe",variant:i,suffix:o}),F2=(i,o,n,e,t,r)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-action-button-wireframe",variant:n,suffix:e,setIfCondition:t,componentElementRef:r});function Mqe(i,o){if(i&1){let n=Y();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("buttonClick",function(){F(n);let t=l(4).ngIf;return L(t==null?null:t.onAtClick(t==null||t.newCommentTextArea==null?null:t.newCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,c_,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.newCommentTextArea==null?null:n.newCommentTextArea.nativeElement),x("aria-label",M(1,7,"Mention someone using @ symbol"))("data-testid",e.componentId+"-autocomplete-new")}}function kqe(i,o){if(i&1){let n=Y();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("buttonClick",function(){F(n);let t=l(4).ngIf;return L(t==null?null:t.onAtClick(t==null||t.editCommentTextArea==null?null:t.editCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,c_,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.editCommentTextArea==null?null:n.editCommentTextArea.nativeElement),x("aria-label",M(1,7,"Mention someone using @ symbol while editing"))("data-testid",e.componentId+"-autocomplete-edit")}}function Rqe(i,o){if(i&1&&(v(0),u(1,Mqe,2,12,"velt-autocomplete-tool-internal",5)(2,kqe,2,12,"velt-autocomplete-tool-internal",5),C()),i&2){let n=l(4);m(),d("ngIf",!n.editMode),m(),d("ngIf",n.editMode)}}function Nqe(i,o){if(i&1&&(v(0),u(1,Rqe,3,2,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.userMentions)}}function Fqe(i,o){if(i&1){let n=Y();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("buttonClick",function(){F(n);let t=l(4).ngIf;return L(t==null?null:t.onAtClick(t==null||t.newCommentTextArea==null?null:t.newCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,c_,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.newCommentTextArea==null?null:n.newCommentTextArea.nativeElement),x("aria-label",M(1,7,"Type @ to mention someone"))("data-testid",e.componentId+"-autocomplete-tool-new")}}function Lqe(i,o){if(i&1){let n=Y();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("buttonClick",function(){F(n);let t=l(4).ngIf;return L(t==null?null:t.onAtClick(t==null||t.editCommentTextArea==null?null:t.editCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,c_,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.editCommentTextArea==null?null:n.editCommentTextArea.nativeElement),x("aria-label",M(1,7,"Type @ to mention someone while editing"))("data-testid",e.componentId+"-autocomplete-tool-edit")}}function Bqe(i,o){if(i&1&&(v(0),u(1,Fqe,2,12,"velt-autocomplete-tool-internal",5)(2,Lqe,2,12,"velt-autocomplete-tool-internal",5),C()),i&2){let n=l(4);m(),d("ngIf",!n.editMode),m(),d("ngIf",n.editMode)}}function Vqe(i,o){if(i&1&&(v(0),u(1,Bqe,3,2,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.userMentions)}}function Uqe(i,o){if(i&1){let n=Y();_(0,"app-attachment-button",8),P(1,"translate"),W("clicked",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.onAttachmentButtonClick())})("selectFiles",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.selectFiles(t))})("setIfConditionEvent",function(t){F(n);let r=l(4);return L(r.setIfCondition(t))}),b()}if(i&2){let n=l(3).ngIf,e=l();d("template",e.template)("darkMode",!!(n!=null&&n.darkMode))("componentMeta",k(8,c_,n==null?null:n.variant,e.type))("allowedFileTypes",n==null?null:n.allowedFileTypes),x("aria-label",M(1,6,"Add file attachment to comment"))("data-testid",e.componentId+"-attachment-button")}}function jqe(i,o){if(i&1&&(v(0),u(1,Uqe,2,11,"app-attachment-button",7),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.enableAttachment)}}function $qe(i,o){if(i&1){let n=Y();_(0,"app-attachment-button",8),P(1,"translate"),W("clicked",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.onAttachmentButtonClick())})("selectFiles",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.selectFiles(t))})("setIfConditionEvent",function(t){F(n);let r=l(4);return L(r.setIfCondition(t))}),b()}if(i&2){let n=l(3).ngIf,e=l();d("template",e.template)("darkMode",!!(n!=null&&n.darkMode))("componentMeta",k(8,c_,n==null?null:n.variant,e.type))("allowedFileTypes",n==null?null:n.allowedFileTypes),x("aria-label",M(1,6,"Add file attachment to comment"))("data-testid",e.componentId+"-attachment-button")}}function Hqe(i,o){if(i&1&&(v(0),u(1,$qe,2,11,"app-attachment-button",7),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.enableAttachment)}}function zqe(i,o){if(i&1&&(v(0),_(1,"app-action-button",13),P(2,"translate"),le(),_(3,"svg",14),w(4,"path",15)(5,"path",16),b()(),C()),i&2){let n=l(4).ngIf,e=l();m(),d("title",M(2,4,"Record voice"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label","Record voice message")("data-testid",e.componentId+"-audio-record")}}function Gqe(i,o){if(i&1){let n=Y();_(0,"app-device-permission-button",10),P(1,"translate"),_(2,"div",11),P(3,"translate"),W("click",function(){F(n);let t=l(3).ngIf;return L(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("audio"))}),u(4,zqe,6,6,"ng-container",12),b()()}if(i&2){let n=l(3).ngIf,e=l();d("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(1,6,"Record voice message"))("data-testid",e.componentId+"-audio-button"),m(2),x("aria-label",M(3,8,"Click to start voice recording"))("data-testid",e.componentId+"-audio-record"),m(2),d("veltDynamicTemplate",Ns(12,F2,e.template,A(10,l_,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function Wqe(i,o){if(i&1&&(v(0),u(1,Gqe,5,19,"app-device-permission-button",9),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("audio"))}}function qqe(i,o){if(i&1&&(v(0),_(1,"app-action-button",13),P(2,"translate"),P(3,"translate"),le(),_(4,"svg",19),w(5,"path",20),b()(),C()),i&2){let n=l(4).ngIf,e=l();m(),d("title",M(2,4,"Record video"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(3,6,"Record video message"))("data-testid",e.componentId+"-video-record")}}function Yqe(i,o){if(i&1){let n=Y();_(0,"app-device-permission-button",18),P(1,"translate"),_(2,"div",11),W("click",function(){F(n);let t=l(3).ngIf;return L(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("video"))}),u(3,qqe,6,8,"ng-container",12),b()()}if(i&2){let n=l(3).ngIf,e=l();d("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(1,6,"Record video message"))("data-testid",e.componentId+"-video-button"),m(2),x("aria-label","Click to start video recording")("data-testid",e.componentId+"-video-record"),m(),d("veltDynamicTemplate",Ns(10,F2,e.template,A(8,l_,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function Kqe(i,o){if(i&1&&(v(0),u(1,Yqe,4,17,"app-device-permission-button",17),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("video"))}}function Zqe(i,o){if(i&1&&(v(0),_(1,"app-action-button",13),P(2,"translate"),P(3,"translate"),le(),_(4,"svg",22),w(5,"path",23)(6,"path",24)(7,"path",25)(8,"path",26),b()(),C()),i&2){let n=l(4).ngIf,e=l();m(),d("title",M(2,4,"Record screen"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(3,6,"Record your screen"))("data-testid",e.componentId+"-screen-record")}}function Xqe(i,o){if(i&1){let n=Y();_(0,"div",11),P(1,"translate"),W("click",function(){F(n);let t=l(3).ngIf;return L(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("screen"))}),u(2,Zqe,9,8,"ng-container",12),b()}if(i&2){let n=l(3).ngIf,e=l();x("aria-label",M(1,3,"Click to start screen recording"))("data-testid",e.componentId+"-screen-record"),m(2),d("veltDynamicTemplate",Ns(7,F2,e.template,A(5,l_,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function Qqe(i,o){if(i&1&&(v(0),u(1,Xqe,3,14,"div",21),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("screen"))&&(n==null?null:n.screenSharingSupported))}}function Jqe(i,o){i&1&&(_(0,"div",30),le(),_(1,"svg",31),w(2,"path",32),b()())}function eYe(i,o){if(i&1){let n=Y();_(0,"button",28),P(1,"translate"),W("click",function(t){F(n);let r=l(3).ngIf;return r==null||r.addComment(),L(t.stopPropagation())}),u(2,Jqe,3,0,"div",29),b()}if(i&2){let n,e=l(3).ngIf,t=l();d("disabled",(e==null||e.newComment==null||(n=e.newComment.trim())==null?null:n.length)<1&&!(!(e==null||e.selectedAttachments==null)&&e.selectedAttachments.length)&&!(!(e==null||e.localRecordedData==null)&&e.localRecordedData.length)||(e==null?null:e.uploadingAttachments)),x("aria-label",M(1,4,"Save new comment"))("data-testid",t.componentId+"-submit-new"),m(2),d("veltDynamicTemplate",Ns(8,F2,t.template,A(6,l_,t.componentConfigSignal),e==null?null:e.variant,t.type,t.setIfCondition.bind(t),t.elementRef))}}function tYe(i,o){i&1&&(_(0,"div",30),le(),_(1,"svg",31),w(2,"path",33),b()())}function nYe(i,o){if(i&1){let n=Y();_(0,"button",28),P(1,"translate"),W("click",function(t){F(n);let r=l(3).ngIf,a=l();return r==null||r.updateComment(a.i,r==null||r.editCommentTextArea==null?null:r.editCommentTextArea.nativeElement.innerText),L(t.stopPropagation())}),u(2,tYe,3,0,"div",29),b()}if(i&2){let n,e=l(3).ngIf,t=l();d("disabled",!(!(e==null||e.editCommentTextArea==null||e.editCommentTextArea.nativeElement==null||e.editCommentTextArea.nativeElement.innerText==null||(n=e.editCommentTextArea.nativeElement.innerText.trim())==null)&&n.length)&&!(!(e==null||e.selectedAttachments==null)&&e.selectedAttachments.length)&&!(!(e==null||e.attachmentsToDelete==null)&&e.attachmentsToDelete.length)&&!(!(e==null||e.localRecordedData==null)&&e.localRecordedData.length)||(e==null?null:e.uploadingAttachments)),x("aria-label",M(1,4,"Save edited comment"))("data-testid",t.componentId+"-submit-edit"),m(2),d("veltDynamicTemplate",Ns(8,F2,t.template,A(6,l_,t.componentConfigSignal),e==null?null:e.variant,t.type,t.setIfCondition.bind(t),t.elementRef))}}function iYe(i,o){if(i&1&&(v(0),u(1,eYe,3,15,"button",27)(2,nYe,3,15,"button",27),C()),i&2){let n=l(3);m(),d("ngIf",!n.editMode),m(),d("ngIf",n.editMode)}}function oYe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),P(2,"translate"),W("click",function(t){return F(n),L(t.stopPropagation())}),v(3,3),u(4,Nqe,2,1,"ng-container",4)(5,Vqe,2,1,"ng-container",4)(6,jqe,2,1,"ng-container",4)(7,Hqe,2,1,"ng-container",4)(8,Wqe,2,1,"ng-container",4)(9,Kqe,2,1,"ng-container",4)(10,Qqe,2,1,"ng-container",4)(11,iYe,3,2,"ng-container",4),C(),b(),C()}if(i&2){let n=l(2);m(),x("aria-label",M(2,11,"Comment tools and actions"))("data-testid",n.componentId),m(2),d("ngSwitch",n.type),m(),d("ngSwitchCase","userMentions"),m(),d("ngSwitchCase","autocomplete"),m(),d("ngSwitchCase","file"),m(),d("ngSwitchCase","attachments"),m(),d("ngSwitchCase","audio"),m(),d("ngSwitchCase","video"),m(),d("ngSwitchCase","screen"),m(),d("ngSwitchCase","submit")}}function rYe(i,o){if(i&1&&(v(0),u(1,oYe,12,13,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Pqe,n.conditionSignal(),A(1,l_,n.componentConfigSignal)))}}var L2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.editMode=!1,this.hotkey="@",this.componentId="velt-comment-dialog-composer-action-button",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerActionButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerActionButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label",`Composer action button group for ${this.type}`)}catch(e){this.loggingService.catch("Error in CommentDialogComposerActionButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-action-button"]],inputs:{type:"type",editMode:"editMode",i:"i",hotkey:"hotkey"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","group",1,"velt-comment-dialog-composer-action-button",3,"click"],[3,"ngSwitch"],[4,"ngSwitchCase"],[3,"hotkey","template","componentMeta","darkMode","triggerElement","buttonClick",4,"ngIf"],[3,"buttonClick","hotkey","template","componentMeta","darkMode","triggerElement"],[3,"template","darkMode","componentMeta","allowedFileTypes","clicked","selectFiles","setIfConditionEvent",4,"ngIf"],[3,"clicked","selectFiles","setIfConditionEvent","template","darkMode","componentMeta","allowedFileTypes"],["type","audio","mode","thread",3,"darkMode",4,"ngIf"],["type","audio","mode","thread",3,"darkMode"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[3,"title","darkMode"],["icon","","width","14","height","20","viewBox","0 0 14 20","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M0.833333 7.5C1.29357 7.5 1.66667 7.8731 1.66667 8.33333V9.16667C1.66667 11.9281 3.90524 14.1667 6.66667 14.1667C9.42809 14.1667 11.6667 11.9281 11.6667 9.16667V8.33333C11.6667 7.8731 12.0398 7.5 12.5 7.5C12.9602 7.5 13.3333 7.8731 13.3333 8.33333V9.16667C13.3333 12.5663 10.7886 15.3717 7.5 15.7818V18.3333H10C10.4602 18.3333 10.8333 18.7064 10.8333 19.1667C10.8333 19.6269 10.4602 20 10 20H3.33333C2.8731 20 2.5 19.6269 2.5 19.1667C2.5 18.7064 2.8731 18.3333 3.33333 18.3333H5.83333V15.7818C2.54474 15.3717 0 12.5663 0 9.16667V8.33333C0 7.8731 0.373096 7.5 0.833333 7.5Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.33203 9.16667V3.33333C8.33203 2.41286 7.58584 1.66667 6.66536 1.66667C5.74489 1.66667 4.9987 2.41286 4.9987 3.33333V9.16667C4.9987 10.0871 5.74489 10.8333 6.66536 10.8333C7.58584 10.8333 8.33203 10.0871 8.33203 9.16667ZM6.66536 0C4.82442 0 3.33203 1.49238 3.33203 3.33333V9.16667C3.33203 11.0076 4.82442 12.5 6.66536 12.5C8.50631 12.5 9.9987 11.0076 9.9987 9.16667V3.33333C9.9987 1.49238 8.50631 0 6.66536 0Z","fill","currentColor"],["type","video","mode","thread",3,"darkMode",4,"ngIf"],["type","video","mode","thread",3,"darkMode"],["icon","","width","19","height","11","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.55139 0.230077C1.68754 0.453772 1.06855 1.02195 0.766641 1.86822L0.666016 2.15026V5.58765V9.02505L0.766892 9.30709C1.0535 10.1083 1.64038 10.6731 2.43987 10.9173L2.70863 10.9993H7.1343H11.56L11.8467 10.9033C12.6234 10.6431 13.2099 10.0635 13.47 9.29927C13.56 9.03464 13.5637 8.99015 13.5769 8.02909C13.5844 7.48129 13.6004 7.03312 13.6125 7.03312C13.661 7.03312 15.0857 7.85517 15.8518 8.3252C16.7188 8.85713 16.9126 8.93691 17.338 8.93691C18.0692 8.93691 18.7509 8.40671 18.947 7.68535C19.0174 7.42654 19.0165 3.74584 18.946 3.48531C18.7883 2.90254 18.278 2.40649 17.7016 2.27577C17.4483 2.2183 17.0895 2.23195 16.8373 2.30859C16.6848 2.35492 16.3699 2.52421 15.9107 2.80671C15.3288 3.1648 13.6405 4.14219 13.6039 4.14219C13.5979 4.14219 13.5847 3.70988 13.5747 3.18148C13.5543 2.10348 13.5363 1.99704 13.2916 1.506C13.0166 0.954081 12.475 0.492835 11.8467 0.275239L11.56 0.17596L7.18806 0.168733C2.95948 0.161752 2.80747 0.163762 2.55139 0.230077ZM11.3211 1.83448C11.5404 1.89857 11.7306 2.05186 11.8398 2.25268L11.9183 2.39705V5.57098V8.74488L11.8268 8.91988C11.7122 9.13896 11.4929 9.30656 11.2552 9.35673C11.0123 9.40799 3.20786 9.40919 2.98224 9.35804C2.74243 9.30364 2.53297 9.14287 2.42553 8.93071L2.33236 8.74678V5.58765V2.42853L2.42553 2.2446C2.52985 2.03864 2.7435 1.8703 2.96604 1.81882C3.04208 1.80123 4.88581 1.78558 7.11882 1.7836C10.641 1.7805 11.1578 1.78678 11.3211 1.83448ZM17.3116 5.59171V7.28802L17.2309 7.23605C16.8358 6.98144 15.6936 6.30232 15.1359 5.99038C14.7573 5.77856 14.4468 5.59675 14.4461 5.58635C14.4453 5.57591 14.7874 5.37341 15.2062 5.13632C15.6251 4.89919 16.258 4.52439 16.6128 4.30341C16.9675 4.08243 17.2699 3.90019 17.2847 3.8985C17.2995 3.89681 17.3116 4.65875 17.3116 5.59171Z","fill","currentColor"],["role","button","tabindex","0",3,"click",4,"ngIf"],["icon","","width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["d","M7.4987 15H9.16536V16.6667H10.832V15H12.4987V16.6667H13.332C13.7923 16.6667 14.1654 17.0398 14.1654 17.5C14.1654 17.9602 13.7923 18.3333 13.332 18.3333H6.66536C6.20513 18.3333 5.83203 17.9602 5.83203 17.5C5.83203 17.0398 6.20513 16.6667 6.66536 16.6667H7.4987V15Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33464 5L3.33464 11.6667C3.33464 12.5871 4.08083 13.3333 5.0013 13.3333L15.0013 13.3333C15.9218 13.3333 16.668 12.5871 16.668 11.6667L16.668 5C16.668 4.07953 15.9218 3.33333 15.0013 3.33333L5.0013 3.33333C4.08083 3.33333 3.33464 4.07953 3.33464 5ZM1.66797 11.6667C1.66797 13.5076 3.16035 15 5.0013 15L15.0013 15C16.8423 15 18.3346 13.5076 18.3346 11.6667L18.3346 5C18.3346 3.15905 16.8423 1.66667 15.0013 1.66667L5.0013 1.66667C3.16035 1.66667 1.66797 3.15905 1.66797 5L1.66797 11.6667Z","fill","currentColor"],["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","currentColor"],["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","currentColor"],["class","velt-composer--submit-button",3,"disabled","click",4,"ngIf"],[1,"velt-composer--submit-button",3,"click","disabled"],["class","velt-composer--input-button",4,"veltDynamicTemplate"],[1,"velt-composer--input-button"],["width","14","height","14","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["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","currentColor"],["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","white"]],template:function(t,r){t&1&&u(0,rYe,2,6,"ng-container",0),t&2&&d("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%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-comment-dialog-composer-action-button[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center}.velt-composer--submit-button[_ngcontent-%COMP%]{background:transparent;border:0;outline:0}.velt-composer--submit-button[_ngcontent-%COMP%] .velt-composer--input-button[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;width:2.4em;height:2.4em;border:0;border-radius:var(--velt-border-radius-3xl);background:var(--velt-accent);color:var(--velt-accent-foreground);cursor:pointer}.velt-composer--submit-button[_ngcontent-%COMP%]:disabled .velt-composer--input-button[_ngcontent-%COMP%]{opacity:.4;pointer-events:none;cursor:not-allowed}.velt-composer--submit-button[_ngcontent-%COMP%]:hover .velt-composer--input-button[_ngcontent-%COMP%]{background:var(--velt-accent-hover);color:var(--velt-accent-foreground)}.velt-composer--submit-button[_ngcontent-%COMP%]:focus .velt-composer--input-button[_ngcontent-%COMP%]{background:var(--velt-accent-hover);color:var(--velt-accent-foreground);outline:0}.velt-composer--submit-button[_ngcontent-%COMP%]:active .velt-composer--input-button[_ngcontent-%COMP%]{background:var(--velt-accent-hover);color:var(--velt-accent-foreground)}"],changeDetection:0});let i=o;return i})();var Oge=i=>({componentConfigSignal:i}),aYe=(i,o)=>({condition:i,data:o}),sYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-assign-user-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function lYe(i,o){if(i&1){let n=Y();_(0,"app-assign-dropdown",4),P(1,"translate"),W("setAssignTo",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.setAssignTo(t))}),b()}if(i&2){let n=l(3).ngIf,e=l();d("darkMode",!!(n!=null&&n.darkMode))("assignTo",n==null?null:n.assignTo)("selectedUserContacts",n==null?null:n.selectedUserContacts),x("data-testid",e.componentId+"-dropdown")("aria-label",M(1,5,"Assign user"))}}function cYe(i,o){if(i&1&&(v(0),u(1,lYe,2,7,"app-assign-dropdown",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.userMentions)}}function dYe(i,o){if(i&1&&(v(0),u(1,cYe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,sYe,e.template,A(1,Oge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function mYe(i,o){if(i&1&&(v(0),u(1,dYe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,aYe,n.conditionSignal(),A(1,Oge,n.componentConfigSignal)))}}var B2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-assign-user",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAssignUserComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAssignUserComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAssignUserComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-assign-user"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"darkMode","assignTo","selectedUserContacts","setAssignTo",4,"ngIf"],[3,"setAssignTo","darkMode","assignTo","selectedUserContacts"]],template:function(t,r){t&1&&u(0,mYe,2,6,"ng-container",0),t&2&&d("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%]{width:100%}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var pYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),gYe=(i,o)=>({condition:i,data:o}),uYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),hYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-preview-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function fYe(i,o){if(i&1&&(v(0),w(1,"img",3),C()),i&2){let n=l(3);m(),d("src",n.file==null?null:n.file.url,hn)}}function vYe(i,o){if(i&1&&(v(0),u(1,fYe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,hYe,e.template,dt(1,uYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function CYe(i,o){if(i&1&&(v(0),u(1,vYe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,gYe,n.conditionSignal(),dt(1,pYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var V2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-image-preview",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImagePreviewComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImagePreviewComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImagePreviewComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image-preview"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["velt-ignore-change-detection","true","aria-hidden","true","role","img",3,"src"]],template:function(t,r){t&1&&u(0,CYe,2,9,"ng-container",0),t&2&&d("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}img[_ngcontent-%COMP%]{width:100%;object-fit:cover;height:100%}"],changeDetection:0});let i=o;return i})();var _Ye=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),yYe=(i,o)=>({condition:i,data:o}),SYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),bYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function IYe(i,o){i&1&&(v(0),le(),_(1,"svg",5),w(2,"path",6)(3,"path",7),b(),C())}function EYe(i,o){if(i&1){let n=Y();_(0,"button",3),P(1,"translate"),P(2,"translate"),W("click",function(){F(n);let t=l(2).ngIf,r=l();return L(r.isEditMode?t==null?null:t.removeAttachmentFromComment(r.fileIndex):t==null?null:t.removeFile(r.fileIndex))}),u(3,IYe,4,0,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("title",M(1,4,"Remove File")),x("data-testid",e.componentId)("aria-label",M(2,6,"Remove file")),m(3),d("veltDynamicTemplate",$(13,bYe,e.template,dt(8,SYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function xYe(i,o){if(i&1&&(v(0),u(1,EYe,4,19,"button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n!=null&&n.uploadingAttachments))}}function TYe(i,o){if(i&1&&(v(0),u(1,xYe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,yYe,n.conditionSignal(),dt(1,_Ye,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var U2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-image-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image-delete"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-composer--icon-button",3,"title","click",4,"ngIf"],[1,"velt-composer--icon-button",3,"click","title"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","role","img"],["d","M0 0h24v24H0V0z","fill","none"],["d","M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"]],template:function(t,r){t&1&&u(0,TYe,2,9,"ng-container",0),t&2&&d("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}.velt-composer--icon-button[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;margin:var(--velt-spacing-xs);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var DYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),wYe=(i,o)=>({condition:i,data:o}),OYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),AYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-loading-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PYe(i,o){i&1&&(v(0),le(),_(1,"svg",3)(2,"circle",4),w(3,"animateTransform",5),b()(),C())}function MYe(i,o){if(i&1&&(v(0),u(1,PYe,4,0,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,AYe,e.template,dt(1,OYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kYe(i,o){if(i&1&&(v(0),u(1,MYe,2,12,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",(n==null?null:n.uploadingAttachments)&&!e.isEditMode&&!(e.file!=null&&e.file.uploaded))}}function RYe(i,o){if(i&1&&(v(0),u(1,kYe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,wYe,n.conditionSignal(),dt(1,DYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var j2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-image-loading",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageLoadingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageLoadingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageLoadingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image-loading"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink","width","48px","height","48px","viewBox","0 0 100 100","preserveAspectRatio","xMidYMid","aria-hidden","true","role","img",2,"margin","auto","display","block"],["cx","50","cy","50","fill","none","stroke","currentColor","stroke-width","7","r","34","stroke-dasharray","160.22122533307947 55.40707511102649"],["attributeName","transform","type","rotate","repeatCount","indefinite","dur","1s","values","0 50 50;360 50 50","keyTimes","0;1"]],template:function(t,r){t&1&&u(0,RYe,2,9,"ng-container",0),t&2&&d("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}svg[_ngcontent-%COMP%]{color:var(--velt-white)}"],changeDetection:0});let i=o;return i})();var NYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),FYe=(i,o)=>({condition:i,data:o}),LYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),BYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function VYe(i,o){if(i&1&&(v(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),_(4,"div",4),P(5,"translate"),P(6,"translate"),w(7,"app-comment-dialog-composer-attachments-image-loading",5),P(8,"translate"),P(9,"translate"),w(10,"app-comment-dialog-composer-attachments-image-delete",6),P(11,"translate"),P(12,"translate"),b(),w(13,"app-comment-dialog-composer-attachments-image-preview",7),P(14,"translate"),P(15,"translate"),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),ue("loading",(n==null?null:n.uploadingAttachments)&&!e.isEditMode&&!(e.file!=null&&e.file.uploaded)),x("aria-label",M(2,24,"Image attachment:")+" "+M(3,26,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-selected-file"),m(3),x("aria-label",M(5,28,"Actions for image:")+" "+M(6,30,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-actions"),m(3),d("componentConfigSignal",e.componentConfigSignal)("file",e.file)("fileIndex",e.fileIndex)("isEditMode",e.isEditMode),x("aria-label",M(8,32,"Uploading image:")+" "+M(9,34,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-loading"),m(3),d("componentConfigSignal",e.componentConfigSignal)("file",e.file)("fileIndex",e.fileIndex)("isEditMode",e.isEditMode),x("aria-label",M(11,36,"Delete image:")+" "+M(12,38,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-delete"),m(3),d("componentConfigSignal",e.componentConfigSignal)("file",e.file)("fileIndex",e.fileIndex)("isEditMode",e.isEditMode),x("aria-label",M(14,40,"Preview of image:")+" "+M(15,42,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-preview")}}function UYe(i,o){if(i&1&&(v(0),u(1,VYe,16,44,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,BYe,e.template,dt(1,LYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function jYe(i,o){if(i&1&&(v(0),u(1,UYe,2,12,"ng-container",0),C()),i&2){let n=l(2);m(),d("ngIf",n.isEditMode?n.file==null||n.file.mimeType==null?null:n.file.mimeType.includes("image"):n.file==null||n.file.fileType==null?null:n.file.fileType.includes("image"))}}function $Ye(i,o){if(i&1&&(v(0),u(1,jYe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,FYe,n.conditionSignal(),dt(1,NYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var $2=(()=>{let o=class o extends H{set _imageWireframe(e){this.imageWireframe=e,this.imageWireframe?this.template=this.domService.deepCloneElement(this.imageWireframe):this.template=null}constructor(e,t,r,a){super(t,r,a),this.domService=e,this.elementRef=t,this.dynamicDataService=r,this.loggingService=a,this.componentId="velt-comment-dialog-composer-attachments-image",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Image attachment controls")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Le),h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode",_imageWireframe:[0,"imageWireframe","_imageWireframe"]},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--selected-file"],["role","group",1,"velt-composer--selected-file-actions"],[3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","button","tabindex","0",3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","img",3,"componentConfigSignal","file","fileIndex","isEditMode"]],template:function(t,r){t&1&&u(0,$Ye,2,9,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-composer--selected-file[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-sm);overflow:hidden;line-height:0;position:relative;height:80px;width:93px;flex:0 0 30%}.velt-composer--selected-file[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;background:color-mix(in srgb,var(--velt-surface-0) 32%,transparent);align-items:center;justify-content:center;display:none}.velt-composer--selected-file[_ngcontent-%COMP%]:hover .velt-composer--selected-file-actions[_ngcontent-%COMP%], .velt-composer--selected-file.loading[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var HYe=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),zYe=(i,o)=>({condition:i,data:o}),GYe=(i,o,n)=>({componentConfigSignal:i,fileIndex:o,file:n}),WYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-preview-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function qYe(i,o){if(i&1&&(v(0),w(1,"img",3),C()),i&2){let n=l(3);m(),d("src",n.file==null?null:n.file.url,hn)}}function YYe(i,o){if(i&1&&(v(0),u(1,qYe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,WYe,e.template,je(1,GYe,e.componentConfigSignal,e.fileIndex,e.file),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function KYe(i,o){if(i&1&&(v(0),u(1,YYe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,zYe,n.conditionSignal(),je(1,HYe,n.componentConfigSignal,n.file,n.fileIndex)))}}var H2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid-item-preview",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemPreviewComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemPreviewComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemPreviewComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item-preview"]],inputs:{file:"file",fileIndex:"fileIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["velt-ignore-change-detection","true","aria-hidden","true","role","img",3,"src"]],template:function(t,r){t&1&&u(0,KYe,2,8,"ng-container",0),t&2&&d("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}img[_ngcontent-%COMP%]{width:100%;object-fit:cover;height:100%}"],changeDetection:0});let i=o;return i})();var ZYe=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),XYe=(i,o)=>({condition:i,data:o}),QYe=(i,o,n)=>({componentConfigSignal:i,fileIndex:o,file:n}),JYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function eKe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),P(3,"translate"),te(4),P(5,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"Error message:")+" "+M(3,5,n.file==null?null:n.file.errorMessage)),m(3),_e(" ",M(5,7,n.file==null?null:n.file.errorMessage)," ")}}function tKe(i,o){if(i&1&&(v(0),u(1,eKe,6,9,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,JYe,e.template,je(1,QYe,e.componentConfigSignal,e.fileIndex,e.file),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function nKe(i,o){if(i&1&&(v(0),u(1,tKe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,XYe,n.conditionSignal(),je(1,ZYe,n.componentConfigSignal,n.file,n.fileIndex)))}}var z2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid-item-message",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemMessageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemMessageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item-message"]],inputs:{file:"file",fileIndex:"fileIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--error-message"]],template:function(t,r){t&1&&u(0,nKe,2,8,"ng-container",0),t&2&&d("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}.velt-composer--error-message[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);text-align:center;margin-top:var(--velt-spacing-xs);color:var(--velt-white)}"],changeDetection:0});let i=o;return i})();var Age=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),iKe=(i,o)=>({condition:i,data:o}),oKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function rKe(i,o){i&1&&(v(0),le(),_(1,"svg",4),w(2,"path",5)(3,"path",6),b(),C())}function aKe(i,o){if(i&1){let n=Y();v(0),_(1,"button",2),P(2,"translate"),P(3,"translate"),P(4,"translate"),W("click",function(){F(n);let t=l().ngIf,r=l();return L(t==null?null:t.removeInvalidFile(r.fileIndex))}),u(5,rKe,4,0,"ng-container",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),d("title",M(2,4,"Remove File")),x("aria-label",M(3,6,"Remove invalid file:")+" "+M(4,8,(e.file==null?null:e.file.name)||"unnamed file"))("data-testid",e.componentId+"-button"),m(4),d("veltDynamicTemplate",$(14,oKe,e.template,je(10,Age,e.componentConfigSignal,e.file,e.fileIndex),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function sKe(i,o){if(i&1&&(v(0),u(1,aKe,6,20,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,iKe,n.conditionSignal(),je(1,Age,n.componentConfigSignal,n.file,n.fileIndex)))}}var G2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid-item-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item-delete"]],inputs:{file:"file",fileIndex:"fileIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[1,"velt-composer--icon-button",3,"click","title"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","role","img"],["d","M0 0h24v24H0V0z","fill","none"],["d","M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"]],template:function(t,r){t&1&&u(0,sKe,2,8,"ng-container",0),t&2&&d("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}.velt-composer--icon-button[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;margin:var(--velt-spacing-xs);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var Pge=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),lKe=(i,o)=>({condition:i,data:o}),cKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function dKe(i,o){if(i&1&&(v(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),_(4,"div",4),P(5,"translate"),P(6,"translate"),w(7,"app-comment-dialog-composer-attachments-invalid-item-delete",5),b(),_(8,"div",6),P(9,"translate"),le(),_(10,"svg",7),w(11,"path",8),b(),ut(),w(12,"app-comment-dialog-composer-attachments-invalid-item-message",9),b(),w(13,"app-comment-dialog-composer-attachments-invalid-item-preview",10),P(14,"translate"),P(15,"translate"),b(),C()),i&2){let n=l(3);m(),x("aria-label",M(2,18,"Invalid file:")+" "+M(3,20,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId),m(3),x("aria-label",M(5,22,"Actions for invalid file:")+" "+M(6,24,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-file-actions"),m(3),d("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex),x("aria-label","Remove invalid file: "+((n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-delete-file"),m(),x("aria-label","File error: "+M(9,26,(n.file==null?null:n.file.error)||"File cannot be uploaded"))("data-testid",n.componentId+"-error-message"),m(4),d("file",n.file)("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-error-message-text"),m(),d("componentConfigSignal",n.componentConfigSignal)("file",n.file),x("aria-label",M(14,28,"Preview of invalid file:")+" "+M(15,30,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-preview-file")}}function mKe(i,o){if(i&1&&(v(0),u(1,dKe,16,32,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,cKe,e.template,je(1,Pge,e.componentConfigSignal,e.file,e.fileIndex),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function pKe(i,o){if(i&1&&(v(0),u(1,mKe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,lKe,n.conditionSignal(),je(1,Pge,n.componentConfigSignal,n.file,n.fileIndex)))}}var W2=(()=>{let o=class o extends H{set _itemWireframe(e){this.itemWireframe=e,this.itemWireframe?this.template=this.domService.deepCloneElement(this.itemWireframe):this.template=null}constructor(e,t,r,a){super(t,r,a),this.domService=e,this.elementRef=t,this.dynamicDataService=r,this.loggingService=a,this.componentId="velt-comment-dialog-composer-attachments-invalid-item",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Composer invalid attachment actions")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Le),h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item"]],inputs:{file:"file",fileIndex:"fileIndex",_itemWireframe:[0,"itemWireframe","_itemWireframe"]},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--invalid-selected-file"],["role","group",1,"velt-composer--selected-file-actions"],["role","button","tabindex","0",3,"componentConfigSignal","file","fileIndex"],["role","alert","aria-live","polite",1,"velt-composer--error-message"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","role","img",1,"velt-composer--error-message-icon"],["d","M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"],[3,"file","componentConfigSignal"],["role","img",3,"componentConfigSignal","file"]],template:function(t,r){t&1&&u(0,pKe,2,8,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-composer--invalid-selected-file[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-sm);overflow:hidden;line-height:0;position:relative;height:72px;width:85px;flex:0 0 30%;border:4px solid var(--velt-error)}.velt-composer--invalid-selected-file[_ngcontent-%COMP%] .velt-composer--error-message[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;background:color-mix(in srgb,var(--velt-surface-0) 52%,transparent);display:flex;flex-direction:column;padding:var(--velt-spacing-xs);align-items:center;justify-content:center;color:var(--velt-white);box-sizing:border-box;gap:var(--velt-spacing-md)}.velt-composer--invalid-selected-file[_ngcontent-%COMP%] .velt-composer--error-message[_ngcontent-%COMP%] .velt-composer--error-message-icon[_ngcontent-%COMP%]{height:24px;color:var(--velt-white)}.velt-composer--invalid-selected-file[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;background:color-mix(in srgb,var(--velt-surface-0) 32%,transparent);align-items:center;justify-content:center;display:none}.velt-composer--invalid-selected-file[_ngcontent-%COMP%]:hover .velt-composer--selected-file-actions[_ngcontent-%COMP%], .velt-composer--invalid-selected-file.loading[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{display:flex}.velt-composer--invalid-selected-file[_ngcontent-%COMP%]:hover .velt-composer--error-message[_ngcontent-%COMP%]{display:none}"],changeDetection:0});let i=o;return i})();var Mge=i=>({componentConfigSignal:i}),gKe=(i,o)=>({condition:i,data:o}),uKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function hKe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),P(2,"translate"),w(3,"app-comment-dialog-composer-attachments-invalid-item",5),b()),i&2){let n=o.$implicit,e=o.index,t=l(4);x("aria-label",M(1,6,"Invalid file")+" "+M(2,8,(n==null||n.file==null?null:n.file.name)||"unknown"))("data-testid",t.componentId+"-invalid-file-"+e),m(3),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("itemWireframe",t.itemTemplate)}}function fKe(i,o){if(i&1&&(v(0),u(1,hKe,4,10,"div",3),C()),i&2){let n=l(2).ngIf;m(),d("ngForOf",n==null?null:n.invalidSelectedFiles)}}function vKe(i,o){if(i&1&&(v(0),u(1,fKe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,uKe,e.template,A(1,Mge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function CKe(i,o){if(i&1&&(v(0),u(1,vKe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,gKe,n.conditionSignal(),A(1,Mge,n.componentConfigSignal)))}}var q2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(super.ngOnInit(),this.setupA11yAttributes(),!this.itemTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-invalid-item-wireframe");qe(e)||(this.itemTemplate=e)}}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","list"),e.setAttribute("aria-label","List of invalid files")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","listitem",4,"ngFor","ngForOf"],["role","listitem"],[3,"componentConfigSignal","file","fileIndex","itemWireframe"]],template:function(t,r){t&1&&u(0,CKe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-sm)}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var _Ke=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),yKe=(i,o)=>({condition:i,data:o}),SKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),bKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function IKe(i,o){i&1&&(v(0),le(),_(1,"svg",5),w(2,"path",6),b(),C())}function EKe(i,o){if(i&1){let n=Y();_(0,"button",3),P(1,"translate"),P(2,"translate"),W("click",function(){F(n);let t=l(2).ngIf,r=l();return L(r.isEditMode?t==null?null:t.removeAttachmentFromComment(r.fileIndex):t==null?null:t.removeFile(r.fileIndex))}),u(3,IKe,3,0,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-button")("aria-label",M(1,3,"Delete file")+" "+M(2,5,(e.file==null||e.file.file==null?null:e.file.file.name)||"unknown")),m(3),d("veltDynamicTemplate",$(12,bKe,e.template,dt(7,SKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function xKe(i,o){if(i&1&&(v(0),u(1,EKe,4,18,"button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n!=null&&n.uploadingAttachments))}}function TKe(i,o){if(i&1&&(v(0),u(1,xKe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,yKe,n.conditionSignal(),dt(1,_Ke,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var Y2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-delete"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-composer--attachment-icon-btn",3,"click",4,"ngIf"],[1,"velt-composer--attachment-icon-btn",3,"click"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg","width","18","height","19","viewBox","0 0 18 19","fill","none","aria-hidden","true","role","img"],["d","M13.5 5L4.5 14M4.5 5L13.5 14","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,TKe,2,9,"ng-container",0),t&2&&d("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}.velt-composer--attachment-icon-btn[_ngcontent-%COMP%]{display:flex;background:transparent;border:0;padding:var(--velt-spacing-sm);cursor:pointer;color:var(--velt-error)}"],changeDetection:0});let i=o;return i})();var DKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),wKe=(i,o)=>({condition:i,data:o}),OKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),AKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PKe(i,o){if(i&1&&(v(0),_(1,"div",3),w(2,"velt-file-icon-internal",4),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId),m(),d("type",n.isEditMode?n.file==null?null:n.file.mimeType:n.file==null?null:n.file.fileType),x("data-testid",n.componentId+"-file-icon-internal")}}function MKe(i,o){if(i&1&&(v(0),u(1,PKe,3,3,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,AKe,e.template,dt(1,OKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kKe(i,o){if(i&1&&(v(0),u(1,MKe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,wKe,n.conditionSignal(),dt(1,DKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var K2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-icon",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-icon"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--attachment-icon"],[3,"type"]],template:function(t,r){t&1&&u(0,kKe,2,9,"ng-container",0),t&2&&d("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}.velt-composer--attachment-icon[_ngcontent-%COMP%]{display:flex;color:var(--velt-accent)}"],changeDetection:0});let i=o;return i})();var RKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),NKe=(i,o)=>({condition:i,data:o}),FKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),LKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-loading-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function BKe(i,o){if(i&1&&(v(0),le(),_(1,"svg",3)(2,"circle",4),w(3,"animateTransform",5),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-svg")}}function VKe(i,o){if(i&1&&(v(0),u(1,BKe,4,1,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,LKe,e.template,dt(1,FKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function UKe(i,o){if(i&1&&(v(0),u(1,VKe,2,12,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",!e.isEditMode&&(n==null?null:n.uploadingAttachments)&&!(e.file!=null&&e.file.uploaded))}}function jKe(i,o){if(i&1&&(v(0),u(1,UKe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,NKe,n.conditionSignal(),dt(1,RKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var Z2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-loading",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherLoadingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherLoadingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherLoadingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-loading"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink","width","32px","height","32px","viewBox","0 0 100 100","preserveAspectRatio","xMidYMid","aria-hidden","true","role","img",2,"margin","auto","display","block"],["cx","50","cy","50","fill","none","stroke","currentColor","stroke-width","7","r","34","stroke-dasharray","160.22122533307947 55.40707511102649"],["attributeName","transform","type","rotate","repeatCount","indefinite","dur","1s","values","0 50 50;360 50 50","keyTimes","0;1"]],template:function(t,r){t&1&&u(0,jKe,2,9,"ng-container",0),t&2&&d("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}svg[_ngcontent-%COMP%]{color:var(--velt-accent)}"],changeDetection:0});let i=o;return i})();var $Ke=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),HKe=(i,o)=>({condition:i,data:o}),zKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),GKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function WKe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),te(3),P(4,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",n.isEditMode?n.file==null?null:n.file.name:M(2,3,n.file==null||n.file.file==null?null:n.file.file.name)),m(2),_e(" ",n.isEditMode?n.file==null?null:n.file.name:M(4,5,n.file==null||n.file.file==null?null:n.file.file.name)," ")}}function qKe(i,o){if(i&1&&(v(0),u(1,WKe,5,7,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,GKe,e.template,dt(1,zKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function YKe(i,o){if(i&1&&(v(0),u(1,qKe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,HKe,n.conditionSignal(),dt(1,$Ke,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var X2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-name",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-name"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--attachment-name"]],template:function(t,r){t&1&&u(0,YKe,2,9,"ng-container",0),t&2&&d("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%]{line-height:normal}.velt-composer--attachment-name[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-3);text-overflow:ellipsis;font-size:var(--velt-font-size-xs);font-style:normal;font-weight:600;line-height:normal;white-space:nowrap}"],changeDetection:0});let i=o;return i})();var KKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),ZKe=(i,o)=>({condition:i,data:o}),XKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),QKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-size-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JKe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"fileSize"),te(3),P(4,"fileSize"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",n.isEditMode?n.file==null?null:n.file.size:M(2,3,n.file==null||n.file.file==null?null:n.file.file.size)),m(2),_e(" ",n.isEditMode?n.file==null?null:n.file.size:M(4,5,n.file==null||n.file.file==null?null:n.file.file.size)," ")}}function eZe(i,o){if(i&1&&(v(0),u(1,JKe,5,7,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,QKe,e.template,dt(1,XKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tZe(i,o){if(i&1&&(v(0),u(1,eZe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,ZKe,n.conditionSignal(),dt(1,KKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var Q2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-size",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherSizeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherSizeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherSizeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-size"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--attachment-size"]],template:function(t,r){t&1&&u(0,tZe,2,9,"ng-container",0),t&2&&d("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%]{line-height:normal}.velt-composer--attachment-size[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-7);text-overflow:ellipsis;font-size:var(--velt-font-size-2xs);font-style:normal;font-weight:500;line-height:normal}"],changeDetection:0});let i=o;return i})();var nZe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),iZe=(i,o)=>({condition:i,data:o}),oZe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),rZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function aZe(i,o){if(i&1&&(v(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),w(4,"app-comment-dialog-composer-attachments-other-icon",4),P(5,"translate"),P(6,"translate"),_(7,"div",5),P(8,"translate"),P(9,"translate"),w(10,"app-comment-dialog-composer-attachments-other-name",6),P(11,"translate"),P(12,"translate"),w(13,"app-comment-dialog-composer-attachments-other-size",6),P(14,"translate"),P(15,"translate"),b(),w(16,"app-comment-dialog-composer-attachments-other-loading",7),P(17,"translate"),P(18,"translate"),_(19,"div",8),P(20,"translate"),P(21,"translate"),w(22,"app-comment-dialog-composer-attachments-other-delete",9),P(23,"translate"),P(24,"translate"),b()(),C()),i&2){let n=l(4);m(),x("aria-label",M(2,36,"File attachment:")+" "+M(3,38,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment"),m(3),d("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(5,40,"File type icon for")+" "+M(6,42,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-icon"),m(3),x("aria-label",M(8,44,"Details for file:")+" "+M(9,46,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-details"),m(3),d("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(11,48,"Filename:")+" "+M(12,50,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-name"),m(3),d("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(14,52,"File size:")+" "+M(15,54,(n.file==null?null:n.file.size)||"unknown size"))("data-testid",n.componentId+"-attachment-size"),m(3),d("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(17,56,"Uploading file:")+" "+M(18,58,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-loading"),m(3),x("aria-label",M(20,60,"Actions for file:")+" "+M(21,62,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-actions"),m(3),d("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(23,64,"Remove file:")+" "+M(24,66,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-delete-attachment")}}function sZe(i,o){if(i&1&&(v(0),u(1,aZe,25,68,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,rZe,e.template,dt(1,oZe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function lZe(i,o){if(i&1&&(v(0),u(1,sZe,2,12,"ng-container",0),C()),i&2){let n=l(2);m(),d("ngIf",n.isEditMode?!(!(n.file==null||n.file.mimeType==null)&&n.file.mimeType.includes("image")):!(!(n.file==null||n.file.fileType==null)&&n.file.fileType.includes("image")))}}function cZe(i,o){if(i&1&&(v(0),u(1,lZe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,iZe,n.conditionSignal(),dt(1,nZe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var J2=(()=>{let o=class o extends H{set _otherWireframe(e){this.otherWireframe=e,this.otherWireframe?this.template=this.domService.deepCloneElement(this.otherWireframe):this.template=null}constructor(e,t,r,a){super(t,a,r),this.domService=e,this.elementRef=t,this.loggingService=r,this.dynamicDataService=a,this.componentId="velt-comment-dialog-composer-attachments-other",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","File attachment controls")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Le),h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode",_otherWireframe:[0,"otherWireframe","_otherWireframe"]},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--other-attachment"],["role","img",3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","group",1,"velt-composer--attachment-details"],[3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","status","aria-live","polite",3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","group",1,"velt-composer--attachment-actions"],["role","button","tabindex","0",3,"componentConfigSignal","file","fileIndex","isEditMode"]],template:function(t,r){t&1&&u(0,cZe,2,9,"ng-container",0),t&2&&d("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%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-composer--other-attachment[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm) var(--velt-spacing-xs) var(--velt-spacing-sm) var(--velt-spacing-md);justify-content:space-between;gap:var(--velt-spacing-sm);align-items:center;align-self:stretch;width:100%;border-radius:var(--velt-border-radius-sm);border:1px solid var(--velt-border-4);box-sizing:border-box}.velt-composer--other-attachment[_ngcontent-%COMP%] .velt-composer--attachment-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-xs);flex:1;overflow:hidden}.velt-composer--other-attachment[_ngcontent-%COMP%] .velt-composer--attachment-actions[_ngcontent-%COMP%]{display:flex;width:0;overflow:hidden}.velt-composer--other-attachment[_ngcontent-%COMP%]:not(:last-child){margin-bottom:var(--velt-spacing-lg)}.velt-composer--other-attachment[_ngcontent-%COMP%]:hover .velt-composer--attachment-actions[_ngcontent-%COMP%]{width:auto}"],changeDetection:0});let i=o;return i})();var kge=i=>({componentConfigSignal:i}),dZe=(i,o)=>({condition:i,data:o}),mZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-selected-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function pZe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-composer-attachments-other",7)(2,"app-comment-dialog-composer-attachments-image",8),C()),i&2){let n=o.$implicit,e=o.index,t=l(5);m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!0)("otherWireframe",t.otherTemplate),m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!0)("imageWireframe",t.imageTemplate)}}function gZe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-composer-attachments-other",7)(2,"app-comment-dialog-composer-attachments-image",8),C()),i&2){let n=o.$implicit,e=o.index,t=l(5);m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!1)("otherWireframe",t.otherTemplate),m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!1)("imageWireframe",t.imageTemplate)}}function uZe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),P(2,"translate"),u(3,pZe,3,10,"ng-container",5)(4,gZe,3,10,"ng-container",6),b()),i&2){let n=l(3).ngIf,e=l();x("aria-label",M(1,5,"Attached files")+" - "+(((n==null||n.editComment==null||n.editComment.attachments==null?null:n.editComment.attachments.length)||0)+((n==null||n.selectedFiles==null?null:n.selectedFiles.length)||0))+" "+M(2,7,"total attachments"))("data-testid",e.componentId+"-attachments-list"),m(3),d("ngForOf",n==null||n.editComment==null?null:n.editComment.attachments)("ngForTrackBy",n==null?null:n.trackByAttachmentId),m(),d("ngForOf",n==null?null:n.selectedFiles)}}function hZe(i,o){if(i&1&&(v(0),u(1,uZe,5,9,"div",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null||n.editComment==null||n.editComment.attachments==null?null:n.editComment.attachments.length)||(n==null||n.selectedFiles==null?null:n.selectedFiles.length))}}function fZe(i,o){if(i&1&&(v(0),u(1,hZe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,mZe,e.template,A(1,kge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vZe(i,o){if(i&1&&(v(0),u(1,fZe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,dZe,n.conditionSignal(),A(1,kge,n.componentConfigSignal)))}}var eE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-composer-attachments-selected",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(super.ngOnInit(),this.setupA11yAttributes(),!this.imageTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-image-wireframe");qe(e)||(this.imageTemplate=e)}if(!this.otherTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-other-wireframe");qe(e)||(this.otherTemplate=e)}}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsSelectedComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","list"),e.setAttribute("aria-label","List of selected attachments")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsSelectedComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-selected"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-comment-dialog-composer-attachments--selected","role","list",4,"ngIf"],["role","list",1,"velt-comment-dialog-composer-attachments--selected"],[4,"ngFor","ngForOf","ngForTrackBy"],[4,"ngFor","ngForOf"],[3,"componentConfigSignal","file","fileIndex","isEditMode","otherWireframe"],[3,"componentConfigSignal","file","fileIndex","isEditMode","imageWireframe"]],template:function(t,r){t&1&&u(0,vZe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-comment-dialog-composer-attachments--selected[_ngcontent-%COMP%]{width:100%;display:flex;flex-wrap:wrap;gap:var(--velt-spacing-sm);flex-direction:row;padding:var(--velt-spacing-xs);box-sizing:border-box}"],changeDetection:0});let i=o;return i})();var Rge=i=>({componentConfigSignal:i}),CZe=(i,o)=>({condition:i,data:o}),_Ze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function yZe(i,o){if(i&1&&(v(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),P(4,"translate"),w(5,"app-comment-dialog-composer-attachments-selected",4)(6,"app-comment-dialog-composer-attachments-invalid",4),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),x("aria-label",M(2,4,"File attachments")+" - "+((n==null||n.selectedFiles==null?null:n.selectedFiles.length)||0)+" "+M(3,6,"valid")+", "+((n==null||n.invalidSelectedFiles==null?null:n.invalidSelectedFiles.length)||0)+" "+M(4,8,"invalid files"))("data-testid",e.componentId),m(4),d("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal)}}function SZe(i,o){if(i&1&&(v(0),u(1,yZe,7,10,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,_Ze,e.template,A(1,Rge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function bZe(i,o){if(i&1&&(v(0),u(1,SZe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.editComment)||(n==null||n.selectedFiles==null?null:n.selectedFiles.length)||(n==null||n.invalidSelectedFiles==null?null:n.invalidSelectedFiles.length))}}function IZe(i,o){if(i&1&&(v(0),u(1,bZe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,CZe,n.conditionSignal(),A(1,Rge,n.componentConfigSignal)))}}var tE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-composer-attachments",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Attachments section")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--attachments"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,IZe,2,6,"ng-container",0),t&2&&d("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%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-composer--attachments[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;width:100%;gap:var(--velt-spacing-sm);flex-direction:row}"],changeDetection:0});let i=o;return i})();var EZe=["newCommentTextArea"],xZe=["editCommentTextArea"],TZe=["userSelector"],Nge=i=>({componentConfigSignal:i}),DZe=(i,o)=>({condition:i,data:o}),wZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-input-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function OZe(i,o){if(i&1){let n=Y();_(0,"velt-autocomplete-panel-internal",11,1),W("userContactOptionSelected",function(t){F(n),l();let r=me(4),a=l(3).ngIf;return L(a==null?null:a.userContactSelected(t,r))})("customOptionSelected",function(t){F(n),l();let r=me(4),a=l(3).ngIf;return L(a==null?null:a.autocompleteItemSelected(t,r))})("groupOptionSelected",function(t){F(n),l();let r=me(4),a=l(3).ngIf;return L(a==null?null:a.groupSelected(t,r))})("atHereSelected",function(t){F(n),l();let r=me(4),a=l(3).ngIf;return L(a==null?null:a.atHereSelected(t,r))})("enterPressed",function(){F(n);let t=l(5);return L(t.onEnterPressInAutocompletePanel())})("autocompleteStateChanged",function(t){F(n);let r=l(5);return L(r.onAutocompleteStateChanged(t))}),b()}if(i&2){l();let n=me(5),e=l(3).ngIf;d("darkMode",!!(e!=null&&e.darkMode))("hideInput",!0)("showAtHere",!0)("metadata",e==null||e.annotation==null?null:e.annotation.metadata)("autocompletePanelTrigger",n)("type","generic")("autocompletePanelPosition",e!=null&&e.bottomSheetMode?"above":"auto")}}function AZe(i,o){if(i&1){let n=Y();_(0,"div",7),P(1,"translate"),W("click",function(t){F(n);let r=l(3).ngIf;return r==null||r.onComposerClick(),L(t.stopPropagation())}),_(2,"div",8)(3,"div",9,0),P(6,"translate"),W("afterViewInit",function(){F(n);let t=l(4);return L(t.setNewCommentTextArea())})("input",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.onCommentInput(t))})("paste",function(t){F(n);let r=l(3).ngIf;return r==null||r.onPaste(t),L(t.preventDefault())})("keypress",function(t){F(n);let r=l(4);return L(r.onKeyPress(t))})("keyup",function(t){F(n);let r=l(3).ngIf,a=l();return r==null||r.onEscapeKeyPressed(t),L(a.onKeyUp(t))})("keydown",function(t){F(n);let r=l(4);return r.onKeyPressedAddComment(t),L(r.onKeyDown(t))})("keydown.escape",function(t){F(n);let r=l(4);return L(r.onEscapeKeyPressed(t,r.userSelector))})("keydown.backspace",function(){F(n);let t=me(4),r=l(3).ngIf;return L(!(t!=null&&t.innerText)&&(r!=null&&r.deleteOnBackspace)?r==null?null:r.deleteCommentPinAnnotations("keydownBackspace"):null)})("keydown.delete",function(){F(n);let t=me(4),r=l(3).ngIf;return L(t!=null&&t.innerText||r==null?null:r.deleteCommentPinAnnotations("keydownDelete"))})("copy",function(t){return F(n),L(t.stopPropagation())})("dragover",function(t){return F(n),L(t.preventDefault())})("dragenter",function(t){return F(n),L(t.preventDefault())})("drop",function(t){F(n);let r=l(3).ngIf;return r==null||r.onDrop(t),L(t.preventDefault())})("click",function(){F(n);let t=l(4);return L(t.onCombinedClick())}),b()(),u(7,OZe,2,7,"velt-autocomplete-panel-internal",10),b()}if(i&2){let n=l(3).ngIf,e=l();x("aria-label",M(1,6,"New comment composer"))("data-testid",e.componentId+"-section"),m(3),d("matAutocompleteDisabled",!(n!=null&&n.userMentions)),x("data-testid",e.componentId+"-new-textarea")("placeholder",M(6,8,e.newCommentPlaceholder)),m(4),d("ngIf",n==null?null:n.userMentions)}}function PZe(i,o){if(i&1){let n=Y();_(0,"velt-autocomplete-panel-internal",11,1),W("userContactOptionSelected",function(t){F(n),l();let r=me(4),a=l(4).ngIf;return L(a==null?null:a.userContactSelected(t,r))})("customOptionSelected",function(t){F(n),l();let r=me(4),a=l(4).ngIf;return L(a==null?null:a.autocompleteItemSelected(t,r))})("groupOptionSelected",function(t){F(n),l();let r=me(4),a=l(4).ngIf;return L(a==null?null:a.groupSelected(t,r))})("atHereSelected",function(t){F(n),l();let r=me(4),a=l(4).ngIf;return L(a==null?null:a.atHereSelected(t,r))})("enterPressed",function(){F(n);let t=l(6);return L(t.onEnterPressInAutocompletePanel())})("autocompleteStateChanged",function(t){F(n);let r=l(6);return L(r.onAutocompleteStateChanged(t))}),b()}if(i&2){l();let n=me(5),e=l(4).ngIf;d("darkMode",!!(e!=null&&e.darkMode))("hideInput",!0)("showAtHere",!0)("metadata",e==null||e.annotation==null?null:e.annotation.metadata)("autocompletePanelTrigger",n)("type","generic")("autocompletePanelPosition",e!=null&&e.bottomSheetMode?"above":"auto")}}function MZe(i,o){if(i&1){let n=Y();_(0,"div",7),P(1,"translate"),W("click",function(t){return F(n),L(t.stopPropagation())}),_(2,"div",8)(3,"div",12,2),P(6,"translate"),W("afterViewInit",function(){F(n);let t=l(5);return L(t.setEditCommentTextArea())})("input",function(t){F(n);let r=l(4).ngIf;return L(r==null?null:r.onCommentInput(t))})("paste",function(t){F(n);let r=l(4).ngIf;return r==null||r.onPaste(t),L(t.preventDefault())})("keydown",function(t){F(n);let r=me(4),a=l(5);return a.onKeyPressedUpdateComment(t,a.i,r.innerText),L(a.onKeyDown(t))})("keypress",function(t){F(n);let r=l(5);return L(r.onKeyPress(t))})("keyup",function(t){F(n);let r=l(5);return L(r.onKeyUp(t))})("keydown.backspace",function(){F(n);let t=me(4),r=l(4).ngIf;return L(!(t!=null&&t.innerText)&&(r!=null&&r.deleteOnBackspace)?r==null?null:r.deleteCommentPinAnnotations("keydownBackspace"):null)})("keydown.delete",function(){F(n);let t=me(4),r=l(4).ngIf;return L(t!=null&&t.innerText||r==null?null:r.deleteCommentPinAnnotations("keydownEscape"))})("keydown.escape",function(t){F(n);let r=l(4).ngIf,a=l();return L(a.onEscapeKeyPressed(t,a.userSelector)||(r==null?null:r.cancelUpdate()))})("copy",function(t){return F(n),L(t.stopPropagation())})("dragover",function(t){return F(n),L(t.preventDefault())})("dragenter",function(t){return F(n),L(t.preventDefault())})("drop",function(t){F(n);let r=l(4).ngIf;return r==null||r.onDrop(t),L(t.preventDefault())})("click",function(){F(n);let t=l(5);return L(t.onInputClick())}),b(),u(7,PZe,2,7,"velt-autocomplete-panel-internal",10),b()()}if(i&2){let n=l(4).ngIf,e=l();x("aria-label",M(1,6,"Edit comment composer"))("data-testid",e.componentId+"-edit-section"),m(3),d("matAutocompleteDisabled",!(n!=null&&n.userMentions)),x("data-testid",e.componentId+"-edit-textarea")("placeholder",M(6,8,e.editCommentPlaceholder)),m(4),d("ngIf",n==null?null:n.userMentions)}}function kZe(i,o){if(i&1&&(v(0),u(1,MZe,8,10,"div",6),C()),i&2){let n=l(3).ngIf;m(),d("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId)))}}function RZe(i,o){if(i&1&&(v(0),u(1,AZe,8,10,"div",6)(2,kZe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("ngIf",!e.editMode&&!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))),m(),d("ngIf",e.editMode&&e.commentObj)}}function NZe(i,o){if(i&1&&(v(0),u(1,RZe,3,2,"ng-container",5),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,wZe,e.template,A(1,Nge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function FZe(i,o){if(i&1&&(v(0),u(1,NZe,2,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,DZe,n.conditionSignal(),A(1,Nge,n.componentConfigSignal)))}}var nE=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.renderer=t,this.elementRef=r,this.dynamicDataService=a,this.editMode=!1,this.allowKeydown=!0,this.newCommentPlaceholder="",this.editCommentPlaceholder="",this.componentId="velt-comment-dialog-composer-input",super.initializeComponentConfigSignal(new ke),io(()=>{this.componentConfigSignal()&&this.calculatePlaceholders()})}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.calculatePlaceholders()}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent setupA11yAttributes:",e)}}calculatePlaceholders(){try{let e=this.componentConfigSignal();this.placeholder?(this.newCommentPlaceholder=this.placeholder,this.editCommentPlaceholder=this.placeholder):(e?.userMentions?e?.annotation?.comments?.length===0?(this.newCommentPlaceholder="Comment or add others with @",this.editCommentPlaceholder="Edit your comment..."):(this.newCommentPlaceholder="Reply or add others with @",this.editCommentPlaceholder="Edit your reply..."):e?.annotation?.comments?.length===0?(this.newCommentPlaceholder="Write a comment...",this.editCommentPlaceholder="Edit your comment..."):(this.newCommentPlaceholder="Write a reply...",this.editCommentPlaceholder="Edit your reply..."),(this.commentplaceholder||e?.commentplaceholder)&&e?.annotation?.comments?.length===0&&(this.newCommentPlaceholder=this.commentplaceholder||e?.commentplaceholder||this.newCommentPlaceholder,this.editCommentPlaceholder=this.commentplaceholder||e?.commentplaceholder||this.editCommentPlaceholder),(this.replyplaceholder||e?.replyplaceholder)&&e?.annotation?.comments?.length>0&&(this.newCommentPlaceholder=this.replyplaceholder||e?.replyplaceholder||this.newCommentPlaceholder,this.editCommentPlaceholder=this.replyplaceholder||e?.replyplaceholder||this.editCommentPlaceholder))}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent calculatePlaceholders:",e)}}ngAfterViewInit(){try{this.setNewCommentTextArea(),this.setEditCommentTextArea()}catch(e){this.catchError("Error in CommentDialogComposerInputComponent ngAfterViewInit: ",e)}}setNewCommentTextArea(){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: setNewCommentTextArea","color: green;"),setTimeout(()=>{this.componentConfigSignal()&&this.componentConfigSignal.update(e=>(e=T(E({},e),{newCommentTextArea:this.newCommentTextArea}),e))})}catch(e){this.catchError("Error in CommentDialogComposerInputComponent setNewCommentTextArea: ",e)}}setEditCommentTextArea(){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: setEditCommentTextArea","color: green;"),setTimeout(()=>{this.componentConfigSignal()&&this.componentConfigSignal.update(e=>(e=T(E({},e),{editCommentTextArea:this.editCommentTextArea}),e))})}catch(e){this.catchError("Error in CommentDialogComposerInputComponent setEditCommentTextArea: ",e)}}onKeyPressedAddComment(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyPressedAddComment","color: green;"),this.allowKeydown?this.componentConfigSignal()?.onKeyPressedAddComment(e):this.allowKeydown=!0}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyPressedAddComment: ",t)}}onKeyPressedUpdateComment(e,t,r){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyPressedUpdateComment","color: green;"),this.allowKeydown?this.componentConfigSignal()?.onKeyPressedUpdateComment(e,t,r):this.allowKeydown=!0}catch(a){this.catchError("Error in CommentDialogComposerInputComponent onKeyPressedUpdateComment: ",a)}}onEnterPressInAutocompletePanel(){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onEnterPressInAutocompletePanel","color: green;"),this.componentConfigSignal()?.enterKeyToSubmit&&(this.allowKeydown=!1)}catch(e){this.catchError("Error in CommentDialogComposerInputComponent onEnterPressInAutocompletePanel: ",e)}}onEscapeKeyPressed(e,t){try{if(this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onEscapeKeyPressed","color: green;"),t?.trigger?.panelOpen||t?.matAutocompleteTrigger?.panelOpen){t.closePanel();let s=e.target;if(s&&s.hasAttribute("contenteditable")){let c=["@","#","$"];if(W0(s,c)){let g=window.getSelection();if(g&&g.rangeCount>0){let f=g.getRangeAt(0),I=f.startOffset,D=f.commonAncestorContainer?.textContent||"",N=-1;for(let G of c){let z=D.lastIndexOf(G,I);z>N&&(N=z)}N!==-1&&t.disableAutocompleteAtPosition(N)}}}return!0}return!1}catch(r){return this.catchError("Error in CommentDialogComposerInputComponent onEscapeKeyPressed: ",r),!1}}onInputClick(){this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onInputClick","color: green;");try{this.componentConfigSignal.update(e=>(e=T(E({},e),{composerInOpenState:!0}),e)),this.componentConfigSignal()?.composerInOpenState&&setTimeout(()=>{this.componentConfigSignal().updateOverlayPositionEmit()},300)}catch(e){this.catchError("Error in CommentDialogComposerInputComponent onInputClick: ",e)}}onCombinedClick(){this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onCombinedClick","color: green;");try{this.componentConfigSignal()&&this.componentConfigSignal.update(e=>(e=T(E({},e),{showCommentButtons:!0}),e)),this.onInputClick()}catch(e){this.catchError("Error in CommentDialogComposerInputComponent onCombinedClick: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}onFocus(e){this.newCommentTextArea&&this.newCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(E({},t),{isInputFocused:!0}),t)),this.editCommentTextArea&&this.editCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(E({},t),{isInputFocused:!0}),t))}onBlur(e){this.newCommentTextArea&&this.newCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(E({},t),{isInputFocused:!1}),t)),this.editCommentTextArea&&this.editCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(E({},t),{isInputFocused:!1}),t))}onAutocompleteStateChanged(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onAutocompleteStateChanged","color: green;"),this.componentConfigSignal.update(t=>(t=T(E({},t),{isAutocompleteDropdownOpen:e}),t))}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onAutocompleteStateChanged: ",t)}}onKeyUp(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyUp","color: green;"),e.code!=="Escape"&&e.stopPropagation()}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyUp: ",t)}}onKeyDown(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyDown","color: green;"),e.code!=="Escape"&&e.stopPropagation()}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyDown: ",t)}}onKeyPress(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyPress","color: green;"),e.code!=="Escape"&&e.stopPropagation()}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyPress: ",t)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Hi),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-input"]],viewQuery:function(t,r){if(t&1&&(it(EZe,5),it(xZe,5),it(TZe,5)),t&2){let a;Xe(a=Qe())&&(r.newCommentTextArea=a.first),Xe(a=Qe())&&(r.editCommentTextArea=a.first),Xe(a=Qe())&&(r.userSelector=a.first)}},hostBindings:function(t,r){t&1&&W("focusin",function(s){return r.onFocus(s)})("focusout",function(s){return r.onBlur(s)})},inputs:{editMode:"editMode",commentObj:"commentObj",i:"i",placeholder:"placeholder",commentplaceholder:"commentplaceholder",replyplaceholder:"replyplaceholder"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["newCommentTextArea","","snippylyUserSelectorTrigger","snippylyUserSelectorTrigger"],["userSelector",""],["editCommentTextArea","","snippylyUserSelectorTrigger","snippylyUserSelectorTrigger"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-composer-input","role","region",3,"click",4,"ngIf"],["role","region",1,"velt-composer-input",3,"click"],[1,"velt-composer-input--container"],["role","textbox","contenteditable","","veltAfterViewInit","","veltAutocomplete","",1,"velt-composer-input--message",3,"afterViewInit","input","paste","keypress","keyup","keydown","keydown.escape","keydown.backspace","keydown.delete","copy","dragover","dragenter","drop","click","matAutocompleteDisabled"],[3,"darkMode","hideInput","showAtHere","metadata","autocompletePanelTrigger","type","autocompletePanelPosition","userContactOptionSelected","customOptionSelected","groupOptionSelected","atHereSelected","enterPressed","autocompleteStateChanged",4,"ngIf"],[3,"userContactOptionSelected","customOptionSelected","groupOptionSelected","atHereSelected","enterPressed","autocompleteStateChanged","darkMode","hideInput","showAtHere","metadata","autocompletePanelTrigger","type","autocompletePanelPosition"],["role","textbox","contenteditable","","veltAfterViewInit","","veltAutocomplete","",1,"velt-composer-input--message",3,"afterViewInit","input","paste","keydown","keypress","keyup","keydown.backspace","keydown.delete","keydown.escape","copy","dragover","dragenter","drop","click","matAutocompleteDisabled"]],template:function(t,r){t&1&&u(0,FZe,2,6,"ng-container",3),t&2&&d("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%]{width:100%;display:flex}[_nghost-%COMP%]:empty{display:none}.velt-composer-input[_ngcontent-%COMP%]{position:relative;overflow:auto;width:100%;max-height:10em}.velt-composer-input--container[_ngcontent-%COMP%]{width:100%;display:flex;gap:2rem}.velt-composer-input--container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{display:none}.velt-composer-input--message[_ngcontent-%COMP%]{resize:vertical;padding:var(--velt-spacing-sm);outline:0;border:0;color:var(--velt-text-3);width:100%;box-sizing:border-box}.velt-composer-input--message[_ngcontent-%COMP%]:empty:before{color:var(--velt-text-8);content:attr(placeholder);display:block;pointer-events:none}*[_ngcontent-%COMP%]{-ms-overflow-style:none;scrollbar-width:none}*[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}"],changeDetection:0});let i=o;return i})();var Fge=i=>({componentConfigSignal:i}),LZe=(i,o)=>({condition:i,data:o}),BZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-recordings-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function VZe(i,o){if(i&1){let n=Y();v(0),_(1,"snippyly-recorder-player-internal",5),P(2,"translate"),P(3,"translate"),W("onDelete",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.onDeleteRecorderAnnotation(t))}),b(),C()}if(i&2){let n=o.$implicit,e=l(3).ngIf,t=l();m(),d("isEditMode",!0)("showSummary",!!(e!=null&&e.recordingSummaryEnabled))("darkMode",!!(e!=null&&e.darkMode))("recorderId",n==null?null:n.id)("shadowDom",(e==null?null:e.dialogShadowDOM)!==!1)("playVideoInFullScreen",e==null?null:e.playVideoInFullScreen),x("aria-label",M(2,8,"Screen recording")+" "+M(3,10,(n==null?null:n.id)||"unnamed"))("data-testid",t.componentId+"-recorder-"+(n==null?null:n.id))}}function UZe(i,o){if(i&1){let n=Y();v(0),u(1,VZe,4,12,"ng-container",3),_(2,"snippyly-recorder-control-panel-internal",4),P(3,"translate"),W("onRecordedData",function(t){F(n);let r=l(2).ngIf;return L(r==null?null:r.onRecordedData(t))}),b(),C()}if(i&2){let n=l(2).ngIf,e=l();m(),d("ngForOf",n==null?null:n.localRecordedData)("ngForTrackBy",n==null?null:n.trackByRecorderId),m(),d("panelId",n==null?null:n.commentDialogUniqueId)("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(3,6,"Screen recording controls"))("data-testid",e.componentId+"-control-panel")}}function jZe(i,o){if(i&1&&(v(0),u(1,UZe,4,8,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,BZe,e.template,A(1,Fge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function $Ze(i,o){if(i&1&&(v(0),u(1,jZe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,LZe,n.conditionSignal(),A(1,Fge,n.componentConfigSignal)))}}var iE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-recordings",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerRecordingsComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerRecordingsComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recordings section")}catch(e){this.loggingService.catch("Error in CommentDialogComposerRecordingsComponent setupA11yAttributes: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-recordings"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngFor","ngForOf","ngForTrackBy"],["mode","thread","sourceFeature","comment","role","group",3,"onRecordedData","panelId","darkMode"],["mode","thread","sourceFeature","comment","role","group",3,"onDelete","isEditMode","showSummary","darkMode","recorderId","shadowDom","playVideoInFullScreen"]],template:function(t,r){t&1&&u(0,$Ze,2,6,"ng-container",0),t&2&&d("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%]{width:100%;display:flex;flex-direction:column;gap:var(--velt-spacing-lg)}[_nghost-%COMP%]:empty{display:none}snippyly-recorder-control-panel-internal[_ngcontent-%COMP%]{width:100%}snippyly-recorder-player-internal[_ngcontent-%COMP%]{width:100%}"],changeDetection:0});let i=o;return i})();var HZe=i=>({componentConfigSignal:i}),zZe=(i,o)=>({condition:i,data:o}),GZe=(i,o,n,e,t)=>({componentConfigSignal:i,editMode:o,commentObj:n,i:e,wireframe:t}),WZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function qZe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-composer-avatar",6),C()),i&2){let n=l(6);m(),d("componentConfigSignal",n.componentConfigSignal)}}function YZe(i,o){if(i&1&&w(0,"app-comment-dialog-composer-action-button",13),i&2){let n=l(7);d("type","submit")("componentConfigSignal",n.componentConfigSignal)("editMode",n.editMode)("commentObj",n.commentObj)("i",n.i)}}function KZe(i,o){if(i&1&&(_(0,"div",10),w(1,"app-comment-dialog-composer-input",11),u(2,YZe,1,5,"app-comment-dialog-composer-action-button",12),b()),i&2){let n=l(5).ngIf,e=l();m(),d("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i),m(),d("ngIf",n.composerMode==="default"&&!n.composerInOpenState)}}function ZZe(i,o){i&1&&w(0,"div",18)}function XZe(i,o){if(i&1&&(v(0),u(1,ZZe,1,0,"div",14),_(2,"div",15),w(3,"app-comment-dialog-composer-action-button",13)(4,"app-comment-dialog-composer-action-button",16)(5,"app-comment-dialog-composer-action-button",16)(6,"app-comment-dialog-composer-action-button",16)(7,"app-comment-dialog-composer-action-button",16)(8,"div",17)(9,"app-comment-dialog-composer-action-button",13),b(),C()),i&2){let n=l(5).ngIf,e=l();m(),d("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId)&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.type)==="screen")),m(2),d("type","autocomplete")("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i),m(),d("type","attachments")("componentConfigSignal",e.componentConfigSignal),m(),d("type","audio")("componentConfigSignal",e.componentConfigSignal),m(),d("type","video")("componentConfigSignal",e.componentConfigSignal),m(),d("type","screen")("componentConfigSignal",e.componentConfigSignal),m(2),d("type","submit")("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i)}}function QZe(i,o){if(i&1&&(v(0),_(1,"div"),u(2,qZe,2,1,"ng-container",0),_(3,"div",5),w(4,"app-comment-dialog-composer-private-badge",6)(5,"app-comment-dialog-composer-attachments",7)(6,"app-comment-dialog-composer-recordings",6)(7,"app-comment-dialog-custom-annotation-dropdown",8),u(8,KZe,3,5,"div",9)(9,XZe,10,19,"ng-container",0),b()(),w(10,"app-comment-dialog-composer-assign-user",6),C()),i&2){let n=l(4).ngIf,e=l();m(),ue("velt-composer--inline-comment-section-mode",n.inlineCommentSectionMode)("velt-composer--multi-thread-mode",n.multiThread)("velt-composer--comment-composer-mode",n.commentComposerMode),m(),d("ngIf",n.inlineCommentSectionMode),m(2),d("componentConfigSignal",e.componentConfigSignal),m(),d("wireframe",e.wireframe)("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal),m(),d("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))),m(),d("ngIf",n.composerMode!=="default"||n.composerMode==="default"&&n.composerInOpenState),m(),d("componentConfigSignal",e.componentConfigSignal)}}function JZe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),P(2,"translate"),W("click",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.focusOnComposerInput())}),u(3,QZe,11,15,"ng-container",4),b()}if(i&2){let n=l(3).ngIf,e=l();ue("velt-comment-dialog-composer--no-comments",!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))("velt-comment-dialog-composer--inline",n.inlineCommentSectionMode)("velt-comment-dialog-composer--top",n.composerPosition==="top")("velt-comment-dialog-composer--recording",(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))("velt-composer-edit-mode",e.editMode)("velt-composer-open",n.composerInOpenState)("velt-composer-input-focused",n.isInputFocused),x("aria-label",e.editMode?M(1,17,"Edit comment section"):M(2,19,"Add new comment section"))("data-testid",e.componentId+"-section"),m(3),d("veltDynamicTemplate",$(27,WZe,e.template,$(21,GZe,e.componentConfigSignal,e.editMode,e.commentObj,e.i,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function eXe(i,o){if(i&1&&(v(0),u(1,JZe,4,33,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("ngIf",!(n!=null&&n.disabled)&&!!(n!=null&&n.editComment)===e.editMode&&(n==null?null:n.isKnownUser)&&(!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length)||(n==null?null:n.commentDialogSelected))&&!(n!=null&&n.isPlanExpired))}}function tXe(i,o){if(i&1&&(v(0),u(1,eXe,2,1,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length)||!(n!=null&&n.inlineCommentMode))}}function nXe(i,o){if(i&1&&(v(0),u(1,tXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,zZe,n.conditionSignal(),A(1,HZe,n.componentConfigSignal)))}}var bf=(()=>{let o=class o extends H{get composerWireframe(){return this._composerWireframe}set composerWireframe(e){this._composerWireframe=e,this.composerWireframe&&this.composerWireframe?.children?.length>0?this.template=this.domService.deepCloneElement(this.composerWireframe):this.template=null}onClick(e){try{e.stopPropagation(),e.preventDefault()}catch(t){this.loggingService.catch("Error in CommentDialogComposerComponent onClick:",t)}}constructor(e,t,r,a){super(r,a,t),this.domService=e,this.loggingService=t,this.elementRef=r,this.dynamicDataService=a,this.editMode=!1,this.componentId="velt-comment-dialog-composer",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Comment composer section")}catch(e){this.loggingService.catch("Error in CommentDialogComposerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Le),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer"]],hostBindings:function(t,r){t&1&&W("click",function(s){return r.onClick(s)})},inputs:{editMode:"editMode",commentObj:"commentObj",i:"i",composerWireframe:"composerWireframe"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-dialog-composer","role","region",3,"velt-comment-dialog-composer--no-comments","velt-comment-dialog-composer--inline","velt-comment-dialog-composer--top","velt-comment-dialog-composer--recording","velt-composer-edit-mode","velt-composer-open","velt-composer-input-focused","click",4,"ngIf"],["role","region",1,"velt-comment-dialog-composer",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-composer--reply-div","velt-composer--input-text-wrap"],[3,"componentConfigSignal"],[3,"wireframe","componentConfigSignal"],["type","composer",3,"componentConfigSignal"],["style","display: flex; width: 100%;",4,"ngIf"],[2,"display","flex","width","100%"],[3,"componentConfigSignal","editMode","commentObj","i"],[3,"type","componentConfigSignal","editMode","commentObj","i",4,"ngIf"],[3,"type","componentConfigSignal","editMode","commentObj","i"],["class","velt-composer--line-div",4,"ngIf"],[1,"velt-composer--actions-wrap"],[3,"type","componentConfigSignal"],[1,"velt-composer--flex-fill"],[1,"velt-composer--line-div"]],template:function(t,r){t&1&&u(0,nXe,2,6,"ng-container",0),t&2&&d("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%]{width:100%;display:flex}[_nghost-%COMP%]:empty{display:none}.velt-comment-dialog-composer[_ngcontent-%COMP%]{width:100%;box-sizing:border-box}.velt-composer--reply-div[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:100%;border-radius:var(--velt-border-radius-md);background-color:var(--velt-background-0);border:1px solid var(--velt-border-4);box-sizing:border-box;position:relative;padding:var(--velt-spacing-sm);transition:.5s}.velt-composer--inline-comment-section-mode[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-sm);width:100%}.velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] app-comment-dialog-composer-avatar[_ngcontent-%COMP%]{display:none}.velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] .velt-composer--input-text-wrap[_ngcontent-%COMP%]{border:0px;padding:0}.velt-comment-dialog-composer--no-comments[_ngcontent-%COMP%] .velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] app-comment-dialog-composer-avatar[_ngcontent-%COMP%]{margin-top:2px;display:block}[_nghost-%COMP%] .velt-comment-dialog-composer--inline .velt-dropdown-container{padding:var(--velt-spacing-md) 0px}.velt-composer--line-div[_ngcontent-%COMP%]{border-top:1px solid var(--velt-border-4);width:100%}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty){overflow:hidden;text-align:center;color:var(--velt-text-10);cursor:pointer;border-top:0}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):before, .velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):after{background-color:var(--velt-background-4);content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):before{right:.5em;margin-left:calc(var(--velt-border-radius-full) * -1)}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):after{left:.5em;margin-left:calc(var(--velt-border-radius-full) * -1)}.velt-composer--actions-wrap[_ngcontent-%COMP%]{position:relative;width:100%;margin-top:var(--velt-spacing-sm);display:flex;flex-direction:line;align-items:center;justify-content:flex-start;gap:var(--velt-spacing-xs)}.velt-composer--flex-fill[_ngcontent-%COMP%]{flex:1}.velt-composer-open[_ngcontent-%COMP%]{max-height:280px;overflow:auto}*[_ngcontent-%COMP%]{-ms-overflow-style:none;scrollbar-width:none}*[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}.velt-comment-dialog-composer--top[_ngcontent-%COMP%] .velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] .velt-composer--input-text-wrap[_ngcontent-%COMP%]{border-bottom:1px solid var(--velt-border-4);padding-bottom:var(--velt-spacing-md);border-radius:0}.velt-comment-dialog-composer--top[_ngcontent-%COMP%] .velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] .velt-composer--input-text-wrap[_ngcontent-%COMP%] .velt-composer--line-div[_ngcontent-%COMP%]{display:none}'],changeDetection:0});let i=o;return i})();var Lge=i=>({componentConfigSignal:i}),oXe=(i,o)=>({condition:i,data:o}),rXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-ghost-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function aXe(i,o){if(i&1&&(v(0),le(),_(1,"svg",5),w(2,"path",6)(3,"path",7),b(),ut(),_(4,"span",8),te(5),P(6,"translate"),b(),C()),i&2){let n=l(3).ngIf,e=l();m(4),x("data-testid",e.componentId+"-message"),m(),_e(" ",M(6,2,n==null||n.ghostComment==null?null:n.ghostComment.message))}}function sXe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),u(2,aXe,7,4,"ng-container",4),b()),i&2){let n=l(2).ngIf,e=l();x("aria-label",M(1,3,"Ghost comment notification"))("data-testid",e.componentId),m(2),d("veltDynamicTemplate",$(7,rXe,e.template,A(5,Lge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function lXe(i,o){if(i&1&&(v(0),u(1,sXe,3,13,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.showGhostCommentMessage)&&!(n!=null&&n.inlineCommentMode)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))}}function cXe(i,o){if(i&1&&(v(0),u(1,lXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,oXe,n.conditionSignal(),A(1,Lge,n.componentConfigSignal)))}}var d_=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-ghost-banner",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogGhostBannerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogGhostBannerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Ghost comment banner")}catch(e){this.loggingService.catch("Error in CommentDialogGhostBannerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-ghost-banner"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-ghost-banner","role","region",4,"ngIf"],["role","region",1,"velt-ghost-banner"],[4,"veltDynamicTemplate"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.00065 13.3333C10.9462 13.3333 13.334 10.9455 13.334 7.99998C13.334 5.05446 10.9462 2.66665 8.00065 2.66665C5.05513 2.66665 2.66732 5.05446 2.66732 7.99998C2.66732 10.9455 5.05513 13.3333 8.00065 13.3333ZM8.00065 14.6666C11.6825 14.6666 14.6673 11.6819 14.6673 7.99998C14.6673 4.31808 11.6825 1.33331 8.00065 1.33331C4.31875 1.33331 1.33398 4.31808 1.33398 7.99998C1.33398 11.6819 4.31875 14.6666 8.00065 14.6666Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.00065 4.66669C7.63246 4.66669 7.33398 4.96516 7.33398 5.33335C7.33398 5.70154 7.63246 6.00002 8.00065 6.00002C8.36884 6.00002 8.66732 5.70154 8.66732 5.33335C8.66732 4.96516 8.36884 4.66669 8.00065 4.66669ZM8.00065 7.33335C7.63246 7.33335 7.33398 7.63183 7.33398 8.00002V10.6667C7.33398 11.0349 7.63246 11.3334 8.00065 11.3334C8.36884 11.3334 8.66732 11.0349 8.66732 10.6667V8.00002C8.66732 7.63183 8.36884 7.33335 8.00065 7.33335Z","fill","currentColor"],["aria-live","polite"]],template:function(t,r){t&1&&u(0,cXe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-ghost-banner[_ngcontent-%COMP%]{margin:-14px -14px 0;padding:var(--velt-spacing-2xl) var(--velt-spacing-lg);border-radius:var(--velt-border-radius-md) var(--velt-border-radius-md) 0 0;background-color:color-mix(in srgb,var(--velt-error) 12%,transparent);display:flex;gap:var(--velt-spacing-sm);color:var(--velt-error);align-items:center}.velt-ghost-banner[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs)}"],changeDetection:0});let i=o;return i})();var mXe=["customContainerRef"],pXe=["*"],Bge=i=>({componentConfigSignal:i}),gXe=(i,o)=>({condition:i,data:o}),uXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-header-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hXe(i,o){if(i&1&&(_(0,"div",6,0),P(2,"translate"),Vt(3),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-custom")("aria-label",M(2,2,"Comment dialog header"))}}function fXe(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),w(2,"app-comment-dialog-status",7)(3,"app-comment-dialog-priority",7)(4,"app-comment-dialog-custom-annotation-dropdown",7)(5,"div",8)(6,"app-comment-dialog-options",7)(7,"app-copy-link",7)(8,"app-comment-dialog-resolve-button",7)(9,"app-comment-dialog-unresolve-button",7),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-default")("aria-label",M(1,18,"Comment dialog header controls"))("aria-controls",n.componentId+"-content"),m(2),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-status"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-priority"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-custom-annotation-dropdown"),m(),x("data-testid",n.componentId+"-fill"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-options"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-copy-link"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-resolve-button"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-unresolve-button")}}function vXe(i,o){if(i&1&&(_(0,"div",9),w(1,"app-comment-dialog-comment-number",7)(2,"app-comment-dialog-comment-category",7)(3,"div",8)(4,"app-comment-dialog-comment-suggestion-status",7)(5,"app-comment-dialog-priority",7)(6,"app-comment-dialog-status",7)(7,"app-comment-dialog-navigation-button",7),b()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-number"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-category"),m(),x("data-testid",n.componentId+"-fill"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-suggestion-status"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-priority"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-status"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-navigation-button")}}function CXe(i,o){if(i&1&&(v(0),u(1,hXe,4,4,"div",4)(2,fXe,10,20,"div",4)(3,vXe,8,13,"div",5),C()),i&2){let n=l(3).ngIf,e=l();m(),d("ngIf",!e.showDefaultContent),m(),d("ngIf",e.showDefaultContent()&&!(n!=null&&n.sidebarMode)),m(),d("ngIf",e.showDefaultContent()&&(n==null?null:n.sidebarMode))}}function _Xe(i,o){if(i&1&&(v(0),u(1,CXe,4,3,"ng-container",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,uXe,e.template,A(1,Bge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yXe(i,o){if(i&1&&(v(0),u(1,_Xe,2,9,"ng-container",1),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)}}function SXe(i,o){if(i&1&&(v(0),u(1,yXe,2,1,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,gXe,n.conditionSignal(),A(1,Bge,n.componentConfigSignal)))}}var m_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.showDefaultContent=Ee(!1),this.componentId="velt-comment-dialog-header",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogHeaderComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogHeaderComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogHeaderComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.customContainerRef?.nativeElement?.children?.length||this.showDefaultContent.set(!0)}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-header"]],viewQuery:function(t,r){if(t&1&&it(mXe,5),t&2){let a;Xe(a=Qe())&&(r.customContainerRef=a.first)}},standalone:!1,features:[V([S]),B],ngContentSelectors:pXe,decls:1,vars:1,consts:[["customContainerRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-header","role","banner",4,"ngIf"],["class","velt-header",4,"ngIf"],["role","banner",1,"velt-header"],[3,"componentConfigSignal"],[1,"velt-fill"],[1,"velt-header"]],template:function(t,r){t&1&&(jt(),u(0,SXe,2,6,"ng-container",1)),t&2&&d("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%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-header[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;gap:var(--velt-spacing-sm);position:relative}.velt-fill[_ngcontent-%COMP%]{flex-grow:1}"],changeDetection:0});let i=o;return i})();var Vge=i=>({componentConfigSignal:i}),IXe=(i,o)=>({condition:i,data:o}),EXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-more-reply-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xXe(i,o){if(i&1&&(_(0,"div",4),te(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId+"-count-"+e.i)("aria-live","polite"),m(),_e(" ",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)===3?M(2,3,"1 more reply"):(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)-2+" "+M(3,5,"more replies")," ")}}function TXe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),P(2,"translate"),P(3,"translate"),W("click",function(t){F(n);let r=l(2).ngIf;return r==null||r.onMoreRepliesClick(),L(t.stopPropagation())}),u(4,xXe,4,7,"div",3),b(),C()}if(i&2){let n=l(2).ngIf,e=l();m(),x("data-testid",e.componentId+"-button-"+e.i)("aria-label",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)===3?M(2,3,"Show 1 more reply"):M(3,5,"Show "+((n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)-2)+" more replies")),m(3),d("veltDynamicTemplate",$(9,EXe,e.template,A(7,Vge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function DXe(i,o){if(i&1&&(v(0),u(1,TXe,5,15,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",(n==null?null:n.commentDialogSelected)&&!(n!=null&&n.showAllComments)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)>2&&e.i===1)}}function wXe(i,o){if(i&1&&(v(0),u(1,DXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,IXe,n.conditionSignal(),A(1,Vge,n.componentConfigSignal)))}}var oE=(()=>{let o=class o extends H{get moreReplyTemplate(){return this._moreReplyTemplate}set moreReplyTemplate(e){try{this._moreReplyTemplate=e,this._moreReplyTemplate?this.template=this.domService.deepCloneElement(this.moreReplyTemplate):this.template=null}catch(t){this.loggingService.catch("Error in CommentDialogMoreReplyComponent moreReplyTemplate:",t)}}constructor(e,t,r,a){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.domService=a,this.componentId="velt-comment-dialog-more-reply",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogMoreReplyComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogMoreReplyComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",`${this.componentId}-host-${this.i}`)}catch(e){this.loggingService.catch("Error in CommentDialogMoreReplyComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S),h(Le))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-more-reply"]],inputs:{i:"i",moreReplyTemplate:"moreReplyTemplate"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click"],["class","velt-hidden-count","role","status",4,"veltDynamicTemplate"],["role","status",1,"velt-hidden-count"]],template:function(t,r){t&1&&u(0,wXe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-hidden-count[_ngcontent-%COMP%]{text-align:center;color:var(--velt-text-10);cursor:pointer}.velt-hidden-count[_ngcontent-%COMP%]:before, .velt-hidden-count[_ngcontent-%COMP%]:after{background-color:var(--velt-background-4);content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:calc(50% - 50px - 1em)}.velt-hidden-count[_ngcontent-%COMP%]:before{right:.5em;margin-left:-50%}.velt-hidden-count[_ngcontent-%COMP%]:after{left:.5em;margin-right:-50%}'],changeDetection:0});let i=o;return i})();var Uge=i=>({componentConfigSignal:i}),OXe=(i,o)=>({condition:i,data:o}),AXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-options-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function PXe(i,o){if(i&1){let n=Y();v(0),_(1,"app-comment-dialog-options-dropdown",3),W("openAssignToMenu",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.toggleAssignToMenu())})("deleteComment",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.deleteComment())})("editCommentClick",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.onEditCommentClick(0))})("toggleNotificationSubscription",function(){F(n);let t=l(3).ngIf;return L(t==null?null:t.toggleNotificationSubscription())})("changeCommentAccessMode",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.changeCommentAccessMode(t))}),b(),C()}if(i&2){let n=l(3).ngIf,e=l();m(),d("darkMode",!!(n!=null&&n.darkMode))("componentConfigSignal",e.componentConfigSignal)("annotation",n==null?null:n.annotation)("user",n==null?null:n.user)("allowAssignment",!!(n!=null&&n.userMentions))("notificationEnabled",!!(n!=null&&n.notificationEnabled))("variant",n==null?null:n.variant)("allowChangeCommentAccessMode",!!(n!=null&&n.isPrivateCommentAllowed))("isUserAdmin",!!(n!=null&&n.isUserAdmin))("shadowDom",n.dialogShadowDOM)("contentTemplate",e.contentTemplate)("triggerTemplate",e.triggerTemplate)}}function MXe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-assign-menu",4),C()),i&2){let n=l(4);m(),d("componentConfigSignal",n.componentConfigSignal)}}function kXe(i,o){if(i&1&&(v(0),u(1,PXe,2,12,"ng-container",0)(2,MXe,2,1,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n&&!(n!=null&&n.disabled)&&(n==null?null:n.dialogSelectedByKnownUser)&&!(n!=null&&n.isPlanExpired)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode)),m(),d("ngIf",n&&!(n!=null&&n.disabled)&&(n==null?null:n.dialogSelectedByKnownUser)&&!(n!=null&&n.isPlanExpired)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode))}}function RXe(i,o){if(i&1&&(v(0),u(1,kXe,3,2,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,AXe,e.template,A(1,Uge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function NXe(i,o){if(i&1&&(v(0),u(1,RXe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,OXe,n.conditionSignal(),A(1,Uge,n.componentConfigSignal)))}}var rE=(()=>{let o=class o extends H{constructor(e,t,r,a){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.wireframeService=a,this.subscriptions=[],super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),!this.template){let e="velt-comment-dialog-options-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentDialogOptionsComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}getChildTemplate(){if(!this.triggerTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-options-dropdown-trigger-wireframe");qe(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-options-dropdown-content-wireframe");qe(e)||(this.contentTemplate=e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S),h(ze))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-options"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"openAssignToMenu","deleteComment","editCommentClick","toggleNotificationSubscription","changeCommentAccessMode","darkMode","componentConfigSignal","annotation","user","allowAssignment","notificationEnabled","variant","allowChangeCommentAccessMode","isUserAdmin","shadowDom","contentTemplate","triggerTemplate"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,NXe,2,6,"ng-container",0),t&2&&d("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:relative;display:inline-block}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var jge=i=>({componentConfigSignal:i}),FXe=(i,o)=>({condition:i,data:o}),LXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-priority-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function BXe(i,o){if(i&1){let n=Y();v(0),_(1,"velt-comment-dialog-priority-dropdown-internal",3),W("changePriority",function(t){F(n);let r=l(3).ngIf;return L(r==null?null:r.changePriority(t))})("click",function(t){return F(n),L(t.stopPropagation())}),b(),C()}if(i&2){let n=l(3).ngIf,e=l();m(),d("disabled",(n==null?null:n.disabled)||(n==null?null:n.isPlanExpired))("darkMode",!!(n!=null&&n.darkMode))("enablePriority",!!(n!=null&&n.enablePriority))("shadowDom",n.dialogShadowDOM)("variant",n==null?null:n.variant)("annotation",n==null?null:n.annotation)("user",n==null?null:n.user)("triggerTemplate",e.triggerTemplate)("contentTemplate",e.contentTemplate)}}function VXe(i,o){if(i&1&&(v(0),u(1,BXe,2,9,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode)&&(n==null?null:n.enablePriority))}}function UXe(i,o){if(i&1&&(v(0),u(1,VXe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,LXe,e.template,A(1,jge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function jXe(i,o){if(i&1&&(v(0),u(1,UXe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,FXe,n.conditionSignal(),A(1,jge,n.componentConfigSignal)))}}var aE=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.subscriptions=[],this.componentId="velt-comment-dialog-priority",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),!this.template){let e="velt-comment-dialog-priority-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentDialogPriorityComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}getChildTemplate(){if(!this.triggerTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-priority-dropdown-trigger-wireframe");qe(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-priority-dropdown-content-wireframe");qe(e)||(this.contentTemplate=e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","combobox"),e.setAttribute("aria-label","Priority")}catch(e){this.loggingService.catch("Error setting up accessibility attributes in CommentDialogPriorityComponent: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-priority"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["snippylyTheme","",3,"changePriority","click","disabled","darkMode","enablePriority","shadowDom","variant","annotation","user","triggerTemplate","contentTemplate"]],template:function(t,r){t&1&&u(0,jXe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var $ge=i=>({componentConfigSignal:i}),$Xe=(i,o)=>({condition:i,data:o}),HXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-private-badge-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function zXe(i,o){if(i&1&&(_(0,"button",3),P(1,"translate"),le(),_(2,"svg",4),w(3,"path",5)(4,"path",6),b(),te(5),P(6,"translate"),b()),i&2){let n=l(4);x("aria-label",M(1,3,"Private comment mode - only visible to your team"))("data-testid",n.componentId),m(5),_e(" ",M(6,5,"Only for your team")," ")}}function GXe(i,o){if(i&1&&(v(0),u(1,zXe,7,7,"button",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,HXe,e.template,A(1,$ge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function WXe(i,o){if(i&1&&(v(0),u(1,GXe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.isPrivateComment)&&!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))}}function qXe(i,o){if(i&1&&(v(0),u(1,WXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,$Xe,n.conditionSignal(),A(1,$ge,n.componentConfigSignal)))}}var sE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-private-badge",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerPrivateBadgeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerPrivateBadgeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Private comment badge for your team")}catch(e){this.loggingService.catch("Error in CommentDialogComposerPrivateBadgeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-private-badge"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-private-badge","role","button",4,"veltDynamicTemplate"],["role","button",1,"velt-private-badge"],["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true"],["fill-rule","evenodd","clip-rule","evenodd","d","M1.81485 7.71681C1.9083 6.42388 2.92469 5.42008 4.21838 5.33784C4.99204 5.28867 5.93802 5.25 7 5.25C8.06198 5.25 9.00796 5.28867 9.78162 5.33784C11.0753 5.42008 12.0917 6.42388 12.1851 7.71681C12.2229 8.23864 12.25 8.79956 12.25 9.33333C12.25 9.86711 12.2229 10.428 12.1851 10.9499C12.0917 12.2428 11.0753 13.2466 9.78162 13.3288C9.00796 13.378 8.06198 13.4167 7 13.4167C5.93802 13.4167 4.99204 13.378 4.21838 13.3288C2.92469 13.2466 1.9083 12.2428 1.81485 10.9499C1.77714 10.428 1.75 9.86711 1.75 9.33333C1.75 8.79956 1.77714 8.23864 1.81485 7.71681ZM8.16667 8.75C8.16667 9.18183 7.93205 9.55887 7.58333 9.76059V10.5C7.58333 10.8222 7.32217 11.0833 7 11.0833C6.67783 11.0833 6.41667 10.8222 6.41667 10.5V9.76059C6.06795 9.55887 5.83333 9.18183 5.83333 8.75C5.83333 8.10567 6.35567 7.58333 7 7.58333C7.64433 7.58333 8.16667 8.10567 8.16667 8.75Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.08398 3.4987C4.08398 1.88787 5.38982 0.582031 7.00065 0.582031C8.61148 0.582031 9.91732 1.88787 9.91732 3.4987V5.83203C9.91732 6.1542 9.65615 6.41536 9.33398 6.41536C9.01182 6.41536 8.75065 6.1542 8.75065 5.83203V3.4987C8.75065 2.5322 7.96715 1.7487 7.00065 1.7487C6.03415 1.7487 5.25065 2.5322 5.25065 3.4987V5.83203C5.25065 6.1542 4.98948 6.41536 4.66732 6.41536C4.34515 6.41536 4.08398 6.1542 4.08398 5.83203V3.4987Z","fill","currentColor"]],template:function(t,r){t&1&&u(0,qXe,2,6,"ng-container",0),t&2&&d("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%]{align-self:flex-start}[_nghost-%COMP%]:empty{display:none}.velt-private-badge[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding-block:var(--velt-spacing-sm);gap:var(--velt-spacing-sm);background-color:var(--velt-background-0);border:none;border-radius:var(--velt-border-radius-sm);font-style:normal;font-weight:500;font-size:var(--velt-font-size-xs);line-height:18px;color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var Hge=i=>({componentConfigSignal:i}),YXe=(i,o)=>({condition:i,data:o}),KXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-private-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ZXe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),le(),_(2,"svg",4),w(3,"path",5)(4,"path",6),b(),te(5),P(6,"translate"),b()),i&2){let n=l(4);x("data-testid",n.componentId)("aria-label",M(1,4,"Private comment banner")),m(2),x("data-testid",n.componentId+"-icon"),m(3),_e(" ",M(6,6,"Only for your team")," ")}}function XXe(i,o){if(i&1&&(v(0),u(1,ZXe,7,8,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,KXe,e.template,A(1,Hge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function QXe(i,o){if(i&1&&(v(0),u(1,XXe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.isPrivateComment)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))}}function JXe(i,o){if(i&1&&(v(0),u(1,QXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,YXe,n.conditionSignal(),A(1,Hge,n.componentConfigSignal)))}}var p_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-private-banner",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogPrivateBannerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogPrivateBannerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogPrivateBannerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-private-banner"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-private-comment--heading","role","banner",4,"veltDynamicTemplate"],["role","banner",1,"velt-private-comment--heading"],["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M1.81485 7.71681C1.9083 6.42388 2.92469 5.42008 4.21838 5.33784C4.99204 5.28867 5.93802 5.25 7 5.25C8.06198 5.25 9.00796 5.28867 9.78162 5.33784C11.0753 5.42008 12.0917 6.42388 12.1851 7.71681C12.2229 8.23864 12.25 8.79956 12.25 9.33333C12.25 9.86711 12.2229 10.428 12.1851 10.9499C12.0917 12.2428 11.0753 13.2466 9.78162 13.3288C9.00796 13.378 8.06198 13.4167 7 13.4167C5.93802 13.4167 4.99204 13.378 4.21838 13.3288C2.92469 13.2466 1.9083 12.2428 1.81485 10.9499C1.77714 10.428 1.75 9.86711 1.75 9.33333C1.75 8.79956 1.77714 8.23864 1.81485 7.71681ZM8.16667 8.75C8.16667 9.18183 7.93205 9.55887 7.58333 9.76059V10.5C7.58333 10.8222 7.32217 11.0833 7 11.0833C6.67783 11.0833 6.41667 10.8222 6.41667 10.5V9.76059C6.06795 9.55887 5.83333 9.18183 5.83333 8.75C5.83333 8.10567 6.35567 7.58333 7 7.58333C7.64433 7.58333 8.16667 8.10567 8.16667 8.75Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.0835 3.50001C4.0835 1.88918 5.38933 0.583344 7.00016 0.583344C8.61099 0.583344 9.91683 1.88918 9.91683 3.50001V5.83334C9.91683 6.15551 9.65566 6.41668 9.3335 6.41668C9.01133 6.41668 8.75016 6.15551 8.75016 5.83334V3.50001C8.75016 2.53351 7.96666 1.75001 7.00016 1.75001C6.03366 1.75001 5.25016 2.53351 5.25016 3.50001V5.83334C5.25016 6.15551 4.989 6.41668 4.66683 6.41668C4.34466 6.41668 4.0835 6.15551 4.0835 5.83334V3.50001Z","fill","white"]],template:function(t,r){t&1&&u(0,JXe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-private-comment--heading[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--velt-accent) 32%,var(--velt-black) 100%);margin:calc(var(--velt-spacing-lg) * -1);padding:var(--velt-spacing-lg);color:var(--velt-accent-foreground);display:flex;align-items:center;justify-content:flex-start;grid-gap:var(--velt-spacing-sm);gap:var(--velt-spacing-sm);margin-bottom:0;border-radius:var(--velt-border-radius-md) var(--velt-border-radius-md) 0 0;border-bottom:1px solid color-mix(in srgb,var(--velt-accent-foreground) 16%,transparent)}"],changeDetection:0});let i=o;return i})();var zge=i=>({componentConfigSignal:i}),tQe=(i,o)=>({condition:i,data:o}),nQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-resolve-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function iQe(i,o){if(i&1&&(v(0),le(),_(1,"svg",5),w(2,"path",6),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function oQe(i,o){if(i&1){let n=Y();_(0,"app-resolve-button",3),P(1,"translate"),W("changeStatus",function(t){F(n);let r=l(2).ngIf;return L(r==null?null:r.changeStatus(t))})("click",function(t){return F(n),L(t.stopPropagation())}),u(2,iQe,3,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("darkMode",!!(n!=null&&n.darkMode))("annotation",n==null?null:n.annotation)("sidebarMode",n==null?null:n.sidebarMode),x("data-testid",e.componentId)("aria-label",M(1,7,"Resolve thread"))("aria-pressed",!1),m(2),d("veltDynamicTemplate",$(11,nQe,e.template,A(9,zge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function rQe(i,o){if(i&1&&(v(0),u(1,oQe,3,17,"app-resolve-button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.canResolveAnnotation)&&!(!(n==null||n.annotation==null)&&n.annotation.assignedTo)&&(!(n!=null&&n.resolveStatusAccessAdminOnly)||(n==null||n.annotation==null||n.annotation.from==null?null:n.annotation.from.userId)===(n==null||n.user==null?null:n.user.userId)||(n==null?null:n.isUserAdmin)))}}function aQe(i,o){if(i&1&&(v(0),u(1,rQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,tQe,n.conditionSignal(),A(1,zge,n.componentConfigSignal)))}}var g_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-resolve-button",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogResolveButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogResolveButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogResolveButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-resolve-button"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"darkMode","annotation","sidebarMode","changeStatus","click",4,"ngIf"],["role","button","tabindex","0",3,"changeStatus","click","darkMode","annotation","sidebarMode"],[4,"veltDynamicTemplate"],["width","12","height","10","viewBox","0 0 12 10","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M11.5886 1.07806C11.914 1.4035 11.914 1.93114 11.5886 2.25657L4.92194 8.92324C4.5965 9.24868 4.06886 9.24868 3.74343 8.92324L0.410093 5.58991C0.0846564 5.26447 0.0846564 4.73683 0.410093 4.4114C0.73553 4.08596 1.26317 4.08596 1.5886 4.4114L4.33268 7.15547L10.4101 1.07806C10.7355 0.752625 11.2632 0.752625 11.5886 1.07806Z","fill","currentColor"]],template:function(t,r){t&1&&u(0,aQe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Gge=i=>({componentConfigSignal:i}),sQe=(i,o)=>({condition:i,data:o}),lQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-sign-in-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function cQe(i,o){if(i&1&&(v(0),w(1,"div",5),_(2,"div",6),P(3,"translate"),te(4),P(5,"translate"),b(),C()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-button")("aria-label",M(3,3,"Sign In")),m(2),_e(" ",M(5,5,"Sign In"))}}function dQe(i,o){if(i&1){let n=Y();_(0,"div",3),W("click",function(t){F(n);let r=l(2).ngIf;return r==null||r.onSignInClick(),L(t.stopPropagation())}),u(1,cQe,6,7,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-container"),m(),d("veltDynamicTemplate",$(4,lQe,e.template,A(2,Gge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function mQe(i,o){if(i&1&&(v(0),u(1,dQe,2,10,"ng-template",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&(!(n!=null&&n.user)||(n==null||n.user==null?null:n.user.isAnonymous))&&(n==null?null:n.enableSignInButton))}}function pQe(i,o){if(i&1&&(v(0),u(1,mQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,sQe,n.conditionSignal(),A(1,Gge,n.componentConfigSignal)))}}var u_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-sign-in",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSignInComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSignInComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSignInComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-sign-in"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],["role","presentation",3,"click"],[4,"veltDynamicTemplate"],["role","presentation",1,"velt-fill"],["role","button","tabindex","0",1,"velt-flat-button","velt-success-button"]],template:function(t,r){t&1&&u(0,pQe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-fill[_ngcontent-%COMP%]{flex-grow:1}.velt-flat-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm) var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-3xl);border:0;color:var(--velt-accent-foreground);font-weight:700;transition:.2s;font-size:var(--velt-font-size-sm);cursor:pointer}.velt-flat-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}.velt-flat-button.velt-success-button[_ngcontent-%COMP%]{background:var(--velt-success)}.velt-flat-button.velt-success-button[_ngcontent-%COMP%]:hover{background:var(--velt-success-hover)}"],changeDetection:0});let i=o;return i})();var Wge=i=>({componentConfigSignal:i}),uQe=(i,o)=>({condition:i,data:o}),hQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-status-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function fQe(i,o){if(i&1){let n=Y();_(0,"app-comment-dialog-status-dropdown",4),P(1,"translate"),W("changeStatus",function(t){F(n);let r=l(4).ngIf;return L(r==null?null:r.changeStatus(t))})("click",function(t){return F(n),L(t.stopPropagation())}),b()}if(i&2){let n=l(4).ngIf,e=l();d("darkMode",!!(n!=null&&n.darkMode))("user",n==null?null:n.user)("annotation",n==null?null:n.annotation)("isUserAdmin",!!(n!=null&&n.isUserAdmin))("resolveStatusAccessAdminOnly",!!(n!=null&&n.resolveStatusAccessAdminOnly))("disabled",(n==null?null:n.disabled)||(n==null?null:n.isPlanExpired))("shadowDom",n.dialogShadowDOM)("variant",n==null?null:n.variant)("triggerTemplate",e.triggerTemplate)("contentTemplate",e.contentTemplate)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId)("aria-label","Status dropdown for "+M(1,13,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"comment"))}}function vQe(i,o){if(i&1&&(v(0),u(1,fQe,2,15,"app-comment-dialog-status-dropdown",3),C()),i&2){let n=l(3).ngIf;m(),d("ngIf",n==null?null:n.enableStatus)}}function CQe(i,o){if(i&1&&(v(0),u(1,vQe,2,1,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode))}}function _Qe(i,o){if(i&1&&(v(0),u(1,CQe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,hQe,e.template,A(1,Wge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yQe(i,o){if(i&1&&(v(0),u(1,_Qe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,uQe,n.conditionSignal(),A(1,Wge,n.componentConfigSignal)))}}var lE=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.subscriptions=[],this.componentId="velt-comment-dialog-status",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),!this.template){let e="velt-comment-dialog-status-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentDialogStatusComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","region"),e.setAttribute("aria-label","Thread status controls"),e.setAttribute("data-testid",this.componentId+"-container"),this.componentConfigSignal()?.disabled&&e.setAttribute("aria-disabled","true"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CommentDialogStatusComponent setupA11yAttributes:",e)}}getChildTemplate(){if(!this.triggerTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-status-dropdown-trigger-wireframe");qe(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-status-dropdown-content-wireframe");qe(e)||(this.triggerTemplate=e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-status"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"darkMode","user","annotation","isUserAdmin","resolveStatusAccessAdminOnly","disabled","shadowDom","variant","triggerTemplate","contentTemplate","componentConfigSignal","changeStatus","click",4,"ngIf"],[3,"changeStatus","click","darkMode","user","annotation","isUserAdmin","resolveStatusAccessAdminOnly","disabled","shadowDom","variant","triggerTemplate","contentTemplate","componentConfigSignal"]],template:function(t,r){t&1&&u(0,yQe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var qge=i=>({componentConfigSignal:i}),SQe=(i,o)=>({condition:i,data:o}),bQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-accept-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function IQe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),te(2),P(3,"translate"),b()),i&2){let n=l(3);x("data-testid",n.componentId+"-button")("aria-label",M(1,3,"Accept suggestion")),m(2),_e(" ",M(3,5,"Accept")," ")}}function EQe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),W("click",function(t){F(n);let r=l().ngIf;return r==null||r.acceptCommentPinAnnotation(),L(t.stopPropagation())}),u(2,IQe,4,7,"div",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(4,bQe,e.template,A(2,qge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function xQe(i,o){if(i&1&&(v(0),u(1,EQe,3,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,SQe,n.conditionSignal(),A(1,qge,n.componentConfigSignal)))}}var cE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-suggestion-action-accept",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionAcceptComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionAcceptComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionAcceptComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-suggestion-action-accept"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","presentation",3,"click"],["class","velt-flat-button velt-accept-button","role","button","tabindex","0",4,"veltDynamicTemplate"],["role","button","tabindex","0",1,"velt-flat-button","velt-accept-button"]],template:function(t,r){t&1&&u(0,xQe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-flat-button[_ngcontent-%COMP%]{width:100px;text-align:center}.velt-flat-button.velt-accept-button[_ngcontent-%COMP%]{background:transparent;color:var(--velt-success);text-decoration:underline}"],changeDetection:0});let i=o;return i})();var Yge=i=>({componentConfigSignal:i}),TQe=(i,o)=>({condition:i,data:o}),DQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-reject-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function wQe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),te(2),P(3,"translate"),b()),i&2){let n=l(3);x("data-testid",n.componentId+"-button")("aria-label",M(1,3,"Reject suggestion")),m(2),_e(" ",M(3,5,"Reject")," ")}}function OQe(i,o){if(i&1){let n=Y();v(0),_(1,"div",2),W("click",function(t){F(n);let r=l().ngIf;return r==null||r.rejectCommentPinAnnotation(),L(t.stopPropagation())}),u(2,wQe,4,7,"div",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(4,DQe,e.template,A(2,Yge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function AQe(i,o){if(i&1&&(v(0),u(1,OQe,3,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,TQe,n.conditionSignal(),A(1,Yge,n.componentConfigSignal)))}}var dE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-suggestion-action-reject",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionRejectComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionRejectComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionRejectComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-suggestion-action-reject"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","presentation",3,"click"],["class","velt-flat-button velt-reject-button","role","button","tabindex","0",4,"veltDynamicTemplate"],["role","button","tabindex","0",1,"velt-flat-button","velt-reject-button"]],template:function(t,r){t&1&&u(0,AQe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-flat-button[_ngcontent-%COMP%]{width:100px;text-align:center}.velt-flat-button.velt-reject-button[_ngcontent-%COMP%]{background:transparent;color:var(--velt-error);text-decoration:underline}"],changeDetection:0});let i=o;return i})();var Kge=i=>({componentConfigSignal:i}),PQe=(i,o)=>({condition:i,data:o}),MQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function kQe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),w(2,"app-comment-dialog-suggestion-action-accept",4)(3,"app-comment-dialog-suggestion-action-reject",4),b()),i&2){let n=l(4);x("data-testid",n.componentId)("aria-label",M(1,6,"Suggestion actions")),m(2),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-accept"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-reject")}}function RQe(i,o){if(i&1&&(v(0),u(1,kQe,4,8,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,MQe,e.template,A(1,Kge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function NQe(i,o){if(i&1&&(v(0),u(1,RQe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.showSuggestionModeActions)}}function FQe(i,o){if(i&1&&(v(0),u(1,NQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,PQe,n.conditionSignal(),A(1,Kge,n.componentConfigSignal)))}}var h_=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-suggestion-action",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-suggestion-action"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-suggestion-actions","role","toolbar",4,"veltDynamicTemplate"],["role","toolbar",1,"velt-suggestion-actions"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,FQe,2,6,"ng-container",0),t&2&&d("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%]:empty{display:none}.velt-suggestion-actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-lg);margin-bottom:var(--velt-spacing-lg)}.velt-suggestion-actions[_ngcontent-%COMP%]{margin-bottom:0}"],changeDetection:0});let i=o;return i})();var Zge=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),BQe=(i,o)=>({condition:i,data:o}),VQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function UQe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",3),P(2,"translate"),P(3,"translate"),C()),i&2){let n=l(4);m(),d("size",32)("user",n.commentObj==null?null:n.commentObj.from),x("data-testid",n.componentId)("aria-label",M(2,4,"Avatar for")+" "+M(3,6,(n.commentObj==null||n.commentObj.from==null?null:n.commentObj.from.name)||(n.commentObj==null||n.commentObj.from==null?null:n.commentObj.from.email)||"user"))}}function jQe(i,o){if(i&1&&(v(0),u(1,UQe,4,8,"ng-container",0),C()),i&2){let n=l(3);m(),d("ngIf",n.commentObj)}}function $Qe(i,o){if(i&1&&(v(0),u(1,jQe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,VQe,e.template,je(1,Zge,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function HQe(i,o){if(i&1&&(v(0),u(1,$Qe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,BQe,n.conditionSignal(),je(1,Zge,n.componentConfigSignal,n.commentObj,n.i)))}}var mE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-thread-card-avatar",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-avatar"]],inputs:{commentObj:"commentObj",i:"i"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"comment-dialog-user-avatar",3,"size","user"]],template:function(t,r){t&1&&u(0,HQe,2,8,"ng-container",0),t&2&&d("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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Xge=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),zQe=(i,o)=>({condition:i,data:o}),GQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-device-type-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),WQe=i=>({$implicit:i}),qQe=()=>[];function YQe(i,o){i&1&&He(0)}function KQe(i,o){if(i&1&&(_(0,"div",7),u(1,YQe,1,0,"ng-container",8),b()),i&2){l();let n=me(3),e=l(2).ngIf,t=l();x("data-testid",t.componentId),m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(3,WQe,e==null?null:e.deviceType))}}function ZQe(i,o){if(i&1&&w(0,"app-device-type-icons",10),i&2){let n=l().$implicit,e=l(4);d("deviceType",n),x("data-testid",e.componentId+"-icons")}}function XQe(i,o){if(i&1&&(_(0,"div",11)(1,"div"),te(2),P(3,"translate"),b(),_(4,"div"),te(5),P(6,"translate"),b()()),i&2){let n=l(4).ngIf,e=l();ue("dark",n==null?null:n.darkMode),x("data-testid",e.componentId+"-info"),m(2),Pv("",M(3,7,n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.osName)," \u2022 ",n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.screenWidth,"x",n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.screenHeight," "),m(3),_e("Using ",M(6,9,n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.browserName))}}function QQe(i,o){if(i&1&&(_(0,"app-overlay-tooltip",9),u(1,ZQe,1,2,"ng-template",null,1,xe)(3,XQe,7,11,"ng-template",null,2,xe),b()),i&2){let n=l(3).ngIf,e=l();d("positions",(n==null?null:n.deviceInfoTooltipPositions)||pt(2,qQe)),x("data-testid",e.componentId+"-tooltip")}}function JQe(i,o){if(i&1&&(v(0),u(1,KQe,2,5,"div",6)(2,QQe,5,3,"ng-template",null,0,xe),C()),i&2){let n=l(2).ngIf,e=l();m(),d("ngIf",!e.i&&(n==null?null:n.showScreenSizeInfo))}}function eJe(i,o){if(i&1&&(v(0),u(1,JQe,4,1,"ng-container",5),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,GQe,e.template,je(1,Xge,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tJe(i,o){if(i&1&&(v(0),u(1,eJe,2,11,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(5,zQe,n.conditionSignal(),je(1,Xge,n.componentConfigSignal,n.commentObj,n.i)))}}var pE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.deviceInfoTooltipPositions=[{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"}],this.componentId="velt-device-type",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardDeviceTypeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardDeviceTypeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardDeviceTypeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-device-type"]],inputs:{i:"i",commentObj:"commentObj"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["deviceTypeRef",""],["triggerTemplate",""],["tooltipTemplate",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","modal-device__type",4,"ngIf"],[1,"modal-device__type"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"positions"],[3,"deviceType"],["role","tooltip",1,"v-device-info-tooltip-container"]],template:function(t,r){t&1&&u(0,tJe,2,8,"ng-container",3),t&2&&d("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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Qge=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),nJe=(i,o)=>({condition:i,data:o}),iJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-preview-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function oJe(i,o){if(i&1){let n=Y();v(0),_(1,"snippyly-lightbox",4,0)(3,"img",5),P(4,"translate"),P(5,"translate"),W("click",function(){F(n);let t=me(2);return L(t==null?null:t.openImageInFullScreen())}),b()(),C()}if(i&2){let n=l(3);m(),d("src",n.attachment==null?null:n.attachment.url),x("data-testid",n.componentId+"-lightbox"),m(2),d("src",n.attachment==null?null:n.attachment.url,hn)("alt",M(4,5,"Attachment")+" "+M(5,7,(n.attachment==null?null:n.attachment.name)||"preview")),x("data-testid",n.componentId+"-image")}}function rJe(i,o){if(i&1&&(v(0),u(1,oJe,6,9,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,iJe,e.template,dt(1,Qge,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function aJe(i,o){if(i&1&&(v(0),u(1,rJe,2,12,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(6,nJe,n.conditionSignal(),dt(1,Qge,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var gE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-attachment-preview",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImagePreviewComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImagePreviewComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImagePreviewComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image-preview"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["lightboxRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"src"],["velt-ignore-change-detection","true",3,"click","src","alt"]],template:function(t,r){t&1&&u(0,aJe,2,9,"ng-container",1),t&2&&d("ngIf",r.componentConfigSignal())},styles:["img[_ngcontent-%COMP%]{width:100%;object-fit:cover}"],changeDetection:0});let i=o;return i})();var Jge=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),sJe=(i,o)=>({condition:i,data:o}),lJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function cJe(i,o){if(i&1&&(v(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),C()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-icon")}}function dJe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),P(2,"translate"),W("click",function(t){F(n);let r=l(2).ngIf,a=l();return r==null||r.removeAttachment(a.attachmentIndex,a.commentObj),L(t.stopPropagation())}),u(3,cJe,5,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("title",M(1,4,"Delete Attachment")),x("aria-label",M(2,6,"Delete Attachment"))("data-testid",e.componentId),m(3),d("veltDynamicTemplate",$(13,lJe,e.template,dt(8,Jge,e.componentConfigSignal,e.commentObj,e.attachmentIndex,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function mJe(i,o){if(i&1&&(v(0),u(1,dJe,4,19,"div",2),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",!(n!=null&&n.disabled)&&(e.commentObj==null||e.commentObj.from==null?null:e.commentObj.from.userId)===(n==null||n.user==null?null:n.user.userId)&&!(n!=null&&n.isPlanExpired))}}function pJe(i,o){if(i&1&&(v(0),u(1,mJe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,sJe,n.conditionSignal(),dt(1,Jge,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var uE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-attachment-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image-delete"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"title","click",4,"ngIf"],["type","button",3,"click","title"],[4,"veltDynamicTemplate"],[1,"icon-button","velt-comment-attachment--image-action-btn"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","focusable","false"],["d","M0 0h24v24H0V0z","fill","none"],["d","M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"]],template:function(t,r){t&1&&u(0,pJe,2,9,"ng-container",0),t&2&&d("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}.velt-comment-attachment--image-action-btn[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;opacity:1;margin:var(--velt-spacing-xs);border:0;cursor:pointer;color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var eue=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),gJe=(i,o)=>({condition:i,data:o}),uJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-download-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hJe(i,o){if(i&1&&(v(0),_(1,"div",5),le(),_(2,"svg",6)(3,"g"),w(4,"rect",7),b(),_(5,"g"),w(6,"path",8),b()()(),C()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-icon")}}function fJe(i,o){if(i&1){let n=Y();_(0,"div",3),P(1,"translate"),P(2,"translate"),W("click",function(t){F(n);let r=l(2).ngIf,a=l();return r==null||r.downloadAttachment(a.attachment),L(t.stopPropagation())}),u(3,hJe,7,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("title",M(1,4,"Download Attachment")),x("aria-label",M(2,6,"Download Attachment"))("data-testid",e.componentId),m(3),d("veltDynamicTemplate",$(13,uJe,e.template,dt(8,eue,e.componentConfigSignal,e.commentObj,e.attachmentIndex,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vJe(i,o){if(i&1&&(v(0),u(1,fJe,4,19,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n!=null&&n.disabled)&&(n==null||n.user==null?null:n.user.userId)&&!(!(n==null||n.user==null)&&n.user.isAnonymous)&&!(n!=null&&n.isPlanExpired))}}function CJe(i,o){if(i&1&&(v(0),u(1,vJe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,gJe,n.conditionSignal(),dt(1,eue,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var hE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-attachment-download",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDownloadComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDownloadComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDownloadComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image-download"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"title","click",4,"ngIf"],["type","button",3,"click","title"],[4,"veltDynamicTemplate"],[1,"icon-button","velt-comment-attachment--image-action-btn"],["xmlns","http://www.w3.org/2000/svg","enable-background","new 0 0 24 24","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","focusable","false"],["fill","none","height","24","width","24"],["d","M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z"]],template:function(t,r){t&1&&u(0,CJe,2,9,"ng-container",0),t&2&&d("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}.velt-comment-attachment--image-action-btn[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;opacity:1;margin:var(--velt-spacing-xs);border:0;cursor:pointer;color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var tue=(i,o,n,e)=>({componentConfigSignal:i,attachmentIndex:o,attachment:n,commentObj:e}),_Je=(i,o)=>({condition:i,data:o}),yJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function SJe(i,o){if(i&1&&(_(0,"div",8),P(1,"translate"),w(2,"app-comment-dialog-thread-card-attachments-image-download",7)(3,"app-comment-dialog-thread-card-attachments-image-delete",7),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-actions")("aria-label",M(1,10,"Image attachment actions")),m(2),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment),m(),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment)}}function bJe(i,o){if(i&1&&(v(0),_(1,"div",5),P(2,"translate"),u(3,SJe,4,12,"div",6),w(4,"app-comment-dialog-thread-card-attachments-image-preview",7),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),x("aria-label",M(2,7,"Image attachment controls"))("data-testid",e.componentId),m(2),d("ngIf",!(n!=null&&n.readOnly)),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment)}}function IJe(i,o){if(i&1&&(v(0),u(1,bJe,5,9,"ng-container",4),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function EJe(i,o){if(i&1&&(v(0),u(1,IJe,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,yJe,e.template,dt(1,tue,e.componentConfigSignal,e.attachmentIndex,e.attachment,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function xJe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function TJe(i,o){if(i&1&&(v(0),u(1,EJe,2,12,"ng-container",2)(2,xJe,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(6,_Je,n.conditionSignal(),dt(1,tue,n.componentConfigSignal,n.attachmentIndex,n.attachment,n.commentObj)))}}var fE=(()=>{let o=class o extends H{get attachment(){return this._attachment}set attachment(e){try{this._attachment=e,this.setShowLoadingTemplate()}catch{}}get imageWireframe(){return this._imageWireframe}set imageWireframe(e){this._imageWireframe=e,this.imageWireframe?this.template=this.domService.deepCloneElement(this.imageWireframe):this.template=null}constructor(e,t,r,a){super(t,a,r),this.domService=e,this.elementRef=t,this.loggingService=r,this.dynamicDataService=a,this.showLoadingTemplate=!1,this.componentId="velt-comment-attachment-image",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent ngOnDestroy:",e)}}setShowLoadingTemplate(){try{this.attachment?.isAttachmentResolverUsed&&!this.attachment?.url?this.showLoadingTemplate=!0:this.showLoadingTemplate=!1}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent setShowLoadingTemplate: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Le),h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex",imageWireframe:"imageWireframe"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","group",1,"comment-attachment","velt-comment-attachment--image"],["class","comment-attachment-actions velt-comment-attachment--image-actions","role","group",4,"ngIf"],[3,"componentConfigSignal","attachmentIndex","commentObj","attachment"],["role","group",1,"comment-attachment-actions","velt-comment-attachment--image-actions"],["height","20px","width","200px","borderRadius","20px",1,"velt-thread-card--message"]],template:function(t,r){t&1&&u(0,TJe,4,9,"ng-container",1),t&2&&d("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}.velt-comment-attachment--image[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-sm);overflow:hidden;line-height:0;position:relative;max-width:400px}.velt-comment-attachment--image[_ngcontent-%COMP%] .velt-comment-attachment--image-actions[_ngcontent-%COMP%]{position:absolute;bottom:8px;right:8px;display:flex;opacity:0}.velt-comment-attachment--image[_ngcontent-%COMP%]:hover .velt-comment-attachment--image-actions[_ngcontent-%COMP%]{opacity:1}.velt-comment-attachment--image[_ngcontent-%COMP%]:not(:last-child){margin-bottom:var(--velt-spacing-lg)}"],changeDetection:0});let i=o;return i})();var DJe=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),wJe=(i,o)=>({condition:i,data:o}),OJe=i=>({componentConfigSignal:i}),AJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PJe(i,o){if(i&1&&(v(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function MJe(i,o){if(i&1){let n=Y();_(0,"button",3),P(1,"translate"),W("click",function(t){F(n);let r=l(2).ngIf,a=l();return r==null||r.removeAttachment(a.attachmentIndex,a.commentObj),L(t.stopPropagation())}),u(2,PJe,4,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("aria-label",M(1,3,"Delete attachment"))("data-testid",e.componentId),m(2),d("veltDynamicTemplate",$(7,AJe,e.template,A(5,OJe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kJe(i,o){if(i&1&&(v(0),u(1,MJe,3,13,"button",2),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",!(n!=null&&n.disabled)&&(e.commentObj==null||e.commentObj.from==null?null:e.commentObj.from.userId)===(n==null||n.user==null?null:n.user.userId)&&!(n!=null&&n.isPlanExpired))}}function RJe(i,o){if(i&1&&(v(0),u(1,kJe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,wJe,n.conditionSignal(),dt(1,DJe,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var vE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-delete"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"click",4,"ngIf"],["type","button",3,"click"],[4,"veltDynamicTemplate"],[1,"attachment-icon-btn","velt-comment-attachment--action-btn"],["width","18","height","19","viewBox","0 0 18 19","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["d","M3 5.75H15M7.5 8.75V13.25M10.5 8.75V13.25M3.75 5.75L4.5 14.75C4.5 15.1478 4.65804 15.5294 4.93934 15.8107C5.22064 16.092 5.60218 16.25 6 16.25H12C12.3978 16.25 12.7794 16.092 13.0607 15.8107C13.342 15.5294 13.5 15.1478 13.5 14.75L14.25 5.75M6.75 5.75V3.5C6.75 3.30109 6.82902 3.11032 6.96967 2.96967C7.11032 2.82902 7.30109 2.75 7.5 2.75H10.5C10.6989 2.75 10.8897 2.82902 11.0303 2.96967C11.171 3.11032 11.25 3.30109 11.25 3.5V5.75","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,RJe,2,9,"ng-container",0),t&2&&d("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%]{display:flex;align-items:center}button[_ngcontent-%COMP%]{background:transparent;border:0;display:flex;margin:0;padding:0}.velt-comment-attachment--action-btn[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm);cursor:pointer;align-items:center;color:var(--velt-error)}"],changeDetection:0});let i=o;return i})();var NJe=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),FJe=(i,o)=>({condition:i,data:o}),LJe=i=>({componentConfigSignal:i}),BJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-download-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function VJe(i,o){if(i&1&&(v(0),_(1,"div",4),le(),_(2,"svg",5),w(3,"path",6),b()(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-icon")}}function UJe(i,o){if(i&1){let n=Y();v(0),_(1,"button",2),P(2,"translate"),P(3,"translate"),W("click",function(t){F(n);let r=l().ngIf,a=l();return r==null||r.downloadAttachment(a.attachment),L(t.stopPropagation())}),u(4,VJe,4,1,"ng-container",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),x("title",M(2,4,"Download attachment"))("aria-label",M(3,6,"Download attachment"))("data-testid",e.componentId),m(3),d("veltDynamicTemplate",$(10,BJe,e.template,A(8,LJe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function jJe(i,o){if(i&1&&(v(0),u(1,UJe,5,16,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,FJe,n.conditionSignal(),dt(1,NJe,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var CE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-download",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDownloadComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDownloadComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDownloadComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-download"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"click"],[4,"veltDynamicTemplate"],[1,"attachment-icon-btn","velt-comment-attachment--action-btn"],["width","18","height","19","viewBox","0 0 18 19","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["d","M3 13.25V14.75C3 15.1478 3.15804 15.5294 3.43934 15.8107C3.72064 16.092 4.10218 16.25 4.5 16.25H13.5C13.8978 16.25 14.2794 16.092 14.5607 15.8107C14.842 15.5294 15 15.1478 15 14.75V13.25M5.25 8.75L9 12.5M9 12.5L12.75 8.75M9 12.5V3.5","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&u(0,jJe,2,9,"ng-container",0),t&2&&d("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%]{display:flex;align-items:center}button[_ngcontent-%COMP%]{background:transparent;border:0;display:flex;margin:0;padding:0}.velt-comment-attachment--action-btn[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm);cursor:pointer;align-items:center;color:var(--velt-accent)}"],changeDetection:0});let i=o;return i})();var nue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),$Je=(i,o)=>({condition:i,data:o}),HJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function zJe(i,o){if(i&1&&(v(0),w(1,"velt-file-icon-internal",3),C()),i&2){let n=l(3);m(),d("type",n.attachment==null?null:n.attachment.mimeType),x("data-testid",n.componentId)}}function GJe(i,o){if(i&1&&(v(0),u(1,zJe,2,2,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,HJe,e.template,dt(1,nue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function WJe(i,o){if(i&1&&(v(0),u(1,GJe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,$Je,n.conditionSignal(),dt(1,nue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var _E=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-icon",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-icon"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"type"]],template:function(t,r){t&1&&u(0,WJe,2,9,"ng-container",0),t&2&&d("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%]{display:flex;color:var(--velt-accent)}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var iue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),qJe=(i,o)=>({condition:i,data:o}),YJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function KJe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),te(3),P(4,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label","File name: "+M(2,3,(n.attachment==null?null:n.attachment.name)||"")),m(2),Ge(M(4,5,n.attachment==null?null:n.attachment.name))}}function ZJe(i,o){if(i&1&&(v(0),u(1,KJe,5,7,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,YJe,e.template,dt(1,iue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function XJe(i,o){if(i&1&&(v(0),u(1,ZJe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,qJe,n.conditionSignal(),dt(1,iue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var yE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-name",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-name"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"attachment-name","velt-comment-attachment--name"]],template:function(t,r){t&1&&u(0,XJe,2,9,"ng-container",0),t&2&&d("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%]{line-height:normal}.velt-comment-attachment--name[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-3);text-overflow:ellipsis;font-size:var(--velt-font-size-xs);font-style:normal;font-weight:600;line-height:normal;white-space:nowrap}"],changeDetection:0});let i=o;return i})();var oue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),QJe=(i,o)=>({condition:i,data:o}),JJe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-size-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function eet(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),P(3,"fileSize"),te(4),P(5,"fileSize"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"File size:")+" "+M(3,5,n.attachment==null?null:n.attachment.size)),m(3),Ge(M(5,7,n.attachment==null?null:n.attachment.size))}}function tet(i,o){if(i&1&&(v(0),u(1,eet,6,9,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,JJe,e.template,dt(1,oue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function net(i,o){if(i&1&&(v(0),u(1,tet,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,QJe,n.conditionSignal(),dt(1,oue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var SE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-size",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherSizeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherSizeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherSizeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-size"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"attachment-size","velt-comment-attachment--size"]],template:function(t,r){t&1&&u(0,net,2,9,"ng-container",0),t&2&&d("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%]{line-height:normal}.velt-comment-attachment--size[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-7);text-overflow:ellipsis;font-size:var(--velt-font-size-2xs);font-style:normal;font-weight:500;line-height:normal}"],changeDetection:0});let i=o;return i})();var rue=(i,o,n,e)=>({componentConfigSignal:i,attachmentIndex:o,commentObj:n,attachment:e}),iet=(i,o)=>({condition:i,data:o}),oet=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ret(i,o){if(i&1&&(_(0,"div",10),w(1,"app-comment-dialog-thread-card-attachments-other-download",7)(2,"app-comment-dialog-thread-card-attachments-other-delete",7),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-actions")("aria-label","Attachment actions"),m(),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment),m(),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment)}}function aet(i,o){if(i&1&&(v(0),_(1,"div",5),P(2,"translate"),_(3,"div",6),w(4,"app-comment-dialog-thread-card-attachments-other-icon",7),b(),_(5,"div",8),w(6,"app-comment-dialog-thread-card-attachments-other-name",7)(7,"app-comment-dialog-thread-card-attachments-other-size",7),b(),u(8,ret,3,10,"div",9),b(),C()),i&2){let n=l(3).ngIf,e=l();m(),x("data-testid",e.componentId)("aria-label","Attachment: "+M(2,18,(e.attachment==null?null:e.attachment.name)||"")),m(2),x("data-testid",e.componentId+"-icon"),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),x("data-testid",e.componentId+"-details")("aria-label","Attachment details"),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),d("ngIf",!(n!=null&&n.readOnly))}}function set(i,o){if(i&1&&(v(0),u(1,aet,9,20,"ng-container",4),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function cet(i,o){if(i&1&&(v(0),u(1,set,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,oet,e.template,dt(1,rue,e.componentConfigSignal,e.attachmentIndex,e.commentObj,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function det(i,o){i&1&&w(0,"velt-skeleton-loader-internal",11)}function met(i,o){if(i&1&&(v(0),u(1,cet,2,12,"ng-container",2)(2,det,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(6,iet,n.conditionSignal(),dt(1,rue,n.componentConfigSignal,n.attachmentIndex,n.commentObj,n.attachment)))}}var bE=(()=>{let o=class o extends H{get attachment(){return this._attachment}set attachment(e){try{this._attachment=e,this.setShowLoadingTemplate()}catch{}}get otherWireframe(){return this._otherWireframe}set otherWireframe(e){this._otherWireframe=e,this.otherWireframe?this.template=this.domService.deepCloneElement(this.otherWireframe):this.template=null}constructor(e,t,r,a){super(t,a,r),this.domService=e,this.elementRef=t,this.loggingService=r,this.dynamicDataService=a,this.showLoadingTemplate=!1,this.componentId="velt-attachment-other",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent ngOnDestroy:",e)}}setShowLoadingTemplate(){try{this.attachment?.isAttachmentResolverUsed&&!this.attachment?.url?this.showLoadingTemplate=!0:this.showLoadingTemplate=!1}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent setShowLoadingTemplate: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","article"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Le),h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex",otherWireframe:"otherWireframe"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"],["role","article",1,"comment-pdf-attachment","velt-comment-attachment"],["role","presentation",1,"attachment-icon","velt-comment-attachment--icon"],[3,"componentConfigSignal","attachmentIndex","commentObj","attachment"],["role","group",1,"attachment-details","velt-comment-attachment--details"],["class","attachment-actions velt-comment-attachment--actions","role","group",4,"ngIf"],["role","group",1,"attachment-actions","velt-comment-attachment--actions"],["height","20px","width","200px","borderRadius","20px",1,"velt-thread-card--message"]],template:function(t,r){t&1&&u(0,met,4,9,"ng-container",1),t&2&&d("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}.velt-comment-attachment[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm) var(--velt-spacing-xs) var(--velt-spacing-sm) var(--velt-spacing-md);justify-content:space-between;gap:var(--velt-spacing-sm);align-items:center;align-self:stretch;width:100%;border-radius:var(--velt-border-radius-sm);border:1px solid var(--velt-border-4);box-sizing:border-box}.velt-comment-attachment[_ngcontent-%COMP%] .velt-comment-attachment--icon[_ngcontent-%COMP%]{display:flex}.velt-comment-attachment[_ngcontent-%COMP%] .velt-comment-attachment--details[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-xs);flex:1;overflow:hidden}.velt-comment-attachment[_ngcontent-%COMP%] .velt-comment-attachment--actions[_ngcontent-%COMP%]{display:flex;width:0;overflow:hidden}.velt-comment-attachment[_ngcontent-%COMP%]:not(:last-child){margin-bottom:var(--velt-spacing-lg)}.velt-comment-attachment[_ngcontent-%COMP%]:hover .velt-comment-attachment--actions[_ngcontent-%COMP%]{width:auto}"],changeDetection:0});let i=o;return i})();var aue=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),pet=(i,o)=>({condition:i,data:o}),get=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function uet(i,o){i&1&&He(0)}function het(i,o){if(i&1&&(v(0),u(1,uet,1,0,"ng-container",9),C()),i&2){l();let n=me(5);m(),d("ngTemplateOutlet",n)}}function fet(i,o){if(i&1&&w(0,"app-comment-dialog-thread-card-attachments-other",10),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(6);d("componentConfigSignal",r.componentConfigSignal)("attachment",e)("commentObj",r.commentObj)("attachmentIndex",t)("otherWireframe",r.otherWireframe)}}function vet(i,o){if(i&1&&w(0,"app-comment-dialog-thread-card-attachments-image",11),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(6);d("componentConfigSignal",r.componentConfigSignal)("attachmentIndex",t)("commentObj",r.commentObj)("attachment",e)("imageWireframe",r.imageWireframe)}}function Cet(i,o){if(i&1&&(v(0),u(1,het,2,1,"ng-container",8)(2,fet,1,5,"ng-template",null,0,xe)(4,vet,1,5,"ng-template",null,1,xe),C()),i&2){let n=o.$implicit,e=me(3);m(),d("ngIf",n==null||n.mimeType==null?null:n.mimeType.includes("image"))("ngIfElse",e)}}function _et(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),u(2,Cet,6,2,"ng-container",7),b()),i&2){let n=l(4).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,4,"Attachments")+"("+(e.commentObj==null||e.commentObj.attachments==null?null:e.commentObj.attachments.length)+")"),m(2),d("ngForOf",e.commentObj==null?null:e.commentObj.attachments)("ngForTrackBy",n==null?null:n.trackByAttachmentId)}}function yet(i,o){if(i&1&&(v(0),u(1,_et,3,6,"div",5),C()),i&2){let n=l(4);m(),d("ngIf",n.commentObj==null||n.commentObj.attachments==null?null:n.commentObj.attachments.length)}}function bet(i,o){if(i&1&&(v(0),u(1,yet,2,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("ngIf",n.commentObj)}}function Iet(i,o){if(i&1&&(v(0),u(1,bet,2,1,"ng-container",4),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,get,e.template,je(1,aue,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Eet(i,o){if(i&1&&(v(0),u(1,Iet,2,11,"ng-container",3),C()),i&2){let n=l();m(),d("veltIf",k(5,pet,n.conditionSignal(),je(1,aue,n.componentConfigSignal,n.commentObj,n.i)))}}var IE=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-thread-card-attachments",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setupA11yAttributes(),this.imageWireframe||(this.imageWireframe=this.template?.querySelector("velt-comment-dialog-thread-card-attachments-image-wireframe")),this.otherWireframe||(this.otherWireframe=this.template?.querySelector("velt-comment-dialog-thread-card-attachments-other-wireframe"))}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","region"),e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("aria-label","Comment attachments")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments"]],inputs:{commentObj:"commentObj",i:"i"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["otherAttachmentRef",""],["imageAttachmentRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","comment-attachments velt-comment-attachments","velt-ignore-change-detection","true","role","region",4,"ngIf"],["velt-ignore-change-detection","true","role","region",1,"comment-attachments","velt-comment-attachments"],[4,"ngFor","ngForOf","ngForTrackBy"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[3,"componentConfigSignal","attachment","commentObj","attachmentIndex","otherWireframe"],[3,"componentConfigSignal","attachmentIndex","commentObj","attachment","imageWireframe"]],template:function(t,r){t&1&&u(0,Eet,2,8,"ng-container",2),t&2&&d("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%]:empty{display:none}.velt-comment-attachments[_ngcontent-%COMP%]{gap:var(--velt-spacing-sm);display:flex;flex-direction:column}.velt-comment-attachments[_ngcontent-%COMP%]:not(:empty){margin:var(--velt-spacing-lg) 0 var(--velt-spacing-sm);padding-left:calc((3rem + 0px) * var(--velt-base-rem-unit))}"],changeDetection:0});let i=o;return i})();var sue=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),xet=(i,o)=>({condition:i,data:o}),Tet=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),Det=(i,o,n,e,t)=>[i,o,n,e,t];function wet(i,o){if(i&1){let n=Y();_(0,"div",7),P(1,"translate"),W("copy",function(t){return F(n),L(t.stopPropagation())}),te(2),P(3,"translate"),b()}if(i&2){let n=l(4).ngIf,e=l();ue("velt-thread-card--inline-mode",n==null?null:n.inlineCommentSectionMode)("velt-thread-card--draft",e.commentObj==null?null:e.commentObj.isDraft),x("data-testid",e.componentId+"-text")("aria-label",M(1,8,"Comment")+" "+(e.i+1))("data-comment-id",e.commentObj==null?null:e.commentObj.commentId),m(2),_e(" ",M(3,10,e.commentObj.commentText)," ")}}function Oet(i,o){if(i&1){let n=Y();_(0,"div",8),P(1,"sanitizeHtml"),P(2,"replaceAutocompleteList"),P(3,"safeHtml"),P(4,"translate"),W("copy",function(t){return F(n),L(t.stopPropagation())}),b()}if(i&2){let n=l(4).ngIf,e=l();ue("velt-thread-card--inline-mode",n==null?null:n.inlineCommentSectionMode)("velt-thread-card--draft",e.commentObj==null?null:e.commentObj.isDraft),d("innerHTML",Ga(3,16,jL(2,10,$(21,Det,M(1,8,e.commentObj.commentHtml),e.commentObj==null?null:e.commentObj.customList,e.commentObj==null?null:e.commentObj.toOrganizationUserGroup,e.commentObj==null?null:e.commentObj.taggedUserContacts,(n==null?null:n.dialogShadowDOM)&&!(n!=null&&n.template))),!1),Ji),x("data-testid",e.componentId+"-html")("aria-label",M(4,19,"Comment")+" "+(e.i+1))("data-comment-id",e.commentObj==null?null:e.commentObj.commentId)}}function Aet(i,o){if(i&1&&(v(0),u(1,wet,4,12,"div",5)(2,Oet,5,27,"div",6),C()),i&2){let n=l(3).ngIf,e=l();m(),d("ngIf",(n==null?null:n.editCommentIndex)!==e.i&&e.commentObj.commentText&&!e.commentObj.commentHtml),m(),d("ngIf",(n==null?null:n.editCommentIndex)!==e.i&&e.commentObj.commentHtml)}}function Pet(i,o){if(i&1&&(v(0),u(1,Aet,3,2,"ng-container",4),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function Met(i,o){if(i&1&&(v(0),u(1,Pet,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,Tet,e.template,je(1,sue,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function ket(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function Ret(i,o){if(i&1&&(v(0),u(1,Met,2,11,"ng-container",2)(2,ket,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(5,xet,n.conditionSignal(),je(1,sue,n.componentConfigSignal,n.commentObj,n.i)))}}var EE=(()=>{let o=class o extends H{get commentObj(){return this._commentObj}set commentObj(e){try{this._commentObj=e,this.setShowLoadingTemplate()}catch{}}constructor(e,t,r,a,s){super(a,s,t),this.authService=e,this.loggingService=t,this.renderer=r,this.elementRef=a,this.dynamicDataService=s,this.showLoadingTemplate=!1,this.componentId="velt-thread-card-message",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.setupA11yAttributes(),this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setShowLoadingTemplate();let t=this.authService.getUser()?.email;if(t){let r=this.renderer.createElement("style");this.renderer.setProperty(r,"type","text/css"),this.renderer.setProperty(r,"innerHTML",`
|
|
521
521
|
.velt-comment-dialog-thread-card-message--email-chip[email="${t}"] {
|