!function(){"use strict";var c=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var l=e(function(t){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(e){return typeof e}:t.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}t.exports=n});var r=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n>6|192:(55296==(64512&a)&&r+1>18|240,t[n++]=a>>12&63|128):t[n++]=a>>12|224,t[n++]=a>>6&63|128),t[n++]=63&a|128)}return t}var B={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],a=0;a>2,p=(3&i)<<4|s>>4,l=(15&s)<<2|u>>6,h=63&u;c||(h=64,o||(l=64)),r.push(n[f],n[p],n[l],n[h])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(M(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{var s=e[n++],c=e[n++];t[r++]=String.fromCharCode((15&a)<<12|(63&s)<<6|63&c)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],a=0;a>4;if(r.push(u),64!==s){var f=o<<4&240|s>>2;if(r.push(f),64!==c){var p=s<<6&192|c;r.push(p)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},R=function(e){return t=M(e),B.encodeByteArray(t,!0).replace(/\./g,"");var t};function F(){try{return"object"===("undefined"==typeof indexedDB?"undefined":l(indexedDB))}catch(e){return}}function W(){return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__}function H(){if("undefined"!=typeof document){var e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&function(e){try{return B.decodeString(e,!0)}catch(e){}return null}(e[1]);return t&&JSON.parse(t)}}function K(){try{return W()||function(){if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||H()}catch(e){return}}var V=function(){var e;return null===(e=K())||void 0===e?void 0:e.config},U=function(){function e(){var n=this;I(this,e),this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}return C(e,[{key:"wrapCallback",value:function(n){var r=this;return function(e,t){e?r.reject(e):r.resolve(t),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(e):n(e,t))}}}]),e}(),q=function(e){y(i,e);var a=L(i);function i(e,t,n){var r;return I(this,i),(r=a.call(this,t)).code=e,r.customData=n,r.name="FirebaseError",Object.setPrototypeOf(v(r),i.prototype),Error.captureStackTrace&&Error.captureStackTrace(v(r),z.prototype.create),r}return i}(S(Error)),z=function(){function r(e,t,n){I(this,r),this.service=e,this.serviceName=t,this.errors=n}return C(r,[{key:"create",value:function(e,t){var r,n=(arguments.length<=1?void 0:t)||{},a="".concat(this.service,"/").concat(e),i=this.errors[e],o=i?(r=n,i.replace($,function(e,t){var n=r[t];return null!=n?String(n):"<".concat(t,"?>")})):"Error",s="".concat(this.serviceName,": ").concat(o," (").concat(a,").");return new q(a,s,n)}}]),r}();var $=/\{\$([^}]+)}/g;function G(e,t){if(e===t)return 1;for(var n=Object.keys(e),r=Object.keys(t),a=0,i=n;ar)return e.dates.pop(),"break"}else if(a.push({agent:t.agent,dates:[t.date]}),tt(a)>r)return a.pop(),"break";i=i.slice(1)};for(o.s();!(n=o.n()).done;){if("break"===s())break}}catch(e){o.e(e)}finally{o.f()}return{heartbeatsToSend:a,unsentEntries:i}}var Ze,et=function(){function t(e){I(this,t),this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}var n,r,e,a;return C(t,[{key:"runIndexedDBEnvironmentCheck",value:(a=h(A.mark(function e(){return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(F()){e.next=4;break}return e.abrupt("return",!1);case 4:return e.abrupt("return",new Promise(function(e,t){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(r);a.onsuccess=function(){a.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},a.onupgradeneeded=function(){n=!1},a.onerror=function(){var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}).then(function(){return!0}).catch(function(){return!1}));case 5:case"end":return e.stop()}},e)})),function(){return a.apply(this,arguments)})},{key:"read",value:(e=h(A.mark(function e(){var t;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return",{heartbeats:[]});case 7:return e.next=9,Ue(this.app);case 9:return t=e.sent,e.abrupt("return",t||{heartbeats:[]});case 11:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"overwrite",value:(r=h(A.mark(function e(t){var n,r;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",ze(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:t.heartbeats}));case 11:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"add",value:(n=h(A.mark(function e(t){var n,r;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",ze(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:[].concat(o(r.heartbeats),o(t.heartbeats))}));case 11:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})}]),t}();function tt(e){return R(JSON.stringify({version:2,heartbeats:e})).length}Ze="",je(new Y("platform-logger",function(e){return new Ie(e)},"PRIVATE")),je(new Y("heartbeat",function(e){return new Ye(e)},"PRIVATE")),Re(_e,"0.9.0",Ze),Re(_e,"0.9.0","esm2017"),Re("fire-js","");function nt(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return rt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n")})):"Error",s="".concat(this.serviceName,": ").concat(o," (").concat(a,").");return new st(a,s,n)}}]),r}(),ut=/\{\$([^}]+)}/g;function ft(e){return e&&e._delegate?e._delegate:e}var pt,lt,ht=function(){function r(e,t,n){I(this,r),this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}return C(r,[{key:"setInstantiationMode",value:function(e){return this.instantiationMode=e,this}},{key:"setMultipleInstances",value:function(e){return this.multipleInstances=e,this}},{key:"setServiceProps",value:function(e){return this.serviceProps=e,this}},{key:"setInstanceCreatedCallback",value:function(e){return this.onInstanceCreated=e,this}}]),r}(),dt=new WeakMap,vt=new WeakMap,gt=new WeakMap,yt=new WeakMap,bt=new WeakMap,mt={get:function(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return vt.get(e);if("objectStoreNames"===t)return e.objectStoreNames||gt.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return kt(e[t])},set:function(e,t,n){return e[t]=n,!0},has:function(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function wt(e){return"function"==typeof e?(i=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(lt=lt||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(i)?function(){for(var e=arguments.length,t=new Array(e),n=0;n=u.createTime+6048e5?function(){var n=h(A.mark(function e(t,n){var r,a;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,function(){var n=h(A.mark(function e(t,n){var r,a,i,o,s,c;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bn(t);case 2:return r=e.sent,a=Fn(n.subscriptionOptions),i={method:"PATCH",headers:r,body:JSON.stringify(a)},e.prev=5,e.next=8,fetch("".concat(Mn(t.appConfig),"/").concat(n.token),i);case 8:return s=e.sent,e.next=11,s.json();case 11:o=e.sent,e.next=17;break;case 14:throw e.prev=14,e.t0=e.catch(5),Pn.create("token-update-failed",{errorInfo:null==e.t0?void 0:e.t0.toString()});case 17:if(o.error)throw c=o.error.message,Pn.create("token-update-failed",{errorInfo:c});e.next=20;break;case 20:if(o.token){e.next=22;break}throw Pn.create("token-update-no-token");case 22:return e.abrupt("return",o.token);case 23:case"end":return e.stop()}},e,null,[[5,14]])}));return function(e,t){return n.apply(this,arguments)}}()(t.firebaseDependencies,n);case 3:return r=e.sent,a=Object.assign(Object.assign({},n),{token:r,createTime:Date.now()}),e.next=7,An(t.firebaseDependencies,a);case 7:return e.abrupt("return",r);case 10:return e.prev=10,e.t0=e.catch(0),e.next=14,Kn(t);case 14:throw e.t0;case 15:case"end":return e.stop()}},e,null,[[0,10]])}));return function(e,t){return n.apply(this,arguments)}}()(o,{token:u.token,createTime:Date.now(),subscriptionOptions:c}):u.token);e.next=10;break;case 10:return e.prev=10,e.next=13,Nn(o.firebaseDependencies,u.token);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10);case 18:case 19:return e.abrupt("return",Un(o.firebaseDependencies,c));case 20:case"end":return e.stop()}var t,n,r,a,i},e,null,[[10,15]])}))).apply(this,arguments)}function Kn(){return Vn.apply(this,arguments)}function Vn(){return(Vn=h(A.mark(function e(t){var n,r;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,On(t.firebaseDependencies);case 2:if(n=e.sent,e.t0=n,e.t0)return e.next=7,Nn(t.firebaseDependencies,n.token);e.next=9;break;case 7:return e.next=9,function(){var t=h(A.mark(function e(t){var n,r;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=jn(t),e.next=3,Dn();case 3:return r=e.sent.transaction(_n,"readwrite"),e.next=6,r.objectStore(_n).delete(n);case 6:return e.next=8,r.done;case 8:case"end":return e.stop()}},e)}));return function(e){return t.apply(this,arguments)}}()(t.firebaseDependencies);case 9:return e.next=11,t.swRegistration.pushManager.getSubscription();case 11:return r=e.sent,e.abrupt("return",!r||r.unsubscribe());case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Un(){return qn.apply(this,arguments)}function qn(){return(qn=h(A.mark(function e(t,n){var r,a;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var n=h(A.mark(function e(t,n){var r,a,i,o,s,c;return A.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bn(t);case 2:return r=e.sent,a=Fn(n),i={method:"POST",headers:r,body:JSON.stringify(a)},e.prev=5,e.next=8,fetch(Mn(t.appConfig),i);case 8:return s=e.sent,e.next=11,s.json();case 11:o=e.sent,e.next=17;break;case 14:throw e.prev=14,e.t0=e.catch(5),Pn.create("token-subscribe-failed",{errorInfo:null==e.t0?void 0:e.t0.toString()});case 17:if(o.error)throw c=o.error.message,Pn.create("token-subscribe-failed",{errorInfo:c});e.next=20;break;case 20:if(o.token){e.next=22;break}throw Pn.create("token-subscribe-no-token");case 22:return e.abrupt("return",o.token);case 23:case"end":return e.stop()}},e,null,[[5,14]])}));return function(e,t){return n.apply(this,arguments)}}()(t,n);case 2:return r=e.sent,a={token:r,createTime:Date.now(),subscriptionOptions:n},e.next=6,An(t,a);case 6:return e.abrupt("return",a.token);case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function zn(e){var t,n={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(t.notification){e.notification={};var n=t.notification.title;n&&(e.notification.title=n);var r=t.notification.body;r&&(e.notification.body=r);var a=t.notification.image;a&&(e.notification.image=a);var i=t.notification.icon;i&&(e.notification.icon=i)}}(n,e),t=n,e.data&&(t.data=e.data),function(e,t){var n,r,a,i,o;if(t.fcmOptions||null!==(n=t.notification)&&void 0!==n&&n.click_action){e.fcmOptions={};var s=null!==(a=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==a?a:null===(i=t.notification)||void 0===i?void 0:i.click_action;s&&(e.fcmOptions.link=s);var c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}}(n,e),n}function $n(e,t){for(var n=[],r=0;r=t)break;var i=r.join(" ");if(i.length>t){var o=i.lastIndexOf(" ");-1')),document.querySelector("body").classList.add("webpush-body"),setTimeout(function(){pr()},5e3)),yr(e).then(function(e){e?(pr(),wr(e,1),navigator.serviceWorker.ready.then(function(e){var t="bạn";""!=cr("myvne_user_id")&&"undefined"!=typeof myvne_users&&void 0!==myvne_users.profile&&void 0!==myvne_users.profile.user_fullname&&myvne_users.profile.user_fullname&&(t=sr(myvne_users.profile.user_fullname,20)),e.showNotification("Bạn đã đăng ký thành công 🎉",{body:"Cảm ơn "+t+" đã đăng ký nhận tin, chúng tôi sẽ cập nhật thông tin quan trọng tới bạn hàng ngày",icon:"https://s1.vnecdn.net/vnexpress/restruct/i/v671/logos/57x57.png",requireInteraction:!0})}).catch(function(e){}).finally(function(){t()})):pr()}).catch(function(e){pr()})}"permissions"in navigator&&navigator.permissions.query({name:"notifications"}).then(function(e){e.onchange=function(){pr(),"denied"!=e.state&&"prompt"!=e.state||null!=xr()&&kr()}}).catch(function(e){}),function(){window.WPN=fr,window.WPN.getInfoDevice=vr,window.WPN.getFirebaseMessaging=gr,window.WPN.getFirebaseToken=yr,window.WPN.isFirebaseSupported=br,window.WPN.isAllowPushNotify=mr,window.WPN.updateSubscriber=wr,window.WPN.removeSubscriber=kr,window.WPN.getTokenLocal=xr,window.WPN.removeTokenLocal=Sr,window.WPN.notifyRegistration=Ir,window.WPN.setSiteId=hr,window.WPN.setAppId=dr;var e=fr.keyTokenLocal+"_log",t=sessionStorage.getItem(e),n=Math.round((new Date).getTime()/1e3);(!t||600<=n-parseInt(t))&&(lr(),sessionStorage.setItem(e,n))}(),window.WPN&&/^https:\/\/([a-z]+\.)?vnexpress\.net/.test(location.origin)&&window.WPN.isFirebaseSupported()&&window.WPN.isAllowPushNotify()&&null==window.WPN.getTokenLocal()&&function(){var e=WPN.keyTokenLocal+"_prompt",t=localStorage.getItem(e),n=Math.round((new Date).getTime()/1e3);if(t){var r=JSON.parse(t);if(!(r.expire_time<=n&&r.time<3))return;r.time++,r.expire_time=n+604800*r.time,localStorage.setItem(e,JSON.stringify(r))}else{var a={expire_time:n+604800,time:1};localStorage.setItem(e,JSON.stringify(a))}var i=window.WPN.getFirebaseMessaging();window.WPN.notifyRegistration(i,function(){})}()}();