"use strict";(self.webpackChunkbongacams=self.webpackChunkbongacams||[]).push([[576,795],{16279:function(t,n,e){e.d(n,{LC:function(){return r},gO:function(){return o},lr:function(){return i}});var i=5e3,o=5e3,r=1e4},63410:function(t,n,e){e.d(n,{Ou:function(){return u},V2:function(){return r},zw:function(){return o}});var i=e(15215);function o(t,n){return{onlineNotifications:(0,i.fX)((0,i.fX)([],t.onlineNotifications||[],!0),[n],!1)}}function r(t,n){var e,i=[];return n&&(null===(e=t.onlineNotifications)||void 0===e||e.forEach(function(t){t.username!==n&&i.push(t)})),{onlineNotifications:i}}function u(t,n){var e;return{onlineNotificationSettings:(0,i.Cl)((0,i.Cl)({},t.onlineNotificationSettings),(e={},e[n.username]=n.isSubscribed,e))}}},29575:function(t,n,e){e.d(n,{T:function(){return f},l:function(){return c}});var i=e(63410),o=e(99525),r=e(67374),u=e(63861),a=e(96831),s=e(8556),c=function(t,n){return new Promise(function(e,i){if((0,s.isTokenInBodyClassList)("fullscreen"))i(new Error("Not Allowed for fullscreen mod"));else{if(!("#buy_tokens"===location.hash||[(0,u.ip)("@member_buy_invisibility"),(0,u.ip)("@member_buy_tokens"),(0,u.ip)("@member_buy_vip")].includes(location.pathname)))return n?(null==t?void 0:t.find(function(t){return t.username===n}))?void i(new Error("Not Allowed for ".concat(n,". User exits in queue"))):void r.I_.getInstance().checkAndSaveAllowing(n).then(function(t){e(t)}).catch(function(t){return new Error("Not Allowed by NotificationsSettings->checkAndSaveAllowing")}):void e(!0);i(new Error('Not Allowed for this page: "'.concat(location.href,'".')))}})},f=function(t){var n=(0,a.p)();if(n)if("visible"===n.document.visibilityState){var e=o.A.getState().onlineNotifications;c(e,t.username).then(function(n){n&&o.A.action(i.zw)(t)}).catch(function(t){return!1})}else n.document.addEventListener("visibilitychange",function(){f(t)},{once:!0})}},67374:function(t,n,e){e.d(n,{I_:function(){return l},qu:function(){return i},bk:function(){return s},xc:function(){return a}});var i={maxDelay:6e5,retries:1/0},o=e(15215),r=e(41669),u=[],a=function(t){r.noticeSocket&&t&&u.indexOf(t)>=0&&(u=u.filter(function(n){return n!==t}),r.noticeSocket.send({data:{data:{model:t},type:2},type:"cms"}))},s=function(t){(0,o.fX)([],u,!0).map(function(t){return a(t)}),function(t){r.noticeSocket&&t&&u.indexOf(t)<0&&(u.push(t),r.noticeSocket.send({data:{data:{model:t},type:1},type:"cms"}))}(t)},c=e(99525),f=e(26859),l=function(){function t(){var n=c.A.getState().isAuthenticated;this.isAuthenticated=n,this.idb=new f.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 n,e,i,r,u;return(0,o.YH)(this,function(o){switch(o.label){case 0:return t?this.isAvailable()?(n=this.getUnmuteKey(),[4,this.getData(n)]):[2,!0]:[2,!1];case 1:return e=o.sent()||{},i=e[t],(r=!i||Date.now()>=i)?(u=c.A.getState().config,e[t]=Date.now()+(null==u?void 0:u.notificationsMutePeriod),[4,this.setData(n,e)]):[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(n){switch(n.label){case 0:return this.isAvailable()?(t=this.getUnmuteKey(),[4,this.removeData(t)]):[2];case 1:return n.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(n){switch(n.label){case 0:return[4,this.getData("isAuth")];case 1:return t=n.sent(),!this.isAuthenticated||t?[3,3]:[4,this.setData("isAuth",!0)];case 2:return n.sent(),[3,5];case 3:return this.isAuthenticated||!t?[3,5]:[4,this.removeData("isAuth")];case 4:n.sent(),n.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(n){switch(n.label){case 0:return[4,this.setData("token",t)];case 1:return n.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(n){switch(n.label){case 0:return this.isAvailable()?(t=c.A.getState().config,[4,this.setData("mutePeriod",null==t?void 0:t.notificationsMutePeriod)]):[3,2];case 1:n.sent(),n.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(n){switch(n.label){case 0:return[4,this.idb.open()];case 1:return n.sent(),[2,this.idb.getItem(t)]}})})},t.prototype.setData=function(t,n){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.setItem(t,n)];case 2:return e.sent(),[2]}})})},t.prototype.removeData=function(t){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.removeItem(t)];case 2:return n.sent(),[2]}})})},t.prototype.getUnmuteKey=function(){var n=c.A.getState().user;return"".concat("um_").concat((null==n?void 0:n.username)||t.guestName)},t.dbName="notificationSettings",t.guestName="guest",t}()},15430:function(t,n,e){e.r(n),e.d(n,{pushNotificationHandler:function(){return a}});var i=e(99525),o=e(16279),r=e(29575),u=e(96831),a=function(t){var n,e=null===(n=t.data)||void 0===n?void 0:n.type,a=(0,u.p)();if("onlineNotification"===e){var s=i.A.getState().isAuthenticated,c=t.data,f=c.displayName,l=c.icon,d=c.streamUrl,h=c.username;if(s||!h||!f||!a)return;var v={avatarUrl:l,displayName:f,streamUrl:d,username:h};a.window.setTimeout(function(){(0,r.T)(v)},o.LC)}}}}]);