@veltdev/sdk-dev 6.0.8-beta.3 → 6.0.8-beta.4

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 (62) hide show
  1. package/app/models/data/comment-action.data.model.d.ts +55 -0
  2. package/app/models/data/comment-annotation.data.model.d.ts +11 -0
  3. package/app/models/data/comment-events.data.model.d.ts +52 -0
  4. package/app/models/data/comment-progress.data.model.d.ts +127 -0
  5. package/app/models/data/comment.data.model.d.ts +29 -0
  6. package/app/models/element/comment-element.model.d.ts +9 -0
  7. package/app/utils/enums.d.ts +1 -0
  8. package/{chunk-SF2KIWKT.js → chunk-2VSCJ7FP.js} +1 -1
  9. package/{chunk-XXJBBXBG.js → chunk-3W7PWPIA.js} +1 -1
  10. package/{chunk-3XNLR5I6.js → chunk-44QKIIUD.js} +1 -1
  11. package/{chunk-OSXZUDM4.js → chunk-4NY6TY72.js} +1 -1
  12. package/{chunk-33F6VZ2D.js → chunk-4Z6JEK4C.js} +1 -1
  13. package/{chunk-IOANBPOF.js → chunk-54WPSIBC.js} +1 -1
  14. package/{chunk-AVALXKWQ.js → chunk-5AD56Z43.js} +1 -1
  15. package/{chunk-HNZ452CD.js → chunk-5AXDQN2Z.js} +1 -1
  16. package/{chunk-5YU74OX2.js → chunk-67WASIND.js} +1 -1
  17. package/{chunk-HCZGU3VQ.js → chunk-6ARAZSKF.js} +1 -1
  18. package/{chunk-VGZY4BCZ.js → chunk-6GPW7ZK5.js} +1 -1
  19. package/{chunk-FSDMNA2X.js → chunk-6VS6CXUM.js} +1 -1
  20. package/{chunk-FXBACOQJ.js → chunk-C45R3XT6.js} +1 -1
  21. package/{chunk-QU2E3FYA.js → chunk-C6NXU52W.js} +1 -1
  22. package/{chunk-JPCBTXDG.js → chunk-F4COO6HD.js} +1 -1
  23. package/{chunk-Y6KJEASI.js → chunk-F5F6L463.js} +1 -1
  24. package/{chunk-E4HJ7YKV.js → chunk-K47CMSNK.js} +1 -1
  25. package/{chunk-24U4LEAT.js → chunk-KGSCJNID.js} +1 -1
  26. package/{chunk-F46FHE6O.js → chunk-LC33EWB5.js} +1 -1
  27. package/{chunk-QNQ45SC7.js → chunk-MIVF7JMQ.js} +1 -1
  28. package/{chunk-QGHDOJHE.js → chunk-PPIN2ZDO.js} +1 -1
  29. package/{chunk-NUVYBRLN.js → chunk-PSDDJB4F.js} +1 -1
  30. package/{chunk-RTIZJ4JW.js → chunk-RD4WD7HR.js} +1 -1
  31. package/{chunk-WNW7AS77.js → chunk-T4Z2W6NR.js} +1 -1
  32. package/{chunk-H2PBKB34.js → chunk-TYOTWEG4.js} +1 -1
  33. package/{chunk-XA3PEI3J.js → chunk-UGQYGMGF.js} +1 -1
  34. package/{chunk-FIFNF23O.js → chunk-UZW6GB3Q.js} +1 -1
  35. package/{chunk-JGICU6Z4.js → chunk-WNQGJ6NQ.js} +1 -1
  36. package/{chunk-LFEKCFWQ.js → chunk-WUADE2PV.js} +1 -1
  37. package/{chunk-NVHVXSVC.js → chunk-YMLBHLGQ.js} +1 -1
  38. package/{chunk-CRZGZZVQ.js → chunk-YTAAOIBL.js} +9 -9
  39. package/{chunk-HG6W5JZA.js → chunk-Z4PTG3MC.js} +1 -1
  40. package/{chunk-U4GFMH6I.js → chunk-ZDDZXCPC.js} +1 -1
  41. package/models.d.ts +2 -0
  42. package/package.json +1 -1
  43. package/velt-activity-log.js +1 -1
  44. package/velt-area.js +1 -1
  45. package/velt-arrow.js +1 -1
  46. package/velt-comment.js +7 -7
  47. package/velt-crdt.js +1 -1
  48. package/velt-cursor.js +1 -1
  49. package/velt-huddle.js +1 -1
  50. package/velt-live-state-sync.js +1 -1
  51. package/velt-notification.js +1 -1
  52. package/velt-presence.js +1 -1
  53. package/velt-reaction.js +1 -1
  54. package/velt-recorder.js +1 -1
  55. package/velt-rewriter.js +1 -1
  56. package/velt-selection.js +1 -1
  57. package/velt-tag.js +1 -1
  58. package/velt-user-invite.js +1 -1
  59. package/velt-user-request.js +1 -1
  60. package/velt-video-player.js +1 -1
  61. package/velt-views.js +1 -1
  62. package/velt.js +3 -3
@@ -1 +1 @@
1
- import{$ as c,B as s,J as a,ca as n,ki as h,l as o}from"./chunk-CRZGZZVQ.js";var u=(()=>{let r=class r{constructor(t){this.loggingService=t,this.toasts$=new o([])}setToast(t){try{t.id||(t.id=Math.random()),this.toasts$.next([...this.toasts$.value,t]),t.duration&&t.duration>0&&s(t.duration).pipe(a(1)).subscribe(()=>{this.removeToast(t)},i=>{this.loggingService.catch("Error in ToastService setToast timer subscription: ",i)})}catch(i){this.loggingService.catch("Error in ToastService setToast: ",i)}}removeToast(t){try{this.toasts$.next(this.toasts$.value.filter(i=>i.id!==t.id))}catch(i){this.loggingService.catch("Error in ToastService removeToast: ",i)}}getToasts$(){return this.toasts$.asObservable()}};r.\u0275fac=function(i){return new(i||r)(n(h))},r.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"});let e=r;return e})();export{u as a};
1
+ import{$ as c,B as s,J as a,ca as n,ki as h,l as o}from"./chunk-YTAAOIBL.js";var u=(()=>{let r=class r{constructor(t){this.loggingService=t,this.toasts$=new o([])}setToast(t){try{t.id||(t.id=Math.random()),this.toasts$.next([...this.toasts$.value,t]),t.duration&&t.duration>0&&s(t.duration).pipe(a(1)).subscribe(()=>{this.removeToast(t)},i=>{this.loggingService.catch("Error in ToastService setToast timer subscription: ",i)})}catch(i){this.loggingService.catch("Error in ToastService setToast: ",i)}}removeToast(t){try{this.toasts$.next(this.toasts$.value.filter(i=>i.id!==t.id))}catch(i){this.loggingService.catch("Error in ToastService removeToast: ",i)}}getToasts$(){return this.toasts$.asObservable()}};r.\u0275fac=function(i){return new(i||r)(n(h))},r.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"});let e=r;return e})();export{u as a};
@@ -1 +1 @@
1
- import{Ea as ie}from"./chunk-SF2KIWKT.js";import{$ as K,$e as R,Cf as $,Ch as E,Df as _,Dh as V,Ee as N,Ef as A,Ff as T,Fi as Q,Gi as ee,Hi as re,L as w,Mf as L,Od as W,Pi as se,Vf as M,_e as U,a as f,af as I,b as y,be as v,ca as P,da as x,g,ki as X,l as D,li as q,oi as H,qh as b,qi as Y,tf as S,th as j,ti as Z,uf as l,uh as B,v as G,wh as J,xh as z,zh as F}from"./chunk-CRZGZZVQ.js";var p="public",ye=(()=>{let O=class O{constructor(e,r,s,i,t,o,c,a,n,d){this.authService=e,this.docService=r,this.loggingService=s,this.commonDbService=i,this.usersService=t,this.commentUtilsService=o,this.coreActionsService=c,this.functions=a,this.configService=n,this.contactService=d,this.endpointsService=x(H),this.currentUserPermissions$=new D(null),this.permissionsCache$=new D(null),this.permissionProvider$=new D(null),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.requestKeyedPermissionsCache=new Map,this.inFlightPermissionsRequests=new Map,this.permissionsCacheGeneration=0,this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="";try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(h){this.loggingService.catch("Error in UserPermissionService constructor:",h)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,r,s,i,t,o){try{return e.find(a=>a.resourceId===s&&a.type===i&&a.organizationId===t&&a.userId===o)?(r.push({userId:o,resourceId:s,organizationId:t,type:i,hasAccess:!1}),e.filter(a=>!(a.resourceId===s&&a.type===i&&a.organizationId===t&&a.userId===o))):e}catch(c){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",c),e}}hasUserContextAccess({userId:e,accessFields:r}){try{if(!this.getIsContextEnabled()||r.includes(N.DEFAULT_VELT_CONTEXT))return!0;let s=r.filter(t=>!L(t));if(!s.length){if(r.some(c=>c.startsWith(N.VISIBILITY_ORG_PREFIX)))return!0;let o=`${N.VISIBILITY_SELF_PREFIX}${$(e).toString()}`;return r.includes(o)}let i=this.contactService.getUserAccessFieldsByUserId(e);return i?.length?s.every(t=>i.includes(t)):!0}catch(s){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",s),!1}}organizationDetails(e){return g(this,null,function*(){try{let r=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e,suppressError:!0}});return r&&r?.errorCode?{errorCode:l.PERMISSION_DENIED,error:!0}:r&&!r?.metadata?{errorCode:l.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(r){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",r),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(s){return g(this,arguments,function*({documentId:e,organizationId:r}){try{let i=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:r,suppressError:!0}});if(i&&i?.errorCode)return{errorCode:l.PERMISSION_DENIED,error:!0};if(i&&!i?.metadata)return{errorCode:l.DOES_NOT_EXIST,error:!0};let t=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,f(f({},t),i?.metadata??{}));let o,c=i?.metadata?.veltFolderId;if(c)try{o=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:c,organizationId:r}}))?.folderIamConfig?.accessType}catch(a){this.loggingService.catch("Error fetching folder accessType for document:",a)}return o||(o=i?.docIamConfig?.accessType),{error:!1,accessType:o}}catch(i){return this.loggingService.catch("Error in UserPermissionService documentDetails:",i),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(s){return g(this,arguments,function*({folderId:e,organizationId:r}){try{let i=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:r,suppressError:!0}});return i&&i?.errorCode?{errorCode:l.PERMISSION_DENIED,error:!0}:i&&!i?.metadata?{errorCode:l.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:i?.folderIamConfig?.accessType}}catch(i){return this.loggingService.catch("Error in UserPermissionService folderDetails:",i),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return g(this,null,function*(){let r=this.permissionsCacheGeneration;try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let s=this.authService.getUser()?.userId,i=this.extractResourceIds(e);if(!i.clientOrganizationId||!i.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let t=yield this.validateResources(i),[o,c]=yield this.fetchUserPermissionsFromDB(i),a=this.authService.getUser()?.userId;if(s!==a)return{};let n=this.buildPermissionsResponse(i,t,o,c);if(Object.keys(n).length>0){if(!e)this.setCurrentUserPermissions(n);else if(this.permissionsCacheGeneration===r){let d=this.buildPermissionsCacheKey(e);d!==null&&this.requestKeyedPermissionsCache.set(d,JSON.parse(JSON.stringify(n)))}}return n}catch(s){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",s),{}}})}getUserPermissionsFromCacheOrFetch(e){return g(this,null,function*(){try{if(!e)return yield this.getUserPermissions(e);let r=this.buildPermissionsCacheKey(e);if(r===null)return yield this.getUserPermissions(e);let s=this.permissionsCacheGeneration,i=this.requestKeyedPermissionsCache.get(r);if(i)return JSON.parse(JSON.stringify(i));let t=this.inFlightPermissionsRequests.get(r);if(t){let a=yield t;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(a))}let o=this.getUserPermissions(e);this.inFlightPermissionsRequests.set(r,o),o.finally(()=>{this.inFlightPermissionsRequests.get(r)===o&&this.inFlightPermissionsRequests.delete(r)}).catch(()=>{});let c=yield o;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(c))}catch(r){return this.loggingService.catch("Error in UserPermissionService getUserPermissionsFromCacheOrFetch:",r),{}}})}clearRequestKeyedPermissionsCache(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService clearRequestKeyedPermissionsCache:",e)}}invalidateAllPermissionsState(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService invalidateAllPermissionsState:",e)}}buildPermissionsCacheKey(e){try{let r={};return Object.keys(e).sort().forEach(s=>{let i=e[s];i!==void 0&&(r[s]=Array.isArray(i)?[...i].sort():i)}),r.__userId=this.authService.getUser()?.userId??null,JSON.stringify(r)}catch(r){return this.loggingService.catch("Error in UserPermissionService buildPermissionsCacheKey:",r),null}}extractResourceIds(e){let r=this.docService.getDocumentPaths(),s=this.docService.getDocumentIds();if(e){let o=e.organizationId??r?.clientOrganizationId;return{folderIds:e.folderIds??[],documentIds:e.documentIds??[],clientOrganizationId:o,organizationId:o?A(o):void 0}}let i=r?.clientOrganizationId;return{folderIds:r?.folderId?[r.folderId]:[],documentIds:s.map(o=>o.clientDocumentId),clientOrganizationId:i,organizationId:i?A(i):void 0}}validateResources(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:i,clientOrganizationId:t}=e,o=[],c=[],a=r.length>0||s.length>0;i&&!a&&(o.push(this.organizationDetails(i)),c.push({id:t??"",type:"organization"})),r.forEach(u=>{o.push(this.folderDetails({folderId:T(u),organizationId:i??""})),c.push({id:u,type:"folder"})}),s.forEach(u=>{o.push(this.documentDetails({documentId:_(u),organizationId:i??""})),c.push({id:u,type:"document"})});let[n,d]=yield Promise.all([Promise.allSettled(o),this.getDefaultDocumentAccessType()]),h=this.processValidationResults(n,c);return y(f({},this.suppressResolverGrantedFailures(h,t)),{defaultDocumentAccessType:d})})}suppressResolverGrantedFailures(e,r){try{let s=this.authService.getUser()?.userId;if(!s)return e;let i=this.getPermissionsCache()??[];if(i.length===0)return e;let t=(n,d,h)=>i.some(u=>u?.userId===s&&u?.resourceId===n&&u?.type===d&&(!h||u?.organizationId===h)&&u?.hasAccess===!0),o=e.failedDocumentIds.filter(n=>!(n.errorCode===l.PERMISSION_DENIED&&t(n.id,I.DOCUMENT,r))),c=e.failedFolderIds.filter(n=>!(n.errorCode===l.PERMISSION_DENIED&&t(n.id,I.FOLDER,r))),a=e.failedOrganizationId;return a&&a.errorCode===l.PERMISSION_DENIED&&r&&t(r,I.ORGANIZATION,r)&&(a=void 0),{failedFolderIds:c,failedDocumentIds:o,failedOrganizationId:a,folderAccessTypes:e.folderAccessTypes,documentAccessTypes:e.documentAccessTypes}}catch(s){return this.loggingService.catch("Error in UserPermissionService suppressResolverGrantedFailures:",s),e}}getDefaultDocumentAccessType(){return g(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,r){let s=[],i=[],t,o={},c={};for(let a=0;a<e.length;a++){let n=e[a],d=r[a];if(n.status==="rejected"||n.status==="fulfilled"&&n.value.error){let u=n.status==="fulfilled"?n.value.errorCode??l.SOMETHING_WENT_WRONG:l.SOMETHING_WENT_WRONG,m={id:d.id,errorCode:u};switch(d.type){case"organization":if(t=m,u===l.DOES_NOT_EXIST)throw new Error(`Organization with id '${d.id}' does not exist`);break;case"folder":s.push(m);break;case"document":i.push(m);break}}else if(n.status==="fulfilled")switch(d.type){case"folder":n.value.accessType&&(o[d.id]=n.value.accessType);break;case"document":n.value.accessType&&(c[d.id]=n.value.accessType);break}}return{failedFolderIds:s,failedDocumentIds:i,failedOrganizationId:t,folderAccessTypes:o,documentAccessTypes:c}}fetchUserPermissionsFromDB(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:i}=e,t=[this.authService.getUser()?.userId??""],o=[...r.map(n=>T(n)),...s.map(n=>_(n)),i??""],[c,a]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:t,organizationId:i}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:t,organizationId:i,resourceIds:o})]);return[c.status==="fulfilled"?c.value:[],a.status==="fulfilled"?a.value:[]]})}buildPermissionsResponse(e,r,s,i){let{folderIds:t,documentIds:o,clientOrganizationId:c,organizationId:a}=e,{failedFolderIds:n,failedDocumentIds:d,failedOrganizationId:h}=r,u={};return this.processRegularUserPermissions(u,s,t,o,c??"",a??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.ensureCurrentUserFailuresRecorded(u,c??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.processTemporaryUserPermissions(u,i),this.processContextPermissions(u),u}processContextPermissions(e){try{let r=this.authService.getUser()?.userId;if(r){let s=this.contactService.getUserAccessFieldsByUserId(r);s?.length&&(e[r]||(e[r]={}),e[r].context={accessFields:s})}}catch(r){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",r);return}}processRegularUserPermissions(e,r,s,i,t,o,c,a,n,d,h,u){for(let m of r)for(let C of m)C?.user?.userId&&(e[C.user.userId]=y(f({},s.length&&{folders:this.buildFolderPermissions(s,C,c,d,u)}),{documents:this.buildDocumentPermissions(i,C,a,h,u),organization:{[t]:this.buildOrganizationPermission(o,C,n)}}))}ensureCurrentUserFailuresRecorded(e,r,s,i,t,o,c,a){try{let n=this.authService.getUser()?.userId;if(!n)return;let d=!!t&&!!r,h=(s?.length??0)>0,u=(i?.length??0)>0;if(!d&&!h&&!u)return;if(e[n]||(e[n]={}),d&&(e[n].organization||(e[n].organization={}),e[n].organization[r]||(e[n].organization[r]={error:this.getErrorMessage(t.errorCode,"organization"),errorCode:t.errorCode})),h){e[n].folders||(e[n].folders={});for(let m of s)e[n].folders[m.id]||(e[n].folders[m.id]=f({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===l.PERMISSION_DENIED&&{accessType:o[m.id]??a??p}))}if(u){e[n].documents||(e[n].documents={});for(let m of i)e[n].documents[m.id]||(e[n].documents[m.id]=f({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===l.PERMISSION_DENIED&&{accessType:c[m.id]??a??p}))}}catch(n){this.loggingService.catch("Error in UserPermissionService ensureCurrentUserFailuresRecorded:",n)}}getErrorMessage(e,r){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${r}`),e){case l.DOES_NOT_EXIST:return`${r} does not exist`;case l.PERMISSION_DENIED:return`User does not have access to ${r}`;case l.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(s){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",s),"Something went wrong"}}buildFolderPermissions(e,r,s,i,t){return e.reduce((o,c)=>{let a=s.find(n=>n.id===c);return a?o[c]=f({error:this.getErrorMessage(a.errorCode,"folder"),errorCode:a.errorCode},a.errorCode===l.PERMISSION_DENIED&&{accessType:i[c]??t??p}):o[c]={accessRole:r.viewerFolderIds?.includes(T(c))?S.VIEWER:S.EDITOR,accessType:i[c]??t??p},o},{})}buildDocumentPermissions(e,r,s,i,t){return e.reduce((o,c)=>{let a=s.find(n=>n.id===c);return a?o[c]=f({error:this.getErrorMessage(a.errorCode,"document"),errorCode:a.errorCode},a.errorCode===l.PERMISSION_DENIED&&{accessType:i[c]??t??p}):o[c]={accessRole:r.viewerDocumentIds?.includes(_(c))?S.VIEWER:S.EDITOR,accessType:i[c]??t??p},o},{})}buildOrganizationPermission(e,r,s){return s?{error:this.getErrorMessage(s.errorCode,"organization"),errorCode:s.errorCode}:{accessRole:r.viewerOrganizationIds?.includes(e)?S.VIEWER:S.EDITOR}}processTemporaryUserPermissions(e,r){for(let s of r)if(s?.userId)switch(this.ensureUserPermissionStructure(e,s.userId),s.type){case"folder":this.addTemporaryFolderPermission(e,s);break;case"document":this.addTemporaryDocumentPermission(e,s);break;case"organization":this.addTemporaryOrganizationPermission(e,s);break}}ensureUserPermissionStructure(e,r){e[r]||(e[r]={})}addTemporaryFolderPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].folders||(e[s].folders={}),e[s].folders[i]={accessRole:t??S.EDITOR,expiresAt:o}}addTemporaryDocumentPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].documents||(e[s].documents={}),e[s].documents[i]={accessRole:t??S.EDITOR,expiresAt:o}}addTemporaryOrganizationPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].organization||(e[s].organization={}),e[s].organization[i]={accessRole:t??S.EDITOR,expiresAt:o}}hasEditAccess({organizationId:e,folderId:r,documentId:s}){try{let i=!0,t=this.getCurrentUserPermissionsWithServerIds(),o=this.authService.getUser()?.userId??"";return t&&(e&&typeof e=="string"&&t?.[o]?.organization?.[e]&&(t?.[o]?.organization?.[e]?.accessRole===S.VIEWER||t?.[o]?.organization?.[e]?.errorCode===l.PERMISSION_DENIED)&&(i=!1),r&&typeof r=="string"&&t?.[o]?.folders?.[r]&&(t?.[o]?.folders?.[r]?.accessRole===S.VIEWER||t?.[o]?.folders?.[r]?.errorCode===l.PERMISSION_DENIED)&&(i=!1),s&&typeof s=="string"&&t?.[o]?.documents?.[s]&&(t?.[o]?.documents?.[s]?.accessRole===S.VIEWER||t?.[o]?.documents?.[s]?.errorCode===l.PERMISSION_DENIED)&&(i=!1)),i}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(w(b))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let r=JSON.parse(JSON.stringify(e??{})),s=this.authService.getUser()?.userId??"";if(r?.[s]){let i=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(r?.[s]?.organization?.[i]){let t=A(i);r[s].organization&&(r[s].organization[t]=r[s].organization[i],delete r[s].organization[i])}r?.[s]?.folders&&(r[s].folders=Object.fromEntries(Object.entries(r?.[s]?.folders??{}).map(([t,o])=>[T(t),o]))),r?.[s]?.documents&&(r[s].documents=Object.fromEntries(Object.entries(r?.[s]?.documents??{}).map(([t,o])=>[_(t),o])))}return r}catch(r){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",r),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(G(e=>this.refactorPermissionsWithServerIds(e)),w(b))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let r=null;e&&(r=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(r)}catch(r){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",r)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.permissionProvider$.next(e)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",r)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return g(this,null,function*(){let e=M();try{if(this.isRevokeAccessOnUserLogoutEnabled){let r=[],s=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(t=>{t.userId===s&&t.hasAccess&&(t.type===I.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&r.push(y(f({},t),{hasAccess:!1})):r.push(y(f({},t),{hasAccess:!1})))}),r.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}}),this.setPermissionsCache([]),this.clearRequestKeyedPermissionsCache(),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}});let t=yield this.revokeAccess({requests:r,userId:this.authService.getUser()?.userId??""});t.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:t,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:t,success:!1,statusCode:500}}})}}}catch(r){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:r}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",r)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(r){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",r),""}}cancelPendingRevokes(e){try{e.forEach(r=>{let s=this.getRevokeKey({userId:r.userId,resourceId:r.resource.id,type:r.resource.type,organizationId:r.resource.organizationId});this.pendingRevokeRequests.has(s)&&this.pendingRevokeRequests.delete(s)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(r){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",r)}}flushPendingRevokes(){return g(this,null,function*(){let e=this.pendingRevokeUniqueId,r=this.pendingRevokeUserId;try{let s=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",s.length===0)return;let i=this.getPermissionsCache()??[];s.forEach(c=>{i=i.filter(a=>!(a.resourceId===c.resourceId&&a.type===c.type&&a.organizationId===c.organizationId&&a.userId===c.userId))}),this.setPermissionsCache(i);let t=this.docService.getDocContext(),o=yield this.revokeAccess({requests:s,userId:r,currentContext:t});o.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:o,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:o,success:!1,statusCode:500}}})}catch(s){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:s}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",s)}})}revokeAccessOnDocumentUnset(i){return g(this,arguments,function*({documentIds:e,folderId:r,context:s}){let t=M();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let o=[],c=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.authService.getUser()?.userId??"",n=this.getPermissionsCache()??[];e.forEach(d=>{n=this.collectRevokeRequest(n,o,d.clientDocumentId,I.DOCUMENT,c,a)}),r&&(n=this.collectRevokeRequest(n,o,r,I.FOLDER,c,a)),c&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(n=this.collectRevokeRequest(n,o,c,I.ORGANIZATION,c,a)),s&&this.getIsContextEnabled()&&J({input:s}).forEach(h=>{let u=JSON.stringify(h.access);n=this.collectRevokeRequest(n,o,u,I.CONTEXT,c,a)}),this.setPermissionsCache(n),o.length>0&&(this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:o}}),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:o}}),o.forEach(d=>{this.pendingRevokeRequests.set(this.getRevokeKey(d),d)}),this.pendingRevokeUniqueId=t,this.pendingRevokeUserId=a,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(o){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:o}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",o)}})}getAccess(s){return g(this,arguments,function*({requests:e,userId:r}){let i={retryConfig:this.getPermissionProviderRetryConfig()};return this.isClientDevResolverActive()?i.clientResolvedResults=yield this.resolveClientSide(e):this.getPermissionProvider()?.dev&&this.warnNoResolverOnce(),this.sendGetAccessToProxy({requests:e,userId:r,metadata:i})})}sendGetAccessToProxy(i){return g(this,arguments,function*({requests:e,userId:r,metadata:s}){let t=V(this.functions,F({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield z({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:s},getSdkProxy:t,userId:r})})}isClientDevResolverActive(){return!!this.getPermissionProvider()?.dev&&this.isClientDevResolverConfigured()}resolveClientSidePermissions(e){return g(this,null,function*(){if(!this.isClientDevResolverActive())throw new Error("Client-side dev permission resolver is not active");return this.resolveClientSide(e)})}isClientDevResolverConfigured(){let e=this.getPermissionProvider();return e?!!e.endpointConfig?.url?.trim()||typeof e.resolvePermissions=="function":!1}resolveClientSide(e){return g(this,null,function*(){this.warnClientResolverEnabledOnce();let r=this.getPermissionProvider(),s=this.getPermissionProviderRetryConfig(),i=r?.resolveTimeout??6e4,t=yield j(()=>this.withResolverTimeout(()=>this.invokeResolver(e,r),i),"clientPermissionResolver",{retryCount:s?.retryCount??0,retryDelay:s?.retryDelay??0});if(!t||!t.success||t.statusCode!==200)throw new Error(t?.message??"Client permission resolver failed");let o=t.data;if(!Array.isArray(o))throw new Error("Client permission resolver returned a malformed payload");return o})}invokeResolver(e,r){return g(this,null,function*(){let s={data:{requests:e}},i=r.endpointConfig?.url?.trim();if(i)return B(i,r.endpointConfig?.headers,s,!0,r.endpointConfig?.credentials);let t=yield r.resolvePermissions(s);if(Array.isArray(t))return{data:t,success:!0,statusCode:200};let o=t,c=o?.statusCode??(o?.success===!1?500:200),a=o?.success!==!1&&c===200;return{data:Array.isArray(o?.data)?o.data:void 0,success:a,statusCode:a?200:c===200?500:c,message:o?.message}})}withResolverTimeout(e,r){return g(this,null,function*(){if(!r||r<=0)return e();let s,i=new Promise((t,o)=>{s=setTimeout(()=>o(new Error("Client permission resolver timed out")),r)});try{return yield Promise.race([e(),i])}finally{s&&clearTimeout(s)}})}warnClientResolverEnabledOnce(){this.clientResolverProdWarned||(this.clientResolverProdWarned=!0,console.warn("[Velt] Client-side dev permission resolver is enabled (dev: true). Permissions are resolved in the browser for local development only \u2014 DO NOT use this in production. Production API keys ignore browser-resolved results and fall back to the server-side permission provider."))}warnNoResolverOnce(){this.clientResolverNoResolverWarned||(this.clientResolverNoResolverWarned=!0,console.warn("[Velt] setPermissionProvider was called with dev: true but no endpointConfig.url or resolvePermissions callback was provided. Falling back to the server-side permission provider."))}revokeAccess(i){return g(this,arguments,function*({requests:e,userId:r,currentContext:s}){let t=V(this.functions,F({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield z({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:f({retryConfig:this.getPermissionProviderRetryConfig()},s?.access&&{currentContext:s})},getSdkProxy:t,userId:r})})}onResourceAccessRequired(o){return g(this,arguments,function*({requests:e,uniqueId:r,methodName:s,userId:i,fromCache:t=!0}){try{if(!e?.length)return;let c=[],a=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&t&&(e.forEach(n=>{let d=a?.find(h=>h.resourceId===n.resource.id&&h.type===n.resource.type&&h.userId===n.userId&&h.organizationId===n.resource.organizationId);d&&c.push(d)}),c.length>0&&(e=e.filter(n=>!c.find(d=>d.resourceId===n.resource.id&&d.type===n.resource.type&&d.userId===n.userId&&d.organizationId===n.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{requests:e,fromCache:t,clientResolved:this.isClientDevResolverActive()}});let n=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??i??""});return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{result:n,clientResolved:this.isClientDevResolverActive()}}),n?.success&&n?.data?.length&&(this.setPermissionsCache([...a,...n.data]),n.data=[...c,...n.data]),n}else if(c.length>0)return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{results:{data:c,success:!0,statusCode:200}}}),{data:c,success:!0,statusCode:200};return}catch(c){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",c),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{error:c,requests:e,fromCache:t}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let r=new Map;e.forEach(i=>{let t=`${i.userId}_${i.resourceId}_${i.organizationId}_${i.type}`;r.set(t,i)});let s=JSON.parse(JSON.stringify(Array.from(r.values())));this.permissionsCache$.next(s)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",r)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};O.\u0275fac=function(r){return new(r||O)(P(Z),P(Q),P(X),P(se),P(ee),P(re),P(Y),P(W),P(q),P(ie))},O.\u0275prov=K({token:O,factory:O.\u0275fac,providedIn:"root"});let k=O;return k})();export{ye as a};
1
+ import{Ea as ie}from"./chunk-2VSCJ7FP.js";import{$ as K,$e as R,Cf as $,Ch as E,Df as _,Dh as V,Ee as N,Ef as A,Ff as T,Fi as Q,Gi as ee,Hi as re,L as w,Mf as L,Od as W,Pi as se,Vf as M,_e as U,a as f,af as I,b as y,be as v,ca as P,da as x,g,ki as X,l as D,li as q,oi as H,qh as b,qi as Y,tf as S,th as j,ti as Z,uf as l,uh as B,v as G,wh as J,xh as z,zh as F}from"./chunk-YTAAOIBL.js";var p="public",ye=(()=>{let O=class O{constructor(e,r,s,i,t,o,c,a,n,d){this.authService=e,this.docService=r,this.loggingService=s,this.commonDbService=i,this.usersService=t,this.commentUtilsService=o,this.coreActionsService=c,this.functions=a,this.configService=n,this.contactService=d,this.endpointsService=x(H),this.currentUserPermissions$=new D(null),this.permissionsCache$=new D(null),this.permissionProvider$=new D(null),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.requestKeyedPermissionsCache=new Map,this.inFlightPermissionsRequests=new Map,this.permissionsCacheGeneration=0,this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="";try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(h){this.loggingService.catch("Error in UserPermissionService constructor:",h)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,r,s,i,t,o){try{return e.find(a=>a.resourceId===s&&a.type===i&&a.organizationId===t&&a.userId===o)?(r.push({userId:o,resourceId:s,organizationId:t,type:i,hasAccess:!1}),e.filter(a=>!(a.resourceId===s&&a.type===i&&a.organizationId===t&&a.userId===o))):e}catch(c){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",c),e}}hasUserContextAccess({userId:e,accessFields:r}){try{if(!this.getIsContextEnabled()||r.includes(N.DEFAULT_VELT_CONTEXT))return!0;let s=r.filter(t=>!L(t));if(!s.length){if(r.some(c=>c.startsWith(N.VISIBILITY_ORG_PREFIX)))return!0;let o=`${N.VISIBILITY_SELF_PREFIX}${$(e).toString()}`;return r.includes(o)}let i=this.contactService.getUserAccessFieldsByUserId(e);return i?.length?s.every(t=>i.includes(t)):!0}catch(s){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",s),!1}}organizationDetails(e){return g(this,null,function*(){try{let r=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e,suppressError:!0}});return r&&r?.errorCode?{errorCode:l.PERMISSION_DENIED,error:!0}:r&&!r?.metadata?{errorCode:l.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(r){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",r),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(s){return g(this,arguments,function*({documentId:e,organizationId:r}){try{let i=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:r,suppressError:!0}});if(i&&i?.errorCode)return{errorCode:l.PERMISSION_DENIED,error:!0};if(i&&!i?.metadata)return{errorCode:l.DOES_NOT_EXIST,error:!0};let t=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,f(f({},t),i?.metadata??{}));let o,c=i?.metadata?.veltFolderId;if(c)try{o=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:c,organizationId:r}}))?.folderIamConfig?.accessType}catch(a){this.loggingService.catch("Error fetching folder accessType for document:",a)}return o||(o=i?.docIamConfig?.accessType),{error:!1,accessType:o}}catch(i){return this.loggingService.catch("Error in UserPermissionService documentDetails:",i),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(s){return g(this,arguments,function*({folderId:e,organizationId:r}){try{let i=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:r,suppressError:!0}});return i&&i?.errorCode?{errorCode:l.PERMISSION_DENIED,error:!0}:i&&!i?.metadata?{errorCode:l.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:i?.folderIamConfig?.accessType}}catch(i){return this.loggingService.catch("Error in UserPermissionService folderDetails:",i),{errorCode:l.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return g(this,null,function*(){let r=this.permissionsCacheGeneration;try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let s=this.authService.getUser()?.userId,i=this.extractResourceIds(e);if(!i.clientOrganizationId||!i.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let t=yield this.validateResources(i),[o,c]=yield this.fetchUserPermissionsFromDB(i),a=this.authService.getUser()?.userId;if(s!==a)return{};let n=this.buildPermissionsResponse(i,t,o,c);if(Object.keys(n).length>0){if(!e)this.setCurrentUserPermissions(n);else if(this.permissionsCacheGeneration===r){let d=this.buildPermissionsCacheKey(e);d!==null&&this.requestKeyedPermissionsCache.set(d,JSON.parse(JSON.stringify(n)))}}return n}catch(s){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",s),{}}})}getUserPermissionsFromCacheOrFetch(e){return g(this,null,function*(){try{if(!e)return yield this.getUserPermissions(e);let r=this.buildPermissionsCacheKey(e);if(r===null)return yield this.getUserPermissions(e);let s=this.permissionsCacheGeneration,i=this.requestKeyedPermissionsCache.get(r);if(i)return JSON.parse(JSON.stringify(i));let t=this.inFlightPermissionsRequests.get(r);if(t){let a=yield t;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(a))}let o=this.getUserPermissions(e);this.inFlightPermissionsRequests.set(r,o),o.finally(()=>{this.inFlightPermissionsRequests.get(r)===o&&this.inFlightPermissionsRequests.delete(r)}).catch(()=>{});let c=yield o;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(c))}catch(r){return this.loggingService.catch("Error in UserPermissionService getUserPermissionsFromCacheOrFetch:",r),{}}})}clearRequestKeyedPermissionsCache(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService clearRequestKeyedPermissionsCache:",e)}}invalidateAllPermissionsState(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService invalidateAllPermissionsState:",e)}}buildPermissionsCacheKey(e){try{let r={};return Object.keys(e).sort().forEach(s=>{let i=e[s];i!==void 0&&(r[s]=Array.isArray(i)?[...i].sort():i)}),r.__userId=this.authService.getUser()?.userId??null,JSON.stringify(r)}catch(r){return this.loggingService.catch("Error in UserPermissionService buildPermissionsCacheKey:",r),null}}extractResourceIds(e){let r=this.docService.getDocumentPaths(),s=this.docService.getDocumentIds();if(e){let o=e.organizationId??r?.clientOrganizationId;return{folderIds:e.folderIds??[],documentIds:e.documentIds??[],clientOrganizationId:o,organizationId:o?A(o):void 0}}let i=r?.clientOrganizationId;return{folderIds:r?.folderId?[r.folderId]:[],documentIds:s.map(o=>o.clientDocumentId),clientOrganizationId:i,organizationId:i?A(i):void 0}}validateResources(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:i,clientOrganizationId:t}=e,o=[],c=[],a=r.length>0||s.length>0;i&&!a&&(o.push(this.organizationDetails(i)),c.push({id:t??"",type:"organization"})),r.forEach(u=>{o.push(this.folderDetails({folderId:T(u),organizationId:i??""})),c.push({id:u,type:"folder"})}),s.forEach(u=>{o.push(this.documentDetails({documentId:_(u),organizationId:i??""})),c.push({id:u,type:"document"})});let[n,d]=yield Promise.all([Promise.allSettled(o),this.getDefaultDocumentAccessType()]),h=this.processValidationResults(n,c);return y(f({},this.suppressResolverGrantedFailures(h,t)),{defaultDocumentAccessType:d})})}suppressResolverGrantedFailures(e,r){try{let s=this.authService.getUser()?.userId;if(!s)return e;let i=this.getPermissionsCache()??[];if(i.length===0)return e;let t=(n,d,h)=>i.some(u=>u?.userId===s&&u?.resourceId===n&&u?.type===d&&(!h||u?.organizationId===h)&&u?.hasAccess===!0),o=e.failedDocumentIds.filter(n=>!(n.errorCode===l.PERMISSION_DENIED&&t(n.id,I.DOCUMENT,r))),c=e.failedFolderIds.filter(n=>!(n.errorCode===l.PERMISSION_DENIED&&t(n.id,I.FOLDER,r))),a=e.failedOrganizationId;return a&&a.errorCode===l.PERMISSION_DENIED&&r&&t(r,I.ORGANIZATION,r)&&(a=void 0),{failedFolderIds:c,failedDocumentIds:o,failedOrganizationId:a,folderAccessTypes:e.folderAccessTypes,documentAccessTypes:e.documentAccessTypes}}catch(s){return this.loggingService.catch("Error in UserPermissionService suppressResolverGrantedFailures:",s),e}}getDefaultDocumentAccessType(){return g(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,r){let s=[],i=[],t,o={},c={};for(let a=0;a<e.length;a++){let n=e[a],d=r[a];if(n.status==="rejected"||n.status==="fulfilled"&&n.value.error){let u=n.status==="fulfilled"?n.value.errorCode??l.SOMETHING_WENT_WRONG:l.SOMETHING_WENT_WRONG,m={id:d.id,errorCode:u};switch(d.type){case"organization":if(t=m,u===l.DOES_NOT_EXIST)throw new Error(`Organization with id '${d.id}' does not exist`);break;case"folder":s.push(m);break;case"document":i.push(m);break}}else if(n.status==="fulfilled")switch(d.type){case"folder":n.value.accessType&&(o[d.id]=n.value.accessType);break;case"document":n.value.accessType&&(c[d.id]=n.value.accessType);break}}return{failedFolderIds:s,failedDocumentIds:i,failedOrganizationId:t,folderAccessTypes:o,documentAccessTypes:c}}fetchUserPermissionsFromDB(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:i}=e,t=[this.authService.getUser()?.userId??""],o=[...r.map(n=>T(n)),...s.map(n=>_(n)),i??""],[c,a]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:t,organizationId:i}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:t,organizationId:i,resourceIds:o})]);return[c.status==="fulfilled"?c.value:[],a.status==="fulfilled"?a.value:[]]})}buildPermissionsResponse(e,r,s,i){let{folderIds:t,documentIds:o,clientOrganizationId:c,organizationId:a}=e,{failedFolderIds:n,failedDocumentIds:d,failedOrganizationId:h}=r,u={};return this.processRegularUserPermissions(u,s,t,o,c??"",a??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.ensureCurrentUserFailuresRecorded(u,c??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.processTemporaryUserPermissions(u,i),this.processContextPermissions(u),u}processContextPermissions(e){try{let r=this.authService.getUser()?.userId;if(r){let s=this.contactService.getUserAccessFieldsByUserId(r);s?.length&&(e[r]||(e[r]={}),e[r].context={accessFields:s})}}catch(r){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",r);return}}processRegularUserPermissions(e,r,s,i,t,o,c,a,n,d,h,u){for(let m of r)for(let C of m)C?.user?.userId&&(e[C.user.userId]=y(f({},s.length&&{folders:this.buildFolderPermissions(s,C,c,d,u)}),{documents:this.buildDocumentPermissions(i,C,a,h,u),organization:{[t]:this.buildOrganizationPermission(o,C,n)}}))}ensureCurrentUserFailuresRecorded(e,r,s,i,t,o,c,a){try{let n=this.authService.getUser()?.userId;if(!n)return;let d=!!t&&!!r,h=(s?.length??0)>0,u=(i?.length??0)>0;if(!d&&!h&&!u)return;if(e[n]||(e[n]={}),d&&(e[n].organization||(e[n].organization={}),e[n].organization[r]||(e[n].organization[r]={error:this.getErrorMessage(t.errorCode,"organization"),errorCode:t.errorCode})),h){e[n].folders||(e[n].folders={});for(let m of s)e[n].folders[m.id]||(e[n].folders[m.id]=f({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===l.PERMISSION_DENIED&&{accessType:o[m.id]??a??p}))}if(u){e[n].documents||(e[n].documents={});for(let m of i)e[n].documents[m.id]||(e[n].documents[m.id]=f({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===l.PERMISSION_DENIED&&{accessType:c[m.id]??a??p}))}}catch(n){this.loggingService.catch("Error in UserPermissionService ensureCurrentUserFailuresRecorded:",n)}}getErrorMessage(e,r){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${r}`),e){case l.DOES_NOT_EXIST:return`${r} does not exist`;case l.PERMISSION_DENIED:return`User does not have access to ${r}`;case l.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(s){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",s),"Something went wrong"}}buildFolderPermissions(e,r,s,i,t){return e.reduce((o,c)=>{let a=s.find(n=>n.id===c);return a?o[c]=f({error:this.getErrorMessage(a.errorCode,"folder"),errorCode:a.errorCode},a.errorCode===l.PERMISSION_DENIED&&{accessType:i[c]??t??p}):o[c]={accessRole:r.viewerFolderIds?.includes(T(c))?S.VIEWER:S.EDITOR,accessType:i[c]??t??p},o},{})}buildDocumentPermissions(e,r,s,i,t){return e.reduce((o,c)=>{let a=s.find(n=>n.id===c);return a?o[c]=f({error:this.getErrorMessage(a.errorCode,"document"),errorCode:a.errorCode},a.errorCode===l.PERMISSION_DENIED&&{accessType:i[c]??t??p}):o[c]={accessRole:r.viewerDocumentIds?.includes(_(c))?S.VIEWER:S.EDITOR,accessType:i[c]??t??p},o},{})}buildOrganizationPermission(e,r,s){return s?{error:this.getErrorMessage(s.errorCode,"organization"),errorCode:s.errorCode}:{accessRole:r.viewerOrganizationIds?.includes(e)?S.VIEWER:S.EDITOR}}processTemporaryUserPermissions(e,r){for(let s of r)if(s?.userId)switch(this.ensureUserPermissionStructure(e,s.userId),s.type){case"folder":this.addTemporaryFolderPermission(e,s);break;case"document":this.addTemporaryDocumentPermission(e,s);break;case"organization":this.addTemporaryOrganizationPermission(e,s);break}}ensureUserPermissionStructure(e,r){e[r]||(e[r]={})}addTemporaryFolderPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].folders||(e[s].folders={}),e[s].folders[i]={accessRole:t??S.EDITOR,expiresAt:o}}addTemporaryDocumentPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].documents||(e[s].documents={}),e[s].documents[i]={accessRole:t??S.EDITOR,expiresAt:o}}addTemporaryOrganizationPermission(e,r){let{userId:s,resourceId:i,role:t,expiresAt:o}=r;e[s].organization||(e[s].organization={}),e[s].organization[i]={accessRole:t??S.EDITOR,expiresAt:o}}hasEditAccess({organizationId:e,folderId:r,documentId:s}){try{let i=!0,t=this.getCurrentUserPermissionsWithServerIds(),o=this.authService.getUser()?.userId??"";return t&&(e&&typeof e=="string"&&t?.[o]?.organization?.[e]&&(t?.[o]?.organization?.[e]?.accessRole===S.VIEWER||t?.[o]?.organization?.[e]?.errorCode===l.PERMISSION_DENIED)&&(i=!1),r&&typeof r=="string"&&t?.[o]?.folders?.[r]&&(t?.[o]?.folders?.[r]?.accessRole===S.VIEWER||t?.[o]?.folders?.[r]?.errorCode===l.PERMISSION_DENIED)&&(i=!1),s&&typeof s=="string"&&t?.[o]?.documents?.[s]&&(t?.[o]?.documents?.[s]?.accessRole===S.VIEWER||t?.[o]?.documents?.[s]?.errorCode===l.PERMISSION_DENIED)&&(i=!1)),i}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(w(b))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let r=JSON.parse(JSON.stringify(e??{})),s=this.authService.getUser()?.userId??"";if(r?.[s]){let i=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(r?.[s]?.organization?.[i]){let t=A(i);r[s].organization&&(r[s].organization[t]=r[s].organization[i],delete r[s].organization[i])}r?.[s]?.folders&&(r[s].folders=Object.fromEntries(Object.entries(r?.[s]?.folders??{}).map(([t,o])=>[T(t),o]))),r?.[s]?.documents&&(r[s].documents=Object.fromEntries(Object.entries(r?.[s]?.documents??{}).map(([t,o])=>[_(t),o])))}return r}catch(r){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",r),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(G(e=>this.refactorPermissionsWithServerIds(e)),w(b))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let r=null;e&&(r=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(r)}catch(r){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",r)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.permissionProvider$.next(e)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",r)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return g(this,null,function*(){let e=M();try{if(this.isRevokeAccessOnUserLogoutEnabled){let r=[],s=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(t=>{t.userId===s&&t.hasAccess&&(t.type===I.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&r.push(y(f({},t),{hasAccess:!1})):r.push(y(f({},t),{hasAccess:!1})))}),r.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}}),this.setPermissionsCache([]),this.clearRequestKeyedPermissionsCache(),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}});let t=yield this.revokeAccess({requests:r,userId:this.authService.getUser()?.userId??""});t.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:t,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:t,success:!1,statusCode:500}}})}}}catch(r){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:r}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",r)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(r){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",r),""}}cancelPendingRevokes(e){try{e.forEach(r=>{let s=this.getRevokeKey({userId:r.userId,resourceId:r.resource.id,type:r.resource.type,organizationId:r.resource.organizationId});this.pendingRevokeRequests.has(s)&&this.pendingRevokeRequests.delete(s)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(r){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",r)}}flushPendingRevokes(){return g(this,null,function*(){let e=this.pendingRevokeUniqueId,r=this.pendingRevokeUserId;try{let s=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",s.length===0)return;let i=this.getPermissionsCache()??[];s.forEach(c=>{i=i.filter(a=>!(a.resourceId===c.resourceId&&a.type===c.type&&a.organizationId===c.organizationId&&a.userId===c.userId))}),this.setPermissionsCache(i);let t=this.docService.getDocContext(),o=yield this.revokeAccess({requests:s,userId:r,currentContext:t});o.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:o,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:o,success:!1,statusCode:500}}})}catch(s){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:s}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",s)}})}revokeAccessOnDocumentUnset(i){return g(this,arguments,function*({documentIds:e,folderId:r,context:s}){let t=M();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let o=[],c=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.authService.getUser()?.userId??"",n=this.getPermissionsCache()??[];e.forEach(d=>{n=this.collectRevokeRequest(n,o,d.clientDocumentId,I.DOCUMENT,c,a)}),r&&(n=this.collectRevokeRequest(n,o,r,I.FOLDER,c,a)),c&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(n=this.collectRevokeRequest(n,o,c,I.ORGANIZATION,c,a)),s&&this.getIsContextEnabled()&&J({input:s}).forEach(h=>{let u=JSON.stringify(h.access);n=this.collectRevokeRequest(n,o,u,I.CONTEXT,c,a)}),this.setPermissionsCache(n),o.length>0&&(this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:o}}),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:o}}),o.forEach(d=>{this.pendingRevokeRequests.set(this.getRevokeKey(d),d)}),this.pendingRevokeUniqueId=t,this.pendingRevokeUserId=a,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(o){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:t,methodName:R.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:o}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",o)}})}getAccess(s){return g(this,arguments,function*({requests:e,userId:r}){let i={retryConfig:this.getPermissionProviderRetryConfig()};return this.isClientDevResolverActive()?i.clientResolvedResults=yield this.resolveClientSide(e):this.getPermissionProvider()?.dev&&this.warnNoResolverOnce(),this.sendGetAccessToProxy({requests:e,userId:r,metadata:i})})}sendGetAccessToProxy(i){return g(this,arguments,function*({requests:e,userId:r,metadata:s}){let t=V(this.functions,F({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield z({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:s},getSdkProxy:t,userId:r})})}isClientDevResolverActive(){return!!this.getPermissionProvider()?.dev&&this.isClientDevResolverConfigured()}resolveClientSidePermissions(e){return g(this,null,function*(){if(!this.isClientDevResolverActive())throw new Error("Client-side dev permission resolver is not active");return this.resolveClientSide(e)})}isClientDevResolverConfigured(){let e=this.getPermissionProvider();return e?!!e.endpointConfig?.url?.trim()||typeof e.resolvePermissions=="function":!1}resolveClientSide(e){return g(this,null,function*(){this.warnClientResolverEnabledOnce();let r=this.getPermissionProvider(),s=this.getPermissionProviderRetryConfig(),i=r?.resolveTimeout??6e4,t=yield j(()=>this.withResolverTimeout(()=>this.invokeResolver(e,r),i),"clientPermissionResolver",{retryCount:s?.retryCount??0,retryDelay:s?.retryDelay??0});if(!t||!t.success||t.statusCode!==200)throw new Error(t?.message??"Client permission resolver failed");let o=t.data;if(!Array.isArray(o))throw new Error("Client permission resolver returned a malformed payload");return o})}invokeResolver(e,r){return g(this,null,function*(){let s={data:{requests:e}},i=r.endpointConfig?.url?.trim();if(i)return B(i,r.endpointConfig?.headers,s,!0,r.endpointConfig?.credentials);let t=yield r.resolvePermissions(s);if(Array.isArray(t))return{data:t,success:!0,statusCode:200};let o=t,c=o?.statusCode??(o?.success===!1?500:200),a=o?.success!==!1&&c===200;return{data:Array.isArray(o?.data)?o.data:void 0,success:a,statusCode:a?200:c===200?500:c,message:o?.message}})}withResolverTimeout(e,r){return g(this,null,function*(){if(!r||r<=0)return e();let s,i=new Promise((t,o)=>{s=setTimeout(()=>o(new Error("Client permission resolver timed out")),r)});try{return yield Promise.race([e(),i])}finally{s&&clearTimeout(s)}})}warnClientResolverEnabledOnce(){this.clientResolverProdWarned||(this.clientResolverProdWarned=!0,console.warn("[Velt] Client-side dev permission resolver is enabled (dev: true). Permissions are resolved in the browser for local development only \u2014 DO NOT use this in production. Production API keys ignore browser-resolved results and fall back to the server-side permission provider."))}warnNoResolverOnce(){this.clientResolverNoResolverWarned||(this.clientResolverNoResolverWarned=!0,console.warn("[Velt] setPermissionProvider was called with dev: true but no endpointConfig.url or resolvePermissions callback was provided. Falling back to the server-side permission provider."))}revokeAccess(i){return g(this,arguments,function*({requests:e,userId:r,currentContext:s}){let t=V(this.functions,F({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield z({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:f({retryConfig:this.getPermissionProviderRetryConfig()},s?.access&&{currentContext:s})},getSdkProxy:t,userId:r})})}onResourceAccessRequired(o){return g(this,arguments,function*({requests:e,uniqueId:r,methodName:s,userId:i,fromCache:t=!0}){try{if(!e?.length)return;let c=[],a=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&t&&(e.forEach(n=>{let d=a?.find(h=>h.resourceId===n.resource.id&&h.type===n.resource.type&&h.userId===n.userId&&h.organizationId===n.resource.organizationId);d&&c.push(d)}),c.length>0&&(e=e.filter(n=>!c.find(d=>d.resourceId===n.resource.id&&d.type===n.resource.type&&d.userId===n.userId&&d.organizationId===n.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{requests:e,fromCache:t,clientResolved:this.isClientDevResolverActive()}});let n=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??i??""});return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{result:n,clientResolved:this.isClientDevResolverActive()}}),n?.success&&n?.data?.length&&(this.setPermissionsCache([...a,...n.data]),n.data=[...c,...n.data]),n}else if(c.length>0)return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{results:{data:c,success:!0,statusCode:200}}}),{data:c,success:!0,statusCode:200};return}catch(c){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",c),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:E.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{error:c,requests:e,fromCache:t}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let r=new Map;e.forEach(i=>{let t=`${i.userId}_${i.resourceId}_${i.organizationId}_${i.type}`;r.set(t,i)});let s=JSON.parse(JSON.stringify(Array.from(r.values())));this.permissionsCache$.next(s)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",r)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};O.\u0275fac=function(r){return new(r||O)(P(Z),P(Q),P(X),P(se),P(ee),P(re),P(Y),P(W),P(q),P(ie))},O.\u0275prov=K({token:O,factory:O.\u0275fac,providedIn:"root"});let k=O;return k})();export{ye as a};
@@ -1 +1 @@
1
- import{Pa as s,Xa as a,Xc as c,si as n}from"./chunk-CRZGZZVQ.js";var f=(()=>{let i=class i{constructor(t,r){this.domService=t,this.sanitizer=r}transform(t,r=!0){try{let o=r?this.domService.sanitizeHtml(t):t;return this.sanitizer.bypassSecurityTrustHtml(o)}catch{return t}}};i.\u0275fac=function(r){return new(r||i)(s(n,16),s(c,16))},i.\u0275pipe=a({name:"safeHtml",type:i,pure:!0});let e=i;return e})();export{f as a};
1
+ import{Pa as s,Xa as a,Xc as c,si as n}from"./chunk-YTAAOIBL.js";var f=(()=>{let i=class i{constructor(t,r){this.domService=t,this.sanitizer=r}transform(t,r=!0){try{let o=r?this.domService.sanitizeHtml(t):t;return this.sanitizer.bypassSecurityTrustHtml(o)}catch{return t}}};i.\u0275fac=function(r){return new(r||i)(s(n,16),s(c,16))},i.\u0275pipe=a({name:"safeHtml",type:i,pure:!0});let e=i;return e})();export{f as a};
@@ -1 +1 @@
1
- import{Ee as h,Wd as c}from"./chunk-CRZGZZVQ.js";var d=(t,r)=>{try{let e=l(t),i=[],n=[];return e.forEach(o=>{o?.parentElement?.closest(h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?o?.parentElement?.normalize():n.push(o)}),n.forEach(o=>{let s=a(o,r);s&&i.push(s)}),i}catch(e){return c.catch("Error in highlighter highlightRange: ",e),[]}},l=t=>{try{if(t.collapsed)return[];let r=t.commonAncestorContainer;if(t.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(r=t.commonAncestorContainer.parentElement),!r)return[];let e=[],i=r.ownerDocument.createNodeIterator(r,NodeFilter.SHOW_TEXT),n,o=!1;for(;n=i.nextNode();)if(t.intersectsNode(n)){let s=n?.length;t.startContainer===n&&t.startOffset>0&&(n.splitText(t.startOffset),o=!0),t.endContainer===n&&t.endOffset<s&&n.splitText(t.endOffset),e.push(n)}return o&&e.shift(),e}catch(r){return c.catch("Error in highlighter getTextNodesInRange: ",r),[]}},a=(t,r)=>{try{let e=document.createElement(r||h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return t.parentElement?.replaceChild(e,t),e.appendChild(t),e}catch(e){return c.catch("Error in highlighter highlightNode: ",e),null}};export{d as a};
1
+ import{Ee as h,Wd as c}from"./chunk-YTAAOIBL.js";var d=(t,r)=>{try{let e=l(t),i=[],n=[];return e.forEach(o=>{o?.parentElement?.closest(h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?o?.parentElement?.normalize():n.push(o)}),n.forEach(o=>{let s=a(o,r);s&&i.push(s)}),i}catch(e){return c.catch("Error in highlighter highlightRange: ",e),[]}},l=t=>{try{if(t.collapsed)return[];let r=t.commonAncestorContainer;if(t.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(r=t.commonAncestorContainer.parentElement),!r)return[];let e=[],i=r.ownerDocument.createNodeIterator(r,NodeFilter.SHOW_TEXT),n,o=!1;for(;n=i.nextNode();)if(t.intersectsNode(n)){let s=n?.length;t.startContainer===n&&t.startOffset>0&&(n.splitText(t.startOffset),o=!0),t.endContainer===n&&t.endOffset<s&&n.splitText(t.endOffset),e.push(n)}return o&&e.shift(),e}catch(r){return c.catch("Error in highlighter getTextNodesInRange: ",r),[]}},a=(t,r)=>{try{let e=document.createElement(r||h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return t.parentElement?.replaceChild(e,t),e.appendChild(t),e}catch(e){return c.catch("Error in highlighter highlightNode: ",e),null}};export{d as a};
@@ -1 +1 @@
1
- import{a as N}from"./chunk-JGICU6Z4.js";import{$ as v,Ai as B,E as P,Ee as m,Fi as J,G as x,I as C,J as f,Ma as j,Oi as K,Pi as W,Sg as V,Tg as L,Ug as H,Vf as $,Vg as z,Wg as R,Xg as F,bb as X,ca as a,ki as g,l as p,la as M,lg as T,qg as k,r as A,si as G,ti as b,w as D,z as y}from"./chunk-CRZGZZVQ.js";var h=(function(l){return l.CLICK="click",l.HOVER="hover",l.SCROLL="scroll",l.NAVIGATE="navigate",l})(h||{}),u=class{constructor(){this.type=h.HOVER,this.data=null,this.pageInfo=k(),this.timestamp=Date.now()}},U=class{constructor(n,w){this.targetXpath=n,this.xpath=w}};var E=class{constructor(){this.sessionId=null,this.isLeader=!1,this.lastProcessedActionTimestamp=null}};var S=class{constructor(n){this.snippylyId=n,this.joinTimestamp=Date.now()}};var I=class{constructor(n,w,e){this.followers=[],this.actionStack=[],this.id=$(),this.leaderId=n,this.leaderName=w,this.followers.push(new S(e))}};var Q=(()=>{let n=class n{constructor(e,t,r,i,o,s){this.databaseService=e,this.docService=t,this.loggingService=r,this.authService=i,this.commonDbService=o,this.realtimeAdapter=s,this.currentUser$=new p(null),this.currentSession$=new p(null);try{this.databaseService.getDb().pipe(P(c=>!!c),f(1)).subscribe(c=>{c&&(this.db=c)},c=>{this.loggingService.catch("Error in FlockSessionService getDb subscription: ",c)}),this.authService.getUser$().subscribe(c=>{c&&c.userSnippylyId&&(this.user=c)})}catch(c){this.loggingService.catch("Error in FlockSessionService constructor: ",c)}}startCurrentFlockUserSubscription(e){try{this.currentUserSub?.unsubscribe(),e&&e.userSnippylyId&&(this.user=e,this.subscribeToCurrentFlockUser(e?.userSnippylyId))}catch(t){this.loggingService.catch("Error in FlockSessionService startCurrentFlockUserSubscription: ",t)}}stopCurrentFlockUserSubscription(){try{this.currentUserSub?.unsubscribe()}catch(e){this.loggingService.catch("Error in FlockSessionService stopCurrentFlockUserSubscription: ",e)}}provisionFlockSession(e,t,r){try{let i=this.docService.getDocumentPaths();i&&this.db&&this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:i?.documentId,organizationId:i?.organizationId,id:e,skipFirestore:!0}}).pipe(f(1)).subscribe(o=>{o?.data&&o?.data?.sessionId?this.subscribeToCurrentSession(o?.data?.sessionId,r):this.createFlockSession(e,t,r)})}catch(i){this.loggingService.catch("Error in FlockSessionService provisionFlockSession: ",i)}return null}swapLeader(e,t,r){try{if(this.updateRemoteFlockUser(e,{isLeader:!1}),this.updateRemoteFlockUser(t,{isLeader:!0}),this.currentSession){this.currentSession.leaderId=t,this.currentSession.leaderName=r,this.currentSession.followers.push(new S(e));let i=this.currentSession.followers.findIndex(o=>o.snippylyId===t);i>-1&&this.currentSession.followers.splice(i,1),this.updateSession(this.currentSession.id,this.currentSession)}}catch(i){this.loggingService.catch("Error in FlockSessionService swapLeader: ",i)}}createFlockSession(e,t,r){try{let i=new I(e,t,r);return this.updateRemoteFlockUser(e,{snippylyId:e,sessionId:i.id,isLeader:!0}),this.updateSession(i.id,i),this.subscribeToCurrentSession(i.id),i.id}catch(i){this.loggingService.catch("Error in FlockSessionService createFlockSession: ",i)}return null}removeFollowerFromCurrentSession(e){try{if(this.currentSession){this.updateRemoteFlockUser(e,{sessionId:null,lastProcessedActionTimestamp:null});let t=this.currentSession.followers.findIndex(r=>r.snippylyId===e);if(t>-1){if(this.currentSession.followers.splice(t,1),this.currentSession.followers.length===0){this.deleteSession(this.currentSession.id);return}this.updateSession(this.currentSession.id,this.currentSession),this.user&&this.user.userSnippylyId&&this.user.userSnippylyId===e&&(this.sessionSub?.unsubscribe(),this.currentSession=void 0,this.currentSession$?.next(null))}}}catch(t){this.loggingService.catch("Error in FlockSessionService removeFollowerFromSession: ",t)}}updateRemoteFlockUser(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockUser",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateRemoteFlockUser: ",r)}}subscribeToCurrentSession(e,t=void 0){try{let r=this.docService.getDocumentPaths();r&&this.db&&(this.sessionSub&&this.sessionSub.unsubscribe(),this.sessionSub=this.commonDbService.dbListener({feature:"flockSession",properties:{documentId:r?.documentId,organizationId:r?.organizationId,id:e,skipFirestore:!0}}).subscribe(i=>{i?.data&&typeof i?.data=="object"&&Object.keys(i?.data)?.length>0?(this.currentSession=i?.data,t!==void 0&&this.currentSession?.followers.findIndex(o=>o.snippylyId===t)===-1&&(this.currentSession.followers.push(new S(t)),this.updateSession(this.currentSession.id,this.currentSession)),this.currentSession$.next(this.currentSession??null)):(this.currentSession=void 0,this.currentSession$.next(null))}))}catch(r){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentSession: ",r)}}subscribeToCurrentFlockUser(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.currentUserSub&&this.currentUserSub.unsubscribe(),this.currentUserSub=this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:t?.documentId,organizationId:t?.organizationId,id:e,skipFirestore:!0}}).pipe(x(r=>(this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",r),A(null)))).subscribe(r=>{r?.data&&typeof r?.data=="object"&&Object.keys(r?.data)?.length>0&&(this.currentUser$.next(r?.data),r?.data?.sessionId&&this.subscribeToCurrentSession(r?.data?.sessionId))},r=>{this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser subscription: ",r)}))}catch(t){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",t)}}updateSession(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockSession",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateSession: ",r)}}deleteSession(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.commonDbService.deleteData({feature:"flockSession",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:e,skipFirestore:!0}}),this.currentSession&&e===this.currentSession.id&&(this.updateRemoteFlockUser(this.currentSession.leaderId,{sessionId:null,isLeader:!1,lastProcessedActionTimestamp:null}),this.currentSession.followers.forEach(r=>{this.updateRemoteFlockUser(r.snippylyId,{sessionId:null,lastProcessedActionTimestamp:null})}),this.currentSession=void 0,this.currentSession$.next(null),this.sessionSub?.unsubscribe()))}catch(t){this.loggingService.catch("Error in FlockSessionService deleteSession: ",t)}}addActionToStack(e,t){try{t=t&&JSON.parse(JSON.stringify(t));let r=this.docService.getDocumentPaths();if(r&&this.db&&e){let i=this.realtimeAdapter.rtdbRef(this.db,`${r.flock}/sessions/${e}/actionStack`);this.realtimeAdapter.rtdbRunTransaction("flockSession",i,o=>o?(o.unshift(t),o.slice(0,5)):[t]),t.type===h.NAVIGATE&&this.updateSession(e,{pageInfo:t.pageInfo})}}catch(r){this.loggingService.catch("Error in FlockSessionService addActionToStack: ",r)}}};n.\u0275fac=function(t){return new(t||n)(a(B),a(J),a(g),a(b),a(W),a(K))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Z=(()=>{let n=class n{constructor(e,t,r,i){this.componentFactoryResolver=e,this.applicationRef=t,this.injector=r,this.loggingService=i,this.darkMode=!1}createFollowOverlay(e,t){try{let i=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);i.instance.setLeaderName(e),i.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),t()}),this.applicationRef.attachView(i.hostView),this.overlayRef=i,this.overlayRef.instance.darkMode=this.darkMode;let o=this.overlayRef.location.nativeElement;o.id="snippyly-follow-overlay",o.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(o)}catch(r){this.loggingService.catch("Error in FlockOverlayService createFollowOverlay: ",r)}}createLeaderOverlay(e){let r=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);r.instance.setType("leading"),r.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),e()}),this.applicationRef.attachView(r.hostView),this.overlayRef=r,this.overlayRef.instance.darkMode=this.darkMode;let i=this.overlayRef.location.nativeElement;i.id="snippyly-follow-overlay",i.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(i)}changeLeaderName(e){this.overlayRef&&this.overlayRef.instance.setLeaderName(e)}getLeaderName(){return this.overlayRef?this.overlayRef.instance.getLeaderName():null}removeOverlay(){if(this.overlayRef){let e=this.overlayRef.location.nativeElement;this.applicationRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),e.shadowRoot&&e.shadowRoot.removeChild(e.shadowRoot.childNodes[0]),e.remove(),this.overlayRef=void 0}}setDarkMode(e){try{this.darkMode=e,this.overlayRef&&(this.overlayRef.instance.darkMode=e)}catch(t){this.loggingService.catch("Error in FlockOverlayService setDarkMode: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(j),a(X),a(M),a(g))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Ce=(()=>{let n=class n{constructor(e,t,r,i,o){this.authService=e,this.domService=t,this.loggingService=r,this.flockSessionService=i,this.flockOverlayService=o,this.flockLeader$=new p({userId:"",name:""}),this.flockMode$=new p(!1),this.currentFlockUser=null,this.localScrollData=[],this.domSubscriptions=[],this.followOverlayCreated=!1,this.leaderOverlayCreated=!1,this.windowFocused=!0,this.tabFocused=!0,this.useHistoryAPI=!0,this.disableDefaultNavigation=!1;try{this.flockLeader$.subscribe(s=>{let{userId:c,name:d}=s,O=c;if(this.provisionFollowUser(),O&&this.currentFlockUser&&this.currentFlockUser.snippylyId)if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,O,d);return}this.removeCurrentUserFromSession()}else this.flockSessionService.provisionFlockSession(O,d,this.currentFlockUser.snippylyId)},s=>{this.loggingService.catch("Error in FlockService flockLeader$ subscription: ",s)}),this.flockSessionService.currentSession$.subscribe(s=>{if(s!==null){if(this.currentFlockUser&&(this.currentFlockUser.sessionId===null||this.currentFlockUser.sessionId===void 0)&&this.currentFlockUser.snippylyId&&(this.currentFlockUser.sessionId=s.id,this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,this.currentFlockUser)),this.currentFlockUser&&!this.currentFlockUser.isLeader&&!this.followOverlayCreated&&(this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.followOverlayCreated=!0,this.flockOverlayService.createFollowOverlay(s.leaderName,()=>{this.removeCurrentUserFromSession(),this.followOverlayCreated=!1})),this.currentFlockUser&&this.currentFlockUser.isLeader&&!this.leaderOverlayCreated&&(this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1),this.leaderOverlayCreated=!0,this.flockOverlayService.createLeaderOverlay(()=>{this.removeCurrentUserFromSession(),this.leaderOverlayCreated=!1})),this.currentFlockUser&&!this.currentFlockUser.isLeader&&s.actionStack){let c=s.actionStack[0];c&&this.currentFlockUser.lastProcessedActionTimestamp!==c.timestamp&&this.processAction(c)}if(this.currentFlockUser&&!this.currentFlockUser.isLeader&&this.followOverlayCreated&&this.flockOverlayService.getLeaderName()!==null&&s.leaderName!==this.flockOverlayService.getLeaderName()&&this.flockOverlayService.changeLeaderName(s.leaderName),this.currentFlockUser&&this.currentFlockUser.isLeader){let c=k();if(s.pageInfo){if(c&&c.url!==s.pageInfo.url){let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}else{this.flockSessionService.updateSession(s.id,{pageInfo:c});let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}}else this.currentFlockUser&&this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.currentFlockUser&&this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1)}),this.flockSessionService.currentUser$.subscribe(s=>{if(s!==null&&(this.currentFlockUser&&this.currentFlockUser.isLeader!==s.isLeader&&(this.domSubscriptions.forEach(c=>c.unsubscribe()),this.domSubscriptions=[]),this.currentFlockUser=s,s.sessionId&&this.domSubscriptions.length===0))if(s.isLeader){if(!this.tabFocused||!this.windowFocused)return;this.subscribeToLeaderDOMEvents()}else this.subscribeToFollowerDOMEvents()}),D([this.authService.getUser$(),this.getFlockMode$()]).subscribe(([s,c])=>{s&&s.userSnippylyId&&c?this.flockSessionService.startCurrentFlockUserSubscription(s):this.flockSessionService.stopCurrentFlockUserSubscription()})}catch(s){this.loggingService.catch("Error in FlockService constructor: ",s)}}provisionFollowUser(){try{if(this.currentFlockUser===null){let e=this.authService.getUser();e&&e.userSnippylyId&&(this.currentFlockUser=new E,this.currentFlockUser.snippylyId=e.userSnippylyId)}}catch(e){this.loggingService.catch("Error in FlockService provisionFollowUser: ",e)}}startFollowingUser(e,t){try{if(this.provisionFollowUser(),e&&this.currentFlockUser&&this.currentFlockUser.snippylyId){if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,e,t);return}this.removeCurrentUserFromSession()}this.flockSessionService.provisionFlockSession(e,t,this.currentFlockUser.snippylyId)}}catch(r){this.loggingService.catch("Error in FlockService startFollowingUser: ",r)}}stopFollowingUser(){try{this.removeCurrentUserFromSession()}catch(e){this.loggingService.catch("Error in FlockService stopFollowingUser: ",e)}}subscribeToUrlChanges(){try{if(this.useHistoryAPI){let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=(...r)=>{e.apply(window.history,r),this.onUrlChange()},window.history.replaceState=(...r)=>{t.apply(window.history,r),this.onUrlChange()},this.domSubscriptions.push({unsubscribe:()=>{window.history.pushState=e,window.history.replaceState=t}}),this.domSubscriptions.push(y(window,"popstate").subscribe(()=>{this.onUrlChange()}))}}catch(e){this.loggingService.catch("Error in FlockService subscribeToUrlChanges: ",e)}}onUrlChange(){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader){let e=new u;e.type=h.NAVIGATE,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,e)}}catch(e){this.loggingService.catch("Error in FlockService onUrlChange: ",e)}}processAction(e){try{switch(e.type){case h.CLICK:this.clickUserElement(e.data);break;case h.HOVER:this.scrollToHoveredElement(e.data);break;case h.SCROLL:this.scrollToFollowedUser(e.data);break;case h.NAVIGATE:this.checkMatchingUrl(e.pageInfo);break}this.currentFlockUser&&this.currentFlockUser.snippylyId&&this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,{lastProcessedActionTimestamp:e.timestamp})}catch(t){this.loggingService.catch("Error in FlockService processAction: ",t)}}subscribeToLeaderDOMEvents(){try{this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[]),this.domSubscriptions.push(y(window,"mouseover").pipe(C(500)).subscribe(e=>{let t=e?.target;if(t){let r=window.getComputedStyle(t);if(r.position==="fixed"||r.position==="sticky"||t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;t=L(t,{x:e.clientX,y:e.clientY}),this.updateHoveredElement(t)}})),this.domSubscriptions.push(this.domService.onWindowClick$().subscribe(e=>{let t=e?.target;if(t){if(t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;this.updateClickedElement(t)}})),this.subscribeToUrlChanges(),this.subscribeToScrollables()}catch(e){this.loggingService.catch("Error in FlockService subscribeToLeaderDOMEvents: ",e)}}subscribeToFollowerDOMEvents(){}updateClickedElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.CLICK,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateClickedElement: ",t)}}updateHoveredElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.HOVER,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateHoveredElement: ",t)}}subscribeToScrollables(){try{let e=V();e.push(document),e?.forEach(t=>{this.domSubscriptions.push(y(t,"scroll").pipe(C(100)).subscribe(r=>{this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader&&this.updateScrollPositionOfElement(t)}))})}catch(e){this.loggingService.catch("Error in FlockService getScrollableElements: ",e)}}updateScrollPositionOfElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=new U("","");if(e===document){let o=z();if(o){let s=L(o);s&&(t.targetXpath=this.domService.getXPath(s))}t.xpath=""}else{let o=H(e);t.targetXpath=this.domService.getXPath(o),t.xpath=this.domService.getXPath(e)}let r=!1,i=!1;if(this.localScrollData.forEach((o,s)=>{o.xpath===o.xpath&&(t.targetXpath!==o.targetXpath&&(r=!0),this.localScrollData[s]=Object.assign(o,t),i=!0)}),i||this.localScrollData.push(t),r||!i){let o=new u;o.type=h.SCROLL,o.data=t,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,o)}}}catch(t){this.loggingService.catch("Error in FlockService calculateScrollPositionOfAnElement: ",t)}}enableFlockMode(e){try{if(this.flockMode$.next(!0),e){let{useHistoryAPI:t,onNavigate:r,disableDefaultNavigation:i,darkMode:o}=e;t!==void 0&&(this.useHistoryAPI=t),r!==void 0&&typeof r=="function"&&(this.onNavigate=r),i!==void 0&&(this.disableDefaultNavigation=i),this.flockOverlayService.setDarkMode(o)}}catch(t){this.loggingService.catch("Error in FlockService enableFlockMode: ",t)}}disableFlockMode(){try{this.flockMode$.next(!1),this.onNavigateEmitter=void 0,this.useHistoryAPI=!0,this.onNavigate=void 0}catch(e){this.loggingService.catch("Error in FlockService disableFlockMode: ",e)}}setDisableFlockNavigation(e){try{this.disableDefaultNavigation=e}catch(t){this.loggingService.catch("Error in FlockService setDisableFlockNavigation: ",t)}}getFlockMode$(){return this.flockMode$.asObservable()}getFlockMode(){return this.flockMode$.value}setNavigateEmitter(e){try{this.onNavigateEmitter=e}catch(t){this.loggingService.catch("Error in FlockService setNavigateEmitter: ",t)}}setTabFocused(e){try{if(this.tabFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.tabFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.tabFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setTabFocused: ",t)}}setWindowFocused(e){try{if(this.windowFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.windowFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.windowFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setWindowFocused: ",t)}}setFlockLeader(e,t){try{this.flockLeader$.next({userId:e,name:t})}catch(r){this.loggingService.catch("Error in FlockService setFlockLeader: ",r)}}isInSession(){try{return!!(this.currentFlockUser&&this.currentFlockUser.sessionId)}catch(e){this.loggingService.catch("Error in FlockService isFollowing: ",e)}return!1}removeCurrentUserFromSession(){try{this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[],this.currentFlockUser&&(this.currentFlockUser.isLeader?this.currentFlockUser.sessionId&&this.flockSessionService.deleteSession(this.currentFlockUser.sessionId):this.currentFlockUser.snippylyId&&this.flockSessionService.removeFollowerFromCurrentSession(this.currentFlockUser.snippylyId))}catch(e){this.loggingService.catch("Error in FlockService removeCurrentUserFromSession: ",e)}}checkMatchingUrl(e){try{let r=k()?.url,i=e.url;if(r!==i&&i!==void 0){let{url:o,path:s,baseUrl:c}=e;if(this.onNavigate!==void 0&&typeof this.onNavigate=="function"){this.onNavigate({url:o,path:s,baseUrl:c});return}if(this.onNavigateEmitter&&this.onNavigateEmitter.emit({url:o,path:s,baseUrl:c}),this.disableDefaultNavigation)return;window.location.href=i}}catch(t){this.loggingService.catch("Error in FlockService checkMatchingUrl: ",t)}}scrollToFollowedUser(e){try{if(e.xpath===""){let t=this.domService.getElementFromXPath(e.targetXpath);t&&F(t)}else{let t=this.domService.getElementFromXPath(e.xpath),r=this.domService.getElementFromXPath(e.targetXpath);t&&r&&(F(t),R(t,r))}}catch(t){this.loggingService.catch("Error in FlockService scrollToFollowedUser: ",t)}}clickUserElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);t&&this.lastClickedElement?.id!==e.id&&(t?.click(),this.lastClickedElement=e)}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}scrollToHoveredElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);if(t&&e.parentXpath)if(e.parentXpath==="/html")F(t);else{let r=this.domService.getElementFromXPath(e.parentXpath);r&&R(r,t,!0)}}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(b),a(G),a(g),a(Q),a(Z))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{Ce as a};
1
+ import{a as N}from"./chunk-WNQGJ6NQ.js";import{$ as v,Ai as B,E as P,Ee as m,Fi as J,G as x,I as C,J as f,Ma as j,Oi as K,Pi as W,Sg as V,Tg as L,Ug as H,Vf as $,Vg as z,Wg as R,Xg as F,bb as X,ca as a,ki as g,l as p,la as M,lg as T,qg as k,r as A,si as G,ti as b,w as D,z as y}from"./chunk-YTAAOIBL.js";var h=(function(l){return l.CLICK="click",l.HOVER="hover",l.SCROLL="scroll",l.NAVIGATE="navigate",l})(h||{}),u=class{constructor(){this.type=h.HOVER,this.data=null,this.pageInfo=k(),this.timestamp=Date.now()}},U=class{constructor(n,w){this.targetXpath=n,this.xpath=w}};var E=class{constructor(){this.sessionId=null,this.isLeader=!1,this.lastProcessedActionTimestamp=null}};var S=class{constructor(n){this.snippylyId=n,this.joinTimestamp=Date.now()}};var I=class{constructor(n,w,e){this.followers=[],this.actionStack=[],this.id=$(),this.leaderId=n,this.leaderName=w,this.followers.push(new S(e))}};var Q=(()=>{let n=class n{constructor(e,t,r,i,o,s){this.databaseService=e,this.docService=t,this.loggingService=r,this.authService=i,this.commonDbService=o,this.realtimeAdapter=s,this.currentUser$=new p(null),this.currentSession$=new p(null);try{this.databaseService.getDb().pipe(P(c=>!!c),f(1)).subscribe(c=>{c&&(this.db=c)},c=>{this.loggingService.catch("Error in FlockSessionService getDb subscription: ",c)}),this.authService.getUser$().subscribe(c=>{c&&c.userSnippylyId&&(this.user=c)})}catch(c){this.loggingService.catch("Error in FlockSessionService constructor: ",c)}}startCurrentFlockUserSubscription(e){try{this.currentUserSub?.unsubscribe(),e&&e.userSnippylyId&&(this.user=e,this.subscribeToCurrentFlockUser(e?.userSnippylyId))}catch(t){this.loggingService.catch("Error in FlockSessionService startCurrentFlockUserSubscription: ",t)}}stopCurrentFlockUserSubscription(){try{this.currentUserSub?.unsubscribe()}catch(e){this.loggingService.catch("Error in FlockSessionService stopCurrentFlockUserSubscription: ",e)}}provisionFlockSession(e,t,r){try{let i=this.docService.getDocumentPaths();i&&this.db&&this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:i?.documentId,organizationId:i?.organizationId,id:e,skipFirestore:!0}}).pipe(f(1)).subscribe(o=>{o?.data&&o?.data?.sessionId?this.subscribeToCurrentSession(o?.data?.sessionId,r):this.createFlockSession(e,t,r)})}catch(i){this.loggingService.catch("Error in FlockSessionService provisionFlockSession: ",i)}return null}swapLeader(e,t,r){try{if(this.updateRemoteFlockUser(e,{isLeader:!1}),this.updateRemoteFlockUser(t,{isLeader:!0}),this.currentSession){this.currentSession.leaderId=t,this.currentSession.leaderName=r,this.currentSession.followers.push(new S(e));let i=this.currentSession.followers.findIndex(o=>o.snippylyId===t);i>-1&&this.currentSession.followers.splice(i,1),this.updateSession(this.currentSession.id,this.currentSession)}}catch(i){this.loggingService.catch("Error in FlockSessionService swapLeader: ",i)}}createFlockSession(e,t,r){try{let i=new I(e,t,r);return this.updateRemoteFlockUser(e,{snippylyId:e,sessionId:i.id,isLeader:!0}),this.updateSession(i.id,i),this.subscribeToCurrentSession(i.id),i.id}catch(i){this.loggingService.catch("Error in FlockSessionService createFlockSession: ",i)}return null}removeFollowerFromCurrentSession(e){try{if(this.currentSession){this.updateRemoteFlockUser(e,{sessionId:null,lastProcessedActionTimestamp:null});let t=this.currentSession.followers.findIndex(r=>r.snippylyId===e);if(t>-1){if(this.currentSession.followers.splice(t,1),this.currentSession.followers.length===0){this.deleteSession(this.currentSession.id);return}this.updateSession(this.currentSession.id,this.currentSession),this.user&&this.user.userSnippylyId&&this.user.userSnippylyId===e&&(this.sessionSub?.unsubscribe(),this.currentSession=void 0,this.currentSession$?.next(null))}}}catch(t){this.loggingService.catch("Error in FlockSessionService removeFollowerFromSession: ",t)}}updateRemoteFlockUser(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockUser",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateRemoteFlockUser: ",r)}}subscribeToCurrentSession(e,t=void 0){try{let r=this.docService.getDocumentPaths();r&&this.db&&(this.sessionSub&&this.sessionSub.unsubscribe(),this.sessionSub=this.commonDbService.dbListener({feature:"flockSession",properties:{documentId:r?.documentId,organizationId:r?.organizationId,id:e,skipFirestore:!0}}).subscribe(i=>{i?.data&&typeof i?.data=="object"&&Object.keys(i?.data)?.length>0?(this.currentSession=i?.data,t!==void 0&&this.currentSession?.followers.findIndex(o=>o.snippylyId===t)===-1&&(this.currentSession.followers.push(new S(t)),this.updateSession(this.currentSession.id,this.currentSession)),this.currentSession$.next(this.currentSession??null)):(this.currentSession=void 0,this.currentSession$.next(null))}))}catch(r){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentSession: ",r)}}subscribeToCurrentFlockUser(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.currentUserSub&&this.currentUserSub.unsubscribe(),this.currentUserSub=this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:t?.documentId,organizationId:t?.organizationId,id:e,skipFirestore:!0}}).pipe(x(r=>(this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",r),A(null)))).subscribe(r=>{r?.data&&typeof r?.data=="object"&&Object.keys(r?.data)?.length>0&&(this.currentUser$.next(r?.data),r?.data?.sessionId&&this.subscribeToCurrentSession(r?.data?.sessionId))},r=>{this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser subscription: ",r)}))}catch(t){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",t)}}updateSession(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockSession",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateSession: ",r)}}deleteSession(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.commonDbService.deleteData({feature:"flockSession",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:e,skipFirestore:!0}}),this.currentSession&&e===this.currentSession.id&&(this.updateRemoteFlockUser(this.currentSession.leaderId,{sessionId:null,isLeader:!1,lastProcessedActionTimestamp:null}),this.currentSession.followers.forEach(r=>{this.updateRemoteFlockUser(r.snippylyId,{sessionId:null,lastProcessedActionTimestamp:null})}),this.currentSession=void 0,this.currentSession$.next(null),this.sessionSub?.unsubscribe()))}catch(t){this.loggingService.catch("Error in FlockSessionService deleteSession: ",t)}}addActionToStack(e,t){try{t=t&&JSON.parse(JSON.stringify(t));let r=this.docService.getDocumentPaths();if(r&&this.db&&e){let i=this.realtimeAdapter.rtdbRef(this.db,`${r.flock}/sessions/${e}/actionStack`);this.realtimeAdapter.rtdbRunTransaction("flockSession",i,o=>o?(o.unshift(t),o.slice(0,5)):[t]),t.type===h.NAVIGATE&&this.updateSession(e,{pageInfo:t.pageInfo})}}catch(r){this.loggingService.catch("Error in FlockSessionService addActionToStack: ",r)}}};n.\u0275fac=function(t){return new(t||n)(a(B),a(J),a(g),a(b),a(W),a(K))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Z=(()=>{let n=class n{constructor(e,t,r,i){this.componentFactoryResolver=e,this.applicationRef=t,this.injector=r,this.loggingService=i,this.darkMode=!1}createFollowOverlay(e,t){try{let i=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);i.instance.setLeaderName(e),i.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),t()}),this.applicationRef.attachView(i.hostView),this.overlayRef=i,this.overlayRef.instance.darkMode=this.darkMode;let o=this.overlayRef.location.nativeElement;o.id="snippyly-follow-overlay",o.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(o)}catch(r){this.loggingService.catch("Error in FlockOverlayService createFollowOverlay: ",r)}}createLeaderOverlay(e){let r=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);r.instance.setType("leading"),r.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),e()}),this.applicationRef.attachView(r.hostView),this.overlayRef=r,this.overlayRef.instance.darkMode=this.darkMode;let i=this.overlayRef.location.nativeElement;i.id="snippyly-follow-overlay",i.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(i)}changeLeaderName(e){this.overlayRef&&this.overlayRef.instance.setLeaderName(e)}getLeaderName(){return this.overlayRef?this.overlayRef.instance.getLeaderName():null}removeOverlay(){if(this.overlayRef){let e=this.overlayRef.location.nativeElement;this.applicationRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),e.shadowRoot&&e.shadowRoot.removeChild(e.shadowRoot.childNodes[0]),e.remove(),this.overlayRef=void 0}}setDarkMode(e){try{this.darkMode=e,this.overlayRef&&(this.overlayRef.instance.darkMode=e)}catch(t){this.loggingService.catch("Error in FlockOverlayService setDarkMode: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(j),a(X),a(M),a(g))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Ce=(()=>{let n=class n{constructor(e,t,r,i,o){this.authService=e,this.domService=t,this.loggingService=r,this.flockSessionService=i,this.flockOverlayService=o,this.flockLeader$=new p({userId:"",name:""}),this.flockMode$=new p(!1),this.currentFlockUser=null,this.localScrollData=[],this.domSubscriptions=[],this.followOverlayCreated=!1,this.leaderOverlayCreated=!1,this.windowFocused=!0,this.tabFocused=!0,this.useHistoryAPI=!0,this.disableDefaultNavigation=!1;try{this.flockLeader$.subscribe(s=>{let{userId:c,name:d}=s,O=c;if(this.provisionFollowUser(),O&&this.currentFlockUser&&this.currentFlockUser.snippylyId)if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,O,d);return}this.removeCurrentUserFromSession()}else this.flockSessionService.provisionFlockSession(O,d,this.currentFlockUser.snippylyId)},s=>{this.loggingService.catch("Error in FlockService flockLeader$ subscription: ",s)}),this.flockSessionService.currentSession$.subscribe(s=>{if(s!==null){if(this.currentFlockUser&&(this.currentFlockUser.sessionId===null||this.currentFlockUser.sessionId===void 0)&&this.currentFlockUser.snippylyId&&(this.currentFlockUser.sessionId=s.id,this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,this.currentFlockUser)),this.currentFlockUser&&!this.currentFlockUser.isLeader&&!this.followOverlayCreated&&(this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.followOverlayCreated=!0,this.flockOverlayService.createFollowOverlay(s.leaderName,()=>{this.removeCurrentUserFromSession(),this.followOverlayCreated=!1})),this.currentFlockUser&&this.currentFlockUser.isLeader&&!this.leaderOverlayCreated&&(this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1),this.leaderOverlayCreated=!0,this.flockOverlayService.createLeaderOverlay(()=>{this.removeCurrentUserFromSession(),this.leaderOverlayCreated=!1})),this.currentFlockUser&&!this.currentFlockUser.isLeader&&s.actionStack){let c=s.actionStack[0];c&&this.currentFlockUser.lastProcessedActionTimestamp!==c.timestamp&&this.processAction(c)}if(this.currentFlockUser&&!this.currentFlockUser.isLeader&&this.followOverlayCreated&&this.flockOverlayService.getLeaderName()!==null&&s.leaderName!==this.flockOverlayService.getLeaderName()&&this.flockOverlayService.changeLeaderName(s.leaderName),this.currentFlockUser&&this.currentFlockUser.isLeader){let c=k();if(s.pageInfo){if(c&&c.url!==s.pageInfo.url){let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}else{this.flockSessionService.updateSession(s.id,{pageInfo:c});let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}}else this.currentFlockUser&&this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.currentFlockUser&&this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1)}),this.flockSessionService.currentUser$.subscribe(s=>{if(s!==null&&(this.currentFlockUser&&this.currentFlockUser.isLeader!==s.isLeader&&(this.domSubscriptions.forEach(c=>c.unsubscribe()),this.domSubscriptions=[]),this.currentFlockUser=s,s.sessionId&&this.domSubscriptions.length===0))if(s.isLeader){if(!this.tabFocused||!this.windowFocused)return;this.subscribeToLeaderDOMEvents()}else this.subscribeToFollowerDOMEvents()}),D([this.authService.getUser$(),this.getFlockMode$()]).subscribe(([s,c])=>{s&&s.userSnippylyId&&c?this.flockSessionService.startCurrentFlockUserSubscription(s):this.flockSessionService.stopCurrentFlockUserSubscription()})}catch(s){this.loggingService.catch("Error in FlockService constructor: ",s)}}provisionFollowUser(){try{if(this.currentFlockUser===null){let e=this.authService.getUser();e&&e.userSnippylyId&&(this.currentFlockUser=new E,this.currentFlockUser.snippylyId=e.userSnippylyId)}}catch(e){this.loggingService.catch("Error in FlockService provisionFollowUser: ",e)}}startFollowingUser(e,t){try{if(this.provisionFollowUser(),e&&this.currentFlockUser&&this.currentFlockUser.snippylyId){if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,e,t);return}this.removeCurrentUserFromSession()}this.flockSessionService.provisionFlockSession(e,t,this.currentFlockUser.snippylyId)}}catch(r){this.loggingService.catch("Error in FlockService startFollowingUser: ",r)}}stopFollowingUser(){try{this.removeCurrentUserFromSession()}catch(e){this.loggingService.catch("Error in FlockService stopFollowingUser: ",e)}}subscribeToUrlChanges(){try{if(this.useHistoryAPI){let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=(...r)=>{e.apply(window.history,r),this.onUrlChange()},window.history.replaceState=(...r)=>{t.apply(window.history,r),this.onUrlChange()},this.domSubscriptions.push({unsubscribe:()=>{window.history.pushState=e,window.history.replaceState=t}}),this.domSubscriptions.push(y(window,"popstate").subscribe(()=>{this.onUrlChange()}))}}catch(e){this.loggingService.catch("Error in FlockService subscribeToUrlChanges: ",e)}}onUrlChange(){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader){let e=new u;e.type=h.NAVIGATE,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,e)}}catch(e){this.loggingService.catch("Error in FlockService onUrlChange: ",e)}}processAction(e){try{switch(e.type){case h.CLICK:this.clickUserElement(e.data);break;case h.HOVER:this.scrollToHoveredElement(e.data);break;case h.SCROLL:this.scrollToFollowedUser(e.data);break;case h.NAVIGATE:this.checkMatchingUrl(e.pageInfo);break}this.currentFlockUser&&this.currentFlockUser.snippylyId&&this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,{lastProcessedActionTimestamp:e.timestamp})}catch(t){this.loggingService.catch("Error in FlockService processAction: ",t)}}subscribeToLeaderDOMEvents(){try{this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[]),this.domSubscriptions.push(y(window,"mouseover").pipe(C(500)).subscribe(e=>{let t=e?.target;if(t){let r=window.getComputedStyle(t);if(r.position==="fixed"||r.position==="sticky"||t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;t=L(t,{x:e.clientX,y:e.clientY}),this.updateHoveredElement(t)}})),this.domSubscriptions.push(this.domService.onWindowClick$().subscribe(e=>{let t=e?.target;if(t){if(t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;this.updateClickedElement(t)}})),this.subscribeToUrlChanges(),this.subscribeToScrollables()}catch(e){this.loggingService.catch("Error in FlockService subscribeToLeaderDOMEvents: ",e)}}subscribeToFollowerDOMEvents(){}updateClickedElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.CLICK,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateClickedElement: ",t)}}updateHoveredElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.HOVER,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateHoveredElement: ",t)}}subscribeToScrollables(){try{let e=V();e.push(document),e?.forEach(t=>{this.domSubscriptions.push(y(t,"scroll").pipe(C(100)).subscribe(r=>{this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader&&this.updateScrollPositionOfElement(t)}))})}catch(e){this.loggingService.catch("Error in FlockService getScrollableElements: ",e)}}updateScrollPositionOfElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=new U("","");if(e===document){let o=z();if(o){let s=L(o);s&&(t.targetXpath=this.domService.getXPath(s))}t.xpath=""}else{let o=H(e);t.targetXpath=this.domService.getXPath(o),t.xpath=this.domService.getXPath(e)}let r=!1,i=!1;if(this.localScrollData.forEach((o,s)=>{o.xpath===o.xpath&&(t.targetXpath!==o.targetXpath&&(r=!0),this.localScrollData[s]=Object.assign(o,t),i=!0)}),i||this.localScrollData.push(t),r||!i){let o=new u;o.type=h.SCROLL,o.data=t,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,o)}}}catch(t){this.loggingService.catch("Error in FlockService calculateScrollPositionOfAnElement: ",t)}}enableFlockMode(e){try{if(this.flockMode$.next(!0),e){let{useHistoryAPI:t,onNavigate:r,disableDefaultNavigation:i,darkMode:o}=e;t!==void 0&&(this.useHistoryAPI=t),r!==void 0&&typeof r=="function"&&(this.onNavigate=r),i!==void 0&&(this.disableDefaultNavigation=i),this.flockOverlayService.setDarkMode(o)}}catch(t){this.loggingService.catch("Error in FlockService enableFlockMode: ",t)}}disableFlockMode(){try{this.flockMode$.next(!1),this.onNavigateEmitter=void 0,this.useHistoryAPI=!0,this.onNavigate=void 0}catch(e){this.loggingService.catch("Error in FlockService disableFlockMode: ",e)}}setDisableFlockNavigation(e){try{this.disableDefaultNavigation=e}catch(t){this.loggingService.catch("Error in FlockService setDisableFlockNavigation: ",t)}}getFlockMode$(){return this.flockMode$.asObservable()}getFlockMode(){return this.flockMode$.value}setNavigateEmitter(e){try{this.onNavigateEmitter=e}catch(t){this.loggingService.catch("Error in FlockService setNavigateEmitter: ",t)}}setTabFocused(e){try{if(this.tabFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.tabFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.tabFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setTabFocused: ",t)}}setWindowFocused(e){try{if(this.windowFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.windowFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.windowFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setWindowFocused: ",t)}}setFlockLeader(e,t){try{this.flockLeader$.next({userId:e,name:t})}catch(r){this.loggingService.catch("Error in FlockService setFlockLeader: ",r)}}isInSession(){try{return!!(this.currentFlockUser&&this.currentFlockUser.sessionId)}catch(e){this.loggingService.catch("Error in FlockService isFollowing: ",e)}return!1}removeCurrentUserFromSession(){try{this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[],this.currentFlockUser&&(this.currentFlockUser.isLeader?this.currentFlockUser.sessionId&&this.flockSessionService.deleteSession(this.currentFlockUser.sessionId):this.currentFlockUser.snippylyId&&this.flockSessionService.removeFollowerFromCurrentSession(this.currentFlockUser.snippylyId))}catch(e){this.loggingService.catch("Error in FlockService removeCurrentUserFromSession: ",e)}}checkMatchingUrl(e){try{let r=k()?.url,i=e.url;if(r!==i&&i!==void 0){let{url:o,path:s,baseUrl:c}=e;if(this.onNavigate!==void 0&&typeof this.onNavigate=="function"){this.onNavigate({url:o,path:s,baseUrl:c});return}if(this.onNavigateEmitter&&this.onNavigateEmitter.emit({url:o,path:s,baseUrl:c}),this.disableDefaultNavigation)return;window.location.href=i}}catch(t){this.loggingService.catch("Error in FlockService checkMatchingUrl: ",t)}}scrollToFollowedUser(e){try{if(e.xpath===""){let t=this.domService.getElementFromXPath(e.targetXpath);t&&F(t)}else{let t=this.domService.getElementFromXPath(e.xpath),r=this.domService.getElementFromXPath(e.targetXpath);t&&r&&(F(t),R(t,r))}}catch(t){this.loggingService.catch("Error in FlockService scrollToFollowedUser: ",t)}}clickUserElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);t&&this.lastClickedElement?.id!==e.id&&(t?.click(),this.lastClickedElement=e)}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}scrollToHoveredElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);if(t&&e.parentXpath)if(e.parentXpath==="/html")F(t);else{let r=this.domService.getElementFromXPath(e.parentXpath);r&&R(r,t,!0)}}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(b),a(G),a(g),a(Q),a(Z))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{Ce as a};
@@ -1 +1 @@
1
- import{b as x,c as R,d as f,e as F,f as k}from"./chunk-WNW7AS77.js";import{$ as v,Ch as E,Di as N,Ee as I,Fe as C,Ve as S,Vf as w,Wd as u,Yd as y,be as A,ca as d,g,ki as L,li as O,qi as D,ri as P,ti as j}from"./chunk-CRZGZZVQ.js";var z=l=>{try{let n={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return P.sanitize(l,n)}catch(n){return u.catch("Error in File utils sanitizeSvg: ",n),""}},U=l=>{try{return l.name.split(".").slice(0,-1).join(".")}catch(n){u.catch("Error in File utils getFileName: ",n);return}},T=l=>{try{return/(?:\.([^.]+))?$/.exec(l?.name)[1]}catch(n){u.catch("Error in File utils getFileExtension: ",n);return}},M=(l,n)=>{try{let h=l.slice(0,-1,l.type);return new File([h],n+"."+T(l),{type:l.type})}catch(h){u.catch("Error in File utils updateFile: ",h);return}};var b={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var _=(()=>{let n=class n{getStorageInstance(t){return t?f(void 0,t):f()}ref(t,e){return F(t,e)}uploadBytesResumable(t,e,o){return k(t,e,o)}getDownloadURL(t){return R(t)}deleteObject(t){return x(t)}};n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var ae=(()=>{let n=class n{constructor(t,e,o,a,c,s){this.authService=t,this.configService=e,this.coreActionsService=o,this.loggingService=a,this.attachmentResolverService=c,this.storageAdapter=s,this.storage=this.storageAdapter.getStorageInstance();try{this.configService.getApiKey$().subscribe(r=>{this.apiKey=r}),this.authService.getFirebaseConfig$().subscribe(r=>{if(r&&r.firebaseOptions?.storageBucket){this.storage=this.storageAdapter.getStorageInstance(r?.firebaseOptions?.storageBucket);let i=this.configService.getProxyConfig();i?.storageHost&&(this.storage.host=i.storageHost)}},r=>{this.loggingService.catch("Error in StorageService constructor: ",r)})}catch(r){this.loggingService.catch("Error in StorageService constructor:",r)}}createAttachment({path:t,file:e}){try{let o=new C;o.name=e.name;let a=M(e,`${o.attachmentId}_${U(e)}`),c=`${this.apiKey}/${t}/${a?.name}`;return o.bucketPath=c,o.size=e.size,o.type=T(e),o?.type&&(o.mimeType=b[o?.type]),o}catch(o){return this.loggingService.catch("Error in StorageService createAttachment: ",o),null}}sanitizeSvgFile(t){return g(this,null,function*(){if(t.type===b.svg)try{let e=yield t.text(),o=z(e);return new File([o],t.name,{type:t.type})}catch(e){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",e),t}return t})}uploadAttachmentToStorage(c){return g(this,arguments,function*({attachment:t,file:e,resolve:o,reject:a}){try{let s=this.storageAdapter.ref(this.storage,t.bucketPath),r=this.storageAdapter.uploadBytesResumable(s,e,{cacheControl:"public,max-age=3600"});r.on("state_changed",i=>{let m=i.bytesTransferred/i.totalBytes*100},i=>{a(i)},()=>{this.storageAdapter.getDownloadURL(r.snapshot.ref).then(i=>{t.url=i,o(t)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}})}uploadToResolver(r){return g(this,arguments,function*({file:t,attachment:e,metadata:o,resolve:a,reject:c,scope:s}){try{o.attachmentId=e.attachmentId;let i={attachmentId:e.attachmentId,name:e.name,file:t,metadata:o,mimeType:e.mimeType},m=w();this.coreActionsService.triggerAction(A.ATTACHMENT_RESOLVER,{event:E.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:m,methodName:S.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:i,eventType:y.ATTACHMENT_ADD}});let p=yield this.attachmentResolverService.saveAttachment({attachment:i,eventType:y.ATTACHMENT_ADD},m,s);p&&p.data?.url?(e.url=p.data?.url,a(e)):c(new Error("Failed to upload attachment to resolver"))}catch(i){this.loggingService.catch("Error in StorageService uploadToResolver: ",i),c(i)}})}uploadFile({path:t,file:e,useAttachmentResolver:o,metadata:a,attachmentScope:c}){return new Promise((s,r)=>g(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let i=yield this.sanitizeSvgFile(e),m=this.createAttachment({path:t,file:i});if(!m)throw new Error("Attachment not created");o?this.uploadToResolver({file:i,attachment:m,metadata:a,resolve:s,reject:r,scope:c}):this.uploadAttachmentToStorage({attachment:m,file:i,resolve:s,reject:r})}catch(i){this.loggingService.catch("Error in StorageService uploadFile:",i),r(i)}}))}uploadChunk(t,e,o,a){return new Promise((c,s)=>{try{if(a?.useAttachmentResolver){let r=this.createAttachment({path:t,file:e});if(!r){s(new Error("Attachment not created for chunk upload"));return}this.uploadToResolver({file:e,attachment:r,metadata:a.metadata,resolve:i=>c(i.url),reject:s,scope:a.attachmentScope});return}if(this.apiKey){let r=`${this.apiKey}/${t}/${e.name}`,i=this.storageAdapter.ref(this.storage,r),m=this.storageAdapter.uploadBytesResumable(i,e,{cacheControl:"public,max-age=3600"});m.on("state_changed",p=>{let H=p.bytesTransferred/p.totalBytes*100},p=>{s(p)},()=>{this.storageAdapter.getDownloadURL(m.snapshot.ref).then(p=>{c(p)}).catch(p=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${o}:`,p),s(p)})})}else{let r=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",r),s(r)}}catch(r){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${o}: `,r),s(r)}})}downloadAttachment(t){try{if(t.url){let e=new XMLHttpRequest;e.responseType="blob",e.onload=()=>{let o=e.response,a=document.createElement("a"),c=window.URL.createObjectURL(o);a.setAttribute("type","hidden"),a.setAttribute(I.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=c,t?.name&&(a.download=t?.name),document.body.appendChild(a);let s=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(s),window.URL.revokeObjectURL(c),a.remove()},e.onerror=()=>{window.open(t.url,"_blank")},e.open("GET",t.url),e.send()}}catch(e){this.loggingService.catch("Error in StorageService downloadAttachment: ",e)}}deleteAttachment({attachment:t,metadata:e,useAttachmentResolver:o,attachmentScope:a}){return new Promise((c,s)=>{if(o){let r=w();this.coreActionsService.triggerAction(A.ATTACHMENT_RESOLVER,{event:E.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:S.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t.attachmentId,metadata:e}}),this.attachmentResolverService.deleteAttachment({attachmentId:t.attachmentId,metadata:e},r,a).then(()=>{c(null)}).catch(i=>{s(i)})}else{let r=this.storageAdapter.ref(this.storage,t.bucketPath);this.storageAdapter.deleteObject(r).then(()=>{c(null)}).catch(i=>{c(null)})}})}deleteFileFromPath(t){return new Promise((e,o)=>{let a=this.storageAdapter.ref(this.storage,t);this.storageAdapter.deleteObject(a).then(()=>{e(null)}).catch(c=>{o(c)})})}};n.\u0275fac=function(e){return new(e||n)(d(j),d(O),d(D),d(L),d(N),d(_))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{ae as a};
1
+ import{b as x,c as R,d as f,e as F,f as k}from"./chunk-T4Z2W6NR.js";import{$ as v,Ch as E,Di as N,Ee as I,Fe as C,Ve as S,Vf as w,Wd as u,Yd as y,be as A,ca as d,g,ki as L,li as O,qi as D,ri as P,ti as j}from"./chunk-YTAAOIBL.js";var z=l=>{try{let n={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return P.sanitize(l,n)}catch(n){return u.catch("Error in File utils sanitizeSvg: ",n),""}},U=l=>{try{return l.name.split(".").slice(0,-1).join(".")}catch(n){u.catch("Error in File utils getFileName: ",n);return}},T=l=>{try{return/(?:\.([^.]+))?$/.exec(l?.name)[1]}catch(n){u.catch("Error in File utils getFileExtension: ",n);return}},M=(l,n)=>{try{let h=l.slice(0,-1,l.type);return new File([h],n+"."+T(l),{type:l.type})}catch(h){u.catch("Error in File utils updateFile: ",h);return}};var b={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var _=(()=>{let n=class n{getStorageInstance(t){return t?f(void 0,t):f()}ref(t,e){return F(t,e)}uploadBytesResumable(t,e,o){return k(t,e,o)}getDownloadURL(t){return R(t)}deleteObject(t){return x(t)}};n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var ae=(()=>{let n=class n{constructor(t,e,o,a,c,s){this.authService=t,this.configService=e,this.coreActionsService=o,this.loggingService=a,this.attachmentResolverService=c,this.storageAdapter=s,this.storage=this.storageAdapter.getStorageInstance();try{this.configService.getApiKey$().subscribe(r=>{this.apiKey=r}),this.authService.getFirebaseConfig$().subscribe(r=>{if(r&&r.firebaseOptions?.storageBucket){this.storage=this.storageAdapter.getStorageInstance(r?.firebaseOptions?.storageBucket);let i=this.configService.getProxyConfig();i?.storageHost&&(this.storage.host=i.storageHost)}},r=>{this.loggingService.catch("Error in StorageService constructor: ",r)})}catch(r){this.loggingService.catch("Error in StorageService constructor:",r)}}createAttachment({path:t,file:e}){try{let o=new C;o.name=e.name;let a=M(e,`${o.attachmentId}_${U(e)}`),c=`${this.apiKey}/${t}/${a?.name}`;return o.bucketPath=c,o.size=e.size,o.type=T(e),o?.type&&(o.mimeType=b[o?.type]),o}catch(o){return this.loggingService.catch("Error in StorageService createAttachment: ",o),null}}sanitizeSvgFile(t){return g(this,null,function*(){if(t.type===b.svg)try{let e=yield t.text(),o=z(e);return new File([o],t.name,{type:t.type})}catch(e){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",e),t}return t})}uploadAttachmentToStorage(c){return g(this,arguments,function*({attachment:t,file:e,resolve:o,reject:a}){try{let s=this.storageAdapter.ref(this.storage,t.bucketPath),r=this.storageAdapter.uploadBytesResumable(s,e,{cacheControl:"public,max-age=3600"});r.on("state_changed",i=>{let m=i.bytesTransferred/i.totalBytes*100},i=>{a(i)},()=>{this.storageAdapter.getDownloadURL(r.snapshot.ref).then(i=>{t.url=i,o(t)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}})}uploadToResolver(r){return g(this,arguments,function*({file:t,attachment:e,metadata:o,resolve:a,reject:c,scope:s}){try{o.attachmentId=e.attachmentId;let i={attachmentId:e.attachmentId,name:e.name,file:t,metadata:o,mimeType:e.mimeType},m=w();this.coreActionsService.triggerAction(A.ATTACHMENT_RESOLVER,{event:E.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:m,methodName:S.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:i,eventType:y.ATTACHMENT_ADD}});let p=yield this.attachmentResolverService.saveAttachment({attachment:i,eventType:y.ATTACHMENT_ADD},m,s);p&&p.data?.url?(e.url=p.data?.url,a(e)):c(new Error("Failed to upload attachment to resolver"))}catch(i){this.loggingService.catch("Error in StorageService uploadToResolver: ",i),c(i)}})}uploadFile({path:t,file:e,useAttachmentResolver:o,metadata:a,attachmentScope:c}){return new Promise((s,r)=>g(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let i=yield this.sanitizeSvgFile(e),m=this.createAttachment({path:t,file:i});if(!m)throw new Error("Attachment not created");o?this.uploadToResolver({file:i,attachment:m,metadata:a,resolve:s,reject:r,scope:c}):this.uploadAttachmentToStorage({attachment:m,file:i,resolve:s,reject:r})}catch(i){this.loggingService.catch("Error in StorageService uploadFile:",i),r(i)}}))}uploadChunk(t,e,o,a){return new Promise((c,s)=>{try{if(a?.useAttachmentResolver){let r=this.createAttachment({path:t,file:e});if(!r){s(new Error("Attachment not created for chunk upload"));return}this.uploadToResolver({file:e,attachment:r,metadata:a.metadata,resolve:i=>c(i.url),reject:s,scope:a.attachmentScope});return}if(this.apiKey){let r=`${this.apiKey}/${t}/${e.name}`,i=this.storageAdapter.ref(this.storage,r),m=this.storageAdapter.uploadBytesResumable(i,e,{cacheControl:"public,max-age=3600"});m.on("state_changed",p=>{let H=p.bytesTransferred/p.totalBytes*100},p=>{s(p)},()=>{this.storageAdapter.getDownloadURL(m.snapshot.ref).then(p=>{c(p)}).catch(p=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${o}:`,p),s(p)})})}else{let r=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",r),s(r)}}catch(r){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${o}: `,r),s(r)}})}downloadAttachment(t){try{if(t.url){let e=new XMLHttpRequest;e.responseType="blob",e.onload=()=>{let o=e.response,a=document.createElement("a"),c=window.URL.createObjectURL(o);a.setAttribute("type","hidden"),a.setAttribute(I.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=c,t?.name&&(a.download=t?.name),document.body.appendChild(a);let s=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(s),window.URL.revokeObjectURL(c),a.remove()},e.onerror=()=>{window.open(t.url,"_blank")},e.open("GET",t.url),e.send()}}catch(e){this.loggingService.catch("Error in StorageService downloadAttachment: ",e)}}deleteAttachment({attachment:t,metadata:e,useAttachmentResolver:o,attachmentScope:a}){return new Promise((c,s)=>{if(o){let r=w();this.coreActionsService.triggerAction(A.ATTACHMENT_RESOLVER,{event:E.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:S.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t.attachmentId,metadata:e}}),this.attachmentResolverService.deleteAttachment({attachmentId:t.attachmentId,metadata:e},r,a).then(()=>{c(null)}).catch(i=>{s(i)})}else{let r=this.storageAdapter.ref(this.storage,t.bucketPath);this.storageAdapter.deleteObject(r).then(()=>{c(null)}).catch(i=>{c(null)})}})}deleteFileFromPath(t){return new Promise((e,o)=>{let a=this.storageAdapter.ref(this.storage,t);this.storageAdapter.deleteObject(a).then(()=>{e(null)}).catch(c=>{o(c)})})}};n.\u0275fac=function(e){return new(e||n)(d(j),d(O),d(D),d(L),d(N),d(_))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{ae as a};
@@ -1,2 +1,2 @@
1
- import{$ as F,Ab as j,Bb as B,Ca as N,Db as G,Eb as Y,Fa as u,Fb as H,Gc as ee,Ib as W,Jb as y,Kc as te,Mb as q,Nb as $,Pa as h,Pb as Q,Pc as A,Ua as b,Xa as V,_a as S,a as s,ac as K,b as g,ca as E,db as p,g as D,ha as P,hh as oe,ia as x,ki as k,lb as c,mb as v,nb as C,ob as M,pc as J,qa as f,sb as T,sc as X,si as ne,tb as _,tc as Z,ti as ie,ua as L,vb as O,wa as w,xb as z,zb as l}from"./chunk-CRZGZZVQ.js";var ae={en:{"Action button":"Action button",Yes:"Yes",Delete:"Delete",Cancel:"Cancel","Delete thread?":"Delete thread?","All replies to this thread will be lost.":"All replies to this thread will be lost.","Delete comment?":"Delete comment?","This selected comment will be deleted.":"This selected comment will be deleted.","Delete recording?":"Delete recording?","This selected recording will be deleted.":"This selected recording will be deleted.","Delete area?":"Delete area?","This selected area will be deleted.":"This selected area will be deleted.","Delete arrow?":"Delete arrow?","This selected arrow will be deleted.":"This selected arrow will be deleted.","Delete tag?":"Delete tag?","This selected tag will be deleted.":"This selected tag will be deleted.","Contact us":"Contact us","Let us know how can we help you!":"Let us know how can we help you!","Your email address":"Your email address","How can we help?":"How can we help?",Send:"Send","Allow mic permission to":"Allow mic permission to","enable your audio":"enable your audio","1. Click the":"1. Click the","page info icon in your browser\u2019s address bar":"page info icon in your browser\u2019s address bar","2. Turn on Microphone":"2. Turn on Microphone","2. Turn on Camera":"2. Turn on Camera","Allow camera permission":"Allow camera permission","to enable your video":"to enable your video",dropdown:"dropdown","assign dropdown":"assign dropdown","custom dropdown":"custom dropdown","options dropdown":"options dropdown","priority dropdown":"priority dropdown","status dropdown":"status dropdown","seen dropdown":"seen dropdown",menu:"menu","assign menu":"assign menu","custom menu":"custom menu","options menu":"options menu","priority menu":"priority menu","status menu":"status menu","seen menu":"seen menu","menu items":"menu items","assign menu items":"assign menu items","custom menu items":"custom menu items","options menu items":"options menu items","priority menu items":"priority menu items","status menu items":"status menu items","seen menu items":"seen menu items","Playback Speed":"Playback Speed","Subtitles not available":"Subtitles not available","Transcription not available":"Transcription not available",Feedback:"Feedback","Provide feedback on your Superflow experience.":"Provide feedback on your Superflow experience.","Tell us the details...":"Tell us the details...","You are following":"You are following","You are leading.":"You are leading.",Stop:"Stop",following:"following",leading:"leading","is editing.":"is editing.","requested edit access.":"requested edit access.","You are editing.":"You are editing.","You are editing on different tab.":"You are editing on different tab.","Access Requested":"Access Requested","Request access":"Request access","Edit here":"Edit here",Settings:"Settings",Audio:"Audio",Microphone:"Microphone",Video:"Video",Camera:"Camera","Save changes":"Save changes","Audio settings":"Audio settings","No device found":"No device found","Video settings":"Video settings","Media source settings":"Media source settings","Audio recording preview":"Audio recording preview","Cancel recording":"Cancel recording","Video recording icon":"Video recording icon","Screen recording icon":"Screen recording icon","Audio recording icon":"Audio recording icon","Recording preview bottom panel":"Recording preview bottom panel","Starting recording in":"Starting recording in","Recording control buttons":"Recording control buttons","Toggle camera":"Toggle camera",off:"off",on:"on","Camera is off":"Camera is off","Close recording preview":"Close recording preview","Toggle microphone":"Toggle microphone",Close:"Close",Open:"Open","recording settings":"recording settings","Start Recording":"Start Recording","Report bugs":"Report bugs","Let us know about any bugs so we can fix them ASAP!":"Let us know about any bugs so we can fix them ASAP!","Thank you! We will get back to you soon.":"Thank you! We will get back to you soon.","Thank you for your feedback!":"Thank you for your feedback!","Thanks for reporting the bug. We will get back to you soon.":"Thanks for reporting the bug. We will get back to you soon.","Invitation sent!":"Invitation sent!","User removed!":"User removed!",members:"members","Invalid contact":"Invalid contact","Invalid email":"Invalid email","Comment pin":"Comment pin","Add text comment":"Add text comment","Add comment annotation":"Add comment annotation","Use AI to rewrite selected text":"Use AI to rewrite selected text","Select a shorter text":"Select a shorter text","Select a longer text":"Select a longer text",Rewrite:"Rewrite","Ask ChatGPT":"Ask ChatGPT","Text comment tools":"Text comment tools","Avatar for comment author":"Avatar for comment author","comments in this thread":"comments in this thread","Assign To":"Assign To","Attach files":"Attach files","Attach files input":"Attach files input","All comments":"All comments","View all comments":"View all comments","Approve comment":"Approve comment",Approve:"Approve","Assign thread":"Assign thread",Search:"Search","Search users":"Search users","Avatar for assigned user":"Avatar for assigned user","Assigned to":"Assigned to","Comment assignment details":"Comment assignment details","Assigned to:":"Assigned to:","Comment dialog thread":"Comment dialog thread","Close comment dialog":"Close comment dialog","Comment Index":"Comment Index",Suggestion:"Suggestion","Comment tools and actions":"Comment tools and actions","Mention someone using @ symbol":"Mention someone using @ symbol","Mention someone using @ symbol while editing":"Mention someone using @ symbol while editing","Type @ to mention someone":"Type @ to mention someone","Type @ to mention someone while editing":"Type @ to mention someone while editing","Add file attachment to comment":"Add file attachment to comment","Record voice message":"Record voice message","Click to start voice recording":"Click to start voice recording","Record video message":"Record video message","Click to start screen recording":"Click to start screen recording","Record your screen":"Record your screen","Save new comment":"Save new comment","Save edited comment":"Save edited comment","Assign user":"Assign user","Remove File":"Remove File","Image attachment:":"Image attachment:","unnamed image":"unnamed image","Actions for image:":"Actions for image:","Uploading image:":"Uploading image:","Delete image:":"Delete image:","Preview of image:":"Preview of image:","Remove invalid file:":"Remove invalid file:","Error message:":"Error message:","Invalid file:":"Invalid file:","Actions for invalid file:":"Actions for invalid file:","File error:":"File error:","File cannot be uploaded":"File cannot be uploaded","Preview of invalid file:":"Preview of invalid file:","Invalid file":"Invalid file",unknown:"unknown","Delete file":"Delete file","File attachment:":"File attachment:","unnamed file":"unnamed file","File type icon for":"File type icon for","Details for file:":"Details for file:","Filename:":"Filename:","File size:":"File size:","Uploading file:":"Uploading file:","Actions for file:":"Actions for file:","Remove file:":"Remove file:","Attached files":"Attached files","total attachments":"total attachments","File attachments":"File attachments",valid:"valid","invalid files":"invalid files","User avatar for":"User avatar for","unknown user":"unknown user","New comment composer":"New comment composer","Comment or type @ to add others":"Comment or type @ to add others","Write a comment...":"Write a comment...","Edit comment composer":"Edit comment composer","Comment or add emails with @":"Comment or add emails with @","Private comment mode - only visible to your team":"Private comment mode - only visible to your team","Only for your team":"Only for your team","Screen recording":"Screen recording",unnamed:"unnamed","Screen recording controls":"Screen recording controls","Edit comment section":"Edit comment section","Add new comment section":"Add new comment section","Custom annotation options":"Custom annotation options","Toggle annotation options":"Toggle annotation options","Annotation:":"Annotation:",Select:"Select","Remaining count:":"Remaining count:","Delete comment controls":"Delete comment controls","Delete this comment":"Delete this comment","Ghost comment notification":"Ghost comment notification","Original content not found.":"Original content not found.","Comment dialog header":"Comment dialog header","Comment dialog header controls":"Comment dialog header controls","Comment metadata":"Comment metadata","1 more reply":"1 more reply","more replies":"more replies","Show 1 more reply":"Show 1 more reply","Navigate to comment location":"Navigate to comment location","Assign comment":"Assign comment","Delete thread":"Delete thread","Delete comment":"Delete comment","Edit comment":"Edit comment",Edit:"Edit","Make it private":"Make it private","Make it public":"Make it public",Subscribe:"Subscribe",Unsubscribe:"Unsubscribe","priority level":"priority level","Priority name":"Priority name",P0:"P0",P1:"P1",P2:"P2","Selected priority:":"Selected priority:","Selected priority indicator":"Selected priority indicator","Priority:":"Priority:","Priority item":"Priority item","Thread priority:":"Thread priority:","Private comment banner":"Private comment banner","Resolve thread":"Resolve thread","Sign In":"Sign In","Status dropdown for":"Status dropdown for",comment:"comment","Status name:":"Status name:","Status option:":"Status option:","Status:":"Status:","Accept suggestion":"Accept suggestion",Accept:"Accept","Reject suggestion":"Reject suggestion",Reject:"Reject","Suggestion actions":"Suggestion actions","Delete Attachment":"Delete Attachment","Download Attachment":"Download Attachment",Attachment:"Attachment",preview:"preview","Image attachment controls":"Image attachment controls","Image attachment actions":"Image attachment actions","Delete attachment":"Delete attachment","Download attachment":"Download attachment","File name:":"File name:","Attachment:":"Attachment:",Attachments:"Attachments","Avatar for":"Avatar for",user:"user","Draft comment status":"Draft comment status",Draft:"Draft",Comment:"Comment","Comment by":"Comment by",Me:"Me","Comment reactions":"Comment reactions","Comment recordings":"Comment recordings","Name for":"Name for","Time for":"Time for","Seen by":"Seen by","Users who viewed this comment":"Users who viewed this comment","List of users who have seen this comment":"List of users who have seen this comment","Seen By":"Seen By","Comment viewers list":"Comment viewers list","Show comment viewers":"Show comment viewers","Comment viewers dropdown":"Comment viewers dropdown",now:"now",Unread:"Unread","Comment thread":"Comment thread","Comment content":"Comment content","Author information":"Author information","Author details and status":"Author details and status","Comment device information":"Comment device information","Inline mode metadata":"Inline mode metadata","Comment actions":"Comment actions","Reaction options":"Reaction options","Comment message":"Comment message",of:"of","Show more replies":"Show more replies",replies:"replies",Reply:"Reply",reply:"reply",Show:"Show","Show reply":"Show reply","Unresolve comment":"Unresolve comment","Upgrade plan":"Upgrade plan",Upgrade:"Upgrade","Copy link to comment":"Copy link to comment","Link Copied!":"Link Copied!","Copy thread link":"Copy thread link","Emoji reactions menu":"Emoji reactions menu","Open emoji reactions menu":"Open emoji reactions menu",Priority:"Priority","Private Comment":"Private Comment",Resolve:"Resolve",Unresolve:"Unresolve","Comment bubble":"Comment bubble","Multi-thread comment dialog":"Multi-thread comment dialog","Comment dialog":"Comment dialog","Comment bottom sheet":"Comment bottom sheet","Comment inbox container":"Comment inbox container","Single comment dialog":"Single comment dialog","Ghost comment indicator":"Ghost comment indicator","Private comment":"Private comment","Comment icon":"Comment icon","Exit comment mode":"Exit comment mode","to exit":"to exit",exit:"exit","Private Comment Mode":"Private Comment Mode","Comment Mode":"Comment Mode","Comment mode icon":"Comment mode icon","Comments stream view":"Comments stream view","Comments inbox":"Comments inbox","Comments location overview":"Comments location overview","Comments minimap":"Comments minimap","Go to comments here.":"Go to comments here.","Close comments sidebar":"Close comments sidebar","Add your first comment":"Add your first comment","No comments to display":"No comments to display","filter section":"filter section",All:"All","Close filter panel":"Close filter panel","Apply filters and close panel":"Apply filters and close panel",Done:"Done","checkbox checked":"checkbox checked","checkbox unchecked":"checkbox unchecked",items:"items","Current viewing page":"Current viewing page","This page":"This page",selected:"selected","not selected":"not selected",pages:"pages",people:"people",priorities:"priorities",statuses:"statuses",Filters:"Filters",versions:"versions","View All":"View All","View all":"View all","Comment filters":"Comment filters","Available filters":"Available filters","Apply or cancel filters":"Apply or cancel filters","Filter comments":"Filter comments","filters applied":"filters applied","Return to all comments":"Return to all comments","Back to all comments":"Back to all comments","Search through comments":"Search through comments","Filter and status controls":"Filter and status controls","Unknown user":"Unknown user","Comment dialog for":"Comment dialog for",Collapse:"Collapse",Expand:"Expand","comment group":"comment group",arrow:"arrow","Comments list with":"Comments list with","Location filter options":"Location filter options",Pages:"Pages","Filter comments by location":"Filter comments by location","menu expanded":"menu expanded","menu collapsed":"menu collapsed","Location filter dropdown":"Location filter dropdown","Mark all comments as read":"Mark all comments as read","Mark all as read":"Mark all as read","Mark as read":"Mark as read","Mark as unread":"Mark as unread",Reset:"Reset","Show open comments only":"Show open comments only","Mark all comments as resolved":"Mark all comments as resolved","Mark all as resolved":"Mark all as resolved","Bulk actions for comments":"Bulk actions for comments","Actions menu":"Actions menu",expanded:"expanded",collapsed:"collapsed","Comment actions dropdown":"Comment actions dropdown","Show unread and read comments":"Show unread and read comments","Unread and read":"Unread and read","Show read comments only":"Show read comments only","Read only":"Read only","Show resolved comments only":"Show resolved comments only",Resolved:"Resolved","Show unread comments only":"Show unread comments only","Unread only":"Unread only","Selected indicator":"Selected indicator","Sort comments by date":"Sort comments by date","Sort by date":"Sort by date","Sort comments by unread status":"Sort comments by unread status","Sort by unread":"Sort by unread","Sort and filter comments":"Sort and filter comments","custom filter applied":"custom filter applied","Comment filters and sorting":"Comment filters and sorting",filtered:"filtered","Page comment composer":"Page comment composer","Add a comment to the page":"Add a comment to the page","Comments and feedback panel":"Comments and feedback panel","Reset all comment filters":"Reset all comment filters","Clear filters":"Clear filters","Loading comments":"Loading comments","Comment status filters":"Comment status filters",status:"status","status icon":"status icon","Status filter options":"Status filter options","Status filter dropdown":"Status filter dropdown","Comments sidebar":"Comments sidebar","Comments panel":"Comments panel","Comment composer":"Comment composer","Comments section panel":"Comments section panel",Comments:"Comments","Loading Comments":"Loading Comments","Comments section":"Comments section","No comments found for applied filters.":"No comments found for applied filters.","Comments list":"Comments list","Comment actions menu":"Comment actions menu","More actions":"More actions","Filter and sort options":"Filter and sort options","Collapse threads":"Collapse threads","Comments dialog":"Comments dialog","Clear all filters":"Clear all filters","Comments information":"Comments information","Toggle comments sidebar":"Toggle comments sidebar","Click to mute":"Click to mute","Click to unmute":"Click to unmute","Stop sharing":"Stop sharing","Share screen":"Share screen","Invite users to join this huddle":"Invite users to join this huddle","Please select a contact to invite":"Please select a contact to invite","Chat with everyone":"Chat with everyone","Enable audio or video to change the settings":"Enable audio or video to change the settings","Change audio/video settings":"Change audio/video settings",Leave:"Leave","In-call messages":"In-call messages","Type here...":"Type here...","Audio Huddle":"Audio Huddle","Video Huddle":"Video Huddle","Screen Huddle":"Screen Huddle","1 person is":"1 person is","people are":"people are","on a call now":"on a call now","You can join the call":"You can join the call","Stop Sharing":"Stop Sharing","is sharing now.":"is sharing now.",You:"You","Close notifications panel":"Close notifications panel","Notification item":"Notification item","All notifications list":"All notifications list","All notifications":"All notifications","All notifications read":"All notifications read","Document notification":"Document notification","Document name:":"Document name:",Untitled:"Untitled","Document ID:":"Document ID:",Document:"Document","unread notifications":"unread notifications","Document notifications panel":"Document notifications panel","For you notifications panel":"For you notifications panel","Notification message:":"Notification message:","Notification headline:":"Notification headline:","Notification time:":"Notification time:","Unread notification":"Unread notification",Notification:"Notification",unread:"unread",read:"read",Load:"Load","more notifications":"more notifications","Load More":"Load More","User notifications for":"User notifications for",notification:"notification",notifications:"notifications",available:"available",Notifications:"Notifications","User:":"User:","People notifications panel":"People notifications panel",Documents:"Documents","For You":"For You",People:"People","Notification categories":"Notification categories","Mark all notifications as read":"Mark all notifications as read","Notification actions":"Notification actions","View all notifications":"View all notifications","Notifications panel":"Notifications panel","Notifications bell icon - no unread notifications":"Notifications bell icon - no unread notifications","Notifications count":"Notifications count","Notification bell with":"Notification bell with","User online":"User online","mins ago.":"mins ago.","Reaction count":"Reaction count","Reaction with":"Reaction with","Reaction by":"Reaction by","Users who reacted":"Users who reacted","Reaction details":"Reaction details","React with":"React with",emoji:"emoji","Choose a reaction":"Choose a reaction","Available reactions":"Available reactions","Add reaction":"Add reaction","Reaction selector":"Reaction selector","Start audio recording":"Start audio recording","Audio Recording":"Audio Recording","Screen Recording":"Screen Recording","Start video recording":"Start video recording","Video Recording":"Video Recording","Recording options menu":"Recording options menu","Available recording types":"Available recording types",Record:"Record","Record audio":"Record audio","Record screen":"Record screen","Record video":"Record video","Recording controls for":"Recording controls for",recording:"recording","Stop recording":"Stop recording","Recording duration":"Recording duration","Resume recording":"Resume recording","Pause recording":"Pause recording","Currently recording:":"Currently recording:",none:"none","Audio waveform visualization":"Audio waveform visualization","Currently recording":"Currently recording","Recording paused":"Recording paused","Recording information":"Recording information","Recording controls":"Recording controls","Expand recording panel":"Expand recording panel","Collapse recording panel":"Collapse recording panel","Floating mode container for":"Floating mode container for","Screen recording preview":"Screen recording preview","Expanded view":"Expanded view","Mini preview":"Mini preview","Recording control panel":"Recording control panel","Draggable recording panel":"Draggable recording panel","Currently saving recording":"Currently saving recording","Saving Recording...":"Saving Recording...",Paused:"Paused","Video preview":"Video preview","Screen recording panel":"Screen recording panel","Draggable recording controls":"Draggable recording controls","Video recording preview":"Video recording preview","recording player":"recording player",Draggable:"Draggable",player:"player","recording pin":"recording pin","Created by":"Created by",Play:"Play","Draggable recording pin by":"Draggable recording pin by","Recording player":"Recording player","Audio recording":"Audio recording","Audio player":"Audio player","Audio player controls":"Audio player controls","Audio content and controls":"Audio content and controls","Playback controls":"Playback controls","Playback time":"Playback time","Audio waveform":"Audio waveform",Subtitles:"Subtitles","Additional controls and information":"Additional controls and information","Pause button":"Pause button","Pause audio":"Pause audio","Play audio":"Play audio","Audio progress":"Audio progress","Copy link to recording":"Copy link to recording","Delete recording":"Delete recording","Enter full screen mode":"Enter full screen mode","Recording name:":"Recording name:","Untitled recording":"Untitled recording","Recording player controls":"Recording player controls","Pause video":"Pause video","Play video":"Play video","Video subtitles":"Video subtitles","Toggle subtitles":"Toggle subtitles","Seek video playback":"Seek video playback","Video playback controls":"Video playback controls","Video transcription":"Video transcription","Video player":"Video player","Video player container":"Video player container","Video player with controls":"Video player with controls","Video information and controls":"Video information and controls","Video transcription summary":"Video transcription summary","Fullscreen video player":"Fullscreen video player","Expanded video player":"Expanded video player","Getting data ...":"Getting data ...","Get more options":"Get more options","Max 3 rewrites allowed":"Max 3 rewrites allowed",left:"left","Show original text":"Show original text","Select a rewritten text to create a task":"Select a rewritten text to create a task","Create Task":"Create Task","How would you like to change this copy?":"How would you like to change this copy?",Suggestions:"Suggestions","Selected users":"Selected users","additional users":"additional users",Reassign:"Reassign",Remove:"Remove","Please select a contact to assign":"Please select a contact to assign",Summary:"Summary","see more":"see more","see less":"see less","Invite users":"Invite users","No users are added.":"No users are added.",Invited:"Invited","General access":"General access","Copy Link":"Copy Link","Send invite":"Send invite","Go Back":"Go Back","Total Views":"Total Views","Views Today":"Views Today",View:"View",Views:"Views",Today:"Today","Search comments":"Search comments","In Progress":"In Progress",Status:"Status","Not set":"Not set","Comment Type":"Comment Type",Public:"Public",Private:"Private","Group By":"Group By","Assigned to Me":"Assigned to Me","Added by Me":"Added by Me",Other:"Other",Desktop:"Desktop",Mobile:"Mobile",Tablet:"Tablet",Others:"Others","Default - MacBook Pro Microphone (Built-in)":"Default - MacBook Pro Microphone (Built-in)","iPhone Microphone":"iPhone Microphone","MacBook Pro Microphone (Built-in)":"MacBook Pro Microphone (Built-in)","Sorting options":"Sorting options","Created First":"Created First","Created Last":"Created Last","Updated First":"Updated First","Updated Last":"Updated Last"}};var re=(()=>{let n=class n{constructor(e){this.loggingService=e,this.currentLanguageSignal=f(navigator.language.split("-")[0]),this.autoTranslationSignal=f(!1),this.translationsMap=new Map,this.translationCache=new Map,this.translationsUpdateSignal=f(0),this.currentLanguage=this.currentLanguageSignal.asReadonly(),this.autoTranslation=this.autoTranslationSignal.asReadonly(),this.translationsVersion=this.translationsUpdateSignal.asReadonly(),this.currentTranslations=X(()=>{let t=this.currentLanguageSignal(),o=this.translationsUpdateSignal();return this.translationsMap.get(t)||{}}),this.loggingService.log("%c[WB] Calling FUNCTION: constructor","color: green;"),this.setTranslations(ae),Z(()=>{let t=this.currentLanguageSignal();this.translationCache.clear(),this.translationsUpdateSignal.update(o=>o+1)})}translate(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: translate","color: green;");let t=this.currentLanguageSignal(),o=this.translationsUpdateSignal(),r=`${t}:${e}:${o}`,d=this.translationCache.get(t);if(d?.has(r))return d.get(r)||e;let m=this.currentTranslations()[e];return this.translationCache.has(t)||this.translationCache.set(t,new Map),this.translationCache.get(t)?.set(r,m||e),oe(m)?e:m}catch{return e}}setTranslations(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setTranslations","color: green;");let t=!1;Object.entries(e).forEach(([o,r])=>{if(r&&typeof r=="object"){let d=this.translationsMap.get(o)||{};Object.keys(r).forEach(R=>{d.hasOwnProperty(R)||(t=!0)});let m=s(s({},d),r);this.translationsMap.set(o,m),this.translationCache.delete(o)}}),this.translationsUpdateSignal.update(o=>o+1),t&&setTimeout(()=>{this.translationsUpdateSignal.update(o=>o+1)},0)}catch(t){this.loggingService.catch("Error in setTranslations: ",t)}}setLanguage(e){return D(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLanguage","color: green;"),this.currentLanguageSignal.set(e)}catch(t){this.loggingService.catch("Error in setLanguage: ",t)}})}enableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!0)}catch(e){this.loggingService.catch("Error in enableAutoTranslation: ",e)}}disableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!1),this.translationCache.clear()}catch(e){this.loggingService.catch("Error in disableAutoTranslation: ",e)}}};n.\u0275fac=function(t){return new(t||n)(E(k))},n.\u0275prov=F({token:n,factory:n.\u0275fac,providedIn:"root"});let i=n;return i})();var xe=(()=>{let n=class n{constructor(e,t){this.domService=e,this.translateService=t,this.sanitizedCache=new Map}transform(e){if(e==null)return"";let t=typeof e=="boolean"||typeof e=="number"?String(e):e;try{let o=this.translateService.currentLanguage(),r=this.translateService.translationsVersion(),d=`${o}:${t}:${r}`,m=this.sanitizedCache.get(d);if(m)return m;let R=this.translateService.translate(t),I=this.domService.sanitizeHtml(R);return this.sanitizedCache.set(d,I),this.sanitizedCache.size>1e3&&this.sanitizedCache.clear(),I}catch(o){return console.warn("Translation error:",o),t}}};n.\u0275fac=function(t){return new(t||n)(h(ne,16),h(re,16))},n.\u0275pipe=V({name:"translate",type:n,pure:!0});let i=n;return i})();var ge=()=>({}),se=(()=>{let n=class n{constructor(){this.height=void 0,this.width=void 0,this.borderRadius=void 0,this.customClass=void 0,this.veltElement=!0}ngOnInit(){}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=b({type:n,selectors:[["velt-skeleton-loader-internal"]],hostVars:1,hostBindings:function(t,o){t&2&&p("data-velt-element",o.veltElement)},inputs:{height:"height",width:"width",borderRadius:"borderRadius",customClass:"customClass",customStyles:"customStyles"},decls:2,vars:11,consts:[[1,"skeleton-loader",3,"ngStyle"]],template:function(t,o){t&1&&(v(0,"div",0),$(1),C()),t&2&&(q(o.customClass),y("--velt-skeleton-loader-height",o.height||"100%")("--velt-skeleton-loader-width",o.width||"100%")("--velt-skeleton-loader-border-radius",o.borderRadius||"inherit"),c("ngStyle",o.customStyles||K(10,ge)),u(),Q(" ","\u200E ",`
1
+ import{$ as F,Ab as j,Bb as B,Ca as N,Db as G,Eb as Y,Fa as u,Fb as H,Gc as ee,Ib as W,Jb as y,Kc as te,Mb as q,Nb as $,Pa as h,Pb as Q,Pc as A,Ua as b,Xa as V,_a as S,a as s,ac as K,b as g,ca as E,db as p,g as D,ha as P,hh as oe,ia as x,ki as k,lb as c,mb as v,nb as C,ob as M,pc as J,qa as f,sb as T,sc as X,si as ne,tb as _,tc as Z,ti as ie,ua as L,vb as O,wa as w,xb as z,zb as l}from"./chunk-YTAAOIBL.js";var ae={en:{"Action button":"Action button",Yes:"Yes",Delete:"Delete",Cancel:"Cancel","Delete thread?":"Delete thread?","All replies to this thread will be lost.":"All replies to this thread will be lost.","Delete comment?":"Delete comment?","This selected comment will be deleted.":"This selected comment will be deleted.","Delete recording?":"Delete recording?","This selected recording will be deleted.":"This selected recording will be deleted.","Delete area?":"Delete area?","This selected area will be deleted.":"This selected area will be deleted.","Delete arrow?":"Delete arrow?","This selected arrow will be deleted.":"This selected arrow will be deleted.","Delete tag?":"Delete tag?","This selected tag will be deleted.":"This selected tag will be deleted.","Contact us":"Contact us","Let us know how can we help you!":"Let us know how can we help you!","Your email address":"Your email address","How can we help?":"How can we help?",Send:"Send","Allow mic permission to":"Allow mic permission to","enable your audio":"enable your audio","1. Click the":"1. Click the","page info icon in your browser\u2019s address bar":"page info icon in your browser\u2019s address bar","2. Turn on Microphone":"2. Turn on Microphone","2. Turn on Camera":"2. Turn on Camera","Allow camera permission":"Allow camera permission","to enable your video":"to enable your video",dropdown:"dropdown","assign dropdown":"assign dropdown","custom dropdown":"custom dropdown","options dropdown":"options dropdown","priority dropdown":"priority dropdown","status dropdown":"status dropdown","seen dropdown":"seen dropdown",menu:"menu","assign menu":"assign menu","custom menu":"custom menu","options menu":"options menu","priority menu":"priority menu","status menu":"status menu","seen menu":"seen menu","menu items":"menu items","assign menu items":"assign menu items","custom menu items":"custom menu items","options menu items":"options menu items","priority menu items":"priority menu items","status menu items":"status menu items","seen menu items":"seen menu items","Playback Speed":"Playback Speed","Subtitles not available":"Subtitles not available","Transcription not available":"Transcription not available",Feedback:"Feedback","Provide feedback on your Superflow experience.":"Provide feedback on your Superflow experience.","Tell us the details...":"Tell us the details...","You are following":"You are following","You are leading.":"You are leading.",Stop:"Stop",following:"following",leading:"leading","is editing.":"is editing.","requested edit access.":"requested edit access.","You are editing.":"You are editing.","You are editing on different tab.":"You are editing on different tab.","Access Requested":"Access Requested","Request access":"Request access","Edit here":"Edit here",Settings:"Settings",Audio:"Audio",Microphone:"Microphone",Video:"Video",Camera:"Camera","Save changes":"Save changes","Audio settings":"Audio settings","No device found":"No device found","Video settings":"Video settings","Media source settings":"Media source settings","Audio recording preview":"Audio recording preview","Cancel recording":"Cancel recording","Video recording icon":"Video recording icon","Screen recording icon":"Screen recording icon","Audio recording icon":"Audio recording icon","Recording preview bottom panel":"Recording preview bottom panel","Starting recording in":"Starting recording in","Recording control buttons":"Recording control buttons","Toggle camera":"Toggle camera",off:"off",on:"on","Camera is off":"Camera is off","Close recording preview":"Close recording preview","Toggle microphone":"Toggle microphone",Close:"Close",Open:"Open","recording settings":"recording settings","Start Recording":"Start Recording","Report bugs":"Report bugs","Let us know about any bugs so we can fix them ASAP!":"Let us know about any bugs so we can fix them ASAP!","Thank you! We will get back to you soon.":"Thank you! We will get back to you soon.","Thank you for your feedback!":"Thank you for your feedback!","Thanks for reporting the bug. We will get back to you soon.":"Thanks for reporting the bug. We will get back to you soon.","Invitation sent!":"Invitation sent!","User removed!":"User removed!",members:"members","Invalid contact":"Invalid contact","Invalid email":"Invalid email","Comment pin":"Comment pin","Add text comment":"Add text comment","Add comment annotation":"Add comment annotation","Use AI to rewrite selected text":"Use AI to rewrite selected text","Select a shorter text":"Select a shorter text","Select a longer text":"Select a longer text",Rewrite:"Rewrite","Ask ChatGPT":"Ask ChatGPT","Text comment tools":"Text comment tools","Avatar for comment author":"Avatar for comment author","comments in this thread":"comments in this thread","Assign To":"Assign To","Attach files":"Attach files","Attach files input":"Attach files input","All comments":"All comments","View all comments":"View all comments","Approve comment":"Approve comment",Approve:"Approve","Assign thread":"Assign thread",Search:"Search","Search users":"Search users","Avatar for assigned user":"Avatar for assigned user","Assigned to":"Assigned to","Comment assignment details":"Comment assignment details","Assigned to:":"Assigned to:","Comment dialog thread":"Comment dialog thread","Close comment dialog":"Close comment dialog","Comment Index":"Comment Index",Suggestion:"Suggestion","Comment tools and actions":"Comment tools and actions","Mention someone using @ symbol":"Mention someone using @ symbol","Mention someone using @ symbol while editing":"Mention someone using @ symbol while editing","Type @ to mention someone":"Type @ to mention someone","Type @ to mention someone while editing":"Type @ to mention someone while editing","Add file attachment to comment":"Add file attachment to comment","Record voice message":"Record voice message","Click to start voice recording":"Click to start voice recording","Record video message":"Record video message","Click to start screen recording":"Click to start screen recording","Record your screen":"Record your screen","Save new comment":"Save new comment","Save edited comment":"Save edited comment","Assign user":"Assign user","Remove File":"Remove File","Image attachment:":"Image attachment:","unnamed image":"unnamed image","Actions for image:":"Actions for image:","Uploading image:":"Uploading image:","Delete image:":"Delete image:","Preview of image:":"Preview of image:","Remove invalid file:":"Remove invalid file:","Error message:":"Error message:","Invalid file:":"Invalid file:","Actions for invalid file:":"Actions for invalid file:","File error:":"File error:","File cannot be uploaded":"File cannot be uploaded","Preview of invalid file:":"Preview of invalid file:","Invalid file":"Invalid file",unknown:"unknown","Delete file":"Delete file","File attachment:":"File attachment:","unnamed file":"unnamed file","File type icon for":"File type icon for","Details for file:":"Details for file:","Filename:":"Filename:","File size:":"File size:","Uploading file:":"Uploading file:","Actions for file:":"Actions for file:","Remove file:":"Remove file:","Attached files":"Attached files","total attachments":"total attachments","File attachments":"File attachments",valid:"valid","invalid files":"invalid files","User avatar for":"User avatar for","unknown user":"unknown user","New comment composer":"New comment composer","Comment or type @ to add others":"Comment or type @ to add others","Write a comment...":"Write a comment...","Edit comment composer":"Edit comment composer","Comment or add emails with @":"Comment or add emails with @","Private comment mode - only visible to your team":"Private comment mode - only visible to your team","Only for your team":"Only for your team","Screen recording":"Screen recording",unnamed:"unnamed","Screen recording controls":"Screen recording controls","Edit comment section":"Edit comment section","Add new comment section":"Add new comment section","Custom annotation options":"Custom annotation options","Toggle annotation options":"Toggle annotation options","Annotation:":"Annotation:",Select:"Select","Remaining count:":"Remaining count:","Delete comment controls":"Delete comment controls","Delete this comment":"Delete this comment","Ghost comment notification":"Ghost comment notification","Original content not found.":"Original content not found.","Comment dialog header":"Comment dialog header","Comment dialog header controls":"Comment dialog header controls","Comment metadata":"Comment metadata","1 more reply":"1 more reply","more replies":"more replies","Show 1 more reply":"Show 1 more reply","Navigate to comment location":"Navigate to comment location","Assign comment":"Assign comment","Delete thread":"Delete thread","Delete comment":"Delete comment","Edit comment":"Edit comment",Edit:"Edit","Make it private":"Make it private","Make it public":"Make it public",Subscribe:"Subscribe",Unsubscribe:"Unsubscribe","priority level":"priority level","Priority name":"Priority name",P0:"P0",P1:"P1",P2:"P2","Selected priority:":"Selected priority:","Selected priority indicator":"Selected priority indicator","Priority:":"Priority:","Priority item":"Priority item","Thread priority:":"Thread priority:","Private comment banner":"Private comment banner","Resolve thread":"Resolve thread","Sign In":"Sign In","Status dropdown for":"Status dropdown for",comment:"comment","Status name:":"Status name:","Status option:":"Status option:","Status:":"Status:","Accept suggestion":"Accept suggestion",Accept:"Accept","Reject suggestion":"Reject suggestion",Reject:"Reject","Suggestion actions":"Suggestion actions","Delete Attachment":"Delete Attachment","Download Attachment":"Download Attachment",Attachment:"Attachment",preview:"preview","Image attachment controls":"Image attachment controls","Image attachment actions":"Image attachment actions","Delete attachment":"Delete attachment","Download attachment":"Download attachment","File name:":"File name:","Attachment:":"Attachment:",Attachments:"Attachments","Avatar for":"Avatar for",user:"user","Draft comment status":"Draft comment status",Draft:"Draft",Comment:"Comment","Comment by":"Comment by",Me:"Me","Comment reactions":"Comment reactions","Comment recordings":"Comment recordings","Name for":"Name for","Time for":"Time for","Seen by":"Seen by","Users who viewed this comment":"Users who viewed this comment","List of users who have seen this comment":"List of users who have seen this comment","Seen By":"Seen By","Comment viewers list":"Comment viewers list","Show comment viewers":"Show comment viewers","Comment viewers dropdown":"Comment viewers dropdown",now:"now",Unread:"Unread","Comment thread":"Comment thread","Comment content":"Comment content","Author information":"Author information","Author details and status":"Author details and status","Comment device information":"Comment device information","Inline mode metadata":"Inline mode metadata","Comment actions":"Comment actions","Reaction options":"Reaction options","Comment message":"Comment message",of:"of","Show more replies":"Show more replies",replies:"replies",Reply:"Reply",reply:"reply",Show:"Show","Show reply":"Show reply","Unresolve comment":"Unresolve comment","Upgrade plan":"Upgrade plan",Upgrade:"Upgrade","Copy link to comment":"Copy link to comment","Link Copied!":"Link Copied!","Copy thread link":"Copy thread link","Emoji reactions menu":"Emoji reactions menu","Open emoji reactions menu":"Open emoji reactions menu",Priority:"Priority","Private Comment":"Private Comment",Resolve:"Resolve",Unresolve:"Unresolve","Comment bubble":"Comment bubble","Multi-thread comment dialog":"Multi-thread comment dialog","Comment dialog":"Comment dialog","Comment bottom sheet":"Comment bottom sheet","Comment inbox container":"Comment inbox container","Single comment dialog":"Single comment dialog","Ghost comment indicator":"Ghost comment indicator","Private comment":"Private comment","Comment icon":"Comment icon","Exit comment mode":"Exit comment mode","to exit":"to exit",exit:"exit","Private Comment Mode":"Private Comment Mode","Comment Mode":"Comment Mode","Comment mode icon":"Comment mode icon","Comments stream view":"Comments stream view","Comments inbox":"Comments inbox","Comments location overview":"Comments location overview","Comments minimap":"Comments minimap","Go to comments here.":"Go to comments here.","Close comments sidebar":"Close comments sidebar","Add your first comment":"Add your first comment","No comments to display":"No comments to display","filter section":"filter section",All:"All","Close filter panel":"Close filter panel","Apply filters and close panel":"Apply filters and close panel",Done:"Done","checkbox checked":"checkbox checked","checkbox unchecked":"checkbox unchecked",items:"items","Current viewing page":"Current viewing page","This page":"This page",selected:"selected","not selected":"not selected",pages:"pages",people:"people",priorities:"priorities",statuses:"statuses",Filters:"Filters",versions:"versions","View All":"View All","View all":"View all","Comment filters":"Comment filters","Available filters":"Available filters","Apply or cancel filters":"Apply or cancel filters","Filter comments":"Filter comments","filters applied":"filters applied","Return to all comments":"Return to all comments","Back to all comments":"Back to all comments","Search through comments":"Search through comments","Filter and status controls":"Filter and status controls","Unknown user":"Unknown user","Comment dialog for":"Comment dialog for",Collapse:"Collapse",Expand:"Expand","comment group":"comment group",arrow:"arrow","Comments list with":"Comments list with","Location filter options":"Location filter options",Pages:"Pages","Filter comments by location":"Filter comments by location","menu expanded":"menu expanded","menu collapsed":"menu collapsed","Location filter dropdown":"Location filter dropdown","Mark all comments as read":"Mark all comments as read","Mark all as read":"Mark all as read","Mark as read":"Mark as read","Mark as unread":"Mark as unread",Reset:"Reset","Show open comments only":"Show open comments only","Mark all comments as resolved":"Mark all comments as resolved","Mark all as resolved":"Mark all as resolved","Bulk actions for comments":"Bulk actions for comments","Actions menu":"Actions menu",expanded:"expanded",collapsed:"collapsed","Comment actions dropdown":"Comment actions dropdown","Show unread and read comments":"Show unread and read comments","Unread and read":"Unread and read","Show read comments only":"Show read comments only","Read only":"Read only","Show resolved comments only":"Show resolved comments only",Resolved:"Resolved","Show unread comments only":"Show unread comments only","Unread only":"Unread only","Selected indicator":"Selected indicator","Sort comments by date":"Sort comments by date","Sort by date":"Sort by date","Sort comments by unread status":"Sort comments by unread status","Sort by unread":"Sort by unread","Sort and filter comments":"Sort and filter comments","custom filter applied":"custom filter applied","Comment filters and sorting":"Comment filters and sorting",filtered:"filtered","Page comment composer":"Page comment composer","Add a comment to the page":"Add a comment to the page","Comments and feedback panel":"Comments and feedback panel","Reset all comment filters":"Reset all comment filters","Clear filters":"Clear filters","Loading comments":"Loading comments","Comment status filters":"Comment status filters",status:"status","status icon":"status icon","Status filter options":"Status filter options","Status filter dropdown":"Status filter dropdown","Comments sidebar":"Comments sidebar","Comments panel":"Comments panel","Comment composer":"Comment composer","Comments section panel":"Comments section panel",Comments:"Comments","Loading Comments":"Loading Comments","Comments section":"Comments section","No comments found for applied filters.":"No comments found for applied filters.","Comments list":"Comments list","Comment actions menu":"Comment actions menu","More actions":"More actions","Filter and sort options":"Filter and sort options","Collapse threads":"Collapse threads","Comments dialog":"Comments dialog","Clear all filters":"Clear all filters","Comments information":"Comments information","Toggle comments sidebar":"Toggle comments sidebar","Click to mute":"Click to mute","Click to unmute":"Click to unmute","Stop sharing":"Stop sharing","Share screen":"Share screen","Invite users to join this huddle":"Invite users to join this huddle","Please select a contact to invite":"Please select a contact to invite","Chat with everyone":"Chat with everyone","Enable audio or video to change the settings":"Enable audio or video to change the settings","Change audio/video settings":"Change audio/video settings",Leave:"Leave","In-call messages":"In-call messages","Type here...":"Type here...","Audio Huddle":"Audio Huddle","Video Huddle":"Video Huddle","Screen Huddle":"Screen Huddle","1 person is":"1 person is","people are":"people are","on a call now":"on a call now","You can join the call":"You can join the call","Stop Sharing":"Stop Sharing","is sharing now.":"is sharing now.",You:"You","Close notifications panel":"Close notifications panel","Notification item":"Notification item","All notifications list":"All notifications list","All notifications":"All notifications","All notifications read":"All notifications read","Document notification":"Document notification","Document name:":"Document name:",Untitled:"Untitled","Document ID:":"Document ID:",Document:"Document","unread notifications":"unread notifications","Document notifications panel":"Document notifications panel","For you notifications panel":"For you notifications panel","Notification message:":"Notification message:","Notification headline:":"Notification headline:","Notification time:":"Notification time:","Unread notification":"Unread notification",Notification:"Notification",unread:"unread",read:"read",Load:"Load","more notifications":"more notifications","Load More":"Load More","User notifications for":"User notifications for",notification:"notification",notifications:"notifications",available:"available",Notifications:"Notifications","User:":"User:","People notifications panel":"People notifications panel",Documents:"Documents","For You":"For You",People:"People","Notification categories":"Notification categories","Mark all notifications as read":"Mark all notifications as read","Notification actions":"Notification actions","View all notifications":"View all notifications","Notifications panel":"Notifications panel","Notifications bell icon - no unread notifications":"Notifications bell icon - no unread notifications","Notifications count":"Notifications count","Notification bell with":"Notification bell with","User online":"User online","mins ago.":"mins ago.","Reaction count":"Reaction count","Reaction with":"Reaction with","Reaction by":"Reaction by","Users who reacted":"Users who reacted","Reaction details":"Reaction details","React with":"React with",emoji:"emoji","Choose a reaction":"Choose a reaction","Available reactions":"Available reactions","Add reaction":"Add reaction","Reaction selector":"Reaction selector","Start audio recording":"Start audio recording","Audio Recording":"Audio Recording","Screen Recording":"Screen Recording","Start video recording":"Start video recording","Video Recording":"Video Recording","Recording options menu":"Recording options menu","Available recording types":"Available recording types",Record:"Record","Record audio":"Record audio","Record screen":"Record screen","Record video":"Record video","Recording controls for":"Recording controls for",recording:"recording","Stop recording":"Stop recording","Recording duration":"Recording duration","Resume recording":"Resume recording","Pause recording":"Pause recording","Currently recording:":"Currently recording:",none:"none","Audio waveform visualization":"Audio waveform visualization","Currently recording":"Currently recording","Recording paused":"Recording paused","Recording information":"Recording information","Recording controls":"Recording controls","Expand recording panel":"Expand recording panel","Collapse recording panel":"Collapse recording panel","Floating mode container for":"Floating mode container for","Screen recording preview":"Screen recording preview","Expanded view":"Expanded view","Mini preview":"Mini preview","Recording control panel":"Recording control panel","Draggable recording panel":"Draggable recording panel","Currently saving recording":"Currently saving recording","Saving Recording...":"Saving Recording...",Paused:"Paused","Video preview":"Video preview","Screen recording panel":"Screen recording panel","Draggable recording controls":"Draggable recording controls","Video recording preview":"Video recording preview","recording player":"recording player",Draggable:"Draggable",player:"player","recording pin":"recording pin","Created by":"Created by",Play:"Play","Draggable recording pin by":"Draggable recording pin by","Recording player":"Recording player","Audio recording":"Audio recording","Audio player":"Audio player","Audio player controls":"Audio player controls","Audio content and controls":"Audio content and controls","Playback controls":"Playback controls","Playback time":"Playback time","Audio waveform":"Audio waveform",Subtitles:"Subtitles","Additional controls and information":"Additional controls and information","Pause button":"Pause button","Pause audio":"Pause audio","Play audio":"Play audio","Audio progress":"Audio progress","Copy link to recording":"Copy link to recording","Delete recording":"Delete recording","Enter full screen mode":"Enter full screen mode","Recording name:":"Recording name:","Untitled recording":"Untitled recording","Recording player controls":"Recording player controls","Pause video":"Pause video","Play video":"Play video","Video subtitles":"Video subtitles","Toggle subtitles":"Toggle subtitles","Seek video playback":"Seek video playback","Video playback controls":"Video playback controls","Video transcription":"Video transcription","Video player":"Video player","Video player container":"Video player container","Video player with controls":"Video player with controls","Video information and controls":"Video information and controls","Video transcription summary":"Video transcription summary","Fullscreen video player":"Fullscreen video player","Expanded video player":"Expanded video player","Getting data ...":"Getting data ...","Get more options":"Get more options","Max 3 rewrites allowed":"Max 3 rewrites allowed",left:"left","Show original text":"Show original text","Select a rewritten text to create a task":"Select a rewritten text to create a task","Create Task":"Create Task","How would you like to change this copy?":"How would you like to change this copy?",Suggestions:"Suggestions","Selected users":"Selected users","additional users":"additional users",Reassign:"Reassign",Remove:"Remove","Please select a contact to assign":"Please select a contact to assign",Summary:"Summary","see more":"see more","see less":"see less","Invite users":"Invite users","No users are added.":"No users are added.",Invited:"Invited","General access":"General access","Copy Link":"Copy Link","Send invite":"Send invite","Go Back":"Go Back","Total Views":"Total Views","Views Today":"Views Today",View:"View",Views:"Views",Today:"Today","Search comments":"Search comments","In Progress":"In Progress",Status:"Status","Not set":"Not set","Comment Type":"Comment Type",Public:"Public",Private:"Private","Group By":"Group By","Assigned to Me":"Assigned to Me","Added by Me":"Added by Me",Other:"Other",Desktop:"Desktop",Mobile:"Mobile",Tablet:"Tablet",Others:"Others","Default - MacBook Pro Microphone (Built-in)":"Default - MacBook Pro Microphone (Built-in)","iPhone Microphone":"iPhone Microphone","MacBook Pro Microphone (Built-in)":"MacBook Pro Microphone (Built-in)","Sorting options":"Sorting options","Created First":"Created First","Created Last":"Created Last","Updated First":"Updated First","Updated Last":"Updated Last"}};var re=(()=>{let n=class n{constructor(e){this.loggingService=e,this.currentLanguageSignal=f(navigator.language.split("-")[0]),this.autoTranslationSignal=f(!1),this.translationsMap=new Map,this.translationCache=new Map,this.translationsUpdateSignal=f(0),this.currentLanguage=this.currentLanguageSignal.asReadonly(),this.autoTranslation=this.autoTranslationSignal.asReadonly(),this.translationsVersion=this.translationsUpdateSignal.asReadonly(),this.currentTranslations=X(()=>{let t=this.currentLanguageSignal(),o=this.translationsUpdateSignal();return this.translationsMap.get(t)||{}}),this.loggingService.log("%c[WB] Calling FUNCTION: constructor","color: green;"),this.setTranslations(ae),Z(()=>{let t=this.currentLanguageSignal();this.translationCache.clear(),this.translationsUpdateSignal.update(o=>o+1)})}translate(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: translate","color: green;");let t=this.currentLanguageSignal(),o=this.translationsUpdateSignal(),r=`${t}:${e}:${o}`,d=this.translationCache.get(t);if(d?.has(r))return d.get(r)||e;let m=this.currentTranslations()[e];return this.translationCache.has(t)||this.translationCache.set(t,new Map),this.translationCache.get(t)?.set(r,m||e),oe(m)?e:m}catch{return e}}setTranslations(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setTranslations","color: green;");let t=!1;Object.entries(e).forEach(([o,r])=>{if(r&&typeof r=="object"){let d=this.translationsMap.get(o)||{};Object.keys(r).forEach(R=>{d.hasOwnProperty(R)||(t=!0)});let m=s(s({},d),r);this.translationsMap.set(o,m),this.translationCache.delete(o)}}),this.translationsUpdateSignal.update(o=>o+1),t&&setTimeout(()=>{this.translationsUpdateSignal.update(o=>o+1)},0)}catch(t){this.loggingService.catch("Error in setTranslations: ",t)}}setLanguage(e){return D(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLanguage","color: green;"),this.currentLanguageSignal.set(e)}catch(t){this.loggingService.catch("Error in setLanguage: ",t)}})}enableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!0)}catch(e){this.loggingService.catch("Error in enableAutoTranslation: ",e)}}disableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!1),this.translationCache.clear()}catch(e){this.loggingService.catch("Error in disableAutoTranslation: ",e)}}};n.\u0275fac=function(t){return new(t||n)(E(k))},n.\u0275prov=F({token:n,factory:n.\u0275fac,providedIn:"root"});let i=n;return i})();var xe=(()=>{let n=class n{constructor(e,t){this.domService=e,this.translateService=t,this.sanitizedCache=new Map}transform(e){if(e==null)return"";let t=typeof e=="boolean"||typeof e=="number"?String(e):e;try{let o=this.translateService.currentLanguage(),r=this.translateService.translationsVersion(),d=`${o}:${t}:${r}`,m=this.sanitizedCache.get(d);if(m)return m;let R=this.translateService.translate(t),I=this.domService.sanitizeHtml(R);return this.sanitizedCache.set(d,I),this.sanitizedCache.size>1e3&&this.sanitizedCache.clear(),I}catch(o){return console.warn("Translation error:",o),t}}};n.\u0275fac=function(t){return new(t||n)(h(ne,16),h(re,16))},n.\u0275pipe=V({name:"translate",type:n,pure:!0});let i=n;return i})();var ge=()=>({}),se=(()=>{let n=class n{constructor(){this.height=void 0,this.width=void 0,this.borderRadius=void 0,this.customClass=void 0,this.veltElement=!0}ngOnInit(){}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=b({type:n,selectors:[["velt-skeleton-loader-internal"]],hostVars:1,hostBindings:function(t,o){t&2&&p("data-velt-element",o.veltElement)},inputs:{height:"height",width:"width",borderRadius:"borderRadius",customClass:"customClass",customStyles:"customStyles"},decls:2,vars:11,consts:[[1,"skeleton-loader",3,"ngStyle"]],template:function(t,o){t&1&&(v(0,"div",0),$(1),C()),t&2&&(q(o.customClass),y("--velt-skeleton-loader-height",o.height||"100%")("--velt-skeleton-loader-width",o.width||"100%")("--velt-skeleton-loader-border-radius",o.borderRadius||"inherit"),c("ngStyle",o.customStyles||K(10,ge)),u(),Q(" ","\u200E ",`
2
2
  `))},dependencies:[A,te],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let i=n;return i})();var ue=["userAvatarRef"],pe=["*"];function he(i,n){if(i&1&&(v(0,"div",7),M(1,"span",8),C()),i&2){let a=l(2).ngIf,e=l();y("background-color",a.background||"#625DF5"),p("data-testid",e.componentId+"-initial-container"),u(),y("color",a.textColor||"#FFFFFF"),p("data-modal-author-initial",a.initial)("data-testid",e.componentId+"-initial")}}function fe(i,n){if(i&1){let a=O();v(0,"img",9),z("error",function(){P(a);let t=l(3);return x(t.onImageLoadError())})("load",function(){P(a);let t=l(3);return x(t.onImageLoaded())}),C()}if(i&2){let a=l(2).ngIf,e=l();y("display",a.imgLoaded?"":"none !important"),c("src",a.src,N),p("alt","User avatar")("data-testid",e.componentId+"-image")}}function ve(i,n){if(i&1&&(T(0),v(1,"div",4,1),S(3,he,2,7,"div",5)(4,fe,1,5,"ng-template",6),B(5),C(),_()),i&2){let a=l().ngIf,e=l();u(),p("data-testid",e.componentId+"-container")("aria-label","User avatar"),u(2),c("ngIf",!a.imgLoaded),u(),c("ngIf",!a.imgLoadError)}}function Ce(i,n){if(i&1&&M(0,"velt-skeleton-loader-internal",10),i&2){let a=l().ngIf;c("height",a.size?a.size+"px":"100%")("width",a.size?a.size+"px":"100%")}}function ye(i,n){if(i&1&&(T(0),S(1,ve,6,4,"ng-container",3)(2,Ce,1,2,"ng-template",null,0,J),_()),i&2){let a=n.ngIf,e=W(3);u(),c("ngIf",a.imgLoaded||(a==null||a.user==null?null:a.user.photoUrl)||(a==null||a.user==null?null:a.user.name)||(a==null||a.user==null?null:a.user.email)||(a==null?null:a.initial))("ngIfElse",e)}}var Ye=(()=>{let n=class n{constructor(e,t,o){this.authService=e,this.loggingService=t,this.elementRef=o,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new w(null),this.componentConfigSignal=f({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=g(s({},o),{[t]:e[t].currentValue}),o))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(o=>(o=g(s({},o),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),o)),this.componentConfigSignal.update(o=>(o=g(s({},o),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),o)),this.componentConfigSignal.update(o=>(o=g(s({},o),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),o)),this.componentConfigSignal.update(o=>(o=g(s({},o),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),o))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=g(s({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=g(s({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};n.\u0275fac=function(t){return new(t||n)(h(ie),h(k),h(w))},n.\u0275cmp=b({type:n,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,o){if(t&1&&G(ue,5),t&2){let r;Y(r=H())&&(o.userAvatarRef=r.first)}},hostVars:1,hostBindings:function(t,o){t&2&&p("data-velt-element",o.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},features:[L],ngContentSelectors:pe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,o){t&1&&(j(),S(0,ye,4,2,"ng-container",2)),t&2&&c("ngIf",o.componentConfigSignal())},dependencies:[A,ee,se],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let i=n;return i})();export{re as a,xe as b,se as c,Ye as d};