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

// // Initialize the Firebase app in the service worker by passing the generated config
// const firebaseConfig = {
// 	apiKey: "AIzaSyAJnzwAxo9mgSjmF6ryJ5kb8LmnS-IKwVA",
// 	authDomain: "vendpinv2.firebaseapp.com",
// 	projectId: "vendpinv2",
// 	storageBucket: "vendpinv2.firebasestorage.app",
// 	messagingSenderId: "382241427333",
// 	appId: "1:382241427333:web:c1ead99dea03f7f4267eec",
// 	measurementId: "G-5FFBGCWNQM",
// };

//  const firebaseConfig = {
// 	apiKey: import.meta.env.VITE_API_KEY,
// 	authDomain: import.meta.env.VITE_AUTH_DOMAIN,
// 	projectId: import.meta.env.VITE_PROJECT_ID,
// 	storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
// 	messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
// 	appId: import.meta.env.VITE_APP_ID,
// 	measurementId: import.meta.env.VITE_MEASUREMENT_ID,
// };
const firebaseConfig = {
	apiKey: "AIzaSyAJnzwAxo9mgSjmF6ryJ5kb8LmnS-IKwVA",
	authDomain: "vendpinv2.firebaseapp.com",
	projectId: "vendpinv2",
	storageBucket: "vendpinv2.firebasestorage.app",
	messagingSenderId: "382241427333",
	appId: "1:382241427333:web:c1ead99dea03f7f4267eec",
	measurementId: "G-5FFBGCWNQM",
};

firebase.initializeApp(firebaseConfig);

const messaging = firebase.messaging();

messaging.onBackgroundMessage(function (payload) {
	console.log(
		"[firebase-messaging-sw.js] Received background message ",
		payload
	);

	const notificationTitle = payload.notification.title;
	const notificationOptions = {
		body: payload.notification.body,
	};

	self.registration.showNotification(notificationTitle, notificationOptions);
});
