zmp-sdk 2.18.6 → 2.18.9

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/dist/index.umd.js CHANGED
@@ -12,4 +12,4 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function t(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function i(e,t){return function(i,n){t(i,n,e)}}function n(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}function o(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function r(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}var a=Object.prototype;var s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||a)};var l=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var u=function(e){if(!s(e))return l(e);var t=[];for(var i in Object(e))c.call(e,i)&&"constructor"!=i&&t.push(i);return t},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(e,t){return e(t={exports:{}},t.exports),t.exports}var h="object"==typeof d&&d&&d.Object===Object&&d,v="object"==typeof self&&self&&self.Object===Object&&self,f=h||v||Function("return this")(),m=f.Symbol,g=Object.prototype,y=g.hasOwnProperty,_=g.toString,E=m?m.toStringTag:void 0;var S=function(e){var t=y.call(e,E),i=e[E];try{e[E]=void 0;var n=!0}catch(e){}var o=_.call(e);return n&&(t?e[E]=i:delete e[E]),o},A=Object.prototype.toString;var T=function(e){return A.call(e)},O=m?m.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?S(e):T(e)};var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var N,P=function(e){if(!w(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=f["__core-js_shared__"],I=(N=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var k=function(e){return!!I&&I in e},R=Function.prototype.toString;var B=function(e){if(null!=e){try{return R.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,j=Function.prototype,L=Object.prototype,M=j.toString,U=L.hasOwnProperty,W=RegExp("^"+M.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var x=function(e){return!(!w(e)||k(e))&&(P(e)?W:D).test(B(e))};var z=function(e,t){return null==e?void 0:e[t]};var F=function(e,t){var i=z(e,t);return x(i)?i:void 0},G=F(f,"DataView"),H=F(f,"Map"),$=F(f,"Promise"),V=F(f,"Set"),Z=F(f,"WeakMap"),J="[object Map]",K="[object Promise]",Q="[object Set]",q="[object WeakMap]",Y="[object DataView]",X=B(G),ee=B(H),te=B($),ie=B(V),ne=B(Z),oe=b;(G&&oe(new G(new ArrayBuffer(1)))!=Y||H&&oe(new H)!=J||$&&oe($.resolve())!=K||V&&oe(new V)!=Q||Z&&oe(new Z)!=q)&&(oe=function(e){var t=b(e),i="[object Object]"==t?e.constructor:void 0,n=i?B(i):"";if(n)switch(n){case X:return Y;case ee:return J;case te:return K;case ie:return Q;case ne:return q}return t});var re=oe;var ae=function(e){return null!=e&&"object"==typeof e};var se=function(e){return ae(e)&&"[object Arguments]"==b(e)},le=Object.prototype,ce=le.hasOwnProperty,ue=le.propertyIsEnumerable,de=se(function(){return arguments}())?se:function(e){return ae(e)&&ce.call(e,"callee")&&!ue.call(e,"callee")},pe=Array.isArray;var he=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ve=function(e){return null!=e&&he(e.length)&&!P(e)};var fe=function(){return!1},me=p((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?f.Buffer:void 0,r=(o?o.isBuffer:void 0)||fe;e.exports=r})),ge={};ge["[object Float32Array]"]=ge["[object Float64Array]"]=ge["[object Int8Array]"]=ge["[object Int16Array]"]=ge["[object Int32Array]"]=ge["[object Uint8Array]"]=ge["[object Uint8ClampedArray]"]=ge["[object Uint16Array]"]=ge["[object Uint32Array]"]=!0,ge["[object Arguments]"]=ge["[object Array]"]=ge["[object ArrayBuffer]"]=ge["[object Boolean]"]=ge["[object DataView]"]=ge["[object Date]"]=ge["[object Error]"]=ge["[object Function]"]=ge["[object Map]"]=ge["[object Number]"]=ge["[object Object]"]=ge["[object RegExp]"]=ge["[object Set]"]=ge["[object String]"]=ge["[object WeakMap]"]=!1;var ye=function(e){return ae(e)&&he(e.length)&&!!ge[b(e)]};var _e=function(e){return function(t){return e(t)}},Ee=p((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&h.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Se=Ee&&Ee.isTypedArray,Ae=Se?_e(Se):ye,Te=Object.prototype.hasOwnProperty;var Oe=function(e){if(null==e)return!0;if(ve(e)&&(pe(e)||"string"==typeof e||"function"==typeof e.splice||me(e)||Ae(e)||de(e)))return!e.length;var t=re(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(s(e))return!u(e).length;for(var i in e)if(Te.call(e,i))return!1;return!0};var be=function(e){return void 0===e};var we=function(e){return null===e};var Ne=function(e){return"string"==typeof e||!pe(e)&&ae(e)&&"[object String]"==b(e)};var Pe=function(e){return"number"==typeof e||ae(e)&&"[object Number]"==b(e)};var Ce=function(e){return ae(e)&&"[object RegExp]"==b(e)},Ie=Ee&&Ee.isRegExp,ke=Ie?_e(Ie):Ce;var Re=function(e){return"symbol"==typeof e||ae(e)&&"[object Symbol]"==b(e)},Be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,De=/^\w*$/;var je=function(e,t){if(pe(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Re(e))||(De.test(e)||!Be.test(e)||null!=t&&e in Object(t))},Le=F(Object,"create");var Me=function(){this.__data__=Le?Le(null):{},this.size=0};var Ue=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},We=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;if(Le){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return We.call(t,e)?t[e]:void 0},ze=Object.prototype.hasOwnProperty;var Fe=function(e){var t=this.__data__;return Le?void 0!==t[e]:ze.call(t,e)};var Ge=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Le&&void 0===t?"__lodash_hash_undefined__":t,this};function He(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}He.prototype.clear=Me,He.prototype.delete=Ue,He.prototype.get=xe,He.prototype.has=Fe,He.prototype.set=Ge;var $e=He;var Ve=function(){this.__data__=[],this.size=0};var Ze=function(e,t){return e===t||e!=e&&t!=t};var Je=function(e,t){for(var i=e.length;i--;)if(Ze(e[i][0],t))return i;return-1},Ke=Array.prototype.splice;var Qe=function(e){var t=this.__data__,i=Je(t,e);return!(i<0)&&(i==t.length-1?t.pop():Ke.call(t,i,1),--this.size,!0)};var qe=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var Ye=function(e){return Je(this.__data__,e)>-1};var Xe=function(e,t){var i=this.__data__,n=Je(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function et(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=Ve,et.prototype.delete=Qe,et.prototype.get=qe,et.prototype.has=Ye,et.prototype.set=Xe;var tt=et;var it=function(){this.size=0,this.__data__={hash:new $e,map:new(H||tt),string:new $e}};var nt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var i=e.__data__;return nt(t)?i["string"==typeof t?"string":"hash"]:i.map};var rt=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var at=function(e){return ot(this,e).get(e)};var st=function(e){return ot(this,e).has(e)};var lt=function(e,t){var i=ot(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function ct(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}ct.prototype.clear=it,ct.prototype.delete=rt,ct.prototype.get=at,ct.prototype.has=st,ct.prototype.set=lt;var ut=ct;function dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],r=i.cache;if(r.has(o))return r.get(o);var a=e.apply(this,n);return i.cache=r.set(o,a)||r,a};return i.cache=new(dt.Cache||ut),i}dt.Cache=ut;var pt=dt;var ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,ft=function(e){var t=pt(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ht,(function(e,i,n,o){t.push(n?o.replace(vt,"$1"):i||e)})),t}));var mt=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o},gt=m?m.prototype:void 0,yt=gt?gt.toString:void 0;var _t=function e(t){if("string"==typeof t)return t;if(pe(t))return mt(t,e)+"";if(Re(t))return yt?yt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var Et=function(e){return null==e?"":_t(e)};var St=function(e,t){return pe(e)?e:je(e,t)?[e]:ft(Et(e))};var At=function(e){if("string"==typeof e||Re(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Tt=function(e,t){for(var i=0,n=(t=St(t,e)).length;null!=e&&i<n;)e=e[At(t[i++])];return i&&i==n?e:void 0};var Ot=function(e,t,i){var n=null==e?void 0:Tt(e,t);return void 0===n?i:n},bt=function(){try{var e=F(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var wt=function(e,t,i){"__proto__"==t&&bt?bt(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Nt=Object.prototype.hasOwnProperty;var Pt=function(e,t,i){var n=e[t];Nt.call(e,t)&&Ze(n,i)&&(void 0!==i||t in e)||wt(e,t,i)},Ct=/^(?:0|[1-9]\d*)$/;var It=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&Ct.test(e))&&e>-1&&e%1==0&&e<t};var kt=function(e,t,i,n){if(!w(e))return e;for(var o=-1,r=(t=St(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=At(t[o]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var u=s[l];void 0===(c=n?n(u,l,s):void 0)&&(c=w(u)?u:It(t[o+1])?[]:{})}Pt(s,l,c),s=s[l]}return e};var Rt,Bt,Dt,jt,Lt,Mt,Ut,Wt,xt,zt,Ft,Gt={isEmpty:Oe,isNull:we,isUndefined:be,isFunction:P,isObject:w,isString:Ne,isNumber:Pe,isArray:pe,isRegExp:ke,get:Ot,set:function(e,t,i){return null==e?e:kt(e,t,i)}};function Ht(e){return"function"==typeof window.Debug?window.Debug(e):function(...t){"development"===process.env.NODE_ENV&&console.log(e,...t)}}e.NetworkType=void 0,(Rt=e.NetworkType||(e.NetworkType={})).none="none",Rt.wifi="wifi",Rt.cellular="cellular",Rt.unknown="unknown",e.PlatformType=void 0,(Bt=e.PlatformType||(e.PlatformType={})).wp="wp",Bt.android="android",Bt.iOS="iOS",Bt.unknown="unknown",e.ProfileType=void 0,(Dt=e.ProfileType||(e.ProfileType={}))[Dt.user=1]="user",Dt[Dt.oa=0]="oa",Dt[Dt.aliasOA=2]="aliasOA",e.ChatType=void 0,(jt=e.ChatType||(e.ChatType={}))[jt.user=1]="user",jt[jt.oa=0]="oa",e.PostFeedType=void 0,(Lt=e.PostFeedType||(e.PostFeedType={}))[Lt.image=1]="image",Lt[Lt.link=4]="link",Lt[Lt.profile=5]="profile",e.ShareSheetType=void 0,(Mt=e.ShareSheetType||(e.ShareSheetType={}))[Mt.image=1]="image",Mt[Mt.gif=11]="gif",Mt[Mt.video=12]="video",Mt[Mt.link=4]="link",Mt[Mt.oa=5]="oa",Mt[Mt.zmp=20]="zmp",e.OrientationType=void 0,(Ut=e.OrientationType||(e.OrientationType={}))[Ut.auto=1]="auto",Ut[Ut.portrait=2]="portrait",Ut[Ut.landscape=3]="landscape",e.VibrateType=void 0,(Wt=e.VibrateType||(e.VibrateType={}))[Wt.oneShot=0]="oneShot",e.NativeCode=void 0,(xt=e.NativeCode||(e.NativeCode={}))[xt.token_invalid=-2]="token_invalid",xt[xt.not_permission=-1]="not_permission",xt[xt.client_not_support=-5]="client_not_support",xt[xt.decode_failed=-4]="decode_failed",e.Events=void 0,(zt=e.Events||(e.Events={})).AppPaused="h5.event.paused",zt.AppResumed="h5.event.resumed",zt.NetworkChanged="h5.event.connection.changed",zt.OnDataCallback="h5.event.webview.result",zt.OpenApp="h5.event.open.mp",e.MediaPickerType=void 0,(Ft=e.MediaPickerType||(e.MediaPickerType={}))[Ft.photo=4]="photo",Ft[Ft.video=5]="video",Ft[Ft.file=6]="file",Ft[Ft.multi_photo=7]="multi_photo",Ft[Ft.multi_video=8]="multi_video";const $t=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var i=e.length+1,n=o.length-1;n>=0;n--){let t=o[n];if(t&&0===t.indexOf(e)&&(t=t.substring(i,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Vt=e=>$t(`${window.location.host}_`+e),Zt=e=>$t((()=>{const e=window.location.host;if(e){if(e.indexOf("zalo.me")>=0)return"zalo.me_";if(e.indexOf("baomoi.com")>=0)return"baomoi.com_";if(e.indexOf("mp3.zing.vn")>=0)return"mp3.zing.vn_";if(e.indexOf("zaloapp.com")>=0)return"zaloapp.com_"}return""})()+e),Jt=1048576,Kt=window.zAppID,Qt=window.APP_ID,qt=window.APP_CONFIG||{},Yt="h5.zdn.vn_zoauth",Xt="h5.zdn.vn_zlink3rd",ei="h5.zdn.vn_zoauth_vrf",ti="https://graph.zalo.me/v2.0/me",ii="https://h5.zalo.me/openapi/access_token",ni="https://oauth.zaloapp.com/v3/access_token",oi="https://graph.zalo.me/v2.0/me/friends/list",ri=5*Jt,ai=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),si={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:999}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},li=0,ci=-1400,ui=-1500,di=-1401,pi=-1403,hi=-1404,vi={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},fi="apps/get-info",mi={android:12100571,iOS:400,wp:0,unknown:0},gi=[si.GET_DOWNLOADED_STICKER.name,si.OPEN_SHARE_STICKER.name,si.OPEN_PROFILE.name,si.OPEN_FEED_DETAIL.name,si.OPEN_FRIEND_RADA.name,si.OPEN_INAPP.name,si.OPEN_OUTAPP.name,si.OPEN_PAGE.name,si.OPEN_PHOTODETAIL.name,si.OPEN_GALARY.name,si.OPEN_GAMECENTER.name,si.OPEN_GAMENEWS.name,si.OPEN_TAB_CONTACT.name,si.OPEN_TAB_SOCIAL.name,si.OPEN_FRIENDSUGGEST.name,si.OPEN_GROUPLIST.name,si.OPEN_NEARBY.name,si.OPEN_ROOM.name,si.OPEN_STICKERSTORE.name,si.OPEN_CREATECHAT.name,si.COPY_LINK_CATESTICKER.name,si.REQUEST_BUY_STICKER.name,si.OPEN_CHAT.name,si.OPEN_TAB_CHAT.name,si.OPEN_CHATGROUP.name,si.OPEN_ADDFRIEND.name,si.OPEN_TAB_MORE.name,si.OPEN_POSTFEED.name,si.OPEN_LOGINDEVICES.name,si.OPEN_SENDSTICKER.name,si.REPORT_ABUSE.name,si.FOLLOW_OA.name,si.UNFOLLOW_OA.name,si.OPEN_GAMEDETAIL.name,si.OPEN_SHARESHEET.name,si.REQUEST_PERMISSION_CAMERA.name,si.CHANGE_TITLE_HEADER.name,si.WEBVIEW_CLEARCACHE.name,si.WEBVIEW_CONFIRMCACHE.name,si.WEBVIEW_ISVISIBLE.name,si.WEBVIEW_NETWORKTYPE.name,si.CHANGE_BUTTON_HEADER.name,si.CREATE_OPTIONS_MENU.name,si.CREATE_SHORTCUT.name,si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,si.WINDOW_CLOSE.name,si.WEBVIEW_CHECKRESERROR.name,si.IAP_REQUESTPAYMENT.name,si.ZBROWSER_GETSTATS.name,si.ZBROWSER_JSBRIDGE.name,si.PROMPT_AUTHENTICATION.name,si.CHANGE_ACTIONBAR_COLOR.name,si.PROMPT_AUTHENTICATION_CHECK_STATE.name,si.OPEN_APPSTORE.name,si.GET_LOCATION.name,si.QUERY_LOCATION_HIDE.name,si.SHOW_TOAST.name,si.OPEN_APP.name,si.HIDE_KEYBOARD.name,si.OPEN_PHONE.name,si.OPEN_QR.name,si.OPEN_SMS.name,si.VIEW_MYQR.name,si.KEEP_SCREEN.name,si.CHANGE_AUTOROTATE.name,si.CHECK_APP_INSTALLED.name,si.QUERY_SHOW.name,si.QUERY_HIDE.name,si.OPEN_INAPPRW.name,si.ZALORUN_GETTRACKINGSTATUS.name,si.ZALORUN_SETTRACKINGSTATUS.name,si.ZALORUN_GETDAYSTEP.name,si.ZALORUN_FORCESUBMITDATA.name,si.ZALORUN_SETWEIGHT.name,si.OPEN_PROFILE_EXT.name,si.DOWNLOAD_CATE.name,si.JUMP_LOGIN.name,si.OPEN_ADTIMA_ADS_INTERSTITIAL.name,si.OPEN_ADTIMA_ADS.name,si.GET_ADIDCLIENT.name,si.SCAN_IBEACON.name,si.SAVE_IMAGE_GALLERY.name,si.OPEN_MP.name,si.CHANGE_ACTIONBAR.name,si.INTERACTIVE_VIBRATION.name,si.ZBROWSER_MPDS.name],yi=0,_i=3,Ei=1,Si=0;class Ai{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class Ti extends Ai{constructor(e,t){super(e,t),this.message=`${t}. ${vi.READ_MORE}`,this.handler()}handler(){switch(this.code){case e.NativeCode.token_invalid:this.code=di,this.message=vi.LOGIN_REQUIRED;break;case e.NativeCode.not_permission:this.code=pi,this.message=vi.NOT_PERMISSION;break;case e.NativeCode.client_not_support:this.code=hi,this.message=vi.CLIENT_NOT_SUPPORT;break;case e.NativeCode.decode_failed:this.message=vi.DECODE_FAILED}}}const Oi={handler:null,setHandler(e){this.handler=e}};Oi.setHandler(((e,t)=>t instanceof Ai?(t.api=e,t):new Ai(-2001,Gt.isNull(t.message)?"Unknown Error":t.message,e)));const bi=(e,t,i)=>{const o=i.value;return i.value=function(...e){return n(this,void 0,void 0,(function*(){const{success:i,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>n(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!Gt.isNull(i)&&Gt.isFunction(i)?i.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===di||(null==e?void 0:e.code)===pi)){let t=!1;this instanceof vo&&(t=this.getLoginStatus()),t||(e=new Ai(di,vi.LOGIN_REQUIRED))}const{handler:i}=Oi,n=i.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(n.toString()),!Gt.isNull(r)&&Gt.isFunction(r)?r.call(null,n,this):console.error("Error:",n)}}))))}))},i},wi=(e,t,i)=>{const n=i.value;return i.value=function(...e){try{return n.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===di||(null==e?void 0:e.code)===pi)){let t=!1;this instanceof vo&&(t=this.getLoginStatus()),t||(e=new Ai(di,vi.LOGIN_REQUIRED))}const{handler:i}=Oi;!Gt.isNull(i)&&Gt.isFunction(i)?i.call(null,t,e,this):console.warn(e.message)}},i},Ni=(e,t)=>({code:li,message:t||vi.SUCCESS,data:e||{}}),Pi={badRequest:e=>new Ai(ci,e),loginFailed:()=>new Ai(ci,vi.LOGIN_FAILED),loginRequired:()=>new Ai(di,vi.LOGIN_REQUIRED),missingParam:e=>new Ai(ci,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new Ai(ci,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new Ai(ui,"Can not get app info to share"),lengthInvalid:e=>new Ai(ci,`${e} length is invalid.`)};const Ci={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(void 0===n)return;if(null===n)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(n))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var n=e.split("&"),o=0;o<n.length;o++){var r=n[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(i,a))throw new URIError("Duplicate key: "+a);i[a]=2===r.length?decodeURIComponent(r[1]):null}return i},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Ci.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var i=e.split("=");i&&2==i.length&&(t[i[0]]=decodeURIComponent(i[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),i=[];return t.map((function(t){var n=e[t],o=[t,n="object"==(void 0===n?"undefined":typeof n)?JSON.stringify(n):encodeURIComponent(n)].join("=");i.push(o)})),i.join("&")}},Ii=new RegExp("[\\u0300-\\u036f]","g"),ki=new RegExp("[đ|Đ]","g"),Ri=new RegExp("\\s","g"),Bi=Ht("zmp:utils:common"),Di=e=>{try{new URL(e)}catch(e){return!1}return!0},ji=()=>navigator.userAgent||navigator.vendor||window.opera,Li=()=>{const e=ji().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},Mi=e=>{const t=document.getElementsByTagName("meta");for(let i=0;i<t.length;i++)if(t[i].getAttribute("name")===e||t[i].getAttribute("property")===e)return t[i].getAttribute("content");return""},Ui=()=>{const e=ji().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Wi=()=>{let t=Li();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},xi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Di(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Di(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},zi=e=>(e=>{let t=Vt(e);return t||(t=Zt(e),t)?t:$t(e)})(e),Fi=e=>{if(Gt.isObject(JSON)&&JSON.parse&&Gt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return Gt.isObject(e)?e:new Function("return "+e)()},Gi=e=>{if(Gt.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var i=e.length,n=0;n<i;n++)t.push(Gi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Gi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Hi=()=>{try{const e=Number(Ui()),t=Wi();return e>=mi[t]}catch(e){return!0}},$i=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"&#39;"),Vi=e=>{try{if(e){Bi(e);const t=e.replace(/\\/g,"").replace(/&#39;/g,"'");return Bi("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Bi("parse json error:",t),e}},Zi=(e,t,i,o,r,a)=>n(void 0,void 0,void 0,(function*(){const n=new URL(location.href),s=new URLSearchParams;let l=`${n.pathname}${n.search}`;a&&(l=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const c=new URL(`https://zalo.me/app/link${l}`);s.append("title",i),s.append("description",o||""),s.append("thumbnail",r),s.append("url",c.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw Pi.cannotGetShareInfo();return c.search=`${c.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:c.href})})),Ji=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>xi(i,e))):xi(i,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(i)),errorMessage:null==t?void 0:t.values.toString()};if(Gt.isNumber(null==t?void 0:t.maxLength))return{error:(Gt.isString(i)||Gt.isArray(i))&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(Gt.isNumber(null==t?void 0:t.min)&&Gt.isNumber(null==t?void 0:t.max))return{error:i<(null==t?void 0:t.min)||i>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(Gt.isNumber(null==t?void 0:t.min))return{error:i<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(Gt.isNumber(null==t?void 0:t.max))return{error:i>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(Gt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},Ki=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};Gt.isUndefined(i)||(n.currentVersion=i);const o=Ci.appendToUrl(`https://h5.zalo.me/${fi}`,n),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var Qi=p((function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,a=new Array(r);o<r;o++)a[o]=n[o].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,r,a){var s=i?i+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,o),!0;case 5:return u.fn.call(u.context,t,n,o,r),!0;case 6:return u.fn.call(u.context,t,n,o,r,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var p,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,o);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,o){var r=i?i+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||n&&s.context!==n||a(this,r);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||n&&s[l].context!==n)&&c.push(s[l]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}));class qi extends Qi{constructor(){super(),this.debug=Ht("zmp:event-emitter")}static getInstance(){return qi.instance||(qi.instance=new qi),qi.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}}var Yi={},Xi=function(e,t,i){var n=t||"default";return function(){var t=n in Yi?Yi[n](e,i):e;return t.apply(this,arguments)}};Xi.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Yi[t]=e};var en={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function tn(e){try{return null===e?en:JSON.parse(e)}catch(e){return en}}var nn,on={execute:function(e,t,i,n){i.suppress_http_code=1;var o=Ci.encode(i);"post"!=t&&(e=Ci.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,n=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){i.send(e)}},r=Xi((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=Xi((function(){a=n,"onerror"in o&&o.onerror(i)}),"entry","XMLHttpRequest:error");return i.onload=function(){r()},i.onerror=function(){a()},i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){n(tn(e.responseText))},r.onerror=function(e){e.responseText?n(tn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class rn extends Qi{constructor(){super(),this.debug=Ht("zmp:ZaloJSBridge"),this.events=qi.getInstance(),this._accessTk=zi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=zi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=ji(),this._device=Li(),this._jsCallFuncCallbacks={},this.events.on(e.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return rn.instance||(rn.instance=new rn),rn.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{on.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Fi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:i.action,error:i.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Fi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n)}}this.results.push({action:i.action,error:i.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Vi(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(t,i){try{switch(t){case e.Events.OpenApp:const{url:t}=i,n=new URL(t),o=n.pathname.split(`/zapps/${Qt}`)[1];return{path:`${o||"/"}${n.search}`};default:return i}}catch(e){return i}}defaultCallback(e){null!=e&&(e=Fi(e))}jsCall(e,t,i,n=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(Ii,"").replace(ki,"d").replace(Ri,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||Gt.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),i||(i=this.defaultCallback);const l={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,l)}),8e3),callback:i};try{return t=Gi(t),n?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,i,n,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class an{constructor(){this.debug=Ht("zmp:ZJSBridgeProvider"),nn.set(this,void 0),r(this,nn,rn.getInstance(),"f")}setZAccSession(e){o(this,nn,"f").accessTk=e}setJSToken(e){o(this,nn,"f").jsAccessTk=e}callNative(e,t,i){return this.debug(e.name,t),new Promise(((r,a)=>{const s=o=>n(this,void 0,void 0,(function*(){try{const n=new Ti(o.error_code,`${o.action}: ${o.error_message}`);if(null==i?void 0:i.callback){const e=yield i.callback(o,n);return r(e)}if(o&&o.error_code>=0)r(o.data||{});else if(o&&o.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:o}})}catch(e){}return a(n)}}catch(e){return a(e)}})),l=Li().isIOS,c=(e=>{var t;const i=Ui(),n=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||i>=n})(e);if(l&&!c){const t=new Ti(-5,`${e}: Client isn't support this action`);return a(t)}(null==i?void 0:i.delay)?setTimeout((()=>{o(this,nn,"f").jsCall(e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}),i.delay):o(this,nn,"f").jsCall(e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}))}}nn=new WeakMap;var sn,ln,cn,un,dn,pn="2.18.6";class hn{static getVersion(){return pn}static getSystemInfo(){return{version:Mi("version-id")||"",apiVersion:pn,zaloVersion:Ui(),platform:Wi(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return n(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield Ki(e,0,t.version)}))}}class vn{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let i;Gt.isEmpty(e.textColor)||(t.textColor=e.textColor),Gt.isString(e.color)&&e.color.length>0?(Gt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(Gt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),i=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:i,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(si.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?_i:yi,i="home"===e.type||"both"===e.type?Ei:Si;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:i})}))),yield this.callNative(si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class fn{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){Gt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(si.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class mn{constructor(e,t,i,n){this.title=n,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,i>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}sn=new WeakMap,ln=new WeakMap,cn=new WeakMap,un=new WeakMap,dn=new WeakMap;const gn=new class{constructor(){sn.set(this,3),ln.set(this,["none","error","warn","info"]),cn.set(this,"[zmp] > "),un.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),dn.set(this,((e,t,i)=>{o(this,un,"f")[o(this,ln,"f")[e]]++;const n=o(this,ln,"f")[e];if(r(this,cn,o(this,cn,"f")+("string"!=typeof t?new mn(t,n,e,i).toString():t),"f"),!(e>o(this,sn,"f")))switch(e){case 1:console.error(o(this,cn,"f"));break;case 2:console.warn(o(this,cn,"f"));break;case 3:console.info(o(this,cn,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,sn,e,"f")}info(e){o(this,dn,"f").call(this,3,e)}warn(e,t){o(this,dn,"f").call(this,2,e,t)}error(e,t){o(this,dn,"f").call(this,1,e,t)}getMetrics(){return o(this,un,"f")}};class yn{static setDeviceOrientation(t){return n(this,void 0,void 0,(function*(){yield this.callNative(si.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const i=t.network;let n;const o=Li().isAndroid;switch(i){case ai(o).NONE:n=e.NetworkType.none;break;case ai(o).WIFI:n=e.NetworkType.wifi;break;case ai(o)["2G"]:case ai(o)["3G"]:case ai(o)["4G"]:n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const i=e&&e.state;this.getNetworkType().then((e=>{const n={isConnected:"CONNECTED"===i,networkType:e&&e.networkType};t(n)})).catch((e=>{gn.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,i,o,r,a;return n(this,void 0,void 0,(function*(){const n={subaction:0,scanning_type:Gt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:Gt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:Gt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:Gt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:Gt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:Gt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:Gt.isNumber(null===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:Gt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:Gt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:Gt.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(si.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const i={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(i)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,i,n,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_code,message:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return Gt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(si.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}}var _n,En,Sn,An,Tn,On,bn,wn,Nn,Pn,Cn,In,kn,Rn,Bn,Dn,jn,Ln,Mn,Un,Wn,xn,zn,Fn,Gn,Hn,$n,Vn;class Zn{constructor(e){_n.set(this,localStorage),En.set(this,void 0),Sn.set(this,void 0),Li(),r(this,Sn,{keys:new Set,currentSize:0,limitSize:ri},"f"),r(this,En,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,_n,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,Sn,"f").keys.add(t)}}catch(e){gn.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return o(this,En,"f")&&(e=`${o(this,En,"f")}_${e}`),o(this,Sn,"f").keys.has(e)?o(this,_n,"f").getItem(e):null}set(e){return n(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){o(this,En,"f")&&(e=`${o(this,En,"f")}_${e}`),o(this,_n,"f").setItem(e,t),o(this,Sn,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let i,n,o=0;for(n in e){const r=n.split("_")[0];e.hasOwnProperty(n)&&(t&&r!==t||(i=2*(e[n].length+n.length),o+=i))}return o})(o(this,_n,"f"),o(this,En,"f"));return{currentSize:Gt.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return n(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){o(this,En,"f")&&(e=`${o(this,En,"f")}_${e}`),o(this,Sn,"f").keys.has(e)&&(o(this,_n,"f").removeItem(e),o(this,Sn,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,Sn,"f").keys.forEach((e=>{o(this,En,"f")&&e.indexOf(o(this,En,"f"))<0||(o(this,_n,"f").removeItem(e),o(this,Sn,"f").keys.delete(e))}))}}_n=new WeakMap,En=new WeakMap,Sn=new WeakMap;class Jn extends an{constructor(e){super(),An.set(this,void 0),Tn.set(this,void 0),r(this,Tn,{keys:new Set,currentSize:0,limitSize:ri},"f"),r(this,An,e,"f")}get(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return n(this,void 0,void 0,(function*(){const e=yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=0;return e&&e.mpds_data&&e.mpds_data.size&&(t=e.mpds_data.size),t}));return{currentSize:Gt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return n(this,void 0,void 0,(function*(){yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,An,"f")})}))}}An=new WeakMap,Tn=new WeakMap;class Kn{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Vi(e)})),n}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{Gt.isUndefined(t)||Gt.isNull(t)||(i[e]=$i(t))})),yield t.set(i)}))}removeDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Qn extends Kn{constructor(e){super(),On.set(this,void 0),r(this,On,e,"f")}getInstance(){return new Zn(o(this,On,"f"))}}On=new WeakMap;class qn extends Kn{constructor(e){super(),bn.set(this,void 0),r(this,bn,e,"f")}getInstance(){return new Jn(o(this,bn,"f"))}}bn=new WeakMap;class Yn{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new Qn(this.getAppId());return Hi()&&(t=new qn(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new Qn(this.getAppId());Hi()&&(t=new qn(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new Qn(this.getAppId());return Hi()&&(e=new qn(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new Qn(this.getAppId());return Hi()&&(t=new qn(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new Qn(this.getAppId());Hi()&&(e=new qn(this.getAppId())),yield e.clearStorage()}))}}class Xn{static getUserInfo(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let i="id,name,picture";(null==e?void 0:e.avatarType)&&(i=`${i}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${ti}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),i={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),i}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class eo{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,i=(null==e?void 0:e.params)||{},n=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&"),o=yield Ki(t,0);yield this.callNative(si.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:{appId:t,appAvtUrl:o.logoUrl||"",appName:o.name||""}})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.OPEN_INAPP,{url:e.url})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class to{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,i={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(i)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class io{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return Gt.isEmpty(e.imageBase64Data)?Gt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(si.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class no{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return n(this,void 0,void 0,(function*(){let i={};switch(t.type){case"image":i={photoUrl:t.data.imageUrl};break;case"link":i={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":i={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.callNative(si.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},i),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return n(this,void 0,void 0,(function*(){let i={};switch(t.type){case"image":let e=[];Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),i={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":i={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":i={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":i={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":i={uid:t.data.id};break;case"zmp":const n=yield this.getAccessToken(),o=yield Zi(this.getAppId(),n||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?i={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=11412&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Mini App",vi:"Chương trình nhỏ"}},enableReactions:1}}:(i={link:o.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.callNative(si.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[t.type]},i),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,i){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(t,i)=>{const n=Wi();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(si).filter((e=>si[e].skip_jump)),i={actions:[...t.actions,...e]};return Promise.resolve(i)}if(n===e.PlatformType.iOS){const e={actions:gi};return Promise.resolve(e)}return Promise.reject(i)}})}))}static openMediaPicker(t,i,o,r){return n(this,void 0,void 0,(function*(){const n={type:0,url:"https://zapi-server.tungnt.xyz/upload/photos",maxSize:1048576};return yield this.callNative(si.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),i),silent_request:o,upload:n,max_select_item:r},{isMultiCallback:!0,callback:(e,t)=>{var i,n;if(0===e.error_code){const t=Vi(null===(i=e.data)||void 0===i?void 0:i.result_content),o={urls:null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.urls};return Promise.resolve(o)}return Promise.reject(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_OUTAPP,{url:e})}))}}class oo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Ci.getParamsAsObject(i))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.WEBVIEW_SET_RESULT,{result:$i(e.data)})}))}static onCallbackData(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class ro extends an{constructor(){var e,t,i,n,a,s,l,c,u,d,p,h,v,f,m,g,y;super(),wn.set(this,Kt),Nn.set(this,Qt),Pn.set(this,qt),Cn.set(this,void 0),In.set(this,void 0),kn.set(this,void 0),Rn.set(this,null),Bn.set(this,{timer:{getToken:0}}),Dn.set(this,void 0),jn.set(this,void 0),Ln.set(this,null),this.events=qi.getInstance(),this.isIOS=Li().isIOS,Mn.set(this,void 0),this.getActionBarConfig=()=>o(this,Mn,"f"),this.setActionBarConfig=e=>{r(this,Mn,e(o(this,Mn,"f")),"f")},Un.set(this,(()=>new Promise(((e,t)=>{Gt.isUndefined(o(this,Ln,"f"))||Gt.isNull(o(this,Ln,"f"))?this.callNative(si.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],n=i.find((e=>e.name===Xt));n&&(this.setJSToken(n.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(n.value)),r(this,Ln,i,"f"),e(i)})).catch((e=>{t(e)})):e(o(this,Ln,"f"))})))),Wn.set(this,vn.setNavigationBarRightButton),this.getVersion=hn.getVersion,this.getSystemInfo=hn.getSystemInfo,this.setNavigationBarTitle=vn.setNavigationBarTitle,this.setNavigationBarColor=vn.setNavigationBarColor,this.setNavigationBarLeftButton=vn.setNavigationBarLeftButton,this.setBackgroundColor=fn.setBackgroundColor,this.setDeviceOrientation=yn.setDeviceOrientation,this.setStorage=Yn.setStorage,this.getStorage=Yn.getStorage,this.getStorageInfo=Yn.getStorageInfo,this.removeStorage=Yn.removeStorage,this.clearStorage=Yn.clearStorage,this.getUserInfo=Xn.getUserInfo,this.getNetworkType=yn.getNetworkType,this.onNetworkStatusChange=yn.onNetworkStatusChange,this.startBeaconDiscovery=yn.startBeaconDiscovery,this.stopBeaconDiscovery=yn.stopBeaconDiscovery,this.getBeacons=yn.getBeacons,this.closeApp=eo.closeApp,this.getLocation=to.getLocation,this.stopBluetoothDevicesDiscovery=yn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=yn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=yn.openBluetoothAdapter,this.onBluetoothDeviceFound=yn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=yn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=yn.getConnectedBluetoothDevices,this.getBluetoothDevices=yn.getBluetoothDevices,this.getBluetoothAdapterState=yn.getBluetoothAdapterState,this.closeBluetoothAdapter=yn.closeBluetoothAdapter,this.scanQRCode=yn.scanQRCode,this.openProfile=no.openProfile,this.openChat=no.openChat,this.openPostFeed=no.openPostFeed,this.followOA=no.followOA,this.unFollowOA=no.unfollowOA,this.openShareSheet=no.openShareSheet,this.requestCameraPermission=io.requestCameraPermission,this.createShortcut=no.createShortcut,this.openBioAuthentication=yn.openBioAuthentication,this.checkStateBioAuthentication=yn.checkStateBioAuthentication,this.sendLocation=to.sendLocation,this.showToast=yn.showToast,this.hideKeyboard=yn.hideKeyboard,this.openPhone=yn.openPhone,this.openSMS=yn.openSMS,this.viewOAQr=no.viewOAQr,this.keepScreen=yn.keepScreen,this.saveImageToPhotosAlbum=io.saveImageToPhotosAlbum,this.openMiniApp=eo.openMiniApp,this.vibrate=yn.vibrate,this.openWebview=eo.openWebview,this.getRouteParams=oo.getRouteParams,this.getAppInfo=hn.getAppInfo,this.sendDataToPreviousMiniApp=oo.sendDataToPreviousMiniApp,this.onCallbackData=oo.onCallbackData,this.getPhoneNumber=Xn.getPhoneNumber,this.openProfilePicker=no.openProfilePicker,xn.set(this,no.getActionsSupported),this.connectWifi=yn.connectWifi,this.openMediaPicker=no.openMediaPicker,this.openOutApp=no.openOutApp,this.closeLoading=eo.closeLoading,r(this,Cn,null,"f"),r(this,In,null,"f"),r(this,kn,null,"f"),this.isShowNavBar=!0,r(this,Dn,0,"f"),r(this,jn,0,"f");const _="home"===(null===(t=null===(e=o(this,Pn,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(n=null===(i=o(this,Pn,"f"))||void 0===i?void 0:i.app)||void 0===n?void 0:n.leftButton)?Ei:Si,E=new URL(location.href),S=Gt.isString(null===(s=null===(a=o(this,Pn,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(c=null===(l=o(this,Pn,"f"))||void 0===l?void 0:l.app)||void 0===c?void 0:c.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=o(this,Pn,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=o(this,Pn,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?_i:yi;r(this,Mn,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=o(this,Pn,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=o(this,Pn,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return ro.instance||(ro.instance=new ro),ro.instance}getLoginStatus(){return Gt.isString(o(this,kn,"f"))&&o(this,kn,"f").length>0}getAppId(){return o(this,Nn,"f")}getZAppId(){return o(this,wn,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=yield o(this,Un,"f").call(this),t=e.find((e=>e.name===Yt)),i=e.find((e=>e.name===ei));if(!Gt.isUndefined(t)&&!Gt.isNull(t)&&Gt.isString(t.value)){if(r(this,Cn,t.value,"f"),Gt.isUndefined(i)||Gt.isNull(i)||!Gt.isString(i.value)?yield this.loginZaloV3():(r(this,In,i.value,"f"),yield this.loginZaloV4()),!o(this,kn,"f"))throw Pi.loginFailed();return o(this,kn,"f")}throw Pi.loginFailed()}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${ni}?app_id=${o(this,wn,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,Nn,"f")}/&code=${o(this,Cn,"f")}&isSDK=true123`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,kn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,jn,e,"f"),r(this,Dn,(new Date).getTime(),"f"),this.setZAccSession(o(this,kn,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,kn,"f")||""),o(this,kn,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,Nn,"f")),e.append("code",o(this,Cn,"f")||""),e.append("code_verifier",o(this,In,"f")||""),Gt.isNull(o(this,Rn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,Rn,"f")||""));return yield fetch(ii,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&r(this,Rn,t.refresh_token,"f"),t.access_token){r(this,kn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,jn,e,"f"),r(this,Dn,(new Date).getTime(),"f"),this.setZAccSession(o(this,kn,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,kn,"f")||""),o(this,kn,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Dn,"f");if(!o(this,kn,"f"))throw Pi.loginRequired();return e<o(this,jn,"f")?o(this,kn,"f"):yield this.login()}))}}wn=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,In=new WeakMap,kn=new WeakMap,Rn=new WeakMap,Bn=new WeakMap,Dn=new WeakMap,jn=new WeakMap,Ln=new WeakMap,Mn=new WeakMap,Un=new WeakMap,Wn=new WeakMap,xn=new WeakMap;class ao{constructor(){zn.set(this,Kt),Fn.set(this,qt),Gn.set(this,"DEFAULT ZOAUTH"),Hn.set(this,"DEFAULT ACCESS TOKEN"),$n.set(this,{timer:{getToken:0}}),Vn.set(this,!1),this.getLoginStatus=()=>o(this,Vn,"f"),this.getAppId=()=>o(this,zn,"f"),this.login=()=>(r(this,Vn,!0,"f"),Promise.resolve(o(this,Gn,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,Hn,"f")),this.getVersion=hn.getVersion,this.getSystemInfo=hn.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>n(this,void 0,void 0,(function*(){const t=new Qn(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new Qn(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new Qn(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new Qn(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new Qn(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let t;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":t=e.NetworkType.none;break;case"4g":t=e.NetworkType.wifi;break;case"3g":case"2g":t=e.NetworkType.cellular;break;default:t=e.NetworkType.unknown}const i={networkType:t};return Promise.resolve(i)},this.onNetworkStatusChange=t=>{const i=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=i.effectiveType;return i.addEventListener("change",(function(){let i;switch(n){case"none":i=e.NetworkType.none;break;case"4g":i=e.NetworkType.wifi;break;case"3g":case"2g":i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}t({isConnected:!0,networkType:i})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e.url),Promise.resolve()),this.getRouteParams=oo.getRouteParams,this.getAppInfo=()=>Promise.resolve({description:"",name:"",version:"",appUrl:"",qrCodeUrl:""}),this.sendDataToPreviousMiniApp=e=>Promise.resolve(),this.onCallbackData=e=>(e({data:""}),Promise.resolve()),this.getPhoneNumber=()=>(console.warn("This api only works on zalo app"),Promise.resolve({number:""})),this.openProfilePicker=()=>(console.warn("This api only works on zalo app"),Promise.resolve([])),this.connectWifi=()=>(console.warn("This api only works on zalo app"),Promise.resolve()),this.openOutApp=e=>(location.href=e,Promise.resolve()),this.closeLoading=e=>Promise.resolve()}on(e,t,i){throw new Error("Method not implemented.")}once(e,t,i){throw new Error("Method not implemented.")}off(e,t,i,n){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,n){return console.warn("This api only works on zalo app"),Promise.resolve({urls:[]})}}zn=new WeakMap,Fn=new WeakMap,Gn=new WeakMap,Hn=new WeakMap,$n=new WeakMap,Vn=new WeakMap;const so=Symbol("required"),lo=Symbol("checkType"),co=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(so,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(so,r,i,n)},uo=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(lo,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(lo,a,n,o)};const po=(e,t,i)=>{const n=i.value,o=n.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return i.value=function(){const i=Reflect.getOwnMetadata(so,e,t),r=Reflect.getOwnMetadata(lo,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:i,properties:n,defaultValue:r}=e;let a=arguments[t],s=o[t];const l=typeof a;if(!Gt.isUndefined(a)){if(!xi(a,i))throw Pi.wrongTypeParam(s,i,Array.isArray(a)?"array":null===a?"null":l);"object"===i&&Object.entries(n).forEach((([e,i])=>{const n=e.split("?")[0],o=Gt.get(a,n);if(Gt.isUndefined(o)||Gt.isNull(o)){if(!e.includes("?"))throw Pi.missingParam(e);Gt.isObject(Gt.get(a,n.split(".")[0]))&&r&&!Gt.isUndefined(Gt.get(r,n))&&Gt.set(arguments[t],n,Gt.get(r,n))}else if(Gt.isFunction(i)){const e=i(o);if(e&&e.error)throw Pi.wrongTypeParam(`${s}.${n}`,e.errorMessage,typeof o)}}))}})),i&&i.forEach((e=>{const{parameterIndex:t,option:i,fields:n}=e,o=arguments[t],r=null==i?void 0:i.if,a=null==i?void 0:i.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>Gt.get(o,e)===r[e]))),s&&n.forEach((e=>{const i=e=>{let i=!1;return Gt.isEmpty(Gt.get(o,e))&&(Gt.isUndefined(Gt.get(a,e))||Gt.set(arguments[t],e,Gt.get(a,e)),i=!0),i};if(Array.isArray(e)&&e.length>0&&e.every(i))throw Pi.missingParam(e.join(" or "));if(Gt.isString(e)&&i(e))throw Pi.missingParam(e)}))})),n.apply(this,arguments)},i};var ho;class vo{constructor(){this.events=qi.getInstance(),ho.set(this,void 0),r(this,ho,this.getServiceInstance(),"f"),this.events.addListener=(t,i,n)=>{const o=t;return this.events.addListener(e.Events[o],i,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").login(e)}))}getLoginStatus(){return o(this,ho,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getAccessToken(e)}))}getVersion(){return o(this,ho,"f").getVersion()}getSystemInfo(){return o(this,ho,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return o(this,ho,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield Ki(Qt,0),i=Li().isIOS,n=t.logoUrl||Mi("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),i){a.append("appId",Qt),a.append("appName",r),a.append("appIcon",n);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,ho,"f").openOutApp(encodeURI(e))}else yield o(this,ho,"f").createShortcut(`https://zalo.me/app/link/zapps/${Qt}/?${a.toString()}`,r,n);return Ni()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(this,void 0,void 0,(function*(){if(!Gt.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield o(this,ho,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openWebview(e)}))}getRouteParams(){return o(this,ho,"f").getRouteParams()}getAppInfo(e){return o(this,ho,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,ho,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield o(this,ho,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(oi,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield n.json();if(0!==o.error||!o.data)throw new Error(o.message);i=t.map((e=>{var t,i,n,r,a,s,l,c,u,d,p;return{id:(null===(i=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===i?void 0:i.user_id_by_app)||"",profile:{name:null===(r=null===(n=o.data[e])||void 0===n?void 0:n.user_info)||void 0===r?void 0:r.name,avatar:null===(c=null===(l=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===l?void 0:l.data)||void 0===c?void 0:c.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${Gt.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){i=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:i||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").connectWifi(e)}))}openMediaPicker(e){var t,i,r;return n(this,void 0,void 0,(function*(){const n={};Gt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(i=e.editView)||void 0===i?void 0:i.enable)?n.enable=1:n.enable=0,n.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,ho,"f").openMediaPicker(e.type,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Zi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").closeLoading("user action")}))}}ho=new WeakMap,t([bi],vo.prototype,"login",null),t([wi],vo.prototype,"getLoginStatus",null),t([bi],vo.prototype,"getAccessToken",null),t([wi],vo.prototype,"getVersion",null),t([wi],vo.prototype,"getSystemInfo",null),t([bi,po,i(0,uo("object",{title:Ji("string")}))],vo.prototype,"setNavigationBarTitle",null),t([bi,po,i(0,uo("object",{color:Ji("string"),"textColor?":Ji("string",{values:["white","black"]}),"statusBarColor?":Ji("string")}))],vo.prototype,"setNavigationBarColor",null),t([bi,po,i(0,uo("object",{backgroundColor:Ji("string"),"textColor?":Ji("string",{values:["white","black"]})}))],vo.prototype,"setBackgroundColor",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["none","back","home","both"]})}))],vo.prototype,"setNavigationBarLeftButton",null),t([bi,po,i(0,uo("object",{rotate:Ji("string",{values:["auto","portrait","landscape"]})}))],vo.prototype,"setDeviceOrientation",null),t([bi,po,i(0,uo("object",{data:Ji("object")}))],vo.prototype,"setStorage",null),t([bi,po,i(0,uo("object",{keys:Ji("array<string>")}))],vo.prototype,"getStorage",null),t([bi],vo.prototype,"getStorageInfo",null),t([bi,po,i(0,uo("object",{keys:Ji("array<string>")}))],vo.prototype,"removeStorage",null),t([bi],vo.prototype,"clearStorage",null),t([bi,po,i(0,uo("object",{"avatarType?":Ji("string",{values:["small","normal","large"]})}))],vo.prototype,"getUserInfo",null),t([bi],vo.prototype,"getNetworkType",null),t([bi],vo.prototype,"onNetworkStatusChange",null),t([bi],vo.prototype,"startBeaconDiscovery",null),t([bi],vo.prototype,"stopBeaconDiscovery",null),t([bi],vo.prototype,"getBeacons",null),t([bi],vo.prototype,"closeApp",null),t([bi],vo.prototype,"getLocation",null),t([bi],vo.prototype,"stopBluetoothDevicesDiscovery",null),t([bi],vo.prototype,"startBluetoothDevicesDiscovery",null),t([bi],vo.prototype,"openBluetoothAdapter",null),t([bi],vo.prototype,"onBluetoothDeviceFound",null),t([bi],vo.prototype,"onBluetoothAdapterStateChange",null),t([bi],vo.prototype,"getConnectedBluetoothDevices",null),t([bi],vo.prototype,"getBluetoothDevices",null),t([bi],vo.prototype,"getBluetoothAdapterState",null),t([bi],vo.prototype,"closeBluetoothAdapter",null),t([bi],vo.prototype,"scanQRCode",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["user","oa","aliasOA"]}),id:Ji("string")}))],vo.prototype,"openProfile",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["user","oa"]}),id:Ji("string")}))],vo.prototype,"openChat",null),t([bi,po,i(0,co(["data.imageUrl"],{if:{type:"image"}})),i(0,co(["data.link"],{if:{type:"link"}})),i(0,co(["data.id"],{if:{type:"profile"}})),i(0,uo("object",{type:Ji("string",{values:["image","link","profile"]}),data:Ji("object"),"data.imageUrl?":Ji("url"),"data.link?":Ji("url"),"data.title?":Ji("string"),"data.thumb?":Ji("url"),"data.description?":Ji("string"),"data.avatar?":Ji("url"),"data.id?":Ji("string"),"data.displayName?":Ji("string")}))],vo.prototype,"openPostFeed",null),t([bi,po,i(0,uo("object",{id:Ji("string"),"showDialogConfirm?":Ji("boolean")}))],vo.prototype,"followOA",null),t([bi,po,i(0,uo("object",{id:Ji("string")}))],vo.prototype,"unfollowOA",null),t([bi,po,i(0,co([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),i(0,co(["data.link"],{if:{type:"link"}})),i(0,co(["data.id"],{if:{type:"oa"}})),i(0,co(["data.gifUrl"],{if:{type:"gif"}})),i(0,co(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),i(0,co(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),i(0,uo("object",{type:Ji("string",{values:["image","gif","video","link","oa","zmp"]}),data:Ji("object"),"data.imageUrl?":Ji("url"),"data.imageUrls?":Ji("array<url>",{maxLength:10}),"data.caption?":Ji("string"),"data.gifUrl?":Ji("url"),"data.width?":Ji("number"),"data.height?":Ji("number"),"data.videoThumb?":Ji("url"),"data.videoUrl?":Ji("url"),"data.link?":Ji("url"),"data.chatOnly?":Ji("boolean"),"data.id?":Ji("string"),"data.thumbnail?":Ji("url"),"data.path?":Ji("string"),"data.title?":Ji("string",{maxLength:100}),"data.description?":Ji(["string"],{maxLength:400})}))],vo.prototype,"openShareSheet",null),t([bi],vo.prototype,"requestCameraPermission",null),t([bi],vo.prototype,"createShortcut",null),t([bi,po,i(0,uo("object",{secretData:Ji("string"),"ui?":Ji("object"),"ui.title?":Ji("string"),"ui.subTitle?":Ji("string"),"ui.negativeButtonText?":Ji("string"),"requireFingerprint?":Ji("boolean")},{requireFingerprint:!0,ui:{title:"Xác thực",subTitle:"Sử dụng sinh trắc học của bạn để xác thực",negativeButtonText:"Đóng"}}))],vo.prototype,"openBioAuthentication",null),t([bi],vo.prototype,"checkStateBioAuthentication",null),t([bi,po,i(0,uo("object",{toUserId:Ji("string"),"title?":Ji("string")}))],vo.prototype,"sendLocation",null),t([bi,po,i(0,uo("object",{message:Ji("string")}))],vo.prototype,"showToast",null),t([bi],vo.prototype,"hideKeyboard",null),t([bi,po,i(0,uo("object",{phoneNumber:Ji("string")}))],vo.prototype,"openPhone",null),t([bi,po,i(0,uo("object",{content:Ji("string"),phoneNumber:Ji("string",{regex:/^\+?\d+$/})}))],vo.prototype,"openSMS",null),t([bi,po,i(0,uo("object",{id:Ji("string"),"displayName?":Ji("string")},{displayName:""}))],vo.prototype,"viewOAQr",null),t([bi],vo.prototype,"keepScreen",null),t([bi,po,i(0,uo("object",{"imageBase64Data?":Ji("string"),"imageUrl?":Ji("url")}))],vo.prototype,"saveImageToGallery",null),t([bi,po,i(0,uo("object",{"imageBase64Data?":Ji("string"),"imageUrl?":Ji("url")}))],vo.prototype,"saveImageToPhotosAlbum",null),t([bi,po,i(0,uo("object",{appId:Ji("string"),"params?":Ji("object")}))],vo.prototype,"openMiniApp",null),t([bi,po,i(0,uo("object",{"type?":Ji("string",{values:["oneShot"]}),"milliseconds?":Ji("number")},{type:"oneShot",milliseconds:500}))],vo.prototype,"vibrate",null),t([bi,po,i(0,uo("object",{url:Ji("string")}))],vo.prototype,"openWebview",null),t([wi],vo.prototype,"getRouteParams",null),t([bi],vo.prototype,"getAppInfo",null),t([bi],vo.prototype,"sendDataToPreviousMiniApp",null),t([bi],vo.prototype,"onCallbackData",null),t([bi],vo.prototype,"getPhoneNumber",null),t([bi,po,i(0,uo("object",{"maxProfile?":Ji("number",{min:1,max:10})},{maxProfile:1}))],vo.prototype,"openProfilePicker",null),t([bi,po,i(0,co(["SSID"])),i(0,uo("object",{SSID:Ji("string"),"password?":Ji("string"),"hiddenSSID?":Ji("boolean")}))],vo.prototype,"connectWifi",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["photo","video","file","multi_photo","multi_video"]}),"editView?":Ji("object"),"editView.enable?":Ji("boolean"),"editView.aspectRatio?":Ji("string",{regex:/^\d+:\d+$/}),"silentRequest?":Ji("boolean"),"maxSelectItem?":Ji("number",{min:1})}))],vo.prototype,"openMediaPicker",null),t([bi,po,i(0,uo("object",{title:Ji("string",{maxLength:100}),"thumbnail?":Ji("url"),"path?":Ji("string"),description:Ji(["string"],{maxLength:400})},{description:""}))],vo.prototype,"getShareableLink",null),t([bi,po],vo.prototype,"closeLoading",null);class fo extends vo{getServiceInstance(){return ro.getInstance()}}class mo extends vo{getServiceInstance(){return new ao}}const go=Li();e.default=void 0,window.onJSCall=e=>function(t){rn.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){rn.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){rn.getInstance().nativeEventHandler(e,t,i)}},go.isZalo?e.default=new fo:e.default=new mo,window.ZaloMiniAppSDK=e.default,e.SDKCreator=vo,e.default=e.default,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */function t(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function i(e,t){return function(i,n){t(i,n,e)}}function n(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}function o(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function r(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}var a=Object.prototype;var s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||a)};var l=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var u=function(e){if(!s(e))return l(e);var t=[];for(var i in Object(e))c.call(e,i)&&"constructor"!=i&&t.push(i);return t},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(e,t){return e(t={exports:{}},t.exports),t.exports}var h="object"==typeof d&&d&&d.Object===Object&&d,v="object"==typeof self&&self&&self.Object===Object&&self,f=h||v||Function("return this")(),m=f.Symbol,g=Object.prototype,y=g.hasOwnProperty,_=g.toString,E=m?m.toStringTag:void 0;var S=function(e){var t=y.call(e,E),i=e[E];try{e[E]=void 0;var n=!0}catch(e){}var o=_.call(e);return n&&(t?e[E]=i:delete e[E]),o},A=Object.prototype.toString;var T=function(e){return A.call(e)},O=m?m.toStringTag:void 0;var b=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?S(e):T(e)};var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var N,P=function(e){if(!w(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=f["__core-js_shared__"],I=(N=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var k=function(e){return!!I&&I in e},R=Function.prototype.toString;var B=function(e){if(null!=e){try{return R.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,j=Function.prototype,L=Object.prototype,M=j.toString,U=L.hasOwnProperty,W=RegExp("^"+M.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var x=function(e){return!(!w(e)||k(e))&&(P(e)?W:D).test(B(e))};var z=function(e,t){return null==e?void 0:e[t]};var F=function(e,t){var i=z(e,t);return x(i)?i:void 0},G=F(f,"DataView"),H=F(f,"Map"),$=F(f,"Promise"),V=F(f,"Set"),Z=F(f,"WeakMap"),J="[object Map]",K="[object Promise]",Q="[object Set]",q="[object WeakMap]",Y="[object DataView]",X=B(G),ee=B(H),te=B($),ie=B(V),ne=B(Z),oe=b;(G&&oe(new G(new ArrayBuffer(1)))!=Y||H&&oe(new H)!=J||$&&oe($.resolve())!=K||V&&oe(new V)!=Q||Z&&oe(new Z)!=q)&&(oe=function(e){var t=b(e),i="[object Object]"==t?e.constructor:void 0,n=i?B(i):"";if(n)switch(n){case X:return Y;case ee:return J;case te:return K;case ie:return Q;case ne:return q}return t});var re=oe;var ae=function(e){return null!=e&&"object"==typeof e};var se=function(e){return ae(e)&&"[object Arguments]"==b(e)},le=Object.prototype,ce=le.hasOwnProperty,ue=le.propertyIsEnumerable,de=se(function(){return arguments}())?se:function(e){return ae(e)&&ce.call(e,"callee")&&!ue.call(e,"callee")},pe=Array.isArray;var he=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ve=function(e){return null!=e&&he(e.length)&&!P(e)};var fe=function(){return!1},me=p((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?f.Buffer:void 0,r=(o?o.isBuffer:void 0)||fe;e.exports=r})),ge={};ge["[object Float32Array]"]=ge["[object Float64Array]"]=ge["[object Int8Array]"]=ge["[object Int16Array]"]=ge["[object Int32Array]"]=ge["[object Uint8Array]"]=ge["[object Uint8ClampedArray]"]=ge["[object Uint16Array]"]=ge["[object Uint32Array]"]=!0,ge["[object Arguments]"]=ge["[object Array]"]=ge["[object ArrayBuffer]"]=ge["[object Boolean]"]=ge["[object DataView]"]=ge["[object Date]"]=ge["[object Error]"]=ge["[object Function]"]=ge["[object Map]"]=ge["[object Number]"]=ge["[object Object]"]=ge["[object RegExp]"]=ge["[object Set]"]=ge["[object String]"]=ge["[object WeakMap]"]=!1;var ye=function(e){return ae(e)&&he(e.length)&&!!ge[b(e)]};var _e=function(e){return function(t){return e(t)}},Ee=p((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&h.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=r})),Se=Ee&&Ee.isTypedArray,Ae=Se?_e(Se):ye,Te=Object.prototype.hasOwnProperty;var Oe=function(e){if(null==e)return!0;if(ve(e)&&(pe(e)||"string"==typeof e||"function"==typeof e.splice||me(e)||Ae(e)||de(e)))return!e.length;var t=re(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(s(e))return!u(e).length;for(var i in e)if(Te.call(e,i))return!1;return!0};var be=function(e){return void 0===e};var we=function(e){return null===e};var Ne=function(e){return"string"==typeof e||!pe(e)&&ae(e)&&"[object String]"==b(e)};var Pe=function(e){return"number"==typeof e||ae(e)&&"[object Number]"==b(e)};var Ce=function(e){return ae(e)&&"[object RegExp]"==b(e)},Ie=Ee&&Ee.isRegExp,ke=Ie?_e(Ie):Ce;var Re=function(e){return"symbol"==typeof e||ae(e)&&"[object Symbol]"==b(e)},Be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,De=/^\w*$/;var je=function(e,t){if(pe(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Re(e))||(De.test(e)||!Be.test(e)||null!=t&&e in Object(t))},Le=F(Object,"create");var Me=function(){this.__data__=Le?Le(null):{},this.size=0};var Ue=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},We=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;if(Le){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return We.call(t,e)?t[e]:void 0},ze=Object.prototype.hasOwnProperty;var Fe=function(e){var t=this.__data__;return Le?void 0!==t[e]:ze.call(t,e)};var Ge=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Le&&void 0===t?"__lodash_hash_undefined__":t,this};function He(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}He.prototype.clear=Me,He.prototype.delete=Ue,He.prototype.get=xe,He.prototype.has=Fe,He.prototype.set=Ge;var $e=He;var Ve=function(){this.__data__=[],this.size=0};var Ze=function(e,t){return e===t||e!=e&&t!=t};var Je=function(e,t){for(var i=e.length;i--;)if(Ze(e[i][0],t))return i;return-1},Ke=Array.prototype.splice;var Qe=function(e){var t=this.__data__,i=Je(t,e);return!(i<0)&&(i==t.length-1?t.pop():Ke.call(t,i,1),--this.size,!0)};var qe=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var Ye=function(e){return Je(this.__data__,e)>-1};var Xe=function(e,t){var i=this.__data__,n=Je(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function et(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=Ve,et.prototype.delete=Qe,et.prototype.get=qe,et.prototype.has=Ye,et.prototype.set=Xe;var tt=et;var it=function(){this.size=0,this.__data__={hash:new $e,map:new(H||tt),string:new $e}};var nt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ot=function(e,t){var i=e.__data__;return nt(t)?i["string"==typeof t?"string":"hash"]:i.map};var rt=function(e){var t=ot(this,e).delete(e);return this.size-=t?1:0,t};var at=function(e){return ot(this,e).get(e)};var st=function(e){return ot(this,e).has(e)};var lt=function(e,t){var i=ot(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function ct(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}ct.prototype.clear=it,ct.prototype.delete=rt,ct.prototype.get=at,ct.prototype.has=st,ct.prototype.set=lt;var ut=ct;function dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],r=i.cache;if(r.has(o))return r.get(o);var a=e.apply(this,n);return i.cache=r.set(o,a)||r,a};return i.cache=new(dt.Cache||ut),i}dt.Cache=ut;var pt=dt;var ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,ft=function(e){var t=pt(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ht,(function(e,i,n,o){t.push(n?o.replace(vt,"$1"):i||e)})),t}));var mt=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o},gt=m?m.prototype:void 0,yt=gt?gt.toString:void 0;var _t=function e(t){if("string"==typeof t)return t;if(pe(t))return mt(t,e)+"";if(Re(t))return yt?yt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var Et=function(e){return null==e?"":_t(e)};var St=function(e,t){return pe(e)?e:je(e,t)?[e]:ft(Et(e))};var At=function(e){if("string"==typeof e||Re(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Tt=function(e,t){for(var i=0,n=(t=St(t,e)).length;null!=e&&i<n;)e=e[At(t[i++])];return i&&i==n?e:void 0};var Ot=function(e,t,i){var n=null==e?void 0:Tt(e,t);return void 0===n?i:n},bt=function(){try{var e=F(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var wt=function(e,t,i){"__proto__"==t&&bt?bt(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Nt=Object.prototype.hasOwnProperty;var Pt=function(e,t,i){var n=e[t];Nt.call(e,t)&&Ze(n,i)&&(void 0!==i||t in e)||wt(e,t,i)},Ct=/^(?:0|[1-9]\d*)$/;var It=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&Ct.test(e))&&e>-1&&e%1==0&&e<t};var kt=function(e,t,i,n){if(!w(e))return e;for(var o=-1,r=(t=St(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=At(t[o]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var u=s[l];void 0===(c=n?n(u,l,s):void 0)&&(c=w(u)?u:It(t[o+1])?[]:{})}Pt(s,l,c),s=s[l]}return e};var Rt,Bt,Dt,jt,Lt,Mt,Ut,Wt,xt,zt,Ft,Gt={isEmpty:Oe,isNull:we,isUndefined:be,isFunction:P,isObject:w,isString:Ne,isNumber:Pe,isArray:pe,isRegExp:ke,get:Ot,set:function(e,t,i){return null==e?e:kt(e,t,i)}};function Ht(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}e.NetworkType=void 0,(Rt=e.NetworkType||(e.NetworkType={})).none="none",Rt.wifi="wifi",Rt.cellular="cellular",Rt.unknown="unknown",e.PlatformType=void 0,(Bt=e.PlatformType||(e.PlatformType={})).wp="wp",Bt.android="android",Bt.iOS="iOS",Bt.unknown="unknown",e.ProfileType=void 0,(Dt=e.ProfileType||(e.ProfileType={}))[Dt.user=1]="user",Dt[Dt.oa=0]="oa",Dt[Dt.aliasOA=2]="aliasOA",e.ChatType=void 0,(jt=e.ChatType||(e.ChatType={}))[jt.user=1]="user",jt[jt.oa=0]="oa",e.PostFeedType=void 0,(Lt=e.PostFeedType||(e.PostFeedType={}))[Lt.image=1]="image",Lt[Lt.link=4]="link",Lt[Lt.profile=5]="profile",e.ShareSheetType=void 0,(Mt=e.ShareSheetType||(e.ShareSheetType={}))[Mt.image=1]="image",Mt[Mt.gif=11]="gif",Mt[Mt.video=12]="video",Mt[Mt.link=4]="link",Mt[Mt.oa=5]="oa",Mt[Mt.zmp=20]="zmp",e.OrientationType=void 0,(Ut=e.OrientationType||(e.OrientationType={}))[Ut.auto=1]="auto",Ut[Ut.portrait=2]="portrait",Ut[Ut.landscape=3]="landscape",e.VibrateType=void 0,(Wt=e.VibrateType||(e.VibrateType={}))[Wt.oneShot=0]="oneShot",e.NativeCode=void 0,(xt=e.NativeCode||(e.NativeCode={}))[xt.token_invalid=-2]="token_invalid",xt[xt.not_permission=-1]="not_permission",xt[xt.client_not_support=-5]="client_not_support",xt[xt.decode_failed=-4]="decode_failed",e.Events=void 0,(zt=e.Events||(e.Events={})).AppPaused="h5.event.paused",zt.AppResumed="h5.event.resumed",zt.NetworkChanged="h5.event.connection.changed",zt.OnDataCallback="h5.event.webview.result",zt.OpenApp="h5.event.open.mp",e.MediaPickerType=void 0,(Ft=e.MediaPickerType||(e.MediaPickerType={}))[Ft.photo=4]="photo",Ft[Ft.video=5]="video",Ft[Ft.file=6]="file";const $t=e=>{const t=document.cookie;if(t){const o=t.split("; ");if(o&&o.length>0)for(var i=e.length+1,n=o.length-1;n>=0;n--){let t=o[n];if(t&&0===t.indexOf(e)&&(t=t.substring(i,t.length),t))return t=t.replace(/["']/g,""),t}}return null},Vt=e=>$t(`${window.location.host}_`+e),Zt=e=>$t((()=>{const e=window.location.host;if(e){if(e.indexOf("zalo.me")>=0)return"zalo.me_";if(e.indexOf("baomoi.com")>=0)return"baomoi.com_";if(e.indexOf("mp3.zing.vn")>=0)return"mp3.zing.vn_";if(e.indexOf("zaloapp.com")>=0)return"zaloapp.com_"}return""})()+e),Jt=1048576,Kt=window.zAppID,Qt=window.APP_ID,qt=window.APP_CONFIG||{},Yt="h5.zdn.vn_zoauth",Xt="h5.zdn.vn_zlink3rd",ei="h5.zdn.vn_zoauth_vrf",ti="https://graph.zalo.me/v2.0/me",ii="https://h5.zalo.me/openapi/access_token",ni="https://oauth.zaloapp.com/v3/access_token",oi="https://graph.zalo.me/v2.0/me/friends/list",ri=5*Jt,ai=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),si={GET_DOWNLOADED_STICKER:{name:"action.get.downloaded.sticker",have_callback:!0},OPEN_SHARE_STICKER:{name:"action.open.share.sticker"},OPEN_PROFILE:{name:"action.open.profile"},OPEN_FEED_DETAIL:{name:"action.open.feeddetail"},OPEN_FRIEND_RADA:{name:"action.open.friendrada"},OPEN_INAPP:{name:"action.open.inapp"},OPEN_OUTAPP:{name:"action.open.outapp"},OPEN_PAGE:{name:"action.open.page"},OPEN_PHOTODETAIL:{name:"action.open.photodetail"},OPEN_GALARY:{name:"action.open.galary"},OPEN_GAMECENTER:{name:"action.open.gamecenter"},OPEN_GAMENEWS:{name:"action.open.gamenews"},OPEN_TAB_CONTACT:{name:"action.open.tab.contact"},OPEN_TAB_SOCIAL:{name:"action.open.tab.social"},OPEN_FRIENDSUGGEST:{name:"action.open.friendsuggest"},OPEN_GROUPLIST:{name:"action.open.grouplist"},OPEN_NEARBY:{name:"action.open.nearby"},OPEN_ROOM:{name:"action.open.room"},OPEN_STICKERSTORE:{name:"action.open.stickerstore"},OPEN_CREATECHAT:{name:"action.open.createchat"},COPY_LINK_CATESTICKER:{name:"action.copy.link.catesticker"},REQUEST_BUY_STICKER:{name:"action.request.buy.sticker"},OPEN_CHAT:{name:"action.open.chat"},OPEN_TAB_CHAT:{name:"action.open.tab.chat"},OPEN_CHATGROUP:{name:"action.open.chatgroup"},OPEN_ADDFRIEND:{name:"action.open.addfriend"},OPEN_TAB_MORE:{name:"action.open.tab.more"},OPEN_POSTFEED:{name:"action.open.postfeed"},OPEN_LOGINDEVICES:{name:"action.open.logindevices"},OPEN_SENDSTICKER:{name:"action.open.sendsticker"},REPORT_ABUSE:{name:"action.report.abuse",have_callback:!0},FOLLOW_OA:{name:"action.follow.oa",have_callback:!0},UNFOLLOW_OA:{name:"action.unfollow.oa",have_callback:!0},OPEN_GAMEDETAIL:{name:"action.open.gamedetail"},OPEN_SHARESHEET:{name:"action.open.sharesheet",have_callback:!0},REQUEST_PERMISSION_CAMERA:{name:"action.request.permission.camera"},CHANGE_TITLE_HEADER:{name:"action.change.title.header",skip_jump:!0},WEBVIEW_CLEARCACHE:{name:"action.webview.clearcache"},WEBVIEW_CONFIRMCACHE:{name:"action.webview.confirmcache"},WEBVIEW_ISVISIBLE:{name:"action.webview.isvisible"},WEBVIEW_NETWORKTYPE:{name:"action.webview.networktype",skip_jump:!0},CHANGE_BUTTON_HEADER:{name:"action.change.button.header"},CREATE_OPTIONS_MENU:{name:"action.create.options.menu",skip_jump:!0,have_callback:!0},CREATE_SHORTCUT:{name:"action.create.shortcut"},CHANGE_ACTIONBAR_LEFTBUTTON_TYPE:{name:"action.change.actionbar.leftbutton.type",skip_jump:!0,have_callback:!0},WINDOW_CLOSE:{name:"action.window.close",skip_jump:!0,have_callback:!0},WEBVIEW_CHECKRESERROR:{name:"action.webview.checkResError"},IAP_REQUESTPAYMENT:{name:"action.iap.requestpayment"},ZBROWSER_GETSTATS:{name:"action.zbrowser.getstats"},ZBROWSER_JSBRIDGE:{name:"action.zbrowser.jsbridge",skip_jump:!0,have_callback:!0},PROMPT_AUTHENTICATION:{name:"action.prompt.authentication"},CHANGE_ACTIONBAR_COLOR:{name:"action.change.actionbar.color",skip_jump:!0},PROMPT_AUTHENTICATION_CHECK_STATE:{name:"action.prompt.authentication.check_state"},OPEN_APPSTORE:{name:"action.open.appstore"},GET_LOCATION:{name:"action.get.location",have_callback:!0},QUERY_LOCATION_HIDE:{name:"action.query.location.hide",have_callback:!0},SHOW_TOAST:{name:"action.show.toast",have_callback:!0},OPEN_APP:{name:"action.open.app"},HIDE_KEYBOARD:{name:"action.hide.keyboard"},OPEN_PHONE:{name:"action.open.phone"},OPEN_QR:{name:"action.open.qr"},OPEN_SMS:{name:"action.open.sms"},VIEW_MYQR:{name:"action.view.myqr",have_callback:!0},KEEP_SCREEN:{name:"action.keep.screen",have_callback:!0},CHANGE_AUTOROTATE:{name:"action.change.autorotate",skip_jump:!0},CHECK_APP_INSTALLED:{name:"action.check.app.installed"},QUERY_SHOW:{name:"action.query.show"},QUERY_HIDE:{name:"action.query.hide"},OPEN_INAPPRW:{name:"action.open.inapprw"},ZALORUN_GETTRACKINGSTATUS:{name:"action.zalorun.getTrackingStatus",have_callback:!0},ZALORUN_SETTRACKINGSTATUS:{name:"action.zalorun.setTrackingStatus",have_callback:!0},ZALORUN_GETDAYSTEP:{name:"action.zalorun.getDayStep",have_callback:!0},ZALORUN_FORCESUBMITDATA:{name:"action.zalorun.forceSubmitData",have_callback:!0},ZALORUN_SETWEIGHT:{name:"action.zalorun.setWeight",have_callback:!0},OPEN_PROFILE_EXT:{name:"action.open.profile.ext"},DOWNLOAD_CATE:{name:"action.download.cate",have_callback:!0},JUMP_LOGIN:{name:"action.jump.login",skip_jump:!0,white_list:!0},OPEN_ADTIMA_ADS_INTERSTITIAL:{name:"action.open.adtima.ads.interstitial"},OPEN_ADTIMA_ADS:{name:"action.open.adtima.ads"},GET_ADIDCLIENT:{name:"action.get.adidclient"},SCAN_IBEACON:{name:"action.scan.ibeacon"},INTERACTIVE_VIBRATION:{name:"action.interactive.vibration"},SAVE_IMAGE_GALLERY:{name:"action.save.image.gallery",version_live:{iOS:408}},OPEN_MP:{name:"action.open.mp",version_live:{iOS:402}},CHANGE_ACTIONBAR:{name:"action.change.actionbar",version_live:{iOS:402},skip_jump:!0},ZBROWSER_MPDS:{name:"action.zbrowser.mpds",version_live:{iOS:402}},WEBVIEW_SET_RESULT:{name:"action.webview.set.result",version_live:{iOS:416}},MP_GET_NUMBER:{name:"action.mp.get.number",version_live:{iOS:416}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432}},GET_SUPPORTED_ACTIONS:{name:"action.get.supported.actions",white_list:!0},MP_JOIN_WIFI:{name:"action.mp.join.wifi",version_live:{android:0,iOS:999},have_permission:!1,white_list:!1},PICK_MEDIA:{name:"action.pick.media",version_live:{iOS:452}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},li=0,ci=-1400,ui=-1500,di=-1401,pi=-1403,hi=-1404,vi={SUCCESS:"Success",READ_MORE:"Read more at: https://miniapp.zalo.me/docs/api",LOGIN_REQUIRED:"Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login",LOGIN_FAILED:"Login failed.",NOT_PERMISSION:"You don't have permission to call this api",CLIENT_NOT_SUPPORT:"This API is not supported in this Zalo version",DECODE_FAILED:"Can not decode your data. Read more at: https://miniapp.zalo.me/docs/api/error"},fi="apps/get-info",mi={android:12100571,iOS:400,wp:0,unknown:0},gi=[si.GET_DOWNLOADED_STICKER.name,si.OPEN_SHARE_STICKER.name,si.OPEN_PROFILE.name,si.OPEN_FEED_DETAIL.name,si.OPEN_FRIEND_RADA.name,si.OPEN_INAPP.name,si.OPEN_OUTAPP.name,si.OPEN_PAGE.name,si.OPEN_PHOTODETAIL.name,si.OPEN_GALARY.name,si.OPEN_GAMECENTER.name,si.OPEN_GAMENEWS.name,si.OPEN_TAB_CONTACT.name,si.OPEN_TAB_SOCIAL.name,si.OPEN_FRIENDSUGGEST.name,si.OPEN_GROUPLIST.name,si.OPEN_NEARBY.name,si.OPEN_ROOM.name,si.OPEN_STICKERSTORE.name,si.OPEN_CREATECHAT.name,si.COPY_LINK_CATESTICKER.name,si.REQUEST_BUY_STICKER.name,si.OPEN_CHAT.name,si.OPEN_TAB_CHAT.name,si.OPEN_CHATGROUP.name,si.OPEN_ADDFRIEND.name,si.OPEN_TAB_MORE.name,si.OPEN_POSTFEED.name,si.OPEN_LOGINDEVICES.name,si.OPEN_SENDSTICKER.name,si.REPORT_ABUSE.name,si.FOLLOW_OA.name,si.UNFOLLOW_OA.name,si.OPEN_GAMEDETAIL.name,si.OPEN_SHARESHEET.name,si.REQUEST_PERMISSION_CAMERA.name,si.CHANGE_TITLE_HEADER.name,si.WEBVIEW_CLEARCACHE.name,si.WEBVIEW_CONFIRMCACHE.name,si.WEBVIEW_ISVISIBLE.name,si.WEBVIEW_NETWORKTYPE.name,si.CHANGE_BUTTON_HEADER.name,si.CREATE_OPTIONS_MENU.name,si.CREATE_SHORTCUT.name,si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,si.WINDOW_CLOSE.name,si.WEBVIEW_CHECKRESERROR.name,si.IAP_REQUESTPAYMENT.name,si.ZBROWSER_GETSTATS.name,si.ZBROWSER_JSBRIDGE.name,si.PROMPT_AUTHENTICATION.name,si.CHANGE_ACTIONBAR_COLOR.name,si.PROMPT_AUTHENTICATION_CHECK_STATE.name,si.OPEN_APPSTORE.name,si.GET_LOCATION.name,si.QUERY_LOCATION_HIDE.name,si.SHOW_TOAST.name,si.OPEN_APP.name,si.HIDE_KEYBOARD.name,si.OPEN_PHONE.name,si.OPEN_QR.name,si.OPEN_SMS.name,si.VIEW_MYQR.name,si.KEEP_SCREEN.name,si.CHANGE_AUTOROTATE.name,si.CHECK_APP_INSTALLED.name,si.QUERY_SHOW.name,si.QUERY_HIDE.name,si.OPEN_INAPPRW.name,si.ZALORUN_GETTRACKINGSTATUS.name,si.ZALORUN_SETTRACKINGSTATUS.name,si.ZALORUN_GETDAYSTEP.name,si.ZALORUN_FORCESUBMITDATA.name,si.ZALORUN_SETWEIGHT.name,si.OPEN_PROFILE_EXT.name,si.DOWNLOAD_CATE.name,si.JUMP_LOGIN.name,si.OPEN_ADTIMA_ADS_INTERSTITIAL.name,si.OPEN_ADTIMA_ADS.name,si.GET_ADIDCLIENT.name,si.SCAN_IBEACON.name,si.SAVE_IMAGE_GALLERY.name,si.OPEN_MP.name,si.CHANGE_ACTIONBAR.name,si.INTERACTIVE_VIBRATION.name,si.ZBROWSER_MPDS.name],yi=0,_i=3,Ei=1,Si=0;class Ai{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${this.api}; code: ${this.code}; message: ${this.message}`}}class Ti extends Ai{constructor(e,t){super(e,t),this.message=`${t}. ${vi.READ_MORE}`,this.handler()}handler(){switch(this.code){case e.NativeCode.token_invalid:this.code=di,this.message=vi.LOGIN_REQUIRED;break;case e.NativeCode.not_permission:this.code=pi,this.message=vi.NOT_PERMISSION;break;case e.NativeCode.client_not_support:this.code=hi,this.message=vi.CLIENT_NOT_SUPPORT;break;case e.NativeCode.decode_failed:this.message=vi.DECODE_FAILED}}}const Oi={handler:null,setHandler(e){this.handler=e}};Oi.setHandler(((e,t)=>t instanceof Ai?(t.api=e,t):new Ai(-2001,Gt.isNull(t.message)?"Unknown Error":t.message,e)));const bi=(e,t,i)=>{const o=i.value;return i.value=function(...e){return n(this,void 0,void 0,(function*(){const{success:i,fail:r}=Array.isArray(e)&&e.length>0&&e[0];return new Promise(((a,s)=>n(this,void 0,void 0,(function*(){try{const t=yield o.apply(this,e);!Gt.isNull(i)&&Gt.isFunction(i)?i.call(null,t,this):a(t)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===di||(null==e?void 0:e.code)===pi)){let t=!1;this instanceof vo&&(t=this.getLoginStatus()),t||(e=new Ai(di,vi.LOGIN_REQUIRED))}const{handler:i}=Oi,n=i.call(null,t,e,this);window.zmpSentry&&window.zmpSentry.throwError(n.toString()),!Gt.isNull(r)&&Gt.isFunction(r)?r.call(null,n,this):s(n)}}))))}))},i},wi=(e,t,i)=>{const n=i.value;return i.value=function(...e){try{return n.apply(this,e)}catch(e){if("login"!==(null==e?void 0:e.api)&&((null==e?void 0:e.code)===di||(null==e?void 0:e.code)===pi)){let t=!1;this instanceof vo&&(t=this.getLoginStatus()),t||(e=new Ai(di,vi.LOGIN_REQUIRED))}const{handler:i}=Oi,n=i.call(null,t,e,this);throw window.zmpSentry&&window.zmpSentry.throwError(n.toString()),n}},i},Ni=(e,t)=>({code:li,message:t||vi.SUCCESS,data:e||{}}),Pi={badRequest:e=>new Ai(ci,e),loginFailed:()=>new Ai(ci,vi.LOGIN_FAILED),loginRequired:()=>new Ai(di,vi.LOGIN_REQUIRED),missingParam:e=>new Ai(ci,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new Ai(ci,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new Ai(ui,"Can not get app info to share"),lengthInvalid:e=>new Ai(ci,`${e} length is invalid.`)};const Ci={encode:function(e){var t=[];for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(void 0===n)return;if(null===n)return void t.push(i);t.push(encodeURIComponent(i)+"="+encodeURIComponent(n))}return t.join("&")},decode:function(e,t){var i={};if(""===e)return i;for(var n=e.split("&"),o=0;o<n.length;o++){var r=n[o].split("=",2),a=decodeURIComponent(r[0]);if(t&&Object.prototype.hasOwnProperty.call(i,a))throw new URIError("Duplicate key: "+a);i[a]=2===r.length?decodeURIComponent(r[1]):null}return i},appendToUrl:function(e,t){return e+(-1!==e.indexOf("?")?"&":"?")+("string"==typeof t?t:Ci.encode(t))},getParameterByName:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},getParamsAsObject:function(e){var t={};return e?(e.split("&").map((function(e){var i=e.split("=");i&&2==i.length&&(t[i[0]]=decodeURIComponent(i[1].replace(/\+/g," ")))})),t):t},toQueryString:function(e){if(!e)return"";if("object"!=(void 0===e?"undefined":typeof e))return e;var t=Object.keys(e),i=[];return t.map((function(t){var n=e[t],o=[t,n="object"==(void 0===n?"undefined":typeof n)?JSON.stringify(n):encodeURIComponent(n)].join("=");i.push(o)})),i.join("&")}},Ii=new RegExp("[\\u0300-\\u036f]","g"),ki=new RegExp("[đ|Đ]","g"),Ri=new RegExp("\\s","g"),Bi=Ht("zmp:utils:common"),Di=e=>{try{new URL(e)}catch(e){return!1}return!0},ji=()=>navigator.userAgent||navigator.vendor||window.opera,Li=()=>{const e=ji().toLowerCase();return{isWP:/iemobile/.test(e),isAndroid:/android/i.test(e)&&!/iemobile/.test(e),isIOS:/iphone|ios|ipad|ipod/.test(e)&&!/iemobile/.test(e),isMobile:/android|iphone|ios|ipad|ipod|iemobile/.test(e),isZalo:/zalo/.test(e)}},Mi=e=>{const t=document.getElementsByTagName("meta");for(let i=0;i<t.length;i++)if(t[i].getAttribute("name")===e||t[i].getAttribute("property")===e)return t[i].getAttribute("content");return""},Ui=()=>{const e=ji().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Wi=()=>{let t=Li();return t.isWP?e.PlatformType.wp:t.isAndroid?e.PlatformType.android:t.isIOS?e.PlatformType.iOS:e.PlatformType.unknown},xi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Di(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Di(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},zi=e=>(e=>{let t=Vt(e);return t||(t=Zt(e),t)?t:$t(e)})(e),Fi=e=>{if(Gt.isObject(JSON)&&JSON.parse&&Gt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");return JSON.parse(t,((e,t)=>t))}return Gt.isObject(e)?e:new Function("return "+e)()},Gi=e=>{if(Gt.isObject(JSON)&&JSON.stringify)return JSON.stringify(e);if(void 0===e)return"undefined";if(null===e)return"null";try{if("string"==typeof e||null!==e.constructor.toString().match(/string/i))return'"'+e.replace(/"/g,'\\"')+'"'}catch(e){console.log(e)}var t;if(null!==Object.prototype.toString.call(e).match(/array/i)){t=new Array;for(var i=e.length,n=0;n<i;n++)t.push(Gi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Gi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Hi=()=>{try{const e=Number(Ui()),t=Wi();return e>=mi[t]}catch(e){return!0}},$i=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"&#39;"),Vi=e=>{try{if(e){Bi(e);const t=e.replace(/\\/g,"").replace(/&#39;/g,"'");return Bi("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Bi("parse json error:",t),e}},Zi=(e,t,i,o,r,a)=>n(void 0,void 0,void 0,(function*(){const n=new URL(location.href),s=new URLSearchParams;let l=`${n.pathname}${n.search}`;a&&(l=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const c=new URL(`https://zalo.me/app/link${l}`);s.append("title",i),s.append("description",o||""),s.append("thumbnail",r),s.append("url",c.href),s.append("accessToken",t||"");const u=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),d=yield u.json();if(!d||0!==d.err)throw Pi.cannotGetShareInfo();return c.search=`${c.search}&zshareId=${d.data.shareId}`,Object.assign(Object.assign({},d.data),{shareableLink:c.href})})),Ji=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>xi(i,e))):xi(i,e)))return{error:!0,errorMessage:e};if(t){if(Array.isArray(null==t?void 0:t.values))return{error:!(null==t?void 0:t.values.includes(i)),errorMessage:null==t?void 0:t.values.toString()};if(Gt.isNumber(null==t?void 0:t.maxLength))return{error:(Gt.isString(i)||Gt.isArray(i))&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(Gt.isNumber(null==t?void 0:t.min)&&Gt.isNumber(null==t?void 0:t.max))return{error:i<(null==t?void 0:t.min)||i>(null==t?void 0:t.max),errorMessage:`data must be in between ${null==t?void 0:t.min} and ${null==t?void 0:t.max}`};if(Gt.isNumber(null==t?void 0:t.min))return{error:i<(null==t?void 0:t.min),errorMessage:`data must >= ${null==t?void 0:t.min}`};if(Gt.isNumber(null==t?void 0:t.max))return{error:i>(null==t?void 0:t.max),errorMessage:`data must <= ${null==t?void 0:t.max}`};if(Gt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},Ki=(e,t,i)=>n(void 0,void 0,void 0,(function*(){const n={appId:e,versionStatus:t};Gt.isUndefined(i)||(n.currentVersion=i);const o=Ci.appendToUrl(`https://h5.zalo.me/${fi}`,n),r=yield fetch(o,{credentials:"include"});if(r.ok){const e=yield r.json();if(e.err<0||!e.data)throw new Error(e);return{name:e.data.name,version:e.data.version,description:e.data.description,appUrl:e.data.appUrl,qrCodeUrl:e.data.qrCodeUrl,logoUrl:e.data.logoUrl}}throw new Error("Can't get app info")}));var Qi=p((function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,a=new Array(r);o<r;o++)a[o]=n[o].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,o,r,a){var s=i?i+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,o),!0;case 5:return u.fn.call(u.context,t,n,o,r),!0;case 6:return u.fn.call(u.context,t,n,o,r,a),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var p,h=u.length;for(c=0;c<h;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,o);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,o){var r=i?i+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||o&&!s.once||n&&s.context!==n||a(this,r);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||n&&s[l].context!==n)&&c.push(s[l]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}));class qi extends Qi{constructor(){super(),this.debug=Ht("zmp:event-emitter")}static getInstance(){return qi.instance||(qi.instance=new qi),qi.instance}h5ConfirmHandleEvent(e,t,i){ZaloJavaScriptInterface.jsH5EventCallback(e,t,i||"")}on(e,t,i){this.debug(`register ${e}: ${i}`);return super.on(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}once(e,t,i){this.debug(`register once ${e}: ${i}`);return super.once(e,((n,o)=>{this.h5ConfirmHandleEvent(n,e,i),t(o)}),i)}}var Yi={},Xi=function(e,t,i){var n=t||"default";return function(){var t=n in Yi?Yi[n](e,i):e;return t.apply(this,arguments)}};Xi.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];Yi[t]=e};var en={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function tn(e){try{return null===e?en:JSON.parse(e)}catch(e){return en}}var nn,on={execute:function(e,t,i,n){i.suppress_http_code=1;var o=Ci.encode(i);"post"!=t&&(e=Ci.appendToUrl(e,o),o="");var r=function(e,t){if(!self.XMLHttpRequest)return null;var i=new XMLHttpRequest,n=function(){};if(!("withCredentials"in i))return null;i.open(e,t,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o={send:function(e){i.send(e)}},r=Xi((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=Xi((function(){a=n,"onerror"in o&&o.onerror(i)}),"entry","XMLHttpRequest:error");return i.onload=function(){r()},i.onerror=function(){a()},i.onreadystatechange=function(){4==i.readyState&&(200==i.status?r():a())},o}(t,e);return!!r&&(r.onload=function(e){n(tn(e.responseText))},r.onerror=function(e){e.responseText?n(tn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class rn extends Qi{constructor(){super(),this.debug=Ht("zmp:ZaloJSBridge"),this.events=qi.getInstance(),this._accessTk=zi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=zi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=ji(),this._device=Li(),this._jsCallFuncCallbacks={},this.events.on(e.Events.AppPaused,(()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}})),this.sendLogTimer?clearInterval(this.sendLogTimer):this.sendLogTimer=setInterval((()=>{if(this.results.length>0){let e=this.results;this.results=[];try{this.sendLogData(e)}catch(e){}}}),5e3)}static getInstance(){return rn.instance||(rn.instance=new rn),rn.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{on.execute("https://h5.zalo.me/log/async","post",{appId:window.APP_ID,data:JSON.stringify(e)},(e=>{}))}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Fi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n),this._jsCallFuncCallbacks[e]=null,delete this._jsCallFuncCallbacks[e]}}this.results.push({action:i.action,error:i.error_code})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Fi(t);if(this._jsCallFuncCallbacks[e]){const t=this._jsCallFuncCallbacks[e].callback,n=this._jsCallFuncCallbacks[e].timeout;if(t){try{t.call(this,i)}catch(e){console.error("Call callback error",e)}n&&clearTimeout(n)}}this.results.push({action:i.action,error:i.error_code})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Vi(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(t,i){try{switch(t){case e.Events.OpenApp:const{url:t}=i,n=new URL(t),o=n.pathname.split(`/zapps/${Qt}`)[1];return{path:`${o||"/"}${n.search}`};default:return i}}catch(e){return i}}defaultCallback(e){null!=e&&(e=Fi(e))}jsCall(e,t,i,n=!1,o=3,r=!0){try{const a=e.name,s=((e="")=>`${e.normalize("NFD").replace(Ii,"").replace(ki,"d").replace(Ri,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(a);if(!this._device.isMobile||Gt.isEmpty(a))return this.onJSCall(s,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a}),!1;null==t&&(t={}),i||(i=this.defaultCallback);const l={error_code:-14,error_message:"Request Timeout!",data:{},action:a};this._jsCallFuncCallbacks[s]={timeout:r&&e.have_callback&&setTimeout((()=>{this.onJSCall(s,l)}),8e3),callback:i};try{return t=Gi(t),n?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onMultiJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onMultiJSCall('${s}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,window.onJSCall(s)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,a,this._accessTk,t,`window.onJSCall('${s}')`)}catch(r){if(!(o-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:t,jsToken:this._jsAccessTk,access_token:this._accessTk},action:a,js_error:r};return this.onJSCall(s,e),!1}setTimeout((()=>{this.jsCall(e,t,i,n,o)}),500)}}catch(e){console.log("jsCall","error",e)}return!1}}class an{constructor(){this.debug=Ht("zmp:ZJSBridgeProvider"),nn.set(this,void 0),r(this,nn,rn.getInstance(),"f")}setZAccSession(e){o(this,nn,"f").accessTk=e}setJSToken(e){o(this,nn,"f").jsAccessTk=e}callNative(e,t,i){return this.debug(e.name,t),new Promise(((r,a)=>{const s=o=>n(this,void 0,void 0,(function*(){try{const n=new Ti(o.error_code,`${o.action}: ${o.error_message}`);if(null==i?void 0:i.callback){const e=yield i.callback(o,n);return r(e)}if(o&&o.error_code>=0)r(o.data||{});else if(o&&o.error_code<0){try{window.zmpSentry&&window.zmpSentry.captureMessage(`${e.name}: call native fail`,{extra:{data:t,rs:o}})}catch(e){}return a(n)}}catch(e){return a(e)}})),l=Li().isIOS,c=(e=>{var t;const i=Ui(),n=(null===(t=null==e?void 0:e.version_live)||void 0===t?void 0:t.iOS)||0;return!!(Array.isArray(window.ignoreCheckSupport)&&window.ignoreCheckSupport.length>0&&window.ignoreCheckSupport.includes(e.name))||i>=n})(e);if(l&&!c){const t=new Ti(-5,`${e}: Client isn't support this action`);return a(t)}(null==i?void 0:i.delay)?setTimeout((()=>{o(this,nn,"f").jsCall(e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}),i.delay):o(this,nn,"f").jsCall(e,t,s,null==i?void 0:i.isMultiCallback,null==i?void 0:i.nRetry,null==i?void 0:i.haveTimeout)}))}}nn=new WeakMap;var sn,ln,cn,un,dn,pn="2.18.9";class hn{static getVersion(){return pn}static getSystemInfo(){return{version:Mi("version-id")||"",apiVersion:pn,zaloVersion:Ui(),platform:Wi(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return n(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield Ki(e,0,t.version)}))}}class vn{static setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){const t={};let i;Gt.isEmpty(e.textColor)||(t.textColor=e.textColor),Gt.isString(e.color)&&e.color.length>0?(Gt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(Gt.isEmpty(e.statusBarColor)||(t.backgroundColor=e.statusBarColor),i=6),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{actionbarType:i,dataConfig:Object.assign(Object.assign({},e.dataConfig),t)}))),yield this.callNative(si.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){const t="none"===e.type||"home"===e.type?_i:yi,i="home"===e.type||"both"===e.type?Ei:Si;this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:t,dataConfig:Object.assign(Object.assign({},e.dataConfig),{viewInLeftType:t}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:i})}))),yield this.callNative(si.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarRightButton(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.CREATE_OPTIONS_MENU,{supportToolBar:e.supportToolBar,reset:e.reset,menuListItems:e.menuListItems,zapp:this.getAppId()})}))}}class fn{static setBackgroundColor(e){return n(this,void 0,void 0,(function*(){Gt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.callNative(si.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class mn{constructor(e,t,i,n){this.title=n,this.severity=t;const o=new Date;if(this.time=o.toLocaleTimeString(),this.content=e,i>0){const e=(new Error).stack;this.stack=e?e.replace("Error\n",""):""}}toString(){return(this.content.stack?[this.title,this.severity.toUpperCase(),this.time,this.content,this.content.stack.replace("Error:","")]:[this.title,this.severity.toUpperCase(),this.time,JSON.stringify(this.content),this.stack]).join(" ")}}sn=new WeakMap,ln=new WeakMap,cn=new WeakMap,un=new WeakMap,dn=new WeakMap;const gn=new class{constructor(){sn.set(this,3),ln.set(this,["none","error","warn","info"]),cn.set(this,"[zmp] > "),un.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),dn.set(this,((e,t,i)=>{o(this,un,"f")[o(this,ln,"f")[e]]++;const n=o(this,ln,"f")[e];if(r(this,cn,o(this,cn,"f")+("string"!=typeof t?new mn(t,n,e,i).toString():t),"f"),!(e>o(this,sn,"f")))switch(e){case 1:console.error(o(this,cn,"f"));break;case 2:console.warn(o(this,cn,"f"));break;case 3:console.info(o(this,cn,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){r(this,sn,e,"f")}info(e){o(this,dn,"f").call(this,3,e)}warn(e,t){o(this,dn,"f").call(this,2,e,t)}error(e,t){o(this,dn,"f").call(this,1,e,t)}getMetrics(){return o(this,un,"f")}};class yn{static setDeviceOrientation(t){return n(this,void 0,void 0,(function*(){yield this.callNative(si.CHANGE_AUTOROTATE,{autoRotate:e.OrientationType[t.rotate]})}))}static getNetworkType(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((t=>{const i=t.network;let n;const o=Li().isAndroid;switch(i){case ai(o).NONE:n=e.NetworkType.none;break;case ai(o).WIFI:n=e.NetworkType.wifi;break;case ai(o)["2G"]:case ai(o)["3G"]:case ai(o)["4G"]:n=e.NetworkType.cellular;break;default:n=e.NetworkType.unknown}return{networkType:n}}))}))}static onNetworkStatusChange(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.NetworkChanged,(e=>{const i=e&&e.state;this.getNetworkType().then((e=>{const n={isConnected:"CONNECTED"===i,networkType:e&&e.networkType};t(n)})).catch((e=>{gn.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,i,o,r,a;return n(this,void 0,void 0,(function*(){const n={subaction:0,scanning_type:Gt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:Gt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:Gt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:Gt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:Gt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:Gt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:Gt.isNumber(null===(i=null==e?void 0:e.scanConfig)||void 0===i?void 0:i.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:Gt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:Gt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:Gt.isNumber(null===(a=null==e?void 0:e.scanConfig)||void 0===a?void 0:a.beaconConnectedTimeout)?e.scanConfig.beaconConnectedTimeout:6e5},items:Array.isArray(null==e?void 0:e.items)?null==e?void 0:e.items:[]}};return yield this.callNative(si.SCAN_IBEACON,Object.assign({},n)),!0}))}static stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.SCAN_IBEACON,Object.assign({},{subaction:1}),{isMultiCallback:!0}).then((e=>{const t={beacons:[]};return Array.isArray(e)&&e.forEach((e=>{const i={uuid:e.uuid,major:e.major,minor:e.minor,distance:e.distance,rssi:e.rssi};t.beacons.push(i)})),t}))}))}static stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.callNative({name:""},t)}))}static getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return this.callNative({name:""},{})}))}static scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.HIDE_KEYBOARD,{})}))}static openPhone(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.PROMPT_AUTHENTICATION,{secret_data:e.secretData,app_id:this.getZAppId(),ui:{title:e.ui.title,sub_title:e.ui.subTitle,negative_text:e.ui.negativeButtonText},require_fingerprint:e.requireFingerprint?1:0}).then((e=>{var t,i,n,o;return{code:null==e?void 0:e.error_code,message:null==e?void 0:e.error_message,data:{domain:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.domain,code:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.error_code,message:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_message,payToken:null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pay_token}}}))}))}static checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.INTERACTIVE_VIBRATION,{type:e.VibrateType[t.type],vibrate_time:t.milliseconds})}))}static connectWifi(e){return n(this,void 0,void 0,(function*(){let t="open";return Gt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.callNative(si.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}}var _n,En,Sn,An,Tn,On,bn,wn,Nn,Pn,Cn,In,kn,Rn,Bn,Dn,jn,Ln,Mn,Un,Wn,xn,zn,Fn,Gn,Hn,$n,Vn;class Zn{constructor(e){_n.set(this,localStorage),En.set(this,void 0),Sn.set(this,void 0),Li(),r(this,Sn,{keys:new Set,currentSize:0,limitSize:ri},"f"),r(this,En,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in o(this,_n,"f")){if(e){if(t.split("_")[0]!==e)continue}o(this,Sn,"f").keys.add(t)}}catch(e){gn.error(e,"LocalResourceStorage > findAllCurrentDataByApp")}}get(e){let t=new Map;return e.forEach((e=>{t.set(e,this.getSync(e))})),Promise.resolve(t)}getSync(e){return o(this,En,"f")&&(e=`${o(this,En,"f")}_${e}`),o(this,Sn,"f").keys.has(e)?o(this,_n,"f").getItem(e):null}set(e){return n(this,void 0,void 0,(function*(){return Object.entries(e).forEach((([e,t])=>{this.setSync(e,t.replace(/\\"/g,'"'))})),Promise.resolve({errorKeys:[]})}))}setSync(e,t){o(this,En,"f")&&(e=`${o(this,En,"f")}_${e}`),o(this,_n,"f").setItem(e,t),o(this,Sn,"f").keys.add(e)}getInfo(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.getInfoSync())}))}getInfoSync(){const e=((e,t)=>{let i,n,o=0;for(n in e){const r=n.split("_")[0];e.hasOwnProperty(n)&&(t&&r!==t||(i=2*(e[n].length+n.length),o+=i))}return o})(o(this,_n,"f"),o(this,En,"f"));return{currentSize:Gt.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return n(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){o(this,En,"f")&&(e=`${o(this,En,"f")}_${e}`),o(this,Sn,"f").keys.has(e)&&(o(this,_n,"f").removeItem(e),o(this,Sn,"f").keys.delete(e))}clear(){return n(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){o(this,Sn,"f").keys.forEach((e=>{o(this,En,"f")&&e.indexOf(o(this,En,"f"))<0||(o(this,_n,"f").removeItem(e),o(this,Sn,"f").keys.delete(e))}))}}_n=new WeakMap,En=new WeakMap,Sn=new WeakMap;class Jn extends an{constructor(e){super(),An.set(this,void 0),Tn.set(this,void 0),r(this,Tn,{keys:new Set,currentSize:0,limitSize:ri},"f"),r(this,An,e,"f")}get(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=new Map;return e&&e.mpds_data&&e.mpds_data.map&&(t=new Map(Object.entries(e.mpds_data.map))),t}))}))}set(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}getInfo(){return n(this,void 0,void 0,(function*(){const e=yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=0;return e&&e.mpds_data&&e.mpds_data.size&&(t=e.mpds_data.size),t}));return{currentSize:Gt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return n(this,void 0,void 0,(function*(){return{errorKeys:yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:o(this,An,"f")},{isMultiCallback:!1}).then((e=>{let t=[];return e&&e.mpds_data&&e.mpds_data.error_keys&&(t=e.mpds_data.error_keys),t}))}}))}clear(){return n(this,void 0,void 0,(function*(){yield this.callNative(si.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:o(this,An,"f")})}))}}An=new WeakMap,Tn=new WeakMap;class Kn{getDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Vi(e)})),n}))}putDataToStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{Gt.isUndefined(t)||Gt.isNull(t)||(i[e]=$i(t))})),yield t.set(i)}))}removeDataFromStorage(e){return n(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return n(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Qn extends Kn{constructor(e){super(),On.set(this,void 0),r(this,On,e,"f")}getInstance(){return new Zn(o(this,On,"f"))}}On=new WeakMap;class qn extends Kn{constructor(e){super(),bn.set(this,void 0),r(this,bn,e,"f")}getInstance(){return new Jn(o(this,bn,"f"))}}bn=new WeakMap;class Yn{static setStorage(e){return n(this,void 0,void 0,(function*(){let t=new Qn(this.getAppId());return Hi()&&(t=new qn(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return n(this,void 0,void 0,(function*(){let t=new Qn(this.getAppId());Hi()&&(t=new qn(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return n(this,void 0,void 0,(function*(){let e=new Qn(this.getAppId());return Hi()&&(e=new qn(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return n(this,void 0,void 0,(function*(){let t=new Qn(this.getAppId());return Hi()&&(t=new qn(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return n(this,void 0,void 0,(function*(){let e=new Qn(this.getAppId());Hi()&&(e=new qn(this.getAppId())),yield e.clearStorage()}))}}class Xn{static getUserInfo(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let i="id,name,picture";(null==e?void 0:e.avatarType)&&(i=`${i}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${ti}?fields=${i}`,{headers:{access_token:t||""}}).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json(),i={id:t.id,name:t.name,birthday:"",gender:"",avatar:t.picture&&t.picture.data&&t.picture.data.url};return console.warn("'birthday' and 'gender' are deprecated"),i}))))}}))}static getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.MP_GET_NUMBER,{},{isMultiCallback:!0,callback:(e,t)=>{if(0===e.error_code){const t={number:e.data};return Promise.resolve(t)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}}class eo{static closeApp(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.WINDOW_CLOSE,{})}))}static openMiniApp(e){return n(this,void 0,void 0,(function*(){const t=null==e?void 0:e.appId,i=(null==e?void 0:e.params)||{},n=Object.entries(i).map((function([e,t]){return[e,t].join("=")})).join("&");let o;try{o=yield Ki(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.callNative(si.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.OPEN_INAPP,{url:e.url})}))}static closeLoading(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class to{static getLocation(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.GET_LOCATION,{silent_request:!1,permission_description:"Cho phép Zalo truy cập vào vị trí của thiết bị này?"},{isMultiCallback:!0,haveTimeout:!1,callback:(e,t)=>{if(0===e.error_code){const t=e.data,i={latitude:t.latitude,longitude:t.longitude,timestamp:t.timestamp,provider:t.provider};return Promise.resolve(i)}return Promise.reject(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class io{static requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.REQUEST_PERMISSION_CAMERA,{},{callback:(e,t)=>-2===e.error_code||e.error_code>=0?Promise.resolve({userAllow:-2!==e.error_code,message:e.error_message}):Promise.reject(t)})}))}static saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){let t={};return Gt.isEmpty(e.imageBase64Data)?Gt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.callNative(si.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class no{static viewOAQr(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_PROFILE,{uId:t.id,type:e.ProfileType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openChat(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_CHAT,{uId:t.id,type:e.ChatType[t.type],zapp:this.getZAppId(),sourceId:t.sourceId,sourceIndex:t.sourceIndex})}))}static openPostFeed(t){return n(this,void 0,void 0,(function*(){let i={};switch(t.type){case"image":i={photoUrl:t.data.imageUrl};break;case"link":i={link:t.data.link,title:t.data.title,thumb:t.data.thumb,description:t.data.description};break;case"profile":i={avt:t.data.avatar,uid:t.data.id,dpn:t.data.displayName}}return yield this.callNative(si.OPEN_POSTFEED,Object.assign(Object.assign({type:e.PostFeedType[t.type]},i),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return n(this,void 0,void 0,(function*(){yield this.callNative(si.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(t){return n(this,void 0,void 0,(function*(){let i={};switch(t.type){case"image":let e=[];Array.isArray(t.data.imageUrls)&&t.data.imageUrls.length>0?e=t.data.imageUrls:e.push(t.data.imageUrl),i={photoUrls:e,photoUrl:t.data.imageUrl,caption:t.data.caption};break;case"gif":i={photoUrl:t.data.imageUrl,gifUrl:t.data.gifUrl,width:t.data.width,height:t.data.height};break;case"video":i={videoThumb:t.data.videoThumb,videoUrl:t.data.videoUrl,width:t.data.width,height:t.data.height};break;case"link":i={link:t.data.link,chatOnly:t.data.chatOnly?1:0};break;case"oa":i={uid:t.data.id};break;case"zmp":const n=yield this.getAccessToken(),o=yield Zi(this.getAppId(),n||"",t.data.title||"",t.data.description||"",t.data.thumbnail||"",t.data.path);window.forceShareZMP?i={data:{ZInstantAPIInfo:{url:`${o.zinstantApi}`,zinstantdata_id:`templateId=${o.ztemplateId}&appId=${this.getAppId()}&shareId=${o.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(i={link:o.shareableLink,chatOnly:t.data.chatOnly?1:0},t.type="link")}return yield this.callNative(si.OPEN_SHARESHEET,Object.assign(Object.assign({type:e.ShareSheetType[t.type]},i),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,i){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.CREATE_SHORTCUT,{url:e,title:t,iconUrl:i})}))}static openProfilePicker(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,callback:(e,t)=>0===e.error_code&&Array.isArray(e.data)?Promise.resolve(e.data.map((e=>e.id))):Promise.reject(t)})}))}static getActionsSupported(t){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,callback:(t,i)=>{const n=Wi();if(Array.isArray(t.actions)&&t.actions.length>0){const e=Object.keys(si).filter((e=>si[e].skip_jump)),i={actions:[...t.actions,...e]};return Promise.resolve(i)}if(n===e.PlatformType.iOS){const e={actions:gi};return Promise.resolve(e)}return Promise.reject(i)}})}))}static openMediaPicker(t,i,o,r){return n(this,void 0,void 0,(function*(){const n={type:0,url:"https://zapi-server.tungnt.xyz/upload/photos",maxSize:1048576};return yield this.callNative(si.PICK_MEDIA,{media_type:e.MediaPickerType[t],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),i),silent_request:o,upload:n,max_select_item:r},{isMultiCallback:!0,callback:(e,t)=>{var i,n;if(0===e.error_code){const t=Vi(null===(i=e.data)||void 0===i?void 0:i.result_content),o={urls:null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.urls};return Promise.resolve(o)}return Promise.reject(t)}})}))}static openOutApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.OPEN_OUTAPP,{url:e})}))}}class oo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Ci.getParamsAsObject(i))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return n(this,void 0,void 0,(function*(){return yield this.callNative(si.WEBVIEW_SET_RESULT,{result:$i(e.data)})}))}static onCallbackData(t){return n(this,void 0,void 0,(function*(){yield this.events.on(e.Events.OnDataCallback,(e=>{t({data:e})}))}))}}class ro extends an{constructor(){var e,t,i,n,a,s,l,c,u,d,p,h,v,f,m,g,y;super(),wn.set(this,Kt),Nn.set(this,Qt),Pn.set(this,qt),Cn.set(this,void 0),In.set(this,void 0),kn.set(this,void 0),Rn.set(this,null),Bn.set(this,{timer:{getToken:0}}),Dn.set(this,void 0),jn.set(this,void 0),Ln.set(this,null),this.events=qi.getInstance(),this.isIOS=Li().isIOS,Mn.set(this,void 0),this.getActionBarConfig=()=>o(this,Mn,"f"),this.setActionBarConfig=e=>{r(this,Mn,e(o(this,Mn,"f")),"f")},Un.set(this,(()=>new Promise(((e,t)=>{Gt.isUndefined(o(this,Ln,"f"))||Gt.isNull(o(this,Ln,"f"))?this.callNative(si.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],n=i.find((e=>e.name===Xt));n&&(this.setJSToken(n.value),window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(n.value)),r(this,Ln,i,"f"),e(i)})).catch((e=>{t(e)})):e(o(this,Ln,"f"))})))),Wn.set(this,vn.setNavigationBarRightButton),this.getVersion=hn.getVersion,this.getSystemInfo=hn.getSystemInfo,this.setNavigationBarTitle=vn.setNavigationBarTitle,this.setNavigationBarColor=vn.setNavigationBarColor,this.setNavigationBarLeftButton=vn.setNavigationBarLeftButton,this.setBackgroundColor=fn.setBackgroundColor,this.setDeviceOrientation=yn.setDeviceOrientation,this.setStorage=Yn.setStorage,this.getStorage=Yn.getStorage,this.getStorageInfo=Yn.getStorageInfo,this.removeStorage=Yn.removeStorage,this.clearStorage=Yn.clearStorage,this.getUserInfo=Xn.getUserInfo,this.getNetworkType=yn.getNetworkType,this.onNetworkStatusChange=yn.onNetworkStatusChange,this.startBeaconDiscovery=yn.startBeaconDiscovery,this.stopBeaconDiscovery=yn.stopBeaconDiscovery,this.getBeacons=yn.getBeacons,this.closeApp=eo.closeApp,this.getLocation=to.getLocation,this.stopBluetoothDevicesDiscovery=yn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=yn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=yn.openBluetoothAdapter,this.onBluetoothDeviceFound=yn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=yn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=yn.getConnectedBluetoothDevices,this.getBluetoothDevices=yn.getBluetoothDevices,this.getBluetoothAdapterState=yn.getBluetoothAdapterState,this.closeBluetoothAdapter=yn.closeBluetoothAdapter,this.scanQRCode=yn.scanQRCode,this.openProfile=no.openProfile,this.openChat=no.openChat,this.openPostFeed=no.openPostFeed,this.followOA=no.followOA,this.unFollowOA=no.unfollowOA,this.openShareSheet=no.openShareSheet,this.requestCameraPermission=io.requestCameraPermission,this.createShortcut=no.createShortcut,this.openBioAuthentication=yn.openBioAuthentication,this.checkStateBioAuthentication=yn.checkStateBioAuthentication,this.sendLocation=to.sendLocation,this.showToast=yn.showToast,this.hideKeyboard=yn.hideKeyboard,this.openPhone=yn.openPhone,this.openSMS=yn.openSMS,this.viewOAQr=no.viewOAQr,this.keepScreen=yn.keepScreen,this.saveImageToPhotosAlbum=io.saveImageToPhotosAlbum,this.openMiniApp=eo.openMiniApp,this.vibrate=yn.vibrate,this.openWebview=eo.openWebview,this.getRouteParams=oo.getRouteParams,this.getAppInfo=hn.getAppInfo,this.sendDataToPreviousMiniApp=oo.sendDataToPreviousMiniApp,this.onCallbackData=oo.onCallbackData,this.getPhoneNumber=Xn.getPhoneNumber,this.openProfilePicker=no.openProfilePicker,xn.set(this,no.getActionsSupported),this.connectWifi=yn.connectWifi,this.openMediaPicker=no.openMediaPicker,this.openOutApp=no.openOutApp,this.closeLoading=eo.closeLoading,r(this,Cn,null,"f"),r(this,In,null,"f"),r(this,kn,null,"f"),this.isShowNavBar=!0,r(this,Dn,0,"f"),r(this,jn,0,"f");const _="home"===(null===(t=null===(e=o(this,Pn,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(n=null===(i=o(this,Pn,"f"))||void 0===i?void 0:i.app)||void 0===n?void 0:n.leftButton)?Ei:Si,E=new URL(location.href),S=Gt.isString(null===(s=null===(a=o(this,Pn,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(u=null===(c=null===(l=o(this,Pn,"f"))||void 0===l?void 0:l.app)||void 0===c?void 0:c.headerColor)||void 0===u?void 0:u.length)>0?5:6,A="none"===(null===(p=null===(d=o(this,Pn,"f"))||void 0===d?void 0:d.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=o(this,Pn,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?_i:yi;r(this,Mn,{actionbarType:S,buttonType:A,dataConfig:{backgroundColor:(null===(m=null===(f=o(this,Pn,"f"))||void 0===f?void 0:f.app)||void 0===m?void 0:m.headerColor)||"",textColor:(null===(y=null===(g=o(this,Pn,"f"))||void 0===g?void 0:g.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:A,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${E.search}`}},"f")}static getInstance(){return ro.instance||(ro.instance=new ro),ro.instance}getLoginStatus(){return Gt.isString(o(this,kn,"f"))&&o(this,kn,"f").length>0}getAppId(){return o(this,Nn,"f")}getZAppId(){return o(this,wn,"f")}login(e){return n(this,void 0,void 0,(function*(){const e=yield o(this,Un,"f").call(this),t=e.find((e=>e.name===Yt)),i=e.find((e=>e.name===ei));if(!Gt.isUndefined(t)&&!Gt.isNull(t)&&Gt.isString(t.value)){if(r(this,Cn,t.value,"f"),Gt.isUndefined(i)||Gt.isNull(i)||!Gt.isString(i.value)?yield this.loginZaloV3():(r(this,In,i.value,"f"),yield this.loginZaloV4()),!o(this,kn,"f"))throw Pi.loginFailed();return o(this,kn,"f")}throw Pi.loginFailed()}))}loginZaloV3(){return n(this,void 0,void 0,(function*(){return yield fetch(`${ni}?app_id=${o(this,wn,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${o(this,Nn,"f")}/&code=${o(this,Cn,"f")}&isSDK=true123`).then((e=>n(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){r(this,kn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,jn,e,"f"),r(this,Dn,(new Date).getTime(),"f"),this.setZAccSession(o(this,kn,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,kn,"f")||""),o(this,kn,"f")}return null}))))}))}loginZaloV4(){return n(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",o(this,Nn,"f")),e.append("code",o(this,Cn,"f")||""),e.append("code_verifier",o(this,In,"f")||""),Gt.isNull(o(this,Rn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",o(this,Rn,"f")||""));return yield fetch(ii,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>n(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&r(this,Rn,t.refresh_token,"f"),t.access_token){r(this,kn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return r(this,jn,e,"f"),r(this,Dn,(new Date).getTime(),"f"),this.setZAccSession(o(this,kn,"f")||""),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(o(this,kn,"f")||""),o(this,kn,"f")}return null}))))}))}getAccessToken(e){return n(this,void 0,void 0,(function*(){const e=(new Date).getTime()-o(this,Dn,"f");if(!o(this,kn,"f"))throw Pi.loginRequired();return e<o(this,jn,"f")?o(this,kn,"f"):yield this.login()}))}}wn=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,In=new WeakMap,kn=new WeakMap,Rn=new WeakMap,Bn=new WeakMap,Dn=new WeakMap,jn=new WeakMap,Ln=new WeakMap,Mn=new WeakMap,Un=new WeakMap,Wn=new WeakMap,xn=new WeakMap;class ao{constructor(){zn.set(this,Kt),Fn.set(this,qt),Gn.set(this,"DEFAULT ZOAUTH"),Hn.set(this,"DEFAULT ACCESS TOKEN"),$n.set(this,{timer:{getToken:0}}),Vn.set(this,!1),this.getLoginStatus=()=>o(this,Vn,"f"),this.getAppId=()=>o(this,zn,"f"),this.login=()=>(r(this,Vn,!0,"f"),Promise.resolve(o(this,Gn,"f"))),this.getAccessToken=()=>Promise.resolve(o(this,Hn,"f")),this.getVersion=hn.getVersion,this.getSystemInfo=hn.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>n(this,void 0,void 0,(function*(){const t=new Qn(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>n(this,void 0,void 0,(function*(){const t=new Qn(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>n(this,void 0,void 0,(function*(){const e=new Qn(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>n(this,void 0,void 0,(function*(){const t=new Qn(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>n(this,void 0,void 0,(function*(){const e=new Qn(this.getAppId());return yield e.clearStorage()})),this.getUserInfo=()=>(console.warn("birthday and gender are deprecated"),Promise.resolve({userInfo:{id:"3368637342326461234",name:"User Name",avatar:"https://h5.zdn.vn/static/images/avatar.png"}})),this.getNetworkType=()=>{let t;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":t=e.NetworkType.none;break;case"4g":t=e.NetworkType.wifi;break;case"3g":case"2g":t=e.NetworkType.cellular;break;default:t=e.NetworkType.unknown}const i={networkType:t};return Promise.resolve(i)},this.onNetworkStatusChange=t=>{const i=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=i.effectiveType;return i.addEventListener("change",(function(){let i;switch(n){case"none":i=e.NetworkType.none;break;case"4g":i=e.NetworkType.wifi;break;case"3g":case"2g":i=e.NetworkType.cellular;break;default:i=e.NetworkType.unknown}t({isConnected:!0,networkType:i})})),Promise.resolve()},this.startBeaconDiscovery=e=>Promise.resolve(!0),this.stopBeaconDiscovery=e=>Promise.resolve(!0),this.getBeacons=e=>Promise.resolve({beacons:[]}),this.closeApp=()=>Promise.resolve(),this.getLocation=()=>Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"}),this.onBackButtonClick=()=>Promise.resolve(),this.stopBluetoothDevicesDiscovery=()=>Promise.resolve(),this.startBluetoothDevicesDiscovery=()=>Promise.resolve(),this.openBluetoothAdapter=()=>Promise.resolve(),this.onBluetoothDeviceFound=()=>Promise.resolve(),this.onBluetoothAdapterStateChange=()=>Promise.resolve(),this.getConnectedBluetoothDevices=()=>Promise.resolve(),this.getBluetoothDevices=()=>Promise.resolve(),this.getBluetoothAdapterState=()=>Promise.resolve(),this.closeBluetoothAdapter=()=>Promise.resolve(),this.scanQRCode=()=>Promise.resolve({content:"132"}),this.openProfile=()=>Promise.resolve(),this.openChat=()=>Promise.resolve(),this.openPostFeed=()=>Promise.resolve({status:1,shareType:0,numberOfUser:0}),this.followOA=()=>Promise.resolve(),this.unFollowOA=()=>Promise.resolve(),this.openShareSheet=()=>Promise.resolve({status:2,shareType:0,numberOfUser:0}),this.requestCameraPermission=()=>Promise.resolve({userAllow:!0,message:"Success"}),this.createShortcut=()=>Promise.resolve(),this.openBioAuthentication=()=>Promise.resolve({code:0,message:"OK",data:{domain:"",code:0,message:"",payToken:""}}),this.checkStateBioAuthentication=()=>Promise.resolve({bioState:""}),this.sendLocation=()=>Promise.resolve(),this.showToast=()=>Promise.resolve(),this.hideKeyboard=()=>Promise.resolve(),this.openPhone=()=>Promise.resolve(),this.openSMS=()=>Promise.resolve(),this.viewOAQr=()=>Promise.resolve(),this.keepScreen=()=>Promise.resolve(),this.saveImageToPhotosAlbum=()=>Promise.resolve(),this.openMiniApp=e=>Promise.resolve(),this.vibrate=()=>Promise.resolve(),this.openWebview=e=>(location.replace(e.url),Promise.resolve()),this.getRouteParams=oo.getRouteParams,this.getAppInfo=()=>Promise.resolve({description:"",name:"",version:"",appUrl:"",qrCodeUrl:""}),this.sendDataToPreviousMiniApp=e=>Promise.resolve(),this.onCallbackData=e=>(e({data:""}),Promise.resolve()),this.getPhoneNumber=()=>(console.warn("This api only works on zalo app"),Promise.resolve({number:""})),this.openProfilePicker=()=>(console.warn("This api only works on zalo app"),Promise.resolve([])),this.connectWifi=()=>(console.warn("This api only works on zalo app"),Promise.resolve()),this.openOutApp=e=>(location.href=e,Promise.resolve()),this.closeLoading=e=>Promise.resolve()}on(e,t,i){throw new Error("Method not implemented.")}once(e,t,i){throw new Error("Method not implemented.")}off(e,t,i,n){throw new Error("Method not implemented.")}removeAllListeners(e){throw new Error("Method not implemented.")}openMediaPicker(e,t,i,n){return console.warn("This api only works on zalo app"),Promise.resolve({urls:[]})}}zn=new WeakMap,Fn=new WeakMap,Gn=new WeakMap,Hn=new WeakMap,$n=new WeakMap,Vn=new WeakMap;const so=Symbol("required"),lo=Symbol("checkType"),co=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(so,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(so,r,i,n)},uo=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(lo,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(lo,a,n,o)};const po=(e,t,i)=>{const n=i.value,o=n.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",");return i.value=function(){const i=Reflect.getOwnMetadata(so,e,t),r=Reflect.getOwnMetadata(lo,e,t);return r&&r.forEach((e=>{const{parameterIndex:t,type:i,properties:n,defaultValue:r}=e;let a=arguments[t],s=o[t];const l=typeof a;if(!Gt.isUndefined(a)){if(!xi(a,i))throw Pi.wrongTypeParam(s,i,Array.isArray(a)?"array":null===a?"null":l);"object"===i&&Object.entries(n).forEach((([e,i])=>{const n=e.split("?")[0],o=Gt.get(a,n);if(Gt.isUndefined(o)||Gt.isNull(o)){if(!e.includes("?"))throw Pi.missingParam(e);Gt.isObject(Gt.get(a,n.split(".")[0]))&&r&&!Gt.isUndefined(Gt.get(r,n))&&Gt.set(arguments[t],n,Gt.get(r,n))}else if(Gt.isFunction(i)){const e=i(o);if(e&&e.error)throw Pi.wrongTypeParam(`${s}.${n}`,e.errorMessage,typeof o)}}))}})),i&&i.forEach((e=>{const{parameterIndex:t,option:i,fields:n}=e,o=arguments[t],r=null==i?void 0:i.if,a=null==i?void 0:i.defaultValue;let s=!0;r&&(s=Object.keys(r).every((e=>Gt.get(o,e)===r[e]))),s&&n.forEach((e=>{const i=e=>{let i=!1;return Gt.isEmpty(Gt.get(o,e))&&(Gt.isUndefined(Gt.get(a,e))||Gt.set(arguments[t],e,Gt.get(a,e)),i=!0),i};if(Array.isArray(e)&&e.length>0&&e.every(i))throw Pi.missingParam(e.join(" or "));if(Gt.isString(e)&&i(e))throw Pi.missingParam(e)}))})),n.apply(this,arguments)},i};var ho;class vo{constructor(){this.events=qi.getInstance(),ho.set(this,void 0),r(this,ho,this.getServiceInstance(),"f"),this.events.addListener=(t,i,n)=>{const o=t;return this.events.addListener(e.Events[o],i,n)}}login(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").login(e)}))}getLoginStatus(){return o(this,ho,"f").getLoginStatus()}getAccessToken(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getAccessToken(e)}))}getVersion(){return o(this,ho,"f").getVersion()}getSystemInfo(){return o(this,ho,"f").getSystemInfo()}setNavigationBarTitle(e){return n(this,void 0,void 0,(function*(){return o(this,ho,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setNavigationBarLeftButton(e)}))}setDeviceOrientation(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setDeviceOrientation(e)}))}setStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").setStorage(e)}))}getStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getStorage(e)}))}getStorageInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getStorageInfo(e)}))}removeStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").removeStorage(e)}))}clearStorage(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").clearStorage(e)}))}getUserInfo(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getUserInfo(e)}))}getNetworkType(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getBeacons(e)}))}closeApp(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").closeApp(e)}))}getLocation(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").closeBluetoothAdapter()}))}scanQRCode(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").scanQRCode(e)}))}openProfile(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openProfile(e)}))}openChat(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openChat(e)}))}openPostFeed(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openPostFeed(e)}))}followOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").followOA(e)}))}unfollowOA(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").unFollowOA(e)}))}openShareSheet(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openShareSheet(e)}))}requestCameraPermission(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").requestCameraPermission(e)}))}createShortcut(e){return n(this,void 0,void 0,(function*(){const t=yield Ki(Qt,0),i=Li().isIOS,n=t.logoUrl||Mi("og:image:url")||"",r=t.name||document.title,a=e.params?new URLSearchParams(e.params):new URLSearchParams;if(a.append("utm_source","zalo-shortcut"),a.append("utm_medium","default"),a.append("utm_campaign","default"),i){a.append("appId",Qt),a.append("appName",r),a.append("appIcon",n);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield o(this,ho,"f").openOutApp(encodeURI(e))}else yield o(this,ho,"f").createShortcut(`https://zalo.me/app/link/zapps/${Qt}/?${a.toString()}`,r,n);return Ni()}))}openBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").sendLocation(e)}))}showToast(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").showToast(e)}))}hideKeyboard(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").hideKeyboard(e)}))}openPhone(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").openPhone(e)}))}openSMS(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openSMS(e)}))}viewOAQr(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").viewOAQr(e)}))}keepScreen(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").keepScreen(e)}))}saveImageToGallery(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return n(this,void 0,void 0,(function*(){if(!Gt.isEmpty(e.params)){const t=e.params||{};Object.keys(t).forEach((e=>{"object"==typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=""+encodeURIComponent(t[e])})),e.params=t}yield o(this,ho,"f").openMiniApp(e)}))}vibrate(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").vibrate(e)}))}openWebview(e){return n(this,void 0,void 0,(function*(){yield o(this,ho,"f").openWebview(e)}))}getRouteParams(){return o(this,ho,"f").getRouteParams()}getAppInfo(e){return o(this,ho,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return o(this,ho,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").onCallbackData(e)}))}getPhoneNumber(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").getPhoneNumber()}))}openProfilePicker(e){return n(this,void 0,void 0,(function*(){const t=yield o(this,ho,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(oi,{method:"POST",headers:{"Content-Type":"application/json",access_token:e||""},body:JSON.stringify({fields:"id,name,picture",user_ids:t})}),o=yield n.json();if(0!==o.error||!o.data)throw new Error(o.message);i=t.map((e=>{var t,i,n,r,a,s,l,c,u,d,p;return{id:(null===(i=null===(t=o.data[e])||void 0===t?void 0:t.user_info)||void 0===i?void 0:i.user_id_by_app)||"",profile:{name:null===(r=null===(n=o.data[e])||void 0===n?void 0:n.user_info)||void 0===r?void 0:r.name,avatar:null===(c=null===(l=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===l?void 0:l.data)||void 0===c?void 0:c.url},code:0!==(null===(u=o.data[e])||void 0===u?void 0:u.error)?-1:0,message:`Get profile: ${Gt.isUndefined(null===(d=o.data[e])||void 0===d?void 0:d.message)?"Unknown error":null===(p=o.data[e])||void 0===p?void 0:p.message}`}}))}catch(e){i=t.map((t=>({id:t,profile:{name:"",avatar:""},code:-1,message:`Can't get profile: ${e.message}`})))}return{users:i||[]}}))}connectWifi(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").connectWifi(e)}))}openMediaPicker(e){var t,i,r;return n(this,void 0,void 0,(function*(){const n={};Gt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(i=e.editView)||void 0===i?void 0:i.enable)?n.enable=1:n.enable=0,n.aspect_ratio=null===(r=e.editView)||void 0===r?void 0:r.aspectRatio;const a=!0===e.silentRequest?1:0,s=e.maxSelectItem;return yield o(this,ho,"f").openMediaPicker(e.type,n,a,s)}))}getShareableLink(e){return n(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Zi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return n(this,void 0,void 0,(function*(){return yield o(this,ho,"f").closeLoading("user action")}))}}ho=new WeakMap,t([bi],vo.prototype,"login",null),t([wi],vo.prototype,"getLoginStatus",null),t([bi],vo.prototype,"getAccessToken",null),t([wi],vo.prototype,"getVersion",null),t([wi],vo.prototype,"getSystemInfo",null),t([bi,po,i(0,uo("object",{title:Ji("string")}))],vo.prototype,"setNavigationBarTitle",null),t([bi,po,i(0,uo("object",{color:Ji("string"),"textColor?":Ji("string",{values:["white","black"]}),"statusBarColor?":Ji("string")}))],vo.prototype,"setNavigationBarColor",null),t([bi,po,i(0,uo("object",{backgroundColor:Ji("string"),"textColor?":Ji("string",{values:["white","black"]})}))],vo.prototype,"setBackgroundColor",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["none","back","home","both"]})}))],vo.prototype,"setNavigationBarLeftButton",null),t([bi,po,i(0,uo("object",{rotate:Ji("string",{values:["auto","portrait","landscape"]})}))],vo.prototype,"setDeviceOrientation",null),t([bi,po,i(0,uo("object",{data:Ji("object")}))],vo.prototype,"setStorage",null),t([bi,po,i(0,uo("object",{keys:Ji("array<string>")}))],vo.prototype,"getStorage",null),t([bi],vo.prototype,"getStorageInfo",null),t([bi,po,i(0,uo("object",{keys:Ji("array<string>")}))],vo.prototype,"removeStorage",null),t([bi],vo.prototype,"clearStorage",null),t([bi,po,i(0,uo("object",{"avatarType?":Ji("string",{values:["small","normal","large"]})}))],vo.prototype,"getUserInfo",null),t([bi],vo.prototype,"getNetworkType",null),t([bi],vo.prototype,"onNetworkStatusChange",null),t([bi],vo.prototype,"startBeaconDiscovery",null),t([bi],vo.prototype,"stopBeaconDiscovery",null),t([bi],vo.prototype,"getBeacons",null),t([bi],vo.prototype,"closeApp",null),t([bi],vo.prototype,"getLocation",null),t([bi],vo.prototype,"stopBluetoothDevicesDiscovery",null),t([bi],vo.prototype,"startBluetoothDevicesDiscovery",null),t([bi],vo.prototype,"openBluetoothAdapter",null),t([bi],vo.prototype,"onBluetoothDeviceFound",null),t([bi],vo.prototype,"onBluetoothAdapterStateChange",null),t([bi],vo.prototype,"getConnectedBluetoothDevices",null),t([bi],vo.prototype,"getBluetoothDevices",null),t([bi],vo.prototype,"getBluetoothAdapterState",null),t([bi],vo.prototype,"closeBluetoothAdapter",null),t([bi],vo.prototype,"scanQRCode",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["user","oa","aliasOA"]}),id:Ji("string")}))],vo.prototype,"openProfile",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["user","oa"]}),id:Ji("string")}))],vo.prototype,"openChat",null),t([bi,po,i(0,co(["data.imageUrl"],{if:{type:"image"}})),i(0,co(["data.link"],{if:{type:"link"}})),i(0,co(["data.id"],{if:{type:"profile"}})),i(0,uo("object",{type:Ji("string",{values:["image","link","profile"]}),data:Ji("object"),"data.imageUrl?":Ji("url"),"data.link?":Ji("url"),"data.title?":Ji("string"),"data.thumb?":Ji("url"),"data.description?":Ji("string"),"data.avatar?":Ji("url"),"data.id?":Ji("string"),"data.displayName?":Ji("string")}))],vo.prototype,"openPostFeed",null),t([bi,po,i(0,uo("object",{id:Ji("string"),"showDialogConfirm?":Ji("boolean")}))],vo.prototype,"followOA",null),t([bi,po,i(0,uo("object",{id:Ji("string")}))],vo.prototype,"unfollowOA",null),t([bi,po,i(0,co([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),i(0,co(["data.link"],{if:{type:"link"}})),i(0,co(["data.id"],{if:{type:"oa"}})),i(0,co(["data.gifUrl"],{if:{type:"gif"}})),i(0,co(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),i(0,co(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),i(0,uo("object",{type:Ji("string",{values:["image","gif","video","link","oa","zmp"]}),data:Ji("object"),"data.imageUrl?":Ji("url"),"data.imageUrls?":Ji("array<url>",{maxLength:10}),"data.caption?":Ji("string"),"data.gifUrl?":Ji("url"),"data.width?":Ji("number"),"data.height?":Ji("number"),"data.videoThumb?":Ji("url"),"data.videoUrl?":Ji("url"),"data.link?":Ji("url"),"data.chatOnly?":Ji("boolean"),"data.id?":Ji("string"),"data.thumbnail?":Ji("url"),"data.path?":Ji("string"),"data.title?":Ji("string",{maxLength:100}),"data.description?":Ji(["string"],{maxLength:400})}))],vo.prototype,"openShareSheet",null),t([bi],vo.prototype,"requestCameraPermission",null),t([bi],vo.prototype,"createShortcut",null),t([bi,po,i(0,uo("object",{secretData:Ji("string"),"ui?":Ji("object"),"ui.title?":Ji("string"),"ui.subTitle?":Ji("string"),"ui.negativeButtonText?":Ji("string"),"requireFingerprint?":Ji("boolean")},{requireFingerprint:!0,ui:{title:"Xác thực",subTitle:"Sử dụng sinh trắc học của bạn để xác thực",negativeButtonText:"Đóng"}}))],vo.prototype,"openBioAuthentication",null),t([bi],vo.prototype,"checkStateBioAuthentication",null),t([bi,po,i(0,uo("object",{toUserId:Ji("string"),"title?":Ji("string")}))],vo.prototype,"sendLocation",null),t([bi,po,i(0,uo("object",{message:Ji("string")}))],vo.prototype,"showToast",null),t([bi],vo.prototype,"hideKeyboard",null),t([bi,po,i(0,uo("object",{phoneNumber:Ji("string")}))],vo.prototype,"openPhone",null),t([bi,po,i(0,uo("object",{content:Ji("string"),phoneNumber:Ji("string",{regex:/^\+?\d+$/})}))],vo.prototype,"openSMS",null),t([bi,po,i(0,uo("object",{id:Ji("string"),"displayName?":Ji("string")},{displayName:""}))],vo.prototype,"viewOAQr",null),t([bi],vo.prototype,"keepScreen",null),t([bi,po,i(0,uo("object",{"imageBase64Data?":Ji("string"),"imageUrl?":Ji("url")}))],vo.prototype,"saveImageToGallery",null),t([bi,po,i(0,uo("object",{"imageBase64Data?":Ji("string"),"imageUrl?":Ji("url")}))],vo.prototype,"saveImageToPhotosAlbum",null),t([bi,po,i(0,uo("object",{appId:Ji("string"),"params?":Ji("object")}))],vo.prototype,"openMiniApp",null),t([bi,po,i(0,uo("object",{"type?":Ji("string",{values:["oneShot"]}),"milliseconds?":Ji("number")},{type:"oneShot",milliseconds:500}))],vo.prototype,"vibrate",null),t([bi,po,i(0,uo("object",{url:Ji("string")}))],vo.prototype,"openWebview",null),t([wi],vo.prototype,"getRouteParams",null),t([bi],vo.prototype,"getAppInfo",null),t([bi],vo.prototype,"sendDataToPreviousMiniApp",null),t([bi],vo.prototype,"onCallbackData",null),t([bi],vo.prototype,"getPhoneNumber",null),t([bi,po,i(0,uo("object",{"maxProfile?":Ji("number",{min:1,max:10})},{maxProfile:1}))],vo.prototype,"openProfilePicker",null),t([bi,po,i(0,co(["SSID"])),i(0,uo("object",{SSID:Ji("string"),"password?":Ji("string"),"hiddenSSID?":Ji("boolean")}))],vo.prototype,"connectWifi",null),t([bi,po,i(0,uo("object",{type:Ji("string",{values:["photo","video","file","multi_photo","multi_video"]}),"editView?":Ji("object"),"editView.enable?":Ji("boolean"),"editView.aspectRatio?":Ji("string",{regex:/^\d+:\d+$/}),"silentRequest?":Ji("boolean"),"maxSelectItem?":Ji("number",{min:1})}))],vo.prototype,"openMediaPicker",null),t([bi,po,i(0,uo("object",{title:Ji("string",{maxLength:100}),"thumbnail?":Ji("url"),"path?":Ji("string"),description:Ji(["string"],{maxLength:400})},{description:""}))],vo.prototype,"getShareableLink",null),t([bi,po],vo.prototype,"closeLoading",null);class fo extends vo{getServiceInstance(){return ro.getInstance()}}class mo extends vo{getServiceInstance(){return new ao}}const go=Li();e.default=void 0,window.onJSCall=e=>function(t){rn.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){rn.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){rn.getInstance().nativeEventHandler(e,t,i)}},go.isZalo?e.default=new fo:e.default=new mo,window.ZaloMiniAppSDK=e.default,e.SDKCreator=vo,e.default=e.default,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -66,7 +66,5 @@ export declare enum Events {
66
66
  export declare enum MediaPickerType {
67
67
  photo = 4,
68
68
  video = 5,
69
- file = 6,
70
- multi_photo = 7,
71
- multi_video = 8
69
+ file = 6
72
70
  }
@@ -402,7 +402,7 @@ export declare type OnCallbackData = {
402
402
  * Get user info data type
403
403
  */
404
404
  export declare type GetUserInfoDataType<T> = CallbackType<T> & {
405
- avatarType: 'small' | 'normal' | 'large';
405
+ avatarType?: 'small' | 'normal' | 'large';
406
406
  };
407
407
  export declare type OpenProfilePicker<T> = CallbackType<T> & {
408
408
  maxProfile: number;
@@ -67,6 +67,7 @@ export declare const getZMPShareInfo: (appID: string, accessToken: string, share
67
67
  zinstantApi: string;
68
68
  shareId: string;
69
69
  shareableLink: string;
70
+ ztemplateId: string;
70
71
  }>;
71
72
  export declare const checkData: (types: string | Array<string>, option?: {
72
73
  min?: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmp-sdk",
3
- "version": "2.18.6",
3
+ "version": "2.18.9",
4
4
  "description": "Zalo Mini App SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",