import{O as r,g as s,ka as n,ma as b,na as j,r as i}from"./chunk-JSJB5BKT.js";import{e as g}from"./chunk-SZAW6ZBW.js";var h,a,l=g(()=>{b();j();h=class{constructor(e){this.currentUserService=e,this.cachingObject={subject:new s,items:null,isPending:!1,userId:null}}get items(){return this.cachingObject.items}notifyCaching(e){this.isSameUser()?(this.cachingObject.isPending=!1,this.cachingObject.subject.next(e),this.cachingObject.items=[...e]):this.invalidateCache()}invalidateCache(){this.cachingObject.items=null,this.cachingObject.isPending=!1,this.cachingObject.userId=null}getCache(e=!1,t){return(e||!this.isSameUser())&&this.invalidateCache(),this.cachingObject.items?i([...this.cachingObject.items]):this.cachingObject.isPending?this.cachingObject.subject:(this.cachingObject.userId=this.currentUserService.currentUserId,this.cachingObject.isPending=!0,t.pipe(n(c=>this.notifyCaching(c||[])),r(()=>(this.invalidateCache(),i(null)))))}isSameUser(){return!this.currentUserService.currentUserSnapshot||!this.currentUserService.currentUserId?!1:this.cachingObject.userId&&this.cachingObject.userId===this.currentUserService.currentUserId}},a=class{constructor(e){this.currentUserService=e,this.cachingObject={subject:new s,item:null,isPending:!1,userId:null}}get items(){return this.cachingObject.item}notifyCaching(e){this.isSameUser()?(this.cachingObject.isPending=!1,this.cachingObject.subject.next(e),this.cachingObject.item=e):this.invalidateCache()}invalidateCache(){this.cachingObject.item=null,this.cachingObject.isPending=!1,this.cachingObject.userId=null}getCache(e=!1,t){return(e||!this.isSameUser())&&this.invalidateCache(),this.cachingObject.item?i(this.cachingObject.item):this.cachingObject.isPending?this.cachingObject.subject:(this.cachingObject.userId=this.currentUserService.currentUserId,this.cachingObject.isPending=!0,t.pipe(n(c=>this.notifyCaching(c)),r(()=>(this.invalidateCache(),i(null)))))}isSameUser(){return!this.currentUserService.currentUserSnapshot||!this.currentUserService.currentUserId?!1:this.cachingObject.userId&&this.cachingObject.userId===this.currentUserService.currentUserId}}});export{h as a,a as b,l as c};
