@veltdev/sdk-staging 6.0.0-beta.13 → 6.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/app/models/data/config.data.model.d.ts +38 -5
  2. package/app/utils/enums.d.ts +1 -1
  3. package/{chunk-5JIXRA34.js → chunk-54BT4NQJ.js} +1 -1
  4. package/{chunk-N3AV6IGG.js → chunk-5EO5WTC7.js} +1 -1
  5. package/{chunk-Z77RD4H5.js → chunk-5I3MKJ2F.js} +1 -1
  6. package/{chunk-UF2D32ZI.js → chunk-5NMVUDFG.js} +1 -1
  7. package/{chunk-SXYSM6QP.js → chunk-62RN7JJN.js} +1 -1
  8. package/{chunk-JDZOVFS3.js → chunk-6K2VWE4K.js} +1 -1
  9. package/{chunk-SAPJAJDB.js → chunk-6OW5GJ3E.js} +1 -1
  10. package/{chunk-OHH7LESC.js → chunk-7PEWZDFC.js} +1 -1
  11. package/{chunk-YFZUZKVN.js → chunk-APPJN3VX.js} +1 -1
  12. package/{chunk-VMH5N5PO.js → chunk-B7JPRLBQ.js} +1 -1
  13. package/{chunk-TVX75U2C.js → chunk-CZWARF5M.js} +1 -1
  14. package/{chunk-P54MO3GU.js → chunk-ELEMLDFM.js} +1 -1
  15. package/{chunk-SG6UCHMH.js → chunk-EYPJC34Q.js} +1 -1
  16. package/{chunk-3H5W2TGU.js → chunk-HLPJRWIY.js} +1 -1
  17. package/{chunk-55YE7G6I.js → chunk-HNT7HKW3.js} +1 -1
  18. package/{chunk-DUIGMOMV.js → chunk-HPRUJRZF.js} +1 -1
  19. package/{chunk-XM2SXO32.js → chunk-IY3WJ7XZ.js} +1 -1
  20. package/{chunk-MLCIQM44.js → chunk-JAOM3JHX.js} +1 -1
  21. package/{chunk-N2SSZ74J.js → chunk-K5BJ5DAO.js} +1 -1
  22. package/{chunk-YEQZ76RF.js → chunk-KYEMQS6S.js} +1 -1
  23. package/{chunk-GHVMD37V.js → chunk-LHTLQZLP.js} +1 -1
  24. package/{chunk-JXMMR7DC.js → chunk-MRAZ6ENQ.js} +1 -1
  25. package/{chunk-T4D6QD4H.js → chunk-MZ2HKBWF.js} +1 -1
  26. package/{chunk-7MOQQG4Z.js → chunk-NLVNX52N.js} +1 -1
  27. package/chunk-O4F37U67.js +167 -0
  28. package/{chunk-JPM7CIV3.js → chunk-OEYWDDK3.js} +1 -1
  29. package/{chunk-GJ55RHPP.js → chunk-OK5VRMUL.js} +1 -1
  30. package/{chunk-AIQ4EOVH.js → chunk-POME7PZR.js} +1 -1
  31. package/{chunk-OWD3J56P.js → chunk-RD2BRSWO.js} +1 -1
  32. package/{chunk-GNMKNWD5.js → chunk-S4APJ64C.js} +1 -1
  33. package/{chunk-Q2QL77LS.js → chunk-TMYAQS7C.js} +1 -1
  34. package/{chunk-XM56PHBZ.js → chunk-WJFVURTP.js} +1 -1
  35. package/{chunk-CZTTDJFW.js → chunk-XYR7TNZL.js} +1 -1
  36. package/package.json +1 -1
  37. package/velt-activity-log.js +1 -1
  38. package/velt-area.js +1 -1
  39. package/velt-arrow.js +1 -1
  40. package/velt-comment.js +1 -1
  41. package/velt-crdt.js +1 -1
  42. package/velt-cursor.js +1 -1
  43. package/velt-huddle.js +1 -1
  44. package/velt-live-state-sync.js +1 -1
  45. package/velt-notification.js +1 -1
  46. package/velt-presence.js +1 -1
  47. package/velt-reaction.js +1 -1
  48. package/velt-recorder.js +1 -1
  49. package/velt-rewriter.js +1 -1
  50. package/velt-selection.js +1 -1
  51. package/velt-tag.js +1 -1
  52. package/velt-user-invite.js +1 -1
  53. package/velt-user-request.js +1 -1
  54. package/velt-video-player.js +1 -1
  55. package/velt-views.js +1 -1
  56. package/velt.js +2 -2
  57. package/chunk-NFOSJ24G.js +0 -167
package/velt-huddle.js CHANGED
@@ -1,3 +1,3 @@
1
- import{a as cn}from"./chunk-VMH5N5PO.js";import{a as ln}from"./chunk-XM56PHBZ.js";import{c as _t,d as ft}from"./chunk-SAPJAJDB.js";import{a as sn}from"./chunk-TVX75U2C.js";import{a as dn}from"./chunk-JXMMR7DC.js";import{a as gn}from"./chunk-MLCIQM44.js";import"./chunk-T4D6QD4H.js";import{b as It,c as wt,g as Mt,l as Et,m as Ot,s as Dt,u as Ut,v as Lt,w as Bt}from"./chunk-JDZOVFS3.js";import{b as Q,c as Te,d as pe}from"./chunk-GNMKNWD5.js";import{a as an}from"./chunk-5JIXRA34.js";import{a as on}from"./chunk-SXYSM6QP.js";import{a as xt}from"./chunk-AIQ4EOVH.js";import{A as yt,G as xe,H as ke,I as bt,Y as Pt,ba as Vt,ea as nn,ga as rn}from"./chunk-N2SSZ74J.js";import{$ as Se,Aa as tt,Bf as jt,Ca as fe,Db as ot,Dd as kt,De as M,E as te,Eb as at,Ec as ht,Fa as d,Fb as lt,Fc as ge,Fh as Jt,G as qe,Ga as X,Gc as J,Gh as Yt,Gi as en,Hc as vt,Hi as tn,Ib as F,Ic as Ct,J as he,Jb as ye,Kb as q,L as Be,Lb as st,Mf as Ne,Nb as A,Nd as Ht,Nf as He,Ob as N,Pa as I,Pb as ie,Pc as St,Qb as be,Sb as dt,Sd as Tt,Se as Nt,T as Y,Ta as nt,Tb as ct,Td as At,Te as Rt,Ua as G,Ub as gt,Ug as we,Va as it,W as Xe,Ya as rt,Yb as ut,Zb as pt,_a as _,a as p,aa as Qe,ac as ve,ae as Ft,af as $t,ai as Me,b as m,bi as le,ca as B,ci as w,da as et,db as K,dc as mt,di as Ee,g as y,gi as Kt,ha as v,he as Fe,i as Je,ia as C,ii as qt,ja as k,ka as re,kc as b,ki as ue,l as L,lb as g,lc as x,li as se,mb as l,nb as u,ne as ae,ob as S,pc as Z,pg as Ie,q as Ye,qa as W,r as P,rh as Wt,sb as D,si as Xt,tb as U,ua as ne,uh as V,v as z,vb as E,vg as zt,vh as Gt,w as Ke,wa as _e,xb as f,xh as Zt,xi as Qt,yi as Oe,zb as s}from"./chunk-NFOSJ24G.js";var Ae=(()=>{let o=class o{constructor(e,t,i){this.coreActionsService=e,this.loggingService=t,this.usersService=i}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let i of e)i?.userId&&t.add(i?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",t),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=p(p({},e),t))}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",t),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(i=>{t.includes(i)||(e[i]=null)})}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",t),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let t=new Set;for(let i of e)i?.from?.userId&&t.add(i?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",t),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",t),e}}resolveUsersFromHuddleMessages(e){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),i=He(),a=Rt.GET_HUDDLE_USERS;this.coreActionsService.triggerAction(Ft.USER_RESOLVER,{event:V.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:i,methodName:Nt.RESOLVE_USERS_FROM_HUDDLE_MESSAGES,moduleName:a,source:"internal",payload:{userIds:t}});let c=yield this.usersService.resolveUsers({userIds:t,uniqueId:i,moduleName:a});for(let h of e)h?.from?.userId&&c[h.from.userId]&&(h.from=c[h.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(B(qt),B(w),B(Oe))},o.\u0275prov=Se({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var R=(()=>{let o=class o{constructor(e,t,i,a,c,h,H,$,T,ee,mn,hn,vn,Cn){this.afAuth=e,this.analyticsService=t,this.authService=i,this.databaseService=a,this.docService=c,this.configService=h,this.domService=H,this.huddleUtilsService=$,this.functions=T,this.loggingService=ee,this.commonDbService=mn,this.usersService=hn,this.serviceBook=vn,this.realtimeAdapter=Cn,this.endpointsService=et(Kt),this.documentPaths=null,this.localStream$=new L(null),this.peerConnectionMap={},this.localStream=new MediaStream,this.screenSharingStream=new MediaStream,this.screenSharingStream$=new L(null),this.remoteStreamMap={},this.remoteStreamMap$=new L(null),this.localStreamState$=new L({}),this.peerConnectionStateMap={},this.peerConnectionStateMap$=new L({}),this.hudleToolComponentId$=new L(null),this.attendees$=new L([]),this.invitees$=new L([]),this.huddleJoined$=new L(!1),this.userHuddleStartTime$=new L(null),this.messages$=new L([]),this.messagesPanelVisible$=new L(!1),this.huddleOnCursorMode$=new L(!1),this.flockModeOnAvatarClickEnabled$=new L(!1),this.chatEnabled$=new L(!0),this.serverFallback$=new L(!0),this.huddleOnCursorModeByAttendeeId$=new L({}),this.huddleCursorAvailableByAttendeeId$=new L({}),this.remoteStreamsByUserId$=new L({}),this.messagesSubscription=null,this.huddleJoined=!1,this.onAnswerConnectionIdHistory={},this.onOfferUidHistory={},this.senders={},this.db=null,this.dbRefsRemoveOnDropCall=[],this.servers={iceServers:[{urls:["stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302"]}]},this.databaseService.getDb().pipe(te(O=>!!O),he(1)).subscribe(O=>{try{O&&(this.db=O,this.isHuddleTagInstalled()&&this.getServerFallback()&&this.getTwilioIceServers(),this.getUser(),this.getDocumentPaths())}catch(j){this.loggingService.catch("Error in HuddleService getDb:",j)}},O=>{this.loggingService.catch("Error in HuddleService getDb subscription: ",O)}),this.docService.addPreDocumentIdChangeFunction("huddle-service",O=>y(this,null,function*(){this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee(),this.attendees$.next([]))})),this.getAttendees().subscribe(),this.getInvitees().subscribe(),this.localStream$.subscribe(O=>{O&&(this.localStream=O)}),this.screenSharingStream$.subscribe(O=>{O&&(this.screenSharingStream=O)}),this.configService.getConfig$().subscribe(O=>{try{!O?.featureAllowList?.find(ce=>ce===ae.CURSOR)&&this.huddleOnCursorMode$.next(!1)}catch(j){this.loggingService.catch("Error in HuddleService configService.getConfig$:",j)}},O=>{this.loggingService.catch("Error in HuddleService configService.getConfig$ subscription: ",O)}),this.attendees$.subscribe(O=>{try{if(O?.length){if(this.huddleOnCursorMode$?.value){let j=this.huddleOnCursorModeByAttendeeId$.getValue()||{};O.forEach(ce=>{j[ce.userSnippylyId]=!0}),this.huddleOnCursorModeByAttendeeId$.next(j)}this.huddleJoined$?.value&&(O?.find(j=>j?.huddleOnCursorMode)?this.addCursorTag():this.removeCursorTag())}}catch(j){this.loggingService.catch("Error in HuddleService attendees$:",j)}},O=>{this.loggingService.catch("Error in HuddleService attendees$ subscription: ",O)}),Ke([this.huddleJoined$,this.huddleOnCursorMode$]).subscribe(([O,j])=>{try{if(O){if(j){let ce=this.attendees$.getValue()||[],Sn=this.huddleOnCursorModeByAttendeeId$.getValue()||{};ce.forEach(_n=>{Sn[_n.userSnippylyId]=!0}),document?.body?.setAttribute(M.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE,"true")}else this.huddleOnCursorModeByAttendeeId$.next({}),document?.body?.removeAttribute(M.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE);this.updateHuddleOnCursorMode()}else this.removeCursorTag(),document?.body?.removeAttribute(M.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE)}catch(ce){this.loggingService.catch("Error in HuddleService huddleJoined$:",ce)}},O=>{this.loggingService.catch("Error in HuddleService huddleJoined$ subscription: ",O)}),this.huddleOnCursorModeByAttendeeId$.subscribe(O=>{try{this.huddleJoined&&(Object.keys(O).length?this.addCursorTag():this.removeCursorTag())}catch(j){this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$:",j)}},O=>{this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$ subscription: ",O)}),this.authService.addPreSignOutFuction("huddle-signout",this.signOutUser.bind(this))}isHuddleTagInstalled(){try{return!!document?.querySelector(`${M.TAGS.VELT_HUDDLE}`)||!!document?.querySelector(`${M.TAGS.SNIPPYLY_HUDDLE}`)}catch(e){return this.loggingService.catch("Error in HuddleService isHuddleTagInstalled:",e),!1}}getTwilioIceServers(){return y(this,null,function*(){try{let t=(yield Gt(this.functions,Wt({url:this.endpointsService.getCloudFunctionUrl("getIceServers"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5})())?.data;t&&t?.iceServers&&(this.servers.iceServers=t.iceServers)}catch(e){this.loggingService.catch("Error in HuddleService getTwilioIceServers:",e)}})}getRemoteStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getRemoteStream","color: green;"),this.remoteStreamMap$.asObservable()}getPeerConnectionStateMap(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPeerConnectionStateMap","color: green;"),this.peerConnectionStateMap$.asObservable()}getLocalStreamState(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStreamState","color: green;"),this.localStreamState$.asObservable()}getScreenSharingStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScreenSharingStream","color: green;"),this.screenSharingStream$.asObservable()}getAttendees(){return this.authService.getAuthState$().pipe(te(e=>!!e),z(e=>({firebaseUser:e})),Y(e=>this.configService.getConfig$().pipe(te(t=>!!t),z(t=>m(p({},e),{config:t})))),Y(e=>this.authService.getUser$().pipe(z(t=>m(p({},e),{user:t})))),Y(e=>Ne(e.config,e.user,ae.HUDDLE)?P(m(p({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),P(m(p({},e),{allowed:!1})))),Be((e,t)=>e?.allowed===t?.allowed),Y(e=>this.docService.getDocumentPaths$().pipe(z(t=>(this.documentPaths=t,e)))),Y(e=>e?.allowed?e?.user?.isAnonymous?P(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleAttendees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(z(t=>t?.data),z(t=>t?(this.attendees$.next(Object.values(t)),Object.values(t)):(this.attendees$.next([]),null))):P(null):P([])))}getInvitees(){try{return this.authService.getAuthState$().pipe(te(e=>!!e),z(e=>({firebaseUser:e})),Y(e=>this.configService.getConfig$().pipe(te(t=>!!t),z(t=>m(p({},e),{config:t})))),Y(e=>this.authService.getUser$().pipe(z(t=>m(p({},e),{user:t})))),Y(e=>Ne(e.config,e.user,ae.HUDDLE)?P(m(p({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),P(m(p({},e),{allowed:!1})))),Be((e,t)=>e?.allowed===t?.allowed),Y(e=>this.docService.getDocumentPaths$().pipe(z(t=>(this.documentPaths=t,e)))),Y(e=>e?.allowed?e?.user?.isAnonymous?P(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(z(t=>t?.data),z(t=>t?(this.invitees$.next(Object.values(t)),Object.values(t)):(this.invitees$.next([]),null))):P(null):P([])))}catch(e){return this.loggingService.catch("Error in HuddleService getInvitees:",e),P([])}}clearHuddleInvitees(){try{this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService clearHuddleInvitees:",e)}}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(te(e=>!!e)).subscribe(e=>{e&&(this.user=e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(Xe(e=>{this.documentPaths=e})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}setHuddleToolComponentId(e){this.hudleToolComponentId$.next(e||null)}getHuddleToolComponentId(){return this.hudleToolComponentId$.asObservable()}joinHuddle(e){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: joinHuddle","color: green;"),this.documentPaths?.huddle?(this.initialHuddleType=e,this.huddleJoined=!0,this.huddleJoined$.next(!0),this.initLocalStreams(),this.huddle=this.realtimeAdapter.rtdbRef(this.db,this.documentPaths?.huddle),this.iceCandidates=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/iceCandidates`),this.connections=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/connections`),this.attendees=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/attendees`),this.messages=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/messages`),this.setHuddleListener(),this.addAttendee(),this.callExistingAttendees(),this.userHuddleStartTime$.next(new Date().getTime())):this.loggingService.catch("Error in joinHuddle: documentPaths not found")}catch(t){this.loggingService.catch("Error in HuddleService joinHuddle:",t)}})}initLocalStreams(){try{if(!this.localStream$?.value?.getTracks()?.length){let e=new MediaStream([this.silence(),this.black()]);this.localStream$.next(e)}if(!this.screenSharingStream$?.value?.getTracks()?.length){let e=new MediaStream([this.black()]);this.screenSharingStream$.next(e)}}catch(e){this.loggingService.catch("Error in HuddleService initLocalStreams:",e)}}setHuddleListener(){this.loggingService.log("%c[WB] Calling FUNCTION: setHuddleListener","color: green;"),this.realtimeAdapter.rtdbOnValue("huddle",this.connections,e=>{try{if(e.exists()){let t=e.val();Object.values(t).forEach(a=>{let c=Object.values(a);if(c&&c.length>0){let H=c[0]?.connectionId;this.onHuddleSnapshot(H,a)}}),Object.keys(this.remoteStreamMap).forEach(a=>y(this,null,function*(){t[a]||(this.remoteStreamMap[a]&&Object.values(this.remoteStreamMap[a]).forEach(c=>{c.getTracks().forEach(h=>{h.stop()})}),delete this.remoteStreamMap[a],yield this.removeIceCandidates(a))})),this.remoteStreamMap$.next(this.remoteStreamMap)}else Object.keys(this.remoteStreamMap).forEach(t=>y(this,null,function*(){Object.values(this.remoteStreamMap[t]).forEach(i=>{i.getTracks().forEach(a=>{a.stop()})}),yield this.removeIceCandidates(t)})),this.remoteStreamMap={},this.remoteStreamMap$.next(this.remoteStreamMap)}catch(t){this.loggingService.catch("Error in HuddleService setHuddleLister onValue:",t)}}),this.realtimeAdapter.rtdbStateChanges$("huddle",this.iceCandidates).subscribe(e=>{try{e.event==="child_added"&&this.onIceCandidateSnapshot(e.snapshot)}catch(t){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",t)}}),this.realtimeAdapter.rtdbStateChanges$("huddle",this.attendees).subscribe(e=>{try{if(e.event==="child_removed"){let t=e?.snapshot?.val();if(t){delete this.onOfferUidHistory[t?.userSnippylyId];let i=this.getCombinedId(this.user.userSnippylyId,t?.userSnippylyId);delete this.onAnswerConnectionIdHistory[i],this.closeConnection(i)}}}catch(t){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",t)}}),this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.messagesSubscription=new Je(e=>{let t=this.realtimeAdapter.rtdbOnValue("huddle",this.messages,i=>e.next(i),i=>e.error(i));return()=>t()}).pipe(Y(e=>this.usersService.getUserById$().pipe(z(()=>e))),Y(e=>{if(e.exists()){let t=e.val();return Ye(this.huddleUtilsService.resolveUsersFromHuddleMessages(Object.values(t||{})))}return P([])}),qe(e=>(this.loggingService.catch("Error in HuddleService messages onValue:",e),P([])))).subscribe(e=>{this.messages$.next(e)})}onHuddleSnapshot(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: onHuddleSnapshot","color: green;"),t.offerData&&!t.answerData&&t.offerData.from!==this.user.userSnippylyId&&t.offerData.to===this.user.userSnippylyId&&!(e in this.peerConnectionMap)&&!this.onOfferUidHistory[t.offerData.from]?(this.loggingService.log("offer received"),this.loggingService.log(t),this.onOfferUidHistory[t.offerData.from]=!0,this.onOffer(e,t.offerData)):t.answerData&&t.answerData.from!==this.user.userSnippylyId&&t.answerData.to===this.user.userSnippylyId&&this.peerConnectionMap[e]&&this.peerConnectionMap[e]?.connectionState!=="connected"&&!this.onAnswerConnectionIdHistory[e]&&(this.loggingService.log("answer received"),this.loggingService.log(t),this.onAnswerConnectionIdHistory[e]=!0,this.onAnswer(e,t.answerData))}catch(i){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",i)}}onIceCandidateSnapshot(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateSnapshot","color: green;"),this.loggingService.log("ice candidate received");let t=e.val(),i=t.connectionId;t?.from!==this.user.userSnippylyId&&i in this.peerConnectionMap&&this.onIceCandidateChange(i,t)}catch(t){this.loggingService.catch("Error in HuddleService onIceCandidateSnapshot:",t)}}onOffer(e,t){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onOffer","color: green;"),this.createPeerConnection(e,t.from)){this.addLocalStreamToPeerConnection(e,!0);let a=t.offer;yield this.setRemoteDescription(e,a),yield this.sendAnswer(e,t.from)}}catch(i){this.loggingService.catch("Error in HuddleService onOffer:",i)}})}sendAnswer(e,t){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendAnswer","color: green;"),this.loggingService.log(e),this.documentPaths?.huddle&&e){let i=yield this.peerConnectionMap[e].createAnswer();yield this.setLocalDescription(e,i);let c={answer:{type:i.type,sdp:i.sdp},from:this.user.userSnippylyId,connectionId:e,to:t},h=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/connections/${e}`);this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:h}),yield this.realtimeAdapter.rtdbUpdate("huddle",h,{answerData:c}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",h)}else this.loggingService.catch("Error in sendAnswer: documentPaths not found")}catch(i){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",i)}})}onAnswer(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onAnswer","color: green;");let i=t.answer;yield this.setRemoteDescription(e,i)}catch(i){this.loggingService.catch("Error in HuddleService onAnswer:",i)}})}onIceCandidateChange(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateChange","color: green;");let i=t.candidate;this.loggingService.log("onIceCandidateChange",i),yield this.peerConnectionMap[e].addIceCandidate(new RTCIceCandidate(i))}catch(i){this.loggingService.catch("Error in HuddleService onIceCandidateChange:",i)}})}setRemoteDescription(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRemoteDescription","color: green;"),yield this.peerConnectionMap[e].setRemoteDescription(new RTCSessionDescription(t))}catch(i){this.loggingService.catch("Error in HuddleService setRemoteDescription:",i)}})}addAttendee(){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: addAttendee","color: green;"),this.documentPaths?.huddle&&this.user?.userSnippylyId){let e=m(p({},this.user),{timestamp:this.timestamp,streamMetadata:{webcam:this.localStream?.id,screen:this.screenSharingStream?.id},initialHuddleType:this.initialHuddleType,huddleOnCursorMode:this.huddleOnCursorMode$?.value});e=this.huddleUtilsService.formatHuddleAttendeeData(e);let t=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}`);yield this.realtimeAdapter.rtdbSet("huddle",t,JSON.parse(JSON.stringify(e))),this.dbRefsRemoveOnDropCall.push({type:"attendee",dbRef:t}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",t),yield this.updateUserHuddleState()}else this.loggingService.catch("Error in addAttendee: documentPaths not found")}catch(e){this.loggingService.catch("Error in HuddleService addAttendee:",e)}})}callExistingAttendees(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callExistingAttendees","color: green;"),this.realtimeAdapter.rtdbListVal$("huddle",this.attendees).pipe(he(1)).subscribe(e=>{e&&e.length>1?(e.forEach(t=>{t.userSnippylyId!==this.user.userSnippylyId&&!this.onOfferUidHistory[t.userSnippylyId]&&(this.loggingService.log("calling"),this.loggingService.log(t),this.initOffer(t.userSnippylyId))}),this.addLocalStreamToAllPeerConnections()):this.deleteMessages()})}catch(e){this.loggingService.catch("Error in HuddleService callExistingAttendees:",e)}}addLocalStreamToAllPeerConnections(){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToAllPeerConnections","color: green;"),Object.keys(this.senders).forEach(e=>{this.loggingService.log(this.senders[e]),this.localStream.getTracks().forEach(t=>{this.loggingService.log(t),this.senders[e].replaceTrack(t)})})}catch(e){this.loggingService.catch("Error in HuddleService addLocalStreamToAllPeerConnections:",e)}})}initOffer(e){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: initOffer","color: green;");let t=this.createPeerConnection(null,e);t&&(this.addLocalStreamToPeerConnection(t,!1),yield this.sendOffer(t,e))}catch(t){this.loggingService.catch("Error in HuddleService initOffer:",t)}})}createPeerConnection(e,t){try{return this.loggingService.log("%c[WB] Calling FUNCTION: createPeerConnection","color: green;"),e||(e=this.getCombinedId(this.user?.userSnippylyId,t)),e in this.peerConnectionMap?null:(this.loggingService.log("creating pc"),this.peerConnectionMap[e]=new RTCPeerConnection(this.servers),this.peerConnectionMap[e].onicecandidateerror=i=>{this.loggingService.log("Huddle: onicecandidateerror",i)},this.peerConnectionMap[e].onicecandidate=i=>{if(this.loggingService.log("pc onicecandidate"),i.candidate){let a={candidate:i.candidate.toJSON(),from:this.user.userSnippylyId,connectionId:e},c=this.realtimeAdapter.rtdbPush("huddle",this.iceCandidates,a);this.dbRefsRemoveOnDropCall.push({type:"iceCandidate",dbRef:c}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",c)}},this.peerConnectionMap[e].ontrack=i=>{this.loggingService.log("pc ontrack"),this.onTrack(e,i)},this.peerConnectionMap[e].onconnectionstatechange=i=>y(this,null,function*(){this.logStatuses("onconnectionstatechange",e,i),this.peerConnectionMap[e].connectionState==="failed"&&(this.removeConnection(e),this.closeConnection(e),this.checkForRemovingAttendee())}),this.peerConnectionMap[e].onicegatheringstatechange=i=>y(this,null,function*(){this.logStatuses("onicegatheringstatechange",e,i)}),this.peerConnectionMap[e].onsignalingstatechange=i=>y(this,null,function*(){this.logStatuses("onsignalingstatechange",e,i)}),this.peerConnectionMap[e].oniceconnectionstatechange=i=>y(this,null,function*(){this.loggingService.log("pc oniceconnectionstatechange"),this.logStatuses("oniceconnectionstatechange",e,i);try{this.peerConnectionStateMap[e]=this.peerConnectionMap[e].iceConnectionState,this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.peerConnectionMap[e]?.iceConnectionState==="connected"?(this.loggingService.log("connected"),this.updateTransceiverDirection(e)):this.peerConnectionMap[e]?.iceConnectionState==="disconnected"?this.loggingService.log("Disconnected"):this.peerConnectionMap[e].iceConnectionState==="closed"&&(this.loggingService.log("Closed"),this.closeConnection(e))}catch(a){this.loggingService.catch("Error in HuddleService oniceconnectionstatechange:",a)}}),this.peerConnectionMap[e].onnegotiationneeded=()=>{this.loggingService.log("pc onnegotiationneeded"),this.logStatuses("onnegotiationneeded",e)},e)}catch(i){return this.loggingService.catch("Error in HuddleService createPeerConnection:",i),""}}logStatuses(e,t,i){let a={};["connectionState","iceConnectionState","iceGatheringState","signalingState"].forEach(h=>{a[h]=this.peerConnectionMap[t][h]}),this.loggingService.log("Huddle: logStatues: ",t,e,a,i,this.peerConnectionMap[t])}checkForRemovingAttendee(){return y(this,null,function*(){try{this.documentPaths?.huddle&&this.user?.userSnippylyId&&(Object.keys(this.peerConnectionMap)?.length||(this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}}),this.joinHuddle(this.initialHuddleType)))}catch(e){this.loggingService.catch("Error in HuddleService checkForRemovingAttendee:",e)}})}closeConnection(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: closeConnection","color: green;"),this.peerConnectionMap[e]){let t=this.peerConnectionMap[e];t.getTransceivers()?.forEach(a=>{a.stop()}),t.getReceivers()?.forEach(a=>{a.track?.stop()}),t.close(),delete this.peerConnectionMap[e],delete this.onAnswerConnectionIdHistory[e],delete this.senders[e];let i=e.split("__").find(a=>a!==this.user?.userSnippylyId);i&&delete this.onOfferUidHistory[i]}}catch(t){this.loggingService.catch("Error in HuddleService closeConnection:",t)}}removeConnection(e){return y(this,null,function*(){try{this.documentPaths?.huddle&&e&&this.commonDbService.deleteData({feature:"huddleConnection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in HuddleService removeConnection:",t)}})}addLocalStreamToPeerConnection(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToPeerConnection","color: green;"),t?(this.localStream.getTracks().forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.screenSharingStream)})):(this.localStream.getTracks().forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.screenSharingStream)}))}catch(i){this.loggingService.catch("Error in HuddleService addLocalStreamToPeerConnection:",i)}}updateTransceiverDirection(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateTransceiverDirection","color: green;");let t=this.peerConnectionMap[e].getTransceivers();this.loggingService.log(t),t.map(i=>{this.loggingService.log(i.currentDirection),i.currentDirection!=="sendrecv"&&(i.direction="sendrecv"),this.senders[e]=i.sender})}catch(t){this.loggingService.catch("Error in HuddleService updateTransceiverDirection:",t)}}generateKey(){this.loggingService.log("%c[WB] Calling FUNCTION: generateKey","color: green;");let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let i=0;i<20;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}getCombinedId(e,t){try{return e.localeCompare(t)===-1?`${e}__${t}`:`${t}__${e}`}catch(i){return this.loggingService.catch("Error in HuddleService getCombinedId:",i),""}}sendOffer(e,t){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendOffer","color: green;"),this.documentPaths?.huddle&&e){this.onOfferUidHistory[t]=!0;let i=yield this.peerConnectionMap[e].createOffer();yield this.setLocalDescription(e,i);let a={sdp:i.sdp,type:i.type};t||(t="all");let c={offer:a,from:this.user.userSnippylyId,connectionId:e,to:t},h=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/connections/${e}`);yield this.realtimeAdapter.rtdbSet("huddle",h,{offerData:c}),this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:h}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",h)}}catch(i){this.loggingService.catch("Error in HuddleService sendOffer:",i)}})}setLocalDescription(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocalDescription","color: green;"),yield this.peerConnectionMap[e].setLocalDescription(t)}catch(i){this.loggingService.catch("Error in HuddleService setLocalDescription:",i)}})}onTrack(e,t){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onTrack","color: green;"),this.remoteStreamMap[e]||(this.remoteStreamMap[e]={}),this.loggingService.log(t.receiver.track),t?.streams?.length){this.remoteStreamMap[e][t.streams[0].id]=t.streams[0];let i=e.split("__").find(c=>c!==this.user?.userSnippylyId),a=this.attendees$.value?.find(c=>c?.userSnippylyId===i);a&&(a?.streamMetadata?.webcam===t.streams[0].id&&(this.remoteStreamMap[e].webcam=t.streams[0]),a?.streamMetadata?.screen===t.streams[0].id&&(this.remoteStreamMap[e].screen=t.streams[0])),this.remoteStreamMap$.next(this.remoteStreamMap)}}catch(i){this.loggingService.catch("Error in HuddleService onTrack:",i)}}toggleScreenSharing(e){return y(this,null,function*(){try{if(e)this.screenSharingStream=yield navigator.mediaDevices?.getDisplayMedia({video:!0}),Object.keys(this.peerConnectionMap).forEach(t=>{this.peerConnectionMap[t].getSenders().find(c=>c?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind)?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])});else{let t=this.localStream;Object.keys(this.peerConnectionMap).forEach(i=>{this.peerConnectionMap[i].getSenders().find(h=>h?.track?.kind==t.getVideoTracks()[0].kind)?.replaceTrack(t.getVideoTracks()[0])}),this.screenSharingStream?.getTracks().forEach(i=>i.stop())}}catch(t){this.loggingService.catch("Error in HuddleService toggleScreenSharing:",t)}})}setLocalStream(e){return y(this,null,function*(){try{if(this.localStream=new MediaStream([this.silence(),this.black()]),e?.audio||e?.video){let t=e,i=we();e?.audio&&(e?.audio instanceof Object?t.audio=m(p({},e?.audio),{deviceId:i?.selectedAudioDevice?.deviceId}):t.audio={deviceId:i?.selectedAudioDevice?.deviceId}),e?.video&&(e?.video instanceof Object?t.video=m(p({},e?.video),{deviceId:i?.selectedVideoDevice?.deviceId}):t.video={deviceId:i?.selectedVideoDevice?.deviceId});let a=yield navigator.mediaDevices.getUserMedia(t);a?.getAudioTracks()?.length&&(this.localStream.getAudioTracks().forEach(c=>this.localStream.removeTrack(c)),a.getAudioTracks().forEach(c=>this.localStream.addTrack(c))),a?.getVideoTracks()?.length&&(this.localStream.getVideoTracks().forEach(c=>this.localStream.removeTrack(c)),a.getVideoTracks().forEach(c=>this.localStream.addTrack(c)))}this.localStream$.next(this.localStream)}catch(t){this.loggingService.catch("Error in HuddleService setLocalStream:",t)}})}setScreenSharingStream(){return y(this,null,function*(){try{let e=yield navigator.mediaDevices?.getDisplayMedia({video:!0});e&&this.screenSharingStream$.next(e)}catch(e){this.loggingService.catch("Error in HuddleService setScreenSharingStream:",e)}})}removeLocalStream(){return y(this,null,function*(){try{this.localStream$?.value&&(this.localStream$.value.getTracks().forEach(t=>{t.stop()}),this.localStream$.next(null))}catch(e){this.loggingService.catch("Error in HuddleService removeLocalStream:",e)}})}toggleLocalStreamAudio(e){return y(this,null,function*(){try{let t=this.localStream$.value;if(t){let i=t.getAudioTracks()[0];if(i.enabled&&!e)i.stop(),t.getAudioTracks()?.forEach(a=>{t.removeTrack(a)}),t.addTrack(this.silence()),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_AUDIO_MUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=we(),c=yield navigator.mediaDevices.getUserMedia({audio:{deviceId:a?.selectAudioDevice?.deviceId}});c&&(t.getAudioTracks()?.forEach(h=>{t.removeTrack(h)}),c.getAudioTracks()?.forEach(h=>{t.addTrack(h)}),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_AUDIO_UNMUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(h=>h?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(h=>h?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(H=>H?.track?.kind==t?.getAudioTracks()[0].kind)?.replaceTrack(t?.getAudioTracks()[0])}),this.updateUserHuddleState()}}catch(t){this.loggingService.catch("Error in HuddleService toggleLocalStreamAudio:",t)}})}toggleLocalStreamVideo(e){return y(this,null,function*(){try{let t=this.localStream$.value;if(t){let i=t.getVideoTracks()[0];if(i.enabled&&!e)i.stop(),t.getVideoTracks()?.forEach(a=>{t.removeTrack(a)}),t.addTrack(this.black()),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_VIDEO_TURNED_OFF,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=we(),c=yield navigator.mediaDevices.getUserMedia({video:{deviceId:a?.selectedVideoDevice?.deviceId}});c&&(t.getVideoTracks()?.forEach(h=>{t.removeTrack(h)}),c.getVideoTracks()?.forEach(h=>{t.addTrack(h)}),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_VIDEO_TURNED_ON,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(h=>h?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(h=>h?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(H=>H?.track?.kind==t?.getVideoTracks()[0].kind)?.replaceTrack(t?.getVideoTracks()[0])}),this.updateUserHuddleState()}}catch(t){this.loggingService.catch("Error in HuddleService toggleLocalStreamVideo:",t)}})}toggleLocalScreenSharing(){return y(this,null,function*(){try{let e=this.screenSharingStream;if(e){if(e.getVideoTracks()[0].enabled)this.stopScreenSharingStream();else{let i=yield navigator.mediaDevices?.getDisplayMedia({video:!0});i&&(e.getVideoTracks()?.forEach(a=>{e.removeTrack(a)}),i.getVideoTracks()?.forEach(a=>{e.addTrack(a),a.onended=()=>{this.stopScreenSharingStream(),this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}})),this.screenSharingStream$.next(e),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_SCREENSHARING_STARTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)})}this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}}catch(e){this.loggingService.catch("Error in HuddleService toggleLocalScreenSharing:",e)}})}stopScreenSharingStream(){return y(this,null,function*(){let e=this.screenSharingStream;if(e){let t=e.getVideoTracks()[0];t.enabled&&(t.stop(),e.getVideoTracks()?.forEach(i=>{e.removeTrack(i)}),e.addTrack(this.black()),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_SCREENSHARING_STOPPED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(i=>i?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(i=>i?.userId)}))}})}updateScreenSharingTracksToPeers(){return y(this,null,function*(){Object.keys(this.peerConnectionMap).forEach(e=>{let i=this.peerConnectionMap[e].getSenders().filter(a=>a?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind);i?.length>1&&i[1]?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])})})}dropCall(){return y(this,null,function*(){try{this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.removeHuddleSessionData(),this.huddleJoined=!1,this.huddleJoined$.next(!1),this.peerConnectionMap&&Object.keys(this.peerConnectionMap).forEach(e=>{let t=this.peerConnectionMap[e];t.getTransceivers()?.forEach(i=>{i.stop()}),t.getSenders()?.forEach(i=>{i.track?.stop()}),t.getReceivers()?.forEach(i=>{i.track?.stop()}),t.close()}),this.peerConnectionMap={},this.dbRefsRemoveOnDropCall.forEach(e=>y(this,null,function*(){yield this.realtimeAdapter.rtdbRemove("huddle",e.dbRef)})),this.onOfferUidHistory={},this.onAnswerConnectionIdHistory={},this.senders={},this.peerConnectionStateMap={},this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.localStream.getTracks().forEach(e=>{e.stop()}),this.screenSharingStream.getTracks().forEach(e=>{e.stop()}),this.localStream=new MediaStream([this.silence(),this.black()]),this.screenSharingStream=new MediaStream([this.black()]),this.localStream$.next(this.localStream),this.screenSharingStream$.next(this.screenSharingStream),this.localStreamState$.next({audioState:!1,videoState:!1,screenSharingState:!1}),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_LEFT,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(e=>e?.userId)})}catch(e){this.loggingService.catch("Error in HuddleService dropCall:",e)}})}updateHuddleSessionData(e,t,i){try{let a=JSON.parse(sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)||"{}");i?sessionStorage.setItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(i)):(a[e]=t,sessionStorage.setItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(a)))}catch(a){this.loggingService.catch("Error in HuddleService updateHuddleSessionData:",a)}}getHuddleSessionData(){try{return sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)?JSON.parse(sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)):null}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleSessionData:",e),null}}removeHuddleSessionData(){try{sessionStorage.removeItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)}catch(e){this.loggingService.catch("Error in HuddleService removeHuddleSessionData:",e)}}removeAttendee(){return y(this,null,function*(){try{if(this.documentPaths?.huddle&&this.user.userSnippylyId){yield this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}});return}else return}catch(e){return this.loggingService.catch("Error in HuddleService removeAttendee:",e),Promise.resolve(null)}})}updateUserHuddleState(){return y(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=this.getAudioState(),t=this.getVideoState(),i=this.getScreenSharingState();this.localStreamState$.next({audioState:e,videoState:t,screenSharingState:i});let a={audioState:e,videoState:t,screenSharingState:i};yield this.commonDbService.setData({feature:"huddleAttendeeState",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0},data:a})}}catch(e){this.loggingService.catch("Error in HuddleService updateUserHuddleState:",e)}})}updateHuddleOnCursorMode(){return y(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}/huddleOnCursorMode`);yield this.realtimeAdapter.rtdbSet("huddle",e,!!this.huddleOnCursorMode$.value)}}catch(e){this.loggingService.catch("Error in HuddleService updateHuddleOnCursorMode:",e)}})}getAudioState(){try{let e=this.localStream$.value;if(e){let t=e?.getAudioTracks();return!!(t?.length?t[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getAudioState:",e),!1}}getVideoState(){try{let e=this.localStream$.value;if(e){let t=e?.getVideoTracks();return!!(t?.length?t[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}getScreenSharingState(){try{let e=this.screenSharingStream;if(e){let t=e?.getVideoTracks();return!!(t?.length?t[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}removeIceCandidates(e){return y(this,null,function*(){try{if(this.documentPaths?.huddle&&e){let t=yield this.commonDbService?.getData({feature:"allHuddleIceCandidates",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}});Object.keys(t).length>0&&Object.keys(t).forEach(i=>y(this,null,function*(){t[i].connectionId===e&&this.commonDbService.deleteData({feature:"huddleIceCandidate",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:i,skipFirestore:!0}})}))}}catch(t){this.loggingService.catch("Error in HuddleService dropCall:",t)}})}get timestamp(){return this.commonDbService.getServerTimestamp()}silence(){try{let e=new AudioContext,t=e.createOscillator(),i=t.connect(e.createMediaStreamDestination());return t.start(),Object.assign(i.stream.getAudioTracks()[0],{enabled:!1})}catch(e){this.loggingService.catch("Error in HuddleService silence:",e)}}black({width:e=640,height:t=480}={}){try{let i=Object.assign(document.createElement("canvas"),{width:e,height:t});i.getContext("2d")?.fillRect(0,0,e,t);let a=i.captureStream();return Object.assign(a.getVideoTracks()[0],{enabled:!1})}catch(i){this.loggingService.catch("Error in HuddleService black:",i)}}getInitialHuddleType(){try{return this.initialHuddleType}catch(e){return this.loggingService.catch("Error in HuddleService getInitialHuddleType:",e),null}}getHuddleAttendees$(){try{return this.attendees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees$:",e),P([])}}getHuddleAttendees(){try{return this.attendees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees:",e),null}}getHuddleInvitees$(){try{return this.invitees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees$:",e),P([])}}getHuddleInvitees(){try{return this.invitees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees:",e),null}}getHuddleStartTime(){try{return this.userHuddleStartTime$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleStartTime:",e),null}}getTotalUserHuddleDuration(){try{return this.userHuddleStartTime$.value?new Date().getTime()-this.userHuddleStartTime$.value:null}catch(e){return this.loggingService.catch("Error in HuddleService gettotalUserHuddleDuration:",e),null}}inviteUsers(e){try{this.updateInvitees(e);let t={};t.notificationSource="huddleInvite",t.huddleInvitees=e,t.huddleType=this.getInitialHuddleType(),this.updateNotificationsDatabase(t)}catch(t){this.loggingService.catch("Error in HuddleService inviteUsers:",t)}}updateInvitees(e){try{if(this.documentPaths?.huddle){let t={};e.forEach(i=>{if(i?.email){let a=jt(i.email);t[a]=i}}),this.commonDbService.setData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in HuddleService updateInvitees:",t)}}updateNotificationsDatabase(e={}){try{let t=p({notificationSource:"huddle"},e);this.serviceBook.get(Zt)?.updateNotificationDatabase(t)}catch(t){this.loggingService.catch("Error in HuddleService updateNotificationsDatabase: ",t)}}getHuddleJoined$(){try{return this.huddleJoined$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleJoined$:",e),P(!1)}}getHuddleCursorAvailableByAttendeeId(){try{return this.huddleCursorAvailableByAttendeeId$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId:",e),null}}getHuddleCursorAvailableByAttendeeId$(){try{return this.huddleCursorAvailableByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId$:",e),P({})}}updateHuddleCursorAvailableByAttendeeId(e,t){try{let i=this.huddleCursorAvailableByAttendeeId$.value;i[e]=t,this.huddleCursorAvailableByAttendeeId$.next(i)}catch(i){this.loggingService.catch("Error in HuddleService updateCursorUserAvailableByUserId:",i)}}setRemoteStreamsByUserId(e){try{this.remoteStreamsByUserId$.next(e)}catch(t){this.loggingService.catch("Error in HuddleService setRemoteStreamsByUserId:",t)}}getRemoteStreamsByUserId$(){try{return this.remoteStreamsByUserId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getRemoteStreamsByUserId$:",e),P({})}}enableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableHuddleOnCursorMode:",e)}}disableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableHuddleOnCursorMode:",e)}}getHuddleOnCursorMode$(){try{return this.huddleOnCursorMode$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorMode$:",e),P(!1)}}enableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableFlockModeOnAvatarClick:",e)}}disableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableFlockModeOnAvatarClick:",e)}}getFlockModeOnAvatarClick$(){try{return this.flockModeOnAvatarClickEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick$:",e),P(!1)}}getFlockModeOnAvatarClick(){try{return this.flockModeOnAvatarClickEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick:",e),!1}}enableChat(){try{this.chatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableChat:",e)}}disableChat(){try{this.chatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableChat:",e)}}getChatEnabled$(){try{return this.chatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled$:",e),P(!1)}}getChatEnabled(){try{return this.chatEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled:",e),!1}}enableServerFallback(){try{if(this.serverFallback$.value===!0)return;this.serverFallback$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableServerFallback:",e)}}disableServerFallback(){try{if(this.serverFallback$.value===!1)return;this.serverFallback$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableServerFallback:",e)}}getServerFallback$(){try{return this.serverFallback$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getServerFallback$:",e),P(!1)}}getServerFallback(){try{return this.serverFallback$.value}catch(e){return this.loggingService.catch("Error in HuddleService getServerFallback:",e),!1}}getHuddleOnCursorModeByAttendeeId$(){try{return this.huddleOnCursorModeByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorModeByAttendeeId$:",e),P({})}}toggleHuddleOnCursorModeByAttendeeId(e){try{let t=this.huddleOnCursorModeByAttendeeId$.value;t[e]?delete t[e]:t[e]=!0,this.huddleOnCursorModeByAttendeeId$.next(t)}catch(t){this.loggingService.catch("Error in HuddleService toggleHuddleOnCursorModeByAttendeeId:",t)}}addCursorTag(){try{if(!document.querySelector(`${M.TAGS.SNIPPYLY_CURSOR}`)){let e=document.createElement(M.TAGS.SNIPPYLY_CURSOR);e.setAttribute("snippyly-temporary","true"),document.body.appendChild(e)}}catch(e){this.loggingService.catch("Error in HuddleService addCursorTag:",e)}}removeCursorTag(){try{let e=document.querySelector(`${M.TAGS.SNIPPYLY_CURSOR}`);e?.hasAttribute("snippyly-temporary")&&e.remove()}catch(e){this.loggingService.catch("Error in HuddleService removeCursorTag:",e)}}sendMessage(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;"),this.documentPaths?.huddle&&this.user){let t=new $t;t.message=e,t.from=this.user,t.timestamp=this.timestamp,this.commonDbService.setData({feature:"huddleMessage",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:t.id,skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in HuddleService sendMessage:",t)}}getMessages$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessages$","color: green;"),this.messages$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessages$:",e),P([])}}deleteMessages(){try{this.loggingService.log("%c[WB] Calling FUNCTION: deleteMessages","color: green;"),this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleMessages",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService deleteMessages:",e)}}showMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService showMessagesPanel:",e)}}hideMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: hideMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService hideMessagesPanel:",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!this.messagesPanelVisible$.value)}catch(e){this.loggingService.catch("Error in HuddleService toggleMessagesPanel:",e)}}getMessagesPanelVisible$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible$","color: green;"),this.messagesPanelVisible$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible$:",e),P(!1)}}getMessagesPanelVisible(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible","color: green;"),this.messagesPanelVisible$.value}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible:",e),!1}}signOutUser(e){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee())}catch(t){this.loggingService.catch("Error in HuddleService signOutUser:",t)}})}};o.\u0275fac=function(t){return new(t||o)(B(kt),B(le),B(se),B(Xt),B(Qt),B(Ee),B(ue),B(Ae),B(Ht),B(w),B(tn),B(Oe),B(Me),B(en))},o.\u0275prov=Se({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();function kn(r,o){if(r&1&&(l(0,"div",21),A(1),b(2,"translate"),b(3,"translate"),u()),r&2){let n=s().$implicit,e=s().ngIf;d(),ie(" ",(n==null||n.from==null?null:n.from.userId)===(e.user==null?null:e.user.userId)?x(2,1,"Me"):x(3,3,(n==null||n.from==null?null:n.from.name)||(n==null||n.from==null?null:n.from.email))," ")}}function Hn(r,o){r&1&&S(0,"velt-skeleton-loader-internal",22)}function In(r,o){if(r&1&&(D(0),l(1,"div",15),S(2,"snippyly-user-avatar",16),l(3,"div",17),_(4,kn,4,5,"div",18)(5,Hn,1,0,"ng-template",null,1,Z),l(7,"div",19),A(8),b(9,"timeAgo"),u(),S(10,"div",20),b(11,"translate"),b(12,"safeHtml"),u()(),U()),r&2){let n=o.$implicit,e=F(6),t=s().ngIf;d(2),g("user",n==null?null:n.from),d(2),g("ngIf",(n==null||n.from==null?null:n.from.userId)===(t.user==null?null:t.user.userId)||(n==null||n.from==null?null:n.from.name)||(n==null||n.from==null?null:n.from.email))("ngIfElse",e),d(4),N(x(9,5,n==null?null:n.timestamp)),d(2),g("innerHTML",x(12,9,x(11,7,(n==null?null:n.message)||"")),tt)}}function wn(r,o){if(r&1){let n=E();D(0),l(1,"div",3)(2,"div",4,0)(4,"div",5)(5,"div"),A(6),b(7,"translate"),u(),l(8,"div"),k(),l(9,"svg",6),f("click",function(){v(n);let t=s();return C(t.toggleMessagesPanel())}),S(10,"path",7),u()()(),re(),l(11,"div",8),_(12,In,13,11,"ng-container",9),u(),l(13,"div",10)(14,"textarea",11),b(15,"translate"),gt("ngModelChange",function(t){let i=v(n).ngIf;return ct(i.message,t)||(i.message=t),C(t)}),f("keydown.enter",function(t){v(n);let i=s();return t.preventDefault(),C(i.sendMessage())}),u(),l(16,"button",12),f("click",function(){v(n);let t=s();return C(t.sendMessage())}),k(),l(17,"svg",13),S(18,"path",14),u()()()()(),U()}if(r&2){let n=o.ngIf,e=s();d(),q("visible",n.messagesPanelVisible)("mobile",n.isPhone),d(5),N(x(7,11,"In-call messages")),d(6),g("ngForOf",n.messages)("ngForTrackBy",e.trackByMessageId),d(2),g("placeholder",ut(x(15,13,"Type here..."))),dt("ngModel",n.message),d(2),g("disabled",!(n.message!=null&&n.message.trim()))}}var je=(()=>{let o=class o{constructor(e,t,i,a,c,h){this.authService=e,this.huddleService=t,this.loggingService=i,this.breakpointObserver=a,this.elementRef=c,this.domService=h,this.subscriptions=[],this.componentConfigSignal=W({isPhone:!1,user:null,messages:[],message:"",messagesPanelVisible:!1});try{this.loggingService.log("%c[WB] Creating CLASS: HuddleMessagesPanelComponent","color: blue;"),this.subscriptions.push(this.huddleService.getMessages$().subscribe(H=>{H.sort(($,T)=>$?.timestamp-T?.timestamp),this.componentConfigSignal.update($=>m(p({},$),{messages:H}))})),this.subscriptions.push(this.huddleService.getMessagesPanelVisible$().subscribe(H=>{this.componentConfigSignal.update($=>m(p({},$),{messagesPanelVisible:H}))})),this.subscriptions.push(this.authService.getUser$().subscribe(H=>{this.componentConfigSignal.update($=>m(p({},$),{user:H}))})),this.subscriptions.push(this.breakpointObserver.observe(At.XSmall).subscribe(H=>{H.matches?this.componentConfigSignal.update($=>m(p({},$),{isPhone:!0})):this.componentConfigSignal.update($=>m(p({},$),{isPhone:!1}))},H=>{this.loggingService.catch("Error in HuddleMessagesPanelComponent breakpointObserver subscription: ",H)}))}catch(H){this.loggingService.catch("Error in HuddleMessagesPanelComponent constructor: ",H)}}ngOnInit(){}ngAfterViewInit(){try{this.subscriptions.push(this.domService.subscribeInjectCustomCss(this.elementRef))}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent ngAfterViewInit: ",e)}}trackByMessageId(e,t){return t.id||e}highlightLinks(e){this.loggingService.log("%c[WB] Calling FUNCTION: highlightLinks","color: green;");try{return e&&(e=e?.replaceAll("&amp;","&")),e.replaceAll(M.REGEX_URL,i=>new RegExp(M.REGEX_EMAIL).test("@"+i)?i:`<a class="message-link" href="${i}" target="_blank">${i}</a>`)}catch(t){return this.loggingService.catch("Error in HuddleMessagesPanelComponent highlightLinks: ",t),""}}sendMessage(){this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;");try{let e=this.componentConfigSignal().message?.trim();if(!e)return;e=this.highlightLinks(e),this.huddleService.sendMessage(e),this.componentConfigSignal.update(t=>m(p({},t),{message:""}))}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent sendMessage: ",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.huddleService.toggleMessagesPanel()}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent toggleMessagesPanel: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onDestroy","color: green;"),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(se),I(R),I(w),I(Tt),I(_e),I(ue))},o.\u0275cmp=G({type:o,selectors:[["velt-huddle-messages-panel-internal"]],standalone:!1,decls:1,vars:1,consts:[["sidebarRef",""],["loadingTemplateRef",""],[4,"ngIf"],["part","container","data-velt-element","true","data-velt-comment-disabled","true",1,"s-sidebar-container"],[1,"s-sidebar"],[1,"v-huddle-messages-header"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"v-huddle-message-panel-close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#777E91"],[1,"v-huddle-messages-container"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"v-huddle-message-box-container"],["name","message","rows","1",1,"v-huddle-message-box-input",3,"ngModelChange","keydown.enter","placeholder","ngModel"],[1,"v-huddle-message-box-send-btn",3,"click","disabled"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M20.8089 10.1394L4.6724 3.15546C3.9926 2.8612 3.22459 2.99065 2.66814 3.49311C2.1117 3.99565 1.87896 4.76995 2.06084 5.51382L3.49713 11.3888H10.5294C10.853 11.3888 11.1154 11.6625 11.1154 12C11.1154 12.3375 10.853 12.6112 10.5294 12.6112H3.49713L2.06084 18.4862C1.87896 19.2301 2.11166 20.0044 2.66814 20.5069C3.22572 21.0104 3.99381 21.1382 4.67244 20.8445L20.8089 13.8606C21.5436 13.5426 22 12.8297 22 12C22 11.1703 21.5436 10.4574 20.8089 10.1394Z","fill","#777E90"],[1,"v-huddle-message-block"],[3,"user"],[1,"v-huddle-message-block-right"],["class","v-huddle-message-block-user",4,"ngIf","ngIfElse"],[1,"v-huddle-message-block-time"],[1,"v-huddle-message-block-message",3,"innerHTML"],[1,"v-huddle-message-block-user"],["height","20px","width","80px","borderRadius","20px"]],template:function(t,i){t&1&&_(0,wn,19,15,"ng-container",2),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[ge,J,It,wt,Mt,pe,Te,Q,sn,dn],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}:host{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-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)}:host[dark]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-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)}.s-sidebar-container{height:100vh;width:calc((22rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;right:-100%;padding:calc((1rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;z-index:999999997;transition:width .5s ease-in-out,right .5s ease-in-out}.s-sidebar-container.mobile{width:100%!important;height:100%!important;box-sizing:border-box!important;-webkit-backdrop-filter:blur(2px)!important;backdrop-filter:blur(2px)!important}.s-sidebar-container.visible{right:0}.s-sidebar-container .s-sidebar{background:var(--velt-background-0);padding:calc((1rem + 0px) * var(--velt-base-rem-unit));border-radius:var(--velt-border-radius-lg);width:100%;overflow-x:hidden;box-sizing:border-box;position:relative;height:100%;border:1px solid var(--velt-border-5);display:flex;flex-direction:column;justify-content:space-between;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .s-sidebar::-webkit-scrollbar{display:none;width:0;height:0}.s-sidebar-container .s-sidebar:not(.s-overflow-hidden){overflow-y:auto}.s-sidebar-container .v-huddle-message-panel-close-btn{cursor:pointer}.s-sidebar-container .v-huddle-messages-header{display:flex;justify-content:space-between}.s-sidebar-container .v-huddle-messages-container{overflow:auto;flex-grow:1}.s-sidebar-container .v-huddle-messages-container::-webkit-scrollbar{display:none;width:0;height:0}.s-sidebar-container .v-huddle-message-block{display:flex;gap:calc((1rem + 0px) * var(--velt-base-rem-unit));margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .v-huddle-message-block .v-huddle-message-block-time{font-size:calc((.5rem + 0px) * var(--velt-base-rem-unit));color:gray;margin-bottom:calc((.25rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .v-huddle-message-block .v-huddle-message-block-message{font-size:calc((.75rem + 0px) * var(--velt-base-rem-unit));word-break:break-word;white-space:pre-wrap}.s-sidebar-container .v-huddle-message-box-container{display:flex;gap:calc((1rem + 0px) * var(--velt-base-rem-unit));align-items:center}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-input{padding:calc((.75rem + 0px) * var(--velt-base-rem-unit));border-radius:8px;border:0;outline:0;background:#f7f7f7;flex-grow:1;font-family:var(--velt-default-font-family);resize:none}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-send-btn{background:transparent;border:0;outline:0;border-radius:100%;width:32px;height:32px;display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer;opacity:1}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-send-btn[disabled]{opacity:.5;cursor:not-allowed}
1
+ import{a as cn}from"./chunk-B7JPRLBQ.js";import{a as ln}from"./chunk-WJFVURTP.js";import{c as _t,d as ft}from"./chunk-6OW5GJ3E.js";import{a as sn}from"./chunk-CZWARF5M.js";import{a as dn}from"./chunk-MRAZ6ENQ.js";import{a as gn}from"./chunk-JAOM3JHX.js";import"./chunk-MZ2HKBWF.js";import{b as It,c as wt,g as Mt,l as Et,m as Ot,s as Dt,u as Ut,v as Lt,w as Bt}from"./chunk-6K2VWE4K.js";import{b as Q,c as Te,d as pe}from"./chunk-S4APJ64C.js";import{a as an}from"./chunk-54BT4NQJ.js";import{a as on}from"./chunk-62RN7JJN.js";import{a as xt}from"./chunk-POME7PZR.js";import{A as yt,G as xe,H as ke,I as bt,Y as Pt,ba as Vt,ea as nn,ga as rn}from"./chunk-K5BJ5DAO.js";import{$ as Se,Aa as tt,Bf as jt,Ca as fe,Db as ot,Dd as kt,De as M,E as te,Eb as at,Ec as ht,Fa as d,Fb as lt,Fc as ge,Fh as Jt,G as qe,Ga as X,Gc as J,Gh as Yt,Gi as en,Hc as vt,Hi as tn,Ib as F,Ic as Ct,J as he,Jb as ye,Kb as q,L as Be,Lb as st,Mf as Ne,Nb as A,Nd as Ht,Nf as He,Ob as N,Pa as I,Pb as ie,Pc as St,Qb as be,Sb as dt,Sd as Tt,Se as Nt,T as Y,Ta as nt,Tb as ct,Td as At,Te as Rt,Ua as G,Ub as gt,Ug as we,Va as it,W as Xe,Ya as rt,Yb as ut,Zb as pt,_a as _,a as p,aa as Qe,ac as ve,ae as Ft,af as $t,ai as Me,b as m,bi as le,ca as B,ci as w,da as et,db as K,dc as mt,di as Ee,g as y,gi as Kt,ha as v,he as Fe,i as Je,ia as C,ii as qt,ja as k,ka as re,kc as b,ki as ue,l as L,lb as g,lc as x,li as se,mb as l,nb as u,ne as ae,ob as S,pc as Z,pg as Ie,q as Ye,qa as W,r as P,rh as Wt,sb as D,si as Xt,tb as U,ua as ne,uh as V,v as z,vb as E,vg as zt,vh as Gt,w as Ke,wa as _e,xb as f,xh as Zt,xi as Qt,yi as Oe,zb as s}from"./chunk-O4F37U67.js";var Ae=(()=>{let o=class o{constructor(e,t,i){this.coreActionsService=e,this.loggingService=t,this.usersService=i}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let i of e)i?.userId&&t.add(i?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",t),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=p(p({},e),t))}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",t),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(i=>{t.includes(i)||(e[i]=null)})}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",t),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let t=new Set;for(let i of e)i?.from?.userId&&t.add(i?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",t),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",t),e}}resolveUsersFromHuddleMessages(e){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),i=He(),a=Rt.GET_HUDDLE_USERS;this.coreActionsService.triggerAction(Ft.USER_RESOLVER,{event:V.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:i,methodName:Nt.RESOLVE_USERS_FROM_HUDDLE_MESSAGES,moduleName:a,source:"internal",payload:{userIds:t}});let c=yield this.usersService.resolveUsers({userIds:t,uniqueId:i,moduleName:a});for(let h of e)h?.from?.userId&&c[h.from.userId]&&(h.from=c[h.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(B(qt),B(w),B(Oe))},o.\u0275prov=Se({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var R=(()=>{let o=class o{constructor(e,t,i,a,c,h,H,$,T,ee,mn,hn,vn,Cn){this.afAuth=e,this.analyticsService=t,this.authService=i,this.databaseService=a,this.docService=c,this.configService=h,this.domService=H,this.huddleUtilsService=$,this.functions=T,this.loggingService=ee,this.commonDbService=mn,this.usersService=hn,this.serviceBook=vn,this.realtimeAdapter=Cn,this.endpointsService=et(Kt),this.documentPaths=null,this.localStream$=new L(null),this.peerConnectionMap={},this.localStream=new MediaStream,this.screenSharingStream=new MediaStream,this.screenSharingStream$=new L(null),this.remoteStreamMap={},this.remoteStreamMap$=new L(null),this.localStreamState$=new L({}),this.peerConnectionStateMap={},this.peerConnectionStateMap$=new L({}),this.hudleToolComponentId$=new L(null),this.attendees$=new L([]),this.invitees$=new L([]),this.huddleJoined$=new L(!1),this.userHuddleStartTime$=new L(null),this.messages$=new L([]),this.messagesPanelVisible$=new L(!1),this.huddleOnCursorMode$=new L(!1),this.flockModeOnAvatarClickEnabled$=new L(!1),this.chatEnabled$=new L(!0),this.serverFallback$=new L(!0),this.huddleOnCursorModeByAttendeeId$=new L({}),this.huddleCursorAvailableByAttendeeId$=new L({}),this.remoteStreamsByUserId$=new L({}),this.messagesSubscription=null,this.huddleJoined=!1,this.onAnswerConnectionIdHistory={},this.onOfferUidHistory={},this.senders={},this.db=null,this.dbRefsRemoveOnDropCall=[],this.servers={iceServers:[{urls:["stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302"]}]},this.databaseService.getDb().pipe(te(O=>!!O),he(1)).subscribe(O=>{try{O&&(this.db=O,this.isHuddleTagInstalled()&&this.getServerFallback()&&this.getTwilioIceServers(),this.getUser(),this.getDocumentPaths())}catch(j){this.loggingService.catch("Error in HuddleService getDb:",j)}},O=>{this.loggingService.catch("Error in HuddleService getDb subscription: ",O)}),this.docService.addPreDocumentIdChangeFunction("huddle-service",O=>y(this,null,function*(){this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee(),this.attendees$.next([]))})),this.getAttendees().subscribe(),this.getInvitees().subscribe(),this.localStream$.subscribe(O=>{O&&(this.localStream=O)}),this.screenSharingStream$.subscribe(O=>{O&&(this.screenSharingStream=O)}),this.configService.getConfig$().subscribe(O=>{try{!O?.featureAllowList?.find(ce=>ce===ae.CURSOR)&&this.huddleOnCursorMode$.next(!1)}catch(j){this.loggingService.catch("Error in HuddleService configService.getConfig$:",j)}},O=>{this.loggingService.catch("Error in HuddleService configService.getConfig$ subscription: ",O)}),this.attendees$.subscribe(O=>{try{if(O?.length){if(this.huddleOnCursorMode$?.value){let j=this.huddleOnCursorModeByAttendeeId$.getValue()||{};O.forEach(ce=>{j[ce.userSnippylyId]=!0}),this.huddleOnCursorModeByAttendeeId$.next(j)}this.huddleJoined$?.value&&(O?.find(j=>j?.huddleOnCursorMode)?this.addCursorTag():this.removeCursorTag())}}catch(j){this.loggingService.catch("Error in HuddleService attendees$:",j)}},O=>{this.loggingService.catch("Error in HuddleService attendees$ subscription: ",O)}),Ke([this.huddleJoined$,this.huddleOnCursorMode$]).subscribe(([O,j])=>{try{if(O){if(j){let ce=this.attendees$.getValue()||[],Sn=this.huddleOnCursorModeByAttendeeId$.getValue()||{};ce.forEach(_n=>{Sn[_n.userSnippylyId]=!0}),document?.body?.setAttribute(M.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE,"true")}else this.huddleOnCursorModeByAttendeeId$.next({}),document?.body?.removeAttribute(M.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE);this.updateHuddleOnCursorMode()}else this.removeCursorTag(),document?.body?.removeAttribute(M.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE)}catch(ce){this.loggingService.catch("Error in HuddleService huddleJoined$:",ce)}},O=>{this.loggingService.catch("Error in HuddleService huddleJoined$ subscription: ",O)}),this.huddleOnCursorModeByAttendeeId$.subscribe(O=>{try{this.huddleJoined&&(Object.keys(O).length?this.addCursorTag():this.removeCursorTag())}catch(j){this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$:",j)}},O=>{this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$ subscription: ",O)}),this.authService.addPreSignOutFuction("huddle-signout",this.signOutUser.bind(this))}isHuddleTagInstalled(){try{return!!document?.querySelector(`${M.TAGS.VELT_HUDDLE}`)||!!document?.querySelector(`${M.TAGS.SNIPPYLY_HUDDLE}`)}catch(e){return this.loggingService.catch("Error in HuddleService isHuddleTagInstalled:",e),!1}}getTwilioIceServers(){return y(this,null,function*(){try{let t=(yield Gt(this.functions,Wt({url:this.endpointsService.getCloudFunctionUrl("getIceServers"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5})())?.data;t&&t?.iceServers&&(this.servers.iceServers=t.iceServers)}catch(e){this.loggingService.catch("Error in HuddleService getTwilioIceServers:",e)}})}getRemoteStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getRemoteStream","color: green;"),this.remoteStreamMap$.asObservable()}getPeerConnectionStateMap(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPeerConnectionStateMap","color: green;"),this.peerConnectionStateMap$.asObservable()}getLocalStreamState(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStreamState","color: green;"),this.localStreamState$.asObservable()}getScreenSharingStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScreenSharingStream","color: green;"),this.screenSharingStream$.asObservable()}getAttendees(){return this.authService.getAuthState$().pipe(te(e=>!!e),z(e=>({firebaseUser:e})),Y(e=>this.configService.getConfig$().pipe(te(t=>!!t),z(t=>m(p({},e),{config:t})))),Y(e=>this.authService.getUser$().pipe(z(t=>m(p({},e),{user:t})))),Y(e=>Ne(e.config,e.user,ae.HUDDLE)?P(m(p({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),P(m(p({},e),{allowed:!1})))),Be((e,t)=>e?.allowed===t?.allowed),Y(e=>this.docService.getDocumentPaths$().pipe(z(t=>(this.documentPaths=t,e)))),Y(e=>e?.allowed?e?.user?.isAnonymous?P(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleAttendees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(z(t=>t?.data),z(t=>t?(this.attendees$.next(Object.values(t)),Object.values(t)):(this.attendees$.next([]),null))):P(null):P([])))}getInvitees(){try{return this.authService.getAuthState$().pipe(te(e=>!!e),z(e=>({firebaseUser:e})),Y(e=>this.configService.getConfig$().pipe(te(t=>!!t),z(t=>m(p({},e),{config:t})))),Y(e=>this.authService.getUser$().pipe(z(t=>m(p({},e),{user:t})))),Y(e=>Ne(e.config,e.user,ae.HUDDLE)?P(m(p({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),P(m(p({},e),{allowed:!1})))),Be((e,t)=>e?.allowed===t?.allowed),Y(e=>this.docService.getDocumentPaths$().pipe(z(t=>(this.documentPaths=t,e)))),Y(e=>e?.allowed?e?.user?.isAnonymous?P(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(z(t=>t?.data),z(t=>t?(this.invitees$.next(Object.values(t)),Object.values(t)):(this.invitees$.next([]),null))):P(null):P([])))}catch(e){return this.loggingService.catch("Error in HuddleService getInvitees:",e),P([])}}clearHuddleInvitees(){try{this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService clearHuddleInvitees:",e)}}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(te(e=>!!e)).subscribe(e=>{e&&(this.user=e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(Xe(e=>{this.documentPaths=e})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}setHuddleToolComponentId(e){this.hudleToolComponentId$.next(e||null)}getHuddleToolComponentId(){return this.hudleToolComponentId$.asObservable()}joinHuddle(e){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: joinHuddle","color: green;"),this.documentPaths?.huddle?(this.initialHuddleType=e,this.huddleJoined=!0,this.huddleJoined$.next(!0),this.initLocalStreams(),this.huddle=this.realtimeAdapter.rtdbRef(this.db,this.documentPaths?.huddle),this.iceCandidates=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/iceCandidates`),this.connections=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/connections`),this.attendees=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/attendees`),this.messages=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/messages`),this.setHuddleListener(),this.addAttendee(),this.callExistingAttendees(),this.userHuddleStartTime$.next(new Date().getTime())):this.loggingService.catch("Error in joinHuddle: documentPaths not found")}catch(t){this.loggingService.catch("Error in HuddleService joinHuddle:",t)}})}initLocalStreams(){try{if(!this.localStream$?.value?.getTracks()?.length){let e=new MediaStream([this.silence(),this.black()]);this.localStream$.next(e)}if(!this.screenSharingStream$?.value?.getTracks()?.length){let e=new MediaStream([this.black()]);this.screenSharingStream$.next(e)}}catch(e){this.loggingService.catch("Error in HuddleService initLocalStreams:",e)}}setHuddleListener(){this.loggingService.log("%c[WB] Calling FUNCTION: setHuddleListener","color: green;"),this.realtimeAdapter.rtdbOnValue("huddle",this.connections,e=>{try{if(e.exists()){let t=e.val();Object.values(t).forEach(a=>{let c=Object.values(a);if(c&&c.length>0){let H=c[0]?.connectionId;this.onHuddleSnapshot(H,a)}}),Object.keys(this.remoteStreamMap).forEach(a=>y(this,null,function*(){t[a]||(this.remoteStreamMap[a]&&Object.values(this.remoteStreamMap[a]).forEach(c=>{c.getTracks().forEach(h=>{h.stop()})}),delete this.remoteStreamMap[a],yield this.removeIceCandidates(a))})),this.remoteStreamMap$.next(this.remoteStreamMap)}else Object.keys(this.remoteStreamMap).forEach(t=>y(this,null,function*(){Object.values(this.remoteStreamMap[t]).forEach(i=>{i.getTracks().forEach(a=>{a.stop()})}),yield this.removeIceCandidates(t)})),this.remoteStreamMap={},this.remoteStreamMap$.next(this.remoteStreamMap)}catch(t){this.loggingService.catch("Error in HuddleService setHuddleLister onValue:",t)}}),this.realtimeAdapter.rtdbStateChanges$("huddle",this.iceCandidates).subscribe(e=>{try{e.event==="child_added"&&this.onIceCandidateSnapshot(e.snapshot)}catch(t){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",t)}}),this.realtimeAdapter.rtdbStateChanges$("huddle",this.attendees).subscribe(e=>{try{if(e.event==="child_removed"){let t=e?.snapshot?.val();if(t){delete this.onOfferUidHistory[t?.userSnippylyId];let i=this.getCombinedId(this.user.userSnippylyId,t?.userSnippylyId);delete this.onAnswerConnectionIdHistory[i],this.closeConnection(i)}}}catch(t){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",t)}}),this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.messagesSubscription=new Je(e=>{let t=this.realtimeAdapter.rtdbOnValue("huddle",this.messages,i=>e.next(i),i=>e.error(i));return()=>t()}).pipe(Y(e=>this.usersService.getUserById$().pipe(z(()=>e))),Y(e=>{if(e.exists()){let t=e.val();return Ye(this.huddleUtilsService.resolveUsersFromHuddleMessages(Object.values(t||{})))}return P([])}),qe(e=>(this.loggingService.catch("Error in HuddleService messages onValue:",e),P([])))).subscribe(e=>{this.messages$.next(e)})}onHuddleSnapshot(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: onHuddleSnapshot","color: green;"),t.offerData&&!t.answerData&&t.offerData.from!==this.user.userSnippylyId&&t.offerData.to===this.user.userSnippylyId&&!(e in this.peerConnectionMap)&&!this.onOfferUidHistory[t.offerData.from]?(this.loggingService.log("offer received"),this.loggingService.log(t),this.onOfferUidHistory[t.offerData.from]=!0,this.onOffer(e,t.offerData)):t.answerData&&t.answerData.from!==this.user.userSnippylyId&&t.answerData.to===this.user.userSnippylyId&&this.peerConnectionMap[e]&&this.peerConnectionMap[e]?.connectionState!=="connected"&&!this.onAnswerConnectionIdHistory[e]&&(this.loggingService.log("answer received"),this.loggingService.log(t),this.onAnswerConnectionIdHistory[e]=!0,this.onAnswer(e,t.answerData))}catch(i){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",i)}}onIceCandidateSnapshot(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateSnapshot","color: green;"),this.loggingService.log("ice candidate received");let t=e.val(),i=t.connectionId;t?.from!==this.user.userSnippylyId&&i in this.peerConnectionMap&&this.onIceCandidateChange(i,t)}catch(t){this.loggingService.catch("Error in HuddleService onIceCandidateSnapshot:",t)}}onOffer(e,t){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onOffer","color: green;"),this.createPeerConnection(e,t.from)){this.addLocalStreamToPeerConnection(e,!0);let a=t.offer;yield this.setRemoteDescription(e,a),yield this.sendAnswer(e,t.from)}}catch(i){this.loggingService.catch("Error in HuddleService onOffer:",i)}})}sendAnswer(e,t){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendAnswer","color: green;"),this.loggingService.log(e),this.documentPaths?.huddle&&e){let i=yield this.peerConnectionMap[e].createAnswer();yield this.setLocalDescription(e,i);let c={answer:{type:i.type,sdp:i.sdp},from:this.user.userSnippylyId,connectionId:e,to:t},h=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/connections/${e}`);this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:h}),yield this.realtimeAdapter.rtdbUpdate("huddle",h,{answerData:c}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",h)}else this.loggingService.catch("Error in sendAnswer: documentPaths not found")}catch(i){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",i)}})}onAnswer(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onAnswer","color: green;");let i=t.answer;yield this.setRemoteDescription(e,i)}catch(i){this.loggingService.catch("Error in HuddleService onAnswer:",i)}})}onIceCandidateChange(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateChange","color: green;");let i=t.candidate;this.loggingService.log("onIceCandidateChange",i),yield this.peerConnectionMap[e].addIceCandidate(new RTCIceCandidate(i))}catch(i){this.loggingService.catch("Error in HuddleService onIceCandidateChange:",i)}})}setRemoteDescription(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRemoteDescription","color: green;"),yield this.peerConnectionMap[e].setRemoteDescription(new RTCSessionDescription(t))}catch(i){this.loggingService.catch("Error in HuddleService setRemoteDescription:",i)}})}addAttendee(){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: addAttendee","color: green;"),this.documentPaths?.huddle&&this.user?.userSnippylyId){let e=m(p({},this.user),{timestamp:this.timestamp,streamMetadata:{webcam:this.localStream?.id,screen:this.screenSharingStream?.id},initialHuddleType:this.initialHuddleType,huddleOnCursorMode:this.huddleOnCursorMode$?.value});e=this.huddleUtilsService.formatHuddleAttendeeData(e);let t=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}`);yield this.realtimeAdapter.rtdbSet("huddle",t,JSON.parse(JSON.stringify(e))),this.dbRefsRemoveOnDropCall.push({type:"attendee",dbRef:t}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",t),yield this.updateUserHuddleState()}else this.loggingService.catch("Error in addAttendee: documentPaths not found")}catch(e){this.loggingService.catch("Error in HuddleService addAttendee:",e)}})}callExistingAttendees(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callExistingAttendees","color: green;"),this.realtimeAdapter.rtdbListVal$("huddle",this.attendees).pipe(he(1)).subscribe(e=>{e&&e.length>1?(e.forEach(t=>{t.userSnippylyId!==this.user.userSnippylyId&&!this.onOfferUidHistory[t.userSnippylyId]&&(this.loggingService.log("calling"),this.loggingService.log(t),this.initOffer(t.userSnippylyId))}),this.addLocalStreamToAllPeerConnections()):this.deleteMessages()})}catch(e){this.loggingService.catch("Error in HuddleService callExistingAttendees:",e)}}addLocalStreamToAllPeerConnections(){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToAllPeerConnections","color: green;"),Object.keys(this.senders).forEach(e=>{this.loggingService.log(this.senders[e]),this.localStream.getTracks().forEach(t=>{this.loggingService.log(t),this.senders[e].replaceTrack(t)})})}catch(e){this.loggingService.catch("Error in HuddleService addLocalStreamToAllPeerConnections:",e)}})}initOffer(e){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: initOffer","color: green;");let t=this.createPeerConnection(null,e);t&&(this.addLocalStreamToPeerConnection(t,!1),yield this.sendOffer(t,e))}catch(t){this.loggingService.catch("Error in HuddleService initOffer:",t)}})}createPeerConnection(e,t){try{return this.loggingService.log("%c[WB] Calling FUNCTION: createPeerConnection","color: green;"),e||(e=this.getCombinedId(this.user?.userSnippylyId,t)),e in this.peerConnectionMap?null:(this.loggingService.log("creating pc"),this.peerConnectionMap[e]=new RTCPeerConnection(this.servers),this.peerConnectionMap[e].onicecandidateerror=i=>{this.loggingService.log("Huddle: onicecandidateerror",i)},this.peerConnectionMap[e].onicecandidate=i=>{if(this.loggingService.log("pc onicecandidate"),i.candidate){let a={candidate:i.candidate.toJSON(),from:this.user.userSnippylyId,connectionId:e},c=this.realtimeAdapter.rtdbPush("huddle",this.iceCandidates,a);this.dbRefsRemoveOnDropCall.push({type:"iceCandidate",dbRef:c}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",c)}},this.peerConnectionMap[e].ontrack=i=>{this.loggingService.log("pc ontrack"),this.onTrack(e,i)},this.peerConnectionMap[e].onconnectionstatechange=i=>y(this,null,function*(){this.logStatuses("onconnectionstatechange",e,i),this.peerConnectionMap[e].connectionState==="failed"&&(this.removeConnection(e),this.closeConnection(e),this.checkForRemovingAttendee())}),this.peerConnectionMap[e].onicegatheringstatechange=i=>y(this,null,function*(){this.logStatuses("onicegatheringstatechange",e,i)}),this.peerConnectionMap[e].onsignalingstatechange=i=>y(this,null,function*(){this.logStatuses("onsignalingstatechange",e,i)}),this.peerConnectionMap[e].oniceconnectionstatechange=i=>y(this,null,function*(){this.loggingService.log("pc oniceconnectionstatechange"),this.logStatuses("oniceconnectionstatechange",e,i);try{this.peerConnectionStateMap[e]=this.peerConnectionMap[e].iceConnectionState,this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.peerConnectionMap[e]?.iceConnectionState==="connected"?(this.loggingService.log("connected"),this.updateTransceiverDirection(e)):this.peerConnectionMap[e]?.iceConnectionState==="disconnected"?this.loggingService.log("Disconnected"):this.peerConnectionMap[e].iceConnectionState==="closed"&&(this.loggingService.log("Closed"),this.closeConnection(e))}catch(a){this.loggingService.catch("Error in HuddleService oniceconnectionstatechange:",a)}}),this.peerConnectionMap[e].onnegotiationneeded=()=>{this.loggingService.log("pc onnegotiationneeded"),this.logStatuses("onnegotiationneeded",e)},e)}catch(i){return this.loggingService.catch("Error in HuddleService createPeerConnection:",i),""}}logStatuses(e,t,i){let a={};["connectionState","iceConnectionState","iceGatheringState","signalingState"].forEach(h=>{a[h]=this.peerConnectionMap[t][h]}),this.loggingService.log("Huddle: logStatues: ",t,e,a,i,this.peerConnectionMap[t])}checkForRemovingAttendee(){return y(this,null,function*(){try{this.documentPaths?.huddle&&this.user?.userSnippylyId&&(Object.keys(this.peerConnectionMap)?.length||(this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}}),this.joinHuddle(this.initialHuddleType)))}catch(e){this.loggingService.catch("Error in HuddleService checkForRemovingAttendee:",e)}})}closeConnection(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: closeConnection","color: green;"),this.peerConnectionMap[e]){let t=this.peerConnectionMap[e];t.getTransceivers()?.forEach(a=>{a.stop()}),t.getReceivers()?.forEach(a=>{a.track?.stop()}),t.close(),delete this.peerConnectionMap[e],delete this.onAnswerConnectionIdHistory[e],delete this.senders[e];let i=e.split("__").find(a=>a!==this.user?.userSnippylyId);i&&delete this.onOfferUidHistory[i]}}catch(t){this.loggingService.catch("Error in HuddleService closeConnection:",t)}}removeConnection(e){return y(this,null,function*(){try{this.documentPaths?.huddle&&e&&this.commonDbService.deleteData({feature:"huddleConnection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in HuddleService removeConnection:",t)}})}addLocalStreamToPeerConnection(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToPeerConnection","color: green;"),t?(this.localStream.getTracks().forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.screenSharingStream)})):(this.localStream.getTracks().forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(i=>{this.peerConnectionMap[e].addTrack(i,this.screenSharingStream)}))}catch(i){this.loggingService.catch("Error in HuddleService addLocalStreamToPeerConnection:",i)}}updateTransceiverDirection(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateTransceiverDirection","color: green;");let t=this.peerConnectionMap[e].getTransceivers();this.loggingService.log(t),t.map(i=>{this.loggingService.log(i.currentDirection),i.currentDirection!=="sendrecv"&&(i.direction="sendrecv"),this.senders[e]=i.sender})}catch(t){this.loggingService.catch("Error in HuddleService updateTransceiverDirection:",t)}}generateKey(){this.loggingService.log("%c[WB] Calling FUNCTION: generateKey","color: green;");let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let i=0;i<20;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}getCombinedId(e,t){try{return e.localeCompare(t)===-1?`${e}__${t}`:`${t}__${e}`}catch(i){return this.loggingService.catch("Error in HuddleService getCombinedId:",i),""}}sendOffer(e,t){return y(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendOffer","color: green;"),this.documentPaths?.huddle&&e){this.onOfferUidHistory[t]=!0;let i=yield this.peerConnectionMap[e].createOffer();yield this.setLocalDescription(e,i);let a={sdp:i.sdp,type:i.type};t||(t="all");let c={offer:a,from:this.user.userSnippylyId,connectionId:e,to:t},h=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/connections/${e}`);yield this.realtimeAdapter.rtdbSet("huddle",h,{offerData:c}),this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:h}),this.realtimeAdapter.rtdbOnDisconnectRemove("huddle",h)}}catch(i){this.loggingService.catch("Error in HuddleService sendOffer:",i)}})}setLocalDescription(e,t){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocalDescription","color: green;"),yield this.peerConnectionMap[e].setLocalDescription(t)}catch(i){this.loggingService.catch("Error in HuddleService setLocalDescription:",i)}})}onTrack(e,t){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onTrack","color: green;"),this.remoteStreamMap[e]||(this.remoteStreamMap[e]={}),this.loggingService.log(t.receiver.track),t?.streams?.length){this.remoteStreamMap[e][t.streams[0].id]=t.streams[0];let i=e.split("__").find(c=>c!==this.user?.userSnippylyId),a=this.attendees$.value?.find(c=>c?.userSnippylyId===i);a&&(a?.streamMetadata?.webcam===t.streams[0].id&&(this.remoteStreamMap[e].webcam=t.streams[0]),a?.streamMetadata?.screen===t.streams[0].id&&(this.remoteStreamMap[e].screen=t.streams[0])),this.remoteStreamMap$.next(this.remoteStreamMap)}}catch(i){this.loggingService.catch("Error in HuddleService onTrack:",i)}}toggleScreenSharing(e){return y(this,null,function*(){try{if(e)this.screenSharingStream=yield navigator.mediaDevices?.getDisplayMedia({video:!0}),Object.keys(this.peerConnectionMap).forEach(t=>{this.peerConnectionMap[t].getSenders().find(c=>c?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind)?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])});else{let t=this.localStream;Object.keys(this.peerConnectionMap).forEach(i=>{this.peerConnectionMap[i].getSenders().find(h=>h?.track?.kind==t.getVideoTracks()[0].kind)?.replaceTrack(t.getVideoTracks()[0])}),this.screenSharingStream?.getTracks().forEach(i=>i.stop())}}catch(t){this.loggingService.catch("Error in HuddleService toggleScreenSharing:",t)}})}setLocalStream(e){return y(this,null,function*(){try{if(this.localStream=new MediaStream([this.silence(),this.black()]),e?.audio||e?.video){let t=e,i=we();e?.audio&&(e?.audio instanceof Object?t.audio=m(p({},e?.audio),{deviceId:i?.selectedAudioDevice?.deviceId}):t.audio={deviceId:i?.selectedAudioDevice?.deviceId}),e?.video&&(e?.video instanceof Object?t.video=m(p({},e?.video),{deviceId:i?.selectedVideoDevice?.deviceId}):t.video={deviceId:i?.selectedVideoDevice?.deviceId});let a=yield navigator.mediaDevices.getUserMedia(t);a?.getAudioTracks()?.length&&(this.localStream.getAudioTracks().forEach(c=>this.localStream.removeTrack(c)),a.getAudioTracks().forEach(c=>this.localStream.addTrack(c))),a?.getVideoTracks()?.length&&(this.localStream.getVideoTracks().forEach(c=>this.localStream.removeTrack(c)),a.getVideoTracks().forEach(c=>this.localStream.addTrack(c)))}this.localStream$.next(this.localStream)}catch(t){this.loggingService.catch("Error in HuddleService setLocalStream:",t)}})}setScreenSharingStream(){return y(this,null,function*(){try{let e=yield navigator.mediaDevices?.getDisplayMedia({video:!0});e&&this.screenSharingStream$.next(e)}catch(e){this.loggingService.catch("Error in HuddleService setScreenSharingStream:",e)}})}removeLocalStream(){return y(this,null,function*(){try{this.localStream$?.value&&(this.localStream$.value.getTracks().forEach(t=>{t.stop()}),this.localStream$.next(null))}catch(e){this.loggingService.catch("Error in HuddleService removeLocalStream:",e)}})}toggleLocalStreamAudio(e){return y(this,null,function*(){try{let t=this.localStream$.value;if(t){let i=t.getAudioTracks()[0];if(i.enabled&&!e)i.stop(),t.getAudioTracks()?.forEach(a=>{t.removeTrack(a)}),t.addTrack(this.silence()),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_AUDIO_MUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=we(),c=yield navigator.mediaDevices.getUserMedia({audio:{deviceId:a?.selectAudioDevice?.deviceId}});c&&(t.getAudioTracks()?.forEach(h=>{t.removeTrack(h)}),c.getAudioTracks()?.forEach(h=>{t.addTrack(h)}),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_AUDIO_UNMUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(h=>h?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(h=>h?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(H=>H?.track?.kind==t?.getAudioTracks()[0].kind)?.replaceTrack(t?.getAudioTracks()[0])}),this.updateUserHuddleState()}}catch(t){this.loggingService.catch("Error in HuddleService toggleLocalStreamAudio:",t)}})}toggleLocalStreamVideo(e){return y(this,null,function*(){try{let t=this.localStream$.value;if(t){let i=t.getVideoTracks()[0];if(i.enabled&&!e)i.stop(),t.getVideoTracks()?.forEach(a=>{t.removeTrack(a)}),t.addTrack(this.black()),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_VIDEO_TURNED_OFF,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=we(),c=yield navigator.mediaDevices.getUserMedia({video:{deviceId:a?.selectedVideoDevice?.deviceId}});c&&(t.getVideoTracks()?.forEach(h=>{t.removeTrack(h)}),c.getVideoTracks()?.forEach(h=>{t.addTrack(h)}),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_VIDEO_TURNED_ON,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(h=>h?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(h=>h?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(H=>H?.track?.kind==t?.getVideoTracks()[0].kind)?.replaceTrack(t?.getVideoTracks()[0])}),this.updateUserHuddleState()}}catch(t){this.loggingService.catch("Error in HuddleService toggleLocalStreamVideo:",t)}})}toggleLocalScreenSharing(){return y(this,null,function*(){try{let e=this.screenSharingStream;if(e){if(e.getVideoTracks()[0].enabled)this.stopScreenSharingStream();else{let i=yield navigator.mediaDevices?.getDisplayMedia({video:!0});i&&(e.getVideoTracks()?.forEach(a=>{e.removeTrack(a)}),i.getVideoTracks()?.forEach(a=>{e.addTrack(a),a.onended=()=>{this.stopScreenSharingStream(),this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}})),this.screenSharingStream$.next(e),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_SCREENSHARING_STARTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)})}this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}}catch(e){this.loggingService.catch("Error in HuddleService toggleLocalScreenSharing:",e)}})}stopScreenSharingStream(){return y(this,null,function*(){let e=this.screenSharingStream;if(e){let t=e.getVideoTracks()[0];t.enabled&&(t.stop(),e.getVideoTracks()?.forEach(i=>{e.removeTrack(i)}),e.addTrack(this.black()),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_SCREENSHARING_STOPPED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(i=>i?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(i=>i?.userId)}))}})}updateScreenSharingTracksToPeers(){return y(this,null,function*(){Object.keys(this.peerConnectionMap).forEach(e=>{let i=this.peerConnectionMap[e].getSenders().filter(a=>a?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind);i?.length>1&&i[1]?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])})})}dropCall(){return y(this,null,function*(){try{this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.removeHuddleSessionData(),this.huddleJoined=!1,this.huddleJoined$.next(!1),this.peerConnectionMap&&Object.keys(this.peerConnectionMap).forEach(e=>{let t=this.peerConnectionMap[e];t.getTransceivers()?.forEach(i=>{i.stop()}),t.getSenders()?.forEach(i=>{i.track?.stop()}),t.getReceivers()?.forEach(i=>{i.track?.stop()}),t.close()}),this.peerConnectionMap={},this.dbRefsRemoveOnDropCall.forEach(e=>y(this,null,function*(){yield this.realtimeAdapter.rtdbRemove("huddle",e.dbRef)})),this.onOfferUidHistory={},this.onAnswerConnectionIdHistory={},this.senders={},this.peerConnectionStateMap={},this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.localStream.getTracks().forEach(e=>{e.stop()}),this.screenSharingStream.getTracks().forEach(e=>{e.stop()}),this.localStream=new MediaStream([this.silence(),this.black()]),this.screenSharingStream=new MediaStream([this.black()]),this.localStream$.next(this.localStream),this.screenSharingStream$.next(this.screenSharingStream),this.localStreamState$.next({audioState:!1,videoState:!1,screenSharingState:!1}),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_LEFT,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(e=>e?.userId)})}catch(e){this.loggingService.catch("Error in HuddleService dropCall:",e)}})}updateHuddleSessionData(e,t,i){try{let a=JSON.parse(sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)||"{}");i?sessionStorage.setItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(i)):(a[e]=t,sessionStorage.setItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(a)))}catch(a){this.loggingService.catch("Error in HuddleService updateHuddleSessionData:",a)}}getHuddleSessionData(){try{return sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)?JSON.parse(sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)):null}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleSessionData:",e),null}}removeHuddleSessionData(){try{sessionStorage.removeItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)}catch(e){this.loggingService.catch("Error in HuddleService removeHuddleSessionData:",e)}}removeAttendee(){return y(this,null,function*(){try{if(this.documentPaths?.huddle&&this.user.userSnippylyId){yield this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}});return}else return}catch(e){return this.loggingService.catch("Error in HuddleService removeAttendee:",e),Promise.resolve(null)}})}updateUserHuddleState(){return y(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=this.getAudioState(),t=this.getVideoState(),i=this.getScreenSharingState();this.localStreamState$.next({audioState:e,videoState:t,screenSharingState:i});let a={audioState:e,videoState:t,screenSharingState:i};yield this.commonDbService.setData({feature:"huddleAttendeeState",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0},data:a})}}catch(e){this.loggingService.catch("Error in HuddleService updateUserHuddleState:",e)}})}updateHuddleOnCursorMode(){return y(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=this.realtimeAdapter.rtdbRef(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}/huddleOnCursorMode`);yield this.realtimeAdapter.rtdbSet("huddle",e,!!this.huddleOnCursorMode$.value)}}catch(e){this.loggingService.catch("Error in HuddleService updateHuddleOnCursorMode:",e)}})}getAudioState(){try{let e=this.localStream$.value;if(e){let t=e?.getAudioTracks();return!!(t?.length?t[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getAudioState:",e),!1}}getVideoState(){try{let e=this.localStream$.value;if(e){let t=e?.getVideoTracks();return!!(t?.length?t[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}getScreenSharingState(){try{let e=this.screenSharingStream;if(e){let t=e?.getVideoTracks();return!!(t?.length?t[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}removeIceCandidates(e){return y(this,null,function*(){try{if(this.documentPaths?.huddle&&e){let t=yield this.commonDbService?.getData({feature:"allHuddleIceCandidates",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}});Object.keys(t).length>0&&Object.keys(t).forEach(i=>y(this,null,function*(){t[i].connectionId===e&&this.commonDbService.deleteData({feature:"huddleIceCandidate",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:i,skipFirestore:!0}})}))}}catch(t){this.loggingService.catch("Error in HuddleService dropCall:",t)}})}get timestamp(){return this.commonDbService.getServerTimestamp()}silence(){try{let e=new AudioContext,t=e.createOscillator(),i=t.connect(e.createMediaStreamDestination());return t.start(),Object.assign(i.stream.getAudioTracks()[0],{enabled:!1})}catch(e){this.loggingService.catch("Error in HuddleService silence:",e)}}black({width:e=640,height:t=480}={}){try{let i=Object.assign(document.createElement("canvas"),{width:e,height:t});i.getContext("2d")?.fillRect(0,0,e,t);let a=i.captureStream();return Object.assign(a.getVideoTracks()[0],{enabled:!1})}catch(i){this.loggingService.catch("Error in HuddleService black:",i)}}getInitialHuddleType(){try{return this.initialHuddleType}catch(e){return this.loggingService.catch("Error in HuddleService getInitialHuddleType:",e),null}}getHuddleAttendees$(){try{return this.attendees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees$:",e),P([])}}getHuddleAttendees(){try{return this.attendees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees:",e),null}}getHuddleInvitees$(){try{return this.invitees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees$:",e),P([])}}getHuddleInvitees(){try{return this.invitees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees:",e),null}}getHuddleStartTime(){try{return this.userHuddleStartTime$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleStartTime:",e),null}}getTotalUserHuddleDuration(){try{return this.userHuddleStartTime$.value?new Date().getTime()-this.userHuddleStartTime$.value:null}catch(e){return this.loggingService.catch("Error in HuddleService gettotalUserHuddleDuration:",e),null}}inviteUsers(e){try{this.updateInvitees(e);let t={};t.notificationSource="huddleInvite",t.huddleInvitees=e,t.huddleType=this.getInitialHuddleType(),this.updateNotificationsDatabase(t)}catch(t){this.loggingService.catch("Error in HuddleService inviteUsers:",t)}}updateInvitees(e){try{if(this.documentPaths?.huddle){let t={};e.forEach(i=>{if(i?.email){let a=jt(i.email);t[a]=i}}),this.commonDbService.setData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in HuddleService updateInvitees:",t)}}updateNotificationsDatabase(e={}){try{let t=p({notificationSource:"huddle"},e);this.serviceBook.get(Zt)?.updateNotificationDatabase(t)}catch(t){this.loggingService.catch("Error in HuddleService updateNotificationsDatabase: ",t)}}getHuddleJoined$(){try{return this.huddleJoined$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleJoined$:",e),P(!1)}}getHuddleCursorAvailableByAttendeeId(){try{return this.huddleCursorAvailableByAttendeeId$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId:",e),null}}getHuddleCursorAvailableByAttendeeId$(){try{return this.huddleCursorAvailableByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId$:",e),P({})}}updateHuddleCursorAvailableByAttendeeId(e,t){try{let i=this.huddleCursorAvailableByAttendeeId$.value;i[e]=t,this.huddleCursorAvailableByAttendeeId$.next(i)}catch(i){this.loggingService.catch("Error in HuddleService updateCursorUserAvailableByUserId:",i)}}setRemoteStreamsByUserId(e){try{this.remoteStreamsByUserId$.next(e)}catch(t){this.loggingService.catch("Error in HuddleService setRemoteStreamsByUserId:",t)}}getRemoteStreamsByUserId$(){try{return this.remoteStreamsByUserId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getRemoteStreamsByUserId$:",e),P({})}}enableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableHuddleOnCursorMode:",e)}}disableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableHuddleOnCursorMode:",e)}}getHuddleOnCursorMode$(){try{return this.huddleOnCursorMode$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorMode$:",e),P(!1)}}enableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableFlockModeOnAvatarClick:",e)}}disableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableFlockModeOnAvatarClick:",e)}}getFlockModeOnAvatarClick$(){try{return this.flockModeOnAvatarClickEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick$:",e),P(!1)}}getFlockModeOnAvatarClick(){try{return this.flockModeOnAvatarClickEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick:",e),!1}}enableChat(){try{this.chatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableChat:",e)}}disableChat(){try{this.chatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableChat:",e)}}getChatEnabled$(){try{return this.chatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled$:",e),P(!1)}}getChatEnabled(){try{return this.chatEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled:",e),!1}}enableServerFallback(){try{if(this.serverFallback$.value===!0)return;this.serverFallback$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableServerFallback:",e)}}disableServerFallback(){try{if(this.serverFallback$.value===!1)return;this.serverFallback$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableServerFallback:",e)}}getServerFallback$(){try{return this.serverFallback$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getServerFallback$:",e),P(!1)}}getServerFallback(){try{return this.serverFallback$.value}catch(e){return this.loggingService.catch("Error in HuddleService getServerFallback:",e),!1}}getHuddleOnCursorModeByAttendeeId$(){try{return this.huddleOnCursorModeByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorModeByAttendeeId$:",e),P({})}}toggleHuddleOnCursorModeByAttendeeId(e){try{let t=this.huddleOnCursorModeByAttendeeId$.value;t[e]?delete t[e]:t[e]=!0,this.huddleOnCursorModeByAttendeeId$.next(t)}catch(t){this.loggingService.catch("Error in HuddleService toggleHuddleOnCursorModeByAttendeeId:",t)}}addCursorTag(){try{if(!document.querySelector(`${M.TAGS.SNIPPYLY_CURSOR}`)){let e=document.createElement(M.TAGS.SNIPPYLY_CURSOR);e.setAttribute("snippyly-temporary","true"),document.body.appendChild(e)}}catch(e){this.loggingService.catch("Error in HuddleService addCursorTag:",e)}}removeCursorTag(){try{let e=document.querySelector(`${M.TAGS.SNIPPYLY_CURSOR}`);e?.hasAttribute("snippyly-temporary")&&e.remove()}catch(e){this.loggingService.catch("Error in HuddleService removeCursorTag:",e)}}sendMessage(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;"),this.documentPaths?.huddle&&this.user){let t=new $t;t.message=e,t.from=this.user,t.timestamp=this.timestamp,this.commonDbService.setData({feature:"huddleMessage",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:t.id,skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in HuddleService sendMessage:",t)}}getMessages$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessages$","color: green;"),this.messages$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessages$:",e),P([])}}deleteMessages(){try{this.loggingService.log("%c[WB] Calling FUNCTION: deleteMessages","color: green;"),this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleMessages",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService deleteMessages:",e)}}showMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService showMessagesPanel:",e)}}hideMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: hideMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService hideMessagesPanel:",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!this.messagesPanelVisible$.value)}catch(e){this.loggingService.catch("Error in HuddleService toggleMessagesPanel:",e)}}getMessagesPanelVisible$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible$","color: green;"),this.messagesPanelVisible$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible$:",e),P(!1)}}getMessagesPanelVisible(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible","color: green;"),this.messagesPanelVisible$.value}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible:",e),!1}}signOutUser(e){return y(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee())}catch(t){this.loggingService.catch("Error in HuddleService signOutUser:",t)}})}};o.\u0275fac=function(t){return new(t||o)(B(kt),B(le),B(se),B(Xt),B(Qt),B(Ee),B(ue),B(Ae),B(Ht),B(w),B(tn),B(Oe),B(Me),B(en))},o.\u0275prov=Se({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();function kn(r,o){if(r&1&&(l(0,"div",21),A(1),b(2,"translate"),b(3,"translate"),u()),r&2){let n=s().$implicit,e=s().ngIf;d(),ie(" ",(n==null||n.from==null?null:n.from.userId)===(e.user==null?null:e.user.userId)?x(2,1,"Me"):x(3,3,(n==null||n.from==null?null:n.from.name)||(n==null||n.from==null?null:n.from.email))," ")}}function Hn(r,o){r&1&&S(0,"velt-skeleton-loader-internal",22)}function In(r,o){if(r&1&&(D(0),l(1,"div",15),S(2,"snippyly-user-avatar",16),l(3,"div",17),_(4,kn,4,5,"div",18)(5,Hn,1,0,"ng-template",null,1,Z),l(7,"div",19),A(8),b(9,"timeAgo"),u(),S(10,"div",20),b(11,"translate"),b(12,"safeHtml"),u()(),U()),r&2){let n=o.$implicit,e=F(6),t=s().ngIf;d(2),g("user",n==null?null:n.from),d(2),g("ngIf",(n==null||n.from==null?null:n.from.userId)===(t.user==null?null:t.user.userId)||(n==null||n.from==null?null:n.from.name)||(n==null||n.from==null?null:n.from.email))("ngIfElse",e),d(4),N(x(9,5,n==null?null:n.timestamp)),d(2),g("innerHTML",x(12,9,x(11,7,(n==null?null:n.message)||"")),tt)}}function wn(r,o){if(r&1){let n=E();D(0),l(1,"div",3)(2,"div",4,0)(4,"div",5)(5,"div"),A(6),b(7,"translate"),u(),l(8,"div"),k(),l(9,"svg",6),f("click",function(){v(n);let t=s();return C(t.toggleMessagesPanel())}),S(10,"path",7),u()()(),re(),l(11,"div",8),_(12,In,13,11,"ng-container",9),u(),l(13,"div",10)(14,"textarea",11),b(15,"translate"),gt("ngModelChange",function(t){let i=v(n).ngIf;return ct(i.message,t)||(i.message=t),C(t)}),f("keydown.enter",function(t){v(n);let i=s();return t.preventDefault(),C(i.sendMessage())}),u(),l(16,"button",12),f("click",function(){v(n);let t=s();return C(t.sendMessage())}),k(),l(17,"svg",13),S(18,"path",14),u()()()()(),U()}if(r&2){let n=o.ngIf,e=s();d(),q("visible",n.messagesPanelVisible)("mobile",n.isPhone),d(5),N(x(7,11,"In-call messages")),d(6),g("ngForOf",n.messages)("ngForTrackBy",e.trackByMessageId),d(2),g("placeholder",ut(x(15,13,"Type here..."))),dt("ngModel",n.message),d(2),g("disabled",!(n.message!=null&&n.message.trim()))}}var je=(()=>{let o=class o{constructor(e,t,i,a,c,h){this.authService=e,this.huddleService=t,this.loggingService=i,this.breakpointObserver=a,this.elementRef=c,this.domService=h,this.subscriptions=[],this.componentConfigSignal=W({isPhone:!1,user:null,messages:[],message:"",messagesPanelVisible:!1});try{this.loggingService.log("%c[WB] Creating CLASS: HuddleMessagesPanelComponent","color: blue;"),this.subscriptions.push(this.huddleService.getMessages$().subscribe(H=>{H.sort(($,T)=>$?.timestamp-T?.timestamp),this.componentConfigSignal.update($=>m(p({},$),{messages:H}))})),this.subscriptions.push(this.huddleService.getMessagesPanelVisible$().subscribe(H=>{this.componentConfigSignal.update($=>m(p({},$),{messagesPanelVisible:H}))})),this.subscriptions.push(this.authService.getUser$().subscribe(H=>{this.componentConfigSignal.update($=>m(p({},$),{user:H}))})),this.subscriptions.push(this.breakpointObserver.observe(At.XSmall).subscribe(H=>{H.matches?this.componentConfigSignal.update($=>m(p({},$),{isPhone:!0})):this.componentConfigSignal.update($=>m(p({},$),{isPhone:!1}))},H=>{this.loggingService.catch("Error in HuddleMessagesPanelComponent breakpointObserver subscription: ",H)}))}catch(H){this.loggingService.catch("Error in HuddleMessagesPanelComponent constructor: ",H)}}ngOnInit(){}ngAfterViewInit(){try{this.subscriptions.push(this.domService.subscribeInjectCustomCss(this.elementRef))}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent ngAfterViewInit: ",e)}}trackByMessageId(e,t){return t.id||e}highlightLinks(e){this.loggingService.log("%c[WB] Calling FUNCTION: highlightLinks","color: green;");try{return e&&(e=e?.replaceAll("&amp;","&")),e.replaceAll(M.REGEX_URL,i=>new RegExp(M.REGEX_EMAIL).test("@"+i)?i:`<a class="message-link" href="${i}" target="_blank">${i}</a>`)}catch(t){return this.loggingService.catch("Error in HuddleMessagesPanelComponent highlightLinks: ",t),""}}sendMessage(){this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;");try{let e=this.componentConfigSignal().message?.trim();if(!e)return;e=this.highlightLinks(e),this.huddleService.sendMessage(e),this.componentConfigSignal.update(t=>m(p({},t),{message:""}))}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent sendMessage: ",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.huddleService.toggleMessagesPanel()}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent toggleMessagesPanel: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onDestroy","color: green;"),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(se),I(R),I(w),I(Tt),I(_e),I(ue))},o.\u0275cmp=G({type:o,selectors:[["velt-huddle-messages-panel-internal"]],standalone:!1,decls:1,vars:1,consts:[["sidebarRef",""],["loadingTemplateRef",""],[4,"ngIf"],["part","container","data-velt-element","true","data-velt-comment-disabled","true",1,"s-sidebar-container"],[1,"s-sidebar"],[1,"v-huddle-messages-header"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"v-huddle-message-panel-close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#777E91"],[1,"v-huddle-messages-container"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"v-huddle-message-box-container"],["name","message","rows","1",1,"v-huddle-message-box-input",3,"ngModelChange","keydown.enter","placeholder","ngModel"],[1,"v-huddle-message-box-send-btn",3,"click","disabled"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M20.8089 10.1394L4.6724 3.15546C3.9926 2.8612 3.22459 2.99065 2.66814 3.49311C2.1117 3.99565 1.87896 4.76995 2.06084 5.51382L3.49713 11.3888H10.5294C10.853 11.3888 11.1154 11.6625 11.1154 12C11.1154 12.3375 10.853 12.6112 10.5294 12.6112H3.49713L2.06084 18.4862C1.87896 19.2301 2.11166 20.0044 2.66814 20.5069C3.22572 21.0104 3.99381 21.1382 4.67244 20.8445L20.8089 13.8606C21.5436 13.5426 22 12.8297 22 12C22 11.1703 21.5436 10.4574 20.8089 10.1394Z","fill","#777E90"],[1,"v-huddle-message-block"],[3,"user"],[1,"v-huddle-message-block-right"],["class","v-huddle-message-block-user",4,"ngIf","ngIfElse"],[1,"v-huddle-message-block-time"],[1,"v-huddle-message-block-message",3,"innerHTML"],[1,"v-huddle-message-block-user"],["height","20px","width","80px","borderRadius","20px"]],template:function(t,i){t&1&&_(0,wn,19,15,"ng-container",2),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[ge,J,It,wt,Mt,pe,Te,Q,sn,dn],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}:host{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-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)}:host[dark]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-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)}.s-sidebar-container{height:100vh;width:calc((22rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;right:-100%;padding:calc((1rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;z-index:999999997;transition:width .5s ease-in-out,right .5s ease-in-out}.s-sidebar-container.mobile{width:100%!important;height:100%!important;box-sizing:border-box!important;-webkit-backdrop-filter:blur(2px)!important;backdrop-filter:blur(2px)!important}.s-sidebar-container.visible{right:0}.s-sidebar-container .s-sidebar{background:var(--velt-background-0);padding:calc((1rem + 0px) * var(--velt-base-rem-unit));border-radius:var(--velt-border-radius-lg);width:100%;overflow-x:hidden;box-sizing:border-box;position:relative;height:100%;border:1px solid var(--velt-border-5);display:flex;flex-direction:column;justify-content:space-between;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .s-sidebar::-webkit-scrollbar{display:none;width:0;height:0}.s-sidebar-container .s-sidebar:not(.s-overflow-hidden){overflow-y:auto}.s-sidebar-container .v-huddle-message-panel-close-btn{cursor:pointer}.s-sidebar-container .v-huddle-messages-header{display:flex;justify-content:space-between}.s-sidebar-container .v-huddle-messages-container{overflow:auto;flex-grow:1}.s-sidebar-container .v-huddle-messages-container::-webkit-scrollbar{display:none;width:0;height:0}.s-sidebar-container .v-huddle-message-block{display:flex;gap:calc((1rem + 0px) * var(--velt-base-rem-unit));margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .v-huddle-message-block .v-huddle-message-block-time{font-size:calc((.5rem + 0px) * var(--velt-base-rem-unit));color:gray;margin-bottom:calc((.25rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .v-huddle-message-block .v-huddle-message-block-message{font-size:calc((.75rem + 0px) * var(--velt-base-rem-unit));word-break:break-word;white-space:pre-wrap}.s-sidebar-container .v-huddle-message-box-container{display:flex;gap:calc((1rem + 0px) * var(--velt-base-rem-unit));align-items:center}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-input{padding:calc((.75rem + 0px) * var(--velt-base-rem-unit));border-radius:8px;border:0;outline:0;background:#f7f7f7;flex-grow:1;font-family:var(--velt-default-font-family);resize:none}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-send-btn{background:transparent;border:0;outline:0;border-radius:100%;width:32px;height:32px;display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer;opacity:1}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-send-btn[disabled]{opacity:.5;cursor:not-allowed}
2
2
  `],encapsulation:3,changeDetection:0});let r=o;return r})();function En(r,o){if(r&1&&(l(0,"span",7),A(1),b(2,"translate"),u()),r&2){let n=s(2).ngIf;d(),ie(" ",n.user!=null&&n.user.name?n.user==null||n.user.name==null?null:n.user.name.charAt(0):x(2,1,n.user==null||n.user.email==null?null:n.user.email.charAt(0)))}}function On(r,o){if(r&1){let n=E();l(0,"img",8),f("error",function(){v(n);let t=s(3);return C(t.onImageLoadError())}),u()}if(r&2){let n=s(2).ngIf;g("src",n.user.photoUrl,fe)}}function Tn(r,o){if(r&1&&(l(0,"div",3)(1,"span",4),b(2,"translate"),_(3,En,3,3,"span",5)(4,On,1,1,"ng-template",null,0,Z),u(),S(6,"audio",6),u()),r&2){let n=F(5),e=s().ngIf;d(),ye("color",e.user.color+" !important")("background-color",e.user.color+" !important"),g("title",x(2,8,(e.user==null?null:e.user.name)||(e.user==null?null:e.user.email))),d(2),g("ngIf",e.showInitial)("ngIfElse",n),d(3),g("srcObject",e.remoteAudioStream)}}function An(r,o){if(r&1&&(D(0),_(1,Tn,7,10,"div",2),U()),r&2){let n=o.ngIf;d(),g("ngIf",n.user)}}var ze=(()=>{let o=class o{constructor(e){this.loggingService=e,this.veltElement=!0,this.componentConfigSignal=W({user:this.user,showInitial:!1,remoteAudioStream:this.remoteAudioStream})}ngOnInit(){}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling AudioHuddleUserComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=m(p({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in AudioHuddleUserComponent ngOnChanges: ",t)}}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.componentConfigSignal.update(e=>(e=m(p({},e),{showInitial:!0}),e))}catch(e){this.loggingService.catch("Error in AudioHuddleUserComponent onImageLoadError: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(w))},o.\u0275cmp=G({type:o,selectors:[["snippyly-audio-huddle-user"]],hostVars:1,hostBindings:function(t,i){t&2&&K("data-velt-element",i.veltElement)},inputs:{user:"user",remoteAudioStream:"remoteAudioStream"},standalone:!1,features:[ne],decls:1,vars:1,consts:[["showAvatarImgRef",""],[4,"ngIf"],["class","audio-huddle-user photo-container",4,"ngIf"],[1,"audio-huddle-user","photo-container"],["velt-ignore-change-detection","true",1,"audio-huddle-user",3,"title"],["class","audio-huddle-user-initial",4,"ngIf","ngIfElse"],["autoplay","true",3,"srcObject"],[1,"audio-huddle-user-initial"],["referrerpolicy","no-referrer","loading","lazy",1,"audio-huddle-user-image",3,"error","src"]],template:function(t,i){t&1&&_(0,An,2,1,"ng-container",1),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[J,Q],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}.audio-huddle-user[_ngcontent-%COMP%]{display:none!important}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:40px;height:40px;box-sizing:border-box;background-clip:padding-box;border-radius:50%;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;transition:top .12s ease-in-out,width .12s ease-in-out,height .12s ease-in-out}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.s-presence-container[_ngcontent-%COMP%]{display:inline-flex;flex-direction:row-reverse;align-items:center}.audio-huddle-user[_ngcontent-%COMP%]{position:relative;box-shadow:0 0 0 3px;border-radius:50%;overflow:hidden;width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((2rem + 0px) * var(--velt-base-rem-unit));min-width:calc((2rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2rem + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.audio-huddle-user.more-users[_ngcontent-%COMP%]{background:#4578a7;box-shadow:0 0 0 3px #4578a7}.audio-huddle-user[_ngcontent-%COMP%]:not(:last-child):not(.more-users){margin-left:calc((-.5rem + 0px) * var(--velt-base-rem-unit))!important}.audio-huddle-user-image[_ngcontent-%COMP%]{width:100%;height:100%;display:block;object-fit:cover}.audio-huddle-user-image-small[_ngcontent-%COMP%]{width:calc((1.6rem + 0px) * var(--velt-base-rem-unit));height:100%;display:block;object-fit:cover}.audio-huddle-user-initial[_ngcontent-%COMP%]{color:#fff}.away[_ngcontent-%COMP%]{filter:grayscale(1)}"],changeDetection:0});let r=o;return r})();function Vn(r,o){if(r&1&&(l(0,"span",11),A(1),b(2,"translate"),u()),r&2){let n=s(2).ngIf;d(),ie(" ",n.user!=null&&n.user.name?n.user==null||n.user.name==null?null:n.user.name.charAt(0):x(2,1,n.user==null||n.user.email==null?null:n.user.email.charAt(0)))}}function Dn(r,o){if(r&1){let n=E();l(0,"img",12),f("error",function(){v(n);let t=s(3);return C(t.onImageLoadError())}),u()}if(r&2){let n=s(2).ngIf;g("src",n.user==null?null:n.user.photoUrl,fe)}}function Un(r,o){if(r&1&&(l(0,"span"),A(1),b(2,"translate"),u()),r&2){let n=s(2).ngIf;d(),N(n.isRemoteStream?n.user==null||n.user.name==null?null:n.user.name.split(" ")[0]:x(2,1,"You"))}}function Ln(r,o){r&1&&(k(),l(0,"svg",15),S(1,"path",16),u())}function Bn(r,o){r&1&&(k(),l(0,"svg",17),S(1,"path",18)(2,"path",19),u())}function Fn(r,o){if(r&1&&(D(0),_(1,Ln,2,0,"svg",13)(2,Bn,3,0,"svg",14),U()),r&2){let n=s(2).ngIf;d(),g("ngIf",n.audioState),d(),g("ngIf",!n.audioState)}}function Nn(r,o){r&1&&(k(),l(0,"svg",15),S(1,"path",16),u())}function Rn(r,o){r&1&&(k(),l(0,"svg",17),S(1,"path",18)(2,"path",19),u())}function $n(r,o){r&1&&(k(),l(0,"svg",23),S(1,"path",24),u())}function jn(r,o){r&1&&(k(),l(0,"svg",17)(1,"g"),S(2,"path",25)(3,"path",19),u()())}function zn(r,o){if(r&1){let n=E();l(0,"div",20),f("click",function(t){return v(n),C(t.stopPropagation())}),l(1,"div",21),f("click",function(){v(n);let t=s(3);return C(t.onToggleAudioClick())}),_(2,Nn,2,0,"svg",13)(3,Rn,3,0,"svg",14),u(),l(4,"div",21),f("click",function(){v(n);let t=s(3);return C(t.onToggleVideoClick())}),_(5,$n,2,0,"svg",22)(6,jn,4,0,"svg",14),u()()}if(r&2){let n=s(2).ngIf;d(2),g("ngIf",n.audioState),d(),g("ngIf",!n.audioState),d(2),g("ngIf",n.videoState),d(),g("ngIf",!n.videoState)}}function Wn(r,o){if(r&1){let n=E();l(0,"div",20),f("click",function(t){return v(n),C(t.stopPropagation())}),l(1,"div",21),f("click",function(){v(n);let t=s(3);return C(t.onToggleHuddleOnCursor())}),k(),l(2,"svg",17),S(3,"path",26),u()()()}}function Gn(r,o){if(r&1){let n=E();l(0,"div",3),f("click",function(){v(n);let t=s(2);return C(t.toggleSelection())}),l(1,"div",4),S(2,"video",5),l(3,"div",6)(4,"span",7),b(5,"translate"),_(6,Vn,3,3,"span",8)(7,Dn,1,1,"ng-template",null,0,Z),u()(),l(9,"div",9),_(10,Un,3,3,"span",1)(11,Fn,3,2,"ng-container",1),u()(),_(12,zn,7,4,"div",10)(13,Wn,4,0,"div",10),u()}if(r&2){let n=F(8),e=s().ngIf,t=s();q("local-stream",!e.isRemoteStream)("video-off",!e.videoState)("speaking",e.audioState)("selected",t.selected),d(2),q("flip",!e.isRemoteStream),g("srcObject",e.isRemoteStream?e.remoteVideoStream:e.stream)("muted",e.isRemoteStream?null:"muted")("volume",e.isRemoteStream?1:0),d(2),ye("color",(e.user==null?null:e.user.color)+" !important")("background-color",(e.user==null?null:e.user.color)+" !important"),g("title",x(5,24,(e.user==null?null:e.user.name)||(e.user==null?null:e.user.email))),d(2),g("ngIf",e.showInitials)("ngIfElse",n),d(4),g("ngIf",e.user==null?null:e.user.name),d(),g("ngIf",e.isRemoteStream),d(),g("ngIf",!e.isRemoteStream),d(),g("ngIf",e.isRemoteStream)}}function Zn(r,o){if(r&1&&(D(0),_(1,Gn,14,26,"div",2),U()),r&2){let n=o.ngIf;d(),g("ngIf",n.isRemoteStream?n.remoteVideoStream:n.stream)}}var We=(()=>{let o=class o{get remoteStream(){return this._remoteStream}set remoteStream(e){this._remoteStream=e}constructor(e){this.loggingService=e,this.toggleAudio=new X,this.toggleVideo=new X,this.toggleHuddleOnCursor=new X,this.veltElement=!0,this.componentConfigSignal=W({isRemoteStream:this.isRemoteStream,remoteVideoStream:this.remoteVideoStream,stream:this.stream,videoState:this.videoState,audioState:this.audioState,user:this.user,selected:this.selected,showInitials:!1})}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling VideoHuddleUserComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=m(p({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in VideoHuddleUserComponent ngOnChanges: ",t)}}onToggleAudioClick(){this.toggleAudio.emit()}onToggleVideoClick(){this.toggleVideo.emit()}toggleSelection(){this.componentConfigSignal.update(e=>(e.selected=!e.selected,e))}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.componentConfigSignal.update(e=>(e=m(p({},e),{showInitials:!0}),e))}catch(e){this.loggingService.catch("Error in VideoHuddleUserComponent onImageLoadError: ",e)}}onToggleHuddleOnCursor(){this.loggingService.log("%c[WB] Calling FUNCTION: onToggleHuddleOnCursor","color: green;");try{this.toggleHuddleOnCursor.emit()}catch(e){this.loggingService.catch("Error in VideoHuddleUserComponent onToggleHuddleOnCursor: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(w))},o.\u0275cmp=G({type:o,selectors:[["snippyly-video-huddle-user"]],hostVars:1,hostBindings:function(t,i){t&2&&K("data-velt-element",i.veltElement)},inputs:{stream:"stream",selected:"selected",isRemoteStream:"isRemoteStream",user:"user",audioState:"audioState",videoState:"videoState",remoteStream:"remoteStream",remoteVideoStream:"remoteVideoStream"},outputs:{toggleAudio:"toggleAudio",toggleVideo:"toggleVideo",toggleHuddleOnCursor:"toggleHuddleOnCursor"},standalone:!1,features:[ne],decls:1,vars:1,consts:[["showAvatarImgRef",""],[4,"ngIf"],["class","video-huddle-block",3,"local-stream","video-off","speaking","selected","click",4,"ngIf"],[1,"video-huddle-block",3,"click"],[1,"video-player-container"],["playsinline","","autoplay","true",3,"srcObject","muted","volume"],[1,"user-profile-container"],["velt-ignore-change-detection","true",1,"s-presence-avatar",3,"title"],["class","s-presence-avatar-initial",4,"ngIf","ngIfElse"],[1,"video-player-overlay"],["class","video-huddle-actions-panel",3,"click",4,"ngIf"],[1,"s-presence-avatar-initial"],["referrerpolicy","no-referrer","loading","lazy",1,"s-presence-avatar-image",3,"error","src"],["width","13","height","19","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","13","height","19","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.77526 0.888917C4.98766 1.03653 4.34477 1.39041 3.76525 1.99544C3.26289 2.51988 2.94255 3.10884 2.75974 3.84431C2.69679 4.09753 2.6908 4.39635 2.6908 7.29276C2.6908 10.7979 2.68044 10.6352 2.94799 11.327C3.299 12.2346 4.07584 13.0561 4.94368 13.4374C5.82412 13.8243 6.82444 13.8531 7.71552 13.5173C8.69181 13.1494 9.53872 12.2934 9.92297 11.2862C10.1713 10.6354 10.1631 10.7714 10.1631 7.29276C10.1631 3.78764 10.1735 3.95032 9.90592 3.25855C9.62932 2.54335 9.02923 1.81042 8.38767 1.40419C7.61998 0.918084 6.64549 0.725873 5.77526 0.888917ZM6.9551 2.18212C7.80033 2.36379 8.55484 3.08137 8.82443 3.95997C8.91085 4.24162 8.9112 4.25479 8.9112 7.29276C8.9112 10.3307 8.91085 10.3439 8.82443 10.6256C8.578 11.4287 7.92854 12.0994 7.15071 12.3538C6.92897 12.4264 6.7875 12.4431 6.40739 12.4415C6.00213 12.4398 5.89869 12.425 5.65097 12.3333C5.00401 12.0936 4.49038 11.6376 4.2051 11.0497C3.92221 10.4667 3.92452 10.4977 3.92452 7.29276C3.92452 4.09736 3.92315 4.11587 4.19825 3.55135C4.71228 2.49645 5.83136 1.94067 6.9551 2.18212ZM0.537139 8.64006C0.373453 8.71677 0.215048 8.92183 0.182929 9.09861C0.133831 9.36895 0.199086 10.6794 0.283042 11.1082C0.737953 13.4317 2.32631 15.2803 4.50075 16.017C4.75328 16.1025 5.14915 16.2055 5.38044 16.2458L5.801 16.3192V16.9744V17.6296L5.06042 17.6421C4.38416 17.6536 4.31046 17.6619 4.21195 17.738C4.00671 17.8964 3.94271 18.0255 3.94271 18.2809C3.94271 18.5363 4.00679 18.6655 4.21206 18.8237C4.31804 18.9055 4.36006 18.907 6.42696 18.907C8.49385 18.907 8.53586 18.9055 8.64185 18.8237C8.84712 18.6655 8.9112 18.5363 8.9112 18.2809C8.9112 18.0255 8.8472 17.8964 8.64196 17.738C8.54346 17.6619 8.46975 17.6536 7.79349 17.6421L7.05291 17.6296V16.9744V16.3192L7.47347 16.2469C9.74567 15.8564 11.6474 14.1569 12.3699 11.8711C12.6066 11.1222 12.6648 10.7131 12.6659 9.79054C12.6668 9.05017 12.6614 8.98828 12.5862 8.8841C12.4332 8.67197 12.3081 8.60568 12.0605 8.60568C11.8131 8.60568 11.6881 8.67181 11.5348 8.88378C11.4622 8.9842 11.4515 9.07453 11.4282 9.79025C11.4001 10.6516 11.3449 11.0079 11.1515 11.5749C10.8931 12.3325 10.527 12.9264 9.95298 13.5192C9.22696 14.2689 8.41181 14.7274 7.405 14.9524C6.91168 15.0626 5.87256 15.0542 5.38588 14.936C4.37192 14.6897 3.6185 14.2601 2.90093 13.5192C2.32689 12.9264 1.96079 12.3325 1.70239 11.5749C1.50901 11.0079 1.45377 10.6516 1.42568 9.79025C1.39755 8.92635 1.3871 8.88689 1.13621 8.69342C1.00672 8.5936 0.695505 8.56589 0.537139 8.64006Z","fill","#FF7162"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M9.77526 0.888917C8.98766 1.03653 8.34477 1.39041 7.76525 1.99544C7.26289 2.51988 6.94255 3.10884 6.75974 3.84431C6.69679 4.09753 6.6908 4.39635 6.6908 7.29276C6.6908 10.7979 6.68044 10.6352 6.94799 11.327C7.299 12.2346 8.07584 13.0561 8.94368 13.4374C9.82412 13.8243 10.8244 13.8531 11.7155 13.5173C12.6918 13.1494 13.5387 12.2934 13.923 11.2862C14.1713 10.6354 14.1631 10.7714 14.1631 7.29276C14.1631 3.78764 14.1735 3.95032 13.9059 3.25855C13.6293 2.54335 13.0292 1.81042 12.3877 1.40419C11.62 0.918084 10.6455 0.725873 9.77526 0.888917ZM10.9551 2.18212C11.8003 2.36379 12.5548 3.08137 12.8244 3.95997C12.9108 4.24162 12.9112 4.25479 12.9112 7.29276C12.9112 10.3307 12.9108 10.3439 12.8244 10.6256C12.578 11.4287 11.9285 12.0994 11.1507 12.3538C10.929 12.4264 10.7875 12.4431 10.4074 12.4415C10.0021 12.4398 9.89869 12.425 9.65097 12.3333C9.00401 12.0936 8.49038 11.6376 8.2051 11.0497C7.92221 10.4667 7.92452 10.4977 7.92452 7.29276C7.92452 4.09736 7.92315 4.11587 8.19825 3.55135C8.71228 2.49645 9.83136 1.94067 10.9551 2.18212ZM4.53714 8.64006C4.37345 8.71677 4.21505 8.92183 4.18293 9.09861C4.13383 9.36895 4.19909 10.6794 4.28304 11.1082C4.73795 13.4317 6.32631 15.2803 8.50075 16.017C8.75328 16.1025 9.14915 16.2055 9.38044 16.2458L9.801 16.3192V16.9744V17.6296L9.06042 17.6421C8.38416 17.6536 8.31046 17.6619 8.21195 17.738C8.00671 17.8964 7.94271 18.0255 7.94271 18.2809C7.94271 18.5363 8.00679 18.6655 8.21206 18.8237C8.31804 18.9055 8.36006 18.907 10.427 18.907C12.4938 18.907 12.5359 18.9055 12.6418 18.8237C12.8471 18.6655 12.9112 18.5363 12.9112 18.2809C12.9112 18.0255 12.8472 17.8964 12.642 17.738C12.5435 17.6619 12.4697 17.6536 11.7935 17.6421L11.0529 17.6296V16.9744V16.3192L11.4735 16.2469C13.7457 15.8564 15.6474 14.1569 16.3699 11.8711C16.6066 11.1222 16.6648 10.7131 16.6659 9.79054C16.6668 9.05017 16.6614 8.98828 16.5862 8.8841C16.4332 8.67197 16.3081 8.60568 16.0605 8.60568C15.8131 8.60568 15.6881 8.67181 15.5348 8.88378C15.4622 8.9842 15.4515 9.07453 15.4282 9.79025C15.4001 10.6516 15.3449 11.0079 15.1515 11.5749C14.8931 12.3325 14.527 12.9264 13.953 13.5192C13.227 14.2689 12.4118 14.7274 11.405 14.9524C10.9117 15.0626 9.87256 15.0542 9.38588 14.936C8.37192 14.6897 7.6185 14.2601 6.90093 13.5192C6.32689 12.9264 5.96079 12.3325 5.70239 11.5749C5.50901 11.0079 5.45377 10.6516 5.42568 9.79025C5.39755 8.92636 5.3871 8.88689 5.13621 8.69342C5.00672 8.5936 4.69551 8.56589 4.53714 8.64006Z","fill","white"],["d","M19 1L1 19","stroke","#FF7162","stroke-width","1.4","stroke-linecap","round"],[1,"video-huddle-actions-panel",3,"click"],[1,"video-huddle-action-button",3,"click"],["width","19","height","11","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","19","height","11","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.55139 0.23203C1.68754 0.455725 1.06855 1.0239 0.766641 1.87017L0.666016 2.15221V5.58961V9.027L0.766892 9.30905C1.0535 10.1102 1.64038 10.6751 2.43987 10.9192L2.70863 11.0013H7.1343H11.56L11.8467 10.9053C12.6234 10.645 13.2099 10.0654 13.47 9.30122C13.56 9.03659 13.5637 8.9921 13.5769 8.03104C13.5844 7.48324 13.6004 7.03508 13.6125 7.03508C13.661 7.03508 15.0857 7.85713 15.8518 8.32715C16.7188 8.85908 16.9126 8.93887 17.338 8.93887C18.0692 8.93887 18.7509 8.40866 18.947 7.6873C19.0174 7.42849 19.0165 3.7478 18.946 3.48726C18.7883 2.90449 18.278 2.40845 17.7016 2.27772C17.4483 2.22025 17.0895 2.2339 16.8373 2.31054C16.6848 2.35687 16.3699 2.52617 15.9107 2.80867C15.3288 3.16675 13.6405 4.14414 13.6039 4.14414C13.5979 4.14414 13.5847 3.71184 13.5747 3.18343C13.5543 2.10543 13.5363 1.99899 13.2916 1.50796C13.0166 0.956034 12.475 0.494788 11.8467 0.277192L11.56 0.177913L7.18806 0.170686C2.95948 0.163705 2.80747 0.165715 2.55139 0.23203ZM11.3211 1.83643C11.5404 1.90052 11.7306 2.05381 11.8398 2.25463L11.9183 2.399V5.57293V8.74683L11.8268 8.92184C11.7122 9.14091 11.4929 9.30852 11.2552 9.35869C11.0123 9.40995 3.20786 9.41115 2.98224 9.35999C2.74243 9.30559 2.53297 9.14483 2.42553 8.93266L2.33236 8.74873V5.58961V2.43048L2.42553 2.24656C2.52985 2.04059 2.7435 1.87225 2.96604 1.82078C3.04208 1.80318 4.88581 1.78753 7.11882 1.78556C10.641 1.78245 11.1578 1.78873 11.3211 1.83643ZM17.3116 5.59366V7.28997L17.2309 7.23801C16.8358 6.98339 15.6936 6.30427 15.1359 5.99233C14.7573 5.78052 14.4468 5.5987 14.4461 5.5883C14.4453 5.57787 14.7874 5.37536 15.2062 5.13827C15.6251 4.90114 16.258 4.52634 16.6128 4.30536C16.9675 4.08438 17.2699 3.90215 17.2847 3.90045C17.2995 3.89876 17.3116 4.6607 17.3116 5.59366Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.55139 4.23203C2.68754 4.45573 2.06855 5.0239 1.76664 5.87017L1.66602 6.15221V9.58961V13.027L1.76689 13.309C2.0535 14.1102 2.64038 14.6751 3.43987 14.9192L3.70863 15.0013H8.1343H12.56L12.8467 14.9053C13.6234 14.645 14.2099 14.0654 14.47 13.3012C14.56 13.0366 14.5637 12.9921 14.5769 12.031C14.5844 11.4832 14.6004 11.0351 14.6125 11.0351C14.661 11.0351 16.0857 11.8571 16.8518 12.3271C17.7188 12.8591 17.9126 12.9389 18.338 12.9389C19.0692 12.9389 19.7509 12.4087 19.947 11.6873C20.0174 11.4285 20.0165 7.7478 19.946 7.48726C19.7883 6.90449 19.278 6.40845 18.7016 6.27772C18.4483 6.22025 18.0895 6.2339 17.8373 6.31054C17.6848 6.35687 17.3699 6.52617 16.9107 6.80867C16.3288 7.16675 14.6405 8.14414 14.6039 8.14414C14.5979 8.14414 14.5847 7.71184 14.5747 7.18343C14.5543 6.10543 14.5363 5.99899 14.2916 5.50796C14.0166 4.95603 13.475 4.49479 12.8467 4.27719L12.56 4.17791L8.18806 4.17069C3.95948 4.16371 3.80747 4.16571 3.55139 4.23203ZM12.3211 5.83643C12.5404 5.90052 12.7306 6.05381 12.8398 6.25463L12.9183 6.399V9.57293V12.7468L12.8268 12.9218C12.7122 13.1409 12.4929 13.3085 12.2552 13.3587C12.0123 13.4099 4.20786 13.4111 3.98224 13.36C3.74243 13.3056 3.53297 13.1448 3.42553 12.9327L3.33236 12.7487V9.58961V6.43048L3.42553 6.24656C3.52985 6.04059 3.7435 5.87225 3.96604 5.82078C4.04208 5.80318 5.88581 5.78753 8.11882 5.78556C11.641 5.78245 12.1578 5.78873 12.3211 5.83643ZM18.3116 9.59366V11.29L18.2309 11.238C17.8358 10.9834 16.6936 10.3043 16.1359 9.99233C15.7573 9.78052 15.4468 9.5987 15.4461 9.5883C15.4453 9.57787 15.7874 9.37536 16.2062 9.13827C16.6251 8.90114 17.258 8.52634 17.6128 8.30536C17.9675 8.08438 18.2699 7.90215 18.2847 7.90045C18.2995 7.89876 18.3116 8.6607 18.3116 9.59366Z","fill","white"],["d","M4.69231 5.29805L6.9519 16.6605C7.26158 18.2178 9.31823 18.591 10.1553 17.2418L12.4275 13.5798C12.4611 13.5255 12.5143 13.4861 12.5761 13.4699L16.8289 12.3482C18.3433 11.9488 18.6107 9.91372 17.2509 9.13668L7.27695 3.4373C5.97394 2.69272 4.3996 3.82614 4.69231 5.29805Z","stroke","#E5E5E9","stroke-width","1.5","stroke-linecap","square"]],template:function(t,i){t&1&&_(0,Zn,2,1,"ng-container",1),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[J,Q],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}*[_ngcontent-%COMP%]{-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}*[_ngcontent-%COMP%]:not(svg *){height:unset;width:unset}.video-huddle-block[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%!important;height:100%!important;pointer-events:none!important}.video-huddle-block[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:20px!important;height:20px!important}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%]{position:relative!important}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%] .video-player-overlay[_ngcontent-%COMP%]{width:100%!important;height:100%!important;position:absolute!important;top:0!important;background:#56565670!important;border-radius:100%!important;display:none!important;flex-direction:column;justify-content:center;align-items:center}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%] .video-player-overlay[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{margin:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%]:hover .video-player-overlay[_ngcontent-%COMP%], .video-huddle-block.video-off[_ngcontent-%COMP%] .user-profile-container[_ngcontent-%COMP%]{display:flex!important}.video-huddle-block.video-off[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{display:none!important}.video-huddle-block[_ngcontent-%COMP%] .user-profile-container[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:none!important;align-items:center!important;justify-content:center!important;background:#232323!important;border-radius:50%!important}.s-presence-avatar[_ngcontent-%COMP%]{position:relative!important;box-shadow:0 0 0 3px!important;border-radius:50%!important;overflow:hidden!important;width:100%!important;height:100%!important;min-width:100%!important;min-height:100%!important;display:flex!important;align-items:center!important;justify-content:center!important}.s-presence-avatar.more-users[_ngcontent-%COMP%]{background:#4578a7!important;box-shadow:0 0 0 3px #4578a7!important}.attendees-container[_ngcontent-%COMP%]{display:inline-flex!important;flex-direction:row-reverse!important;align-items:center!important;margin:0 16px 0 8px!important}.s-presence-avatar[_ngcontent-%COMP%]:not(:last-child):not(.more-users){margin-left:calc((-.5rem + 0px) * var(--velt-base-rem-unit))!important}.s-presence-avatar-image[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block!important;object-fit:cover!important}.s-presence-avatar-image-small[_ngcontent-%COMP%]{width:calc((1.6rem + 0px) * var(--velt-base-rem-unit))!important;height:100%!important;display:block!important;object-fit:cover!important}.s-presence-avatar-initial[_ngcontent-%COMP%]{color:#fff!important;font-size:calc((3rem + 0px) * var(--velt-base-rem-unit))!important}"],changeDetection:0});let r=o;return r})();var Yn=(r,o,n)=>({large:r,medium:o,small:n});function Kn(r,o){if(r&1){let n=E();l(0,"div",3),S(1,"video",4),l(2,"div",5)(3,"div",6),f("click",function(){v(n);let t=s(2);return C(t.onToggleScreenSharing())}),A(4),b(5,"translate"),u()()()}if(r&2){let n=s().ngIf;d(),g("srcObject",n.stream)("volume",0),d(3),N(x(5,3,"Stop Sharing"))}}function qn(r,o){if(r&1){let n=E();l(0,"div",7),S(1,"video",4),l(2,"div",5)(3,"div"),A(4),b(5,"translate"),u(),l(6,"div",8),k(),l(7,"svg",9),f("click",function(){v(n);let t=s(2);return C(t.changeViewportSize("large"))}),S(8,"path",10)(9,"path",11),u(),l(10,"svg",12),f("click",function(){v(n);let t=s(2);return C(t.changeViewportSize("medium"))}),S(11,"path",13)(12,"path",14),u(),l(13,"svg",15),f("click",function(){v(n);let t=s(2);return C(t.changeViewportSize("small"))}),S(14,"path",16)(15,"path",17),u()()()()}if(r&2){let n=s().ngIf;g("ngClass",mt(13,Yn,n.viewportSize==="large",n.viewportSize==="medium",n.viewportSize==="small")),d(),g("srcObject",n.stream)("volume",0),d(3),be("",(n.user==null?null:n.user.name)||(n.user==null?null:n.user.email)," ",x(5,11,"is sharing now.")),d(3),q("selected",n.viewportSize==="large"),d(3),q("selected",n.viewportSize==="medium"),d(3),q("selected",n.viewportSize==="small")}}function Xn(r,o){if(r&1&&(D(0),_(1,Kn,6,5,"div",1)(2,qn,16,17,"div",2),U()),r&2){let n=o.ngIf;d(),g("ngIf",n.stream&&!n.isRemoteStream),d(),g("ngIf",n.stream&&n.isRemoteStream)}}var Ge=(()=>{let o=class o{constructor(e){this.loggingService=e,this.isRemoteStream=!1,this.toggleScreenSharing=new X,this.viewportSizeChange=new X,this.veltElement=!0,this.componentConfigSignal=W({stream:this.stream,isRemoteStream:this.isRemoteStream,viewportSize:"small",user:this.user})}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling ScreenSharingHuddleComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=m(p({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in ScreenSharingHuddleComponent ngOnChanges: ",t)}}changeViewportSize(e){this.componentConfigSignal.update(t=>m(p({},t),{viewportSize:e})),this.viewportSizeChange.emit(this.componentConfigSignal().viewportSize)}onToggleScreenSharing(){this.toggleScreenSharing.emit()}};o.\u0275fac=function(t){return new(t||o)(I(w))},o.\u0275cmp=G({type:o,selectors:[["snippyly-screen-sharing-huddle"]],hostVars:1,hostBindings:function(t,i){t&2&&K("data-velt-element",i.veltElement)},inputs:{user:"user",stream:"stream",isRemoteStream:"isRemoteStream"},outputs:{toggleScreenSharing:"toggleScreenSharing",viewportSizeChange:"viewportSizeChange"},standalone:!1,features:[ne],decls:1,vars:1,consts:[[4,"ngIf"],["class","screen-sharing-container local-screen-sharing-container",4,"ngIf"],["class","screen-sharing-container remote-screen-sharing-container",3,"ngClass",4,"ngIf"],[1,"screen-sharing-container","local-screen-sharing-container"],["autoplay","","muted","true","playsinline","",3,"srcObject","volume"],[1,"screen-sharing-overlay"],[1,"stop-sharing-btn",3,"click"],[1,"screen-sharing-container","remote-screen-sharing-container",3,"ngClass"],[1,"screen-sharing-resize-container"],["width","21","height","20","viewBox","0 0 21 20","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M18.0006 2.5H3.00065C2.08018 2.5 1.33398 3.24619 1.33398 4.16667V13.3333C1.33398 14.2538 2.08018 15 3.00065 15H5.06885C5.33962 15 5.59351 14.8684 5.74966 14.6472L8.45823 10.8101C9.45427 9.39904 11.547 9.39904 12.5431 10.8101L15.2516 14.6472C15.4078 14.8684 15.6617 15 15.9324 15H18.0006C18.9211 15 19.6673 14.2538 19.6673 13.3333V4.16667C19.6673 3.24619 18.9211 2.5 18.0006 2.5Z"],["d","M6.50021 16.1684L9.83354 11.724C10.1669 11.2795 10.8335 11.2795 11.1669 11.724L14.5002 16.1684C14.9122 16.7178 14.5202 17.5017 13.8335 17.5017H7.16688C6.48017 17.5017 6.08819 16.7178 6.50021 16.1684Z"],["width","15","height","12","viewBox","0 0 15 12","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M13.6364 0.167969H1.36364C0.610521 0.167969 0 0.748339 0 1.46426V8.59387C0 9.3098 0.610521 9.89017 1.36364 9.89017H3.0558C3.27734 9.89017 3.48507 9.78785 3.61283 9.61579L5.82893 6.63136C6.64387 5.53387 8.35613 5.53387 9.17107 6.63136L11.3872 9.61579C11.5149 9.78785 11.7227 9.89017 11.9442 9.89017H13.6364C14.3895 9.89017 15 9.3098 15 8.59387V1.46426C15 0.748339 14.3895 0.167969 13.6364 0.167969Z"],["d","M4.22745 10.7981L6.95472 7.34129C7.22745 6.99561 7.7729 6.99561 8.04563 7.34129L10.7729 10.7981C11.11 11.2254 10.7893 11.8351 10.2274 11.8351H4.7729C4.21105 11.8351 3.89034 11.2254 4.22745 10.7981Z"],["width","11","height","10","viewBox","0 0 11 10","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M9.59091 0.832031H1.40909C0.907014 0.832031 0.5 1.24658 0.5 1.75795V6.85053C0.5 7.36191 0.907014 7.77646 1.40909 7.77646H2.5372C2.68489 7.77646 2.82338 7.70337 2.90855 7.58048L4.38595 5.44874C4.92925 4.66482 6.07075 4.66482 6.61405 5.44874L8.09145 7.58048C8.17662 7.70337 8.31511 7.77646 8.4628 7.77646H9.59091C10.093 7.77646 10.5 7.36191 10.5 6.85053V1.75795C10.5 1.24658 10.093 0.832031 9.59091 0.832031Z"],["d","M3.3183 8.42384L5.13648 5.95472C5.3183 5.7078 5.68193 5.7078 5.86375 5.95472L7.68193 8.42384C7.90667 8.72905 7.69286 9.16458 7.3183 9.16458H3.68193C3.30737 9.16458 3.09356 8.72905 3.3183 8.42384Z"]],template:function(t,i){t&1&&_(0,Xn,3,2,"ng-container",0),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[ht,J,Q],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}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}*[_ngcontent-%COMP%]:not(svg *){height:unset;width:unset}[_nghost-%COMP%]{position:fixed;bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;right:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;z-index:2147483607!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%]{width:326px!important;height:216px!important;padding:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;background:#fff!important;box-shadow:0 1px 4px #00000029!important;border-radius:20px!important;position:relative!important;overflow:hidden!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:#fff!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%]{position:absolute!important;width:100%!important;height:100%!important;top:0!important;background:#fff!important;display:none!important;align-items:center;justify-content:center;color:#fff!important;background:#000000b3!important;left:0!important;font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%]:hover .screen-sharing-overlay[_ngcontent-%COMP%]{display:flex!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%] .stop-sharing-btn[_ngcontent-%COMP%]{cursor:pointer!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%]{width:30vw!important;height:20vh!important;padding:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;background:#fff!important;box-shadow:0 1px 4px #00000029!important;border-radius:20px!important;position:relative!important;overflow:hidden!important;transition:width .2s ease-in-out,height .2s ease-in-out}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:#fff!important;text-align:center!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%]{position:absolute!important;width:100%!important;height:100%!important;top:0!important;background:#fff!important;display:none!important;align-items:center;justify-content:center;color:#fff!important;background:#000000b3!important;left:0!important;font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;flex-direction:column}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%] .screen-sharing-resize-container[_ngcontent-%COMP%]{margin-top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;background:#000;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center;justify-content:center}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%] .screen-sharing-resize-container[_ngcontent-%COMP%] > svg[_ngcontent-%COMP%]{margin:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;cursor:pointer!important;fill:#b1b5c4!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%] .screen-sharing-resize-container[_ngcontent-%COMP%] > svg.selected[_ngcontent-%COMP%]{fill:#fff!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%]:hover .screen-sharing-overlay[_ngcontent-%COMP%]{display:flex!important}.screen-sharing-container.remote-screen-sharing-container.medium[_ngcontent-%COMP%]{width:60vw!important;height:60vh!important}.screen-sharing-container.remote-screen-sharing-container.large[_ngcontent-%COMP%]{width:calc(100vw - 5rem)!important;height:calc(100vh - 5rem)!important}video[_ngcontent-%COMP%]{width:100%!important;height:100%!important;border-radius:8px!important}"],changeDetection:0});let r=o;return r})();var ti=["remoteScreenSharingHuddleDrag"],ni=()=>["snippyly-sidebar-panel","velt-overlay-panel"];function ii(r,o){if(r&1){let n=E();l(0,"snippyly-video-huddle-user",8),f("toggleAudio",function(){v(n);let t=s(4);return C(t.toggleAudio())})("toggleVideo",function(){v(n);let t=s(4);return C(t.toggleVideo())})("cdkDragStarted",function(t){v(n);let i=s(4);return C(i.onDragStarted(t))})("cdkDragMoved",function(t){v(n);let i=s(4);return C(i.onDragMoved(t))})("cdkDragEnded",function(t){v(n);let i=s(4);return C(i.onDragEnded(t))}),u()}if(r&2){let n=s(3).ngIf;g("user",n.user)("stream",n.localStream)("audioState",n.localStreamState==null?null:n.localStreamState.audioState)("videoState",n.localStreamState==null?null:n.localStreamState.videoState)}}function ri(r,o){if(r&1&&(D(0),_(1,ii,1,4,"snippyly-video-huddle-user",7),U()),r&2){let n=s(2).ngIf;d(),g("ngIf",n.localStream&&n.meetingJoined&&((n.localStreamState==null?null:n.localStreamState.videoState)||n.videoStateEnabledInPastByUserId[n.user==null?null:n.user.userSnippylyId]))}}function oi(r,o){if(r&1){let n=E();l(0,"snippyly-video-huddle-user",12),f("toggleAudio",function(){v(n);let t=s(6);return C(t.toggleAudio())})("toggleVideo",function(){v(n);let t=s(6);return C(t.toggleVideo())})("toggleHuddleOnCursor",function(){v(n);let t=s(2).$implicit,i=s(4);return C(i.toggleHuddleOnCursor(t))})("cdkDragStarted",function(t){v(n);let i=s(6);return C(i.onDragStarted(t))})("cdkDragMoved",function(t){v(n);let i=s(6);return C(i.onDragMoved(t))})("cdkDragEnded",function(t){v(n);let i=s(6);return C(i.onDragEnded(t))}),u()}if(r&2){let n=s(2).$implicit,e=s(3).ngIf;g("user",n)("remoteVideoStream",e.remoteStreamsByUserId[n==null?null:n.userSnippylyId]==null?null:e.remoteStreamsByUserId[n==null?null:n.userSnippylyId].webcam)("audioState",n==null||n.state==null?null:n.state.audioState)("videoState",n==null||n.state==null?null:n.state.videoState)("isRemoteStream",!0)}}function ai(r,o){if(r&1&&S(0,"snippyly-audio-huddle-user",13),r&2){let n=s(2).$implicit,e=s(3).ngIf;g("user",n)("remoteAudioStream",e.remoteStreamsByUserId[n==null?null:n.userSnippylyId]==null?null:e.remoteStreamsByUserId[n==null?null:n.userSnippylyId].webcam)}}function li(r,o){if(r&1&&(D(0),_(1,oi,1,5,"snippyly-video-huddle-user",10)(2,ai,1,2,"snippyly-audio-huddle-user",11),U()),r&2){let n=s().$implicit,e=s(3).ngIf;d(),g("ngIf",(n==null?null:n.userSnippylyId)!==(e.user==null?null:e.user.userSnippylyId)&&((n==null||n.state==null?null:n.state.videoState)||e.videoStateEnabledInPastByUserId[n==null?null:n.userSnippylyId])&&e.peerConnectionStateMapByUserId[n==null?null:n.userSnippylyId]==="connected"),d(),g("ngIf",(n==null?null:n.userSnippylyId)!==(e.user==null?null:e.user.userSnippylyId)&&!(!(n==null||n.state==null)&&n.state.videoState||e.videoStateEnabledInPastByUserId[n==null?null:n.userSnippylyId])&&(n==null||n.state==null?null:n.state.audioState))}}function si(r,o){if(r&1&&_(0,li,3,2,"ng-container",4),r&2){let n=o.$implicit,e=s(3).ngIf;g("ngIf",!e.huddleCursorAvailableByAttendeeId[n==null?null:n.userSnippylyId])}}function di(r,o){if(r&1&&(D(0),_(1,si,1,1,"ng-template",9),U()),r&2){let n=s(2).ngIf,e=s();d(),g("ngForOf",n.huddleAttendees)("ngForTrackBy",e.trackById)}}function ci(r,o){if(r&1&&(l(0,"div",6),_(1,ri,2,1,"ng-container",4)(2,di,2,2,"ng-container",4),u()),r&2){let n=s().ngIf;st(pt("--legacy-velt-user-color: ",n.user==null?null:n.user.color)),K("highlight",n.isDragging||null),d(),g("ngIf",!n.huddleCursorAvailableByAttendeeId[n.user==null?null:n.user.userSnippylyId]),d(),g("ngIf",n.meetingJoined)}}function gi(r,o){if(r&1){let n=E();D(0),l(1,"snippyly-screen-sharing-huddle",15),f("toggleScreenSharing",function(){v(n);let t=s(3);return C(t.toggleScreenSharing())}),u(),U()}if(r&2){let n=s(2).ngIf;d(),g("stream",n.localScreenSharingStream)}}function ui(r,o){if(r&1){let n=E();l(0,"snippyly-screen-sharing-huddle",17,1),f("viewportSizeChange",function(){v(n);let t=s(4);return C(t.onViewportSizeChange())}),u()}if(r&2){let n=s(3).ngIf;g("stream",n.screenSharing==null?null:n.screenSharing.stream)("user",n.screenSharing==null?null:n.screenSharing.attendee)("isRemoteStream",(n.screenSharing==null||n.screenSharing.attendee==null?null:n.screenSharing.attendee.userSnippylyId)!==(n.user==null?null:n.user.userSnippylyId))}}function pi(r,o){if(r&1&&_(0,ui,2,3,"snippyly-screen-sharing-huddle",16),r&2){let n=s(2).ngIf;g("ngIf",n.screenSharing&&n.peerConnectionStateMapByUserId[n.screenSharing==null||n.screenSharing.attendee==null?null:n.screenSharing.attendee.userSnippylyId]==="connected")}}function mi(r,o){if(r&1&&(D(0),_(1,gi,2,1,"ng-container",14)(2,pi,1,1,"ng-template",null,0,Z),U()),r&2){let n=F(3),e=s().ngIf;d(),g("ngIf",e.localScreenSharingStream&&(e.localStreamState==null?null:e.localStreamState.screenSharingState))("ngIfElse",n)}}function hi(r,o){r&1&&S(0,"velt-huddle-messages-panel-internal")}function vi(r,o){if(r&1&&(D(0),S(1,"div",18,2),_(3,hi,1,0,"ng-template",19,3,Z),U()),r&2){let n=F(2),e=s().ngIf;d(3),g("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",e.meetingJoined)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",ve(4,ni))}}function Ci(r,o){if(r&1&&(D(0),_(1,ci,3,6,"div",5)(2,mi,4,2,"ng-container",4)(3,vi,5,5,"ng-container",4),U()),r&2){let n=o.ngIf;d(),g("ngIf",n.meetingJoined),d(),g("ngIf",n.meetingJoined),d(),g("ngIf",n.meetingJoined)}}var Ve=(()=>{let o=class o{set _chat(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.huddleService.enableChat():this.huddleService.disableChat()}catch{}}set _flockModeOnAvatarClick(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.huddleService.enableFlockModeOnAvatarClick():this.huddleService.disableFlockModeOnAvatarClick()}catch{}}set _serverFallback(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.huddleService.enableServerFallback():this.huddleService.disableServerFallback()}catch{}}constructor(e,t,i,a){this.analyticsService=e,this.authService=t,this.huddleService=i,this.loggingService=a,this.droppedInsideContainer=!1,this.remoteStreams=[],this.remoteStreamsMap={},this.huddleStarted=!1,this.peerConnectionStateMap={},this.huddleOnCursorMode=!1,this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=W({isDragging:!1,user:null,meetingJoined:!1,huddleCursorAvailableByAttendeeId:{},localStreamState:{},localStream:null,videoStateEnabledInPastByUserId:{},huddleAttendees:[],remoteStreamsByUserId:{},localScreenSharingStream:null,screenSharing:null,peerConnectionStateMapByUserId:{}}),this.subscriptions.push(this.authService.getUser$().pipe(te(c=>!!c)).subscribe(c=>{c&&(this.componentConfigSignal.update(h=>(h=m(p({},h),{user:c}),h)),this.setHuddleInstalledInAnalytics())},c=>{this.loggingService.catch("Error in getUser: ",c)})),this.subscriptions.push(this.huddleService.localStream$.subscribe(c=>{this.componentConfigSignal.update(h=>(h=m(p({},h),{localStream:c}),h))},c=>{this.loggingService.catch("Error in localStream: ",c)})),this.subscriptions.push(this.huddleService.getScreenSharingStream().subscribe(c=>{this.componentConfigSignal.update(h=>(h=m(p({},h),{localScreenSharingStream:c}),h))},c=>{this.loggingService.catch("Error in localStream: ",c)})),this.subscriptions.push(this.huddleService.getPeerConnectionStateMap().subscribe(c=>{this.peerConnectionStateMap=c,this.updatePeerConnectionStateMapByUserId()},c=>{this.loggingService.catch("Error in getPeerConnectionStateMap: ",c)})),this.subscriptions.push(this.huddleService.getHuddleOnCursorMode$().subscribe(c=>{this.huddleOnCursorMode=c})),this.subscriptions.push(this.huddleService.getHuddleCursorAvailableByAttendeeId$().subscribe(c=>{this.componentConfigSignal.update(h=>(h=m(p({},h),{huddleCursorAvailableByAttendeeId:c}),h))},c=>{this.loggingService.catch("Error in getHuddleCursorAvailableByAttendeeId: ",c)})),this.subscriptions.push(this.huddleService.getRemoteStream().subscribe(c=>{try{c?(this.remoteStreamsMap=c,this.remoteStreams=Object.values(c)):this.remoteStreams=[],this.updateRemoteStreamsByUserId()}catch(h){this.loggingService.catch("Error in HuddleComponent getRemoteStream:",h)}},c=>{this.loggingService.catch("Error in getRemoteStream: ",c)})),this.subscriptions.push(this.huddleService.getLocalStreamState().subscribe(c=>{this.componentConfigSignal.update(h=>(h=m(p({},h),{localStreamState:c}),h))},c=>{this.loggingService.catch("Error in getLocalStreamState: ",c)})),this.getHuddleAttendees()}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}trackById(e,t){return t?.userSnippylyId}getHuddleAttendees(){this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(e=>{try{e?(this.componentConfigSignal.update(t=>(t=m(p({},t),{huddleAttendees:e.slice()}),t)),this.huddleStarted=!!e?.length,this.componentConfigSignal.update(t=>(t=m(p({},t),{meetingJoined:!!e.find(i=>i?.userSnippylyId===t.user?.userSnippylyId)}),t)),this.updateRemoteStreamsByUserId()):(this.huddleStarted=!1,this.componentConfigSignal.update(t=>(t=m(p({},t),{meetingJoined:!1}),t)),this.componentConfigSignal.update(t=>(t=m(p({},t),{huddleAttendees:[]}),t)),this.componentConfigSignal.update(t=>(t=m(p({},t),{remoteStreamsByUserId:{}}),t))),this.componentConfigSignal().meetingJoined?this.componentConfigSignal().huddleAttendees.forEach(t=>{t.userSnippylyId&&!this.componentConfigSignal().videoStateEnabledInPastByUserId[t.userSnippylyId]&&t?.state?.videoState&&this.componentConfigSignal.update(i=>(i=m(p({},i),{videoStateEnabledInPastByUserId:m(p({},i.videoStateEnabledInPastByUserId),{[t.userSnippylyId]:!0})}),i))}):this.componentConfigSignal.update(t=>(t=m(p({},t),{videoStateEnabledInPastByUserId:{}}),t))}catch(t){this.loggingService.catch("Error in HuddleComponent getHuddleAttendees:",t)}}))}updateRemoteStreamsByUserId(){try{if(this.componentConfigSignal().huddleAttendees&&this.componentConfigSignal().user?.userSnippylyId){let e=this.componentConfigSignal().huddleAttendees.map(t=>t.userSnippylyId);Object.keys(this.componentConfigSignal().remoteStreamsByUserId).forEach(t=>{e.includes(t)&&this.componentConfigSignal.update(i=>{let a=p({},i.remoteStreamsByUserId);return delete a[t],m(p({},i),{remoteStreamsByUserId:a})})}),this.componentConfigSignal().huddleAttendees.forEach(t=>{let i=this.huddleService.getCombinedId(this.componentConfigSignal().user?.userSnippylyId,t.userSnippylyId);this.componentConfigSignal().remoteStreamsByUserId[t?.userSnippylyId]||this.componentConfigSignal.update(a=>(a=m(p({},a),{remoteStreamsByUserId:m(p({},a.remoteStreamsByUserId),{[t?.userSnippylyId]:this.remoteStreamsMap[i]})}),a)),t?.state?.screenSharingState&&this.remoteStreamsMap[i]&&Object.values(this.remoteStreamsMap[i]).forEach(a=>{!a?.getAudioTracks()?.length&&a?.getVideoTracks()?.length&&this.componentConfigSignal.update(c=>(c=m(p({},c),{screenSharing:{attendee:t,stream:a}}),c))}),this.componentConfigSignal().huddleAttendees.filter(a=>a?.state?.screenSharingState)?.length||this.componentConfigSignal.update(a=>(a=m(p({},a),{screenSharing:null}),a))})}else this.componentConfigSignal.update(e=>(e=m(p({},e),{remoteStreamsByUserId:{}}),e));this.huddleService.setRemoteStreamsByUserId(this.componentConfigSignal().remoteStreamsByUserId)}catch(e){this.loggingService.catch("Error in HuddleComponent updateRemoteStreamsByUserId:",e)}}updatePeerConnectionStateMapByUserId(){try{this.componentConfigSignal().huddleAttendees.forEach(e=>{let t=this.huddleService.getCombinedId(this.componentConfigSignal().user?.userSnippylyId,e.userSnippylyId);this.componentConfigSignal.update(i=>(i=m(p({},i),{peerConnectionStateMapByUserId:m(p({},i.peerConnectionStateMapByUserId),{[e.userSnippylyId]:this.peerConnectionStateMap[t]})}),i))})}catch(e){this.loggingService.catch("Error in HuddleComponent updatePeerConnectionStateMapByUserId:",e)}}toggleAudio(){try{this.huddleService.toggleLocalStreamAudio()}catch(e){this.loggingService.catch("Error in HuddleComponent toggleAudio:",e)}}toggleVideo(){try{this.huddleService.toggleLocalStreamVideo()}catch(e){this.loggingService.catch("Error in HuddleComponent toggleVideo:",e)}}toggleScreenSharing(){return y(this,null,function*(){try{yield this.huddleService.toggleLocalScreenSharing()}catch(e){this.loggingService.catch("Error in HuddleComponent toggleScreenSharing:",e)}})}toggleHuddleOnCursor(e){try{this.huddleService.toggleHuddleOnCursorModeByAttendeeId(e?.userSnippylyId)}catch(t){this.loggingService.catch("Error in HuddleComponent toggleHuddleOnCursor:",t)}}dropCall(){try{this.huddleService.dropCall(),this.huddleService.removeLocalStream(),this.componentConfigSignal.update(e=>(e=m(p({},e),{huddleAttendees:[]}),e))}catch(e){this.loggingService.catch("Error in HuddleComponent dropCall:",e)}}copyUrl(){Ie(window.location.href)}onDragStarted(e){try{let t=e.source.element.nativeElement;t&&(t.hasAttribute("fixed")||t.setAttribute("fixed","true"))}catch(t){this.loggingService.catch("Error in HuddleComponent onDragStarted:",t)}}onDragMoved(e){try{this.componentConfigSignal.update(H=>(H=m(p({},H),{isDragging:!0}),H));let t=e.source.element.nativeElement,i=e.event,a=i?.touches?.length?i.touches[0]?.clientX:i.clientX,c=i?.touches?.length?i.touches[0]?.clientY:i.clientY,h=document.elementsFromPoint(a,c);this.droppedInsideContainer=!1;for(let H=0;H<h.length;H++)if(h[H].id==="videoHuddleContainer"){this.droppedInsideContainer=!0;break}if(t){let H=t.getBoundingClientRect();t.style.setProperty("left",a-H?.width/2+"px","important"),t.style.setProperty("top",c-H?.height/2+"px","important")}}catch(t){this.loggingService.catch("Error in CommentPinPortalComponent onDragMoved: ",t)}}onDragEnded(e){try{this.componentConfigSignal.update(i=>(i=m(p({},i),{isDragging:!1}),i));let t=e.source.element.nativeElement;t&&this.droppedInsideContainer&&(t.removeAttribute("fixed"),t.style.removeProperty("transform"),this.droppedInsideContainer=!1)}catch(t){this.loggingService.catch("Error in HuddleComponent onDragEnded:",t)}}onViewportSizeChange(){try{this.remoteScreenSharingHuddleDrag&&this.remoteScreenSharingHuddleDrag.reset()}catch(e){this.loggingService.catch("Error in HuddleComponent onViewportSizeChange:",e)}}setHuddleInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(ae.HUDDLE)}catch(e){this.loggingService.catch("Error in HuddleComponent setHuddleInstalledInAnalytics: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(le),I(se),I(R),I(w))},o.\u0275cmp=G({type:o,selectors:[["snippyly-huddle"]],viewQuery:function(t,i){if(t&1&&ot(ti,5),t&2){let a;at(a=lt())&&(i.remoteScreenSharingHuddleDrag=a.first)}},hostVars:1,hostBindings:function(t,i){t&2&&K("data-velt-element",i.veltElement)},inputs:{_chat:[0,"chat","_chat"],_flockModeOnAvatarClick:[0,"flockModeOnAvatarClick","_flockModeOnAvatarClick"],_serverFallback:[0,"serverFallback","_serverFallback"]},standalone:!1,decls:1,vars:1,consts:[["remoteScreenSharingHuddleRef",""],["remoteScreenSharingHuddleDrag","cdkDrag"],["messagePanelTrigger","cdkOverlayOrigin"],["sidebarOverlay","cdkConnectedOverlay"],[4,"ngIf"],["id","videoHuddleContainer","class","video-huddle-container",3,"style",4,"ngIf"],["id","videoHuddleContainer",1,"video-huddle-container"],["cdkDrag","",3,"user","stream","audioState","videoState","toggleAudio","toggleVideo","cdkDragStarted","cdkDragMoved","cdkDragEnded",4,"ngIf"],["cdkDrag","",3,"toggleAudio","toggleVideo","cdkDragStarted","cdkDragMoved","cdkDragEnded","user","stream","audioState","videoState"],["ngFor","",3,"ngForOf","ngForTrackBy"],["cdkDrag","",3,"user","remoteVideoStream","audioState","videoState","isRemoteStream","toggleAudio","toggleVideo","toggleHuddleOnCursor","cdkDragStarted","cdkDragMoved","cdkDragEnded",4,"ngIf"],[3,"user","remoteAudioStream",4,"ngIf"],["cdkDrag","",3,"toggleAudio","toggleVideo","toggleHuddleOnCursor","cdkDragStarted","cdkDragMoved","cdkDragEnded","user","remoteVideoStream","audioState","videoState","isRemoteStream"],[3,"user","remoteAudioStream"],[4,"ngIf","ngIfElse"],["cdkDrag","",3,"toggleScreenSharing","stream"],["cdkDrag","",3,"stream","user","isRemoteStream","viewportSizeChange",4,"ngIf"],["cdkDrag","",3,"viewportSizeChange","stream","user","isRemoteStream"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass"]],template:function(t,i){t&1&&_(0,Ci,4,3,"ng-container",4),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[ge,J,ke,xe,_t,je,ze,We,Ge],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}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.icon-btn[_ngcontent-%COMP%]{border:1px solid #2d2d2d;border-radius:100%;width:calc((2.5rem + 0px) * var(--velt-base-rem-unit))!important;height:calc((2.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex;align-items:center;justify-content:center;color:#2d2d2d;fill:#2d2d2d;cursor:pointer}.icon-btn[_ngcontent-%COMP%]:hover{background:#fff5}.icon-btn.background-red[_ngcontent-%COMP%]{background:red!important;border-color:red!important;color:#fff!important;fill:#fff!important}.icon-btn.background-royalblue[_ngcontent-%COMP%]{background:#4169e1!important;border-color:#4169e1!important}.icon-btn[_ngcontent-%COMP%]:before{content:""}.drop-call-btn[_ngcontent-%COMP%]{transform:rotate(135deg)!important} .video-huddle-container{position:fixed!important;z-index:2147483637!important;top:0!important;left:0!important;display:flex!important;flex-direction:column!important;max-height:100vh!important;overflow:auto;box-sizing:border-box;background-color:transparent;transition:background-color .2s} .video-huddle-container[highlight]{background-color:#a0a0a047;height:100vh!important;min-width:132px!important} .video-huddle-container:not(:empty){padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important} .video-huddle-container snippyly-video-huddle-user[fixed]{position:fixed!important;top:0!important;left:0!important;transform:none!important;z-index:1!important} .video-huddle-container .video-huddle-block{height:100%!important;width:100%!important;position:relative!important;margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important} .video-huddle-container .video-huddle-block .video-player-container{height:100px!important;width:100px!important;transition:all .5s ease-in-out;border-radius:50%!important} .video-huddle-container .video-huddle-block video{width:100%!important;height:100%!important;object-fit:cover!important;border-radius:50%!important} .video-huddle-container .video-huddle-block.speaking .video-player-container{transition:all .7s ease} .video-huddle-container .video-huddle-block .video-huddle-actions-panel{background:#000!important;color:#fff!important;padding:calc((.25rem + 0px) * var(--velt-base-rem-unit)) calc((.25rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;position:absolute!important;bottom:0!important;left:50%!important;transform:translate(-50%,50%)!important;display:none!important} .video-huddle-container .video-huddle-block.selected{margin-bottom:36px!important} .video-huddle-container .video-huddle-block.selected .video-player-container{width:180px!important;height:180px!important} .video-huddle-container .video-huddle-block.selected .video-huddle-actions-panel{display:flex!important;justify-content:space-between!important;align-items:center!important} .video-huddle-container .video-huddle-block.selected .video-huddle-actions-panel .video-huddle-action-button{margin:0 calc((.2rem + 0px) * var(--velt-base-rem-unit))!important;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:50%!important;cursor:pointer!important;box-sizing:content-box!important} .video-huddle-container .video-huddle-block.selected .video-huddle-actions-panel .video-huddle-action-button:first-child{margin-left:calc((.1rem + 0px) * var(--velt-base-rem-unit))!important} .video-huddle-container .video-huddle-block.selected .video-huddle-actions-panel .video-huddle-action-button:last-child{margin-right:calc((.1rem + 0px) * var(--velt-base-rem-unit))!important} .video-huddle-container .video-huddle-block.selected .video-huddle-actions-panel .video-huddle-action-button:hover{background-color:#353945!important} .video-huddle-container::-webkit-scrollbar{display:none!important;width:0!important;height:0!important} .video-huddle-container::-webkit-scrollbar{width:0!important;height:0!important} .video-huddle-container::-webkit-scrollbar-button{width:0!important;height:0!important}@keyframes _ngcontent-%COMP%_ripple{0%{box-shadow:0 0 #0000ff4d,0 0 0 1px #0000ff4d,0 0 0 3px #0000ff4d,0 0 0 5px #0000ff4d}to{box-shadow:0 0 #0000ff4d,0 0 0 4px #0000ff4d,0 0 0 20px #00f0,0 0 0 30px #00f0}}'],changeDetection:0});let r=o;return r})();function Si(r,o){if(r&1){let n=E();l(0,"div",21),f("click",function(){v(n);let t=s().$implicit,i=s(2);return C(i.followUser(t))}),S(1,"snippyly-user-avatar",22),u()}if(r&2){let n=s().$implicit,e=s().ngIf;q("s-current-user",(e.user==null?null:e.user.userSnippylyId)===(n==null?null:n.userSnippylyId)),d(),g("user",n)}}function _i(r,o){if(r&1&&(D(0),_(1,Si,2,3,"div",20),U()),r&2){let n=o.index,e=s().ngIf;d(),g("ngIf",n<e.maxAttendees)}}function fi(r,o){if(r&1&&(l(0,"button"),A(1),u()),r&2){let n=s().ngIf;d(),N("+"+((n.attendees==null?null:n.attendees.length)-n.maxAttendees))}}function yi(r,o){r&1&&(k(),l(0,"svg",23),S(1,"path",24),u())}function bi(r,o){r&1&&(k(),l(0,"svg",25),S(1,"path",26)(2,"path",27),u())}function xi(r,o){r&1&&(k(),l(0,"svg",28),S(1,"path",29),u())}function ki(r,o){r&1&&(k(),l(0,"svg",25)(1,"g"),S(2,"path",30)(3,"path",27),u(),l(4,"defs")(5,"clipPath",31),S(6,"rect",32),u()()())}function Hi(r,o){r&1&&(D(0),k(),l(1,"svg",25)(2,"g"),S(3,"path",34)(4,"path",35)(5,"path",36)(6,"path",37)(7,"path",27),u(),l(8,"defs")(9,"clipPath",38),S(10,"rect",32),u()()(),U())}function Ii(r,o){r&1&&(k(),l(0,"svg",25)(1,"g"),S(2,"path",39)(3,"path",40)(4,"path",36)(5,"path",37)(6,"path",27),u(),l(7,"defs")(8,"clipPath",41),S(9,"rect",32),u()()())}function wi(r,o){r&1&&(k(),l(0,"svg",25),S(1,"path",42)(2,"path",43)(3,"path",44)(4,"path",45),u())}function Mi(r,o){if(r&1&&_(0,Ii,10,0,"svg",11)(1,wi,5,0,"svg",11),r&2){let n=s(2).ngIf;g("ngIf",!n.screenSharingState),d(),g("ngIf",n.screenSharingState)}}function Ei(r,o){if(r&1){let n=E();l(0,"button",8),f("click",function(){v(n);let t=s(2);return C(t.onToggleScreenSharingClick())}),l(1,"div",9),A(2),b(3,"translate"),b(4,"translate"),u(),_(5,Hi,11,0,"ng-container",33)(6,Mi,2,2,"ng-template",null,0,Z),u()}if(r&2){let n=F(7),e=s().ngIf;d(2),ie("",e.screenSharingState?x(3,3,"Stop sharing"):x(4,5,"Share screen")," "),d(3),g("ngIf",e.screenSharingDisabled)("ngIfElse",n)}}function Oi(r,o){r&1&&(k(),l(0,"svg",25),S(1,"path",46),u())}function Ti(r,o){r&1&&(k(),l(0,"svg",25),S(1,"path",47),u())}function Ai(r,o){if(r&1){let n=E();l(0,"button",8),f("click",function(){v(n);let t=s(2);return C(t.onToggleHuddleCursorModeClick())}),_(1,Oi,2,0,"svg",11)(2,Ti,2,0,"svg",11),u()}if(r&2){let n=s().ngIf;d(),g("ngIf",!n.huddleOnCursorMode),d(),g("ngIf",n.huddleOnCursorMode)}}function Pi(r,o){if(r&1){let n=E();l(0,"button",8),f("click",function(){v(n);let t=s(2);return C(t.toggleMessagesPanel())}),l(1,"div",9),A(2),b(3,"translate"),u(),k(),l(4,"svg",16),S(5,"path",48),u()()}r&2&&(d(2),N(x(3,1,"Chat with everyone")))}function Vi(r,o){if(r&1){let n=E();D(0),l(1,"div",2)(2,"div",3)(3,"div",4),_(4,_i,2,1,"ng-container",5)(5,fi,2,1,"button",1),u(),l(6,"div",6)(7,"app-device-permission-button",7)(8,"button",8),f("click",function(){v(n);let t=s();return C(t.onToggleAudioClick())}),l(9,"div",9),A(10),b(11,"translate"),b(12,"translate"),u(),_(13,yi,2,0,"svg",10)(14,bi,3,0,"svg",11),u()(),l(15,"app-device-permission-button",12)(16,"button",8),f("click",function(){v(n);let t=s();return C(t.onToggleVideoClick())}),l(17,"div",9),A(18),b(19,"translate"),b(20,"translate"),u(),_(21,xi,2,0,"svg",13)(22,ki,7,0,"svg",11),u()(),_(23,Ei,8,7,"button",14)(24,Ai,3,2,"button",14)(25,Pi,6,3,"button",14),l(26,"button",15),f("click",function(){v(n);let t=s();return C(t.openMediaSourceOptionsDialog())}),l(27,"div",9),A(28),b(29,"translate"),b(30,"translate"),u(),k(),l(31,"svg",16),S(32,"path",17),u()()(),re(),l(33,"div",18)(34,"button",19),f("click",function(){v(n);let t=s();return C(t.onLeaveClick())}),A(35),b(36,"translate"),u()()()(),U()}if(r&2){let n=o.ngIf,e=s();d(4),g("ngForOf",n.attendees)("ngForTrackBy",e.trackByAttendeeId),d(),g("ngIf",(n.attendees==null?null:n.attendees.length)>n.maxAttendees),d(2),g("darkMode",!0),d(3),ie("",n.audioState?x(11,17,"Click to mute"):x(12,19,"Click to unmute")," "),d(3),g("ngIf",n.audioState),d(),g("ngIf",!n.audioState),d(),g("darkMode",!0),d(3),ie("",n.videoState?x(19,21,"Turn off video"):x(20,23,"Turn on video")," "),d(3),g("ngIf",n.videoState),d(),g("ngIf",!n.videoState),d(),g("ngIf",n.screenSharingSupported),d(),g("ngIf",!n.hideHuddleOnCursor),d(),g("ngIf",n.chatEnabled),d(),g("disabled",!n.audioState&&!n.videoState),d(2),N(!n.audioState&&!n.videoState?x(29,25,"Enable audio or video to change the settings"):x(30,27,"Change audio/video settings")),d(7),N(x(36,29,"Leave"))}}var Ze=(()=>{let o=class o{constructor(e,t,i,a,c,h){this.analyticsService=e,this.configService=t,this.flockService=i,this.huddleService=a,this.loggingService=c,this.dialog=h,this.attendees=[],this.toggleAudio=new X,this.toggleVideo=new X,this.toggleScreenSharing=new X,this.leave=new X,this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=W({attendees:this.attendees,maxAttendees:4,audioState:this.audioState,videoState:this.videoState,chatEnabled:!1,huddleOnCursorMode:!1,hideHuddleOnCursor:!1,screenSharingState:this.screenSharingState,screenSharingDisabled:this.screenSharingDisabled,screenSharingSupported:!!navigator?.mediaDevices?.getDisplayMedia,user:this.user})}ngOnInit(){try{this.subscriptions.push(this.configService.getConfig$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=m(p({},t),{hideHuddleOnCursor:!e?.featureAllowList?.find(i=>i===ae.CURSOR)}),t))},e=>{this.loggingService.catch("Error in HuddleMenuPanelComponent getConfig$: ",e)})),this.subscriptions.push(this.huddleService.getHuddleOnCursorMode$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=m(p({},t),{huddleOnCursorMode:e}),t))},e=>{this.loggingService.catch("Error in HuddleMenuPanelComponent getHuddleOnCursorMode$: ",e)})),this.subscriptions.push(this.huddleService.getChatEnabled$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=m(p({},t),{chatEnabled:e}),t))},e=>{this.loggingService.catch("Error in HuddleMenuPanelComponent getChatEnabled$: ",e)}))}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent ngOnInit: ",e)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling HuddleMenuPanelComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=m(p({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in HuddleMenuPanelComponent ngOnChanges: ",t)}}trackByAttendeeId(e,t){return t?.userId}onToggleAudioClick(){try{this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_AUDIO_BUTTON_CLICKED,{huddleType:this.huddleService.getInitialHuddleType(),totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.toggleAudio.emit()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleAudioClick: ",e)}}onToggleVideoClick(){try{this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_VIDEO_BUTTON_CLICKED,{huddleType:this.huddleService.getInitialHuddleType(),totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.toggleVideo.emit()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleVideoClick: ",e)}}onToggleScreenSharingClick(){try{this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_SCREENSHARING_BUTTON_CLICKED,{huddleType:this.huddleService.getInitialHuddleType(),totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.toggleScreenSharing.emit()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleScreenSharingClick: ",e)}}onToggleHuddleCursorModeClick(){try{this.componentConfigSignal().huddleOnCursorMode?this.huddleService.disableHuddleOnCursorMode():this.huddleService.enableHuddleOnCursorMode()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleHuddleCursorModeClick: ",e)}}openMediaSourceOptionsDialog(){try{this.subscriptions.push(this.dialog.open(cn,{panelClass:"velt-mat-dialog-container",data:{settingsVisible:{audio:this.componentConfigSignal().audioState,video:this.componentConfigSignal().videoState}}}).afterClosed().pipe(he(1)).subscribe(e=>{e&&(this.componentConfigSignal().audioState&&this.huddleService.toggleLocalStreamAudio(!0),this.componentConfigSignal().videoState&&this.huddleService.toggleLocalStreamVideo(!0))}))}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent mediaSourceOptionsDialog: ",e)}}onLeaveClick(){this.leave.emit()}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.huddleService.toggleMessagesPanel()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent toggleMessagesPanel: ",e)}}followUser(e){try{this.huddleService.getFlockModeOnAvatarClick()&&this.flockService.getFlockMode()&&this.componentConfigSignal().user?.userSnippylyId!==e.userSnippylyId&&this.flockService.setFlockLeader(e.userSnippylyId,e.name)}catch(t){this.loggingService.catch("Error in HuddleMenuPanelComponent followUser: ",t)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(le),I(Ee),I(gn),I(R),I(w),I(Pt))},o.\u0275cmp=G({type:o,selectors:[["snippyly-huddle-menu-panel"]],hostVars:1,hostBindings:function(t,i){t&2&&K("data-velt-element",i.veltElement)},inputs:{stream:"stream",selected:"selected",isRemoteStream:"isRemoteStream",user:"user",audioState:"audioState",videoState:"videoState",screenSharingState:"screenSharingState",screenSharingDisabled:"screenSharingDisabled",attendees:"attendees"},outputs:{toggleAudio:"toggleAudio",toggleVideo:"toggleVideo",toggleScreenSharing:"toggleScreenSharing",leave:"leave"},standalone:!1,features:[ne],decls:1,vars:1,consts:[["screenSharingToggleBtnRef",""],[4,"ngIf"],[1,"reply-div","input-text-wrap"],[1,"action-menu"],[1,"pins-wrap"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"actions-wrap"],["type","audio",3,"darkMode"],[1,"action__button","tooltip",3,"click"],[1,"tooltiptext"],["width","20","height","20","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["type","video",3,"darkMode"],["width","20","height","20","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["class","action__button tooltip",3,"click",4,"ngIf"],[1,"action__button","tooltip",3,"click","disabled"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M19.5 12C19.5 11.77 19.49 11.55 19.47 11.32L21.33 9.91C21.73 9.61 21.84 9.05 21.59 8.61L19.72 5.38C19.47 4.94 18.93 4.76 18.47 4.96L16.32 5.87C15.95 5.61 15.56 5.38 15.15 5.19L14.86 2.88C14.8 2.38 14.37 2 13.87 2H10.14C9.63003 2 9.20003 2.38 9.14003 2.88L8.85003 5.19C8.44003 5.38 8.05003 5.61 7.68003 5.87L5.53003 4.96C5.07003 4.76 4.53003 4.94 4.28003 5.38L2.41003 8.62C2.16003 9.06 2.27003 9.61 2.67003 9.92L4.53003 11.33C4.51003 11.55 4.50003 11.77 4.50003 12C4.50003 12.23 4.51003 12.45 4.53003 12.68L2.67003 14.09C2.27003 14.39 2.16003 14.95 2.41003 15.39L4.28003 18.62C4.53003 19.06 5.07003 19.24 5.53003 19.04L7.68003 18.13C8.05003 18.39 8.44003 18.62 8.85003 18.81L9.14003 21.12C9.20003 21.62 9.63003 22 10.13 22H13.86C14.36 22 14.79 21.62 14.85 21.12L15.14 18.81C15.55 18.62 15.94 18.39 16.31 18.13L18.46 19.04C18.92 19.24 19.46 19.06 19.71 18.62L21.58 15.39C21.83 14.95 21.72 14.4 21.32 14.09L19.46 12.68C19.49 12.45 19.5 12.23 19.5 12ZM12.04 15.5C10.11 15.5 8.54003 13.93 8.54003 12C8.54003 10.07 10.11 8.5 12.04 8.5C13.97 8.5 15.54 10.07 15.54 12C15.54 13.93 13.97 15.5 12.04 15.5Z","fill","#fff"],[1,"buttons-wrap"],[1,"secondary",3,"click"],["class","pin2",3,"s-current-user","click",4,"ngIf"],[1,"pin2",3,"click"],[1,"huddle-menu-panel-user-avatar",3,"user"],["width","20","height","20","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.77526 0.888917C4.98766 1.03653 4.34477 1.39041 3.76525 1.99544C3.26289 2.51988 2.94255 3.10884 2.75974 3.84431C2.69679 4.09753 2.6908 4.39635 2.6908 7.29276C2.6908 10.7979 2.68044 10.6352 2.94799 11.327C3.299 12.2346 4.07584 13.0561 4.94368 13.4374C5.82412 13.8243 6.82444 13.8531 7.71552 13.5173C8.69181 13.1494 9.53872 12.2934 9.92297 11.2862C10.1713 10.6354 10.1631 10.7714 10.1631 7.29276C10.1631 3.78764 10.1735 3.95032 9.90592 3.25855C9.62932 2.54335 9.02923 1.81042 8.38767 1.40419C7.61998 0.918084 6.64549 0.725873 5.77526 0.888917ZM6.9551 2.18212C7.80033 2.36379 8.55484 3.08137 8.82443 3.95997C8.91085 4.24162 8.9112 4.25479 8.9112 7.29276C8.9112 10.3307 8.91085 10.3439 8.82443 10.6256C8.578 11.4287 7.92854 12.0994 7.15071 12.3538C6.92897 12.4264 6.7875 12.4431 6.40739 12.4415C6.00213 12.4398 5.89869 12.425 5.65097 12.3333C5.00401 12.0936 4.49038 11.6376 4.2051 11.0497C3.92221 10.4667 3.92452 10.4977 3.92452 7.29276C3.92452 4.09736 3.92315 4.11587 4.19825 3.55135C4.71228 2.49645 5.83136 1.94067 6.9551 2.18212ZM0.537139 8.64006C0.373453 8.71677 0.215048 8.92183 0.182929 9.09861C0.133831 9.36895 0.199086 10.6794 0.283042 11.1082C0.737953 13.4317 2.32631 15.2803 4.50075 16.017C4.75328 16.1025 5.14915 16.2055 5.38044 16.2458L5.801 16.3192V16.9744V17.6296L5.06042 17.6421C4.38416 17.6536 4.31046 17.6619 4.21195 17.738C4.00671 17.8964 3.94271 18.0255 3.94271 18.2809C3.94271 18.5363 4.00679 18.6655 4.21206 18.8237C4.31804 18.9055 4.36006 18.907 6.42696 18.907C8.49385 18.907 8.53586 18.9055 8.64185 18.8237C8.84712 18.6655 8.9112 18.5363 8.9112 18.2809C8.9112 18.0255 8.8472 17.8964 8.64196 17.738C8.54346 17.6619 8.46975 17.6536 7.79349 17.6421L7.05291 17.6296V16.9744V16.3192L7.47347 16.2469C9.74567 15.8564 11.6474 14.1569 12.3699 11.8711C12.6066 11.1222 12.6648 10.7131 12.6659 9.79054C12.6668 9.05017 12.6614 8.98828 12.5862 8.8841C12.4332 8.67197 12.3081 8.60568 12.0605 8.60568C11.8131 8.60568 11.6881 8.67181 11.5348 8.88378C11.4622 8.9842 11.4515 9.07453 11.4282 9.79025C11.4001 10.6516 11.3449 11.0079 11.1515 11.5749C10.8931 12.3325 10.527 12.9264 9.95298 13.5192C9.22696 14.2689 8.41181 14.7274 7.405 14.9524C6.91168 15.0626 5.87256 15.0542 5.38588 14.936C4.37192 14.6897 3.6185 14.2601 2.90093 13.5192C2.32689 12.9264 1.96079 12.3325 1.70239 11.5749C1.50901 11.0079 1.45377 10.6516 1.42568 9.79025C1.39755 8.92635 1.3871 8.88689 1.13621 8.69342C1.00672 8.5936 0.695505 8.56589 0.537139 8.64006Z","fill","#FF7162"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M9.77526 0.888917C8.98766 1.03653 8.34477 1.39041 7.76525 1.99544C7.26289 2.51988 6.94255 3.10884 6.75974 3.84431C6.69679 4.09753 6.6908 4.39635 6.6908 7.29276C6.6908 10.7979 6.68044 10.6352 6.94799 11.327C7.299 12.2346 8.07584 13.0561 8.94368 13.4374C9.82412 13.8243 10.8244 13.8531 11.7155 13.5173C12.6918 13.1494 13.5387 12.2934 13.923 11.2862C14.1713 10.6354 14.1631 10.7714 14.1631 7.29276C14.1631 3.78764 14.1735 3.95032 13.9059 3.25855C13.6293 2.54335 13.0292 1.81042 12.3877 1.40419C11.62 0.918084 10.6455 0.725873 9.77526 0.888917ZM10.9551 2.18212C11.8003 2.36379 12.5548 3.08137 12.8244 3.95997C12.9108 4.24162 12.9112 4.25479 12.9112 7.29276C12.9112 10.3307 12.9108 10.3439 12.8244 10.6256C12.578 11.4287 11.9285 12.0994 11.1507 12.3538C10.929 12.4264 10.7875 12.4431 10.4074 12.4415C10.0021 12.4398 9.89869 12.425 9.65097 12.3333C9.00401 12.0936 8.49038 11.6376 8.2051 11.0497C7.92221 10.4667 7.92452 10.4977 7.92452 7.29276C7.92452 4.09736 7.92315 4.11587 8.19825 3.55135C8.71228 2.49645 9.83136 1.94067 10.9551 2.18212ZM4.53714 8.64006C4.37345 8.71677 4.21505 8.92183 4.18293 9.09861C4.13383 9.36895 4.19909 10.6794 4.28304 11.1082C4.73795 13.4317 6.32631 15.2803 8.50075 16.017C8.75328 16.1025 9.14915 16.2055 9.38044 16.2458L9.801 16.3192V16.9744V17.6296L9.06042 17.6421C8.38416 17.6536 8.31046 17.6619 8.21195 17.738C8.00671 17.8964 7.94271 18.0255 7.94271 18.2809C7.94271 18.5363 8.00679 18.6655 8.21206 18.8237C8.31804 18.9055 8.36006 18.907 10.427 18.907C12.4938 18.907 12.5359 18.9055 12.6418 18.8237C12.8471 18.6655 12.9112 18.5363 12.9112 18.2809C12.9112 18.0255 12.8472 17.8964 12.642 17.738C12.5435 17.6619 12.4697 17.6536 11.7935 17.6421L11.0529 17.6296V16.9744V16.3192L11.4735 16.2469C13.7457 15.8564 15.6474 14.1569 16.3699 11.8711C16.6066 11.1222 16.6648 10.7131 16.6659 9.79054C16.6668 9.05017 16.6614 8.98828 16.5862 8.8841C16.4332 8.67197 16.3081 8.60568 16.0605 8.60568C15.8131 8.60568 15.6881 8.67181 15.5348 8.88378C15.4622 8.9842 15.4515 9.07453 15.4282 9.79025C15.4001 10.6516 15.3449 11.0079 15.1515 11.5749C14.8931 12.3325 14.527 12.9264 13.953 13.5192C13.227 14.2689 12.4118 14.7274 11.405 14.9524C10.9117 15.0626 9.87256 15.0542 9.38588 14.936C8.37192 14.6897 7.6185 14.2601 6.90093 13.5192C6.32689 12.9264 5.96079 12.3325 5.70239 11.5749C5.50901 11.0079 5.45377 10.6516 5.42568 9.79025C5.39755 8.92636 5.3871 8.88689 5.13621 8.69342C5.00672 8.5936 4.69551 8.56589 4.53714 8.64006Z","fill","white"],["d","M19 1L1 19","stroke","#FF7162","stroke-width","1.4","stroke-linecap","round"],["width","20","height","20","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.55139 0.23203C1.68754 0.455725 1.06855 1.0239 0.766641 1.87017L0.666016 2.15221V5.58961V9.027L0.766892 9.30905C1.0535 10.1102 1.64038 10.6751 2.43987 10.9192L2.70863 11.0013H7.1343H11.56L11.8467 10.9053C12.6234 10.645 13.2099 10.0654 13.47 9.30122C13.56 9.03659 13.5637 8.9921 13.5769 8.03104C13.5844 7.48324 13.6004 7.03508 13.6125 7.03508C13.661 7.03508 15.0857 7.85713 15.8518 8.32715C16.7188 8.85908 16.9126 8.93887 17.338 8.93887C18.0692 8.93887 18.7509 8.40866 18.947 7.6873C19.0174 7.42849 19.0165 3.7478 18.946 3.48726C18.7883 2.90449 18.278 2.40845 17.7016 2.27772C17.4483 2.22025 17.0895 2.2339 16.8373 2.31054C16.6848 2.35687 16.3699 2.52617 15.9107 2.80867C15.3288 3.16675 13.6405 4.14414 13.6039 4.14414C13.5979 4.14414 13.5847 3.71184 13.5747 3.18343C13.5543 2.10543 13.5363 1.99899 13.2916 1.50796C13.0166 0.956034 12.475 0.494788 11.8467 0.277192L11.56 0.177913L7.18806 0.170686C2.95948 0.163705 2.80747 0.165715 2.55139 0.23203ZM11.3211 1.83643C11.5404 1.90052 11.7306 2.05381 11.8398 2.25463L11.9183 2.399V5.57293V8.74683L11.8268 8.92184C11.7122 9.14091 11.4929 9.30852 11.2552 9.35869C11.0123 9.40995 3.20786 9.41115 2.98224 9.35999C2.74243 9.30559 2.53297 9.14483 2.42553 8.93266L2.33236 8.74873V5.58961V2.43048L2.42553 2.24656C2.52985 2.04059 2.7435 1.87225 2.96604 1.82078C3.04208 1.80318 4.88581 1.78753 7.11882 1.78556C10.641 1.78245 11.1578 1.78873 11.3211 1.83643ZM17.3116 5.59366V7.28997L17.2309 7.23801C16.8358 6.98339 15.6936 6.30427 15.1359 5.99233C14.7573 5.78052 14.4468 5.5987 14.4461 5.5883C14.4453 5.57787 14.7874 5.37536 15.2062 5.13827C15.6251 4.90114 16.258 4.52634 16.6128 4.30536C16.9675 4.08438 17.2699 3.90215 17.2847 3.90045C17.2995 3.89876 17.3116 4.6607 17.3116 5.59366Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.55139 4.23203C2.68754 4.45573 2.06855 5.0239 1.76664 5.87017L1.66602 6.15221V9.58961V13.027L1.76689 13.309C2.0535 14.1102 2.64038 14.6751 3.43987 14.9192L3.70863 15.0013H8.1343H12.56L12.8467 14.9053C13.6234 14.645 14.2099 14.0654 14.47 13.3012C14.56 13.0366 14.5637 12.9921 14.5769 12.031C14.5844 11.4832 14.6004 11.0351 14.6125 11.0351C14.661 11.0351 16.0857 11.8571 16.8518 12.3271C17.7188 12.8591 17.9126 12.9389 18.338 12.9389C19.0692 12.9389 19.7509 12.4087 19.947 11.6873C20.0174 11.4285 20.0165 7.7478 19.946 7.48726C19.7883 6.90449 19.278 6.40845 18.7016 6.27772C18.4483 6.22025 18.0895 6.2339 17.8373 6.31054C17.6848 6.35687 17.3699 6.52617 16.9107 6.80867C16.3288 7.16675 14.6405 8.14414 14.6039 8.14414C14.5979 8.14414 14.5847 7.71184 14.5747 7.18343C14.5543 6.10543 14.5363 5.99899 14.2916 5.50796C14.0166 4.95603 13.475 4.49479 12.8467 4.27719L12.56 4.17791L8.18806 4.17069C3.95948 4.16371 3.80747 4.16571 3.55139 4.23203ZM12.3211 5.83643C12.5404 5.90052 12.7306 6.05381 12.8398 6.25463L12.9183 6.399V9.57293V12.7468L12.8268 12.9218C12.7122 13.1409 12.4929 13.3085 12.2552 13.3587C12.0123 13.4099 4.20786 13.4111 3.98224 13.36C3.74243 13.3056 3.53297 13.1448 3.42553 12.9327L3.33236 12.7487V9.58961V6.43048L3.42553 6.24656C3.52985 6.04059 3.7435 5.87225 3.96604 5.82078C4.04208 5.80318 5.88581 5.78753 8.11882 5.78556C11.641 5.78245 12.1578 5.78873 12.3211 5.83643ZM18.3116 9.59366V11.29L18.2309 11.238C17.8358 10.9834 16.6936 10.3043 16.1359 9.99233C15.7573 9.78052 15.4468 9.5987 15.4461 9.5883C15.4453 9.57787 15.7874 9.37536 16.2062 9.13827C16.6251 8.90114 17.258 8.52634 17.6128 8.30536C17.9675 8.08438 18.2699 7.90215 18.2847 7.90045C18.2995 7.89876 18.3116 8.6607 18.3116 9.59366Z","fill","white"],["id","clip0_2334_10689"],["width","20","height","20","fill","white"],[4,"ngIf","ngIfElse"],["d","M7.50016 15H9.16683V16.6667H10.8335V15H12.5002V16.6667H13.3335C13.7937 16.6667 14.1668 17.0398 14.1668 17.5C14.1668 17.9602 13.7937 18.3333 13.3335 18.3333H6.66683C6.20659 18.3333 5.8335 17.9602 5.8335 17.5C5.8335 17.0398 6.20659 16.6667 6.66683 16.6667H7.50016V15Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33317 5L3.33317 11.6667C3.33317 12.5871 4.07936 13.3333 4.99984 13.3333L14.9998 13.3333C15.9203 13.3333 16.6665 12.5871 16.6665 11.6667L16.6665 5C16.6665 4.07953 15.9203 3.33333 14.9998 3.33333L4.99984 3.33333C4.07936 3.33333 3.33317 4.07953 3.33317 5ZM1.6665 11.6667C1.6665 13.5076 3.15889 15 4.99984 15L14.9998 15C16.8408 15 18.3332 13.5076 18.3332 11.6667L18.3332 5C18.3332 3.15905 16.8408 1.66667 14.9998 1.66667L4.99984 1.66667C3.15889 1.66667 1.6665 3.15905 1.6665 5L1.6665 11.6667Z","fill","white"],["d","M5.83333 5C5.3731 5 5 5.3731 5 5.83333C5 6.29357 5.3731 6.66667 5.83333 6.66667H11.6667C12.1269 6.66667 12.5 6.29357 12.5 5.83333C12.5 5.3731 12.1269 5 11.6667 5H5.83333Z","fill","white"],["d","M5.83333 8.33333C5.3731 8.33333 5 8.70643 5 9.16667C5 9.6269 5.3731 10 5.83333 10H7.5C7.96024 10 8.33333 9.6269 8.33333 9.16667C8.33333 8.70643 7.96024 8.33333 7.5 8.33333H5.83333Z","fill","white"],["id","clip0_2260_32847"],["d","M7.50065 15H9.16732V16.6667H10.834V15H12.5007V16.6667H13.334C13.7942 16.6667 14.1673 17.0398 14.1673 17.5C14.1673 17.9602 13.7942 18.3333 13.334 18.3333H6.66732C6.20708 18.3333 5.83398 17.9602 5.83398 17.5C5.83398 17.0398 6.20708 16.6667 6.66732 16.6667H7.50065V15Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33268 5L3.33268 11.6667C3.33268 12.5871 4.07887 13.3333 4.99935 13.3333L14.9993 13.3333C15.9198 13.3333 16.666 12.5871 16.666 11.6667L16.666 5C16.666 4.07953 15.9198 3.33333 14.9993 3.33333L4.99935 3.33333C4.07887 3.33333 3.33268 4.07953 3.33268 5ZM1.66602 11.6667C1.66602 13.5076 3.1584 15 4.99935 15L14.9993 15C16.8403 15 18.3327 13.5076 18.3327 11.6667L18.3327 5C18.3327 3.15905 16.8403 1.66667 14.9993 1.66667L4.99935 1.66667C3.1584 1.66667 1.66602 3.15905 1.66602 5L1.66602 11.6667Z","fill","white"],["id","clip0_2305_6167"],["d","M7.50016 15H9.16683V16.6667H10.8335V15H12.5002V16.6667H13.3335C13.7937 16.6667 14.1668 17.0398 14.1668 17.5C14.1668 17.9602 13.7937 18.3333 13.3335 18.3333H6.66683C6.20659 18.3333 5.8335 17.9602 5.8335 17.5C5.8335 17.0398 6.20659 16.6667 6.66683 16.6667H7.50016V15Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33317 5L3.33317 11.6667C3.33317 12.5871 4.07936 13.3333 4.99984 13.3333L14.9998 13.3333C15.9203 13.3333 16.6665 12.5871 16.6665 11.6667L16.6665 5C16.6665 4.07953 15.9203 3.33333 14.9998 3.33333L4.99984 3.33333C4.07936 3.33333 3.33317 4.07953 3.33317 5ZM1.6665 11.6667C1.6665 13.5076 3.15889 15 4.99984 15L14.9998 15C16.8408 15 18.3332 13.5076 18.3332 11.6667L18.3332 5C18.3332 3.15905 16.8408 1.66667 14.9998 1.66667L4.99984 1.66667C3.15889 1.66667 1.6665 3.15905 1.6665 5L1.6665 11.6667Z","fill","#FF7162"],["d","M5.83333 5C5.3731 5 5 5.3731 5 5.83333C5 6.29357 5.3731 6.66667 5.83333 6.66667H11.6667C12.1269 6.66667 12.5 6.29357 12.5 5.83333C12.5 5.3731 12.1269 5 11.6667 5H5.83333Z","fill","#FF7162"],["d","M5.83333 8.33333C5.3731 8.33333 5 8.70643 5 9.16667C5 9.6269 5.3731 10 5.83333 10H7.5C7.96024 10 8.33333 9.6269 8.33333 9.16667C8.33333 8.70643 7.96024 8.33333 7.5 8.33333H5.83333Z","fill","#FF7162"],["d","M4.69231 5.29805L6.9519 16.6605C7.26158 18.2178 9.31823 18.591 10.1553 17.2418L12.4275 13.5798C12.4611 13.5255 12.5143 13.4861 12.5761 13.4699L16.8289 12.3482C18.3433 11.9488 18.6107 9.91372 17.2509 9.13668L7.27695 3.4373C5.97394 2.69272 4.3996 3.82614 4.69231 5.29805Z","stroke","#E5E5E9","stroke-width","1.5","stroke-linecap","square"],["d","M4.69231 5.29805L6.9519 16.6605C7.26158 18.2178 9.31823 18.591 10.1553 17.2418L12.4275 13.5798C12.4611 13.5255 12.5143 13.4861 12.5761 13.4699L16.8289 12.3482C18.3433 11.9488 18.6107 9.91372 17.2509 9.13668L7.27695 3.4373C5.97394 2.69272 4.3996 3.82614 4.69231 5.29805Z","stroke","#FF7162","stroke-width","1.5","stroke-linecap","square"],["fill-rule","evenodd","clip-rule","evenodd","d","M13.8325 2.04946C17.7809 2.65969 20.8233 5.37592 21.8636 9.21997C22.1983 10.457 22.1983 12.6637 21.8636 13.9007C20.922 17.3797 18.4001 19.9016 14.921 20.8432C14.2284 21.0307 13.7495 21.0787 12.5807 21.0777C10.9937 21.0764 10.2354 20.9338 8.89576 20.3847L8.17885 20.0909L5.96793 20.6411C3.89884 21.156 3.73807 21.1807 3.46234 21.0259C2.91579 20.7191 2.9196 20.4879 3.50969 18.1292L4.05124 15.965L3.75679 15.2466C3.20719 13.9056 3.06459 13.1477 3.06328 11.5603C3.06231 10.3914 3.11031 9.9126 3.29775 9.21997C4.23324 5.76343 6.77214 3.21049 10.1836 2.29591C10.9867 2.08059 13.1072 1.93745 13.8325 2.04946ZM10.2766 4.07773C8.99188 4.49235 8.06085 5.06677 7.07399 6.05364C5.60817 7.51946 4.87896 9.14649 4.77653 11.1793C4.71394 12.4216 4.88419 13.4239 5.34355 14.5187C5.50236 14.8972 5.68807 15.3419 5.7561 15.5069C5.85962 15.7577 5.81488 16.0697 5.48277 17.4105C5.26419 18.2927 5.09471 19.0236 5.10603 19.035C5.11735 19.0463 5.8483 18.8768 6.73045 18.6582C8.0713 18.3261 8.38328 18.2814 8.63408 18.3849C8.7991 18.4529 9.24377 18.6386 9.62225 18.7974C10.7171 19.2568 11.7194 19.427 12.9617 19.3645C14.9945 19.262 16.6215 18.5328 18.0873 17.067C19.0668 16.0875 19.6379 15.1663 20.0725 13.8644C20.3166 13.1336 20.3512 12.8471 20.3512 11.5603C20.3512 10.2736 20.3166 9.98706 20.0725 9.25621C19.6379 7.95433 19.0668 7.0331 18.0873 6.05364C16.4266 4.39297 14.6419 3.68684 12.3085 3.76717C11.4187 3.79787 10.8968 3.87755 10.2766 4.07773Z","fill","#fff"]],template:function(t,i){t&1&&_(0,Vi,37,31,"ng-container",1),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[ge,J,pe,Q],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}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}*[_ngcontent-%COMP%]:not(svg *){height:unset;width:unset}.s-presence-avatar-initial[_ngcontent-%COMP%]{color:#fff!important}.pin2[_ngcontent-%COMP%]{position:relative!important;display:flex!important;justify-content:center!important;align-items:center!important;width:2.25em!important;height:2.25em!important;background:linear-gradient(145deg,#6941ff,#ff5f7a,#ffa113)!important;border-radius:2em!important;overflow:hidden!important;margin-left:-.5em!important;transition:transform .2s ease}.pin2[_ngcontent-%COMP%]:not(.s-current-user){cursor:pointer!important}.pin2[_ngcontent-%COMP%]:hover{z-index:2!important;transform:scale(1.1)!important}.modal-author__image[_ngcontent-%COMP%]{width:2em!important;height:2em!important;background-size:cover!important;border-radius:50%!important;border:1px solid!important}.pins-wrap[_ngcontent-%COMP%]{position:relative!important;display:flex!important;width:max-content!important;justify-content:center!important;align-items:center!important;margin-left:.5em!important}button[_ngcontent-%COMP%]{background:#e6e8ec00!important;transition:.5s!important;font-style:normal!important;font-weight:600!important;font-size:14px!important;line-height:1em!important;outline:0!important;border:0!important;color:#fff!important}button[_ngcontent-%COMP%]:hover{background:#23262f!important;cursor:pointer!important}.action-menu[_ngcontent-%COMP%]{position:relative!important;display:flex!important;width:max-content!important;justify-content:center!important;gap:1em!important}.buttons-wrap[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:flex-start!important;gap:.25em!important}.primary[_ngcontent-%COMP%]{color:#fff!important;padding:.5em .75em!important;background:#625df580!important;border-radius:5.6em!important}.secondary[_ngcontent-%COMP%]:hover{background:#625df5!important;border:2px solid rgb(98,93,245)!important}.secondary[_ngcontent-%COMP%]:focus{background:#625df5!important;outline:0!important}.secondary[_ngcontent-%COMP%]:active{background:#3b3893!important}.secondary[_ngcontent-%COMP%]{padding:.5em .75em!important;border-radius:5.6em!important;border:2px solid #E6E8EC!important}.line-div[_ngcontent-%COMP%]{border-top:1px solid #e6e8ec!important;width:100%!important}.reply-div[_ngcontent-%COMP%], .single-comment-disable-div[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:flex-start!important}.value-div[_ngcontent-%COMP%]{gap:.25em!important}.modal-div[_ngcontent-%COMP%]{position:relative!important;display:flex!important;flex-direction:column!important;gap:1em!important;border-radius:.75em!important;background-color:#fff!important;box-sizing:border-box!important;width:max-content!important;text-align:left!important;font-size:14px!important;color:#141416!important}.modal-header[_ngcontent-%COMP%]{display:flex!important;justify-content:flex-end!important;gap:.75em!important}.modal-header__button[_ngcontent-%COMP%]{border:0!important;border-radius:50%!important;width:2em!important;height:2em!important;flex-shrink:0!important;display:flex!important;align-items:center!important;justify-content:center!important}.modal-messages[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;gap:1em!important}.modal-author[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;gap:.25em!important}.modal-author__image[_ngcontent-%COMP%]{width:2em!important;height:2em!important;background-color:#d3d3d3!important;background-size:cover!important;border-radius:50%!important}.modal-author__name[_ngcontent-%COMP%]{flex-grow:1!important;font-style:normal!important;font-weight:600!important;font-size:16px!important;line-height:1.5!important;color:#141416!important}.modal-author__last-message[_ngcontent-%COMP%]{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:1.5!important;display:flex!important;align-items:center!important;text-align:right!important;color:#777e91!important}.modal-author__text[_ngcontent-%COMP%]{flex-grow:1!important;padding-left:2.6em!important}.action__button[_ngcontent-%COMP%]{border:0!important;border-radius:50%!important;width:2.4em!important;height:2.4em!important;flex-shrink:0!important;display:flex!important;align-items:center!important;justify-content:center!important}.action__button[_ngcontent-%COMP%]:disabled{cursor:not-allowed!important}.action__button[_ngcontent-%COMP%]:disabled svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#777e91!important}.actions-wrap[_ngcontent-%COMP%]{position:relative!important;height:2.4em!important;display:flex!important;flex-direction:line!important;align-items:center!important;justify-content:flex-start!important;gap:.25em!important}.input-text-wrap[_ngcontent-%COMP%]{width:max-content!important;height:100%!important;border-radius:.5em!important;background-color:#141416!important;border:0!important;box-sizing:border-box!important;position:relative!important;box-shadow:0 0 24px -2px #ffffff61;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((25rem + 0px) * var(--velt-base-rem-unit))!important}.input-text[_ngcontent-%COMP%]{font-style:normal!important;font-weight:400!important;font-size:14px!important;line-height:1.5em!important;padding:.25em!important;width:100%!important;height:100%!important;background-color:#fcfcfd!important;box-sizing:border-box!important;outline:0!important;overflow:hidden!important}.tooltip[_ngcontent-%COMP%]{position:relative!important;display:flex!important;flex-direction:column!important}.tooltip-link[_ngcontent-%COMP%]{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:1.5em!important}.tooltip[_ngcontent-%COMP%] .tooltiptext[_ngcontent-%COMP%]{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:135%!important;background-color:#000!important;color:#fff!important;text-align:left!important;padding:6px 12px!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:14px!important;line-height:2em!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important}.tooltip[_ngcontent-%COMP%]:hover .tooltiptext[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important}.tooltip[_ngcontent-%COMP%] .tooltiptext[_ngcontent-%COMP%]:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;background-color:#000!important;border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important} snippyly-user-avatar.huddle-menu-panel-user-avatar{display:flex} snippyly-user-avatar.huddle-menu-panel-user-avatar .s-user-avatar-initial{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important} snippyly-user-avatar.huddle-menu-panel-user-avatar .s-user-avatar-image{border:1px solid black!important;border-radius:50%!important}'],changeDetection:0});let r=o;return r})();var Ui=()=>["snippyly-overlay-panel","snippyly-huddle-menu-panel-overlay-panel","velt-overlay-panel"],Li=()=>["snippyly-overlay-panel","snippyly-huddle-banner-panel","velt-overlay-panel"];function Bi(r,o){if(r&1){let n=E();l(0,"div",20),f("click",function(){v(n);let t=s(2);return C(t.onHuddleToolClick("audio"))}),l(1,"slot",21),f("slotchange",function(){v(n);let t=s(2);return C(t.onButtonSlotChange())}),l(2,"div",22),k(),l(3,"svg",23),S(4,"path",24),u()()()()}}function Fi(r,o){if(r&1){let n=E();l(0,"div",20),f("click",function(){v(n);let t=s(2);return C(t.onHuddleToolClick("video"))}),l(1,"slot",21),f("slotchange",function(){v(n);let t=s(2);return C(t.onButtonSlotChange())}),l(2,"div",22),k(),l(3,"svg",25),S(4,"path",26)(5,"path",27),u()()()()}}function Ni(r,o){if(r&1){let n=E();l(0,"div",20),f("click",function(){v(n);let t=s(3);return C(t.onHuddleToolClick("presentation"))}),l(1,"slot",21),f("slotchange",function(){v(n);let t=s(3);return C(t.onButtonSlotChange())}),l(2,"div",22),k(),l(3,"svg",23),S(4,"path",28),u()()()()}}function Ri(r,o){r&1&&_(0,Ni,5,0,"div",7),r&2&&g("ngSwitchCase","presentation")}function $i(r,o){if(r&1){let n=E();l(0,"div",29,4)(2,"slot",21),f("slotchange",function(){v(n);let t=s(2);return C(t.onButtonSlotChange())}),l(3,"div",30),k(),l(4,"svg",31),S(5,"path",24),u(),l(6,"svg",32),S(7,"path",33),u()()()()}if(r&2){let n=F(1);s();let e=F(8);g("matMenuTriggerFor",e),d(3),q("active",n==null?null:n.menuOpen)}}function ji(r,o){if(r&1){let n=E();l(0,"div",11),f("click",function(){v(n);let t=s(2);return C(t.onHuddleToolClick("presentation"))}),k(),l(1,"svg",12),S(2,"path",34),u(),re(),l(3,"span"),A(4),b(5,"translate"),u()()}if(r&2){let n=s().ngIf;g("disabled",n.disabled),d(4),N(x(5,2,"Screen Huddle"))}}function zi(r,o){if(r&1){let n=E();l(0,"snippyly-huddle-menu-panel",36),f("toggleAudio",function(){v(n);let t=s(3);return C(t.toggleAudio())})("toggleVideo",function(){v(n);let t=s(3);return C(t.toggleVideo())})("toggleScreenSharing",function(){v(n);let t=s(3);return C(t.toggleScreenSharing())})("leave",function(){v(n);let t=s(3);return C(t.dropCall())}),u()}if(r&2){let n=s(2).ngIf,e=F(24);g("veltDraggableOverlay",e)("attendees",n.huddleAttendees)("user",n.user)("audioState",n.localStreamState==null?null:n.localStreamState.audioState)("videoState",n.localStreamState==null?null:n.localStreamState.videoState)("screenSharingState",n.localStreamState==null?null:n.localStreamState.screenSharingState)}}function Wi(r,o){if(r&1&&_(0,zi,1,6,"snippyly-huddle-menu-panel",35),r&2){let n=s().ngIf;g("ngIf",n.meetingJoined)}}function Gi(r,o){if(r&1){let n=E();l(0,"div",38)(1,"div")(2,"div"),k(),l(3,"svg",39),S(4,"path",40),u()(),re(),l(5,"div")(6,"h3",41),A(7),b(8,"translate"),b(9,"translate"),b(10,"translate"),u(),l(11,"p",42),A(12),b(13,"translate"),u(),l(14,"div",43)(15,"button",44),f("click",function(){v(n);let t=s(3);return C(t.onJoinButtonClick())}),A(16,"Join"),u(),l(17,"button",45),f("click",function(){v(n);let t=s(3);return C(t.removeBanner())}),A(18,"Cancel"),u()()(),l(19,"div"),k(),l(20,"svg",46),f("click",function(){v(n);let t=s(3);return C(t.removeBanner())}),S(21,"path",47),u()()()()}if(r&2){let n=s(2).ngIf;d(7),be("",(n.huddleAttendees==null?null:n.huddleAttendees.length)===1?x(8,3,"1 person is"):(n.huddleAttendees==null?null:n.huddleAttendees.length)+" "+x(9,5,"people are")," ",x(10,7,"on a call now")),d(5),N(x(13,9,"You can join the call"))}}function Zi(r,o){if(r&1&&_(0,Gi,22,11,"div",37),r&2){let n=s().ngIf;g("ngIf",n.isFirstComponent&&!n.meetingJoined&&!n.bannerRemoved&&(n.huddleAttendees==null?null:n.huddleAttendees.length))}}function Ji(r,o){if(r&1){let n=E();D(0),l(1,"div",6,0),_(3,Bi,5,0,"div",7)(4,Fi,6,0,"div",7)(5,Ri,1,1,"ng-template",8)(6,$i,8,3,"div",9),u(),l(7,"mat-menu",10,1)(9,"div",11),f("click",function(){v(n);let t=s();return C(t.onHuddleToolClick("audio"))}),k(),l(10,"svg",12),S(11,"path",13),u(),re(),l(12,"span"),A(13),b(14,"translate"),u()(),l(15,"div",11),f("click",function(){v(n);let t=s();return C(t.onHuddleToolClick("video"))}),k(),l(16,"svg",12),S(17,"path",14)(18,"path",15),u(),re(),l(19,"span"),A(20),b(21,"translate"),u()(),_(22,ji,6,4,"div",16),u(),_(23,Wi,1,1,"ng-template",17,2,Z),S(25,"div",18,3),_(27,Zi,1,1,"ng-template",19,2,Z),U()}if(r&2){let n=o.ngIf,e=F(2),t=F(26),i=s();d(),g("ngSwitch",n.type),d(2),g("ngSwitchCase","audio"),d(),g("ngSwitchCase","video"),d(),g("ngIf",n.screenSharingSupported),d(),g("ngSwitchCase","all"),d(3),g("disabled",n.disabled),d(4),N(x(14,21,"Audio Huddle")),d(2),g("disabled",n.disabled),d(5),N(x(21,23,"Video Huddle")),d(2),g("ngIf",n.screenSharingSupported),d(),g("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",n.meetingJoined&&n.joinedHuddleToolComponentId===i.veltId)("cdkConnectedOverlayPanelClass",ve(25,Ui))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayPositions",n.positions)("cdkConnectedOverlayDisableClose",!0),d(4),g("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",n.isFirstComponent&&!n.meetingJoined&&!n.bannerRemoved&&!!(n.huddleAttendees!=null&&n.huddleAttendees.length))("cdkConnectedOverlayPanelClass",ve(26,Li))("cdkConnectedOverlayPositions",n.positions)}}var De=(()=>{let o=class o extends rn{constructor(e,t,i,a,c,h,H,$){super(H,h),this.analyticsService=e,this.authService=t,this.huddleService=i,this.iamService=a,this.loggingService=c,this.themeService=h,this.elementRef=H,this.domService=$,this.type="audio",this.remoteStreams=[],this.huddleStarted=!1,this.initialHuddleType="audio",this.customButtonAdded=!1,this.subscriptions=[],this.veltId=He(),this.veltElement=!0,this.componentConfigSignal=W({type:this.type,screenSharingSupported:!!navigator?.mediaDevices?.getDisplayMedia,disabled:!1,meetingJoined:!1,joinedHuddleToolComponentId:null,positions:M.OVERLAY_POSITIONS.map(T=>new yt({originX:T.originX,originY:T.originY},{overlayX:T.overlayX,overlayY:T.overlayY})),user:null,localStreamState:{},huddleAttendees:[],isFirstComponent:!1,bannerRemoved:!1}),this.subscriptions.push(this.authService.getUser$().pipe(te(T=>!!T)).subscribe(T=>{T&&(this.componentConfigSignal.update(ee=>m(p({},ee),{user:T})),this.checkToAutoJoinHuddle())},T=>{this.loggingService.catch("Error in getUser: ",T)})),this.subscriptions.push(this.huddleService.getRemoteStream().subscribe(T=>{try{T||(this.remoteStreams=[])}catch(ee){this.loggingService.catch("Error in HuddleToolComponent getRemoteStream:",ee)}},T=>{this.loggingService.catch("Error in getRemoteStream: ",T)})),this.subscriptions.push(this.huddleService.getLocalStreamState().subscribe(T=>{this.componentConfigSignal.update(ee=>m(p({},ee),{localStreamState:T}))},T=>{this.loggingService.catch("Error in getLocalStreamState: ",T)})),this.subscriptions.push(this.huddleService.getHuddleToolComponentId().subscribe(T=>{this.componentConfigSignal.update(ee=>m(p({},ee),{joinedHuddleToolComponentId:T}))},T=>{this.loggingService.catch("Error in getHuddleToolComponentId: ",T)})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(T=>{this.componentConfigSignal.update(ee=>m(p({},ee),{disabled:!!T?.all?.disabled}))})),this.getHuddleAttendees()}ngOnInit(){}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=m(p({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in HuddleToolComponent ngOnChanges: ",t)}}ngAfterViewInit(){try{this.subscriptions.push(this.domService.subscribeInjectCustomCss(this.elementRef));let e=document.querySelector(M.TAGS.SNIPPYLY_HUDDLE_TOOL),t=document.querySelector(M.TAGS.VELT_HUDDLE_TOOL);t||e?t?this.veltId===t?.getAttribute(M.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(i=>m(p({},i),{isFirstComponent:!0})),this.checkToAutoJoinHuddle()):this.veltId===e?.getAttribute(M.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(i=>m(p({},i),{isFirstComponent:!0})),this.checkToAutoJoinHuddle()):(document.querySelector(M.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(M.TAGS.SUPERFLOW_TOOLBAR))&&(this.componentConfigSignal.update(i=>m(p({},i),{isFirstComponent:!0})),this.checkToAutoJoinHuddle())}catch(e){this.loggingService.catch("Error in HuddleToolComponent AfterViewInit: ",e)}}onButtonSlotChange(){this.customButtonAdded=!0}checkToAutoJoinHuddle(){try{if(this.componentConfigSignal().user&&this.componentConfigSignal().isFirstComponent){let e=sessionStorage.getItem(M.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA);if(e&&!this.huddleStarted){let t=JSON.parse(e).type;this.joinHuddle(t)}}}catch(e){this.loggingService.catch("Error in checkToAutoJoinHuddle: ",e)}}getHuddleAttendees(){this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(e=>{try{e?(this.componentConfigSignal.update(t=>m(p({},t),{huddleAttendees:e.slice()})),this.huddleStarted=!!e?.length,(this.componentConfigSignal().meetingJoined||!this.componentConfigSignal().huddleAttendees?.length)&&this.componentConfigSignal.update(t=>m(p({},t),{bannerRemoved:!1})),this.componentConfigSignal.update(t=>m(p({},t),{meetingJoined:!!e.find(i=>i?.userSnippylyId===this.componentConfigSignal().user?.userSnippylyId)})),this.componentConfigSignal().huddleAttendees?.length&&(this.initialHuddleType=this.componentConfigSignal().huddleAttendees[0].initialHuddleType)):(this.huddleStarted=!1,this.componentConfigSignal.update(t=>m(p({},t),{meetingJoined:!1})),this.componentConfigSignal.update(t=>m(p({},t),{bannerRemoved:!1})),this.componentConfigSignal.update(t=>m(p({},t),{huddleAttendees:[]})),this.initialHuddleType="audio")}catch(t){this.loggingService.catch("Error in HuddleToolComponent getHuddleAttendees:",t)}}))}onHuddleToolClick(e){try{if(this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_TOOL_CLICKED,{huddleType:e,toolType:this.customButtonAdded?`custom - ${this.componentConfigSignal().type}`:`default - ${this.componentConfigSignal().type}`}),this.componentConfigSignal().disabled){this.loggingService.catch("Huddle feature is disabled.");return}this.joinHuddle(e)}catch(t){this.loggingService.catch("Error in HuddleToolComponent onHuddleToolClick:",t)}}onJoinButtonClick(){try{this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_JOIN_BUTTON_CLICKED,{huddleType:this.initialHuddleType,huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.joinHuddle(void 0)}catch(e){this.loggingService.catch("Error in HuddleToolComponent onJoinButtonClick:",e)}}joinHuddle(e){return y(this,null,function*(){try{e?this.huddleStarted||(this.initialHuddleType=e||"audio"):e=this.initialHuddleType||"audio";let t=this.huddleService.getHuddleSessionData();if(this.componentConfigSignal().meetingJoined&&(yield this.dropCall(),yield zt(1e3)),!this.componentConfigSignal().meetingJoined)if(this.componentConfigSignal().user&&!this.componentConfigSignal().meetingJoined){this.huddleService.setHuddleToolComponentId(this.veltId);let i=M.HUDDLE_TYPE_CONFIGS[e],a=JSON.parse(JSON.stringify(i));i&&(a.audio=t?!!t.audio:i.audio,a.video=t?!!t.video:i.video,a.presentation=t?!!t.presentation:i.presentation,yield this.huddleService.setLocalStream(p({},a)),(t?t?.presentation:i.presentation)&&!this.huddleStarted?yield this.huddleService.setScreenSharingStream():a.presentation=!1,this.huddleService.updateHuddleSessionData("","",p({type:e},a)),this.componentConfigSignal.update(c=>m(p({},c),{meetingJoined:!0})),this.huddleService.joinHuddle(this.initialHuddleType),this.componentConfigSignal().huddleAttendees?.length?(this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_JOINED,{huddleType:this.initialHuddleType,totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(c=>c?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(c=>c?.userId)}),this.huddleService.updateNotificationsDatabase({actionType:Fe.JOINED})):(this.huddleService.clearHuddleInvitees(),this.analyticsService.trackEvent(V.Events.Huddle.HUDDLE_CREATED,{huddleType:this.initialHuddleType,totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(c=>c?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(c=>c?.userId)}),this.huddleService.updateNotificationsDatabase({actionType:Fe.CREATED})))}else this.componentConfigSignal().user||this.loggingService.catch("Velt sdk not authenticated.")}catch(t){this.loggingService.catch("Error in HuddleToolComponent joinHuddle:",t)}})}toggleAudio(){try{this.huddleService.updateHuddleSessionData("audio",!this.componentConfigSignal().localStreamState?.audioState),this.huddleService.toggleLocalStreamAudio()}catch(e){this.loggingService.catch("Error in HuddleToolComponent toggleAudio:",e)}}toggleVideo(){try{this.huddleService.updateHuddleSessionData("video",!this.componentConfigSignal().localStreamState?.videoState),this.huddleService.toggleLocalStreamVideo()}catch(e){this.loggingService.catch("Error in HuddleToolComponent toggleVideo:",e)}}toggleScreenSharing(){return y(this,null,function*(){try{this.huddleService.updateHuddleSessionData("presentation",!this.componentConfigSignal().localStreamState?.screenSharingState),yield this.huddleService.toggleLocalScreenSharing()}catch(e){this.loggingService.catch("Error in HuddleToolComponent toggleScreenSharing:",e)}})}dropCall(){return y(this,null,function*(){try{this.componentConfigSignal.update(e=>m(p({},e),{huddleAttendees:[]})),yield this.huddleService.dropCall(),yield this.huddleService.removeLocalStream(),yield this.huddleService.removeAttendee()}catch(e){this.loggingService.catch("Error in HuddleToolComponent dropCall:",e)}})}copyUrl(){Ie(window.location.href)}removeBanner(){try{this.componentConfigSignal.update(e=>m(p({},e),{bannerRemoved:!0}))}catch(e){this.loggingService.catch("Error in HuddleToolComponent removeBanner:",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in HuddleToolComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in HuddleToolComponent unsubscribe: ",e)}}};o.\u0275fac=function(t){return new(t||o)(I(le),I(se),I(R),I(on),I(w),I(nn),I(_e),I(ue))},o.\u0275cmp=G({type:o,selectors:[["snippyly-huddle-tool"]],hostVars:2,hostBindings:function(t,i){t&2&&K("data-velt-id",i.veltId)("data-velt-element",i.veltElement)},inputs:{type:"type"},standalone:!1,features:[rt,ne],decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["allMenu","matMenu"],["overlay","cdkConnectedOverlay"],["huddleBannerTrigger","cdkOverlayOrigin"],["allMenuTrigger","matMenuTrigger"],[4,"ngIf"],["part","container","cdkOverlayOrigin","",1,"huddle-tool-container",3,"ngSwitch"],[3,"click",4,"ngSwitchCase"],[3,"ngIf"],[3,"matMenuTriggerFor",4,"ngSwitchCase"],[1,"velt-menu","huddle-all-menu-panel"],["mat-menu-item","",3,"click","disabled"],["width","25","height","24","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M5.5 14.625C5.5 14.1609 5.68437 13.7158 6.01256 13.3876C6.34075 13.0594 6.78587 12.875 7.25 12.875H8.125C8.58913 12.875 9.03425 13.0594 9.36244 13.3876C9.69063 13.7158 9.875 14.1609 9.875 14.625V17.25C9.875 17.7141 9.69063 18.1592 9.36244 18.4874C9.03425 18.8156 8.58913 19 8.125 19H7.25C6.78587 19 6.34075 18.8156 6.01256 18.4874C5.68437 18.1592 5.5 17.7141 5.5 17.25V14.625ZM5.5 14.625V12C5.5 10.1435 6.2375 8.36301 7.55025 7.05025C8.86301 5.7375 10.6435 5 12.5 5C14.3565 5 16.137 5.7375 17.4497 7.05025C18.7625 8.36301 19.5 10.1435 19.5 12V14.625M19.5 14.625C19.5 14.1609 19.3156 13.7158 18.9874 13.3876C18.6592 13.0594 18.2141 12.875 17.75 12.875H16.875C16.4109 12.875 15.9658 13.0594 15.6376 13.3876C15.3094 13.7158 15.125 14.1609 15.125 14.625V17.25C15.125 17.7141 15.3094 18.1592 15.6376 18.4874C15.9658 18.8156 16.4109 19 16.875 19H17.75C18.2141 19 18.6592 18.8156 18.9874 18.4874C19.3156 18.1592 19.5 17.7141 19.5 17.25V14.625Z","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M15.1667 10.2228L19.2138 8.19966C19.3493 8.13195 19.4998 8.09999 19.6511 8.10681C19.8024 8.11362 19.9495 8.15899 20.0783 8.23859C20.2072 8.3182 20.3135 8.42941 20.3873 8.56167C20.4611 8.69394 20.4999 8.84286 20.5 8.99432V15.0068C20.4999 15.1582 20.4611 15.3072 20.3873 15.4394C20.3135 15.5717 20.2072 15.6829 20.0783 15.7625C19.9495 15.8421 19.8024 15.8875 19.6511 15.8943C19.4998 15.9011 19.3493 15.8691 19.2138 15.8014L15.1667 13.7783V10.2228Z","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M4.5 8.44445C4.5 7.97295 4.6873 7.52077 5.0207 7.18737C5.3541 6.85397 5.80628 6.66667 6.27778 6.66667H13.3889C13.8604 6.66667 14.3126 6.85397 14.646 7.18737C14.9794 7.52077 15.1667 7.97295 15.1667 8.44445V15.5556C15.1667 16.0271 14.9794 16.4792 14.646 16.8126C14.3126 17.146 13.8604 17.3333 13.3889 17.3333H6.27778C5.80628 17.3333 5.3541 17.146 5.0207 16.8126C4.6873 16.4792 4.5 16.0271 4.5 15.5556V8.44445Z","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["mat-menu-item","",3,"disabled","click",4,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayPositions","cdkConnectedOverlayDisableClose"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions"],[3,"click"],["name","button",3,"slotchange"],["part","button-container",1,"action-btn"],["part","button-icon","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M5.5 14.625C5.5 14.1609 5.68437 13.7158 6.01256 13.3876C6.34075 13.0594 6.78587 12.875 7.25 12.875H8.125C8.58913 12.875 9.03425 13.0594 9.36244 13.3876C9.69063 13.7158 9.875 14.1609 9.875 14.625V17.25C9.875 17.7141 9.69063 18.1592 9.36244 18.4874C9.03425 18.8156 8.58913 19 8.125 19H7.25C6.78587 19 6.34075 18.8156 6.01256 18.4874C5.68437 18.1592 5.5 17.7141 5.5 17.25V14.625ZM5.5 14.625V12C5.5 10.1435 6.2375 8.36301 7.55025 7.05025C8.86301 5.7375 10.6435 5 12.5 5C14.3565 5 16.137 5.7375 17.4497 7.05025C18.7625 8.36301 19.5 10.1435 19.5 12V14.625M19.5 14.625C19.5 14.1609 19.3156 13.7158 18.9874 13.3876C18.6592 13.0594 18.2141 12.875 17.75 12.875H16.875C16.4109 12.875 15.9658 13.0594 15.6376 13.3876C15.3094 13.7158 15.125 14.1609 15.125 14.625V17.25C15.125 17.7141 15.3094 18.1592 15.6376 18.4874C15.9658 18.8156 16.4109 19 16.875 19H17.75C18.2141 19 18.6592 18.8156 18.9874 18.4874C19.3156 18.1592 19.5 17.7141 19.5 17.25V14.625Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["part","button-icon","width","25","height","24","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M15.1667 10.2228L19.2138 8.19966C19.3493 8.13195 19.4998 8.09999 19.6511 8.10681C19.8024 8.11362 19.9495 8.15899 20.0783 8.23859C20.2072 8.3182 20.3135 8.42941 20.3873 8.56167C20.4611 8.69394 20.4999 8.84286 20.5 8.99432V15.0068C20.4999 15.1582 20.4611 15.3072 20.3873 15.4394C20.3135 15.5717 20.2072 15.6829 20.0783 15.7625C19.9495 15.8421 19.8024 15.8875 19.6511 15.8943C19.4998 15.9011 19.3493 15.8691 19.2138 15.8014L15.1667 13.7783V10.2228Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M4.5 8.44445C4.5 7.97295 4.6873 7.52077 5.0207 7.18737C5.3541 6.85397 5.80628 6.66667 6.27778 6.66667H13.3889C13.8604 6.66667 14.3126 6.85397 14.646 7.18737C14.9794 7.52077 15.1667 7.97295 15.1667 8.44445V15.5556C15.1667 16.0271 14.9794 16.4792 14.646 16.8126C14.3126 17.146 13.8604 17.3333 13.3889 17.3333H6.27778C5.80628 17.3333 5.3541 17.146 5.0207 16.8126C4.6873 16.4792 4.5 16.0271 4.5 15.5556V8.44445Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M19 12V14.1667C19 14.3582 18.9239 14.5419 18.7885 14.6773C18.653 14.8128 18.4693 14.8889 18.2778 14.8889H6.72222C6.53068 14.8889 6.34698 14.8128 6.21153 14.6773C6.07609 14.5419 6 14.3582 6 14.1667V6.94444C6 6.75289 6.07609 6.56919 6.21153 6.43375C6.34698 6.2983 6.53068 6.22221 6.72222 6.22221H13.2222M8.88889 17.7778H16.1111M10.3333 14.8889V17.7778M14.6667 14.8889V17.7778M16.1111 6.22221H19M19 6.22221V9.1111M19 6.22221L15.3889 9.83333","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],[3,"matMenuTriggerFor"],["part","button-container",1,"action-btn","action-dropdown"],["part","button-icon","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon","action-dropdown-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",1,"toolbar-icon-dropdown-arrow"],["fill-rule","evenodd","clip-rule","evenodd","d","M12.2071 5.79289C11.8166 5.40237 11.1834 5.40237 10.7929 5.79289L8 8.58579L5.20711 5.79289C4.81658 5.40237 4.18342 5.40237 3.79289 5.79289C3.40237 6.18342 3.40237 6.81658 3.79289 7.20711L7.29289 10.7071C7.68342 11.0976 8.31658 11.0976 8.70711 10.7071L12.2071 7.20711C12.5976 6.81658 12.5976 6.18342 12.2071 5.79289Z","fill","currentColor"],["d","M19 12V14.1667C19 14.3582 18.9239 14.5419 18.7885 14.6773C18.653 14.8128 18.4693 14.8889 18.2778 14.8889H6.72222C6.53068 14.8889 6.34698 14.8128 6.21153 14.6773C6.07609 14.5419 6 14.3582 6 14.1667V6.94444C6 6.75289 6.07609 6.56919 6.21153 6.43375C6.34698 6.2983 6.53068 6.22221 6.72222 6.22221H13.2222M8.88889 17.7778H16.1111M10.3333 14.8889V17.7778M14.6667 14.8889V17.7778M16.1111 6.22221H19M19 6.22221V9.1111M19 6.22221L15.3889 9.83333","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],[3,"veltDraggableOverlay","attendees","user","audioState","videoState","screenSharingState","toggleAudio","toggleVideo","toggleScreenSharing","leave",4,"ngIf"],[3,"toggleAudio","toggleVideo","toggleScreenSharing","leave","veltDraggableOverlay","attendees","user","audioState","videoState","screenSharingState"],["class","huddle-banner",4,"ngIf"],[1,"huddle-banner"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 17C11.45 17 11 16.55 11 16V12C11 11.45 11.45 11 12 11C12.55 11 13 11.45 13 12V16C13 16.55 12.55 17 12 17ZM13 9H11V7H13V9Z","fill","#625DF5"],[1,"title"],[1,"subtitle"],[1,"action-btn-container"],[1,"join-btn",3,"click"],[1,"cancel-btn",3,"click"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#777E91"]],template:function(t,i){t&1&&_(0,Ji,29,27,"ng-container",5),t&2&&g("ngIf",i.componentConfigSignal())},dependencies:[J,vt,Ct,ke,xe,Ut,Dt,Lt,ln,Ze,Q],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;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*:empty{display:revert!important}.huddle-tool-container{width:max-content}.icon-btn{border:1px solid #2d2d2d;border-radius:100%;width:40px!important;height:40px!important;display:flex;align-items:center;justify-content:center;color:#2d2d2d!important;fill:#2d2d2d!important;cursor:pointer}.icon-btn:hover{background:#fff5}.icon-btn.background-red{background:red!important;border-color:red!important;color:#fff!important;fill:#fff!important}.icon-btn.background-royalblue{background:#4169e1!important;border-color:#4169e1!important}.icon-btn:before{content:""}.drop-call-btn{transform:rotate(135deg)!important}.action-btn{display:inline-flex;justify-content:center;align-items:center;padding:6px!important;border-radius:var(--legacy-velt-tool-border-radius);border:var(--legacy-velt-tool-border);background-color:var(--legacy-velt-tool-bg-color);color:var(--legacy-velt-tool-icon-color);cursor:pointer}.action-btn .action-btn-label{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;padding-right:4px!important;font-weight:700!important;color:currentColor!important}.action-btn .action-btn-icon{width:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));color:currentColor}.action-btn .toolbar-icon-dropdown-arrow{width:16px;height:16px;color:currentColor}.action-btn:focus{border-radius:var(--legacy-velt-tool-focus-border-radius);border:var(--legacy-velt-tool-focus-border);background-color:var(--legacy-velt-tool-focus-bg-color);color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:focus .action-btn-icon{width:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:focus .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:hover{border-radius:var(--legacy-velt-tool-hover-border-radius);border:var(--legacy-velt-tool-hover-border);background-color:var(--legacy-velt-tool-hover-bg-color);color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:hover .action-btn-icon{width:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:hover .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:active,.action-btn.active{border-radius:var(--legacy-velt-tool-active-border-radius);border:var(--legacy-velt-tool-active-border);background-color:var(--legacy-velt-tool-active-bg-color);color:var(--legacy-velt-tool-active-icon-color)}.action-btn:active .action-btn-icon,.action-btn.active .action-btn-icon{width:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:active .toolbar-icon-dropdown-arrow,.action-btn.active .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-active-icon-color)}
3
3
  `],encapsulation:3,changeDetection:0});let r=o;return r})();var pn=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=it({type:o}),o.\u0275inj=Qe({imports:[St,Et,Ot,bt,ft,Bt,Vt,pe,Te]});let r=o;return r})();var Ue=class extends an{constructor(o){super(o),this.getService(w).log("%c[WB] Creating CLASS: HuddleElement","color: blue;"),this.enableCursorMode=this._enableCursorMode,this.disableCursorMode=this._disableCursorMode,this.enableChat=this._enableChat,this.disableChat=this._disableChat,this.enableFlockModeOnAvatarClick=this._enableFlockModeOnAvatarClick,this.disableFlockModeOnAvatarClick=this._disableFlockModeOnAvatarClick}_enableCursorMode(){this.getService(w).log("%c[WB] Calling FUNCTION: _enableCursorMode","color: green;");try{this.trackEvent(V.Events.Huddle.ENABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED),this.getService(R).enableHuddleOnCursorMode()}catch(o){this.getService(w).catch("Error in enableCursorMode: ",o)}}_disableCursorMode(){this.getService(w).log("%c[WB] Calling FUNCTION: _disableCursorMode","color: green;");try{this.trackEvent(V.Events.Huddle.DISABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED),this.getService(R).disableHuddleOnCursorMode()}catch(o){this.getService(w).catch("Error in disableCursorMode: ",o)}}_enableChat(){this.getService(w).log("%c[WB] Calling FUNCTION: _enableChat","color: green;");try{this.trackEvent(V.Events.Huddle.ENABLE_CHAT_TRIGGERED),this.getService(R).enableChat()}catch(o){this.getService(w).catch("Error in enableChat: ",o)}}_disableChat(){this.getService(w).log("%c[WB] Calling FUNCTION: _disableChat","color: green;");try{this.trackEvent(V.Events.Huddle.DISABLE_CHAT_TRIGGERED),this.getService(R).disableChat()}catch(o){this.getService(w).catch("Error in disableChat: ",o)}}_enableFlockModeOnAvatarClick(){this.getService(w).log("%c[WB] Calling FUNCTION: _enableFlockModeOnAvatarClick","color: green;");try{this.trackEvent(V.Events.Huddle.ENABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED),this.getService(R).enableFlockModeOnAvatarClick()}catch(o){this.getService(w).catch("Error in enableFlockModeOnAvatarClick: ",o)}}_disableFlockModeOnAvatarClick(){this.getService(w).log("%c[WB] Calling FUNCTION: _disableFlockModeOnAvatarClick","color: green;");try{this.trackEvent(V.Events.Huddle.DISABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED),this.getService(R).disableFlockModeOnAvatarClick()}catch(o){this.getService(w).catch("Error in disableFlockModeOnAvatarClick: ",o)}}};function Yi(r){r.get(w).log("%c[WB] Loading huddle feature chunk","color: blue;");let n=r.get(Me);n.set(Jt,r.get(R)),n.set(Yt,r.get(Ae));let t=nt(pn,r).injector;return Le(t,M.TAGS.VELT_HUDDLE,Ve),Le(t,M.TAGS.SNIPPYLY_HUDDLE,Ve),Le(t,M.TAGS.VELT_HUDDLE_TOOL,De),Le(t,M.TAGS.SNIPPYLY_HUDDLE_TOOL,De),new Ue(r)}function Le(r,o,n){if(customElements.get(o))return;let e=xt(n,{injector:r});customElements.define(o,e)}export{Yi as default};