importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js');

firebase.initializeApp({
  apiKey:            'AIzaSyBU2uAZ-czXuCyR69pBlqllBSfyWXu-4DE',
  authDomain:        'sudanna26-d9fec.firebaseapp.com',
  projectId:         'sudanna26-d9fec',
  messagingSenderId: '1012255287874',
  appId:             '1:1012255287874:web:461e331316e2f40c541bdb',
});

const messaging = firebase.messaging();

messaging.onBackgroundMessage(payload => {
  const n = payload.notification || {};
  self.registration.showNotification(n.title || 'سودانا', {
    body:  n.body  || '',
    icon:  '/icon-192.png',
    badge: '/icon-192.png',
    data:  payload.data || {},
    dir:   'rtl',
    lang:  'ar',
  });
});
