@veltdev/sdk-staging 6.0.0-beta.5 → 6.0.0-beta.7
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/client/snippyly.model.d.ts +2 -3
- package/app/models/data/selection.model.d.ts +10 -8
- package/app/models/data/user-resolver.data.model.d.ts +11 -9
- package/app/models/data/user.data.model.d.ts +21 -18
- package/app/models/element/activity-element.model.d.ts +0 -1
- package/app/models/element/area-element.model.d.ts +0 -1
- package/app/models/element/arrow-element.model.d.ts +1 -2
- package/app/models/element/autocomplete-element.model.d.ts +0 -1
- package/app/models/element/comment-element.model.d.ts +103 -77
- package/app/models/element/contact-element.model.d.ts +1 -2
- package/app/models/element/crdt-element.model.d.ts +1 -1
- package/app/models/element/cursor-element.model.d.ts +1 -2
- package/app/models/element/huddle-element.model.d.ts +1 -2
- package/app/models/element/live-state-sync-element.model.d.ts +1 -1
- package/app/models/element/notification-element.model.d.ts +33 -2
- package/app/models/element/presence-element.model.d.ts +32 -11
- package/app/models/element/reaction-element.model.d.ts +1 -1
- package/app/models/element/recorder-element.model.d.ts +21 -2
- package/app/models/element/rewriter-element.model.d.ts +43 -1
- package/app/models/element/selection-element.model.d.ts +1 -1
- package/app/models/element/suggestion-element.model.d.ts +0 -1
- package/app/models/element/tag-element.model.d.ts +7 -8
- package/app/models/element/views-element.model.d.ts +1 -1
- package/app/utils/enums.d.ts +91 -82
- package/{chunk-4HTRJDUT.js → chunk-2YJ3NBTO.js} +1 -1
- package/{chunk-HPCGJVBV.js → chunk-3OIAZGVH.js} +1 -1
- package/{chunk-NREV2I2E.js → chunk-3OILJMAX.js} +1 -1
- package/{chunk-NVSEAZ7V.js → chunk-4QPJMZ5V.js} +1 -1
- package/{chunk-JWZNY6MR.js → chunk-52EPUXSU.js} +1 -1
- package/{chunk-I3QEZDJJ.js → chunk-57VK6E6U.js} +1 -1
- package/{chunk-M6OYNJUV.js → chunk-5SSUFLRQ.js} +1 -1
- package/{chunk-6YU4HPC3.js → chunk-5W33SILU.js} +1 -1
- package/{chunk-HRMFENXY.js → chunk-6TORUSYX.js} +1 -1
- package/{chunk-2CSNE6K3.js → chunk-AMBQ736A.js} +1 -1
- package/{chunk-S6BGMPB5.js → chunk-DP4GMASO.js} +1 -1
- package/{chunk-ZOEYUSVF.js → chunk-ENIVQSM6.js} +1 -1
- package/{chunk-CAH7LK67.js → chunk-EWNXINED.js} +1 -1
- package/{chunk-BLOVLKDQ.js → chunk-G2POMKRC.js} +1 -1
- package/{chunk-EJCDV3ZL.js → chunk-G56O673H.js} +1 -1
- package/{chunk-XQKUJSNO.js → chunk-GUGGWPZ7.js} +1 -1
- package/{chunk-OSPUUVRC.js → chunk-HDABOQPS.js} +1 -1
- package/{chunk-GG5L5Y4V.js → chunk-J3FNQGWW.js} +1 -1
- package/{chunk-AUXK5IGY.js → chunk-JSZMRBOR.js} +1 -1
- package/{chunk-GUCATQJB.js → chunk-LAUYCNER.js} +1 -1
- package/{chunk-4KHSKSMM.js → chunk-MJDGHV4Y.js} +1 -1
- package/{chunk-NM7DOIHZ.js → chunk-MX66OK5A.js} +1 -1
- package/{chunk-4RKIO2W6.js → chunk-NR3CZ6OR.js} +1 -1
- package/{chunk-A7KXFTE5.js → chunk-QDQ2XJUX.js} +1 -1
- package/{chunk-GY4HESRT.js → chunk-RMV5EWSF.js} +1 -1
- package/{chunk-TIHAG3UC.js → chunk-RQQHM7ZV.js} +1 -1
- package/{chunk-WEQZFWL6.js → chunk-SQTBBRA3.js} +1 -1
- package/{chunk-3HVKHN3C.js → chunk-TY3WZ4Q4.js} +26 -26
- package/{chunk-ONMQQFFH.js → chunk-W4BGGBK5.js} +1 -1
- package/{chunk-6YAEGDTT.js → chunk-XAJ4ABBW.js} +1 -1
- package/{chunk-62IPFSNC.js → chunk-XJWB3IUW.js} +1 -1
- package/{chunk-DEKTLMP2.js → chunk-YSZQAETY.js} +1 -1
- package/{chunk-ZOM7FOLY.js → chunk-ZMXXM7C4.js} +1 -1
- package/package.json +1 -1
- package/types.d.ts +22 -22
- package/velt-activity-log.js +1 -1
- package/velt-area.js +1 -1
- package/velt-arrow.js +1 -1
- package/velt-comment.js +6 -6
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +1 -1
- package/velt-huddle.js +1 -1
- package/velt-live-state-sync.js +1 -1
- package/velt-notification.js +1 -1
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +1 -1
- package/velt-selection.js +1 -1
- package/velt-tag.js +1 -1
- package/velt-user-invite.js +1 -1
- package/velt-user-request.js +1 -1
- package/velt-video-player.js +1 -1
- package/velt-views.js +1 -1
- package/velt.d.ts +1 -2
- package/velt.js +3 -3
package/velt-crdt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as de}from"./chunk-EJCDV3ZL.js";import{$ as _,E as O,H as $,Hi as oe,I as M,Kh as Z,Lf as K,Mf as j,Pc as q,Pi as se,Qf as p,Qi as ae,T as k,Ta as G,Va as Y,Ve as X,W,Xe as f,a as w,aa as x,ag as z,b as R,ca as b,g as v,je as J,ji as ee,k as P,l as H,li as te,ni as A,oi as re,pi as h,qi as ie,r as E,ue as V,ui as ce,vi as ne,ye as Q}from"./chunk-3HVKHN3C.js";var F=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,r){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new P),this.actionSubjects.get(e)?.next(r)}catch(n){this.loggingService.catch("Error in CrdtActionsService triggerAction: ",n)}}onAction(e){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new P);let r=this.actionSubjects.get(e);return r?r.asObservable():E(null)}catch(r){return this.loggingService.catch("Error in CrdtActionsService onAction: ",r),E(null)}}};o.\u0275fac=function(r){return new(r||o)(b(h))},o.\u0275prov=_({token:o,factory:o.\u0275fac,providedIn:"root"});let y=o;return y})();var I=(()=>{let o=class o{static generateKey(){return v(this,null,function*(){try{return yield window.crypto.subtle.generateKey({name:"AES-GCM",length:this.KEY_LENGTH},!1,["encrypt","decrypt"])}catch(e){return f.catch("Failed to generate key: ",e),null}})}static deriveKeyFromPassword(e,r){return v(this,null,function*(){try{if(!r){let t=yield window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));r=new Uint8Array(t).slice(0,this.SALT_LENGTH)}let n=new TextEncoder().encode(e),i=yield window.crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits","deriveKey"]);return{key:yield window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:this.PBKDF2_ITERATIONS,hash:"SHA-256"},i,{name:"AES-GCM",length:this.KEY_LENGTH},!1,["encrypt","decrypt"]),salt:r}}catch(n){return f.catch("Failed to derive key from password: ",n),null}})}static resolveKey(e){return v(this,null,function*(){try{if(e.customKey){if(e.customKey instanceof CryptoKey)return{key:e.customKey};if(typeof e.customKey=="string"){let n=yield this.deriveKeyFromPassword(e.customKey,e.customSalt);if(!n)return f.catch("Failed to derive key from password"),null;let{key:i,salt:c}=n;return{key:i,salt:c}}}let r=yield this.generateKey();return r?{key:r}:(f.catch("Failed to generate key"),null)}catch(r){return f.catch("Failed to resolve key: ",r),null}})}static encrypt(n){return v(this,arguments,function*(e,r={}){try{if(r.customEncryptCallback)try{return yield r.customEncryptCallback(e)}catch(g){return f.catch("Custom encryption callback failed: ",g),""}let i=yield this.resolveKey(r);if(!i)return f.catch("Failed to resolve key"),"";let{key:c,salt:t}=i,s;if(r.customIV){if(r.customIV.length!==this.IV_LENGTH)return f.catch(`Custom IV must be exactly ${this.IV_LENGTH} bytes`),"";s=r.customIV}else s=window.crypto.getRandomValues(new Uint8Array(this.IV_LENGTH));let a=new TextEncoder().encode(e),d={name:"AES-GCM",iv:s,tagLength:128};r.additionalData&&(d.additionalData=r.additionalData);try{let g=yield window.crypto.subtle.encrypt(d,c,a),u=new Uint8Array(s.length+g.byteLength);u.set(s,0),u.set(new Uint8Array(g),s.length);let m=8192,C=[];for(let D=0;D<u.length;D+=m){let T=u.slice(D,Math.min(D+m,u.length)),U="";for(let N=0;N<T.length;N++)U+=String.fromCharCode(T[N]);C.push(U)}return btoa(C.join(""))}catch(g){return f.catch("Encryption failed: ",g),""}}catch(i){return f.catch("Failed to encrypt: ",i),null}})}static decrypt(n){return v(this,arguments,function*(e,r={}){try{if(r.customDecryptCallback)try{return yield r.customDecryptCallback(e)}catch(g){return f.catch("Custom decryption callback failed: ",g),""}let i=yield this.resolveKey(r);if(!i)return f.catch("Failed to resolve key"),"";let{key:c}=i,t=new Uint8Array(atob(e).split("").map(g=>g.charCodeAt(0)));if(t.length<this.IV_LENGTH)return f.catch("Invalid encrypted data: Too short"),"";let s;if(r.customIV){if(r.customIV.length!==this.IV_LENGTH)return f.catch(`Custom IV must be exactly ${this.IV_LENGTH} bytes`),"";s=r.customIV}else s=t.slice(0,this.IV_LENGTH);let a=t.slice(this.IV_LENGTH),d={name:"AES-GCM",iv:s,tagLength:128};r.additionalData&&(d.additionalData=r.additionalData);try{let g=yield window.crypto.subtle.decrypt(d,c,a);return new TextDecoder().decode(g)}catch(g){return f.catch("Decryption failed: ",g),""}}catch(i){return f.catch("Failed to decrypt: ",i),""}})}static encryptData(n){return v(this,arguments,function*(e,r={}){try{let i=JSON.stringify(e);return(yield this.encrypt(i,r))??""}catch(i){return f.catch("Failed to encrypt data: ",i),""}})}static decryptData(n){return v(this,arguments,function*(e,r={}){try{let i=yield this.decrypt(e,r);return JSON.parse(i)}catch(i){return f.catch("Failed to decrypt data: ",i),null}})}};o.IV_LENGTH=12,o.SALT_LENGTH=16,o.PBKDF2_ITERATIONS=1e5,o.KEY_LENGTH=256;let y=o;return y})();var S=(()=>{let o=class o{constructor(e,r,n,i,c,t,s,a,d,g){this.analyticsService=e,this.authService=r,this.commonDbService=n,this.commonDbUtilsService=i,this.configService=c,this.crdtActionsService=t,this.docService=s,this.domService=a,this.loggingService=d,this.serviceBook=g,this.MIN_WEBHOOK_DEBOUNCE_TIME=5*1e3,this.webhookDebounceTime=this.MIN_WEBHOOK_DEBOUNCE_TIME,this.updateDataWebhookTrigger$=new P,this.updateDataWebhookDebounceSubscription=null,this.pendingWebhookEvent=null,this.webhookEnabled$=new H(!1),this.lastCrdtDataUpdatedId=null,this.MIN_ACTIVITY_DEBOUNCE_TIME=10*1e3,this.activityDebounceTime=600*1e3,this.editorEditTrackers=new Map,this.activityService=null,this.notificationService=null;try{this.loggingService.log("%c[WB] Creating CLASS: CrdtService","color: blue;"),this.serviceBook.observe(ee).subscribe(u=>{this.activityService=u}),this.serviceBook.observe(Z).subscribe(u=>{this.notificationService=u}),this.setupUpdateDataWebhookDebounce(),this.docService.addPreDocumentIdChangeFunction("crdt-service",()=>(this.lastCrdtDataUpdatedId=null,Promise.resolve())),this.authService.addPreSignOutFuction("crdt-service",()=>(this.lastCrdtDataUpdatedId=null,Promise.resolve()))}catch(u){this.loggingService.catch("Error in CrdtService constructor: ",u)}}trackCrdtDataUpdated(e){try{if(this.lastCrdtDataUpdatedId===e)return;this.lastCrdtDataUpdatedId=e,this.analyticsService.trackEvent(J.Events.Crdt.CRDT_DATA_UPDATED,{id:e})}catch(r){this.loggingService.catch("Error in CrdtService trackCrdtDataUpdated: ",r)}}setupUpdateDataWebhookDebounce(){try{this.updateDataWebhookDebounceSubscription&&(this.updateDataWebhookDebounceSubscription.unsubscribe(),this.updateDataWebhookDebounceSubscription=null,this.pendingWebhookEvent=null),this.updateDataWebhookDebounceSubscription=this.updateDataWebhookTrigger$.pipe(W(e=>{this.pendingWebhookEvent=e}),M(this.webhookDebounceTime)).subscribe(e=>{this.pendingWebhookEvent=null,this.webhookEnabled$.value&&e&&this.triggerUpdateDataWebhook(e)},e=>{this.loggingService.catch("Error in CrdtService setupUpdateDataWebhookDebounce subscription: ",e)})}catch(e){this.loggingService.catch("Error in CrdtService setupUpdateDataWebhookDebounce: ",e)}}setWebhookDebounceTime(e){try{e<this.MIN_WEBHOOK_DEBOUNCE_TIME&&(this.loggingService.catch("Error in CrdtService setWebhookDebounceTime: Value must be at least "+this.MIN_WEBHOOK_DEBOUNCE_TIME/1e3+" seconds ("+this.MIN_WEBHOOK_DEBOUNCE_TIME+"ms). Using minimum value."),e=this.MIN_WEBHOOK_DEBOUNCE_TIME),this.pendingWebhookEvent&&this.webhookEnabled$.value&&(this.triggerUpdateDataWebhook(this.pendingWebhookEvent),this.pendingWebhookEvent=null),this.webhookDebounceTime=e,this.setupUpdateDataWebhookDebounce()}catch(r){this.loggingService.catch("Error in CrdtService setWebhookDebounceTime: ",r)}}updateData(i){return v(this,arguments,function*({id:e,state:r,data:n}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateData","color: green;");let c=this.docService.getDocumentPaths(),t=this.authService.getUser(),s=this.domService.getTabId();if(t?.userId&&c){let a=p(e),d=t.userId,g=p(t.userId),u=new Date().toISOString(),m=null,C=this.configService.getEncryptionProvider();if(C?.encrypt&&typeof C.encrypt=="function")m=yield C.encrypt({data:r});else{let N={};N.customKey=a,m=yield I.encryptData(r,N)}let D={id:e,veltId:a,encryptedState:m,lastUpdate:u,lastUpdatedBy:d,lastUpdatedByVeltUserId:g,sessionId:s},T={methodName:j.UPDATE_DATA,uniqueId:z(),timestamp:new Date().getTime(),source:K.INTERNAL,payload:{id:e,data:n,lastUpdatedBy:d,sessionId:s,lastUpdate:u}},U=yield this.commonDbService.updateData({feature:"crdtData",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:a,skipFirestore:!0},data:D});return this.crdtActionsService.triggerAction(V.UPDATE_DATA,T),this.trackCrdtDataUpdated(e),this.updateDataWebhookTrigger$.next(T?.payload),this.trackEditForActivity(e),U}return Promise.resolve(null)}catch(c){return this.loggingService.catch("Error in CrdtService updateData: ",c),Promise.resolve(null)}})}triggerUpdateDataWebhook(e){try{this.updateNotificationsDatabase(e,Q.UPDATE_DATA)}catch(r){this.loggingService.catch("Error in CrdtService triggerUpdateDataWebhook: ",r)}}onDataChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onDataChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"crdtData",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(k(t=>v(this,null,function*(){try{if(t?.data){if(t.data.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.data.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.data.encryptedState,d)}t.data.state=s,delete t.data?.encryptedState}return t}else{if(t?.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.encryptedState,d)}t.state=s,delete t?.encryptedState}return t}}catch(s){return this.loggingService.catch("Error in CrdtService onDataChange subscription: ",s),null}}))):E(null))).subscribe(c=>{c&&(c.data?r(c.data):r(c))});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onDataChange: ",n),()=>{}}}getData(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getData","color: green;");let n=this.docService.getDocumentPaths();if(n){let i=p(e),c=yield this.commonDbService.getData({feature:"crdtData",properties:{documentId:n?.documentId??"",organizationId:n?.organizationId??"",id:i,skipFirestore:!0}});if(c?.encryptedState){let t=null,s=this.configService.getEncryptionProvider();if(s?.decrypt&&typeof s.decrypt=="function")t=yield s.decrypt({data:c.encryptedState});else{let a={};a.customKey=i,t=yield I.decryptData(c.encryptedState,a)}c.state=t,delete c?.encryptedState}return c}return Promise.resolve(null)}catch(n){return this.loggingService.catch("Error in CrdtService getData: ",n),Promise.resolve(null)}})}onStateChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onStateChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"crdtSyncState",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(k(t=>v(this,null,function*(){try{if(t?.data){if(t.data.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.data.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.data.encryptedState,d)}t.data.state=s,delete t.data?.encryptedState}return t}else{if(t?.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.encryptedState,d)}t.state=s,delete t?.encryptedState}return t}}catch(s){return this.loggingService.catch("Error in CrdtService onStateChange subscription: ",s),null}}))):E(null))).subscribe(c=>{c&&(c.data?r(c.data):r(c))});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onStateChange: ",n),()=>{}}}updateState(n){return v(this,arguments,function*({id:e,state:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateState","color: green;");let i=this.docService.getDocumentPaths(),c=this.authService.getUser(),t=this.domService.getTabId();if(c?.userId&&i){let s=p(e),a=c.userId,d=p(a),g=null,u=this.configService.getEncryptionProvider();if(u?.encrypt&&typeof u.encrypt=="function")g=yield u.encrypt({data:r});else{let m={};m.customKey=s,g=yield I.encryptData(r,m)}return this.commonDbService.setData({feature:"crdtSyncState",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:s,skipFirestore:!0},data:{id:e,veltId:s,encryptedState:g,lastUpdate:new Date().toISOString(),lastUpdatedBy:a,lastUpdatedByVeltUserId:d,sessionId:t}})}return Promise.resolve(null)}catch(i){return this.loggingService.catch("Error in CrdtService updateState: ",i),Promise.resolve(null)}})}registerSyncUser(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: registerSyncUser","color: green;");let n=this.authService.getUser(),i=this.docService.getDocumentPaths(),c=this.configService.getApiKey(),t=p(e),s=this.domService.getTabId();if(n?.userId&&i&&c){let a=n.userId,d=p(a),g={documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:t,userId:d,apiKey:c,skipFirestore:!0},u={userId:a,veltUserId:d,status:"online",lastSeen:Date.now(),sessionId:s};yield this.commonDbService.setData({feature:"crdtSyncPresence",properties:g,data:u});let m=this.commonDbUtilsService.getDocumentPath({feature:"crdtSyncPresence",properties:g,defaultDocumentPaths:i,apiKey:c});m&&(yield this.commonDbService.setupOnDisconnect(m,{status:"offline",lastSeen:new Date().getTime(),sessionId:s}))}}catch(n){this.loggingService.catch("Error in CrdtService registerSyncUser: ",n)}})}onRegisteredUserChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onRegisteredUserChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"allCrdtSyncPresence",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(W(t=>{try{t?.data?r(t.data):r(t)}catch(s){this.loggingService.catch("Error in CrdtService onRegisteredUserChange subscription: ",s)}})):E(null))).subscribe(()=>{});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onRegisteredUserChange: ",n),()=>{}}}setPresence(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: setPresence","color: green;");let n=this.authService.getUser(),i=this.docService.getDocumentPaths(),c=this.configService.getApiKey(),t=p(e),s=this.domService.getTabId();if(n?.userId&&i&&c){let a=n.userId,d=p(a),g={documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:t,userId:d,apiKey:c,skipFirestore:!0},u={userId:a,veltUserId:d,status:"online",lastSeen:Date.now(),sessionId:s};yield this.commonDbService.setData({feature:"crdtPresence",properties:g,data:u});let m=this.commonDbUtilsService.getDocumentPath({feature:"crdtPresence",properties:g,defaultDocumentPaths:i,apiKey:c});m&&(yield this.commonDbService.setupOnDisconnect(m,{status:"offline",lastSeen:new Date().getTime(),sessionId:s}))}}catch(n){this.loggingService.catch("Error in CrdtService setPresence: ",n)}})}onPresenceChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onPresenceChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"allCrdtPresence",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(W(t=>{try{t?.data?r(t.data):r(t)}catch(s){this.loggingService.catch("Error in CrdtService onPresenceChange subscription: ",s)}})):E(null))).subscribe(()=>{});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onPresenceChange: ",n),()=>{}}}saveVersion(c){return v(this,arguments,function*({id:e,versionId:r,versionName:n,state:i}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: saveVersion","color: green;");let t=this.docService.getDocumentPaths();if(t){let s=p(e),a="",d=this.configService.getEncryptionProvider();if(d?.encrypt&&typeof d.encrypt=="function")a=yield d.encrypt({data:i});else{let u={};u.customKey=s,a=yield I.encryptData(i,u)}let g={versionId:r,versionName:n,encryptedState:a,timestamp:new Date().getTime()};return this.commonDbService.setData({feature:"crdtVersion",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:s,versionId:r,skipFirestore:!0},data:w({id:e},g)})}return Promise.resolve(null)}catch(t){return this.loggingService.catch("Error in CrdtService saveVersion: ",t),Promise.resolve(null)}})}getVersion(n){return v(this,arguments,function*({id:e,versionId:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersion","color: green;");let i=this.docService.getDocumentPaths();if(i){let c=p(e),t=yield this.commonDbService.getData({feature:"crdtVersion",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,versionId:r,skipFirestore:!0}});if(t?.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.encryptedState});else{let d={};d.customKey=c,s=yield I.decryptData(t.encryptedState,d)}t.state=s,delete t.encryptedState}return t}return Promise.resolve(null)}catch(i){return this.loggingService.catch("Error in CrdtService getVersion: ",i),Promise.resolve(null)}})}getVersions(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersions","color: green;");let n=this.docService.getDocumentPaths();if(n){let i=p(e),c=yield this.commonDbService.getData({feature:"crdtVersions",properties:{documentId:n?.documentId??"",organizationId:n?.organizationId??"",id:i,skipFirestore:!0}}),t=null;if(c){t=[];for(let s of Object.values(c))if(s?.encryptedState){let a=null,d=this.configService.getEncryptionProvider();if(d?.decrypt&&typeof d.decrypt=="function")a=yield d.decrypt({data:s.encryptedState});else{let u={};u.customKey=i,a=yield I.decryptData(s.encryptedState,u)}let g=R(w({},s),{state:a});delete g?.encryptedState,t.push(g)}else t.push(s)}return t}return Promise.resolve(null)}catch(n){return this.loggingService.catch("Error in CrdtService getVersions: ",n),Promise.resolve(null)}})}encryptCrdtData(e,r){return v(this,null,function*(){try{let n=this.configService.getEncryptionProvider();if(n?.encrypt&&typeof n.encrypt=="function")return yield n.encrypt({data:e});let i={};return i.customKey=r,yield I.encryptData(e,i)}catch(n){return this.loggingService.catch("Error in CrdtService encryptCrdtData: ",n),null}})}decryptCrdtData(e,r){return v(this,null,function*(){try{let n=this.configService.getEncryptionProvider();if(n?.decrypt&&typeof n.decrypt=="function")return yield n.decrypt({data:e});let i={};return i.customKey=r,yield I.decryptData(e,i)}catch(n){return this.loggingService.catch("Error in CrdtService decryptCrdtData: ",n),null}})}pushMessage(d){return v(this,arguments,function*({id:e,data:r,yjsClientId:n,messageType:i,eventData:c,type:t,contentKey:s,source:a}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: pushMessage","color: green;");let g=this.docService.getDocumentPaths(),u=this.authService.getUser();if(u?.userId&&g){let m=p(e),C=yield this.encryptCrdtData(r,m);if(C==null)return;let D=u.userId,T=p(u.userId),U=this.domService.getTabId();if(yield this.commonDbService.pushData({feature:"crdtMessages",properties:{documentId:g?.documentId??"",organizationId:g?.organizationId??"",id:m,skipFirestore:!0},data:{id:e,veltId:m,encryptedData:C,yjsClientId:n,messageType:i??null,type:t??null,contentKey:s??null,source:a??"unknown",updatedByUserId:D,updatedByVeltUserId:T,sessionId:U,timestamp:this.commonDbService.getServerTimestamp()}}),i==="sync"){let N=new Date().toISOString(),L={methodName:j.UPDATE_DATA,uniqueId:z(),timestamp:new Date().getTime(),source:K.INTERNAL,payload:{id:e,data:c,lastUpdatedBy:D,sessionId:U,lastUpdate:N}};this.crdtActionsService.triggerAction(V.UPDATE_DATA,L),this.trackCrdtDataUpdated(e),this.updateDataWebhookTrigger$.next(L?.payload),this.trackEditForActivity(e)}}}catch(g){this.loggingService.catch("Error in CrdtService pushMessage: ",g)}})}onMessage({id:e,callback:r,afterTs:n}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onMessage","color: green;");let i=p(e),c=this.docService.getDocumentPaths$().pipe(k(t=>t?this.commonDbService.streamChildAdded({feature:"crdtMessages",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:i,skipFirestore:!0},afterTs:n}):E(null))).pipe(O(t=>!!t),$(t=>v(this,null,function*(){try{if(t.encryptedData){let s=yield this.decryptCrdtData(t.encryptedData,i);if(s==null)return null;t.data=s,delete t.encryptedData}else if(!t.data)return null;return t}catch(s){return this.loggingService.catch("Error in CrdtService onMessage decryption: ",s),null}})),O(t=>!!t)).subscribe(t=>{try{r(t)}catch(s){this.loggingService.catch("Error in CrdtService onMessage subscription: ",s)}});return()=>c.unsubscribe()}catch(i){return this.loggingService.catch("Error in CrdtService onMessage: ",i),()=>{}}}getMessages(n){return v(this,arguments,function*({id:e,afterTs:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getMessages","color: green;");let i=this.docService.getDocumentPaths();if(i){let c=p(e),t=yield this.commonDbService.getData({feature:"crdtMessages",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,skipFirestore:!0}});if(!t||typeof t!="object"||t?.errorCode)return[];let s=[];for(let a of Object.keys(t)){let d=t[a];if(!(!d||typeof d!="object")&&!(r!=null&&d.timestamp!=null&&d.timestamp<=r))if(d.encryptedData){let g=yield this.decryptCrdtData(d.encryptedData,c);if(g==null)continue;s.push({data:g,yjsClientId:d.yjsClientId,timestamp:d.timestamp})}else d.data&&s.push({data:d.data,yjsClientId:d.yjsClientId,timestamp:d.timestamp})}return s.sort((a,d)=>a.timestamp-d.timestamp),s}return[]}catch(i){return this.loggingService.catch("Error in CrdtService getMessages: ",i),[]}})}getSnapshot(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getSnapshot","color: green;");let n=this.docService.getDocumentPaths();if(n){let i=p(e),c=yield this.commonDbService.getData({feature:"crdtSnapshot",properties:{documentId:n?.documentId??"",organizationId:n?.organizationId??"",id:i,skipFirestore:!0}});if(!c||typeof c!="object"||Object.keys(c).length===0||c?.errorCode)return null;if(c?.encryptedState){let t=yield this.decryptCrdtData(c.encryptedState,i);if(t==null)return null;c.state=t,delete c?.encryptedState}if(c?.encryptedVector){let t=yield this.decryptCrdtData(c.encryptedVector,i);if(t==null)return null;c.vector=t,delete c?.encryptedVector}return c}return Promise.resolve(null)}catch(n){return this.loggingService.catch("Error in CrdtService getSnapshot: ",n),Promise.resolve(null)}})}saveSnapshot(s){return v(this,arguments,function*({id:e,state:r,vector:n,type:i,contentKey:c,source:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: saveSnapshot","color: green;");let a=this.docService.getDocumentPaths(),d=this.authService.getUser();if(d?.userId&&a){let g=p(e),u=yield this.encryptCrdtData(r,g),m=yield this.encryptCrdtData(n,g);if(u==null||m==null)return;let C=d.userId,D=p(d.userId),T=this.domService.getTabId();yield this.commonDbService.setData({feature:"crdtSnapshot",properties:{documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:g,skipFirestore:!0},data:{id:e,veltId:g,encryptedState:u,encryptedVector:m,type:i??null,contentKey:c??null,source:t??"unknown",updatedByUserId:C,updatedByVeltUserId:D,sessionId:T,timestamp:this.commonDbService.getServerTimestamp()}})}}catch(a){this.loggingService.catch("Error in CrdtService saveSnapshot: ",a)}})}pruneMessages(n){return v(this,arguments,function*({id:e,beforeTs:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: pruneMessages","color: green;");let i=this.docService.getDocumentPaths();if(i){let c=p(e),t=yield this.commonDbService.getData({feature:"crdtMessages",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,skipFirestore:!0}});if(t&&typeof t=="object"&&!t?.errorCode){let s=[];for(let a of Object.keys(t)){let d=t[a];d?.timestamp!=null&&d.timestamp<r&&s.push(this.commonDbService.deleteData({feature:"crdtMessage",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,messageId:a,skipFirestore:!0}}))}yield Promise.all(s)}}}catch(i){this.loggingService.catch("Error in CrdtService pruneMessages: ",i)}})}updateNotificationsDatabase(e,r,n={}){try{let i=w({crdtData:e,actionType:r,notificationSource:"crdt"},n);this.notificationService?.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in CrdtService updateNotificationsDatabase: ",i)}}enableWebhook(){try{if(this.webhookEnabled$.value===!0)return;this.webhookEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CrdtService enableWebhook: ",e)}}disableWebhook(){try{if(this.webhookEnabled$.value===!1)return;this.webhookEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CrdtService disableWebhook: ",e)}}trackEditForActivity(e){try{let r=this.editorEditTrackers.get(e);if(!r){let n=new P,i=n.pipe(M(this.activityDebounceTime)).subscribe(()=>{this.flushEditorActivity(e)});r={count:0,subject$:n,subscription:i},this.editorEditTrackers.set(e,r)}r.count++,r.subject$.next()}catch(r){this.loggingService.catch("Error in CrdtService trackEditForActivity: ",r)}}flushEditorActivity(e){try{let r=this.editorEditTrackers.get(e);if(!r||r.count===0)return;let n=r.count;r.count=0;let i={featureType:"crdt",actionType:X.EDITOR_EDIT,targetEntityId:e,entityData:{editCount:n}};this.activityService?.createActivity(i)}catch(r){this.loggingService.catch("Error in CrdtService flushEditorActivity: ",r)}}setActivityDebounceTime(e){try{e<this.MIN_ACTIVITY_DEBOUNCE_TIME&&(this.loggingService.catch("Error in CrdtService setActivityDebounceTime: Value must be at least "+this.MIN_ACTIVITY_DEBOUNCE_TIME/1e3+" seconds ("+this.MIN_ACTIVITY_DEBOUNCE_TIME+"ms). Using minimum value."),e=this.MIN_ACTIVITY_DEBOUNCE_TIME),this.flushAllEditorActivities(),this.activityDebounceTime=e}catch(r){this.loggingService.catch("Error in CrdtService setActivityDebounceTime: ",r)}}flushAllEditorActivities(){try{for(let[e,r]of this.editorEditTrackers)r.count>0&&this.flushEditorActivity(e),r.subject$.complete(),r.subscription.unsubscribe();this.editorEditTrackers.clear()}catch(e){this.loggingService.catch("Error in CrdtService flushAllEditorActivities: ",e)}}};o.\u0275fac=function(r){return new(r||o)(b(re),b(ne),b(ae),b(se),b(ie),b(F),b(oe),b(ce),b(h),b(A))},o.\u0275prov=_({token:o,factory:o.\u0275fac,providedIn:"root"});let y=o;return y})();var B=class extends de{constructor(o){super(o),this.getService(h).log("%c[WB] Creating CLASS: CrdtElement","color: blue;"),this.updateData=this._updateData,this.onDataChange=this._onDataChange,this.getData=this._getData,this.onStateChange=this._onStateChange,this.updateState=this._updateState,this.registerSyncUser=this._registerSyncUser,this.onRegisteredUserChange=this._onRegisteredUserChange,this.setPresence=this._setPresence,this.onPresenceChange=this._onPresenceChange,this.saveVersion=this._saveVersion,this.getVersion=this._getVersion,this.getVersions=this._getVersions,this.pushMessage=this._pushMessage,this.onMessage=this._onMessage,this.getMessages=this._getMessages,this.getSnapshot=this._getSnapshot,this.saveSnapshot=this._saveSnapshot,this.pruneMessages=this._pruneMessages,this.enableWebhook=this._enableWebhook,this.disableWebhook=this._disableWebhook,this.setWebhookDebounceTime=this._setWebhookDebounceTime,this.setActivityDebounceTime=this._setActivityDebounceTime,this.on=this._on}_updateData(o){this.getService(h).log("%c[WB] Calling FUNCTION: updateData","color: green;");try{return this.getService(S).updateData(o)}catch(l){return this.getService(h).catch("Error in updateData: ",l),Promise.resolve(null)}}_onDataChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onDataChange","color: green;");try{return this.getService(S).onDataChange(o)}catch(l){return this.getService(h).catch("Error in onDataChange: ",l),()=>{}}}_getData(o){this.getService(h).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.getService(S).getData(o)}catch(l){return this.getService(h).catch("Error in getData: ",l),Promise.resolve(null)}}_onStateChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onStateChange","color: green;");try{return this.getService(S).onStateChange(o)}catch(l){return this.getService(h).catch("Error in onStateChange: ",l),()=>{}}}_updateState(o){this.getService(h).log("%c[WB] Calling FUNCTION: updateState","color: green;");try{return this.getService(S).updateState(o)}catch(l){return this.getService(h).catch("Error in updateState: ",l),Promise.resolve(null)}}_registerSyncUser(o){this.getService(h).log("%c[WB] Calling FUNCTION: registerSyncUser","color: green;");try{return this.getService(S).registerSyncUser(o)}catch(l){return this.getService(h).catch("Error in registerSyncUser: ",l),Promise.resolve()}}_onRegisteredUserChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onRegisteredUserChange","color: green;");try{return this.getService(S).onRegisteredUserChange(o)}catch(l){return this.getService(h).catch("Error in onRegisteredUserChange: ",l),()=>{}}}_setPresence(o){this.getService(h).log("%c[WB] Calling FUNCTION: setPresence","color: green;");try{return this.getService(S).setPresence(o)}catch(l){return this.getService(h).catch("Error in setPresence: ",l),Promise.resolve()}}_onPresenceChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onPresenceChange","color: green;");try{return this.getService(S).onPresenceChange(o)}catch(l){return this.getService(h).catch("Error in onPresenceChange: ",l),()=>{}}}_saveVersion(o){this.getService(h).log("%c[WB] Calling FUNCTION: saveVersion","color: green;");try{return this.getService(S).saveVersion(o)}catch(l){return this.getService(h).catch("Error in saveVersion: ",l),Promise.resolve(null)}}_getVersion(o){this.getService(h).log("%c[WB] Calling FUNCTION: getVersion","color: green;");try{return this.getService(S).getVersion(o)}catch(l){return this.getService(h).catch("Error in getVersion: ",l),Promise.resolve(null)}}_getVersions(o){this.getService(h).log("%c[WB] Calling FUNCTION: getVersions","color: green;");try{return this.getService(S).getVersions(o)}catch(l){return this.getService(h).catch("Error in getVersions: ",l),Promise.resolve(null)}}_pushMessage(o){this.getService(h).log("%c[WB] Calling FUNCTION: pushMessage","color: green;");try{return this.getService(S).pushMessage(o)}catch(l){return this.getService(h).catch("Error in pushMessage: ",l),Promise.resolve()}}_onMessage(o){this.getService(h).log("%c[WB] Calling FUNCTION: onMessage","color: green;");try{return this.getService(S).onMessage(o)}catch(l){return this.getService(h).catch("Error in onMessage: ",l),()=>{}}}_getMessages(o){this.getService(h).log("%c[WB] Calling FUNCTION: getMessages","color: green;");try{return this.getService(S).getMessages(o)}catch(l){return this.getService(h).catch("Error in getMessages: ",l),Promise.resolve([])}}_getSnapshot(o){this.getService(h).log("%c[WB] Calling FUNCTION: getSnapshot","color: green;");try{return this.getService(S).getSnapshot(o)}catch(l){return this.getService(h).catch("Error in getSnapshot: ",l),Promise.resolve(null)}}_saveSnapshot(o){this.getService(h).log("%c[WB] Calling FUNCTION: saveSnapshot","color: green;");try{return this.getService(S).saveSnapshot(o)}catch(l){return this.getService(h).catch("Error in saveSnapshot: ",l),Promise.resolve()}}_pruneMessages(o){this.getService(h).log("%c[WB] Calling FUNCTION: pruneMessages","color: green;");try{return this.getService(S).pruneMessages(o)}catch(l){return this.getService(h).catch("Error in pruneMessages: ",l),Promise.resolve()}}_enableWebhook(){this.getService(h).log("%c[WB] Calling FUNCTION: enableWebhook","color: green;");try{return this.getService(S).enableWebhook()}catch(o){this.getService(h).catch("Error in enableWebhook: ",o);return}}_disableWebhook(){this.getService(h).log("%c[WB] Calling FUNCTION: disableWebhook","color: green;");try{return this.getService(S).disableWebhook()}catch(o){this.getService(h).catch("Error in disableWebhook: ",o);return}}_setWebhookDebounceTime(o){this.getService(h).log("%c[WB] Calling FUNCTION: setWebhookDebounceTime","color: green;");try{!isNaN(o)&&o>0?this.getService(S).setWebhookDebounceTime(o):this.getService(h).catch("Error in setWebhookDebounceTime: ","Provided value must be a positive number greater than zero.")}catch(l){this.getService(h).catch("Error in setWebhookDebounceTime: ",l)}}_setActivityDebounceTime(o){this.getService(h).log("%c[WB] Calling FUNCTION: setActivityDebounceTime","color: green;");try{!isNaN(o)&&o>=1e4?this.getService(S).setActivityDebounceTime(o):this.getService(h).catch("Error in setActivityDebounceTime: ","Provided value must be a number >= 10000ms (10 seconds).")}catch(l){this.getService(h).catch("Error in setActivityDebounceTime: ",l)}}_on(o){this.getService(h).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(F).onAction(o)}catch(l){return this.getService(h).catch("Error in on: ",l),E(null)}}};var ge=(()=>{let o=class o{};o.\u0275fac=function(r){return new(r||o)},o.\u0275mod=Y({type:o}),o.\u0275inj=x({imports:[q]});let y=o;return y})();function ve(y){return y.get(h).log("%c[WB] Loading CRDT feature chunk","color: blue;"),y.get(A).set(te,y.get(S)),G(ge,y),new B(y)}export{ve as default};
|
|
1
|
+
import{a as de}from"./chunk-G56O673H.js";import{$ as _,E as O,H as $,Hi as oe,I as M,Kh as Z,Lf as K,Mf as j,Pc as q,Pi as se,Qf as p,Qi as ae,T as k,Ta as G,Va as Y,Ve as X,W,Xe as f,a as w,aa as x,ag as z,b as R,ca as b,g as v,je as J,ji as ee,k as P,l as H,li as te,ni as A,oi as re,pi as h,qi as ie,r as E,ue as V,ui as ce,vi as ne,ye as Q}from"./chunk-TY3WZ4Q4.js";var F=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,r){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new P),this.actionSubjects.get(e)?.next(r)}catch(n){this.loggingService.catch("Error in CrdtActionsService triggerAction: ",n)}}onAction(e){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new P);let r=this.actionSubjects.get(e);return r?r.asObservable():E(null)}catch(r){return this.loggingService.catch("Error in CrdtActionsService onAction: ",r),E(null)}}};o.\u0275fac=function(r){return new(r||o)(b(h))},o.\u0275prov=_({token:o,factory:o.\u0275fac,providedIn:"root"});let y=o;return y})();var I=(()=>{let o=class o{static generateKey(){return v(this,null,function*(){try{return yield window.crypto.subtle.generateKey({name:"AES-GCM",length:this.KEY_LENGTH},!1,["encrypt","decrypt"])}catch(e){return f.catch("Failed to generate key: ",e),null}})}static deriveKeyFromPassword(e,r){return v(this,null,function*(){try{if(!r){let t=yield window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));r=new Uint8Array(t).slice(0,this.SALT_LENGTH)}let n=new TextEncoder().encode(e),i=yield window.crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits","deriveKey"]);return{key:yield window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:this.PBKDF2_ITERATIONS,hash:"SHA-256"},i,{name:"AES-GCM",length:this.KEY_LENGTH},!1,["encrypt","decrypt"]),salt:r}}catch(n){return f.catch("Failed to derive key from password: ",n),null}})}static resolveKey(e){return v(this,null,function*(){try{if(e.customKey){if(e.customKey instanceof CryptoKey)return{key:e.customKey};if(typeof e.customKey=="string"){let n=yield this.deriveKeyFromPassword(e.customKey,e.customSalt);if(!n)return f.catch("Failed to derive key from password"),null;let{key:i,salt:c}=n;return{key:i,salt:c}}}let r=yield this.generateKey();return r?{key:r}:(f.catch("Failed to generate key"),null)}catch(r){return f.catch("Failed to resolve key: ",r),null}})}static encrypt(n){return v(this,arguments,function*(e,r={}){try{if(r.customEncryptCallback)try{return yield r.customEncryptCallback(e)}catch(g){return f.catch("Custom encryption callback failed: ",g),""}let i=yield this.resolveKey(r);if(!i)return f.catch("Failed to resolve key"),"";let{key:c,salt:t}=i,s;if(r.customIV){if(r.customIV.length!==this.IV_LENGTH)return f.catch(`Custom IV must be exactly ${this.IV_LENGTH} bytes`),"";s=r.customIV}else s=window.crypto.getRandomValues(new Uint8Array(this.IV_LENGTH));let a=new TextEncoder().encode(e),d={name:"AES-GCM",iv:s,tagLength:128};r.additionalData&&(d.additionalData=r.additionalData);try{let g=yield window.crypto.subtle.encrypt(d,c,a),u=new Uint8Array(s.length+g.byteLength);u.set(s,0),u.set(new Uint8Array(g),s.length);let m=8192,C=[];for(let D=0;D<u.length;D+=m){let T=u.slice(D,Math.min(D+m,u.length)),U="";for(let N=0;N<T.length;N++)U+=String.fromCharCode(T[N]);C.push(U)}return btoa(C.join(""))}catch(g){return f.catch("Encryption failed: ",g),""}}catch(i){return f.catch("Failed to encrypt: ",i),null}})}static decrypt(n){return v(this,arguments,function*(e,r={}){try{if(r.customDecryptCallback)try{return yield r.customDecryptCallback(e)}catch(g){return f.catch("Custom decryption callback failed: ",g),""}let i=yield this.resolveKey(r);if(!i)return f.catch("Failed to resolve key"),"";let{key:c}=i,t=new Uint8Array(atob(e).split("").map(g=>g.charCodeAt(0)));if(t.length<this.IV_LENGTH)return f.catch("Invalid encrypted data: Too short"),"";let s;if(r.customIV){if(r.customIV.length!==this.IV_LENGTH)return f.catch(`Custom IV must be exactly ${this.IV_LENGTH} bytes`),"";s=r.customIV}else s=t.slice(0,this.IV_LENGTH);let a=t.slice(this.IV_LENGTH),d={name:"AES-GCM",iv:s,tagLength:128};r.additionalData&&(d.additionalData=r.additionalData);try{let g=yield window.crypto.subtle.decrypt(d,c,a);return new TextDecoder().decode(g)}catch(g){return f.catch("Decryption failed: ",g),""}}catch(i){return f.catch("Failed to decrypt: ",i),""}})}static encryptData(n){return v(this,arguments,function*(e,r={}){try{let i=JSON.stringify(e);return(yield this.encrypt(i,r))??""}catch(i){return f.catch("Failed to encrypt data: ",i),""}})}static decryptData(n){return v(this,arguments,function*(e,r={}){try{let i=yield this.decrypt(e,r);return JSON.parse(i)}catch(i){return f.catch("Failed to decrypt data: ",i),null}})}};o.IV_LENGTH=12,o.SALT_LENGTH=16,o.PBKDF2_ITERATIONS=1e5,o.KEY_LENGTH=256;let y=o;return y})();var S=(()=>{let o=class o{constructor(e,r,n,i,c,t,s,a,d,g){this.analyticsService=e,this.authService=r,this.commonDbService=n,this.commonDbUtilsService=i,this.configService=c,this.crdtActionsService=t,this.docService=s,this.domService=a,this.loggingService=d,this.serviceBook=g,this.MIN_WEBHOOK_DEBOUNCE_TIME=5*1e3,this.webhookDebounceTime=this.MIN_WEBHOOK_DEBOUNCE_TIME,this.updateDataWebhookTrigger$=new P,this.updateDataWebhookDebounceSubscription=null,this.pendingWebhookEvent=null,this.webhookEnabled$=new H(!1),this.lastCrdtDataUpdatedId=null,this.MIN_ACTIVITY_DEBOUNCE_TIME=10*1e3,this.activityDebounceTime=600*1e3,this.editorEditTrackers=new Map,this.activityService=null,this.notificationService=null;try{this.loggingService.log("%c[WB] Creating CLASS: CrdtService","color: blue;"),this.serviceBook.observe(ee).subscribe(u=>{this.activityService=u}),this.serviceBook.observe(Z).subscribe(u=>{this.notificationService=u}),this.setupUpdateDataWebhookDebounce(),this.docService.addPreDocumentIdChangeFunction("crdt-service",()=>(this.lastCrdtDataUpdatedId=null,Promise.resolve())),this.authService.addPreSignOutFuction("crdt-service",()=>(this.lastCrdtDataUpdatedId=null,Promise.resolve()))}catch(u){this.loggingService.catch("Error in CrdtService constructor: ",u)}}trackCrdtDataUpdated(e){try{if(this.lastCrdtDataUpdatedId===e)return;this.lastCrdtDataUpdatedId=e,this.analyticsService.trackEvent(J.Events.Crdt.CRDT_DATA_UPDATED,{id:e})}catch(r){this.loggingService.catch("Error in CrdtService trackCrdtDataUpdated: ",r)}}setupUpdateDataWebhookDebounce(){try{this.updateDataWebhookDebounceSubscription&&(this.updateDataWebhookDebounceSubscription.unsubscribe(),this.updateDataWebhookDebounceSubscription=null,this.pendingWebhookEvent=null),this.updateDataWebhookDebounceSubscription=this.updateDataWebhookTrigger$.pipe(W(e=>{this.pendingWebhookEvent=e}),M(this.webhookDebounceTime)).subscribe(e=>{this.pendingWebhookEvent=null,this.webhookEnabled$.value&&e&&this.triggerUpdateDataWebhook(e)},e=>{this.loggingService.catch("Error in CrdtService setupUpdateDataWebhookDebounce subscription: ",e)})}catch(e){this.loggingService.catch("Error in CrdtService setupUpdateDataWebhookDebounce: ",e)}}setWebhookDebounceTime(e){try{e<this.MIN_WEBHOOK_DEBOUNCE_TIME&&(this.loggingService.catch("Error in CrdtService setWebhookDebounceTime: Value must be at least "+this.MIN_WEBHOOK_DEBOUNCE_TIME/1e3+" seconds ("+this.MIN_WEBHOOK_DEBOUNCE_TIME+"ms). Using minimum value."),e=this.MIN_WEBHOOK_DEBOUNCE_TIME),this.pendingWebhookEvent&&this.webhookEnabled$.value&&(this.triggerUpdateDataWebhook(this.pendingWebhookEvent),this.pendingWebhookEvent=null),this.webhookDebounceTime=e,this.setupUpdateDataWebhookDebounce()}catch(r){this.loggingService.catch("Error in CrdtService setWebhookDebounceTime: ",r)}}updateData(i){return v(this,arguments,function*({id:e,state:r,data:n}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateData","color: green;");let c=this.docService.getDocumentPaths(),t=this.authService.getUser(),s=this.domService.getTabId();if(t?.userId&&c){let a=p(e),d=t.userId,g=p(t.userId),u=new Date().toISOString(),m=null,C=this.configService.getEncryptionProvider();if(C?.encrypt&&typeof C.encrypt=="function")m=yield C.encrypt({data:r});else{let N={};N.customKey=a,m=yield I.encryptData(r,N)}let D={id:e,veltId:a,encryptedState:m,lastUpdate:u,lastUpdatedBy:d,lastUpdatedByVeltUserId:g,sessionId:s},T={methodName:j.UPDATE_DATA,uniqueId:z(),timestamp:new Date().getTime(),source:K.INTERNAL,payload:{id:e,data:n,lastUpdatedBy:d,sessionId:s,lastUpdate:u}},U=yield this.commonDbService.updateData({feature:"crdtData",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:a,skipFirestore:!0},data:D});return this.crdtActionsService.triggerAction(V.UPDATE_DATA,T),this.trackCrdtDataUpdated(e),this.updateDataWebhookTrigger$.next(T?.payload),this.trackEditForActivity(e),U}return Promise.resolve(null)}catch(c){return this.loggingService.catch("Error in CrdtService updateData: ",c),Promise.resolve(null)}})}triggerUpdateDataWebhook(e){try{this.updateNotificationsDatabase(e,Q.UPDATE_DATA)}catch(r){this.loggingService.catch("Error in CrdtService triggerUpdateDataWebhook: ",r)}}onDataChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onDataChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"crdtData",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(k(t=>v(this,null,function*(){try{if(t?.data){if(t.data.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.data.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.data.encryptedState,d)}t.data.state=s,delete t.data?.encryptedState}return t}else{if(t?.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.encryptedState,d)}t.state=s,delete t?.encryptedState}return t}}catch(s){return this.loggingService.catch("Error in CrdtService onDataChange subscription: ",s),null}}))):E(null))).subscribe(c=>{c&&(c.data?r(c.data):r(c))});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onDataChange: ",n),()=>{}}}getData(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getData","color: green;");let n=this.docService.getDocumentPaths();if(n){let i=p(e),c=yield this.commonDbService.getData({feature:"crdtData",properties:{documentId:n?.documentId??"",organizationId:n?.organizationId??"",id:i,skipFirestore:!0}});if(c?.encryptedState){let t=null,s=this.configService.getEncryptionProvider();if(s?.decrypt&&typeof s.decrypt=="function")t=yield s.decrypt({data:c.encryptedState});else{let a={};a.customKey=i,t=yield I.decryptData(c.encryptedState,a)}c.state=t,delete c?.encryptedState}return c}return Promise.resolve(null)}catch(n){return this.loggingService.catch("Error in CrdtService getData: ",n),Promise.resolve(null)}})}onStateChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onStateChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"crdtSyncState",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(k(t=>v(this,null,function*(){try{if(t?.data){if(t.data.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.data.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.data.encryptedState,d)}t.data.state=s,delete t.data?.encryptedState}return t}else{if(t?.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.encryptedState});else{let d={};d.customKey=n,s=yield I.decryptData(t.encryptedState,d)}t.state=s,delete t?.encryptedState}return t}}catch(s){return this.loggingService.catch("Error in CrdtService onStateChange subscription: ",s),null}}))):E(null))).subscribe(c=>{c&&(c.data?r(c.data):r(c))});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onStateChange: ",n),()=>{}}}updateState(n){return v(this,arguments,function*({id:e,state:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateState","color: green;");let i=this.docService.getDocumentPaths(),c=this.authService.getUser(),t=this.domService.getTabId();if(c?.userId&&i){let s=p(e),a=c.userId,d=p(a),g=null,u=this.configService.getEncryptionProvider();if(u?.encrypt&&typeof u.encrypt=="function")g=yield u.encrypt({data:r});else{let m={};m.customKey=s,g=yield I.encryptData(r,m)}return this.commonDbService.setData({feature:"crdtSyncState",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:s,skipFirestore:!0},data:{id:e,veltId:s,encryptedState:g,lastUpdate:new Date().toISOString(),lastUpdatedBy:a,lastUpdatedByVeltUserId:d,sessionId:t}})}return Promise.resolve(null)}catch(i){return this.loggingService.catch("Error in CrdtService updateState: ",i),Promise.resolve(null)}})}registerSyncUser(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: registerSyncUser","color: green;");let n=this.authService.getUser(),i=this.docService.getDocumentPaths(),c=this.configService.getApiKey(),t=p(e),s=this.domService.getTabId();if(n?.userId&&i&&c){let a=n.userId,d=p(a),g={documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:t,userId:d,apiKey:c,skipFirestore:!0},u={userId:a,veltUserId:d,status:"online",lastSeen:Date.now(),sessionId:s};yield this.commonDbService.setData({feature:"crdtSyncPresence",properties:g,data:u});let m=this.commonDbUtilsService.getDocumentPath({feature:"crdtSyncPresence",properties:g,defaultDocumentPaths:i,apiKey:c});m&&(yield this.commonDbService.setupOnDisconnect(m,{status:"offline",lastSeen:new Date().getTime(),sessionId:s}))}}catch(n){this.loggingService.catch("Error in CrdtService registerSyncUser: ",n)}})}onRegisteredUserChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onRegisteredUserChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"allCrdtSyncPresence",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(W(t=>{try{t?.data?r(t.data):r(t)}catch(s){this.loggingService.catch("Error in CrdtService onRegisteredUserChange subscription: ",s)}})):E(null))).subscribe(()=>{});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onRegisteredUserChange: ",n),()=>{}}}setPresence(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: setPresence","color: green;");let n=this.authService.getUser(),i=this.docService.getDocumentPaths(),c=this.configService.getApiKey(),t=p(e),s=this.domService.getTabId();if(n?.userId&&i&&c){let a=n.userId,d=p(a),g={documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:t,userId:d,apiKey:c,skipFirestore:!0},u={userId:a,veltUserId:d,status:"online",lastSeen:Date.now(),sessionId:s};yield this.commonDbService.setData({feature:"crdtPresence",properties:g,data:u});let m=this.commonDbUtilsService.getDocumentPath({feature:"crdtPresence",properties:g,defaultDocumentPaths:i,apiKey:c});m&&(yield this.commonDbService.setupOnDisconnect(m,{status:"offline",lastSeen:new Date().getTime(),sessionId:s}))}}catch(n){this.loggingService.catch("Error in CrdtService setPresence: ",n)}})}onPresenceChange({id:e,callback:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onPresenceChange","color: green;");let n=p(e),i=this.docService.getDocumentPaths$().pipe(k(c=>c?this.commonDbService.dbListener({feature:"allCrdtPresence",properties:{documentId:c?.documentId??"",organizationId:c?.organizationId??"",id:n,skipFirestore:!0}}).pipe(W(t=>{try{t?.data?r(t.data):r(t)}catch(s){this.loggingService.catch("Error in CrdtService onPresenceChange subscription: ",s)}})):E(null))).subscribe(()=>{});return()=>i.unsubscribe()}catch(n){return this.loggingService.catch("Error in CrdtService onPresenceChange: ",n),()=>{}}}saveVersion(c){return v(this,arguments,function*({id:e,versionId:r,versionName:n,state:i}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: saveVersion","color: green;");let t=this.docService.getDocumentPaths();if(t){let s=p(e),a="",d=this.configService.getEncryptionProvider();if(d?.encrypt&&typeof d.encrypt=="function")a=yield d.encrypt({data:i});else{let u={};u.customKey=s,a=yield I.encryptData(i,u)}let g={versionId:r,versionName:n,encryptedState:a,timestamp:new Date().getTime()};return this.commonDbService.setData({feature:"crdtVersion",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:s,versionId:r,skipFirestore:!0},data:w({id:e},g)})}return Promise.resolve(null)}catch(t){return this.loggingService.catch("Error in CrdtService saveVersion: ",t),Promise.resolve(null)}})}getVersion(n){return v(this,arguments,function*({id:e,versionId:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersion","color: green;");let i=this.docService.getDocumentPaths();if(i){let c=p(e),t=yield this.commonDbService.getData({feature:"crdtVersion",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,versionId:r,skipFirestore:!0}});if(t?.encryptedState){let s=null,a=this.configService.getEncryptionProvider();if(a?.decrypt&&typeof a.decrypt=="function")s=yield a.decrypt({data:t.encryptedState});else{let d={};d.customKey=c,s=yield I.decryptData(t.encryptedState,d)}t.state=s,delete t.encryptedState}return t}return Promise.resolve(null)}catch(i){return this.loggingService.catch("Error in CrdtService getVersion: ",i),Promise.resolve(null)}})}getVersions(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersions","color: green;");let n=this.docService.getDocumentPaths();if(n){let i=p(e),c=yield this.commonDbService.getData({feature:"crdtVersions",properties:{documentId:n?.documentId??"",organizationId:n?.organizationId??"",id:i,skipFirestore:!0}}),t=null;if(c){t=[];for(let s of Object.values(c))if(s?.encryptedState){let a=null,d=this.configService.getEncryptionProvider();if(d?.decrypt&&typeof d.decrypt=="function")a=yield d.decrypt({data:s.encryptedState});else{let u={};u.customKey=i,a=yield I.decryptData(s.encryptedState,u)}let g=R(w({},s),{state:a});delete g?.encryptedState,t.push(g)}else t.push(s)}return t}return Promise.resolve(null)}catch(n){return this.loggingService.catch("Error in CrdtService getVersions: ",n),Promise.resolve(null)}})}encryptCrdtData(e,r){return v(this,null,function*(){try{let n=this.configService.getEncryptionProvider();if(n?.encrypt&&typeof n.encrypt=="function")return yield n.encrypt({data:e});let i={};return i.customKey=r,yield I.encryptData(e,i)}catch(n){return this.loggingService.catch("Error in CrdtService encryptCrdtData: ",n),null}})}decryptCrdtData(e,r){return v(this,null,function*(){try{let n=this.configService.getEncryptionProvider();if(n?.decrypt&&typeof n.decrypt=="function")return yield n.decrypt({data:e});let i={};return i.customKey=r,yield I.decryptData(e,i)}catch(n){return this.loggingService.catch("Error in CrdtService decryptCrdtData: ",n),null}})}pushMessage(d){return v(this,arguments,function*({id:e,data:r,yjsClientId:n,messageType:i,eventData:c,type:t,contentKey:s,source:a}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: pushMessage","color: green;");let g=this.docService.getDocumentPaths(),u=this.authService.getUser();if(u?.userId&&g){let m=p(e),C=yield this.encryptCrdtData(r,m);if(C==null)return;let D=u.userId,T=p(u.userId),U=this.domService.getTabId();if(yield this.commonDbService.pushData({feature:"crdtMessages",properties:{documentId:g?.documentId??"",organizationId:g?.organizationId??"",id:m,skipFirestore:!0},data:{id:e,veltId:m,encryptedData:C,yjsClientId:n,messageType:i??null,type:t??null,contentKey:s??null,source:a??"unknown",updatedByUserId:D,updatedByVeltUserId:T,sessionId:U,timestamp:this.commonDbService.getServerTimestamp()}}),i==="sync"){let N=new Date().toISOString(),L={methodName:j.UPDATE_DATA,uniqueId:z(),timestamp:new Date().getTime(),source:K.INTERNAL,payload:{id:e,data:c,lastUpdatedBy:D,sessionId:U,lastUpdate:N}};this.crdtActionsService.triggerAction(V.UPDATE_DATA,L),this.trackCrdtDataUpdated(e),this.updateDataWebhookTrigger$.next(L?.payload),this.trackEditForActivity(e)}}}catch(g){this.loggingService.catch("Error in CrdtService pushMessage: ",g)}})}onMessage({id:e,callback:r,afterTs:n}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onMessage","color: green;");let i=p(e),c=this.docService.getDocumentPaths$().pipe(k(t=>t?this.commonDbService.streamChildAdded({feature:"crdtMessages",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:i,skipFirestore:!0},afterTs:n}):E(null))).pipe(O(t=>!!t),$(t=>v(this,null,function*(){try{if(t.encryptedData){let s=yield this.decryptCrdtData(t.encryptedData,i);if(s==null)return null;t.data=s,delete t.encryptedData}else if(!t.data)return null;return t}catch(s){return this.loggingService.catch("Error in CrdtService onMessage decryption: ",s),null}})),O(t=>!!t)).subscribe(t=>{try{r(t)}catch(s){this.loggingService.catch("Error in CrdtService onMessage subscription: ",s)}});return()=>c.unsubscribe()}catch(i){return this.loggingService.catch("Error in CrdtService onMessage: ",i),()=>{}}}getMessages(n){return v(this,arguments,function*({id:e,afterTs:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getMessages","color: green;");let i=this.docService.getDocumentPaths();if(i){let c=p(e),t=yield this.commonDbService.getData({feature:"crdtMessages",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,skipFirestore:!0}});if(!t||typeof t!="object"||t?.errorCode)return[];let s=[];for(let a of Object.keys(t)){let d=t[a];if(!(!d||typeof d!="object")&&!(r!=null&&d.timestamp!=null&&d.timestamp<=r))if(d.encryptedData){let g=yield this.decryptCrdtData(d.encryptedData,c);if(g==null)continue;s.push({data:g,yjsClientId:d.yjsClientId,timestamp:d.timestamp})}else d.data&&s.push({data:d.data,yjsClientId:d.yjsClientId,timestamp:d.timestamp})}return s.sort((a,d)=>a.timestamp-d.timestamp),s}return[]}catch(i){return this.loggingService.catch("Error in CrdtService getMessages: ",i),[]}})}getSnapshot(r){return v(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getSnapshot","color: green;");let n=this.docService.getDocumentPaths();if(n){let i=p(e),c=yield this.commonDbService.getData({feature:"crdtSnapshot",properties:{documentId:n?.documentId??"",organizationId:n?.organizationId??"",id:i,skipFirestore:!0}});if(!c||typeof c!="object"||Object.keys(c).length===0||c?.errorCode)return null;if(c?.encryptedState){let t=yield this.decryptCrdtData(c.encryptedState,i);if(t==null)return null;c.state=t,delete c?.encryptedState}if(c?.encryptedVector){let t=yield this.decryptCrdtData(c.encryptedVector,i);if(t==null)return null;c.vector=t,delete c?.encryptedVector}return c}return Promise.resolve(null)}catch(n){return this.loggingService.catch("Error in CrdtService getSnapshot: ",n),Promise.resolve(null)}})}saveSnapshot(s){return v(this,arguments,function*({id:e,state:r,vector:n,type:i,contentKey:c,source:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: saveSnapshot","color: green;");let a=this.docService.getDocumentPaths(),d=this.authService.getUser();if(d?.userId&&a){let g=p(e),u=yield this.encryptCrdtData(r,g),m=yield this.encryptCrdtData(n,g);if(u==null||m==null)return;let C=d.userId,D=p(d.userId),T=this.domService.getTabId();yield this.commonDbService.setData({feature:"crdtSnapshot",properties:{documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:g,skipFirestore:!0},data:{id:e,veltId:g,encryptedState:u,encryptedVector:m,type:i??null,contentKey:c??null,source:t??"unknown",updatedByUserId:C,updatedByVeltUserId:D,sessionId:T,timestamp:this.commonDbService.getServerTimestamp()}})}}catch(a){this.loggingService.catch("Error in CrdtService saveSnapshot: ",a)}})}pruneMessages(n){return v(this,arguments,function*({id:e,beforeTs:r}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: pruneMessages","color: green;");let i=this.docService.getDocumentPaths();if(i){let c=p(e),t=yield this.commonDbService.getData({feature:"crdtMessages",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,skipFirestore:!0}});if(t&&typeof t=="object"&&!t?.errorCode){let s=[];for(let a of Object.keys(t)){let d=t[a];d?.timestamp!=null&&d.timestamp<r&&s.push(this.commonDbService.deleteData({feature:"crdtMessage",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:c,messageId:a,skipFirestore:!0}}))}yield Promise.all(s)}}}catch(i){this.loggingService.catch("Error in CrdtService pruneMessages: ",i)}})}updateNotificationsDatabase(e,r,n={}){try{let i=w({crdtData:e,actionType:r,notificationSource:"crdt"},n);this.notificationService?.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in CrdtService updateNotificationsDatabase: ",i)}}enableWebhook(){try{if(this.webhookEnabled$.value===!0)return;this.webhookEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CrdtService enableWebhook: ",e)}}disableWebhook(){try{if(this.webhookEnabled$.value===!1)return;this.webhookEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CrdtService disableWebhook: ",e)}}trackEditForActivity(e){try{let r=this.editorEditTrackers.get(e);if(!r){let n=new P,i=n.pipe(M(this.activityDebounceTime)).subscribe(()=>{this.flushEditorActivity(e)});r={count:0,subject$:n,subscription:i},this.editorEditTrackers.set(e,r)}r.count++,r.subject$.next()}catch(r){this.loggingService.catch("Error in CrdtService trackEditForActivity: ",r)}}flushEditorActivity(e){try{let r=this.editorEditTrackers.get(e);if(!r||r.count===0)return;let n=r.count;r.count=0;let i={featureType:"crdt",actionType:X.EDITOR_EDIT,targetEntityId:e,entityData:{editCount:n}};this.activityService?.createActivity(i)}catch(r){this.loggingService.catch("Error in CrdtService flushEditorActivity: ",r)}}setActivityDebounceTime(e){try{e<this.MIN_ACTIVITY_DEBOUNCE_TIME&&(this.loggingService.catch("Error in CrdtService setActivityDebounceTime: Value must be at least "+this.MIN_ACTIVITY_DEBOUNCE_TIME/1e3+" seconds ("+this.MIN_ACTIVITY_DEBOUNCE_TIME+"ms). Using minimum value."),e=this.MIN_ACTIVITY_DEBOUNCE_TIME),this.flushAllEditorActivities(),this.activityDebounceTime=e}catch(r){this.loggingService.catch("Error in CrdtService setActivityDebounceTime: ",r)}}flushAllEditorActivities(){try{for(let[e,r]of this.editorEditTrackers)r.count>0&&this.flushEditorActivity(e),r.subject$.complete(),r.subscription.unsubscribe();this.editorEditTrackers.clear()}catch(e){this.loggingService.catch("Error in CrdtService flushAllEditorActivities: ",e)}}};o.\u0275fac=function(r){return new(r||o)(b(re),b(ne),b(ae),b(se),b(ie),b(F),b(oe),b(ce),b(h),b(A))},o.\u0275prov=_({token:o,factory:o.\u0275fac,providedIn:"root"});let y=o;return y})();var B=class extends de{constructor(o){super(o),this.getService(h).log("%c[WB] Creating CLASS: CrdtElement","color: blue;"),this.updateData=this._updateData,this.onDataChange=this._onDataChange,this.getData=this._getData,this.onStateChange=this._onStateChange,this.updateState=this._updateState,this.registerSyncUser=this._registerSyncUser,this.onRegisteredUserChange=this._onRegisteredUserChange,this.setPresence=this._setPresence,this.onPresenceChange=this._onPresenceChange,this.saveVersion=this._saveVersion,this.getVersion=this._getVersion,this.getVersions=this._getVersions,this.pushMessage=this._pushMessage,this.onMessage=this._onMessage,this.getMessages=this._getMessages,this.getSnapshot=this._getSnapshot,this.saveSnapshot=this._saveSnapshot,this.pruneMessages=this._pruneMessages,this.enableWebhook=this._enableWebhook,this.disableWebhook=this._disableWebhook,this.setWebhookDebounceTime=this._setWebhookDebounceTime,this.setActivityDebounceTime=this._setActivityDebounceTime,this.on=this._on}_updateData(o){this.getService(h).log("%c[WB] Calling FUNCTION: updateData","color: green;");try{return this.getService(S).updateData(o)}catch(l){return this.getService(h).catch("Error in updateData: ",l),Promise.resolve(null)}}_onDataChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onDataChange","color: green;");try{return this.getService(S).onDataChange(o)}catch(l){return this.getService(h).catch("Error in onDataChange: ",l),()=>{}}}_getData(o){this.getService(h).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.getService(S).getData(o)}catch(l){return this.getService(h).catch("Error in getData: ",l),Promise.resolve(null)}}_onStateChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onStateChange","color: green;");try{return this.getService(S).onStateChange(o)}catch(l){return this.getService(h).catch("Error in onStateChange: ",l),()=>{}}}_updateState(o){this.getService(h).log("%c[WB] Calling FUNCTION: updateState","color: green;");try{return this.getService(S).updateState(o)}catch(l){return this.getService(h).catch("Error in updateState: ",l),Promise.resolve(null)}}_registerSyncUser(o){this.getService(h).log("%c[WB] Calling FUNCTION: registerSyncUser","color: green;");try{return this.getService(S).registerSyncUser(o)}catch(l){return this.getService(h).catch("Error in registerSyncUser: ",l),Promise.resolve()}}_onRegisteredUserChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onRegisteredUserChange","color: green;");try{return this.getService(S).onRegisteredUserChange(o)}catch(l){return this.getService(h).catch("Error in onRegisteredUserChange: ",l),()=>{}}}_setPresence(o){this.getService(h).log("%c[WB] Calling FUNCTION: setPresence","color: green;");try{return this.getService(S).setPresence(o)}catch(l){return this.getService(h).catch("Error in setPresence: ",l),Promise.resolve()}}_onPresenceChange(o){this.getService(h).log("%c[WB] Calling FUNCTION: onPresenceChange","color: green;");try{return this.getService(S).onPresenceChange(o)}catch(l){return this.getService(h).catch("Error in onPresenceChange: ",l),()=>{}}}_saveVersion(o){this.getService(h).log("%c[WB] Calling FUNCTION: saveVersion","color: green;");try{return this.getService(S).saveVersion(o)}catch(l){return this.getService(h).catch("Error in saveVersion: ",l),Promise.resolve(null)}}_getVersion(o){this.getService(h).log("%c[WB] Calling FUNCTION: getVersion","color: green;");try{return this.getService(S).getVersion(o)}catch(l){return this.getService(h).catch("Error in getVersion: ",l),Promise.resolve(null)}}_getVersions(o){this.getService(h).log("%c[WB] Calling FUNCTION: getVersions","color: green;");try{return this.getService(S).getVersions(o)}catch(l){return this.getService(h).catch("Error in getVersions: ",l),Promise.resolve(null)}}_pushMessage(o){this.getService(h).log("%c[WB] Calling FUNCTION: pushMessage","color: green;");try{return this.getService(S).pushMessage(o)}catch(l){return this.getService(h).catch("Error in pushMessage: ",l),Promise.resolve()}}_onMessage(o){this.getService(h).log("%c[WB] Calling FUNCTION: onMessage","color: green;");try{return this.getService(S).onMessage(o)}catch(l){return this.getService(h).catch("Error in onMessage: ",l),()=>{}}}_getMessages(o){this.getService(h).log("%c[WB] Calling FUNCTION: getMessages","color: green;");try{return this.getService(S).getMessages(o)}catch(l){return this.getService(h).catch("Error in getMessages: ",l),Promise.resolve([])}}_getSnapshot(o){this.getService(h).log("%c[WB] Calling FUNCTION: getSnapshot","color: green;");try{return this.getService(S).getSnapshot(o)}catch(l){return this.getService(h).catch("Error in getSnapshot: ",l),Promise.resolve(null)}}_saveSnapshot(o){this.getService(h).log("%c[WB] Calling FUNCTION: saveSnapshot","color: green;");try{return this.getService(S).saveSnapshot(o)}catch(l){return this.getService(h).catch("Error in saveSnapshot: ",l),Promise.resolve()}}_pruneMessages(o){this.getService(h).log("%c[WB] Calling FUNCTION: pruneMessages","color: green;");try{return this.getService(S).pruneMessages(o)}catch(l){return this.getService(h).catch("Error in pruneMessages: ",l),Promise.resolve()}}_enableWebhook(){this.getService(h).log("%c[WB] Calling FUNCTION: enableWebhook","color: green;");try{return this.getService(S).enableWebhook()}catch(o){this.getService(h).catch("Error in enableWebhook: ",o);return}}_disableWebhook(){this.getService(h).log("%c[WB] Calling FUNCTION: disableWebhook","color: green;");try{return this.getService(S).disableWebhook()}catch(o){this.getService(h).catch("Error in disableWebhook: ",o);return}}_setWebhookDebounceTime(o){this.getService(h).log("%c[WB] Calling FUNCTION: setWebhookDebounceTime","color: green;");try{!isNaN(o)&&o>0?this.getService(S).setWebhookDebounceTime(o):this.getService(h).catch("Error in setWebhookDebounceTime: ","Provided value must be a positive number greater than zero.")}catch(l){this.getService(h).catch("Error in setWebhookDebounceTime: ",l)}}_setActivityDebounceTime(o){this.getService(h).log("%c[WB] Calling FUNCTION: setActivityDebounceTime","color: green;");try{!isNaN(o)&&o>=1e4?this.getService(S).setActivityDebounceTime(o):this.getService(h).catch("Error in setActivityDebounceTime: ","Provided value must be a number >= 10000ms (10 seconds).")}catch(l){this.getService(h).catch("Error in setActivityDebounceTime: ",l)}}_on(o){this.getService(h).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(F).onAction(o)}catch(l){return this.getService(h).catch("Error in on: ",l),E(null)}}};var ge=(()=>{let o=class o{};o.\u0275fac=function(r){return new(r||o)},o.\u0275mod=Y({type:o}),o.\u0275inj=x({imports:[q]});let y=o;return y})();function ve(y){return y.get(h).log("%c[WB] Loading CRDT feature chunk","color: blue;"),y.get(A).set(te,y.get(S)),G(ge,y),new B(y)}export{ve as default};
|
package/velt-cursor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as U,B as T,y as Dt}from"./chunk-4RKIO2W6.js";import{a as Ot}from"./chunk-NM7DOIHZ.js";import{b as Me,c as ke,d as Ne}from"./chunk-62IPFSNC.js";import{a as Tt}from"./chunk-EJCDV3ZL.js";import{a as Ut}from"./chunk-XQKUJSNO.js";import{a as ct}from"./chunk-ZOM7FOLY.js";import{da as h,ea as Pt,fa as R,ga as At}from"./chunk-GG5L5Y4V.js";import{$ as Se,$e as pt,$f as gt,Ab as ye,Bb as be,Ca as Ze,Ci as bt,Dd as lt,De as q,E as H,Fa as l,Fc as at,G as je,Ga as Ve,Gc as A,Gd as We,Hd as ut,Hi as It,Ib as it,Ii as xt,J as He,Jb as $,Kb as Z,L as Je,M as ze,Nb as Ie,Nh as Ae,Oh as De,Pa as m,Pb as xe,Pc as st,Ph as _t,Qi as Et,Sh as K,T as I,Ta as et,Te as y,Ua as O,Ud as mt,Va as tt,W as ce,X as Ye,Ya as D,_a as u,_b as N,_d as dt,a as g,aa as qe,ag as vt,b as f,bc as C,bg as ht,ca as L,cc as x,db as P,ec as F,eh as ft,fh as Ct,g as ae,gh as St,ha as Ke,ia as Xe,ja as $e,je as oe,kc as Ee,kf as Pe,l as se,lb as a,lc as Oe,mb as _,nb as b,ni as G,ob as k,oi as Ue,p as ie,pc as ot,pi as v,qa as _e,qi as yt,r as B,sb as d,tb as p,ua as Qe,ui as Te,v as j,vb as rt,vi as we,wa as E,xb as nt,zb as c}from"./chunk-3HVKHN3C.js";var ee=(()=>{let i=class i{constructor(e,t,o,s,S,M,re,ne,Le,Wt,Gt){this.analyticsService=e,this.configService=t,this.docService=o,this.afAuth=s,this.iamService=S,this.domService=M,this.databaseService=re,this.authService=ne,this.loggingService=Le,this.commonDbService=Wt,this.serviceBook=Gt,this.cursorUser$=new se(new Pe),this.documentPaths=null,this.inactivityTime=120*1e3,this.allowedElementIds$=new se([]),this.cursorTagAvailable$=new se(!1),this.cursorTagAvailable=!1,this.cursorUsers$=new se([]),this.loggingService.log("%c[WB] Creating CLASS: CursorService","color: blue;");try{this.serviceBook.set(Ae,this),this.checkCursorTagAvailable(),this.databaseService.getDb().pipe(H(W=>!!W),I(W=>this.cursorTagAvailable$.pipe(H(Y=>!!Y),He(1),j(()=>W))),He(1)).subscribe(W=>{W&&this.cursorTagAvailable&&(this.getPresenceUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnDatabaseDisconnect().subscribe(()=>{},Y=>{this.loggingService.catch("Error in CursorService constructor updateOnDatabaseDisconnect: ",Y)}),this.addMouseMoveListener(),this.addScreenSizeChangeListener(),this.updateOnAllowedFeatureListChange())},W=>{this.loggingService.catch("Error in CursorService constructor getDb: ",W)}),this.cursorUsers$.pipe(ze()).subscribe(([W,Y])=>{sessionStorage.getItem(y.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED)||Y?.length>1&&W.length!==Y.length&&(this.analyticsService.trackEvent(oe.Events.Cursor.CURSOR_MULTIPLE_USERS_DETECTED,{totalUsers:Y.length,cursorSnippylyUserIds:Y.map(Be=>Be.userSnippylyId),cursorClientUserIds:Y.map(Be=>Be.userId)}),sessionStorage.setItem(y.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED,"true"))}),this.authService.addPreSignOutFuction("cursor-signout",this.signOutUser.bind(this))}catch(W){this.loggingService.catch("Error in CursorService constructor: ",W)}}checkCursorTagAvailable(){this.loggingService.log("%c[WB] Calling FUNCTION: checkCursorTagAvailable","color: green;");try{this.cursorTagAvailable=!!document.querySelector(y.TAGS.VELT_CURSOR)||!!document.querySelector(y.TAGS.SNIPPYLY_CURSOR),this.cursorTagAvailable$.next(this.cursorTagAvailable)}catch(e){this.loggingService.catch("Error in CursorService checkCursorTagAvailable: ",e)}}addScreenSizeChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addScreenSizeChangeListener","color: green;");try{this.docService.getDocumentPaths$().pipe(H(e=>!!e),I(e=>this.domService.getCurrentWindowSize$("CursorService addScreenSizeChangeListener").pipe(H(t=>!!t)))).subscribe(e=>{this.setCurrentCursorUserScreenSize(e)},e=>{this.loggingService.catch("Error in addScreenSizeChangeListener getCurrentWindowSize: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addScreenSizeChangeListener: ",e)}}addMouseMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addMouseMoveListener","color: green;");try{this.domService.onWindowPointerMove$().pipe(Ye(50)).subscribe(e=>{e&&this.setCurrentCursorUserPosition(e.pageX,e.pageY,this.domService.getTargetElementForCursorPosition(e,!0,!1,!1,void 0,!1))},e=>{this.loggingService.catch("Error in addMouseMoveListener getCurrentMousePosition: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addMouseMoveListener: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;");try{this.docService.getDocumentPaths$().pipe(ce(e=>{this.documentPaths=e}),ze(),ce(([e,t])=>{e&&this.updateUserStatusOnDocumentChange(y.PRESENCE_STATUS_OFFLINE,e),t&&this.updateUserStatusOnDocumentChange(y.PRESENCE_STATUS_ONLINE,t)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getDocumentPaths: ",e)}}getLocation(){try{this.docService.getLocation$().pipe(ce(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getLocation: ",e)}}getCursorUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCursorUser","color: green;"),this.cursorUser$.asObservable()}getPresenceUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.serviceBook.observe(_t).pipe(H(e=>!!e),I(e=>e.getPresenceUser()),H(e=>!!e),je(e=>B(e.code))).subscribe(e=>{this.setCursorUser(e)},e=>{this.loggingService.catch("Error in getPresenceUser: ",e)})}getLiveCursorsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;"),We(this.afAuth).pipe(H(e=>!!e),I(e=>this.isFeatureAllowed({firebaseUser:e,users:[],filteredUsers:[]})),I(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(j(t=>(e.featureAllowed=t,e))):B(e)),I(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(j(t=>(e.featureAllowed=!t,e))):B(e)),I(e=>!e.featureAllowed||e?.user?.isAnonymous?B([]):B(e).pipe(I(t=>this.docService.getDocumentPaths$().pipe(j(o=>(this.documentPaths=o,t.documentPaths=o,t)))),I(t=>this.getDataFromDocumentId().pipe(j(o=>(t.users=o||[],g({},t))))),j(t=>(t.filteredUsers=this.filterOnlineUsers(t.users,t.firebaseUser),t)),I(t=>t?.filteredUsers?.length?this.domService.getCurrentWindowSize$("CursorService getLiveCursorsOnCurrentDocument").pipe(j(()=>t)):B(t)),j(t=>(t?.filteredUsers?.forEach(o=>{this.calculateCursorUserPosition(o)}),t)),I(t=>t?.filteredUsers?B(t?.filteredUsers||[]):B([])))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(H(t=>!!t),j(t=>f(g({},e),{config:t})),I(t=>this.authService.getUser$().pipe(j(o=>f(g({},t),{user:o})))),I(t=>gt(t.config,t.user,q.CURSOR)?B(f(g({},t),{featureAllowed:!0})):(this.loggingService.warn("Cursor feature is not allowed."),B(f(g({},t),{featureAllowed:!1})))),Je((t,o)=>t?.featureAllowed===o?.featureAllowed))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(H(t=>!!t),I(t=>{if(this.configService?.getApiKey()&&this.documentPaths?.cursor){let o=new Date(Date.now()-864e5).getTime();return this.commonDbService.dbListener({feature:"allCursors",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,useQuery:!0,rtdbQuery:[mt("timestamp"),dt(o)]}}).pipe(je(s=>(this.loggingService.catch("Error in CursorService getDataFromDocumentId: ",s),B(null))),j(s=>s?.data),j(s=>{let S=[];return s&&(S=Object.values(s).filter(M=>typeof M=="object")),S}))}else return B([])}))}calculateCursorUserPosition(e){try{if(e?.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let o=t.iterateNext();if(o&&this.isElementInsideAllowedElements(o)){let s=o.getBoundingClientRect();s&&s.width&&s.height&&(e.position={top:s.top+s.height*e.targetElement.topPercentage/100,left:s.left+s.width*e.targetElement.leftPercentage/100})}}}}catch(t){this.loggingService.catch("Error in calculateCursorUserPosition:",t)}}filterOnlineUsers(e,t){try{let s=e.slice().filter(M=>{let re=ht(M.timestamp);return M.userSnippylyId&&M.onlineStatus===y.PRESENCE_STATUS_ONLINE&&re<this.inactivityTime});this.cursorUsers$.next(s),s=s.filter(M=>M?.userSnippylyId!==t?.uid);let S=this.docService.getLocation();return S&&S.locationId?s=s.filter(M=>M.locationId===S.locationId):s=s.filter(M=>!M.locationId),s}catch(o){return this.loggingService.catch("Error in filterOnlineUsers:",o),[]}}setCursorUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorUser","color: green;");try{let t=this.cursorUser$.value;t.userId=e?.userId,t.name=e?.name,t.email=e?.email,t.photoUrl=e?.photoUrl,t.comment="",this.authService.isFeatureAllowed(q.PRESENCE)&&(t.onlineStatus=e?.onlineStatus),t.userSnippylyId=e?.userSnippylyId,t.color=e?.color,t.textColor=e?.textColor,t.initial=e?.initial,t.timestamp=this.timestamp,t.type=e?.type,t.isReadOnly=e?.isReadOnly,t.isAnonymous=e?.isAnonymous;let o=this.domService.getCurrentWindowSizeValue();t.screenWidth=o?.screenWidth,t.screenHeight=o?.screenHeight,t.screenScrollHeight=o?.screenScrollHeight,this.updateCurrentCursorUser(t)}catch(t){this.loggingService.catch("Error in setCursorUser:",t)}}setCurrentCursorUserPosition(e,t,o){try{let s=this.cursorUser$.value;s?.onlineStatus===y.PRESENCE_STATUS_ONLINE&&(s.positionX=e,s.positionY=t,o?s.targetElement=o:s.targetElement=null,this.updateCurrentCursorUser(s))}catch(s){this.loggingService.catch("Error in setCurrentCursorUserPosition:",s)}}setCurrentCursorUserScreenSize(e){try{if(e.screenWidth!==0&&e.screenHeight!==0){let t=this.cursorUser$.value;t?.onlineStatus===y.PRESENCE_STATUS_ONLINE&&(t.screenWidth=e.screenWidth,t.screenHeight=e.screenHeight,t.screenScrollHeight=e.screenScrollHeight,this.updateCurrentCursorUser(t))}}catch(t){this.loggingService.catch("Error in setCurrentCursorUserScreenSize:",t)}}updateCurrentCursorUser(e){return ae(this,null,function*(){try{if(this.documentPaths&&e&&e.userId&&this.authService.isFeatureAllowed(q.CURSOR)){if(!e.isAnonymous){e.pageInfo=new pt;let t=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},t),{timestamp:this.timestamp})))})}this.cursorUser$.next(e)}}catch(t){this.loggingService.catch("Error in updateCurrentCursorUser:",t)}})}updateUserStatusOnDocumentChange(e,t){return ae(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let o=this.cursorUser$.value;if(o.onlineStatus=e,t&&o&&o.userId&&!o.isAnonymous&&this.authService.isFeatureAllowed(q.CURSOR)){let s=JSON.parse(JSON.stringify(o));this.commonDbService.updateData({feature:"cursor",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:o.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},s),{timestamp:this.timestamp})))})}}catch(o){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",o)}})}updateUserOnLocationChange(e){return ae(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let t=this.cursorUser$.value;if(t.location=e?e.location:null,t.locationId=e?e?.locationId:null,this.documentPaths&&t&&t.userId&&!t.isAnonymous&&this.authService.isFeatureAllowed(q.CURSOR)){let o=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},o),{timestamp:this.timestamp})))})}}catch(t){this.loggingService.catch("Error in updateUserOnLocationChange:",t)}})}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let t=this.cursorUser$.value,o=!1;if(e.featureAllowList.includes(q.CURSOR)?t?.onlineStatus!==y.PRESENCE_STATUS_ONLINE&&(t.onlineStatus=y.PRESENCE_STATUS_ONLINE,o=!0):t?.onlineStatus!==y.PRESENCE_STATUS_OFFLINE&&(t.onlineStatus=y.PRESENCE_STATUS_OFFLINE,o=!0),o&&this.documentPaths&&t&&t.userId&&!t.isAnonymous){let s=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},s),{timestamp:this.timestamp})))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),We(this.afAuth).pipe(H(e=>!!e),I(e=>this.docService.getDocumentPaths$().pipe(j(t=>e))),ce(e=>ae(this,null,function*(){try{if(this.documentPaths&&e){let t=yield ut(e,!0).catch(s=>null);if(!t)return;let{user:o}=t.claims;if(!o?.isAnonymous&&this.documentPaths?.cursor){let s=`${this.documentPaths.cursor}/${e.uid}`;this.commonDbService.setupOnDisconnect(s,{onlineStatus:y.PRESENCE_STATUS_OFFLINE,comment:"",timestamp:this.timestamp}).catch(S=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",S)})}}}catch(t){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",t)}})))}signOutUser(e){return new Promise((t,o)=>{try{this.documentPaths&&e?this.commonDbService.getData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e.uid,skipFirestore:!0}}).then(s=>{s&&this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.uid,skipFirestore:!0},callback:()=>{t(null)},data:JSON.parse(JSON.stringify(f(g({},s?.data??{}),{timestamp:this.timestamp,onlineStatus:y.PRESENCE_STATUS_OFFLINE})))}),t(null)}).catch(s=>{this.loggingService.catch("Error in signOutUser subscription: ",s),o(s)}):t(null)}catch(s){this.loggingService.catch("Error in signOutUser:",s),o(s)}})}setInactivityTime(e){this.inactivityTime=e,this.analyticsService.trackEvent(oe.Events.Cursor.CURSOR_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime})}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in CursorService isElementInsideAllowedElements: ",t),!1}}get timestamp(){return this.commonDbService.getServerTimestamp()}};i.\u0275fac=function(t){return new(t||i)(L(Ue),L(yt),L(It),L(lt),L(Ut),L(Te),L(bt),L(we),L(v),L(Et),L(G))},i.\u0275prov=Se({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();var w=class{constructor(){this.showDefault=!1,this.showAvatar=!1,this.showAudio=!1,this.showVideo=!1,this.selfCursorPointer=!1,this.onImageLoadError=()=>{},this.getGainAnimationBorderStyle=()=>{},this.getTextColor=()=>{}}};var Xt=["*"],wt=r=>({componentConfigSignal:r}),Qt=(r,i)=>({condition:r,data:i}),Zt=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-arrow-wireframe",setIfCondition:n,componentElementRef:e});function er(r,i){r&1&&(d(0),be(1),p())}function tr(r,i){if(r&1&&(d(0),u(1,er,2,0,"ng-container",2),p()),r&2){let n=c(2);l(),a("veltDynamicTemplate",F(3,Zt,n.template,C(1,wt,n.componentConfigSignal),n.setIfCondition.bind(n),n.elementRef))}}function rr(r,i){if(r&1&&(d(0),u(1,tr,2,8,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Qt,n.conditionSignal(),C(1,wt,n.componentConfigSignal)))}}var le=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-arrow",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerArrowComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerArrowComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Directional cursor arrow"),e.setAttribute("aria-describedby","Cursor pointer with directional arrow indicator")}catch(e){this.loggingService.catch("Error in CursorPointerArrowComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-arrow-internal"]],standalone:!1,features:[N([h]),D],ngContentSelectors:Xt,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,o){t&1&&(ye(),u(0,rr,2,6,"ng-container",0)),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let r=i;return r})();var Mt=r=>({componentConfigSignal:r}),ir=(r,i)=>({condition:r,data:i}),or=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-audio-huddle-audio-wireframe",setIfCondition:n,componentElementRef:e});function ar(r,i){if(r&1&&(d(0),k(1,"audio",3),p()),r&2){let n=c(2).ngIf;l(),a("srcObject",n.stream)("volume",n.selfCursorPointer?0:1)}}function sr(r,i){if(r&1&&(d(0),u(1,ar,2,2,"ng-container",2),p()),r&2){let n=c(2);l(),a("veltDynamicTemplate",F(3,or,n.template,C(1,Mt,n.componentConfigSignal),n.setIfCondition.bind(n),n.elementRef))}}function cr(r,i){if(r&1&&(d(0),u(1,sr,2,8,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,ir,n.conditionSignal(),C(1,Mt,n.componentConfigSignal)))}}var ue=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-audio-huddle-audio",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAudioComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAudioComponent 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 huddle cursor pointer"),e.setAttribute("aria-describedby","User cursor with audio huddle controls"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAudioComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-audio-huddle-audio-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["playsinline","","autoplay","true",3,"srcObject","volume"]],template:function(t,o){t&1&&u(0,cr,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let r=i;return r})();var kt=(r,i)=>({componentConfigSignal:r,user:i}),ur=(r,i)=>({condition:r,data:i}),mr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-audio-huddle-avatar-wireframe",setIfCondition:n,componentElementRef:e});function dr(r,i){if(r&1&&(d(0),k(1,"snippyly-user-avatar",3),p()),r&2){let n=c(2).ngIf;l(),a("user",n.cursorUser)}}function pr(r,i){if(r&1&&(d(0),u(1,dr,2,1,"ng-container",2),p()),r&2){let n=c().ngIf,e=c();l(),a("veltDynamicTemplate",F(4,mr,e.template,x(1,kt,e.componentConfigSignal,n.cursorUser),e.setIfCondition.bind(e),e.elementRef))}}function gr(r,i){if(r&1&&(d(0),u(1,pr,2,9,"ng-container",1),p()),r&2){let n=i.ngIf,e=c();l(),a("veltIf",x(4,ur,e.conditionSignal(),x(1,kt,e.componentConfigSignal,n.cursorUser)))}}var me=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-audio-huddle-avatar",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAvatarComponent 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 huddle avatar cursor pointer"),e.setAttribute("aria-describedby","User avatar in audio huddle at cursor location"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAvatarComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-audio-huddle-avatar-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"user"]],template:function(t,o){t&1&&u(0,gr,2,7,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,Ne],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}snippyly-user-avatar[_ngcontent-%COMP%]{position:absolute;--legacy-velt-avatar-size: var(--legacy-velt-cursor-video-size)}snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));border-radius:0;max-width:100%;max-height:100%}snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%] .s-user-avatar-initial[_ngcontent-%COMP%]:after{font-size:var(--velt-font-size-2xl)}"],changeDetection:0});let r=i;return r})();var Nt=r=>({componentConfigSignal:r}),hr=(r,i)=>({condition:r,data:i}),fr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-audio-huddle-wireframe",setIfCondition:n,componentElementRef:e});function Cr(r,i){if(r&1&&(d(0),_(1,"div",6),k(2,"velt-cursor-pointer-audio-huddle-avatar-internal",7)(3,"velt-cursor-pointer-audio-huddle-audio-internal",7),b(),p()),r&2){let n=c(4);l(2),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal)}}function Sr(r,i){if(r&1&&(_(0,"div",3)(1,"div",4),u(2,Cr,4,2,"ng-container",5),b()()),r&2){let n=c(2).ngIf,e=c();P("data-testid",e.componentId+"-spacing"),l(),$("background",n.cursorUser==null?null:n.cursorUser.color)("border",n.gainVolume&&n.lightenedColor?n.getGainAnimationBorderStyle():""),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(9,fr,e.template,C(7,Nt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function _r(r,i){if(r&1&&(d(0),u(1,Sr,3,14,"ng-template",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showAudio)}}function yr(r,i){if(r&1&&(d(0),u(1,_r,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,hr,n.conditionSignal(),C(1,Nt,n.componentConfigSignal)))}}var de=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-audio-huddle",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleComponent 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 call cursor pointer"),e.setAttribute("aria-describedby","User cursor with audio call indicator"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-audio-huddle-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],[1,"velt-cursor-pointer-audio-huddle-spacing","s-cursor-video-spacing"],[1,"velt-cursor-pointer-audio-huddle-container","s-cursor-video-container"],[4,"veltDynamicTemplate"],[1,"velt-cursor-pointer-audio-huddle-block","s-cursor-video-block"],[3,"componentConfigSignal"]],template:function(t,o){t&1&&u(0,yr,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,ue,me],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-audio-huddle-spacing[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;position:absolute;top:calc((.4rem + 0px) * var(--velt-base-rem-unit));left:calc((.4rem + 0px) * var(--velt-base-rem-unit));background:transparent}.velt-cursor-pointer-audio-huddle-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));box-sizing:content-box;padding:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-full);box-shadow:0 1px 4px #10101036}.velt-cursor-pointer-audio-huddle-container[_ngcontent-%COMP%] .velt-cursor-pointer-audio-huddle-block[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}"],changeDetection:0});let r=i;return r})();var Ft=r=>({componentConfigSignal:r}),Ir=(r,i)=>({condition:r,data:i}),xr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-avatar-wireframe",setIfCondition:n,componentElementRef:e});function Er(r,i){if(r&1){let n=rt();d(0),_(1,"img",5),nt("error",function(){Ke(n);let t=c(3).ngIf;return Xe(t.onImageLoadError())}),b(),p()}if(r&2){let n=c(3).ngIf;l(),a("src",n.cursorUser==null?null:n.cursorUser.photoUrl,Ze)}}function Or(r,i){if(r&1&&(_(0,"div",3),u(1,Er,2,1,"ng-container",4),b()),r&2){let n=c(2).ngIf,e=c();$("background-color",n.cursorUser==null?null:n.cursorUser.color),Z("user-presence-text-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment)("velt-cursor-pointer-avatar-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(10,xr,e.template,C(8,Ft,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function Pr(r,i){if(r&1&&(d(0),u(1,Or,2,15,"ng-template",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showAvatar)}}function Ar(r,i){if(r&1&&(d(0),u(1,Pr,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Ir,n.conditionSignal(),C(1,Ft,n.componentConfigSignal)))}}var pe=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-avatar",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","User avatar cursor pointer"),e.setAttribute("aria-describedby","Shows user profile picture at cursor location")}catch(e){this.loggingService.catch("Error in CursorPointerAvatarComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-avatar-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],[1,"velt-cursor-pointer-avatar-container","user-avatar-container"],[4,"veltDynamicTemplate"],[3,"error","src"]],template:function(t,o){t&1&&u(0,Ar,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036;transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)));padding:calc((.08rem + 0px) * var(--velt-base-rem-unit));border-radius:var(--velt-border-radius-full)}.velt-cursor-pointer-avatar-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:100%}.velt-cursor-pointer-avatar-container-comment-border[_ngcontent-%COMP%]{border-bottom-left-radius:var(--velt-border-radius-xl);border-bottom-right-radius:var(--velt-border-radius-xl);border-top-right-radius:var(--velt-border-radius-xl);margin-top:calc(var(--velt-spacing-sm) * -1)}"],changeDetection:0});let r=i;return r})();var Rt=r=>({componentConfigSignal:r}),Tr=(r,i)=>({condition:r,data:i}),wr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-default-comment-wireframe",setIfCondition:n,componentElementRef:e});function Mr(r,i){if(r&1&&(d(0),Ie(1),Ee(2,"translate"),p()),r&2){let n=c(3).ngIf;l(),xe(" ",Oe(2,1,n.cursorUser==null?null:n.cursorUser.comment)," ")}}function kr(r,i){if(r&1&&(_(0,"p",3),u(1,Mr,3,3,"ng-container",4),b()),r&2){let n=c(3);P("data-testid",n.componentId),l(),a("veltDynamicTemplate",F(4,wr,n.template,C(2,Rt,n.componentConfigSignal),n.setIfCondition.bind(n),n.elementRef))}}function Nr(r,i){if(r&1&&(d(0),u(1,kr,2,9,"p",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.cursorUser==null?null:n.cursorUser.comment)}}function Fr(r,i){if(r&1&&(d(0),u(1,Nr,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Tr,n.conditionSignal(),C(1,Rt,n.componentConfigSignal)))}}var ge=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-default-comment",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultCommentComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultCommentComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Cursor pointer with comment indicator"),e.setAttribute("aria-describedby","Shows comment activity at cursor location")}catch(e){this.loggingService.catch("Error in CursorPointerDefaultCommentComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-default-comment-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-cursor-pointer-default-comment-container user-presence-comment",4,"ngIf"],[1,"velt-cursor-pointer-default-comment-container","user-presence-comment"],[4,"veltDynamicTemplate"]],template:function(t,o){t&1&&u(0,Fr,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,Me],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let r=i;return r})();var Lt=r=>({componentConfigSignal:r}),Lr=(r,i)=>({condition:r,data:i}),Br=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-default-name-wireframe",setIfCondition:n,componentElementRef:e});function jr(r,i){if(r&1&&(d(0),Ie(1),Ee(2,"translate"),p()),r&2){let n,e=c(3).ngIf;l(),xe(" ",Oe(2,1,(e.cursorUser==null?null:e.cursorUser.name)||(!(e.cursorUser==null||e.cursorUser.email==null||(n=e.cursorUser.email.split("@"))==null)&&n.length?e.cursorUser==null||e.cursorUser.email==null?null:e.cursorUser.email.split("@")[0]:e.cursorUser==null?null:e.cursorUser.email))," ")}}function Hr(r,i){if(r&1&&(_(0,"p",3),u(1,jr,3,3,"ng-container",4),b()),r&2){let n=c(2).ngIf,e=c();$("color",n.getTextColor(n.cursorUser==null?null:n.cursorUser.color)),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(6,Br,e.template,C(4,Lt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function zr(r,i){if(r&1&&(d(0),u(1,Hr,2,11,"p",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",(n.cursorUser==null?null:n.cursorUser.name)||(n.cursorUser==null?null:n.cursorUser.email))}}function $r(r,i){if(r&1&&(d(0),u(1,zr,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Lr,n.conditionSignal(),C(1,Lt,n.componentConfigSignal)))}}var ve=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-default-name",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Cursor pointer with user name"),e.setAttribute("aria-describedby","Shows user name next to cursor location")}catch(e){this.loggingService.catch("Error in CursorPointerDefaultNameComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-default-name-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-cursor-pointer-default-name-container user-presence-name",3,"color",4,"ngIf"],[1,"velt-cursor-pointer-default-name-container","user-presence-name"],[4,"veltDynamicTemplate"]],template:function(t,o){t&1&&u(0,$r,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,Me],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-default-name-container[_ngcontent-%COMP%]{margin:0;font-size:var(--velt-font-size-xs);color:#fff}"],changeDetection:0});let r=i;return r})();var Bt=r=>({componentConfigSignal:r}),Wr=(r,i)=>({condition:r,data:i}),Gr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-default-wireframe",setIfCondition:n,componentElementRef:e});function Jr(r,i){if(r&1&&(d(0),k(1,"velt-cursor-pointer-default-name-internal",7)(2,"velt-cursor-pointer-default-comment-internal",7),p()),r&2){let n=c(5);l(),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal)}}function Yr(r,i){if(r&1&&(_(0,"div",5),u(1,Jr,3,2,"ng-container",6),b()),r&2){let n=c(3).ngIf,e=c();$("background-color",n.cursorUser==null?null:n.cursorUser.color),Z("user-presence-text-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment)("velt-cursor-pointer-default-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(10,Gr,e.template,C(8,Bt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function qr(r,i){r&1&&(_(0,"div",8),k(1,"velt-skeleton-loader-internal",9),b())}function Kr(r,i){if(r&1&&u(0,Yr,2,15,"div",4)(1,qr,2,0,"ng-template",null,0,ot),r&2){let n=it(2),e=c(2).ngIf;a("ngIf",(e.cursorUser==null?null:e.cursorUser.name)||(e.cursorUser==null?null:e.cursorUser.email)||(e.cursorUser==null?null:e.cursorUser.comment))("ngIfElse",n)}}function Xr(r,i){if(r&1&&(d(0),u(1,Kr,3,2,"ng-template",3),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showDefault)}}function Qr(r,i){if(r&1&&(d(0),u(1,Xr,2,1,"ng-container",2),p()),r&2){let n=c();l(),a("veltIf",x(3,Wr,n.conditionSignal(),C(1,Bt,n.componentConfigSignal)))}}var he=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-default",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Default cursor pointer"),e.setAttribute("aria-describedby","User cursor location indicator")}catch(e){this.loggingService.catch("Error in CursorPointerDefaultComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-default-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],["class","velt-cursor-pointer-default-container user-presence-text-container",3,"backgroundColor","user-presence-text-container-comment-border","velt-cursor-pointer-default-container-comment-border",4,"ngIf","ngIfElse"],[1,"velt-cursor-pointer-default-container","user-presence-text-container"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],[1,"velt-cursor-pointer-default-container-loading","user-presence-text-container-loading"],["height","24px","width","80px","borderRadius","24px"]],template:function(t,o){t&1&&u(0,Qr,2,6,"ng-container",1),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,ke,ge,ve],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex;transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)))}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-default-container[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm);box-shadow:0 1px 4px #10101036;border-radius:var(--velt-border-radius-md);filter:brightness(110%) saturate(110%)}.velt-cursor-pointer-default-container-comment-border[_ngcontent-%COMP%]{border-bottom-left-radius:var(--velt-border-radius-xl);border-bottom-right-radius:var(--velt-border-radius-xl);border-top-right-radius:var(--velt-border-radius-xl);margin-top:calc(var(--velt-spacing-sm) * -1)}.velt-cursor-pointer-default-container-loading[_ngcontent-%COMP%]{transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let r=i;return r})();var jt=r=>({componentConfigSignal:r}),en=(r,i)=>({condition:r,data:i}),tn=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-video-huddle-wireframe",setIfCondition:n,componentElementRef:e});function rn(r,i){if(r&1&&(d(0),_(1,"div",6),k(2,"video",7),b(),p()),r&2){let n=c(3).ngIf;l(2),Z("flip",n.selfCursorPointer),a("srcObject",n.stream)("volume",n.selfCursorPointer?0:1)}}function nn(r,i){if(r&1&&(_(0,"div",3)(1,"div",4),u(2,rn,3,4,"ng-container",5),b()()),r&2){let n=c(2).ngIf,e=c();P("data-testid",e.componentId+"-spacing"),l(),$("background",n.cursorUser==null?null:n.cursorUser.color)("border",n.gainVolume&&n.lightenedColor?n.getGainAnimationBorderStyle():""),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(9,tn,e.template,C(7,jt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function on(r,i){if(r&1&&(d(0),u(1,nn,3,14,"ng-template",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showVideo)}}function an(r,i){if(r&1&&(d(0),u(1,on,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,en,n.conditionSignal(),C(1,jt,n.componentConfigSignal)))}}var fe=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-video-huddle",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerVideoHuddleComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerVideoHuddleComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Video call cursor pointer"),e.setAttribute("aria-describedby","User cursor with video call indicator"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerVideoHuddleComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-video-huddle-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],[1,"velt-cursor-pointer-video-huddle-spacing","s-cursor-video-spacing"],[1,"velt-cursor-pointer-video-huddle-container","s-cursor-video-container"],[4,"veltDynamicTemplate"],[1,"velt-cursor-pointer-video-huddle-block","s-cursor-video-block"],["playsinline","","autoplay","true",3,"srcObject","volume"]],template:function(t,o){t&1&&u(0,an,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-video-huddle-spacing[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;position:absolute;top:calc((.4rem + 0px) * var(--velt-base-rem-unit));left:calc((.4rem + 0px) * var(--velt-base-rem-unit));background:transparent}.velt-cursor-pointer-video-huddle-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));box-sizing:content-box;padding:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-full);box-shadow:0 1px 4px #10101036}.velt-cursor-pointer-video-huddle-container[_ngcontent-%COMP%] .velt-cursor-pointer-video-huddle-block[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}.velt-cursor-pointer-video-huddle-container[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:var(--velt-border-radius-full);object-fit:cover}"],changeDetection:0});let r=i;return r})();var cn=["*"],Ht=r=>({componentConfigSignal:r}),ln=(r,i)=>({condition:r,data:i}),un=(r,i)=>({template:r,context:i,componentName:"velt-cursor-pointer-wireframe"});function mn(r,i){if(r&1&&(d(0),_(1,"velt-cursor-pointer-arrow-internal",5),be(2),b(),k(3,"velt-cursor-pointer-default-internal",5)(4,"velt-cursor-pointer-avatar-internal",5)(5,"velt-cursor-pointer-audio-huddle-internal",5)(6,"velt-cursor-pointer-video-huddle-internal",5),p()),r&2){let n=c(4);l(),a("componentConfigSignal",n.componentConfigSignal),l(2),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal)}}function dn(r,i){if(r&1&&(_(0,"div",3),u(1,mn,7,5,"ng-container",4),b()),r&2){let n=c(2).ngIf,e=c();$("top",n.cursorUser==null||n.cursorUser.position==null?null:n.cursorUser.position.top,"px")("left",n.cursorUser==null||n.cursorUser.position==null?null:n.cursorUser.position.left,"px"),Z("no-transition",n.selfCursorPointer),l(),a("veltDynamicTemplate",x(9,un,n.template,C(7,Ht,e.componentConfigSignal)))}}function pn(r,i){if(r&1&&(d(0),u(1,dn,2,12,"div",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.cursorUser==null?null:n.cursorUser.position)}}function gn(r,i){if(r&1&&(d(0),u(1,pn,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,ln,n.conditionSignal(),C(1,Ht,n.componentConfigSignal)))}}var Ce=(()=>{let i=class i extends At{set cursorUser(e){this.componentConfigSignal.update(t=>(t=f(g({},t),{cursorUser:e}),t)),e?.color&&this.componentConfigSignal.update(t=>(t=f(g({},t),{lightenedColor:Ct(e?.color,80)}),t))}get stream(){return this._stream}set stream(e){this._stream=e,e&&this.startGainAnimation(e),this.serviceBook.get(K)?.updateHuddleCursorAvailableByAttendeeId(this.componentConfigSignal().cursorUser?.userSnippylyId,!!this.stream),this.updatePointerStates()}constructor(e,t,o,s,S){super(o,s),this.serviceBook=e,this.loggingService=t,this.elementRef=o,this.themeService=s,this.wireframeService=S,this.selfCursorPointer=!1,this.avatarMode=!1,this.showInitial=!1,this.veltElement=!0,this.componentConfigSignal=_e({template:this.template,variant:this.variant,selfCursorPointer:this.selfCursorPointer||!1,showDefault:!1,showAvatar:!1,showAudio:!1,showVideo:!1,gainVolume:void 0,lightenedColor:void 0,onImageLoadError:this.onImageLoadError.bind(this),getGainAnimationBorderStyle:this.getGainAnimationBorderStyle.bind(this),getTextColor:this.getTextColor.bind(this)}),this.subscriptions=[],this.componentId="velt-cursor-pointer"}ngOnInit(){try{let e="velt-cursor-pointer-wireframe";this.setupA11yAttributes(),this.updatePointerStates(),this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let o=document.createElement(t.tagName);o.innerHTML=t.innerHTML,this.componentConfigSignal.update(s=>f(g({},s),{template:o}))}}))}catch(e){this.loggingService.catch("Error in CursorPointerComponent ngOnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Live cursor pointer indicator"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in CursorPointerComponent setupA11yAttributes:",e)}}ngAfterViewInit(){}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=f(g({},o),{[t]:e[t].currentValue}),o))}),(e.avatarMode||e.huddleState)&&this.updatePointerStates()}catch(t){this.loggingService.catch("Error in CursorPointerComponent ngOnChanges: ",t)}}startGainAnimation(e){try{let t=new AudioContext,o=t.createMediaStreamSource(e),s=t.createAnalyser();o.connect(s);let S=new Uint8Array(s.frequencyBinCount),M=()=>{s.getByteFrequencyData(S);let re=S.reduce((ne,Le)=>ne+Le,0)/S.length;this.componentConfigSignal.update(ne=>(ne=f(g({},ne),{gainVolume:re}),ne)),this.gainAnimationId=requestAnimationFrame(M)};this.gainAnimationId=requestAnimationFrame(M)}catch(t){this.loggingService.catch("Error in CursorPointerComponent startGainAnimation: ",t)}}stopGainAnimation(){try{this.gainAnimationId!==void 0&&cancelAnimationFrame(this.gainAnimationId),this.componentConfigSignal.update(e=>(e=f(g({},e),{gainVolume:void 0}),e))}catch(e){this.loggingService.catch("Error in CursorPointerComponent stopGainAnimation: ",e)}}getOutlineSizeByGainAmount(){try{if(this.componentConfigSignal().gainVolume!==void 0)return ft(0,5,Math.min(1,this.componentConfigSignal().gainVolume/15))}catch(e){this.loggingService.catch("Error in CursorPointerComponent getOutlineSizeByGainAmount: ",e)}return 0}getGainAnimationBorderStyle(){return this.getOutlineSizeByGainAmount()+"px solid "+(this.componentConfigSignal().lightenedColor||"white")+" !important"}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitial=!0,this.updatePointerStates()}catch(e){this.loggingService.catch("Error in CursorPointerComponent onImageLoadError: ",e)}}getTextColor(e){try{return e?St(e):"#141416"}catch(t){this.loggingService.catch("Error in CursorPointerComponent getTextColor: ",t)}return"#141416"}ngOnDestroy(){try{this.stopGainAnimation(),this.stream=void 0,super.ngOnDestroy(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in CursorPointerComponent ngOnDestroy: ",e)}}updatePointerStates(){try{let e=!!this.stream&&!!this.huddleState?.audioState&&!this.huddleState?.videoState,t=!!this.stream&&!!this.huddleState?.videoState,o=!e&&!t&&!!this.avatarMode&&!this.showInitial,s=!e&&!t&&(!this.avatarMode||!!this.avatarMode&&this.showInitial);(s!==this.componentConfigSignal().showDefault||o!==this.componentConfigSignal().showAvatar||e!==this.componentConfigSignal().showAudio||t!==this.componentConfigSignal().showVideo)&&this.componentConfigSignal.update(S=>(S=g({},S),S.showDefault=s,S.showAvatar=o,S.showAudio=e,S.showVideo=t,S))}catch(e){this.loggingService.catch("Error in CursorPointerComponent updatePointerStates: ",e)}}};i.\u0275fac=function(t){return new(t||i)(m(G),m(v),m(E),m(Pt),m(Ot))},i.\u0275cmp=O({type:i,selectors:[["snippyly-cursor-pointer"]],hostVars:1,hostBindings:function(t,o){t&2&&P("data-velt-element",o.veltElement)},inputs:{cursorUser:"cursorUser",selfCursorPointer:"selfCursorPointer",avatarMode:"avatarMode",huddleState:"huddleState",variant:"variant",template:"template",stream:"stream"},standalone:!1,features:[D,Qe],ngContentSelectors:cn,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-cursor-pointer-container user-presence-pointer",3,"no-transition","top","left",4,"ngIf"],[1,"velt-cursor-pointer-container","user-presence-pointer"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"]],template:function(t,o){t&1&&(ye(),u(0,gn,2,6,"ng-container",0)),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,le,de,pe,he,fe],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events: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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000}*[_ngcontent-%COMP%]:empty{display:revert}.velt-cursor-pointer-container[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-cursor-z-index);-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;filter:brightness(110%) saturate(110%);transition:top linear 75ms,left linear 75ms}.velt-cursor-pointer-container.no-transition[_ngcontent-%COMP%]{transition:none}"],changeDetection:0});let r=i;return r})();function hn(r,i){if(r&1&&(_(0,"snippyly-cursor-pointer",5)(1,"slot",6),$e(),_(2,"svg",7)(3,"g",8),k(4,"path",9)(5,"path",10),b(),_(6,"defs")(7,"filter",11),k(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),b()()()()()),r&2){let n=c().$implicit,e=c(2).ngIf,t=c();a("cursorUser",n)("avatarMode",t.avatarMode)("huddleState",e.huddleOnCursorModeByAttendeeId[n==null?null:n.userSnippylyId]?e.attendeesByUserId[n==null?null:n.userSnippylyId]==null?null:e.attendeesByUserId[n==null?null:n.userSnippylyId].state:void 0)("stream",e.huddleOnCursorModeByAttendeeId[n==null?null:n.userSnippylyId]?e.remoteStreamsByUserId[n==null?null:n.userSnippylyId]==null?null:e.remoteStreamsByUserId[n==null?null:n.userSnippylyId].webcam:void 0),l(4),P("fill",n.color),l(),P("fill",n.color)}}function fn(r,i){if(r&1&&(d(0),u(1,hn,15,6,"snippyly-cursor-pointer",4),p()),r&2){let n=i.$implicit;l(),a("ngIf",n==null?null:n.position)}}function Cn(r,i){if(r&1&&(_(0,"snippyly-cursor-pointer",19)(1,"slot",6),$e(),_(2,"svg",7)(3,"g",8),k(4,"path",9)(5,"path",10),b(),_(6,"defs")(7,"filter",11),k(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),b()()()()()),r&2){let n=c(2).ngIf,e=c();a("cursorUser",n.currentCursorUser)("selfCursorPointer",!0)("avatarMode",e.avatarMode)("huddleState",n.huddleOnCursorMode?n.attendeesByUserId[n.currentCursorUser==null?null:n.currentCursorUser.userSnippylyId]==null?null:n.attendeesByUserId[n.currentCursorUser==null?null:n.currentCursorUser.userSnippylyId].state:void 0)("stream",n.localStream),l(4),P("fill",n.currentCursorUser.color),l(),P("fill",n.currentCursorUser.color)}}function Sn(r,i){if(r&1&&u(0,fn,2,1,"ng-container",2)(1,Cn,15,7,"snippyly-cursor-pointer",3),r&2){let n=c().ngIf,e=c();a("ngForOf",n.cursorUsers)("ngForTrackBy",e.trackById),l(),a("ngIf",n.huddleJoined&&n.huddleOnCursorMode&&n.currentCursorUser)}}function _n(r,i){if(r&1&&(d(0),u(1,Sn,2,3,"ng-template",1),p()),r&2){let n=i.ngIf;l(),a("ngIf",n.isFirstComponent&&!(n.user!=null&&n.user.isAnonymous))}}var Fe=(()=>{let i=class i{get inactivityTime(){return this._inactivityTime}set inactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Cursor set inactivityTime: ","inactivity-time value is not a number."):(this._inactivityTime=e,this.cursorService.setInactivityTime(this._inactivityTime))}catch(t){this.loggingService.catch("Error in Cursor set inactivityTime: ",t)}}get allowedElementIds(){return this._allowedElementIds}set allowedElementIds(e){try{this._allowedElementIds=typeof e=="string"?JSON.parse(e):e,this.cursorService.setAllowedElementIds(this._allowedElementIds)}catch(t){this.loggingService.catch("Error in Cursor set allowedElementIds: ",t)}}constructor(e,t,o,s,S,M,re){this.analyticsService=e,this.authService=t,this.cursorService=o,this.domService=s,this.elementRef=S,this.serviceBook=M,this.loggingService=re,this.avatarMode=!1,this.onCursorUsersChanged=new Ve,this.onCursorUserChange=new Ve,this.subscriptions=[],this.constants=y,this.showInitials={},this.componentConfigSignal=_e({isFirstComponent:!1,user:void 0,cursorUsers:[],huddleOnCursorModeByAttendeeId:{},attendeesByUserId:{},remoteStreamsByUserId:{},huddleOnCursorMode:!1,huddleJoined:!1,currentCursorUser:new Pe,localStream:void 0}),this.veltId=vt(),this.veltElement=!0,this._inactivityTime=5,this._allowedElementIds=[],this.loggingService.log("%c[WB] Creating CLASS: CursorComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{this.subscriptions.push(this.domService.subscribeInjectCustomCss(this.elementRef));let e=document.querySelector(y.TAGS.SNIPPYLY_CURSOR),t=document.querySelector(y.TAGS.VELT_CURSOR);t?this.veltId===t?.getAttribute(y.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(o=>(o=f(g({},o),{isFirstComponent:!0}),o)),this.initComponent()):this.veltId===e?.getAttribute(y.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(o=>(o=f(g({},o),{isFirstComponent:!0}),o)),this.initComponent())}catch(e){this.loggingService.catch("Error in CursorComponent AfterViewInit: ",e)}}initComponent(){try{this.cursorService.checkCursorTagAvailable(),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{user:e}),t)),this.componentConfigSignal().user&&this.setCursorInstalledInAnalytics()},e=>{this.loggingService.catch("Error in CursorComponent getUser$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleJoined$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{huddleJoined:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleJoined$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleOnCursorMode$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{huddleOnCursorMode:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleOnCursorMode$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.localStream$??ie)).subscribe(e=>{e?this.componentConfigSignal.update(t=>(t=f(g({},t),{localStream:e}),t)):this.componentConfigSignal.update(t=>(t=f(g({},t),{localStream:void 0}),t))},e=>{this.loggingService.catch("Error in CursorComponent localStream$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getRemoteStreamsByUserId$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{remoteStreamsByUserId:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getRemoteStreamsByUserId$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleAttendees$()??ie)).subscribe(e=>{let t={};e?t=e.reduce((o,s)=>(o[s.userSnippylyId]=s,o),{}):t={},this.componentConfigSignal.update(o=>(o=f(g({},o),{attendeesByUserId:t}),o))},e=>{this.loggingService.catch("Error in CursorComponent getAttendees$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleOnCursorModeByAttendeeId$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{huddleOnCursorModeByAttendeeId:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleOnCursorModeByAttendeeId$ subscription: ",e)})),this.subscriptions.push(this.domService.onWindowPointerMove$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{currentCursorUser:f(g({},t.currentCursorUser),{position:{left:(e?.clientX||0)-2,top:(e?.clientY||0)-2}})}),t))},e=>{this.loggingService.catch("Error in CursorComponent onWindowPointerMove$ subscription: ",e)})),this.getCurrentCursorUser(),this.getLiveCursorsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in CursorComponent initComponent: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in CursorComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in CursorComponent unsubscribe: ",e)}}getLiveCursorsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.cursorService.getLiveCursorsOnCurrentDocument().pipe(H(e=>!!e)).subscribe(e=>{this.loggingService.log(e),e&&(this.componentConfigSignal.update(t=>(t=f(g({},t),{cursorUsers:e}),t)),this.onCursorUsersChanged.emit(e),this.onCursorUserChange.emit(e))},e=>{this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument: ",e)}}getCurrentCursorUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentCursorUser","color: green;");try{this.subscriptions.push(this.cursorService.getCursorUser().pipe(H(e=>!!e)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{currentCursorUser:f(g({},e),{position:t.currentCursorUser?.position})}),t))},e=>{this.loggingService.catch("Error in CursorComponent getCurrentCursorUser subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getCurrentCursorUser: ",e)}}trackById(e,t){return t?.userId}onImageLoadError(e){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitials[e.userId]=!0}catch(t){this.loggingService.catch("Error in CursorComponent onImageLoadError: ",t)}}setCursorInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(q.CURSOR)}catch(e){this.loggingService.catch("Error in CursorComponent setCursorInstalledInAnalytics: ",e)}}};i.\u0275fac=function(t){return new(t||i)(m(Ue),m(we),m(ee),m(Te),m(E),m(G),m(v))},i.\u0275cmp=O({type:i,selectors:[["app-cursor"]],hostVars:2,hostBindings:function(t,o){t&2&&P("data-velt-id",o.veltId)("data-velt-element",o.veltElement)},inputs:{avatarMode:"avatarMode",inactivityTime:"inactivityTime",allowedElementIds:"allowedElementIds"},outputs:{onCursorUsersChanged:"cursorUsersChanged",onCursorUserChange:"onCursorUserChange"},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[3,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream"],["name","cursor"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"cursor-icon"],["filter","url(#filter0_d_6047_31299)"],["d","M7.68749 16.5142L5.42791 5.15177C5.26065 4.31067 6.16027 3.66301 6.90484 4.08848L16.8788 9.78786C17.6558 10.2319 17.503 11.3948 16.6376 11.623L12.3849 12.7447C12.1377 12.8098 11.9249 12.9672 11.7902 13.1844L9.51802 16.8464C9.03968 17.6174 7.86445 17.4041 7.68749 16.5142Z","fill","#625DF5"],["d","M4.93751 5.24929L7.19709 16.6118C7.46253 17.9466 9.22538 18.2664 9.94288 17.11L12.215 13.448C12.2824 13.3394 12.3888 13.2607 12.5124 13.2281L16.7651 12.1065C18.0632 11.7642 18.2924 10.0198 17.1268 9.35374L7.15291 3.65436C6.03605 3.01615 4.68662 3.98765 4.93751 5.24929Z","stroke","white","stroke-linecap","square"],["id","filter0_d_6047_31299","x","0.588557","y","0.405717","width","21.6129","height","23.0055","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["flood-opacity","0","result","BackgroundImageFix"],["in","SourceAlpha","type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0","result","hardAlpha"],["dy","1.1"],["stdDeviation","1.2"],["type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.17 0"],["mode","normal","in2","BackgroundImageFix","result","effect1_dropShadow_6047_31299"],["mode","normal","in","SourceGraphic","in2","effect1_dropShadow_6047_31299","result","shape"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream"]],template:function(t,o){t&1&&u(0,_n,2,1,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[at,A,Ce],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}body.velt-pin-dragging iframe{pointer-events:none!important}*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));pointer-events:none!important}*:empty{display:revert}.cursor-icon path{stroke:#fff;stroke-width:1px;stroke-linejoin:round}
|
|
1
|
+
import{A as U,B as T,y as Dt}from"./chunk-NR3CZ6OR.js";import{a as Ot}from"./chunk-MX66OK5A.js";import{b as Me,c as ke,d as Ne}from"./chunk-XJWB3IUW.js";import{a as Tt}from"./chunk-G56O673H.js";import{a as Ut}from"./chunk-GUGGWPZ7.js";import{a as ct}from"./chunk-ZMXXM7C4.js";import{da as h,ea as Pt,fa as R,ga as At}from"./chunk-J3FNQGWW.js";import{$ as Se,$e as pt,$f as gt,Ab as ye,Bb as be,Ca as Ze,Ci as bt,Dd as lt,De as q,E as H,Fa as l,Fc as at,G as je,Ga as Ve,Gc as A,Gd as We,Hd as ut,Hi as It,Ib as it,Ii as xt,J as He,Jb as $,Kb as Z,L as Je,M as ze,Nb as Ie,Nh as Ae,Oh as De,Pa as m,Pb as xe,Pc as st,Ph as _t,Qi as Et,Sh as K,T as I,Ta as et,Te as y,Ua as O,Ud as mt,Va as tt,W as ce,X as Ye,Ya as D,_a as u,_b as N,_d as dt,a as g,aa as qe,ag as vt,b as f,bc as C,bg as ht,ca as L,cc as x,db as P,ec as F,eh as ft,fh as Ct,g as ae,gh as St,ha as Ke,ia as Xe,ja as $e,je as oe,kc as Ee,kf as Pe,l as se,lb as a,lc as Oe,mb as _,nb as b,ni as G,ob as k,oi as Ue,p as ie,pc as ot,pi as v,qa as _e,qi as yt,r as B,sb as d,tb as p,ua as Qe,ui as Te,v as j,vb as rt,vi as we,wa as E,xb as nt,zb as c}from"./chunk-TY3WZ4Q4.js";var ee=(()=>{let i=class i{constructor(e,t,o,s,S,M,re,ne,Le,Wt,Gt){this.analyticsService=e,this.configService=t,this.docService=o,this.afAuth=s,this.iamService=S,this.domService=M,this.databaseService=re,this.authService=ne,this.loggingService=Le,this.commonDbService=Wt,this.serviceBook=Gt,this.cursorUser$=new se(new Pe),this.documentPaths=null,this.inactivityTime=120*1e3,this.allowedElementIds$=new se([]),this.cursorTagAvailable$=new se(!1),this.cursorTagAvailable=!1,this.cursorUsers$=new se([]),this.loggingService.log("%c[WB] Creating CLASS: CursorService","color: blue;");try{this.serviceBook.set(Ae,this),this.checkCursorTagAvailable(),this.databaseService.getDb().pipe(H(W=>!!W),I(W=>this.cursorTagAvailable$.pipe(H(Y=>!!Y),He(1),j(()=>W))),He(1)).subscribe(W=>{W&&this.cursorTagAvailable&&(this.getPresenceUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnDatabaseDisconnect().subscribe(()=>{},Y=>{this.loggingService.catch("Error in CursorService constructor updateOnDatabaseDisconnect: ",Y)}),this.addMouseMoveListener(),this.addScreenSizeChangeListener(),this.updateOnAllowedFeatureListChange())},W=>{this.loggingService.catch("Error in CursorService constructor getDb: ",W)}),this.cursorUsers$.pipe(ze()).subscribe(([W,Y])=>{sessionStorage.getItem(y.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED)||Y?.length>1&&W.length!==Y.length&&(this.analyticsService.trackEvent(oe.Events.Cursor.CURSOR_MULTIPLE_USERS_DETECTED,{totalUsers:Y.length,cursorSnippylyUserIds:Y.map(Be=>Be.userSnippylyId),cursorClientUserIds:Y.map(Be=>Be.userId)}),sessionStorage.setItem(y.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED,"true"))}),this.authService.addPreSignOutFuction("cursor-signout",this.signOutUser.bind(this))}catch(W){this.loggingService.catch("Error in CursorService constructor: ",W)}}checkCursorTagAvailable(){this.loggingService.log("%c[WB] Calling FUNCTION: checkCursorTagAvailable","color: green;");try{this.cursorTagAvailable=!!document.querySelector(y.TAGS.VELT_CURSOR)||!!document.querySelector(y.TAGS.SNIPPYLY_CURSOR),this.cursorTagAvailable$.next(this.cursorTagAvailable)}catch(e){this.loggingService.catch("Error in CursorService checkCursorTagAvailable: ",e)}}addScreenSizeChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addScreenSizeChangeListener","color: green;");try{this.docService.getDocumentPaths$().pipe(H(e=>!!e),I(e=>this.domService.getCurrentWindowSize$("CursorService addScreenSizeChangeListener").pipe(H(t=>!!t)))).subscribe(e=>{this.setCurrentCursorUserScreenSize(e)},e=>{this.loggingService.catch("Error in addScreenSizeChangeListener getCurrentWindowSize: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addScreenSizeChangeListener: ",e)}}addMouseMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addMouseMoveListener","color: green;");try{this.domService.onWindowPointerMove$().pipe(Ye(50)).subscribe(e=>{e&&this.setCurrentCursorUserPosition(e.pageX,e.pageY,this.domService.getTargetElementForCursorPosition(e,!0,!1,!1,void 0,!1))},e=>{this.loggingService.catch("Error in addMouseMoveListener getCurrentMousePosition: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addMouseMoveListener: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;");try{this.docService.getDocumentPaths$().pipe(ce(e=>{this.documentPaths=e}),ze(),ce(([e,t])=>{e&&this.updateUserStatusOnDocumentChange(y.PRESENCE_STATUS_OFFLINE,e),t&&this.updateUserStatusOnDocumentChange(y.PRESENCE_STATUS_ONLINE,t)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getDocumentPaths: ",e)}}getLocation(){try{this.docService.getLocation$().pipe(ce(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getLocation: ",e)}}getCursorUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCursorUser","color: green;"),this.cursorUser$.asObservable()}getPresenceUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.serviceBook.observe(_t).pipe(H(e=>!!e),I(e=>e.getPresenceUser()),H(e=>!!e),je(e=>B(e.code))).subscribe(e=>{this.setCursorUser(e)},e=>{this.loggingService.catch("Error in getPresenceUser: ",e)})}getLiveCursorsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;"),We(this.afAuth).pipe(H(e=>!!e),I(e=>this.isFeatureAllowed({firebaseUser:e,users:[],filteredUsers:[]})),I(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(j(t=>(e.featureAllowed=t,e))):B(e)),I(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(j(t=>(e.featureAllowed=!t,e))):B(e)),I(e=>!e.featureAllowed||e?.user?.isAnonymous?B([]):B(e).pipe(I(t=>this.docService.getDocumentPaths$().pipe(j(o=>(this.documentPaths=o,t.documentPaths=o,t)))),I(t=>this.getDataFromDocumentId().pipe(j(o=>(t.users=o||[],g({},t))))),j(t=>(t.filteredUsers=this.filterOnlineUsers(t.users,t.firebaseUser),t)),I(t=>t?.filteredUsers?.length?this.domService.getCurrentWindowSize$("CursorService getLiveCursorsOnCurrentDocument").pipe(j(()=>t)):B(t)),j(t=>(t?.filteredUsers?.forEach(o=>{this.calculateCursorUserPosition(o)}),t)),I(t=>t?.filteredUsers?B(t?.filteredUsers||[]):B([])))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(H(t=>!!t),j(t=>f(g({},e),{config:t})),I(t=>this.authService.getUser$().pipe(j(o=>f(g({},t),{user:o})))),I(t=>gt(t.config,t.user,q.CURSOR)?B(f(g({},t),{featureAllowed:!0})):(this.loggingService.warn("Cursor feature is not allowed."),B(f(g({},t),{featureAllowed:!1})))),Je((t,o)=>t?.featureAllowed===o?.featureAllowed))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(H(t=>!!t),I(t=>{if(this.configService?.getApiKey()&&this.documentPaths?.cursor){let o=new Date(Date.now()-864e5).getTime();return this.commonDbService.dbListener({feature:"allCursors",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,useQuery:!0,rtdbQuery:[mt("timestamp"),dt(o)]}}).pipe(je(s=>(this.loggingService.catch("Error in CursorService getDataFromDocumentId: ",s),B(null))),j(s=>s?.data),j(s=>{let S=[];return s&&(S=Object.values(s).filter(M=>typeof M=="object")),S}))}else return B([])}))}calculateCursorUserPosition(e){try{if(e?.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let o=t.iterateNext();if(o&&this.isElementInsideAllowedElements(o)){let s=o.getBoundingClientRect();s&&s.width&&s.height&&(e.position={top:s.top+s.height*e.targetElement.topPercentage/100,left:s.left+s.width*e.targetElement.leftPercentage/100})}}}}catch(t){this.loggingService.catch("Error in calculateCursorUserPosition:",t)}}filterOnlineUsers(e,t){try{let s=e.slice().filter(M=>{let re=ht(M.timestamp);return M.userSnippylyId&&M.onlineStatus===y.PRESENCE_STATUS_ONLINE&&re<this.inactivityTime});this.cursorUsers$.next(s),s=s.filter(M=>M?.userSnippylyId!==t?.uid);let S=this.docService.getLocation();return S&&S.locationId?s=s.filter(M=>M.locationId===S.locationId):s=s.filter(M=>!M.locationId),s}catch(o){return this.loggingService.catch("Error in filterOnlineUsers:",o),[]}}setCursorUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorUser","color: green;");try{let t=this.cursorUser$.value;t.userId=e?.userId,t.name=e?.name,t.email=e?.email,t.photoUrl=e?.photoUrl,t.comment="",this.authService.isFeatureAllowed(q.PRESENCE)&&(t.onlineStatus=e?.onlineStatus),t.userSnippylyId=e?.userSnippylyId,t.color=e?.color,t.textColor=e?.textColor,t.initial=e?.initial,t.timestamp=this.timestamp,t.type=e?.type,t.isReadOnly=e?.isReadOnly,t.isAnonymous=e?.isAnonymous;let o=this.domService.getCurrentWindowSizeValue();t.screenWidth=o?.screenWidth,t.screenHeight=o?.screenHeight,t.screenScrollHeight=o?.screenScrollHeight,this.updateCurrentCursorUser(t)}catch(t){this.loggingService.catch("Error in setCursorUser:",t)}}setCurrentCursorUserPosition(e,t,o){try{let s=this.cursorUser$.value;s?.onlineStatus===y.PRESENCE_STATUS_ONLINE&&(s.positionX=e,s.positionY=t,o?s.targetElement=o:s.targetElement=null,this.updateCurrentCursorUser(s))}catch(s){this.loggingService.catch("Error in setCurrentCursorUserPosition:",s)}}setCurrentCursorUserScreenSize(e){try{if(e.screenWidth!==0&&e.screenHeight!==0){let t=this.cursorUser$.value;t?.onlineStatus===y.PRESENCE_STATUS_ONLINE&&(t.screenWidth=e.screenWidth,t.screenHeight=e.screenHeight,t.screenScrollHeight=e.screenScrollHeight,this.updateCurrentCursorUser(t))}}catch(t){this.loggingService.catch("Error in setCurrentCursorUserScreenSize:",t)}}updateCurrentCursorUser(e){return ae(this,null,function*(){try{if(this.documentPaths&&e&&e.userId&&this.authService.isFeatureAllowed(q.CURSOR)){if(!e.isAnonymous){e.pageInfo=new pt;let t=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},t),{timestamp:this.timestamp})))})}this.cursorUser$.next(e)}}catch(t){this.loggingService.catch("Error in updateCurrentCursorUser:",t)}})}updateUserStatusOnDocumentChange(e,t){return ae(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let o=this.cursorUser$.value;if(o.onlineStatus=e,t&&o&&o.userId&&!o.isAnonymous&&this.authService.isFeatureAllowed(q.CURSOR)){let s=JSON.parse(JSON.stringify(o));this.commonDbService.updateData({feature:"cursor",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:o.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},s),{timestamp:this.timestamp})))})}}catch(o){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",o)}})}updateUserOnLocationChange(e){return ae(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let t=this.cursorUser$.value;if(t.location=e?e.location:null,t.locationId=e?e?.locationId:null,this.documentPaths&&t&&t.userId&&!t.isAnonymous&&this.authService.isFeatureAllowed(q.CURSOR)){let o=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},o),{timestamp:this.timestamp})))})}}catch(t){this.loggingService.catch("Error in updateUserOnLocationChange:",t)}})}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let t=this.cursorUser$.value,o=!1;if(e.featureAllowList.includes(q.CURSOR)?t?.onlineStatus!==y.PRESENCE_STATUS_ONLINE&&(t.onlineStatus=y.PRESENCE_STATUS_ONLINE,o=!0):t?.onlineStatus!==y.PRESENCE_STATUS_OFFLINE&&(t.onlineStatus=y.PRESENCE_STATUS_OFFLINE,o=!0),o&&this.documentPaths&&t&&t.userId&&!t.isAnonymous){let s=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(f(g({},s),{timestamp:this.timestamp})))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),We(this.afAuth).pipe(H(e=>!!e),I(e=>this.docService.getDocumentPaths$().pipe(j(t=>e))),ce(e=>ae(this,null,function*(){try{if(this.documentPaths&&e){let t=yield ut(e,!0).catch(s=>null);if(!t)return;let{user:o}=t.claims;if(!o?.isAnonymous&&this.documentPaths?.cursor){let s=`${this.documentPaths.cursor}/${e.uid}`;this.commonDbService.setupOnDisconnect(s,{onlineStatus:y.PRESENCE_STATUS_OFFLINE,comment:"",timestamp:this.timestamp}).catch(S=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",S)})}}}catch(t){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",t)}})))}signOutUser(e){return new Promise((t,o)=>{try{this.documentPaths&&e?this.commonDbService.getData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e.uid,skipFirestore:!0}}).then(s=>{s&&this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.uid,skipFirestore:!0},callback:()=>{t(null)},data:JSON.parse(JSON.stringify(f(g({},s?.data??{}),{timestamp:this.timestamp,onlineStatus:y.PRESENCE_STATUS_OFFLINE})))}),t(null)}).catch(s=>{this.loggingService.catch("Error in signOutUser subscription: ",s),o(s)}):t(null)}catch(s){this.loggingService.catch("Error in signOutUser:",s),o(s)}})}setInactivityTime(e){this.inactivityTime=e,this.analyticsService.trackEvent(oe.Events.Cursor.CURSOR_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime})}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in CursorService isElementInsideAllowedElements: ",t),!1}}get timestamp(){return this.commonDbService.getServerTimestamp()}};i.\u0275fac=function(t){return new(t||i)(L(Ue),L(yt),L(It),L(lt),L(Ut),L(Te),L(bt),L(we),L(v),L(Et),L(G))},i.\u0275prov=Se({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();var w=class{constructor(){this.showDefault=!1,this.showAvatar=!1,this.showAudio=!1,this.showVideo=!1,this.selfCursorPointer=!1,this.onImageLoadError=()=>{},this.getGainAnimationBorderStyle=()=>{},this.getTextColor=()=>{}}};var Xt=["*"],wt=r=>({componentConfigSignal:r}),Qt=(r,i)=>({condition:r,data:i}),Zt=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-arrow-wireframe",setIfCondition:n,componentElementRef:e});function er(r,i){r&1&&(d(0),be(1),p())}function tr(r,i){if(r&1&&(d(0),u(1,er,2,0,"ng-container",2),p()),r&2){let n=c(2);l(),a("veltDynamicTemplate",F(3,Zt,n.template,C(1,wt,n.componentConfigSignal),n.setIfCondition.bind(n),n.elementRef))}}function rr(r,i){if(r&1&&(d(0),u(1,tr,2,8,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Qt,n.conditionSignal(),C(1,wt,n.componentConfigSignal)))}}var le=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-arrow",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerArrowComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerArrowComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Directional cursor arrow"),e.setAttribute("aria-describedby","Cursor pointer with directional arrow indicator")}catch(e){this.loggingService.catch("Error in CursorPointerArrowComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-arrow-internal"]],standalone:!1,features:[N([h]),D],ngContentSelectors:Xt,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,o){t&1&&(ye(),u(0,rr,2,6,"ng-container",0)),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let r=i;return r})();var Mt=r=>({componentConfigSignal:r}),ir=(r,i)=>({condition:r,data:i}),or=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-audio-huddle-audio-wireframe",setIfCondition:n,componentElementRef:e});function ar(r,i){if(r&1&&(d(0),k(1,"audio",3),p()),r&2){let n=c(2).ngIf;l(),a("srcObject",n.stream)("volume",n.selfCursorPointer?0:1)}}function sr(r,i){if(r&1&&(d(0),u(1,ar,2,2,"ng-container",2),p()),r&2){let n=c(2);l(),a("veltDynamicTemplate",F(3,or,n.template,C(1,Mt,n.componentConfigSignal),n.setIfCondition.bind(n),n.elementRef))}}function cr(r,i){if(r&1&&(d(0),u(1,sr,2,8,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,ir,n.conditionSignal(),C(1,Mt,n.componentConfigSignal)))}}var ue=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-audio-huddle-audio",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAudioComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAudioComponent 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 huddle cursor pointer"),e.setAttribute("aria-describedby","User cursor with audio huddle controls"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAudioComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-audio-huddle-audio-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["playsinline","","autoplay","true",3,"srcObject","volume"]],template:function(t,o){t&1&&u(0,cr,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let r=i;return r})();var kt=(r,i)=>({componentConfigSignal:r,user:i}),ur=(r,i)=>({condition:r,data:i}),mr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-audio-huddle-avatar-wireframe",setIfCondition:n,componentElementRef:e});function dr(r,i){if(r&1&&(d(0),k(1,"snippyly-user-avatar",3),p()),r&2){let n=c(2).ngIf;l(),a("user",n.cursorUser)}}function pr(r,i){if(r&1&&(d(0),u(1,dr,2,1,"ng-container",2),p()),r&2){let n=c().ngIf,e=c();l(),a("veltDynamicTemplate",F(4,mr,e.template,x(1,kt,e.componentConfigSignal,n.cursorUser),e.setIfCondition.bind(e),e.elementRef))}}function gr(r,i){if(r&1&&(d(0),u(1,pr,2,9,"ng-container",1),p()),r&2){let n=i.ngIf,e=c();l(),a("veltIf",x(4,ur,e.conditionSignal(),x(1,kt,e.componentConfigSignal,n.cursorUser)))}}var me=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-audio-huddle-avatar",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAvatarComponent 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 huddle avatar cursor pointer"),e.setAttribute("aria-describedby","User avatar in audio huddle at cursor location"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleAvatarComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-audio-huddle-avatar-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"user"]],template:function(t,o){t&1&&u(0,gr,2,7,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,Ne],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}snippyly-user-avatar[_ngcontent-%COMP%]{position:absolute;--legacy-velt-avatar-size: var(--legacy-velt-cursor-video-size)}snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));border-radius:0;max-width:100%;max-height:100%}snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%] .s-user-avatar-initial[_ngcontent-%COMP%]:after{font-size:var(--velt-font-size-2xl)}"],changeDetection:0});let r=i;return r})();var Nt=r=>({componentConfigSignal:r}),hr=(r,i)=>({condition:r,data:i}),fr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-audio-huddle-wireframe",setIfCondition:n,componentElementRef:e});function Cr(r,i){if(r&1&&(d(0),_(1,"div",6),k(2,"velt-cursor-pointer-audio-huddle-avatar-internal",7)(3,"velt-cursor-pointer-audio-huddle-audio-internal",7),b(),p()),r&2){let n=c(4);l(2),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal)}}function Sr(r,i){if(r&1&&(_(0,"div",3)(1,"div",4),u(2,Cr,4,2,"ng-container",5),b()()),r&2){let n=c(2).ngIf,e=c();P("data-testid",e.componentId+"-spacing"),l(),$("background",n.cursorUser==null?null:n.cursorUser.color)("border",n.gainVolume&&n.lightenedColor?n.getGainAnimationBorderStyle():""),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(9,fr,e.template,C(7,Nt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function _r(r,i){if(r&1&&(d(0),u(1,Sr,3,14,"ng-template",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showAudio)}}function yr(r,i){if(r&1&&(d(0),u(1,_r,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,hr,n.conditionSignal(),C(1,Nt,n.componentConfigSignal)))}}var de=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-audio-huddle",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleComponent 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 call cursor pointer"),e.setAttribute("aria-describedby","User cursor with audio call indicator"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerAudioHuddleComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-audio-huddle-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],[1,"velt-cursor-pointer-audio-huddle-spacing","s-cursor-video-spacing"],[1,"velt-cursor-pointer-audio-huddle-container","s-cursor-video-container"],[4,"veltDynamicTemplate"],[1,"velt-cursor-pointer-audio-huddle-block","s-cursor-video-block"],[3,"componentConfigSignal"]],template:function(t,o){t&1&&u(0,yr,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,ue,me],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-audio-huddle-spacing[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;position:absolute;top:calc((.4rem + 0px) * var(--velt-base-rem-unit));left:calc((.4rem + 0px) * var(--velt-base-rem-unit));background:transparent}.velt-cursor-pointer-audio-huddle-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));box-sizing:content-box;padding:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-full);box-shadow:0 1px 4px #10101036}.velt-cursor-pointer-audio-huddle-container[_ngcontent-%COMP%] .velt-cursor-pointer-audio-huddle-block[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}"],changeDetection:0});let r=i;return r})();var Ft=r=>({componentConfigSignal:r}),Ir=(r,i)=>({condition:r,data:i}),xr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-avatar-wireframe",setIfCondition:n,componentElementRef:e});function Er(r,i){if(r&1){let n=rt();d(0),_(1,"img",5),nt("error",function(){Ke(n);let t=c(3).ngIf;return Xe(t.onImageLoadError())}),b(),p()}if(r&2){let n=c(3).ngIf;l(),a("src",n.cursorUser==null?null:n.cursorUser.photoUrl,Ze)}}function Or(r,i){if(r&1&&(_(0,"div",3),u(1,Er,2,1,"ng-container",4),b()),r&2){let n=c(2).ngIf,e=c();$("background-color",n.cursorUser==null?null:n.cursorUser.color),Z("user-presence-text-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment)("velt-cursor-pointer-avatar-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(10,xr,e.template,C(8,Ft,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function Pr(r,i){if(r&1&&(d(0),u(1,Or,2,15,"ng-template",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showAvatar)}}function Ar(r,i){if(r&1&&(d(0),u(1,Pr,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Ir,n.conditionSignal(),C(1,Ft,n.componentConfigSignal)))}}var pe=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-avatar",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","User avatar cursor pointer"),e.setAttribute("aria-describedby","Shows user profile picture at cursor location")}catch(e){this.loggingService.catch("Error in CursorPointerAvatarComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-avatar-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],[1,"velt-cursor-pointer-avatar-container","user-avatar-container"],[4,"veltDynamicTemplate"],[3,"error","src"]],template:function(t,o){t&1&&u(0,Ar,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036;transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)));padding:calc((.08rem + 0px) * var(--velt-base-rem-unit));border-radius:var(--velt-border-radius-full)}.velt-cursor-pointer-avatar-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:100%}.velt-cursor-pointer-avatar-container-comment-border[_ngcontent-%COMP%]{border-bottom-left-radius:var(--velt-border-radius-xl);border-bottom-right-radius:var(--velt-border-radius-xl);border-top-right-radius:var(--velt-border-radius-xl);margin-top:calc(var(--velt-spacing-sm) * -1)}"],changeDetection:0});let r=i;return r})();var Rt=r=>({componentConfigSignal:r}),Tr=(r,i)=>({condition:r,data:i}),wr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-default-comment-wireframe",setIfCondition:n,componentElementRef:e});function Mr(r,i){if(r&1&&(d(0),Ie(1),Ee(2,"translate"),p()),r&2){let n=c(3).ngIf;l(),xe(" ",Oe(2,1,n.cursorUser==null?null:n.cursorUser.comment)," ")}}function kr(r,i){if(r&1&&(_(0,"p",3),u(1,Mr,3,3,"ng-container",4),b()),r&2){let n=c(3);P("data-testid",n.componentId),l(),a("veltDynamicTemplate",F(4,wr,n.template,C(2,Rt,n.componentConfigSignal),n.setIfCondition.bind(n),n.elementRef))}}function Nr(r,i){if(r&1&&(d(0),u(1,kr,2,9,"p",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.cursorUser==null?null:n.cursorUser.comment)}}function Fr(r,i){if(r&1&&(d(0),u(1,Nr,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Tr,n.conditionSignal(),C(1,Rt,n.componentConfigSignal)))}}var ge=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-default-comment",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultCommentComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultCommentComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Cursor pointer with comment indicator"),e.setAttribute("aria-describedby","Shows comment activity at cursor location")}catch(e){this.loggingService.catch("Error in CursorPointerDefaultCommentComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-default-comment-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-cursor-pointer-default-comment-container user-presence-comment",4,"ngIf"],[1,"velt-cursor-pointer-default-comment-container","user-presence-comment"],[4,"veltDynamicTemplate"]],template:function(t,o){t&1&&u(0,Fr,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,Me],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let r=i;return r})();var Lt=r=>({componentConfigSignal:r}),Lr=(r,i)=>({condition:r,data:i}),Br=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-default-name-wireframe",setIfCondition:n,componentElementRef:e});function jr(r,i){if(r&1&&(d(0),Ie(1),Ee(2,"translate"),p()),r&2){let n,e=c(3).ngIf;l(),xe(" ",Oe(2,1,(e.cursorUser==null?null:e.cursorUser.name)||(!(e.cursorUser==null||e.cursorUser.email==null||(n=e.cursorUser.email.split("@"))==null)&&n.length?e.cursorUser==null||e.cursorUser.email==null?null:e.cursorUser.email.split("@")[0]:e.cursorUser==null?null:e.cursorUser.email))," ")}}function Hr(r,i){if(r&1&&(_(0,"p",3),u(1,jr,3,3,"ng-container",4),b()),r&2){let n=c(2).ngIf,e=c();$("color",n.getTextColor(n.cursorUser==null?null:n.cursorUser.color)),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(6,Br,e.template,C(4,Lt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function zr(r,i){if(r&1&&(d(0),u(1,Hr,2,11,"p",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",(n.cursorUser==null?null:n.cursorUser.name)||(n.cursorUser==null?null:n.cursorUser.email))}}function $r(r,i){if(r&1&&(d(0),u(1,zr,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,Lr,n.conditionSignal(),C(1,Lt,n.componentConfigSignal)))}}var ve=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-default-name",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Cursor pointer with user name"),e.setAttribute("aria-describedby","Shows user name next to cursor location")}catch(e){this.loggingService.catch("Error in CursorPointerDefaultNameComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-default-name-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-cursor-pointer-default-name-container user-presence-name",3,"color",4,"ngIf"],[1,"velt-cursor-pointer-default-name-container","user-presence-name"],[4,"veltDynamicTemplate"]],template:function(t,o){t&1&&u(0,$r,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,Me],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-default-name-container[_ngcontent-%COMP%]{margin:0;font-size:var(--velt-font-size-xs);color:#fff}"],changeDetection:0});let r=i;return r})();var Bt=r=>({componentConfigSignal:r}),Wr=(r,i)=>({condition:r,data:i}),Gr=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-default-wireframe",setIfCondition:n,componentElementRef:e});function Jr(r,i){if(r&1&&(d(0),k(1,"velt-cursor-pointer-default-name-internal",7)(2,"velt-cursor-pointer-default-comment-internal",7),p()),r&2){let n=c(5);l(),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal)}}function Yr(r,i){if(r&1&&(_(0,"div",5),u(1,Jr,3,2,"ng-container",6),b()),r&2){let n=c(3).ngIf,e=c();$("background-color",n.cursorUser==null?null:n.cursorUser.color),Z("user-presence-text-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment)("velt-cursor-pointer-default-container-comment-border",n.cursorUser==null?null:n.cursorUser.comment),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(10,Gr,e.template,C(8,Bt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function qr(r,i){r&1&&(_(0,"div",8),k(1,"velt-skeleton-loader-internal",9),b())}function Kr(r,i){if(r&1&&u(0,Yr,2,15,"div",4)(1,qr,2,0,"ng-template",null,0,ot),r&2){let n=it(2),e=c(2).ngIf;a("ngIf",(e.cursorUser==null?null:e.cursorUser.name)||(e.cursorUser==null?null:e.cursorUser.email)||(e.cursorUser==null?null:e.cursorUser.comment))("ngIfElse",n)}}function Xr(r,i){if(r&1&&(d(0),u(1,Kr,3,2,"ng-template",3),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showDefault)}}function Qr(r,i){if(r&1&&(d(0),u(1,Xr,2,1,"ng-container",2),p()),r&2){let n=c();l(),a("veltIf",x(3,Wr,n.conditionSignal(),C(1,Bt,n.componentConfigSignal)))}}var he=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-default",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerDefaultComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Default cursor pointer"),e.setAttribute("aria-describedby","User cursor location indicator")}catch(e){this.loggingService.catch("Error in CursorPointerDefaultComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-default-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],["class","velt-cursor-pointer-default-container user-presence-text-container",3,"backgroundColor","user-presence-text-container-comment-border","velt-cursor-pointer-default-container-comment-border",4,"ngIf","ngIfElse"],[1,"velt-cursor-pointer-default-container","user-presence-text-container"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],[1,"velt-cursor-pointer-default-container-loading","user-presence-text-container-loading"],["height","24px","width","80px","borderRadius","24px"]],template:function(t,o){t&1&&u(0,Qr,2,6,"ng-container",1),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,ke,ge,ve],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex;transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)))}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-default-container[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm);box-shadow:0 1px 4px #10101036;border-radius:var(--velt-border-radius-md);filter:brightness(110%) saturate(110%)}.velt-cursor-pointer-default-container-comment-border[_ngcontent-%COMP%]{border-bottom-left-radius:var(--velt-border-radius-xl);border-bottom-right-radius:var(--velt-border-radius-xl);border-top-right-radius:var(--velt-border-radius-xl);margin-top:calc(var(--velt-spacing-sm) * -1)}.velt-cursor-pointer-default-container-loading[_ngcontent-%COMP%]{transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let r=i;return r})();var jt=r=>({componentConfigSignal:r}),en=(r,i)=>({condition:r,data:i}),tn=(r,i,n,e)=>({template:r,context:i,componentName:"velt-cursor-pointer-video-huddle-wireframe",setIfCondition:n,componentElementRef:e});function rn(r,i){if(r&1&&(d(0),_(1,"div",6),k(2,"video",7),b(),p()),r&2){let n=c(3).ngIf;l(2),Z("flip",n.selfCursorPointer),a("srcObject",n.stream)("volume",n.selfCursorPointer?0:1)}}function nn(r,i){if(r&1&&(_(0,"div",3)(1,"div",4),u(2,rn,3,4,"ng-container",5),b()()),r&2){let n=c(2).ngIf,e=c();P("data-testid",e.componentId+"-spacing"),l(),$("background",n.cursorUser==null?null:n.cursorUser.color)("border",n.gainVolume&&n.lightenedColor?n.getGainAnimationBorderStyle():""),P("data-testid",e.componentId),l(),a("veltDynamicTemplate",F(9,tn,e.template,C(7,jt,e.componentConfigSignal),e.setIfCondition.bind(e),e.elementRef))}}function on(r,i){if(r&1&&(d(0),u(1,nn,3,14,"ng-template",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.showVideo)}}function an(r,i){if(r&1&&(d(0),u(1,on,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,en,n.conditionSignal(),C(1,jt,n.componentConfigSignal)))}}var fe=(()=>{let i=class i extends R{constructor(e,t,o){super(t,o,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=o,this.componentId="velt-cursor-pointer-video-huddle",super.initializeComponentConfigSignal(new w)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CursorPointerVideoHuddleComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CursorPointerVideoHuddleComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Video call cursor pointer"),e.setAttribute("aria-describedby","User cursor with video call indicator"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CursorPointerVideoHuddleComponent setupA11yAttributes:",e)}}};i.\u0275fac=function(t){return new(t||i)(m(v),m(E),m(h))},i.\u0275cmp=O({type:i,selectors:[["velt-cursor-pointer-video-huddle-internal"]],standalone:!1,features:[N([h]),D],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],[1,"velt-cursor-pointer-video-huddle-spacing","s-cursor-video-spacing"],[1,"velt-cursor-pointer-video-huddle-container","s-cursor-video-container"],[4,"veltDynamicTemplate"],[1,"velt-cursor-pointer-video-huddle-block","s-cursor-video-block"],["playsinline","","autoplay","true",3,"srcObject","volume"]],template:function(t,o){t&1&&u(0,an,2,6,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-cursor-pointer-video-huddle-spacing[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;position:absolute;top:calc((.4rem + 0px) * var(--velt-base-rem-unit));left:calc((.4rem + 0px) * var(--velt-base-rem-unit));background:transparent}.velt-cursor-pointer-video-huddle-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));box-sizing:content-box;padding:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-full);box-shadow:0 1px 4px #10101036}.velt-cursor-pointer-video-huddle-container[_ngcontent-%COMP%] .velt-cursor-pointer-video-huddle-block[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}.velt-cursor-pointer-video-huddle-container[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:var(--velt-border-radius-full);object-fit:cover}"],changeDetection:0});let r=i;return r})();var cn=["*"],Ht=r=>({componentConfigSignal:r}),ln=(r,i)=>({condition:r,data:i}),un=(r,i)=>({template:r,context:i,componentName:"velt-cursor-pointer-wireframe"});function mn(r,i){if(r&1&&(d(0),_(1,"velt-cursor-pointer-arrow-internal",5),be(2),b(),k(3,"velt-cursor-pointer-default-internal",5)(4,"velt-cursor-pointer-avatar-internal",5)(5,"velt-cursor-pointer-audio-huddle-internal",5)(6,"velt-cursor-pointer-video-huddle-internal",5),p()),r&2){let n=c(4);l(),a("componentConfigSignal",n.componentConfigSignal),l(2),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal),l(),a("componentConfigSignal",n.componentConfigSignal)}}function dn(r,i){if(r&1&&(_(0,"div",3),u(1,mn,7,5,"ng-container",4),b()),r&2){let n=c(2).ngIf,e=c();$("top",n.cursorUser==null||n.cursorUser.position==null?null:n.cursorUser.position.top,"px")("left",n.cursorUser==null||n.cursorUser.position==null?null:n.cursorUser.position.left,"px"),Z("no-transition",n.selfCursorPointer),l(),a("veltDynamicTemplate",x(9,un,n.template,C(7,Ht,e.componentConfigSignal)))}}function pn(r,i){if(r&1&&(d(0),u(1,dn,2,12,"div",2),p()),r&2){let n=c().ngIf;l(),a("ngIf",n.cursorUser==null?null:n.cursorUser.position)}}function gn(r,i){if(r&1&&(d(0),u(1,pn,2,1,"ng-container",1),p()),r&2){let n=c();l(),a("veltIf",x(3,ln,n.conditionSignal(),C(1,Ht,n.componentConfigSignal)))}}var Ce=(()=>{let i=class i extends At{set cursorUser(e){this.componentConfigSignal.update(t=>(t=f(g({},t),{cursorUser:e}),t)),e?.color&&this.componentConfigSignal.update(t=>(t=f(g({},t),{lightenedColor:Ct(e?.color,80)}),t))}get stream(){return this._stream}set stream(e){this._stream=e,e&&this.startGainAnimation(e),this.serviceBook.get(K)?.updateHuddleCursorAvailableByAttendeeId(this.componentConfigSignal().cursorUser?.userSnippylyId,!!this.stream),this.updatePointerStates()}constructor(e,t,o,s,S){super(o,s),this.serviceBook=e,this.loggingService=t,this.elementRef=o,this.themeService=s,this.wireframeService=S,this.selfCursorPointer=!1,this.avatarMode=!1,this.showInitial=!1,this.veltElement=!0,this.componentConfigSignal=_e({template:this.template,variant:this.variant,selfCursorPointer:this.selfCursorPointer||!1,showDefault:!1,showAvatar:!1,showAudio:!1,showVideo:!1,gainVolume:void 0,lightenedColor:void 0,onImageLoadError:this.onImageLoadError.bind(this),getGainAnimationBorderStyle:this.getGainAnimationBorderStyle.bind(this),getTextColor:this.getTextColor.bind(this)}),this.subscriptions=[],this.componentId="velt-cursor-pointer"}ngOnInit(){try{let e="velt-cursor-pointer-wireframe";this.setupA11yAttributes(),this.updatePointerStates(),this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let o=document.createElement(t.tagName);o.innerHTML=t.innerHTML,this.componentConfigSignal.update(s=>f(g({},s),{template:o}))}}))}catch(e){this.loggingService.catch("Error in CursorPointerComponent ngOnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Live cursor pointer indicator"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in CursorPointerComponent setupA11yAttributes:",e)}}ngAfterViewInit(){}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=f(g({},o),{[t]:e[t].currentValue}),o))}),(e.avatarMode||e.huddleState)&&this.updatePointerStates()}catch(t){this.loggingService.catch("Error in CursorPointerComponent ngOnChanges: ",t)}}startGainAnimation(e){try{let t=new AudioContext,o=t.createMediaStreamSource(e),s=t.createAnalyser();o.connect(s);let S=new Uint8Array(s.frequencyBinCount),M=()=>{s.getByteFrequencyData(S);let re=S.reduce((ne,Le)=>ne+Le,0)/S.length;this.componentConfigSignal.update(ne=>(ne=f(g({},ne),{gainVolume:re}),ne)),this.gainAnimationId=requestAnimationFrame(M)};this.gainAnimationId=requestAnimationFrame(M)}catch(t){this.loggingService.catch("Error in CursorPointerComponent startGainAnimation: ",t)}}stopGainAnimation(){try{this.gainAnimationId!==void 0&&cancelAnimationFrame(this.gainAnimationId),this.componentConfigSignal.update(e=>(e=f(g({},e),{gainVolume:void 0}),e))}catch(e){this.loggingService.catch("Error in CursorPointerComponent stopGainAnimation: ",e)}}getOutlineSizeByGainAmount(){try{if(this.componentConfigSignal().gainVolume!==void 0)return ft(0,5,Math.min(1,this.componentConfigSignal().gainVolume/15))}catch(e){this.loggingService.catch("Error in CursorPointerComponent getOutlineSizeByGainAmount: ",e)}return 0}getGainAnimationBorderStyle(){return this.getOutlineSizeByGainAmount()+"px solid "+(this.componentConfigSignal().lightenedColor||"white")+" !important"}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitial=!0,this.updatePointerStates()}catch(e){this.loggingService.catch("Error in CursorPointerComponent onImageLoadError: ",e)}}getTextColor(e){try{return e?St(e):"#141416"}catch(t){this.loggingService.catch("Error in CursorPointerComponent getTextColor: ",t)}return"#141416"}ngOnDestroy(){try{this.stopGainAnimation(),this.stream=void 0,super.ngOnDestroy(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in CursorPointerComponent ngOnDestroy: ",e)}}updatePointerStates(){try{let e=!!this.stream&&!!this.huddleState?.audioState&&!this.huddleState?.videoState,t=!!this.stream&&!!this.huddleState?.videoState,o=!e&&!t&&!!this.avatarMode&&!this.showInitial,s=!e&&!t&&(!this.avatarMode||!!this.avatarMode&&this.showInitial);(s!==this.componentConfigSignal().showDefault||o!==this.componentConfigSignal().showAvatar||e!==this.componentConfigSignal().showAudio||t!==this.componentConfigSignal().showVideo)&&this.componentConfigSignal.update(S=>(S=g({},S),S.showDefault=s,S.showAvatar=o,S.showAudio=e,S.showVideo=t,S))}catch(e){this.loggingService.catch("Error in CursorPointerComponent updatePointerStates: ",e)}}};i.\u0275fac=function(t){return new(t||i)(m(G),m(v),m(E),m(Pt),m(Ot))},i.\u0275cmp=O({type:i,selectors:[["snippyly-cursor-pointer"]],hostVars:1,hostBindings:function(t,o){t&2&&P("data-velt-element",o.veltElement)},inputs:{cursorUser:"cursorUser",selfCursorPointer:"selfCursorPointer",avatarMode:"avatarMode",huddleState:"huddleState",variant:"variant",template:"template",stream:"stream"},standalone:!1,features:[D,Qe],ngContentSelectors:cn,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-cursor-pointer-container user-presence-pointer",3,"no-transition","top","left",4,"ngIf"],[1,"velt-cursor-pointer-container","user-presence-pointer"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"]],template:function(t,o){t&1&&(ye(),u(0,gn,2,6,"ng-container",0)),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[A,T,U,le,de,pe,he,fe],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events: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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000}*[_ngcontent-%COMP%]:empty{display:revert}.velt-cursor-pointer-container[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-cursor-z-index);-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;filter:brightness(110%) saturate(110%);transition:top linear 75ms,left linear 75ms}.velt-cursor-pointer-container.no-transition[_ngcontent-%COMP%]{transition:none}"],changeDetection:0});let r=i;return r})();function hn(r,i){if(r&1&&(_(0,"snippyly-cursor-pointer",5)(1,"slot",6),$e(),_(2,"svg",7)(3,"g",8),k(4,"path",9)(5,"path",10),b(),_(6,"defs")(7,"filter",11),k(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),b()()()()()),r&2){let n=c().$implicit,e=c(2).ngIf,t=c();a("cursorUser",n)("avatarMode",t.avatarMode)("huddleState",e.huddleOnCursorModeByAttendeeId[n==null?null:n.userSnippylyId]?e.attendeesByUserId[n==null?null:n.userSnippylyId]==null?null:e.attendeesByUserId[n==null?null:n.userSnippylyId].state:void 0)("stream",e.huddleOnCursorModeByAttendeeId[n==null?null:n.userSnippylyId]?e.remoteStreamsByUserId[n==null?null:n.userSnippylyId]==null?null:e.remoteStreamsByUserId[n==null?null:n.userSnippylyId].webcam:void 0),l(4),P("fill",n.color),l(),P("fill",n.color)}}function fn(r,i){if(r&1&&(d(0),u(1,hn,15,6,"snippyly-cursor-pointer",4),p()),r&2){let n=i.$implicit;l(),a("ngIf",n==null?null:n.position)}}function Cn(r,i){if(r&1&&(_(0,"snippyly-cursor-pointer",19)(1,"slot",6),$e(),_(2,"svg",7)(3,"g",8),k(4,"path",9)(5,"path",10),b(),_(6,"defs")(7,"filter",11),k(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),b()()()()()),r&2){let n=c(2).ngIf,e=c();a("cursorUser",n.currentCursorUser)("selfCursorPointer",!0)("avatarMode",e.avatarMode)("huddleState",n.huddleOnCursorMode?n.attendeesByUserId[n.currentCursorUser==null?null:n.currentCursorUser.userSnippylyId]==null?null:n.attendeesByUserId[n.currentCursorUser==null?null:n.currentCursorUser.userSnippylyId].state:void 0)("stream",n.localStream),l(4),P("fill",n.currentCursorUser.color),l(),P("fill",n.currentCursorUser.color)}}function Sn(r,i){if(r&1&&u(0,fn,2,1,"ng-container",2)(1,Cn,15,7,"snippyly-cursor-pointer",3),r&2){let n=c().ngIf,e=c();a("ngForOf",n.cursorUsers)("ngForTrackBy",e.trackById),l(),a("ngIf",n.huddleJoined&&n.huddleOnCursorMode&&n.currentCursorUser)}}function _n(r,i){if(r&1&&(d(0),u(1,Sn,2,3,"ng-template",1),p()),r&2){let n=i.ngIf;l(),a("ngIf",n.isFirstComponent&&!(n.user!=null&&n.user.isAnonymous))}}var Fe=(()=>{let i=class i{get inactivityTime(){return this._inactivityTime}set inactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Cursor set inactivityTime: ","inactivity-time value is not a number."):(this._inactivityTime=e,this.cursorService.setInactivityTime(this._inactivityTime))}catch(t){this.loggingService.catch("Error in Cursor set inactivityTime: ",t)}}get allowedElementIds(){return this._allowedElementIds}set allowedElementIds(e){try{this._allowedElementIds=typeof e=="string"?JSON.parse(e):e,this.cursorService.setAllowedElementIds(this._allowedElementIds)}catch(t){this.loggingService.catch("Error in Cursor set allowedElementIds: ",t)}}constructor(e,t,o,s,S,M,re){this.analyticsService=e,this.authService=t,this.cursorService=o,this.domService=s,this.elementRef=S,this.serviceBook=M,this.loggingService=re,this.avatarMode=!1,this.onCursorUsersChanged=new Ve,this.onCursorUserChange=new Ve,this.subscriptions=[],this.constants=y,this.showInitials={},this.componentConfigSignal=_e({isFirstComponent:!1,user:void 0,cursorUsers:[],huddleOnCursorModeByAttendeeId:{},attendeesByUserId:{},remoteStreamsByUserId:{},huddleOnCursorMode:!1,huddleJoined:!1,currentCursorUser:new Pe,localStream:void 0}),this.veltId=vt(),this.veltElement=!0,this._inactivityTime=5,this._allowedElementIds=[],this.loggingService.log("%c[WB] Creating CLASS: CursorComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{this.subscriptions.push(this.domService.subscribeInjectCustomCss(this.elementRef));let e=document.querySelector(y.TAGS.SNIPPYLY_CURSOR),t=document.querySelector(y.TAGS.VELT_CURSOR);t?this.veltId===t?.getAttribute(y.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(o=>(o=f(g({},o),{isFirstComponent:!0}),o)),this.initComponent()):this.veltId===e?.getAttribute(y.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(o=>(o=f(g({},o),{isFirstComponent:!0}),o)),this.initComponent())}catch(e){this.loggingService.catch("Error in CursorComponent AfterViewInit: ",e)}}initComponent(){try{this.cursorService.checkCursorTagAvailable(),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{user:e}),t)),this.componentConfigSignal().user&&this.setCursorInstalledInAnalytics()},e=>{this.loggingService.catch("Error in CursorComponent getUser$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleJoined$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{huddleJoined:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleJoined$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleOnCursorMode$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{huddleOnCursorMode:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleOnCursorMode$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.localStream$??ie)).subscribe(e=>{e?this.componentConfigSignal.update(t=>(t=f(g({},t),{localStream:e}),t)):this.componentConfigSignal.update(t=>(t=f(g({},t),{localStream:void 0}),t))},e=>{this.loggingService.catch("Error in CursorComponent localStream$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getRemoteStreamsByUserId$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{remoteStreamsByUserId:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getRemoteStreamsByUserId$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleAttendees$()??ie)).subscribe(e=>{let t={};e?t=e.reduce((o,s)=>(o[s.userSnippylyId]=s,o),{}):t={},this.componentConfigSignal.update(o=>(o=f(g({},o),{attendeesByUserId:t}),o))},e=>{this.loggingService.catch("Error in CursorComponent getAttendees$ subscription: ",e)})),this.subscriptions.push(this.serviceBook.observe(K).pipe(I(e=>e?.getHuddleOnCursorModeByAttendeeId$()??ie)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{huddleOnCursorModeByAttendeeId:e}),t))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleOnCursorModeByAttendeeId$ subscription: ",e)})),this.subscriptions.push(this.domService.onWindowPointerMove$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{currentCursorUser:f(g({},t.currentCursorUser),{position:{left:(e?.clientX||0)-2,top:(e?.clientY||0)-2}})}),t))},e=>{this.loggingService.catch("Error in CursorComponent onWindowPointerMove$ subscription: ",e)})),this.getCurrentCursorUser(),this.getLiveCursorsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in CursorComponent initComponent: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in CursorComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in CursorComponent unsubscribe: ",e)}}getLiveCursorsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.cursorService.getLiveCursorsOnCurrentDocument().pipe(H(e=>!!e)).subscribe(e=>{this.loggingService.log(e),e&&(this.componentConfigSignal.update(t=>(t=f(g({},t),{cursorUsers:e}),t)),this.onCursorUsersChanged.emit(e),this.onCursorUserChange.emit(e))},e=>{this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument: ",e)}}getCurrentCursorUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentCursorUser","color: green;");try{this.subscriptions.push(this.cursorService.getCursorUser().pipe(H(e=>!!e)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=f(g({},t),{currentCursorUser:f(g({},e),{position:t.currentCursorUser?.position})}),t))},e=>{this.loggingService.catch("Error in CursorComponent getCurrentCursorUser subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getCurrentCursorUser: ",e)}}trackById(e,t){return t?.userId}onImageLoadError(e){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitials[e.userId]=!0}catch(t){this.loggingService.catch("Error in CursorComponent onImageLoadError: ",t)}}setCursorInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(q.CURSOR)}catch(e){this.loggingService.catch("Error in CursorComponent setCursorInstalledInAnalytics: ",e)}}};i.\u0275fac=function(t){return new(t||i)(m(Ue),m(we),m(ee),m(Te),m(E),m(G),m(v))},i.\u0275cmp=O({type:i,selectors:[["app-cursor"]],hostVars:2,hostBindings:function(t,o){t&2&&P("data-velt-id",o.veltId)("data-velt-element",o.veltElement)},inputs:{avatarMode:"avatarMode",inactivityTime:"inactivityTime",allowedElementIds:"allowedElementIds"},outputs:{onCursorUsersChanged:"cursorUsersChanged",onCursorUserChange:"onCursorUserChange"},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[3,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream"],["name","cursor"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"cursor-icon"],["filter","url(#filter0_d_6047_31299)"],["d","M7.68749 16.5142L5.42791 5.15177C5.26065 4.31067 6.16027 3.66301 6.90484 4.08848L16.8788 9.78786C17.6558 10.2319 17.503 11.3948 16.6376 11.623L12.3849 12.7447C12.1377 12.8098 11.9249 12.9672 11.7902 13.1844L9.51802 16.8464C9.03968 17.6174 7.86445 17.4041 7.68749 16.5142Z","fill","#625DF5"],["d","M4.93751 5.24929L7.19709 16.6118C7.46253 17.9466 9.22538 18.2664 9.94288 17.11L12.215 13.448C12.2824 13.3394 12.3888 13.2607 12.5124 13.2281L16.7651 12.1065C18.0632 11.7642 18.2924 10.0198 17.1268 9.35374L7.15291 3.65436C6.03605 3.01615 4.68662 3.98765 4.93751 5.24929Z","stroke","white","stroke-linecap","square"],["id","filter0_d_6047_31299","x","0.588557","y","0.405717","width","21.6129","height","23.0055","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["flood-opacity","0","result","BackgroundImageFix"],["in","SourceAlpha","type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0","result","hardAlpha"],["dy","1.1"],["stdDeviation","1.2"],["type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.17 0"],["mode","normal","in2","BackgroundImageFix","result","effect1_dropShadow_6047_31299"],["mode","normal","in","SourceGraphic","in2","effect1_dropShadow_6047_31299","result","shape"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream"]],template:function(t,o){t&1&&u(0,_n,2,1,"ng-container",0),t&2&&a("ngIf",o.componentConfigSignal())},dependencies:[at,A,Ce],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}body.velt-pin-dragging iframe{pointer-events:none!important}*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));pointer-events:none!important}*:empty{display:revert}.cursor-icon path{stroke:#fff;stroke-width:1px;stroke-linejoin:round}
|
|
2
2
|
`],encapsulation:3,changeDetection:0});let r=i;return r})();var Re=class extends Tt{constructor(i){super(i),this.getService(v).log("%c[WB] Creating CLASS: CursorElement","color: blue;"),this.getLiveCursorsOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.allowedElementIds=this._allowedElementIds}_getOnlineUsersOnCurrentDocument(){this.getService(v).log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;");try{return this.trackEvent(oe.Events.Cursor.GET_LIVE_CURSORS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(ee).getLiveCursorsOnCurrentDocument()}catch(i){return this.getService(v).catch("Error in _getOnlineUsersOnCurrentDocument: ",i),B(null)}}_setInactivityTime(i){this.getService(v).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(oe.Events.Cursor.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:i}}),isNaN(i)?this.getService(v).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(ee).setInactivityTime(i)}catch(n){this.getService(v).catch("Error in setInactivityTime: ",n)}}_allowedElementIds(i){this.getService(v).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(oe.Events.Cursor.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:i}}),this.getService(ee).setAllowedElementIds(i)}catch(n){this.getService(v).catch("Error in allowedElementIds: ",n)}}};var zt=(()=>{let i=class i{};i.\u0275fac=function(t){return new(t||i)},i.\u0275mod=tt({type:i}),i.\u0275inj=qe({imports:[st,Ne,ke]});let r=i;return r})();var $t=(()=>{let i=class i{constructor(e,t,o){this.loggingService=e,this.usersService=t,this.serviceBook=o,this.serviceBook.set(De,this)}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let t=new Set;for(let o of e)o?.userId&&t.add(o?.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=g(g({},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(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};i.\u0275fac=function(t){return new(t||i)(L(v),L(xt),L(G))},i.\u0275prov=Se({token:i,factory:i.\u0275fac,providedIn:"root"});let r=i;return r})();var yn={"velt-cursor-pointer-wireframe":Ce,"velt-cursor-pointer-arrow-wireframe":le,"velt-cursor-pointer-audio-huddle-wireframe":de,"velt-cursor-pointer-audio-huddle-avatar-wireframe":me,"velt-cursor-pointer-audio-huddle-audio-wireframe":ue,"velt-cursor-pointer-avatar-wireframe":pe,"velt-cursor-pointer-default-wireframe":he,"velt-cursor-pointer-default-name-wireframe":ve,"velt-cursor-pointer-default-comment-wireframe":ge,"velt-cursor-pointer-video-huddle-wireframe":fe};Object.assign(Dt,yn);function bn(r){r.get(v).log("%c[WB] Loading cursor feature chunk","color: blue;");let n=r.get(G);n.set(Ae,r.get(ee)),n.set(De,r.get($t));let t=et(zt,r).injector;return Vt(t,y.TAGS.VELT_CURSOR,Fe),Vt(t,y.TAGS.SNIPPYLY_CURSOR,Fe),new Re(r)}function Vt(r,i,n){if(customElements.get(i))return;let e=ct(n,{injector:r});customElements.define(i,e)}export{bn as default};
|