var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); !function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=26)}([function(e,t,i){"use strict";i.d(t,"a",function(){return n});class n{static shouldLog(){try{if("undefined"==typeof window||void 0===window.localStorage)return!1;const e=window.localStorage.getItem("loglevel");return!(!e||"trace"!==e.toLowerCase())}catch(e){return!1}}static setLevel(e){if("undefined"!=typeof window&&void 0!==window.localStorage)try{window.localStorage.setItem("loglevel",e),n.proxyMethodsCreated=void 0,n.createProxyMethods()}catch(e){return}}static createProxyMethods(){if(void 0!==n.proxyMethodsCreated)return;n.proxyMethodsCreated=!0;const e={log:"debug",trace:"trace",info:"info",warn:"warn",error:"error"};for(const t of Object.keys(e)){const i=void 0!==console[t],o=e[t],s=i&&(n.shouldLog()||"error"===o);n[o]=s?console[t].bind(console):function(){}}}}n.createProxyMethods()},function(e,t,i){"use strict";i.d(t,"g",function(){return h}),i.d(t,"n",function(){return p}),i.d(t,"u",function(){return f}),i.d(t,"c",function(){return m}),i.d(t,"o",function(){return b}),i.d(t,"w",function(){return S}),i.d(t,"i",function(){return v}),i.d(t,"q",function(){return y}),i.d(t,"p",function(){return O}),i.d(t,"b",function(){return w}),i.d(t,"e",function(){return E}),i.d(t,"a",function(){return P}),i.d(t,"t",function(){return I}),i.d(t,"l",function(){return T}),i.d(t,"j",function(){return C}),i.d(t,"h",function(){return A}),i.d(t,"r",function(){return N}),i.d(t,"v",function(){return M}),i.d(t,"f",function(){return k}),i.d(t,"x",function(){return x}),i.d(t,"s",function(){return _}),i.d(t,"k",function(){return R}),i.d(t,"d",function(){return D}),i.d(t,"m",function(){return W});var n=i(4),o=i.n(n),s=i(2),r=i(5),a=(i(3),i(0)),c=i(9),l=i(16),u=i(21),d=i(6),g=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};function h(e){return u.a.decodeHtmlEntities(e)}function p(){return o.a.chrome||o.a.chromium||o.a.opera||o.a.yandexbrowser}function f(e){var t=document.querySelectorAll(e);if(t.length>0)for(let e=0;e{OneSignal.initialized?e():OneSignal.emitter.once(OneSignal.EVENTS.SDK_INITIALIZED,e)})})}function b(){return c.a.isUsingSubscriptionWorkaround()}function S(e=!1){return g(this,void 0,void 0,function*(){return l.a.triggerNotificationPermissionChanged(e)})}function v(e,...t){if(e)return e.apply(null,t)}function y(e,...t){return c.a.logMethodCall(e,...t)}function O(e){return!!e&&!!e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}function w(e,t,i){let n;if(!(n="string"==typeof e?document.querySelector(e):e))throw new Error(`${e} must be a CSS selector string or DOM Element object.`);n.insertAdjacentHTML(t,i)}function E(e){if("string"==typeof e){const t=document.querySelector(e);if(null===t)throw new Error(`Cannot find element with selector "${e}"`);for(;t.firstChild;)t.removeChild(t.firstChild)}else{if("object"!=typeof e)throw new Error(`${e} must be a CSS selector string or DOM Element object.`);for(;e.firstChild;)e.removeChild(e.firstChild)}}function P(e,t){if("string"==typeof e){const i=document.querySelector(e);if(null===i)throw new Error(`Cannot find element with selector "${e}"`);i.classList.add(t)}else{if("object"!=typeof e)throw new Error(`${e} must be a CSS selector string or DOM Element object.`);e.classList.add(t)}}function I(e,t){if("string"==typeof e){const i=document.querySelector(e);if(null===i)throw new Error(`Cannot find element with selector "${e}"`);i.classList.remove(t)}else{if("object"!=typeof e)throw new Error(`${e} must be a CSS selector string or DOM Element object.`);e.classList.remove(t)}}function T(e,t){if("string"==typeof e){const i=document.querySelector(e);if(null===i)throw new Error(`Cannot find element with selector "${e}"`);return i.classList.contains(t)}if("object"==typeof e)return e.classList.contains(t);throw new Error(`${e} must be a CSS selector string or DOM Element object.`)}function C(e){return d.a.getConsoleStyle(e)}function A(e){return new Promise(t=>{setTimeout(t,e)})}function N(){return Promise.resolve()}function M(e,t){return d.a.timeoutPromise(e,t)}function k(e,t){return d.a.contains(e,t)}function x(){return a.a.warn("OneSignal: Unsubscribing from push."),s.a.getWindowEnv()!==r.a.ServiceWorker?self.registration.pushManager.getSubscription().then(e=>{if(e)return e.unsubscribe();throw new Error("Cannot unsubscribe because not subscribed.")}):b()?new Promise((e,t)=>{a.a.debug("Unsubscribe from push got called, and we're going to remotely execute it in HTTPS iFrame."),OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_FROM_PUSH,null,i=>{a.a.debug("Unsubscribe from push succesfully remotely executed."),i.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():t("Failed to remotely unsubscribe from push.")})}):navigator.serviceWorker&&navigator.serviceWorker.controller?navigator.serviceWorker.ready.then(e=>e.pushManager).then(e=>e.getSubscription()).then(e=>e?e.unsubscribe():Promise.resolve()):Promise.resolve()}function _(e,t,i,n=!1){if(t||a.a.error("Cannot call on() with no event: ",t),i||a.a.error("Cannot call on() with no task: ",i),"string"==typeof e){let n=document.querySelectorAll(e);if(n.length>0)for(let e=0;e{OneSignal.emitter.once(e,e=>{if(t){t(e)&&i(e)}else i(e)})})})}function W(){window.__oneSignalSdkLoadCount=R()+1}},function(e,t,i){"use strict";i.d(t,"a",function(){return g});var n=i(15),o=i(20),s=i(5),r=i(8),a=i(14),c=i(12),l=i(10),u=i(9),d=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class g{static getBuildEnv(){return n.a.Production}static getIntegration(e){return d(this,void 0,void 0,function*(){if(l.a.isSafari())return a.a.Secure;const t=window===window.top,i="https:"===window.location.protocol;if(void 0===e){if("undefined"==typeof OneSignal||!OneSignal.context||!OneSignal.context.appConfig)throw new r.a("usingProxyOrigin",r.b.Empty);e=!!OneSignal.context.appConfig.subdomain}if(t)return i?e?a.a.SecureProxy:a.a.Secure:!u.b.isLocalhostAllowedAsSecureOrigin()||"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname?a.a.InsecureProxy:a.a.Secure;if(i){return(yield g.isFrameContextInsecure())?a.a.InsecureProxy:e?a.a.SecureProxy:a.a.Secure}return a.a.InsecureProxy})}static isFrameContextInsecure(){return d(this,void 0,void 0,function*(){if(window===window.top||!("serviceWorker"in navigator)||void 0===navigator.serviceWorker.getRegistration)return!1;return!(yield c.b.getRegistration())})}static isInsecureOrigin(){return"http:"===window.location.protocol}static getWindowEnv(){return"undefined"==typeof window?"undefined"!=typeof self&&void 0!==self.registration?s.a.ServiceWorker:s.a.Unknown:window===window.top?-1!==location.href.indexOf("initOneSignal")||"/subscribe"===location.pathname&&""===location.search&&(location.hostname.endsWith(".onesignal.com")||location.hostname.endsWith(".os.tc")||-1!==location.hostname.indexOf(".localhost")&&g.getBuildEnv()===n.a.Development)?s.a.OneSignalSubscriptionPopup:s.a.Host:"/webPushIframe"===location.pathname?s.a.OneSignalProxyFrame:"/webPushModal"===location.pathname?s.a.OneSignalSubscriptionModal:s.a.CustomIframe}static getTestEnv(){return o.a.None}static getBuildEnvPrefix(e=g.getBuildEnv()){switch(e){case n.a.Development:return"Dev-";case n.a.Staging:return"Staging-";case n.a.Production:return"";default:throw new r.a("buildEnv",r.b.EnumOutOfRange)}}static getOneSignalApiUrl(e=g.getBuildEnv()){switch(e){case n.a.Development:return new URL("https://web.archive.org/web/20190510161927/https://localhost:3001/api/v1");case n.a.Staging:return new URL(`https://${window.location.host}/api/v1`);case n.a.Production:return new URL("https://web.archive.org/web/20190510161927/https://onesignal.com/api/v1");default:throw new r.a("buildEnv",r.b.EnumOutOfRange)}}static getOneSignalResourceUrlPath(e=g.getBuildEnv()){const t=g.getOneSignalApiUrl(e).origin;let i;switch(e){case n.a.Development:case n.a.Staging:case n.a.Production:i="/sdks";break;default:throw new r.a("buildEnv",r.b.EnumOutOfRange)}return new URL(t+i)}static getOneSignalCssFileName(e=g.getBuildEnv()){switch(e){case n.a.Development:return"Dev-OneSignalSDKStyles.css";case n.a.Staging:return"Staging-OneSignalSDKStyles.css";case n.a.Production:return"OneSignalSDKStyles.css";default:throw new r.a("buildEnv",r.b.EnumOutOfRange)}}}},function(e,t,i){"use strict";var n=i(17),o=i(22);class s{}class r{}var a=i(18),c=i(20),l=i(5),u=i(19),d=i(2),g=i(9),h=i(6);i.d(t,"a",function(){return b});var p,f,m=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};(f=p||(p={}))[f.SET=0]="SET";class b{constructor(e){this.databaseName=e,this.emitter=new n.a,this.database=new o.a(this.databaseName)}static resetInstance(){b.databaseInstance=null}static get singletonInstance(){return b.databaseInstanceName||(b.databaseInstanceName="ONE_SIGNAL_SDK_DB"),b.databaseInstance||(b.databaseInstance=new b(b.databaseInstanceName)),b.databaseInstance}static applyDbResultFilter(e,t,i){switch(e){case"Options":return i&&t?i.value:i&&!t?i:null;case"Ids":return i&&t?i.id:i&&!t?i:null;case"NotificationOpened":return i&&t?{data:i.data,timestamp:i.timestamp}:i&&!t?i:null;default:return i||null}}get(e,t){return m(this,void 0,void 0,function*(){if(d.a.getWindowEnv()!==l.a.ServiceWorker&&g.b.isUsingSubscriptionWorkaround()&&d.a.getTestEnv()===c.a.None)return yield new Promise(i=>m(this,void 0,void 0,function*(){OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET,[{table:e,key:t}],e=>{let t=e.data[0];i(t)})}));{const i=yield this.database.get(e,t);return b.applyDbResultFilter(e,t,i)}})}put(e,t){return m(this,void 0,void 0,function*(){yield new Promise((i,n)=>m(this,void 0,void 0,function*(){d.a.getWindowEnv()!==l.a.ServiceWorker&&g.b.isUsingSubscriptionWorkaround()&&d.a.getTestEnv()===c.a.None?OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_PUT,[{table:e,keypath:t}],o=>{o.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?i():n(`(Database) Attempted remote IndexedDB put(${e}, ${t}), but did not get success response.`)}):(yield this.database.put(e,t),i())})),this.emitter.emit(b.EVENTS.SET,t)})}remove(e,t){return d.a.getWindowEnv()!==l.a.ServiceWorker&&g.b.isUsingSubscriptionWorkaround()&&d.a.getTestEnv()===c.a.None?new Promise((i,n)=>{OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_REMOVE,[{table:e,keypath:t}],o=>{o.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?i():n(`(Database) Attempted remote IndexedDB remove(${e}, ${t}), but did not get success response.`)})}):this.database.remove(e,t)}getAppConfig(){return m(this,void 0,void 0,function*(){const e={},t=yield this.get("Ids","appId");return e.appId=t,e.subdomain=yield this.get("Options","subdomain"),e.vapidPublicKey=yield this.get("Options","vapidPublicKey"),e.emailAuthRequired=yield this.get("Options","emailAuthRequired"),e})}getExternalUserId(){return m(this,void 0,void 0,function*(){return yield this.get("Ids","externalUserId")})}setExternalUserId(e){return m(this,void 0,void 0,function*(){const t=h.b.getValueOrDefault(e,"");""===t?yield this.remove("Ids","externalUserId"):yield this.put("Ids",{type:"externalUserId",id:t})})}setAppConfig(e){return m(this,void 0,void 0,function*(){e.appId&&(yield this.put("Ids",{type:"appId",id:e.appId})),e.subdomain&&(yield this.put("Options",{key:"subdomain",value:e.subdomain})),!0===e.httpUseOneSignalCom?yield this.put("Options",{key:"httpUseOneSignalCom",value:!0}):!1===e.httpUseOneSignalCom&&(yield this.put("Options",{key:"httpUseOneSignalCom",value:!1})),!0===e.emailAuthRequired?yield this.put("Options",{key:"emailAuthRequired",value:!0}):!1===e.emailAuthRequired&&(yield this.put("Options",{key:"emailAuthRequired",value:!1})),e.vapidPublicKey&&(yield this.put("Options",{key:"vapidPublicKey",value:e.vapidPublicKey}))})}getAppState(){return m(this,void 0,void 0,function*(){const e=new s;return e.defaultNotificationUrl=yield this.get("Options","defaultUrl"),e.defaultNotificationTitle=yield this.get("Options","defaultTitle"),e.lastKnownPushEnabled=yield this.get("Options","isPushEnabled"),e.clickedNotifications=yield this.get("NotificationOpened"),e})}setAppState(e){return m(this,void 0,void 0,function*(){if(e.defaultNotificationUrl&&(yield this.put("Options",{key:"defaultUrl",value:e.defaultNotificationUrl})),(e.defaultNotificationTitle||""===e.defaultNotificationTitle)&&(yield this.put("Options",{key:"defaultTitle",value:e.defaultNotificationTitle})),null!=e.lastKnownPushEnabled&&(yield this.put("Options",{key:"isPushEnabled",value:e.lastKnownPushEnabled})),e.clickedNotifications){const t=Object.keys(e.clickedNotifications);for(let i of t){const t=e.clickedNotifications[i];t?yield this.put("NotificationOpened",{url:i,data:t.data,timestamp:t.timestamp}):null===t&&(yield this.remove("NotificationOpened",i))}}})}getServiceWorkerState(){return m(this,void 0,void 0,function*(){const e=new r;return e.workerVersion=yield this.get("Ids","WORKER1_ONE_SIGNAL_SW_VERSION"),e.updaterWorkerVersion=yield this.get("Ids","WORKER2_ONE_SIGNAL_SW_VERSION"),e.backupNotification=yield this.get("Ids","backupNotification"),e})}setServiceWorkerState(e){return m(this,void 0,void 0,function*(){e.workerVersion&&(yield this.put("Ids",{type:"WORKER1_ONE_SIGNAL_SW_VERSION",id:e.workerVersion})),e.updaterWorkerVersion&&(yield this.put("Ids",{type:"WORKER2_ONE_SIGNAL_SW_VERSION",id:e.updaterWorkerVersion})),e.backupNotification&&(yield this.put("Ids",{type:"backupNotification",id:e.backupNotification}))})}getSubscription(){return m(this,void 0,void 0,function*(){const e=new a.a;e.deviceId=yield this.get("Ids","userId"),e.subscriptionToken=yield this.get("Ids","registrationId");const t=yield this.get("Options","optedOut"),i=yield this.get("Options","subscription"),n=yield this.get("Options","subscriptionCreatedAt"),o=yield this.get("Options","subscriptionExpirationTime");return e.optedOut=null!=t?t:null!=i&&!i,e.createdAt=n,e.expirationTime=o,e})}setSubscription(e){return m(this,void 0,void 0,function*(){e.deviceId&&(yield this.put("Ids",{type:"userId",id:e.deviceId})),void 0!==e.subscriptionToken&&(yield this.put("Ids",{type:"registrationId",id:e.subscriptionToken})),null!=e.optedOut&&(yield this.put("Options",{key:"optedOut",value:e.optedOut})),null!=e.createdAt&&(yield this.put("Options",{key:"subscriptionCreatedAt",value:e.createdAt})),null!=e.expirationTime?yield this.put("Options",{key:"subscriptionExpirationTime",value:e.expirationTime}):yield this.remove("Options","subscriptionExpirationTime")})}getEmailProfile(){return m(this,void 0,void 0,function*(){const e=yield this.get("Ids","emailProfile");return e?u.a.deserialize(e):new u.a})}setEmailProfile(e){return m(this,void 0,void 0,function*(){e&&(yield this.put("Ids",{type:"emailProfile",id:e.serialize()}))})}setProvideUserConsent(e){return m(this,void 0,void 0,function*(){yield this.put("Options",{key:"userConsent",value:e})})}getProvideUserConsent(){return m(this,void 0,void 0,function*(){return yield this.get("Options","userConsent")})}static rebuild(){return m(this,void 0,void 0,function*(){return Promise.all([b.singletonInstance.remove("Ids"),b.singletonInstance.remove("NotificationOpened"),b.singletonInstance.remove("Options")])})}static on(...e){return m(this,void 0,void 0,function*(){return b.singletonInstance.emitter.on.apply(b.singletonInstance.emitter,e)})}static setEmailProfile(e){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.setEmailProfile(e)})}static getEmailProfile(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getEmailProfile()})}static setSubscription(e){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.setSubscription(e)})}static getSubscription(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getSubscription()})}static setProvideUserConsent(e){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.setProvideUserConsent(e)})}static getProvideUserConsent(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getProvideUserConsent()})}static setServiceWorkerState(e){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.setServiceWorkerState(e)})}static getServiceWorkerState(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getServiceWorkerState()})}static setAppState(e){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.setAppState(e)})}static getAppState(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getAppState()})}static setAppConfig(e){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.setAppConfig(e)})}static getAppConfig(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getAppConfig()})}static getExternalUserId(){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.getExternalUserId()})}static setExternalUserId(e){return m(this,void 0,void 0,function*(){yield b.singletonInstance.setExternalUserId(e)})}static remove(e,t){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.remove(e,t)})}static put(e,t){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.put(e,t)})}static get(e,t){return m(this,void 0,void 0,function*(){return yield b.singletonInstance.get(e,t)})}}b.EVENTS=p},function(e,t,i){var n;n=function(){var e=!0;function t(t){function i(e){var i=t.match(e);return i&&i.length>1&&i[1]||""}var n,o,s,r=i(/(ipod|iphone|ipad)/i).toLowerCase(),a=!/like android/i.test(t)&&/android/i.test(t),c=/nexus\s*[0-6]\s*/i.test(t),l=!c&&/nexus\s*[0-9]+/i.test(t),u=/CrOS/.test(t),d=/silk/i.test(t),g=/sailfish/i.test(t),h=/tizen/i.test(t),p=/(web|hpw)os/i.test(t),f=/windows phone/i.test(t),m=(/SamsungBrowser/i.test(t),!f&&/windows/i.test(t)),b=!r&&!d&&/macintosh/i.test(t),S=!a&&!g&&!h&&!p&&/linux/i.test(t),v=i(/edge\/(\d+(\.\d+)?)/i),y=i(/version\/(\d+(\.\d+)?)/i),O=/tablet/i.test(t)&&!/tablet pc/i.test(t),w=!O&&/[^-]mobi/i.test(t),E=/xbox/i.test(t);/opera/i.test(t)?n={name:"Opera",opera:e,version:y||i(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(t)?n={name:"Opera",opera:e,version:i(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||y}:/SamsungBrowser/i.test(t)?n={name:"Samsung Internet for Android",samsungBrowser:e,version:y||i(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(t)?n={name:"Opera Coast",coast:e,version:y||i(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(t)?n={name:"Yandex Browser",yandexbrowser:e,version:y||i(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(t)?n={name:"UC Browser",ucbrowser:e,version:i(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(t)?n={name:"Maxthon",maxthon:e,version:i(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(t)?n={name:"Epiphany",epiphany:e,version:i(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(t)?n={name:"Puffin",puffin:e,version:i(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(t)?n={name:"Sleipnir",sleipnir:e,version:i(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(t)?n={name:"K-Meleon",kMeleon:e,version:i(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:f?(n={name:"Windows Phone",windowsphone:e},v?(n.msedge=e,n.version=v):(n.msie=e,n.version=i(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(t)?n={name:"Internet Explorer",msie:e,version:i(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:u?n={name:"Chrome",chromeos:e,chromeBook:e,chrome:e,version:i(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(t)?n={name:"Microsoft Edge",msedge:e,version:v}:/vivaldi/i.test(t)?n={name:"Vivaldi",vivaldi:e,version:i(/vivaldi\/(\d+(\.\d+)?)/i)||y}:g?n={name:"Sailfish",sailfish:e,version:i(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?n={name:"SeaMonkey",seamonkey:e,version:i(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(t)?(n={name:"Firefox",firefox:e,version:i(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(n.firefoxos=e)):d?n={name:"Amazon Silk",silk:e,version:i(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(t)?n={name:"PhantomJS",phantom:e,version:i(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(t)?n={name:"SlimerJS",slimer:e,version:i(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?n={name:"BlackBerry",blackberry:e,version:y||i(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:p?(n={name:"WebOS",webos:e,version:y||i(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(n.touchpad=e)):/bada/i.test(t)?n={name:"Bada",bada:e,version:i(/dolfin\/(\d+(\.\d+)?)/i)}:h?n={name:"Tizen",tizen:e,version:i(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||y}:/qupzilla/i.test(t)?n={name:"QupZilla",qupzilla:e,version:i(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||y}:/chromium/i.test(t)?n={name:"Chromium",chromium:e,version:i(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||y}:/chrome|crios|crmo/i.test(t)?n={name:"Chrome",chrome:e,version:i(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:a?n={name:"Android",version:y}:/safari|applewebkit/i.test(t)?(n={name:"Safari",safari:e},y&&(n.version=y)):r?(n={name:"iphone"==r?"iPhone":"ipad"==r?"iPad":"iPod"},y&&(n.version=y)):n=/googlebot/i.test(t)?{name:"Googlebot",googlebot:e,version:i(/googlebot\/(\d+(\.\d+))/i)||y}:{name:i(/^(.*)\/(.*) /),version:(o=/^(.*)\/(.*) /,s=t.match(o),s&&s.length>1&&s[2]||"")},!n.msedge&&/(apple)?webkit/i.test(t)?(/(apple)?webkit\/537\.36/i.test(t)?(n.name=n.name||"Blink",n.blink=e):(n.name=n.name||"Webkit",n.webkit=e),!n.version&&y&&(n.version=y)):!n.opera&&/gecko\//i.test(t)&&(n.name=n.name||"Gecko",n.gecko=e,n.version=n.version||i(/gecko\/(\d+(\.\d+)?)/i)),n.windowsphone||n.msedge||!a&&!n.silk?n.windowsphone||n.msedge||!r?b?n.mac=e:E?n.xbox=e:m?n.windows=e:S&&(n.linux=e):(n[r]=e,n.ios=e):n.android=e;var P="";n.windows?P=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(i(/Windows ((NT|XP)( \d\d?.\d)?)/i)):n.windowsphone?P=i(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):n.mac?P=(P=i(/Mac OS X (\d+([_\.\s]\d+)*)/i)).replace(/[_\s]/g,"."):r?P=(P=i(/os (\d+([_\s]\d+)*) like mac os x/i)).replace(/[_\s]/g,"."):a?P=i(/android[ \/-](\d+(\.\d+)*)/i):n.webos?P=i(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):n.blackberry?P=i(/rim\stablet\sos\s(\d+(\.\d+)*)/i):n.bada?P=i(/bada\/(\d+(\.\d+)*)/i):n.tizen&&(P=i(/tizen[\/\s](\d+(\.\d+)*)/i)),P&&(n.osversion=P);var I=!n.windows&&P.split(".")[0];return O||l||"ipad"==r||a&&(3==I||I>=4&&!w)||n.silk?n.tablet=e:(w||"iphone"==r||"ipod"==r||a||c||n.blackberry||n.webos||n.bada)&&(n.mobile=e),n.msedge||n.msie&&n.version>=10||n.yandexbrowser&&n.version>=15||n.vivaldi&&n.version>=1||n.chrome&&n.version>=20||n.samsungBrowser&&n.version>=4||n.firefox&&n.version>=20||n.safari&&n.version>=6||n.opera&&n.version>=10||n.ios&&n.osversion&&n.osversion.split(".")[0]>=6||n.blackberry&&n.version>=10.1||n.chromium&&n.version>=20?n.a=e:n.msie&&n.version<10||n.chrome&&n.version<20||n.firefox&&n.version<20||n.safari&&n.version<6||n.opera&&n.version<10||n.ios&&n.osversion&&n.osversion.split(".")[0]<6||n.chromium&&n.version<20?n.c=e:n.x=e,n}var i=t("undefined"!=typeof navigator&&navigator.userAgent||"");function n(e){return e.split(".").length}function o(e,t){var i,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i=0;){if(i[0][t]>i[1][t])return 1;if(i[0][t]!==i[1][t])return-1;if(0===t)return 0}}function r(e,n,o){var r=i;"string"==typeof n&&(o=n,n=void 0),void 0===n&&(n=!1),o&&(r=t(o));var a=""+r.version;for(var c in e)if(e.hasOwnProperty(c)&&r[c]){if("string"!=typeof e[c])throw new Error("Browser version in the minVersion map should be a string: "+c+": "+String(e));return s([a,e[c]])<0}return n}return i.test=function(e){for(var t=0;t"function"==typeof t?"[Function]":t,4)}static encodeHashAsUriComponent(e){let t="";const i=Object.keys(e);for(var n of i){const i=e[n];t+=`${encodeURIComponent(n)}=${encodeURIComponent(i)}`}return t}static timeoutPromise(e,t){const i=new Promise((e,i)=>{setTimeout(()=>{i(new o)},t)});return Promise.race([e,i])}static getValueOrDefault(e,t){return void 0!==e&&null!==e?e:t}static enforceAppId(e){if(!e)throw new Error("App id cannot be empty")}static enforcePlayerId(e){if(!e)throw new Error("Player id cannot be empty")}}t.b=s},function(e,t,i){"use strict";i.d(t,"a",function(){return g});var n=i(10),o=i(2),s=i(5),r=i(0),a=i(6),c=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};const l=["notifyButtonHovering","notifyButtonHover","notifyButtonButtonClick","notifyButtonLauncherClick","animatedElementHiding","animatedElementHidden","animatedElementShowing","animatedElementShown","activeAnimatedElementActivating","activeAnimatedElementActive","activeAnimatedElementInactivating","activeAnimatedElementInactive","dbRetrieved","dbSet","testEvent"],u=["onesignal.prompt.custom.clicked","onesignal.prompt.native.permissionchanged","onesignal.subscription.changed","onesignal.internal.subscriptionset","dbRebuilt","initialize","subscriptionSet","sendWelcomeNotification","subscriptionChange","notificationPermissionChange","dbSet","register","notificationDisplay","notificationDismiss","notificationClick","permissionPromptDisplay","testWouldDisplay","testInitOptionDisabled","popupWindowTimeout"],d={notificationPermissionChange:"onesignal.prompt.native.permissionchanged",subscriptionChange:"onesignal.subscription.changed",customPromptClick:"onesignal.prompt.custom.clicked"};class g{static trigger(e,t,i=null){return c(this,void 0,void 0,function*(){if(!a.b.contains(l,e)){let n=t,s=a.b.capitalize(o.a.getWindowEnv().toString());i&&(s=`${s} ⬸ ${a.b.capitalize(i)}`),n||!1===n?r.a.debug(`(${s}) » %c${e}:`,a.b.getConsoleStyle("event"),n):r.a.debug(`(${s}) » %c${e}`,a.b.getConsoleStyle("event"))}if(n.a.isBrowser()){if(e===OneSignal.EVENTS.SDK_INITIALIZED){if(OneSignal.initialized)return;OneSignal.initialized=!0}yield OneSignal.emitter.emit(e,t)}if(d.hasOwnProperty(e)){let i=d[e];g._triggerLegacy(i,t)}if(n.a.isBrowser()&&(o.a.getWindowEnv()===s.a.OneSignalSubscriptionPopup||o.a.getWindowEnv()===s.a.OneSignalProxyFrame)){opener||parent?a.b.contains(u,e)&&(o.a.getWindowEnv()===s.a.OneSignalSubscriptionPopup?OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,{eventName:e,eventData:t}):OneSignal.proxyFrame.retriggerRemoteEvent(e,t)):r.a.error(`Could not send event '${e}' back to host page because no creator (opener or parent) found!`)}})}static _triggerLegacy(e,t){const i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:t});window.dispatchEvent(i)}}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"a",function(){return InvalidArgumentError});var n,o=i(13);!function(e){e[e.Empty=0]="Empty",e[e.Malformed=1]="Malformed",e[e.EnumOutOfRange=2]="EnumOutOfRange"}(n||(n={}));class InvalidArgumentError extends o.a{constructor(e,t){switch(t){case n.Empty:super(`Supply a non-empty value to '${e}'.`);break;case n.Malformed:super(`The value for '${e}' was malformed.`);break;case n.EnumOutOfRange:super(`The value for '${e}' was out of range of the expected input enum.`)}this.argument=e,this.reason=n[t],Object.setPrototypeOf(this,InvalidArgumentError.prototype)}}},function(e,t,i){"use strict";(function(e){i.d(t,"a",function(){return u});var n=i(4),o=i.n(n),s=i(2),r=i(5),a=i(0),c=i(6),l=i(25);class u{static getBaseUrl(){return location.origin}static isLocalhostAllowedAsSecureOrigin(){return OneSignal.config&&OneSignal.config.userConfig&&!0===OneSignal.config.userConfig.allowLocalhostAsSecureOrigin}static isUsingSubscriptionWorkaround(){const e=s.a.getWindowEnv();if(!OneSignal.config)throw new Error(`(${e.toString()}) isUsingSubscriptionWorkaround() cannot be called until OneSignal.config exists.`);if(o.a.safari)return!1;const t=this.isLocalhostAllowedAsSecureOrigin();return u.internalIsUsingSubscriptionWorkaround(OneSignal.config.subdomain,t)}static internalIsUsingSubscriptionWorkaround(e,t){if(o.a.safari)return!1;if(!0===t&&("localhost"===location.hostname||"127.0.0.1"===location.hostname))return!1;const i=s.a.getWindowEnv();return!(i!==r.a.Host&&i!==r.a.CustomIframe||!e&&"http:"!==location.protocol)}static redetectBrowserUserAgent(){return Object(l.a)()}static isValidUuid(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(e)}static getRandomUuid(){let t="";const i="undefined"==typeof window?e.crypto:window.crypto||window.msCrypto;return t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i?function(e){var t=i.getRandomValues(new Uint8Array(1))[0]%16|0;return("x"==e?t:3&t|8).toString(16)}:function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}static logMethodCall(e,...t){return a.a.debug(`Called %c${e}(${t.map(c.a.stringify).join(", ")})`,c.a.getConsoleStyle("code"),".")}}t.b=u}).call(this,i(28))},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(2),o=i(5),s=i(4),r=i.n(s);class a{static isBrowser(){return"undefined"!=typeof window}static isSafari(){return a.isBrowser()&&r.a.safari}static version(){return Number(150703)}static get TRADITIONAL_CHINESE_LANGUAGE_TAG(){return["tw","hant"]}static get SIMPLIFIED_CHINESE_LANGUAGE_TAG(){return["cn","hans"]}static getLanguage(){let e=navigator.language;if(e){let t=(e=e.toLowerCase()).split("-");if("zh"==t[0]){for(let e of a.TRADITIONAL_CHINESE_LANGUAGE_TAG)if(-1!==t.indexOf(e))return"zh-Hant";for(let e of a.SIMPLIFIED_CHINESE_LANGUAGE_TAG)if(-1!==t.indexOf(e))return"zh-Hans";return"zh-Hant"}return t[0].substring(0,2)}return"en"}static supportsServiceWorkers(){switch(n.a.getWindowEnv()){case o.a.ServiceWorker:return!0;default:return"undefined"!=typeof navigator&&"serviceWorker"in navigator}}static getSdkStylesVersionHash(){return"undefined"==typeof __SRC_STYLESHEETS_MD5_HASH__?"1":__SRC_STYLESHEETS_MD5_HASH__}}},function(e,t,i){"use strict";i.d(t,"b",function(){return n}),i.d(t,"a",function(){return InvalidStateError});var n,o=i(13),s=i(23);!function(e){e[e.MissingAppId=0]="MissingAppId",e[e.RedundantPermissionMessage=1]="RedundantPermissionMessage",e[e.PushPermissionAlreadyGranted=2]="PushPermissionAlreadyGranted",e[e.UnsupportedEnvironment=3]="UnsupportedEnvironment",e[e.MissingDomElement=4]="MissingDomElement",e[e.ServiceWorkerNotActivated=5]="ServiceWorkerNotActivated",e[e.NoProxyFrame=6]="NoProxyFrame"}(n||(n={}));class InvalidStateError extends o.a{constructor(e,t){switch(e){case n.MissingAppId:super("Missing required app ID.");break;case n.RedundantPermissionMessage:let i="";t&&t.permissionPromptType&&(i=`(${s.a[t.permissionPromptType]})`),super(`Another permission message ${i} is being displayed.`);break;case n.PushPermissionAlreadyGranted:super("Push permission has already been granted.");break;case n.UnsupportedEnvironment:super("The current environment does not support this operation.");break;case n.ServiceWorkerNotActivated:super("The service worker must be activated first.");break;case n.NoProxyFrame:super("No proxy frame.")}this.description=n[e],this.reason=e,Object.setPrototypeOf(this,InvalidStateError.prototype)}}},function(e,t,i){"use strict";i.d(t,"b",function(){return c}),i.d(t,"a",function(){return n});var n,o=i(0),s=i(11),r=i(9),a=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class c{static getRegistration(){return a(this,void 0,void 0,function*(){try{return yield navigator.serviceWorker.getRegistration(location.href)}catch(e){return o.a.warn("[Service Worker Status] Error Checking service worker registration",location.href,e),null}})}static getServiceWorkerHref(e,t){let i="";if(e===n.WorkerA)i=t.workerBPath.getFullPath();else if(e===n.WorkerB||e===n.ThirdParty||e===n.None)i=t.workerAPath.getFullPath();else if(e===n.Bypassed)throw new s.a(s.b.UnsupportedEnvironment);return new URL(i,r.a.getBaseUrl()).href}}!function(e){e.WorkerA="Worker A (Main)",e.WorkerB="Worker B (Updater)",e.ThirdParty="3rd Party",e.Installing="Installing",e.None="None",e.Bypassed="Bypassed",e.Indeterminate="Indeterminate"}(n||(n={}))},function(e,t,i){"use strict";i.d(t,"a",function(){return n});class n extends Error{constructor(e=""){super(e),Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:this.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):(Object.defineProperty(this,"stack",{configurable:!0,enumerable:!1,value:new Error(e).stack,writable:!0}),Object.setPrototypeOf(this,n.prototype))}}},function(e,t,i){"use strict";var n;i.d(t,"a",function(){return n}),function(e){e.Secure="Secure",e.SecureProxy="Secure Proxy",e.InsecureProxy="Insecure Proxy"}(n||(n={}))},function(e,t,i){"use strict";var n;i.d(t,"a",function(){return n}),function(e){e.Development="Development",e.Staging="Staging",e.Production="Production"}(n||(n={}))},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(3),o=i(7),s=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class r{static triggerNotificationPermissionChanged(e=!1){return s(this,void 0,void 0,function*(){const t=yield OneSignal.privateGetNotificationPermission();(t!==(yield n.a.get("Options","notificationPermission"))||e)&&(yield n.a.put("Options",{key:"notificationPermission",value:t}),o.a.trigger(OneSignal.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,{to:t}))})}}},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class o{constructor(){this._events={}}on(e,t){return this._events[e]=this._events[e]||[],this._events[e].push(t),this}once(e,t){const i=this;function n(){i.off(e,n),t.apply(this,arguments)}return n.listener=t,this.on(e,n),this}off(e,t){const i=this._events[e];if(void 0!==i){for(let e=0;e{try{var i=indexedDB.open(e,1)}catch(e){}if(!i)return null;i.onerror=this.onDatabaseOpenError,i.onblocked=this.onDatabaseOpenBlocked,i.onupgradeneeded=this.onDatabaseUpgradeNeeded,i.onsuccess=(()=>{this.database=i.result,this.database.onerror=this.onDatabaseError,this.database.onversionchange=this.onDatabaseVersionChange,t(this.database)})})}ensureDatabaseOpen(){return r(this,void 0,void 0,function*(){return this.openLock||(this.openLock=this.open(this.databaseName)),yield this.openLock,this.database})}onDatabaseOpenError(e){e.preventDefault();const t=e.target.error;s.b.contains(t.message,"The operation failed for reasons unrelated to the database itself and not covered by any other error code")||s.b.contains(t.message,"A mutation operation was attempted on a database that did not allow mutations")?o.a.warn("OneSignal: IndexedDb web storage is not available on this origin since this profile's IndexedDb schema has been upgraded in a newer version of Firefox. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1236557#c6"):o.a.warn("OneSignal: Fatal error opening IndexedDb database:",t)}onDatabaseError(e){o.a.debug("IndexedDb: Generic database error",e.target.errorCode)}onDatabaseOpenBlocked(){o.a.debug("IndexedDb: Blocked event")}onDatabaseVersionChange(e){o.a.debug("IndexedDb: versionchange event")}onDatabaseUpgradeNeeded(e){o.a.debug("IndexedDb: Database is being rebuilt or upgraded (upgradeneeded event).");const t=e.target.result;t.createObjectStore("Ids",{keyPath:"type"}),t.createObjectStore("NotificationOpened",{keyPath:"url"}),t.createObjectStore("Options",{keyPath:"key"}),"undefined"!=typeof OneSignal&&(OneSignal._isNewVisitor=!0)}get(e,t){return r(this,void 0,void 0,function*(){return yield this.ensureDatabaseOpen(),t?yield new Promise((i,n)=>{var o=this.database.transaction(e).objectStore(e).get(t);o.onsuccess=(()=>{i(o.result)}),o.onerror=(()=>{n(o.error)})}):yield new Promise((t,i)=>{let n={},o=this.database.transaction(e).objectStore(e).openCursor();o.onsuccess=(e=>{var i=e.target.result;if(i){let e=i.key;n[e]=i.value,i.continue()}else t(n)}),o.onerror=(()=>{i(o.error)})})})}put(e,t){return r(this,void 0,void 0,function*(){return yield this.ensureDatabaseOpen(),yield new Promise((i,n)=>{try{let s=this.database.transaction([e],"readwrite").objectStore(e).put(t);s.onsuccess=(()=>{i(t)}),s.onerror=(e=>{o.a.error("Database PUT Transaction Error:",e),n(e)})}catch(e){o.a.error("Database PUT Error:",e),n(e)}})})}remove(e,t){if(t)var i="delete";else i="clear";return new Promise((n,s)=>{try{let r=this.database.transaction([e],"readwrite").objectStore(e)[i](t);r.onsuccess=(()=>{n(t)}),r.onerror=(e=>{o.a.error("Database REMOVE Transaction Error:",e),s(e)})}catch(e){o.a.error("Database REMOVE Error:",e),s(e)}})}}},function(e,t,i){"use strict";var n;i.d(t,"a",function(){return n}),function(e){e[e.HttpsPermissionRequest="HTTPS permission request"]="HttpsPermissionRequest",e[e.FullscreenHttpPermissionMessage="fullscreen HTTP permission message"]="FullscreenHttpPermissionMessage",e[e.FullscreenHttpsPermissionMessage="fullscreen HTTPS permission message"]="FullscreenHttpsPermissionMessage",e[e.SlidedownPermissionMessage="slidedown permission message"]="SlidedownPermissionMessage",e[e.SubscriptionBell="subscription bell"]="SubscriptionBell"}(n||(n={}))},function(e,t){e.exports=function(e,t,o){"function"==typeof t&&(o=t,t={});t||(t={});var s,r,a=t.prefix||"__jp",c=t.name||a+i++,l=t.param||"callback",u=null!=t.timeout?t.timeout:6e4,d=encodeURIComponent,g=document.getElementsByTagName("script")[0]||document.head;u&&(r=setTimeout(function(){h(),o&&o(new Error("Timeout"))},u));function h(){s.parentNode&&s.parentNode.removeChild(s),window[c]=n,r&&clearTimeout(r)}return window[c]=function(e){h(),o&&o(null,e)},e=(e+=(~e.indexOf("?")?"&":"?")+l+"="+d(c)).replace("?&","?"),(s=document.createElement("script")).src=e,g.parentNode.insertBefore(s,g),function(){window[c]&&h()}};var i=0;function n(){}},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(4),o=i.n(n);function s(){let e;return e=""===o.a.name&&""===o.a.version?o.a._detect(navigator.userAgent):o.a}},function(e,t,i){"use strict";i.r(t);var n=i(0),o=i(1);class s{static doReplay(e){e&&(Array.isArray(e)?s.processAsArray(e):e.constructor&&"OneSignalStubES6"===e.constructor.name?s.processAsES6Stub(e):n.a.error("window.OneSignal is an unexpected type! Should be an Array, OneSignalStubES6, or undefined."))}static processAsArray(e){for(const t of e)try{OneSignal.push(t)}catch(e){n.a.error(e)}}static processAsES6Stub(e){e.SERVICE_WORKER_PATH&&(OneSignal.SERVICE_WORKER_PATH=e.SERVICE_WORKER_PATH),e.SERVICE_WORKER_UPDATER_PATH&&(OneSignal.SERVICE_WORKER_UPDATER_PATH=e.SERVICE_WORKER_UPDATER_PATH),e.currentLogLevel&&OneSignal.log.setLevel(e.currentLogLevel),e.SERVICE_WORKER_PARAM&&(OneSignal.SERVICE_WORKER_PARAM=e.SERVICE_WORKER_PARAM),e.preExistingArray&&s.processAsArray(e.preExistingArray);for(const t of e.directFunctionCallsArray){const e=OneSignal[t.functionName].apply(OneSignal,t.args);t.delayedPromise&&e instanceof Promise&&e.then(function(...e){t.delayedPromise&&t.delayedPromise.resolve&&t.delayedPromise.resolve.apply(null,e)}).catch(function(...e){t.delayedPromise&&t.delayedPromise.reject&&t.delayedPromise.reject.apply(null,e)})}}}"undefined"!=typeof window&&function(){if(Object(o.m)(),Object(o.k)()>1)return n.a.warn("OneSignal: The web push SDK is included more than once. For optimal performance, please include our SDK only once on your page."),void n.a.debug("OneSignal: Exiting from SDK initialization to prevent double-initialization errors. "+`Occurred ${Object(o.k)()} times.`);const e=window.OneSignal;window.OneSignal=i(27).default,s.doReplay(e)}()},function(e,t,i){"use strict";i.r(t);var n,o,s,r,a=i(4),c=i.n(a),l=i(10),InvalidArgumentError=i(8),InvalidStateError=i(11),u=i(13);(o=n||(n={}))[o.Unknown=0]="Unknown",o[o.NoDeviceId=1]="NoDeviceId",o[o.NoEmailSet=2]="NoEmailSet",o[o.OptedOut=3]="OptedOut";class d extends u.a{constructor(e){switch(e){case n.Unknown||n.NoDeviceId:super("This operation can only be performed after the user is subscribed.");break;case n.NoEmailSet:super("No email is currently set.");break;case n.OptedOut:super("The user has manually opted out of receiving of notifications. This operation can only be performed after the user is fully resubscribed.")}this.reason=n[e],Object.setPrototypeOf(this,d.prototype)}}(r=s||(s={}))[r.InvalidAppId=0]="InvalidAppId",r[r.AppNotConfiguredForWebPush=1]="AppNotConfiguredForWebPush",r[r.MissingSubdomain=2]="MissingSubdomain",r[r.WrongSiteUrl=3]="WrongSiteUrl",r[r.MultipleInitialization=4]="MultipleInitialization",r[r.MissingSafariWebId=5]="MissingSafariWebId",r[r.Unknown=6]="Unknown";class g extends u.a{constructor(e,t){switch(e){case s.InvalidAppId:super("OneSignal: This app ID does not match any existing app. Double check your app ID.");break;case s.AppNotConfiguredForWebPush:super("OneSignal: This app ID does not have any web platforms enabled. Double check your app ID, or see step 1 on our setup guide (https://goo.gl/01h7fZ).");break;case s.MissingSubdomain:super("OneSignal: Non-HTTPS pages require a subdomain of OneSignal to be chosen on your dashboard. See step 1.4 on our setup guide (https://goo.gl/xip6JB).");break;case s.WrongSiteUrl:t&&t.siteUrl?super(`OneSignal: This web push config can only be used on ${new URL(t.siteUrl).origin}. Your current origin is ${location.origin}.`):super("OneSignal: This web push config can not be used on the current site.");break;case s.MultipleInitialization:super("OneSignal: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once.");break;case s.MissingSafariWebId:super("OneSignal: Safari browser support on Mac OS X requires the Safari web platform to be enabled. Please see the Safari Support steps in our web setup guide.");break;case s.Unknown:super("OneSignal: An unknown initialization error occurred.")}this.reason=s[e],Object.setPrototypeOf(this,g.prototype)}}var h,p,f,m,b=i(7);class S{static put(e,t){return void 0===S.store[e]&&(S.store[e]=[null,null]),S.store[e].push(t),S.store[e].length==S.LIMIT+1&&S.store[e].shift(),S.store[e]}static get(e){return void 0===S.store[e]&&(S.store[e]=[null,null]),S.store[e]}static getFirst(e){return S.get(e)[0]}static getLast(e){return S.get(e)[1]}static remove(e){delete S.store[e]}static isEmpty(e){let t=S.get(e);return null===t[0]&&null===t[1]}}S.store={},S.LIMIT=2,(p=h||(h={}))[p.MissingAppId=0]="MissingAppId";class v extends u.a{constructor(e){switch(e){case h.MissingAppId:super("The API call is missing an app ID.")}Object.setPrototypeOf(this,v.prototype)}}class y extends u.a{constructor(){super("This code is not implemented yet."),Object.setPrototypeOf(this,y.prototype)}}!function(e){e[e.ChromeLike=5]="ChromeLike",e[e.Safari=7]="Safari",e[e.Firefox=8]="Firefox",e[e.Edge=12]="Edge",e[e.Email=11]="Email"}(f||(f={})),function(e){e.Mobile="mobile",e.Tablet="tablet",e.Desktop="desktop"}(m||(m={}));var O=i(9);class w{constructor(){this.language=l.a.getLanguage(),this.timezone=-60*(new Date).getTimezoneOffset(),this.browserName=c.a.name,this.browserVersion=NaN!==parseInt(String(c.a.version))?parseInt(String(c.a.version)):-1,this.operatingSystem=this.getBrowserOperatingSystem(),this.operatingSystemVersion=String(c.a.osversion),this.devicePlatform=this.getDevicePlatform(),this.deviceModel=navigator.platform,this.sdkVersion=l.a.version().toString(),this.deliveryPlatform=this.getDeliveryPlatform()}getDevicePlatform(){const e=c.a.mobile,t=c.a.tablet;return e?m.Mobile:t?m.Tablet:m.Desktop}isSafari(){return c.a.safari&&void 0!==window.safari&&void 0!==window.safari.pushNotification}getBrowserOperatingSystem(){return c.a.mac?"Mac OS X":c.a.windows?"Microsoft Windows":c.a.windowsphone?"Microsoft Windows Phone":c.a.linux?"Linux":c.a.chromeos?"Google Chrome OS":c.a.android?"Google Android":c.a.ios?"Apple iOS":c.a.blackberry?"Blackberry":c.a.firefoxos?"Mozilla Firefox OS":c.a.webos?"WebOS":c.a.tizen?"Tizen":c.a.sailfish?"Sailfish OS":"Unknown"}getDeliveryPlatform(){const e=O.a.redetectBrowserUserAgent();return this.isSafari()?f.Safari:e.firefox?f.Firefox:e.msedge?f.Edge:f.ChromeLike}serialize(){const e={device_type:this.deliveryPlatform,language:this.language,timezone:this.timezone,device_os:this.browserVersion,sdk:this.sdkVersion,notification_types:this.subscriptionState,delivery_platform:this.deliveryPlatform,browser_name:this.browserName,browser_version:this.browserVersion,operating_system:this.operatingSystem,operating_system_version:this.operatingSystemVersion,device_platform:this.devicePlatform,device_model:this.deviceModel};return this.appId&&(e.app_id=this.appId),e}deserialize(e){throw new y}}class E extends w{constructor(e,t,i){super(),this.email=e,this.emailAuthHash=t,this.pushDeviceRecordId=i,this.deliveryPlatform=f.Email}serialize(){const e=super.serialize();return this.email&&(e.identifier=this.email),this.emailAuthHash&&(e.email_auth_hash=this.emailAuthHash),this.pushDeviceRecordId&&(e.device_player_id=this.pushDeviceRecordId),e}deserialize(e){throw new y}}var P=i(2),I=i(6);class T{static get(e,t,i){return T.call("GET",e,t,i)}static post(e,t,i){return T.call("POST",e,t,i)}static put(e,t,i){return T.call("PUT",e,t,i)}static delete(e,t,i){return T.call("DELETE",e,t,i)}static call(e,t,i,n){if("GET"===e){if(t.indexOf("players")>-1&&-1===t.indexOf("app_id="))return console.error("Calls to player api are not permitted without app_id"),Promise.reject(new v(h.MissingAppId))}else if(t.indexOf("players")>-1&&(!i||!i.app_id))return console.error("Calls to player api are not permitted without app_id"),Promise.reject(new v(h.MissingAppId));let o=new Headers;if(o.append("SDK-Version",`onesignal/web/${l.a.version()}`),o.append("Content-Type","application/json;charset=UTF-8"),n)for(let e of Object.keys(n))o.append(e,n[e]);let s,r={method:e||"NO_METHOD_SPECIFIED",headers:o,cache:"no-cache"};return i&&(r.body=JSON.stringify(i)),fetch(P.a.getOneSignalApiUrl().toString()+"/"+t,r).then(e=>(s=e.status,e.json())).then(e=>{if(s>=200&&s<300)return e;if("no-user-id-error"!==T.identifyError(e))return Promise.reject(e)})}static identifyError(e){if(!e||!e.errors)return"no-error";let t=e.errors;return I.a.contains(t,"No user with this id found")||I.a.contains(t,"Could not find app_id for given player id.")?"no-user-id-error":"unknown-error"}}var C=T,A=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class N{static getPlayer(e,t){return I.b.enforceAppId(e),I.b.enforcePlayerId(t),C.get(`players/${t}?app_id=${e}`)}static updatePlayer(e,t,i){return I.b.enforceAppId(e),I.b.enforcePlayerId(t),C.put(`players/${t}`,Object.assign({app_id:e},i))}static sendNotification(e,t,i,n,o,s,r,a){var c={app_id:e,contents:n,include_player_ids:t,isAnyWeb:!0,data:r,web_buttons:a};return i&&(c.headings=i),o&&(c.url=o),s&&(c.chrome_web_icon=s,c.firefox_icon=s),I.b.trimUndefined(c),C.post("notifications",c)}static createUser(e){return A(this,void 0,void 0,function*(){const t=e.serialize();I.b.enforceAppId(t.app_id);const i=yield C.post("players",t);return i&&i.success?i.id:null})}static createEmailRecord(e,t,i){return A(this,void 0,void 0,function*(){I.b.enforceAppId(e.appId);const n=new E(t.emailAddress,t.emailAuthHash,i);n.appId=e.appId;const o=yield C.post("players",n.serialize());return o&&o.success?o.id:null})}static updateEmailRecord(e,t,i){return A(this,void 0,void 0,function*(){I.b.enforceAppId(e.appId),I.b.enforcePlayerId(t.emailId);const n=new E(t.emailAddress,t.emailAuthHash,i);n.appId=e.appId;const o=yield C.put(`players/${t.emailId}`,n.serialize());return o&&o.success?o.id:null})}static logoutEmail(e,t,i){return A(this,void 0,void 0,function*(){I.b.enforceAppId(e.appId),I.b.enforcePlayerId(i);const n=yield C.post(`players/${i}/email_logout`,{app_id:e.appId,parent_player_id:t.emailId,email_auth_hash:t.emailAuthHash?t.emailAuthHash:void 0});return!(!n||!n.success)})}static updateUserSession(e,t){return A(this,void 0,void 0,function*(){try{const i=t.serialize();I.b.enforceAppId(i.app_id),I.b.enforcePlayerId(e);const n=yield C.post(`players/${e}/on_session`,i);return n.id?n.id:e}catch(e){throw e&&Array.isArray(e.errors)&&e.errors.length>0&&I.b.contains(e.errors[0],"app_id not found")?new v(h.MissingAppId):e}})}}var M=i(3),k=i(0),x=i(1),_=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class R{static initialize(e){return _(this,void 0,void 0,function*(){if(!e||!e.enabled)return;if(k.a.info("Inititalize CustomLink"),0!==(yield OneSignal.context.dynamicResourceLoader.loadSdkStylesheet()))return void k.a.debug("Not initializing custom link button because styles failed to load.");document.querySelectorAll(R.containerSelector).forEach(t=>{R.isInitialized(t)||R.injectMarkup(t,e)});const t=yield OneSignal.privateIsPushNotificationsEnabled();document.querySelectorAll(R.subscribeSelector).forEach(i=>R.initSubscribeElement(i,e,t)),document.querySelectorAll(R.explanationSelector).forEach(i=>R.initExplanationElement(i,e,t))})}static injectMarkup(e,t){if(t.text){if(e.innerHTML="",t.text.explanation){const t=document.createElement("p");Object(x.a)(t,R.explanationClass),e.appendChild(t)}if(t.text.subscribe){const t=document.createElement("button");Object(x.a)(t,R.subscribeClass),e.appendChild(t)}R.markAsInitialized(e)}else k.a.error("CustomLink: required property 'text' is missing in the config")}static initSubscribeElement(e,t,i){t.text&&t.text.subscribe&&(i||(e.textContent=t.text.subscribe)),t.text&&t.text.unsubscribe&&i&&(e.textContent=t.text.unsubscribe),R.setResetClass(e),R.setStateClass(e,i),R.setStyleClass(e,t),R.setSizeClass(e,t),R.setCustomColors(e,t),!0!==t.unsubscribeEnabled&&Object(x.a)(e,"hide"),e.setAttribute(R.subscriptionStateAttribute,i.toString()),R.isInitialized(e)||(e.addEventListener("click",()=>{k.a.info("CustomLink: subscribe clicked"),R.handleClick(e)}),R.markAsInitialized(e))}static handleClick(e){return _(this,void 0,void 0,function*(){if("true"===e.getAttribute(R.subscriptionStateAttribute)){(yield OneSignal.privateIsPushNotificationsEnabled())&&(yield OneSignal.setSubscription(!1))}else{if(yield OneSignal.internalIsOptedOut())yield OneSignal.setSubscription(!0);else{const e={autoAccept:!0};yield OneSignal.registerForPushNotifications(e)}}})}static initExplanationElement(e,t,i){t.text&&t.text.explanation&&(e.textContent=t.text.explanation),R.setResetClass(e),R.setStateClass(e,i),R.setSizeClass(e,t),!0!==t.unsubscribeEnabled&&Object(x.a)(e,"hide")}static setCustomColors(e,t){"button"===t.style&&t.color&&t.color.button&&t.color.text?(e.style.backgroundColor=t.color.button,e.style.color=t.color.text):"link"===t.style&&t.color&&t.color.text&&(e.style.color=t.color.text)}static setStateClass(e,t){const i=t?"state-unsubscribed":"state-subscribed",n=t?"state-subscribed":"state-unsubscribed";Object(x.l)(e,i)&&Object(x.t)(e,i),Object(x.l)(e,n)||Object(x.a)(e,n)}static setStyleClass(e,t){if(!t||!t.style)return;const i=t.style;Object(x.l)(e,i)||Object(x.a)(e,i)}static setSizeClass(e,t){if(!t||!t.size)return;const i=t.size;Object(x.l)(e,i)||Object(x.a)(e,i)}static setResetClass(e){const t=R.resetClass;Object(x.l)(e,t)||Object(x.a)(e,t)}static markAsInitialized(e){e.setAttribute(R.initializedAttribute,"true")}static isInitialized(e){return"true"===e.getAttribute(R.initializedAttribute)}}R.initializedAttribute="data-cl-initialized",R.subscriptionStateAttribute="data-cl-state",R.containerClass="onesignal-customlink-container",R.containerSelector=`.${R.containerClass}`,R.subscribeClass="onesignal-customlink-subscribe",R.subscribeSelector=`.${R.subscribeClass}`,R.explanationClass="onesignal-customlink-explanation",R.explanationSelector=`.${R.explanationClass}`,R.resetClass="onesignal-reset";var D=i(21),W=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class U{static onNotificationPermissionChange(){U.checkAndTriggerSubscriptionChanged()}static onInternalSubscriptionSet(e){return W(this,void 0,void 0,function*(){S.put("subscription.optedOut",e)})}static checkAndTriggerSubscriptionChanged(){return W(this,void 0,void 0,function*(){O.a.logMethodCall("checkAndTriggerSubscriptionChanged");const e=yield OneSignal.context.subscriptionManager.getSubscriptionState(),t=yield OneSignal.privateIsPushNotificationsEnabled(),i=yield M.a.getAppState(),{lastKnownPushEnabled:n}=i;(null===n||t!==n)&&(k.a.info("The user's subscription state changed from "+`${null===n?"(not stored)":n} ⟶ ${e.subscribed}`),i.lastKnownPushEnabled=t,yield M.a.setAppState(i),U.triggerSubscriptionChanged(t))})}static _onSubscriptionChanged(e){return W(this,void 0,void 0,function*(){U.onSubscriptionChanged_showWelcomeNotification(e),U.onSubscriptionChanged_evaluateNotifyButtonDisplayPredicate(),U.onSubscriptionChanged_updateCustomLink()})}static onSubscriptionChanged_showWelcomeNotification(e){return W(this,void 0,void 0,function*(){if(OneSignal.__doNotShowWelcomeNotification)k.a.debug("Not showing welcome notification because user has previously subscribed.");else if(!0===e){const{deviceId:e}=yield M.a.getSubscription(),{appId:t}=yield M.a.getAppConfig();let i=OneSignal.config.userConfig.welcomeNotification,n=void 0!==i&&!0===i.disable,o=void 0!==i&&void 0!==i.title&&null!==i.title?i.title:"",s=void 0!==i&&void 0!==i.message&&null!==i.message&&i.message.length>0?i.message:"Thanks for subscribing!",r=new URL(location.href).origin+"?_osp=do_not_open",a=i&&i.url&&i.url.length>0?i.url:r;o=D.a.decodeHtmlEntities(o),s=D.a.decodeHtmlEntities(s),n||(k.a.debug("Sending welcome notification."),N.sendNotification(t,[e],{en:o},{en:s},a,null,{__isOneSignalWelcomeNotification:!0},void 0),b.a.trigger(OneSignal.EVENTS.WELCOME_NOTIFICATION_SENT,{title:o,message:s,url:a}))}})}static onSubscriptionChanged_evaluateNotifyButtonDisplayPredicate(){return W(this,void 0,void 0,function*(){if(!OneSignal.config.userConfig.notifyButton)return;const e=OneSignal.config.userConfig.notifyButton.displayPredicate;if(e&&"function"==typeof e&&OneSignal.notifyButton){!1!==(yield e())?(k.a.debug("Showing notify button because display predicate returned true."),OneSignal.notifyButton.launcher.show()):(k.a.debug("Hiding notify button because display predicate returned false."),OneSignal.notifyButton.launcher.hide())}})}static onSubscriptionChanged_updateCustomLink(){return W(this,void 0,void 0,function*(){OneSignal.config.userConfig.promptOptions&&(yield R.initialize(OneSignal.config.userConfig.promptOptions.customlink))})}static triggerSubscriptionChanged(e){b.a.trigger(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,e)}static fireStoredNotificationClicks(e=document.URL){return W(this,void 0,void 0,function*(){function t(e){return W(this,void 0,void 0,function*(){const t=yield M.a.getAppState();t.clickedNotifications[e.url]=null,yield M.a.setAppState(t);const{data:i,timestamp:n}=e;if(n){if((Date.now()-n)/1e3/60>5)return}b.a.trigger(OneSignal.EVENTS.NOTIFICATION_CLICKED,i)})}const i=yield M.a.getAppState();if("origin"===(yield M.a.get("Options","notificationClickHandlerMatch"))){for(const e of Object.keys(i.clickedNotifications))if(new URL(e).origin===location.origin){yield t(i.clickedNotifications[e])}}else{var n=i.clickedNotifications[e];if(n)yield t(n);else if(!n&&e.endsWith("/")){var o=e.substring(0,e.length-1);(n=i.clickedNotifications[o])&&(yield t(n))}}})}}var B,L,j=i(5);class F{static promiseStub(){return{then:F.promiseStub,catch:F.promiseStub}}static ensureBackwardsCompatibility(e){F.environmentPolyfill(e),F.postmams(e),e.syncHashedEmail=F.promiseStub}static environmentPolyfill(e){e.environment={},e.environment.getEnv=function(){return""},e.environment.isPopup=function(){return P.a.getWindowEnv()===j.a.OneSignalSubscriptionPopup},e.environment.isIframe=function(){return P.a.getWindowEnv()===j.a.OneSignalProxyFrame}}static postmams(e){const t=function(){this.messenger.message.apply(this.messenger,arguments)},i=function(){this.messenger.postMessage.apply(this.messenger,arguments)};function n(e){e.message=t,e.postMessage=i}e.proxyFrame&&(e.iframePostmam=e.proxyFrame,n(e.iframePostmam)),e.subscriptionPopup&&(e.popupPostmam=e.subscriptionPopup,n(e.popupPostmam)),e.subscriptionModal&&(e.modalPostmam=e.subscriptionModal,n(e.modalPostmam))}}!function(e){e.Default="default",e.Granted="granted",e.Denied="denied"}(B||(B={}));class H{static isLocalStorageSupported(){try{return"undefined"!=typeof localStorage&&(localStorage.getItem("test"),!0)}catch(e){return!1}}static setItem(e,t,i){if(!H.isLocalStorageSupported())return;const n=void 0!==i?60*i*1e3:0,o={value:JSON.stringify(t),timestamp:void 0!==i?(new Date).getTime()+n:void 0};localStorage.setItem(e,JSON.stringify(o))}static getItem(e){if(!H.isLocalStorageSupported())return null;const t=localStorage.getItem(e);let i;try{i=JSON.parse(t)}catch(e){return null}if(null===i)return null;if(i.timestamp&&(new Date).getTime()>=i.timestamp)return localStorage.removeItem(e),null;let n=i.value;try{n=JSON.parse(i.value)}catch(e){return n}return n}static removeItem(e){if(!H.isLocalStorageSupported())return null;localStorage.removeItem(e)}}!function(e){e[e.Default=0]="Default",e[e.Subscribed=1]="Subscribed",e[e.MutedByApi=-2]="MutedByApi",e[e.NotSubscribed=-10]="NotSubscribed",e[e.TemporaryWebRecord=-20]="TemporaryWebRecord",e[e.PermissionRevoked=-21]="PermissionRevoked",e[e.PushSubscriptionRevoked=-22]="PushSubscriptionRevoked",e[e.ServiceWorkerStatus403=-23]="ServiceWorkerStatus403",e[e.ServiceWorkerStatus404=-24]="ServiceWorkerStatus404"}(L||(L={}));var V,$,z=i(16),G=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class K{static fixWordpressManifestIfMisplaced(){var e=document.querySelectorAll("link[rel=manifest]");if(e&&!(e.length<=1))for(let t=0;t to the first element in .")}}}static getCurrentNotificationType(){return G(this,void 0,void 0,function*(){const e=yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.context.appConfig.safariWebId);if(e===B.Default)return L.Default;if(e===B.Denied)return O.a.isUsingSubscriptionWorkaround()?L.Default:L.NotSubscribed;const t=yield OneSignal.context.subscriptionManager.isAlreadyRegisteredWithOneSignal();if(e===B.Granted&&t){return(yield OneSignal.privateIsPushNotificationsEnabled())?L.Subscribed:L.MutedByApi}return L.Default})}static getNotificationTypeFromOptIn(e){return 1==e||null==e?L.Subscribed:L.MutedByApi}static wasHttpsNativePromptDismissed(){return"dismissed"===H.getItem("onesignal-notification-prompt")}static markHttpPopoverShown(){sessionStorage.setItem("ONESIGNAL_HTTP_PROMPT_SHOWN","true")}static isHttpPromptAlreadyShown(){return"true"==sessionStorage.getItem("ONESIGNAL_HTTP_PROMPT_SHOWN")}static checkAndTriggerNotificationPermissionChanged(){return G(this,void 0,void 0,function*(){const e=yield M.a.get("Options","notificationPermission"),t=yield OneSignal.getNotificationPermission();e!==t&&(yield z.a.triggerNotificationPermissionChanged(),yield M.a.put("Options",{key:"notificationPermission",value:t}))})}static getNotificationIcons(){return G(this,void 0,void 0,function*(){const e=yield K.getAppId();if(!e)throw new InvalidStateError.a(InvalidStateError.b.MissingAppId);var t=`${P.a.getOneSignalApiUrl().toString()}/apps/${e}/icon`;const i=yield(yield fetch(t)).json();if(i.errors)throw k.a.error(`API call %c${t}`,I.a.getConsoleStyle("code"),"failed with:",i.errors),new Error("Failed to get notification icons.");return i})}static getSlidedownPermissionMessageOptions(e){const t="We'd like to show you notifications for the latest news and updates.";return e?e.slidedown?{enabled:e.slidedown.enabled,autoPrompt:e.slidedown.autoPrompt,actionMessage:e.slidedown.actionMessage||t,acceptButtonText:e.slidedown.acceptButtonText||"Allow",cancelButtonText:e.slidedown.cancelButtonText||"No Thanks"}:{enabled:!1,autoPrompt:!1,actionMessage:e.actionMessage||t,acceptButtonText:e.acceptButtonText||"Allow",cancelButtonText:e.cancelButtonText||"No Thanks"}:{enabled:!1,autoPrompt:!1,actionMessage:t,acceptButtonText:"Allow",cancelButtonText:"No Thanks"}}static getFullscreenPermissionMessageOptions(e){return e?e.fullscreen?{autoAcceptTitle:e.fullscreen.autoAcceptTitle,actionMessage:e.fullscreen.actionMessage,exampleNotificationTitleDesktop:e.fullscreen.title,exampleNotificationTitleMobile:e.fullscreen.title,exampleNotificationMessageDesktop:e.fullscreen.message,exampleNotificationMessageMobile:e.fullscreen.message,exampleNotificationCaption:e.fullscreen.caption,acceptButtonText:e.fullscreen.acceptButton,cancelButtonText:e.fullscreen.cancelButton}:e:null}static getPromptOptionsQueryString(){let e="";if(K.getFullscreenPermissionMessageOptions(OneSignal.config.userConfig.promptOptions)){let t=K.getPromptOptionsPostHash();for(let i of Object.keys(t)){e+="&"+i+"="+t[i]}}return e}static getPromptOptionsPostHash(){let e=K.getFullscreenPermissionMessageOptions(OneSignal.config.userConfig.promptOptions);if(e){var t={exampleNotificationTitleDesktop:"exampleNotificationTitle",exampleNotificationMessageDesktop:"exampleNotificationMessage",exampleNotificationTitleMobile:"exampleNotificationTitle",exampleNotificationMessageMobile:"exampleNotificationMessage"};for(let i of Object.keys(t)){let n=t[i];e[i]&&(e[n]=e[i])}for(var i=["autoAcceptTitle","siteName","autoAcceptTitle","subscribeText","showGraphic","actionMessage","exampleNotificationTitle","exampleNotificationMessage","exampleNotificationCaption","acceptButtonText","cancelButtonText","timeout"],n={},o=0;o{!0===t.data.progress?(k.a.debug("Got message from host page that remote reg. is in progress, closing popup."),e&&window.close()):k.a.debug("Got message from host page that remote reg. could not be finished.")});break;default:throw"undefined"!=typeof OneSignal&&(OneSignal._isRegisteringForPush=!1),new InvalidStateError.a(InvalidStateError.b.UnsupportedEnvironment)}return"undefined"!=typeof OneSignal&&(OneSignal._isRegisteringForPush=!1),i})}}var Z=i(17),X=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Q{constructor(e,t,i){if(this.windowReference=e,this.sendToOrigin=t,this.receiveFromOrigin=i,!window||!window.postMessage)throw new Error("Must pass in a valid window reference supporting postMessage():"+e);if(!t||!i)throw new Error("Invalid origin. Must be set.");this.emitter=new Z.a,this.channel=new MessageChannel,this.messagePort=null,this.isListening=!1,this.isConnected=!1,this.replies={}}static get HANDSHAKE_MESSAGE(){return"onesignal.postmam.handshake"}static get CONNECTED_MESSAGE(){return"onesignal.postmam.connected"}listen(){k.a.debug("(Postmam) Called listen()."),this.isListening?k.a.debug("(Postmam) Already listening for Postmam connections."):l.a.isBrowser()&&(this.isListening=!0,k.a.debug("(Postmam) Listening for Postmam connections.",this),window.addEventListener("message",this.onWindowMessagePostmanConnectReceived.bind(this)))}startPostMessageReceive(){window.addEventListener("message",this.onWindowPostMessageReceived.bind(this))}stopPostMessageReceive(){window.removeEventListener("message",this.onWindowPostMessageReceived)}destroy(){this.stopPostMessageReceive(),this.emitter.removeAllListeners()}onWindowPostMessageReceived(e){if(!this.isSafeOrigin(e.origin))return;let{id:t,command:i,data:n,source:o}=e.data;if(i===Q.CONNECTED_MESSAGE)return this.emitter.emit("connect"),void(this.isConnected=!0);let s={id:t,command:i,data:n,source:o},r=Object.assign({reply:this.reply.bind(this,s)},s);if(this.replies.hasOwnProperty(t)){k.a.info("(Postmam) This message is a reply."),!1===this.replies[t].bind(window)(r)&&delete this.replies[t]}else this.emitter.emit(i,r)}onWindowMessagePostmanConnectReceived(e){const t=P.a.getWindowEnv().toString();if(k.a.debug(`(Postmam) (${t}) Window postmessage for Postman connect received:`,e),this.isSafeOrigin(e.origin)){var{handshake:i}=e.data;i===Q.HANDSHAKE_MESSAGE?(k.a.info("(Postmam) Got our expected Postmam handshake message (and connecting...):",e.data),window.removeEventListener("message",this.onWindowMessagePostmanConnectReceived),this.messagePort=e.ports[0],this.messagePort.addEventListener("message",this.onMessageReceived.bind(this),!1),k.a.info("(Postmam) Removed previous message event listener for handshakes, replaced with main message listener."),this.messagePort.start(),this.isConnected=!0,k.a.info(`(Postmam) (${t}) Connected.`),this.message(Q.CONNECTED_MESSAGE),this.emitter.emit("connect")):k.a.info("(Postmam) Got a postmam message, but not our expected handshake:",e.data)}}connect(){k.a.info(`(Postmam) (${P.a.getWindowEnv().toString()}) Establishing a connection to ${this.sendToOrigin}.`),this.messagePort=this.channel.port1,this.messagePort.addEventListener("message",this.onMessageReceived.bind(this),!1),this.messagePort.start(),this.windowReference.postMessage({handshake:Q.HANDSHAKE_MESSAGE},this.sendToOrigin,[this.channel.port2])}onMessageReceived(e){if(!e.data)return void k.a.debug(`(${P.a.getWindowEnv().toString()}) Received an empty Postmam message:`,e);let{id:t,command:i,data:n,source:o}=e.data;if(i===Q.CONNECTED_MESSAGE)return this.emitter.emit("connect"),void(this.isConnected=!0);let s={id:t,command:i,data:n,source:o},r=Object.assign({reply:this.reply.bind(this,s)},s);if(this.replies.hasOwnProperty(t)){!1===this.replies[t].bind(window)(r)&&delete this.replies[t]}else this.emitter.emit(i,r)}reply(e,t,i){const n={id:e.id,command:e.command,data:t,source:P.a.getWindowEnv().toString(),isReply:!0};"function"==typeof i&&(this.replies[n.id]=i),this.messagePort.postMessage(n)}postMessage(e,t,i){if(!e||""==e)throw new Error("(Postmam) Postmam command must not be empty.");if("function"==typeof t)return void k.a.debug("You passed a function to data, did you mean to pass null?");const n={id:O.a.getRandomUuid(),command:e,data:t,source:P.a.getWindowEnv().toString()};"function"==typeof i&&(this.replies[n.id]=i),this.windowReference.postMessage(n,"*")}message(e,t,i){if(!e||""==e)throw new Error("(Postmam) Postmam command must not be empty.");if("function"==typeof t)return void k.a.debug("You passed a function to data, did you mean to pass null?");const n={id:O.a.getRandomUuid(),command:e,data:t,source:P.a.getWindowEnv().toString()};"function"==typeof i&&(this.replies[n.id]=i),this.messagePort.postMessage(n)}generateSafeOrigins(e){const t=[];try{const i=new URL(e);let n=i.host;0===i.host.indexOf("www.")&&(n=i.host.replace("www.","")),"https:"===i.protocol?(t.push(`https://${n}`),t.push(`https://web.archive.org/web/20190510161927/https://www.${n}`)):"http:"===i.protocol&&(t.push(`http://${n}`),t.push(`https://web.archive.org/web/20190510161927/http://www.${n}`),t.push(`https://${n}`),t.push(`https://web.archive.org/web/20190510161927/https://www.${n}`))}catch(e){}return t}isSafeOrigin(e){if(OneSignal.config)t=OneSignal.config.subdomain;else var t="x";const i=this.generateSafeOrigins(this.receiveFromOrigin);return"https://onesignal.com"===e||e===`https://${t||""}.onesignal.com`||e===`https://${t||""}.os.tc`||e===`https://${t||""}.os.tc:3001`||e===P.a.getOneSignalApiUrl().origin||"*"===this.receiveFromOrigin||I.a.contains(i,e)}on(...e){return X(this,void 0,void 0,function*(){return this.emitter.on.apply(this.emitter,e)})}off(...e){return X(this,void 0,void 0,function*(){return this.emitter.off.apply(this.emitter,e)})}once(...e){return X(this,void 0,void 0,function*(){return this.emitter.once.apply(this.emitter,e)})}}var ee=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class te{constructor(e,t){this.appId=e,this.registrationOptions=t}load(){return ee(this,void 0,void 0,function*(){const e=yield OneSignal.isPushNotificationsEnabled(),t=yield OneSignal.getNotificationPermission();this.url=P.a.getOneSignalApiUrl(),this.url.pathname="webPushModal",this.url.search=`${K.getPromptOptionsQueryString()}&id=${this.appId}&httpsPrompt=true&pushEnabled=${e}&permissionBlocked=${"denied"===t}&promptType=modal`,k.a.info(`Loading iFrame for HTTPS subscription modal at ${this.url.toString()}`),this.modal=this.createHiddenSubscriptionDomModal(this.url.toString()),this.establishCrossOriginMessaging()})}createHiddenSubscriptionDomModal(e){let t=document.createElement("div");t.setAttribute("id","OneSignal-iframe-modal"),t.setAttribute("style","display:none !important"),t.innerHTML='
',document.body.appendChild(t);let i=document.createElement("style");i.innerHTML="@media (max-width: 560px) { .OneSignal-permission-iframe { width: 100%; height: 100%;} }",document.getElementsByTagName("head")[0].appendChild(i);let n=document.createElement("iframe");return n.className="OneSignal-permission-iframe",n.setAttribute("frameborder","0"),n.width=OneSignal._windowWidth.toString(),n.height=OneSignal._windowHeight.toString(),n.src=e,document.getElementById("notif-permission").appendChild(n),n}removeFrame(){const e=document.querySelector("#OneSignal-iframe-modal");e&&e.remove()}showSubscriptionDomModal(){document.getElementById("OneSignal-iframe-modal").setAttribute("style","")}establishCrossOriginMessaging(){this.messenger=new Q(this.modal,this.url.origin,this.url.origin),this.messenger.startPostMessageReceive(),this.messenger.once(OneSignal.POSTMAM_COMMANDS.MODAL_LOADED,this.onModalLoaded.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.MODAL_PROMPT_ACCEPTED,this.onModalAccepted.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.MODAL_PROMPT_REJECTED,this.onModalRejected.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_CLOSING,this.onModalClosing.bind(this))}onModalLoaded(e){this.showSubscriptionDomModal(),b.a.trigger("modalLoaded")}onModalAccepted(e){return ee(this,void 0,void 0,function*(){k.a.debug("User accepted the HTTPS modal prompt.",location.origin),OneSignal._sessionInitAlreadyRunning=!1,this.dispose(),K.triggerCustomPromptClicked("granted"),k.a.debug("Calling setSubscription(true)"),yield J.registerForPush(),yield OneSignal.setSubscription(!0)})}onModalRejected(e){k.a.debug("User rejected the HTTPS modal prompt."),OneSignal._sessionInitAlreadyRunning=!1,this.dispose(),K.triggerCustomPromptClicked("denied")}onModalClosing(e){k.a.info("Detected modal is closing."),this.dispose()}dispose(){this.messenger&&this.messenger.destroy(),this.removeFrame()}message(){this.messenger.message.apply(this.messenger,arguments)}}var ie,ne,oe=i(12),se=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};(ne=ie||(ie={})).WorkerVersion="GetWorkerVersion",ne.Subscribe="Subscribe",ne.SubscribeNew="SubscribeNew",ne.AmpSubscriptionState="amp-web-push-subscription-state",ne.AmpSubscribe="amp-web-push-subscribe",ne.AmpUnsubscribe="amp-web-push-unsubscribe",ne.NotificationDisplayed="notification.displayed",ne.NotificationClicked="notification.clicked",ne.NotificationDismissed="notification.dismissed",ne.RedirectPage="command.redirect";class re{constructor(){this.replies={}}addListener(e,t,i){const n={callback:t,onceListenerOnly:i},o=this.replies[e.toString()];o?o.push(n):this.replies[e.toString()]=[n]}findListenersForMessage(e){return this.replies[e.toString()]||[]}deleteListenerRecords(e){this.replies[e.toString()]=null}deleteAllListenerRecords(){this.replies={}}deleteListenerRecord(e,t){const i=this.replies[e.toString()];if(null!=i)for(let e=i.length-1;e>=0;e--){i[e]===t&&i.splice(e,1)}}}class ae{constructor(e,t=new re){this.context=e,this.replies=t}broadcast(e,t){return se(this,void 0,void 0,function*(){if(P.a.getWindowEnv()===j.a.ServiceWorker){const i=yield self.clients.matchAll({type:"window",includeUncontrolled:!0});for(let n of i)k.a.debug(`[Worker Messenger] [SW -> Page] Broadcasting '${e.toString()}' to window client ${n.url}.`),n.postMessage({command:e,payload:t})}})}unicast(e,t,i){return se(this,void 0,void 0,function*(){if(P.a.getWindowEnv()===j.a.ServiceWorker){if(!i)throw new InvalidArgumentError.a("windowClient",InvalidArgumentError.b.Empty);k.a.debug(`[Worker Messenger] [SW -> Page] Unicasting '${e.toString()}' to window client ${i.url}.`),i.postMessage({command:e,payload:t})}else(yield this.isWorkerControllingPage())||k.a.debug("[Worker Messenger] The page is not controlled by the service worker yet. Waiting...",self.registration),yield this.waitUntilWorkerControlsPage(),k.a.debug(`[Worker Messenger] [Page -> SW] Unicasting '${e.toString()}' to service worker.`),navigator.serviceWorker.controller.postMessage({command:e,payload:t})})}listen(e){return se(this,void 0,void 0,function*(){if(!l.a.supportsServiceWorkers())return;P.a.getWindowEnv()===j.a.ServiceWorker?(self.addEventListener("message",this.onWorkerMessageReceivedFromPage.bind(this)),k.a.debug("[Worker Messenger] Service worker is now listening for messages.")):yield this.listenForPage(e)})}listenForPage(e){return se(this,void 0,void 0,function*(){e||((yield this.isWorkerControllingPage())||k.a.debug(`(${location.origin}) [Worker Messenger] The page is not controlled by the service worker yet. Waiting...`,self.registration),yield this.waitUntilWorkerControlsPage(),k.a.debug(`(${location.origin}) [Worker Messenger] The page is now controlled by the service worker.`)),navigator.serviceWorker.addEventListener("message",this.onPageMessageReceivedFromServiceWorker.bind(this)),k.a.debug(`(${location.origin}) [Worker Messenger] Page is now listening for messages.`)})}onWorkerMessageReceivedFromPage(e){const t=e.data;if(!t||!t.command)return;const i=this.replies.findListenersForMessage(t.command),n=[],o=[];k.a.debug("[Worker Messenger] Service worker received message:",e.data);for(let e of i)e.onceListenerOnly&&n.push(e),o.push(e);for(let e=n.length-1;e>=0;e--){const i=n[e];this.replies.deleteListenerRecord(t.command,i)}for(let e of o)e.callback.apply(null,[t.payload])}onPageMessageReceivedFromServiceWorker(e){const t=e.data;if(!t||!t.command)return;const i=this.replies.findListenersForMessage(t.command),n=[],o=[];k.a.debug("[Worker Messenger] Page received message:",e.data);for(let e of i)e.onceListenerOnly&&n.push(e),o.push(e);for(let e=n.length-1;e>=0;e--){const i=n[e];this.replies.deleteListenerRecord(t.command,i)}for(let e of o)e.callback.apply(null,[t.payload])}on(e,t){this.replies.addListener(e,t,!1)}once(e,t){this.replies.addListener(e,t,!0)}off(e){e?this.replies.deleteListenerRecords(e):this.replies.deleteAllListenerRecords()}isWorkerControllingPage(){return se(this,void 0,void 0,function*(){if(P.a.getWindowEnv()===j.a.ServiceWorker)return!!self.registration.active;{const e=yield this.context.serviceWorkerManager.getActiveState();return e===oe.a.WorkerA||e===oe.a.WorkerB}})}waitUntilWorkerControlsPage(){return se(this,void 0,void 0,function*(){return new Promise(e=>se(this,void 0,void 0,function*(){if(yield this.isWorkerControllingPage())e();else{P.a.getWindowEnv()===j.a.ServiceWorker?self.addEventListener("activate",t=>se(this,void 0,void 0,function*(){(yield this.isWorkerControllingPage())&&e()})):navigator.serviceWorker.addEventListener("controllerchange",t=>se(this,void 0,void 0,function*(){(yield this.isWorkerControllingPage())&&e()}))}}))})}}var ce=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class le{constructor(){this.cache={}}getCache(){return Object.assign({},this.cache)}loadSdkStylesheet(){return ce(this,void 0,void 0,function*(){const e=P.a.getOneSignalResourceUrlPath(),t=P.a.getOneSignalCssFileName();return yield this.loadIfNew(0,new URL(`${e}/${t}?v=${l.a.getSdkStylesVersionHash()}`))})}loadFetchPolyfill(){return ce(this,void 0,void 0,function*(){return yield this.loadIfNew(1,new URL("https://web.archive.org/web/20190510161927/https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.min.js"))})}loadIfNew(e,t){return ce(this,void 0,void 0,function*(){return this.cache[t.toString()]||(this.cache[t.toString()]=le.load(e,t)),yield this.cache[t.toString()]})}static load(e,t){return ce(this,void 0,void 0,function*(){try{return yield new Promise((i,n)=>{switch(e){case 1:(o=document.createElement("script")).setAttribute("type","text/javascript"),o.setAttribute("async","async"),o.setAttribute("src",t.toString());break;case 0:var o;(o=document.createElement("link")).setAttribute("rel","stylesheet"),o.setAttribute("href",t.toString())}o.onerror=n,o.onload=i,document.querySelector("head").appendChild(o)}),0}catch(e){return 1}})}}var ue=i(14),de=i(18);class ge{constructor(e,t,i,n="shown",o=["opacity","transform"],s,r=500){this.selector=e,this.showClass=t,this.hideClass=i,this.state=n,this.targetTransitionEvents=o,this.nestedContentSelector=s,this.transitionCheckTimeout=r}show(){return this.hidden?new Promise(e=>{this.state="showing",b.a.trigger(ge.EVENTS.SHOWING,this);const t=this.element;if(t?(this.hideClass&&Object(x.t)(t,this.hideClass),this.showClass&&Object(x.a)(t,this.showClass)):k.a.error(`(show) could not find animated element with selector ${this.selector}`),0==this.targetTransitionEvents.length)return e(this);var i=setTimeout(()=>{k.a.debug(`Element did not completely show (state: ${this.state}).`)},this.transitionCheckTimeout);Object(x.s)(this.element,"transitionend",(t,n)=>{if(t.target===this.element&&Object(x.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(i),n(),this.state="shown",b.a.trigger(ge.EVENTS.SHOWN,this),e(this)},!0)}):Promise.resolve(this)}hide(){return this.shown?new Promise(e=>{this.state="hiding",b.a.trigger(ge.EVENTS.HIDING,this);const t=this.element;if(t?(this.showClass&&Object(x.t)(t,this.showClass),this.hideClass&&Object(x.a)(t,this.hideClass)):k.a.error(`(hide) could not find animated element with selector ${this.selector}`),0==this.targetTransitionEvents.length)return e(this);Object(x.s)(this.element,"transitionend",(t,i)=>{var n=setTimeout(()=>{k.a.debug(`Element did not completely hide (state: ${this.state}).`)},this.transitionCheckTimeout);if(t.target===this.element&&Object(x.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(n),i(),this.state="hidden",b.a.trigger(ge.EVENTS.HIDDEN,this),e(this)},!0)}):Promise.resolve(this)}waitUntilShown(){return"shown"===this.state?Promise.resolve(this):new Promise(e=>{Kt.emitter.once(ge.EVENTS.SHOWN,t=>{if(t===this)return e(this)})})}waitUntilHidden(){return"hidden"===this.state?Promise.resolve(this):new Promise(e=>{Kt.emitter.once(ge.EVENTS.HIDDEN,t=>{if(t===this)return e(this)})})}static get EVENTS(){return{SHOWING:"animatedElementShowing",SHOWN:"animatedElementShown",HIDING:"animatedElementHiding",HIDDEN:"animatedElementHidden"}}get content(){if(!this.element)return"";if(this.nestedContentSelector){const e=this.element.querySelector(this.nestedContentSelector);return e?e.innerHTML:""}return this.element.innerHTML}set content(e){if(this.element)if(this.nestedContentSelector){const t=this.element.querySelector(this.nestedContentSelector);t&&(t.innerHTML=e)}else this.element.innerHTML=e}get element(){return document.querySelector(this.selector)}get showing(){return"showing"===this.state}get shown(){return"shown"===this.state}get hiding(){return"hiding"===this.state}get hidden(){return"hidden"===this.state}}class he extends ge{constructor(e,t,i,n,o,s="shown",r="active",a=["opacity","transform"],c){super(e,t,i,s,a),this.selector=e,this.showClass=t,this.hideClass=i,this.activeClass=n,this.inactiveClass=o,this.state=s,this.activeState=r,this.targetTransitionEvents=a,this.nestedContentSelector=c}activate(){return this.inactive&&this.shown?new Promise(e=>{this.activeState="activating",b.a.trigger(he.EVENTS.ACTIVATING,this);const t=this.element;if(t?(this.inactiveClass&&Object(x.t)(t,this.inactiveClass),this.activeClass&&Object(x.a)(t,this.activeClass)):k.a.error("Could not find active animated element"),!this.shown)return k.a.debug("Ending activate() transition (alternative)."),this.activeState="active",b.a.trigger(he.EVENTS.ACTIVE,this),e(this);if(0==this.targetTransitionEvents.length)return e(this);var i=setTimeout(()=>{k.a.debug(`Element did not completely activate (state: ${this.state}, activeState: ${this.activeState}).`)},this.transitionCheckTimeout);Object(x.s)(this.element,"transitionend",(t,n)=>{if(t.target===this.element&&Object(x.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(i),n(),this.activeState="active",b.a.trigger(he.EVENTS.ACTIVE,this),e(this)},!0)}):Promise.resolve(this)}inactivate(){return this.active?new Promise(e=>{this.activeState="inactivating",b.a.trigger(he.EVENTS.INACTIVATING,this);const t=this.element;if(t?(this.activeClass&&Object(x.t)(t,this.activeClass),this.inactiveClass&&Object(x.a)(t,this.inactiveClass)):k.a.error("Could not find active animated element"),!this.shown)return this.activeState="inactive",b.a.trigger(he.EVENTS.INACTIVE,this),e(this);if(0==this.targetTransitionEvents.length)return e(this);var i=setTimeout(()=>{k.a.debug(`Element did not completely inactivate (state: ${this.state}, activeState: ${this.activeState}).`)},this.transitionCheckTimeout);Object(x.s)(this.element,"transitionend",(t,n)=>{if(t.target===this.element&&Object(x.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(i),n(),this.activeState="inactive",b.a.trigger(he.EVENTS.INACTIVE,this),e(this)},!0)}):Promise.resolve(this)}waitUntilActive(){return this.active?Promise.resolve(this):new Promise(e=>{Kt.emitter.once(he.EVENTS.ACTIVE,t=>{if(t===this)return e(this)})})}waitUntilInactive(){return this.inactive?Promise.resolve(this):new Promise(e=>{Kt.emitter.once(he.EVENTS.INACTIVE,t=>{if(t===this)return e(this)})})}static get EVENTS(){return Object.assign({},ge.EVENTS,{ACTIVATING:"activeAnimatedElementActivating",ACTIVE:"activeAnimatedElementActive",INACTIVATING:"activeAnimatedElementInactivating",INACTIVE:"activeAnimatedElementInactive"})}get activating(){return"activating"===this.activeState}get active(){return"active"===this.activeState}get inactivating(){return"inactivating"===this.activeState}get inactive(){return"inactive"===this.activeState}}class pe extends he{constructor(){super(".onesignal-bell-launcher-badge","onesignal-bell-launcher-badge-opened",null,"onesignal-bell-launcher-badge-active",null,"hidden")}increment(){if(!isNaN(this.content)){let e=+this.content;e+=1,this.content=e.toString()}}show(){const e=super.show();return OneSignal.notifyButton.setCustomColorsIfSpecified(),e}decrement(){if(!isNaN(this.content)){let e=+this.content;e-=1,this.content=e>0?e.toString():""}}}class fe extends ge{constructor(e){super(".onesignal-bell-launcher-message","onesignal-bell-launcher-message-opened",void 0,"hidden",["opacity","transform"],".onesignal-bell-launcher-message-body"),this.bell=e,this.contentType="",this.queued=[]}static get TIMEOUT(){return 2500}static get TYPES(){return{TIP:"tip",MESSAGE:"message",QUEUED:"queued"}}display(e,t,i=0){return k.a.debug(`Calling %cdisplay(${e}, ${t}, ${i}).`,Object(x.j)("code")),(this.shown?this.hide():Object(x.r)()).then(()=>{this.content=Object(x.g)(t),this.contentType=e}).then(()=>this.show()).then(()=>Object(x.h)(i)).then(()=>this.hide()).then(()=>{this.content=this.getTipForState(),this.contentType="tip"})}getTipForState(){return this.bell.state===we.STATES.UNSUBSCRIBED?this.bell.options.text["tip.state.unsubscribed"]:this.bell.state===we.STATES.SUBSCRIBED?this.bell.options.text["tip.state.subscribed"]:this.bell.state===we.STATES.BLOCKED?this.bell.options.text["tip.state.blocked"]:""}enqueue(e){return this.queued.push(Object(x.g)(e)),new Promise(e=>{this.bell.badge.shown?this.bell.badge.hide().then(()=>this.bell.badge.increment()).then(()=>this.bell.badge.show()).then(e):(this.bell.badge.increment(),this.bell.initialized?this.bell.badge.show().then(e):e())})}dequeue(e){let t=this.queued.pop(e);return new Promise(e=>{this.bell.badge.shown?this.bell.badge.hide().then(()=>this.bell.badge.decrement()).then(e=>e>0?this.bell.badge.show():Promise.resolve(this)).then(e(t)):(this.bell.badge.decrement(),e(t))})}}class me extends he{constructor(e){super(".onesignal-bell-launcher-button",void 0,void 0,"onesignal-bell-launcher-button-active",void 0,"shown",""),this.bell=e,this.events={mouse:"bell.launcher.button.mouse"};const t=this.element;t&&(t.addEventListener("touchstart",()=>{this.onHovering(),this.onTap()},{passive:!0}),t.addEventListener("mouseenter",()=>{this.onHovering()}),t.addEventListener("mouseleave",()=>{this.onHovered()}),t.addEventListener("touchmove",()=>{this.onHovered()},{passive:!0}),t.addEventListener("mousedown",()=>{this.onTap()}),t.addEventListener("mouseup",()=>{this.onEndTap()}),t.addEventListener("click",()=>{this.onHovered(),this.onClick()}))}onHovering(){(S.isEmpty(this.events.mouse)||"out"===S.getLast(this.events.mouse))&&b.a.trigger(we.EVENTS.HOVERING),S.put(this.events.mouse,"over")}onHovered(){S.put(this.events.mouse,"out"),b.a.trigger(we.EVENTS.HOVERED)}onTap(){this.pulse(),this.activate(),this.bell.badge.activate()}onEndTap(){this.inactivate(),this.bell.badge.inactivate()}onClick(){if(b.a.trigger(we.EVENTS.BELL_CLICK),b.a.trigger(we.EVENTS.LAUNCHER_CLICK),!this.bell.message.shown||this.bell.message.contentType!=fe.TYPES.MESSAGE){var e=S.getLast("subscription.optedOut");return this.bell.unsubscribed?e?this.bell.launcher.activateIfInactive().then(()=>{this.bell.showDialogProcedure()}):(Kt.registerForPushNotifications(),this.bell._ignoreSubscriptionState=!0,Kt.emitter.once(Kt.EVENTS.SUBSCRIPTION_CHANGED,()=>{this.bell.message.display(fe.TYPES.MESSAGE,this.bell.options.text["message.action.subscribed"],fe.TIMEOUT).then(()=>{this.bell._ignoreSubscriptionState=!1,this.bell.launcher.inactivate()})})):this.bell.subscribed?this.bell.launcher.activateIfInactive().then(()=>{this.bell.showDialogProcedure()}):this.bell.blocked&&(Object(x.o)()?Kt.registerForPushNotifications():this.bell.launcher.activateIfInactive().then(()=>{this.bell.showDialogProcedure()})),this.bell.message.hide()}}pulse(){Object(x.u)(".pulse-ring"),this.element&&Object(x.b)(this.element,"beforeend",'
'),this.bell.setCustomColorsIfSpecified()}}class be extends ge{constructor(e){super(".onesignal-bell-launcher-dialog","onesignal-bell-launcher-dialog-opened",void 0,"hidden",["opacity","transform"],".onesignal-bell-launcher-dialog-body"),this.bell=e,this.subscribeButtonId="#onesignal-bell-container .onesignal-bell-launcher #subscribe-button",this.unsubscribeButtonId="#onesignal-bell-container .onesignal-bell-launcher #unsubscribe-button",this.notificationIcons=null}getPlatformNotificationIcon(){return this.notificationIcons?Object(x.n)()||c.a.firefox||c.a.msedge?this.notificationIcons.chrome||this.notificationIcons.safari:c.a.safari?this.notificationIcons.safari||this.notificationIcons.chrome:void 0:null}show(){return this.updateBellLauncherDialogBody().then(()=>super.show())}get subscribeButtonSelectorId(){return"subscribe-button"}get unsubscribeButtonSelectorId(){return"unsubscribe-button"}get subscribeButton(){return this.element?this.element.querySelector("#"+this.subscribeButtonSelectorId):null}get unsubscribeButton(){return this.element?this.element.querySelector("#"+this.unsubscribeButtonSelectorId):null}updateBellLauncherDialogBody(){return OneSignal.getSubscription().then(e=>{this.nestedContentSelector&&Object(x.e)(this.nestedContentSelector);let t="Nothing to show.";var i="";if(this.bell.options.showCredit&&(i='
Powered by OneSignal
'),this.bell.state===we.STATES.SUBSCRIBED&&!0===e||this.bell.state===we.STATES.UNSUBSCRIBED&&!1===e){let e="",n=this.getPlatformNotificationIcon();e=n?`
`:'
';let o="";o=this.bell.state!==we.STATES.SUBSCRIBED?``:``,t=`

${this.bell.options.text["dialog.main.title"]}

${e}
${o}
${i}`}else if(this.bell.state===we.STATES.BLOCKED){let e=null;c.a.chrome?c.a.mobile||c.a.tablet||(e="/bell/chrome-unblock.jpg"):c.a.firefox?e="/bell/firefox-unblock.jpg":c.a.safari?e="/bell/safari-unblock.jpg":c.a.msedge&&(e="/bell/edge-unblock.png");let n="";e&&(n=``),(c.a.mobile||c.a.tablet)&&c.a.chrome&&(n="
  1. Access Settings by tapping the three menu dots
  2. Click Site settings under Advanced.
  3. Click Notifications.
  4. Find and click this entry for this website.
  5. Click Notifications and set it to Allow.
"),t=`

${this.bell.options.text["dialog.blocked.title"]}

${this.bell.options.text["dialog.blocked.message"]}

${n}
${i}`}this.nestedContentSelector&&Object(x.b)(this.nestedContentSelector,"beforeend",t),this.subscribeButton&&this.subscribeButton.addEventListener("click",()=>{OneSignal.__doNotShowWelcomeNotification=!1,b.a.trigger(we.EVENTS.SUBSCRIBE_CLICK)}),this.unsubscribeButton&&this.unsubscribeButton.addEventListener("click",()=>b.a.trigger(we.EVENTS.UNSUBSCRIBE_CLICK)),this.bell.setCustomColorsIfSpecified()})}}var Se=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class ve extends he{constructor(e){super(".onesignal-bell-launcher","onesignal-bell-launcher-active",void 0,void 0,"onesignal-bell-launcher-inactive","hidden","active"),this.bell=e,this.wasInactive=!1}resize(e){return Se(this,void 0,void 0,function*(){if(!this.element)throw new InvalidStateError.a(InvalidStateError.b.MissingDomElement);if("small"===e&&Object(x.l)(this.element,"onesignal-bell-launcher-sm")||"medium"===e&&Object(x.l)(this.element,"onesignal-bell-launcher-md")||"large"===e&&Object(x.l)(this.element,"onesignal-bell-launcher-lg"))return Promise.resolve(this);if(Object(x.t)(this.element,"onesignal-bell-launcher-sm"),Object(x.t)(this.element,"onesignal-bell-launcher-md"),Object(x.t)(this.element,"onesignal-bell-launcher-lg"),"small"===e)Object(x.a)(this.element,"onesignal-bell-launcher-sm");else if("medium"===e)Object(x.a)(this.element,"onesignal-bell-launcher-md");else{if("large"!==e)throw new Error("Invalid OneSignal bell size "+e);Object(x.a)(this.element,"onesignal-bell-launcher-lg")}return this.shown?yield new Promise(e=>{if(0==this.targetTransitionEvents.length)return e(this);var t=setTimeout(()=>{k.a.debug(`Launcher did not completely resize (state: ${this.state}, activeState: ${this.activeState}).`)},this.transitionCheckTimeout);Object(x.s)(this.element,"transitionend",(i,n)=>{if(i.target===this.element&&Object(x.f)(this.targetTransitionEvents,i.propertyName))return clearTimeout(t),n(),e(this)},!0)}):this})}activateIfInactive(){return this.inactive?(this.wasInactive=!0,this.activate()):Object(x.r)()}inactivateIfWasInactive(){return this.wasInactive?(this.wasInactive=!1,this.inactivate()):Object(x.r)()}clearIfWasInactive(){this.wasInactive=!1}inactivate(){return this.bell.message.hide().then(()=>this.bell.badge.content.length>0?this.bell.badge.hide().then(()=>Promise.all([super.inactivate(),this.resize("small")])).then(()=>this.bell.badge.show()):Promise.all([super.inactivate(),this.resize("small")]))}activate(){return this.bell.badge.content.length>0?this.bell.badge.hide().then(()=>Promise.all([super.activate(),this.resize(this.bell.options.size)])):Promise.all([super.activate(),this.resize(this.bell.options.size)])}}var ye=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})},Oe='';class we{constructor(e,t){this.state=we.STATES.UNINITIALIZED,this._ignoreSubscriptionState=!1,this.hovering=!1,this.initialized=!1,this.DEFAULT_SIZE="medium",this.DEFAULT_POSITION="bottom-right",this.DEFAULT_THEME="default",this.options={enable:e.enable||!1,size:e.size||this.DEFAULT_SIZE,position:e.position||this.DEFAULT_POSITION,theme:e.theme||this.DEFAULT_THEME,showLauncherAfter:e.showLauncherAfter||10,showBadgeAfter:e.showBadgeAfter||300,text:this.setDefaultTextOptions(e.text||{}),prenotify:e.prenotify,showCredit:e.showCredit,colors:e.colors,offset:e.offset},t&&(this._launcher=t),this.options.enable&&(this.validateOptions(this.options),this.state=we.STATES.UNINITIALIZED,this._ignoreSubscriptionState=!1,this.installEventHooks(),this.updateState())}static get EVENTS(){return{STATE_CHANGED:"notifyButtonStateChange",LAUNCHER_CLICK:"notifyButtonLauncherClick",BELL_CLICK:"notifyButtonButtonClick",SUBSCRIBE_CLICK:"notifyButtonSubscribeClick",UNSUBSCRIBE_CLICK:"notifyButtonUnsubscribeClick",HOVERING:"notifyButtonHovering",HOVERED:"notifyButtonHover"}}static get STATES(){return{UNINITIALIZED:"uninitialized",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed",BLOCKED:"blocked"}}static get TEXT_SUBS(){return{"prompt.native.grant":{default:"Allow",chrome:"Allow",firefox:"Always Receive Notifications",safari:"Allow"}}}showDialogProcedure(){this.dialog.shown||this.dialog.show().then(()=>{Object(x.s)(document,"click",(e,t)=>{this.dialog.element.contains(e.target)||(t(),this.dialog.shown&&this.dialog.hide().then(()=>{this.launcher.inactivateIfWasInactive()}))},!0)})}validateOptions(e){if(!e.size||!Object(x.f)(["small","medium","large"],e.size))throw new Error(`Invalid size ${e.size} for notify button. Choose among 'small', 'medium', or 'large'.`);if(!e.position||!Object(x.f)(["bottom-left","bottom-right"],e.position))throw new Error(`Invalid position ${e.position} for notify button. Choose either 'bottom-left', or 'bottom-right'.`);if(!e.theme||!Object(x.f)(["default","inverse"],e.theme))throw new Error(`Invalid theme ${e.theme} for notify button. Choose either 'default', or 'inverse'.`);if(!e.showLauncherAfter||e.showLauncherAfter<0)throw new Error(`Invalid delay duration of ${this.options.showLauncherAfter} for showing the notify button. Choose a value above 0.`);if(!e.showBadgeAfter||e.showBadgeAfter<0)throw new Error(`Invalid delay duration of ${this.options.showBadgeAfter} for showing the notify button's badge. Choose a value above 0.`)}setDefaultTextOptions(e){return{"tip.state.unsubscribed":e["tip.state.unsubscribed"]||"Subscribe to notifications","tip.state.subscribed":e["tip.state.subscribed"]||"You're subscribed to notifications","tip.state.blocked":e["tip.state.blocked"]||"You've blocked notifications","message.prenotify":e["message.prenotify"]||"Click to subscribe to notifications","message.action.subscribed":e["message.action.subscribed"]||"Thanks for subscribing!","message.action.resubscribed":e["message.action.resubscribed"]||"You're subscribed to notifications","message.action.subscribing":e["message.action.subscribing"]||"Click {{prompt.native.grant}} to receive notifications","message.action.unsubscribed":e["message.action.unsubscribed"]||"You won't receive notifications again","dialog.main.title":e["dialog.main.title"]||"Manage Site Notifications","dialog.main.button.subscribe":e["dialog.main.button.subscribe"]||"SUBSCRIBE","dialog.main.button.unsubscribe":e["dialog.main.button.unsubscribe"]||"UNSUBSCRIBE","dialog.blocked.title":e["dialog.blocked.title"]||"Unblock Notifications","dialog.blocked.message":e["dialog.blocked.message"]||"Follow these instructions to allow notifications:"}}installEventHooks(){Kt.emitter.on(we.EVENTS.SUBSCRIBE_CLICK,()=>{this.dialog.subscribeButton.disabled=!0,this._ignoreSubscriptionState=!0,Kt.setSubscription(!0).then(()=>(this.dialog.subscribeButton.disabled=!1,this.dialog.hide())).then(()=>this.message.display(fe.TYPES.MESSAGE,this.options.text["message.action.resubscribed"],fe.TIMEOUT)).then(()=>(this._ignoreSubscriptionState=!1,this.launcher.clearIfWasInactive(),this.launcher.inactivate())).then(()=>this.updateState())}),Kt.emitter.on(we.EVENTS.UNSUBSCRIBE_CLICK,()=>{this.dialog.unsubscribeButton.disabled=!0,Kt.setSubscription(!1).then(()=>(this.dialog.unsubscribeButton.disabled=!1,this.dialog.hide())).then(()=>(this.launcher.clearIfWasInactive(),this.launcher.activate())).then(()=>this.message.display(fe.TYPES.MESSAGE,this.options.text["message.action.unsubscribed"],fe.TIMEOUT)).then(()=>this.updateState())}),Kt.emitter.on(we.EVENTS.HOVERING,()=>{this.hovering=!0,this.launcher.activateIfInactive(),this.message.shown||this.dialog.shown?this.hovering=!1:this.message.contentType!==fe.TYPES.MESSAGE?new Promise(e=>{if(this.message.queued.length>0)return this.message.dequeue().then(t=>{this.message.content=t,this.message.contentType=fe.TYPES.QUEUED,e()});this.message.content=Object(x.g)(this.message.getTipForState()),this.message.contentType=fe.TYPES.TIP,e()}).then(()=>this.message.show()).then(()=>{this.hovering=!1}):this.hovering=!1}),Kt.emitter.on(we.EVENTS.HOVERED,()=>{this.message.contentType!==fe.TYPES.MESSAGE&&this.dialog.hidden&&(this.hovering&&(this.hovering=!1,this.message.waitUntilShown().then(()=>Object(x.h)(fe.TIMEOUT)).then(()=>this.message.hide()).then(()=>{this.launcher.wasInactive&&this.dialog.hidden&&(this.launcher.inactivate(),this.launcher.wasInactive=!1)})),this.message.shown&&this.message.hide().then(()=>{this.launcher.wasInactive&&this.dialog.hidden&&(this.launcher.inactivate(),this.launcher.wasInactive=!1)}))}),Kt.emitter.on(Kt.EVENTS.SUBSCRIPTION_CHANGED,e=>ye(this,void 0,void 0,function*(){if(1==e&&(this.badge.shown&&this.options.prenotify&&this.badge.hide(),null===this.dialog.notificationIcons)){const e=yield K.getNotificationIcons();this.dialog.notificationIcons=e}Kt.getNotificationPermission(t=>{let i;i=e?we.STATES.SUBSCRIBED:t===B.Denied?we.STATES.BLOCKED:we.STATES.UNSUBSCRIBED,this.setState(i,this._ignoreSubscriptionState)})})),Kt.emitter.on(we.EVENTS.STATE_CHANGED,e=>{this.launcher.element&&(e.to===we.STATES.SUBSCRIBED?this.launcher.inactivate():(e.to===we.STATES.UNSUBSCRIBED||we.STATES.BLOCKED)&&this.launcher.activate())}),Kt.emitter.on(Kt.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,()=>{this.updateState()})}addDefaultClasses(){const e=this.container;if("bottom-left"===this.options.position)e&&Object(x.a)(e,"onesignal-bell-container-bottom-left"),Object(x.a)(this.launcher.selector,"onesignal-bell-launcher-bottom-left");else{if("bottom-right"!==this.options.position)throw new Error("Invalid OneSignal notify button position "+this.options.position);e&&Object(x.a)(e,"onesignal-bell-container-bottom-right"),Object(x.a)(this.launcher.selector,"onesignal-bell-launcher-bottom-right")}if("default"===this.options.theme)Object(x.a)(this.launcher.selector,"onesignal-bell-launcher-theme-default");else{if("inverse"!==this.options.theme)throw new Error("Invalid OneSignal notify button theme "+this.options.theme);Object(x.a)(this.launcher.selector,"onesignal-bell-launcher-theme-inverse")}}create(){return ye(this,void 0,void 0,function*(){if(!this.options.enable)return;if(0!==(yield Kt.context.dynamicResourceLoader.loadSdkStylesheet()))return void k.a.debug("Not showing notify button because styles failed to load.");this.container&&Object(x.u)("#onesignal-bell-container"),Object(x.b)("body","beforeend",'
'),this.container&&Object(x.b)(this.container,"beforeend",'
'),Object(x.b)(this.launcher.selector,"beforeend",'
'),Object(x.b)(this.launcher.selector,"beforeend",'
'),Object(x.b)(this.launcher.selector,"beforeend",'
'),Object(x.b)(this.message.selector,"beforeend",'
'),Object(x.b)(this.launcher.selector,"beforeend",'
'),Object(x.b)(this.dialog.selector,"beforeend",'
'),Object(x.b)(this.button.selector,"beforeend",Oe);const e=yield Kt.isPushNotificationsEnabled(),t=yield Kt.getSubscription(),i=yield K.wasHttpsNativePromptDismissed();let n=e?"small":this.options.size||this.DEFAULT_SIZE;yield this.launcher.resize(n),this.addDefaultClasses(),this.applyOffsetIfSpecified(),this.setCustomColorsIfSpecified(),this.patchSafariSvgFilterBug(),k.a.info("Showing the notify button."),yield(e?this.launcher.inactivate():Object(x.r)()).then(()=>Kt.getSubscription()).then(t=>!e&&t||null!==this.dialog.notificationIcons?Object(x.r)():K.getNotificationIcons().then(e=>{this.dialog.notificationIcons=e})).then(()=>Object(x.h)(this.options.showLauncherAfter||0)).then(()=>Object(x.o)()&&t&&!0!==i&&!e&&!0===Kt.config.userConfig.promptOptions.autoPrompt&&!K.isHttpPromptAlreadyShown()?(k.a.debug("Not showing notify button because popover will be shown."),Object(x.r)()):this.launcher.show()).then(()=>Object(x.h)(this.options.showBadgeAfter||0)).then(()=>this.options.prenotify&&!e&&Kt._isNewVisitor?this.message.enqueue(this.options.text["message.prenotify"]).then(()=>this.badge.show()):Object(x.r)()).then(()=>this.initialized=!0)})}patchSafariSvgFilterBug(){if(!(c.a.safari&&Number(c.a.version)>=9.1)){let e="drop-shadow(0 2px 4px rgba(34,36,38,0.35));",t="drop-shadow(0 2px 4px rgba(34,36,38,0));",i="drop-shadow(0px 2px 2px rgba(34,36,38,.15));";this.graphic.setAttribute("style",`filter: ${e}; -webkit-filter: ${e};`),this.badge.element.setAttribute("style",`filter: ${t}; -webkit-filter: ${t};`),this.dialog.element.setAttribute("style",`filter: ${i}; -webkit-filter: ${i};`)}c.a.safari&&this.badge.element.setAttribute("style","display: none;")}applyOffsetIfSpecified(){let e=this.options.offset;if(e){const t=this.launcher.element;if(!t)return void k.a.error("Could not find bell dom element");t.style.cssText="",e.bottom&&(t.style.cssText+=`bottom: ${e.bottom};`),"bottom-right"===this.options.position?e.right&&(t.style.cssText+=`right: ${e.right};`):"bottom-left"===this.options.position&&e.left&&(t.style.cssText+=`left: ${e.left};`)}}setCustomColorsIfSpecified(){let e=this.dialog.element.querySelector("button.action"),t=this.button.element.querySelector(".pulse-ring");this.graphic.querySelector(".background").style.cssText="";let i=this.graphic.querySelectorAll(".foreground");for(let e=0;e{this.setState(e?we.STATES.SUBSCRIBED:we.STATES.UNSUBSCRIBED),t===B.Denied&&this.setState(we.STATES.BLOCKED)})}setState(e,t=!1){let i=this.state;this.state=e,i===e||t||b.a.trigger(we.EVENTS.STATE_CHANGED,{from:i,to:e})}get container(){return document.querySelector("#onesignal-bell-container")}get graphic(){return this.button.element.querySelector("svg")}get launcher(){return this._launcher||(this._launcher=new ve(this)),this._launcher}get button(){return this._button||(this._button=new me(this)),this._button}get badge(){return this._badge||(this._badge=new pe),this._badge}get message(){return this._message||(this._message=new fe(this)),this._message}get dialog(){return this._dialog||(this._dialog=new be(this)),this._dialog}get subscribed(){return this.state===we.STATES.SUBSCRIBED}get unsubscribed(){return this.state===we.STATES.UNSUBSCRIBED}get blocked(){return this.state===we.STATES.BLOCKED}}class Ee{constructor(e){if(!e)throw new InvalidArgumentError.a("path",InvalidArgumentError.b.Empty);this.path=e.trim()}getQueryString(){const e=this.path.indexOf("?");return-1===e?null:this.path.length>e?this.path.substring(e+1):null}getWithoutQueryString(){return this.path.split(Ee.QUERY_STRING)[0]}getFileName(){return this.getWithoutQueryString().split("\\").pop().split("/").pop()}getFileNameWithQuery(){return this.path.split("\\").pop().split("/").pop()}getFullPath(){return this.path}getPathWithoutFileName(){const e=this.getWithoutQueryString(),t=e.lastIndexOf(this.getFileName());let i=e.substring(0,t);return i=i.replace(/[\\\/]$/,"")}}Ee.QUERY_STRING="?";class Pe extends u.a{constructor(e,t){super("Registration of a Service Worker failed."),this.status=e,this.statusText=t,Object.setPrototypeOf(this,Pe.prototype)}}var Ie=Pe,Te=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Ce{constructor(e,t){this.context=e,this.config=t}static getRegistration(){return Te(this,void 0,void 0,function*(){return yield oe.b.getRegistration()})}getActiveState(){return Te(this,void 0,void 0,function*(){const e=yield P.a.getIntegration();if(e===ue.a.InsecureProxy)return oe.a.Indeterminate;if(e===ue.a.SecureProxy){switch(P.a.getWindowEnv()){case j.a.Host:case j.a.CustomIframe:const e=OneSignal.proxyFrameHost;return e?yield e.runCommand(OneSignal.POSTMAM_COMMANDS.SERVICE_WORKER_STATE):oe.a.Indeterminate;case j.a.OneSignalSubscriptionPopup:break;case j.a.OneSignalSubscriptionModal:throw new y}}const t=yield Ce.getRegistration();if(!t)return oe.a.None;if(t.installing)return oe.a.Installing;if(!t.active)return oe.a.ThirdParty;const i=new URL(t.active.scriptURL).pathname;let n;return n=new Ee(i).getFileName()==this.config.workerAPath.getFileName()?oe.a.WorkerA:new Ee(i).getFileName()==this.config.workerBPath.getFileName()?oe.a.WorkerB:oe.a.ThirdParty,navigator.serviceWorker.controller||n!==oe.a.WorkerA&&n!==oe.a.WorkerB?n:oe.a.Bypassed})}getWorkerVersion(){return Te(this,void 0,void 0,function*(){return new Promise(e=>Te(this,void 0,void 0,function*(){if(O.b.isUsingSubscriptionWorkaround()){const t=OneSignal.proxyFrameHost;if(t){const i=yield t.runCommand(OneSignal.POSTMAM_COMMANDS.GET_WORKER_VERSION);e(i)}else e(NaN)}else this.context.workerMessenger.once(ie.WorkerVersion,t=>{e(t)}),this.context.workerMessenger.unicast(ie.WorkerVersion)}))})}shouldInstallWorker(){return Te(this,void 0,void 0,function*(){const e=yield this.getActiveState();return e!==oe.a.WorkerA&&e!==oe.a.WorkerB})}subscribeForPushNotifications(){return Te(this,void 0,void 0,function*(){const e=yield this.getActiveState();if(e!==oe.a.WorkerA&&e!==oe.a.WorkerB)throw new InvalidStateError.a(InvalidStateError.b.ServiceWorkerNotActivated);return new Promise(e=>{this.context.workerMessenger.once(ie.Subscribe,t=>{e(de.a.deserialize(t))}),this.context.workerMessenger.unicast(ie.Subscribe,this.context.appConfig)})})}updateWorker(){return Te(this,void 0,void 0,function*(){if(!l.a.supportsServiceWorkers())return;const e=yield this.getActiveState();let t;k.a.info("[Service Worker Update] Checking service worker version...");try{t=yield I.a.timeoutPromise(this.getWorkerVersion(),2e3)}catch(e){k.a.info("[Service Worker Update] Worker did not reply to version query; assuming older version."),t=1}e===oe.a.WorkerA||e===oe.a.WorkerB?t!==l.a.version()?(k.a.info(`[Service Worker Update] Updating service worker from v${t} --\x3e v${l.a.version()}.`),yield this.installWorker()):k.a.info(`[Service Worker Update] Service worker version is current at v${t} (no update required).`):k.a.debug(`[Service Worker Update] Not updating service worker, current active worker state is ${e}.`)})}installWorker(){return Te(this,void 0,void 0,function*(){if(!l.a.supportsServiceWorkers())return;const e=yield this.getActiveState();yield this.installAlternatingWorker(),yield new Promise(t=>Te(this,void 0,void 0,function*(){const i=yield this.getActiveState();e!==i&&i!==oe.a.Installing?t():navigator.serviceWorker.addEventListener("controllerchange",i=>Te(this,void 0,void 0,function*(){const i=yield this.getActiveState();i!==e&&i!==oe.a.Installing&&t()}))})),(yield this.getActiveState())===oe.a.WorkerB&&(yield this.installAlternatingWorker()),yield this.establishServiceWorkerChannel()})}establishServiceWorkerChannel(){return Te(this,void 0,void 0,function*(){const e=this.context.workerMessenger;e.off(),e.on(ie.NotificationDisplayed,e=>{k.a.debug(location.origin,"Received notification display event from service worker."),b.a.trigger(OneSignal.EVENTS.NOTIFICATION_DISPLAYED,e)}),e.on(ie.NotificationClicked,e=>Te(this,void 0,void 0,function*(){let t;if(0===(t=P.a.getWindowEnv()===j.a.OneSignalProxyFrame?yield new Promise(e=>{const t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.GET_EVENT_LISTENER_COUNT,OneSignal.EVENTS.NOTIFICATION_CLICKED,t=>{let i=t.data;e(i)})}):OneSignal.emitter.numberOfListeners(OneSignal.EVENTS.NOTIFICATION_CLICKED))){k.a.debug("notification.clicked event received, but no event listeners; storing event in IndexedDb for later retrieval.");let t=e.url;e.url||(t=location.href),yield M.a.put("NotificationOpened",{url:t,data:e,timestamp:Date.now()})}else b.a.trigger(OneSignal.EVENTS.NOTIFICATION_CLICKED,e)})),e.on(ie.RedirectPage,e=>{k.a.debug(`${P.a.getWindowEnv().toString()} Picked up command.redirect to ${e}, forwarding to host page.`);const t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,e)}),e.on(ie.NotificationDismissed,e=>{b.a.trigger(OneSignal.EVENTS.NOTIFICATION_DISMISSED,e)})})}installAlternatingWorker(){return Te(this,void 0,void 0,function*(){const e=yield this.getActiveState();if(e===oe.a.ThirdParty){const e=yield Ce.getRegistration();e&&(yield e.unregister())}const t=`${oe.b.getServiceWorkerHref(e,this.config)}?${I.a.encodeHashAsUriComponent({appId:this.context.appConfig.appId})}`;k.a.info(`[Service Worker Installation] Installing service worker ${t}.`);try{yield navigator.serviceWorker.register(t,{scope:`${O.b.getBaseUrl()}${this.config.registrationOptions.scope}`})}catch(e){if(k.a.error(`[Service Worker Installation] Installing service worker failed ${e}`),P.a.getWindowEnv()===j.a.OneSignalSubscriptionPopup)throw e;const i=yield fetch(t);if(403===i.status||404===i.status)throw new Ie(i.status,i.statusText);throw e}k.a.debug("[Service Worker Installation] Service worker installed.")})}}var Ae,Ne,Me,ke,xe=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class _e{constructor(e,t){this.url=e,this.url.pathname="subscribe",this.options=t||{}}load(){const e=Object.assign({},K.getPromptOptionsPostHash(),{promptType:"popup",parentHostname:encodeURIComponent(location.hostname)});return this.options.autoAccept&&(e.autoAccept=!0),k.a.info(`Opening a popup to ${this.url.toString()} with POST data:`,e),this.popupWindow=this.openWindowViaPost(this.url.toString(),e,null),this.establishCrossOriginMessaging(),this.loadPromise={},this.loadPromise.promise=new Promise((e,t)=>{this.loadPromise.resolver=e,this.loadPromise.rejector=t}),this.loadPromise.promise}openWindowViaPost(e,t,i){var n=document.createElement("form");n.action=e,n.method="POST",n.target="onesignal-http-popup";var o=void 0!=window.screenLeft?window.screenLeft:screen.left,s=void 0!=window.screenTop?window.screenTop:screen.top,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,c=OneSignal._windowWidth,l=OneSignal._windowHeight,u=r/2-c/2+o,d=a/2-l/2+s;i&&(i.childWidth&&(c=i.childWidth),i.childHeight&&(l=i.childHeight),i.left&&(u=i.left),i.top&&(d=i.top));const g=window.open("about:blank","onesignal-http-popup",`'scrollbars=yes, width=${c}, height=${l}, top=${d}, left=${u}`);if(t)for(var h in t){var p=document.createElement("textarea");p.name=h,p.value="object"==typeof t[h]?JSON.stringify(t[h]):t[h],n.appendChild(p)}return n.style.display="none",document.body.appendChild(n),n.submit(),document.body.removeChild(n),g}establishCrossOriginMessaging(){this.messenger=new Q(this.popupWindow,this.url.toString(),this.url.toString()),this.messenger.on(OneSignal.POSTMAM_COMMANDS.POPUP_BEGIN_MESSAGEPORT_COMMS,this.onBeginMessagePortCommunications.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_LOADED,this.onPopupLoaded.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_ACCEPTED,this.onPopupAccepted.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_REJECTED,this.onPopupRejected.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_CLOSING,this.onPopupClosing.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.SET_SESSION_COUNT,this.onSetSessionCount.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.WINDOW_TIMEOUT,this.onWindowTimeout.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.FINISH_REMOTE_REGISTRATION,this.onFinishingRegistrationRemotely.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,this.onRemoteRetriggerEvent.bind(this)),this.messenger.startPostMessageReceive()}dispose(){this.messenger.destroy()}onBeginMessagePortCommunications(e){return xe(this,void 0,void 0,function*(){return k.a.debug(`(${P.a.getWindowEnv().toString()}) Successfully established cross-origin messaging with the popup window.`),this.messenger.connect(),!1})}onPopupLoaded(e){return xe(this,void 0,void 0,function*(){this.loadPromise.resolver(),b.a.trigger("popupLoad")})}onPopupAccepted(e){return xe(this,void 0,void 0,function*(){K.triggerCustomPromptClicked("granted")})}onPopupRejected(e){return xe(this,void 0,void 0,function*(){K.triggerCustomPromptClicked("denied")})}onPopupClosing(e){return xe(this,void 0,void 0,function*(){k.a.info("Popup window is closing, running cleanup events."),b.a.trigger(OneSignal.EVENTS.POPUP_CLOSING),this.dispose()})}onSetSessionCount(e){return xe(this,void 0,void 0,function*(){k.a.debug(P.a.getWindowEnv().toString()+" Marking current session as a continuing browsing session.");const{sessionCount:t}=e.data;OneSignal.context.sessionManager.setPageViewCount(t)})}onWindowTimeout(e){return xe(this,void 0,void 0,function*(){k.a.debug(P.a.getWindowEnv().toString()+" Popup window timed out and was closed."),b.a.trigger(OneSignal.EVENTS.POPUP_WINDOW_TIMEOUT)})}onFinishingRegistrationRemotely(e){return xe(this,void 0,void 0,function*(){k.a.debug(location.origin,P.a.getWindowEnv().toString()+" Finishing HTTP popup registration inside the iFrame, sent from popup."),e.reply({progress:!0});const{rawPushSubscription:t}=e.data;this.messenger&&this.messenger.stopPostMessageReceive(),yield OneSignal.context.subscriptionManager.registerSubscription(t),yield U.checkAndTriggerSubscriptionChanged(),yield K.checkAndTriggerNotificationPermissionChanged()})}onRemoteRetriggerEvent(e){let{eventName:t,eventData:i}=e.data;return b.a.trigger(t,i,e.source),!1}message(){this.messenger&&this.messenger.message.apply(this.messenger,arguments)}}function Re(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}class De{getPropertiesAsJson(){return{origin:location.origin,url:location.href,sdkVersion:l.a.version()}}}class We{}(Ne=Ae||(Ae={})).HttpPermissionRequest="HttpPermissionRequest",Ne.SyncHashedEmail="SyncHashedEmail";class Ue extends De{constructor(e){super(),this.apiName=e}getEventName(){return"api-usage"}getPropertiesAsJson(){return Object.assign({api:this.apiName.toString()},super.getPropertiesAsJson())}}class Be extends We{constructor(){super()}getProfileName(){return"all_websites"}getDateUtc(){const e=new Date;return`${e.getUTCMonth()+1}_${e.getUTCDate()}_${e.getUTCFullYear()}`}getOperationData(){const e={$add:{},$ignore_time:!0};return e.$add[`pageview_${this.getDateUtc()}`]=1,e}}class Le{constructor(e,t){this.isFeatureEnabled=e,this.mixpanelReportingToken=t}static get MIXPANEL_REPORTING_URL(){return"https://api.mixpanel.com"}isEnabled(){return this.isFeatureEnabled&&!!this.mixpanelReportingToken}reportEvent(e){if(!this.isEnabled())return Promise.resolve(null);const t={event:e.getEventName(),properties:Object.assign({token:this.mixpanelReportingToken},e.getPropertiesAsJson())},i=Re(JSON.stringify(t)),n={method:"GET",headers:new Headers,cache:"no-cache"};return fetch(`${Le.MIXPANEL_REPORTING_URL}/track/?data=${i}`,n)}reportEngagement(e){if(!this.isEnabled())return Promise.resolve(null);let t={$token:this.mixpanelReportingToken,$distinct_id:e.getProfileName()};t=Object.assign({},t,e.getOperationData());const i=Re(JSON.stringify(t)),n={method:"GET",headers:new Headers,cache:"no-cache"};return fetch(`${Le.MIXPANEL_REPORTING_URL}/engage/?data=${i}`,n)}shouldCollectPageView(){const e=new Date;return e.getUTCMonth()+1<=2&&e.getUTCDate()<=10&&e.getUTCFullYear()<=2018&&e.getUTCMonth()+1>=2&&e.getUTCDate()>=8&&e.getUTCFullYear()>=2018}reportPageView(){this.shouldCollectPageView()&&this.reportEngagement(new Be)}}(ke=Me||(Me={}))[ke.HttpPermissionRequest=0]="HttpPermissionRequest",ke[ke.SyncHashedEmail=1]="SyncHashedEmail";class je extends u.a{constructor(e){switch(e){case Me.HttpPermissionRequest:super("The HTTP permission request has been deprecated. Please remove any custom popups from your code."),this.reportUsage(Ae.HttpPermissionRequest);break;case Me.SyncHashedEmail:super("API syncHashedEmail() has been deprecated and will be removed in a future SDK release. Please remove any usages from your code."),this.reportUsage(Ae.SyncHashedEmail)}Object.setPrototypeOf(this,je.prototype)}reportUsage(e){"undefined"!=typeof OneSignal&&OneSignal.context&&OneSignal.context.metricsManager&&OneSignal.context.metricsManager.reportEvent(new Ue(e))}}var Fe=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class He{static internalInit(){return Fe(this,void 0,void 0,function*(){k.a.debug("Called %cinternalInit()",Object(x.j)("code")),yield OneSignal.context.serviceWorkerManager.updateWorker(),OneSignal.context.sessionManager.incrementPageViewCount(),"visible"===document.visibilityState?yield He.sessionInit():Object(x.s)(document,"visibilitychange",(e,t)=>{"visible"===document.visibilityState&&(t(),He.sessionInit())},!0)})}static sessionInit(){return Fe(this,void 0,void 0,function*(){if(k.a.debug("Called %csessionInit()",Object(x.j)("code")),OneSignal._sessionInitAlreadyRunning)return void k.a.debug("Returning from sessionInit because it has already been called.");OneSignal._sessionInitAlreadyRunning=!0;try{yield He.doInitialize()}catch(e){if(e instanceof g)return;throw e}const e=yield OneSignal.internalIsOptedOut();O.a.isUsingSubscriptionWorkaround()||(yield He.handleAutoResubscribe(e));const t=yield OneSignal.privateIsPushNotificationsEnabled();if(OneSignal.config.userConfig.promptOptions.autoPrompt&&!e&&!t){c.a.chrome&&Number(c.a.version)>=63&&(c.a.tablet||c.a.mobile)||c.a.safari&&Number(c.a.version)>=12.1?(OneSignal.config.userConfig.promptOptions.slidedown.enabled=!0,yield OneSignal.context.promptsManager.internalShowSlidedownPrompt()):yield OneSignal.context.promptsManager.internalShowAutoPrompt()}OneSignal._sessionInitAlreadyRunning=!1,yield b.a.trigger(OneSignal.EVENTS.SDK_INITIALIZED)})}static registerForPushNotifications(e={}){return Fe(this,void 0,void 0,function*(){if(e&&e.modalPrompt)return OneSignal.subscriptionModalHost=new te(OneSignal.config.appId,e),void(yield OneSignal.subscriptionModalHost.load());if(O.a.isUsingSubscriptionWorkaround())return e.httpPermissionRequest?void k.a.error(new je(Me.HttpPermissionRequest)):void(yield He.loadSubscriptionPopup(e));if(c.a.safari&&Number(c.a.version)>=12.1)return void(yield J.internalRegisterForPush(!1));(yield OneSignal.internalIsOptedOut())||(yield J.registerForPush())})}static onSdkInitialized(){return Fe(this,void 0,void 0,function*(){const e=yield He.processExpiringSubscriptions();(yield OneSignal.context.subscriptionManager.isAlreadyRegisteredWithOneSignal())?e||(yield OneSignal.context.updateManager.sendOnSessionUpdate()):OneSignal.config.userConfig.promptOptions.autoPrompt||OneSignal.config.userConfig.autoResubscribe||(yield OneSignal.context.updateManager.sendOnSessionUpdate()),yield b.a.trigger(OneSignal.EVENTS.SDK_INITIALIZED_PUBLIC)})}static loadSubscriptionPopup(e){return Fe(this,void 0,void 0,function*(){OneSignal.subscriptionPopupHost=new _e(OneSignal.proxyFrameHost.url,e),yield OneSignal.subscriptionPopupHost.load()})}static storeInitialValues(){return Fe(this,void 0,void 0,function*(){const e=yield OneSignal.privateIsPushNotificationsEnabled(),t=yield OneSignal.privateGetNotificationPermission(),i=yield OneSignal.internalIsOptedOut();S.put("subscription.optedOut",i),yield M.a.put("Options",{key:"isPushEnabled",value:e}),yield M.a.put("Options",{key:"notificationPermission",value:t})})}static setWelcomeNotificationFlag(){return Fe(this,void 0,void 0,function*(){(yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.context.appConfig.safariWebId))===B.Granted&&(OneSignal.__doNotShowWelcomeNotification=!0)})}static establishServiceWorkerChannel(){return Fe(this,void 0,void 0,function*(){if(navigator.serviceWorker&&"https:"===window.location.protocol&&!(yield P.a.isFrameContextInsecure()))try{const e=yield Ce.getRegistration();e&&e.active&&(yield OneSignal.context.serviceWorkerManager.establishServiceWorkerChannel())}catch(e){k.a.error(e)}})}static processExpiringSubscriptions(){return Fe(this,void 0,void 0,function*(){const e=OneSignal.context;if(k.a.debug("Checking subscription expiration..."),!(yield e.subscriptionManager.isSubscriptionExpiring()))return k.a.debug("Subscription is not considered expired."),!1;const t=yield P.a.getIntegration(),i=P.a.getWindowEnv();switch(k.a.debug("Subscription is considered expiring. Current Integration:",t),t){case ue.a.Secure:const n=yield e.subscriptionManager.subscribe(1);yield e.subscriptionManager.registerSubscription(n);break;case ue.a.SecureProxy:if(i===j.a.OneSignalProxyFrame)yield this.registerSubscriptionInProxyFrame(e);else{yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.PROCESS_EXPIRING_SUBSCRIPTIONS)}break;case ue.a.InsecureProxy:yield M.a.remove("Ids","registrationId"),k.a.debug("Unsubscribed expiring HTTP subscription by removing registration ID.")}return!0})}static registerSubscriptionInProxyFrame(e){return Fe(this,void 0,void 0,function*(){const t=yield new Promise(t=>{e.workerMessenger.once(ie.SubscribeNew,e=>{t(de.a.deserialize(e))}),e.workerMessenger.unicast(ie.SubscribeNew,e.appConfig)});return k.a.debug("Finished registering brand new subscription:",t),t})}static doInitialize(){return Fe(this,void 0,void 0,function*(){const e=[];e.push(He.storeInitialValues()),e.push(He.installNativePromptPermissionChangedHook()),e.push(He.setWelcomeNotificationFlag()),e.push(He.establishServiceWorkerChannel()),e.push(He.showNotifyButton()),e.push(He.showPromptsFromWebConfigEditor()),OneSignal.context.cookieSyncer.install();try{yield Promise.all(e)}catch(e){throw k.a.error(e),new g(s.Unknown)}})}static showNotifyButton(){return Fe(this,void 0,void 0,function*(){if(l.a.isBrowser()&&!OneSignal.notifyButton){OneSignal.config.userConfig.notifyButton=OneSignal.config.userConfig.notifyButton||{},OneSignal.config.userConfig.bell&&(OneSignal.config.userConfig.bell=Object.assign({},OneSignal.config.userConfig.bell,OneSignal.config.userConfig.notifyButton),OneSignal.config.userConfig.notifyButton=Object.assign({},OneSignal.config.userConfig.notifyButton,OneSignal.config.userConfig.bell));const e=OneSignal.config.userConfig.notifyButton.displayPredicate;e&&"function"==typeof e?OneSignal.emitter.once(OneSignal.EVENTS.SDK_INITIALIZED,()=>Fe(this,void 0,void 0,function*(){!1!==(yield Promise.resolve(OneSignal.config.userConfig.notifyButton.displayPredicate()))?(OneSignal.notifyButton=new we(OneSignal.config.userConfig.notifyButton),OneSignal.notifyButton.create()):k.a.debug("Notify button display predicate returned false so not showing the notify button.")})):(OneSignal.notifyButton=new we(OneSignal.config.userConfig.notifyButton),OneSignal.notifyButton.create())}})}static updateEmailSessionCount(){return Fe(this,void 0,void 0,function*(){const e=OneSignal.context;if(e.sessionManager.isFirstPageView()){const t=yield M.a.getEmailProfile();if(t.emailId){const i=new E(t.emailAddress,t.emailAuthHash);i.appId=e.appConfig.appId,yield N.updateUserSession(t.emailId,i)}}})}static showPromptsFromWebConfigEditor(){return Fe(this,void 0,void 0,function*(){const e=OneSignal.config;e.userConfig.promptOptions&&(yield R.initialize(e.userConfig.promptOptions.customlink))})}static installNativePromptPermissionChangedHook(){return Fe(this,void 0,void 0,function*(){if(navigator.permissions&&!(c.a.firefox&&Number(c.a.version)<=45)){OneSignal._usingNativePermissionHook=!0,(yield navigator.permissions.query({name:"notifications"})).onchange=function(){Object(x.w)()}}})}static saveInitOptions(){return Fe(this,void 0,void 0,function*(){let e=[];!1===OneSignal.config.userConfig.persistNotification?e.push(M.a.put("Options",{key:"persistNotification",value:!1})):!0===OneSignal.config.userConfig.persistNotification?e.push(M.a.put("Options",{key:"persistNotification",value:"force"})):e.push(M.a.put("Options",{key:"persistNotification",value:!0}));let t=OneSignal.config.userConfig.webhooks;return["notification.displayed","notification.clicked","notification.dismissed"].forEach(i=>{t&&t[i]?e.push(M.a.put("Options",{key:`webhooks.${i}`,value:t[i]})):e.push(M.a.put("Options",{key:`webhooks.${i}`,value:!1}))}),t&&t.cors?e.push(M.a.put("Options",{key:"webhooks.cors",value:!0})):e.push(M.a.put("Options",{key:"webhooks.cors",value:!1})),OneSignal.config.userConfig.notificationClickHandlerMatch?e.push(M.a.put("Options",{key:"notificationClickHandlerMatch",value:OneSignal.config.userConfig.notificationClickHandlerMatch})):e.push(M.a.put("Options",{key:"notificationClickHandlerMatch",value:"exact"})),OneSignal.config.userConfig.notificationClickHandlerAction?e.push(M.a.put("Options",{key:"notificationClickHandlerAction",value:OneSignal.config.userConfig.notificationClickHandlerAction})):e.push(M.a.put("Options",{key:"notificationClickHandlerAction",value:"navigate"})),Promise.all(e)})}static initSaveState(e){return Fe(this,void 0,void 0,function*(){const t=yield K.getAppId();yield M.a.put("Ids",{type:"appId",id:t});const i=e||document.title||"Notification";yield M.a.put("Options",{key:"pageTitle",value:i}),k.a.info(`OneSignal: Set pageTitle to be '${i}'.`);const n=OneSignal.config;yield M.a.put("Options",{key:"emailAuthRequired",value:!!n.emailAuthRequired})})}static handleAutoResubscribe(e){return Fe(this,void 0,void 0,function*(){if(k.a.info("handleAutoResubscribe",{autoResubscribe:OneSignal.config.userConfig.autoResubscribe,isOptedOut:e}),OneSignal.config.userConfig.autoResubscribe&&!e){(yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.context.appConfig.safariWebId))==B.Granted&&(yield J.registerForPush())}})}static polyfillSafariFetch(){return Fe(this,void 0,void 0,function*(){if(c.a.safari&&void 0===window.fetch){k.a.debug("Loading fetch polyfill for Safari..");try{yield(new le).loadFetchPolyfill(),k.a.debug("Done loading fetch polyfill.")}catch(e){k.a.debug("Error loading fetch polyfill:",e)}}})}static errorIfInitAlreadyCalled(){if(OneSignal._initCalled)throw new g(s.MultipleInitialization);OneSignal._initCalled=!0}}var Ve=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class $e{static markHttpsNativePromptDismissed(){return Ve(this,void 0,void 0,function*(){if(Object(x.o)())try{yield new Promise((e,t)=>{OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.MARK_PROMPT_DISMISSED,{},i=>{i.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():t()})})}catch(e){k.a.debug("Proxy Frame possibly didn't not receive MARK_PROMPT_DISMISSED message",e||"")}let e=yield M.a.get("Options","promptDismissCount");e||(e=0),Object(x.o)()||(e+=1);let t=3;2==e?t=7:e>2&&(t=30),k.a.debug(`(${P.a.getWindowEnv().toString()}) OneSignal: User dismissed the native notification prompt; reprompt after ${t} days.`),yield M.a.put("Options",{key:"promptDismissCount",value:e});const i=24*t*60;return H.setItem("onesignal-notification-prompt","dismissed",i)})}}var ze=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Ge{constructor(e,t=!1){this.context=e,this.isFeatureEnabled=t}get PUBLISHER_ID(){try{return`os!${this.context.appConfig.appId.replace(/-/g,"").substr(0,15).toLowerCase()}`}catch(e){return"os!os"}}getFrameOrigin(){return!!this.context.appConfig.subdomain?new URL(`https://${this.context.appConfig.subdomain}.os.tc`):new URL(P.a.getOneSignalApiUrl().origin)}install(){return ze(this,void 0,void 0,function*(){if(window.top!==window)return;const e=this.getFrameOrigin();this.isFeatureEnabled?(e.pathname="/webPushAnalytics",e.search=`sync=true&appId=${this.PUBLISHER_ID}`):e.pathname="/webPushAnalytics";const t=document.createElement("iframe");t.style.display="none",t.src=e.href;const i={promise:void 0,resolver:void 0,rejector:void 0};return i.promise=new Promise((e,t)=>{i.resolver=e,i.rejector=t}),document.body.appendChild(t),t.onload=i.resolver,t.onerror=i.rejector,i.promise})}}class Ke{constructor(){this.incrementedPageViewCount=!1}getPageViewCount(){try{const e=sessionStorage.getItem(Ke.SESSION_STORAGE_KEY_NAME),t=e?parseInt(e):0;return isNaN(t)?0:t}catch(e){return 0}}setPageViewCount(e){try{sessionStorage.setItem(Ke.SESSION_STORAGE_KEY_NAME,e.toString()),P.a.getWindowEnv()===j.a.OneSignalSubscriptionPopup&&OneSignal.subscriptionPopup&&OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.SET_SESSION_COUNT)}catch(e){}}incrementPageViewCount(){if(this.incrementedPageViewCount)return;const e=this.getPageViewCount()+1;this.setPageViewCount(e),k.a.debug(`Incremented page view count to ${e}.`),this.incrementedPageViewCount=!0}simulatePageNavigationOrRefresh(){this.incrementedPageViewCount=!1}isFirstPageView(){return 1===this.getPageViewCount()}}Ke.SESSION_STORAGE_KEY_NAME="onesignal-pageview-count";var qe,Ye,Je=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Ze{static get STORED_PERMISSION_KEY(){return"storedNotificationPermission"}getNotificationPermission(e){return Je(this,void 0,void 0,function*(){const t=yield this.getReportedNotificationPermission(e);return(yield this.isPermissionEnvironmentAmbiguous(t))?yield this.getInterpretedAmbiguousPermission(t):t})}getReportedNotificationPermission(e){return Je(this,void 0,void 0,function*(){return c.a.safari?Ze.getSafariNotificationPermission(e):O.b.isUsingSubscriptionWorkaround()?yield this.getOneSignalSubdomainNotificationPermission(e):this.getW3cNotificationPermission()})}static getSafariNotificationPermission(e){if(e)return window.safari.pushNotification.permission(e).permission;throw new InvalidArgumentError.a("safariWebId",InvalidArgumentError.b.Empty)}getW3cNotificationPermission(){return window.Notification.permission}getOneSignalSubdomainNotificationPermission(e){return Je(this,void 0,void 0,function*(){return new Promise(t=>{OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION,{safariWebId:e},e=>{let i=e.data;t(i)})})})}isPermissionEnvironmentAmbiguous(e){return Je(this,void 0,void 0,function*(){const t=O.b.redetectBrowserUserAgent();return!t.safari&&!t.firefox&&e===B.Denied&&(this.isCurrentFrameContextCrossOrigin()||(yield P.a.isFrameContextInsecure())||O.b.isUsingSubscriptionWorkaround()||P.a.isInsecureOrigin())})}isCurrentFrameContextCrossOrigin(){let e;try{e=window.top.location.origin}catch(e){return!0}return window.top!==window&&e!==window.location.origin}getInterpretedAmbiguousPermission(e){return Je(this,void 0,void 0,function*(){switch(e){case B.Denied:const t=yield this.getStoredPermission();return t||B.Default;default:return e}})}getStoredPermission(){return Je(this,void 0,void 0,function*(){return yield M.a.get("Options",Ze.STORED_PERMISSION_KEY)})}setStoredPermission(e){return Je(this,void 0,void 0,function*(){yield M.a.put("Options",{key:Ze.STORED_PERMISSION_KEY,value:e})})}updateStoredPermission(){return Je(this,void 0,void 0,function*(){const e=yield this.getNotificationPermission();return yield this.setStoredPermission(e)})}}class Xe{isNewSubscription(){return this.existingW3cPushSubscription?!!this.existingW3cPushSubscription.w3cEndpoint!=!!this.w3cEndpoint||(!(!this.existingW3cPushSubscription.w3cEndpoint||!this.w3cEndpoint||this.existingW3cPushSubscription.w3cEndpoint.toString()===this.w3cEndpoint.toString())||(this.existingW3cPushSubscription.w3cP256dh!==this.w3cP256dh||this.existingW3cPushSubscription.w3cAuth!==this.w3cAuth)):!this.existingSafariDeviceToken||this.existingSafariDeviceToken!==this.safariDeviceToken}static setFromW3cSubscription(e){const t=new Xe;if(e&&(t.w3cEndpoint=new URL(e.endpoint),e.getKey)){let i=null;try{i=e.getKey("p256dh")}catch(e){}let n=null;try{n=e.getKey("auth")}catch(e){}if(i){let e=btoa(String.fromCharCode.apply(null,new Uint8Array(i)));t.w3cP256dh=e}if(n){let e=btoa(String.fromCharCode.apply(null,new Uint8Array(n)));t.w3cAuth=e}}return t}setFromSafariSubscription(e){this.safariDeviceToken=e}serialize(){return{w3cEndpoint:this.w3cEndpoint?this.w3cEndpoint.toString():null,w3cP256dh:this.w3cP256dh,w3cAuth:this.w3cAuth,safariDeviceToken:this.safariDeviceToken,existingPushSubscription:this.existingW3cPushSubscription?this.existingW3cPushSubscription.serialize():null,existingSafariDeviceToken:this.existingSafariDeviceToken}}static deserialize(e){const t=new Xe;if(!e)return t;try{t.w3cEndpoint=new URL(e.w3cEndpoint)}catch(e){}return t.w3cP256dh=e.w3cP256dh,t.w3cAuth=e.w3cAuth,t.existingW3cPushSubscription=void 0,e.existingW3cPushSubscription?t.existingW3cPushSubscription=Xe.deserialize(e.existingW3cPushSubscription):e.existingPushSubscription&&(t.existingW3cPushSubscription=Xe.deserialize(e.existingPushSubscription)),t.safariDeviceToken=e.safariDeviceToken,t.existingSafariDeviceToken=e.existingSafariDeviceToken,t}}class Qe extends w{constructor(e){super(),this.subscription=e}serialize(){const e=super.serialize();return this.subscription&&(e.identifier=c.a.safari?this.subscription.safariDeviceToken:this.subscription.w3cEndpoint?this.subscription.w3cEndpoint.toString():null,e.web_auth=this.subscription.w3cAuth,e.web_p256=this.subscription.w3cP256dh),e}static createFromPushSubscription(e,t,i){const n=new Qe(t);return n.appId=e,n.subscriptionState=t?L.Subscribed:L.NotSubscribed,i&&(n.subscriptionState=i),n}deserialize(e){throw new y}}(Ye=qe||(qe={}))[Ye.InvalidSafariSetup=0]="InvalidSafariSetup",Ye[Ye.Blocked=1]="Blocked",Ye[Ye.Dismissed=2]="Dismissed";class et extends u.a{constructor(e){switch(e){case qe.InvalidSafariSetup:super("The Safari site URL, icon size, or push certificate is invalid, or Safari is in a private session.");break;case qe.Blocked:super("Notification permissions are blocked.");break;case qe.Dismissed:super("The notification permission prompt was dismissed.")}Object.setPrototypeOf(this,et.prototype)}}var tt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class it{constructor(e,t){this.context=e,this.config=t}static isSafari(){return l.a.isSafari()}subscribe(e){return tt(this,void 0,void 0,function*(){const t=P.a.getWindowEnv();switch(t){case j.a.CustomIframe:case j.a.Unknown:case j.a.OneSignalProxyFrame:throw new InvalidStateError.a(InvalidStateError.b.UnsupportedEnvironment)}let i;switch(t){case j.a.ServiceWorker:i=yield this.subscribeFcmFromWorker(e);break;case j.a.Host:case j.a.OneSignalSubscriptionModal:case j.a.OneSignalSubscriptionPopup:if((yield OneSignal.privateGetNotificationPermission())===B.Denied)throw new q(V.Blocked);i=it.isSafari()?yield this.subscribeSafari():yield this.subscribeFcmFromPage(e);break;default:throw new InvalidStateError.a(InvalidStateError.b.UnsupportedEnvironment)}return i})}registerSubscription(e,t){return tt(this,void 0,void 0,function*(){e&&(e=Xe.deserialize(e));const i=Qe.createFromPushSubscription(this.config.appId,e,t);let n=void 0;(yield this.isAlreadyRegisteredWithOneSignal())?yield this.context.updateManager.sendPlayerUpdate(i):(n=yield this.context.updateManager.sendPlayerCreate(i))&&(yield this.associateSubscriptionWithEmail(n));const o=yield M.a.getSubscription();return o.deviceId=n,o.optedOut=!1,e?it.isSafari()?o.subscriptionToken=e.safariDeviceToken:o.subscriptionToken=e.w3cEndpoint?e.w3cEndpoint.toString():null:o.subscriptionToken=null,yield M.a.setSubscription(o),P.a.getWindowEnv()!==j.a.ServiceWorker&&b.a.trigger(OneSignal.EVENTS.REGISTERED),"undefined"!=typeof OneSignal&&(OneSignal._sessionInitAlreadyRunning=!1),o})}static requestPresubscribeNotificationPermission(){return tt(this,void 0,void 0,function*(){return yield it.requestNotificationPermission()})}unsubscribe(e){return tt(this,void 0,void 0,function*(){if(0===e)throw new y;if(1!==e)throw new y;if(P.a.getWindowEnv()!==j.a.ServiceWorker)throw new y;{const{deviceId:e}=yield M.a.getSubscription();yield N.updatePlayer(this.context.appConfig.appId,e,{notification_types:L.MutedByApi}),yield M.a.put("Options",{key:"optedOut",value:!0})}})}static requestNotificationPermission(){return new Promise(e=>window.Notification.requestPermission(e))}associateSubscriptionWithEmail(e){return tt(this,void 0,void 0,function*(){const t=yield M.a.getEmailProfile();t.emailId&&(yield N.updatePlayer(this.config.appId,e,{parent_player_id:t.emailId,email:t.emailAddress}))})}isAlreadyRegisteredWithOneSignal(){return tt(this,void 0,void 0,function*(){const{deviceId:e}=yield M.a.getSubscription();return!!e})}subscribeSafariPromptPermission(){return new Promise(e=>{window.safari.pushNotification.requestPermission(`${P.a.getOneSignalApiUrl().toString()}/safari`,this.config.safariWebId,{app_id:this.config.appId},t=>{t.deviceToken?e(t.deviceToken.toLowerCase()):e(null)})})}subscribeSafari(){return tt(this,void 0,void 0,function*(){const e=new Xe;if(!this.config.safariWebId)throw new g(s.MissingSafariWebId);const{deviceToken:t}=window.safari.pushNotification.permission(this.config.safariWebId);e.existingSafariDeviceToken=t,t||b.a.trigger(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED);const i=yield this.subscribeSafariPromptPermission();if(z.a.triggerNotificationPermissionChanged(),!i)throw new et(qe.InvalidSafariSetup);return e.setFromSafariSubscription(i),e})}subscribeFcmFromPage(e){return tt(this,void 0,void 0,function*(){if(P.a.getWindowEnv()!==j.a.ServiceWorker&&window.Notification.permission===B.Default){yield b.a.trigger(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED);const e=yield it.requestPresubscribeNotificationPermission();switch(e===B.Default&&(yield z.a.triggerNotificationPermissionChanged(!0)),e){case B.Default:throw k.a.debug("Exiting subscription and not registering worker because the permission was dismissed."),OneSignal._sessionInitAlreadyRunning=!1,OneSignal._isRegisteringForPush=!1,new q(V.Dismissed);case B.Denied:throw k.a.debug("Exiting subscription and not registering worker because the permission was blocked."),OneSignal._sessionInitAlreadyRunning=!1,OneSignal._isRegisteringForPush=!1,new q(V.Blocked)}}if(yield this.context.serviceWorkerManager.shouldInstallWorker())try{yield this.context.serviceWorkerManager.installWorker()}catch(e){throw e instanceof Ie&&(403===e.status?yield this.context.subscriptionManager.registerFailedSubscription(L.ServiceWorkerStatus403,this.context):404===e.status&&(yield this.context.subscriptionManager.registerFailedSubscription(L.ServiceWorkerStatus404,this.context))),e}k.a.debug("Waiting for the service worker to activate...");const t=yield navigator.serviceWorker.ready;return k.a.debug("Service worker is ready to continue subscribing."),yield this.subscribeFcmVapidOrLegacyKey(t.pushManager,e)})}subscribeFcmFromWorker(e){return tt(this,void 0,void 0,function*(){if(!self.registration.active&&!c.a.firefox)throw new InvalidStateError.a(InvalidStateError.b.ServiceWorkerNotActivated);const t=yield self.registration.pushManager.permissionState({userVisibleOnly:!0});if("denied"===t)throw new q(V.Blocked);if("prompt"===t)throw new q(V.Default);return yield this.subscribeFcmVapidOrLegacyKey(self.registration.pushManager,e)})}getVapidKeyForBrowser(){let e=void 0;return(e=c.a.firefox?this.config.onesignalVapidPublicKey:this.config.vapidPublicKey)?function(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=atob(t),n=new Uint8Array(i.length);for(let e=0;e=i}})}isSubscriptionExpiringForSecureIntegration(){return tt(this,void 0,void 0,function*(){const e=yield this.context.serviceWorkerManager.getActiveState();if(e!==oe.a.WorkerA&&e!==oe.a.WorkerB)return!1;const t=yield Ce.getRegistration();if(!t)return!1;if(!t.pushManager)return!1;const i=yield t.pushManager.getSubscription();if(!i)return!1;if(!i.expirationTime)return!1;let{createdAt:n}=yield M.a.getSubscription();if(!n){const e=31536e6;n=(new Date).getTime()+e}const o=n+(i.expirationTime-n)/2;return!!i.expirationTime&&((new Date).getTime()>=i.expirationTime||(new Date).getTime()>=o)})}getSubscriptionState(){return tt(this,void 0,void 0,function*(){if(it.isSafari())return this.getSubscriptionStateForSecure();const e=P.a.getWindowEnv();switch(e){case j.a.ServiceWorker:const t=yield self.registration.pushManager.getSubscription(),{optedOut:i}=yield M.a.getSubscription();return{subscribed:!!t,optedOut:!!i};default:switch(yield P.a.getIntegration()){case ue.a.Secure:return this.getSubscriptionStateForSecure();case ue.a.SecureProxy:switch(e){case j.a.OneSignalProxyFrame:case j.a.OneSignalSubscriptionPopup:case j.a.OneSignalSubscriptionModal:return this.getSubscriptionStateForSecure();default:return yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.GET_SUBSCRIPTION_STATE)}case ue.a.InsecureProxy:return yield this.getSubscriptionStateForInsecure();default:throw new InvalidStateError.a(InvalidStateError.b.UnsupportedEnvironment)}}})}getSubscriptionStateForSecure(){return tt(this,void 0,void 0,function*(){const{deviceId:e,optedOut:t}=yield M.a.getSubscription();if(it.isSafari()){const i=window.safari.pushNotification.permission(this.config.safariWebId);return{subscribed:!("granted"!==i.permission||!i.deviceToken||!e),optedOut:!!t}}const i=yield this.context.serviceWorkerManager.getActiveState(),n=yield Ce.getRegistration(),o=yield this.context.permissionManager.getNotificationPermission(this.context.appConfig.safariWebId),s=i===oe.a.WorkerA||i===oe.a.WorkerB;return n?{subscribed:!(!e||o!==B.Granted||!s),optedOut:!!t}:{subscribed:!1,optedOut:!!t}})}getSubscriptionStateForInsecure(){return tt(this,void 0,void 0,function*(){const{deviceId:e,subscriptionToken:t,optedOut:i}=yield M.a.getSubscription(),n=yield this.context.permissionManager.getNotificationPermission(this.context.appConfig.safariWebId);return{subscribed:!(!e||!t||n!==B.Granted),optedOut:!!i}})}registerFailedSubscription(e,t){return tt(this,void 0,void 0,function*(){t.sessionManager.isFirstPageView()&&(t.subscriptionManager.registerSubscription(new Xe,e),t.sessionManager.incrementPageViewCount())})}}var nt=class{static getServiceWorkerManager(e){const t=e.appConfig,i=P.a.getBuildEnvPrefix(),n={workerAPath:new Ee(`/${i}OneSignalSDKWorker.js`),workerBPath:new Ee(`/${i}OneSignalSDKUpdaterWorker.js`),registrationOptions:{scope:"/"}};return t.userConfig&&(t.userConfig.path&&(n.workerAPath=new Ee(`${t.userConfig.path}${i}${t.userConfig.serviceWorkerPath}`),n.workerBPath=new Ee(`${t.userConfig.path}${i}${t.userConfig.serviceWorkerUpdaterPath}`)),t.userConfig.serviceWorkerParam&&(n.registrationOptions=t.userConfig.serviceWorkerParam)),new Ce(e,n)}static getSubscriptionManager(e){const t=e.appConfig,i={safariWebId:t.safariWebId,appId:t.appId,vapidPublicKey:t.vapidPublicKey,onesignalVapidPublicKey:t.onesignalVapidPublicKey};return new it(e,i)}},ot=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class st{constructor(e){this.context=e,this.onSessionSent=e.sessionManager.getPageViewCount()>1}getDeviceId(){return ot(this,void 0,void 0,function*(){const{deviceId:e}=yield M.a.getSubscription();if(!e)throw new d(n.NoDeviceId);return e})}createDeviceRecord(){return ot(this,void 0,void 0,function*(){const e=new Qe;return e.appId=this.context.appConfig.appId,e.subscriptionState=yield K.getCurrentNotificationType(),e})}sendPlayerUpdate(e){return ot(this,void 0,void 0,function*(){if(!(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal()))return void k.a.debug("Not sending the update because user is not registered with OneSignal (no device id)");const t=yield this.getDeviceId();e||(e=yield this.createDeviceRecord()),this.onSessionSent?yield N.updatePlayer(this.context.appConfig.appId,t,Object.assign({notification_types:L.Subscribed},e.serialize())):yield this.sendOnSessionUpdate(e)})}sendOnSessionUpdate(e){return ot(this,void 0,void 0,function*(){if(this.onSessionSent)return;if(!this.context.sessionManager.isFirstPageView())return;if(!(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal()))return void k.a.debug("Not sending the on session because user is not registered with OneSignal (no device id)");const t=yield this.getDeviceId();if(e||(e=yield this.createDeviceRecord()),e.subscriptionState===L.Subscribed||!0===OneSignal.config.enableOnSession)try{yield N.updateUserSession(t,e),this.onSessionSent=!0}catch(e){k.a.error(`Failed to update user session. Error "${e.message}" ${e.stack}`)}})}sendPlayerCreate(e){return ot(this,void 0,void 0,function*(){try{const t=yield N.createUser(e);return t?(k.a.info("Subscribed to web push and registered with OneSignal",e,t),this.onSessionSent=!0,t):void k.a.error("Failed to create user.")}catch(e){return void k.a.error(`Failed to create user. Error "${e.message}" ${e.stack}`)}})}onSessionAlreadyCalled(){return this.onSessionSent}sendExternalUserIdUpdate(e){return ot(this,void 0,void 0,function*(){const t=yield this.getDeviceId();yield N.updatePlayer(this.context.appConfig.appId,t,{external_user_id:I.b.getValueOrDefault(e,"")})})}}class rt extends u.a{constructor(){super("This operation can only be performed when the user is not subscribed."),Object.setPrototypeOf(this,rt.prototype)}}class at extends u.a{constructor(){super("The permission message was previously dismissed."),Object.setPrototypeOf(this,at.prototype)}}var ct=i(23),lt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class ut{static get EVENTS(){return{ALLOW_CLICK:"popoverAllowClick",CANCEL_CLICK:"popoverCancelClick",SHOWN:"popoverShown",CLOSED:"popoverClosed"}}constructor(e){e||(e=K.getSlidedownPermissionMessageOptions(OneSignal.config.userConfig.promptOptions)),this.options=e,this.options.actionMessage=e.actionMessage.substring(0,90),this.options.acceptButtonText=e.acceptButtonText.substring(0,15),this.options.cancelButtonText=e.cancelButtonText.substring(0,15),this.notificationIcons=null}create(){return lt(this,void 0,void 0,function*(){if(null===this.notificationIcons){const e=yield K.getNotificationIcons();this.notificationIcons=e,this.container&&Object(x.u)("#onesignal-popover-container");let t=this.getPlatformNotificationIcon(),i=`
notification icon
${this.options.actionMessage}
`;Object(x.b)("body","beforeend",'
'),Object(x.b)(this.container,"beforeend",`
${i}
`),Object(x.a)(this.container,c.a.mobile?"slide-up":"slide-down"),this.allowButton.addEventListener("click",this.onPopoverAllowed.bind(this)),this.cancelButton.addEventListener("click",this.onPopoverCanceled.bind(this)),b.a.trigger(ut.EVENTS.SHOWN)}})}onPopoverAllowed(e){return lt(this,void 0,void 0,function*(){yield b.a.trigger(ut.EVENTS.ALLOW_CLICK)})}onPopoverCanceled(e){b.a.trigger(ut.EVENTS.CANCEL_CLICK),this.close()}close(){Object(x.a)(this.container,"close-popover"),Object(x.s)(this.dialog,"animationend",(e,t)=>{e.target!==this.dialog||"slideDownExit"!==e.animationName&&"slideUpExit"!==e.animationName||(Object(x.u)("#onesignal-popover-container"),t(),b.a.trigger(ut.EVENTS.CLOSED))},!0)}getPlatformNotificationIcon(){return this.notificationIcons?c.a.safari&&this.notificationIcons.safari?this.notificationIcons.safari:c.a.firefox&&this.notificationIcons.firefox?this.notificationIcons.firefox:this.notificationIcons.chrome||this.notificationIcons.firefox||this.notificationIcons.safari||"default-icon":"default-icon"}get container(){return document.querySelector("#onesignal-popover-container")}get dialog(){return document.querySelector("#onesignal-popover-dialog")}get allowButton(){return document.querySelector("#onesignal-popover-allow-button")}get cancelButton(){return document.querySelector("#onesignal-popover-cancel-button")}}var dt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class gt{constructor(e){this.isAutoPromptShowing=!1}checkIfAutoPromptShouldBeShown(e={force:!1}){return dt(this,void 0,void 0,function*(){if(this.isAutoPromptShowing)throw new InvalidStateError.a(InvalidStateError.b.RedundantPermissionMessage,{permissionPromptType:ct.a.SlidedownPermissionMessage});if(K.wasHttpsNativePromptDismissed()&&!e.force)return k.a.info(new at),!1;if((yield OneSignal.privateGetNotificationPermission())===B.Denied)return k.a.info(new q(V.Blocked)),!1;if(yield OneSignal.privateIsPushNotificationsEnabled())throw new rt;if(!(yield OneSignal.privateGetSubscription()))throw new d(n.OptedOut);return!0})}internalShowAutoPrompt(e={force:!1}){return dt(this,void 0,void 0,function*(){if(O.b.logMethodCall("internalShowAutoPrompt",e),!OneSignal.config||!OneSignal.config.userConfig||!OneSignal.config.userConfig.promptOptions)return void k.a.error("OneSignal config was not initialized correctly. Aborting.");const t=OneSignal.config.userConfig.promptOptions;t.native.enabled||t.slidedown.enabled?t.native&&t.native.enabled&&t.native.autoPrompt?yield this.internalShowNativePrompt():t.slidedown&&t.slidedown.enabled&&t.slidedown.autoPrompt&&(yield this.internalShowSlidedownPrompt(e)):k.a.error("No suitable prompt type enabled.")})}internalShowNativePrompt(){return dt(this,void 0,void 0,function*(){O.b.logMethodCall("internalShowNativePrompt"),this.isAutoPromptShowing?k.a.debug("Already showing autopromt. Abort showing a native prompt."):(this.isAutoPromptShowing=!0,K.markHttpPopoverShown(),yield He.registerForPushNotifications(),this.isAutoPromptShowing=!1,$e.markHttpsNativePromptDismissed())})}internalShowSlidedownPrompt(e={force:!1}){return dt(this,void 0,void 0,function*(){if(O.b.logMethodCall("internalShowSlidedownPrompt"),this.isAutoPromptShowing)return void k.a.debug("Already showing autopromt. Abort showing a slidedown.");try{if(!(yield this.checkIfAutoPromptShouldBeShown(e)))return}catch(e){return void k.a.warn("checkIfAutoPromptShouldBeShown returned an error",e)}if(K.markHttpPopoverShown(),0!==(yield OneSignal.context.dynamicResourceLoader.loadSdkStylesheet()))return void k.a.debug("Not showing slidedown permission message because styles failed to load.");const t=K.getSlidedownPermissionMessageOptions(OneSignal.config.userConfig.promptOptions);this.installEventHooksForPopover(),OneSignal.popover=new ut(t),yield OneSignal.popover.create(),k.a.debug("Showing Slidedown(Popover).")})}installEventHooksForPopover(){!function(){const e=OneSignal.notifyButton;e&&e.options.enable&&"hidden"!==OneSignal.notifyButton.launcher.state&&OneSignal.notifyButton.launcher.waitUntilShown().then(()=>{OneSignal.notifyButton.launcher.hide()}),OneSignal.emitter.once(ut.EVENTS.CLOSED,()=>{OneSignal.notifyButton&&OneSignal.notifyButton.options.enable&&OneSignal.notifyButton.launcher.show()})}(),OneSignal.emitter.once(ut.EVENTS.SHOWN,()=>{this.isAutoPromptShowing=!0}),OneSignal.emitter.once(ut.EVENTS.CLOSED,()=>{this.isAutoPromptShowing=!1}),OneSignal.emitter.once(ut.EVENTS.ALLOW_CLICK,()=>{OneSignal.popover&&OneSignal.popover.close(),k.a.debug("Setting flag to not show the popover to the user again."),$e.markHttpsNativePromptDismissed();He.registerForPushNotifications({autoAccept:!0})}),OneSignal.emitter.once(ut.EVENTS.CANCEL_CLICK,()=>{k.a.debug("Setting flag to not show the popover to the user again."),$e.markHttpsNativePromptDismissed()})}}class ht{constructor(e){this.appConfig=e,this.subscriptionManager=nt.getSubscriptionManager(this),this.serviceWorkerManager=nt.getServiceWorkerManager(this),this.sessionManager=new Ke,this.permissionManager=new Ze,this.workerMessenger=new ae(this),this.updateManager=new st(this),this.promptsManager=new gt(this),this.cookieSyncer=new Ge(this,e.cookieSyncEnabled),this.dynamicResourceLoader=new le,this.metricsManager=new Le(e.metrics.enable,e.metrics.mixpanelReportingToken)}}var pt=i(24),ft=i.n(pt),mt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};var bt,St,vt,yt=class{static downloadServerAppConfig(e){return mt(this,void 0,void 0,function*(){return I.a.enforceAppId(e),yield new Promise((t,i)=>{t(T.get(`sync/${e}/web`,null))})})}static getUserIdFromSubscriptionIdentifier(e,t,i){return I.a.enforceAppId(e),T.post("players",{app_id:e,device_type:t,identifier:i,notification_types:L.TemporaryWebRecord}).then(e=>e&&e.id?e.id:null).catch(e=>(k.a.debug("Error getting user ID from subscription identifier:",e),null))}static updatePlayer(e,t,i){return I.a.enforceAppId(e),I.a.enforcePlayerId(t),T.put(`players/${t}`,Object.assign({app_id:e},i))}},Ot=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class wt{static getPlayer(e,t){return N.getPlayer(e,t)}static updatePlayer(e,t,i){return N.updatePlayer(e,t,i)}static sendNotification(e,t,i,n,o,s,r,a){return N.sendNotification(e,t,i,n,o,s,r,a)}static jsonpLib(e,t){ft()(e,null,t)}static downloadServerAppConfig(e){return Ot(this,void 0,void 0,function*(){return P.a.getWindowEnv()!==j.a.ServiceWorker?yield new Promise((t,i)=>{wt.jsonpLib(`${P.a.getOneSignalApiUrl().toString()}/sync/${e}/web`,(e,n)=>{e?i(e):n.success?t(n):i(n)})}):yield yt.downloadServerAppConfig(e)})}static createUser(e){return Ot(this,void 0,void 0,function*(){return yield N.createUser(e)})}static createEmailRecord(e,t,i){return Ot(this,void 0,void 0,function*(){return yield N.createEmailRecord(e,t,i)})}static updateEmailRecord(e,t,i){return Ot(this,void 0,void 0,function*(){return yield N.updateEmailRecord(e,t,i)})}static logoutEmail(e,t,i){return Ot(this,void 0,void 0,function*(){return yield N.logoutEmail(e,t,i)})}static updateUserSession(e,t){return Ot(this,void 0,void 0,function*(){return yield N.updateUserSession(e,t)})}}!function(e){e.TypicalSite="typical",e.WordPress="wordpress",e.Shopify="shopify",e.Blogger="blogger",e.Magento="magento",e.Drupal="drupal",e.SquareSpace="squarespace",e.Joomla="joomla",e.Weebly="weebly",e.Wix="wix",e.Custom="custom"}(bt||(bt={})),function(e){e.Exact="exact",e.Origin="origin"}(St||(St={})),function(e){e.Navigate="navigate",e.Focus="focus"}(vt||(vt={}));var Et,Pt,It=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};(Pt=Et||(Et={}))[Pt.Dashboard=0]="Dashboard",Pt[Pt.JavaScript=1]="JavaScript";class Tt{static getAppConfig(e,t){return It(this,void 0,void 0,function*(){try{if(!e||!e.appId||!O.b.isValidUuid(e.appId))throw new g(s.InvalidAppId);const i=yield t(e.appId),n=this.getMergedConfig(e,i);return this.checkRestrictedOrigin(n),n}catch(e){if(e){if(1===e.code)throw new g(s.InvalidAppId);if(2===e.code)throw new g(s.AppNotConfiguredForWebPush)}throw e}})}static checkRestrictedOrigin(e){if(e.restrictedOriginEnabled&&P.a.getWindowEnv()!==j.a.ServiceWorker&&window.top===window&&!I.b.contains(window.location.hostname,".os.tc")&&!I.b.contains(window.location.hostname,".onesignal.com")&&!this.doesCurrentOriginMatchConfigOrigin(e.origin))throw new g(s.WrongSiteUrl,{siteUrl:e.origin})}static doesCurrentOriginMatchConfigOrigin(e){try{return location.origin===new URL(e).origin}catch(e){return!1}}static getIntegrationCapabilities(e){switch(e){case bt.Custom:case bt.WordPress:return{configuration:Et.JavaScript};default:return{configuration:Et.Dashboard}}}static getMergedConfig(e,t){const i=this.getConfigIntegrationKind(t),n=this.getSubdomainForConfigIntegrationKind(i,e,t),o=t.config.setupBehavior?t.config.setupBehavior.allowLocalhostAsSecureOrigin:e.allowLocalhostAsSecureOrigin,s=O.b.internalIsUsingSubscriptionWorkaround(n,o),r=this.getUserConfigForConfigIntegrationKind(i,e,t,s);return{appId:t.app_id,subdomain:n,origin:t.config.origin,httpUseOneSignalCom:t.config.http_use_onesignal_com,cookieSyncEnabled:t.features.cookie_sync.enable,restrictedOriginEnabled:t.features.restrict_origin&&t.features.restrict_origin.enable,metrics:{enable:t.features.metrics.enable,mixpanelReportingToken:t.features.metrics.mixpanel_reporting_token},safariWebId:t.config.safari_web_id,vapidPublicKey:t.config.vapid_public_key,onesignalVapidPublicKey:t.config.onesignal_vapid_public_key,emailAuthRequired:t.features.email&&t.features.email.require_auth,userConfig:r,enableOnSession:t.features.enable_on_session||!1}}static getConfigIntegrationKind(e){return e.config.integration?e.config.integration.kind:bt.Custom}static getCustomLinkConfig(e){const t={enabled:!1,style:"button",size:"medium",unsubscribeEnabled:!1,text:{explanation:"",subscribe:"",unsubscribe:""},color:{button:"",text:""}};if(!(e&&e.config&&e.config.staticPrompts&&e.config.staticPrompts.customlink&&e.config.staticPrompts.customlink.enabled))return t;const i=e.config.staticPrompts.customlink;return{enabled:i.enabled,style:i.style,size:i.size,unsubscribeEnabled:i.unsubscribeEnabled,text:i.text?{subscribe:i.text.subscribe,unsubscribe:i.text.unsubscribe,explanation:i.text.explanation}:t.text,color:i.color?{button:i.color.button,text:i.color.text}:t.color}}static injectDefaultsIntoPromptOptions(e,t,i,n=!1){let o={enabled:!1};e&&e.customlink&&(o=e.customlink);const s=t.customlink,r=Object.assign({},e,{customlink:{enabled:I.b.getValueOrDefault(o.enabled,s.enabled),style:I.b.getValueOrDefault(o.style,s.style),size:I.b.getValueOrDefault(o.size,s.size),unsubscribeEnabled:I.b.getValueOrDefault(o.unsubscribeEnabled,s.unsubscribeEnabled),text:{subscribe:I.b.getValueOrDefault(o.text?o.text.subscribe:void 0,s.text.subscribe),unsubscribe:I.b.getValueOrDefault(o.text?o.text.unsubscribe:void 0,s.text.unsubscribe),explanation:I.b.getValueOrDefault(o.text?o.text.explanation:void 0,s.text.explanation)},color:{button:I.b.getValueOrDefault(o.color?o.color.button:void 0,s.color.button),text:I.b.getValueOrDefault(o.color?o.color.text:void 0,s.color.text)}}});return r.slidedown?(r.slidedown.enabled=!!r.slidedown.enabled,r.slidedown.autoPrompt=r.slidedown.hasOwnProperty("autoPrompt")?!!r.slidedown.enabled&&!!r.slidedown.autoPrompt:!!r.slidedown.enabled):(r.slidedown=K.getSlidedownPermissionMessageOptions(r),r.slidedown.enabled=!1,r.slidedown.autoPrompt=!1),r.native?(r.native.enabled=!!r.native.enabled,r.native.autoPrompt=r.native.hasOwnProperty("autoPrompt")?!!r.native.enabled&&!!r.native.autoPrompt:!!r.native.enabled):r.native={enabled:!1,autoPrompt:!1},!0===i.autoRegister&&(n?(r.native.enabled=!1,r.native.autoPrompt=!1,r.slidedown.enabled=!0,r.slidedown.autoPrompt=!0):(r.native.enabled=!0,r.native.autoPrompt=!0)),r.autoPrompt=r.native.autoPrompt||r.slidedown.autoPrompt,r}static getPromptOptionsForDashboardConfiguration(e){const t=e.config.staticPrompts,i=t.native?{enabled:t.native.enabled,autoPrompt:t.native.enabled&&!1!==t.native.autoPrompt}:{enabled:!1,autoPrompt:!1},n={enabled:t.slidedown.enabled,autoPrompt:t.slidedown.enabled&&!1!==t.slidedown.autoPrompt,actionMessage:t.slidedown.actionMessage,acceptButtonText:t.slidedown.acceptButton,cancelButtonText:t.slidedown.cancelButton};return{autoPrompt:i.autoPrompt||n.autoPrompt,native:i,slidedown:n,fullscreen:{enabled:t.fullscreen.enabled,actionMessage:t.fullscreen.actionMessage,acceptButton:t.fullscreen.acceptButton,cancelButton:t.fullscreen.cancelButton,title:t.fullscreen.title,message:t.fullscreen.message,caption:t.fullscreen.caption,autoAcceptTitle:t.fullscreen.autoAcceptTitle},customlink:this.getCustomLinkConfig(e)}}static getUserConfigForConfigIntegrationKind(e,t,i,n=!1){switch(this.getIntegrationCapabilities(e).configuration){case Et.Dashboard:return{appId:i.app_id,autoRegister:!1,autoResubscribe:i.config.autoResubscribe,path:i.config.serviceWorker.path,serviceWorkerPath:i.config.serviceWorker.workerName,serviceWorkerUpdaterPath:i.config.serviceWorker.updaterWorkerName,serviceWorkerParam:{scope:i.config.serviceWorker.registrationScope},subdomainName:i.config.siteInfo.proxyOrigin,promptOptions:this.getPromptOptionsForDashboardConfiguration(i),welcomeNotification:{disable:!i.config.welcomeNotification.enable,title:i.config.welcomeNotification.title,message:i.config.welcomeNotification.message,url:i.config.welcomeNotification.url},notifyButton:{enable:i.config.staticPrompts.bell.enabled,displayPredicate:i.config.staticPrompts.bell.hideWhenSubscribed?()=>OneSignal.isPushNotificationsEnabled().then(e=>!e):null,size:i.config.staticPrompts.bell.size,position:i.config.staticPrompts.bell.location,showCredit:!1,offset:{bottom:i.config.staticPrompts.bell.offset.bottom+"px",left:i.config.staticPrompts.bell.offset.left+"px",right:i.config.staticPrompts.bell.offset.right+"px"},colors:{"circle.background":i.config.staticPrompts.bell.color.main,"circle.foreground":i.config.staticPrompts.bell.color.accent,"badge.background":"black","badge.foreground":"white","badge.bordercolor":"black","pulse.color":i.config.staticPrompts.bell.color.accent,"dialog.button.background.hovering":i.config.staticPrompts.bell.color.main,"dialog.button.background.active":i.config.staticPrompts.bell.color.main,"dialog.button.background":i.config.staticPrompts.bell.color.main,"dialog.button.foreground":"white"},text:{"tip.state.unsubscribed":i.config.staticPrompts.bell.tooltip.unsubscribed,"tip.state.subscribed":i.config.staticPrompts.bell.tooltip.subscribed,"tip.state.blocked":i.config.staticPrompts.bell.tooltip.blocked,"message.prenotify":i.config.staticPrompts.bell.tooltip.unsubscribed,"message.action.subscribing":i.config.staticPrompts.bell.message.subscribing,"message.action.subscribed":i.config.staticPrompts.bell.message.subscribing,"message.action.resubscribed":i.config.staticPrompts.bell.message.subscribing,"message.action.unsubscribed":i.config.staticPrompts.bell.message.unsubscribing,"dialog.main.title":i.config.staticPrompts.bell.dialog.main.title,"dialog.main.button.subscribe":i.config.staticPrompts.bell.dialog.main.subscribeButton,"dialog.main.button.unsubscribe":i.config.staticPrompts.bell.dialog.main.unsubscribeButton,"dialog.blocked.title":i.config.staticPrompts.bell.dialog.blocked.title,"dialog.blocked.message":i.config.staticPrompts.bell.dialog.blocked.message}},persistNotification:i.config.notificationBehavior?i.config.notificationBehavior.display.persist:void 0,webhooks:{cors:i.config.webhooks.corsEnable,"notification.displayed":i.config.webhooks.notificationDisplayedHook,"notification.clicked":i.config.webhooks.notificationClickedHook,"notification.dismissed":i.config.webhooks.notificationDismissedHook},notificationClickHandlerMatch:i.config.notificationBehavior?i.config.notificationBehavior.click.match:void 0,notificationClickHandlerAction:i.config.notificationBehavior?i.config.notificationBehavior.click.action:void 0,allowLocalhostAsSecureOrigin:i.config.setupBehavior?i.config.setupBehavior.allowLocalhostAsSecureOrigin:void 0,requiresUserPrivacyConsent:t.requiresUserPrivacyConsent};case Et.JavaScript:const o=Object.assign({},t,{promptOptions:this.injectDefaultsIntoPromptOptions(t.promptOptions,i.config.staticPrompts,t,n)},{serviceWorkerParam:"undefined"!=typeof OneSignal&&OneSignal.SERVICE_WORKER_PARAM?OneSignal.SERVICE_WORKER_PARAM:{scope:"/"},serviceWorkerPath:"undefined"!=typeof OneSignal&&OneSignal.SERVICE_WORKER_PATH?OneSignal.SERVICE_WORKER_PATH:"OneSignalSDKWorker.js",serviceWorkerUpdaterPath:"undefined"!=typeof OneSignal&&OneSignal.SERVICE_WORKER_UPDATER_PATH?OneSignal.SERVICE_WORKER_UPDATER_PATH:"OneSignalSDUpdaterKWorker.js",path:t.path?t.path:"/"});return t.hasOwnProperty("autoResubscribe")?o.autoResubscribe=!!t.autoResubscribe:t.hasOwnProperty("autoRegister")?o.autoResubscribe=!!t.autoRegister:o.autoResubscribe=!!i.config.autoResubscribe,o}}static getSubdomainForConfigIntegrationKind(e,t,i){const n=this.getIntegrationCapabilities(e);let o=t.subdomainName,s="";switch(n.configuration){case Et.Dashboard:s=i.config.siteInfo.proxyOriginEnabled?i.config.siteInfo.proxyOrigin:void 0;break;case Et.JavaScript:s=i.config.subdomain}return s&&!this.shouldUseServerConfigSubdomain(o,n)?void 0:s}static shouldUseServerConfigSubdomain(e,t){switch(t.configuration){case Et.Dashboard:return!0;case Et.JavaScript:switch(location.protocol){case"https:":return!!e;case"http:":return!0;default:return!1}}}}var Ct=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class At{getAppConfig(e){return Ct(this,void 0,void 0,function*(){return yield Tt.getAppConfig(e,wt.downloadServerAppConfig)})}getMergedConfig(e,t){return Tt.getMergedConfig(e,t)}}var Nt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Mt{constructor(e){this.options={appId:e.appId,subdomain:e.subdomainName,origin:e.origin,metrics:{enable:!1,mixpanelReportingToken:null},userConfig:{}}}initialize(){return Nt(this,void 0,void 0,function*(){if((window.opener||window.parent)==window)return document.write("OneSignal: This page cannot be directly opened, and must be opened as a result of a subscription call."),Promise.resolve();const e=Object.assign({},this.options);e.appId=e.appId,e.subdomainName=e.subdomain,e.origin=e.origin,OneSignal.config=e||{};const t=yield(new At).getAppConfig(e);return OneSignal.context=new ht(t),OneSignal.context.workerMessenger.listen(!0),OneSignal.initialized=!0,this.loadPromise={},this.loadPromise.promise=new Promise((e,t)=>{this.loadPromise.resolver=e,this.loadPromise.rejector=t}),this.establishCrossOriginMessaging(),this.loadPromise.promise})}establishCrossOriginMessaging(){}dispose(){this.messenger.destroy()}finishInitialization(){this.loadPromise.resolver()}subscribe(){return Nt(this,void 0,void 0,function*(){const e=yield OneSignal.isPushNotificationsEnabled(),t=opener||parent;e?t&&window.close():J.registerForPush()})}}var kt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class xt extends Mt{initialize(){const e=super.initialize();return b.a.trigger("httpInitialize"),e}establishCrossOriginMessaging(){this.messenger&&this.messenger.destroy(),this.messenger=new Q(window,this.options.origin,this.options.origin),this.messenger.on(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.IFRAME_POPUP_INITIALIZE,this.onProxyFrameInitializing.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION,this.onRemoteNotificationPermission.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET,this.onRemoteDatabaseGet.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_PUT,this.onRemoteDatabasePut.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_REMOVE,this.onRemoteDatabaseRemove.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_FROM_PUSH,this.onUnsubscribeFromPush.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.MARK_PROMPT_DISMISSED,this.onMarkPromptDismissed.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.IS_SUBSCRIBED,this.onIsSubscribed.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_PROXY_FRAME,this.onUnsubscribeProxyFrame.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SERVICE_WORKER_STATE,this.onServiceWorkerState.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_WORKER_VERSION,this.onWorkerVersion.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SUBSCRIPTION_EXPIRATION_STATE,this.onSubscriptionExpirationState.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.PROCESS_EXPIRING_SUBSCRIPTIONS,this.onProcessExpiringSubscriptions.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_SUBSCRIPTION_STATE,this.onGetSubscriptionState.bind(this)),this.messenger.listen()}retriggerRemoteEvent(e,t){this.messenger.message(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,{eventName:e,eventData:t})}onMessengerConnect(e){return kt(this,void 0,void 0,function*(){return k.a.debug(`(${P.a.getWindowEnv().toString()}) Successfully established cross-origin communication.`),this.finishInitialization(),!1})}onProxyFrameInitializing(e){return kt(this,void 0,void 0,function*(){if(k.a.info(`(${P.a.getWindowEnv().toString()}) The iFrame has just received initOptions from the host page!`),OneSignal.config=Object.assign({},e.data.hostInitOptions,OneSignal.config,{pageUrl:e.data.pageUrl,pageTitle:e.data.pageTitle}),He.installNativePromptPermissionChangedHook(),(yield M.a.get("Options","defaultUrl"))||(yield M.a.put("Options",{key:"defaultUrl",value:new URL(OneSignal.config.pageUrl).origin})),yield M.a.put("Options",{key:"lastKnownHostUrl",value:OneSignal.config.pageUrl}),yield He.initSaveState(OneSignal.config.pageTitle),yield He.storeInitialValues(),yield He.saveInitOptions(),navigator.serviceWorker&&"https:"===window.location.protocol)try{OneSignal.context.serviceWorkerManager.establishServiceWorkerChannel()}catch(e){k.a.error("Error interacting with Service Worker inside an HTTP-hosted iFrame:",e)}e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE)})}onRemoteNotificationPermission(e){return kt(this,void 0,void 0,function*(){const t=OneSignal.context,i=yield t.permissionManager.getReportedNotificationPermission(t.appConfig.safariWebId);return e.reply(i),!1})}onRemoteDatabaseGet(e){return kt(this,void 0,void 0,function*(){const t=e.data,i=[];for(let e of t){const{table:t,key:n}=e;i.push(M.a.get(t,n))}const n=yield Promise.all(i);return e.reply(n),!1})}onRemoteDatabasePut(e){return kt(this,void 0,void 0,function*(){const t=e.data;let i=[];for(let e of t){let{table:t,keypath:n}=e;i.push(M.a.put(t,n))}return yield Promise.all(i),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onRemoteDatabaseRemove(e){return kt(this,void 0,void 0,function*(){const t=e.data;let i=[];for(let e of t){let{table:t,keypath:n}=e;i.push(M.a.remove(t,n))}return yield Promise.all(i),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onUnsubscribeFromPush(e){return kt(this,void 0,void 0,function*(){k.a.debug("(Reposted from iFrame -> Host) User unsubscribed but permission granted. Re-prompting the user for push.");try{yield Object(x.x)(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE)}catch(e){k.a.debug("Failed to unsubscribe from push remotely:",e)}})}onMarkPromptDismissed(e){return kt(this,void 0,void 0,function*(){return k.a.debug("(Reposted from iFrame -> Host) Marking prompt as dismissed."),yield $e.markHttpsNativePromptDismissed(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onIsSubscribed(e){return kt(this,void 0,void 0,function*(){const t=yield OneSignal.isPushNotificationsEnabled();return e.reply(t),!1})}onUnsubscribeProxyFrame(e){return kt(this,void 0,void 0,function*(){return(yield OneSignal.isPushNotificationsEnabled())&&(yield OneSignal.setSubscription(!1),yield OneSignal.database.rebuild()),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onServiceWorkerState(e){return kt(this,void 0,void 0,function*(){const t=yield OneSignal.context.serviceWorkerManager.getActiveState();return e.reply(t),!1})}onWorkerVersion(e){return kt(this,void 0,void 0,function*(){const t=yield OneSignal.context.serviceWorkerManager.getWorkerVersion();return e.reply(t),!1})}onSubscriptionExpirationState(e){return kt(this,void 0,void 0,function*(){const t=yield OneSignal.context.subscriptionManager.isSubscriptionExpiring();return e.reply(t),!1})}onProcessExpiringSubscriptions(e){return kt(this,void 0,void 0,function*(){OneSignal.context,yield He.processExpiringSubscriptions();return e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onGetSubscriptionState(e){return kt(this,void 0,void 0,function*(){const t=yield OneSignal.context.subscriptionManager.getSubscriptionState();return e.reply(t),!1})}}class _t extends Mt{constructor(e){super(e)}establishCrossOriginMessaging(){this.messenger&&this.messenger.destroy(),this.messenger=new Q(window.parent,this.options.origin,this.options.origin)}}class Rt extends Mt{constructor(e){super(e)}establishCrossOriginMessaging(){this.messenger=new Q(window.opener,this.options.origin,this.options.origin),this.messenger.once(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnected.bind(this)),this.messenger.postMessage(OneSignal.POSTMAM_COMMANDS.POPUP_BEGIN_MESSAGEPORT_COMMS,null),this.messenger.listen()}onMessengerConnected(e){k.a.debug(`(${P.a.getWindowEnv().toString()}) The host page is now ready to receive commands from the HTTP popup.`),this.finishInitialization()}}var Dt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Wt{static initHttp(e){return Dt(this,void 0,void 0,function*(){switch(k.a.debug(`Called %cinitHttp(${JSON.stringify(e,null,4)})`,Object(x.j)("code")),P.a.getWindowEnv()){case j.a.OneSignalProxyFrame:OneSignal.proxyFrame=new xt(e),yield OneSignal.proxyFrame.initialize(),F.ensureBackwardsCompatibility(OneSignal);break;case j.a.OneSignalSubscriptionPopup:OneSignal.subscriptionPopup=new Rt(e),yield OneSignal.subscriptionPopup.initialize(),F.ensureBackwardsCompatibility(OneSignal),b.a.trigger("httpInitialize");break;case j.a.OneSignalSubscriptionModal:OneSignal.subscriptionModal=new _t(e),OneSignal.subscriptionModal.establishCrossOriginMessaging(),OneSignal.subscriptionModal.initialize(),F.ensureBackwardsCompatibility(OneSignal),b.a.trigger("httpInitialize");break;default:k.a.error("Unsupported HTTP initialization branch.")}})}}var Ut=i(15),Bt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Lt{static get LOAD_TIMEOUT_MS(){return 15e3}constructor(e){this.url=e,this.url.pathname="webPushIframe"}load(){return Bt(this,void 0,void 0,function*(){k.a.debug("Opening an iFrame to",this.url.toString()),this.removeFrame();const e=document.createElement("iframe");return e.style.display="none",e.src=this.url.toString(),e.sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation",this.loadPromise={},this.loadPromise.promise=new Promise((e,t)=>{this.loadPromise.resolver=e,this.loadPromise.rejector=t}),document.body.appendChild(e),e.onload=this.onFrameLoad.bind(this),this.element=e,Object(x.v)(this.loadPromise.promise,Lt.LOAD_TIMEOUT_MS).catch(()=>{window===window.top&&k.a.warn(`OneSignal: Loading the required iFrame ${this.url.toString()} timed out. Check that the Site URL onesignal.com dashboard web config is ${location.origin}. Only the Site URL specified there is allowed to use load the iFrame.`)}),this.loadPromise.promise})}removeFrame(){if(!l.a.isBrowser())return;const e=document.querySelector(`iframe[src='${this.url.toString()}']`);e&&e.remove()}onFrameLoad(e){this.establishCrossOriginMessaging()}establishCrossOriginMessaging(){this.messenger&&this.messenger.destroy(),this.messenger=new Q(this.element.contentWindow,this.url.toString(),this.url.toString()),this.messenger.on(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,this.onRemoteRetriggerEvent.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,this.onRemoteNotificationPermissionChanged.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REQUEST_HOST_URL,this.onRequestHostUrl.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,this.onServiceWorkerCommandRedirect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_EVENT_LISTENER_COUNT,this.onGetEventListenerCount.bind(this)),this.messenger.connect()}dispose(){this.messenger&&this.messenger.destroy(),this.removeFrame()}onMessengerConnect(e){return Bt(this,void 0,void 0,function*(){k.a.debug(`Successfully established cross-origin communication for iFrame at ${this.url.toString()}`),this.messenger.message(OneSignal.POSTMAM_COMMANDS.IFRAME_POPUP_INITIALIZE,{hostInitOptions:JSON.parse(JSON.stringify(OneSignal.config)),pageUrl:window.location.href,pageTitle:document.title},e=>(e.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE&&this.loadPromise.resolver(),!1))})}onRemoteRetriggerEvent(e){let{eventName:t,eventData:i}=e.data;return b.a.trigger(t,i,e.source),!1}onRemoteNotificationPermissionChanged(e){let{forceUpdatePermission:t}=e.data;return Object(x.w)(t),!1}onRequestHostUrl(e){return e.reply(location.href),!1}onServiceWorkerCommandRedirect(e){const t=e.data;return t&&t.startsWith("http")&&(window.location.href=t),!1}onGetEventListenerCount(e){const t=e.data;return k.a.debug("(Reposted from iFrame -> Host) Getting event listener count for ",t),e.reply(OneSignal.emitter.numberOfListeners(t)),!1}isSubscribed(){return new Promise(e=>{this.messenger.message(OneSignal.POSTMAM_COMMANDS.IS_SUBSCRIBED,null,t=>{e(t.data)})})}unsubscribeFromPush(){return new Promise(e=>{this.messenger.message(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_PROXY_FRAME,null,t=>{e()})})}getProxyServiceWorkerActiveState(){return new Promise((e,t)=>{this.message(OneSignal.POSTMAM_COMMANDS.SERVICE_WORKER_STATE,null,t=>{e(t.data)})})}runCommand(e){return Bt(this,void 0,void 0,function*(){return yield new Promise((t,i)=>{this.message(e,null,e=>{t(e.data)})})})}message(...e){this.messenger.message.apply(this.messenger,arguments)}}var jt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Ft{constructor(){}static discoverAltOrigin(e){return jt(this,void 0,void 0,function*(){const t=Ft.getOneSignalProxyIframeUrls(e),i=[];let n;for(const e of t){const t=new Lt(e);yield t.load(),i.push(t)}const o=yield Ft.removeDuplicatedAltOriginSubscription(i);if(o)n=o[0];else for(const e of i)if(yield e.isSubscribed())n=e;else{if(!Object(x.f)(e.url.host,".os.tc")){e.dispose();continue}n?e.dispose():n=e}return n})}static removeDuplicatedAltOriginSubscription(e){return jt(this,void 0,void 0,function*(){const t=[];for(const i of e)(yield i.isSubscribed())&&t.push(i);if(t.length<2)return null;if(P.a.getBuildEnv()==Ut.a.Development)var i=".localhost:3001";else if(P.a.getBuildEnv()==Ut.a.Production)i=".onesignal.com";var n=t.find(e=>Object(x.f)(e.url.host,i));if(n){yield n.unsubscribeFromPush(),n.dispose();const t=e.indexOf(n);return e.splice(t,1),e}return null})}static getCanonicalSubscriptionUrls(e,t=P.a.getBuildEnv()){let i=[];if(e.httpUseOneSignalCom){let n=P.a.getOneSignalApiUrl(t);n.host=[e.subdomain,n.host].join("."),i.push(n)}let n=P.a.getOneSignalApiUrl(t);n.host=[e.subdomain,"os.tc"].join("."),i.push(n);for(const e of i)e.pathname="";return i}static getOneSignalProxyIframeUrls(e){const t=Ft.getCanonicalSubscriptionUrls(e);for(const e of t)e.pathname="webPushIframe";return t}static getOneSignalSubscriptionPopupUrls(e){const t=Ft.getCanonicalSubscriptionUrls(e);for(const e of t)e.pathname="subscribe";return t}}var Ht=i(22);class Vt{static isValidUrl(e,t){if(t&&t.allowNull&&null===e)return!0;if(t&&t.allowEmpty&&(null===e||void 0===e))return!0;try{const i=new URL(e);return!t||!t.requireHttps||"https:"===i.protocol}catch(e){return!1}}static isValidBoolean(e,t){return!(!t||!t.allowNull||null!==e)||(!0===e||!1===e)}static isValidArray(e,t){return!(!t||!t.allowNull||null!==e)||(!(!t||!t.allowEmpty||null!==e&&void 0!==e)||e instanceof Array)}}var $t=i(19);class zt{static processItem(e,t){if("function"==typeof t)t();else{if(!Array.isArray(t))throw new u.a("Only accepts function and Array types!");{if(0==t.length)throw new u.a("Empty array is not valid!");const i=t.shift();if(null==i||void 0===i)throw new u.a("First element in array must be the OneSignal function name");const n=e[i.toString()];if("function"!=typeof n)throw new u.a(`No OneSignal function with the name '${i}'`);n.apply(e,t)}}}}i.d(t,"default",function(){return Kt});var Gt=function(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})};class Kt{static setDefaultNotificationUrl(e){return Gt(this,void 0,void 0,function*(){if(!Vt.isValidUrl(e,{allowNull:!0}))throw new InvalidArgumentError.a("url",InvalidArgumentError.b.Malformed);yield Object(x.c)(),Object(x.q)("setDefaultNotificationUrl",e);const t=yield M.a.getAppState();t.defaultNotificationUrl=e,yield M.a.setAppState(t)})}static setDefaultTitle(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("setDefaultTitle",e);const t=yield M.a.getAppState();t.defaultNotificationTitle=e,yield M.a.setAppState(t)})}static setEmail(e,t){return Gt(this,void 0,void 0,function*(){if(!e)throw new InvalidArgumentError.a("email",InvalidArgumentError.b.Empty);if(!Object(x.p)(e))throw new InvalidArgumentError.a("email",InvalidArgumentError.b.Malformed);if(t&&t.emailAuthHash&&64!==t.emailAuthHash.length)throw new InvalidArgumentError.a("options.emailAuthHash",InvalidArgumentError.b.Malformed);yield Object(x.c)(),Object(x.q)("setEmail",e,t);const i=yield M.a.getAppConfig(),{deviceId:n}=yield M.a.getSubscription(),o=yield M.a.getEmailProfile();if(i.emailAuthRequired&&(!t||!t.emailAuthHash))throw new InvalidArgumentError.a("options.emailAuthHash",InvalidArgumentError.b.Empty);const s=new $t.a(o.emailId,e);t&&t.emailAuthHash&&(s.emailAuthHash=t.emailAuthHash);const r=!!o.emailId;return r&&i.emailAuthRequired?s.emailId=yield wt.updateEmailRecord(i,s,n):s.emailId=yield wt.createEmailRecord(i,s,n),!n||r&&o.emailId===s.emailId&&o.emailAddress&&s.emailAddress===o.emailAddress||(yield wt.updatePlayer(i.appId,n,{parent_player_id:s.emailId,email:s.emailAddress})),yield M.a.setEmailProfile(s),s.emailId})}static logoutEmail(){return Gt(this,void 0,void 0,function*(){yield Object(x.c)();const e=yield M.a.getAppConfig(),t=yield M.a.getEmailProfile(),{deviceId:i}=yield M.a.getSubscription();t.emailId?i?(yield wt.logoutEmail(e,t,i))?yield M.a.setEmailProfile(new $t.a):k.a.warn("Failed to logout email."):k.a.warn(new d(n.NoDeviceId)):k.a.warn(new d(n.NoEmailSet))})}static isPushNotificationsSupported(){return Object(x.q)("isPushNotificationsSupported"),!0}static initializeConfig(e){return Gt(this,void 0,void 0,function*(){const t=yield(new At).getAppConfig(e);k.a.debug(`OneSignal: Final web app config: %c${JSON.stringify(t,null,4)}`,Object(x.j)("code")),Kt.context=new ht(t),Kt.config=Kt.context.appConfig})}static init(e){return Gt(this,void 0,void 0,function*(){if(Object(x.q)("init"),yield He.polyfillSafariFetch(),He.errorIfInitAlreadyCalled(),yield Kt.initializeConfig(e),!Kt.config)throw new Error("OneSignal config not initialized!");if(!c.a.safari||Kt.config.safariWebId){if(Kt.config.userConfig.requiresUserPrivacyConsent){if(!(yield M.a.getProvideUserConsent()))return void(Kt.pendingInit=!0)}yield Kt.delayedInit()}else k.a.warn(new g(s.MissingSafariWebId))})}static delayedInit(){return Gt(this,void 0,void 0,function*(){function e(){return Gt(this,void 0,void 0,function*(){if(!Kt.__initAlreadyCalled){if(Kt.__initAlreadyCalled=!0,K.fixWordpressManifestIfMisplaced(),Kt.emitter.on(Kt.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,U.onNotificationPermissionChange),Kt.emitter.on(Kt.EVENTS.SUBSCRIPTION_CHANGED,U._onSubscriptionChanged),Kt.emitter.on(Kt.EVENTS.SDK_INITIALIZED,He.onSdkInitialized),O.b.isUsingSubscriptionWorkaround()){if(!Kt.config||!Kt.config.subdomain)throw new g(s.MissingSubdomain);Kt.proxyFrameHost=yield Ft.discoverAltOrigin(Kt.config)}window.addEventListener("focus",()=>{K.checkAndTriggerNotificationPermissionChanged()}),yield He.initSaveState(document.title),yield He.saveInitOptions(),P.a.getWindowEnv()===j.a.CustomIframe?yield b.a.trigger(Kt.EVENTS.SDK_INITIALIZED):yield He.internalInit()}})}Kt.pendingInit=!1,Kt.context.workerMessenger.listen(),"complete"===document.readyState||"interactive"===document.readyState?yield e():(k.a.debug("OneSignal: Waiting for DOMContentLoaded or readyStateChange event before continuing initialization..."),window.addEventListener("DOMContentLoaded",()=>{e()}),document.onreadystatechange=(()=>{"complete"!==document.readyState&&"interactive"!==document.readyState||e()}))})}static provideUserConsent(e){return Gt(this,void 0,void 0,function*(){yield M.a.setProvideUserConsent(e),e&&Kt.pendingInit&&(yield Kt.delayedInit())})}static showHttpPermissionRequest(e){return Gt(this,void 0,void 0,function*(){k.a.debug("Called showHttpPermissionRequest(), redirecting to HTTP prompt."),Kt.showHttpPrompt(e).catch(e=>k.a.info(e))})}static showHttpPrompt(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),yield Kt.context.promptsManager.internalShowSlidedownPrompt(e)})}static showNativePrompt(){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),yield Kt.context.promptsManager.internalShowNativePrompt()})}static showSlidedownPrompt(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),yield Kt.context.promptsManager.internalShowSlidedownPrompt(e)})}static registerForPushNotifications(e){return Gt(this,void 0,void 0,function*(){if(Kt.initialized)return yield He.registerForPushNotifications(e);yield new Promise((t,i)=>{Kt.emitter.once(Kt.EVENTS.SDK_INITIALIZED,()=>Gt(this,void 0,void 0,function*(){return yield He.registerForPushNotifications(e),t()}))})})}static getNotificationPermission(e){return Gt(this,void 0,void 0,function*(){return yield Object(x.c)(),Kt.privateGetNotificationPermission(e)})}static privateGetNotificationPermission(e){return Gt(this,void 0,void 0,function*(){const t=yield Kt.context.permissionManager.getNotificationPermission(Kt.config.safariWebId);return e&&e(t),t})}static getTags(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("getTags",e);const{appId:t}=yield M.a.getAppConfig(),{deviceId:i}=yield M.a.getSubscription();if(!i)return k.a.info(new d(n.NoDeviceId)),null;const{tags:o}=yield wt.getPlayer(t,i);return Object(x.i)(e,o),o})}static sendTag(e,t,i){return Gt(this,void 0,void 0,function*(){const n={};return n[e]=t,yield Kt.sendTags(n,i)})}static sendTags(e,t){return Gt(this,void 0,void 0,function*(){if(yield Object(x.c)(),Object(x.q)("sendTags",e,t),!e||0===Object.keys(e).length)return k.a.info(new InvalidArgumentError.a("tags",InvalidArgumentError.b.Empty)),null;Object.keys(e).forEach(t=>{!1===e[t]&&(e[t]="false")});const{appId:i}=yield M.a.getAppConfig(),n=yield M.a.getEmailProfile();n.emailId&&(yield wt.updatePlayer(i,n.emailId,{tags:e,email_auth_hash:n.emailAuthHash}));var{deviceId:o}=yield M.a.getSubscription();o||(yield Object(x.d)(Kt.EVENTS.REGISTERED));var{deviceId:s}=yield M.a.getSubscription();return yield wt.updatePlayer(i,s,{tags:e}),Object(x.i)(t,e),e})}static deleteTag(e){return Gt(this,void 0,void 0,function*(){return yield Kt.deleteTags([e])})}static deleteTags(e,t){return Gt(this,void 0,void 0,function*(){if(yield Object(x.c)(),Object(x.q)("deleteTags",e,t),!Vt.isValidArray(e))throw new InvalidArgumentError.a("tags",InvalidArgumentError.b.Malformed);0===e.length&&k.a.info(new InvalidArgumentError.a("tags",InvalidArgumentError.b.Empty));const i={};for(let t of e)i[t]="";const n=yield Kt.sendTags(i);if(n){const e=Object.keys(n);return Object(x.i)(t,e),e}return[]})}static setExternalUserId(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("setExternalUserId"),(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal())||(yield Object(x.d)(Kt.EVENTS.REGISTERED)),yield Promise.all([Kt.database.setExternalUserId(e),Kt.context.updateManager.sendExternalUserIdUpdate(e)])})}static getExternalUserId(){return Gt(this,void 0,void 0,function*(){return yield Object(x.c)(),Object(x.q)("getExternalUserId"),yield Kt.database.getExternalUserId()})}static removeExternalUserId(){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("removeExternalUserId"),(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal())?yield Promise.all([Kt.database.setExternalUserId(void 0),Kt.context.updateManager.sendExternalUserIdUpdate(void 0)]):k.a.warn("User is not subscribed, cannot remove external user id.")})}static addListenerForNotificationOpened(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("addListenerForNotificationOpened",e),Kt.emitter.once(Kt.EVENTS.NOTIFICATION_CLICKED,t=>{Object(x.i)(e,t)}),Kt.config&&U.fireStoredNotificationClicks(Kt.config.pageUrl||Kt.config.userConfig.pageUrl)})}static getIdsAvailable(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("getIdsAvailable",e);const{deviceId:t,subscriptionToken:i}=yield M.a.getSubscription(),n={userId:t,registrationId:i};return Object(x.i)(e,n),n})}static isPushNotificationsEnabled(e){return Gt(this,void 0,void 0,function*(){return yield Object(x.c)(),Kt.privateIsPushNotificationsEnabled(e)})}static privateIsPushNotificationsEnabled(e){return Gt(this,void 0,void 0,function*(){Object(x.q)("isPushNotificationsEnabled",e);const t=yield Kt.context.subscriptionManager.getSubscriptionState();return Object(x.i)(e,t.subscribed&&!t.optedOut),t.subscribed&&!t.optedOut})}static setSubscription(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("setSubscription",e);const t=yield M.a.getAppConfig(),{appId:i}=t,o=yield M.a.getSubscription(),{deviceId:s}=o;if(!t.appId)throw new InvalidStateError.a(InvalidStateError.b.MissingAppId);if(!Vt.isValidBoolean(e))throw new InvalidArgumentError.a("newSubscription",InvalidArgumentError.b.Malformed);s?(o.optedOut=!e,yield wt.updatePlayer(i,s,{notification_types:K.getNotificationTypeFromOptIn(e)}),yield M.a.setSubscription(o),U.onInternalSubscriptionSet(o.optedOut),U.checkAndTriggerSubscriptionChanged()):k.a.info(new d(n.NoDeviceId))})}static isOptedOut(e){return Gt(this,void 0,void 0,function*(){return yield Object(x.c)(),Kt.internalIsOptedOut(e)})}static internalIsOptedOut(e){return Gt(this,void 0,void 0,function*(){Object(x.q)("isOptedOut",e);const{optedOut:t}=yield M.a.getSubscription();return Object(x.i)(e,t),t})}static optOut(e,t){return Gt(this,void 0,void 0,function*(){if(yield Object(x.c)(),Object(x.q)("optOut",e,t),!Vt.isValidBoolean(e))throw new InvalidArgumentError.a("doOptOut",InvalidArgumentError.b.Malformed);yield Kt.setSubscription(!e),Object(x.i)(t)})}static getEmailId(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("getEmailId",e);const t=(yield M.a.getEmailProfile()).emailId;return Object(x.i)(e,t),t})}static getUserId(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("getUserId",e);const t=(yield M.a.getSubscription()).deviceId;return Object(x.i)(e,t),t})}static getRegistrationId(e){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("getRegistrationId",e);const t=(yield M.a.getSubscription()).subscriptionToken;return Object(x.i)(e,t),t})}static getSubscription(e){return Gt(this,void 0,void 0,function*(){return yield Object(x.c)(),yield Kt.privateGetSubscription(e)})}static privateGetSubscription(e){return Gt(this,void 0,void 0,function*(){Object(x.q)("getSubscription",e);const t=!(yield M.a.getSubscription()).optedOut;return Object(x.i)(e,t),t})}static sendSelfNotification(e="OneSignal Test Message",t="This is an example notification.",i=new URL(location.href).origin+"?_osp=do_not_open",o,s,r){return Gt(this,void 0,void 0,function*(){yield Object(x.c)(),Object(x.q)("sendSelfNotification",e,t,i,o,s,r);const a=yield M.a.getAppConfig(),c=yield M.a.getSubscription();if(!a.appId)throw new InvalidStateError.a(InvalidStateError.b.MissingAppId);if(!(yield Kt.isPushNotificationsEnabled()))throw new d(n.NoDeviceId);if(!Vt.isValidUrl(i))throw new InvalidArgumentError.a("url",InvalidArgumentError.b.Malformed);if(!Vt.isValidUrl(o,{allowEmpty:!0,requireHttps:!0}))throw new InvalidArgumentError.a("icon",InvalidArgumentError.b.Malformed);c.deviceId&&(yield wt.sendNotification(a.appId,[c.deviceId],{en:e},{en:t},i,o,s,r))})}static push(e){zt.processItem(Kt,e)}static on(e,t){return this.emitter.on(e,t)}static off(e,t){return this.emitter.off(e,t)}static once(e,t){return this.emitter.once(e,t)}}Kt.VERSION=l.a.version(),Kt._VERSION=l.a.version(),Kt.sdkEnvironment=P.a,Kt._notificationOpenedCallbacks=[],Kt._idsAvailable_callback=[],Kt._defaultLaunchURL=null,Kt.config=null,Kt._sessionInitAlreadyRunning=!1,Kt._isNotificationEnabledCallback=[],Kt._subscriptionSet=!0,Kt.modalUrl=null,Kt._windowWidth=650,Kt._windowHeight=568,Kt._isNewVisitor=!1,Kt._channel=null,Kt.timedLocalStorage=H,Kt.initialized=!1,Kt.notifyButton=null,Kt.store=S,Kt.environment=l.a,Kt.database=M.a,Kt.event=b.a,Kt.browser=c.a,Kt.popover=null,Kt.log=k.a,Kt.api=wt,Kt.indexedDb=Ht.a,Kt.mainHelper=K,Kt.subscriptionHelper=J,Kt.httpHelper=Wt,Kt.eventHelper=U,Kt.initHelper=He,Kt.testHelper=$e,Kt.pendingInit=!0,Kt.emitter=new Z.a,Kt.SERVICE_WORKER_UPDATER_PATH="OneSignalSDKUpdaterWorker.js",Kt.SERVICE_WORKER_PATH="OneSignalSDKWorker.js",Kt.SERVICE_WORKER_PARAM={scope:"/"},Kt._LOGGING=!1,Kt.LOGGING=!1,Kt._usingNativePermissionHook=!1,Kt._initCalled=!1,Kt.__initAlreadyCalled=!1,Kt.checkAndWipeUserSubscription=function(){},Kt.DeviceRecord=w,Kt.EmailDeviceRecord=E,Kt.notificationPermission=B,Kt._initHttp=Wt.initHttp,Kt._initPopup=(()=>Kt.subscriptionPopup.subscribe()),Kt.POSTMAM_COMMANDS={CONNECTED:"connect",REMOTE_NOTIFICATION_PERMISSION:"postmam.remoteNotificationPermission",REMOTE_DATABASE_GET:"postmam.remoteDatabaseGet",REMOTE_DATABASE_PUT:"postmam.remoteDatabasePut",REMOTE_DATABASE_REMOVE:"postmam.remoteDatabaseRemove",REMOTE_OPERATION_COMPLETE:"postman.operationComplete",REMOTE_RETRIGGER_EVENT:"postmam.remoteRetriggerEvent",MODAL_LOADED:"postmam.modalPrompt.loaded",MODAL_PROMPT_ACCEPTED:"postmam.modalPrompt.accepted",MODAL_PROMPT_REJECTED:"postmam.modalPrompt.canceled",POPUP_LOADED:"postmam.popup.loaded",POPUP_ACCEPTED:"postmam.popup.accepted",POPUP_REJECTED:"postmam.popup.canceled",POPUP_CLOSING:"postman.popup.closing",REMOTE_NOTIFICATION_PERMISSION_CHANGED:"postmam.remoteNotificationPermissionChanged",IFRAME_POPUP_INITIALIZE:"postmam.iframePopupInitialize",UNSUBSCRIBE_FROM_PUSH:"postmam.unsubscribeFromPush",SET_SESSION_COUNT:"postmam.setSessionCount",REQUEST_HOST_URL:"postmam.requestHostUrl",WINDOW_TIMEOUT:"postmam.windowTimeout",FINISH_REMOTE_REGISTRATION:"postmam.finishRemoteRegistration",FINISH_REMOTE_REGISTRATION_IN_PROGRESS:"postmam.finishRemoteRegistrationInProgress",POPUP_BEGIN_MESSAGEPORT_COMMS:"postmam.beginMessagePortComms",SERVICEWORKER_COMMAND_REDIRECT:"postmam.command.redirect",MARK_PROMPT_DISMISSED:"postmam.markPromptDismissed",IS_SUBSCRIBED:"postmam.isSubscribed",UNSUBSCRIBE_PROXY_FRAME:"postman.unsubscribeProxyFrame",GET_EVENT_LISTENER_COUNT:"postmam.getEventListenerCount",SERVICE_WORKER_STATE:"postmam.serviceWorkerState",GET_WORKER_VERSION:"postmam.getWorkerVersion",SUBSCRIPTION_EXPIRATION_STATE:"postmam.subscriptionExpirationState",PROCESS_EXPIRING_SUBSCRIPTIONS:"postmam.processExpiringSubscriptions",GET_SUBSCRIPTION_STATE:"postmam.getSubscriptionState"},Kt.EVENTS={CUSTOM_PROMPT_CLICKED:"customPromptClick",NATIVE_PROMPT_PERMISSIONCHANGED:"notificationPermissionChange",SUBSCRIPTION_CHANGED:"subscriptionChange",WELCOME_NOTIFICATION_SENT:"sendWelcomeNotification",NOTIFICATION_DISPLAYED:"notificationDisplay",NOTIFICATION_DISMISSED:"notificationDismiss",NOTIFICATION_CLICKED:"notificationClick",SDK_INITIALIZED:"initializeInternal",SDK_INITIALIZED_PUBLIC:"initialize",REGISTERED:"register",POPUP_CLOSING:"popupClose",PERMISSION_PROMPT_DISPLAYED:"permissionPromptDisplay",TEST_INIT_OPTION_DISABLED:"testInitOptionDisabled",TEST_WOULD_DISPLAY:"testWouldDisplay",POPUP_WINDOW_TIMEOUT:"popupWindowTimeout"},F.ensureBackwardsCompatibility(Kt),k.a.info(`%cOneSignal Web SDK loaded (version ${Kt._VERSION}, ${P.a.getWindowEnv().toString()} environment).`,Object(x.j)("bold")),k.a.debug(`Current Page URL: ${"undefined"==typeof location?"NodeJS":location.href}`),k.a.debug(`Browser Environment: ${c.a.name} ${c.a.version}`)},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}}]); //# sourceMappingURL=OneSignalPageSDKES6.js.map } /* FILE ARCHIVED ON 16:19:27 May 10, 2019 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 06:28:12 Jul 12, 2024. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): captures_list: 0.789 exclusion.robots: 0.032 exclusion.robots.policy: 0.018 esindex: 0.012 cdx.remote: 8.997 LoadShardBlock: 569.834 (6) PetaboxLoader3.datanode: 814.399 (8) PetaboxLoader3.resolve: 182.02 (3) load_resource: 492.263 (2) */