import{W as n,ja as y}from"./chunk-Q232IBQN.js";import{h as l,m as c}from"./chunk-K3AFQ46O.js";import{f as d,sa as v,xa as a}from"./chunk-O7RN3KYY.js";import{a as p}from"./chunk-ZE2KCNEA.js";import{a as o}from"./chunk-CEWFFWI2.js";p();var S=(()=>{class i{constructor(){this.http=a(l),this.analytics=a(y),this.favoritesUpdatedSubject=new d([]),this.favoritesUpdated$=this.favoritesUpdatedSubject.asObservable()}ngOnDestroy(){this.favoritesUpdatedSubject.complete()}updateFavorites(){this.http.get(`${c.API_ENDPOINT_V1}/favorites/`).subscribe(t=>{this.favoritesUpdatedSubject.next(t)})}reorderFavorites(t){return this.http.post(`${c.API_ENDPOINT_V1}/favorites/reorder/`,{favorites:t})}sendFavoriteClickedAnalyticsEvent(t,e,s){let r={type:n.SHORTCUT_CLICKED,properties:{item_type:t.content_type,item_id:t.content_object.id,item_title:e,display_order:s}};this.analytics.analyticsEvent(r)}sendFavoriteCreatedAnalyticsEvent(t){let e=this.favoritesUpdatedSubject.value.length,s={type:n.SHORTCUT_CREATED,properties:o({display_order:e},t)};this.analytics.analyticsEvent(s)}sendFavoriteRemovedAnalyticsEvent(t){let e=this.favoritesUpdatedSubject.value.findIndex(r=>r.content_type===t.item_type&&r.content_object.id===t.item_id),s={type:n.SHORTCUT_REMOVED,properties:o({display_order:e},t)};this.analytics.analyticsEvent(s)}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275prov=v({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{S as a};