@veltdev/sdk-staging 6.0.8-beta.3 → 6.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/app/models/data/notification.model.d.ts +13 -0
  2. package/app/models/element/notification-element.model.d.ts +24 -1
  3. package/{chunk-3HT5L4QS.js → chunk-23Y35Q3J.js} +1 -1
  4. package/{chunk-7GIX7FRK.js → chunk-23YNPJA6.js} +1 -1
  5. package/{chunk-RD4WD7HR.js → chunk-2N7F6RD7.js} +1 -1
  6. package/{chunk-IEO673J4.js → chunk-3QB54TU3.js} +1 -1
  7. package/{chunk-3MAA6ORB.js → chunk-3T53AUKI.js} +1 -1
  8. package/{chunk-JGOSCTOU.js → chunk-4BWTKX3J.js} +1 -1
  9. package/{chunk-YTAAOIBL.js → chunk-4EV2AXDK.js} +1 -1
  10. package/{chunk-F5F6L463.js → chunk-4ZVKEG33.js} +1 -1
  11. package/{chunk-4Z6JEK4C.js → chunk-6AS4UBOQ.js} +1 -1
  12. package/{chunk-5AXDQN2Z.js → chunk-7AHH7XWM.js} +1 -1
  13. package/{chunk-HG5ATWOH.js → chunk-ABE26DFY.js} +1 -1
  14. package/{chunk-54WPSIBC.js → chunk-CQ2PFN5H.js} +1 -1
  15. package/{chunk-LZ6S3GDG.js → chunk-E2Q3RJVJ.js} +1 -1
  16. package/{chunk-44QKIIUD.js → chunk-F7UEUUNI.js} +1 -1
  17. package/{chunk-T3HQOEN5.js → chunk-FKN5MCLS.js} +1 -1
  18. package/{chunk-6LQHVKDO.js → chunk-GDYKECHB.js} +1 -1
  19. package/chunk-H3AESJRG.js +1 -0
  20. package/{chunk-6GDK5ORV.js → chunk-JKLS6423.js} +1 -1
  21. package/{chunk-67WASIND.js → chunk-KPCULYW2.js} +1 -1
  22. package/{chunk-KGSCJNID.js → chunk-MUZB4ZRW.js} +1 -1
  23. package/{chunk-I545665X.js → chunk-MVFPB6P2.js} +1 -1
  24. package/{chunk-OBHASA4V.js → chunk-O64Y7CY5.js} +1 -1
  25. package/{chunk-45RSUXWO.js → chunk-OK6SKS5O.js} +1 -1
  26. package/{chunk-ITGK4UWR.js → chunk-PDOET6TG.js} +1 -1
  27. package/{chunk-T4Z2W6NR.js → chunk-PPWVFIE5.js} +1 -1
  28. package/{chunk-RVRKRO3G.js → chunk-QHAOMKNT.js} +1 -1
  29. package/{chunk-TYOTWEG4.js → chunk-QYY5QDZZ.js} +1 -1
  30. package/{chunk-AN5PXX2C.js → chunk-S7J3GTUB.js} +1 -1
  31. package/{chunk-WUADE2PV.js → chunk-SHXQBB7N.js} +1 -1
  32. package/{chunk-XTVGC5C3.js → chunk-TVHRQJC4.js} +1 -1
  33. package/{chunk-HO27RBDE.js → chunk-UQI5JFMO.js} +1 -1
  34. package/{chunk-O3SELCX3.js → chunk-UUEOTEBS.js} +1 -1
  35. package/{chunk-6OH2EVLZ.js → chunk-ZWTASV4Q.js} +1 -1
  36. package/package.json +1 -1
  37. package/velt-activity-log.js +1 -1
  38. package/velt-area.js +1 -1
  39. package/velt-arrow.js +1 -1
  40. package/velt-comment.js +1 -1
  41. package/velt-crdt.js +1 -1
  42. package/velt-cursor.js +1 -1
  43. package/velt-huddle.js +1 -1
  44. package/velt-live-state-sync.js +1 -1
  45. package/velt-notification.js +1 -1
  46. package/velt-presence.js +1 -1
  47. package/velt-reaction.js +1 -1
  48. package/velt-recorder.js +1 -1
  49. package/velt-rewriter.js +1 -1
  50. package/velt-selection.js +1 -1
  51. package/velt-tag.js +1 -1
  52. package/velt-user-invite.js +1 -1
  53. package/velt-user-request.js +1 -1
  54. package/velt-video-player.js +1 -1
  55. package/velt-views.js +1 -1
  56. package/velt.js +3 -3
  57. package/chunk-2CPFZPZL.js +0 -1
@@ -291,3 +291,16 @@ export interface CrossOrganizationConfig {
291
291
  /** Feeds the merge applies to. Only `'forYou'` is supported; `'all'` is ignored with a warning. */
292
292
  feeds?: ('forYou' | 'all')[];
293
293
  }
294
+ /**
295
+ * Config for the user-scoped "For You" notifications fetch
296
+ * (`enableUserScopedNotifications`). When enabled, the SDK fetches the user's
297
+ * newest notifications for the current organization directly — independent of
298
+ * the recently-active-documents window — so unread notifications on documents
299
+ * outside that window stay visible in the For You tab and unread count.
300
+ *
301
+ * @see specs/org-notifications-top15-document-window/spec.md
302
+ */
303
+ export interface UserScopedNotificationsConfig {
304
+ /** Max user-scoped notifications fetched. Default 25; clamped to [1, 200]. */
305
+ limit?: number;
306
+ }
@@ -1,6 +1,6 @@
1
1
  import { Observable } from "rxjs";
2
2
 
3
- import { CrossOrganizationConfig, GetNotificationsDataQuery, Notification, NotificationInitialSettingsConfig, NotificationSettingsConfig, NotificationTabConfig } from "../data/notification.model";
3
+ import { CrossOrganizationConfig, GetNotificationsDataQuery, Notification, NotificationInitialSettingsConfig, NotificationSettingsConfig, NotificationTabConfig, UserScopedNotificationsConfig } from "../data/notification.model";
4
4
  import { NotificationEventTypesMap } from "../data/notifications-events.data.model";
5
5
 
6
6
  export declare class NotificationElement {
@@ -139,6 +139,19 @@ export declare class NotificationElement {
139
139
  */
140
140
  disableCrossOrganization: () => void;
141
141
 
142
+ /**
143
+ * To enable the user-scoped "For You" notifications fetch: fetches the user's newest
144
+ * notifications for the current organization independent of the recently-active-documents
145
+ * window, so unread notifications on older documents stay visible in the For You tab and
146
+ * unread count. Default limit 25; clamped to [1, 200].
147
+ */
148
+ enableUserScopedNotifications: (config?: UserScopedNotificationsConfig) => void;
149
+
150
+ /**
151
+ * To disable the user-scoped "For You" notifications fetch (restores windowed behavior)
152
+ */
153
+ disableUserScopedNotifications: () => void;
154
+
142
155
  /**
143
156
  * Subscribe to notification events
144
157
  */
@@ -281,6 +294,16 @@ export declare class NotificationElement {
281
294
  */
282
295
  private _disableCrossOrganization;
283
296
 
297
+ /**
298
+ * To enable the user-scoped "For You" notifications fetch
299
+ */
300
+ private _enableUserScopedNotifications;
301
+
302
+ /**
303
+ * To disable the user-scoped "For You" notifications fetch
304
+ */
305
+ private _disableUserScopedNotifications;
306
+
284
307
  /**
285
308
  * Subscribe to notification events
286
309
  */
@@ -1 +1 @@
1
- import{b as $}from"./chunk-67WASIND.js";import{$ as D,Db as Z,Eb as A,Fa as m,Fb as q,Fc as z,Ga as C,Gc as G,Ib as f,Kb as b,Ke as U,Nb as T,Ob as N,Pa as S,Pb as I,Ua as H,Xa as k,_a as v,ca as B,db as L,ha as l,ia as c,ja as w,ji as Q,kc as M,ki as O,la as F,lb as p,lc as E,mb as u,nb as d,ob as y,vb as _,xb as g,zb as a}from"./chunk-YTAAOIBL.js";var W=(()=>{let r=class r{transform(t,i,...o){try{let s=t&&t?.slice?t?.slice():[];return s?.length&&new U().getBrowserName()?.toLocaleLowerCase()==="safari"&&(s=s.sort((V,x)=>V.type==="mp4"&&x.type!=="mp4"?-1:V.type!=="mp4"&&x.type==="mp4"?1:0)),s}catch{return t}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275pipe=k({name:"rearrangeMediaSource",type:r,pure:!0});let n=r;return n})();var J=(()=>{let r=class r{constructor(t,i){this.injector=t,this.loggingService=i,this.arrowPromise=null,this.commentPromise=null,this.cursorPromise=null,this.huddlePromise=null,this.notificationPromise=null,this.presencePromise=null,this.reactionPromise=null,this.recorderPromise=null,this.tagPromise=null,this.rewriterPromise=null,this.selectionPromise=null,this.areaPromise=null,this.activityLogPromise=null,this.viewPromise=null,this.userInvitePromise=null,this.userRequestPromise=null,this.videoPlayerPromise=null,this.crdtPromise=null,this.liveStateSyncPromise=null,this.loggingService.log("%c[WB] Creating CLASS: ChunkLoaderService","color: blue;")}ensureArrowChunk(){return this.arrowPromise||(this.arrowPromise=import("./velt-arrow.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading arrow chunk: ",t),this.arrowPromise=null,t})),this.arrowPromise}ensureCommentChunk(){return this.commentPromise||(this.commentPromise=import("./velt-comment.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading comment chunk: ",t),this.commentPromise=null,t})),this.commentPromise}ensureCursorChunk(){return this.cursorPromise||(this.cursorPromise=import("./velt-cursor.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading cursor chunk: ",t),this.cursorPromise=null,t})),this.cursorPromise}ensureHuddleChunk(){return this.huddlePromise||(this.huddlePromise=import("./velt-huddle.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading huddle chunk: ",t),this.huddlePromise=null,t})),this.huddlePromise}ensureNotificationChunk(){return this.notificationPromise||(this.notificationPromise=import("./velt-notification.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading notification chunk: ",t),this.notificationPromise=null,t})),this.notificationPromise}ensurePresenceChunk(){return this.presencePromise||(this.presencePromise=import("./velt-presence.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading presence chunk: ",t),this.presencePromise=null,t})),this.presencePromise}ensureReactionChunk(){return this.reactionPromise||(this.reactionPromise=import("./velt-reaction.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading reaction chunk: ",t),this.reactionPromise=null,t})),this.reactionPromise}ensureRecorderChunk(){return this.recorderPromise||(this.recorderPromise=import("./velt-recorder.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading recorder chunk: ",t),this.recorderPromise=null,t})),this.recorderPromise}ensureTagChunk(){return this.tagPromise||(this.tagPromise=import("./velt-tag.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading tag chunk: ",t),this.tagPromise=null,t})),this.tagPromise}ensureRewriterChunk(){return this.rewriterPromise||(this.rewriterPromise=import("./velt-rewriter.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading rewriter chunk: ",t),this.rewriterPromise=null,t})),this.rewriterPromise}ensureSelectionChunk(){return this.selectionPromise||(this.selectionPromise=import("./velt-selection.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading selection chunk: ",t),this.selectionPromise=null,t})),this.selectionPromise}ensureAreaChunk(){return this.areaPromise||(this.areaPromise=import("./velt-area.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading area chunk: ",t),this.areaPromise=null,t})),this.areaPromise}ensureActivityLogChunk(){return this.activityLogPromise||(this.activityLogPromise=import("./velt-activity-log.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading activity-log chunk: ",t),this.activityLogPromise=null,t})),this.activityLogPromise}ensureViewChunk(){return this.viewPromise||(this.viewPromise=import("./velt-views.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading view chunk: ",t),this.viewPromise=null,t})),this.viewPromise}ensureUserInviteChunk(){return this.userInvitePromise||(this.userInvitePromise=import("./velt-user-invite.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading user-invite chunk: ",t),this.userInvitePromise=null,t})),this.userInvitePromise}ensureUserRequestChunk(){return this.userRequestPromise||(this.userRequestPromise=import("./velt-user-request.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading user-request chunk: ",t),this.userRequestPromise=null,t})),this.userRequestPromise}ensureVideoPlayerChunk(){return this.videoPlayerPromise||(this.videoPlayerPromise=import("./velt-video-player.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading video-player chunk: ",t),this.videoPlayerPromise=null,t})),this.videoPlayerPromise}ensureCrdtChunk(){return this.crdtPromise||(this.crdtPromise=import("./velt-crdt.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading crdt chunk: ",t),this.crdtPromise=null,t})),this.crdtPromise}ensureLiveStateSyncChunk(){return this.liveStateSyncPromise||(this.liveStateSyncPromise=import("./velt-live-state-sync.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading live-state-sync chunk: ",t),this.liveStateSyncPromise=null,t})),this.liveStateSyncPromise}};r.\u0275fac=function(i){return new(i||r)(B(F),B(O))},r.\u0275prov=D({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var et=["videoRef"];function it(n,r){if(n&1&&y(0,"source",10),n&2){let e=a();p("src",!(e.annotation==null||e.annotation.attachment==null)&&e.annotation.attachment.thumbnail?e.annotation==null||e.annotation.attachment==null?null:e.annotation.attachment.url:(e.annotation==null||e.annotation.attachment==null?null:e.annotation.attachment.url)+"#t=0.001")}}function nt(n,r){if(n&1&&y(0,"source",12),n&2){let e=r.$implicit;p("src",e==null?null:e.url)("type",(e==null?null:e.mimeType)||"video/mp4")}}function ot(n,r){if(n&1&&(v(0,nt,1,2,"source",11),M(1,"rearrangeMediaSource")),n&2){let e=a();p("ngForOf",E(1,2,e.annotation==null?null:e.annotation.attachments))("ngForTrackBy",e.trackByAttachmentId)}}function rt(n,r){if(n&1){let e=_();u(0,"div",13)(1,"div",14)(2,"snippyly-subtitles-embed",15,1),g("subtitlesButtonClick",function(){l(e);let i=a();return c(i.onSubtitlesButtonClick())}),d()()()}if(n&2){let e,t=f(3),i=a(),o=f(3);b("hide",(t==null?null:t.componentConfigSignal)&&(t==null||(e=t.componentConfigSignal())==null?null:e.highlightedTextIndex)<0),m(2),p("transcription",i.annotation==null?null:i.annotation.transcription)("timeToRead",(o==null?null:o.currentTime)||0)("mode","embed")}}function at(n,r){if(n&1){let e=_();u(0,"input",28),g("input",function(i){l(e);let o=a(2);return c(o.onDurationChange(i))}),d()}if(n&2){let e=a(2),t=f(3);p("value",(t==null?null:t.currentTime)*1e3/((e.annotation==null||e.annotation.recordedTime==null?null:e.annotation.recordedTime.duration)||0))}}function st(n,r){if(n&1){let e=_();w(),u(0,"svg",29),g("click",function(){l(e);let i=a(2);return c(i.toggleVideo())}),y(1,"path",30),d()}}function lt(n,r){if(n&1){let e=_();w(),u(0,"svg",31),g("click",function(){l(e);let i=a(2);return c(i.toggleVideo())}),y(1,"path",32)(2,"path",33),d()}}function ct(n,r){n&1&&(u(0,"span",38),T(1),M(2,"translate"),d()),n&2&&(m(),I(" ",E(2,1,"Subtitles not available")," "))}function pt(n,r){if(n&1){let e=_();u(0,"div",34),v(1,ct,3,3,"span",35),w(),u(2,"svg",36),g("click",function(){l(e);let i=a(2);return c(!(i.annotation==null||i.annotation.transcription==null)&&i.annotation.transcription.transcriptedText?i.onSubtitlesButtonClick(!0):null)}),y(3,"path",37),d()()}if(n&2){let e=a(2);b("disabled",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText)),m(),p("ngIf",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText))}}function mt(n,r){n&1&&(u(0,"span",38),T(1),M(2,"translate"),d()),n&2&&(m(),I(" ",E(2,1,"Transcription not available")))}function ut(n,r){if(n&1){let e=_();u(0,"div",39),g("click",function(){l(e);let i=a(2);return c(!(i.annotation==null||i.annotation.transcription==null)&&i.annotation.transcription.transcriptedText?i.onTranscriptionButtonClick(!0):null)}),v(1,mt,3,3,"span",35),w(),u(2,"svg",40),y(3,"path",41),d()()}if(n&2){let e=a(2);b("disabled",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText)),m(),p("ngIf",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText))}}function dt(n,r){if(n&1){let e=_();u(0,"snippyly-transcription-embed",42),g("transcriptionButtonClick",function(){l(e);let i=a(2);return c(i.onTranscriptionButtonClick())})("transcriptionSummaryCopy",function(){l(e);let i=a(2);return c(i.onTranscriptionSummaryCopy())})("seekTo",function(i){l(e);let o=a(2),s=f(3);return c(o.onSeekToVideo(i,s))})("transcriptionPanelDragged",function(){l(e);let i=a(2);return c(i.onTranscriptionPanelDragged())}),d()}if(n&2){let e=a(2),t=f(3);p("transcription",e.annotation==null?null:e.annotation.transcription)("timeToRead",(t==null?null:t.currentTime)||0)}}function ht(n,r){if(n&1){let e=_();w(),u(0,"svg",43),g("click",function(){l(e);let i=a(2);return c(i.onDelete())}),y(1,"path",44)(2,"path",45)(3,"path",46)(4,"path",47),d()}}function gt(n,r){if(n&1&&(u(0,"div",16)(1,"div",17),v(2,at,1,1,"input",18),d(),u(3,"div",19)(4,"div",20),v(5,st,2,0,"svg",21)(6,lt,3,0,"svg",22),u(7,"span"),T(8),d()(),u(9,"div",23),v(10,pt,4,3,"div",24)(11,ut,4,3,"div",25)(12,dt,1,2,"snippyly-transcription-embed",26)(13,ht,5,0,"svg",27),d()()()),n&2){let e=a();m(2),p("ngIf",e.annotation==null||e.annotation.recordedTime==null?null:e.annotation.recordedTime.duration),m(3),p("ngIf",!e.playing),m(),p("ngIf",e.playing),m(2),N(e.currentTime||(e.annotation==null||e.annotation.recordedTime==null?null:e.annotation.recordedTime.display)||"00:00"),m(2),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.showSubtitlesButton),m(),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.transcriptionMode==="embed"),m(),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.transcriptionMode==="floating"&&e.showTranscriptionButton),m(),p("ngIf",e.showDeleteButton)}}function _t(n,r){if(n&1){let e=_();u(0,"snippyly-transcription-embed",50),g("seekTo",function(i){l(e);let o=a(2),s=f(3);return c(o.onSeekToVideo(i,s))})("close",function(){l(e);let i=a(2);return c(i.toggleTranscription())})("transcriptionSummaryCopy",function(){l(e);let i=a(2);return c(i.onTranscriptionSummaryCopy())})("transcriptionPanelDragged",function(){l(e);let i=a(2);return c(i.onTranscriptionPanelDragged())}),d()}if(n&2){let e=a(2),t=f(3);p("transcription",e.annotation==null?null:e.annotation.transcription)("timeToRead",(t==null?null:t.currentTime)||0)("mode",e.transcriptionMode)("visible",!0)}}function vt(n,r){if(n&1){let e=_();u(0,"div",48),g("click",function(i){return l(e),c(i.stopPropagation())})("pointerdown",function(i){return l(e),c(i.stopPropagation())})("pointerup",function(i){return l(e),c(i.stopPropagation())}),v(1,_t,1,4,"snippyly-transcription-embed",49),d()}if(n&2){let e=a();m(),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.showTranscriptionButton)}}var Ot=(()=>{let r=class r{constructor(t,i,o){this.analyticsService=t,this.loggingService=i,this.chunkLoaderService=o,this.showControls=!0,this.showSubtitlesButton=!0,this.showTranscriptionButton=!0,this.transcriptionMode="floating",this.play=new C,this.pause=new C,this.delete=new C,this.transcriptionButtonClick=new C,this.transcriptionSummaryCopy=new C,this.subtitlesButtonClick=new C,this.transcriptionTimestampClick=new C,this.transcriptionPanelDragged=new C,this.playing=!1,this.currentTime="",this.showSubtitles=!1,this.transcriptionVisible=!1,this.veltElement=!0}ngOnInit(){this.annotation?.transcription&&this.ensureRecorderChunkForEmbeds()}ensureRecorderChunkForEmbeds(){this.chunkLoaderService.ensureRecorderChunk().catch(t=>{this.loggingService.catch("Error in VideoPlayerComponent ensureRecorderChunkForEmbeds: ",t)})}trackByAttachmentId(t,i){return i?.attachmentId}toggleVideo(){try{if(this.videoRef?.nativeElement){let t=this.videoRef?.nativeElement;t&&(t.duration>0&&!t.paused?(t.pause(),this.playing=!1,this.pause.emit()):(t.play(),this.playing=!0,this.play.emit()))}}catch(t){this.loggingService.catch("Error in VideoPlayerComponent toggleVideo: ",t)}}toggleSubtitles(){try{this.ensureRecorderChunkForEmbeds(),this.showSubtitles=!this.showSubtitles}catch(t){this.loggingService.catch("Error in VideoPlayerComponent toggleSubtitles: ",t)}}toggleTranscription(){try{this.ensureRecorderChunkForEmbeds(),this.transcriptionVisible=!this.transcriptionVisible}catch(t){this.loggingService.catch("Error in VideoPlayerComponent toggleTranscription: ",t)}}onTranscriptionButtonClick(t){try{this.transcriptionButtonClick.emit(),t&&this.toggleTranscription()}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionButtonClick: ",i)}}onTranscriptionSummaryCopy(){try{this.transcriptionSummaryCopy.emit()}catch(t){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionSummaryCopy: ",t)}}onSubtitlesButtonClick(t){try{this.subtitlesButtonClick.emit(),t&&this.toggleSubtitles()}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onSubtitlesButtonClick: ",i)}}onDurationChange(t){try{t?.target?.value>=0&&this.videoRef&&(this.videoRef.nativeElement.currentTime=t.target.value*(this.annotation?.recordedTime?.duration||0)/1e3),this.playing||this.toggleVideo()}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onDurationChange: ",i)}}timeUpdate(t){try{this.currentTime=this.formatSecondsAsTime(t)}catch(i){this.loggingService.catch("Error in VideoPlayerComponent timeUpdate: ",i)}}formatSecondsAsTime(t){try{let i=Math.floor(t/3600),o=Math.floor((t-i*3600)/60),s=Math.floor(t-i*3600-o*60);return i&&i<10&&(i="0"+i),o<10&&(o="0"+o),s<10&&(s="0"+s),(i?i+":":"")+o+":"+s}catch(i){return this.loggingService.catch("Error in VideoPlayerComponent formatSecondsAsTime: ",i),""}}onSeekToVideo(t,i){try{i&&(i.currentTime=t),this.playing||this.toggleVideo(),this.onTranscriptionTimestampClick(t)}catch(o){this.loggingService.catch("Error in VideoPlayerComponent onSeekToVideo: ",o)}}onTranscriptionTimestampClick(t){try{this.transcriptionTimestampClick.emit(t)}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionTimestampClick: ",i)}}onTranscriptionPanelDragged(){try{this.transcriptionPanelDragged.emit()}catch(t){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionPanelDragged: ",t)}}onDelete(){try{this.delete?.emit()}catch(t){this.loggingService.catch("Error in VideoPlayerComponent onDelete: ",t)}}};r.\u0275fac=function(i){return new(i||r)(S(Q),S(O),S(J))},r.\u0275cmp=H({type:r,selectors:[["snippyly-video-player"]],viewQuery:function(i,o){if(i&1&&Z(et,5),i&2){let s;A(s=q())&&(o.videoRef=s.first)}},hostVars:1,hostBindings:function(i,o){i&2&&L("data-velt-element",o.veltElement)},inputs:{annotation:"annotation",showControls:"showControls",showSubtitlesButton:"showSubtitlesButton",showTranscriptionButton:"showTranscriptionButton",showDeleteButton:"showDeleteButton",transcriptionMode:"transcriptionMode"},outputs:{play:"play",pause:"pause",delete:"delete",transcriptionButtonClick:"transcriptionButtonClick",transcriptionSummaryCopy:"transcriptionSummaryCopy",subtitlesButtonClick:"subtitlesButtonClick",transcriptionTimestampClick:"transcriptionTimestampClick",transcriptionPanelDragged:"transcriptionPanelDragged"},standalone:!1,decls:9,vars:8,consts:[["videoRef",""],["subtitlesRef",""],[1,"s-video-player-container"],[1,"s-video-player",3,"click","pointerdown","pointerup"],["playsinline","",3,"timeupdate","pointerdown","poster"],["type","video/mp4",3,"src",4,"ngIf"],[3,"ngIf"],["class","s-video-subtitles-wrap",3,"hide",4,"ngIf"],["class","s-video-controls-wrap",4,"ngIf"],["class","s-video-transcription",3,"click","pointerdown","pointerup",4,"ngIf"],["type","video/mp4",3,"src"],[3,"src","type",4,"ngFor","ngForOf","ngForTrackBy"],[3,"src","type"],[1,"s-video-subtitles-wrap"],[1,"subtitles"],[3,"subtitlesButtonClick","transcription","timeToRead","mode"],[1,"s-video-controls-wrap"],[1,"s-video-progress-bar"],["type","range","min","0","max","1","step","0.01",3,"value","input",4,"ngIf"],[1,"s-video-controls"],[1,"s-video-controls-left"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click",4,"ngIf"],["width","20","height","20","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click",4,"ngIf"],[1,"s-video-controls-right"],["class","s-video-subtitles-btn s-tooltip",3,"disabled",4,"ngIf"],["class","s-video-transcription-btn s-tooltip",3,"disabled","click",4,"ngIf"],[3,"transcription","timeToRead","transcriptionButtonClick","transcriptionSummaryCopy","seekTo","transcriptionPanelDragged",4,"ngIf"],["width","20","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","class","delete-btn",3,"click",4,"ngIf"],["type","range","min","0","max","1","step","0.01",3,"input","value"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M3.08337 3.65485C3.08337 1.69607 5.23378 0.498172 6.89926 1.52918L17.1496 7.87464C18.7284 8.852 18.7284 11.1486 17.1496 12.126L6.89926 18.4714C5.23378 19.5024 3.08337 18.3045 3.08337 16.3458V3.65485Z","fill","white"],["width","20","height","20","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M1.33203 2.66536C1.33203 1.92899 1.92898 1.33203 2.66536 1.33203H5.33203C6.06841 1.33203 6.66536 1.92898 6.66536 2.66536V13.332C6.66536 14.0684 6.06841 14.6654 5.33203 14.6654H2.66536C1.92898 14.6654 1.33203 14.0684 1.33203 13.332V2.66536Z","fill","white"],["d","M9.33203 2.66536C9.33203 1.92899 9.92899 1.33203 10.6654 1.33203H13.332C14.0684 1.33203 14.6654 1.92898 14.6654 2.66536V13.332C14.6654 14.0684 14.0684 14.6654 13.332 14.6654H10.6654C9.92899 14.6654 9.33203 14.0684 9.33203 13.332V2.66536Z","fill","white"],[1,"s-video-subtitles-btn","s-tooltip"],["class","s-tooltiptext top",4,"ngIf"],["width","20","height","21","viewBox","0 0 20 21","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M11.47 7.62875C11.893 7.41764 12.3718 7.34543 12.8382 7.42242C13.3046 7.49941 13.7348 7.72166 14.0675 8.0575C14.1849 8.17486 14.2508 8.33403 14.2508 8.5C14.2508 8.66597 14.1849 8.82514 14.0675 8.9425C13.9501 9.05986 13.791 9.12579 13.625 9.12579C13.459 9.12579 13.2999 9.05986 13.1825 8.9425C13.0358 8.79219 12.8452 8.69223 12.6382 8.65697C12.4311 8.62171 12.2182 8.65297 12.03 8.74625C11.6712 8.92625 11.25 9.41875 11.25 10.5C11.25 11.5813 11.6712 12.075 12.03 12.2537C12.2182 12.347 12.4311 12.3783 12.6382 12.343C12.8452 12.3078 13.0358 12.2078 13.1825 12.0575C13.2999 11.9401 13.459 11.8742 13.625 11.8742C13.791 11.8742 13.9501 11.9401 14.0675 12.0575C14.1849 12.1749 14.2508 12.334 14.2508 12.5C14.2508 12.666 14.1849 12.8251 14.0675 12.9425C13.38 13.63 12.34 13.8062 11.47 13.3713C10.5787 12.9262 10 11.9187 10 10.5C10 9.08125 10.5787 8.075 11.47 7.62875ZM9.0675 8.0575C8.73492 7.72149 8.3047 7.49913 7.83824 7.42213C7.37178 7.34514 6.89292 7.41745 6.47 7.62875C5.57875 8.07375 5 9.08125 5 10.5C5 11.9187 5.57875 12.925 6.47 13.3713C6.89292 13.5826 7.37178 13.6549 7.83824 13.5779C8.3047 13.5009 8.73492 13.2785 9.0675 12.9425C9.12561 12.8844 9.1717 12.8154 9.20315 12.7395C9.2346 12.6636 9.25079 12.5822 9.25079 12.5C9.25079 12.4178 9.2346 12.3364 9.20315 12.2605C9.1717 12.1846 9.12561 12.1156 9.0675 12.0575C9.00939 11.9994 8.9404 11.9533 8.86448 11.9218C8.78855 11.8904 8.70718 11.8742 8.625 11.8742C8.54282 11.8742 8.46144 11.8904 8.38552 11.9218C8.3096 11.9533 8.24061 11.9994 8.1825 12.0575C8.03568 12.2076 7.84513 12.3075 7.63811 12.3427C7.4311 12.378 7.21823 12.3468 7.03 12.2537C6.67125 12.0738 6.25 11.5813 6.25 10.5C6.25 9.41875 6.67125 8.925 7.03 8.74625C7.21823 8.65316 7.4311 8.62201 7.63811 8.65726C7.84513 8.69251 8.03568 8.79236 8.1825 8.9425C8.29986 9.05986 8.45903 9.12579 8.625 9.12579C8.79097 9.12579 8.95014 9.05986 9.0675 8.9425C9.18486 8.82514 9.25079 8.66597 9.25079 8.5C9.25079 8.33403 9.18486 8.17486 9.0675 8.0575ZM1.25 7.375C1.25 6.5462 1.57924 5.75134 2.16529 5.16529C2.75134 4.57924 3.5462 4.25 4.375 4.25H15.625C16.4538 4.25 17.2487 4.57924 17.8347 5.16529C18.4208 5.75134 18.75 6.5462 18.75 7.375V13.625C18.75 14.4538 18.4208 15.2487 17.8347 15.8347C17.2487 16.4208 16.4538 16.75 15.625 16.75H4.375C3.5462 16.75 2.75134 16.4208 2.16529 15.8347C1.57924 15.2487 1.25 14.4538 1.25 13.625V7.375ZM4.375 5.5C3.87772 5.5 3.40081 5.69754 3.04917 6.04917C2.69754 6.40081 2.5 6.87772 2.5 7.375V13.625C2.5 14.1223 2.69754 14.5992 3.04917 14.9508C3.40081 15.3025 3.87772 15.5 4.375 15.5H15.625C16.1223 15.5 16.5992 15.3025 16.9508 14.9508C17.3025 14.5992 17.5 14.1223 17.5 13.625V7.375C17.5 6.87772 17.3025 6.40081 16.9508 6.04917C16.5992 5.69754 16.1223 5.5 15.625 5.5H4.375Z","fill","white"],[1,"s-tooltiptext","top"],[1,"s-video-transcription-btn","s-tooltip",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M7.49997 10.8332C9.34164 10.8332 10.8333 9.3415 10.8333 7.49984C10.8333 5.65817 9.34164 4.1665 7.49997 4.1665C5.65831 4.1665 4.16664 5.65817 4.16664 7.49984C4.16664 9.3415 5.65831 10.8332 7.49997 10.8332ZM7.49997 5.83317C8.41664 5.83317 9.16664 6.58317 9.16664 7.49984C9.16664 8.4165 8.41664 9.1665 7.49997 9.1665C6.58331 9.1665 5.83331 8.4165 5.83331 7.49984C5.83331 6.58317 6.58331 5.83317 7.49997 5.83317ZM12.825 12.9665C11.425 12.2498 9.60831 11.6665 7.49997 11.6665C5.39164 11.6665 3.57497 12.2498 2.17497 12.9665C1.76835 13.1759 1.42772 13.4939 1.19089 13.8852C0.954055 14.2765 0.830281 14.7258 0.833306 15.1832V17.4998H14.1666V15.1832C14.1666 14.2498 13.6583 13.3915 12.825 12.9665ZM12.5 15.8332H2.49997V15.1832C2.49997 14.8665 2.66664 14.5832 2.93331 14.4498C3.92497 13.9415 5.52497 13.3332 7.49997 13.3332C9.47497 13.3332 11.075 13.9415 12.0666 14.4498C12.3333 14.5832 12.5 14.8665 12.5 15.1832V15.8332ZM14.9416 13.3332L16.3 11.9748C13.9916 9.45817 13.9916 5.67484 16.3 3.02484L14.9416 1.6665C11.6916 4.90817 11.6833 9.95817 14.9416 13.3332ZM19.1 9.12484C18.7587 8.65332 18.5749 8.08609 18.5749 7.504C18.5749 6.92192 18.7587 6.35469 19.1 5.88317L17.7 4.47484C16.0166 6.15817 16.0166 8.69984 17.7 10.5332L19.1 9.12484Z","fill","white"],[3,"transcriptionButtonClick","transcriptionSummaryCopy","seekTo","transcriptionPanelDragged","transcription","timeToRead"],["width","20","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",1,"delete-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.28702 4.66602V12.2851C4.28702 13.1266 5.01189 13.8089 5.90606 13.8089H10.7632C11.6574 13.8089 12.3823 13.1266 12.3823 12.2851V4.66602H14.0013V12.2851C14.0013 13.9682 12.5516 15.3327 10.7632 15.3327H5.90606C4.11771 15.3327 2.66797 13.9682 2.66797 12.2851V4.66602H4.28702Z","fill","#FF7162"],["d","M6.77778 6.66602C6.34822 6.66602 6 7.06398 6 7.5549V11.1105C6 11.6014 6.34822 11.9993 6.77778 11.9993C7.20733 11.9993 7.55556 11.6014 7.55556 11.1105V7.5549C7.55556 7.06398 7.20733 6.66602 6.77778 6.66602Z","fill","#FF7162"],["d","M9.88889 6.66602C9.45933 6.66602 9.11111 7.06398 9.11111 7.5549V11.1105C9.11111 11.6014 9.45933 11.9993 9.88889 11.9993C10.3184 11.9993 10.6667 11.6014 10.6667 11.1105V7.5549C10.6667 7.06398 10.3184 6.66602 9.88889 6.66602Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.16667 3.11111V2.33333C5.16667 1.04467 6.22999 0 7.54167 0H9.125C10.4367 0 11.5 1.04467 11.5 2.33333V3.11111H13.875C14.3122 3.11111 14.6667 3.45933 14.6667 3.88889C14.6667 4.31844 14.3122 4.66667 13.875 4.66667H2.79167C2.35444 4.66667 2 4.31844 2 3.88889C2 3.45933 2.35444 3.11111 2.79167 3.11111H5.16667ZM6.75 2.33333C6.75 1.90378 7.10444 1.55556 7.54167 1.55556H9.125C9.56223 1.55556 9.91667 1.90378 9.91667 2.33333V3.11111H6.75V2.33333Z","fill","#FF7162"],[1,"s-video-transcription",3,"click","pointerdown","pointerup"],[3,"transcription","timeToRead","mode","visible","seekTo","close","transcriptionSummaryCopy","transcriptionPanelDragged",4,"ngIf"],[3,"seekTo","close","transcriptionSummaryCopy","transcriptionPanelDragged","transcription","timeToRead","mode","visible"]],template:function(i,o){if(i&1){let s=_();u(0,"div",2)(1,"div",3),g("click",function(h){return l(s),c(h.stopPropagation())})("pointerdown",function(h){return l(s),c(h.stopPropagation())})("pointerup",function(h){return l(s),c(h.stopPropagation())}),u(2,"video",4,0),g("timeupdate",function(){l(s);let h=f(3);return c(o.timeUpdate(h==null?null:h.currentTime))})("pointerdown",function(){return l(s),c(o.toggleVideo())}),v(4,it,1,1,"source",5)(5,ot,2,4,"ng-template",6),d(),v(6,rt,4,5,"div",7)(7,gt,14,8,"div",8),d(),v(8,vt,2,1,"div",9),d()}i&2&&(m(2),b("flip",(o.annotation==null?null:o.annotation.recordingType)==="video"),p("poster",(o.annotation==null||o.annotation.attachment==null?null:o.annotation.attachment.thumbnail)||(!(o.annotation==null||o.annotation.attachments==null)&&o.annotation.attachments.length?o.annotation==null||o.annotation.attachments[0]==null?null:o.annotation.attachments[0].thumbnail:"")),m(2),p("ngIf",!(!(o.annotation==null||o.annotation.attachments==null)&&o.annotation.attachments.length)&&(o.annotation==null?null:o.annotation.attachment)),m(),p("ngIf",o.annotation==null||o.annotation.attachments==null?null:o.annotation.attachments.length),m(),p("ngIf",o.showSubtitles),m(),p("ngIf",o.showControls),m(),p("ngIf",o.transcriptionVisible))},dependencies:[z,G,$,W],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#fff!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-video-player[_ngcontent-%COMP%]{position:relative!important;display:flex!important;justify-content:center!important;align-items:center!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;background-color:#d3d3d3!important}.s-video-player[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important;height:100%!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important}.controls-wrap[_ngcontent-%COMP%]{position:absolute!important;bottom:0!important;display:flex!important;justify-content:space-between!important;align-items:center!important;width:80%!important;padding:1em!important;font-style:normal!important;font-weight:400!important;font-size:1em!important;line-height:1em!important;color:#fff!important}.controls[_ngcontent-%COMP%]{display:flex!important;justify-content:center!important;align-items:center!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.line[_ngcontent-%COMP%]{position:absolute!important;bottom:100%!important;width:90%!important;display:flex!important;align-items:center!important}.line[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%!important}.s-video-subtitles-wrap[_ngcontent-%COMP%]{position:absolute;width:calc((25rem + 0px) * var(--velt-base-rem-unit))!important;max-width:90%!important;bottom:10%!important;left:50%!important;transform:translate(-50%)!important;transition:bottom .3s!important}.s-video-subtitles-wrap[_ngcontent-%COMP%] .subtitles[_ngcontent-%COMP%]{background:#141416!important;border-radius:calc((.6rem + 0px) * var(--velt-base-rem-unit))!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;text-align:center!important}.s-video-subtitles-wrap.hide[_ngcontent-%COMP%]{display:none!important}svg[_ngcontent-%COMP%]{cursor:pointer!important}.s-video-player[_ngcontent-%COMP%]:hover .s-video-subtitles-wrap[_ngcontent-%COMP%]{bottom:calc(10% + 80px)!important}.s-video-player[_ngcontent-%COMP%]:hover .s-video-controls-wrap[_ngcontent-%COMP%]{opacity:1!important}.s-video-controls-wrap[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;position:absolute!important;z-index:10!important;bottom:0!important;width:100%!important;border-bottom-left-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;border-bottom-right-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;overflow:hidden!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;opacity:0!important;transition:opacity .3s!important;background:#141416!important;background:linear-gradient(0deg,#141416,#37373700)!important;padding-top:calc((5rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-progress-bar[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%!important;accent-color:#625DF5!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-controls[_ngcontent-%COMP%]{display:flex!important;justify-content:space-between!important;align-items:center!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-controls[_ngcontent-%COMP%] .s-video-controls-left[_ngcontent-%COMP%]{display:flex!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;align-items:center!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-controls[_ngcontent-%COMP%] .s-video-controls-right[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-player-container[_ngcontent-%COMP%]{width:100%!important;height:100%!important;box-sizing:border-box!important;display:flex!important;gap:2rem!important}.s-video-player-container[_ngcontent-%COMP%] .s-video-player[_ngcontent-%COMP%]{flex:1 1 100%!important;height:100%!important;background-color:#141416!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important}.s-video-player-container[_ngcontent-%COMP%] .s-video-player[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%!important}.s-video-player-container[_ngcontent-%COMP%] .s-video-transcription[_ngcontent-%COMP%]{flex:0 0 auto!important;width:calc((25rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;height:100%!important;overflow:hidden!important}.s-video-subtitles-btn[_ngcontent-%COMP%], .s-video-transcription-btn[_ngcontent-%COMP%]{display:flex!important}.s-video-subtitles-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%], .s-video-transcription-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{cursor:not-allowed!important}.s-video-subtitles-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%], .s-video-transcription-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#80808a!important}"],changeDetection:0});let n=r;return n})();var It=(()=>{let r=class r{transform(t){try{if(!t||t<0||!isFinite(t))return"00:00:00";let i=Math.floor(t/1e3),o=Math.floor(i/3600),s=Math.floor(i%3600/60),P=i%60,h=j=>isNaN(j)?"00":j.toString().padStart(2,"0"),V=h(o),x=h(s),K=h(P);return`${V}:${x}:${K}`}catch(i){return console.error("Error in hourMinSecTimeDisplay pipe:",i),null}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275pipe=k({name:"hourMinSecTimeDisplay",type:r,pure:!0});let n=r;return n})();export{W as a,Ot as b,It as c,J as d};
1
+ import{b as $}from"./chunk-KPCULYW2.js";import{$ as D,Db as Z,Eb as A,Fa as m,Fb as q,Fc as z,Ga as C,Gc as G,Ib as f,Kb as b,Ke as U,Nb as T,Ob as N,Pa as S,Pb as I,Ua as H,Xa as k,_a as v,ca as B,db as L,ha as l,ia as c,ja as w,ji as Q,kc as M,ki as O,la as F,lb as p,lc as E,mb as u,nb as d,ob as y,vb as _,xb as g,zb as a}from"./chunk-4EV2AXDK.js";var W=(()=>{let r=class r{transform(t,i,...o){try{let s=t&&t?.slice?t?.slice():[];return s?.length&&new U().getBrowserName()?.toLocaleLowerCase()==="safari"&&(s=s.sort((V,x)=>V.type==="mp4"&&x.type!=="mp4"?-1:V.type!=="mp4"&&x.type==="mp4"?1:0)),s}catch{return t}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275pipe=k({name:"rearrangeMediaSource",type:r,pure:!0});let n=r;return n})();var J=(()=>{let r=class r{constructor(t,i){this.injector=t,this.loggingService=i,this.arrowPromise=null,this.commentPromise=null,this.cursorPromise=null,this.huddlePromise=null,this.notificationPromise=null,this.presencePromise=null,this.reactionPromise=null,this.recorderPromise=null,this.tagPromise=null,this.rewriterPromise=null,this.selectionPromise=null,this.areaPromise=null,this.activityLogPromise=null,this.viewPromise=null,this.userInvitePromise=null,this.userRequestPromise=null,this.videoPlayerPromise=null,this.crdtPromise=null,this.liveStateSyncPromise=null,this.loggingService.log("%c[WB] Creating CLASS: ChunkLoaderService","color: blue;")}ensureArrowChunk(){return this.arrowPromise||(this.arrowPromise=import("./velt-arrow.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading arrow chunk: ",t),this.arrowPromise=null,t})),this.arrowPromise}ensureCommentChunk(){return this.commentPromise||(this.commentPromise=import("./velt-comment.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading comment chunk: ",t),this.commentPromise=null,t})),this.commentPromise}ensureCursorChunk(){return this.cursorPromise||(this.cursorPromise=import("./velt-cursor.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading cursor chunk: ",t),this.cursorPromise=null,t})),this.cursorPromise}ensureHuddleChunk(){return this.huddlePromise||(this.huddlePromise=import("./velt-huddle.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading huddle chunk: ",t),this.huddlePromise=null,t})),this.huddlePromise}ensureNotificationChunk(){return this.notificationPromise||(this.notificationPromise=import("./velt-notification.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading notification chunk: ",t),this.notificationPromise=null,t})),this.notificationPromise}ensurePresenceChunk(){return this.presencePromise||(this.presencePromise=import("./velt-presence.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading presence chunk: ",t),this.presencePromise=null,t})),this.presencePromise}ensureReactionChunk(){return this.reactionPromise||(this.reactionPromise=import("./velt-reaction.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading reaction chunk: ",t),this.reactionPromise=null,t})),this.reactionPromise}ensureRecorderChunk(){return this.recorderPromise||(this.recorderPromise=import("./velt-recorder.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading recorder chunk: ",t),this.recorderPromise=null,t})),this.recorderPromise}ensureTagChunk(){return this.tagPromise||(this.tagPromise=import("./velt-tag.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading tag chunk: ",t),this.tagPromise=null,t})),this.tagPromise}ensureRewriterChunk(){return this.rewriterPromise||(this.rewriterPromise=import("./velt-rewriter.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading rewriter chunk: ",t),this.rewriterPromise=null,t})),this.rewriterPromise}ensureSelectionChunk(){return this.selectionPromise||(this.selectionPromise=import("./velt-selection.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading selection chunk: ",t),this.selectionPromise=null,t})),this.selectionPromise}ensureAreaChunk(){return this.areaPromise||(this.areaPromise=import("./velt-area.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading area chunk: ",t),this.areaPromise=null,t})),this.areaPromise}ensureActivityLogChunk(){return this.activityLogPromise||(this.activityLogPromise=import("./velt-activity-log.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading activity-log chunk: ",t),this.activityLogPromise=null,t})),this.activityLogPromise}ensureViewChunk(){return this.viewPromise||(this.viewPromise=import("./velt-views.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading view chunk: ",t),this.viewPromise=null,t})),this.viewPromise}ensureUserInviteChunk(){return this.userInvitePromise||(this.userInvitePromise=import("./velt-user-invite.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading user-invite chunk: ",t),this.userInvitePromise=null,t})),this.userInvitePromise}ensureUserRequestChunk(){return this.userRequestPromise||(this.userRequestPromise=import("./velt-user-request.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading user-request chunk: ",t),this.userRequestPromise=null,t})),this.userRequestPromise}ensureVideoPlayerChunk(){return this.videoPlayerPromise||(this.videoPlayerPromise=import("./velt-video-player.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading video-player chunk: ",t),this.videoPlayerPromise=null,t})),this.videoPlayerPromise}ensureCrdtChunk(){return this.crdtPromise||(this.crdtPromise=import("./velt-crdt.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading crdt chunk: ",t),this.crdtPromise=null,t})),this.crdtPromise}ensureLiveStateSyncChunk(){return this.liveStateSyncPromise||(this.liveStateSyncPromise=import("./velt-live-state-sync.js").then(t=>t.default(this.injector)).catch(t=>{throw this.loggingService.catch("Error loading live-state-sync chunk: ",t),this.liveStateSyncPromise=null,t})),this.liveStateSyncPromise}};r.\u0275fac=function(i){return new(i||r)(B(F),B(O))},r.\u0275prov=D({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var et=["videoRef"];function it(n,r){if(n&1&&y(0,"source",10),n&2){let e=a();p("src",!(e.annotation==null||e.annotation.attachment==null)&&e.annotation.attachment.thumbnail?e.annotation==null||e.annotation.attachment==null?null:e.annotation.attachment.url:(e.annotation==null||e.annotation.attachment==null?null:e.annotation.attachment.url)+"#t=0.001")}}function nt(n,r){if(n&1&&y(0,"source",12),n&2){let e=r.$implicit;p("src",e==null?null:e.url)("type",(e==null?null:e.mimeType)||"video/mp4")}}function ot(n,r){if(n&1&&(v(0,nt,1,2,"source",11),M(1,"rearrangeMediaSource")),n&2){let e=a();p("ngForOf",E(1,2,e.annotation==null?null:e.annotation.attachments))("ngForTrackBy",e.trackByAttachmentId)}}function rt(n,r){if(n&1){let e=_();u(0,"div",13)(1,"div",14)(2,"snippyly-subtitles-embed",15,1),g("subtitlesButtonClick",function(){l(e);let i=a();return c(i.onSubtitlesButtonClick())}),d()()()}if(n&2){let e,t=f(3),i=a(),o=f(3);b("hide",(t==null?null:t.componentConfigSignal)&&(t==null||(e=t.componentConfigSignal())==null?null:e.highlightedTextIndex)<0),m(2),p("transcription",i.annotation==null?null:i.annotation.transcription)("timeToRead",(o==null?null:o.currentTime)||0)("mode","embed")}}function at(n,r){if(n&1){let e=_();u(0,"input",28),g("input",function(i){l(e);let o=a(2);return c(o.onDurationChange(i))}),d()}if(n&2){let e=a(2),t=f(3);p("value",(t==null?null:t.currentTime)*1e3/((e.annotation==null||e.annotation.recordedTime==null?null:e.annotation.recordedTime.duration)||0))}}function st(n,r){if(n&1){let e=_();w(),u(0,"svg",29),g("click",function(){l(e);let i=a(2);return c(i.toggleVideo())}),y(1,"path",30),d()}}function lt(n,r){if(n&1){let e=_();w(),u(0,"svg",31),g("click",function(){l(e);let i=a(2);return c(i.toggleVideo())}),y(1,"path",32)(2,"path",33),d()}}function ct(n,r){n&1&&(u(0,"span",38),T(1),M(2,"translate"),d()),n&2&&(m(),I(" ",E(2,1,"Subtitles not available")," "))}function pt(n,r){if(n&1){let e=_();u(0,"div",34),v(1,ct,3,3,"span",35),w(),u(2,"svg",36),g("click",function(){l(e);let i=a(2);return c(!(i.annotation==null||i.annotation.transcription==null)&&i.annotation.transcription.transcriptedText?i.onSubtitlesButtonClick(!0):null)}),y(3,"path",37),d()()}if(n&2){let e=a(2);b("disabled",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText)),m(),p("ngIf",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText))}}function mt(n,r){n&1&&(u(0,"span",38),T(1),M(2,"translate"),d()),n&2&&(m(),I(" ",E(2,1,"Transcription not available")))}function ut(n,r){if(n&1){let e=_();u(0,"div",39),g("click",function(){l(e);let i=a(2);return c(!(i.annotation==null||i.annotation.transcription==null)&&i.annotation.transcription.transcriptedText?i.onTranscriptionButtonClick(!0):null)}),v(1,mt,3,3,"span",35),w(),u(2,"svg",40),y(3,"path",41),d()()}if(n&2){let e=a(2);b("disabled",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText)),m(),p("ngIf",!(!(e.annotation==null||e.annotation.transcription==null)&&e.annotation.transcription.transcriptedText))}}function dt(n,r){if(n&1){let e=_();u(0,"snippyly-transcription-embed",42),g("transcriptionButtonClick",function(){l(e);let i=a(2);return c(i.onTranscriptionButtonClick())})("transcriptionSummaryCopy",function(){l(e);let i=a(2);return c(i.onTranscriptionSummaryCopy())})("seekTo",function(i){l(e);let o=a(2),s=f(3);return c(o.onSeekToVideo(i,s))})("transcriptionPanelDragged",function(){l(e);let i=a(2);return c(i.onTranscriptionPanelDragged())}),d()}if(n&2){let e=a(2),t=f(3);p("transcription",e.annotation==null?null:e.annotation.transcription)("timeToRead",(t==null?null:t.currentTime)||0)}}function ht(n,r){if(n&1){let e=_();w(),u(0,"svg",43),g("click",function(){l(e);let i=a(2);return c(i.onDelete())}),y(1,"path",44)(2,"path",45)(3,"path",46)(4,"path",47),d()}}function gt(n,r){if(n&1&&(u(0,"div",16)(1,"div",17),v(2,at,1,1,"input",18),d(),u(3,"div",19)(4,"div",20),v(5,st,2,0,"svg",21)(6,lt,3,0,"svg",22),u(7,"span"),T(8),d()(),u(9,"div",23),v(10,pt,4,3,"div",24)(11,ut,4,3,"div",25)(12,dt,1,2,"snippyly-transcription-embed",26)(13,ht,5,0,"svg",27),d()()()),n&2){let e=a();m(2),p("ngIf",e.annotation==null||e.annotation.recordedTime==null?null:e.annotation.recordedTime.duration),m(3),p("ngIf",!e.playing),m(),p("ngIf",e.playing),m(2),N(e.currentTime||(e.annotation==null||e.annotation.recordedTime==null?null:e.annotation.recordedTime.display)||"00:00"),m(2),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.showSubtitlesButton),m(),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.transcriptionMode==="embed"),m(),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.transcriptionMode==="floating"&&e.showTranscriptionButton),m(),p("ngIf",e.showDeleteButton)}}function _t(n,r){if(n&1){let e=_();u(0,"snippyly-transcription-embed",50),g("seekTo",function(i){l(e);let o=a(2),s=f(3);return c(o.onSeekToVideo(i,s))})("close",function(){l(e);let i=a(2);return c(i.toggleTranscription())})("transcriptionSummaryCopy",function(){l(e);let i=a(2);return c(i.onTranscriptionSummaryCopy())})("transcriptionPanelDragged",function(){l(e);let i=a(2);return c(i.onTranscriptionPanelDragged())}),d()}if(n&2){let e=a(2),t=f(3);p("transcription",e.annotation==null?null:e.annotation.transcription)("timeToRead",(t==null?null:t.currentTime)||0)("mode",e.transcriptionMode)("visible",!0)}}function vt(n,r){if(n&1){let e=_();u(0,"div",48),g("click",function(i){return l(e),c(i.stopPropagation())})("pointerdown",function(i){return l(e),c(i.stopPropagation())})("pointerup",function(i){return l(e),c(i.stopPropagation())}),v(1,_t,1,4,"snippyly-transcription-embed",49),d()}if(n&2){let e=a();m(),p("ngIf",(e.annotation==null?null:e.annotation.transcription)&&e.showTranscriptionButton)}}var Ot=(()=>{let r=class r{constructor(t,i,o){this.analyticsService=t,this.loggingService=i,this.chunkLoaderService=o,this.showControls=!0,this.showSubtitlesButton=!0,this.showTranscriptionButton=!0,this.transcriptionMode="floating",this.play=new C,this.pause=new C,this.delete=new C,this.transcriptionButtonClick=new C,this.transcriptionSummaryCopy=new C,this.subtitlesButtonClick=new C,this.transcriptionTimestampClick=new C,this.transcriptionPanelDragged=new C,this.playing=!1,this.currentTime="",this.showSubtitles=!1,this.transcriptionVisible=!1,this.veltElement=!0}ngOnInit(){this.annotation?.transcription&&this.ensureRecorderChunkForEmbeds()}ensureRecorderChunkForEmbeds(){this.chunkLoaderService.ensureRecorderChunk().catch(t=>{this.loggingService.catch("Error in VideoPlayerComponent ensureRecorderChunkForEmbeds: ",t)})}trackByAttachmentId(t,i){return i?.attachmentId}toggleVideo(){try{if(this.videoRef?.nativeElement){let t=this.videoRef?.nativeElement;t&&(t.duration>0&&!t.paused?(t.pause(),this.playing=!1,this.pause.emit()):(t.play(),this.playing=!0,this.play.emit()))}}catch(t){this.loggingService.catch("Error in VideoPlayerComponent toggleVideo: ",t)}}toggleSubtitles(){try{this.ensureRecorderChunkForEmbeds(),this.showSubtitles=!this.showSubtitles}catch(t){this.loggingService.catch("Error in VideoPlayerComponent toggleSubtitles: ",t)}}toggleTranscription(){try{this.ensureRecorderChunkForEmbeds(),this.transcriptionVisible=!this.transcriptionVisible}catch(t){this.loggingService.catch("Error in VideoPlayerComponent toggleTranscription: ",t)}}onTranscriptionButtonClick(t){try{this.transcriptionButtonClick.emit(),t&&this.toggleTranscription()}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionButtonClick: ",i)}}onTranscriptionSummaryCopy(){try{this.transcriptionSummaryCopy.emit()}catch(t){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionSummaryCopy: ",t)}}onSubtitlesButtonClick(t){try{this.subtitlesButtonClick.emit(),t&&this.toggleSubtitles()}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onSubtitlesButtonClick: ",i)}}onDurationChange(t){try{t?.target?.value>=0&&this.videoRef&&(this.videoRef.nativeElement.currentTime=t.target.value*(this.annotation?.recordedTime?.duration||0)/1e3),this.playing||this.toggleVideo()}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onDurationChange: ",i)}}timeUpdate(t){try{this.currentTime=this.formatSecondsAsTime(t)}catch(i){this.loggingService.catch("Error in VideoPlayerComponent timeUpdate: ",i)}}formatSecondsAsTime(t){try{let i=Math.floor(t/3600),o=Math.floor((t-i*3600)/60),s=Math.floor(t-i*3600-o*60);return i&&i<10&&(i="0"+i),o<10&&(o="0"+o),s<10&&(s="0"+s),(i?i+":":"")+o+":"+s}catch(i){return this.loggingService.catch("Error in VideoPlayerComponent formatSecondsAsTime: ",i),""}}onSeekToVideo(t,i){try{i&&(i.currentTime=t),this.playing||this.toggleVideo(),this.onTranscriptionTimestampClick(t)}catch(o){this.loggingService.catch("Error in VideoPlayerComponent onSeekToVideo: ",o)}}onTranscriptionTimestampClick(t){try{this.transcriptionTimestampClick.emit(t)}catch(i){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionTimestampClick: ",i)}}onTranscriptionPanelDragged(){try{this.transcriptionPanelDragged.emit()}catch(t){this.loggingService.catch("Error in VideoPlayerComponent onTranscriptionPanelDragged: ",t)}}onDelete(){try{this.delete?.emit()}catch(t){this.loggingService.catch("Error in VideoPlayerComponent onDelete: ",t)}}};r.\u0275fac=function(i){return new(i||r)(S(Q),S(O),S(J))},r.\u0275cmp=H({type:r,selectors:[["snippyly-video-player"]],viewQuery:function(i,o){if(i&1&&Z(et,5),i&2){let s;A(s=q())&&(o.videoRef=s.first)}},hostVars:1,hostBindings:function(i,o){i&2&&L("data-velt-element",o.veltElement)},inputs:{annotation:"annotation",showControls:"showControls",showSubtitlesButton:"showSubtitlesButton",showTranscriptionButton:"showTranscriptionButton",showDeleteButton:"showDeleteButton",transcriptionMode:"transcriptionMode"},outputs:{play:"play",pause:"pause",delete:"delete",transcriptionButtonClick:"transcriptionButtonClick",transcriptionSummaryCopy:"transcriptionSummaryCopy",subtitlesButtonClick:"subtitlesButtonClick",transcriptionTimestampClick:"transcriptionTimestampClick",transcriptionPanelDragged:"transcriptionPanelDragged"},standalone:!1,decls:9,vars:8,consts:[["videoRef",""],["subtitlesRef",""],[1,"s-video-player-container"],[1,"s-video-player",3,"click","pointerdown","pointerup"],["playsinline","",3,"timeupdate","pointerdown","poster"],["type","video/mp4",3,"src",4,"ngIf"],[3,"ngIf"],["class","s-video-subtitles-wrap",3,"hide",4,"ngIf"],["class","s-video-controls-wrap",4,"ngIf"],["class","s-video-transcription",3,"click","pointerdown","pointerup",4,"ngIf"],["type","video/mp4",3,"src"],[3,"src","type",4,"ngFor","ngForOf","ngForTrackBy"],[3,"src","type"],[1,"s-video-subtitles-wrap"],[1,"subtitles"],[3,"subtitlesButtonClick","transcription","timeToRead","mode"],[1,"s-video-controls-wrap"],[1,"s-video-progress-bar"],["type","range","min","0","max","1","step","0.01",3,"value","input",4,"ngIf"],[1,"s-video-controls"],[1,"s-video-controls-left"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click",4,"ngIf"],["width","20","height","20","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click",4,"ngIf"],[1,"s-video-controls-right"],["class","s-video-subtitles-btn s-tooltip",3,"disabled",4,"ngIf"],["class","s-video-transcription-btn s-tooltip",3,"disabled","click",4,"ngIf"],[3,"transcription","timeToRead","transcriptionButtonClick","transcriptionSummaryCopy","seekTo","transcriptionPanelDragged",4,"ngIf"],["width","20","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","class","delete-btn",3,"click",4,"ngIf"],["type","range","min","0","max","1","step","0.01",3,"input","value"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M3.08337 3.65485C3.08337 1.69607 5.23378 0.498172 6.89926 1.52918L17.1496 7.87464C18.7284 8.852 18.7284 11.1486 17.1496 12.126L6.89926 18.4714C5.23378 19.5024 3.08337 18.3045 3.08337 16.3458V3.65485Z","fill","white"],["width","20","height","20","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M1.33203 2.66536C1.33203 1.92899 1.92898 1.33203 2.66536 1.33203H5.33203C6.06841 1.33203 6.66536 1.92898 6.66536 2.66536V13.332C6.66536 14.0684 6.06841 14.6654 5.33203 14.6654H2.66536C1.92898 14.6654 1.33203 14.0684 1.33203 13.332V2.66536Z","fill","white"],["d","M9.33203 2.66536C9.33203 1.92899 9.92899 1.33203 10.6654 1.33203H13.332C14.0684 1.33203 14.6654 1.92898 14.6654 2.66536V13.332C14.6654 14.0684 14.0684 14.6654 13.332 14.6654H10.6654C9.92899 14.6654 9.33203 14.0684 9.33203 13.332V2.66536Z","fill","white"],[1,"s-video-subtitles-btn","s-tooltip"],["class","s-tooltiptext top",4,"ngIf"],["width","20","height","21","viewBox","0 0 20 21","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M11.47 7.62875C11.893 7.41764 12.3718 7.34543 12.8382 7.42242C13.3046 7.49941 13.7348 7.72166 14.0675 8.0575C14.1849 8.17486 14.2508 8.33403 14.2508 8.5C14.2508 8.66597 14.1849 8.82514 14.0675 8.9425C13.9501 9.05986 13.791 9.12579 13.625 9.12579C13.459 9.12579 13.2999 9.05986 13.1825 8.9425C13.0358 8.79219 12.8452 8.69223 12.6382 8.65697C12.4311 8.62171 12.2182 8.65297 12.03 8.74625C11.6712 8.92625 11.25 9.41875 11.25 10.5C11.25 11.5813 11.6712 12.075 12.03 12.2537C12.2182 12.347 12.4311 12.3783 12.6382 12.343C12.8452 12.3078 13.0358 12.2078 13.1825 12.0575C13.2999 11.9401 13.459 11.8742 13.625 11.8742C13.791 11.8742 13.9501 11.9401 14.0675 12.0575C14.1849 12.1749 14.2508 12.334 14.2508 12.5C14.2508 12.666 14.1849 12.8251 14.0675 12.9425C13.38 13.63 12.34 13.8062 11.47 13.3713C10.5787 12.9262 10 11.9187 10 10.5C10 9.08125 10.5787 8.075 11.47 7.62875ZM9.0675 8.0575C8.73492 7.72149 8.3047 7.49913 7.83824 7.42213C7.37178 7.34514 6.89292 7.41745 6.47 7.62875C5.57875 8.07375 5 9.08125 5 10.5C5 11.9187 5.57875 12.925 6.47 13.3713C6.89292 13.5826 7.37178 13.6549 7.83824 13.5779C8.3047 13.5009 8.73492 13.2785 9.0675 12.9425C9.12561 12.8844 9.1717 12.8154 9.20315 12.7395C9.2346 12.6636 9.25079 12.5822 9.25079 12.5C9.25079 12.4178 9.2346 12.3364 9.20315 12.2605C9.1717 12.1846 9.12561 12.1156 9.0675 12.0575C9.00939 11.9994 8.9404 11.9533 8.86448 11.9218C8.78855 11.8904 8.70718 11.8742 8.625 11.8742C8.54282 11.8742 8.46144 11.8904 8.38552 11.9218C8.3096 11.9533 8.24061 11.9994 8.1825 12.0575C8.03568 12.2076 7.84513 12.3075 7.63811 12.3427C7.4311 12.378 7.21823 12.3468 7.03 12.2537C6.67125 12.0738 6.25 11.5813 6.25 10.5C6.25 9.41875 6.67125 8.925 7.03 8.74625C7.21823 8.65316 7.4311 8.62201 7.63811 8.65726C7.84513 8.69251 8.03568 8.79236 8.1825 8.9425C8.29986 9.05986 8.45903 9.12579 8.625 9.12579C8.79097 9.12579 8.95014 9.05986 9.0675 8.9425C9.18486 8.82514 9.25079 8.66597 9.25079 8.5C9.25079 8.33403 9.18486 8.17486 9.0675 8.0575ZM1.25 7.375C1.25 6.5462 1.57924 5.75134 2.16529 5.16529C2.75134 4.57924 3.5462 4.25 4.375 4.25H15.625C16.4538 4.25 17.2487 4.57924 17.8347 5.16529C18.4208 5.75134 18.75 6.5462 18.75 7.375V13.625C18.75 14.4538 18.4208 15.2487 17.8347 15.8347C17.2487 16.4208 16.4538 16.75 15.625 16.75H4.375C3.5462 16.75 2.75134 16.4208 2.16529 15.8347C1.57924 15.2487 1.25 14.4538 1.25 13.625V7.375ZM4.375 5.5C3.87772 5.5 3.40081 5.69754 3.04917 6.04917C2.69754 6.40081 2.5 6.87772 2.5 7.375V13.625C2.5 14.1223 2.69754 14.5992 3.04917 14.9508C3.40081 15.3025 3.87772 15.5 4.375 15.5H15.625C16.1223 15.5 16.5992 15.3025 16.9508 14.9508C17.3025 14.5992 17.5 14.1223 17.5 13.625V7.375C17.5 6.87772 17.3025 6.40081 16.9508 6.04917C16.5992 5.69754 16.1223 5.5 15.625 5.5H4.375Z","fill","white"],[1,"s-tooltiptext","top"],[1,"s-video-transcription-btn","s-tooltip",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M7.49997 10.8332C9.34164 10.8332 10.8333 9.3415 10.8333 7.49984C10.8333 5.65817 9.34164 4.1665 7.49997 4.1665C5.65831 4.1665 4.16664 5.65817 4.16664 7.49984C4.16664 9.3415 5.65831 10.8332 7.49997 10.8332ZM7.49997 5.83317C8.41664 5.83317 9.16664 6.58317 9.16664 7.49984C9.16664 8.4165 8.41664 9.1665 7.49997 9.1665C6.58331 9.1665 5.83331 8.4165 5.83331 7.49984C5.83331 6.58317 6.58331 5.83317 7.49997 5.83317ZM12.825 12.9665C11.425 12.2498 9.60831 11.6665 7.49997 11.6665C5.39164 11.6665 3.57497 12.2498 2.17497 12.9665C1.76835 13.1759 1.42772 13.4939 1.19089 13.8852C0.954055 14.2765 0.830281 14.7258 0.833306 15.1832V17.4998H14.1666V15.1832C14.1666 14.2498 13.6583 13.3915 12.825 12.9665ZM12.5 15.8332H2.49997V15.1832C2.49997 14.8665 2.66664 14.5832 2.93331 14.4498C3.92497 13.9415 5.52497 13.3332 7.49997 13.3332C9.47497 13.3332 11.075 13.9415 12.0666 14.4498C12.3333 14.5832 12.5 14.8665 12.5 15.1832V15.8332ZM14.9416 13.3332L16.3 11.9748C13.9916 9.45817 13.9916 5.67484 16.3 3.02484L14.9416 1.6665C11.6916 4.90817 11.6833 9.95817 14.9416 13.3332ZM19.1 9.12484C18.7587 8.65332 18.5749 8.08609 18.5749 7.504C18.5749 6.92192 18.7587 6.35469 19.1 5.88317L17.7 4.47484C16.0166 6.15817 16.0166 8.69984 17.7 10.5332L19.1 9.12484Z","fill","white"],[3,"transcriptionButtonClick","transcriptionSummaryCopy","seekTo","transcriptionPanelDragged","transcription","timeToRead"],["width","20","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",1,"delete-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.28702 4.66602V12.2851C4.28702 13.1266 5.01189 13.8089 5.90606 13.8089H10.7632C11.6574 13.8089 12.3823 13.1266 12.3823 12.2851V4.66602H14.0013V12.2851C14.0013 13.9682 12.5516 15.3327 10.7632 15.3327H5.90606C4.11771 15.3327 2.66797 13.9682 2.66797 12.2851V4.66602H4.28702Z","fill","#FF7162"],["d","M6.77778 6.66602C6.34822 6.66602 6 7.06398 6 7.5549V11.1105C6 11.6014 6.34822 11.9993 6.77778 11.9993C7.20733 11.9993 7.55556 11.6014 7.55556 11.1105V7.5549C7.55556 7.06398 7.20733 6.66602 6.77778 6.66602Z","fill","#FF7162"],["d","M9.88889 6.66602C9.45933 6.66602 9.11111 7.06398 9.11111 7.5549V11.1105C9.11111 11.6014 9.45933 11.9993 9.88889 11.9993C10.3184 11.9993 10.6667 11.6014 10.6667 11.1105V7.5549C10.6667 7.06398 10.3184 6.66602 9.88889 6.66602Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.16667 3.11111V2.33333C5.16667 1.04467 6.22999 0 7.54167 0H9.125C10.4367 0 11.5 1.04467 11.5 2.33333V3.11111H13.875C14.3122 3.11111 14.6667 3.45933 14.6667 3.88889C14.6667 4.31844 14.3122 4.66667 13.875 4.66667H2.79167C2.35444 4.66667 2 4.31844 2 3.88889C2 3.45933 2.35444 3.11111 2.79167 3.11111H5.16667ZM6.75 2.33333C6.75 1.90378 7.10444 1.55556 7.54167 1.55556H9.125C9.56223 1.55556 9.91667 1.90378 9.91667 2.33333V3.11111H6.75V2.33333Z","fill","#FF7162"],[1,"s-video-transcription",3,"click","pointerdown","pointerup"],[3,"transcription","timeToRead","mode","visible","seekTo","close","transcriptionSummaryCopy","transcriptionPanelDragged",4,"ngIf"],[3,"seekTo","close","transcriptionSummaryCopy","transcriptionPanelDragged","transcription","timeToRead","mode","visible"]],template:function(i,o){if(i&1){let s=_();u(0,"div",2)(1,"div",3),g("click",function(h){return l(s),c(h.stopPropagation())})("pointerdown",function(h){return l(s),c(h.stopPropagation())})("pointerup",function(h){return l(s),c(h.stopPropagation())}),u(2,"video",4,0),g("timeupdate",function(){l(s);let h=f(3);return c(o.timeUpdate(h==null?null:h.currentTime))})("pointerdown",function(){return l(s),c(o.toggleVideo())}),v(4,it,1,1,"source",5)(5,ot,2,4,"ng-template",6),d(),v(6,rt,4,5,"div",7)(7,gt,14,8,"div",8),d(),v(8,vt,2,1,"div",9),d()}i&2&&(m(2),b("flip",(o.annotation==null?null:o.annotation.recordingType)==="video"),p("poster",(o.annotation==null||o.annotation.attachment==null?null:o.annotation.attachment.thumbnail)||(!(o.annotation==null||o.annotation.attachments==null)&&o.annotation.attachments.length?o.annotation==null||o.annotation.attachments[0]==null?null:o.annotation.attachments[0].thumbnail:"")),m(2),p("ngIf",!(!(o.annotation==null||o.annotation.attachments==null)&&o.annotation.attachments.length)&&(o.annotation==null?null:o.annotation.attachment)),m(),p("ngIf",o.annotation==null||o.annotation.attachments==null?null:o.annotation.attachments.length),m(),p("ngIf",o.showSubtitles),m(),p("ngIf",o.showControls),m(),p("ngIf",o.transcriptionVisible))},dependencies:[z,G,$,W],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#fff!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-video-player[_ngcontent-%COMP%]{position:relative!important;display:flex!important;justify-content:center!important;align-items:center!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;background-color:#d3d3d3!important}.s-video-player[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important;height:100%!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important}.controls-wrap[_ngcontent-%COMP%]{position:absolute!important;bottom:0!important;display:flex!important;justify-content:space-between!important;align-items:center!important;width:80%!important;padding:1em!important;font-style:normal!important;font-weight:400!important;font-size:1em!important;line-height:1em!important;color:#fff!important}.controls[_ngcontent-%COMP%]{display:flex!important;justify-content:center!important;align-items:center!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.line[_ngcontent-%COMP%]{position:absolute!important;bottom:100%!important;width:90%!important;display:flex!important;align-items:center!important}.line[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%!important}.s-video-subtitles-wrap[_ngcontent-%COMP%]{position:absolute;width:calc((25rem + 0px) * var(--velt-base-rem-unit))!important;max-width:90%!important;bottom:10%!important;left:50%!important;transform:translate(-50%)!important;transition:bottom .3s!important}.s-video-subtitles-wrap[_ngcontent-%COMP%] .subtitles[_ngcontent-%COMP%]{background:#141416!important;border-radius:calc((.6rem + 0px) * var(--velt-base-rem-unit))!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;text-align:center!important}.s-video-subtitles-wrap.hide[_ngcontent-%COMP%]{display:none!important}svg[_ngcontent-%COMP%]{cursor:pointer!important}.s-video-player[_ngcontent-%COMP%]:hover .s-video-subtitles-wrap[_ngcontent-%COMP%]{bottom:calc(10% + 80px)!important}.s-video-player[_ngcontent-%COMP%]:hover .s-video-controls-wrap[_ngcontent-%COMP%]{opacity:1!important}.s-video-controls-wrap[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;position:absolute!important;z-index:10!important;bottom:0!important;width:100%!important;border-bottom-left-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;border-bottom-right-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;overflow:hidden!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;opacity:0!important;transition:opacity .3s!important;background:#141416!important;background:linear-gradient(0deg,#141416,#37373700)!important;padding-top:calc((5rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-progress-bar[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%!important;accent-color:#625DF5!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-controls[_ngcontent-%COMP%]{display:flex!important;justify-content:space-between!important;align-items:center!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-controls[_ngcontent-%COMP%] .s-video-controls-left[_ngcontent-%COMP%]{display:flex!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;align-items:center!important}.s-video-controls-wrap[_ngcontent-%COMP%] .s-video-controls[_ngcontent-%COMP%] .s-video-controls-right[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-player-container[_ngcontent-%COMP%]{width:100%!important;height:100%!important;box-sizing:border-box!important;display:flex!important;gap:2rem!important}.s-video-player-container[_ngcontent-%COMP%] .s-video-player[_ngcontent-%COMP%]{flex:1 1 100%!important;height:100%!important;background-color:#141416!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important}.s-video-player-container[_ngcontent-%COMP%] .s-video-player[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%!important}.s-video-player-container[_ngcontent-%COMP%] .s-video-transcription[_ngcontent-%COMP%]{flex:0 0 auto!important;width:calc((25rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;height:100%!important;overflow:hidden!important}.s-video-subtitles-btn[_ngcontent-%COMP%], .s-video-transcription-btn[_ngcontent-%COMP%]{display:flex!important}.s-video-subtitles-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%], .s-video-transcription-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{cursor:not-allowed!important}.s-video-subtitles-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%], .s-video-transcription-btn.disabled[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#80808a!important}"],changeDetection:0});let n=r;return n})();var It=(()=>{let r=class r{transform(t){try{if(!t||t<0||!isFinite(t))return"00:00:00";let i=Math.floor(t/1e3),o=Math.floor(i/3600),s=Math.floor(i%3600/60),P=i%60,h=j=>isNaN(j)?"00":j.toString().padStart(2,"0"),V=h(o),x=h(s),K=h(P);return`${V}:${x}:${K}`}catch(i){return console.error("Error in hourMinSecTimeDisplay pipe:",i),null}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275pipe=k({name:"hourMinSecTimeDisplay",type:r,pure:!0});let n=r;return n})();export{W as a,Ot as b,It as c,J as d};
@@ -1,2 +1,2 @@
1
- import{f as B,j as Z}from"./chunk-HO27RBDE.js";import{$ as y,Ee as p,L as w,Pi as ne,Qe as te,Se as re,T as q,Uh as k,Va as Y,Wa as X,Xf as T,_ as H,_b as Q,a as _,aa as W,ae as d,b as C,ca as h,g as V,hg as O,i as v,ii as ie,k as N,ki as E,od as ee,qa as J,qh as j,r as $,ua as K,v as L}from"./chunk-YTAAOIBL.js";var P=class{_totalWeight=0;_averageItemSize;_defaultItemSize;constructor(i=50){this._defaultItemSize=i,this._averageItemSize=i}getAverageItemSize(){return this._averageItemSize}addSample(i,o){let e=this._totalWeight+i.end-i.start;if(e){let t=(o+this._averageItemSize*this._totalWeight)/e;t&&(this._averageItemSize=t,this._totalWeight=e)}}reset(){this._averageItemSize=this._defaultItemSize,this._totalWeight=0}},z=class{scrolledIndexChange=new v(()=>{});_viewport=null;_minBufferPx;_maxBufferPx;_averager;_lastScrollOffset;_lastRenderedContentSize;_lastRenderedContentOffset;_removalFailures=0;constructor(i,o,e=new P){this._minBufferPx=i,this._maxBufferPx=o,this._averager=e}attach(i){this._averager.reset(),this._viewport=i,this._renderContentForCurrentOffset()}detach(){this._viewport=null}onContentScrolled(){this._viewport&&this._updateRenderedContentAfterScroll()}onDataLengthChanged(){this._viewport&&(this._renderContentForCurrentOffset(),this._checkRenderedContentSize())}onContentRendered(){this._viewport&&this._checkRenderedContentSize()}onRenderedOffsetChanged(){this._viewport&&this._checkRenderedContentOffset()}scrollToIndex(){}updateBufferSize(i,o){if(o<i)throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");this._minBufferPx=i,this._maxBufferPx=o}_updateRenderedContentAfterScroll(){let i=this._viewport,o=i.measureScrollOffset(),e=o-this._lastScrollOffset,t=Math.abs(e),r=i.getRenderedRange(),s=0;if(e<0){let g=r.start*this._averager.getAverageItemSize()-this._lastRenderedContentOffset;s=Math.round(g*Math.max(0,Math.min(1,t/(o+t)))),e=e-s,t=Math.abs(e)}let a=this._lastScrollOffset-this._lastRenderedContentOffset,c=this._lastRenderedContentOffset+this._lastRenderedContentSize-(this._lastScrollOffset+i.getViewportSize()),u=t+this._minBufferPx-(e<0?a:c);if(u>0)if(t>=i.getViewportSize())this._renderContentForCurrentOffset();else{let f=Math.max(0,Math.ceil((u-this._minBufferPx+this._maxBufferPx)/this._averager.getAverageItemSize())),g=(e<0?c:a)-this._minBufferPx+t,b=Math.floor(g/this._averager.getAverageItemSize()/(this._removalFailures+1)),A=Math.min(r.end-r.start,Math.max(0,b)),l=this._expandRange(r,e<0?f:0,e>0?f:0);e<0?l.end=Math.max(l.start+1,l.end-A):l.start=Math.min(l.end-1,l.start+A);let S,G;if(e<0){let R=i.measureRangeSize({start:l.end,end:r.end});R<=g?(S=this._lastRenderedContentOffset+this._lastRenderedContentSize-R,this._removalFailures=0):(l.end=r.end,S=this._lastRenderedContentOffset+this._lastRenderedContentSize,this._removalFailures++),G="to-end"}else{let R=i.measureRangeSize({start:r.start,end:l.start});R<=g?(S=this._lastRenderedContentOffset+R,this._removalFailures=0):(l.start=r.start,S=this._lastRenderedContentOffset,this._removalFailures++),G="to-start"}i.setRenderedRange(l),i.setRenderedContentOffset(S+s,G)}else s&&i.setRenderedContentOffset(this._lastRenderedContentOffset+s);this._lastScrollOffset=o}_checkRenderedContentSize(){let i=this._viewport;this._lastRenderedContentSize=i.measureRenderedContentSize(),this._averager.addSample(i.getRenderedRange(),this._lastRenderedContentSize),this._updateTotalContentSize(this._lastRenderedContentSize)}_checkRenderedContentOffset(){let i=this._viewport;this._lastRenderedContentOffset=i.getOffsetToRenderedContentStart()}_renderContentForCurrentOffset(){let i=this._viewport,o=i.measureScrollOffset();this._lastScrollOffset=o,this._removalFailures=0;let e=this._averager.getAverageItemSize(),t=Math.min(i.getDataLength()-1,Math.floor(o/e)),r=Math.ceil(this._maxBufferPx/e),s=this._expandRange(this._getVisibleRangeForIndex(t),r,r);i.setRenderedRange(s),i.setRenderedContentOffset(e*s.start)}_getVisibleRangeForIndex(i){let o=this._viewport,e={start:i,end:i+Math.ceil(o.getViewportSize()/this._averager.getAverageItemSize())},t=e.end-o.getDataLength();return t>0&&(e.start=Math.max(0,e.start-t)),e}_expandRange(i,o,e){let t=this._viewport,r=Math.max(0,i.start-o),s=Math.min(t.getDataLength(),i.end+e);return{start:r,end:s}}_updateTotalContentSize(i){let o=this._viewport,e=o.getRenderedRange(),t=i+(o.getDataLength()-(e.end-e.start))*this._averager.getAverageItemSize();o.setTotalContentSize(t)}};function le(n){return n._scrollStrategy}var Ae=(()=>{class n{get minBufferPx(){return this._minBufferPx}set minBufferPx(o){this._minBufferPx=B(o)}_minBufferPx=100;get maxBufferPx(){return this._maxBufferPx}set maxBufferPx(o){this._maxBufferPx=B(o)}_maxBufferPx=200;_scrollStrategy=new z(this.minBufferPx,this.maxBufferPx);ngOnChanges(){this._scrollStrategy.updateBufferSize(this.minBufferPx,this.maxBufferPx)}static \u0275fac=function(e){return new(e||n)};static \u0275dir=X({type:n,selectors:[["cdk-virtual-scroll-viewport","autosize",""]],inputs:{minBufferPx:"minBufferPx",maxBufferPx:"maxBufferPx"},features:[Q([{provide:Z,useFactory:le,deps:[H(()=>n)]}]),K]})}return n})(),Re=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Y({type:n});static \u0275inj=W({})}return n})();var I=(()=>{let i=class i{constructor(e){this.loggingService=e,this.enabledSignal=J(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0;try{this.enabled$=ee(this.enabledSignal).pipe(w())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new v}}enable(e){try{this.onTargetEditStart=e?.onTargetEditStart??null,this.onTargetEditCommit=e?.onTargetEditCommit??null,this.autoCommit=e?.autoCommit!==!1,this.enabledSignal.set(!0)}catch(t){this.loggingService.catch("Error in SuggestionModeService enable: ",t)}}disable(){try{this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0,this.enabledSignal.set(!1)}catch(e){this.loggingService.catch("Error in SuggestionModeService disable: ",e)}}isEnabled(){try{return this.enabledSignal()}catch(e){return this.loggingService.catch("Error in SuggestionModeService isEnabled: ",e),!1}}getOnTargetEditStart(){try{return this.onTargetEditStart}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditStart: ",e),null}}getOnTargetEditCommit(){try{return this.onTargetEditCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditCommit: ",e),null}}isAutoCommitEnabled(){try{return this.autoCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService isAutoCommitEnabled: ",e),!1}}};i.\u0275fac=function(t){return new(t||i)(h(E))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var D=(()=>{let i=class i{constructor(e){this.loggingService=e,this.snapshots=new Map}captureFromGetter(e,t){try{if(!e||typeof t!="function")return!1;let r;try{r=t()}catch(s){return T()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,s),!1}return this.captureValue(e,r)}catch(r){return this.loggingService.catch("Error in SuggestionSnapshotService captureFromGetter: ",r),!1}}captureValue(e,t){try{if(!e)return!1;let r;try{r=structuredClone(t)}catch(s){return T()&&this.loggingService.catch(`[velt] Suggestion target "${e}" snapshot failed (value not cloneable). Cause: structuredClone rejected the value (cyclic refs, DOM nodes, or functions are common culprits). Fix: ensure your getter returns plain JSON-serializable data.`,s),!1}return this.snapshots.set(e,r),!0}catch(r){return this.loggingService.catch("Error in SuggestionSnapshotService captureValue: ",r),!1}}getSnapshot(e){try{return this.snapshots.has(e)?this.snapshots.get(e):void 0}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService getSnapshot: ",t);return}}hasSnapshot(e){try{return this.snapshots.has(e)}catch(t){return this.loggingService.catch("Error in SuggestionSnapshotService hasSnapshot: ",t),!1}}clearSnapshot(e){try{this.snapshots.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService clearSnapshot: ",t)}}clearAllSnapshots(){try{this.snapshots.clear()}catch(e){this.loggingService.catch("Error in SuggestionSnapshotService clearAllSnapshots: ",e)}}};i.\u0275fac=function(t){return new(t||i)(h(E))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var ae=(()=>{let i=class i{constructor(e,t,r){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.registry=new Map,this.warnedUnstableIds=new Set,this.actionsService=null}registerTarget(e,t){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let r=this.registry.get(e)??{};r.getter=t,this.registry.set(e,r)}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",r)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getGetter(e){try{return this.registry.get(e)?.getter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getGetter: ",t);return}}setActionsService(e){try{this.actionsService=e}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService setActionsService: ",t)}}getNode(e){try{if(!e)return;let t=this.registry.get(e)?.node;if(t&&t.isConnected)return t;let r=this.queryAll(e);if(r.length===0)return;r.length>1&&this.warnDuplicateId(e,r.length);let s=r[0],a=this.registry.get(e)??{};return a.node=s,this.registry.set(e,a),s}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}getFallbackValue(e){try{let t=this.getNode(e);if(!t)return{hasValue:!1};let r=t.textContent??"";return r.length>0?{hasValue:!0,value:r}:{hasValue:!1}}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getFallbackValue: ",t),{hasValue:!1}}}isRegistered(e){try{return this.registry.get(e)?.getter?!0:!!this.getNode(e)}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isRegistered: ",t),!1}}countTaggedElements(e){try{let t=e??this.rootEl??document.body;return t?t.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).length:0}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService countTaggedElements: ",t),0}}startObserving(e=document.body){try{if(this.observer)return;this.rootEl=e,this.scanAndRefresh(e),this.observer=new MutationObserver(()=>{try{this.scanAndRefresh(this.rootEl??document.body)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService observer callback: ",t)}}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[p.ATTRIBUTES.VELT_SUGGESTION_TARGET]}),this.installDelegatedListeners(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService startObserving: ",t)}}stopObserving(){try{this.observer?.disconnect(),this.observer=void 0,this.rootEl&&this.removeDelegatedListeners(this.rootEl),this.rootEl=void 0}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService stopObserving: ",e)}}clear(){try{this.registry.clear(),this.warnedUnstableIds.clear()}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService clear: ",e)}}installDelegatedListeners(e){try{this.boundFocusIn=t=>this.handleFocusIn(t),this.boundChange=t=>this.handleChange(t),this.boundFocusOut=t=>this.handleFocusOut(t),e.addEventListener("focusin",this.boundFocusIn,!0),e.addEventListener("change",this.boundChange,!0),e.addEventListener("focusout",this.boundFocusOut,!0)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService installDelegatedListeners: ",t)}}removeDelegatedListeners(e){try{this.boundFocusIn&&e.removeEventListener("focusin",this.boundFocusIn,!0),this.boundChange&&e.removeEventListener("change",this.boundChange,!0),this.boundFocusOut&&e.removeEventListener("focusout",this.boundFocusOut,!0),this.boundFocusIn=void 0,this.boundChange=void 0,this.boundFocusOut=void 0}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService removeDelegatedListeners: ",t)}}handleFocusIn(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t)return;this.captureSnapshotForTarget(t.targetId,t.element);let r=this.snapshotService.getSnapshot(t.targetId),s={targetId:t.targetId,oldValue:r,newValue:r,element:t.element},a=this.modeService.getOnTargetEditStart();if(a)try{a(s)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(d.TARGET_EDIT_START,{details:s,timestamp:Date.now()})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusIn: ",t)}}handleChange(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||!this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleChange: ",t)}}handleFocusOut(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusOut: ",t)}}isAtomicCommitTarget(e){try{if(e instanceof HTMLSelectElement)return!0;if(e instanceof HTMLInputElement){let t=(e.type||"").toLowerCase();return t==="checkbox"||t==="radio"}return!1}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isAtomicCommitTarget: ",t),!1}}processCommit(e,t){try{let r=this.snapshotService.getSnapshot(e),s=this.readElementValue(e,t);if(O(r,s))return;let a={targetId:e,oldValue:r,newValue:s,element:t},c=this.modeService.getOnTargetEditCommit(),u=null;if(c){let g=null;try{g=c(a)}catch(b){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",b)}g&&(u=this.invokeAutoCommit({targetId:e,newValue:s,summary:g.summary,summaryHtml:g.summaryHtml,metadata:g.metadata}))}else this.modeService.isAutoCommitEnabled()&&(u=this.invokeAutoCommit({targetId:e,newValue:s}));let f=g=>V(this,null,function*(){return u&&(yield u)?null:this.invokeAutoCommit({targetId:e,newValue:s,summary:g?.summary,summaryHtml:g?.summaryHtml,metadata:g?.metadata})});this.actionsService?.triggerAction(d.TARGET_EDIT_COMMIT,{details:a,commitSuggestion:f,timestamp:Date.now()})}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",r)}}invokeAutoCommit(e){try{return this.actionsService?this.actionsService.commitSuggestion(e).catch(t=>(T()&&this.loggingService.catch(`[velt] auto-commit for "${e.targetId}" rejected: `,t),null)):(T()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",t),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let r=this.registry.get(e);if(r?.getter){this.snapshotService.captureFromGetter(e,r.getter);return}let s=this.readElementValue(e,t);this.snapshotService.captureValue(e,s)}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService captureSnapshotForTarget: ",r)}}readElementValue(e,t){try{let r=this.registry.get(e);if(r?.getter)try{return r.getter()}catch{return}if(t instanceof HTMLInputElement){let s=(t.type||"").toLowerCase();return s==="checkbox"||s==="radio"?t.checked:s==="number"||s==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}return t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:(t instanceof HTMLElement&&t.isContentEditable,t.textContent??"")}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService readElementValue: ",r);return}}findTaggedAncestor(e){try{if(!(e instanceof Element))return null;let t=e.closest(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let r=t.getAttribute(p.ATTRIBUTES.VELT_SUGGESTION_TARGET);return r?{element:t,targetId:r}:null}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService findTaggedAncestor: ",t),null}}queryAll(e){try{let t=window.CSS?.escape?window.CSS.escape(e):e.replace(/"/g,'\\"');return Array.from(document.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(r=>{let s=r.getAttribute(p.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!s)return;let a=this.registry.get(s)??{};(!a.node||!a.node.isConnected)&&(a.node=r,this.registry.set(s,a))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!T()||this.warnedUnstableIds.has(e))return;let t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e),r=/\d{10,}/.test(e);(t||r)&&(this.warnedUnstableIds.add(e),this.loggingService.catch(`[velt] Target id "${e}" appears unstable. Cause: contains a UUID or timestamp shape \u2014 these typically change across re-renders. Fix: use a stable customer-owned id (the same one you use in your state). Docs: velt.dev/docs/suggestions/target-ids`,new Error("UNSTABLE_TARGET_ID")))}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService warnIfUnstableId: ",t)}}warnDuplicateId(e,t){try{if(!T())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${p.ATTRIBUTES.VELT_SUGGESTION_TARGET} appears on multiple DOM nodes. Fix: ensure each suggestable element has a unique id. Velt is using the first registered element. Docs: velt.dev/docs/suggestions/target-ids`,new Error("DUPLICATE_TARGET_ID"))}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService warnDuplicateId: ",r)}}};i.\u0275fac=function(t){return new(t||i)(h(E),h(I),h(D))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var Ve=(()=>{let i=class i{constructor(e,t,r,s,a,c){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.targetRegistry=s,this.serviceBook=a,this.commonDbService=c,this.actionSubjects=new Map,this.observingActive=!1,this.commentService=null;try{this.targetRegistry.setActionsService(this),this.serviceBook.observe(k).subscribe(u=>{this.commentService=u})}catch(u){this.loggingService.catch("Error in SuggestionActionsService constructor: ",u)}}enableSuggestionMode(e){try{this.modeService.enable(e),this.startObservingIfNeeded(),this.warnIfNoTaggedElements()}catch(t){this.loggingService.catch("Error in SuggestionActionsService enableSuggestionMode: ",t)}}disableSuggestionMode(){try{this.modeService.disable(),this.stopObservingIfNeeded()}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableSuggestionMode: ",e)}}isSuggestionModeEnabled(){try{return this.modeService.isEnabled()}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled: ",e),!1}}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new v}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter)}catch(t){this.loggingService.catch("Error in SuggestionActionsService registerTarget: ",t)}}unregisterTarget(e){try{this.targetRegistry.unregisterTarget(e)}catch(t){this.loggingService.catch("Error in SuggestionActionsService unregisterTarget: ",t)}}startSuggestion(e){try{let t=this.targetRegistry.getGetter(e);if(t){this.snapshotService.captureFromGetter(e,t);return}let r=this.targetRegistry.getFallbackValue(e);r.hasValue?this.snapshotService.captureValue(e,r.value):this.loggingService.warn(`[velt] startSuggestion: target "${e}" not registered. Cause: no getter via registerTarget() and no textContent fallback. Fix: tag the element with data-velt-suggestion-target and register a getter via registerTarget(). Docs: velt.dev/docs/suggestions/targets`)}catch(t){this.loggingService.catch("Error in SuggestionActionsService startSuggestion: ",t)}}commitSuggestion(e){return new Promise((t,r)=>{try{if(!e?.targetId){r(new Error("INVALID_CONFIG"));return}if(!this.modeService.isEnabled()){this.loggingService.warn("[velt] commitSuggestion called while suggestion mode is disabled. Cause: enableSuggestionMode() has not been called (or disableSuggestionMode() was called). Fix: call enableSuggestionMode() before commit, or branch on isSuggestionModeEnabled() in your onSave handler. Docs: velt.dev/docs/suggestions/mode"),r(new Error("MODE_NOT_SUGGESTING"));return}if(!this.targetRegistry.isRegistered(e.targetId)){this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" not registered. Cause: no element has data-velt-suggestion-target="${e.targetId}" and no registerTarget() call provided a getter. Fix: tag the element or register a getter at app boot. Docs: velt.dev/docs/suggestions/targets`),r(new Error("TARGET_NOT_REGISTERED"));return}if(!this.snapshotService.hasSnapshot(e.targetId)){let l=this.targetRegistry.getGetter(e.targetId);if(l){if(!this.snapshotService.captureFromGetter(e.targetId,l)){r(new Error("SNAPSHOT_FAILED"));return}}else{let S=this.targetRegistry.getFallbackValue(e.targetId);if(S.hasValue)this.snapshotService.captureValue(e.targetId,S.value);else{this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" requires registerTarget() for complex values. Cause: complex objects need a getter so the SDK can deep-clone the snapshot. Fix: call velt.getSuggestionElement().registerTarget("${e.targetId}", () => yourState.${e.targetId}) at app boot. Docs: velt.dev/docs/suggestions/getter`),r(new Error("NO_GETTER_FOR_COMPLEX"));return}}}let u=this.snapshotService.getSnapshot(e.targetId),f=e.newValue;if(O(u,f)){this.loggingService.warn(`[velt] commitSuggestion: no change detected for target "${e.targetId}". Cause: oldValue and newValue are deeply equal. Fix: only call commitSuggestion when the customer actually changed the value. Docs: velt.dev/docs/suggestions/edge-cases`),r(new Error("NO_CHANGE_TO_SUGGEST"));return}let g=new te;g.type="suggestion",g.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:u,newValue:f,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},g.metadata=e.metadata??{};let b=fe(e.summary,e.summaryHtml,u,f),A=new re;if(A.commentText=b.commentText,A.commentHtml=b.commentHtml,g.comments=[A],!this.commentService){this.loggingService.catch('SuggestionActionsService.commitSuggestion: comment chunk not loaded \u2014 call Snippyly.preloadComment() first or include "comment" in featureAllowList.',new Error("comment chunk unavailable")),r(new Error("comment chunk not loaded"));return}this.commentService.addComment(void 0,void 0,void 0,void 0,!1,[],void 0,void 0,void 0,void 0,void 0,void 0,void 0,l=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(d.SUGGESTION_CREATED,l.annotation),t({id:l.annotation.annotationId})}catch(S){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",S),r(S)}},void 0,void 0,g,void 0,void 0,!0,void 0,void 0,"internal",void 0)}catch(s){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",s),r(s)}})}getSuggestions(e){try{let t=this.commentService?.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],r=[];for(let s of t){if(!s.suggestion)continue;let a=this.projectAnnotationToSuggestion(s);a&&this.matchesFilter(a,e)&&r.push(a)}return r}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.serviceBook.observe(k).pipe(q(t=>t?t.getCommentAnnotationsOnCurrentOrganizationAndDocument$():$([]))).pipe(L(t=>{let r=[];for(let s of t??[]){if(!s.suggestion)continue;let a=this.projectAnnotationToSuggestion(s);a&&this.matchesFilter(a,e)&&r.push(a)}return r}),w(j))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new v}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((r,s)=>(s.createdAt??0)-(r.createdAt??0))[0]}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion: ",t),null}}getPendingSuggestion$(e){try{return e?this.getSuggestions$({targetId:e,status:"pending"}).pipe(L(t=>t.length===0?null:t.sort((r,s)=>(s.createdAt??0)-(r.createdAt??0))[0]),w(j)):new v}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new v}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new N),this.actionSubjects.get(e)?.next(t)}catch(r){this.loggingService.catch("Error in SuggestionActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new N),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in SuggestionActionsService onAction: ",t),$(null)}}projectAndTrigger(e,t){try{if(!t||!t.suggestion)return;let r=this.projectAnnotationToSuggestion(t);if(!r)return;let s=this.timestamp;switch(e){case d.SUGGESTION_CREATED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_CREATED,a);break}case d.SUGGESTION_APPROVED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_APPROVED,a);break}case d.SUGGESTION_REJECTED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_REJECTED,a);break}case d.SUGGESTION_STALE:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_STALE,a);break}}}catch(r){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",r)}}projectAnnotationToSuggestion(e){try{let t=e.suggestion;if(!t)return;let r={annotationId:e.annotationId,targetId:t.targetId,targetType:t.targetType,oldValue:t.oldValue,newValue:t.newValue,summary:t.summary,metadata:e.metadata??{},driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return C(_({},r),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"accepted":case"apply_failed":return C(_({},r),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"rejected":return C(_({},r),{status:"rejected",rejectReason:t.rejectReason??null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return C(_({},r),{status:"stale",rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt});default:return}}catch(t){this.loggingService.catch("Error in SuggestionActionsService projectAnnotationToSuggestion: ",t);return}}startObservingIfNeeded(){try{if(this.observingActive)return;this.observingActive=!0,this.targetRegistry.startObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService startObservingIfNeeded: ",e)}}stopObservingIfNeeded(){try{if(!this.observingActive)return;this.observingActive=!1,this.targetRegistry.stopObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService stopObservingIfNeeded: ",e)}}warnIfNoTaggedElements(){try{this.targetRegistry.countTaggedElements()===0&&this.loggingService.warn('[velt] No suggestable elements found on this page. Cause: no DOM elements have a data-velt-suggestion-target attribute. Fix: tag at least one element with data-velt-suggestion-target="your.id" before enabling suggestion mode. Docs: velt.dev/docs/suggestions/getting-started')}catch(e){this.loggingService.catch("Error in SuggestionActionsService warnIfNoTaggedElements: ",e)}}get timestamp(){return this.commonDbService.getServerTimestamp()}matchesFilter(e,t){try{return t?!(t.targetId&&e.targetId!==t.targetId||t.status&&!(Array.isArray(t.status)?t.status:[t.status]).includes(e.status)):!0}catch(r){return this.loggingService.catch("Error in SuggestionActionsService matchesFilter: ",r),!1}}};i.\u0275fac=function(t){return new(t||i)(h(E),h(I),h(D),h(ae),h(ie),h(ne))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();function ge(n){try{return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return""}}function m(n){try{if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}catch{return""}}function ce(n){try{if(n===null||typeof n!="object"||Array.isArray(n))return!1;let i=Object.getPrototypeOf(n);return i===Object.prototype||i===null}catch{return!1}}function ue(n,i){try{let o=n==null,e=i==null;if(o&&!e)return[{op:"add",newText:m(i)}];if(!o&&e)return[{op:"remove",oldText:m(n)}];if(ce(n)&&ce(i)){let t=n,r=i,s=[...Object.keys(t),...Object.keys(r).filter(c=>!(c in t))],a=[];for(let c of s){let u=c in t,f=c in r;u&&f?O(t[c],r[c])||a.push({op:"replace",oldText:`${c}: ${m(t[c])}`,newText:`${c}: ${m(r[c])}`}):u?a.push({op:"remove",oldText:`${c}: ${m(t[c])}`}):a.push({op:"add",newText:`${c}: ${m(r[c])}`})}if(a.length>0)return a}return[{op:"replace",oldText:m(n),newText:m(i)}]}catch{return[{op:"replace",oldText:m(n),newText:m(i)}]}}function de(n,i){try{return ue(n,i).map(o=>o.op==="add"?`Add: "${o.newText??""}"`:o.op==="remove"?`Remove: "${o.oldText??""}"`:`Replace: "${o.oldText??""}" with "${o.newText??""}"`).join(`
1
+ import{f as B,j as Z}from"./chunk-UQI5JFMO.js";import{$ as y,Ee as p,L as w,Pi as ne,Qe as te,Se as re,T as q,Uh as k,Va as Y,Wa as X,Xf as T,_ as H,_b as Q,a as _,aa as W,ae as d,b as C,ca as h,g as V,hg as O,i as v,ii as ie,k as N,ki as E,od as ee,qa as J,qh as j,r as $,ua as K,v as L}from"./chunk-4EV2AXDK.js";var P=class{_totalWeight=0;_averageItemSize;_defaultItemSize;constructor(i=50){this._defaultItemSize=i,this._averageItemSize=i}getAverageItemSize(){return this._averageItemSize}addSample(i,o){let e=this._totalWeight+i.end-i.start;if(e){let t=(o+this._averageItemSize*this._totalWeight)/e;t&&(this._averageItemSize=t,this._totalWeight=e)}}reset(){this._averageItemSize=this._defaultItemSize,this._totalWeight=0}},z=class{scrolledIndexChange=new v(()=>{});_viewport=null;_minBufferPx;_maxBufferPx;_averager;_lastScrollOffset;_lastRenderedContentSize;_lastRenderedContentOffset;_removalFailures=0;constructor(i,o,e=new P){this._minBufferPx=i,this._maxBufferPx=o,this._averager=e}attach(i){this._averager.reset(),this._viewport=i,this._renderContentForCurrentOffset()}detach(){this._viewport=null}onContentScrolled(){this._viewport&&this._updateRenderedContentAfterScroll()}onDataLengthChanged(){this._viewport&&(this._renderContentForCurrentOffset(),this._checkRenderedContentSize())}onContentRendered(){this._viewport&&this._checkRenderedContentSize()}onRenderedOffsetChanged(){this._viewport&&this._checkRenderedContentOffset()}scrollToIndex(){}updateBufferSize(i,o){if(o<i)throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");this._minBufferPx=i,this._maxBufferPx=o}_updateRenderedContentAfterScroll(){let i=this._viewport,o=i.measureScrollOffset(),e=o-this._lastScrollOffset,t=Math.abs(e),r=i.getRenderedRange(),s=0;if(e<0){let g=r.start*this._averager.getAverageItemSize()-this._lastRenderedContentOffset;s=Math.round(g*Math.max(0,Math.min(1,t/(o+t)))),e=e-s,t=Math.abs(e)}let a=this._lastScrollOffset-this._lastRenderedContentOffset,c=this._lastRenderedContentOffset+this._lastRenderedContentSize-(this._lastScrollOffset+i.getViewportSize()),u=t+this._minBufferPx-(e<0?a:c);if(u>0)if(t>=i.getViewportSize())this._renderContentForCurrentOffset();else{let f=Math.max(0,Math.ceil((u-this._minBufferPx+this._maxBufferPx)/this._averager.getAverageItemSize())),g=(e<0?c:a)-this._minBufferPx+t,b=Math.floor(g/this._averager.getAverageItemSize()/(this._removalFailures+1)),A=Math.min(r.end-r.start,Math.max(0,b)),l=this._expandRange(r,e<0?f:0,e>0?f:0);e<0?l.end=Math.max(l.start+1,l.end-A):l.start=Math.min(l.end-1,l.start+A);let S,G;if(e<0){let R=i.measureRangeSize({start:l.end,end:r.end});R<=g?(S=this._lastRenderedContentOffset+this._lastRenderedContentSize-R,this._removalFailures=0):(l.end=r.end,S=this._lastRenderedContentOffset+this._lastRenderedContentSize,this._removalFailures++),G="to-end"}else{let R=i.measureRangeSize({start:r.start,end:l.start});R<=g?(S=this._lastRenderedContentOffset+R,this._removalFailures=0):(l.start=r.start,S=this._lastRenderedContentOffset,this._removalFailures++),G="to-start"}i.setRenderedRange(l),i.setRenderedContentOffset(S+s,G)}else s&&i.setRenderedContentOffset(this._lastRenderedContentOffset+s);this._lastScrollOffset=o}_checkRenderedContentSize(){let i=this._viewport;this._lastRenderedContentSize=i.measureRenderedContentSize(),this._averager.addSample(i.getRenderedRange(),this._lastRenderedContentSize),this._updateTotalContentSize(this._lastRenderedContentSize)}_checkRenderedContentOffset(){let i=this._viewport;this._lastRenderedContentOffset=i.getOffsetToRenderedContentStart()}_renderContentForCurrentOffset(){let i=this._viewport,o=i.measureScrollOffset();this._lastScrollOffset=o,this._removalFailures=0;let e=this._averager.getAverageItemSize(),t=Math.min(i.getDataLength()-1,Math.floor(o/e)),r=Math.ceil(this._maxBufferPx/e),s=this._expandRange(this._getVisibleRangeForIndex(t),r,r);i.setRenderedRange(s),i.setRenderedContentOffset(e*s.start)}_getVisibleRangeForIndex(i){let o=this._viewport,e={start:i,end:i+Math.ceil(o.getViewportSize()/this._averager.getAverageItemSize())},t=e.end-o.getDataLength();return t>0&&(e.start=Math.max(0,e.start-t)),e}_expandRange(i,o,e){let t=this._viewport,r=Math.max(0,i.start-o),s=Math.min(t.getDataLength(),i.end+e);return{start:r,end:s}}_updateTotalContentSize(i){let o=this._viewport,e=o.getRenderedRange(),t=i+(o.getDataLength()-(e.end-e.start))*this._averager.getAverageItemSize();o.setTotalContentSize(t)}};function le(n){return n._scrollStrategy}var Ae=(()=>{class n{get minBufferPx(){return this._minBufferPx}set minBufferPx(o){this._minBufferPx=B(o)}_minBufferPx=100;get maxBufferPx(){return this._maxBufferPx}set maxBufferPx(o){this._maxBufferPx=B(o)}_maxBufferPx=200;_scrollStrategy=new z(this.minBufferPx,this.maxBufferPx);ngOnChanges(){this._scrollStrategy.updateBufferSize(this.minBufferPx,this.maxBufferPx)}static \u0275fac=function(e){return new(e||n)};static \u0275dir=X({type:n,selectors:[["cdk-virtual-scroll-viewport","autosize",""]],inputs:{minBufferPx:"minBufferPx",maxBufferPx:"maxBufferPx"},features:[Q([{provide:Z,useFactory:le,deps:[H(()=>n)]}]),K]})}return n})(),Re=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Y({type:n});static \u0275inj=W({})}return n})();var I=(()=>{let i=class i{constructor(e){this.loggingService=e,this.enabledSignal=J(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0;try{this.enabled$=ee(this.enabledSignal).pipe(w())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new v}}enable(e){try{this.onTargetEditStart=e?.onTargetEditStart??null,this.onTargetEditCommit=e?.onTargetEditCommit??null,this.autoCommit=e?.autoCommit!==!1,this.enabledSignal.set(!0)}catch(t){this.loggingService.catch("Error in SuggestionModeService enable: ",t)}}disable(){try{this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0,this.enabledSignal.set(!1)}catch(e){this.loggingService.catch("Error in SuggestionModeService disable: ",e)}}isEnabled(){try{return this.enabledSignal()}catch(e){return this.loggingService.catch("Error in SuggestionModeService isEnabled: ",e),!1}}getOnTargetEditStart(){try{return this.onTargetEditStart}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditStart: ",e),null}}getOnTargetEditCommit(){try{return this.onTargetEditCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditCommit: ",e),null}}isAutoCommitEnabled(){try{return this.autoCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService isAutoCommitEnabled: ",e),!1}}};i.\u0275fac=function(t){return new(t||i)(h(E))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var D=(()=>{let i=class i{constructor(e){this.loggingService=e,this.snapshots=new Map}captureFromGetter(e,t){try{if(!e||typeof t!="function")return!1;let r;try{r=t()}catch(s){return T()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,s),!1}return this.captureValue(e,r)}catch(r){return this.loggingService.catch("Error in SuggestionSnapshotService captureFromGetter: ",r),!1}}captureValue(e,t){try{if(!e)return!1;let r;try{r=structuredClone(t)}catch(s){return T()&&this.loggingService.catch(`[velt] Suggestion target "${e}" snapshot failed (value not cloneable). Cause: structuredClone rejected the value (cyclic refs, DOM nodes, or functions are common culprits). Fix: ensure your getter returns plain JSON-serializable data.`,s),!1}return this.snapshots.set(e,r),!0}catch(r){return this.loggingService.catch("Error in SuggestionSnapshotService captureValue: ",r),!1}}getSnapshot(e){try{return this.snapshots.has(e)?this.snapshots.get(e):void 0}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService getSnapshot: ",t);return}}hasSnapshot(e){try{return this.snapshots.has(e)}catch(t){return this.loggingService.catch("Error in SuggestionSnapshotService hasSnapshot: ",t),!1}}clearSnapshot(e){try{this.snapshots.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService clearSnapshot: ",t)}}clearAllSnapshots(){try{this.snapshots.clear()}catch(e){this.loggingService.catch("Error in SuggestionSnapshotService clearAllSnapshots: ",e)}}};i.\u0275fac=function(t){return new(t||i)(h(E))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var ae=(()=>{let i=class i{constructor(e,t,r){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.registry=new Map,this.warnedUnstableIds=new Set,this.actionsService=null}registerTarget(e,t){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let r=this.registry.get(e)??{};r.getter=t,this.registry.set(e,r)}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",r)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getGetter(e){try{return this.registry.get(e)?.getter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getGetter: ",t);return}}setActionsService(e){try{this.actionsService=e}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService setActionsService: ",t)}}getNode(e){try{if(!e)return;let t=this.registry.get(e)?.node;if(t&&t.isConnected)return t;let r=this.queryAll(e);if(r.length===0)return;r.length>1&&this.warnDuplicateId(e,r.length);let s=r[0],a=this.registry.get(e)??{};return a.node=s,this.registry.set(e,a),s}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}getFallbackValue(e){try{let t=this.getNode(e);if(!t)return{hasValue:!1};let r=t.textContent??"";return r.length>0?{hasValue:!0,value:r}:{hasValue:!1}}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getFallbackValue: ",t),{hasValue:!1}}}isRegistered(e){try{return this.registry.get(e)?.getter?!0:!!this.getNode(e)}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isRegistered: ",t),!1}}countTaggedElements(e){try{let t=e??this.rootEl??document.body;return t?t.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).length:0}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService countTaggedElements: ",t),0}}startObserving(e=document.body){try{if(this.observer)return;this.rootEl=e,this.scanAndRefresh(e),this.observer=new MutationObserver(()=>{try{this.scanAndRefresh(this.rootEl??document.body)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService observer callback: ",t)}}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[p.ATTRIBUTES.VELT_SUGGESTION_TARGET]}),this.installDelegatedListeners(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService startObserving: ",t)}}stopObserving(){try{this.observer?.disconnect(),this.observer=void 0,this.rootEl&&this.removeDelegatedListeners(this.rootEl),this.rootEl=void 0}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService stopObserving: ",e)}}clear(){try{this.registry.clear(),this.warnedUnstableIds.clear()}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService clear: ",e)}}installDelegatedListeners(e){try{this.boundFocusIn=t=>this.handleFocusIn(t),this.boundChange=t=>this.handleChange(t),this.boundFocusOut=t=>this.handleFocusOut(t),e.addEventListener("focusin",this.boundFocusIn,!0),e.addEventListener("change",this.boundChange,!0),e.addEventListener("focusout",this.boundFocusOut,!0)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService installDelegatedListeners: ",t)}}removeDelegatedListeners(e){try{this.boundFocusIn&&e.removeEventListener("focusin",this.boundFocusIn,!0),this.boundChange&&e.removeEventListener("change",this.boundChange,!0),this.boundFocusOut&&e.removeEventListener("focusout",this.boundFocusOut,!0),this.boundFocusIn=void 0,this.boundChange=void 0,this.boundFocusOut=void 0}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService removeDelegatedListeners: ",t)}}handleFocusIn(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t)return;this.captureSnapshotForTarget(t.targetId,t.element);let r=this.snapshotService.getSnapshot(t.targetId),s={targetId:t.targetId,oldValue:r,newValue:r,element:t.element},a=this.modeService.getOnTargetEditStart();if(a)try{a(s)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(d.TARGET_EDIT_START,{details:s,timestamp:Date.now()})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusIn: ",t)}}handleChange(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||!this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleChange: ",t)}}handleFocusOut(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusOut: ",t)}}isAtomicCommitTarget(e){try{if(e instanceof HTMLSelectElement)return!0;if(e instanceof HTMLInputElement){let t=(e.type||"").toLowerCase();return t==="checkbox"||t==="radio"}return!1}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isAtomicCommitTarget: ",t),!1}}processCommit(e,t){try{let r=this.snapshotService.getSnapshot(e),s=this.readElementValue(e,t);if(O(r,s))return;let a={targetId:e,oldValue:r,newValue:s,element:t},c=this.modeService.getOnTargetEditCommit(),u=null;if(c){let g=null;try{g=c(a)}catch(b){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",b)}g&&(u=this.invokeAutoCommit({targetId:e,newValue:s,summary:g.summary,summaryHtml:g.summaryHtml,metadata:g.metadata}))}else this.modeService.isAutoCommitEnabled()&&(u=this.invokeAutoCommit({targetId:e,newValue:s}));let f=g=>V(this,null,function*(){return u&&(yield u)?null:this.invokeAutoCommit({targetId:e,newValue:s,summary:g?.summary,summaryHtml:g?.summaryHtml,metadata:g?.metadata})});this.actionsService?.triggerAction(d.TARGET_EDIT_COMMIT,{details:a,commitSuggestion:f,timestamp:Date.now()})}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",r)}}invokeAutoCommit(e){try{return this.actionsService?this.actionsService.commitSuggestion(e).catch(t=>(T()&&this.loggingService.catch(`[velt] auto-commit for "${e.targetId}" rejected: `,t),null)):(T()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",t),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let r=this.registry.get(e);if(r?.getter){this.snapshotService.captureFromGetter(e,r.getter);return}let s=this.readElementValue(e,t);this.snapshotService.captureValue(e,s)}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService captureSnapshotForTarget: ",r)}}readElementValue(e,t){try{let r=this.registry.get(e);if(r?.getter)try{return r.getter()}catch{return}if(t instanceof HTMLInputElement){let s=(t.type||"").toLowerCase();return s==="checkbox"||s==="radio"?t.checked:s==="number"||s==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}return t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:(t instanceof HTMLElement&&t.isContentEditable,t.textContent??"")}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService readElementValue: ",r);return}}findTaggedAncestor(e){try{if(!(e instanceof Element))return null;let t=e.closest(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let r=t.getAttribute(p.ATTRIBUTES.VELT_SUGGESTION_TARGET);return r?{element:t,targetId:r}:null}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService findTaggedAncestor: ",t),null}}queryAll(e){try{let t=window.CSS?.escape?window.CSS.escape(e):e.replace(/"/g,'\\"');return Array.from(document.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(r=>{let s=r.getAttribute(p.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!s)return;let a=this.registry.get(s)??{};(!a.node||!a.node.isConnected)&&(a.node=r,this.registry.set(s,a))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!T()||this.warnedUnstableIds.has(e))return;let t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e),r=/\d{10,}/.test(e);(t||r)&&(this.warnedUnstableIds.add(e),this.loggingService.catch(`[velt] Target id "${e}" appears unstable. Cause: contains a UUID or timestamp shape \u2014 these typically change across re-renders. Fix: use a stable customer-owned id (the same one you use in your state). Docs: velt.dev/docs/suggestions/target-ids`,new Error("UNSTABLE_TARGET_ID")))}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService warnIfUnstableId: ",t)}}warnDuplicateId(e,t){try{if(!T())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${p.ATTRIBUTES.VELT_SUGGESTION_TARGET} appears on multiple DOM nodes. Fix: ensure each suggestable element has a unique id. Velt is using the first registered element. Docs: velt.dev/docs/suggestions/target-ids`,new Error("DUPLICATE_TARGET_ID"))}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService warnDuplicateId: ",r)}}};i.\u0275fac=function(t){return new(t||i)(h(E),h(I),h(D))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var Ve=(()=>{let i=class i{constructor(e,t,r,s,a,c){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.targetRegistry=s,this.serviceBook=a,this.commonDbService=c,this.actionSubjects=new Map,this.observingActive=!1,this.commentService=null;try{this.targetRegistry.setActionsService(this),this.serviceBook.observe(k).subscribe(u=>{this.commentService=u})}catch(u){this.loggingService.catch("Error in SuggestionActionsService constructor: ",u)}}enableSuggestionMode(e){try{this.modeService.enable(e),this.startObservingIfNeeded(),this.warnIfNoTaggedElements()}catch(t){this.loggingService.catch("Error in SuggestionActionsService enableSuggestionMode: ",t)}}disableSuggestionMode(){try{this.modeService.disable(),this.stopObservingIfNeeded()}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableSuggestionMode: ",e)}}isSuggestionModeEnabled(){try{return this.modeService.isEnabled()}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled: ",e),!1}}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new v}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter)}catch(t){this.loggingService.catch("Error in SuggestionActionsService registerTarget: ",t)}}unregisterTarget(e){try{this.targetRegistry.unregisterTarget(e)}catch(t){this.loggingService.catch("Error in SuggestionActionsService unregisterTarget: ",t)}}startSuggestion(e){try{let t=this.targetRegistry.getGetter(e);if(t){this.snapshotService.captureFromGetter(e,t);return}let r=this.targetRegistry.getFallbackValue(e);r.hasValue?this.snapshotService.captureValue(e,r.value):this.loggingService.warn(`[velt] startSuggestion: target "${e}" not registered. Cause: no getter via registerTarget() and no textContent fallback. Fix: tag the element with data-velt-suggestion-target and register a getter via registerTarget(). Docs: velt.dev/docs/suggestions/targets`)}catch(t){this.loggingService.catch("Error in SuggestionActionsService startSuggestion: ",t)}}commitSuggestion(e){return new Promise((t,r)=>{try{if(!e?.targetId){r(new Error("INVALID_CONFIG"));return}if(!this.modeService.isEnabled()){this.loggingService.warn("[velt] commitSuggestion called while suggestion mode is disabled. Cause: enableSuggestionMode() has not been called (or disableSuggestionMode() was called). Fix: call enableSuggestionMode() before commit, or branch on isSuggestionModeEnabled() in your onSave handler. Docs: velt.dev/docs/suggestions/mode"),r(new Error("MODE_NOT_SUGGESTING"));return}if(!this.targetRegistry.isRegistered(e.targetId)){this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" not registered. Cause: no element has data-velt-suggestion-target="${e.targetId}" and no registerTarget() call provided a getter. Fix: tag the element or register a getter at app boot. Docs: velt.dev/docs/suggestions/targets`),r(new Error("TARGET_NOT_REGISTERED"));return}if(!this.snapshotService.hasSnapshot(e.targetId)){let l=this.targetRegistry.getGetter(e.targetId);if(l){if(!this.snapshotService.captureFromGetter(e.targetId,l)){r(new Error("SNAPSHOT_FAILED"));return}}else{let S=this.targetRegistry.getFallbackValue(e.targetId);if(S.hasValue)this.snapshotService.captureValue(e.targetId,S.value);else{this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" requires registerTarget() for complex values. Cause: complex objects need a getter so the SDK can deep-clone the snapshot. Fix: call velt.getSuggestionElement().registerTarget("${e.targetId}", () => yourState.${e.targetId}) at app boot. Docs: velt.dev/docs/suggestions/getter`),r(new Error("NO_GETTER_FOR_COMPLEX"));return}}}let u=this.snapshotService.getSnapshot(e.targetId),f=e.newValue;if(O(u,f)){this.loggingService.warn(`[velt] commitSuggestion: no change detected for target "${e.targetId}". Cause: oldValue and newValue are deeply equal. Fix: only call commitSuggestion when the customer actually changed the value. Docs: velt.dev/docs/suggestions/edge-cases`),r(new Error("NO_CHANGE_TO_SUGGEST"));return}let g=new te;g.type="suggestion",g.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:u,newValue:f,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},g.metadata=e.metadata??{};let b=fe(e.summary,e.summaryHtml,u,f),A=new re;if(A.commentText=b.commentText,A.commentHtml=b.commentHtml,g.comments=[A],!this.commentService){this.loggingService.catch('SuggestionActionsService.commitSuggestion: comment chunk not loaded \u2014 call Snippyly.preloadComment() first or include "comment" in featureAllowList.',new Error("comment chunk unavailable")),r(new Error("comment chunk not loaded"));return}this.commentService.addComment(void 0,void 0,void 0,void 0,!1,[],void 0,void 0,void 0,void 0,void 0,void 0,void 0,l=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(d.SUGGESTION_CREATED,l.annotation),t({id:l.annotation.annotationId})}catch(S){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",S),r(S)}},void 0,void 0,g,void 0,void 0,!0,void 0,void 0,"internal",void 0)}catch(s){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",s),r(s)}})}getSuggestions(e){try{let t=this.commentService?.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],r=[];for(let s of t){if(!s.suggestion)continue;let a=this.projectAnnotationToSuggestion(s);a&&this.matchesFilter(a,e)&&r.push(a)}return r}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.serviceBook.observe(k).pipe(q(t=>t?t.getCommentAnnotationsOnCurrentOrganizationAndDocument$():$([]))).pipe(L(t=>{let r=[];for(let s of t??[]){if(!s.suggestion)continue;let a=this.projectAnnotationToSuggestion(s);a&&this.matchesFilter(a,e)&&r.push(a)}return r}),w(j))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new v}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((r,s)=>(s.createdAt??0)-(r.createdAt??0))[0]}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion: ",t),null}}getPendingSuggestion$(e){try{return e?this.getSuggestions$({targetId:e,status:"pending"}).pipe(L(t=>t.length===0?null:t.sort((r,s)=>(s.createdAt??0)-(r.createdAt??0))[0]),w(j)):new v}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new v}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new N),this.actionSubjects.get(e)?.next(t)}catch(r){this.loggingService.catch("Error in SuggestionActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new N),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in SuggestionActionsService onAction: ",t),$(null)}}projectAndTrigger(e,t){try{if(!t||!t.suggestion)return;let r=this.projectAnnotationToSuggestion(t);if(!r)return;let s=this.timestamp;switch(e){case d.SUGGESTION_CREATED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_CREATED,a);break}case d.SUGGESTION_APPROVED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_APPROVED,a);break}case d.SUGGESTION_REJECTED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_REJECTED,a);break}case d.SUGGESTION_STALE:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_STALE,a);break}}}catch(r){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",r)}}projectAnnotationToSuggestion(e){try{let t=e.suggestion;if(!t)return;let r={annotationId:e.annotationId,targetId:t.targetId,targetType:t.targetType,oldValue:t.oldValue,newValue:t.newValue,summary:t.summary,metadata:e.metadata??{},driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return C(_({},r),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"accepted":case"apply_failed":return C(_({},r),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"rejected":return C(_({},r),{status:"rejected",rejectReason:t.rejectReason??null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return C(_({},r),{status:"stale",rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt});default:return}}catch(t){this.loggingService.catch("Error in SuggestionActionsService projectAnnotationToSuggestion: ",t);return}}startObservingIfNeeded(){try{if(this.observingActive)return;this.observingActive=!0,this.targetRegistry.startObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService startObservingIfNeeded: ",e)}}stopObservingIfNeeded(){try{if(!this.observingActive)return;this.observingActive=!1,this.targetRegistry.stopObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService stopObservingIfNeeded: ",e)}}warnIfNoTaggedElements(){try{this.targetRegistry.countTaggedElements()===0&&this.loggingService.warn('[velt] No suggestable elements found on this page. Cause: no DOM elements have a data-velt-suggestion-target attribute. Fix: tag at least one element with data-velt-suggestion-target="your.id" before enabling suggestion mode. Docs: velt.dev/docs/suggestions/getting-started')}catch(e){this.loggingService.catch("Error in SuggestionActionsService warnIfNoTaggedElements: ",e)}}get timestamp(){return this.commonDbService.getServerTimestamp()}matchesFilter(e,t){try{return t?!(t.targetId&&e.targetId!==t.targetId||t.status&&!(Array.isArray(t.status)?t.status:[t.status]).includes(e.status)):!0}catch(r){return this.loggingService.catch("Error in SuggestionActionsService matchesFilter: ",r),!1}}};i.\u0275fac=function(t){return new(t||i)(h(E),h(I),h(D),h(ae),h(ie),h(ne))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();function ge(n){try{return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return""}}function m(n){try{if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}catch{return""}}function ce(n){try{if(n===null||typeof n!="object"||Array.isArray(n))return!1;let i=Object.getPrototypeOf(n);return i===Object.prototype||i===null}catch{return!1}}function ue(n,i){try{let o=n==null,e=i==null;if(o&&!e)return[{op:"add",newText:m(i)}];if(!o&&e)return[{op:"remove",oldText:m(n)}];if(ce(n)&&ce(i)){let t=n,r=i,s=[...Object.keys(t),...Object.keys(r).filter(c=>!(c in t))],a=[];for(let c of s){let u=c in t,f=c in r;u&&f?O(t[c],r[c])||a.push({op:"replace",oldText:`${c}: ${m(t[c])}`,newText:`${c}: ${m(r[c])}`}):u?a.push({op:"remove",oldText:`${c}: ${m(t[c])}`}):a.push({op:"add",newText:`${c}: ${m(r[c])}`})}if(a.length>0)return a}return[{op:"replace",oldText:m(n),newText:m(i)}]}catch{return[{op:"replace",oldText:m(n),newText:m(i)}]}}function de(n,i){try{return ue(n,i).map(o=>o.op==="add"?`Add: "${o.newText??""}"`:o.op==="remove"?`Remove: "${o.oldText??""}"`:`Replace: "${o.oldText??""}" with "${o.newText??""}"`).join(`
2
2
  `)}catch{return'Replace: "" with ""'}}var F="color:#e0492b;font-style:italic;",M="color:#0f8a4d;font-style:italic;";function Se(n,i){try{let o=ue(n,i),e=t=>ge(t??"");if(o.length===1){let t=o[0];return t.op==="add"?`<div>Add:</div><div style="${M}">&ldquo;${e(t.newText)}&rdquo;</div>`:t.op==="remove"?`<div>Remove:</div><div style="${F}">&ldquo;${e(t.oldText)}&rdquo;</div>`:`<div>Replace:</div><div style="${F}">&ldquo;${e(t.oldText)}&rdquo;</div><div>with</div><div style="${M}">&ldquo;${e(t.newText)}&rdquo;</div>`}return o.map(t=>t.op==="add"?`<div>Add: <span style="${M}">&ldquo;${e(t.newText)}&rdquo;</span></div>`:t.op==="remove"?`<div>Remove: <span style="${F}">&ldquo;${e(t.oldText)}&rdquo;</span></div>`:`<div>Replace: <span style="${F}">&ldquo;${e(t.oldText)}&rdquo;</span> with <span style="${M}">&ldquo;${e(t.newText)}&rdquo;</span></div>`).join("")}catch{return"<div>Replace:</div><div>with</div>"}}function fe(n,i,o,e){try{let t=n||de(o,e),r;return i?r=i:n?r=`<p>${ge(n)}</p>`:r=Se(o,e),{commentText:t,commentHtml:r}}catch{return{commentText:"",commentHtml:""}}}export{Ae as a,Re as b,ae as c,Ve as d};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-67WASIND.js";import{Pa as c,Xa as f}from"./chunk-YTAAOIBL.js";var l=(()=>{let t=class t{constructor(r){this.translateService=r}transform(r,...i){try{let n=(new Date().getTime()-new Date(r).getTime())/1e3;if(n<1)return this.translateService.translate("now");let s={y:31536e3,mo:2592e3,w:604800,d:86400,h:3600,m:60,s:1};for(let a in s){let o=Math.floor(n/s[a]);if(o>0)return`${o}${this.translateService.translate(a)}`}return r}catch{return r}}};t.\u0275fac=function(i){return new(i||t)(c(m,16))},t.\u0275pipe=f({name:"timeAgo",type:t,pure:!0});let e=t;return e})();export{l as a};
1
+ import{a as m}from"./chunk-KPCULYW2.js";import{Pa as c,Xa as f}from"./chunk-4EV2AXDK.js";var l=(()=>{let t=class t{constructor(r){this.translateService=r}transform(r,...i){try{let n=(new Date().getTime()-new Date(r).getTime())/1e3;if(n<1)return this.translateService.translate("now");let s={y:31536e3,mo:2592e3,w:604800,d:86400,h:3600,m:60,s:1};for(let a in s){let o=Math.floor(n/s[a]);if(o>0)return`${o}${this.translateService.translate(a)}`}return r}catch{return r}}};t.\u0275fac=function(i){return new(i||t)(c(m,16))},t.\u0275pipe=f({name:"timeAgo",type:t,pure:!0});let e=t;return e})();export{l as a};
@@ -1 +1 @@
1
- import{ca as F}from"./chunk-HO27RBDE.js";import{$ as A,Ai as U,Cf as g,Ch as D,E as h,Ee as $,Fi as C,G as d,J as v,L as l,Pi as w,T as n,Xe as M,ca as s,ji as E,ki as R,l as p,li as y,qh as I,r as u,te as a,ti as k,ue as m,v as c}from"./chunk-YTAAOIBL.js";var Z=(()=>{let o=class o{constructor(e,t,r,b,f,W,T,j){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=b,this.docService=f,this.configService=W,this.loggingService=T,this.commonDbService=j,this.documentIAM$=new p(null),this.workspaceIAM$=new p(null),this.roles$=new p([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.getUser(),this.getDocumentPaths())},i=>{this.loggingService.catch("Error in CommentService getDb subscription: ",i)}),this.getRole$().pipe(v(1)).subscribe(i=>{this.authService?.getUser()&&!i&&this.analyticsService.trackEvent(D.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(i=>{i?.accessType&&this.contactService.setDocumentAccessType(i.accessType)})}catch(i){this.loggingService.catch("Error in IamService constructor: ",i)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(h(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(h(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new M;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(d(e=>u(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(c(e=>!!e),l())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(c(e=>e?.length?e:$.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(c(e=>e?.features),n(e=>this.getRole$().pipe(c(t=>(t===a.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(n(()=>this.documentIAM$.pipe(h(t=>!!t),n(()=>this.workspaceIAM$.pipe(c(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),u(!1)}}getRole$(){try{return this.authService.getUser$().pipe(n(()=>this.configService.getSF$()),n(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():u(null)),n(()=>this.configService.getSF()?this.documentIAM$.pipe(h(e=>!!e),l(I)):u(null)),n(()=>this.workspaceIAM$.pipe(l(I))),c(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),u(null)}}getRole(){try{let e=this.configService.getSF();if(this.user?.isAdmin)return a.ADMIN;return a.COMMENTER;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?m.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||m.PUBLIC:null){case m.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||a.COMMENTER;break;case m.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(c(e=>e===a.ADMIN),l())}isUserAdmin(){try{return this.getRole()===a.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(s(E),s(k),s(F),s(U),s(C),s(y),s(R),s(w))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let S=o;return S})();export{Z as a};
1
+ import{ca as F}from"./chunk-UQI5JFMO.js";import{$ as A,Ai as U,Cf as g,Ch as D,E as h,Ee as $,Fi as C,G as d,J as v,L as l,Pi as w,T as n,Xe as M,ca as s,ji as E,ki as R,l as p,li as y,qh as I,r as u,te as a,ti as k,ue as m,v as c}from"./chunk-4EV2AXDK.js";var Z=(()=>{let o=class o{constructor(e,t,r,b,f,W,T,j){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=b,this.docService=f,this.configService=W,this.loggingService=T,this.commonDbService=j,this.documentIAM$=new p(null),this.workspaceIAM$=new p(null),this.roles$=new p([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.getUser(),this.getDocumentPaths())},i=>{this.loggingService.catch("Error in CommentService getDb subscription: ",i)}),this.getRole$().pipe(v(1)).subscribe(i=>{this.authService?.getUser()&&!i&&this.analyticsService.trackEvent(D.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(i=>{i?.accessType&&this.contactService.setDocumentAccessType(i.accessType)})}catch(i){this.loggingService.catch("Error in IamService constructor: ",i)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(h(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(h(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new M;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(d(e=>u(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(c(e=>!!e),l())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(c(e=>e?.length?e:$.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(c(e=>e?.features),n(e=>this.getRole$().pipe(c(t=>(t===a.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(n(()=>this.documentIAM$.pipe(h(t=>!!t),n(()=>this.workspaceIAM$.pipe(c(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),u(!1)}}getRole$(){try{return this.authService.getUser$().pipe(n(()=>this.configService.getSF$()),n(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():u(null)),n(()=>this.configService.getSF()?this.documentIAM$.pipe(h(e=>!!e),l(I)):u(null)),n(()=>this.workspaceIAM$.pipe(l(I))),c(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),u(null)}}getRole(){try{let e=this.configService.getSF();if(this.user?.isAdmin)return a.ADMIN;return a.COMMENTER;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?m.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||m.PUBLIC:null){case m.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||a.COMMENTER;break;case m.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(c(e=>e===a.ADMIN),l())}isUserAdmin(){try{return this.getRole()===a.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(s(E),s(k),s(F),s(U),s(C),s(y),s(R),s(w))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let S=o;return S})();export{Z as a};