PageSourceSearch

https://vodeville.se/chunk-E4WLAMJD.js

js vodeville.se collected 2026-10-02 23:31:10 UTC 3,824 bytes, 2 lines download raw bytes

1import{a as f}from"./chunk-NGCE2PY6.js";import{c as p}from"./chunk-FF4Q56LD.js";import{u as m}from"./chunk-NBBIF7I4.js";import{Da as l,a as c,b as d,ha as v,j as o,ma as u,w as n}from"./chunk-UBAJYFF7.js";var h="vodeville.movienight.active",R=(()=>{class r{constructor(){this.localService=u(f),this.http=u(m),this.userService=u(p),this.active=l(this.readFromStorage()),this.suggestedFilmIds=l(new Set),this.selectedProviderIds=l(new Set)}readFromStorage(){try{let e=JSON.parse(this.localService.getData(h)??"");if(e?.token&&(e?.isGuest===!1||e?.participantId!=null))return{token:e.token,participantId:e.participantId??null,isGuest:e.isGuest??!0,status:e.status??"COLLECTING",votesRevealed:!!e.votesRevealed,winnerFilm:e.winnerFilm??null,dismissed:!!e.dismissed}}catch{}return null}persist(e){this.localService.saveData(h,JSON.stringify(e))}save(e,t,s){let i=this.active(),a={token:e,participantId:t,isGuest:s,status:i?.token===e?i.status:"COLLECTING",votesRevealed:i?.token===e?i.votesRevealed:!1,winnerFilm:i?.token===e?i.winnerFilm:null,dismissed:!1};this.persist(a),this.active.set(a)}setStatus(e){let t=this.active();if(!t||t.status===e)return;let s=d(c({},t),{status:e});this.persist(s),this.active.set(s)}setSelectedProviderIds(e){let t=this.selectedProviderIds();e.length===t.size&&e.every(s=>t.has(s))||this.selectedProviderIds.set(new Set(e))}clear(){this.localService.removeData(h),this.active.set(null),this.suggestedFilmIds.set(new Set),this.selectedProviderIds.set(new Set)}dismiss(e){if(this.userService.user()){this.http.post(`/api/movienight/${encodeURIComponent(e)}/dismiss`,{}).pipe(o(()=>n(null))).subscribe(()=>this.clear());return}this.dismissGuestBanner(e)}syncHostBannerHints(e,t){let s=this.active();!s?.isGuest||s.token!==e||s.dismissed||(t.hostDismissedBanner||t.hostSubmittedBallot)&&this.dismissGuestBanner(e)}refreshGuest(){let e=this.active();!e?.isGuest||e.dismissed||e.participantId==null||this.http.get(`/api/movienight/${encodeURIComponent(e.token)}/guest-active`,{params:{guestParticipantId:e.participantId}}).pipe(o(t=>t.status===404?n(null):n(void 0))).subscribe(t=>{if(t!==void 0){if(t===null){this.clear();return}this.applyGuestActiveResponse(e.token,t)}})}applyGuestActiveResponse(e,t){let s=this.active();if(!s||s.token!==e)return;let i=d(c({},s),{status:t.status,votesRevealed:t.votesRevealed,winnerFilm:t.winnerFilm,dismissed:s.dismissed||t.banner.hostDismissedBanner||t.banner.hostSubmittedBallot});this.persist(i),this.active.set(i)}dismissGuestBanner(e){let t=this.active();if(!t||t.token!==e||t.dismissed)return;let s=d(c({},t),{dismissed:!0});this.persist(s),this.active.set(s)}setSuggestedFilmIds(e){let t=this.suggestedFilmIds();e.length===t.size&&e.every(s=>t.has(s))||this.suggestedFilmIds.set(new Set(e))}addSuggestedFilmId(e){this.suggestedFilmIds.update(t=>new Set([...t,e]))}removeSuggestedFilmId(e){this.suggestedFilmIds.update(t=>{let s=new Set(t);return s.delete(e),s})}refresh(){if(!this.userService.user()){let e=this.active();e&&!e.isGuest&&this.clear();return}this.http.get("/api/movienight/active").pipe(o(e=>e.status===404?n(null):n(void 0))).subscribe(e=>{if(e===void 0)return;if(e===null){let a=this.active();a&&!a.isGuest&&this.clear();return}let t=this.active(),s=t?.token===e.token&&!t.isGuest,i={token:e.token,participantId:s?t.participantId:null,isGuest:!1,status:e.status,votesRevealed:e.votesRevealed,winnerFilm:e.winnerFilm,dismissed:!1};this.persist(i),this.active.set(i)})}setWinnerFilm(e){let t=this.active();if(!t||t.winnerFilm?.id===e?.id&&t.winnerFilm?.title===e?.title)return;let s=d(c({},t),{winnerFilm:e});this.persist(s),this.active.set(s)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=v({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{R as a};
2//# sourceMappingURL=chunk-E4WLAMJD.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.