web-push-notifications 3.31.0 → 3.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- !function(root,factory){if("object"==typeof exports&&"object"==typeof module)module.exports=factory();else if("function"==typeof define&&define.amd)define([],factory);else{var a=factory();for(var i in a)("object"==typeof exports?exports:root)[i]=a[i]}}(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=31)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG=exports.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT=exports.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET=exports.PAGE_VISITED_URL=exports.MANUAL_UNSUBSCRIBE=exports.EVENT_PW_SITE_OPENED=exports.EVENT_GDPR_DELETE=exports.EVENT_GDPR_CONSENT=exports.EVENT_CLICK_SUBSCRIBE_BUTTON=exports.EVENT_SHOW_SUBSCRIBE_BUTTON=exports.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET=exports.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET=exports.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG=exports.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG=exports.EVENT_ON_UPDATE_INBOX_MESSAGES=exports.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE=exports.EVENT_ON_CHANGE_COMMUNICATION_ENABLED=exports.EVENT_ON_NOTIFICATION_CLOSE=exports.EVENT_ON_NOTIFICATION_CLICK=exports.EVENT_ON_PUSH_DELIVERY=exports.EVENT_ON_SW_INIT_ERROR=exports.EVENT_ON_PERMISSION_GRANTED=exports.EVENT_ON_PERMISSION_DENIED=exports.EVENT_ON_PERMISSION_PROMPT=exports.EVENT_ON_REGISTER=exports.EVENT_ON_UNSUBSCRIBE=exports.EVENT_ON_SUBSCRIBE=exports.EVENT_ON_READY=exports.EVENT_ON_LOAD=exports.PERMISSION_PROMPT=exports.PERMISSION_GRANTED=exports.PERMISSION_DENIED=exports.DEVICE_REGISTRATION_STATUS_UNREGISTERED=exports.DEVICE_REGISTRATION_STATUS_REGISTERED=exports.MANUAL_SET_LOGGER_LEVEL=exports.KEY_SAFARI_PREVIOUS_PERMISSION=exports.KEY_DEVICE_REGISTRATION_STATUS=exports.KEY_CLICK_SUBSCRIBE_WIDGET=exports.KEY_SHOW_SUBSCRIBE_WIDGET=exports.DEFAULT_NOTIFICATION_IMAGE=exports.DEFAULT_NOTIFICATION_TITLE=exports.WAKE_UP_SERVICE_WORKER_INTERVAL=exports.MAX_NOTIFICATION_DURATION=exports.MIN_NOTIFICATION_DURATION=exports.DEFAULT_NOTIFICATION_DURATION=exports.PERIOD_GOAL_EVENT=exports.PERIOD_SEND_APP_OPEN=exports.FACEBOOK_HWID_KEY=exports.FACEBOOK_APP_ID=exports.DEFAULT_API_URL=exports.DEFAULT_SERVICE_WORKER_URL=void 0,exports.DEFAULT_SERVICE_WORKER_URL="/pushwoosh-service-worker.js",exports.DEFAULT_API_URL="https://cp.pushwoosh.com/json/1.3/",exports.FACEBOOK_APP_ID="436711767081797",exports.FACEBOOK_HWID_KEY="FACEBOOK_HWID_KEY",exports.PERIOD_SEND_APP_OPEN=36e5,exports.PERIOD_GOAL_EVENT=864e5,exports.DEFAULT_NOTIFICATION_DURATION=10,exports.MIN_NOTIFICATION_DURATION=10,exports.MAX_NOTIFICATION_DURATION=55,exports.WAKE_UP_SERVICE_WORKER_INTERVAL=20,exports.DEFAULT_NOTIFICATION_TITLE="Pushwoosh notification",exports.DEFAULT_NOTIFICATION_IMAGE="https://cp.pushwoosh.com/img/logo-medium.png",exports.KEY_SHOW_SUBSCRIBE_WIDGET="WIDGET_SHOWED",exports.KEY_CLICK_SUBSCRIBE_WIDGET="WIDGET_CLICKED",exports.KEY_DEVICE_REGISTRATION_STATUS="deviceRegistrationStatus",exports.KEY_SAFARI_PREVIOUS_PERMISSION="safariPreviousPermission",exports.MANUAL_SET_LOGGER_LEVEL="PW_SET_LOGGER_LEVEL",exports.DEVICE_REGISTRATION_STATUS_REGISTERED="registered",exports.DEVICE_REGISTRATION_STATUS_UNREGISTERED="unregistered",exports.PERMISSION_DENIED="denied",exports.PERMISSION_GRANTED="granted",exports.PERMISSION_PROMPT="default",exports.EVENT_ON_LOAD="onLoad",exports.EVENT_ON_READY="onReady",exports.EVENT_ON_SUBSCRIBE="onSubscribe",exports.EVENT_ON_UNSUBSCRIBE="onUnsubscribe",exports.EVENT_ON_REGISTER="onRegister",exports.EVENT_ON_PERMISSION_PROMPT="onPermissionPrompt",exports.EVENT_ON_PERMISSION_DENIED="onPermissionDenied",exports.EVENT_ON_PERMISSION_GRANTED="onPermissionGranted",exports.EVENT_ON_SW_INIT_ERROR="onSWInitError",exports.EVENT_ON_PUSH_DELIVERY="onPushDelivery",exports.EVENT_ON_NOTIFICATION_CLICK="onNotificationClick",exports.EVENT_ON_NOTIFICATION_CLOSE="onNotificationClose",exports.EVENT_ON_CHANGE_COMMUNICATION_ENABLED="onChangeCommunicationEnabled",exports.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE="onPutNewMessageToInboxStore",exports.EVENT_ON_UPDATE_INBOX_MESSAGES="onUpdateInboxMessages",exports.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG="onShowNotificationPermissionDialog",exports.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG="onHideNotificationPermissionDialog",exports.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET="onShowSubscriptionWidget",exports.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET="onHideSubscriptionWidget",exports.EVENT_SHOW_SUBSCRIBE_BUTTON="showSubscribeButton",exports.EVENT_CLICK_SUBSCRIBE_BUTTON="clickSubscribeButton",exports.EVENT_GDPR_CONSENT="GDPRConsent",exports.EVENT_GDPR_DELETE="GDPRDelete",exports.EVENT_PW_SITE_OPENED="PW_SiteOpened",exports.MANUAL_UNSUBSCRIBE="MANUAL_UNSUBSCRIBE",exports.PAGE_VISITED_URL="PAGE_VISITED_URL",exports.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET="not-set",exports.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT="default",exports.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG={headerText:"Subscribe to our news",headerTextColor:"#000000",subheaderText:"Don't miss out on the latest news and updates!",subheaderTextColor:"#000000",buttonAcceptText:"Agree",buttonAcceptTextColor:"#1A72E8",buttonAcceptRound:"4px",buttonAcceptBackgroundColor:"#FFFFFF",buttonAcceptBorderColor:"#E3E4E8",buttonCancelText:"Deny",buttonCancelTextColor:"#1A72E8",buttonCancelRound:"4px",buttonCancelBackgroundColor:"#FFFFFF",buttonCancelBorderColor:"#E3E4E8",cappingCount:3,cappingDelay:144e5,backgroundColor:"#FFFFFF"}},function(module,exports,__webpack_require__){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__rest=this&&this.__rest||function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.message=exports.log=exports.keyValue=exports.LogMessage=exports.LogLog=exports.LogBase=exports.getInstance=void 0;var databasePromise,version_1=__webpack_require__(10),MigrationExecutor_1=__webpack_require__(11),constants_1=__webpack_require__(6);function onversionchange(database,event){console.info("onversionchange",event),database.close()}function getInstance(){return databasePromise||(databasePromise=new Promise(function(resolve,reject){var request=indexedDB.open("PUSHWOOSH_SDK_STORE",version_1.default);request.onsuccess=function(event){var database=event.target.result;database.onversionchange=onversionchange.bind(null,database,reject),resolve(database)},request.onerror=function(){return reject(request.error)},request.onupgradeneeded=function(event){var database=event.target.result;database.onversionchange=onversionchange.bind(null,database,reject),new MigrationExecutor_1.default(database).applyMigrations()}})),databasePromise}function getInstanceWithPromise(executor){return getInstance().then(function(database){return new Promise(function(resolve,reject){return executor(database,resolve,reject)})})}exports.getInstance=getInstance;var LogBase=function(){function LogBase(){}return LogBase.prototype._add=function(obj){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var request=database.transaction([_this.name],"readwrite").objectStore(_this.name).add(obj);request.onsuccess=function(){resolve(obj)},request.onerror=function(){reject(request.error)}}).then(function(obj){return _this.getAll().then(function(items){if(Array.isArray(items)){var ids=items.map(function(i){return i.id}).sort(function(a,b){return a==b?0:a<b?1:-1});if(ids.length>_this.maxItems)return Promise.all(ids.slice(_this.maxItems).map(function(id){return _this.delete(id)})).then(function(){return obj})}return obj})})},LogBase.prototype.delete=function(key){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var request=database.transaction([_this.name],"readwrite").objectStore(_this.name).delete(key);request.onsuccess=function(){resolve(request.result)},request.onerror=function(){reject(request.error)}})},LogBase.prototype.getAll=function(){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var result=[],cursor=database.transaction(_this.name).objectStore(_this.name).openCursor();cursor.onsuccess=function(ev){var cursorResult=ev.target.result;cursorResult?(cursorResult.value&&result.push(cursorResult.value),cursorResult.continue()):resolve(result)},cursor.onerror=function(){reject(cursor.error)}})},LogBase}();exports.LogBase=LogBase;var LogLog=function(_super){function LogLog(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.name=constants_1.STORE_NAME_MAIN_LOG,_this.maxItems=100,_this.environment="undefined"!=typeof self&&self.registration?"worker":"browser",_this}return __extends(LogLog,_super),LogLog.prototype.add=function(type,message,additional){var obj={type:type,environment:this.environment,message:""+message,date:new Date};return message instanceof Error&&(obj.stack=message.stack),additional&&(obj.additional=additional),this._add(obj)},LogLog}(LogBase);exports.LogLog=LogLog;var LogMessage=function(_super){function LogMessage(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.name=constants_1.STORE_NAME_MESSAGE_LOG,_this.maxItems=25,_this}return __extends(LogMessage,_super),LogMessage.prototype.add=function(log){return this._add(__assign(__assign({},log),{date:new Date}))},LogMessage}(LogBase);exports.LogMessage=LogMessage,exports.keyValue=function(name){return{get:function(key,defaultValue){return getInstanceWithPromise(function(database,resolve,reject){var timeout,request=database.transaction(name).objectStore(name).get(key),isComplete=!1,isError=!1,check=function(){if(clearTimeout(timeout),isComplete){var result=request.result;resolve(result&&result.value||defaultValue)}else isError?reject(request.error):timeout=setTimeout(check,0)};request.onsuccess=function(){return isComplete=!0},request.onerror=function(){return isError=!0},check()})},getAll:function(){return getInstanceWithPromise(function(database,resolve,reject){var timeout,result={},cursor=database.transaction(name).objectStore(name).openCursor(),isComplete=!1,isError=!1,check=function(){clearTimeout(timeout),isComplete?resolve(result):isError?reject(cursor.error):timeout=setTimeout(check,0)};cursor.onsuccess=function(event){var cursorResult=event.target.result;cursorResult?(result[cursorResult.key]=cursorResult.value.value,cursorResult.continue()):isComplete=!0},cursor.onerror=function(){return isError=!0},check()})},extend:function(key,value){return __awaiter(this,void 0,void 0,function(){var oldValues,newValues;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.get(key)];case 1:return oldValues=_a.sent(),newValues=__rest(value,[]),[4,this.set(key,__assign(__assign({},oldValues),newValues))];case 2:return _a.sent(),[2]}})})},set:function(key,value){return getInstanceWithPromise(function(database,resolve,reject){var timeout,request=database.transaction([name],"readwrite").objectStore(name).put({key:key,value:value}),isComplete=!1,isError=!1,check=function(){clearTimeout(timeout),isComplete?resolve(key):isError?reject(request.error):timeout=setTimeout(check,0)};request.onsuccess=function(){return isComplete=!0},request.onerror=function(){return isError=!0},check()})}}}(constants_1.STORE_NAME_KEY_VALUE),exports.log=new LogLog,exports.message=new LogMessage},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Data=void 0;var storage_1=__webpack_require__(1),CONSTANTS=__webpack_require__(0),Data=function(){function Data(store){void 0===store&&(store=storage_1.keyValue),this.store=store}return Data.prototype.clearAll=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationCode",void 0)];case 1:return _a.sent(),[4,this.store.set("params.hwid",void 0)];case 2:return _a.sent(),[4,this.store.set("params.deviceType",void 0)];case 3:return _a.sent(),[4,this.store.set("params.deviceModel",void 0)];case 4:return _a.sent(),[4,this.store.set("params.language",void 0)];case 5:return _a.sent(),[4,this.store.set("params.apiEntrypoint",void 0)];case 6:return _a.sent(),[4,this.store.set("params.tokens",void 0)];case 7:return _a.sent(),[4,this.store.set("params.applicationServerKey",void 0)];case 8:return _a.sent(),[4,this.store.set("params.senderId",void 0)];case 9:return _a.sent(),[4,this.store.set("params.webSitePushId",void 0)];case 10:return _a.sent(),[4,this.store.set("params.defaultNotificationImage",void 0)];case 11:return _a.sent(),[4,this.store.set("params.defaultNotificationTitle",void 0)];case 12:return _a.sent(),[4,this.store.set("params.userId",void 0)];case 13:return _a.sent(),[4,this.store.set("params.userIdWasChanged",void 0)];case 14:return _a.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 15:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 16:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 17:return _a.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 18:return _a.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 19:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 20:return _a.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 21:return _a.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 22:return _a.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 23:return _a.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 24:return _a.sent(),[4,this.store.set("params.features",void 0)];case 25:return _a.sent(),[4,this.store.set("params.init",void 0)];case 26:return _a.sent(),[4,this.store.set("API_PARAMS",void 0)];case 27:return _a.sent(),[4,this.store.set("SENDER_ID",void 0)];case 28:return _a.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 29:return _a.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 30:return _a.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 31:return _a.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 32:return _a.sent(),[2]}})})},Data.prototype.setApplicationCode=function(application){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationCode",application)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApplicationCode=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.applicationCode")];case 1:return[2,_a.sent()]}})})},Data.prototype.setHwid=function(hwid){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.hwid",hwid)];case 1:return _a.sent(),[2]}})})},Data.prototype.getHwid=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.hwid")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDeviceType=function(type){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.deviceType",type)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDeviceType=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.deviceType")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDeviceModel=function(model){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.deviceModel",model)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDeviceModel=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.deviceModel")];case 1:return[2,_a.sent()]}})})},Data.prototype.setLanguage=function(language){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.language",language)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLanguage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.language","en")];case 1:return[2,_a.sent()]}})})},Data.prototype.setApiEntrypoint=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.apiEntrypoint",url)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApiEntrypoint=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.apiEntrypoint",CONSTANTS.DEFAULT_API_URL)];case 1:return[2,_a.sent()]}})})},Data.prototype.setTokens=function(tokens){return __awaiter(this,void 0,void 0,function(){var hwid;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getHwid()];case 1:return hwid=_a.sent(),[4,this.store.set("API_PARAMS",__assign({hwid:hwid},tokens))];case 2:return _a.sent(),[4,this.store.set("params.tokens",tokens)];case 3:return _a.sent(),[2]}})})},Data.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("API_PARAMS")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.tokens")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setApplicationServerKey=function(key){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationServerKey",key)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApplicationServerKey=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.applicationServerKey")];case 1:return[2,_a.sent()]}})})},Data.prototype.setSenderId=function(senderId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("GCM_SENDER_ID",senderId)];case 1:return _a.sent(),[4,this.store.set("params.senderId",senderId)];case 2:return _a.sent(),[2]}})})},Data.prototype.getSenderId=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("GCM_SENDER_ID")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.senderId")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setWebSitePushId=function(senderId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.webSitePushId",senderId)];case 1:return _a.sent(),[2]}})})},Data.prototype.getWebSitePushId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.webSitePushId")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDefaultNotificationImage=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.defaultNotificationImage",url)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDefaultNotificationImage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.defaultNotificationImage",CONSTANTS.DEFAULT_NOTIFICATION_IMAGE)];case 1:return[2,_a.sent()]}})})},Data.prototype.setDefaultNotificationTitle=function(text){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.defaultNotificationTitle",text)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDefaultNotificationTitle=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.defaultNotificationTitle",CONSTANTS.DEFAULT_NOTIFICATION_TITLE)];case 1:return[2,_a.sent()]}})})},Data.prototype.setUserId=function(userId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return userId?[3,2]:[4,this.store.set("params.userId",void 0)];case 1:return _a.sent(),[2];case 2:return[4,this.store.set("params.userId",userId.toString())];case 3:return _a.sent(),[2]}})})},Data.prototype.getUserId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.userId")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusUserIdWasChanged=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.userIdWasChanged",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getStatusUserIdWasChanged=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.userIdWasChanged",!1)];case 1:return[2,_a.sent()]}})})},Data.prototype.setLastPermissionStatus=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.isLastPermissionStatus",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLastPermissionStatus=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.isLastPermissionStatus")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusManualUnsubscribed=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("MANUAL_UNSUBSCRIBE",status)];case 1:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("MANUAL_UNSUBSCRIBE",!1)];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isManualUnsubscribed",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setStatusCommunicationDisabled=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("COMMUNICATION_ENABLED",status?0:1)];case 1:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusCommunicationDisabled=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("COMMUNICATION_ENABLED")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isCommunicationDisabled",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:0==oldValue]}})})},Data.prototype.setStatusDropAllData=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("DEVICE_DATA_REMOVED",status)];case 1:return _a.sent(),[4,this.store.set("params.isDropAllData",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusDropAllData=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("DEVICE_DATA_REMOVED",!1)];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isDropAllData",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setSdkVersion=function(version){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.sdkVersion",version)];case 1:return _a.sent(),[2]}})})},Data.prototype.getSdkVersion=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.sdkVersion")];case 1:return[2,_a.sent()]}})})},Data.prototype.setServiceWorkerVersion=function(version){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("WORKER_VERSION",version)];case 1:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",version)];case 2:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerVersion=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("WORKER_VERSION")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.serviceWorkerVersion")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setServiceWorkerUrl=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return url?[4,this.store.set("params.serviceWorkerUrl",url)]:[2];case 1:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerUrl=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.serviceWorkerUrl",CONSTANTS.DEFAULT_SERVICE_WORKER_URL)];case 1:return[2,_a.sent()]}})})},Data.prototype.setServiceWorkerScope=function(scope){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return scope?[4,this.store.set("params.serviceWorkerScope",scope)]:[2];case 1:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerScope=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.serviceWorkerScope")];case 1:return[2,_a.sent()]}})})},Data.prototype.setLastOpenMessage=function(message){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("LAST_OPEN_MESSAGE",message)];case 1:return _a.sent(),[4,this.store.set("params.lastOpenMessage",message)];case 2:return _a.sent(),[2]}})})},Data.prototype.getLastOpenMessage=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("LAST_OPEN_MESSAGE")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.lastOpenMessage")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setLastOpenApplicationTime=function(time){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.lastOpenApplicationTime",time)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLastOpenApplicationTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.lastOpenApplicationTime")];case 1:return[2,_a.sent()]}})})},Data.prototype.setFeatures=function(features){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.features",features)];case 1:return _a.sent(),[2]}})})},Data.prototype.getFeatures=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.features")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInitParams=function(params){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.init",params)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInitParams=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.init")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInboxLastRequestCode=function(lastCode){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.lastRequestCode",lastCode)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxLastRequestCode=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.inbox.lastRequestCode","")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInboxLastRequestTime=function(lastRequestTime){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.lastRequestTime",lastRequestTime)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxLastRequestTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.inbox.lastRequestTime",0)]})})},Data.prototype.setInboxNewMessagesCount=function(count){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.newMessagesCount",count)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxNewMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.inbox.newMessagesCount",0)]})})},Data.prototype.setDelayedEvent=function(event){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("DELAYED_EVENT",event)];case 1:return _a.sent(),[4,this.store.set("params.delayedEvent",event)];case 2:return _a.sent(),[2]}})})},Data.prototype.getDelayedEvent=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("DELAYED_EVENT")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.delayedEvent")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setPromptDisplayCount=function(count){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.promptDisplayCount",count)];case 1:return _a.sent(),[2]}})})},Data.prototype.getPromptDisplayCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.promptDisplayCount",0)]})})},Data.prototype.setPromptLastSeenTime=function(time){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.promptLastSeenTime",time)];case 1:return _a.sent(),[2]}})})},Data.prototype.getPromptLastSeenTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.promptLastSeenTime",0)]})})},Data}();exports.Data=Data},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DateModule=function(){function DateModule(date){void 0===date&&(date=new Date),this._date=date}return Object.defineProperty(DateModule.prototype,"date",{get:function(){return this._date},set:function(date){this._date=date},enumerable:!1,configurable:!0}),DateModule.prototype.getUtcTimestamp=function(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)},DateModule.prototype.getTimestamp=function(){return Math.round(this.date.getTime()/1e3)},DateModule.prototype.setLocal=function(){var newDateTimestamp=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(newDateTimestamp)},DateModule.prototype.addDays=function(days){var newDateTimestamp=this._date.getTime()+24*days*60*60*1e3;this._date=new Date(newDateTimestamp)},DateModule.prototype.getInboxFakeOrder=function(){return(100*this._date.getTime()+9e9).toString()},DateModule}();exports.default=DateModule},function(module,exports,__webpack_require__){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Logger=exports.logAndRejectError=exports.logAndThrowError=void 0;var storage_1=__webpack_require__(1),levels={error:1,info:2,debug:3},limitLevel=3;__webpack_require__(5).patchConsole();var Logger={setLevel:function(level){levels[level]||(level="error"),limitLevel=levels[level]},write:function(type,message,additional){return"error"===type?this.error(message):this.info(message),storage_1.log.add(type,message,additional)}};exports.Logger=Logger,Object.keys(levels).forEach(function(levelName){var levelNumber=levels[levelName];Logger[levelName]=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];levelNumber<=limitLevel&&(console.groupCollapsed(levelName),console.info.apply(console,__spreadArrays([""],args)),console.trace("trace"),console.groupEnd())}}),exports.logAndThrowError=function(error){var logText=new Error(error);throw Logger.write("error",logText,"logAndThrowError"),logText},exports.logAndRejectError=function(error,reject){var logText=new Error(error);Logger.write("error",logText,"logAndRejectError"),reject(logText)}},function(module,exports,__webpack_require__){"use strict";function getGlobal(){return globalThis}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateUUID=exports.clearLocationHash=exports.patchConsole=exports.parseSerializedNotificationParams=exports.getVersion=exports.getGlobal=void 0,exports.getGlobal=getGlobal,exports.getVersion=function(){return"3.31.0"},exports.parseSerializedNotificationParams=function(param,defaultValue){if("string"==typeof param)try{return JSON.parse(param)}catch(e){console.log(e)}return void 0===param&&void 0!==defaultValue?defaultValue:param},exports.patchConsole=function(){for(var method,noop=function(){},methods=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],len=methods.length,global=getGlobal(),console=global.console=global.console||{};len--;)console[method=methods[len]]||(console[method]=noop)},exports.clearLocationHash=function(){"history"in getGlobal()&&history.pushState?history.pushState(null,"","#"):location.hash="#"},exports.generateUUID=function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KEY_PATH_BASE_INCREMENT=exports.STORE_NAME_INBOX_MESSAGES=exports.STORE_NAME_MAIN_LOG=exports.STORE_NAME_MESSAGE_LOG=exports.STORE_NAME_KEY_VALUE=void 0,exports.STORE_NAME_KEY_VALUE="keyValue",exports.STORE_NAME_MESSAGE_LOG="messages",exports.STORE_NAME_MAIN_LOG="log",exports.STORE_NAME_INBOX_MESSAGES="inboxMessages",exports.KEY_PATH_BASE_INCREMENT="id"},function(module,exports,__webpack_require__){var v1=__webpack_require__(15),v4=__webpack_require__(16),uuid=v4;uuid.v1=v1,uuid.v4=v4,module.exports=uuid},function(module,exports){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}},function(module,exports){for(var byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);module.exports=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=7},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Migrations_1=__webpack_require__(20),MigrationExecutor=function(){function MigrationExecutor(db,migrationsBuilder){void 0===migrationsBuilder&&(migrationsBuilder=new Migrations_1.default),this.db=db,this.migrationsBuilder=migrationsBuilder}return MigrationExecutor.prototype.applyMigrations=function(){var _this=this;this.applyMigrationsPack(this.migrationsBuilder.initial),this.migrationsBuilder.dateSorted.forEach(function(migrationsPack){_this.applyMigrationsPack(migrationsPack)})},MigrationExecutor.prototype.applyMigrationsPack=function(migrationsPack){var _this=this;migrationsPack.forEach(function(migration){migration(_this.db)})},MigrationExecutor}();exports.default=MigrationExecutor},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.storeCreatorDecorator=void 0,exports.storeCreatorDecorator=function(name,storeCreator){return function(database){database.objectStoreNames.contains(name)||storeCreator(database)}}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:!0});var DateModule_1=__webpack_require__(3),InboxMessages=function(){function InboxMessages(data,api,inboxModel,dateModule){void 0===dateModule&&(dateModule=new DateModule_1.default),this.data=data,this.api=api,this.inboxModel=inboxModel,this.dateModule=dateModule,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}return InboxMessages.prototype.messageTypeFactory=function(actionParams){var messageType=0;return"h"in actionParams||"rm"in actionParams||"r"in actionParams?messageType=1:"l"in actionParams&&null!=actionParams.l&&(messageType=actionParams.l.startsWith("http")?2:3),messageType},InboxMessages.prototype.updateMessagesStatusWithCodes=function(codes,messages,status){return __awaiter(this,void 0,void 0,function(){var updatedMessages,inboxStatusQueries,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return updatedMessages=[],inboxStatusQueries=[],messages.forEach(function(msg){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){return-1===codes.indexOf(msg.inbox_id)?[2]:(msg.status=status,updatedMessages.push(msg),inboxStatusQueries.push(this.api.inboxStatus(msg.order,msg.status)),[2])})})}),[4,this.inboxModel.putBulkMessages(updatedMessages)];case 1:return _a.sent(),[4,Promise.all(inboxStatusQueries)];case 2:return _a.sent(),[2]}})})},InboxMessages.prototype.publicMessageBuilder=function(message){return __awaiter(this,void 0,void 0,function(){var imageUrl,_a,title,_b;return __generator(this,function(_c){switch(_c.label){case 0:return(_a=message.image)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:_a=_c.sent(),_c.label=2;case 2:return imageUrl=_a,(_b=message.title)?[3,4]:[4,this.data.getDefaultNotificationTitle()];case 3:_b=_c.sent(),_c.label=4;case 4:return title=_b,this.dateModule.date=new Date(1e3*parseInt(message.send_date)),this.dateModule.setLocal(),[2,{title:title,imageUrl:imageUrl,code:message.inbox_id,message:message.text,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(JSON.parse(message.action_params)),isRead:2===message.status||3===message.status,isActionPerformed:3===message.status}]}})})},InboxMessages.prototype.messagesWithNoActionPerformedCount=function(){return this.inboxModel.getDeliveredReadMessagesCount()},InboxMessages.prototype.unreadMessagesCount=function(){return this.inboxModel.getDeliveredMessagesCount()},InboxMessages.prototype.messagesCount=function(){return this.inboxModel.messagesCount()},InboxMessages.prototype.loadMessages=function(){return __awaiter(this,void 0,void 0,function(){var readMessages,unreadMessages,buildMessagePromises;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return readMessages=_a.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return unreadMessages=_a.sent(),buildMessagePromises=__spreadArrays(readMessages,unreadMessages).sort(function(msgA,msgB){return parseInt(msgB.send_date,10)-parseInt(msgA.send_date,10)}).sort(function(msgA,msgB){return parseInt(msgB.order||"0",10)-parseInt(msgA.order||"0",10)}).map(this.publicMessageBuilder),[2,Promise.all(buildMessagePromises)]}})})},InboxMessages.prototype.readMessagesWithCodes=function(codes){return __awaiter(this,void 0,void 0,function(){var unreadMessages,statusRead;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getDeliveredMessages()];case 1:return unreadMessages=_a.sent(),statusRead=2,[4,this.updateMessagesStatusWithCodes(codes,unreadMessages,statusRead)];case 2:return _a.sent(),[2]}})})},InboxMessages.prototype.performActionForMessageWithCode=function(code){return __awaiter(this,void 0,void 0,function(){var message,actionParams,messageType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getMessage(code)];case 1:return message=_a.sent(),actionParams=JSON.parse(message.action_params),2===(messageType=this.messageTypeFactory(actionParams))&&null!=actionParams.l?document.location.href=actionParams.l:3===messageType&&null!=actionParams.l&&window.history.go(actionParams.l),message.status=3,[4,this.inboxModel.putMessage(message)];case 2:return _a.sent(),[4,this.api.inboxStatus(message.order,message.status)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.deleteMessagesWithCodes=function(codes){return __awaiter(this,void 0,void 0,function(){var readMessages,unreadMessages,statusDeleted;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return readMessages=_a.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return unreadMessages=_a.sent(),statusDeleted=4,[4,this.updateMessagesStatusWithCodes(codes,__spreadArrays(readMessages,unreadMessages),statusDeleted)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.syncMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.updateMessages()];case 1:return _a.sent(),[2]}})})},InboxMessages}();exports.default=InboxMessages},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiClient=void 0;var Data_1=__webpack_require__(2),logger_1=__webpack_require__(4),ApiClient=function(){function ApiClient(data,logger){void 0===data&&(data=new Data_1.Data),void 0===logger&&(logger=logger_1.Logger),this.data=data,this.logger=logger}return ApiClient.prototype.checkDevice=function(options){return this.createRequest("checkDevice",options)},ApiClient.prototype.getConfig=function(options){return this.createRequest("getConfig",options)},ApiClient.prototype.applicationOpen=function(options){return this.createRequest("applicationOpen",options)},ApiClient.prototype.registerDevice=function(options){return this.createRequest("registerDevice",options)},ApiClient.prototype.unregisterDevice=function(options){return this.createRequest("unregisterDevice",options)},ApiClient.prototype.deleteDevice=function(options){return this.createRequest("deleteDevice",options)},ApiClient.prototype.messageDeliveryEvent=function(options){return this.createRequest("messageDeliveryEvent",options)},ApiClient.prototype.pushStat=function(options){return this.createRequest("pushStat",options)},ApiClient.prototype.setTags=function(options){return this.createRequest("setTags",options)},ApiClient.prototype.getTags=function(options){return this.createRequest("getTags",options)},ApiClient.prototype.registerUser=function(options){return this.createRequest("registerUser",options)},ApiClient.prototype.postEvent=function(options){return this.createRequest("postEvent",options)},ApiClient.prototype.getInboxMessages=function(options){return this.createRequest("getInboxMessages",options)},ApiClient.prototype.inboxStatus=function(options){return this.createRequest("inboxStatus",options)},ApiClient.prototype.pageVisit=function(options,url){return this.createRequest("pageVisit",options,url)},ApiClient.prototype.setPurchase=function(options){return this.createRequest("setPurchase",options)},ApiClient.prototype.createRequest=function(methodName,request,customUrl){return __awaiter(this,void 0,void 0,function(){var entrypoint,response,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return entrypoint=_a.sent(),[4,fetch(customUrl||entrypoint+methodName,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:request})})];case 2:return response=_a.sent(),[4,this.checkResponse(response)];case 3:return(result=_a.sent()).base_url?[4,this.data.setApiEntrypoint(result.base_url)]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[4,this.logger.write("apirequest",methodName+" call with arguments: "+JSON.stringify(request)+" to Pushwoosh has been successful. Result: "+JSON.stringify(result.response))];case 6:return _a.sent(),[2,result.response]}})})},ApiClient.prototype.checkResponse=function(response){return __awaiter(this,void 0,void 0,function(){var data;return __generator(this,function(_a){switch(_a.label){case 0:if(200!==response.status)throw new Error("Error code: "+response.status+". Error text: "+response.statusText);return[4,response.json()];case 1:if(200!==(data=_a.sent()).status_code)throw new Error("Error code: "+data.status_code+". Error text: "+data.status_message);return[2,data]}})})},ApiClient}();exports.ApiClient=ApiClient},function(module,exports,__webpack_require__){var _nodeId,_clockseq,rng=__webpack_require__(8),bytesToUuid=__webpack_require__(9),_lastMSecs=0,_lastNSecs=0;module.exports=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rng();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid(b)}},function(module,exports,__webpack_require__){var rng=__webpack_require__(8),bytesToUuid=__webpack_require__(9);module.exports=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid(rnds)}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EventBus_1=__webpack_require__(18);Object.defineProperty(exports,"EventBus",{enumerable:!0,get:function(){return EventBus_1.EventBus}})},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBus=void 0;var uuid_1=__webpack_require__(7),EventBus=function(){return function(){var _this=this;this.addEventHandler=function(name,handler){var savedEventHandlers=_this.savedEventHandlersMap[name];savedEventHandlers||(savedEventHandlers=[]),savedEventHandlers.push(handler),_this.savedEventHandlersMap[name]=savedEventHandlers},this.removeEventHandler=function(name,handler){var savedEventHandlers=_this.savedEventHandlersMap[name];savedEventHandlers&&(_this.savedEventHandlersMap[name]=savedEventHandlers.filter(function(savedEventHandler){return savedEventHandler!==handler}))},this.dispatchEvent=function(name,payload){var eventId=payload.eventId||uuid_1.v4(),savedEventHandlers=_this.savedEventHandlersMap[name];return savedEventHandlers?(savedEventHandlers.forEach(function(element){"function"==typeof element&&setTimeout(function(){element(__assign(__assign({},payload),{eventId:eventId}))},0)}),eventId):eventId},this.savedEventHandlersMap={}}}();exports.EventBus=EventBus},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Api=void 0;var Data_1=__webpack_require__(2),ApiClient_1=__webpack_require__(14),CONSTANTS=__webpack_require__(0),Api=function(){function Api(eventBus,data,apiClient){void 0===data&&(data=new Data_1.Data),void 0===apiClient&&(apiClient=new ApiClient_1.ApiClient),this.eventBus=eventBus,this.data=data,this.apiClient=apiClient}return Api.prototype.checkDevice=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.checkDevice(params)];case 2:return[2,_a.sent()]}})})},Api.prototype.checkDeviceSubscribeForPushNotifications=function(useCache){return void 0===useCache&&(useCache=!0),__awaiter(this,void 0,void 0,function(){var status,_a,exist,push_token_exist;return __generator(this,function(_b){switch(_b.label){case 0:return void 0!==(status=localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS))&&useCache?[3,2]:[4,this.checkDevice()];case 1:_a=_b.sent(),exist=_a.exist,push_token_exist=_a.push_token_exist,localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,exist&&push_token_exist?CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED:CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),status=localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS),_b.label=2;case 2:return[2,status===CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED]}})})},Api.prototype.getConfig=function(features){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.getConfig(__assign(__assign({},params),{features:features}))]}})})},Api.prototype.applicationOpen=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.setLastOpenApplicationTime(Date.now())];case 2:return _a.sent(),[2,this.apiClient.applicationOpen(params)]}})})},Api.prototype.registerDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,tokens,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:if(_a.sent())throw new Error("Can't register device: Communication is disabled!");return[4,this.getRequestParams()];case 2:return params=_a.sent(),[4,this.data.getTokens()];case 3:if(!(tokens=_a.sent()).pushToken)throw new Error("Can't register device: pushToken is not exist!");return[4,this.apiClient.registerDevice(__assign(__assign({},params),{push_token:tokens.pushToken,auth_token:tokens.authToken,public_key:tokens.publicKey,fcm_push_set:tokens.fcmPushSet,fcm_token:tokens.fcmToken}))];case 4:return response=_a.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 5:return _a.sent(),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED),this.eventBus.dispatchEvent("register",{}),[2,response]}})})},Api.prototype.unregisterDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),response=this.apiClient.unregisterDevice(params),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,response]}})})},Api.prototype.deleteDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),response=this.apiClient.deleteDevice(params),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return _a.sent(),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,response]}})})},Api.prototype.messageDeliveryEvent=function(hash,isTrackingLogOnFailure,metaData){return void 0===metaData&&(metaData={}),__awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.messageDeliveryEvent(__assign(__assign({},params),{hash:hash,metaData:metaData}))];case 2:return[2,_a.sent()]}})})},Api.prototype.pushStat=function(hash,isTrackingLogOnFailure,metaData){return void 0===metaData&&(metaData={}),__awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.pushStat(__assign(__assign({},params),{hash:hash,metaData:metaData}))];case 2:return[2,_a.sent()]}})})},Api.prototype.setTags=function(tags){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setTags(__assign(__assign({},params),{tags:tags}))]}})})},Api.prototype.getTags=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.getTags(params)]}})})},Api.prototype.registerUser=function(userId){return __awaiter(this,void 0,void 0,function(){var params,deviceType,id,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getDeviceType()];case 2:return deviceType=_a.sent(),id=""+userId,[4,this.apiClient.registerUser(__assign(__assign({},params),{userId:id,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:deviceType}))];case 3:return response=_a.sent(),[4,this.data.setUserId(""+userId)];case 4:return _a.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 5:return _a.sent(),[2,response]}})})},Api.prototype.postEvent=function(event,attributes){return __awaiter(this,void 0,void 0,function(){var params,date,time,timestampUTC,timestampCurrent,lastOpenMessage,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),date=new Date,time=date.getTime(),timestampUTC=Math.floor(time/1e3),timestampCurrent=timestampUTC-date.getTimezoneOffset()/60*3600,[4,this.data.getLastOpenMessage()];case 2:if((lastOpenMessage=_a.sent())&&lastOpenMessage.expiry>Date.now()){if(attributes.msgHash)return[2,Promise.reject("attribute msgHash already defined")];attributes=__assign(__assign({},attributes),{msgHash:lastOpenMessage.messageHash})}return[4,this.data.setLastOpenMessage(void 0)];case 3:return _a.sent(),[4,this.apiClient.postEvent(__assign(__assign({},params),{event:event,timestampUTC:timestampUTC,timestampCurrent:timestampCurrent,attributes:attributes}))];case 4:return(response=_a.sent())&&response.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:response.code}),[2,response]}})})},Api.prototype.getInboxMessages=function(count){return void 0===count&&(count=0),__awaiter(this,void 0,void 0,function(){var params,lastCode,lastRequestTime;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getInboxLastRequestCode()];case 2:return lastCode=_a.sent(),[4,this.data.getInboxLastRequestTime()];case 3:return lastRequestTime=_a.sent(),[2,this.apiClient.getInboxMessages(__assign(__assign({},params),{count:count,last_code:lastCode,last_request_time:lastRequestTime}))]}})})},Api.prototype.inboxStatus=function(order,status){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.inboxStatus(__assign(__assign({},params),{inbox_code:order,status:status,time:(new Date).getTime()}))]}})})},Api.prototype.triggerEvent=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){throw new Error("Method has been deprecated, because we don't aggregate this statistics.")})})},Api.prototype.pageVisit=function(config){return __awaiter(this,void 0,void 0,function(){var params,features,url;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getFeatures()];case 2:return features=_a.sent(),(url=features&&features.page_visit&&features.page_visit.entrypoint)?[2,this.apiClient.pageVisit(__assign(__assign({},params),config),url)]:[2]}})})},Api.prototype.setPurchase=function(attributes){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setPurchase(__assign(__assign({},params),attributes))]}})})},Api.prototype.getParams=function(){return __awaiter(this,void 0,void 0,function(){var applicationCode,hwid,apiParams,initParams;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),[4,this.data.getTokens()];case 3:return apiParams=_a.sent(),[4,this.data.getInitParams()];case 4:return initParams=_a.sent(),[2,__assign(__assign({applicationCode:applicationCode,hwid:hwid},apiParams),initParams)]}})})},Object.defineProperty(Api.prototype,"params",{get:function(){throw new Error('Property "Pushwoosh.api.params" have been deprecated. Use the async method "Pushwoosh.api.getParams()"')},enumerable:!1,configurable:!0}),Api.prototype.getRequestParams=function(){return __awaiter(this,void 0,void 0,function(){var applicationCode,hwid,userId,deviceType,deviceModel,language,version,timezone;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),[4,this.data.getUserId()];case 3:return userId=_a.sent(),[4,this.data.getDeviceType()];case 4:return deviceType=_a.sent(),[4,this.data.getDeviceModel()];case 5:return deviceModel=_a.sent(),[4,this.data.getLanguage()];case 6:return language=_a.sent(),[4,this.data.getSdkVersion()];case 7:return version=_a.sent(),timezone=60*-(new Date).getTimezoneOffset(),[2,{application:applicationCode,hwid:hwid,userId:userId||hwid,device_type:deviceType,device_model:deviceModel,timezone:timezone,language:language,v:version}]}})})},Api}();exports.Api=Api},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var initial_1=__webpack_require__(21),_26_11_2018_1=__webpack_require__(22),DateModule_1=__webpack_require__(3),Migrations=function(){function Migrations(dateModule){void 0===dateModule&&(dateModule=new DateModule_1.default),this.migrations={initial:initial_1.default,"2018/11/26":_26_11_2018_1.default},this.dateModule=dateModule}return Object.defineProperty(Migrations.prototype,"initial",{get:function(){return this.migrations.initial},enumerable:!1,configurable:!0}),Object.defineProperty(Migrations.prototype,"dateSorted",{get:function(){var _this=this;return Object.keys(this.migrations).filter(function(key){return"initial"!==key}).sort(function(a,b){var dateA=new DateModule_1.default(new Date(a)),dateB=new DateModule_1.default(new Date(b));return dateA.getTimestamp()-dateB.getTimestamp()}).map(function(key){return _this.migrations[key]})},enumerable:!1,configurable:!0}),Migrations}();exports.default=Migrations},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(12),constants_1=__webpack_require__(6);exports.default=[helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_KEY_VALUE,function(database){database.createObjectStore(constants_1.STORE_NAME_KEY_VALUE,{keyPath:"key"})}),helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_MAIN_LOG,function(database){var logStore=database.createObjectStore(constants_1.STORE_NAME_MAIN_LOG,{keyPath:constants_1.KEY_PATH_BASE_INCREMENT,autoIncrement:!0});logStore.createIndex("environment","environment",{unique:!1}),logStore.createIndex("date","date",{unique:!1}),logStore.createIndex("type","type",{unique:!1})}),helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_MESSAGE_LOG,function(database){database.createObjectStore(constants_1.STORE_NAME_MESSAGE_LOG,{keyPath:constants_1.KEY_PATH_BASE_INCREMENT,autoIncrement:!0}).createIndex("date","date",{unique:!1})})]},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(12),constants_1=__webpack_require__(6);exports.default=[helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_INBOX_MESSAGES,function(database){var store=database.createObjectStore(constants_1.STORE_NAME_INBOX_MESSAGES,{keyPath:"inbox_id",autoIncrement:!1});store.createIndex("status","status",{unique:!1,multiEntry:!0}),store.createIndex("rt","rt",{unique:!1,multiEntry:!0})})]},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushServiceDefault=void 0;var uuid_1=__webpack_require__(7),logger_1=__webpack_require__(4),CONSTANTS=__webpack_require__(0),PushServiceDefault=function(){function PushServiceDefault(api,data,config){this.api=api,this.data=data,this.config=config}return PushServiceDefault.prototype.getPermission=function(){return Notification.permission},PushServiceDefault.prototype.checkIsPermissionGranted=function(){return this.getPermission()===CONSTANTS.PERMISSION_GRANTED},PushServiceDefault.prototype.checkIsPermissionDefault=function(){return this.getPermission()===CONSTANTS.PERMISSION_PROMPT},PushServiceDefault.prototype.checkIsManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getStatusManualUnsubscribed()]})})},PushServiceDefault.prototype.askPermission=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Notification.requestPermission()];case 1:return _a.sent(),[2]}})})},PushServiceDefault.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getTokens()]})})},PushServiceDefault.prototype.subscribe=function(subscription){return __awaiter(this,void 0,void 0,function(){var currentSubscription,senderId_1,applicationServerKey,senderId,pushToken,_p256dn,_auth,p256dh,auth,_a,token,pushSet;return __generator(this,function(_b){switch(_b.label){case 0:return currentSubscription=subscription,this.checkIsPermissionGranted()?currentSubscription?[3,6]:[4,this.trySubscribe()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return currentSubscription=_b.sent(),[4,this.getSenderIdFromManifest()];case 2:return senderId_1=_b.sent(),[4,this.checkIsChangeSenderId(senderId_1)];case 3:return _b.sent()?[4,this.unsubscribe()]:[3,6];case 4:return _b.sent(),[4,this.data.setSenderId(senderId_1)];case 5:_b.sent(),_b.label=6;case 6:return[4,this.getApplicationServerKey()];case 7:return applicationServerKey=_b.sent(),[4,this.data.getSenderId()];case 8:return senderId=_b.sent(),[4,this.getPushToken(currentSubscription)];case 9:if(pushToken=_b.sent(),_p256dn=currentSubscription.getKey("p256dh"),_auth=currentSubscription.getKey("auth"),!_p256dn||!_auth)throw new Error("Can't get subscription keys!");return p256dh=btoa(String.fromCharCode.apply(String,new Uint8Array(_p256dn))),auth=btoa(String.fromCharCode.apply(String,new Uint8Array(_auth))),[4,this.getFcmKeys({endpoint:currentSubscription.endpoint,application_pub_key:applicationServerKey,encryption_key:p256dh,encryption_auth:auth,authorized_entity:senderId})];case 10:return _a=_b.sent(),token=_a.token,pushSet=_a.pushSet,[4,this.data.setTokens({publicKey:p256dh,pushToken:pushToken,authToken:auth,fcmPushSet:pushSet,fcmToken:token,endpoint:currentSubscription.endpoint})];case 11:return _b.sent(),[4,this.api.registerDevice()];case 12:return _b.sent(),[2]}})})},PushServiceDefault.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){var subscription;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,_a.sent().pushManager.getSubscription()];case 2:return subscription=_a.sent(),[4,this.data.setTokens({})];case 3:return _a.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 4:return _a.sent(),[4,this.api.unregisterDevice()];case 5:return _a.sent(),subscription?[4,subscription.unsubscribe()]:[2];case 6:return _a.sent(),[2]}})})},PushServiceDefault.prototype.checkIsRegister=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},PushServiceDefault.prototype.checkIsNeedResubscribe=function(){return __awaiter(this,void 0,void 0,function(){var savedSenderId,isExistSavedSenderId,manifestSenderId,isChangeSenderID,lastPermission,permission,credentials,pushTokenFromSubscription,subscriptionTokensFromStore,pushTokenFromStore;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return savedSenderId=_a.sent(),isExistSavedSenderId=void 0!==savedSenderId,[4,this.getSenderIdFromManifest()];case 2:return manifestSenderId=_a.sent(),isChangeSenderID=isExistSavedSenderId&&manifestSenderId!==savedSenderId,[4,this.data.setSenderId(manifestSenderId)];case 3:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 4:return lastPermission=_a.sent(),permission=this.getPermission(),isExistSavedSenderId&&lastPermission!==permission?[4,this.data.setLastPermissionStatus(permission)]:[3,6];case 5:return _a.sent(),[2,!0];case 6:return[4,this.getCredentials()];case 7:return credentials=_a.sent(),[4,this.getPushToken(credentials)];case 8:return pushTokenFromSubscription=_a.sent(),[4,this.data.getTokens()];case 9:return subscriptionTokensFromStore=_a.sent(),pushTokenFromStore=subscriptionTokensFromStore&&subscriptionTokensFromStore.pushToken||"",[2,isChangeSenderID||!(pushTokenFromSubscription===pushTokenFromStore)]}})})},PushServiceDefault.prototype.getServiceWorkerRegistration=function(){return __awaiter(this,void 0,void 0,function(){var url,_a;return __generator(this,function(_b){switch(_b.label){case 0:return this.registration?[3,5]:[4,this.registerServiceWorker()];case 1:return _b.sent(),[4,this.data.getServiceWorkerUrl()];case 2:return url=_b.sent(),_a=this,[4,navigator.serviceWorker.getRegistration(url)];case 3:return _a.registration=_b.sent(),[4,this.registration.update()];case 4:_b.sent(),_b.label=5;case 5:if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return[2,this.registration]}})})},PushServiceDefault.prototype.registerServiceWorker=function(){return __awaiter(this,void 0,void 0,function(){var url,scope,sdkVersion,serviceWorkerVersion,cleanCache;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getServiceWorkerUrl()];case 1:return url=_a.sent(),[4,this.data.getServiceWorkerScope()];case 2:return scope=_a.sent(),[4,this.data.getSdkVersion()];case 3:return sdkVersion=_a.sent(),[4,this.data.getServiceWorkerVersion()];case 4:return serviceWorkerVersion=_a.sent(),cleanCache="",sdkVersion!==serviceWorkerVersion&&(cleanCache="?cache_clean="+uuid_1.v4()),[4,navigator.serviceWorker.register(""+url+cleanCache,{scope:scope})];case 5:return _a.sent(),[2]}})})},PushServiceDefault.prototype.trySubscribe=function(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,4]),[4,this.subscribePushManager()];case 1:return[2,_a.sent()];case 2:return error_1=_a.sent(),console.error(error_1),[4,this.unsubscribe()];case 3:return _a.sent(),[2,this.subscribePushManager()];case 4:return[2]}})})},PushServiceDefault.prototype.subscribePushManager=function(){return __awaiter(this,void 0,void 0,function(){var registration,applicationServerKey;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return registration=_a.sent(),[4,this.getApplicationServerKey()];case 2:return applicationServerKey=_a.sent(),[2,registration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:applicationServerKey?this.urlBase64ToUint8Array(applicationServerKey):null})]}})})},PushServiceDefault.prototype.getCredentials=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,_a.sent().pushManager.getSubscription()];case 2:return[2,_a.sent()]}})})},PushServiceDefault.prototype.getFcmKeys=function(config){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,fetch(this.config.entrypoint||"https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(config)})];case 1:return 200!==(response=_a.sent()).status?[3,3]:[4,response.json()];case 2:return[2,_a.sent()];case 3:throw new Error("Internal error: Can't register device in fcm. Status: "+response.status+". Message: "+response.statusText)}})})},PushServiceDefault.prototype.getPushToken=function(subscription){return __awaiter(this,void 0,void 0,function(){var deviceType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),subscription?12===deviceType?[2,subscription.endpoint]:[2,subscription.endpoint.split("/").pop()||""]:[2,""]}})})},PushServiceDefault.prototype.getApplicationServerKey=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return 11!==_a.sent()?[2]:[4,this.data.getApplicationServerKey()];case 2:return[2,_a.sent()]}})})},PushServiceDefault.prototype.getSenderIdFromManifest=function(){return __awaiter(this,void 0,void 0,function(){var manifest,url,response,data,match;return __generator(this,function(_a){switch(_a.label){case 0:if(!(manifest=document.querySelector('link[rel="manifest"]')))throw new Error("Error: manifest.json not found!");if(!(url=manifest.getAttribute("href")))throw new Error("Error: manifest.json url not found!");return[4,fetch(url,{method:"GET",headers:{"Content-Type":"application/json;charset=UTF-8"}})];case 1:if(200!==(response=_a.sent()).status)throw new Error("Error: Can't load manifest.json! "+response.statusText);return[4,response.text()];case 2:if(data=_a.sent(),!(match=data.match(/("|')?gcm_sender_id("|')?:\s*("|')?(\d+)("|')?/))||"string"!=typeof match[4])throw new Error("Error: Can't find gcm_sender_id in manifest.json!");return[2,match[4]]}})})},PushServiceDefault.prototype.checkIsChangeSenderId=function(currentSenderId){return __awaiter(this,void 0,void 0,function(){var senderIdFromIndexedDB;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return senderIdFromIndexedDB=_a.sent(),[2,currentSenderId!==senderIdFromIndexedDB]}})})},PushServiceDefault.prototype.urlBase64ToUint8Array=function(base64String){for(var base64=(base64String+"=".repeat((4-base64String.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),rawData=window.atob(base64),outputArray=new Uint8Array(rawData.length),i=0;i<rawData.length;++i)outputArray[i]=rawData.charCodeAt(i);return outputArray},PushServiceDefault}();exports.PushServiceDefault=PushServiceDefault},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var Storage_1=__webpack_require__(25),DateModule_1=__webpack_require__(3),InboxMessagesPublic_1=__webpack_require__(13),InboxMessages=function(){function InboxMessages(eventBus,data,api,storage,dateModule){void 0===storage&&(storage=new Storage_1.default),void 0===dateModule&&(dateModule=new DateModule_1.default),this.eventBus=eventBus,this.data=data,this.api=api,this.storage=storage,this.storeName="inboxMessages",this.dateModule=dateModule}return InboxMessages.prototype.getInboxMessages=function(){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.api.getInboxMessages()];case 1:return response=_a.sent(),[4,this.storeGetInboxMessagesRequestParams(response.next,response.new_inbox)];case 2:return _a.sent(),[2,response]}})})},InboxMessages.prototype.storeGetInboxMessagesRequestParams=function(next,newMessagesCount){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,[4,this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp())];case 1:return _a.sent(),[4,this.data.setInboxLastRequestCode(next)];case 2:return _a.sent(),[4,this.data.setInboxNewMessagesCount(newMessagesCount)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.putServerMessages=function(messages){return __awaiter(this,void 0,void 0,function(){var putTransactions,_this=this;return __generator(this,function(_a){return putTransactions=messages.map(function(message){return __awaiter(_this,void 0,void 0,function(){var localMessage;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.get(this.storeName,message.inbox_id,{})];case 1:return"status"in(localMessage=_a.sent())&&(message.status=localMessage.status),[2,this.putMessage(message)]}})})}),[2,Promise.all(putTransactions)]})})},InboxMessages.prototype.putMessage=function(message){return this.storage.put(this.storeName,message)},InboxMessages.prototype.putBulkMessages=function(messages){var _this=this,putTransactions=messages.map(function(message){return _this.putMessage(message)});return Promise.all(putTransactions)},InboxMessages.prototype.deleteMessages=function(codes){var _this=this,deleteTransactions=codes.map(function(code){return _this.storage.delete(_this.storeName,code)});return Promise.all(deleteTransactions)},InboxMessages.prototype.deleteExpiredMessages=function(){return __awaiter(this,void 0,void 0,function(){var upperBound,allMessages,codesToDelete;return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,upperBound=this.dateModule.getTimestamp().toString(),[4,this.storage.getAll(this.storeName)];case 1:return allMessages=_a.sent(),codesToDelete=allMessages.filter(function(msg){return msg.rt>upperBound}).map(function(msg){return msg.inbox_id}),[2,this.deleteMessages(codesToDelete)]}})})},InboxMessages.prototype.getMessage=function(code){return this.storage.get(this.storeName,code)},InboxMessages.prototype.getReadOpenMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,_a.sent().filter(function(msg){return 2===msg.status||3===msg.status})]}})})},InboxMessages.prototype.getDeliveredMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,_a.sent().filter(function(msg){return 1===msg.status})]}})})},InboxMessages.prototype.messagesCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.storage.count(this.storeName)]})})},InboxMessages.prototype.getDeliveredMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var deliveredStatus,statusIndexName;return __generator(this,function(_a){return deliveredStatus=1,statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,deliveredStatus)]})})},InboxMessages.prototype.getReadMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var readStatus,statusIndexName;return __generator(this,function(_a){return readStatus=2,statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,readStatus)]})})},InboxMessages.prototype.getDeliveredReadMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var _a,readStatus,openStatus,keyRange,statusIndexName;return __generator(this,function(_b){return readStatus=(_a=[2,3])[0],openStatus=_a[1],keyRange=IDBKeyRange.bound(readStatus,openStatus),statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,keyRange)]})})},InboxMessages.prototype.updateMessages=function(){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getInboxMessages()];case 1:return response=_a.sent(),[4,this.deleteExpiredMessages()];case 2:return _a.sent(),response.deleted?[4,this.deleteMessages(response.deleted)]:[3,4];case 3:_a.sent(),_a.label=4;case 4:return[4,this.putServerMessages(response.messages)];case 5:return _a.sent(),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new InboxMessagesPublic_1.default(this.data,this.api,this)}),[2]}})})},InboxMessages}();exports.default=InboxMessages},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var version_1=__webpack_require__(10),MigrationExecutor_1=__webpack_require__(11),Store_1=__webpack_require__(26),Storage=function(){function Storage(){}return Storage.prototype.dbVersionChangeHandler=function(db,event){console.info("onversionchange",event),db.close()},Storage.prototype.dbRequestSuccessHandler=function(resolve,event){var _this=this,database=event.target.result;database.onversionchange=function(event){_this.dbVersionChangeHandler(database,event)},resolve(database)},Storage.prototype.dbRequestUpgradeNeededHandler=function(event){var _this=this,database=event.target.result;database.onversionchange=function(event){_this.dbVersionChangeHandler(database,event)},new MigrationExecutor_1.default(database).applyMigrations()},Storage.prototype.getDB=function(){var _this=this;return new Promise(function(resolve,reject){var request=indexedDB.open("PUSHWOOSH_SDK_STORE",version_1.default);request.onsuccess=function(event){_this.dbRequestSuccessHandler(resolve,event)},request.onupgradeneeded=function(event){_this.dbRequestUpgradeNeededHandler(event)},request.onerror=function(){return reject(request.error)}})},Storage.prototype.put=function(storeName,data,key){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).put(data,key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.delete=function(storeName,key){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).delete(key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.get=function(storeName,key,defaultValue){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).get(key,defaultValue)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.getAll=function(storeName){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).getAll()];case 2:return result=_a.sent(),db.close(),[2,result||[]]}})})},Storage.prototype.count=function(storeName,query){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).count(query)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.countByIndex=function(storeName,indexName,key){return __awaiter(this,void 0,void 0,function(){var db,store,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),(store=new Store_1.default(db,storeName)).index=indexName,[4,store.countByIndex(key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage}();exports.default=Storage},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Store=function(){function Store(db,name){this.name=name,this.store=db.transaction(this.name,"readwrite").objectStore(this.name)}return Object.defineProperty(Store.prototype,"index",{set:function(index){this.store.indexNames.contains(index)?this._index=this.store.index(index):console.warn('Index "'+index+'" in ')},enumerable:!1,configurable:!0}),Store.prototype.writeRequestPromise=function(request,result){return new Promise(function(resolve,reject){request.onsuccess=function(){resolve(result)},request.onerror=function(){reject(request.error)}})},Store.prototype.readRequestPromise=function(request,defaultValue){return new Promise(function(resolve,reject){request.onsuccess=function(event){var target=event.target;resolve(target.result||defaultValue)},request.onerror=function(){reject(request.error)}})},Store.prototype.put=function(data,key){var request=this.store.put(data,key);return this.writeRequestPromise(request,key)},Store.prototype.add=function(data,key){return this.put(data,key)},Store.prototype.delete=function(key){var request=this.store.delete(key);return this.writeRequestPromise(request)},Store.prototype.get=function(key,defaultValue){var request=this.store.get(key);return this.readRequestPromise(request,defaultValue)},Store.prototype.getAll=function(){var cursor=this.store.openCursor(),result=[];return new Promise(function(resolve,reject){cursor.onsuccess=function(event){var cursorResult=event.target.result;cursorResult?(result.push(cursorResult.value),cursorResult.continue()):resolve(result)},cursor.onerror=function(){reject(cursor.error)}})},Store.prototype.count=function(query){var request=this.store.count(query);return this.readRequestPromise(request,0)},Store.prototype.countByIndex=function(key){var request=this._index.count(key);return this.readRequestPromise(request,0)},Store}();exports.default=Store},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE=void 0,exports.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE="pushwoosh-subscription-widget"},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PlatformChecker_1=__webpack_require__(29),PlatformChecker_2=__webpack_require__(29);Object.defineProperty(exports,"PlatformChecker",{enumerable:!0,get:function(){return PlatformChecker_2.PlatformChecker}}),exports.default=PlatformChecker_1.platformChecker},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.platformChecker=exports.PlatformChecker=void 0;var functions_1=__webpack_require__(5),PlatformChecker=function(){function PlatformChecker(global){this.global=global,this._isSafari=this.isSafariBrowser(),this._isOpera=this.isOperaBrowser(),this._isEdge=this.isEdgeBrowser(),this._isFirefox=this.isFirefoxBrowser(),this._isChrome=this.isChromeBrowser(),this._isMacOS=this.isMacOS(),this._isAvailablePromise=this.canUsePromise(),this._isAvailableServiceWorker=this.canUseServiceWorkers(),this._isAvailableNotifications=this.canReceiveNotifications(),this._platform=this.getPlatformType(),this._browserVersion=this.getBrowserVersion()}return Object.defineProperty(PlatformChecker.prototype,"isEdge",{get:function(){return this._isEdge},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isSafari",{get:function(){return this._isSafari},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isOpera",{get:function(){return this._isOpera},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailablePromise",{get:function(){return this._isAvailablePromise},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailableServiceWorker",{get:function(){return this._isAvailableServiceWorker},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailableNotifications",{get:function(){return this._isAvailableNotifications},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"platform",{get:function(){return this._platform},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"browserVersion",{get:function(){return this._browserVersion},enumerable:!1,configurable:!0}),PlatformChecker.prototype.isSafariBrowser=function(){return"safari"in this.global&&navigator.userAgent.indexOf("Safari")>-1},PlatformChecker.prototype.isOperaBrowser=function(){return-1!==navigator.userAgent.indexOf("Opera")||-1!==navigator.userAgent.indexOf("OPR")},PlatformChecker.prototype.isEdgeBrowser=function(){return navigator.userAgent.indexOf("Edge")>-1},PlatformChecker.prototype.isFirefoxBrowser=function(){return-1!==navigator.userAgent.toLowerCase().indexOf("firefox")},PlatformChecker.prototype.isChromeBrowser=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)&&!this._isOpera&&!this._isEdge},PlatformChecker.prototype.isMacOS=function(){return"platform"in navigator&&-1!==navigator.platform.toLowerCase().indexOf("mac")},PlatformChecker.prototype.canUseServiceWorkers=function(){return!!navigator.serviceWorker&&"PushManager"in this.global&&"Notification"in this.global},PlatformChecker.prototype.canUsePromise=function(){return"Promise"in this.global},PlatformChecker.prototype.canReceiveNotifications=function(){return this._isSafari&&this._isMacOS||this._isAvailableServiceWorker&&!this._isEdge},PlatformChecker.prototype.getPlatformType=function(){var platform=11;switch(!0){case this._isSafari:platform=10;break;case this._isOpera||this._isChrome:platform=11;break;case this._isFirefox:platform=12;break;case this._isEdge:platform=150}return platform},PlatformChecker.prototype.getBrowserVersion=function(){var userAgent=navigator.userAgent,matchOperaVersion=userAgent.match(/\bOPR\/(\d+)/);if(null!==matchOperaVersion)return"Opera "+matchOperaVersion[1];var matchEdgeVersion=userAgent.match(/\bEdge\/(\d+)/);if(null!==matchEdgeVersion)return"Edge "+matchEdgeVersion[1];var matchEdgVersion=userAgent.match(/\bEdg\/(\d+)/);if(null!==matchEdgVersion)return"Edge "+matchEdgVersion[1];var match=userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],_a=(match[0],match[1]),browser=void 0===_a?"":_a;if(/trident/i.test(userAgent)){var matchIeVersion=/trident\/([.\d]+)/gi.exec(userAgent)||[];return"IE "+(("7.0"===matchIeVersion[1]?"11":matchIeVersion[1])||"")}match=match[2]?[browser,match[2]]:[navigator.appName,navigator.appVersion,"-?"];var version=userAgent.match(/version\/([.\d]+)/i);return null!==version&&match.splice(1,1,version[1]),match.join(" ")},PlatformChecker}();exports.PlatformChecker=PlatformChecker,exports.platformChecker=new PlatformChecker(functions_1.getGlobal())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIBE_WIDGET_DEFAULT_CONFIG=exports.WIDGET_CONTAINER_ID=exports.BELL_POSITION_TOP_LEFT=exports.BELL_POSITION_TOP_RIGHT=exports.BELL_POSITION_BOTTOM_LEFT=exports.BELL_POSITION_BOTTOM_RIGHT=void 0,exports.BELL_POSITION_BOTTOM_RIGHT="bottomRight",exports.BELL_POSITION_BOTTOM_LEFT="bottomLeft",exports.BELL_POSITION_TOP_RIGHT="topRight",exports.BELL_POSITION_TOP_LEFT="topLeft",exports.WIDGET_CONTAINER_ID="pushwooshBellWidget",exports.SUBSCRIBE_WIDGET_DEFAULT_CONFIG={position:exports.BELL_POSITION_BOTTOM_LEFT,bgColor:"#12AE7E",bellColor:"white",bellStrokeColor:"#08754f",bellButtonBorder:"1px solid #379676",shadow:"0px 0px 6px rgba(0, 0, 0, 0.75)",size:"48px",indent:"20px",zIndex:"999999",tooltipText:{successSubscribe:"You are successfully subscribed!",needSubscribe:"Get notifications about important news!",blockSubscribe:"Click to see how to get notifications",alreadySubscribed:"You are already subscribed"}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Pushwoosh_1=__webpack_require__(32);Object.defineProperty(exports,"Pushwoosh",{enumerable:!0,get:function(){return Pushwoosh_1.default}}),__webpack_require__(38),__webpack_require__(44),__webpack_require__(46)},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var uuid_1=__webpack_require__(7),EventBus_1=__webpack_require__(17),Api_1=__webpack_require__(19),Data_1=__webpack_require__(2),ApiClient_1=__webpack_require__(14),PushService_1=__webpack_require__(33),SubscriptionPromptWidget_1=__webpack_require__(35),CONSTANTS=__webpack_require__(0),functions_1=__webpack_require__(5),PlatformChecker_1=__webpack_require__(28),logger_1=__webpack_require__(4),FacebookModule_1=__webpack_require__(37),storage_1=__webpack_require__(1),InboxMessages_1=__webpack_require__(24),InboxMessagesPublic_1=__webpack_require__(13),Pushwoosh=function(){function Pushwoosh(){var _this=this;this.ready=!1,this.addEventHandler=function(name,handler){return _this.eventBus.addEventHandler(name,handler)},this.removeEventHandler=function(name,handler){return _this.eventBus.removeEventHandler(name,handler)},this.dispatchEvent=function(name,payload){return _this.eventBus.dispatchEvent(name,payload)},this.debug={showLog:function(){return __awaiter(this,void 0,void 0,function(){var items;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.log.getAll()];case 1:return items=_a.sent(),console.log(items),[2]}})})},showKeyValues:function(){return __awaiter(this,void 0,void 0,function(){var items;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.keyValue.getAll()];case 1:return items=_a.sent(),console.log(items),[2]}})})},showMessages:function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.message.getAll()];case 1:return _a.sent().forEach(function(i){return console.log(i)}),[2]}})})}},this.eventBus=new EventBus_1.EventBus,this.data=new Data_1.Data,this.apiClient=new ApiClient_1.ApiClient(this.data),this.api=new Api_1.Api(this.eventBus,this.data,this.apiClient),this.platformChecker=new PlatformChecker_1.PlatformChecker(functions_1.getGlobal()),this.inboxModel=new InboxMessages_1.default(this.eventBus,this.data,this.api),this.pwinbox=new InboxMessagesPublic_1.default(this.data,this.api,this.inboxModel),this.onServiceWorkerMessage=this.onServiceWorkerMessage.bind(this),this.subscriptionPromptWidget=new SubscriptionPromptWidget_1.SubscriptionPromptWidget(this.eventBus,this)}return Pushwoosh.prototype.push=function(command){if("function"!=typeof command){if(!Array.isArray(command))throw new Error("Invalid command!");switch(command[0]){case"init":this.initialize(command[1]);break;case CONSTANTS.EVENT_ON_LOAD:case CONSTANTS.EVENT_ON_READY:case CONSTANTS.EVENT_ON_REGISTER:case CONSTANTS.EVENT_ON_SUBSCRIBE:case CONSTANTS.EVENT_ON_UNSUBSCRIBE:case CONSTANTS.EVENT_ON_SW_INIT_ERROR:case CONSTANTS.EVENT_ON_PUSH_DELIVERY:case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:case CONSTANTS.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:case CONSTANTS.EVENT_ON_UPDATE_INBOX_MESSAGES:case CONSTANTS.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:case CONSTANTS.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:case CONSTANTS.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:case CONSTANTS.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:case CONSTANTS.EVENT_ON_PERMISSION_DENIED:case CONSTANTS.EVENT_ON_PERMISSION_PROMPT:case CONSTANTS.EVENT_ON_PERMISSION_GRANTED:this.subscribeToLegacyEvents(command[0],command[1]);break;default:throw new Error("Unknown command!")}}else this.subscribeToLegacyEvents("onReady",command)},Pushwoosh.prototype.subscribe=function(isForceSubscribe){return void 0===isForceSubscribe&&(isForceSubscribe=!0),__awaiter(this,void 0,void 0,function(){var permission_1,permission,isManualUnsubscribed,isDeviceRegister;return __generator(this,function(_a){switch(_a.label){case 0:return this.isCommunicationDisabled&&logger_1.Logger.error("Communication is disabled!"),this.driver.checkIsPermissionDefault()?(this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),[4,this.driver.askPermission()]):[3,2];case 1:_a.sent(),permission_1=this.driver.getPermission(),this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:permission_1}),_a.label=2;case 2:return permission=this.driver.getPermission(),[4,this.data.getStatusManualUnsubscribed()];case 3:return isManualUnsubscribed=_a.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 4:return isDeviceRegister=_a.sent(),permission!==CONSTANTS.PERMISSION_GRANTED?[3,7]:(this.eventBus.dispatchEvent("permission-granted",{}),!(isForceSubscribe||!isManualUnsubscribed)||isDeviceRegister?[3,6]:[4,this.driver.subscribe()]);case 5:_a.sent(),_a.label=6;case 6:return this.eventBus.dispatchEvent("subscribe",{}),[2];case 7:return permission!==CONSTANTS.PERMISSION_DENIED?[3,10]:(this.eventBus.dispatchEvent("permission-denied",{}),isDeviceRegister?[4,this.driver.unsubscribe()]:[3,9]);case 8:_a.sent(),_a.label=9;case 9:case 10:return[2]}})})},Pushwoosh.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,3]),[4,this.driver.unsubscribe()];case 1:return _a.sent(),[3,3];case 2:return error_1=_a.sent(),logger_1.Logger.error(error_1,"Error occurred during the unsubscribe"),[3,3];case 3:return[2]}})})},Pushwoosh.prototype.forceSubscribe=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.subscribe(!0)];case 1:return _a.sent(),[2]}})})},Pushwoosh.prototype.isDeviceRegistered=function(){return localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS)===CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED},Pushwoosh.prototype.isDeviceUnregistered=function(){return localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS)===CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED},Pushwoosh.prototype.isSubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},Pushwoosh.prototype.isCommunicationEnabled=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:return[2,!_a.sent()]}})})},Pushwoosh.prototype.setCommunicationEnabled=function(isEnabled){return void 0===isEnabled&&(isEnabled=!0),__awaiter(this,void 0,void 0,function(){var deviceType,isPermissionGranted;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),isPermissionGranted=this.driver.checkIsPermissionGranted(),[4,this.data.setStatusCommunicationDisabled(!isEnabled)];case 2:return _a.sent(),isEnabled?[4,this.data.setStatusDropAllData(!1)]:[3,6];case 3:return _a.sent(),isPermissionGranted?[4,this.api.registerDevice()]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[3,8];case 6:return[4,this.api.unregisterDevice()];case 7:_a.sent(),_a.label=8;case 8:return this.eventBus.dispatchEvent("change-enabled-communication",{isEnabled:isEnabled}),[4,this.api.postEvent(CONSTANTS.EVENT_GDPR_CONSENT,{channel:isEnabled,device_type:deviceType})];case 9:return _a.sent(),[2]}})})},Pushwoosh.prototype.removeAllDeviceData=function(){return __awaiter(this,void 0,void 0,function(){var deviceType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),[4,this.api.postEvent(CONSTANTS.EVENT_GDPR_DELETE,{status:!0,device_type:deviceType})];case 2:return _a.sent(),[4,this.api.deleteDevice()];case 3:return _a.sent(),[4,this.data.clearAll()];case 4:return _a.sent(),[4,this.data.setStatusDropAllData(!0)];case 5:return _a.sent(),[2]}})})},Pushwoosh.prototype.getHWID=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getHwid()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.getPushToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getTokens()];case 1:return[2,_a.sent().pushToken]}})})},Pushwoosh.prototype.getUserId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getUserId()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.getParams=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.api.getParams()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.isAvailableNotifications=function(){return this.platformChecker.isAvailableNotifications},Pushwoosh.prototype.sendStatisticsVisitedPage=function(){return __awaiter(this,void 0,void 0,function(){var title,_a,origin,pathname,href;return __generator(this,function(_b){switch(_b.label){case 0:return title=window.document.title,_a=window.location,origin=_a.origin,pathname=_a.pathname,href=_a.href,[4,this.api.pageVisit({title:title,url_path:""+origin+pathname,url:href})];case 1:return _b.sent(),[2]}})})},Pushwoosh.prototype.initialize=function(params){return __awaiter(this,void 0,void 0,function(){var manualDebug,applicationCode,notSavedApplicationCode,isChangeApplicationCode,id,config,_a,userIdWasChange,error_2,error_3,delayedEvent,type,payload,hashReg,hash;return __generator(this,function(_b){switch(_b.label){case 0:return manualDebug=localStorage.getItem(CONSTANTS.MANUAL_SET_LOGGER_LEVEL),logger_1.Logger.setLevel(manualDebug||params.logLevel||"error"),this.platformChecker.isAvailableNotifications?[4,this.data.getApplicationCode()]:[2];case 1:if(applicationCode=_b.sent(),!params.applicationCode)throw new Error("Can't find application code!");return notSavedApplicationCode=!applicationCode,isChangeApplicationCode=applicationCode&&applicationCode!==params.applicationCode,notSavedApplicationCode||isChangeApplicationCode?[4,this.data.clearAll()]:[3,4];case 2:return _b.sent(),[4,this.data.setApplicationCode(params.applicationCode)];case 3:_b.sent(),_b.label=4;case 4:return[4,this.data.getHwid()];case 5:return _b.sent()?[3,7]:(id=params.applicationCode+"_"+uuid_1.v4(),[4,this.data.setHwid(id)]);case 6:_b.sent(),_b.label=7;case 7:return[4,this.data.setDeviceType(this.platformChecker.getPlatformType())];case 8:return _b.sent(),[4,this.data.setDeviceModel(this.platformChecker.getBrowserVersion())];case 9:return _b.sent(),[4,this.data.setLanguage(params.tags&&params.tags.Language||navigator.language)];case 10:return _b.sent(),params.pushwooshUrl?[4,this.data.setApiEntrypoint(params.pushwooshUrl)]:[3,12];case 11:_b.sent(),_b.label=12;case 12:return[4,this.data.setSdkVersion("3.31.0")];case 13:return _b.sent(),[4,this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt"])];case 14:return config=_b.sent(),this.onGetConfig(config&&config.features),this.subscribeWidgetConfig=__assign({enable:!1},params.subscribeWidget),this.inboxWidgetConfig=__assign({enable:!1},params.inboxWidget),this.subscribePopupConfig=__assign({enable:!1},params.subscribePopup),_a=this,[4,this.data.getStatusCommunicationDisabled()];case 15:return _a.isCommunicationDisabled=_b.sent(),[4,this.open()];case 16:return _b.sent(),[4,this.data.getStatusUserIdWasChanged()];case 17:return userIdWasChange=_b.sent(),!params.userId||"user_id"===params.userId||userIdWasChange?[3,19]:[4,this.api.registerUser(params.userId)];case 18:_b.sent(),_b.label=19;case 19:return params.tags&&this.api.setTags(params.tags),this.platformChecker.isAvailableNotifications?[4,this.initPushNotifications(params)]:[3,21];case 20:_b.sent(),_b.label=21;case 21:return _b.trys.push([21,23,,24]),[4,this.inboxModel.updateMessages()];case 22:return _b.sent(),[3,24];case 23:return error_2=_b.sent(),logger_1.Logger.write("error",error_2),[3,24];case 24:return _b.trys.push([24,26,,27]),[4,this.initFacebook(params)];case 25:return _b.sent(),[3,27];case 26:return error_3=_b.sent(),logger_1.Logger.write("error",error_3),[3,27];case 27:return this.ready=!0,this.eventBus.dispatchEvent("ready",{}),[4,this.data.getDelayedEvent()];case 28:return(delayedEvent=_b.sent())?(type=delayedEvent.type,payload=delayedEvent.payload,[4,this.emitLegacyEventsFromServiceWorker(type,payload)]):[3,31];case 29:return _b.sent(),[4,this.data.setDelayedEvent(null)];case 30:_b.sent(),_b.label=31;case 31:return"serviceWorker"in navigator&&(navigator.serviceWorker.onmessage=this.onServiceWorkerMessage),localStorage.setItem("pushwoosh-websdk-status","init"),document.dispatchEvent(new CustomEvent("pushwoosh.initialized",{detail:{pw:this}})),this.platformChecker.isSafari&&(hashReg=/#P(.*)/,hash=decodeURIComponent(document.location.hash),hashReg.test(hash)&&this.api.pushStat(hashReg.exec(hash)[1]).then(functions_1.clearLocationHash)),[2]}})})},Pushwoosh.prototype.defaultProcess=function(initParams){return __awaiter(this,void 0,void 0,function(){var permission,isCommunicationDisabled,isDropAllData,isNeedResubscribe,features,currentPromptUseCase,autoSubscribe,isManualUnsubscribed,isRegister,widgetConfig,isDefaultUseCase,isNotSetUseCase;return __generator(this,function(_b){switch(_b.label){case 0:return"granted"!==(permission=this.driver.getPermission())?[3,2]:[4,this.data.setLastPermissionStatus(permission)];case 1:_b.sent(),_b.label=2;case 2:return[4,this.data.getStatusCommunicationDisabled()];case 3:return isCommunicationDisabled=_b.sent(),[4,this.data.getStatusDropAllData()];case 4:return isDropAllData=_b.sent(),[4,this.driver.checkIsNeedResubscribe()];case 5:return isNeedResubscribe=_b.sent(),[4,this.data.getFeatures()];case 6:return features=_b.sent(),currentPromptUseCase=features.subscription_prompt&&features.subscription_prompt.use_case,isCommunicationDisabled||isDropAllData?[4,this.unsubscribe()]:[3,8];case 7:return _b.sent(),[2];case 8:return isNeedResubscribe?[4,this.unsubscribe()]:[3,11];case 9:return _b.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 10:_b.sent(),_b.label=11;case 11:return autoSubscribe=initParams.autoSubscribe,[4,this.data.getStatusManualUnsubscribed()];case 12:return isManualUnsubscribed=_b.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 13:switch(isRegister=_b.sent(),permission){case CONSTANTS.PERMISSION_PROMPT:return[3,14];case CONSTANTS.PERMISSION_DENIED:return[3,20];case CONSTANTS.PERMISSION_GRANTED:return[3,23]}return[3,28];case 14:return this.eventBus.dispatchEvent("permission-default",{}),isRegister?[4,this.unsubscribe()]:[3,16];case 15:_b.sent(),_b.label=16;case 16:return[4,this.getWidgetConfig()];case 17:return widgetConfig=_b.sent(),[4,this.checkCanShowByCapping(widgetConfig)];case 18:return _b.sent()?(isDefaultUseCase=currentPromptUseCase===CONSTANTS.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT,isNotSetUseCase=currentPromptUseCase===CONSTANTS.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET&&autoSubscribe,(isDefaultUseCase||isNotSetUseCase)&&(this.subscriptionPromptWidget.init(widgetConfig),this.subscriptionPromptWidget.show()),[4,this.updateCappingParams()]):[3,28];case 19:return _b.sent(),[3,28];case 20:return this.eventBus.dispatchEvent("permission-denied",{}),isRegister?[4,this.unsubscribe()]:[3,22];case 21:_b.sent(),_b.label=22;case 22:return[3,28];case 23:return this.eventBus.dispatchEvent("permission-granted",{}),isManualUnsubscribed&&isRegister?[4,this.unsubscribe()]:[3,25];case 24:_b.sent(),_b.label=25;case 25:return!isRegister&&!isManualUnsubscribed||isNeedResubscribe?[4,this.subscribe(!0)]:[3,27];case 26:_b.sent(),_b.label=27;case 27:return[3,28];case 28:return[2]}})})},Pushwoosh.prototype.getWidgetConfig=function(){return __awaiter(this,void 0,void 0,function(){var features,currentConfig,configWithDefaultCapping;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getFeatures()];case 1:return features=_a.sent(),currentConfig=features.subscription_prompt_widget&&features.subscription_prompt_widget.params,configWithDefaultCapping=__assign({cappingCount:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingCount,cappingDelay:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingDelay},currentConfig),[2,currentConfig?configWithDefaultCapping:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG]}})})},Pushwoosh.prototype.checkCanShowByCapping=function(widgetConfig){return __awaiter(this,void 0,void 0,function(){var currentTime,displayCount,lastSeenTime,canShowByCapping,canShowByLastTime;return __generator(this,function(_a){switch(_a.label){case 0:return currentTime=(new Date).getTime(),[4,this.data.getPromptDisplayCount()];case 1:return displayCount=_a.sent(),[4,this.data.getPromptLastSeenTime()];case 2:return lastSeenTime=_a.sent(),canShowByCapping=widgetConfig.cappingCount>displayCount,canShowByLastTime=currentTime-lastSeenTime>widgetConfig.cappingDelay,[2,canShowByCapping&&canShowByLastTime]}})})},Pushwoosh.prototype.updateCappingParams=function(){return __awaiter(this,void 0,void 0,function(){var displayCount,currentTime;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getPromptDisplayCount()];case 1:return displayCount=_a.sent(),currentTime=(new Date).getTime(),[4,this.data.setPromptDisplayCount(displayCount+1)];case 2:return _a.sent(),[4,this.data.setPromptLastSeenTime(currentTime)];case 3:return _a.sent(),[2]}})})},Pushwoosh.prototype.initFacebook=function(initParams){var facebook=__assign({enable:!1,pageId:"",containerClass:""},initParams.facebook);if(facebook&&facebook.enable)try{new FacebookModule_1.default({pageId:facebook.pageId,containerClass:facebook.containerClass,applicationCode:initParams.applicationCode,userId:initParams.userId||""})}catch(error){logger_1.Logger.error(error,"facebook module initialization failed")}},Pushwoosh.prototype.onServiceWorkerMessage=function(event){var _a=(event||{}).data,_b=(void 0===_a?{}:_a)||{},_c=_b.type,type=void 0===_c?"":_c,_d=_b.payload,payload=void 0===_d?{}:_d;this.emitLegacyEventsFromServiceWorker(type,payload)},Pushwoosh.prototype.open=function(isForce){return __awaiter(this,void 0,void 0,function(){var lastApplicationOpenTime,currentTime,isSendingPeriodExceeded;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getLastOpenApplicationTime()];case 1:return lastApplicationOpenTime=_a.sent(),currentTime=Date.now(),lastApplicationOpenTime||(lastApplicationOpenTime=0),isSendingPeriodExceeded=currentTime-lastApplicationOpenTime<CONSTANTS.PERIOD_SEND_APP_OPEN,isForce||!isSendingPeriodExceeded?[4,this.data.setLastOpenApplicationTime(currentTime)]:[2];case 2:return _a.sent(),[4,this.api.applicationOpen()];case 3:return _a.sent(),[2]}})})},Pushwoosh.prototype.onGetConfig=function(features){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setFeatures(features)];case 1:return _a.sent(),features?features.page_visit&&features.page_visit.enabled?[4,storage_1.keyValue.set(CONSTANTS.PAGE_VISITED_URL,features.page_visit.entrypoint)]:[3,3]:[3,5];case 2:_a.sent(),this.sendStatisticsVisitedPage(),_a.label=3;case 3:return features.events&&features.events.length&&features.events.some(function(event){return event===CONSTANTS.EVENT_PW_SITE_OPENED})&&this.sendPostEventVisitedPage(),features.vapid_key?[4,this.data.setApplicationServerKey(features.vapid_key)]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[2]}})})},Pushwoosh.prototype.initPushNotifications=function(params){return __awaiter(this,void 0,void 0,function(){var error_4;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setDefaultNotificationImage(params.defaultNotificationImage)];case 1:return _a.sent(),[4,this.data.setDefaultNotificationTitle(params.defaultNotificationTitle)];case 2:return _a.sent(),[4,this.data.setServiceWorkerUrl(params.serviceWorkerUrl)];case 3:return _a.sent(),[4,this.data.setServiceWorkerScope(params.scope)];case 4:return _a.sent(),[4,this.data.setInitParams(__assign({autoSubscribe:!0},params))];case 5:return _a.sent(),[4,this.initDriver()];case 6:_a.sent(),_a.label=7;case 7:return _a.trys.push([7,9,,10]),[4,this.defaultProcess(params)];case 8:return _a.sent(),[3,10];case 9:return error_4=_a.sent(),logger_1.Logger.error(error_4,"Internal error: defaultProcess fail"),[3,10];case 10:return[2]}})})},Pushwoosh.prototype.initDriver=function(){return __awaiter(this,void 0,void 0,function(){var webSitePushId;return __generator(this,function(_a){switch(_a.label){case 0:return this.platformChecker.isSafari?[4,this.data.getInitParams()]:[3,2];case 1:if(!(webSitePushId=_a.sent().safariWebsitePushID))throw new Error("For work with Safari Push Notification add safariWebsitePushID to initParams!");return this.driver=new PushService_1.PushServiceSafari(this.api,this.data,{webSitePushId:webSitePushId}),[2];case 2:return this.platformChecker.isAvailableServiceWorker?(this.driver=new PushService_1.PushServiceDefault(this.api,this.data,{}),[2]):[2]}})})},Pushwoosh.prototype.sendPostEventVisitedPage=function(){return __awaiter(this,void 0,void 0,function(){var title,href;return __generator(this,function(_a){return title=window.document.title,href=window.location.href,this.api.postEvent(CONSTANTS.EVENT_PW_SITE_OPENED,{url:href,title:title,device_type:this.platformChecker.platform}),[2]})})},Pushwoosh.prototype.subscribeToLegacyEvents=function(type,handler){var _this=this;switch(type){case CONSTANTS.EVENT_ON_LOAD:handler();break;case CONSTANTS.EVENT_ON_READY:if(this.ready){handler(this.api);break}this.eventBus.addEventHandler("ready",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_REGISTER:this.eventBus.addEventHandler("register",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_SUBSCRIBE:this.eventBus.addEventHandler("subscribe",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_UNSUBSCRIBE:this.eventBus.addEventHandler("unsubscribe",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_SW_INIT_ERROR:this.eventBus.addEventHandler("initialize-service-worker-error",function(_a){var error=_a.error;return handler(_this.api,error)});break;case CONSTANTS.EVENT_ON_PUSH_DELIVERY:this.eventBus.addEventHandler("receive-push",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.addEventHandler("open-notification",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.addEventHandler("hide-notification",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:this.eventBus.addEventHandler("change-enabled-communication",function(_a){var isEnabled=_a.isEnabled;return handler(_this.api,isEnabled)});break;case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.addEventHandler("receive-inbox-message",function(_a){var message=_a.message;return handler(_this.api,message)});break;case CONSTANTS.EVENT_ON_UPDATE_INBOX_MESSAGES:this.eventBus.addEventHandler("update-inbox-messages",function(_a){var messages=_a.messages;return handler(_this.api,messages)});break;case CONSTANTS.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("show-notification-permission-dialog",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("hide-notification-permission-dialog",function(_a){var permission=_a.permission;return handler(_this.api,permission)});break;case CONSTANTS.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("show-subscription-widget",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("hide-subscription-widget",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_DENIED:this.eventBus.addEventHandler("permission-denied",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_PROMPT:this.eventBus.addEventHandler("permission-default",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_GRANTED:this.eventBus.addEventHandler("permission-granted",function(){return handler(_this.api)})}},Pushwoosh.prototype.emitLegacyEventsFromServiceWorker=function(type,payload){switch(type){case CONSTANTS.EVENT_ON_PUSH_DELIVERY:this.eventBus.dispatchEvent("receive-push",{notification:payload});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.dispatchEvent("open-notification",{notification:payload});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.dispatchEvent("hide-notification",{notification:payload});break;case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.dispatchEvent("receive-inbox-message",{message:payload})}},Pushwoosh}();exports.default=Pushwoosh},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PushServiceDefault_1=__webpack_require__(23);Object.defineProperty(exports,"PushServiceDefault",{enumerable:!0,get:function(){return PushServiceDefault_1.PushServiceDefault}});var PushServiceSafari_1=__webpack_require__(34);Object.defineProperty(exports,"PushServiceSafari",{enumerable:!0,get:function(){return PushServiceSafari_1.PushServiceSafari}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushServiceSafari=void 0;var logger_1=__webpack_require__(4),CONSTANTS=__webpack_require__(0),PushServiceSafari=function(){function PushServiceSafari(api,data,config){this.api=api,this.config=config,this.data=data}return PushServiceSafari.prototype.getPermission=function(){return this.getPermissionInfo().permission},PushServiceSafari.prototype.checkIsPermissionGranted=function(){return this.getPermission()===CONSTANTS.PERMISSION_GRANTED},PushServiceSafari.prototype.checkIsPermissionDefault=function(){return this.getPermission()===CONSTANTS.PERMISSION_PROMPT},PushServiceSafari.prototype.checkIsManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusManualUnsubscribed()];case 1:return[2,_a.sent()]}})})},PushServiceSafari.prototype.askPermission=function(){return __awaiter(this,void 0,void 0,function(){var application,hwid,payload,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return application=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),payload={application:application,hwid:hwid},[2,new Promise(function(resolve){safari.pushNotification.requestPermission(_this.config.entrypoint||"https://cp.pushwoosh.com/json/1.3/safari",_this.config.webSitePushId,payload,function(){return resolve()})})]}})})},PushServiceSafari.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getTokens()]})})},PushServiceSafari.prototype.subscribe=function(){return __awaiter(this,void 0,void 0,function(){var deviceToken;return __generator(this,function(_a){switch(_a.label){case 0:return this.checkIsPermissionGranted()?[4,this.getPermissionInfo()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return deviceToken=_a.sent().deviceToken,[4,this.data.setTokens({pushToken:deviceToken})];case 2:return _a.sent(),[4,this.api.registerDevice()];case 3:return _a.sent(),[2]}})})},PushServiceSafari.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setTokens({})];case 1:return _a.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return _a.sent(),[4,this.api.unregisterDevice()];case 3:return _a.sent(),[2]}})})},PushServiceSafari.prototype.checkIsRegister=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},PushServiceSafari.prototype.checkIsNeedResubscribe=function(){return __awaiter(this,void 0,void 0,function(){var savedWebSitePushId,isChangeWebSitePushId,lastPermission,permission;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getWebSitePushId()];case 1:return savedWebSitePushId=_a.sent(),isChangeWebSitePushId=void 0!==savedWebSitePushId&&this.config.webSitePushId!==savedWebSitePushId,[4,this.data.setWebSitePushId(this.config.webSitePushId)];case 2:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 3:return lastPermission=_a.sent(),permission=this.getPermission(),lastPermission===permission?[3,5]:[4,this.data.setLastPermissionStatus(permission)];case 4:return _a.sent(),[2,!0];case 5:return[2,isChangeWebSitePushId]}})})},PushServiceSafari.prototype.getPermissionInfo=function(){return safari.pushNotification.permission(this.config.webSitePushId)},PushServiceSafari}();exports.PushServiceSafari=PushServiceSafari},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubscriptionPromptWidget=void 0;var SubscriptionPromptWidget_helpers_1=__webpack_require__(36),SubscriptionPromptWidget_constants_1=__webpack_require__(27),SubscriptionPromptWidget=function(){function SubscriptionPromptWidget(eventBus,pw){this.eventBus=eventBus,this.pw=pw}return SubscriptionPromptWidget.prototype.init=function(params){if(!this.getRootElement()){var html=SubscriptionPromptWidget_helpers_1.getHTML(params),styles=SubscriptionPromptWidget_helpers_1.getStyles(params);document.body.insertAdjacentHTML("beforeend",html),document.head.appendChild(styles)}this.addEventListeners()},SubscriptionPromptWidget.prototype.show=function(){var rootElement=this.getRootElementWithCheckExist();this.eventBus.dispatchEvent("show-subscription-widget",{}),rootElement.classList.add(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")},SubscriptionPromptWidget.prototype.hide=function(){var rootElement=this.getRootElementWithCheckExist();rootElement.classList.contains(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")&&(this.eventBus.dispatchEvent("hide-subscription-widget",{}),rootElement.classList.remove(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show"))},SubscriptionPromptWidget.prototype.getRootElement=function(){return document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-root")},SubscriptionPromptWidget.prototype.getRootElementWithCheckExist=function(){var element=this.getRootElement();if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root", please use method init first.');return element},SubscriptionPromptWidget.prototype.getDeclineButtonWithCheckExist=function(){var element=document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-decline");if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline", please use method init first.');return element},SubscriptionPromptWidget.prototype.getAcceptButtonWithCheckExist=function(){var element=document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-accept");if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept", please use method init first.');return element},SubscriptionPromptWidget.prototype.addEventListeners=function(){var _this=this,rootElement=this.getRootElementWithCheckExist(),declineElement=this.getDeclineButtonWithCheckExist(),acceptElement=this.getAcceptButtonWithCheckExist();document.addEventListener("click",function(event){rootElement.contains(event.target)||_this.hide()}),declineElement.addEventListener("click",function(){_this.hide()}),acceptElement.addEventListener("click",function(){_this.hide(),_this.pw.subscribe()})},SubscriptionPromptWidget}();exports.SubscriptionPromptWidget=SubscriptionPromptWidget},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStyles=exports.getHTML=void 0;var SubscriptionPromptWidget_constants_1=__webpack_require__(27);exports.getHTML=function(params){return'\n <div id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'">\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__body">\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__header">\n '+params.headerText+'\n </div>\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__description">\n '+params.subheaderText+'\n </div>\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__controls">\n <button type="button" id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control "+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__control_decline">\n '+params.buttonCancelText+'\n </button>\n <button type="button" id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control "+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__control_accept">\n '+params.buttonAcceptText+"\n </button>\n </div>\n </div>\n </div>\n "},exports.getStyles=function(params){var styles=document.createElement("style");return styles.innerHTML="\n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+" * {\n box-sizing: border-box!important;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+" {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 320px;\n display: none;\n z-index: 2147483648;\n opacity: 0.99;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show {\n display: block;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__body {\n width: 320px;\n background-color: "+(params.backgroundColor?params.backgroundColor:"#FFFFFF")+";\n box-shadow: 0 9px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n padding: 20px 20px 12px;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__header {\n color: "+params.headerTextColor+";\n font-size: 18px;\n font-weight: bold; \n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__description {\n color: "+params.subheaderTextColor+";\n font-size: 14px;\n line-height: 1.5;\n margin-top: 14px;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__description:empty {\n display: none;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-end;\n margin: 20px 0 0;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control {\n -webkit-appearance: none;\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n padding: 0 20px;\n height: 32px;\n cursor: pointer;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control_decline {\n color: "+params.buttonCancelTextColor+";\n background-color: "+params.buttonCancelBackgroundColor+";\n border-radius: "+params.buttonCancelRound+";\n border-color: "+params.buttonCancelBorderColor+";\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control_accept {\n color: "+params.buttonAcceptTextColor+";\n background-color: "+params.buttonAcceptBackgroundColor+";\n border-radius: "+params.buttonAcceptRound+";\n border-color: "+params.buttonAcceptBorderColor+";\n margin: 0 0 0 12px;\n }\n ",styles}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),functions_1=__webpack_require__(5),storage_1=__webpack_require__(1),FacebookModule=function(){function FacebookModule(config){this.userRef=functions_1.generateUUID(),this.config=config,this.init()}return FacebookModule.prototype.init=function(){this.renderCheckbox(),this.initFacebookSDK(),this.loadFacebookSDK()},FacebookModule.prototype.renderCheckbox=function(){for(var _a=this.config,pageId=_a.pageId,containerClass=_a.containerClass,attributes=[{name:"messenger_app_id",value:constants_1.FACEBOOK_APP_ID},{name:"class",value:"fb-messenger-checkbox"},{name:"page_id",value:pageId},{name:"origin",value:window.location.protocol+"//"+window.location.hostname},{name:"user_ref",value:this.userRef},{name:"allow_login",value:"true"},{name:"size",value:"large"},{name:"skin",value:"light"},{name:"center_align",value:"false"}],nodes=document.getElementsByClassName(containerClass),_loop_1=function(index){var node=document.createElement("div");attributes.forEach(function(attribute){node.setAttribute(attribute.name,attribute.value)}),nodes[index].appendChild(node)},index=0;index<nodes.length;index++)_loop_1(index)},FacebookModule.prototype.getHWID=function(){return __awaiter(this,void 0,void 0,function(){var hwid,applicationCode,newHWID;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.keyValue.get(constants_1.FACEBOOK_HWID_KEY)];case 1:return(hwid=_a.sent())?[3,3]:(applicationCode=this.config.applicationCode,newHWID=applicationCode+"_"+functions_1.generateUUID()+"_fb",[4,storage_1.keyValue.set(constants_1.FACEBOOK_HWID_KEY,newHWID)]);case 2:return _a.sent(),[2,newHWID];case 3:return[2,hwid]}})})},FacebookModule.prototype.userConfirm=function(){return __awaiter(this,void 0,void 0,function(){var _a,pageId,applicationCode,userId,FB,facebookHwid;return __generator(this,function(_b){switch(_b.label){case 0:return _a=this.config,pageId=_a.pageId,applicationCode=_a.applicationCode,userId=_a.userId,FB=window.FB,[4,this.getHWID()];case 1:return facebookHwid=_b.sent(),FB&&FB.AppEvents.logEvent("MessengerCheckboxUserConfirmation",null,{app_id:constants_1.FACEBOOK_APP_ID,page_id:pageId,ref:JSON.stringify({applicationCode:applicationCode,userId:userId,hwid:facebookHwid}),user_ref:this.userRef}),[2]}})})},FacebookModule.prototype.initFacebookSDK=function(){var _this=this;window.fbAsyncInit=function(){window.FB.init({appId:constants_1.FACEBOOK_APP_ID,xfbml:!0,version:"v3.2"}),window.FB.Event.subscribe("messenger_checkbox",function(_a){"checkbox"===_a.event&&_this.userConfirm()})}},FacebookModule.prototype.loadFacebookSDK=function(){var language=navigator.language||"en_US";!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];d.getElementById(id)||((js=d.createElement(s)).id=id,js.src="https://connect.facebook.net/"+language+"/sdk.js",fjs&&fjs.parentNode.insertBefore(js,fjs))}(document,"script","facebook-jssdk")},FacebookModule}();exports.default=FacebookModule},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),PlatformChecker_1=__webpack_require__(28),constants_2=__webpack_require__(30),positioning_1=__webpack_require__(39),bell_1=__webpack_require__(40),storage_1=__webpack_require__(1),SubscribeWidget=function(){function SubscribeWidget(pw){var _this=this;if(this.pw=pw,PlatformChecker_1.default.isAvailableNotifications){this.clickBell=this.clickBell.bind(this),this.onSubscribeEvent=this.onSubscribeEvent.bind(this),this.onUnsubscribeEvent=this.onUnsubscribeEvent.bind(this),this.onPermissionDeniedEvent=this.onPermissionDeniedEvent.bind(this),this.clickOutOfPopover=this.clickOutOfPopover.bind(this);var tooltipText=Object.assign(constants_2.SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText,pw.subscribeWidgetConfig.tooltipText);this.config=Object.assign({},constants_2.SUBSCRIBE_WIDGET_DEFAULT_CONFIG,pw.subscribeWidgetConfig),this.config.tooltipText=tooltipText,pw.isSubscribed().then(function(isSubscribed){isSubscribed||_this.render()})}else console.warn("Browser does not support push notifications")}return SubscribeWidget.prototype.addStylesToElement=function(styles,element){Object.keys(styles).forEach(function(st){element.style[st]=styles[st]})},SubscribeWidget.prototype.createContainer=function(){var container=document.createElement("div");container.id=constants_2.WIDGET_CONTAINER_ID,container.className="pushwoosh-subscribe-widget";var position=positioning_1.default.getBellPosition(this.config.position,this.config.indent),styles=Object.assign({zIndex:this.config.zIndex},position);return this.addStylesToElement(styles,container),container},SubscribeWidget.prototype.createStyle=function(){var styles=__webpack_require__(41),styleNode=document.createElement("style");return styleNode.innerHTML=styles,styleNode},SubscribeWidget.prototype.createBell=function(){var bell,config=this.config;return config.buttonImage?(bell=document.createElement("img")).src=config.buttonImage:(bell=document.createElement("div"),this.addStylesToElement({backgroundColor:config.bgColor,boxShadow:config.shadow,lineHeight:config.size,border:config.bellButtonBorder},bell),bell.innerHTML=bell_1.default(config.bellColor,config.bellStrokeColor)),this.addStylesToElement({width:config.size,height:config.size},bell),bell.className="pushwoosh-subscribe-widget__bell-button",bell},SubscribeWidget.prototype.createTooltip=function(){return __awaiter(this,void 0,void 0,function(){var tooltip,_a,position,modification,_b,_c;return __generator(this,function(_d){switch(_d.label){case 0:return tooltip=document.createElement("div"),_a=positioning_1.default.getTooltipPosition(this.config.position,this.config.size),position=_a[0],modification=_a[1],tooltip.className="pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__"+modification,this.addStylesToElement(position,tooltip),_c=(_b=tooltip).appendChild,[4,this.createTooltipContent()];case 1:return _c.apply(_b,[_d.sent()]),[2,tooltip]}})})},SubscribeWidget.prototype.createTooltipContent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return tooltipContent=document.createElement("div"),_a=tooltipContent,[4,this.tooltipTextFactory()];case 1:return _a.innerText=_b.sent(),tooltipContent.className="pushwoosh-subscribe-widget__tooltip-content",[2,tooltipContent]}})})},SubscribeWidget.prototype.tooltipTextFactory=function(){return __awaiter(this,void 0,void 0,function(){var permission,tooltipText,isManuallyUnsubscribed;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.pw.driver.getPermission()];case 1:return permission=_a.sent(),tooltipText=this.config.tooltipText,[4,storage_1.keyValue.get(constants_1.MANUAL_UNSUBSCRIBE)];case 2:switch(isManuallyUnsubscribed=_a.sent(),permission){case constants_1.PERMISSION_GRANTED:return[2,isManuallyUnsubscribed?tooltipText.needSubscribe:tooltipText.alreadySubscribed];case constants_1.PERMISSION_PROMPT:return[2,tooltipText.needSubscribe];case constants_1.PERMISSION_DENIED:return[2,tooltipText.blockSubscribe];default:return[2,tooltipText.needSubscribe]}return[2]}})})},SubscribeWidget.prototype.createPopover=function(){var popoverContentWrapper=document.createElement("div"),popover=document.createElement("div"),_a=positioning_1.default.getPopoverPosition(this.config.position,this.config.size),position=_a[0],modification=_a[1];popover.className="pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__"+modification,popoverContentWrapper.className="pushwoosh-subscribe-widget__popover-content-wrapper",this.style.innerHTML+=positioning_1.default.getPopoverArrowPosition(this.config.position,this.config.size);var styles=Object.assign({maxWidth:"calc(100vw - "+this.config.indent+" - "+this.config.indent+")"},position);return this.addStylesToElement(styles,popover),popoverContentWrapper.appendChild(this.createPopoverContent()),popover.appendChild(popoverContentWrapper),popover},SubscribeWidget.prototype.getBrowserName=function(){return PlatformChecker_1.default.isOpera?"opera":11===PlatformChecker_1.default.platform&&navigator.userAgent.match(/Android/i)?"mobileChrome":12===PlatformChecker_1.default.platform?"firefox":10===PlatformChecker_1.default.platform?"safari":150===PlatformChecker_1.default.platform?"edge":"chrome"},SubscribeWidget.prototype.createPopoverContent=function(){var config=this.config,popoverContent=document.createElement("div");popoverContent.className="pushwoosh-subscribe-widget__popover-content";var browser=this.getBrowserName(),userImageSrc=config.contentImages&&config.contentImages[browser];if(userImageSrc){var image=document.createElement("img");image.src=userImageSrc,popoverContent.appendChild(image)}else{var standardImage={opera:"opera",mobileChrome:"mobile_chrome",firefox:"FF",safari:"safari"}[browser]||"chrome";[{src:this.getImageSrc(standardImage),width:500,height:130},{src:this.getImageSrc(standardImage+"_unlock"),width:500,height:230}].forEach(function(imageAttrs){var image=document.createElement("img");Object.assign(image,imageAttrs),popoverContent.appendChild(image)})}return popoverContent},SubscribeWidget.prototype.getImageSrc=function(img){return"https://cdn.pushwoosh.com/webpush/img/"+img+".jpg"},SubscribeWidget.prototype.render=function(){return __awaiter(this,void 0,void 0,function(){var bell,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return this.widget=this.createContainer(),this.style=this.createStyle(),bell=this.createBell(),_a=this,[4,this.createTooltip()];case 1:return _a.tooltip=_c.sent(),_b=this,[4,this.createPopover()];case 2:return _b.popover=_c.sent(),this.widget.appendChild(this.style),this.widget.appendChild(bell),this.widget.appendChild(this.tooltip),this.widget.appendChild(this.popover),document.body.appendChild(this.widget),this.pw.push(["onSubscribe",this.onSubscribeEvent]),this.pw.push(["onUnsubscribe",this.onUnsubscribeEvent]),this.pw.push(["onPermissionDenied",this.onPermissionDeniedEvent]),this.addEventListeners(),[2]}})})},SubscribeWidget.prototype.addEventListeners=function(){this.widget.addEventListener("click",this.clickBell),window.addEventListener("click",this.clickOutOfPopover)},SubscribeWidget.prototype.toggleHelpPopover=function(){this.popover.classList.toggle("pushwoosh-subscribe-widget__popover__visible")},SubscribeWidget.prototype.clickBell=function(){return __awaiter(this,void 0,void 0,function(){var permission;return __generator(this,function(_b){switch(_b.label){case 0:switch(permission=this.pw.driver.getPermission(),permission){case constants_1.PERMISSION_GRANTED:return[3,1];case constants_1.PERMISSION_PROMPT:return[3,3];case constants_1.PERMISSION_DENIED:return[3,5]}return[3,6];case 1:return[4,this.pw.subscribe()];case 2:return _b.sent(),[3,7];case 3:return[4,this.pw.subscribe()];case 4:return _b.sent(),[3,7];case 5:return this.toggleHelpPopover(),[3,7];case 6:console.warn("Unknown browser notification permission"),_b.label=7;case 7:return[2]}})})},SubscribeWidget.prototype.onSubscribeEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_this=this;return __generator(this,function(_a){return null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(tooltipContent.innerText=this.config.tooltipText.successSubscribe,this.tooltip.classList.add("pushwoosh-subscribe-widget__tooltip__visible"),setTimeout(function(){return __awaiter(_this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return this.tooltip.classList.remove("pushwoosh-subscribe-widget__tooltip__visible"),_a=tooltipContent,[4,this.tooltipTextFactory()];case 1:return _a.innerText=_b.sent(),this.widget.classList.add("pushwoosh-subscribe-widget__subscribed"),[2]}})})},2e3),[2])})})},SubscribeWidget.prototype.onPermissionDeniedEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return this.addEventListeners(),null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(_a=tooltipContent,[4,this.tooltipTextFactory()]);case 1:return _a.innerText=_b.sent(),[2]}})})},SubscribeWidget.prototype.clickOutOfPopover=function(ev){this.popover.classList.contains("pushwoosh-subscribe-widget__popover__visible")&&!ev.target.classList.contains("pushwoosh-subscribe-widget__popover")&&null===ev.target.closest(".pushwoosh-subscribe-widget__popover")&&!ev.target.classList.contains("pushwoosh-subscribe-widget__bell-button")&&null===ev.target.closest(".pushwoosh-subscribe-widget__bell-button")&&this.popover.classList.remove("pushwoosh-subscribe-widget__popover__visible")},SubscribeWidget.prototype.onUnsubscribeEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(_a=tooltipContent,[4,this.tooltipTextFactory()]);case 1:return _a.innerText=_b.sent(),[2]}})})},SubscribeWidget}();document.addEventListener("pushwoosh.initialized",function(ev){ev.detail.pw.subscribeWidgetConfig.enable&&new SubscribeWidget(ev.detail.pw)})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(30),Positioning=function(){function Positioning(){}return Positioning.getBellPosition=function(position,indent){var positionStyles;switch(position){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={top:"auto",left:"auto",bottom:indent,right:indent};break;case constants_1.BELL_POSITION_BOTTOM_LEFT:positionStyles={top:"auto",left:indent,bottom:indent,right:"auto"};break;case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={top:indent,left:indent,bottom:"auto",right:"auto"};break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={top:indent,left:"auto",bottom:"auto",right:indent};break;default:positionStyles={top:"auto",left:"auto",bottom:indent,right:indent}}return positionStyles},Positioning.getTooltipPosition=function(bellPosition,bellSize){var positionStyles,tooltipModification,increaseIndent=parseInt(bellSize)+12+"px";switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={right:increaseIndent},tooltipModification="right";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={left:increaseIndent},tooltipModification="left";break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={right:increaseIndent},tooltipModification="right";break;default:positionStyles={right:increaseIndent},tooltipModification="right"}return[positionStyles,tooltipModification]},Positioning.getPopoverPosition=function(bellPosition,bellSize){var positionStyles,popoverModification,increaseIndent=parseInt(bellSize)+15+"px";switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={bottom:increaseIndent,right:"0",left:"auto",top:"auto"},popoverModification="bottom";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:positionStyles={bottom:increaseIndent,left:"0",right:"auto",top:"auto"},popoverModification="bottom";break;case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={top:increaseIndent,left:"0",right:"auto",bottom:"auto"},popoverModification="top";break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={top:increaseIndent,right:"0",left:"auto",bottom:"auto"},popoverModification="top";break;default:positionStyles={bottom:increaseIndent,right:"0",left:"auto",top:"auto"},popoverModification="bottom"}return[positionStyles,popoverModification]},Positioning.getPopoverArrowPosition=function(bellPosition,bellSize){var arrowAdditionalStyles;switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: "+(parseInt(bellSize)/2-12)+"px";break;case constants_1.BELL_POSITION_TOP_LEFT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: "+(parseInt(bellSize)/2-12)+"px";break;case constants_1.BELL_POSITION_TOP_RIGHT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px";break;default:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px"}return arrowAdditionalStyles},Positioning}();exports.default=Positioning},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(fillColor,strokeColor){return'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n id="Capa_1"\n x="0px"\n y="0px"\n viewBox="0 0 346.013 346.013"\n style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n xml:space="preserve"\n inkscape:version="0.91 r13725"\n sodipodi:docname="alarm_white.svg"><metadata\n id="metadata51"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs49" /><sodipodi:namedview\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1618"\n inkscape:window-height="828"\n id="namedview47"\n showgrid="false"\n inkscape:zoom="0.6820553"\n inkscape:cx="173.0065"\n inkscape:cy="173.0065"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="0"\n inkscape:current-layer="g3" /><g\n id="g3"><path\n d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n id="path5"\n inkscape:connector-curvature="0"\n vector-effect="non-scaling-stroke"\n style="fill:'+fillColor+"; stroke: "+strokeColor+'; stroke-width: 1; " /><path\n vector-effect="non-scaling-stroke"\n d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n id="path7"\n inkscape:connector-curvature="0"\n style="fill:'+fillColor+"; stroke: "+strokeColor+'; stroke-width: 1;" /></g><g\n id="g17" /><g\n id="g19" /><g\n id="g21" /><g\n id="g23" /><g\n id="g25" /><g\n id="g27" /><g\n id="g29" /><g\n id="g31" /><g\n id="g33" /><g\n id="g35" /><g\n id="g37" /><g\n id="g39" /><g\n id="g41" /><g\n id="g43" /><g\n id="g45" /></svg>'}},function(module,exports,__webpack_require__){var result=__webpack_require__(42);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(43)(void 0)).push([module.i,'/* Widget */\n.pushwoosh-subscribe-widget {\n position: fixed;\n display: block;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n}\n\n.pushwoosh-subscribe-widget__subscribed {\n display: none;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {\n -webkit-border-radius: 50%;\n border-radius: 50%;\n cursor: pointer;\n font-size: 0;\n text-align: center;\n -webkit-transform: scale(0.9) translate3d(0, 0, 0);\n transform: scale(0.9) translate3d(0, 0, 0);\n -webkit-transition: -webkit-transform .3s ease-in-out;\n transition: -webkit-transform .3s ease-in-out;\n -o-transition: transform .3s ease-in-out;\n transition: transform .3s ease-in-out;\n transition: transform .3s ease-in-out, -webkit-transform .3s ease-in-out;\n position: relative;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n}\n\n/* Tooltip */\n.pushwoosh-subscribe-widget__tooltip {\n position: absolute;\n height: 48px;\n max-width: 300px;\n min-width: 200px;\n padding: 5px 7px;\n background-color: #3b444b;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n line-height: 38px;\n font-size: 0;\n font-weight: normal;\n visibility: hidden;\n opacity: 0;\n -webkit-transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n -o-transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n top: 50%;\n -webkit-transform: translate(0, -50%);\n -ms-transform: translate(0, -50%);\n transform: translate(0, -50%);\n -webkit-box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after,\n.pushwoosh-subscribe-widget__tooltip__left:after {\n content: "";\n top: 50%;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n background: #3b444b;\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after {\n left: calc(100% - 7px);\n border-top: 5px solid #3b444b;\n border-left: 5px solid #3b444b;\n border-right: 5px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__tooltip__left:after {\n left: -7px;\n border-top: 5px solid #3b444b;\n border-right: 5px solid #3b444b;\n border-left: 5px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,\n.pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n -webkit-transition-delay: 0s;\n -o-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {\n display: inline-block;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1.4;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 5px;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n/* Popover */\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {\n position: absolute;\n right: auto;\n -webkit-box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background: #9ca8b1;\n visibility: hidden;\n opacity: 0;\n -webkit-transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n -o-transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n -webkit-transition-delay: 0s;\n -o-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after,\n.pushwoosh-subscribe-widget__popover__top:after {\n content: "";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-right: 8px solid transparent;\n border-left: 8px solid #9ca8b1;\n background: #9ca8b1;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after {\n border-bottom: 8px solid #9ca8b1;\n border-top: 8px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n bottom: -16px;\n}\n\n.pushwoosh-subscribe-widget__popover__top:after {\n top: 0;\n border-top: 8px solid #9ca8b1;\n border-bottom: 8px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__popover-content-wrapper {\n overflow: auto;\n max-width: 100%;\n}\n\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n padding: 14px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n float: left;\n min-width: 100%;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n display: block;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-bottom: 14px;\n}\n\n@media (max-width: 767px) and (orientation: portrait) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 0;\n margin-bottom: 14px;\n }\n}\n@media (max-width: 767px) and (orientation: landscape) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 14px;\n margin-bottom: 0;\n }\n}\n',""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var pwInboxWidget=__webpack_require__(45);document.addEventListener("pushwoosh.initialized",function(ev){ev.detail.pw.pwinbox&&ev.detail.pw.inboxWidgetConfig.enable&&(ev.detail.pw.pwinboxWidget=new pwInboxWidget.PWInboxWidget(ev.detail.pw))})},function(module,exports,__webpack_require__){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(1);exports.isElementFixed=function isElementFixed(element){var isFixed="fixed"===window.getComputedStyle(element).position;return!isFixed&&element.parentElement&&(isFixed=isElementFixed(element.parentElement)),isFixed},exports.getGlobal=function(){return Function("return this")()},exports.getMessageTime=function(date){var localDate=new Date(date),localTime=localDate.getHours()+localDate.getTimezoneOffset()/60;localDate.setHours(localTime);var gap=(new Date).getTime()-localDate.getTime();return gap<=6e4?"Just now":gap<constants_1.MILLISECONDS_IN_HOUR&&gap>0?Math.floor(gap/6e4)+" minutes ago":gap<constants_1.MILLISECONDS_IN_DAY&&gap>0?Math.floor(gap/36e5)+" hours ago":localDate.getDate()+" "+constants_1.MONTHS[localDate.getMonth()]+" "+localDate.getFullYear()+", "+localDate.getHours()+":"+("0"+localDate.getMinutes().toString()).slice(-2)},exports.getValidColor=function(color){return"transparent"===color?color:constants_1.COLOR_TEST_REGEXP.test(color)?color:"#333"},exports.compareBySendDate=function(dateOne,dateTwo){var localDateOne=new Date(dateOne),localTimeOne=localDateOne.getHours()+localDateOne.getTimezoneOffset()/60,localDateTwo=new Date(dateTwo),localTimeTwo=localDateTwo.getHours()+localDateTwo.getTimezoneOffset()/60;return localDateOne.setHours(localTimeOne),localDateTwo.setHours(localTimeTwo),localDateTwo.getTime()-localDateOne.getTime()}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MILLISECONDS_IN_DAY=864e5,exports.MILLISECONDS_IN_HOUR=36e5,exports.MONTHS=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],exports.CONFIG_STYLES=[{name:"widgetWidth",type:"size"},{name:"borderRadius",type:"size"},{name:"zIndex",type:"number"},{name:"fontFamily",type:"string"},{name:"bgColor",type:"color"},{name:"textColor",type:"color"},{name:"arrowBorderColor",type:"color"},{name:"borderColor",type:"color"},{name:"badgeBgColor",type:"color"},{name:"badgeTextColor",type:"color"},{name:"timeTextColor",type:"color"},{name:"messageTitleColor",type:"color"},{name:"emptyInboxTitleColor",type:"color"},{name:"emptyInboxTextColor",type:"color"}],exports.DEFAULT_CONFIG={enable:!1,triggerId:"pwInbox",position:"bottom",appendTo:"body",title:"Inbox",bgColor:"#ffffff",textColor:"#333333",fontFamily:"inherit",borderRadius:4,borderColor:"transparent",badgeBgColor:"#ff4c00",badgeTextColor:"#ffffff",widgetWidth:350,zIndex:100,messageTitleColor:"#7a7a7a",timeTextColor:"#c4c4c4",emptyInboxTitle:"You're all caught up",emptyInboxTitleColor:"#333333",emptyInboxText:"There are no new messages. Stay tuned!",emptyInboxTextColor:"#7a7a7a",emptyInboxIconUrl:"https://pushon.pushwoosh.com/images/icon-empty-inbox.png",arrowBorderColor:"rgba(0,0,0,.1)"},exports.COLOR_TEST_REGEXP=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var InboxWidget_1=__webpack_require__(3);exports.PWInboxWidget=InboxWidget_1.default},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t};Object.defineProperty(exports,"__esModule",{value:!0});var widgetTemplates_1=__webpack_require__(4),constants_1=__webpack_require__(1),helpers_1=__webpack_require__(0),InboxWidget=function(){function InboxWidget(pw){this.pw=pw,this.config=__assign({},constants_1.DEFAULT_CONFIG,{arrowBorderColor:this.pw.inboxWidgetConfig.borderColor&&"transparent"!==this.pw.inboxWidgetConfig.borderColor?this.pw.inboxWidgetConfig.borderColor:"rgba(0,0,0,.1)"},this.pw.inboxWidgetConfig),this.updateInbox=this.updateInbox.bind(this),this.markVisibleItemsAsRead=this.markVisibleItemsAsRead.bind(this),this.onWidgetClickHandler=this.onWidgetClickHandler.bind(this),this.onTriggerClickHandler=this.onTriggerClickHandler.bind(this),this.onWindowScrollHandler=this.onWindowScrollHandler.bind(this),this.toggle=this.toggle.bind(this);try{this.initTrigger(),this.updateInbox(),this.addListeners()}catch(err){console.warn(err)}}return InboxWidget.prototype.toggle=function(isOpened){(void 0===isOpened?!this.isOpened:isOpened)?this.openWidget():this.closeWidget()},InboxWidget.prototype.initTrigger=function(){if(!this.pw.pwinbox)throw new Error("Web inbox is not allowed.");var trigger=document.getElementById(this.config.triggerId);if(!trigger)throw new Error("Inbox trigger element doesn't exist. You must set triggerId in inboxWidget config. See the documentation.");this.trigger=trigger,this.trigger.classList.add("pw-inbox-trigger"),this.defaultMargin=12,this.messagesElements={},this.messages=[],this.readItems=[],this.updateCounter(0),this.isOpened=!1,this.renderWidget(),this.isFixed=helpers_1.isElementFixed(this.trigger)},InboxWidget.prototype.renderWidget=function(){this.widget=document.createElement("div"),this.widget.id="pwInboxWidget",this.widget.className="pw-inbox-widget",this.widget.classList.toggle("pw-open",this.isOpened),this.widgetParent=document.querySelector(this.config.appendTo)||document.body,this.widgetParent.appendChild(this.widget),this.widgetParent.appendChild(this.getStyle()),this.renderWidgetInner()},InboxWidget.prototype.getStyle=function(){var styles=__webpack_require__(5),styleNode=document.createElement("style");return styleNode.innerHTML=this.configureStyle(styles),styleNode},InboxWidget.prototype.configureStyle=function(styles){var _this=this,resultStyles=styles.toString();return constants_1.CONFIG_STYLES.forEach(function(style){var template=new RegExp("var\\(--"+style.name+"\\)","ig"),result=_this.getStyleFormatter(style);resultStyles=resultStyles.replace(template,result)}),resultStyles},InboxWidget.prototype.getStyleFormatter=function(style){switch(style.type){case"size":return(this.config[style.name]||0)+"px";case"number":return parseFloat(this.config[style.name].toString()).toString();case"string":return this.config[style.name].toString();case"color":return helpers_1.getValidColor(this.config[style.name].toString());default:return"none"}},InboxWidget.prototype.renderWidgetInner=function(){if(this.messages.length>0)this.widget.classList.remove("pw-inbox-widget--empty"),this.widget.innerHTML=widgetTemplates_1.widgetTemplate(this.config.title),this.renderMessages();else{this.widget.classList.add("pw-inbox-widget--empty");var _a=this.config,emptyInboxTitle=_a.emptyInboxTitle,emptyInboxText=_a.emptyInboxText,emptyInboxIconUrl=_a.emptyInboxIconUrl;this.widget.innerHTML=widgetTemplates_1.widgetTemplateEmpty(emptyInboxIconUrl,emptyInboxTitle,emptyInboxText)}},InboxWidget.prototype.renderMessages=function(){var _this=this;this.list=this.widget.querySelector(".pw-inbox_list")||document.createElement("ul"),this.messages.forEach(function(message){var messageElement=document.createElement("li");messageElement.className="pw-inbox_item",messageElement.classList.toggle("pw-new",!message.isRead),messageElement.classList.toggle("pw-unread",!message.isActionPerformed),messageElement.setAttribute("data-pw-inbox-message-id",message.code),messageElement.innerHTML=widgetTemplates_1.messageTemplate(message),_this.list.appendChild(messageElement),_this.messagesElements[message.code]=messageElement})},InboxWidget.prototype.updateCounter=function(count){this.count=count,this.trigger.setAttribute("data-pw-count",""+this.count),this.trigger.classList.toggle("pw-empty",0===this.count)},InboxWidget.prototype.updateInboxMessages=function(messages){this.messages=messages.sort(function(_a,_b){var sendDateOne=_a.sendDate,sendDateTwo=_b.sendDate;return helpers_1.compareBySendDate(sendDateOne,sendDateTwo)}),this.renderWidgetInner()},InboxWidget.prototype.openWidget=function(){this.isOpened=!0,this.widget.classList.add("pw-open"),document.addEventListener("click",this.onWidgetClickHandler),window.addEventListener("scroll",this.onWindowScrollHandler),window.addEventListener("resize",this.onWindowScrollHandler),this.markVisibleItemsAsRead(),this.messages.length>0&&this.list.addEventListener("scroll",this.markVisibleItemsAsRead),this.positionWidget()},InboxWidget.prototype.closeWidget=function(){this.isOpened=!1,document.removeEventListener("click",this.onWidgetClickHandler),document.removeEventListener("click",this.onWindowScrollHandler),window.removeEventListener("resize",this.onWindowScrollHandler),this.updateReadStatus(),this.messages.length>0&&this.list.removeEventListener("scroll",this.markVisibleItemsAsRead),this.widget.classList.remove("pw-open","pw-top","pw-bottom","pw-right","pw-left"),this.widget.removeAttribute("style")},InboxWidget.prototype.positionWidget=function(){this.isOpened&&(this.widgetParent===document.body?this.defaultPlaceWidget():this.customPlaceWidget())},InboxWidget.prototype.customPlaceWidget=function(){var position=this.config.position;this.widgetParent.style.position="relative",this.widget.classList.add("pw-inbox-widget--inset"),this.widget.classList.add("pw-"+position)},InboxWidget.prototype.defaultPlaceWidget=function(){var position=this.pw.inboxWidgetConfig.position?this.config.position:this.getDefaultPosition(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);switch(widgetRect.width+2*this.defaultMargin>windowWidth&&(this.widget.style.width=windowWidth-2*this.defaultMargin+"px"),widgetRect.height+24>windowHeight&&(this.widget.style.height=windowHeight-2*this.defaultMargin+"px"),position){case"top":this.alignWidgetTop();break;case"right":this.alignWidgetRight();break;case"left":this.alignWidgetLeft();break;case"bottom":this.alignWidgetBottom()}}},InboxWidget.prototype.alignWidgetTop=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-top");var left=pageXOffset+triggerRect.left+Math.floor(triggerRect.width/2)-Math.floor(widgetRect.width/2),isUnderLeft=left<pageXOffset,isUnderRight=left+widgetRect.width>pageXOffset+windowWidth;isUnderLeft&&(left=pageXOffset+this.defaultMargin),isUnderRight&&(left=pageXOffset+windowWidth-widgetRect.width-this.defaultMargin);var top=pageYOffset+triggerRect.top-widgetRect.height;this.alignWidgetElement(left,top),arrow.style.left=triggerRect.left+Math.floor(triggerRect.width/2)-left+"px";var topMargin=this.widget.getBoundingClientRect().top;if(topMargin<0){var newHeight=this.widget.getBoundingClientRect().height+topMargin-this.defaultMargin,newTop=this.widget.getBoundingClientRect().top-topMargin+this.defaultMargin;this.widget.style.height=newHeight+"px",this.widget.style.top=newTop+"px"}}},InboxWidget.prototype.alignWidgetRight=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-right");var top=pageYOffset+triggerRect.top+Math.floor(triggerRect.height/2)-Math.floor(widgetRect.height/2),isUnderTop=top<pageYOffset,isUnderBottom=pageYOffset+windowHeight<top+widgetRect.height;isUnderTop&&(top=pageYOffset+this.defaultMargin),isUnderBottom&&(top=pageYOffset+windowHeight-widgetRect.height-this.defaultMargin);var left=pageXOffset+triggerRect.left+triggerRect.width;this.alignWidgetElement(left,top),arrow.style.top=triggerRect.top+Math.floor(triggerRect.height/2)-top+"px";var rightMargin=windowWidth-this.widget.getBoundingClientRect().right;if(rightMargin<this.defaultMargin){var newWidth=this.widget.getBoundingClientRect().width+rightMargin-this.defaultMargin;this.widget.style.width=newWidth+"px"}}},InboxWidget.prototype.alignWidgetLeft=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-left");var top=pageYOffset+triggerRect.top+Math.floor(triggerRect.height/2)-Math.floor(widgetRect.height/2),isUnderTop=top<pageYOffset,isUnderBottom=pageYOffset+windowHeight<top+widgetRect.height;isUnderTop&&(top=pageYOffset+this.defaultMargin),isUnderBottom&&(top=pageYOffset+windowHeight-widgetRect.height-this.defaultMargin);var left=pageXOffset+triggerRect.left-widgetRect.width;this.alignWidgetElement(left,top),arrow.style.top=triggerRect.top+Math.floor(triggerRect.height/2)-top+"px";var leftMargin=this.widget.getBoundingClientRect().left;if(leftMargin<0){var newWidth=this.widget.getBoundingClientRect().width+leftMargin-this.defaultMargin,newLeft=this.widget.getBoundingClientRect().left-leftMargin;this.widget.style.width=newWidth+"px",this.widget.style.left=newLeft+"px"}}},InboxWidget.prototype.alignWidgetBottom=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-bottom");var left=pageXOffset+triggerRect.left+Math.floor(triggerRect.width/2)-Math.floor(widgetRect.width/2),isUnderLeft=left<pageXOffset,isUnderRight=left+widgetRect.width>pageXOffset+windowWidth;isUnderLeft&&(left=pageXOffset+this.defaultMargin),isUnderRight&&(left=pageXOffset+windowWidth-widgetRect.width-12);var top=pageYOffset+triggerRect.top+triggerRect.height;this.alignWidgetElement(left,top),arrow.style.left=triggerRect.left+Math.floor(triggerRect.width/2)-left+"px";var bottomRange=windowHeight-this.widget.getBoundingClientRect().bottom;if(bottomRange<this.defaultMargin){var newHeight=this.widget.getBoundingClientRect().height+bottomRange-this.defaultMargin;this.widget.style.height=newHeight+"px"}}},InboxWidget.prototype.alignWidgetElement=function(left,top){this.widget.style.left=left+"px",this.widget.style.top=top+"px"},InboxWidget.prototype.getDefaultPosition=function(){var _a=this.trigger.getBoundingClientRect(),left=_a.left,top=_a.top,width=_a.width,height=_a.height;if(!document.documentElement)return"";var antiMargins={right:left,bottom:top,left:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-(left+width),top:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(top+height)},leastMargin=Math.min(left,top,antiMargins.left,antiMargins.top),position="bottom";return Object.keys(antiMargins).forEach(function(key){antiMargins[key]===leastMargin&&(position=key)}),position},InboxWidget.prototype.addListeners=function(){var _this=this;this.trigger.addEventListener("click",this.onTriggerClickHandler),this.pw.push(["onPutNewMessageToInboxStore",function(){_this.updateInbox()}]),this.pw.push(["onUpdateInboxMessages",function(){_this.updateInbox()}])},InboxWidget.prototype.markVisibleItemsAsRead=function(){var _this=this;if(0!==this.messages.length){var scrollTop=this.list.clientHeight+this.list.scrollTop-50;Object.keys(this.messagesElements).forEach(function(code){if(_this.messagesElements[code]&&!(_this.messagesElements[code].offsetTop>scrollTop)){var message=_this.messages.find(function(message){return message.code===code});!message||message.isRead||_this.readItems.indexOf(code)+1||_this.readItems.push(code)}})}},InboxWidget.prototype.updateReadStatus=function(){this.pw.pwinbox.readMessagesWithCodes(this.readItems).then(this.updateInbox)},InboxWidget.prototype.updateInbox=function(){var _this=this;this.pw.pwinbox.loadMessages().then(function(messages){_this.updateInboxMessages(messages)}),this.pw.pwinbox.unreadMessagesCount().then(function(count){_this.updateCounter(count)})},InboxWidget.prototype.performMessageAction=function(code){var _this=this;this.pw.pwinbox.performActionForMessageWithCode(code).then(function(){_this.updateInbox()})},InboxWidget.prototype.removeMessages=function(messages){var _this=this;messages.forEach(function(code){_this.readItems=_this.readItems.slice(_this.readItems.indexOf(code),1)}),this.pw.pwinbox.deleteMessagesWithCodes(messages).then(function(){_this.updateInbox()})},InboxWidget.prototype.onTriggerClickHandler=function(event){event.stopPropagation(),event.target&&this.toggle()},InboxWidget.prototype.onWidgetClickHandler=function(event){if(event.target){var itemElement=event.target.closest(".pw-inbox_item");if(itemElement){var messageCode=itemElement.getAttribute("data-pw-inbox-message-id");messageCode&&(event.target.closest(".pw-inbox_item-remove")?this.removeMessages([messageCode]):this.performMessageAction(messageCode))}else this.toggle()}},InboxWidget.prototype.onWindowScrollHandler=function(){this.isFixed&&this.isOpened?this.toggle():this.positionWidget()},InboxWidget}();exports.default=InboxWidget},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(0);exports.widgetTemplate=function(title){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_inner">\n <div class="pw-inbox_title">\n '+title+'\n </div>\n <ul class="pw-inbox_list">\n \n </ul>\n</div>'},exports.widgetTemplateEmpty=function(emptyInboxIconUrl,emptyInboxTitle,emptyInboxText){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_list--empty">\n <div class="pw-inbox_list-icon">\n <img src="'+emptyInboxIconUrl+'" alt="'+emptyInboxTitle+'">\n </div>\n <div class="pw-inbox_list-title">\n '+emptyInboxTitle+'\n </div>\n <div class="ipw-inbox_list-body">\n '+emptyInboxText+"\n </div>\n</div>"},exports.messageTemplate=function(_a){var imageUrl=_a.imageUrl,title=_a.title,message=_a.message,sendDate=_a.sendDate;return'\n<div class="pw-inbox_item-inner">\n <div class="pw-inbox_icon">\n <img src="'+imageUrl+'" alt="'+(title||message)+'" class="pw-inbox_message-image">\n </div>\n <div class="pw-inbox_content">\n '+(title?'<div class="pw-inbox_item-title">\n '+title+"\n </div>":null)+'\n <div class="pw-inbox_item-body">\n '+message+'\n </div>\n <div class="pw-inbox_item-time">\n '+helpers_1.getMessageTime(sendDate)+'\n </div>\n </div>\n</div>\n<span class="pw-inbox_item-remove"></span>'}},function(module,exports,__webpack_require__){var result=__webpack_require__(6);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(7)(void 0)).push([module.i,".pw-inbox-trigger {\n position: relative;\n cursor: pointer;\n}\n\n.pw-inbox-trigger:after {\n content: attr(data-pw-count);\n display: block;\n position: absolute;\n right: 0;\n top: 0;\n background: var(--badgeBgColor);\n -webkit-border-radius: 8px;\n border-radius: 8px;\n color: var(--badgeTextColor);\n font-size: 10px;\n font-weight: normal;\n line-height: 16px;\n width: 16px;\n padding: 0 2px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n text-align: center;\n}\n\n.pw-inbox-trigger.pw-empty:after {\n display: none;\n}\n\n.pw-inbox-widget * {\n position: static;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: 1em;\n outline: none;\n font-family: var(--fontFamily);\n}\n.pw-inbox-widget {\n font-size: 14px;\n position: absolute;\n top: 0;\n left: -1000px;\n background: var(--bgColor);\n border: solid 1px var(--borderColor);\n -webkit-border-radius: var(--borderRadius);\n border-radius: var(--borderRadius);\n width: var(--widgetWidth);\n -webkit-box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n z-index: var(--zIndex);\n opacity: 0;\n -webkit-transition: opacity .6s ease;\n -o-transition: opacity .6s ease;\n transition: opacity .6s ease;\n -webkit-transition-delay: 100ms;\n -o-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.pw-inbox-widget.pw-open {\n opacity: 1;\n -webkit-transition-delay: 0ms;\n -o-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.pw-inbox-widget.pw-inbox-widget--inset {\n top: auto;\n left: auto;\n display: none;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-open {\n display: block;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-bottom {\n top: 100%;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-top {\n bottom: 100%;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-right {\n left: 100%;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-left {\n right: 100%;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--empty {\n max-height: none;\n}\n.pw-inbox-widget .pw-inbox__arrow {\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget .pw-inbox__arrow:before {\n content: \"\";\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget.pw-top {\n margin-top: -12px;\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow {\n border-top-color: var(--arrowBorderColor);\n bottom: -21px;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow:before {\n border-top-color: var(--bgColor);\n top: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-bottom {\n margin-top: 12px;\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow {\n border-bottom-color: var(--arrowBorderColor);\n top: -21px;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow:before {\n border-bottom-color: var(--bgColor);\n bottom: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-left {\n margin-left: -12px;\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow {\n border-left-color: var(--arrowBorderColor);\n right: -21px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow:before {\n border-left-color: var(--bgColor);\n left: -11px;\n top: -10px;\n}\n.pw-inbox-widget.pw-right {\n margin-left: 12px;\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow {\n border-right-color: var(--arrowBorderColor);\n left: -21px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow:before {\n border-right-color: var(--bgColor);\n right: -11px;\n top: -10px;\n}\n.pw-inbox_inner {\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n height: 100%;\n}\n.pw-inbox_title {\n color: var(--textColor);\n margin: 0;\n padding: 28px 32px 12px;\n font-size: 24px;\n font-weight: 500;\n line-height: 1.1;\n text-align: left;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 66px;\n flex: 0 0 66px;\n}\n.pw-inbox_list {\n overflow-x: hidden;\n overflow-y: auto;\n min-width: 200px;\n max-height: 300px;\n padding: 0;\n margin: 0;\n list-style: none;\n position: relative;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n\n.pw-inbox_item {\n position: relative;\n padding: 8px 32px;\n margin: 0;\n text-align: left;\n}\n.pw-inbox_item-inner {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n cursor: pointer;\n}\n.pw-inbox_icon {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 40px;\n flex: 0 0 40px;\n}\n.pw-inbox_message-image {\n width: 28px;\n}\n.pw-inbox_content {\n -webkit-box-flex: 0;\n -ms-flex: 0 1 100%;\n flex: 0 1 100%;\n}\n.pw-inbox_item-title {\n color: var(--messageTitleColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-body {\n color: var(--textColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-time {\n color: var(--timeTextColor);\n font-size: 12px;\n line-height: 17px;\n}\n.pw-inbox_item-remove {\n position: absolute;\n z-index: 2;\n top: 8px;\n right: 8px;\n display: none;\n width: 10px;\n height: 10px;\n background: transparent url('https://cdn.pushwoosh.com/webpush/img/iconClose.svg') 50% no-repeat;\n cursor: pointer;\n}\n.pw-inbox_item:hover .pw-inbox_item-remove {\n display: block;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-title {\n color: var(--textColor);\n font-weight: 700;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-body {\n font-weight: 700;\n}\n\n.pw-inbox_list--empty {\n padding: 50px 16px;\n text-align: center;\n max-height: 100%;\n overflow: auto;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-icon {\n text-align: center;\n margin-bottom: 30px;\n}\n.pw-inbox_list--empty .pw-inbox_list-icon img {\n max-width: 100%;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-title {\n font-size: 28px;\n line-height: 36px;\n color: var(--emptyInboxTitleColor);\n margin-bottom: 20px;\n}\n\n.pw-inbox_list--empty .ipw-inbox_list-body {\n font-size: 14px;\n line-height: 18px;\n color: var(--emptyInboxTextColor);\n}\n",""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}}])},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var web_push_subscribe_popup_1=__webpack_require__(47);document.addEventListener("pushwoosh.initialized",function(ev){if(ev.detail.pw.subscribePopupConfig&&ev.detail.pw.subscribePopupConfig.enable){var popup_1=new web_push_subscribe_popup_1.PWSubscribePopup(ev.detail.pw);popup_1.initPopup().then(function(){ev.detail.pw.subscribePopup=popup_1})}})},function(module,exports,__webpack_require__){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=1)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONFIG={text:"Don’t miss out on our news and updates! Enable push notifications",askLaterButtonText:"Not now",confirmSubscriptionButtonText:"Subscribe",delay:60,retryOffset:604800,overlay:!1,position:"top",bgColor:"#fff",borderColor:"transparent",boxShadow:"0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)",textColor:"#000",textSize:"inherit",fontFamily:"inherit",subscribeBtnBgColor:"#4285f4",subscribeBtnTextColor:"#fff",askLaterBtnBgColor:"transparent",askLaterBtnTextColor:"#000",theme:"material",viewport:"html"},exports.COLOR_TEST_REGEXP=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/,exports.PERMISSION_DENIED="denied",exports.PERMISSION_GRANTED="granted",exports.CONFIG_STYLES=[{name:"bgColor",type:"color"},{name:"borderColor",type:"color"},{name:"boxShadow",type:"string"},{name:"textColor",type:"color"},{name:"textSize",type:"string"},{name:"fontFamily",type:"string"},{name:"subscribeBtnBgColor",type:"color"},{name:"subscribeBtnTextColor",type:"color"},{name:"askLaterBtnBgColor",type:"color"},{name:"askLaterBtnTextColor",type:"color"}]},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var SubscribePopup_1=__webpack_require__(2);exports.PWSubscribePopup=SubscribePopup_1.default},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),popupTemplates_1=__webpack_require__(3),constants_2=__webpack_require__(0),helpers_1=__webpack_require__(4),SubscribePopup=function(){function SubscribePopup(pw){this.pw=pw,this.config=__assign({},constants_1.DEFAULT_CONFIG,this.pw.subscribePopupConfig),this.onAskLaterClick=this.onAskLaterClick.bind(this),this.onSubscribeClick=this.onSubscribeClick.bind(this)}return SubscribePopup.prototype.initPopup=function(){return __awaiter(this,void 0,void 0,function(){var isSubscribed,isManualUnsubscribed,permission,lastPopupOpen,lastPopupOpenTime,now,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.pw.isSubscribed()];case 1:return isSubscribed=_a.sent(),[4,this.pw.data.getStatusManualUnsubscribed()];case 2:return isManualUnsubscribed=_a.sent(),isSubscribed||isManualUnsubscribed?[2]:[4,this.pw.driver.getPermission()];case 3:return(permission=_a.sent())===constants_2.PERMISSION_GRANTED||permission===constants_2.PERMISSION_DENIED?[2]:(this.renderPopup(),this.appendStyles(),lastPopupOpen=localStorage.getItem("LAST_OPEN_SUBSCRIPTION_POPUP"),lastPopupOpenTime=lastPopupOpen?parseInt(lastPopupOpen):0,now=(new Date).getTime(),lastPopupOpenTime+1e3*this.config.retryOffset<now&&setTimeout(function(){_this.toggle(!0)},1e3*this.config.delay),[2])}})})},SubscribePopup.prototype.toggle=function(isShown){("boolean"==typeof isShown?isShown:!this.isShown)?(this.showPopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-show",{})):(this.closePopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-hide",{}))},SubscribePopup.prototype.showPopup=function(){this.isShown=!0,this.popup.classList.add("pw-show"),document.body.classList.add("pw-popup-opened");var event=new CustomEvent("showPopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});if(this.popup.dispatchEvent(event),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var _a=this.config,theme=_a.theme,viewport=_a.viewport,position=_a.position;if("topbar"===theme&&"top"===position){var viewportElement=document.querySelector(viewport)||document.createElement("div"),currentMarginTop=window.getComputedStyle(viewportElement).marginTop||"0";viewportElement.style.transition="margin-top .3s ease-out",viewportElement.style.marginTop=parseInt(currentMarginTop)+this.popup.getBoundingClientRect().height+"px"}}},SubscribePopup.prototype.closePopup=function(){this.isShown=!1,this.popup.classList.remove("pw-show"),document.body.classList.remove("pw-popup-opened");var event=new CustomEvent("hidePopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});this.popup.dispatchEvent(event);var now=(new Date).getTime().toString();if(localStorage.setItem("LAST_OPEN_SUBSCRIPTION_POPUP",now),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var _a=this.config,theme=_a.theme,viewport=_a.viewport,position=_a.position;if("topbar"===theme&&"top"===position){var viewportElement=document.querySelector(viewport)||document.createElement("div"),currentMarginTop=window.getComputedStyle(viewportElement).marginTop||"0";viewportElement.style.marginTop=parseInt(currentMarginTop)-this.popup.getBoundingClientRect().height+"px"}}},SubscribePopup.prototype.renderPopup=function(){this.popup=document.createElement("div"),this.popup.id="pwSubscribePopup";var _a=this.config,text=_a.text,askLaterButtonText=_a.askLaterButtonText,confirmSubscriptionButtonText=_a.confirmSubscriptionButtonText,iconUrl=_a.iconUrl,position=_a.position,overlay=_a.overlay,theme=_a.theme;this.popup.className="pw-subscribe-popup pw-position-"+position+" pw-subscribe-popup-"+theme,this.popup.classList.toggle("pw-subscribe-popup__overlay",overlay),this.popup.innerHTML=popupTemplates_1.innerTemplate({text:text,askLaterButtonText:askLaterButtonText,confirmSubscriptionButtonText:confirmSubscriptionButtonText,iconUrl:iconUrl}),document.body.appendChild(this.popup),this.addListeners()},SubscribePopup.prototype.appendStyles=function(){var styles=__webpack_require__(5),style=document.createElement("style");style.innerHTML=this.configureStyle(styles),document.body.appendChild(style)},SubscribePopup.prototype.getStyleFormatter=function(style){switch(style.type){case"size":return(this.config[style.name]||0)+"px";case"number":return parseFloat(this.config[style.name].toString()).toString();case"string":return this.config[style.name].toString();case"color":return helpers_1.getValidColor(this.config[style.name].toString());default:return"none"}},SubscribePopup.prototype.configureStyle=function(styles){var _this=this,resultStyles=styles.toString();return constants_1.CONFIG_STYLES.forEach(function(style){var template=new RegExp("var\\(--"+style.name+"\\)","ig"),result=_this.getStyleFormatter(style);resultStyles=resultStyles.replace(template,result)}),resultStyles},SubscribePopup.prototype.addListeners=function(){var askLaterButton=this.popup.querySelector('button[name="pwAskLater"]')||document.createElement("button"),subscribeButton=this.popup.querySelector('button[name="pwSubscribe"]')||document.createElement("button");askLaterButton.addEventListener("click",this.onAskLaterClick),subscribeButton.addEventListener("click",this.onSubscribeClick)},SubscribePopup.prototype.onAskLaterClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-decline",{})},SubscribePopup.prototype.onSubscribeClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-accept",{}),this.pw.subscribe()},SubscribePopup}();exports.default=SubscribePopup},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerTemplate=function(_a){var iconUrl=_a.iconUrl,text=_a.text,askLaterButtonText=_a.askLaterButtonText,confirmSubscriptionButtonText=_a.confirmSubscriptionButtonText;return'<div class="pw-subscription-popup-inner">\n <div class="pw-subscription-popup-content">\n '+(iconUrl?'<div class="pw-subscription-popup-icon">\n <img src="'+iconUrl+'">\n </div>':"")+'\n <div class="pw-subscription-popup-text">\n '+text+'\n </div>\n </div>\n <div class="pw-subscription-popup-controls">\n <button name="pwSubscribe" class="pw-subscribe-popup-button pw-subscribe-popup-button-active">'+confirmSubscriptionButtonText+'</button>\n <button name="pwAskLater" class="pw-subscribe-popup-button">'+askLaterButtonText+"</button>\n </div>\n </div>"}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0);exports.getValidColor=function(color){return"transparent"===color?color:constants_1.COLOR_TEST_REGEXP.test(color)?color:"#333"},exports.getGlobal=function(){return Function("return this")()}},function(module,exports,__webpack_require__){var result=__webpack_require__(6);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(7)(void 0)).push([module.i,".pw-subscribe-popup {\n position: fixed;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n z-index: 1000000;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-transition: all .4s ease-out;\n -o-transition: all .4s ease-out;\n transition: all .4s ease-out;\n}\n\n.pw-subscribe-popup.pw-position-top {\n top: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-top.pw-show {\n top: 0;\n}\n\n.pw-subscribe-popup.pw-position-bottom {\n bottom: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-bottom.pw-show {\n bottom: 0;\n}\n\n.pw-subscribe-popup.pw-position-center {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n -webkit-transform: none;\n\n -ms-transform: none;\n\n transform: none;\n}\n\n.pw-subscribe-popup__overlay {\n background: rgba(0,0,0,.4);\n z-index: 1000000;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-subscribe-popup__overlay) {\n pointer-events: none;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-show) {\n display: none;\n}\n\n\n.pw-subscribe-popup__overlay.pw-position-top {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n.pw-subscribe-popup__overlay.pw-position-bottom {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n\n.pw-subscribe-popup__overlay.pw-position-center {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.pw-subscription-popup-inner {\n max-width: 400px;\n font-size: var(--textSize);\n color: var(--textColor);\n font-family: var(--fontFamily);\n border-style: solid;\n border-width: 1px;\n border-color: var(--borderColor);\n background: var(--bgColor);\n -webkit-box-shadow: var(--boxShadow);\n box-shadow: var(--boxShadow);\n pointer-events: auto;\n}\n\n.pw-subscription-popup-content {\n padding: 16px 16px 4px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: stretch;\n -ms-flex-pack: stretch;\n justify-content: stretch;\n}\n\n.pw-subscription-popup-icon {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 50px;\n flex: 0 0 50px;\n margin-right: 12px;\n padding-top: 4px;\n}\n\n.pw-subscription-popup-icon img {\n max-width: 60px;\n max-height: 60px;\n}\n\n.pw-subscription-popup-text {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 300px;\n flex: 1 1 300px;\n}\n\n.pw-subscription-popup-controls {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n padding: 8px 16px 16px;\n}\n\nbutton.pw-subscribe-popup-button {\n border: solid 1px transparent;\n -webkit-border-radius: 2px;\n border-radius: 2px;\n display: inline-block;\n height: 36px;\n line-height: 36px;\n padding: 0 16px;\n text-transform: uppercase;\n vertical-align: middle;\n -webkit-tap-highlight-color: transparent;\n font-size: 14px;\n outline: 0;\n text-decoration: none;\n color: var(--askLaterBtnTextColor);\n text-align: center;\n letter-spacing: .5px;\n cursor: pointer;\n background: var(--askLaterBtnBgColor);\n margin: 4px 8px;\n}\nbutton.pw-subscribe-popup-button:hover {\n background: rgba(0,0,0,.04);\n}\nbutton.pw-subscribe-popup-button:active {\n background: rgba(0,0,0,.12);\n}\n\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active {\n color: var(--subscribeBtnTextColor);\n background: var(--subscribeBtnBgColor);\n -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:hover {\n -webkit-box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:active {\n -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n}\n\n@media screen and (min-width: 541px) {\n\n .pw-subscribe-popup-topbar {\n width: 100%;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n padding: 2px 40px;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-content {\n padding: 0;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 60%;\n flex: 1 1 60%;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-icon img {\n max-width: 28px;\n max-height: 28px;\n }\n\n .pw-subscribe-popup-topbar button.pw-subscribe-popup-button {\n height: 32px;\n line-height: 32px;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-controls {\n padding: 0 0 0 16px;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n}\n@media screen and (max-width: 540px) {\n .pw-subscribe-popup,\n .pw-subscribe-popup.pw-position-top,\n .pw-subscribe-popup.pw-position-center,\n .pw-subscribe-popup.pw-position-bottom {\n top: auto;\n bottom: -110%;\n left: 0;\n right: 0;\n -webkit-transform: none;\n -ms-transform: none;\n transform: none;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-transition: bottom .4s ease-out;\n -o-transition: bottom .4s ease-out;\n transition: bottom .4s ease-out;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-subscribe-popup__overlay {\n height: 100%;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-show {\n bottom: 0;\n }\n\n .pw-subscribe-popup__overlay .pw-subscription-popup-inner {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n -webkit-box-pack: stretch;\n -ms-flex-pack: stretch;\n justify-content: stretch;\n }\n\n .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n }\n}\n",""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}}])}])});
1
+ !function(root,factory){if("object"==typeof exports&&"object"==typeof module)module.exports=factory();else if("function"==typeof define&&define.amd)define([],factory);else{var a=factory();for(var i in a)("object"==typeof exports?exports:root)[i]=a[i]}}(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=31)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG=exports.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT=exports.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET=exports.PAGE_VISITED_URL=exports.MANUAL_UNSUBSCRIBE=exports.EVENT_PW_SITE_OPENED=exports.EVENT_GDPR_DELETE=exports.EVENT_GDPR_CONSENT=exports.EVENT_CLICK_SUBSCRIBE_BUTTON=exports.EVENT_SHOW_SUBSCRIBE_BUTTON=exports.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET=exports.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET=exports.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG=exports.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG=exports.EVENT_ON_UPDATE_INBOX_MESSAGES=exports.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE=exports.EVENT_ON_CHANGE_COMMUNICATION_ENABLED=exports.EVENT_ON_NOTIFICATION_CLOSE=exports.EVENT_ON_NOTIFICATION_CLICK=exports.EVENT_ON_PUSH_DELIVERY=exports.EVENT_ON_SW_INIT_ERROR=exports.EVENT_ON_PERMISSION_GRANTED=exports.EVENT_ON_PERMISSION_DENIED=exports.EVENT_ON_PERMISSION_PROMPT=exports.EVENT_ON_REGISTER=exports.EVENT_ON_UNSUBSCRIBE=exports.EVENT_ON_SUBSCRIBE=exports.EVENT_ON_READY=exports.EVENT_ON_LOAD=exports.PERMISSION_PROMPT=exports.PERMISSION_GRANTED=exports.PERMISSION_DENIED=exports.DEVICE_REGISTRATION_STATUS_UNREGISTERED=exports.DEVICE_REGISTRATION_STATUS_REGISTERED=exports.MANUAL_SET_LOGGER_LEVEL=exports.KEY_SAFARI_PREVIOUS_PERMISSION=exports.KEY_DEVICE_REGISTRATION_STATUS=exports.KEY_CLICK_SUBSCRIBE_WIDGET=exports.KEY_SHOW_SUBSCRIBE_WIDGET=exports.DEFAULT_NOTIFICATION_IMAGE=exports.DEFAULT_NOTIFICATION_TITLE=exports.WAKE_UP_SERVICE_WORKER_INTERVAL=exports.MAX_NOTIFICATION_DURATION=exports.MIN_NOTIFICATION_DURATION=exports.DEFAULT_NOTIFICATION_DURATION=exports.PERIOD_GOAL_EVENT=exports.PERIOD_SEND_APP_OPEN=exports.FACEBOOK_HWID_KEY=exports.FACEBOOK_APP_ID=exports.DEFAULT_API_URL=exports.DEFAULT_SERVICE_WORKER_URL=void 0,exports.DEFAULT_SERVICE_WORKER_URL="/pushwoosh-service-worker.js",exports.DEFAULT_API_URL="https://cp.pushwoosh.com/json/1.3/",exports.FACEBOOK_APP_ID="436711767081797",exports.FACEBOOK_HWID_KEY="FACEBOOK_HWID_KEY",exports.PERIOD_SEND_APP_OPEN=36e5,exports.PERIOD_GOAL_EVENT=864e5,exports.DEFAULT_NOTIFICATION_DURATION=10,exports.MIN_NOTIFICATION_DURATION=10,exports.MAX_NOTIFICATION_DURATION=55,exports.WAKE_UP_SERVICE_WORKER_INTERVAL=20,exports.DEFAULT_NOTIFICATION_TITLE="Pushwoosh notification",exports.DEFAULT_NOTIFICATION_IMAGE="https://cp.pushwoosh.com/img/logo-medium.png",exports.KEY_SHOW_SUBSCRIBE_WIDGET="WIDGET_SHOWED",exports.KEY_CLICK_SUBSCRIBE_WIDGET="WIDGET_CLICKED",exports.KEY_DEVICE_REGISTRATION_STATUS="deviceRegistrationStatus",exports.KEY_SAFARI_PREVIOUS_PERMISSION="safariPreviousPermission",exports.MANUAL_SET_LOGGER_LEVEL="PW_SET_LOGGER_LEVEL",exports.DEVICE_REGISTRATION_STATUS_REGISTERED="registered",exports.DEVICE_REGISTRATION_STATUS_UNREGISTERED="unregistered",exports.PERMISSION_DENIED="denied",exports.PERMISSION_GRANTED="granted",exports.PERMISSION_PROMPT="default",exports.EVENT_ON_LOAD="onLoad",exports.EVENT_ON_READY="onReady",exports.EVENT_ON_SUBSCRIBE="onSubscribe",exports.EVENT_ON_UNSUBSCRIBE="onUnsubscribe",exports.EVENT_ON_REGISTER="onRegister",exports.EVENT_ON_PERMISSION_PROMPT="onPermissionPrompt",exports.EVENT_ON_PERMISSION_DENIED="onPermissionDenied",exports.EVENT_ON_PERMISSION_GRANTED="onPermissionGranted",exports.EVENT_ON_SW_INIT_ERROR="onSWInitError",exports.EVENT_ON_PUSH_DELIVERY="onPushDelivery",exports.EVENT_ON_NOTIFICATION_CLICK="onNotificationClick",exports.EVENT_ON_NOTIFICATION_CLOSE="onNotificationClose",exports.EVENT_ON_CHANGE_COMMUNICATION_ENABLED="onChangeCommunicationEnabled",exports.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE="onPutNewMessageToInboxStore",exports.EVENT_ON_UPDATE_INBOX_MESSAGES="onUpdateInboxMessages",exports.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG="onShowNotificationPermissionDialog",exports.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG="onHideNotificationPermissionDialog",exports.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET="onShowSubscriptionWidget",exports.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET="onHideSubscriptionWidget",exports.EVENT_SHOW_SUBSCRIBE_BUTTON="showSubscribeButton",exports.EVENT_CLICK_SUBSCRIBE_BUTTON="clickSubscribeButton",exports.EVENT_GDPR_CONSENT="GDPRConsent",exports.EVENT_GDPR_DELETE="GDPRDelete",exports.EVENT_PW_SITE_OPENED="PW_SiteOpened",exports.MANUAL_UNSUBSCRIBE="MANUAL_UNSUBSCRIBE",exports.PAGE_VISITED_URL="PAGE_VISITED_URL",exports.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET="not-set",exports.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT="default",exports.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG={headerText:"Subscribe to our news",headerTextColor:"#000000",subheaderText:"Don't miss out on the latest news and updates!",subheaderTextColor:"#000000",buttonAcceptText:"Agree",buttonAcceptTextColor:"#1A72E8",buttonAcceptRound:"4px",buttonAcceptBackgroundColor:"#FFFFFF",buttonAcceptBorderColor:"#E3E4E8",buttonCancelText:"Deny",buttonCancelTextColor:"#1A72E8",buttonCancelRound:"4px",buttonCancelBackgroundColor:"#FFFFFF",buttonCancelBorderColor:"#E3E4E8",cappingCount:3,cappingDelay:144e5,backgroundColor:"#FFFFFF"}},function(module,exports,__webpack_require__){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__rest=this&&this.__rest||function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.message=exports.log=exports.keyValue=exports.LogMessage=exports.LogLog=exports.LogBase=exports.getInstance=void 0;var databasePromise,version_1=__webpack_require__(10),MigrationExecutor_1=__webpack_require__(11),constants_1=__webpack_require__(6);function onversionchange(database,event){console.info("onversionchange",event),database.close()}function getInstance(){return databasePromise||(databasePromise=new Promise(function(resolve,reject){var request=indexedDB.open("PUSHWOOSH_SDK_STORE",version_1.default);request.onsuccess=function(event){var database=event.target.result;database.onversionchange=onversionchange.bind(null,database,reject),resolve(database)},request.onerror=function(){return reject(request.error)},request.onupgradeneeded=function(event){var database=event.target.result;database.onversionchange=onversionchange.bind(null,database,reject),new MigrationExecutor_1.default(database).applyMigrations()}})),databasePromise}function getInstanceWithPromise(executor){return getInstance().then(function(database){return new Promise(function(resolve,reject){return executor(database,resolve,reject)})})}exports.getInstance=getInstance;var LogBase=function(){function LogBase(){}return LogBase.prototype._add=function(obj){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var request=database.transaction([_this.name],"readwrite").objectStore(_this.name).add(obj);request.onsuccess=function(){resolve(obj)},request.onerror=function(){reject(request.error)}}).then(function(obj){return _this.getAll().then(function(items){if(Array.isArray(items)){var ids=items.map(function(i){return i.id}).sort(function(a,b){return a==b?0:a<b?1:-1});if(ids.length>_this.maxItems)return Promise.all(ids.slice(_this.maxItems).map(function(id){return _this.delete(id)})).then(function(){return obj})}return obj})})},LogBase.prototype.delete=function(key){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var request=database.transaction([_this.name],"readwrite").objectStore(_this.name).delete(key);request.onsuccess=function(){resolve(request.result)},request.onerror=function(){reject(request.error)}})},LogBase.prototype.getAll=function(){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var result=[],cursor=database.transaction(_this.name).objectStore(_this.name).openCursor();cursor.onsuccess=function(ev){var cursorResult=ev.target.result;cursorResult?(cursorResult.value&&result.push(cursorResult.value),cursorResult.continue()):resolve(result)},cursor.onerror=function(){reject(cursor.error)}})},LogBase}();exports.LogBase=LogBase;var LogLog=function(_super){function LogLog(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.name=constants_1.STORE_NAME_MAIN_LOG,_this.maxItems=100,_this.environment="undefined"!=typeof self&&self.registration?"worker":"browser",_this}return __extends(LogLog,_super),LogLog.prototype.add=function(type,message,additional){var obj={type:type,environment:this.environment,message:""+message,date:new Date};return message instanceof Error&&(obj.stack=message.stack),additional&&(obj.additional=additional),this._add(obj)},LogLog}(LogBase);exports.LogLog=LogLog;var LogMessage=function(_super){function LogMessage(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.name=constants_1.STORE_NAME_MESSAGE_LOG,_this.maxItems=25,_this}return __extends(LogMessage,_super),LogMessage.prototype.add=function(log){return this._add(__assign(__assign({},log),{date:new Date}))},LogMessage}(LogBase);exports.LogMessage=LogMessage,exports.keyValue=function(name){return{get:function(key,defaultValue){return getInstanceWithPromise(function(database,resolve,reject){var timeout,request=database.transaction(name).objectStore(name).get(key),isComplete=!1,isError=!1,check=function(){if(clearTimeout(timeout),isComplete){var result=request.result;resolve(result&&result.value||defaultValue)}else isError?reject(request.error):timeout=setTimeout(check,0)};request.onsuccess=function(){return isComplete=!0},request.onerror=function(){return isError=!0},check()})},getAll:function(){return getInstanceWithPromise(function(database,resolve,reject){var timeout,result={},cursor=database.transaction(name).objectStore(name).openCursor(),isComplete=!1,isError=!1,check=function(){clearTimeout(timeout),isComplete?resolve(result):isError?reject(cursor.error):timeout=setTimeout(check,0)};cursor.onsuccess=function(event){var cursorResult=event.target.result;cursorResult?(result[cursorResult.key]=cursorResult.value.value,cursorResult.continue()):isComplete=!0},cursor.onerror=function(){return isError=!0},check()})},extend:function(key,value){return __awaiter(this,void 0,void 0,function(){var oldValues,newValues;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.get(key)];case 1:return oldValues=_a.sent(),newValues=__rest(value,[]),[4,this.set(key,__assign(__assign({},oldValues),newValues))];case 2:return _a.sent(),[2]}})})},set:function(key,value){return getInstanceWithPromise(function(database,resolve,reject){var timeout,request=database.transaction([name],"readwrite").objectStore(name).put({key:key,value:value}),isComplete=!1,isError=!1,check=function(){clearTimeout(timeout),isComplete?resolve(key):isError?reject(request.error):timeout=setTimeout(check,0)};request.onsuccess=function(){return isComplete=!0},request.onerror=function(){return isError=!0},check()})}}}(constants_1.STORE_NAME_KEY_VALUE),exports.log=new LogLog,exports.message=new LogMessage},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Data=void 0;var storage_1=__webpack_require__(1),CONSTANTS=__webpack_require__(0),Data=function(){function Data(store){void 0===store&&(store=storage_1.keyValue),this.store=store}return Data.prototype.clearAll=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationCode",void 0)];case 1:return _a.sent(),[4,this.store.set("params.hwid",void 0)];case 2:return _a.sent(),[4,this.store.set("params.deviceType",void 0)];case 3:return _a.sent(),[4,this.store.set("params.deviceModel",void 0)];case 4:return _a.sent(),[4,this.store.set("params.language",void 0)];case 5:return _a.sent(),[4,this.store.set("params.apiEntrypoint",void 0)];case 6:return _a.sent(),[4,this.store.set("params.tokens",void 0)];case 7:return _a.sent(),[4,this.store.set("params.applicationServerKey",void 0)];case 8:return _a.sent(),[4,this.store.set("params.senderId",void 0)];case 9:return _a.sent(),[4,this.store.set("params.webSitePushId",void 0)];case 10:return _a.sent(),[4,this.store.set("params.defaultNotificationImage",void 0)];case 11:return _a.sent(),[4,this.store.set("params.defaultNotificationTitle",void 0)];case 12:return _a.sent(),[4,this.store.set("params.userId",void 0)];case 13:return _a.sent(),[4,this.store.set("params.userIdWasChanged",void 0)];case 14:return _a.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 15:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 16:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 17:return _a.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 18:return _a.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 19:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 20:return _a.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 21:return _a.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 22:return _a.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 23:return _a.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 24:return _a.sent(),[4,this.store.set("params.features",void 0)];case 25:return _a.sent(),[4,this.store.set("params.init",void 0)];case 26:return _a.sent(),[4,this.store.set("API_PARAMS",void 0)];case 27:return _a.sent(),[4,this.store.set("SENDER_ID",void 0)];case 28:return _a.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 29:return _a.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 30:return _a.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 31:return _a.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 32:return _a.sent(),[2]}})})},Data.prototype.setApplicationCode=function(application){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationCode",application)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApplicationCode=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.applicationCode")];case 1:return[2,_a.sent()]}})})},Data.prototype.setHwid=function(hwid){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.hwid",hwid)];case 1:return _a.sent(),[2]}})})},Data.prototype.getHwid=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.hwid")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDeviceType=function(type){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.deviceType",type)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDeviceType=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.deviceType")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDeviceModel=function(model){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.deviceModel",model)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDeviceModel=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.deviceModel")];case 1:return[2,_a.sent()]}})})},Data.prototype.setLanguage=function(language){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.language",language)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLanguage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.language","en")];case 1:return[2,_a.sent()]}})})},Data.prototype.setApiEntrypoint=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.apiEntrypoint",url)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApiEntrypoint=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.apiEntrypoint",CONSTANTS.DEFAULT_API_URL)];case 1:return[2,_a.sent()]}})})},Data.prototype.setTokens=function(tokens){return __awaiter(this,void 0,void 0,function(){var hwid;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getHwid()];case 1:return hwid=_a.sent(),[4,this.store.set("API_PARAMS",__assign({hwid:hwid},tokens))];case 2:return _a.sent(),[4,this.store.set("params.tokens",tokens)];case 3:return _a.sent(),[2]}})})},Data.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("API_PARAMS")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.tokens")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setApplicationServerKey=function(key){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationServerKey",key)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApplicationServerKey=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.applicationServerKey")];case 1:return[2,_a.sent()]}})})},Data.prototype.setSenderId=function(senderId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("GCM_SENDER_ID",senderId)];case 1:return _a.sent(),[4,this.store.set("params.senderId",senderId)];case 2:return _a.sent(),[2]}})})},Data.prototype.getSenderId=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("GCM_SENDER_ID")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.senderId")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setWebSitePushId=function(senderId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.webSitePushId",senderId)];case 1:return _a.sent(),[2]}})})},Data.prototype.getWebSitePushId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.webSitePushId")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDefaultNotificationImage=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.defaultNotificationImage",url)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDefaultNotificationImage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.defaultNotificationImage",CONSTANTS.DEFAULT_NOTIFICATION_IMAGE)];case 1:return[2,_a.sent()]}})})},Data.prototype.setDefaultNotificationTitle=function(text){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.defaultNotificationTitle",text)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDefaultNotificationTitle=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.defaultNotificationTitle",CONSTANTS.DEFAULT_NOTIFICATION_TITLE)];case 1:return[2,_a.sent()]}})})},Data.prototype.setUserId=function(userId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return userId?[3,2]:[4,this.store.set("params.userId",void 0)];case 1:return _a.sent(),[2];case 2:return[4,this.store.set("params.userId",userId.toString())];case 3:return _a.sent(),[2]}})})},Data.prototype.getUserId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.userId")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusUserIdWasChanged=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.userIdWasChanged",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getStatusUserIdWasChanged=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.userIdWasChanged",!1)];case 1:return[2,_a.sent()]}})})},Data.prototype.setLastPermissionStatus=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.isLastPermissionStatus",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLastPermissionStatus=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.isLastPermissionStatus")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusManualUnsubscribed=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("MANUAL_UNSUBSCRIBE",status)];case 1:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("MANUAL_UNSUBSCRIBE",!1)];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isManualUnsubscribed",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setStatusCommunicationDisabled=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("COMMUNICATION_ENABLED",status?0:1)];case 1:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusCommunicationDisabled=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("COMMUNICATION_ENABLED")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isCommunicationDisabled",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:0==oldValue]}})})},Data.prototype.setStatusDropAllData=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("DEVICE_DATA_REMOVED",status)];case 1:return _a.sent(),[4,this.store.set("params.isDropAllData",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusDropAllData=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("DEVICE_DATA_REMOVED",!1)];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isDropAllData",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setSdkVersion=function(version){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.sdkVersion",version)];case 1:return _a.sent(),[2]}})})},Data.prototype.getSdkVersion=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.sdkVersion")];case 1:return[2,_a.sent()]}})})},Data.prototype.setServiceWorkerVersion=function(version){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("WORKER_VERSION",version)];case 1:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",version)];case 2:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerVersion=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("WORKER_VERSION")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.serviceWorkerVersion")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setServiceWorkerUrl=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return url?[4,this.store.set("params.serviceWorkerUrl",url)]:[2];case 1:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerUrl=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.serviceWorkerUrl",CONSTANTS.DEFAULT_SERVICE_WORKER_URL)];case 1:return[2,_a.sent()]}})})},Data.prototype.setServiceWorkerScope=function(scope){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return scope?[4,this.store.set("params.serviceWorkerScope",scope)]:[2];case 1:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerScope=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.serviceWorkerScope")];case 1:return[2,_a.sent()]}})})},Data.prototype.setLastOpenMessage=function(message){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("LAST_OPEN_MESSAGE",message)];case 1:return _a.sent(),[4,this.store.set("params.lastOpenMessage",message)];case 2:return _a.sent(),[2]}})})},Data.prototype.getLastOpenMessage=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("LAST_OPEN_MESSAGE")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.lastOpenMessage")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setLastOpenApplicationTime=function(time){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.lastOpenApplicationTime",time)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLastOpenApplicationTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.lastOpenApplicationTime")];case 1:return[2,_a.sent()]}})})},Data.prototype.setFeatures=function(features){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.features",features)];case 1:return _a.sent(),[2]}})})},Data.prototype.getFeatures=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.features")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInitParams=function(params){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.init",params)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInitParams=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.init")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInboxLastRequestCode=function(lastCode){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.lastRequestCode",lastCode)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxLastRequestCode=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.inbox.lastRequestCode","")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInboxLastRequestTime=function(lastRequestTime){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.lastRequestTime",lastRequestTime)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxLastRequestTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.inbox.lastRequestTime",0)]})})},Data.prototype.setInboxNewMessagesCount=function(count){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.newMessagesCount",count)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxNewMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.inbox.newMessagesCount",0)]})})},Data.prototype.setDelayedEvent=function(event){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("DELAYED_EVENT",event)];case 1:return _a.sent(),[4,this.store.set("params.delayedEvent",event)];case 2:return _a.sent(),[2]}})})},Data.prototype.getDelayedEvent=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("DELAYED_EVENT")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.delayedEvent")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setPromptDisplayCount=function(count){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.promptDisplayCount",count)];case 1:return _a.sent(),[2]}})})},Data.prototype.getPromptDisplayCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.promptDisplayCount",0)]})})},Data.prototype.setPromptLastSeenTime=function(time){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.promptLastSeenTime",time)];case 1:return _a.sent(),[2]}})})},Data.prototype.getPromptLastSeenTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.promptLastSeenTime",0)]})})},Data}();exports.Data=Data},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DateModule=function(){function DateModule(date){void 0===date&&(date=new Date),this._date=date}return Object.defineProperty(DateModule.prototype,"date",{get:function(){return this._date},set:function(date){this._date=date},enumerable:!1,configurable:!0}),DateModule.prototype.getUtcTimestamp=function(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)},DateModule.prototype.getTimestamp=function(){return Math.round(this.date.getTime()/1e3)},DateModule.prototype.setLocal=function(){var newDateTimestamp=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(newDateTimestamp)},DateModule.prototype.addDays=function(days){var newDateTimestamp=this._date.getTime()+24*days*60*60*1e3;this._date=new Date(newDateTimestamp)},DateModule.prototype.getInboxFakeOrder=function(){return(100*this._date.getTime()+9e9).toString()},DateModule}();exports.default=DateModule},function(module,exports,__webpack_require__){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Logger=exports.logAndRejectError=exports.logAndThrowError=void 0;var storage_1=__webpack_require__(1),levels={error:1,info:2,debug:3},limitLevel=3;__webpack_require__(5).patchConsole();var Logger={setLevel:function(level){levels[level]||(level="error"),limitLevel=levels[level]},write:function(type,message,additional){return"error"===type?this.error(message):this.info(message),storage_1.log.add(type,message,additional)}};exports.Logger=Logger,Object.keys(levels).forEach(function(levelName){var levelNumber=levels[levelName];Logger[levelName]=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];levelNumber<=limitLevel&&(console.groupCollapsed(levelName),console.info.apply(console,__spreadArrays([""],args)),console.trace("trace"),console.groupEnd())}}),exports.logAndThrowError=function(error){var logText=new Error(error);throw Logger.write("error",logText,"logAndThrowError"),logText},exports.logAndRejectError=function(error,reject){var logText=new Error(error);Logger.write("error",logText,"logAndRejectError"),reject(logText)}},function(module,exports,__webpack_require__){"use strict";function getGlobal(){return globalThis}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateUUID=exports.clearLocationHash=exports.patchConsole=exports.parseSerializedNotificationParams=exports.getVersion=exports.getGlobal=void 0,exports.getGlobal=getGlobal,exports.getVersion=function(){return"3.31.1"},exports.parseSerializedNotificationParams=function(param,defaultValue){if("string"==typeof param)try{return JSON.parse(param)}catch(e){console.log(e)}return void 0===param&&void 0!==defaultValue?defaultValue:param},exports.patchConsole=function(){for(var method,noop=function(){},methods=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],len=methods.length,global=getGlobal(),console=global.console=global.console||{};len--;)console[method=methods[len]]||(console[method]=noop)},exports.clearLocationHash=function(){"history"in getGlobal()&&history.pushState?history.pushState(null,"","#"):location.hash="#"},exports.generateUUID=function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KEY_PATH_BASE_INCREMENT=exports.STORE_NAME_INBOX_MESSAGES=exports.STORE_NAME_MAIN_LOG=exports.STORE_NAME_MESSAGE_LOG=exports.STORE_NAME_KEY_VALUE=void 0,exports.STORE_NAME_KEY_VALUE="keyValue",exports.STORE_NAME_MESSAGE_LOG="messages",exports.STORE_NAME_MAIN_LOG="log",exports.STORE_NAME_INBOX_MESSAGES="inboxMessages",exports.KEY_PATH_BASE_INCREMENT="id"},function(module,exports,__webpack_require__){var v1=__webpack_require__(15),v4=__webpack_require__(16),uuid=v4;uuid.v1=v1,uuid.v4=v4,module.exports=uuid},function(module,exports){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}},function(module,exports){for(var byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);module.exports=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=7},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Migrations_1=__webpack_require__(20),MigrationExecutor=function(){function MigrationExecutor(db,migrationsBuilder){void 0===migrationsBuilder&&(migrationsBuilder=new Migrations_1.default),this.db=db,this.migrationsBuilder=migrationsBuilder}return MigrationExecutor.prototype.applyMigrations=function(){var _this=this;this.applyMigrationsPack(this.migrationsBuilder.initial),this.migrationsBuilder.dateSorted.forEach(function(migrationsPack){_this.applyMigrationsPack(migrationsPack)})},MigrationExecutor.prototype.applyMigrationsPack=function(migrationsPack){var _this=this;migrationsPack.forEach(function(migration){migration(_this.db)})},MigrationExecutor}();exports.default=MigrationExecutor},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.storeCreatorDecorator=void 0,exports.storeCreatorDecorator=function(name,storeCreator){return function(database){database.objectStoreNames.contains(name)||storeCreator(database)}}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:!0});var DateModule_1=__webpack_require__(3),InboxMessages=function(){function InboxMessages(data,api,inboxModel,dateModule){void 0===dateModule&&(dateModule=new DateModule_1.default),this.data=data,this.api=api,this.inboxModel=inboxModel,this.dateModule=dateModule,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}return InboxMessages.prototype.messageTypeFactory=function(actionParams){var messageType=0;return"h"in actionParams||"rm"in actionParams||"r"in actionParams?messageType=1:"l"in actionParams&&null!=actionParams.l&&(messageType=actionParams.l.startsWith("http")?2:3),messageType},InboxMessages.prototype.updateMessagesStatusWithCodes=function(codes,messages,status){return __awaiter(this,void 0,void 0,function(){var updatedMessages,inboxStatusQueries,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return updatedMessages=[],inboxStatusQueries=[],messages.forEach(function(msg){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){return-1===codes.indexOf(msg.inbox_id)?[2]:(msg.status=status,updatedMessages.push(msg),inboxStatusQueries.push(this.api.inboxStatus(msg.order,msg.status)),[2])})})}),[4,this.inboxModel.putBulkMessages(updatedMessages)];case 1:return _a.sent(),[4,Promise.all(inboxStatusQueries)];case 2:return _a.sent(),[2]}})})},InboxMessages.prototype.publicMessageBuilder=function(message){return __awaiter(this,void 0,void 0,function(){var imageUrl,_a,title,_b;return __generator(this,function(_c){switch(_c.label){case 0:return(_a=message.image)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:_a=_c.sent(),_c.label=2;case 2:return imageUrl=_a,(_b=message.title)?[3,4]:[4,this.data.getDefaultNotificationTitle()];case 3:_b=_c.sent(),_c.label=4;case 4:return title=_b,this.dateModule.date=new Date(1e3*parseInt(message.send_date)),this.dateModule.setLocal(),[2,{title:title,imageUrl:imageUrl,code:message.inbox_id,message:message.text,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(JSON.parse(message.action_params)),isRead:2===message.status||3===message.status,isActionPerformed:3===message.status}]}})})},InboxMessages.prototype.messagesWithNoActionPerformedCount=function(){return this.inboxModel.getDeliveredReadMessagesCount()},InboxMessages.prototype.unreadMessagesCount=function(){return this.inboxModel.getDeliveredMessagesCount()},InboxMessages.prototype.messagesCount=function(){return this.inboxModel.messagesCount()},InboxMessages.prototype.loadMessages=function(){return __awaiter(this,void 0,void 0,function(){var readMessages,unreadMessages,buildMessagePromises;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return readMessages=_a.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return unreadMessages=_a.sent(),buildMessagePromises=__spreadArrays(readMessages,unreadMessages).sort(function(msgA,msgB){return parseInt(msgB.send_date,10)-parseInt(msgA.send_date,10)}).sort(function(msgA,msgB){return parseInt(msgB.order||"0",10)-parseInt(msgA.order||"0",10)}).map(this.publicMessageBuilder),[2,Promise.all(buildMessagePromises)]}})})},InboxMessages.prototype.readMessagesWithCodes=function(codes){return __awaiter(this,void 0,void 0,function(){var unreadMessages,statusRead;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getDeliveredMessages()];case 1:return unreadMessages=_a.sent(),statusRead=2,[4,this.updateMessagesStatusWithCodes(codes,unreadMessages,statusRead)];case 2:return _a.sent(),[2]}})})},InboxMessages.prototype.performActionForMessageWithCode=function(code){return __awaiter(this,void 0,void 0,function(){var message,actionParams,messageType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getMessage(code)];case 1:return message=_a.sent(),actionParams=JSON.parse(message.action_params),2===(messageType=this.messageTypeFactory(actionParams))&&null!=actionParams.l?document.location.href=actionParams.l:3===messageType&&null!=actionParams.l&&window.history.go(actionParams.l),message.status=3,[4,this.inboxModel.putMessage(message)];case 2:return _a.sent(),[4,this.api.inboxStatus(message.order,message.status)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.deleteMessagesWithCodes=function(codes){return __awaiter(this,void 0,void 0,function(){var readMessages,unreadMessages,statusDeleted;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return readMessages=_a.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return unreadMessages=_a.sent(),statusDeleted=4,[4,this.updateMessagesStatusWithCodes(codes,__spreadArrays(readMessages,unreadMessages),statusDeleted)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.syncMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.updateMessages()];case 1:return _a.sent(),[2]}})})},InboxMessages}();exports.default=InboxMessages},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiClient=void 0;var Data_1=__webpack_require__(2),logger_1=__webpack_require__(4),ApiClient=function(){function ApiClient(data,logger){void 0===data&&(data=new Data_1.Data),void 0===logger&&(logger=logger_1.Logger),this.data=data,this.logger=logger}return ApiClient.prototype.checkDevice=function(options){return this.createRequest("checkDevice",options)},ApiClient.prototype.getConfig=function(options){return this.createRequest("getConfig",options)},ApiClient.prototype.applicationOpen=function(options){return this.createRequest("applicationOpen",options)},ApiClient.prototype.registerDevice=function(options){return this.createRequest("registerDevice",options)},ApiClient.prototype.unregisterDevice=function(options){return this.createRequest("unregisterDevice",options)},ApiClient.prototype.deleteDevice=function(options){return this.createRequest("deleteDevice",options)},ApiClient.prototype.messageDeliveryEvent=function(options){return this.createRequest("messageDeliveryEvent",options)},ApiClient.prototype.pushStat=function(options){return this.createRequest("pushStat",options)},ApiClient.prototype.setTags=function(options){return this.createRequest("setTags",options)},ApiClient.prototype.getTags=function(options){return this.createRequest("getTags",options)},ApiClient.prototype.registerUser=function(options){return this.createRequest("registerUser",options)},ApiClient.prototype.postEvent=function(options){return this.createRequest("postEvent",options)},ApiClient.prototype.getInboxMessages=function(options){return this.createRequest("getInboxMessages",options)},ApiClient.prototype.inboxStatus=function(options){return this.createRequest("inboxStatus",options)},ApiClient.prototype.pageVisit=function(options,url){return this.createRequest("pageVisit",options,url)},ApiClient.prototype.setPurchase=function(options){return this.createRequest("setPurchase",options)},ApiClient.prototype.createRequest=function(methodName,request,customUrl){return __awaiter(this,void 0,void 0,function(){var entrypoint,response,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return entrypoint=_a.sent(),[4,fetch(customUrl||entrypoint+methodName,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:request})})];case 2:return response=_a.sent(),[4,this.checkResponse(response)];case 3:return(result=_a.sent()).base_url?[4,this.data.setApiEntrypoint(result.base_url)]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[4,this.logger.write("apirequest",methodName+" call with arguments: "+JSON.stringify(request)+" to Pushwoosh has been successful. Result: "+JSON.stringify(result.response))];case 6:return _a.sent(),[2,result.response]}})})},ApiClient.prototype.checkResponse=function(response){return __awaiter(this,void 0,void 0,function(){var data;return __generator(this,function(_a){switch(_a.label){case 0:if(200!==response.status)throw new Error("Error code: "+response.status+". Error text: "+response.statusText);return[4,response.json()];case 1:if(200!==(data=_a.sent()).status_code)throw new Error("Error code: "+data.status_code+". Error text: "+data.status_message);return[2,data]}})})},ApiClient}();exports.ApiClient=ApiClient},function(module,exports,__webpack_require__){var _nodeId,_clockseq,rng=__webpack_require__(8),bytesToUuid=__webpack_require__(9),_lastMSecs=0,_lastNSecs=0;module.exports=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rng();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid(b)}},function(module,exports,__webpack_require__){var rng=__webpack_require__(8),bytesToUuid=__webpack_require__(9);module.exports=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid(rnds)}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EventBus_1=__webpack_require__(18);Object.defineProperty(exports,"EventBus",{enumerable:!0,get:function(){return EventBus_1.EventBus}})},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBus=void 0;var uuid_1=__webpack_require__(7),EventBus=function(){return function(){var _this=this;this.addEventHandler=function(name,handler){var savedEventHandlers=_this.savedEventHandlersMap[name];savedEventHandlers||(savedEventHandlers=[]),savedEventHandlers.push(handler),_this.savedEventHandlersMap[name]=savedEventHandlers},this.removeEventHandler=function(name,handler){var savedEventHandlers=_this.savedEventHandlersMap[name];savedEventHandlers&&(_this.savedEventHandlersMap[name]=savedEventHandlers.filter(function(savedEventHandler){return savedEventHandler!==handler}))},this.dispatchEvent=function(name,payload){var eventId=payload.eventId||uuid_1.v4(),savedEventHandlers=_this.savedEventHandlersMap[name];return savedEventHandlers?(savedEventHandlers.forEach(function(element){"function"==typeof element&&setTimeout(function(){element(__assign(__assign({},payload),{eventId:eventId}))},0)}),eventId):eventId},this.savedEventHandlersMap={}}}();exports.EventBus=EventBus},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Api=void 0;var Data_1=__webpack_require__(2),ApiClient_1=__webpack_require__(14),CONSTANTS=__webpack_require__(0),Api=function(){function Api(eventBus,data,apiClient){void 0===data&&(data=new Data_1.Data),void 0===apiClient&&(apiClient=new ApiClient_1.ApiClient),this.eventBus=eventBus,this.data=data,this.apiClient=apiClient}return Api.prototype.checkDevice=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.checkDevice(params)];case 2:return[2,_a.sent()]}})})},Api.prototype.checkDeviceSubscribeForPushNotifications=function(useCache){return void 0===useCache&&(useCache=!0),__awaiter(this,void 0,void 0,function(){var status,_a,exist,push_token_exist;return __generator(this,function(_b){switch(_b.label){case 0:return void 0!==(status=localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS))&&useCache?[3,2]:[4,this.checkDevice()];case 1:_a=_b.sent(),exist=_a.exist,push_token_exist=_a.push_token_exist,localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,exist&&push_token_exist?CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED:CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),status=localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS),_b.label=2;case 2:return[2,status===CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED]}})})},Api.prototype.getConfig=function(features){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.getConfig(__assign(__assign({},params),{features:features}))]}})})},Api.prototype.applicationOpen=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.setLastOpenApplicationTime(Date.now())];case 2:return _a.sent(),[2,this.apiClient.applicationOpen(params)]}})})},Api.prototype.registerDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,tokens,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:if(_a.sent())throw new Error("Can't register device: Communication is disabled!");return[4,this.getRequestParams()];case 2:return params=_a.sent(),[4,this.data.getTokens()];case 3:if(!(tokens=_a.sent()).pushToken)throw new Error("Can't register device: pushToken is not exist!");return[4,this.apiClient.registerDevice(__assign(__assign({},params),{push_token:tokens.pushToken,auth_token:tokens.authToken,public_key:tokens.publicKey,fcm_push_set:tokens.fcmPushSet,fcm_token:tokens.fcmToken}))];case 4:return response=_a.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 5:return _a.sent(),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED),this.eventBus.dispatchEvent("register",{}),[2,response]}})})},Api.prototype.unregisterDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),response=this.apiClient.unregisterDevice(params),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,response]}})})},Api.prototype.deleteDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),response=this.apiClient.deleteDevice(params),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return _a.sent(),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,response]}})})},Api.prototype.messageDeliveryEvent=function(hash,isTrackingLogOnFailure,metaData){return void 0===metaData&&(metaData={}),__awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.messageDeliveryEvent(__assign(__assign({},params),{hash:hash,metaData:metaData}))];case 2:return[2,_a.sent()]}})})},Api.prototype.pushStat=function(hash,isTrackingLogOnFailure,metaData){return void 0===metaData&&(metaData={}),__awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.pushStat(__assign(__assign({},params),{hash:hash,metaData:metaData}))];case 2:return[2,_a.sent()]}})})},Api.prototype.setTags=function(tags){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setTags(__assign(__assign({},params),{tags:tags}))]}})})},Api.prototype.getTags=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.getTags(params)]}})})},Api.prototype.registerUser=function(userId){return __awaiter(this,void 0,void 0,function(){var params,deviceType,id,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getDeviceType()];case 2:return deviceType=_a.sent(),id=""+userId,[4,this.apiClient.registerUser(__assign(__assign({},params),{userId:id,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:deviceType}))];case 3:return response=_a.sent(),[4,this.data.setUserId(""+userId)];case 4:return _a.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 5:return _a.sent(),[2,response]}})})},Api.prototype.postEvent=function(event,attributes){return __awaiter(this,void 0,void 0,function(){var params,date,time,timestampUTC,timestampCurrent,lastOpenMessage,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),date=new Date,time=date.getTime(),timestampUTC=Math.floor(time/1e3),timestampCurrent=timestampUTC-date.getTimezoneOffset()/60*3600,[4,this.data.getLastOpenMessage()];case 2:if((lastOpenMessage=_a.sent())&&lastOpenMessage.expiry>Date.now()){if(attributes.msgHash)return[2,Promise.reject("attribute msgHash already defined")];attributes=__assign(__assign({},attributes),{msgHash:lastOpenMessage.messageHash})}return[4,this.data.setLastOpenMessage(void 0)];case 3:return _a.sent(),[4,this.apiClient.postEvent(__assign(__assign({},params),{event:event,timestampUTC:timestampUTC,timestampCurrent:timestampCurrent,attributes:attributes}))];case 4:return(response=_a.sent())&&response.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:response.code}),[2,response]}})})},Api.prototype.getInboxMessages=function(count){return void 0===count&&(count=0),__awaiter(this,void 0,void 0,function(){var params,lastCode,lastRequestTime;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getInboxLastRequestCode()];case 2:return lastCode=_a.sent(),[4,this.data.getInboxLastRequestTime()];case 3:return lastRequestTime=_a.sent(),[2,this.apiClient.getInboxMessages(__assign(__assign({},params),{count:count,last_code:lastCode,last_request_time:lastRequestTime}))]}})})},Api.prototype.inboxStatus=function(order,status){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.inboxStatus(__assign(__assign({},params),{inbox_code:order,status:status,time:(new Date).getTime()}))]}})})},Api.prototype.triggerEvent=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){throw new Error("Method has been deprecated, because we don't aggregate this statistics.")})})},Api.prototype.pageVisit=function(config){return __awaiter(this,void 0,void 0,function(){var params,features,url;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getFeatures()];case 2:return features=_a.sent(),(url=features&&features.page_visit&&features.page_visit.entrypoint)?[2,this.apiClient.pageVisit(__assign(__assign({},params),config),url)]:[2]}})})},Api.prototype.setPurchase=function(attributes){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setPurchase(__assign(__assign({},params),attributes))]}})})},Api.prototype.getParams=function(){return __awaiter(this,void 0,void 0,function(){var applicationCode,hwid,apiParams,initParams;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),[4,this.data.getTokens()];case 3:return apiParams=_a.sent(),[4,this.data.getInitParams()];case 4:return initParams=_a.sent(),[2,__assign(__assign({applicationCode:applicationCode,hwid:hwid},apiParams),initParams)]}})})},Object.defineProperty(Api.prototype,"params",{get:function(){throw new Error('Property "Pushwoosh.api.params" have been deprecated. Use the async method "Pushwoosh.api.getParams()"')},enumerable:!1,configurable:!0}),Api.prototype.getRequestParams=function(){return __awaiter(this,void 0,void 0,function(){var applicationCode,hwid,userId,deviceType,deviceModel,language,version,timezone;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),[4,this.data.getUserId()];case 3:return userId=_a.sent(),[4,this.data.getDeviceType()];case 4:return deviceType=_a.sent(),[4,this.data.getDeviceModel()];case 5:return deviceModel=_a.sent(),[4,this.data.getLanguage()];case 6:return language=_a.sent(),[4,this.data.getSdkVersion()];case 7:return version=_a.sent(),timezone=60*-(new Date).getTimezoneOffset(),[2,{application:applicationCode,hwid:hwid,userId:userId||hwid,device_type:deviceType,device_model:deviceModel,timezone:timezone,language:language,v:version}]}})})},Api}();exports.Api=Api},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var initial_1=__webpack_require__(21),_26_11_2018_1=__webpack_require__(22),DateModule_1=__webpack_require__(3),Migrations=function(){function Migrations(dateModule){void 0===dateModule&&(dateModule=new DateModule_1.default),this.migrations={initial:initial_1.default,"2018/11/26":_26_11_2018_1.default},this.dateModule=dateModule}return Object.defineProperty(Migrations.prototype,"initial",{get:function(){return this.migrations.initial},enumerable:!1,configurable:!0}),Object.defineProperty(Migrations.prototype,"dateSorted",{get:function(){var _this=this;return Object.keys(this.migrations).filter(function(key){return"initial"!==key}).sort(function(a,b){var dateA=new DateModule_1.default(new Date(a)),dateB=new DateModule_1.default(new Date(b));return dateA.getTimestamp()-dateB.getTimestamp()}).map(function(key){return _this.migrations[key]})},enumerable:!1,configurable:!0}),Migrations}();exports.default=Migrations},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(12),constants_1=__webpack_require__(6);exports.default=[helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_KEY_VALUE,function(database){database.createObjectStore(constants_1.STORE_NAME_KEY_VALUE,{keyPath:"key"})}),helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_MAIN_LOG,function(database){var logStore=database.createObjectStore(constants_1.STORE_NAME_MAIN_LOG,{keyPath:constants_1.KEY_PATH_BASE_INCREMENT,autoIncrement:!0});logStore.createIndex("environment","environment",{unique:!1}),logStore.createIndex("date","date",{unique:!1}),logStore.createIndex("type","type",{unique:!1})}),helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_MESSAGE_LOG,function(database){database.createObjectStore(constants_1.STORE_NAME_MESSAGE_LOG,{keyPath:constants_1.KEY_PATH_BASE_INCREMENT,autoIncrement:!0}).createIndex("date","date",{unique:!1})})]},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(12),constants_1=__webpack_require__(6);exports.default=[helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_INBOX_MESSAGES,function(database){var store=database.createObjectStore(constants_1.STORE_NAME_INBOX_MESSAGES,{keyPath:"inbox_id",autoIncrement:!1});store.createIndex("status","status",{unique:!1,multiEntry:!0}),store.createIndex("rt","rt",{unique:!1,multiEntry:!0})})]},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushServiceDefault=void 0;var uuid_1=__webpack_require__(7),logger_1=__webpack_require__(4),CONSTANTS=__webpack_require__(0),PushServiceDefault=function(){function PushServiceDefault(api,data,config){this.api=api,this.data=data,this.config=config}return PushServiceDefault.prototype.getPermission=function(){return Notification.permission},PushServiceDefault.prototype.checkIsPermissionGranted=function(){return this.getPermission()===CONSTANTS.PERMISSION_GRANTED},PushServiceDefault.prototype.checkIsPermissionDefault=function(){return this.getPermission()===CONSTANTS.PERMISSION_PROMPT},PushServiceDefault.prototype.checkIsManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getStatusManualUnsubscribed()]})})},PushServiceDefault.prototype.askPermission=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Notification.requestPermission()];case 1:return _a.sent(),[2]}})})},PushServiceDefault.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getTokens()]})})},PushServiceDefault.prototype.subscribe=function(subscription){return __awaiter(this,void 0,void 0,function(){var currentSubscription,senderId_1,applicationServerKey,senderId,pushToken,_p256dn,_auth,p256dh,auth,_a,token,pushSet;return __generator(this,function(_b){switch(_b.label){case 0:return currentSubscription=subscription,this.checkIsPermissionGranted()?currentSubscription?[3,6]:[4,this.trySubscribe()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return currentSubscription=_b.sent(),[4,this.getSenderIdFromManifest()];case 2:return senderId_1=_b.sent(),[4,this.checkIsChangeSenderId(senderId_1)];case 3:return _b.sent()?[4,this.unsubscribe()]:[3,6];case 4:return _b.sent(),[4,this.data.setSenderId(senderId_1)];case 5:_b.sent(),_b.label=6;case 6:return[4,this.getApplicationServerKey()];case 7:return applicationServerKey=_b.sent(),[4,this.data.getSenderId()];case 8:return senderId=_b.sent(),[4,this.getPushToken(currentSubscription)];case 9:if(pushToken=_b.sent(),_p256dn=currentSubscription.getKey("p256dh"),_auth=currentSubscription.getKey("auth"),!_p256dn||!_auth)throw new Error("Can't get subscription keys!");return p256dh=btoa(String.fromCharCode.apply(String,new Uint8Array(_p256dn))),auth=btoa(String.fromCharCode.apply(String,new Uint8Array(_auth))),[4,this.getFcmKeys({endpoint:currentSubscription.endpoint,application_pub_key:applicationServerKey,encryption_key:p256dh,encryption_auth:auth,authorized_entity:senderId})];case 10:return _a=_b.sent(),token=_a.token,pushSet=_a.pushSet,[4,this.data.setTokens({publicKey:p256dh,pushToken:pushToken,authToken:auth,fcmPushSet:pushSet,fcmToken:token,endpoint:currentSubscription.endpoint})];case 11:return _b.sent(),[4,this.api.registerDevice()];case 12:return _b.sent(),[2]}})})},PushServiceDefault.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){var subscription;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,_a.sent().pushManager.getSubscription()];case 2:return subscription=_a.sent(),[4,this.data.setTokens({})];case 3:return _a.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 4:return _a.sent(),[4,this.api.unregisterDevice()];case 5:return _a.sent(),subscription?[4,subscription.unsubscribe()]:[2];case 6:return _a.sent(),[2]}})})},PushServiceDefault.prototype.checkIsRegister=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},PushServiceDefault.prototype.checkIsNeedResubscribe=function(){return __awaiter(this,void 0,void 0,function(){var savedSenderId,isExistSavedSenderId,manifestSenderId,isChangeSenderID,lastPermission,permission,credentials,pushTokenFromSubscription,subscriptionTokensFromStore,pushTokenFromStore;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return savedSenderId=_a.sent(),isExistSavedSenderId=void 0!==savedSenderId,[4,this.getSenderIdFromManifest()];case 2:return manifestSenderId=_a.sent(),isChangeSenderID=isExistSavedSenderId&&manifestSenderId!==savedSenderId,[4,this.data.setSenderId(manifestSenderId)];case 3:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 4:return lastPermission=_a.sent(),permission=this.getPermission(),isExistSavedSenderId&&lastPermission!==permission?[4,this.data.setLastPermissionStatus(permission)]:[3,6];case 5:return _a.sent(),[2,!0];case 6:return[4,this.getCredentials()];case 7:return credentials=_a.sent(),[4,this.getPushToken(credentials)];case 8:return pushTokenFromSubscription=_a.sent(),[4,this.data.getTokens()];case 9:return subscriptionTokensFromStore=_a.sent(),pushTokenFromStore=subscriptionTokensFromStore&&subscriptionTokensFromStore.pushToken||"",[2,isChangeSenderID||!(pushTokenFromSubscription===pushTokenFromStore)]}})})},PushServiceDefault.prototype.getServiceWorkerRegistration=function(){return __awaiter(this,void 0,void 0,function(){var url,_a;return __generator(this,function(_b){switch(_b.label){case 0:return this.registration?[3,5]:[4,this.registerServiceWorker()];case 1:return _b.sent(),[4,this.data.getServiceWorkerUrl()];case 2:return url=_b.sent(),_a=this,[4,navigator.serviceWorker.getRegistration(url)];case 3:return _a.registration=_b.sent(),[4,this.registration.update()];case 4:_b.sent(),_b.label=5;case 5:if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return[2,this.registration]}})})},PushServiceDefault.prototype.registerServiceWorker=function(){return __awaiter(this,void 0,void 0,function(){var url,scope,sdkVersion,serviceWorkerVersion,cleanCache;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getServiceWorkerUrl()];case 1:return url=_a.sent(),[4,this.data.getServiceWorkerScope()];case 2:return scope=_a.sent(),[4,this.data.getSdkVersion()];case 3:return sdkVersion=_a.sent(),[4,this.data.getServiceWorkerVersion()];case 4:return serviceWorkerVersion=_a.sent(),cleanCache="",sdkVersion!==serviceWorkerVersion&&(cleanCache="?cache_clean="+uuid_1.v4()),[4,navigator.serviceWorker.register(""+url+cleanCache,{scope:scope})];case 5:return _a.sent(),[2]}})})},PushServiceDefault.prototype.trySubscribe=function(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,4]),[4,this.subscribePushManager()];case 1:return[2,_a.sent()];case 2:return error_1=_a.sent(),console.error(error_1),[4,this.unsubscribe()];case 3:return _a.sent(),[2,this.subscribePushManager()];case 4:return[2]}})})},PushServiceDefault.prototype.subscribePushManager=function(){return __awaiter(this,void 0,void 0,function(){var registration,applicationServerKey;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return registration=_a.sent(),[4,this.getApplicationServerKey()];case 2:return applicationServerKey=_a.sent(),[2,registration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:applicationServerKey?this.urlBase64ToUint8Array(applicationServerKey):null})]}})})},PushServiceDefault.prototype.getCredentials=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,_a.sent().pushManager.getSubscription()];case 2:return[2,_a.sent()]}})})},PushServiceDefault.prototype.getFcmKeys=function(config){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,fetch(this.config.entrypoint||"https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(config)})];case 1:return 200!==(response=_a.sent()).status?[3,3]:[4,response.json()];case 2:return[2,_a.sent()];case 3:throw new Error("Internal error: Can't register device in fcm. Status: "+response.status+". Message: "+response.statusText)}})})},PushServiceDefault.prototype.getPushToken=function(subscription){return __awaiter(this,void 0,void 0,function(){var deviceType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),subscription?12===deviceType?[2,subscription.endpoint]:[2,subscription.endpoint.split("/").pop()||""]:[2,""]}})})},PushServiceDefault.prototype.getApplicationServerKey=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return 11!==_a.sent()?[2]:[4,this.data.getApplicationServerKey()];case 2:return[2,_a.sent()]}})})},PushServiceDefault.prototype.getSenderIdFromManifest=function(){return __awaiter(this,void 0,void 0,function(){var manifest,url,response,data,match;return __generator(this,function(_a){switch(_a.label){case 0:if(!(manifest=document.querySelector('link[rel="manifest"]')))throw new Error("Error: manifest.json not found!");if(!(url=manifest.getAttribute("href")))throw new Error("Error: manifest.json url not found!");return[4,fetch(url,{method:"GET",headers:{"Content-Type":"application/json;charset=UTF-8"}})];case 1:if(200!==(response=_a.sent()).status)throw new Error("Error: Can't load manifest.json! "+response.statusText);return[4,response.text()];case 2:if(data=_a.sent(),!(match=data.match(/("|')?gcm_sender_id("|')?:\s*("|')?(\d+)("|')?/))||"string"!=typeof match[4])throw new Error("Error: Can't find gcm_sender_id in manifest.json!");return[2,match[4]]}})})},PushServiceDefault.prototype.checkIsChangeSenderId=function(currentSenderId){return __awaiter(this,void 0,void 0,function(){var senderIdFromIndexedDB;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return senderIdFromIndexedDB=_a.sent(),[2,currentSenderId!==senderIdFromIndexedDB]}})})},PushServiceDefault.prototype.urlBase64ToUint8Array=function(base64String){for(var base64=(base64String+"=".repeat((4-base64String.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),rawData=window.atob(base64),outputArray=new Uint8Array(rawData.length),i=0;i<rawData.length;++i)outputArray[i]=rawData.charCodeAt(i);return outputArray},PushServiceDefault}();exports.PushServiceDefault=PushServiceDefault},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var Storage_1=__webpack_require__(25),DateModule_1=__webpack_require__(3),InboxMessagesPublic_1=__webpack_require__(13),InboxMessages=function(){function InboxMessages(eventBus,data,api,storage,dateModule){void 0===storage&&(storage=new Storage_1.default),void 0===dateModule&&(dateModule=new DateModule_1.default),this.eventBus=eventBus,this.data=data,this.api=api,this.storage=storage,this.storeName="inboxMessages",this.dateModule=dateModule}return InboxMessages.prototype.getInboxMessages=function(){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.api.getInboxMessages()];case 1:return response=_a.sent(),[4,this.storeGetInboxMessagesRequestParams(response.next,response.new_inbox)];case 2:return _a.sent(),[2,response]}})})},InboxMessages.prototype.storeGetInboxMessagesRequestParams=function(next,newMessagesCount){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,[4,this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp())];case 1:return _a.sent(),[4,this.data.setInboxLastRequestCode(next)];case 2:return _a.sent(),[4,this.data.setInboxNewMessagesCount(newMessagesCount)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.putServerMessages=function(messages){return __awaiter(this,void 0,void 0,function(){var putTransactions,_this=this;return __generator(this,function(_a){return putTransactions=messages.map(function(message){return __awaiter(_this,void 0,void 0,function(){var localMessage;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.get(this.storeName,message.inbox_id,{})];case 1:return"status"in(localMessage=_a.sent())&&(message.status=localMessage.status),[2,this.putMessage(message)]}})})}),[2,Promise.all(putTransactions)]})})},InboxMessages.prototype.putMessage=function(message){return this.storage.put(this.storeName,message)},InboxMessages.prototype.putBulkMessages=function(messages){var _this=this,putTransactions=messages.map(function(message){return _this.putMessage(message)});return Promise.all(putTransactions)},InboxMessages.prototype.deleteMessages=function(codes){var _this=this,deleteTransactions=codes.map(function(code){return _this.storage.delete(_this.storeName,code)});return Promise.all(deleteTransactions)},InboxMessages.prototype.deleteExpiredMessages=function(){return __awaiter(this,void 0,void 0,function(){var upperBound,allMessages,codesToDelete;return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,upperBound=this.dateModule.getTimestamp().toString(),[4,this.storage.getAll(this.storeName)];case 1:return allMessages=_a.sent(),codesToDelete=allMessages.filter(function(msg){return msg.rt>upperBound}).map(function(msg){return msg.inbox_id}),[2,this.deleteMessages(codesToDelete)]}})})},InboxMessages.prototype.getMessage=function(code){return this.storage.get(this.storeName,code)},InboxMessages.prototype.getReadOpenMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,_a.sent().filter(function(msg){return 2===msg.status||3===msg.status})]}})})},InboxMessages.prototype.getDeliveredMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,_a.sent().filter(function(msg){return 1===msg.status})]}})})},InboxMessages.prototype.messagesCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.storage.count(this.storeName)]})})},InboxMessages.prototype.getDeliveredMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var deliveredStatus,statusIndexName;return __generator(this,function(_a){return deliveredStatus=1,statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,deliveredStatus)]})})},InboxMessages.prototype.getReadMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var readStatus,statusIndexName;return __generator(this,function(_a){return readStatus=2,statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,readStatus)]})})},InboxMessages.prototype.getDeliveredReadMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var _a,readStatus,openStatus,keyRange,statusIndexName;return __generator(this,function(_b){return readStatus=(_a=[2,3])[0],openStatus=_a[1],keyRange=IDBKeyRange.bound(readStatus,openStatus),statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,keyRange)]})})},InboxMessages.prototype.updateMessages=function(){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getInboxMessages()];case 1:return response=_a.sent(),[4,this.deleteExpiredMessages()];case 2:return _a.sent(),response.deleted?[4,this.deleteMessages(response.deleted)]:[3,4];case 3:_a.sent(),_a.label=4;case 4:return[4,this.putServerMessages(response.messages)];case 5:return _a.sent(),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new InboxMessagesPublic_1.default(this.data,this.api,this)}),[2]}})})},InboxMessages}();exports.default=InboxMessages},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var version_1=__webpack_require__(10),MigrationExecutor_1=__webpack_require__(11),Store_1=__webpack_require__(26),Storage=function(){function Storage(){}return Storage.prototype.dbVersionChangeHandler=function(db,event){console.info("onversionchange",event),db.close()},Storage.prototype.dbRequestSuccessHandler=function(resolve,event){var _this=this,database=event.target.result;database.onversionchange=function(event){_this.dbVersionChangeHandler(database,event)},resolve(database)},Storage.prototype.dbRequestUpgradeNeededHandler=function(event){var _this=this,database=event.target.result;database.onversionchange=function(event){_this.dbVersionChangeHandler(database,event)},new MigrationExecutor_1.default(database).applyMigrations()},Storage.prototype.getDB=function(){var _this=this;return new Promise(function(resolve,reject){var request=indexedDB.open("PUSHWOOSH_SDK_STORE",version_1.default);request.onsuccess=function(event){_this.dbRequestSuccessHandler(resolve,event)},request.onupgradeneeded=function(event){_this.dbRequestUpgradeNeededHandler(event)},request.onerror=function(){return reject(request.error)}})},Storage.prototype.put=function(storeName,data,key){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).put(data,key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.delete=function(storeName,key){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).delete(key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.get=function(storeName,key,defaultValue){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).get(key,defaultValue)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.getAll=function(storeName){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).getAll()];case 2:return result=_a.sent(),db.close(),[2,result||[]]}})})},Storage.prototype.count=function(storeName,query){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).count(query)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.countByIndex=function(storeName,indexName,key){return __awaiter(this,void 0,void 0,function(){var db,store,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),(store=new Store_1.default(db,storeName)).index=indexName,[4,store.countByIndex(key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage}();exports.default=Storage},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Store=function(){function Store(db,name){this.name=name,this.store=db.transaction(this.name,"readwrite").objectStore(this.name)}return Object.defineProperty(Store.prototype,"index",{set:function(index){this.store.indexNames.contains(index)?this._index=this.store.index(index):console.warn('Index "'+index+'" in ')},enumerable:!1,configurable:!0}),Store.prototype.writeRequestPromise=function(request,result){return new Promise(function(resolve,reject){request.onsuccess=function(){resolve(result)},request.onerror=function(){reject(request.error)}})},Store.prototype.readRequestPromise=function(request,defaultValue){return new Promise(function(resolve,reject){request.onsuccess=function(event){var target=event.target;resolve(target.result||defaultValue)},request.onerror=function(){reject(request.error)}})},Store.prototype.put=function(data,key){var request=this.store.put(data,key);return this.writeRequestPromise(request,key)},Store.prototype.add=function(data,key){return this.put(data,key)},Store.prototype.delete=function(key){var request=this.store.delete(key);return this.writeRequestPromise(request)},Store.prototype.get=function(key,defaultValue){var request=this.store.get(key);return this.readRequestPromise(request,defaultValue)},Store.prototype.getAll=function(){var cursor=this.store.openCursor(),result=[];return new Promise(function(resolve,reject){cursor.onsuccess=function(event){var cursorResult=event.target.result;cursorResult?(result.push(cursorResult.value),cursorResult.continue()):resolve(result)},cursor.onerror=function(){reject(cursor.error)}})},Store.prototype.count=function(query){var request=this.store.count(query);return this.readRequestPromise(request,0)},Store.prototype.countByIndex=function(key){var request=this._index.count(key);return this.readRequestPromise(request,0)},Store}();exports.default=Store},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE=void 0,exports.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE="pushwoosh-subscription-widget"},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PlatformChecker_1=__webpack_require__(29),PlatformChecker_2=__webpack_require__(29);Object.defineProperty(exports,"PlatformChecker",{enumerable:!0,get:function(){return PlatformChecker_2.PlatformChecker}}),exports.default=PlatformChecker_1.platformChecker},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.platformChecker=exports.PlatformChecker=void 0;var functions_1=__webpack_require__(5),PlatformChecker=function(){function PlatformChecker(global){this.global=global,this._isSafari=this.isSafariBrowser(),this._isOpera=this.isOperaBrowser(),this._isEdge=this.isEdgeBrowser(),this._isFirefox=this.isFirefoxBrowser(),this._isChrome=this.isChromeBrowser(),this._isMacOS=this.isMacOS(),this._isAvailablePromise=this.canUsePromise(),this._isAvailableServiceWorker=this.canUseServiceWorkers(),this._isAvailableNotifications=this.canReceiveNotifications(),this._platform=this.getPlatformType(),this._browserVersion=this.getBrowserVersion()}return Object.defineProperty(PlatformChecker.prototype,"isEdge",{get:function(){return this._isEdge},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isSafari",{get:function(){return this._isSafari},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isOpera",{get:function(){return this._isOpera},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailablePromise",{get:function(){return this._isAvailablePromise},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailableServiceWorker",{get:function(){return this._isAvailableServiceWorker},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailableNotifications",{get:function(){return this._isAvailableNotifications},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"platform",{get:function(){return this._platform},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"browserVersion",{get:function(){return this._browserVersion},enumerable:!1,configurable:!0}),PlatformChecker.prototype.isSafariBrowser=function(){return"safari"in this.global&&navigator.userAgent.indexOf("Safari")>-1},PlatformChecker.prototype.isOperaBrowser=function(){return-1!==navigator.userAgent.indexOf("Opera")||-1!==navigator.userAgent.indexOf("OPR")},PlatformChecker.prototype.isEdgeBrowser=function(){return navigator.userAgent.indexOf("Edge")>-1},PlatformChecker.prototype.isFirefoxBrowser=function(){return-1!==navigator.userAgent.toLowerCase().indexOf("firefox")},PlatformChecker.prototype.isChromeBrowser=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)&&!this._isOpera&&!this._isEdge},PlatformChecker.prototype.isMacOS=function(){return"platform"in navigator&&-1!==navigator.platform.toLowerCase().indexOf("mac")},PlatformChecker.prototype.canUseServiceWorkers=function(){return!!navigator.serviceWorker&&"PushManager"in this.global&&"Notification"in this.global},PlatformChecker.prototype.canUsePromise=function(){return"Promise"in this.global},PlatformChecker.prototype.canReceiveNotifications=function(){return this._isSafari&&this._isMacOS||this._isAvailableServiceWorker&&!this._isEdge},PlatformChecker.prototype.getPlatformType=function(){var platform=11;switch(!0){case this._isSafari:platform=10;break;case this._isOpera||this._isChrome:platform=11;break;case this._isFirefox:platform=12;break;case this._isEdge:platform=150}return platform},PlatformChecker.prototype.getBrowserVersion=function(){var userAgent=navigator.userAgent,matchOperaVersion=userAgent.match(/\bOPR\/(\d+)/);if(null!==matchOperaVersion)return"Opera "+matchOperaVersion[1];var matchEdgeVersion=userAgent.match(/\bEdge\/(\d+)/);if(null!==matchEdgeVersion)return"Edge "+matchEdgeVersion[1];var matchEdgVersion=userAgent.match(/\bEdg\/(\d+)/);if(null!==matchEdgVersion)return"Edge "+matchEdgVersion[1];var match=userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],_a=(match[0],match[1]),browser=void 0===_a?"":_a;if(/trident/i.test(userAgent)){var matchIeVersion=/trident\/([.\d]+)/gi.exec(userAgent)||[];return"IE "+(("7.0"===matchIeVersion[1]?"11":matchIeVersion[1])||"")}match=match[2]?[browser,match[2]]:[navigator.appName,navigator.appVersion,"-?"];var version=userAgent.match(/version\/([.\d]+)/i);return null!==version&&match.splice(1,1,version[1]),match.join(" ")},PlatformChecker}();exports.PlatformChecker=PlatformChecker,exports.platformChecker=new PlatformChecker(functions_1.getGlobal())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIBE_WIDGET_DEFAULT_CONFIG=exports.WIDGET_CONTAINER_ID=exports.BELL_POSITION_TOP_LEFT=exports.BELL_POSITION_TOP_RIGHT=exports.BELL_POSITION_BOTTOM_LEFT=exports.BELL_POSITION_BOTTOM_RIGHT=void 0,exports.BELL_POSITION_BOTTOM_RIGHT="bottomRight",exports.BELL_POSITION_BOTTOM_LEFT="bottomLeft",exports.BELL_POSITION_TOP_RIGHT="topRight",exports.BELL_POSITION_TOP_LEFT="topLeft",exports.WIDGET_CONTAINER_ID="pushwooshBellWidget",exports.SUBSCRIBE_WIDGET_DEFAULT_CONFIG={position:exports.BELL_POSITION_BOTTOM_LEFT,bgColor:"#12AE7E",bellColor:"white",bellStrokeColor:"#08754f",bellButtonBorder:"1px solid #379676",shadow:"0px 0px 6px rgba(0, 0, 0, 0.75)",size:"48px",indent:"20px",zIndex:"999999",tooltipText:{successSubscribe:"You are successfully subscribed!",needSubscribe:"Get notifications about important news!",blockSubscribe:"Click to see how to get notifications",alreadySubscribed:"You are already subscribed"}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Pushwoosh_1=__webpack_require__(32);Object.defineProperty(exports,"Pushwoosh",{enumerable:!0,get:function(){return Pushwoosh_1.default}}),__webpack_require__(38),__webpack_require__(44),__webpack_require__(46)},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var uuid_1=__webpack_require__(7),EventBus_1=__webpack_require__(17),Api_1=__webpack_require__(19),Data_1=__webpack_require__(2),ApiClient_1=__webpack_require__(14),PushService_1=__webpack_require__(33),SubscriptionPromptWidget_1=__webpack_require__(35),CONSTANTS=__webpack_require__(0),functions_1=__webpack_require__(5),PlatformChecker_1=__webpack_require__(28),logger_1=__webpack_require__(4),FacebookModule_1=__webpack_require__(37),storage_1=__webpack_require__(1),InboxMessages_1=__webpack_require__(24),InboxMessagesPublic_1=__webpack_require__(13),Pushwoosh=function(){function Pushwoosh(){var _this=this;this.ready=!1,this.addEventHandler=function(name,handler){return _this.eventBus.addEventHandler(name,handler)},this.removeEventHandler=function(name,handler){return _this.eventBus.removeEventHandler(name,handler)},this.dispatchEvent=function(name,payload){return _this.eventBus.dispatchEvent(name,payload)},this.debug={showLog:function(){return __awaiter(this,void 0,void 0,function(){var items;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.log.getAll()];case 1:return items=_a.sent(),console.log(items),[2]}})})},showKeyValues:function(){return __awaiter(this,void 0,void 0,function(){var items;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.keyValue.getAll()];case 1:return items=_a.sent(),console.log(items),[2]}})})},showMessages:function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.message.getAll()];case 1:return _a.sent().forEach(function(i){return console.log(i)}),[2]}})})}},this.eventBus=new EventBus_1.EventBus,this.data=new Data_1.Data,this.apiClient=new ApiClient_1.ApiClient(this.data),this.api=new Api_1.Api(this.eventBus,this.data,this.apiClient),this.platformChecker=new PlatformChecker_1.PlatformChecker(functions_1.getGlobal()),this.inboxModel=new InboxMessages_1.default(this.eventBus,this.data,this.api),this.pwinbox=new InboxMessagesPublic_1.default(this.data,this.api,this.inboxModel),this.onServiceWorkerMessage=this.onServiceWorkerMessage.bind(this),this.subscriptionPromptWidget=new SubscriptionPromptWidget_1.SubscriptionPromptWidget(this.eventBus,this)}return Pushwoosh.prototype.push=function(command){if("function"!=typeof command){if(!Array.isArray(command))throw new Error("Invalid command!");switch(command[0]){case"init":this.initialize(command[1]);break;case CONSTANTS.EVENT_ON_LOAD:case CONSTANTS.EVENT_ON_READY:case CONSTANTS.EVENT_ON_REGISTER:case CONSTANTS.EVENT_ON_SUBSCRIBE:case CONSTANTS.EVENT_ON_UNSUBSCRIBE:case CONSTANTS.EVENT_ON_SW_INIT_ERROR:case CONSTANTS.EVENT_ON_PUSH_DELIVERY:case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:case CONSTANTS.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:case CONSTANTS.EVENT_ON_UPDATE_INBOX_MESSAGES:case CONSTANTS.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:case CONSTANTS.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:case CONSTANTS.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:case CONSTANTS.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:case CONSTANTS.EVENT_ON_PERMISSION_DENIED:case CONSTANTS.EVENT_ON_PERMISSION_PROMPT:case CONSTANTS.EVENT_ON_PERMISSION_GRANTED:this.subscribeToLegacyEvents(command[0],command[1]);break;default:throw new Error("Unknown command!")}}else this.subscribeToLegacyEvents("onReady",command)},Pushwoosh.prototype.subscribe=function(isForceSubscribe){return void 0===isForceSubscribe&&(isForceSubscribe=!0),__awaiter(this,void 0,void 0,function(){var permission_1,permission,isManualUnsubscribed,isDeviceRegister;return __generator(this,function(_a){switch(_a.label){case 0:return this.isCommunicationDisabled&&logger_1.Logger.error("Communication is disabled!"),this.driver.checkIsPermissionDefault()?(this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),[4,this.driver.askPermission()]):[3,2];case 1:_a.sent(),permission_1=this.driver.getPermission(),this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:permission_1}),_a.label=2;case 2:return permission=this.driver.getPermission(),[4,this.data.getStatusManualUnsubscribed()];case 3:return isManualUnsubscribed=_a.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 4:return isDeviceRegister=_a.sent(),permission!==CONSTANTS.PERMISSION_GRANTED?[3,7]:(this.eventBus.dispatchEvent("permission-granted",{}),!(isForceSubscribe||!isManualUnsubscribed)||isDeviceRegister?[3,6]:[4,this.driver.subscribe()]);case 5:_a.sent(),_a.label=6;case 6:return this.eventBus.dispatchEvent("subscribe",{}),[2];case 7:return permission!==CONSTANTS.PERMISSION_DENIED?[3,10]:(this.eventBus.dispatchEvent("permission-denied",{}),isDeviceRegister?[4,this.driver.unsubscribe()]:[3,9]);case 8:_a.sent(),_a.label=9;case 9:case 10:return[2]}})})},Pushwoosh.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,3]),[4,this.driver.unsubscribe()];case 1:return _a.sent(),[3,3];case 2:return error_1=_a.sent(),logger_1.Logger.error(error_1,"Error occurred during the unsubscribe"),[3,3];case 3:return[2]}})})},Pushwoosh.prototype.forceSubscribe=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.subscribe(!0)];case 1:return _a.sent(),[2]}})})},Pushwoosh.prototype.isDeviceRegistered=function(){return localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS)===CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED},Pushwoosh.prototype.isDeviceUnregistered=function(){return localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS)===CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED},Pushwoosh.prototype.isSubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},Pushwoosh.prototype.isCommunicationEnabled=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:return[2,!_a.sent()]}})})},Pushwoosh.prototype.setCommunicationEnabled=function(isEnabled){return void 0===isEnabled&&(isEnabled=!0),__awaiter(this,void 0,void 0,function(){var deviceType,isPermissionGranted;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),isPermissionGranted=this.driver.checkIsPermissionGranted(),[4,this.data.setStatusCommunicationDisabled(!isEnabled)];case 2:return _a.sent(),isEnabled?[4,this.data.setStatusDropAllData(!1)]:[3,6];case 3:return _a.sent(),isPermissionGranted?[4,this.api.registerDevice()]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[3,8];case 6:return[4,this.api.unregisterDevice()];case 7:_a.sent(),_a.label=8;case 8:return this.eventBus.dispatchEvent("change-enabled-communication",{isEnabled:isEnabled}),[4,this.api.postEvent(CONSTANTS.EVENT_GDPR_CONSENT,{channel:isEnabled,device_type:deviceType})];case 9:return _a.sent(),[2]}})})},Pushwoosh.prototype.removeAllDeviceData=function(){return __awaiter(this,void 0,void 0,function(){var deviceType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),[4,this.api.postEvent(CONSTANTS.EVENT_GDPR_DELETE,{status:!0,device_type:deviceType})];case 2:return _a.sent(),[4,this.api.deleteDevice()];case 3:return _a.sent(),[4,this.data.clearAll()];case 4:return _a.sent(),[4,this.data.setStatusDropAllData(!0)];case 5:return _a.sent(),[2]}})})},Pushwoosh.prototype.getHWID=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getHwid()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.getPushToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getTokens()];case 1:return[2,_a.sent().pushToken]}})})},Pushwoosh.prototype.getUserId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getUserId()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.getParams=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.api.getParams()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.isAvailableNotifications=function(){return this.platformChecker.isAvailableNotifications},Pushwoosh.prototype.sendStatisticsVisitedPage=function(){return __awaiter(this,void 0,void 0,function(){var title,_a,origin,pathname,href;return __generator(this,function(_b){switch(_b.label){case 0:return title=window.document.title,_a=window.location,origin=_a.origin,pathname=_a.pathname,href=_a.href,[4,this.api.pageVisit({title:title,url_path:""+origin+pathname,url:href})];case 1:return _b.sent(),[2]}})})},Pushwoosh.prototype.initialize=function(params){return __awaiter(this,void 0,void 0,function(){var manualDebug,applicationCode,notSavedApplicationCode,isChangeApplicationCode,id,config,_a,userIdWasChange,error_2,error_3,delayedEvent,type,payload,hashReg,hash;return __generator(this,function(_b){switch(_b.label){case 0:return manualDebug=localStorage.getItem(CONSTANTS.MANUAL_SET_LOGGER_LEVEL),logger_1.Logger.setLevel(manualDebug||params.logLevel||"error"),this.platformChecker.isAvailableNotifications?[4,this.data.getApplicationCode()]:[2];case 1:if(applicationCode=_b.sent(),!params.applicationCode)throw new Error("Can't find application code!");return notSavedApplicationCode=!applicationCode,isChangeApplicationCode=applicationCode&&applicationCode!==params.applicationCode,notSavedApplicationCode||isChangeApplicationCode?[4,this.data.clearAll()]:[3,4];case 2:return _b.sent(),[4,this.data.setApplicationCode(params.applicationCode)];case 3:_b.sent(),_b.label=4;case 4:return[4,this.data.getHwid()];case 5:return _b.sent()?[3,7]:(id=params.applicationCode+"_"+uuid_1.v4(),[4,this.data.setHwid(id)]);case 6:_b.sent(),_b.label=7;case 7:return[4,this.data.setDeviceType(this.platformChecker.getPlatformType())];case 8:return _b.sent(),[4,this.data.setDeviceModel(this.platformChecker.getBrowserVersion())];case 9:return _b.sent(),[4,this.data.setLanguage(params.tags&&params.tags.Language||navigator.language)];case 10:return _b.sent(),params.pushwooshUrl?[4,this.data.setApiEntrypoint(params.pushwooshUrl)]:[3,12];case 11:_b.sent(),_b.label=12;case 12:return[4,this.data.setSdkVersion("3.31.1")];case 13:return _b.sent(),[4,this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt"])];case 14:return config=_b.sent(),this.onGetConfig(config&&config.features),this.subscribeWidgetConfig=__assign({enable:!1},params.subscribeWidget),this.inboxWidgetConfig=__assign({enable:!1},params.inboxWidget),this.subscribePopupConfig=__assign({enable:!1},params.subscribePopup),_a=this,[4,this.data.getStatusCommunicationDisabled()];case 15:return _a.isCommunicationDisabled=_b.sent(),[4,this.open()];case 16:return _b.sent(),[4,this.data.getStatusUserIdWasChanged()];case 17:return userIdWasChange=_b.sent(),!params.userId||"user_id"===params.userId||userIdWasChange?[3,19]:[4,this.api.registerUser(params.userId)];case 18:_b.sent(),_b.label=19;case 19:return params.tags&&this.api.setTags(params.tags),this.platformChecker.isAvailableNotifications?[4,this.initPushNotifications(params)]:[3,21];case 20:_b.sent(),_b.label=21;case 21:return _b.trys.push([21,23,,24]),[4,this.inboxModel.updateMessages()];case 22:return _b.sent(),[3,24];case 23:return error_2=_b.sent(),logger_1.Logger.write("error",error_2),[3,24];case 24:return _b.trys.push([24,26,,27]),[4,this.initFacebook(params)];case 25:return _b.sent(),[3,27];case 26:return error_3=_b.sent(),logger_1.Logger.write("error",error_3),[3,27];case 27:return this.ready=!0,this.eventBus.dispatchEvent("ready",{}),[4,this.data.getDelayedEvent()];case 28:return(delayedEvent=_b.sent())?(type=delayedEvent.type,payload=delayedEvent.payload,[4,this.emitLegacyEventsFromServiceWorker(type,payload)]):[3,31];case 29:return _b.sent(),[4,this.data.setDelayedEvent(null)];case 30:_b.sent(),_b.label=31;case 31:return"serviceWorker"in navigator&&(navigator.serviceWorker.onmessage=this.onServiceWorkerMessage),localStorage.setItem("pushwoosh-websdk-status","init"),document.dispatchEvent(new CustomEvent("pushwoosh.initialized",{detail:{pw:this}})),this.platformChecker.isSafari&&(hashReg=/#P(.*)/,hash=decodeURIComponent(document.location.hash),hashReg.test(hash)&&this.api.pushStat(hashReg.exec(hash)[1]).then(functions_1.clearLocationHash)),[2]}})})},Pushwoosh.prototype.defaultProcess=function(initParams){return __awaiter(this,void 0,void 0,function(){var permission,isCommunicationDisabled,isDropAllData,isNeedResubscribe,features,currentPromptUseCase,autoSubscribe,isManualUnsubscribed,isRegister,widgetConfig,isDefaultUseCase,isNotSetUseCase;return __generator(this,function(_b){switch(_b.label){case 0:return"granted"!==(permission=this.driver.getPermission())?[3,2]:[4,this.data.setLastPermissionStatus(permission)];case 1:_b.sent(),_b.label=2;case 2:return[4,this.data.getStatusCommunicationDisabled()];case 3:return isCommunicationDisabled=_b.sent(),[4,this.data.getStatusDropAllData()];case 4:return isDropAllData=_b.sent(),[4,this.driver.checkIsNeedResubscribe()];case 5:return isNeedResubscribe=_b.sent(),[4,this.data.getFeatures()];case 6:return features=_b.sent(),currentPromptUseCase=features.subscription_prompt&&features.subscription_prompt.use_case,isCommunicationDisabled||isDropAllData?[4,this.unsubscribe()]:[3,8];case 7:return _b.sent(),[2];case 8:return isNeedResubscribe?[4,this.unsubscribe()]:[3,11];case 9:return _b.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 10:_b.sent(),_b.label=11;case 11:return autoSubscribe=initParams.autoSubscribe,[4,this.data.getStatusManualUnsubscribed()];case 12:return isManualUnsubscribed=_b.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 13:switch(isRegister=_b.sent(),permission){case CONSTANTS.PERMISSION_PROMPT:return[3,14];case CONSTANTS.PERMISSION_DENIED:return[3,20];case CONSTANTS.PERMISSION_GRANTED:return[3,23]}return[3,28];case 14:return this.eventBus.dispatchEvent("permission-default",{}),isRegister?[4,this.unsubscribe()]:[3,16];case 15:_b.sent(),_b.label=16;case 16:return[4,this.getWidgetConfig()];case 17:return widgetConfig=_b.sent(),[4,this.checkCanShowByCapping(widgetConfig)];case 18:return _b.sent()?(isDefaultUseCase=currentPromptUseCase===CONSTANTS.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT,isNotSetUseCase=currentPromptUseCase===CONSTANTS.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET&&autoSubscribe,(isDefaultUseCase||isNotSetUseCase)&&(this.subscriptionPromptWidget.init(widgetConfig),this.subscriptionPromptWidget.show()),[4,this.updateCappingParams()]):[3,28];case 19:return _b.sent(),[3,28];case 20:return this.eventBus.dispatchEvent("permission-denied",{}),isRegister?[4,this.unsubscribe()]:[3,22];case 21:_b.sent(),_b.label=22;case 22:return[3,28];case 23:return this.eventBus.dispatchEvent("permission-granted",{}),isManualUnsubscribed&&isRegister?[4,this.unsubscribe()]:[3,25];case 24:_b.sent(),_b.label=25;case 25:return!isRegister&&!isManualUnsubscribed||isNeedResubscribe?[4,this.subscribe(!0)]:[3,27];case 26:_b.sent(),_b.label=27;case 27:return[3,28];case 28:return[2]}})})},Pushwoosh.prototype.getWidgetConfig=function(){return __awaiter(this,void 0,void 0,function(){var features,currentConfig,configWithDefaultCapping;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getFeatures()];case 1:return features=_a.sent(),currentConfig=features.subscription_prompt_widget&&features.subscription_prompt_widget.params,configWithDefaultCapping=__assign({cappingCount:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingCount,cappingDelay:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingDelay},currentConfig),[2,currentConfig?configWithDefaultCapping:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG]}})})},Pushwoosh.prototype.checkCanShowByCapping=function(widgetConfig){return __awaiter(this,void 0,void 0,function(){var currentTime,displayCount,lastSeenTime,canShowByCapping,canShowByLastTime;return __generator(this,function(_a){switch(_a.label){case 0:return currentTime=(new Date).getTime(),[4,this.data.getPromptDisplayCount()];case 1:return displayCount=_a.sent(),[4,this.data.getPromptLastSeenTime()];case 2:return lastSeenTime=_a.sent(),canShowByCapping=widgetConfig.cappingCount>displayCount,canShowByLastTime=currentTime-lastSeenTime>widgetConfig.cappingDelay,[2,canShowByCapping&&canShowByLastTime]}})})},Pushwoosh.prototype.updateCappingParams=function(){return __awaiter(this,void 0,void 0,function(){var displayCount,currentTime;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getPromptDisplayCount()];case 1:return displayCount=_a.sent(),currentTime=(new Date).getTime(),[4,this.data.setPromptDisplayCount(displayCount+1)];case 2:return _a.sent(),[4,this.data.setPromptLastSeenTime(currentTime)];case 3:return _a.sent(),[2]}})})},Pushwoosh.prototype.initFacebook=function(initParams){var facebook=__assign({enable:!1,pageId:"",containerClass:""},initParams.facebook);if(facebook&&facebook.enable)try{new FacebookModule_1.default({pageId:facebook.pageId,containerClass:facebook.containerClass,applicationCode:initParams.applicationCode,userId:initParams.userId||""})}catch(error){logger_1.Logger.error(error,"facebook module initialization failed")}},Pushwoosh.prototype.onServiceWorkerMessage=function(event){var _a=(event||{}).data,_b=(void 0===_a?{}:_a)||{},_c=_b.type,type=void 0===_c?"":_c,_d=_b.payload,payload=void 0===_d?{}:_d;this.emitLegacyEventsFromServiceWorker(type,payload)},Pushwoosh.prototype.open=function(isForce){return __awaiter(this,void 0,void 0,function(){var lastApplicationOpenTime,currentTime,isSendingPeriodExceeded;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getLastOpenApplicationTime()];case 1:return lastApplicationOpenTime=_a.sent(),currentTime=Date.now(),lastApplicationOpenTime||(lastApplicationOpenTime=0),isSendingPeriodExceeded=currentTime-lastApplicationOpenTime<CONSTANTS.PERIOD_SEND_APP_OPEN,isForce||!isSendingPeriodExceeded?[4,this.data.setLastOpenApplicationTime(currentTime)]:[2];case 2:return _a.sent(),[4,this.api.applicationOpen()];case 3:return _a.sent(),[2]}})})},Pushwoosh.prototype.onGetConfig=function(features){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setFeatures(features)];case 1:return _a.sent(),features?features.page_visit&&features.page_visit.enabled?[4,storage_1.keyValue.set(CONSTANTS.PAGE_VISITED_URL,features.page_visit.entrypoint)]:[3,3]:[3,5];case 2:_a.sent(),this.sendStatisticsVisitedPage(),_a.label=3;case 3:return features.events&&features.events.length&&features.events.some(function(event){return event===CONSTANTS.EVENT_PW_SITE_OPENED})&&this.sendPostEventVisitedPage(),features.vapid_key?[4,this.data.setApplicationServerKey(features.vapid_key)]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[2]}})})},Pushwoosh.prototype.initPushNotifications=function(params){return __awaiter(this,void 0,void 0,function(){var error_4;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setDefaultNotificationImage(params.defaultNotificationImage)];case 1:return _a.sent(),[4,this.data.setDefaultNotificationTitle(params.defaultNotificationTitle)];case 2:return _a.sent(),[4,this.data.setServiceWorkerUrl(params.serviceWorkerUrl)];case 3:return _a.sent(),[4,this.data.setServiceWorkerScope(params.scope)];case 4:return _a.sent(),[4,this.data.setInitParams(__assign({autoSubscribe:!0},params))];case 5:return _a.sent(),[4,this.initDriver()];case 6:_a.sent(),_a.label=7;case 7:return _a.trys.push([7,9,,10]),[4,this.defaultProcess(params)];case 8:return _a.sent(),[3,10];case 9:return error_4=_a.sent(),logger_1.Logger.error(error_4,"Internal error: defaultProcess fail"),[3,10];case 10:return[2]}})})},Pushwoosh.prototype.initDriver=function(){return __awaiter(this,void 0,void 0,function(){var webSitePushId;return __generator(this,function(_a){switch(_a.label){case 0:return this.platformChecker.isSafari?[4,this.data.getInitParams()]:[3,2];case 1:if(!(webSitePushId=_a.sent().safariWebsitePushID))throw new Error("For work with Safari Push Notification add safariWebsitePushID to initParams!");return this.driver=new PushService_1.PushServiceSafari(this.api,this.data,{webSitePushId:webSitePushId}),[2];case 2:return this.platformChecker.isAvailableServiceWorker?(this.driver=new PushService_1.PushServiceDefault(this.api,this.data,{}),[2]):[2]}})})},Pushwoosh.prototype.sendPostEventVisitedPage=function(){return __awaiter(this,void 0,void 0,function(){var title,href;return __generator(this,function(_a){return title=window.document.title,href=window.location.href,this.api.postEvent(CONSTANTS.EVENT_PW_SITE_OPENED,{url:href,title:title,device_type:this.platformChecker.platform}),[2]})})},Pushwoosh.prototype.subscribeToLegacyEvents=function(type,handler){var _this=this;switch(type){case CONSTANTS.EVENT_ON_LOAD:handler();break;case CONSTANTS.EVENT_ON_READY:if(this.ready){handler(this.api);break}this.eventBus.addEventHandler("ready",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_REGISTER:this.eventBus.addEventHandler("register",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_SUBSCRIBE:this.eventBus.addEventHandler("subscribe",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_UNSUBSCRIBE:this.eventBus.addEventHandler("unsubscribe",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_SW_INIT_ERROR:this.eventBus.addEventHandler("initialize-service-worker-error",function(_a){var error=_a.error;return handler(_this.api,error)});break;case CONSTANTS.EVENT_ON_PUSH_DELIVERY:this.eventBus.addEventHandler("receive-push",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.addEventHandler("open-notification",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.addEventHandler("hide-notification",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:this.eventBus.addEventHandler("change-enabled-communication",function(_a){var isEnabled=_a.isEnabled;return handler(_this.api,isEnabled)});break;case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.addEventHandler("receive-inbox-message",function(_a){var message=_a.message;return handler(_this.api,message)});break;case CONSTANTS.EVENT_ON_UPDATE_INBOX_MESSAGES:this.eventBus.addEventHandler("update-inbox-messages",function(_a){var messages=_a.messages;return handler(_this.api,messages)});break;case CONSTANTS.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("show-notification-permission-dialog",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("hide-notification-permission-dialog",function(_a){var permission=_a.permission;return handler(_this.api,permission)});break;case CONSTANTS.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("show-subscription-widget",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("hide-subscription-widget",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_DENIED:this.eventBus.addEventHandler("permission-denied",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_PROMPT:this.eventBus.addEventHandler("permission-default",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_GRANTED:this.eventBus.addEventHandler("permission-granted",function(){return handler(_this.api)})}},Pushwoosh.prototype.emitLegacyEventsFromServiceWorker=function(type,payload){switch(type){case CONSTANTS.EVENT_ON_PUSH_DELIVERY:this.eventBus.dispatchEvent("receive-push",{notification:payload});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.dispatchEvent("open-notification",{notification:payload});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.dispatchEvent("hide-notification",{notification:payload});break;case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.dispatchEvent("receive-inbox-message",{message:payload})}},Pushwoosh}();exports.default=Pushwoosh},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PushServiceDefault_1=__webpack_require__(23);Object.defineProperty(exports,"PushServiceDefault",{enumerable:!0,get:function(){return PushServiceDefault_1.PushServiceDefault}});var PushServiceSafari_1=__webpack_require__(34);Object.defineProperty(exports,"PushServiceSafari",{enumerable:!0,get:function(){return PushServiceSafari_1.PushServiceSafari}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushServiceSafari=void 0;var logger_1=__webpack_require__(4),CONSTANTS=__webpack_require__(0),PushServiceSafari=function(){function PushServiceSafari(api,data,config){this.api=api,this.config=config,this.data=data}return PushServiceSafari.prototype.getPermission=function(){return this.getPermissionInfo().permission},PushServiceSafari.prototype.checkIsPermissionGranted=function(){return this.getPermission()===CONSTANTS.PERMISSION_GRANTED},PushServiceSafari.prototype.checkIsPermissionDefault=function(){return this.getPermission()===CONSTANTS.PERMISSION_PROMPT},PushServiceSafari.prototype.checkIsManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusManualUnsubscribed()];case 1:return[2,_a.sent()]}})})},PushServiceSafari.prototype.askPermission=function(){return __awaiter(this,void 0,void 0,function(){var application,hwid,payload,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return application=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),payload={application:application,hwid:hwid},[2,new Promise(function(resolve){safari.pushNotification.requestPermission(_this.config.entrypoint||"https://cp.pushwoosh.com/json/1.3/safari",_this.config.webSitePushId,payload,function(){return resolve()})})]}})})},PushServiceSafari.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getTokens()]})})},PushServiceSafari.prototype.subscribe=function(){return __awaiter(this,void 0,void 0,function(){var deviceToken;return __generator(this,function(_a){switch(_a.label){case 0:return this.checkIsPermissionGranted()?[4,this.getPermissionInfo()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return deviceToken=_a.sent().deviceToken,[4,this.data.setTokens({pushToken:deviceToken})];case 2:return _a.sent(),[4,this.api.registerDevice()];case 3:return _a.sent(),[2]}})})},PushServiceSafari.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setTokens({})];case 1:return _a.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return _a.sent(),[4,this.api.unregisterDevice()];case 3:return _a.sent(),[2]}})})},PushServiceSafari.prototype.checkIsRegister=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},PushServiceSafari.prototype.checkIsNeedResubscribe=function(){return __awaiter(this,void 0,void 0,function(){var savedWebSitePushId,isChangeWebSitePushId,lastPermission,permission;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getWebSitePushId()];case 1:return savedWebSitePushId=_a.sent(),isChangeWebSitePushId=void 0!==savedWebSitePushId&&this.config.webSitePushId!==savedWebSitePushId,[4,this.data.setWebSitePushId(this.config.webSitePushId)];case 2:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 3:return lastPermission=_a.sent(),permission=this.getPermission(),lastPermission===permission?[3,5]:[4,this.data.setLastPermissionStatus(permission)];case 4:return _a.sent(),[2,!0];case 5:return[2,isChangeWebSitePushId]}})})},PushServiceSafari.prototype.getPermissionInfo=function(){return safari.pushNotification.permission(this.config.webSitePushId)},PushServiceSafari}();exports.PushServiceSafari=PushServiceSafari},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubscriptionPromptWidget=void 0;var SubscriptionPromptWidget_helpers_1=__webpack_require__(36),SubscriptionPromptWidget_constants_1=__webpack_require__(27),SubscriptionPromptWidget=function(){function SubscriptionPromptWidget(eventBus,pw){this.eventBus=eventBus,this.pw=pw}return SubscriptionPromptWidget.prototype.init=function(params){if(!this.getRootElement()){var html=SubscriptionPromptWidget_helpers_1.getHTML(params),styles=SubscriptionPromptWidget_helpers_1.getStyles(params);document.body.insertAdjacentHTML("beforeend",html),document.head.appendChild(styles)}this.addEventListeners()},SubscriptionPromptWidget.prototype.show=function(){var rootElement=this.getRootElementWithCheckExist();this.eventBus.dispatchEvent("show-subscription-widget",{}),rootElement.classList.add(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")},SubscriptionPromptWidget.prototype.hide=function(){var rootElement=this.getRootElementWithCheckExist();rootElement.classList.contains(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")&&(this.eventBus.dispatchEvent("hide-subscription-widget",{}),rootElement.classList.remove(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show"))},SubscriptionPromptWidget.prototype.getRootElement=function(){return document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-root")},SubscriptionPromptWidget.prototype.getRootElementWithCheckExist=function(){var element=this.getRootElement();if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root", please use method init first.');return element},SubscriptionPromptWidget.prototype.getDeclineButtonWithCheckExist=function(){var element=document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-decline");if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline", please use method init first.');return element},SubscriptionPromptWidget.prototype.getAcceptButtonWithCheckExist=function(){var element=document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-accept");if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept", please use method init first.');return element},SubscriptionPromptWidget.prototype.addEventListeners=function(){var _this=this,rootElement=this.getRootElementWithCheckExist(),declineElement=this.getDeclineButtonWithCheckExist(),acceptElement=this.getAcceptButtonWithCheckExist();document.addEventListener("click",function(event){rootElement.contains(event.target)||_this.hide()}),declineElement.addEventListener("click",function(){_this.hide()}),acceptElement.addEventListener("click",function(){_this.hide(),_this.pw.subscribe()})},SubscriptionPromptWidget}();exports.SubscriptionPromptWidget=SubscriptionPromptWidget},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStyles=exports.getHTML=void 0;var SubscriptionPromptWidget_constants_1=__webpack_require__(27);exports.getHTML=function(params){return'\n <div id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'">\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__body">\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__header">\n '+params.headerText+'\n </div>\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__description">\n '+params.subheaderText+'\n </div>\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__controls">\n <button type="button" id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control "+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__control_decline">\n '+params.buttonCancelText+'\n </button>\n <button type="button" id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control "+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__control_accept">\n '+params.buttonAcceptText+"\n </button>\n </div>\n </div>\n </div>\n "},exports.getStyles=function(params){var styles=document.createElement("style");return styles.innerHTML="\n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+" * {\n box-sizing: border-box!important;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+" {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 320px;\n display: none;\n z-index: 2147483648;\n opacity: 0.99;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show {\n display: block;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__body {\n width: 320px;\n background-color: "+(params.backgroundColor?params.backgroundColor:"#FFFFFF")+";\n box-shadow: 0 9px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n padding: 20px 20px 12px;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__header {\n color: "+params.headerTextColor+";\n font-size: 18px;\n font-weight: bold; \n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__description {\n color: "+params.subheaderTextColor+";\n font-size: 14px;\n line-height: 1.5;\n margin-top: 14px;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__description:empty {\n display: none;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-end;\n margin: 20px 0 0;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control {\n -webkit-appearance: none;\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n padding: 0 20px;\n height: 32px;\n cursor: pointer;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control_decline {\n color: "+params.buttonCancelTextColor+";\n background-color: "+params.buttonCancelBackgroundColor+";\n border-radius: "+params.buttonCancelRound+";\n border-color: "+params.buttonCancelBorderColor+";\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control_accept {\n color: "+params.buttonAcceptTextColor+";\n background-color: "+params.buttonAcceptBackgroundColor+";\n border-radius: "+params.buttonAcceptRound+";\n border-color: "+params.buttonAcceptBorderColor+";\n margin: 0 0 0 12px;\n }\n ",styles}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),functions_1=__webpack_require__(5),storage_1=__webpack_require__(1),FacebookModule=function(){function FacebookModule(config){this.userRef=functions_1.generateUUID(),this.config=config,this.init()}return FacebookModule.prototype.init=function(){this.renderCheckbox(),this.initFacebookSDK(),this.loadFacebookSDK()},FacebookModule.prototype.renderCheckbox=function(){for(var _a=this.config,pageId=_a.pageId,containerClass=_a.containerClass,attributes=[{name:"messenger_app_id",value:constants_1.FACEBOOK_APP_ID},{name:"class",value:"fb-messenger-checkbox"},{name:"page_id",value:pageId},{name:"origin",value:window.location.protocol+"//"+window.location.hostname},{name:"user_ref",value:this.userRef},{name:"allow_login",value:"true"},{name:"size",value:"large"},{name:"skin",value:"light"},{name:"center_align",value:"false"}],nodes=document.getElementsByClassName(containerClass),_loop_1=function(index){var node=document.createElement("div");attributes.forEach(function(attribute){node.setAttribute(attribute.name,attribute.value)}),nodes[index].appendChild(node)},index=0;index<nodes.length;index++)_loop_1(index)},FacebookModule.prototype.getHWID=function(){return __awaiter(this,void 0,void 0,function(){var hwid,applicationCode,newHWID;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.keyValue.get(constants_1.FACEBOOK_HWID_KEY)];case 1:return(hwid=_a.sent())?[3,3]:(applicationCode=this.config.applicationCode,newHWID=applicationCode+"_"+functions_1.generateUUID()+"_fb",[4,storage_1.keyValue.set(constants_1.FACEBOOK_HWID_KEY,newHWID)]);case 2:return _a.sent(),[2,newHWID];case 3:return[2,hwid]}})})},FacebookModule.prototype.userConfirm=function(){return __awaiter(this,void 0,void 0,function(){var _a,pageId,applicationCode,userId,FB,facebookHwid;return __generator(this,function(_b){switch(_b.label){case 0:return _a=this.config,pageId=_a.pageId,applicationCode=_a.applicationCode,userId=_a.userId,FB=window.FB,[4,this.getHWID()];case 1:return facebookHwid=_b.sent(),FB&&FB.AppEvents.logEvent("MessengerCheckboxUserConfirmation",null,{app_id:constants_1.FACEBOOK_APP_ID,page_id:pageId,ref:JSON.stringify({applicationCode:applicationCode,userId:userId,hwid:facebookHwid}),user_ref:this.userRef}),[2]}})})},FacebookModule.prototype.initFacebookSDK=function(){var _this=this;window.fbAsyncInit=function(){window.FB.init({appId:constants_1.FACEBOOK_APP_ID,xfbml:!0,version:"v3.2"}),window.FB.Event.subscribe("messenger_checkbox",function(_a){"checkbox"===_a.event&&_this.userConfirm()})}},FacebookModule.prototype.loadFacebookSDK=function(){var language=navigator.language||"en_US";!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];d.getElementById(id)||((js=d.createElement(s)).id=id,js.src="https://connect.facebook.net/"+language+"/sdk.js",fjs&&fjs.parentNode.insertBefore(js,fjs))}(document,"script","facebook-jssdk")},FacebookModule}();exports.default=FacebookModule},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),PlatformChecker_1=__webpack_require__(28),constants_2=__webpack_require__(30),positioning_1=__webpack_require__(39),bell_1=__webpack_require__(40),storage_1=__webpack_require__(1),SubscribeWidget=function(){function SubscribeWidget(pw){var _this=this;if(this.pw=pw,PlatformChecker_1.default.isAvailableNotifications){this.clickBell=this.clickBell.bind(this),this.onSubscribeEvent=this.onSubscribeEvent.bind(this),this.onUnsubscribeEvent=this.onUnsubscribeEvent.bind(this),this.onPermissionDeniedEvent=this.onPermissionDeniedEvent.bind(this),this.clickOutOfPopover=this.clickOutOfPopover.bind(this);var tooltipText=Object.assign(constants_2.SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText,pw.subscribeWidgetConfig.tooltipText);this.config=Object.assign({},constants_2.SUBSCRIBE_WIDGET_DEFAULT_CONFIG,pw.subscribeWidgetConfig),this.config.tooltipText=tooltipText,pw.isSubscribed().then(function(isSubscribed){isSubscribed||_this.render()})}else console.warn("Browser does not support push notifications")}return SubscribeWidget.prototype.addStylesToElement=function(styles,element){Object.keys(styles).forEach(function(st){element.style[st]=styles[st]})},SubscribeWidget.prototype.createContainer=function(){var container=document.createElement("div");container.id=constants_2.WIDGET_CONTAINER_ID,container.className="pushwoosh-subscribe-widget";var position=positioning_1.default.getBellPosition(this.config.position,this.config.indent),styles=Object.assign({zIndex:this.config.zIndex},position);return this.addStylesToElement(styles,container),container},SubscribeWidget.prototype.createStyle=function(){var styles=__webpack_require__(41),styleNode=document.createElement("style");return styleNode.innerHTML=styles,styleNode},SubscribeWidget.prototype.createBell=function(){var bell,config=this.config;return config.buttonImage?(bell=document.createElement("img")).src=config.buttonImage:(bell=document.createElement("div"),this.addStylesToElement({backgroundColor:config.bgColor,boxShadow:config.shadow,lineHeight:config.size,border:config.bellButtonBorder},bell),bell.innerHTML=bell_1.default(config.bellColor,config.bellStrokeColor)),this.addStylesToElement({width:config.size,height:config.size},bell),bell.className="pushwoosh-subscribe-widget__bell-button",bell},SubscribeWidget.prototype.createTooltip=function(){return __awaiter(this,void 0,void 0,function(){var tooltip,_a,position,modification,_b,_c;return __generator(this,function(_d){switch(_d.label){case 0:return tooltip=document.createElement("div"),_a=positioning_1.default.getTooltipPosition(this.config.position,this.config.size),position=_a[0],modification=_a[1],tooltip.className="pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__"+modification,this.addStylesToElement(position,tooltip),_c=(_b=tooltip).appendChild,[4,this.createTooltipContent()];case 1:return _c.apply(_b,[_d.sent()]),[2,tooltip]}})})},SubscribeWidget.prototype.createTooltipContent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return tooltipContent=document.createElement("div"),_a=tooltipContent,[4,this.tooltipTextFactory()];case 1:return _a.innerText=_b.sent(),tooltipContent.className="pushwoosh-subscribe-widget__tooltip-content",[2,tooltipContent]}})})},SubscribeWidget.prototype.tooltipTextFactory=function(){return __awaiter(this,void 0,void 0,function(){var permission,tooltipText,isManuallyUnsubscribed;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.pw.driver.getPermission()];case 1:return permission=_a.sent(),tooltipText=this.config.tooltipText,[4,storage_1.keyValue.get(constants_1.MANUAL_UNSUBSCRIBE)];case 2:switch(isManuallyUnsubscribed=_a.sent(),permission){case constants_1.PERMISSION_GRANTED:return[2,isManuallyUnsubscribed?tooltipText.needSubscribe:tooltipText.alreadySubscribed];case constants_1.PERMISSION_PROMPT:return[2,tooltipText.needSubscribe];case constants_1.PERMISSION_DENIED:return[2,tooltipText.blockSubscribe];default:return[2,tooltipText.needSubscribe]}return[2]}})})},SubscribeWidget.prototype.createPopover=function(){var popoverContentWrapper=document.createElement("div"),popover=document.createElement("div"),_a=positioning_1.default.getPopoverPosition(this.config.position,this.config.size),position=_a[0],modification=_a[1];popover.className="pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__"+modification,popoverContentWrapper.className="pushwoosh-subscribe-widget__popover-content-wrapper",this.style.innerHTML+=positioning_1.default.getPopoverArrowPosition(this.config.position,this.config.size);var styles=Object.assign({maxWidth:"calc(100vw - "+this.config.indent+" - "+this.config.indent+")"},position);return this.addStylesToElement(styles,popover),popoverContentWrapper.appendChild(this.createPopoverContent()),popover.appendChild(popoverContentWrapper),popover},SubscribeWidget.prototype.getBrowserName=function(){return PlatformChecker_1.default.isOpera?"opera":11===PlatformChecker_1.default.platform&&navigator.userAgent.match(/Android/i)?"mobileChrome":12===PlatformChecker_1.default.platform?"firefox":10===PlatformChecker_1.default.platform?"safari":150===PlatformChecker_1.default.platform?"edge":"chrome"},SubscribeWidget.prototype.createPopoverContent=function(){var config=this.config,popoverContent=document.createElement("div");popoverContent.className="pushwoosh-subscribe-widget__popover-content";var browser=this.getBrowserName(),userImageSrc=config.contentImages&&config.contentImages[browser];if(userImageSrc){var image=document.createElement("img");image.src=userImageSrc,popoverContent.appendChild(image)}else{var standardImage={opera:"opera",mobileChrome:"mobile_chrome",firefox:"FF",safari:"safari"}[browser]||"chrome";[{src:this.getImageSrc(standardImage),width:500,height:130},{src:this.getImageSrc(standardImage+"_unlock"),width:500,height:230}].forEach(function(imageAttrs){var image=document.createElement("img");Object.assign(image,imageAttrs),popoverContent.appendChild(image)})}return popoverContent},SubscribeWidget.prototype.getImageSrc=function(img){return"https://cdn.pushwoosh.com/webpush/img/"+img+".jpg"},SubscribeWidget.prototype.render=function(){return __awaiter(this,void 0,void 0,function(){var bell,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return this.widget=this.createContainer(),this.style=this.createStyle(),bell=this.createBell(),_a=this,[4,this.createTooltip()];case 1:return _a.tooltip=_c.sent(),_b=this,[4,this.createPopover()];case 2:return _b.popover=_c.sent(),this.widget.appendChild(this.style),this.widget.appendChild(bell),this.widget.appendChild(this.tooltip),this.widget.appendChild(this.popover),document.body.appendChild(this.widget),this.pw.push(["onSubscribe",this.onSubscribeEvent]),this.pw.push(["onUnsubscribe",this.onUnsubscribeEvent]),this.pw.push(["onPermissionDenied",this.onPermissionDeniedEvent]),this.addEventListeners(),[2]}})})},SubscribeWidget.prototype.addEventListeners=function(){this.widget.addEventListener("click",this.clickBell),window.addEventListener("click",this.clickOutOfPopover)},SubscribeWidget.prototype.toggleHelpPopover=function(){this.popover.classList.toggle("pushwoosh-subscribe-widget__popover__visible")},SubscribeWidget.prototype.clickBell=function(){return __awaiter(this,void 0,void 0,function(){var permission;return __generator(this,function(_b){switch(_b.label){case 0:switch(permission=this.pw.driver.getPermission(),permission){case constants_1.PERMISSION_GRANTED:return[3,1];case constants_1.PERMISSION_PROMPT:return[3,3];case constants_1.PERMISSION_DENIED:return[3,5]}return[3,6];case 1:return[4,this.pw.subscribe()];case 2:return _b.sent(),[3,7];case 3:return[4,this.pw.subscribe()];case 4:return _b.sent(),[3,7];case 5:return this.toggleHelpPopover(),[3,7];case 6:console.warn("Unknown browser notification permission"),_b.label=7;case 7:return[2]}})})},SubscribeWidget.prototype.onSubscribeEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_this=this;return __generator(this,function(_a){return null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(tooltipContent.innerText=this.config.tooltipText.successSubscribe,this.tooltip.classList.add("pushwoosh-subscribe-widget__tooltip__visible"),setTimeout(function(){return __awaiter(_this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return this.tooltip.classList.remove("pushwoosh-subscribe-widget__tooltip__visible"),_a=tooltipContent,[4,this.tooltipTextFactory()];case 1:return _a.innerText=_b.sent(),this.widget.classList.add("pushwoosh-subscribe-widget__subscribed"),[2]}})})},2e3),[2])})})},SubscribeWidget.prototype.onPermissionDeniedEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return this.addEventListeners(),null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(_a=tooltipContent,[4,this.tooltipTextFactory()]);case 1:return _a.innerText=_b.sent(),[2]}})})},SubscribeWidget.prototype.clickOutOfPopover=function(ev){this.popover.classList.contains("pushwoosh-subscribe-widget__popover__visible")&&!ev.target.classList.contains("pushwoosh-subscribe-widget__popover")&&null===ev.target.closest(".pushwoosh-subscribe-widget__popover")&&!ev.target.classList.contains("pushwoosh-subscribe-widget__bell-button")&&null===ev.target.closest(".pushwoosh-subscribe-widget__bell-button")&&this.popover.classList.remove("pushwoosh-subscribe-widget__popover__visible")},SubscribeWidget.prototype.onUnsubscribeEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(_a=tooltipContent,[4,this.tooltipTextFactory()]);case 1:return _a.innerText=_b.sent(),[2]}})})},SubscribeWidget}();document.addEventListener("pushwoosh.initialized",function(ev){ev.detail.pw.subscribeWidgetConfig.enable&&new SubscribeWidget(ev.detail.pw)})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(30),Positioning=function(){function Positioning(){}return Positioning.getBellPosition=function(position,indent){var positionStyles;switch(position){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={top:"auto",left:"auto",bottom:indent,right:indent};break;case constants_1.BELL_POSITION_BOTTOM_LEFT:positionStyles={top:"auto",left:indent,bottom:indent,right:"auto"};break;case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={top:indent,left:indent,bottom:"auto",right:"auto"};break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={top:indent,left:"auto",bottom:"auto",right:indent};break;default:positionStyles={top:"auto",left:"auto",bottom:indent,right:indent}}return positionStyles},Positioning.getTooltipPosition=function(bellPosition,bellSize){var positionStyles,tooltipModification,increaseIndent=parseInt(bellSize)+12+"px";switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={right:increaseIndent},tooltipModification="right";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={left:increaseIndent},tooltipModification="left";break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={right:increaseIndent},tooltipModification="right";break;default:positionStyles={right:increaseIndent},tooltipModification="right"}return[positionStyles,tooltipModification]},Positioning.getPopoverPosition=function(bellPosition,bellSize){var positionStyles,popoverModification,increaseIndent=parseInt(bellSize)+15+"px";switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={bottom:increaseIndent,right:"0",left:"auto",top:"auto"},popoverModification="bottom";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:positionStyles={bottom:increaseIndent,left:"0",right:"auto",top:"auto"},popoverModification="bottom";break;case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={top:increaseIndent,left:"0",right:"auto",bottom:"auto"},popoverModification="top";break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={top:increaseIndent,right:"0",left:"auto",bottom:"auto"},popoverModification="top";break;default:positionStyles={bottom:increaseIndent,right:"0",left:"auto",top:"auto"},popoverModification="bottom"}return[positionStyles,popoverModification]},Positioning.getPopoverArrowPosition=function(bellPosition,bellSize){var arrowAdditionalStyles;switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: "+(parseInt(bellSize)/2-12)+"px";break;case constants_1.BELL_POSITION_TOP_LEFT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: "+(parseInt(bellSize)/2-12)+"px";break;case constants_1.BELL_POSITION_TOP_RIGHT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px";break;default:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px"}return arrowAdditionalStyles},Positioning}();exports.default=Positioning},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(fillColor,strokeColor){return'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n id="Capa_1"\n x="0px"\n y="0px"\n viewBox="0 0 346.013 346.013"\n style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n xml:space="preserve"\n inkscape:version="0.91 r13725"\n sodipodi:docname="alarm_white.svg"><metadata\n id="metadata51"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs49" /><sodipodi:namedview\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1618"\n inkscape:window-height="828"\n id="namedview47"\n showgrid="false"\n inkscape:zoom="0.6820553"\n inkscape:cx="173.0065"\n inkscape:cy="173.0065"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="0"\n inkscape:current-layer="g3" /><g\n id="g3"><path\n d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n id="path5"\n inkscape:connector-curvature="0"\n vector-effect="non-scaling-stroke"\n style="fill:'+fillColor+"; stroke: "+strokeColor+'; stroke-width: 1; " /><path\n vector-effect="non-scaling-stroke"\n d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n id="path7"\n inkscape:connector-curvature="0"\n style="fill:'+fillColor+"; stroke: "+strokeColor+'; stroke-width: 1;" /></g><g\n id="g17" /><g\n id="g19" /><g\n id="g21" /><g\n id="g23" /><g\n id="g25" /><g\n id="g27" /><g\n id="g29" /><g\n id="g31" /><g\n id="g33" /><g\n id="g35" /><g\n id="g37" /><g\n id="g39" /><g\n id="g41" /><g\n id="g43" /><g\n id="g45" /></svg>'}},function(module,exports,__webpack_require__){var result=__webpack_require__(42);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(43)(void 0)).push([module.i,'/* Widget */\n.pushwoosh-subscribe-widget {\n position: fixed;\n display: block;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n}\n\n.pushwoosh-subscribe-widget__subscribed {\n display: none;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {\n -webkit-border-radius: 50%;\n border-radius: 50%;\n cursor: pointer;\n font-size: 0;\n text-align: center;\n -webkit-transform: scale(0.9) translate3d(0, 0, 0);\n transform: scale(0.9) translate3d(0, 0, 0);\n -webkit-transition: -webkit-transform .3s ease-in-out;\n transition: -webkit-transform .3s ease-in-out;\n -o-transition: transform .3s ease-in-out;\n transition: transform .3s ease-in-out;\n transition: transform .3s ease-in-out, -webkit-transform .3s ease-in-out;\n position: relative;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n}\n\n/* Tooltip */\n.pushwoosh-subscribe-widget__tooltip {\n position: absolute;\n height: 48px;\n max-width: 300px;\n min-width: 200px;\n padding: 5px 7px;\n background-color: #3b444b;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n line-height: 38px;\n font-size: 0;\n font-weight: normal;\n visibility: hidden;\n opacity: 0;\n -webkit-transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n -o-transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n top: 50%;\n -webkit-transform: translate(0, -50%);\n -ms-transform: translate(0, -50%);\n transform: translate(0, -50%);\n -webkit-box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after,\n.pushwoosh-subscribe-widget__tooltip__left:after {\n content: "";\n top: 50%;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n background: #3b444b;\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after {\n left: calc(100% - 7px);\n border-top: 5px solid #3b444b;\n border-left: 5px solid #3b444b;\n border-right: 5px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__tooltip__left:after {\n left: -7px;\n border-top: 5px solid #3b444b;\n border-right: 5px solid #3b444b;\n border-left: 5px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,\n.pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n -webkit-transition-delay: 0s;\n -o-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {\n display: inline-block;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1.4;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 5px;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n/* Popover */\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {\n position: absolute;\n right: auto;\n -webkit-box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background: #9ca8b1;\n visibility: hidden;\n opacity: 0;\n -webkit-transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n -o-transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n -webkit-transition-delay: 0s;\n -o-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after,\n.pushwoosh-subscribe-widget__popover__top:after {\n content: "";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-right: 8px solid transparent;\n border-left: 8px solid #9ca8b1;\n background: #9ca8b1;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after {\n border-bottom: 8px solid #9ca8b1;\n border-top: 8px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n bottom: -16px;\n}\n\n.pushwoosh-subscribe-widget__popover__top:after {\n top: 0;\n border-top: 8px solid #9ca8b1;\n border-bottom: 8px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__popover-content-wrapper {\n overflow: auto;\n max-width: 100%;\n}\n\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n padding: 14px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n float: left;\n min-width: 100%;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n display: block;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-bottom: 14px;\n}\n\n@media (max-width: 767px) and (orientation: portrait) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 0;\n margin-bottom: 14px;\n }\n}\n@media (max-width: 767px) and (orientation: landscape) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 14px;\n margin-bottom: 0;\n }\n}\n',""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var pwInboxWidget=__webpack_require__(45);document.addEventListener("pushwoosh.initialized",function(ev){ev.detail.pw.pwinbox&&ev.detail.pw.inboxWidgetConfig.enable&&(ev.detail.pw.pwinboxWidget=new pwInboxWidget.PWInboxWidget(ev.detail.pw))})},function(module,exports,__webpack_require__){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(1);exports.isElementFixed=function isElementFixed(element){var isFixed="fixed"===window.getComputedStyle(element).position;return!isFixed&&element.parentElement&&(isFixed=isElementFixed(element.parentElement)),isFixed},exports.getGlobal=function(){return globalThis},exports.getMessageTime=function(date){var localDate=new Date(date),localTime=localDate.getHours()+localDate.getTimezoneOffset()/60;localDate.setHours(localTime);var gap=(new Date).getTime()-localDate.getTime();return gap<=6e4?"Just now":gap<constants_1.MILLISECONDS_IN_HOUR&&gap>0?Math.floor(gap/6e4)+" minutes ago":gap<constants_1.MILLISECONDS_IN_DAY&&gap>0?Math.floor(gap/36e5)+" hours ago":localDate.getDate()+" "+constants_1.MONTHS[localDate.getMonth()]+" "+localDate.getFullYear()+", "+localDate.getHours()+":"+("0"+localDate.getMinutes().toString()).slice(-2)},exports.getValidColor=function(color){return"transparent"===color?color:constants_1.COLOR_TEST_REGEXP.test(color)?color:"#333"},exports.compareBySendDate=function(dateOne,dateTwo){var localDateOne=new Date(dateOne),localTimeOne=localDateOne.getHours()+localDateOne.getTimezoneOffset()/60,localDateTwo=new Date(dateTwo),localTimeTwo=localDateTwo.getHours()+localDateTwo.getTimezoneOffset()/60;return localDateOne.setHours(localTimeOne),localDateTwo.setHours(localTimeTwo),localDateTwo.getTime()-localDateOne.getTime()}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MILLISECONDS_IN_DAY=864e5,exports.MILLISECONDS_IN_HOUR=36e5,exports.MONTHS=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],exports.CONFIG_STYLES=[{name:"widgetWidth",type:"size"},{name:"borderRadius",type:"size"},{name:"zIndex",type:"number"},{name:"fontFamily",type:"string"},{name:"bgColor",type:"color"},{name:"textColor",type:"color"},{name:"arrowBorderColor",type:"color"},{name:"borderColor",type:"color"},{name:"badgeBgColor",type:"color"},{name:"badgeTextColor",type:"color"},{name:"timeTextColor",type:"color"},{name:"messageTitleColor",type:"color"},{name:"emptyInboxTitleColor",type:"color"},{name:"emptyInboxTextColor",type:"color"}],exports.DEFAULT_CONFIG={enable:!1,triggerId:"pwInbox",position:"bottom",appendTo:"body",title:"Inbox",bgColor:"#ffffff",textColor:"#333333",fontFamily:"inherit",borderRadius:4,borderColor:"transparent",badgeBgColor:"#ff4c00",badgeTextColor:"#ffffff",widgetWidth:350,zIndex:100,messageTitleColor:"#7a7a7a",timeTextColor:"#c4c4c4",emptyInboxTitle:"You're all caught up",emptyInboxTitleColor:"#333333",emptyInboxText:"There are no new messages. Stay tuned!",emptyInboxTextColor:"#7a7a7a",emptyInboxIconUrl:"https://pushon.pushwoosh.com/images/icon-empty-inbox.png",arrowBorderColor:"rgba(0,0,0,.1)"},exports.COLOR_TEST_REGEXP=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var InboxWidget_1=__webpack_require__(3);exports.PWInboxWidget=InboxWidget_1.default},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t};Object.defineProperty(exports,"__esModule",{value:!0});var widgetTemplates_1=__webpack_require__(4),constants_1=__webpack_require__(1),helpers_1=__webpack_require__(0),InboxWidget=function(){function InboxWidget(pw){this.pw=pw,this.config=__assign({},constants_1.DEFAULT_CONFIG,{arrowBorderColor:this.pw.inboxWidgetConfig.borderColor&&"transparent"!==this.pw.inboxWidgetConfig.borderColor?this.pw.inboxWidgetConfig.borderColor:"rgba(0,0,0,.1)"},this.pw.inboxWidgetConfig),this.updateInbox=this.updateInbox.bind(this),this.markVisibleItemsAsRead=this.markVisibleItemsAsRead.bind(this),this.onWidgetClickHandler=this.onWidgetClickHandler.bind(this),this.onTriggerClickHandler=this.onTriggerClickHandler.bind(this),this.onWindowScrollHandler=this.onWindowScrollHandler.bind(this),this.toggle=this.toggle.bind(this);try{this.initTrigger(),this.updateInbox(),this.addListeners()}catch(err){console.warn(err)}}return InboxWidget.prototype.toggle=function(isOpened){(void 0===isOpened?!this.isOpened:isOpened)?this.openWidget():this.closeWidget()},InboxWidget.prototype.initTrigger=function(){if(!this.pw.pwinbox)throw new Error("Web inbox is not allowed.");var trigger=document.getElementById(this.config.triggerId);if(!trigger)throw new Error("Inbox trigger element doesn't exist. You must set triggerId in inboxWidget config. See the documentation.");this.trigger=trigger,this.trigger.classList.add("pw-inbox-trigger"),this.defaultMargin=12,this.messagesElements={},this.messages=[],this.readItems=[],this.updateCounter(0),this.isOpened=!1,this.renderWidget(),this.isFixed=helpers_1.isElementFixed(this.trigger)},InboxWidget.prototype.renderWidget=function(){this.widget=document.createElement("div"),this.widget.id="pwInboxWidget",this.widget.className="pw-inbox-widget",this.widget.classList.toggle("pw-open",this.isOpened),this.widgetParent=document.querySelector(this.config.appendTo)||document.body,this.widgetParent.appendChild(this.widget),this.widgetParent.appendChild(this.getStyle()),this.renderWidgetInner()},InboxWidget.prototype.getStyle=function(){var styles=__webpack_require__(5),styleNode=document.createElement("style");return styleNode.innerHTML=this.configureStyle(styles),styleNode},InboxWidget.prototype.configureStyle=function(styles){var _this=this,resultStyles=styles.toString();return constants_1.CONFIG_STYLES.forEach(function(style){var template=new RegExp("var\\(--"+style.name+"\\)","ig"),result=_this.getStyleFormatter(style);resultStyles=resultStyles.replace(template,result)}),resultStyles},InboxWidget.prototype.getStyleFormatter=function(style){switch(style.type){case"size":return(this.config[style.name]||0)+"px";case"number":return parseFloat(this.config[style.name].toString()).toString();case"string":return this.config[style.name].toString();case"color":return helpers_1.getValidColor(this.config[style.name].toString());default:return"none"}},InboxWidget.prototype.renderWidgetInner=function(){if(this.messages.length>0)this.widget.classList.remove("pw-inbox-widget--empty"),this.widget.innerHTML=widgetTemplates_1.widgetTemplate(this.config.title),this.renderMessages();else{this.widget.classList.add("pw-inbox-widget--empty");var _a=this.config,emptyInboxTitle=_a.emptyInboxTitle,emptyInboxText=_a.emptyInboxText,emptyInboxIconUrl=_a.emptyInboxIconUrl;this.widget.innerHTML=widgetTemplates_1.widgetTemplateEmpty(emptyInboxIconUrl,emptyInboxTitle,emptyInboxText)}},InboxWidget.prototype.renderMessages=function(){var _this=this;this.list=this.widget.querySelector(".pw-inbox_list")||document.createElement("ul"),this.messages.forEach(function(message){var messageElement=document.createElement("li");messageElement.className="pw-inbox_item",messageElement.classList.toggle("pw-new",!message.isRead),messageElement.classList.toggle("pw-unread",!message.isActionPerformed),messageElement.setAttribute("data-pw-inbox-message-id",message.code),messageElement.innerHTML=widgetTemplates_1.messageTemplate(message),_this.list.appendChild(messageElement),_this.messagesElements[message.code]=messageElement})},InboxWidget.prototype.updateCounter=function(count){this.count=count,this.trigger.setAttribute("data-pw-count",""+this.count),this.trigger.classList.toggle("pw-empty",0===this.count)},InboxWidget.prototype.updateInboxMessages=function(messages){this.messages=messages.sort(function(_a,_b){var sendDateOne=_a.sendDate,sendDateTwo=_b.sendDate;return helpers_1.compareBySendDate(sendDateOne,sendDateTwo)}),this.renderWidgetInner()},InboxWidget.prototype.openWidget=function(){this.isOpened=!0,this.widget.classList.add("pw-open"),document.addEventListener("click",this.onWidgetClickHandler),window.addEventListener("scroll",this.onWindowScrollHandler),window.addEventListener("resize",this.onWindowScrollHandler),this.markVisibleItemsAsRead(),this.messages.length>0&&this.list.addEventListener("scroll",this.markVisibleItemsAsRead),this.positionWidget()},InboxWidget.prototype.closeWidget=function(){this.isOpened=!1,document.removeEventListener("click",this.onWidgetClickHandler),document.removeEventListener("click",this.onWindowScrollHandler),window.removeEventListener("resize",this.onWindowScrollHandler),this.updateReadStatus(),this.messages.length>0&&this.list.removeEventListener("scroll",this.markVisibleItemsAsRead),this.widget.classList.remove("pw-open","pw-top","pw-bottom","pw-right","pw-left"),this.widget.removeAttribute("style")},InboxWidget.prototype.positionWidget=function(){this.isOpened&&(this.widgetParent===document.body?this.defaultPlaceWidget():this.customPlaceWidget())},InboxWidget.prototype.customPlaceWidget=function(){var position=this.config.position;this.widgetParent.style.position="relative",this.widget.classList.add("pw-inbox-widget--inset"),this.widget.classList.add("pw-"+position)},InboxWidget.prototype.defaultPlaceWidget=function(){var position=this.pw.inboxWidgetConfig.position?this.config.position:this.getDefaultPosition(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);switch(widgetRect.width+2*this.defaultMargin>windowWidth&&(this.widget.style.width=windowWidth-2*this.defaultMargin+"px"),widgetRect.height+24>windowHeight&&(this.widget.style.height=windowHeight-2*this.defaultMargin+"px"),position){case"top":this.alignWidgetTop();break;case"right":this.alignWidgetRight();break;case"left":this.alignWidgetLeft();break;case"bottom":this.alignWidgetBottom()}}},InboxWidget.prototype.alignWidgetTop=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-top");var left=pageXOffset+triggerRect.left+Math.floor(triggerRect.width/2)-Math.floor(widgetRect.width/2),isUnderLeft=left<pageXOffset,isUnderRight=left+widgetRect.width>pageXOffset+windowWidth;isUnderLeft&&(left=pageXOffset+this.defaultMargin),isUnderRight&&(left=pageXOffset+windowWidth-widgetRect.width-this.defaultMargin);var top=pageYOffset+triggerRect.top-widgetRect.height;this.alignWidgetElement(left,top),arrow.style.left=triggerRect.left+Math.floor(triggerRect.width/2)-left+"px";var topMargin=this.widget.getBoundingClientRect().top;if(topMargin<0){var newHeight=this.widget.getBoundingClientRect().height+topMargin-this.defaultMargin,newTop=this.widget.getBoundingClientRect().top-topMargin+this.defaultMargin;this.widget.style.height=newHeight+"px",this.widget.style.top=newTop+"px"}}},InboxWidget.prototype.alignWidgetRight=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-right");var top=pageYOffset+triggerRect.top+Math.floor(triggerRect.height/2)-Math.floor(widgetRect.height/2),isUnderTop=top<pageYOffset,isUnderBottom=pageYOffset+windowHeight<top+widgetRect.height;isUnderTop&&(top=pageYOffset+this.defaultMargin),isUnderBottom&&(top=pageYOffset+windowHeight-widgetRect.height-this.defaultMargin);var left=pageXOffset+triggerRect.left+triggerRect.width;this.alignWidgetElement(left,top),arrow.style.top=triggerRect.top+Math.floor(triggerRect.height/2)-top+"px";var rightMargin=windowWidth-this.widget.getBoundingClientRect().right;if(rightMargin<this.defaultMargin){var newWidth=this.widget.getBoundingClientRect().width+rightMargin-this.defaultMargin;this.widget.style.width=newWidth+"px"}}},InboxWidget.prototype.alignWidgetLeft=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-left");var top=pageYOffset+triggerRect.top+Math.floor(triggerRect.height/2)-Math.floor(widgetRect.height/2),isUnderTop=top<pageYOffset,isUnderBottom=pageYOffset+windowHeight<top+widgetRect.height;isUnderTop&&(top=pageYOffset+this.defaultMargin),isUnderBottom&&(top=pageYOffset+windowHeight-widgetRect.height-this.defaultMargin);var left=pageXOffset+triggerRect.left-widgetRect.width;this.alignWidgetElement(left,top),arrow.style.top=triggerRect.top+Math.floor(triggerRect.height/2)-top+"px";var leftMargin=this.widget.getBoundingClientRect().left;if(leftMargin<0){var newWidth=this.widget.getBoundingClientRect().width+leftMargin-this.defaultMargin,newLeft=this.widget.getBoundingClientRect().left-leftMargin;this.widget.style.width=newWidth+"px",this.widget.style.left=newLeft+"px"}}},InboxWidget.prototype.alignWidgetBottom=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-bottom");var left=pageXOffset+triggerRect.left+Math.floor(triggerRect.width/2)-Math.floor(widgetRect.width/2),isUnderLeft=left<pageXOffset,isUnderRight=left+widgetRect.width>pageXOffset+windowWidth;isUnderLeft&&(left=pageXOffset+this.defaultMargin),isUnderRight&&(left=pageXOffset+windowWidth-widgetRect.width-12);var top=pageYOffset+triggerRect.top+triggerRect.height;this.alignWidgetElement(left,top),arrow.style.left=triggerRect.left+Math.floor(triggerRect.width/2)-left+"px";var bottomRange=windowHeight-this.widget.getBoundingClientRect().bottom;if(bottomRange<this.defaultMargin){var newHeight=this.widget.getBoundingClientRect().height+bottomRange-this.defaultMargin;this.widget.style.height=newHeight+"px"}}},InboxWidget.prototype.alignWidgetElement=function(left,top){this.widget.style.left=left+"px",this.widget.style.top=top+"px"},InboxWidget.prototype.getDefaultPosition=function(){var _a=this.trigger.getBoundingClientRect(),left=_a.left,top=_a.top,width=_a.width,height=_a.height;if(!document.documentElement)return"";var antiMargins={right:left,bottom:top,left:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-(left+width),top:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(top+height)},leastMargin=Math.min(left,top,antiMargins.left,antiMargins.top),position="bottom";return Object.keys(antiMargins).forEach(function(key){antiMargins[key]===leastMargin&&(position=key)}),position},InboxWidget.prototype.addListeners=function(){var _this=this;this.trigger.addEventListener("click",this.onTriggerClickHandler),this.pw.push(["onPutNewMessageToInboxStore",function(){_this.updateInbox()}]),this.pw.push(["onUpdateInboxMessages",function(){_this.updateInbox()}])},InboxWidget.prototype.markVisibleItemsAsRead=function(){var _this=this;if(0!==this.messages.length){var scrollTop=this.list.clientHeight+this.list.scrollTop-50;Object.keys(this.messagesElements).forEach(function(code){if(_this.messagesElements[code]&&!(_this.messagesElements[code].offsetTop>scrollTop)){var message=_this.messages.find(function(message){return message.code===code});!message||message.isRead||_this.readItems.indexOf(code)+1||_this.readItems.push(code)}})}},InboxWidget.prototype.updateReadStatus=function(){this.pw.pwinbox.readMessagesWithCodes(this.readItems).then(this.updateInbox)},InboxWidget.prototype.updateInbox=function(){var _this=this;this.pw.pwinbox.loadMessages().then(function(messages){_this.updateInboxMessages(messages)}),this.pw.pwinbox.unreadMessagesCount().then(function(count){_this.updateCounter(count)})},InboxWidget.prototype.performMessageAction=function(code){var _this=this;this.pw.pwinbox.performActionForMessageWithCode(code).then(function(){_this.updateInbox()})},InboxWidget.prototype.removeMessages=function(messages){var _this=this;messages.forEach(function(code){_this.readItems=_this.readItems.slice(_this.readItems.indexOf(code),1)}),this.pw.pwinbox.deleteMessagesWithCodes(messages).then(function(){_this.updateInbox()})},InboxWidget.prototype.onTriggerClickHandler=function(event){event.stopPropagation(),event.target&&this.toggle()},InboxWidget.prototype.onWidgetClickHandler=function(event){if(event.target){var itemElement=event.target.closest(".pw-inbox_item");if(itemElement){var messageCode=itemElement.getAttribute("data-pw-inbox-message-id");messageCode&&(event.target.closest(".pw-inbox_item-remove")?this.removeMessages([messageCode]):this.performMessageAction(messageCode))}else this.toggle()}},InboxWidget.prototype.onWindowScrollHandler=function(){this.isFixed&&this.isOpened?this.toggle():this.positionWidget()},InboxWidget}();exports.default=InboxWidget},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(0);exports.widgetTemplate=function(title){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_inner">\n <div class="pw-inbox_title">\n '+title+'\n </div>\n <ul class="pw-inbox_list">\n \n </ul>\n</div>'},exports.widgetTemplateEmpty=function(emptyInboxIconUrl,emptyInboxTitle,emptyInboxText){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_list--empty">\n <div class="pw-inbox_list-icon">\n <img src="'+emptyInboxIconUrl+'" alt="'+emptyInboxTitle+'">\n </div>\n <div class="pw-inbox_list-title">\n '+emptyInboxTitle+'\n </div>\n <div class="ipw-inbox_list-body">\n '+emptyInboxText+"\n </div>\n</div>"},exports.messageTemplate=function(_a){var imageUrl=_a.imageUrl,title=_a.title,message=_a.message,sendDate=_a.sendDate;return'\n<div class="pw-inbox_item-inner">\n <div class="pw-inbox_icon">\n <img src="'+imageUrl+'" alt="'+(title||message)+'" class="pw-inbox_message-image">\n </div>\n <div class="pw-inbox_content">\n '+(title?'<div class="pw-inbox_item-title">\n '+title+"\n </div>":null)+'\n <div class="pw-inbox_item-body">\n '+message+'\n </div>\n <div class="pw-inbox_item-time">\n '+helpers_1.getMessageTime(sendDate)+'\n </div>\n </div>\n</div>\n<span class="pw-inbox_item-remove"></span>'}},function(module,exports,__webpack_require__){var result=__webpack_require__(6);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(7)(void 0)).push([module.i,".pw-inbox-trigger {\n position: relative;\n cursor: pointer;\n}\n\n.pw-inbox-trigger:after {\n content: attr(data-pw-count);\n display: block;\n position: absolute;\n right: 0;\n top: 0;\n background: var(--badgeBgColor);\n -webkit-border-radius: 8px;\n border-radius: 8px;\n color: var(--badgeTextColor);\n font-size: 10px;\n font-weight: normal;\n line-height: 16px;\n width: 16px;\n padding: 0 2px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n text-align: center;\n}\n\n.pw-inbox-trigger.pw-empty:after {\n display: none;\n}\n\n.pw-inbox-widget * {\n position: static;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: 1em;\n outline: none;\n font-family: var(--fontFamily);\n}\n.pw-inbox-widget {\n font-size: 14px;\n position: absolute;\n top: 0;\n left: -1000px;\n background: var(--bgColor);\n border: solid 1px var(--borderColor);\n -webkit-border-radius: var(--borderRadius);\n border-radius: var(--borderRadius);\n width: var(--widgetWidth);\n -webkit-box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n z-index: var(--zIndex);\n opacity: 0;\n -webkit-transition: opacity .6s ease;\n -o-transition: opacity .6s ease;\n transition: opacity .6s ease;\n -webkit-transition-delay: 100ms;\n -o-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.pw-inbox-widget.pw-open {\n opacity: 1;\n -webkit-transition-delay: 0ms;\n -o-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.pw-inbox-widget.pw-inbox-widget--inset {\n top: auto;\n left: auto;\n display: none;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-open {\n display: block;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-bottom {\n top: 100%;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-top {\n bottom: 100%;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-right {\n left: 100%;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-left {\n right: 100%;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--empty {\n max-height: none;\n}\n.pw-inbox-widget .pw-inbox__arrow {\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget .pw-inbox__arrow:before {\n content: \"\";\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget.pw-top {\n margin-top: -12px;\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow {\n border-top-color: var(--arrowBorderColor);\n bottom: -21px;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow:before {\n border-top-color: var(--bgColor);\n top: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-bottom {\n margin-top: 12px;\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow {\n border-bottom-color: var(--arrowBorderColor);\n top: -21px;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow:before {\n border-bottom-color: var(--bgColor);\n bottom: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-left {\n margin-left: -12px;\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow {\n border-left-color: var(--arrowBorderColor);\n right: -21px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow:before {\n border-left-color: var(--bgColor);\n left: -11px;\n top: -10px;\n}\n.pw-inbox-widget.pw-right {\n margin-left: 12px;\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow {\n border-right-color: var(--arrowBorderColor);\n left: -21px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow:before {\n border-right-color: var(--bgColor);\n right: -11px;\n top: -10px;\n}\n.pw-inbox_inner {\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n height: 100%;\n}\n.pw-inbox_title {\n color: var(--textColor);\n margin: 0;\n padding: 28px 32px 12px;\n font-size: 24px;\n font-weight: 500;\n line-height: 1.1;\n text-align: left;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 66px;\n flex: 0 0 66px;\n}\n.pw-inbox_list {\n overflow-x: hidden;\n overflow-y: auto;\n min-width: 200px;\n max-height: 300px;\n padding: 0;\n margin: 0;\n list-style: none;\n position: relative;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n\n.pw-inbox_item {\n position: relative;\n padding: 8px 32px;\n margin: 0;\n text-align: left;\n}\n.pw-inbox_item-inner {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n cursor: pointer;\n}\n.pw-inbox_icon {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 40px;\n flex: 0 0 40px;\n}\n.pw-inbox_message-image {\n width: 28px;\n}\n.pw-inbox_content {\n -webkit-box-flex: 0;\n -ms-flex: 0 1 100%;\n flex: 0 1 100%;\n}\n.pw-inbox_item-title {\n color: var(--messageTitleColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-body {\n color: var(--textColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-time {\n color: var(--timeTextColor);\n font-size: 12px;\n line-height: 17px;\n}\n.pw-inbox_item-remove {\n position: absolute;\n z-index: 2;\n top: 8px;\n right: 8px;\n display: none;\n width: 10px;\n height: 10px;\n background: transparent url('https://cdn.pushwoosh.com/webpush/img/iconClose.svg') 50% no-repeat;\n cursor: pointer;\n}\n.pw-inbox_item:hover .pw-inbox_item-remove {\n display: block;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-title {\n color: var(--textColor);\n font-weight: 700;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-body {\n font-weight: 700;\n}\n\n.pw-inbox_list--empty {\n padding: 50px 16px;\n text-align: center;\n max-height: 100%;\n overflow: auto;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-icon {\n text-align: center;\n margin-bottom: 30px;\n}\n.pw-inbox_list--empty .pw-inbox_list-icon img {\n max-width: 100%;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-title {\n font-size: 28px;\n line-height: 36px;\n color: var(--emptyInboxTitleColor);\n margin-bottom: 20px;\n}\n\n.pw-inbox_list--empty .ipw-inbox_list-body {\n font-size: 14px;\n line-height: 18px;\n color: var(--emptyInboxTextColor);\n}\n",""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}}])},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var web_push_subscribe_popup_1=__webpack_require__(47);document.addEventListener("pushwoosh.initialized",function(ev){if(ev.detail.pw.subscribePopupConfig&&ev.detail.pw.subscribePopupConfig.enable){var popup_1=new web_push_subscribe_popup_1.PWSubscribePopup(ev.detail.pw);popup_1.initPopup().then(function(){ev.detail.pw.subscribePopup=popup_1})}})},function(module,exports,__webpack_require__){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=1)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONFIG={text:"Don’t miss out on our news and updates! Enable push notifications",askLaterButtonText:"Not now",confirmSubscriptionButtonText:"Subscribe",delay:60,retryOffset:604800,overlay:!1,position:"top",bgColor:"#fff",borderColor:"transparent",boxShadow:"0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)",textColor:"#000",textSize:"inherit",fontFamily:"inherit",subscribeBtnBgColor:"#4285f4",subscribeBtnTextColor:"#fff",askLaterBtnBgColor:"transparent",askLaterBtnTextColor:"#000",theme:"material",viewport:"html"},exports.COLOR_TEST_REGEXP=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/,exports.PERMISSION_DENIED="denied",exports.PERMISSION_GRANTED="granted",exports.CONFIG_STYLES=[{name:"bgColor",type:"color"},{name:"borderColor",type:"color"},{name:"boxShadow",type:"string"},{name:"textColor",type:"color"},{name:"textSize",type:"string"},{name:"fontFamily",type:"string"},{name:"subscribeBtnBgColor",type:"color"},{name:"subscribeBtnTextColor",type:"color"},{name:"askLaterBtnBgColor",type:"color"},{name:"askLaterBtnTextColor",type:"color"}]},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var SubscribePopup_1=__webpack_require__(2);exports.PWSubscribePopup=SubscribePopup_1.default},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),popupTemplates_1=__webpack_require__(3),constants_2=__webpack_require__(0),helpers_1=__webpack_require__(4),SubscribePopup=function(){function SubscribePopup(pw){this.pw=pw,this.config=__assign({},constants_1.DEFAULT_CONFIG,this.pw.subscribePopupConfig),this.onAskLaterClick=this.onAskLaterClick.bind(this),this.onSubscribeClick=this.onSubscribeClick.bind(this)}return SubscribePopup.prototype.initPopup=function(){return __awaiter(this,void 0,void 0,function(){var isSubscribed,isManualUnsubscribed,permission,lastPopupOpen,lastPopupOpenTime,now,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.pw.isSubscribed()];case 1:return isSubscribed=_a.sent(),[4,this.pw.data.getStatusManualUnsubscribed()];case 2:return isManualUnsubscribed=_a.sent(),isSubscribed||isManualUnsubscribed?[2]:[4,this.pw.driver.getPermission()];case 3:return(permission=_a.sent())===constants_2.PERMISSION_GRANTED||permission===constants_2.PERMISSION_DENIED?[2]:(this.renderPopup(),this.appendStyles(),lastPopupOpen=localStorage.getItem("LAST_OPEN_SUBSCRIPTION_POPUP"),lastPopupOpenTime=lastPopupOpen?parseInt(lastPopupOpen):0,now=(new Date).getTime(),lastPopupOpenTime+1e3*this.config.retryOffset<now&&setTimeout(function(){_this.toggle(!0)},1e3*this.config.delay),[2])}})})},SubscribePopup.prototype.toggle=function(isShown){("boolean"==typeof isShown?isShown:!this.isShown)?(this.showPopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-show",{})):(this.closePopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-hide",{}))},SubscribePopup.prototype.showPopup=function(){this.isShown=!0,this.popup.classList.add("pw-show"),document.body.classList.add("pw-popup-opened");var event=new CustomEvent("showPopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});if(this.popup.dispatchEvent(event),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var _a=this.config,theme=_a.theme,viewport=_a.viewport,position=_a.position;if("topbar"===theme&&"top"===position){var viewportElement=document.querySelector(viewport)||document.createElement("div"),currentMarginTop=window.getComputedStyle(viewportElement).marginTop||"0";viewportElement.style.transition="margin-top .3s ease-out",viewportElement.style.marginTop=parseInt(currentMarginTop)+this.popup.getBoundingClientRect().height+"px"}}},SubscribePopup.prototype.closePopup=function(){this.isShown=!1,this.popup.classList.remove("pw-show"),document.body.classList.remove("pw-popup-opened");var event=new CustomEvent("hidePopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});this.popup.dispatchEvent(event);var now=(new Date).getTime().toString();if(localStorage.setItem("LAST_OPEN_SUBSCRIPTION_POPUP",now),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var _a=this.config,theme=_a.theme,viewport=_a.viewport,position=_a.position;if("topbar"===theme&&"top"===position){var viewportElement=document.querySelector(viewport)||document.createElement("div"),currentMarginTop=window.getComputedStyle(viewportElement).marginTop||"0";viewportElement.style.marginTop=parseInt(currentMarginTop)-this.popup.getBoundingClientRect().height+"px"}}},SubscribePopup.prototype.renderPopup=function(){this.popup=document.createElement("div"),this.popup.id="pwSubscribePopup";var _a=this.config,text=_a.text,askLaterButtonText=_a.askLaterButtonText,confirmSubscriptionButtonText=_a.confirmSubscriptionButtonText,iconUrl=_a.iconUrl,position=_a.position,overlay=_a.overlay,theme=_a.theme;this.popup.className="pw-subscribe-popup pw-position-"+position+" pw-subscribe-popup-"+theme,this.popup.classList.toggle("pw-subscribe-popup__overlay",overlay),this.popup.innerHTML=popupTemplates_1.innerTemplate({text:text,askLaterButtonText:askLaterButtonText,confirmSubscriptionButtonText:confirmSubscriptionButtonText,iconUrl:iconUrl}),document.body.appendChild(this.popup),this.addListeners()},SubscribePopup.prototype.appendStyles=function(){var styles=__webpack_require__(5),style=document.createElement("style");style.innerHTML=this.configureStyle(styles),document.body.appendChild(style)},SubscribePopup.prototype.getStyleFormatter=function(style){switch(style.type){case"size":return(this.config[style.name]||0)+"px";case"number":return parseFloat(this.config[style.name].toString()).toString();case"string":return this.config[style.name].toString();case"color":return helpers_1.getValidColor(this.config[style.name].toString());default:return"none"}},SubscribePopup.prototype.configureStyle=function(styles){var _this=this,resultStyles=styles.toString();return constants_1.CONFIG_STYLES.forEach(function(style){var template=new RegExp("var\\(--"+style.name+"\\)","ig"),result=_this.getStyleFormatter(style);resultStyles=resultStyles.replace(template,result)}),resultStyles},SubscribePopup.prototype.addListeners=function(){var askLaterButton=this.popup.querySelector('button[name="pwAskLater"]')||document.createElement("button"),subscribeButton=this.popup.querySelector('button[name="pwSubscribe"]')||document.createElement("button");askLaterButton.addEventListener("click",this.onAskLaterClick),subscribeButton.addEventListener("click",this.onSubscribeClick)},SubscribePopup.prototype.onAskLaterClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-decline",{})},SubscribePopup.prototype.onSubscribeClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-accept",{}),this.pw.subscribe()},SubscribePopup}();exports.default=SubscribePopup},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerTemplate=function(_a){var iconUrl=_a.iconUrl,text=_a.text,askLaterButtonText=_a.askLaterButtonText,confirmSubscriptionButtonText=_a.confirmSubscriptionButtonText;return'<div class="pw-subscription-popup-inner">\n <div class="pw-subscription-popup-content">\n '+(iconUrl?'<div class="pw-subscription-popup-icon">\n <img src="'+iconUrl+'">\n </div>':"")+'\n <div class="pw-subscription-popup-text">\n '+text+'\n </div>\n </div>\n <div class="pw-subscription-popup-controls">\n <button name="pwSubscribe" class="pw-subscribe-popup-button pw-subscribe-popup-button-active">'+confirmSubscriptionButtonText+'</button>\n <button name="pwAskLater" class="pw-subscribe-popup-button">'+askLaterButtonText+"</button>\n </div>\n </div>"}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0);exports.getValidColor=function(color){return"transparent"===color?color:constants_1.COLOR_TEST_REGEXP.test(color)?color:"#333"},exports.getGlobal=function(){return globalThis}},function(module,exports,__webpack_require__){var result=__webpack_require__(6);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(7)(void 0)).push([module.i,".pw-subscribe-popup {\n position: fixed;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n z-index: 1000000;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-transition: all .4s ease-out;\n -o-transition: all .4s ease-out;\n transition: all .4s ease-out;\n}\n\n.pw-subscribe-popup.pw-position-top {\n top: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-top.pw-show {\n top: 0;\n}\n\n.pw-subscribe-popup.pw-position-bottom {\n bottom: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-bottom.pw-show {\n bottom: 0;\n}\n\n.pw-subscribe-popup.pw-position-center {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n -webkit-transform: none;\n\n -ms-transform: none;\n\n transform: none;\n}\n\n.pw-subscribe-popup__overlay {\n background: rgba(0,0,0,.4);\n z-index: 1000000;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-subscribe-popup__overlay) {\n pointer-events: none;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-show) {\n display: none;\n}\n\n\n.pw-subscribe-popup__overlay.pw-position-top {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n.pw-subscribe-popup__overlay.pw-position-bottom {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n\n.pw-subscribe-popup__overlay.pw-position-center {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.pw-subscription-popup-inner {\n max-width: 400px;\n font-size: var(--textSize);\n color: var(--textColor);\n font-family: var(--fontFamily);\n border-style: solid;\n border-width: 1px;\n border-color: var(--borderColor);\n background: var(--bgColor);\n -webkit-box-shadow: var(--boxShadow);\n box-shadow: var(--boxShadow);\n pointer-events: auto;\n}\n\n.pw-subscription-popup-content {\n padding: 16px 16px 4px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: stretch;\n -ms-flex-pack: stretch;\n justify-content: stretch;\n}\n\n.pw-subscription-popup-icon {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 50px;\n flex: 0 0 50px;\n margin-right: 12px;\n padding-top: 4px;\n}\n\n.pw-subscription-popup-icon img {\n max-width: 60px;\n max-height: 60px;\n}\n\n.pw-subscription-popup-text {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 300px;\n flex: 1 1 300px;\n}\n\n.pw-subscription-popup-controls {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n padding: 8px 16px 16px;\n}\n\nbutton.pw-subscribe-popup-button {\n border: solid 1px transparent;\n -webkit-border-radius: 2px;\n border-radius: 2px;\n display: inline-block;\n height: 36px;\n line-height: 36px;\n padding: 0 16px;\n text-transform: uppercase;\n vertical-align: middle;\n -webkit-tap-highlight-color: transparent;\n font-size: 14px;\n outline: 0;\n text-decoration: none;\n color: var(--askLaterBtnTextColor);\n text-align: center;\n letter-spacing: .5px;\n cursor: pointer;\n background: var(--askLaterBtnBgColor);\n margin: 4px 8px;\n}\nbutton.pw-subscribe-popup-button:hover {\n background: rgba(0,0,0,.04);\n}\nbutton.pw-subscribe-popup-button:active {\n background: rgba(0,0,0,.12);\n}\n\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active {\n color: var(--subscribeBtnTextColor);\n background: var(--subscribeBtnBgColor);\n -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:hover {\n -webkit-box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:active {\n -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n}\n\n@media screen and (min-width: 541px) {\n\n .pw-subscribe-popup-topbar {\n width: 100%;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n padding: 2px 40px;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-content {\n padding: 0;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 60%;\n flex: 1 1 60%;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-icon img {\n max-width: 28px;\n max-height: 28px;\n }\n\n .pw-subscribe-popup-topbar button.pw-subscribe-popup-button {\n height: 32px;\n line-height: 32px;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-controls {\n padding: 0 0 0 16px;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n}\n@media screen and (max-width: 540px) {\n .pw-subscribe-popup,\n .pw-subscribe-popup.pw-position-top,\n .pw-subscribe-popup.pw-position-center,\n .pw-subscribe-popup.pw-position-bottom {\n top: auto;\n bottom: -110%;\n left: 0;\n right: 0;\n -webkit-transform: none;\n -ms-transform: none;\n transform: none;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-transition: bottom .4s ease-out;\n -o-transition: bottom .4s ease-out;\n transition: bottom .4s ease-out;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-subscribe-popup__overlay {\n height: 100%;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-show {\n bottom: 0;\n }\n\n .pw-subscribe-popup__overlay .pw-subscription-popup-inner {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n -webkit-box-pack: stretch;\n -ms-flex-pack: stretch;\n justify-content: stretch;\n }\n\n .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n }\n}\n",""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}}])}])});