(()=>{var n;function e(){if(!n){n=r("meta_data","client")}return n}function t(n){return new Promise(function(e,t){n.oncomplete=n.onsuccess=function(){return e(n.result)};n.onabort=n.onerror=function(){return t(n.error)}})}function r(n,e){var r=indexedDB.open(n);r.onupgradeneeded=function(){return r.result.createObjectStore(e)};var i=t(r);return function(n,t){return i.then(function(r){return t(r.transaction(e,n).objectStore(e))})}}function i(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:e();return r("readonly",function(e){return t(e.get(n))})}function o(n,r){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e();return i("readwrite",function(e){e.put(r,n);return t(e.transaction)})}self.addEventListener("push",function(n){if(!self.registration){console.warn("Notification not Registered.");return}var e=n.data.json();i("client_id").then(function(n){i("browser_key").then(function(t){var r=!e.client_id||!n||e.client_id!=n;var i=!e.browser_key||!t||e.browser_key!=t;if(i||r){return}self.registration.showNotification(e.title,e)})})});self.addEventListener("notificationclick",function(n){if(n.notification.data.url){clients.openWindow(n.notification.data.url)}n.notification.close()});self.addEventListener("message",function(n){var e=JSON.parse(n.data);o("client_id",e.client_id).then(function(){})["catch"](function(n){return console.warn("Client ID saving failed!",n)});o("browser_key",e.browser_key).then(function(){})["catch"](function(n){return console.warn("Browser ID saving failed!",n)})})})();