"use strict";(self.webpackChunkbongacams=self.webpackChunkbongacams||[]).push([[130],{46964:function(t,e,n){n.d(e,{SW:function(){return i},XH:function(){return a},g8:function(){return s},v:function(){return r},wJ:function(){return o}});var i=function(t,e){t&&(t.onerror=function(t){"string"!=typeof t&&t.target&&e&&(console.log("Error: ",t.target.src),t.target.src=e||"")})},s=function(t){return"notification_image_".concat(t)},o=function(t){return"notification_video_".concat(t)},r=function(t){return t?document.getElementById(s(t)):null},a=function(t){return t?document.getElementById(o(t)):null}},16279:function(t,e,n){n.d(e,{LC:function(){return o},gO:function(){return s},lr:function(){return i}});var i=5e3,s=5e3,o=1e4},21355:function(t,e,n){n.d(e,{Mn:function(){return h},So:function(){return u},cQ:function(){return f},ku:function(){return l}});var i=n(2268),s=n(99525),o=n(41669),r={};function a(t,e,n){var i=t.find(".js-fw_hint"),s=n&&i.data("hint_extra")||i.data("hint".concat(e||n?"_active":""));i.html(s),t.toggleClass("__active",e),t.toggleClass("__extra",n),t.addClass("__anim_click"),t.addClass("__no_hint"),t.one("transitionend WebkitTransitionEnd",function(){return t.removeClass("__anim_click")}),t.off("mouseleave.noHintAfterClick").one("mouseleave.noHintAfterClick",function(){return t.removeClass("__no_hint")})}function c(t,e){void 0===e&&(e=!1);var n=t.closest(".js-fw_wrap_mp");n.addClass("__anim_click"),n.addClass("__no_hint"),n.parent().one("transitionend WebkitTransitionEnd",function(){return n.removeClass("__anim_click")}),n.off("mouseleave.noHintAfterClick").one("mouseleave.noHintAfterClick",function(){return n.removeClass("__no_hint")}),clearTimeout(r[e?"mp_nb":"mp_fw"]),r[e?"mp_nb":"mp_fw"]=window.setTimeout(function(){return n.removeClass("__no_hint")},2e3)}var u=function(t,e,n,s){if(void 0===n&&(n=!1),void 0===s&&(s=!1),o(".js-flw_follow").toggleClass("__hidden",s||t),o(".js-flw_followed").toggleClass("__hidden",s||!t),o(".js-flw_unrequested").toggleClass("__hidden",!s),e.hasClass("__disabled")?e.remove():(a(e,t,s),clearTimeout(r.fw),r.fw=window.setTimeout(function(){return e.removeClass("__no_hint")},2e3)),n){var c=o(".js-flwr_cnt"),u=+c.data("count")+(t?1:-1);c.data("count",u),c.html("".concat(u," ").concat(i.kX.pluralise("followers",u)))}t||l(e.closest(".js-follow_wrp").find(".js-ntf_btn"),t)},l=function(t,e){if(s.A.getState().isAuthenticated&&e){var n=t.closest(".js-follow_wrp").find(".js-fw_btn");u(!0,n)}a(t,e,!1),clearTimeout(r.nb),r.nb=window.setTimeout(function(){return t.removeClass("__no_hint")},2e3)},h=function(t,e){var n=t.siblings(".js-flw_mp_btn.__notify"),i=t.hasClass("mp_notify")?[t,n]:[n,t],s=i[0],r=i[1];if(c(t,!0),e){s.hide(),r.show();var a=o(".js-flw_mp_btn.__follow:visible");t.hasClass("mp_notify")&&!a.hasClass("mp_is_following")&&f(a)}else s.show(),r.hide()},f=function(t){(c(t),t.hasClass("__disabled"))?t.closest(".js-fw_wrap_mp").remove():(t.hide(),t.siblings(".js-flw_mp_btn").show());var e=o(".js-flw_mp_btn.__notify:visible");t.hasClass("mp_is_following")&&e.hasClass("mp_is_notified")&&h(e,!1)}},85424:function(t,e,n){n.r(e),n.d(e,{NotificationWidget:function(){return m},init:function(){return w}});var i=n(15215),s=n(63410),o=n(99525),r=n(5985),a=n(46964),c=n(7715),u=n(67374),l=n(1292),h=n(63861),f=n(63065),d=n(17914),b=n(99128),p=n(88526),v=n(16279),_=n(21355),g=n(41669),m=function(){function t(){var t=this;this.hlsPluginMap={},this.isHlsSupported=!1,this.handleChangeOnlineNotification=function(e){var n=e.onlineNotifications;(null==n?void 0:n.length)&&(n.forEach(function(e){var n={avatarUrl:e.avatarUrl,displayName:e.displayName,streamUrl:e.streamUrl,username:e.username};t.showNotification(n)}),o.A.dispatch(s.V2)())},this.handleChangeNotificationSettings=function(t,e){var n,i,s=(0,c.d)().username;if(s){var o=null===(n=e.onlineNotificationSettings)||void 0===n?void 0:n[s],r=null===(i=t.onlineNotificationSettings)||void 0===i?void 0:i[s];if(void 0===o&&void 0!==r||o!==r){var a=g(".js-ntf_btn");a.length&&(0,_.ku)(a,Boolean(r));var u=g(".js-flw_mp_btn.__notify").filter(":visible");u.length&&(0,_.Mn)(u,Boolean(r))}}},this.showNotification=function(e){var i=e.avatarUrl,s=e.displayName,o=e.streamUrl,r=e.username;Promise.all([n.e(415).then(n.bind(n,34897)),n.e(133).then(n.bind(n,1424)),n.e(501).then(n.bind(n,56760))]).then(function(n){var c=n[0],u=n[1],l=n[2],h=c.default,f=u.default.NotificationOnline,p=l.default.NotificationOnlineClose,_=function(){var t=(0,a.v)(s);null==t||t.classList.remove("__filled"),null==t||t.classList.remove("__blurred")};new h({className:"bc_online_notification_wrp",close:b.w.renderToString(p({})),html:b.w.renderToString(f(e)),onBeforeComplete:function(){return new Promise(function(e){var n=(0,a.XH)(s);if(n&&o){i&&(n.poster=i);var c=(0,a.v)(s);c&&(c.classList.add("__filled"),c.classList.add("__blurred"),(0,a.SW)(c,i)),n.muted=!0,t.isHlsSupported?(n.src=o||"",n.play(),n.addEventListener("error",_),e(!0)):d.A.loadPlugin().then(function(){t.hlsPluginMap[r]=new d.A({selectorToAttach:"#".concat((0,a.wJ)(s)),source:o,onFatalErrorDetach:function(){var e=(0,a.XH)(s);null==e||e.classList.add("__hidden"),_(),delete t.hlsPluginMap[r]},onPlay:function(){e(!0)}},{capLevelToPlayerSize:!0,debug:!1}),setTimeout(function(){e(!0)},v.gO)}).catch(function(t){e(!0)})}else e(!0)})},onClick:function(){location.href="/".concat(r)},onClosed:function(){var e,n=(0,a.XH)(s);null==n||n.removeEventListener("error",_),null===(e=t.hlsPluginMap[r])||void 0===e||e.destroyHls(),delete t.hlsPluginMap[r]}},v.lr)})}}return t.checkSubscription=function(e){return(0,i.sH)(this,void 0,void 0,function(){var n,s,r,a,c,u;return(0,i.YH)(this,function(i){switch(i.label){case 0:if(!t.pushNotificationInstance)return t.instantCheckSubscriptionFor.push(e),[2];if(n=o.A.getState().isAuthenticated,s=t.pushNotificationInstance.getToken(),r=!1,n||!t.pushNotificationInstance.isAvailable()||!s)return[2];a=(0,f.o)(e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,new Promise(function(t,e){g.ajax({data:(0,p.Z)({hash:s}),dataType:"json",error:e,success:function(n){n&&n.success||e(),r=Boolean(n.is_subscribed),t()},type:"POST",url:(0,h.ip)("@is_subscribed_on_online_push_notification?username=".concat(a))})})];case 2:return i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return c=g('.js-ntf_btn[data-username="'.concat(a,'"]')),(0,_.ku)(c,r),u=g('#profile-part[data-id="'.concat(e,'"]')).find(".js-flw_mp_btn.mp_notify"),(0,_.Mn)(u,r),[2]}})})},t.prototype.init=function(){return(0,i.sH)(this,void 0,void 0,function(){var e,n,s;return(0,i.YH)(this,function(i){switch(i.label){case 0:return this.isHlsSupported=d.A.isSupported(),r.c.on("onlineNotifications",this.handleChangeOnlineNotification),r.c.on("onlineNotificationSettings",this.handleChangeNotificationSettings),e=t,[4,l.k.getInstance()];case 1:return e.pushNotificationInstance=i.sent(),(n=g(".js-ntf_btn")).length&&t.instantCheckSubscriptionFor.push(n.data("username")),s=[],t.instantCheckSubscriptionFor.forEach(function(e){e&&s.push(t.checkSubscription(e))}),t.instantCheckSubscriptionFor=[],[4,Promise.all(s)];case 2:return i.sent(),[4,u.I_.getInstance().updateConfig()];case 3:return i.sent(),[2]}})})},t.prototype.rebind=function(){return this},t.instantCheckSubscriptionFor=[],t}();function w(){return(new m).init()}},7715:function(t,e,n){n.d(e,{d:function(){return o}});var i=n(80181),s=n(41669);function o(t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);var n=e?{}:(0,i.json_parse)(s("#wallProfileStateData").text())||{};return!t||!n||n.gender&&n.username||console.error("Invalid Profile State Data",n),n}},17914:function(t,e,n){var i=n(84435),s=function(){function t(t,e){var n=this;this.hls=null,this.options={},this.mediaRecoverCounter=0,this.mediaAttachedHandler=function(t,e){n.options.attachedElement=e.media,n.options.source&&n.loadSource(n.options.source)},this.manifestParsedHandler=function(t,e){n.playHls()},this.errorHandler=function(t,e){var i,s,o;if(e.fatal){if(n.mediaRecoverCounter<10&&[Hls.ErrorDetails.MANIFEST_LOAD_ERROR,Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT].includes(e.details))return n.mediaRecoverCounter+=1,void(null===(i=n.hls)||void 0===i||i.recoverMediaError());null===(o=(s=n.options).onFatalErrorDetach)||void 0===o||o.call(s),n.destroyHls()}switch(e.type){case Hls.ErrorTypes.MEDIA_ERROR:case Hls.ErrorTypes.NETWORK_ERROR:break;default:n.destroyHls()}},this.levelLoadedHandler=function(t,e){var i;e.details.fragments.length<3&&(null===(i=n.hls)||void 0===i||i.once(Hls.Events.LEVEL_LOADED,function(t,e){var i;e.details.fragments.length>=3&&(null===(i=n.hls)||void 0===i||i.recoverMediaError())}))},this.destroyingHandler=function(){n.reset()},this.playHls=function(){var t;null===(t=n.options.attachedElement)||void 0===t||t.play().then(function(){var t,e;null===(e=(t=n.options).onPlay)||void 0===e||e.call(t)}).catch(function(t){var e,i;null===(i=(e=n.options).onPlay)||void 0===i||i.call(e,t)})},this.attachMedia=function(t){var e,i="elementToAttach"in t?t.elementToAttach:document.querySelector(t.selectorToAttach);null===(e=n.hls)||void 0===e||e.attachMedia(i)};var i=t.source,s=t.onFatalErrorDetach,o=t.onPlay;this.hls=new Hls(e),this.attachEventHandlers(),this.attachMedia(t),this.options.source=i,this.options.onFatalErrorDetach=s,this.options.onPlay=o}return t.isSupported=function(){var t=document.createElement("video"),e=t.canPlayType("application/vnd.apple.mpegURL")||t.canPlayType("audio/mpegurl");return t.remove(),Boolean(e)},t.available=function(){return!i.BrowserDetect.isSafari_MacOS()&&!i.BrowserDetect.isIOS()&&(!(i.BrowserDetect.isChrome_Android()&&!i.BrowserDetect.isChrome_MinVersion(56))&&!i.BrowserDetect.isOldWindows())},t.prototype.attachEventHandlers=function(){this.hls&&(this.hls.on(Hls.Events.MANIFEST_PARSED,this.manifestParsedHandler),this.hls.on(Hls.Events.MEDIA_ATTACHED,this.mediaAttachedHandler),this.hls.on(Hls.Events.LEVEL_LOADED,this.levelLoadedHandler),this.hls.on(Hls.Events.ERROR,this.errorHandler),this.hls.once(Hls.Events.DESTROYING,this.destroyingHandler))},t.prototype.detachEventHandlers=function(){this.hls&&(this.hls.off(Hls.Events.MEDIA_ATTACHED,this.mediaAttachedHandler),this.hls.off(Hls.Events.MANIFEST_PARSED,this.manifestParsedHandler),this.hls.off(Hls.Events.LEVEL_LOADED,this.levelLoadedHandler),this.hls.off(Hls.Events.ERROR,this.errorHandler))},t.prototype.reset=function(){this.detachEventHandlers(),this.hls=null,this.options={}},t.prototype.loadSource=function(t){var e;null===(e=this.hls)||void 0===e||e.loadSource(t)},t.prototype.destroyHls=function(){this.hls&&(this.hls.detachMedia(),this.hls.destroy())},t.loadPlugin=function(e){return new Promise(function(i,s){t.available()||e?n.e(577).then(n.t.bind(n,6693,23)).then(function(){i(!0)}).catch(function(){s(new Error("Unable to load hls.js plugin"))}):s(new Error("hls.js plugin not available"))})},t}();e.A=s},63410:function(t,e,n){n.d(e,{Ou:function(){return r},V2:function(){return o},zw:function(){return s}});var i=n(15215);function s(t,e){return{onlineNotifications:(0,i.fX)((0,i.fX)([],t.onlineNotifications||[],!0),[e],!1)}}function o(t,e){var n,i=[];return e&&(null===(n=t.onlineNotifications)||void 0===n||n.forEach(function(t){t.username!==e&&i.push(t)})),{onlineNotifications:i}}function r(t,e){var n;return{onlineNotificationSettings:(0,i.Cl)((0,i.Cl)({},t.onlineNotificationSettings),(n={},n[e.username]=e.isSubscribed,n))}}},69760:function(t,e,n){n.r(e),n.d(e,{PushNotification:function(){return c}});var i=n(15215),s=n(44198),o=n(67374),r=n(84435),a=function(t){function e(){var e=t.call(this)||this;return e._innerStatus=1,e.waitMaxFails=20,e.waitFailCounter=0,e.callbacks=[],e.waitLoading=function(){if(!e.checkStatusComplete(2,!0))throw new Error("Firebase not loaded but status do not equal ".concat(2," (initializing): ").concat(e.status));if("firebase"in window&&"messaging"in firebase)try{e.status=3,e.init()}catch(t){e.status=0}else e.waitFailCounter++,e.waitFailCounter>e.waitMaxFails?e.status=0:window.setTimeout(e.waitLoading,1e3)},e.handleMessage=function(t){(0,s._b)("PushAPI Firebase handleMessage").log(t),e.callbacks.map(function(e){e(t)})},"Notification"in window&&"serviceWorker"in navigator&&"https:"===window.location.protocol||(e.status=0),e}return(0,i.C6)(e,t),e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.subscribe=function(){return(0,i.sH)(this,void 0,void 0,function(){var t,e;return(0,i.YH)(this,function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),[4,this.ready()];case 1:return n.sent(),[4,(t=firebase.messaging()).requestPermission()];case 2:return n.sent(),[4,t.getToken()];case 3:return[2,n.sent()];case 4:throw e=n.sent(),(0,s._b)("PushAPI Firebase subscribe failed").error(e.message||e),e;case 5:return[2]}})})},e.prototype.unsubscribe=function(t){return(0,i.sH)(this,void 0,void 0,function(){var e;return(0,i.YH)(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.ready()];case 1:return n.sent(),[4,firebase.messaging().deleteToken(t)];case 2:return[2,n.sent()];case 3:throw e=n.sent(),(0,s._b)("PushAPI Firebase unsubscribe failed").error(e.message||e),e;case 4:return[2]}})})},e.prototype.onMessage=function(t){this.callbacks.push(t)},e.prototype.isAvailable=function(){return 0!==this.status},e.prototype.setup=function(){if(this.isAvailable()&&!("firebase"in window)&&!this.checkStatusComplete(3)){this.status=2;var t=function(n){if(e.libUris[n]){var i=e.libUris[n];if(!document.querySelector('script[src="'.concat(i,'"]'))){var o=document.createElement("script");o.async=!0,o.src=i,o.onload=function(){(0,s._b)("PushAPI Firebase loadLib success").log(n,i),t(n+1)},document.head.appendChild(o)}}};e.libUris.length&&t(0),this.waitLoading()}},e.prototype.init=function(){this.isAvailable()&&!this.checkStatusComplete(4)&&(this.status=4,firebase.initializeApp(e.config),firebase.messaging().onMessage(this.handleMessage))},e.prototype.ready=function(){return(0,i.sH)(this,void 0,void 0,function(){var t,e=this;return(0,i.YH)(this,function(n){switch(n.label){case 0:return this.checkStatusComplete(4)?[2,!0]:this.checkStatusComplete(2)?(t=this,[4,new Promise(function(n,s){e.readyGenerator=function(){return(0,i.YH)(this,function(e){switch(e.label){case 0:return t.checkStatusComplete(4)?[3,2]:[4];case 1:return e.sent(),t.isAvailable()||s("Network error"),[3,0];case 2:return n(),[2,!0]}})}(),e.readyGenerator.next(null)})]):((0,s._b)("PushAPI Firebase ready").error("You must setup firebase before"),[2,!1]);case 1:return[2,n.sent()]}})})},e.prototype.onChangeStatus=function(t,e){(0,s._b)("PushAPI Firebase onChangeStatus").log(t,"->",e),this.readyGenerator&&this.readyGenerator.next(e)},e.prototype.checkStatusComplete=function(t,e){return void 0===e&&(e=!1),e?this.status===t:this.status>=t},Object.defineProperty(e.prototype,"status",{get:function(){return this._innerStatus},set:function(t){var e=this.status;this._innerStatus=t,this.onChangeStatus(e,t)},enumerable:!1,configurable:!0}),e.libVersion="7.21.0",e.libUris=["https://www.gstatic.com/firebasejs/".concat(e.libVersion,"/firebase-app.js"),"https://www.gstatic.com/firebasejs/".concat(e.libVersion,"/firebase-messaging.js")],e.config={apiKey:"AIzaSyBZPKKo_tInwfJZ0COBg0ZfmYyxacO6lsU",projectId:"bongacams-e8ad2",messagingSenderId:"918428164766",appId:"1:918428164766:web:c8b01dbfcdaf92e0c8918f"},e}(n(1292).T),c=function(){function t(){var e,n=this;if(this.token=null,this.onMessage=function(e){n.isAvailable()&&t.callbacks.push(e)},this.removeMessageListener=function(e){if(n.isAvailable()){var i=[];t.callbacks.map(function(t){t!==e&&i.push(t)}),t.callbacks=i}},"Notification"in window&&!r.BrowserDetect.isSafari()){var i=a.getInstance();i.isAvailable()&&(i.setup(),e=i)}e?(this.service=e,this.service.onMessage(function(e){(0,s._b)("PushAPI PushNotification onMessage").log(e),t.callbacks.map(function(t){t(e)})})):(0,s._b)("PushAPI PushNotification init failed").error("not available")}return t.getInstance=function(){return(0,i.sH)(this,void 0,void 0,function(){return(0,i.YH)(this,function(e){switch(e.label){case 0:return t.instance?[3,2]:(t.instance=new t,[4,t.instance.checkSubscription()]);case 1:e.sent(),e.label=2;case 2:return[2,t.instance]}})})},t.prototype.isAvailable=function(){return Boolean(this.service)},t.prototype.getToken=function(){return this.token},t.prototype.subscribe=function(){return(0,i.sH)(this,void 0,void 0,function(){var t,e;return(0,i.YH)(this,function(n){switch(n.label){case 0:if(!this.isAvailable())return[2,null];n.label=1;case 1:return n.trys.push([1,6,,7]),(0,s._b)("PushAPI PushNotification subscribe try").log(),[4,this.service.subscribe()];case 2:return(t=n.sent())?(this.token=t,[4,o.I_.getInstance().saveToken(this.token)]):[3,5];case 3:return n.sent(),[4,o.I_.getInstance().checkIsAuth()];case 4:n.sent(),(0,s._b)("PushAPI PushNotification subscribe success").log(t),n.label=5;case 5:return[2,t];case 6:switch((e=n.sent()).code){case"messaging/permission-blocked":case"messaging/permission-default":(0,s._b)("PushAPI PushNotification subscribe failed").log("show alert");break;case"messaging/unsupported-browser":(0,s._b)("PushAPI PushNotification subscribe failed").log("unsupported browser");break;default:(0,s._b)("PushAPI PushNotification subscribe failed").log(e)}return[2,null];case 7:return[2]}})})},t.prototype.unsubscribeAll=function(){return(0,i.sH)(this,void 0,void 0,function(){var t,e;return(0,i.YH)(this,function(n){switch(n.label){case 0:if(!this.isAvailable()||!this.isSubscribed())return[2,!1];n.label=1;case 1:return n.trys.push([1,5,,6]),(0,s._b)("PushAPI PushNotification unsubscribeAll try").log(),[4,this.service.unsubscribe(this.token)];case 2:return(t=n.sent())?[4,o.I_.getInstance().removeToken()]:[3,4];case 3:n.sent(),this.token=null,(0,s._b)("PushAPI PushNotification unsubscribeAll success").log(),n.label=4;case 4:return[2,t];case 5:if("messaging/delete-token-not-found"===(e=n.sent()).code);else(0,s._b)("PushAPI PushNotification unsubscribeAll failed").error(e);return[3,6];case 6:return[2]}})})},t.prototype.isSubscribed=function(){return Boolean(this.token)},t.prototype.checkSubscription=function(){return(0,i.sH)(this,void 0,void 0,function(){var t,e;return(0,i.YH)(this,function(n){switch(n.label){case 0:return[4,o.I_.getInstance().checkIsAuth()];case 1:return n.sent(),window.Notification&&"granted"===Notification.permission&&o.I_.getInstance().isAvailable()&&this.isAvailable()?[4,o.I_.getInstance().getToken()]:[2];case 2:return t=n.sent(),(0,s._b)("PushAPI PushNotification checkSubscription savedToken").log(t),t?[4,this.service.subscribe()]:[2];case 3:return e=n.sent(),(0,s._b)("PushAPI PushNotification checkSubscription serviceToken").log(e),e&&t===e?[3,7]:((0,s._b)("PushAPI PushNotification checkSubscription").log("remove all"),[4,o.I_.getInstance().removeToken()]);case 4:return n.sent(),e?[4,this.service.unsubscribe(e)]:[3,6];case 5:n.sent(),n.label=6;case 6:return[2];case 7:return this.token=e,(0,s._b)("PushAPI PushNotification checkSubscription success").log(),[2]}})})},t.callbacks=[],t}()},1292:function(t,e,n){n.d(e,{k:function(){return s.PushNotification},T:function(){return i}});var i=function(){},s=n(69760)}}]);