ReamazePushAgent={initialize:function(){window.ReamazePushData&&(this.data=window.ReamazePushData,this.handleSubscription()),window.addEventListener("ReamazePushDataInit",function(){this.data=window.ReamazePushData,this.handleSubscription()}.bind(this))},handleSubscription:function(){var e="serviceWorker"in navigator&&"PushManager"in window,t="undefined"!=typeof Notification?Notification.permission:null;void 0!==this.data.customVapidToken?this.data.customVapidToken&&this.saveVapidToken(this.data.customVapidToken):e&&"granted"==t&&this._nonReamazeDomain()&&this.registerServiceWorker()},saveVapidToken:function(e){httpRequest=new XMLHttpRequest,httpRequest.open("POST",this.data.baseDataUrl+"/data/push_tokens.json",!0),httpRequest.setRequestHeader("Content-Type","application/json");var t=JSON.stringify({sso:this.data.currentUser.ssoData(),push_token:{token:e,token_name:null,device_id:null,platform:"vapid",status:this.data.subscribed?"active":"paused"}});httpRequest.send(t)},applicationKey:function(){return this.urlB64ToUint8Array(this.data.publicKey?this.data.publicKey:"BB4X1o9wQvuF7xVsk1NSgSLQlw-UB-NvdYvpc67vxa9GuHOKCBhXM9QyJUiaAAtSILVblrunLrQeuMOYImJuoI8")},resetSubscription:function(e){e.pushManager.getSubscription().then(function(t){var i=this.applicationKey(),n=t?new Uint8Array(t.options.applicationServerKey):[];!t||!this.data.enabled||i.length===n.length&&i.every((function(e,t){return e===n[t]}))?t||this.subscribeToken(e):t.unsubscribe().then((function(){this.subscribeToken(e)}))}.bind(this))},registerServiceWorker:function(){var e=function(e){worker=null,e.installing?worker=e.installing:e.waiting?worker=e.waiting:e.active&&(worker=e.active),worker&&("activated"==worker.state?this.resetSubscription(e):worker.addEventListener("statechange",function(t){"activated"==t.target.state&&this.resetSubscription(e)}.bind(this)))}.bind(this);navigator.serviceWorker.register("/apps/reamaze/sdks/rmzServiceWorker.js").then(e).catch((function(){navigator.serviceWorker.register("/sdks/rmzServiceWorker.js").then(e).catch((function(){navigator.serviceWorker.register("/content/rmzServiceWorker.js").then(e).catch((function(){navigator.serviceWorker.register("/rmzServiceWorker.js").then(e).catch((function(){}))}))}))})),navigator.serviceWorker.ready.then(function(e){this.subscribeToken(e)}.bind(this))},subscribeToken:function(e){e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:this.applicationKey()}).then(function(e){this.saveVapidToken(JSON.stringify(e.toJSON()))}.bind(this))},urlB64ToUint8Array:function(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),n=new Uint8Array(i.length),a=0;a