{"version":3,"sources":["src/app/shared/services/local-storage.service.ts","node_modules/@angular/service-worker/fesm2022/service-worker.mjs","src/app/common/modules/web-push/web-push.service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\n\n\nexport class LocalStorageService {\n setItem(key: string, value: LocalStorageType): void {\n localStorage.setItem(key, JSON.stringify(value));\n }\n\n getItem(key: string): LocalStorageType {\n const data = localStorage.getItem(key);\n return data ? JSON.parse(data) : null;\n }\n\n isMenuExpanded(): boolean {\n const item = this.getItem(LocalStorageKeys.IS_MENU_EXPANDED);\n if (item === null) {\n return true;\n }\n return !!item;\n }\n}\n\ntype LocalStorageType = string | number | boolean | object;\n\nexport enum LocalStorageKeys {\n IS_MENU_EXPANDED= 'isMenuExpanded',\n}\n","/**\n * @license Angular v17.2.1\n * (c) 2010-2022 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, InjectionToken, NgZone, ApplicationRef, makeEnvironmentProviders, PLATFORM_ID, APP_INITIALIZER, Injector, NgModule } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { defer, throwError, fromEvent, of, concat, Subject, NEVER, merge } from 'rxjs';\nimport { map, filter, switchMap, publish, take, tap, delay } from 'rxjs/operators';\nconst ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';\nfunction errorObservable(message) {\n return defer(() => throwError(new Error(message)));\n}\n/**\n * @publicApi\n */\nclass NgswCommChannel {\n constructor(serviceWorker) {\n this.serviceWorker = serviceWorker;\n if (!serviceWorker) {\n this.worker = this.events = this.registration = errorObservable(ERR_SW_NOT_SUPPORTED);\n } else {\n const controllerChangeEvents = fromEvent(serviceWorker, 'controllerchange');\n const controllerChanges = controllerChangeEvents.pipe(map(() => serviceWorker.controller));\n const currentController = defer(() => of(serviceWorker.controller));\n const controllerWithChanges = concat(currentController, controllerChanges);\n this.worker = controllerWithChanges.pipe(filter(c => !!c));\n this.registration = this.worker.pipe(switchMap(() => serviceWorker.getRegistration()));\n const rawEvents = fromEvent(serviceWorker, 'message');\n const rawEventPayload = rawEvents.pipe(map(event => event.data));\n const eventsUnconnected = rawEventPayload.pipe(filter(event => event && event.type));\n const events = eventsUnconnected.pipe(publish());\n events.connect();\n this.events = events;\n }\n }\n postMessage(action, payload) {\n return this.worker.pipe(take(1), tap(sw => {\n sw.postMessage({\n action,\n ...payload\n });\n })).toPromise().then(() => undefined);\n }\n postMessageWithOperation(type, payload, operationNonce) {\n const waitForOperationCompleted = this.waitForOperationCompleted(operationNonce);\n const postMessage = this.postMessage(type, payload);\n return Promise.all([postMessage, waitForOperationCompleted]).then(([, result]) => result);\n }\n generateNonce() {\n return Math.round(Math.random() * 10000000);\n }\n eventsOfType(type) {\n let filterFn;\n if (typeof type === 'string') {\n filterFn = event => event.type === type;\n } else {\n filterFn = event => type.includes(event.type);\n }\n return this.events.pipe(filter(filterFn));\n }\n nextEventOfType(type) {\n return this.eventsOfType(type).pipe(take(1));\n }\n waitForOperationCompleted(nonce) {\n return this.eventsOfType('OPERATION_COMPLETED').pipe(filter(event => event.nonce === nonce), take(1), map(event => {\n if (event.result !== undefined) {\n return event.result;\n }\n throw new Error(event.error);\n })).toPromise();\n }\n get isEnabled() {\n return !!this.serviceWorker;\n }\n}\n\n/**\n * Subscribe and listen to\n * [Web Push\n * Notifications](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) through\n * Angular Service Worker.\n *\n * @usageNotes\n *\n * You can inject a `SwPush` instance into any component or service\n * as a dependency.\n *\n * \n *\n * To subscribe, call `SwPush.requestSubscription()`, which asks the user for permission.\n * The call returns a `Promise` with a new\n * [`PushSubscription`](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * instance.\n *\n * \n *\n * A request is rejected if the user denies permission, or if the browser\n * blocks or does not support the Push API or ServiceWorkers.\n * Check `SwPush.isEnabled` to confirm status.\n *\n * Invoke Push Notifications by pushing a message with the following payload.\n *\n * ```ts\n * {\n * \"notification\": {\n * \"actions\": NotificationAction[],\n * \"badge\": USVString,\n * \"body\": DOMString,\n * \"data\": any,\n * \"dir\": \"auto\"|\"ltr\"|\"rtl\",\n * \"icon\": USVString,\n * \"image\": USVString,\n * \"lang\": DOMString,\n * \"renotify\": boolean,\n * \"requireInteraction\": boolean,\n * \"silent\": boolean,\n * \"tag\": DOMString,\n * \"timestamp\": DOMTimeStamp,\n * \"title\": DOMString,\n * \"vibrate\": number[]\n * }\n * }\n * ```\n *\n * Only `title` is required. See `Notification`\n * [instance\n * properties](https://developer.mozilla.org/en-US/docs/Web/API/Notification#Instance_properties).\n *\n * While the subscription is active, Service Worker listens for\n * [PushEvent](https://developer.mozilla.org/en-US/docs/Web/API/PushEvent)\n * occurrences and creates\n * [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification)\n * instances in response.\n *\n * Unsubscribe using `SwPush.unsubscribe()`.\n *\n * An application can subscribe to `SwPush.notificationClicks` observable to be notified when a user\n * clicks on a notification. For example:\n *\n * \n *\n * You can read more on handling notification clicks in the [Service worker notifications\n * guide](guide/service-worker-notifications).\n *\n * @see [Push Notifications](https://developers.google.com/web/fundamentals/codelabs/push-notifications/)\n * @see [Angular Push Notifications](https://blog.angular-university.io/angular-push-notifications/)\n * @see [MDN: Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API)\n * @see [MDN: Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API)\n * @see [MDN: Web Push API Notifications best practices](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices)\n *\n * @publicApi\n */\nlet SwPush = /*#__PURE__*/(() => {\n class SwPush {\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled() {\n return this.sw.isEnabled;\n }\n constructor(sw) {\n this.sw = sw;\n this.pushManager = null;\n this.subscriptionChanges = new Subject();\n if (!sw.isEnabled) {\n this.messages = NEVER;\n this.notificationClicks = NEVER;\n this.subscription = NEVER;\n return;\n }\n this.messages = this.sw.eventsOfType('PUSH').pipe(map(message => message.data));\n this.notificationClicks = this.sw.eventsOfType('NOTIFICATION_CLICK').pipe(map(message => message.data));\n this.pushManager = this.sw.registration.pipe(map(registration => registration.pushManager));\n const workerDrivenSubscriptions = this.pushManager.pipe(switchMap(pm => pm.getSubscription()));\n this.subscription = merge(workerDrivenSubscriptions, this.subscriptionChanges);\n }\n /**\n * Subscribes to Web Push Notifications,\n * after requesting and receiving user permission.\n *\n * @param options An object containing the `serverPublicKey` string.\n * @returns A Promise that resolves to the new subscription object.\n */\n requestSubscription(options) {\n if (!this.sw.isEnabled || this.pushManager === null) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const pushOptions = {\n userVisibleOnly: true\n };\n let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));\n let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));\n for (let i = 0; i < key.length; i++) {\n applicationServerKey[i] = key.charCodeAt(i);\n }\n pushOptions.applicationServerKey = applicationServerKey;\n return this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1)).toPromise().then(sub => {\n this.subscriptionChanges.next(sub);\n return sub;\n });\n }\n /**\n * Unsubscribes from Service Worker push notifications.\n *\n * @returns A Promise that is resolved when the operation succeeds, or is rejected if there is no\n * active subscription or the unsubscribe operation fails.\n */\n unsubscribe() {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const doUnsubscribe = sub => {\n if (sub === null) {\n throw new Error('Not subscribed to push notifications.');\n }\n return sub.unsubscribe().then(success => {\n if (!success) {\n throw new Error('Unsubscribe failed!');\n }\n this.subscriptionChanges.next(null);\n });\n };\n return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise();\n }\n decodeBase64(input) {\n return atob(input);\n }\n static {\n this.ɵfac = function SwPush_Factory(t) {\n return new (t || SwPush)(i0.ɵɵinject(NgswCommChannel));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SwPush,\n factory: SwPush.ɵfac\n });\n }\n }\n return SwPush;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Subscribe to update notifications from the Service Worker, trigger update\n * checks, and forcibly activate updates.\n *\n * @see {@link guide/service-worker-communications Service worker communication guide}\n *\n * @publicApi\n */\nlet SwUpdate = /*#__PURE__*/(() => {\n class SwUpdate {\n /**\n * True if the Service Worker is enabled (supported by the browser and enabled via\n * `ServiceWorkerModule`).\n */\n get isEnabled() {\n return this.sw.isEnabled;\n }\n constructor(sw) {\n this.sw = sw;\n if (!sw.isEnabled) {\n this.versionUpdates = NEVER;\n this.unrecoverable = NEVER;\n return;\n }\n this.versionUpdates = this.sw.eventsOfType(['VERSION_DETECTED', 'VERSION_INSTALLATION_FAILED', 'VERSION_READY', 'NO_NEW_VERSION_DETECTED']);\n this.unrecoverable = this.sw.eventsOfType('UNRECOVERABLE_STATE');\n }\n /**\n * Checks for an update and waits until the new version is downloaded from the server and ready\n * for activation.\n *\n * @returns a promise that\n * - resolves to `true` if a new version was found and is ready to be activated.\n * - resolves to `false` if no new version was found\n * - rejects if any error occurs\n */\n checkForUpdate() {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const nonce = this.sw.generateNonce();\n return this.sw.postMessageWithOperation('CHECK_FOR_UPDATES', {\n nonce\n }, nonce);\n }\n /**\n * Updates the current client (i.e. browser tab) to the latest version that is ready for\n * activation.\n *\n * In most cases, you should not use this method and instead should update a client by reloading\n * the page.\n *\n *
\n *\n * Updating a client without reloading can easily result in a broken application due to a version\n * mismatch between the [application shell](guide/glossary#app-shell) and other page resources,\n * such as [lazy-loaded chunks](guide/glossary#lazy-loading), whose filenames may change between\n * versions.\n *\n * Only use this method, if you are certain it is safe for your specific use case.\n *\n *
\n *\n * @returns a promise that\n * - resolves to `true` if an update was activated successfully\n * - resolves to `false` if no update was available (for example, the client was already on the\n * latest version).\n * - rejects if any error occurs\n */\n activateUpdate() {\n if (!this.sw.isEnabled) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const nonce = this.sw.generateNonce();\n return this.sw.postMessageWithOperation('ACTIVATE_UPDATE', {\n nonce\n }, nonce);\n }\n static {\n this.ɵfac = function SwUpdate_Factory(t) {\n return new (t || SwUpdate)(i0.ɵɵinject(NgswCommChannel));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SwUpdate,\n factory: SwUpdate.ɵfac\n });\n }\n }\n return SwUpdate;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nconst SCRIPT = /*#__PURE__*/new InjectionToken(ngDevMode ? 'NGSW_REGISTER_SCRIPT' : '');\nfunction ngswAppInitializer(injector, script, options, platformId) {\n return () => {\n if (!(isPlatformBrowser(platformId) && 'serviceWorker' in navigator && options.enabled !== false)) {\n return;\n }\n // Wait for service worker controller changes, and fire an INITIALIZE action when a new SW\n // becomes active. This allows the SW to initialize itself even if there is no application\n // traffic.\n navigator.serviceWorker.addEventListener('controllerchange', () => {\n if (navigator.serviceWorker.controller !== null) {\n navigator.serviceWorker.controller.postMessage({\n action: 'INITIALIZE'\n });\n }\n });\n let readyToRegister$;\n if (typeof options.registrationStrategy === 'function') {\n readyToRegister$ = options.registrationStrategy();\n } else {\n const [strategy, ...args] = (options.registrationStrategy || 'registerWhenStable:30000').split(':');\n switch (strategy) {\n case 'registerImmediately':\n readyToRegister$ = of(null);\n break;\n case 'registerWithDelay':\n readyToRegister$ = delayWithTimeout(+args[0] || 0);\n break;\n case 'registerWhenStable':\n readyToRegister$ = !args[0] ? whenStable(injector) : merge(whenStable(injector), delayWithTimeout(+args[0]));\n break;\n default:\n // Unknown strategy.\n throw new Error(`Unknown ServiceWorker registration strategy: ${options.registrationStrategy}`);\n }\n }\n // Don't return anything to avoid blocking the application until the SW is registered.\n // Also, run outside the Angular zone to avoid preventing the app from stabilizing (especially\n // given that some registration strategies wait for the app to stabilize).\n // Catch and log the error if SW registration fails to avoid uncaught rejection warning.\n const ngZone = injector.get(NgZone);\n ngZone.runOutsideAngular(() => readyToRegister$.pipe(take(1)).subscribe(() => navigator.serviceWorker.register(script, {\n scope: options.scope\n }).catch(err => console.error('Service worker registration failed with:', err))));\n };\n}\nfunction delayWithTimeout(timeout) {\n return of(null).pipe(delay(timeout));\n}\nfunction whenStable(injector) {\n const appRef = injector.get(ApplicationRef);\n return appRef.isStable.pipe(filter(stable => stable));\n}\nfunction ngswCommChannelFactory(opts, platformId) {\n return new NgswCommChannel(isPlatformBrowser(platformId) && opts.enabled !== false ? navigator.serviceWorker : undefined);\n}\n/**\n * Token that can be used to provide options for `ServiceWorkerModule` outside of\n * `ServiceWorkerModule.register()`.\n *\n * You can use this token to define a provider that generates the registration options at runtime,\n * for example via a function call:\n *\n * {@example service-worker/registration-options/module.ts region=\"registration-options\"\n * header=\"app.module.ts\"}\n *\n * @publicApi\n */\nclass SwRegistrationOptions {}\n/**\n * @publicApi\n *\n * Sets up providers to register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n *\n * Example usage:\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideServiceWorker('ngsw-worker.js')\n * ],\n * });\n * ```\n */\nfunction provideServiceWorker(script, options = {}) {\n return makeEnvironmentProviders([SwPush, SwUpdate, {\n provide: SCRIPT,\n useValue: script\n }, {\n provide: SwRegistrationOptions,\n useValue: options\n }, {\n provide: NgswCommChannel,\n useFactory: ngswCommChannelFactory,\n deps: [SwRegistrationOptions, PLATFORM_ID]\n }, {\n provide: APP_INITIALIZER,\n useFactory: ngswAppInitializer,\n deps: [Injector, SCRIPT, SwRegistrationOptions, PLATFORM_ID],\n multi: true\n }]);\n}\n\n/**\n * @publicApi\n */\nlet ServiceWorkerModule = /*#__PURE__*/(() => {\n class ServiceWorkerModule {\n /**\n * Register the given Angular Service Worker script.\n *\n * If `enabled` is set to `false` in the given options, the module will behave as if service\n * workers are not supported by the browser, and the service worker will not be registered.\n */\n static register(script, options = {}) {\n return {\n ngModule: ServiceWorkerModule,\n providers: [provideServiceWorker(script, options)]\n };\n }\n static {\n this.ɵfac = function ServiceWorkerModule_Factory(t) {\n return new (t || ServiceWorkerModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ServiceWorkerModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [SwPush, SwUpdate]\n });\n }\n }\n return ServiceWorkerModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n// This file only reexports content of the `src` folder. Keep it that way.\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ServiceWorkerModule, SwPush, SwRegistrationOptions, SwUpdate, provideServiceWorker };\n","import { Injectable } from '@angular/core';\nimport { SwPush } from '@angular/service-worker';\nimport { environment } from '../../../../environments/environment';\nimport { catchError, from, mergeMap, Observable, tap } from 'rxjs';\nimport { User } from '../../../auth/dto/user';\nimport { HttpClient } from '@angular/common/http';\nimport { AuthService } from '../../../auth/auth.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WebPushService {\n private readonly STORAGE_KEY = 'lastWebPushPermissionRequest';\n private readonly VAPID_PUBLIC_KEY = environment.vapidPublicKey;\n private readonly restPath = `${environment.api}/web-push`;\n\n constructor(\n private http: HttpClient,\n private swPush: SwPush,\n private authService: AuthService\n ) {\n }\n\n /**\n * Requests the user to allow notifications.\n * If the user allows, the subscription will be saved in the database.\n * The date of the request will be saved in the local storage.\n * */\n requestPermission(): Observable {\n return from(\n this.swPush.requestSubscription({\n serverPublicKey: this.VAPID_PUBLIC_KEY,\n })\n ).pipe(\n mergeMap((sub) => {\n this.setLastPermissionRequestDate();\n return this.updateWebPushSubscription(sub);\n }),\n catchError((error) => {\n console.error('Could not requestPermission to notifications', error.message);\n throw error;\n })\n );\n }\n\n /**\n * Call the backend to update the subscription.\n *\n * @param subscription The subscription object.\n * @returns The updated user.\n * */\n updateWebPushSubscription(subscription: PushSubscription): Observable {\n return this.http.post(\n `${this.restPath}/updateWebPushSubscription`,\n subscription\n );\n }\n\n /**\n * Mute notifications for the current user.\n *\n * @param status boolean\n */\n muteNotifications(status: boolean): Observable {\n return this.http\n .post(`${this.restPath}/muteNotifications`, { status })\n .pipe(\n tap(() => {\n this.authService.updateLoggedUser();\n })\n );\n }\n\n /**\n * Checks if the user has already been asked for permission.\n * It is useful to avoid asking the user multiple times.\n *\n * @param days The number of days to check.\n * If the last request is older than this number or if there is no request, it will return true.\n *\n * @returns boolean\n * */\n subscriptionOlderThanDays(days: number): boolean {\n const lastPermissionRequestDate = this.getLastPermissionRequestDate();\n if (!lastPermissionRequestDate) {\n return true;\n }\n\n const now = new Date();\n const diff = now.getTime() - lastPermissionRequestDate.getTime();\n const diffInDays = diff / (1000 * 3600 * 24);\n return diffInDays >= days;\n }\n\n /**\n * Saves the date of the last permission request in the local storage.\n */\n setLastPermissionRequestDate() {\n localStorage.setItem(this.STORAGE_KEY, new Date().toJSON());\n }\n\n /**\n * Gets the date of the last permission request.\n * If there is no date, it will return null.\n *\n * @returns Date | null\n */\n getLastPermissionRequestDate(): Date | null {\n try {\n const val = localStorage.getItem(this.STORAGE_KEY);\n return val ? new Date(val) : null;\n } catch (_) {\n return null;\n }\n }\n\n /**\n * The alias for the `SwPush.isEnabled` property.\n *\n * @see {@link https://angular.io/api/service-worker/SwPush#isEnabled}\n * */\n isSwEnabled(): boolean {\n return this.swPush.isEnabled && !this.isIos();\n }\n\n isNotificationPermissionGranted(): boolean {\n if ('Notification' in window) {\n return Notification.permission === 'granted';\n }\n\n return false;\n }\n\n isIos() {\n return (\n [\n 'iPad Simulator',\n 'iPhone Simulator',\n 'iPod Simulator',\n 'iPad',\n 'iPhone',\n 'iPod',\n ].includes(navigator.platform) ||\n // iPad on iOS 13 detection\n (navigator.userAgent.includes('Mac') && 'ontouchend' in document)\n );\n }\n}\n"],"mappings":"iaAOA,IAAaA,IAAmB,IAAA,CAA1B,IAAOA,EAAP,MAAOA,CAAmB,CAC9BC,QAAQC,EAAaC,EAAuB,CAC1CC,aAAaH,QAAQC,EAAKG,KAAKC,UAAUH,CAAK,CAAC,CACjD,CAEAI,QAAQL,EAAW,CACjB,IAAMM,EAAOJ,aAAaG,QAAQL,CAAG,EACrC,OAAOM,EAAOH,KAAKI,MAAMD,CAAI,EAAI,IACnC,CAEAE,gBAAc,CACZ,IAAMC,EAAO,KAAKJ,QAAQK,EAAiBC,gBAAgB,EAC3D,OAAIF,IAAS,KACJ,GAEF,CAAC,CAACA,CACX,yCAhBWX,EAAmB,wBAAnBA,EAAmBc,QAAnBd,EAAmBe,UAAAC,WAJlB,MAAM,CAAA,EAId,IAAOhB,EAAPiB,SAAOjB,CAAmB,GAAA,EAqBpBY,EAAZ,SAAYA,EAAgB,CAC1BA,OAAAA,EAAA,iBAAA,iBADUA,CAEZ,EAFYA,GAAgB,CAAA,CAAA,ECjB5B,IAAMM,EAAuB,gEAC7B,SAASC,GAAgBC,EAAS,CAChC,OAAOC,EAAM,IAAMC,EAAW,IAAI,MAAMF,CAAO,CAAC,CAAC,CACnD,CAIA,IAAMG,EAAN,KAAsB,CACpB,YAAYC,EAAe,CAEzB,GADA,KAAK,cAAgBA,EACjB,CAACA,EACH,KAAK,OAAS,KAAK,OAAS,KAAK,aAAeL,GAAgBD,CAAoB,MAC/E,CAEL,IAAMO,EADyBC,EAAUF,EAAe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tB,KAAKuB,KACf,GAAG,KAAKhB,QAAQ,6BAChBe,CAAY,CAEhB,CAOAE,kBAAkBC,EAAe,CAC/B,OAAO,KAAKzB,KACTuB,KAAW,GAAG,KAAKhB,QAAQ,qBAAsB,CAAEkB,OAAAA,CAAM,CAAE,EAC3DZ,KACCa,EAAI,IAAK,CACP,KAAKxB,YAAYyB,iBAAgB,CACnC,CAAC,CAAC,CAER,CAWAC,0BAA0BC,EAAY,CACpC,IAAMC,EAA4B,KAAKC,6BAA4B,EACnE,OAAKD,GAIO,IAAIE,KAAI,EACHC,QAAO,EAAKH,EAA0BG,QAAO,IACnC,IAAO,KAAO,KACpBJ,EANZ,EAOX,CAKAb,8BAA4B,CAC1BkB,aAAaC,QAAQ,KAAKhC,YAAa,IAAI6B,KAAI,EAAGI,OAAM,CAAE,CAC5D,CAQAL,8BAA4B,CAC1B,GAAI,CACF,IAAMM,EAAMH,aAAaI,QAAQ,KAAKnC,WAAW,EACjD,OAAOkC,EAAM,IAAIL,KAAKK,CAAG,EAAI,IAC/B,MAAY,CACV,OAAO,IACT,CACF,CAOAE,aAAW,CACT,OAAO,KAAKtC,OAAOuC,WAAa,CAAC,KAAKC,MAAK,CAC7C,CAEAC,iCAA+B,CAC7B,MAAI,iBAAkBC,OACbC,aAAaC,aAAe,UAG9B,EACT,CAEAJ,OAAK,CACH,MACE,CACE,iBACA,mBACA,iBACA,OACA,SACA,MAAM,EACNK,SAASC,UAAUC,QAAQ,GAE5BD,UAAUE,UAAUH,SAAS,KAAK,GAAK,eAAgBI,QAE5D,yCAvIWpD,GAAcqD,EAAAC,CAAA,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,CAAA,CAAA,CAAA,wBAAdxD,EAAcyD,QAAdzD,EAAc0D,UAAAC,WAFb,MAAM,CAAA,EAEd,IAAO3D,EAAP4D,SAAO5D,CAAc,GAAA","names":["LocalStorageService","setItem","key","value","localStorage","JSON","stringify","getItem","data","parse","isMenuExpanded","item","LocalStorageKeys","IS_MENU_EXPANDED","factory","ɵfac","providedIn","_LocalStorageService","ERR_SW_NOT_SUPPORTED","errorObservable","message","defer","throwError","NgswCommChannel","serviceWorker","controllerChanges","fromEvent","map","currentController","of","controllerWithChanges","concat","filter","c","switchMap","events","event","publish","action","payload","take","tap","sw","__spreadValues","type","operationNonce","waitForOperationCompleted","postMessage","result","filterFn","nonce","SwPush","_SwPush","Subject","NEVER","registration","workerDrivenSubscriptions","pm","merge","options","pushOptions","key","applicationServerKey","i","sub","doUnsubscribe","success","input","t","ɵɵinject","ɵɵdefineInjectable","SwUpdate","_SwUpdate","SCRIPT","InjectionToken","ngswAppInitializer","injector","script","platformId","isPlatformBrowser","readyToRegister$","strategy","args","delayWithTimeout","whenStable","NgZone","err","timeout","delay","ApplicationRef","stable","ngswCommChannelFactory","opts","SwRegistrationOptions","provideServiceWorker","makeEnvironmentProviders","PLATFORM_ID","APP_INITIALIZER","Injector","ServiceWorkerModule","_ServiceWorkerModule","ɵɵdefineNgModule","ɵɵdefineInjector","WebPushService","constructor","http","swPush","authService","STORAGE_KEY","VAPID_PUBLIC_KEY","environment","vapidPublicKey","restPath","api","requestPermission","from","requestSubscription","serverPublicKey","pipe","mergeMap","sub","setLastPermissionRequestDate","updateWebPushSubscription","catchError","error","console","message","subscription","post","muteNotifications","status","tap","updateLoggedUser","subscriptionOlderThanDays","days","lastPermissionRequestDate","getLastPermissionRequestDate","Date","getTime","localStorage","setItem","toJSON","val","getItem","isSwEnabled","isEnabled","isIos","isNotificationPermissionGranted","window","Notification","permission","includes","navigator","platform","userAgent","document","ɵɵinject","HttpClient","SwPush","AuthService","factory","ɵfac","providedIn","_WebPushService"],"x_google_ignoreList":[1]}