"use strict";(self.webpackChunkbongacams=self.webpackChunkbongacams||[]).push([[524,523],{96575:function(t,e,n){n.d(e,{R:function(){return o}});var i=n(44198);function o(t,e){(0,i._b)("BCC bcAppDispatch").warn(t,{payload:e}),"function"==typeof window.bcAppDispatch&&window.bcAppDispatch(t,e)}Object.prototype.hasOwnProperty.call(window,"legacyAppDispatch")||(window.legacyAppDispatch=function(t,e){(0,i._b)("BCC legacyAppDispatch").warn(t,{payload:e}),document.dispatchEvent(new CustomEvent(t,{detail:e}))})},79797:function(t,e,n){n.r(e),n.d(e,{init:function(){return b}});var i=n(15215),o=n(99525),r=n(80554),c=n(81714),a=function(t){if("function"==typeof Event)return new Event(t);var e=document.createEvent("Event");return e.initEvent(t,!0,!0),e},s=n(67374),u=n(63861),h=n(96575),f=n(3050),d=n(31313),p=n(41669),l=function(){return Promise.all([n.e(6),n.e(38),n.e(5),n.e(32),n.e(10),n.e(7),n.e(579),n.e(252),n.e(424),n.e(175),n.e(87),n.e(130),n.e(93),n.e(137),n.e(220),n.e(281),n.e(98)]).then(n.bind(n,6883))},v=function(){return n.e(251).then(n.bind(n,44327))};function b(){var t=o.A.getState(),e=t.noticeData,n=t.user,b=t.isAuthenticated,m=t.isMobile,g=t.isModerator,y=n.role===c.A.ROLE_MODEL;if(null==e?void 0:e.token){var w=new d.xd((0,u.ip)("@ws_notification"),(0,i.Cl)({plugins:[(0,d.IW)({data:m?(0,i.Cl)((0,i.Cl)({},e),{is_mobile:1}):e,type:"identify"},function(t){return"open"===t.type}),d.vJ],reconnect:!0},y?s.qu:{}));w.on(d.oR.ON_OPEN,function(){p(document).trigger("onNoticeSocketOpen")}),w.on(d.oR.ON_MESSAGE,function(t){(0,f.w)(r.R.SOCKET_NOTIFICATION_MESSAGE,t),p(document).trigger("onNoticeSocketMessage",[t]),b&&(l().then(function(e){e.handleSocketCommon(t)}),g&&v().then(function(e){e.handleSocketAdmin(t)})),"user"===t.type&&(0,h.R)("@@SocketUserEvent",t.data)}),p.noticeSocket=w,document.dispatchEvent(a("onNoticeSocketReady"))}}},67374:function(t,e,n){n.d(e,{I_:function(){return f},qu:function(){return i},bk:function(){return s},xc:function(){return a}});var i={maxDelay:6e5,retries:1/0},o=n(15215),r=n(41669),c=[],a=function(t){r.noticeSocket&&t&&c.indexOf(t)>=0&&(c=c.filter(function(e){return e!==t}),r.noticeSocket.send({data:{data:{model:t},type:2},type:"cms"}))},s=function(t){(0,o.fX)([],c,!0).map(function(t){return a(t)}),function(t){r.noticeSocket&&t&&c.indexOf(t)<0&&(c.push(t),r.noticeSocket.send({data:{data:{model:t},type:1},type:"cms"}))}(t)},u=n(99525),h=n(26859),f=function(){function t(){var e=u.A.getState().isAuthenticated;this.isAuthenticated=e,this.idb=new h.bp(t.dbName)}return t.getInstance=function(){return t.instance||(t.instance=new this),t.instance},t.prototype.isAvailable=function(){return this.idb.isAvailable()},t.prototype.checkAndSaveAllowing=function(t){return(0,o.sH)(this,void 0,void 0,function(){var e,n,i,r,c;return(0,o.YH)(this,function(o){switch(o.label){case 0:return t?this.isAvailable()?(e=this.getUnmuteKey(),[4,this.getData(e)]):[2,!0]:[2,!1];case 1:return n=o.sent()||{},i=n[t],(r=!i||Date.now()>=i)?(c=u.A.getState().config,n[t]=Date.now()+(null==c?void 0:c.notificationsMutePeriod),[4,this.setData(e,n)]):[3,3];case 2:o.sent(),o.label=3;case 3:return[2,r]}})})},t.prototype.clearNotificationMuteData=function(){return(0,o.sH)(this,void 0,void 0,function(){var t;return(0,o.YH)(this,function(e){switch(e.label){case 0:return this.isAvailable()?(t=this.getUnmuteKey(),[4,this.removeData(t)]):[2];case 1:return e.sent(),[2]}})})},t.prototype.getNotificationMuteData=function(){},t.prototype.checkIsAuth=function(){return(0,o.sH)(this,void 0,void 0,function(){var t;return(0,o.YH)(this,function(e){switch(e.label){case 0:return[4,this.getData("isAuth")];case 1:return t=e.sent(),!this.isAuthenticated||t?[3,3]:[4,this.setData("isAuth",!0)];case 2:return e.sent(),[3,5];case 3:return this.isAuthenticated||!t?[3,5]:[4,this.removeData("isAuth")];case 4:e.sent(),e.label=5;case 5:return[2]}})})},t.prototype.getToken=function(){return this.getData("token")},t.prototype.saveToken=function(t){return(0,o.sH)(this,void 0,void 0,function(){return(0,o.YH)(this,function(e){switch(e.label){case 0:return[4,this.setData("token",t)];case 1:return e.sent(),[2]}})})},t.prototype.removeToken=function(){return(0,o.sH)(this,void 0,void 0,function(){return(0,o.YH)(this,function(t){switch(t.label){case 0:return[4,this.removeData("token")];case 1:return t.sent(),[2]}})})},t.prototype.updateConfig=function(){return(0,o.sH)(this,void 0,void 0,function(){var t;return(0,o.YH)(this,function(e){switch(e.label){case 0:return this.isAvailable()?(t=u.A.getState().config,[4,this.setData("mutePeriod",null==t?void 0:t.notificationsMutePeriod)]):[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},t.prototype.getData=function(t){return(0,o.sH)(this,void 0,void 0,function(){return(0,o.YH)(this,function(e){switch(e.label){case 0:return[4,this.idb.open()];case 1:return e.sent(),[2,this.idb.getItem(t)]}})})},t.prototype.setData=function(t,e){return(0,o.sH)(this,void 0,void 0,function(){return(0,o.YH)(this,function(n){switch(n.label){case 0:return[4,this.idb.open()];case 1:return n.sent(),[4,this.idb.setItem(t,e)];case 2:return n.sent(),[2]}})})},t.prototype.removeData=function(t){return(0,o.sH)(this,void 0,void 0,function(){return(0,o.YH)(this,function(e){switch(e.label){case 0:return[4,this.idb.open()];case 1:return e.sent(),[4,this.idb.removeItem(t)];case 2:return e.sent(),[2]}})})},t.prototype.getUnmuteKey=function(){var e=u.A.getState().user;return"".concat("um_").concat((null==e?void 0:e.username)||t.guestName)},t.dbName="notificationSettings",t.guestName="guest",t}()}}]);