1var __IMPORT_META_ENV={};var __PROCESS_ENV={NODE_ENV:"production"}; 2var o="push_notif_enabled",u=` 3self.addEventListener('install', () => self.skipWaiting()); 4self.addEventListener('activate', e => e.waitUntil(self.clients.claim())); 5 6// \xC9coute les messages post\xE9s depuis l'app principale 7self.addEventListener('message', async (event) => { 8 if (event.data?.type !== 'SHOW_NOTIFICATION') return; 9 const { title, options } = event.data; 10 await self.registration.showNotification(title, options || {}); 11}); 12 13// Clic sur la notification \u2192 focus ou ouvrir l'onglet messages 14self.addEventListener('notificationclick', (event) => { 15 event.notification.close(); 16 const url = (event.notification.data && event.notification.data.url) || '/dashboard/messages'; 17 event.waitUntil( 18 self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then(clients => { 19 const existing = clients.find(c => c.url.includes(url) || c.url.includes('/dashboard')); 20 if (existing) return existing.focus(); 21 return self.clients.openWindow(url); 22 }) 23 ); 24}); 25`;function r(){return typeof window<"u"&&"Notification"in window&&"serviceWorker"in navigator}function a(){try{return sessionStorage.getItem(o)!=="false"}catch{return!0}}function f(e){try{sessionStorage.setItem(o,e?"true":"false"),localStorage.setItem("notif_enabled",e?"true":"false")}catch{}}var t=null,n=null;async function c(){if(!r())return null;if(t)return t;try{if(!n){let e=new Blob([u],{type:"application/javascript"});n=URL.createObjectURL(e)}return t=await navigator.serviceWorker.register(n,{scope:"/"}),t}catch{try{if(n)return t=await navigator.serviceWorker.register(n),t}catch{}return null}}async function l(){if(t)return t;if(!r())return null;try{let e=await navigator.serviceWorker.getRegistration();return e?(t=e,e):await c()}catch{return null}}async function d(){return r()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":await Notification.requestPermission():"unsupported"}async function g(e){if(!r()||Notification.permission!=="granted"||!a())return!1;let i={body:e.body,icon:e.icon,badge:e.badge,tag:e.tag||"msg-notif",renotify:!0,silent:!1,data:{url:"/dashboard/messages",...e.data??{}}},s=await l();if(s?.active)return s.active.postMessage({type:"SHOW_NOTIFICATION",title:e.title,options:i}),!0;if(s?.showNotification)try{return await s.showNotification(e.title,i),!0}catch{}try{return new Notification(e.title,i),!0}catch{return!1}}function p(){let e=r(),i=e?Notification.permission:"unsupported";return{supported:e,permission:i,swReady:!!t,enabled:a()}}export{r as a,a as b,f as c,c as d,l as e,d as f,g,p as h};
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.