zmp-sdk 2.21.0-rc → 2.21.2
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/browser.min.js +15 -2
- package/dist/index.es.js +15 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/constants.d.ts +6 -0
- package/dist/types/src/types/enum.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,4 +13,4 @@ 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
15
|
***************************************************************************** */
|
|
16
|
-
function e(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 t(e,t){return function(i,n){t(i,n,e)}}function i(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function n(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 o(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}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.prototype;var a=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)};var s=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var l=function(e){if(!a(e))return s(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 u(e,t){return e(t={exports:{}},t.exports),t.exports}var p="object"==typeof d&&d&&d.Object===Object&&d,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),f=v.Symbol,g=Object.prototype,m=g.hasOwnProperty,y=g.toString,_=f?f.toStringTag:void 0;var S=function(e){var t=m.call(e,_),i=e[_];try{e[_]=void 0;var n=!0}catch(e){}var o=y.call(e);return n&&(t?e[_]=i:delete e[_]),o},E=Object.prototype.toString;var O=function(e){return E.call(e)},A=f?f.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":A&&A in Object(e)?S(e):O(e)};var b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,N=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=v["__core-js_shared__"],I=(w=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var P=function(e){return!!I&&I in e},k=Function.prototype.toString;var R=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,B=Function.prototype,j=Object.prototype,x=B.toString,U=j.hasOwnProperty,M=RegExp("^"+x.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var L=function(e){return!(!b(e)||P(e))&&(N(e)?M:D).test(R(e))};var W=function(e,t){return null==e?void 0:e[t]};var z=function(e,t){var i=W(e,t);return L(i)?i:void 0},J=z(v,"DataView"),F=z(v,"Map"),K=z(v,"Promise"),G=z(v,"Set"),H=z(v,"WeakMap"),$=R(J),V=R(F),Z=R(K),q=R(G),Q=R(H),Y=T;(J&&"[object DataView]"!=Y(new J(new ArrayBuffer(1)))||F&&"[object Map]"!=Y(new F)||K&&"[object Promise]"!=Y(K.resolve())||G&&"[object Set]"!=Y(new G)||H&&"[object WeakMap]"!=Y(new H))&&(Y=function(e){var t=T(e),i="[object Object]"==t?e.constructor:void 0,n=i?R(i):"";if(n)switch(n){case $:return"[object DataView]";case V:return"[object Map]";case Z:return"[object Promise]";case q:return"[object Set]";case Q:return"[object WeakMap]"}return t});var X=Y;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ie=Object.prototype,ne=ie.hasOwnProperty,oe=ie.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&ne.call(e,"callee")&&!oe.call(e,"callee")},ae=Array.isArray;var se=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ce=function(e){return null!=e&&se(e.length)&&!N(e)};var le=function(){return!1},de=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?v.Buffer:void 0,r=(o?o.isBuffer:void 0)||le;e.exports=r})),ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var pe=function(e){return ee(e)&&se(e.length)&&!!ue[T(e)]};var he=function(e){return function(t){return e(t)}},ve=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&p.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})),fe=ve&&ve.isTypedArray,ge=fe?he(fe):pe,me=Object.prototype.hasOwnProperty;var ye=function(e){if(null==e)return!0;if(ce(e)&&(ae(e)||"string"==typeof e||"function"==typeof e.splice||de(e)||ge(e)||re(e)))return!e.length;var t=X(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(a(e))return!l(e).length;for(var i in e)if(me.call(e,i))return!1;return!0};var _e=function(e){return void 0===e};var Se=function(e){return null===e};var Ee=function(e){return"string"==typeof e||!ae(e)&&ee(e)&&"[object String]"==T(e)};var Oe=function(e){return"number"==typeof e||ee(e)&&"[object Number]"==T(e)};var Ae=function(e){return ee(e)&&"[object RegExp]"==T(e)},Te=ve&&ve.isRegExp,be=Te?he(Te):Ae;var we=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!we(e))||(Ce.test(e)||!Ne.test(e)||null!=t&&e in Object(t))},Pe=z(Object,"create");var ke=function(){this.__data__=Pe?Pe(null):{},this.size=0};var Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},De=Object.prototype.hasOwnProperty;var Be=function(e){var t=this.__data__;if(Pe){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return De.call(t,e)?t[e]:void 0},je=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;return Pe?void 0!==t[e]:je.call(t,e)};var Ue=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Pe&&void 0===t?"__lodash_hash_undefined__":t,this};function Me(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])}}Me.prototype.clear=ke,Me.prototype.delete=Re,Me.prototype.get=Be,Me.prototype.has=xe,Me.prototype.set=Ue;var Le=Me;var We=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},Fe=Array.prototype.splice;var Ke=function(e){var t=this.__data__,i=Je(t,e);return!(i<0)&&(i==t.length-1?t.pop():Fe.call(t,i,1),--this.size,!0)};var Ge=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var He=function(e){return Je(this.__data__,e)>-1};var $e=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 Ve(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])}}Ve.prototype.clear=We,Ve.prototype.delete=Ke,Ve.prototype.get=Ge,Ve.prototype.has=He,Ve.prototype.set=$e;var Ze=Ve;var qe=function(){this.size=0,this.__data__={hash:new Le,map:new(F||Ze),string:new Le}};var Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ye=function(e,t){var i=e.__data__;return Qe(t)?i["string"==typeof t?"string":"hash"]:i.map};var Xe=function(e){var t=Ye(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Ye(this,e).get(e)};var tt=function(e){return Ye(this,e).has(e)};var it=function(e,t){var i=Ye(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function nt(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])}}nt.prototype.clear=qe,nt.prototype.delete=Xe,nt.prototype.get=et,nt.prototype.has=tt,nt.prototype.set=it;var ot=nt;function rt(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(rt.Cache||ot),i}rt.Cache=ot;var at=rt;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ct=/\\(\\)?/g,lt=function(e){var t=at(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(st,(function(e,i,n,o){t.push(n?o.replace(ct,"$1"):i||e)})),t}));var dt=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},ut=f?f.prototype:void 0,pt=ut?ut.toString:void 0;var ht=function e(t){if("string"==typeof t)return t;if(ae(t))return dt(t,e)+"";if(we(t))return pt?pt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var vt=function(e){return null==e?"":ht(e)};var ft=function(e,t){return ae(e)?e:Ie(e,t)?[e]:lt(vt(e))};var gt=function(e){if("string"==typeof e||we(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var mt=function(e,t){for(var i=0,n=(t=ft(t,e)).length;null!=e&&i<n;)e=e[gt(t[i++])];return i&&i==n?e:void 0};var yt=function(e,t,i){var n=null==e?void 0:mt(e,t);return void 0===n?i:n},_t=function(){try{var e=z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var St=function(e,t,i){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Et=Object.prototype.hasOwnProperty;var Ot=function(e,t,i){var n=e[t];Et.call(e,t)&&ze(n,i)&&(void 0!==i||t in e)||St(e,t,i)},At=/^(?:0|[1-9]\d*)$/;var Tt=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&At.test(e))&&e>-1&&e%1==0&&e<t};var bt=function(e,t,i,n){if(!b(e))return e;for(var o=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=gt(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=s[c];void 0===(l=n?n(d,c,s):void 0)&&(l=b(d)?d:Tt(t[o+1])?[]:{})}Ot(s,c,l),s=s[c]}return e};var wt,Nt,Ct,It,Pt,kt,Rt,Dt,Bt,jt,xt={isEmpty:ye,isNull:Se,isUndefined:_e,isFunction:N,isObject:b,isString:Ee,isNumber:Oe,isArray:ae,isRegExp:be,get:yt,set:function(e,t,i){return null==e?e:bt(e,t,i)},isPromise:e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};function Ut(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(wt=exports.NetworkType||(exports.NetworkType={})).none="none",wt.wifi="wifi",wt.cellular="cellular",wt.unknown="unknown",exports.PlatformType=void 0,(Nt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Nt.android="android",Nt.iOS="iOS",Nt.unknown="unknown",exports.ProfileType=void 0,(Ct=exports.ProfileType||(exports.ProfileType={}))[Ct.user=1]="user",Ct[Ct.oa=0]="oa",Ct[Ct.aliasOA=2]="aliasOA",exports.ChatType=void 0,(It=exports.ChatType||(exports.ChatType={}))[It.user=1]="user",It[It.oa=0]="oa",exports.PostFeedType=void 0,(Pt=exports.PostFeedType||(exports.PostFeedType={}))[Pt.image=1]="image",Pt[Pt.link=4]="link",Pt[Pt.profile=5]="profile",exports.ShareSheetType=void 0,(kt=exports.ShareSheetType||(exports.ShareSheetType={}))[kt.image=1]="image",kt[kt.gif=11]="gif",kt[kt.video=12]="video",kt[kt.link=4]="link",kt[kt.oa=5]="oa",kt[kt.zmp=20]="zmp",exports.OrientationType=void 0,(Rt=exports.OrientationType||(exports.OrientationType={}))[Rt.auto=1]="auto",Rt[Rt.portrait=2]="portrait",Rt[Rt.landscape=3]="landscape",exports.VibrateType=void 0,(Dt=exports.VibrateType||(exports.VibrateType={}))[Dt.oneShot=0]="oneShot",exports.Events=void 0,(Bt=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",Bt.AppResumed="h5.event.resumed",Bt.NetworkChanged="h5.event.connection.changed",Bt.OnDataCallback="h5.event.webview.result",Bt.OpenApp="h5.event.open.mp",Bt.AppClose="h5.event.action.close",exports.MediaPickerType=void 0,(jt=exports.MediaPickerType||(exports.MediaPickerType={}))[jt.photo=4]="photo",jt[jt.video=5]="video",jt[jt.file=6]="file";const Mt=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},Lt=e=>Mt(`${window.location.host}_`+e),Wt=e=>Mt((()=>{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),zt=window.zAppID,Jt=window.APP_ID,Ft=window.APP_CONFIG||{},Kt="h5.zdn.vn_zoauth",Gt="h5.zdn.vn_zlink3rd",Ht="h5.zdn.vn_zoauth_vrf",$t="h5.zdn.vn_deviceID",Vt="https://graph.zalo.me/v2.0/me",Zt="https://h5.zalo.me/openapi/access_token",qt="https://oauth.zaloapp.com/v3/access_token",Qt="https://graph.zalo.me/v2.0/me/friends/list",Yt="https://h5.zalo.me/apps/get-info",Xt="https://h5.zalo.me/log/async",ei=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ti=0,ii=-2e3,ni=-1400,oi=-1500,ri=-1401,ai=-2004,si=-2005,ci={SUCCESS:"Success",UNKNOWN_ERROR:"Unknown error. Please try again later.",TIME_OUT:"Request timeout. Please try again later.",LOGIN_REQUIRED:"Please login (https://miniapp.zalo.me/docs/api/login) before to call this api",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 id. Please check your params again.",INVALID_PARAM:"Invalid parameter",USER_DENIED:"User denied",USER_CANCEL:"User cancel",MEDIA_PICKER_FAIL:"Unable to pick media",SAVE_IMAGE_FAIL:"Unable to save image"},li={SUCCESS:{code:ti,message:ci.SUCCESS},UNKNOWN_ERROR:{code:ii,message:ci.UNKNOWN_ERROR},UNAUTHORIZED:{code:ri,message:ci.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:ci.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:ci.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:ci.DECODE_FAILED},TIME_OUT:{code:-1408,message:ci.TIME_OUT},USER_DENIED:{code:-2002,message:ci.USER_DENIED},USER_CANCEL:{code:-2003,message:ci.USER_CANCEL}},di={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",error_list:{android:{"-2":{map_to:li.USER_DENIED}},iOS:{"-2":{map_to:li.USER_DENIED}}}},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,error_list:{android:{"-1":{map_to:li.USER_DENIED}},iOS:{"-1":{map_to:li.USER_DENIED}}}},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},error_list:{android:{"-101":{map_to:{code:si,message:ci.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:si,message:ci.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:si,message:ci.SAVE_IMAGE_FAIL},need_more_detail:!0}}}},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},error_list:{android:{"-1":{map_to:li.USER_DENIED},"-101":{map_to:li.USER_DENIED}},iOS:{"-1":{map_to:li.USER_DENIED},"-10":{map_to:li.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:li.USER_CANCEL}},iOS:{"-101":{map_to:li.USER_CANCEL}}}},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:440},error_list:{android:{"-101":{map_to:li.USER_CANCEL},999:{map_to:{code:ai,message:ci.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:ai,message:ci.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},ui={android:{"-4":li.DECODE_FAILED,"-5":li.CLIENT_NOT_SUPPORT,"-14":li.TIME_OUT},iOS:{"-9":li.DECODE_FAILED,"-5":li.CLIENT_NOT_SUPPORT,"-14":li.TIME_OUT}},pi={android:12100571,iOS:400,wp:0,unknown:0},hi=[di.GET_DOWNLOADED_STICKER.name,di.OPEN_SHARE_STICKER.name,di.OPEN_PROFILE.name,di.OPEN_FEED_DETAIL.name,di.OPEN_FRIEND_RADA.name,di.OPEN_INAPP.name,di.OPEN_OUTAPP.name,di.OPEN_PAGE.name,di.OPEN_PHOTODETAIL.name,di.OPEN_GALARY.name,di.OPEN_GAMECENTER.name,di.OPEN_GAMENEWS.name,di.OPEN_TAB_CONTACT.name,di.OPEN_TAB_SOCIAL.name,di.OPEN_FRIENDSUGGEST.name,di.OPEN_GROUPLIST.name,di.OPEN_NEARBY.name,di.OPEN_ROOM.name,di.OPEN_STICKERSTORE.name,di.OPEN_CREATECHAT.name,di.COPY_LINK_CATESTICKER.name,di.REQUEST_BUY_STICKER.name,di.OPEN_CHAT.name,di.OPEN_TAB_CHAT.name,di.OPEN_CHATGROUP.name,di.OPEN_ADDFRIEND.name,di.OPEN_TAB_MORE.name,di.OPEN_POSTFEED.name,di.OPEN_LOGINDEVICES.name,di.OPEN_SENDSTICKER.name,di.REPORT_ABUSE.name,di.FOLLOW_OA.name,di.UNFOLLOW_OA.name,di.OPEN_GAMEDETAIL.name,di.OPEN_SHARESHEET.name,di.REQUEST_PERMISSION_CAMERA.name,di.CHANGE_TITLE_HEADER.name,di.WEBVIEW_CLEARCACHE.name,di.WEBVIEW_CONFIRMCACHE.name,di.WEBVIEW_ISVISIBLE.name,di.WEBVIEW_NETWORKTYPE.name,di.CHANGE_BUTTON_HEADER.name,di.CREATE_OPTIONS_MENU.name,di.CREATE_SHORTCUT.name,di.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,di.WINDOW_CLOSE.name,di.WEBVIEW_CHECKRESERROR.name,di.IAP_REQUESTPAYMENT.name,di.ZBROWSER_GETSTATS.name,di.ZBROWSER_JSBRIDGE.name,di.PROMPT_AUTHENTICATION.name,di.CHANGE_ACTIONBAR_COLOR.name,di.PROMPT_AUTHENTICATION_CHECK_STATE.name,di.OPEN_APPSTORE.name,di.GET_LOCATION.name,di.QUERY_LOCATION_HIDE.name,di.SHOW_TOAST.name,di.OPEN_APP.name,di.HIDE_KEYBOARD.name,di.OPEN_PHONE.name,di.OPEN_QR.name,di.OPEN_SMS.name,di.VIEW_MYQR.name,di.KEEP_SCREEN.name,di.CHANGE_AUTOROTATE.name,di.CHECK_APP_INSTALLED.name,di.QUERY_SHOW.name,di.QUERY_HIDE.name,di.OPEN_INAPPRW.name,di.ZALORUN_GETTRACKINGSTATUS.name,di.ZALORUN_SETTRACKINGSTATUS.name,di.ZALORUN_GETDAYSTEP.name,di.ZALORUN_FORCESUBMITDATA.name,di.ZALORUN_SETWEIGHT.name,di.OPEN_PROFILE_EXT.name,di.DOWNLOAD_CATE.name,di.JUMP_LOGIN.name,di.OPEN_ADTIMA_ADS_INTERSTITIAL.name,di.OPEN_ADTIMA_ADS.name,di.GET_ADIDCLIENT.name,di.SCAN_IBEACON.name,di.SAVE_IMAGE_GALLERY.name,di.OPEN_MP.name,di.CHANGE_ACTIONBAR.name,di.INTERACTIVE_VIBRATION.name,di.ZBROWSER_MPDS.name],vi=0,fi=3,gi=1,mi=0,yi="https://payment-mini.zalo.me/api/order/create",_i="https://payment-mini.zalo.me/api/transaction";class Si{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${String(this.api)}; code: ${this.code}; message: ${this.message}`}toJSON(){return{code:this.code,message:this.message,api:this.api}}}const Ei=(e,t)=>e instanceof Si?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new Si(ii,e.message,t).toJSON():new Si(ii,ci.UNKNOWN_ERROR,t).toJSON())(e,t),Oi=(e,t)=>({code:ti,message:t||ci.SUCCESS,data:e||{}}),Ai={badRequest:e=>new Si(ni,e),loginFailed:e=>new Si(ri,`${ci.LOGIN_FAILED}: ${e}`),loginRequired:()=>new Si(ri,ci.LOGIN_REQUIRED),missingParam:e=>new Si(ni,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new Si(ni,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new Si(oi,"Can not get app info to share"),lengthInvalid:e=>new Si(ni,`${e} length is invalid.`)};const Ti={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:Ti.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("&")}},bi=new RegExp("[\\u0300-\\u036f]","g"),wi=new RegExp("[đ|Đ]","g"),Ni=new RegExp("\\s","g"),Ci=Ut("zmp:utils:common"),Ii=e=>{try{new URL(e)}catch(e){return!1}return!0},Pi=()=>navigator.userAgent||navigator.vendor||window.opera,ki=()=>{const e=Pi().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)}},Ri=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""},Di=()=>{const e=Pi().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},Bi=()=>{let e=ki();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},ji=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Ii(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Ii(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},xi=e=>(e=>{let t=Lt(e);return t||(t=Wt(e),t)?t:Mt(e)})(e),Ui=e=>{if(xt.isObject(JSON)&&JSON.parse&&xt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\x00/g,"");return JSON.parse(t,((e,t)=>t))}return xt.isObject(e)?e:new Function("return "+e)()},Mi=e=>{if(xt.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(Mi(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Mi(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Li=()=>{try{const e=Number(Di()),t=Bi();return e>=pi[t]}catch(e){return!0}},Wi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),zi=e=>{try{if(e){Ci(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Ci("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Ci("parse json error:",t),e}},Ji=(e,t,n,o,r,a)=>i(void 0,void 0,void 0,(function*(){const i=new URL(location.href),s=new URLSearchParams;let c=`${i.pathname}${i.search}`;a&&(c=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const l=new URL(`https://zalo.me/app/link${c}`);s.append("title",n),s.append("description",o||""),s.append("thumbnail",r),s.append("url",l.href),s.append("accessToken",t||"");const d=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),u=yield d.json();if(!u||0!==u.err)throw Ai.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),Fi=(e,t)=>i=>{if(!(Array.isArray(e)?e.some((e=>ji(i,e))):ji(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(xt.isNumber(null==t?void 0:t.maxLength))return{error:xt.isString(i)&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(xt.isNumber(null==t?void 0:t.min)&&xt.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(xt.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(xt.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(xt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},Ki=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};xt.isUndefined(n)||(i.currentVersion=n);const o=Ti.appendToUrl(Yt,i),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 Gi=u((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),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=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 c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,r),!0;case 6:return d.fn.call(d.context,t,n,o,r,a),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var p,h=d.length;for(l=0;l<h;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!c)for(p=1,c=new Array(u-1);p<u;p++)c[p-1]=arguments[p];d[l].fn.apply(d[l].context,c)}}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 c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l: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 Hi extends Gi{constructor(){super(),this.debug=Ut("zmp:event-emitter")}static getInstance(){return Hi.instance||(Hi.instance=new Hi),Hi.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 $i,Vi,Zi,qi,Qi;class Yi{static getVersion(){return"2.21.0-rc"}static getSystemInfo(){return{version:Ri("version-id")||"",apiVersion:"2.21.0-rc",zaloVersion:Di(),platform:Bi(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return i(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield Ki(e,0,t.version)}))}}class Xi{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let i;xt.isEmpty(e.textColor)||(t.textColor=e.textColor),xt.isString(e.color)&&e.color.length>0?(xt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(xt.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.getJSBridge().callNative(di.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return i(this,void 0,void 0,(function*(){let i,n;xt.isString(e)&&(i="none"===e||"home"===e?fi:vi,n="home"===e||"both"===e?gi:mi),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:xt.isNumber(i)?i:e.buttonType,dataConfig:Object.assign(Object.assign({},e.dataConfig),{confirmToExit:xt.isNumber(t)?t:e.dataConfig.confirmToExit,viewInLeftType:xt.isNumber(i)?i:e.dataConfig.viewInLeftType}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:xt.isNumber(n)?n:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(di.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBar(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class en{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){xt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.getJSBridge().callNative(di.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class tn{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(" ")}}$i=new WeakMap,Vi=new WeakMap,Zi=new WeakMap,qi=new WeakMap,Qi=new WeakMap;const nn=new class{constructor(){$i.set(this,3),Vi.set(this,["none","error","warn","info"]),Zi.set(this,"[zmp] > "),qi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),Qi.set(this,((e,t,i)=>{n(this,qi,"f")[n(this,Vi,"f")[e]]++;const r=n(this,Vi,"f")[e];if(o(this,Zi,n(this,Zi,"f")+("string"!=typeof t?new tn(t,r,e,i).toString():t),"f"),!(e>n(this,$i,"f")))switch(e){case 1:console.error(n(this,Zi,"f"));break;case 2:console.warn(n(this,Zi,"f"));break;case 3:console.info(n(this,Zi,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,$i,e,"f")}info(e){n(this,Qi,"f").call(this,3,e)}warn(e,t){n(this,Qi,"f").call(this,2,e,t)}error(e,t){n(this,Qi,"f").call(this,1,e,t)}getMetrics(){return n(this,qi,"f")}};class on{static setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let i;const n=ki().isAndroid;switch(t){case ei(n).NONE:i=exports.NetworkType.none;break;case ei(n).WIFI:i=exports.NetworkType.wifi;break;case ei(n)["2G"]:case ei(n)["3G"]:case ei(n)["4G"]:i=exports.NetworkType.cellular;break;default:i=exports.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const i=t&&t.state;this.getNetworkType().then((t=>{const n={isConnected:"CONNECTED"===i,networkType:t&&t.networkType};e(n)})).catch((e=>{nn.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,n,o,r,a;return i(this,void 0,void 0,(function*(){const i={subaction:0,scanning_type:xt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:xt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:xt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:xt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:xt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:xt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:xt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:xt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:xt.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.getJSBridge().callNative(di.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.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 i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.getJSBridge().callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.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 i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return xt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.getJSBridge().callNative(di.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_APPSTORE,e)}))}}var rn,an,sn;class cn{constructor(e){rn.set(this,localStorage),an.set(this,void 0),sn.set(this,void 0),ki(),o(this,sn,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,an,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in n(this,rn,"f")){if(e){if(t.split("_")[0]!==e)continue}n(this,sn,"f").keys.add(t)}}catch(e){nn.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 n(this,an,"f")&&(e=`${n(this,an,"f")}_${e}`),n(this,sn,"f").keys.has(e)?n(this,rn,"f").getItem(e):null}set(e){return i(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){n(this,an,"f")&&(e=`${n(this,an,"f")}_${e}`),n(this,rn,"f").setItem(e,t),n(this,sn,"f").keys.add(e)}getInfo(){return i(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})(n(this,rn,"f"),n(this,an,"f"));return{currentSize:xt.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return i(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){n(this,an,"f")&&(e=`${n(this,an,"f")}_${e}`),n(this,sn,"f").keys.has(e)&&(n(this,rn,"f").removeItem(e),n(this,sn,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){n(this,sn,"f").keys.forEach((e=>{n(this,an,"f")&&e.indexOf(n(this,an,"f"))<0||(n(this,rn,"f").removeItem(e),n(this,sn,"f").keys.delete(e))}))}}rn=new WeakMap,an=new WeakMap,sn=new WeakMap;var ln={},dn=function(e,t,i){var n=t||"default";return function(){var t=n in ln?ln[n](e,i):e;return t.apply(this,arguments)}};dn.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];ln[t]=e};var un={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function pn(e){try{return null===e?un:JSON.parse(e)}catch(e){return un}}var hn,vn,fn,gn,mn,yn,_n,Sn,En,On,An,Tn,bn,wn,Nn,Cn,In,Pn,kn,Rn,Dn,Bn,jn,xn,Un,Mn,Ln,Wn,zn,Jn={execute:function(e,t,i,n){i.suppress_http_code=1;var o=Ti.encode(i);"post"!=t&&(e=Ti.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=dn((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=dn((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(pn(e.responseText))},r.onerror=function(e){e.responseText?n(pn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class Fn extends Gi{constructor(){super(),hn.add(this),this.debug=Ut("zmp:ZaloJSBridge"),this.events=Hi.getInstance(),this._accessTk=xi("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=xi("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=Pi(),this._device=ki(),this.isJumped=!1,vn.set(this,null),fn.set(this,void 0),this.jump=()=>new Promise(((e,t)=>{xt.isUndefined(n(this,vn,"f"))||xt.isNull(n(this,vn,"f"))?this.callNative(di.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],r=t&&t.actionPermission||[];Object.entries(r).forEach((e=>{const t=e[0],i=e[1]||{perm:0,decode:0};n(this,fn,"f")[t]||(n(this,fn,"f")[t]={permission:!1,support:!1}),n(this,fn,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Gt));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),o(this,vn,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})):e(n(this,vn,"f"))})),this._jsCallFuncCallbacks={},o(this,fn,{},"f"),this.events.on(exports.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 Fn.instance||(Fn.instance=new Fn),Fn.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));Jn.execute(Xt,"post",{appId:window.APP_ID,data:JSON.stringify(t)},(e=>{})),window.zmpSentry&&window.zmpSentry.captureMessage("Result from native",{extra:{data:e}})}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Ui(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,message:i.error_message})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Ui(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,message:i.error_message})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=zi(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,i=new URL(e),n=i.pathname.split(`/zapps/${Jt}`)[1];return{path:`${n||"/"}${i.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=Ui(e))}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=t=>i(this,void 0,void 0,(function*(){var i,n,s,c,l,d,u,p;try{if(xt.isUndefined(t)||xt.isNull(t))return a(new Error("Native callback is null"));if(0!==t.error_code){let o=new Si(t.error_code,t.error_message);const r=Bi();if(e===di.JUMP_LOGIN)o=new Si(ii,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(o.message).toLowerCase()||"no permission!"===String(o.message).toLowerCase())o=new Si(li.FORBIDDEN.code,li.FORBIDDEN.message);else if(ui[r][t.error_code])o=new Si(ui[r][t.error_code].code,ui[r][t.error_code].message);else if(null===(n=null===(i=e.error_list)||void 0===i?void 0:i[r])||void 0===n?void 0:n[String(t.error_code)]){let i=e.error_list[r][String(t.error_code)].map_to.message;(null===(l=null===(c=null===(s=e.error_list)||void 0===s?void 0:s[r])||void 0===c?void 0:c[String(t.error_code)])||void 0===l?void 0:l.need_more_detail)&&(i=`${null===(p=null===(u=null===(d=e.error_list)||void 0===d?void 0:d[r])||void 0===u?void 0:u[String(t.error_code)])||void 0===p?void 0:p.map_to.message}: ${t.error_message}`),o=new Si(e.error_list[r][String(t.error_code)].map_to.code,i)}}else o=new Si(li.UNAUTHORIZED.code,li.UNAUTHORIZED.message);return a(o)}if(null==o?void 0:o.successCallback){const e=yield o.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}})),c=ki().isIOS,l=(e=>{var t;const i=Di(),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(c&&!l){const e=new Si(-5,"Client isn't support this action");return a(e)}(null==o?void 0:o.delay)?setTimeout((()=>{n(this,hn,"m",gn).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):n(this,hn,"m",gn).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}vn=new WeakMap,fn=new WeakMap,hn=new WeakSet,gn=function e(t,i,o,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(bi,"").replace(wi,"d").replace(Ni,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(c);if(!this._device.isMobile||xt.isEmpty(c))return this.onJSCall(l,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c}),!1;null==i&&(i={}),o||(o=this.defaultCallback);const d={error_code:-14,error_message:"Request Timeout!",data:{},action:c};this._jsCallFuncCallbacks[l]={timeout:s&&t.have_callback&&setTimeout((()=>{this.onJSCall(l,d)}),8e3),callback:o};try{return i=Mi(i),r?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onMultiJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onMultiJSCall('${l}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onJSCall('${l}')`)}catch(s){if(!(a-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:i,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c,js_error:s};return this.onJSCall(l,e),!1}setTimeout((()=>{n(this,hn,"m",e).call(this,t,i,o,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class Kn{constructor(e){mn.set(this,void 0),yn.set(this,void 0),_n.set(this,void 0),o(this,yn,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,mn,e,"f"),o(this,_n,Fn.getInstance(),"f")}get(e){return i(this,void 0,void 0,(function*(){return yield n(this,_n,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:n(this,mn,"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 i(this,void 0,void 0,(function*(){return{errorKeys:yield n(this,_n,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:n(this,mn,"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 i(this,void 0,void 0,(function*(){const e=yield n(this,_n,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:n(this,mn,"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:xt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield n(this,_n,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:n(this,mn,"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 i(this,void 0,void 0,(function*(){yield n(this,_n,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:n(this,mn,"f")})}))}}mn=new WeakMap,yn=new WeakMap,_n=new WeakMap;class Gn{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=zi(e)})),n}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{xt.isUndefined(t)||xt.isNull(t)||(i[e]=Wi(t))})),yield t.set(i)}))}removeDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class Hn extends Gn{constructor(e){super(),Sn.set(this,void 0),o(this,Sn,e,"f")}getInstance(){return new cn(n(this,Sn,"f"))}}Sn=new WeakMap;class $n extends Gn{constructor(e){super(),En.set(this,void 0),o(this,En,e,"f")}getInstance(){return new Kn(n(this,En,"f"))}}En=new WeakMap;class Vn{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new Hn(this.getAppId());return Li()&&(t=new $n(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new Hn(this.getAppId());Li()&&(t=new $n(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new Hn(this.getAppId());return Li()&&(e=new $n(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new Hn(this.getAppId());return Li()&&(t=new $n(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new Hn(this.getAppId());Li()&&(e=new $n(this.getAppId())),yield e.clearStorage()}))}}class Zn{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let n="id,name,picture";(null==e?void 0:e.avatarType)&&(n=`${n}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Vt}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(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 i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class qn{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(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.getJSBridge().callNative(di.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Qn{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.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,successCallback:e=>{const t={latitude:e.latitude,longitude:e.longitude,timestamp:e.timestamp,provider:e.provider};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Yn{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.REQUEST_PERMISSION_CAMERA,{},{successCallback:()=>Promise.resolve({userAllow:!0,message:"User Allow"})})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return xt.isEmpty(e.imageBase64Data)?xt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.getJSBridge().callNative(di.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class Xn{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],msg:e.message||"",zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return i(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":t={photoUrl:e.data.imageUrl};break;case"link":t={link:e.data.link,title:e.data.title,thumb:e.data.thumb,description:e.data.description};break;case"profile":t={avt:e.data.avatar,uid:e.data.id,dpn:e.data.displayName}}return yield this.getJSBridge().callNative(di.OPEN_POSTFEED,Object.assign(Object.assign({type:exports.PostFeedType[e.type]},t),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return i(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":let i=[];Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?i=e.data.imageUrls:i.push(e.data.imageUrl),t={photoUrls:i,photoUrl:e.data.imageUrl,caption:e.data.caption};break;case"gif":t={photoUrl:e.data.imageUrl,gifUrl:e.data.gifUrl,width:e.data.width,height:e.data.height};break;case"video":t={videoThumb:e.data.videoThumb,videoUrl:e.data.videoUrl,width:e.data.width,height:e.data.height};break;case"link":t={link:e.data.link,chatOnly:e.data.chatOnly?1:0};break;case"oa":t={uid:e.data.id};break;case"zmp":const n=yield this.getAccessToken(),o=yield Ji(this.getAppId(),n||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={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}}:(t={link:o.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.getJSBridge().callNative(di.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[e.type]},t),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,n){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,successCallback:e=>{if(Array.isArray(e))return Promise.resolve(e.map((e=>e.id)))}})}))}static getActionsSupported(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:e=>{const t=Bi();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(di).filter((e=>di[e].skip_jump)),i={actions:[...e.actions,...t]};return Promise.resolve(i)}if(t===exports.PlatformType.iOS){const e={actions:hi};return Promise.resolve(e)}}})}))}static openMediaPicker(e,t,n,o,r,a){return i(this,void 0,void 0,(function*(){const i={type:0,url:t,maxSize:n||1048576};return yield this.getJSBridge().callNative(di.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),o),silent_request:r,upload:i,max_select_items:a},{isMultiCallback:!0,successCallback:e=>{const t={data:null==e?void 0:e.result_content};return Promise.resolve(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_OUTAPP,{url:e})}))}}class eo{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=Ti.getParamsAsObject(i))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.WEBVIEW_SET_RESULT,{result:Wi(e.data)})}))}static onCallbackData(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class to{constructor(){var e,t,i,r,a,s,c,l,d,u,p,h,v,f,g,m,y;On.set(this,zt),An.set(this,Jt),Tn.set(this,Ft),bn.set(this,void 0),wn.set(this,void 0),Nn.set(this,void 0),Cn.set(this,null),In.set(this,{timer:{getToken:0}}),Pn.set(this,void 0),kn.set(this,void 0),Rn.set(this,void 0),Dn.set(this,void 0),this.events=Hi.getInstance(),this.isIOS=ki().isIOS,Bn.set(this,void 0),this.getActionBarConfig=()=>n(this,Bn,"f"),this.setActionBarConfig=e=>{o(this,Bn,e(n(this,Bn,"f")),"f")},this.getVersion=Yi.getVersion,this.getSystemInfo=Yi.getSystemInfo,this.setNavigationBarTitle=Xi.setNavigationBarTitle,this.setNavigationBarColor=Xi.setNavigationBarColor,this.setNavigationBarLeftButton=Xi.setNavigationBarLeftButton,this.setBackgroundColor=en.setBackgroundColor,this.setDeviceOrientation=on.setDeviceOrientation,this.setStorage=Vn.setStorage,this.getStorage=Vn.getStorage,this.getStorageInfo=Vn.getStorageInfo,this.removeStorage=Vn.removeStorage,this.clearStorage=Vn.clearStorage,this.getUserInfo=Zn.getUserInfo,this.getNetworkType=on.getNetworkType,this.onNetworkStatusChange=on.onNetworkStatusChange,this.startBeaconDiscovery=on.startBeaconDiscovery,this.stopBeaconDiscovery=on.stopBeaconDiscovery,this.getBeacons=on.getBeacons,this.closeApp=qn.closeApp,this.getLocation=Qn.getLocation,this.stopBluetoothDevicesDiscovery=on.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=on.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=on.openBluetoothAdapter,this.onBluetoothDeviceFound=on.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=on.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=on.getConnectedBluetoothDevices,this.getBluetoothDevices=on.getBluetoothDevices,this.getBluetoothAdapterState=on.getBluetoothAdapterState,this.closeBluetoothAdapter=on.closeBluetoothAdapter,this.scanQRCode=on.scanQRCode,this.openProfile=Xn.openProfile,this.openChat=Xn.openChat,this.openPostFeed=Xn.openPostFeed,this.followOA=Xn.followOA,this.unFollowOA=Xn.unfollowOA,this.openShareSheet=Xn.openShareSheet,this.requestCameraPermission=Yn.requestCameraPermission,this.createShortcut=Xn.createShortcut,this.openBioAuthentication=on.openBioAuthentication,this.checkStateBioAuthentication=on.checkStateBioAuthentication,this.sendLocation=Qn.sendLocation,this.showToast=on.showToast,this.hideKeyboard=on.hideKeyboard,this.openPhone=on.openPhone,this.openSMS=on.openSMS,this.viewOAQr=Xn.viewOAQr,this.keepScreen=on.keepScreen,this.saveImageToPhotosAlbum=Yn.saveImageToPhotosAlbum,this.openMiniApp=qn.openMiniApp,this.vibrate=on.vibrate,this.openWebview=qn.openWebview,this.getRouteParams=eo.getRouteParams,this.getAppInfo=Yi.getAppInfo,this.sendDataToPreviousMiniApp=eo.sendDataToPreviousMiniApp,this.onCallbackData=eo.onCallbackData,this.getPhoneNumber=Zn.getPhoneNumber,this.openProfilePicker=Xn.openProfilePicker,jn.set(this,Xn.getActionsSupported),this.connectWifi=on.connectWifi,this.openMediaPicker=Xn.openMediaPicker,this.openOutApp=Xn.openOutApp,this.closeLoading=qn.closeLoading,this.openAppStore=on.openAppStore,o(this,bn,null,"f"),o(this,wn,null,"f"),o(this,Nn,null,"f"),this.isShowNavBar=!0,o(this,kn,0,"f"),o(this,Rn,0,"f"),o(this,Dn,"","f"),o(this,Pn,Fn.getInstance(),"f");const _="home"===(null===(t=null===(e=n(this,Tn,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(i=n(this,Tn,"f"))||void 0===i?void 0:i.app)||void 0===r?void 0:r.leftButton)?gi:mi,S=new URL(location.href),E=xt.isString(null===(s=null===(a=n(this,Tn,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(d=null===(l=null===(c=n(this,Tn,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===d?void 0:d.length)>0?5:6,O="none"===(null===(p=null===(u=n(this,Tn,"f"))||void 0===u?void 0:u.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=n(this,Tn,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?fi:vi;o(this,Bn,{actionbarType:E,buttonType:O,dataConfig:{backgroundColor:(null===(g=null===(f=n(this,Tn,"f"))||void 0===f?void 0:f.app)||void 0===g?void 0:g.headerColor)||"",textColor:(null===(y=null===(m=n(this,Tn,"f"))||void 0===m?void 0:m.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:O,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${S.search}`}},"f")}static getInstance(){return to.instance||(to.instance=new to),to.instance}getLoginStatus(){return xt.isString(n(this,Nn,"f"))&&n(this,Nn,"f").length>0}getAppId(){return n(this,An,"f")}getZAppId(){return n(this,On,"f")}getDeviceId(){return n(this,Dn,"f")}getJSBridge(){return n(this,Pn,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=yield n(this,Pn,"f").jump(),t=e.find((e=>e.name===$t));t&&o(this,Dn,t.value,"f");const i=e.find((e=>e.name===Kt)),r=e.find((e=>e.name===Ht));if(!xt.isUndefined(i)&&!xt.isNull(i)&&xt.isString(i.value)){if(o(this,bn,i.value,"f"),xt.isUndefined(r)||xt.isNull(r)||!xt.isString(r.value)?yield this.loginZaloV3():(o(this,wn,r.value,"f"),yield this.loginZaloV4()),!n(this,Nn,"f"))throw Ai.loginFailed("Invalid authorization code");return n(this,Nn,"f")}throw Ai.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${qt}?app_id=${n(this,On,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${n(this,An,"f")}/&code=${n(this,bn,"f")}&isSDK=true`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Nn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Rn,e,"f"),o(this,kn,(new Date).getTime(),"f"),n(this,Pn,"f").accessTk=n(this,Nn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Nn,"f")||""),n(this,Nn,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",n(this,An,"f")),e.append("code",n(this,bn,"f")||""),e.append("code_verifier",n(this,wn,"f")||""),xt.isNull(n(this,Cn,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",n(this,Cn,"f")||""));return yield fetch(Zt,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&o(this,Cn,t.refresh_token,"f"),t.access_token){o(this,Nn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Rn,e,"f"),o(this,kn,(new Date).getTime(),"f"),n(this,Pn,"f").accessTk=n(this,Nn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Nn,"f")||""),n(this,Nn,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-n(this,kn,"f");if(!n(this,Nn,"f"))throw Ai.loginRequired();return e<n(this,Rn,"f")?n(this,Nn,"f"):yield this.login()}))}}On=new WeakMap,An=new WeakMap,Tn=new WeakMap,bn=new WeakMap,wn=new WeakMap,Nn=new WeakMap,Cn=new WeakMap,In=new WeakMap,Pn=new WeakMap,kn=new WeakMap,Rn=new WeakMap,Dn=new WeakMap,Bn=new WeakMap,jn=new WeakMap;class io{constructor(){xn.set(this,zt),Un.set(this,Ft),Mn.set(this,"DEFAULT ZOAUTH"),Ln.set(this,"DEFAULT ACCESS TOKEN"),Wn.set(this,{timer:{getToken:0}}),zn.set(this,!1),this.getLoginStatus=()=>n(this,zn,"f"),this.getAppId=()=>n(this,xn,"f"),this.getDeviceId=()=>"",this.login=()=>(o(this,zn,!0,"f"),Promise.resolve(n(this,Mn,"f"))),this.getAccessToken=()=>Promise.resolve(n(this,Ln,"f")),this.getVersion=Yi.getVersion,this.getSystemInfo=Yi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>i(this,void 0,void 0,(function*(){const t=new Hn(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new Hn(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new Hn(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new Hn(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new Hn(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 e;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":e=exports.NetworkType.none;break;case"4g":e=exports.NetworkType.wifi;break;case"3g":case"2g":e=exports.NetworkType.cellular;break;default:e=exports.NetworkType.unknown}const t={networkType:e};return Promise.resolve(t)},this.onNetworkStatusChange=e=>{const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(i){case"none":t=exports.NetworkType.none;break;case"4g":t=exports.NetworkType.wifi;break;case"3g":case"2g":t=exports.NetworkType.cellular;break;default:t=exports.NetworkType.unknown}e({isConnected:!0,networkType:t})})),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),Promise.resolve()),this.getRouteParams=eo.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(),this.openAppStore=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,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}xn=new WeakMap,Un=new WeakMap,Mn=new WeakMap,Ln=new WeakMap,Wn=new WeakMap,zn=new WeakMap;const no=Symbol("required"),oo=Symbol("checkType"),ro=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(no,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(no,r,i,n)},ao=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(oo,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(oo,a,n,o)};function so(e,t){Reflect.getMetadataKeys(e).map((i=>{const n=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,n,t)}))}const co=(e,t={})=>i=>{var n;let o=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);o=Object.assign(Object.assign({},t),o),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(o)){const o="function"==typeof a.value&&"constructor"!=r;if(null===(n=t.exclude)||void 0===n?void 0:n.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!o)continue;const s=a.value;e(i,r,a),s!=a.value&&so(s,a.value),Object.defineProperty(i.prototype,r,a)}},lo=(e,t,i)=>{const n=i.value,o=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(n);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(no,e.prototype,t),a=Reflect.getOwnMetadata(oo,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:n,properties:r,defaultValue:a}=e;let s=i[t],c=o[t];const l=typeof s;if(!xt.isUndefined(s)){if(!ji(s,n))throw Ai.wrongTypeParam(c,n,Array.isArray(s)?"array":null===s?"null":l);"object"===n&&Object.entries(r).forEach((([e,n])=>{const o=e.split("?")[0],r=xt.get(s,o);if(xt.isUndefined(r)||xt.isNull(r)){if(!e.includes("?"))throw Ai.missingParam(e);xt.get(s,o.split(".")[0])||!a||xt.isUndefined(xt.get(a,o))||xt.set(i[t],o,xt.get(a,o))}else if(xt.isFunction(n)){const e=n(r);if(e&&e.error)throw Ai.wrongTypeParam(`${c}.${o}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:n,fields:o}=e,r=i[t],a=null==n?void 0:n.if,s=null==n?void 0:n.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>xt.get(r,e)===a[e]))),c&&o.forEach((e=>{const n=e=>{let n=!1;return xt.isEmpty(xt.get(r,e))&&(xt.isUndefined(xt.get(s,e))||xt.set(i[t],e,xt.get(s,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw Ai.missingParam(e.join(" or "));if(xt.isString(e)&&n(e))throw Ai.missingParam(e)}))}));const s=n.call(this,...i);if(xt.isPromise(s)){const{success:e,fail:n}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,o)=>{s.then((t=>{!xt.isNull(e)&&xt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=Ei(e,t);!xt.isNull(n)&&xt.isFunction(n)?n.call(null,i,this):o(i)}))}))}return s}catch(e){throw Ei(e,t)}},i};var uo,po,ho,vo,fo;exports.SDKCreator=class{constructor(){this.events=Hi.getInstance(),uo.set(this,void 0),o(this,uo,this.getServiceInstance(),"f"),this.events.addListener=(e,t,i)=>{const n=e;return this.events.addListener(exports.Events[n],t,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").login(e)}))}getLoginStatus(){return n(this,uo,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getAccessToken(e)}))}getVersion(){return n(this,uo,"f").getVersion()}getSystemInfo(){return n(this,uo,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield Ki(Jt,0),i=ki().isIOS,o=t.logoUrl||Ri("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",Jt),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield n(this,uo,"f").openOutApp(encodeURI(e))}else yield n(this,uo,"f").createShortcut(`https://zalo.me/app/link/zapps/${Jt}/?${a.toString()}`,r,o);return Oi()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield n(this,uo,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!xt.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 n(this,uo,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){console.log(e),yield n(this,uo,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.searchParams.get("typeInapp");xt.isEmpty(i)&&t.searchParams.set("typeInapp","1"),yield n(this,uo,"f").openWebview(t.href)}))}getRouteParams(){return n(this,uo,"f").getRouteParams()}getAppInfo(e){return n(this,uo,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return n(this,uo,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield n(this,uo,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(Qt,{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,c,l,d,u,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===(l=null===(c=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===c?void 0:c.data)||void 0===l?void 0:l.url},code:0!==(null===(d=o.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(u=o.data[e])||void 0===u?void 0:u.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 i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return i(this,void 0,void 0,(function*(){const i={};xt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.enable)?i.enable=1:i.enable=0,i.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 n(this,uo,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Ji(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield n(this,uo,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=ki().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield n(this,uo,"f").openOutApp(e)}))}onConfirmToExit(e){this.events.on(exports.Events.AppClose,e,'{"handle_h5": 1}'),n(this,uo,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(exports.Events.AppClose),n(this,uo,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return n(this,uo,"f").getDeviceId()}},uo=new WeakMap,e([t(0,ao("object",{title:Fi("string")}))],exports.SDKCreator.prototype,"setNavigationBarTitle",null),e([t(0,ao("object",{color:Fi("string"),"textColor?":Fi("string",{values:["white","black"]}),"statusBarColor?":Fi("string")}))],exports.SDKCreator.prototype,"setNavigationBarColor",null),e([t(0,ao("object",{backgroundColor:Fi("string"),"textColor?":Fi("string",{values:["white","black"]})}))],exports.SDKCreator.prototype,"setBackgroundColor",null),e([t(0,ao("object",{type:Fi("string",{values:["none","back","home","both"]})}))],exports.SDKCreator.prototype,"setNavigationBarLeftButton",null),e([t(0,ao("object",{rotate:Fi("string",{values:["auto","portrait","landscape"]})}))],exports.SDKCreator.prototype,"setDeviceOrientation",null),e([t(0,ao("object",{data:Fi("object")}))],exports.SDKCreator.prototype,"setStorage",null),e([t(0,ao("object",{keys:Fi("array<string>")}))],exports.SDKCreator.prototype,"getStorage",null),e([t(0,ao("object",{keys:Fi("array<string>")}))],exports.SDKCreator.prototype,"removeStorage",null),e([t(0,ao("object",{"avatarType?":Fi("string",{values:["small","normal","large"]})}))],exports.SDKCreator.prototype,"getUserInfo",null),e([t(0,ao("object",{type:Fi("string",{values:["user","oa","aliasOA"]}),id:Fi("string")}))],exports.SDKCreator.prototype,"openProfile",null),e([t(0,ao("object",{type:Fi("string",{values:["user","oa"]}),id:Fi("string"),"message?":Fi("string")}))],exports.SDKCreator.prototype,"openChat",null),e([t(0,ro(["data.imageUrl"],{if:{type:"image"}})),t(0,ro(["data.link"],{if:{type:"link"}})),t(0,ro(["data.id"],{if:{type:"profile"}})),t(0,ao("object",{type:Fi("string",{values:["image","link","profile"]}),data:Fi("object"),"data.imageUrl?":Fi("url"),"data.link?":Fi("url"),"data.title?":Fi("string"),"data.thumb?":Fi("url"),"data.description?":Fi("string"),"data.avatar?":Fi("url"),"data.id?":Fi("string"),"data.displayName?":Fi("string")}))],exports.SDKCreator.prototype,"openPostFeed",null),e([t(0,ao("object",{id:Fi("string"),"showDialogConfirm?":Fi("boolean")}))],exports.SDKCreator.prototype,"followOA",null),e([t(0,ao("object",{id:Fi("string")}))],exports.SDKCreator.prototype,"unfollowOA",null),e([t(0,ro([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,ro(["data.link"],{if:{type:"link"}})),t(0,ro(["data.id"],{if:{type:"oa"}})),t(0,ro(["data.gifUrl"],{if:{type:"gif"}})),t(0,ro(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,ro(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,ao("object",{type:Fi("string",{values:["image","gif","video","link","oa","zmp"]}),data:Fi("object"),"data.imageUrl?":Fi("url"),"data.imageUrls?":Fi("array<url>",{maxLength:10}),"data.caption?":Fi("string"),"data.gifUrl?":Fi("url"),"data.width?":Fi("number"),"data.height?":Fi("number"),"data.videoThumb?":Fi("url"),"data.videoUrl?":Fi("url"),"data.link?":Fi("url"),"data.chatOnly?":Fi("boolean"),"data.id?":Fi("string"),"data.thumbnail?":Fi("url"),"data.path?":Fi("string"),"data.title?":Fi("string",{maxLength:100}),"data.description?":Fi(["string"],{maxLength:400})}))],exports.SDKCreator.prototype,"openShareSheet",null),e([t(0,ao("object",{secretData:Fi("string"),"ui?":Fi("object"),"ui.title?":Fi("string"),"ui.subTitle?":Fi("string"),"ui.negativeButtonText?":Fi("string"),"requireFingerprint?":Fi("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"}}))],exports.SDKCreator.prototype,"openBioAuthentication",null),e([t(0,ao("object",{toUserId:Fi("string"),"title?":Fi("string")}))],exports.SDKCreator.prototype,"sendLocation",null),e([t(0,ao("object",{message:Fi("string")}))],exports.SDKCreator.prototype,"showToast",null),e([t(0,ao("object",{phoneNumber:Fi("string")}))],exports.SDKCreator.prototype,"openPhone",null),e([t(0,ao("object",{content:Fi("string"),phoneNumber:Fi("string",{regex:/^\+?\d+$/})}))],exports.SDKCreator.prototype,"openSMS",null),e([t(0,ao("object",{id:Fi("string"),"displayName?":Fi("string")},{displayName:""}))],exports.SDKCreator.prototype,"viewOAQr",null),e([t(0,ao("object",{"imageBase64Data?":Fi("string"),"imageUrl?":Fi("url")}))],exports.SDKCreator.prototype,"saveImageToGallery",null),e([t(0,ao("object",{"imageBase64Data?":Fi("string"),"imageUrl?":Fi("url")}))],exports.SDKCreator.prototype,"saveImageToPhotosAlbum",null),e([t(0,ao("object",{appId:Fi("string"),"params?":Fi("object")}))],exports.SDKCreator.prototype,"openMiniApp",null),e([t(0,ao("object",{"type?":Fi("string",{values:["oneShot"]}),"milliseconds?":Fi("number")},{type:"oneShot",milliseconds:500}))],exports.SDKCreator.prototype,"vibrate",null),e([t(0,ao("object",{url:Fi("url")}))],exports.SDKCreator.prototype,"openWebview",null),e([t(0,ao("object",{"maxProfile?":Fi("number",{min:1,max:10})},{maxProfile:1}))],exports.SDKCreator.prototype,"openProfilePicker",null),e([t(0,ro(["SSID"])),t(0,ao("object",{SSID:Fi("string"),"password?":Fi("string"),"hiddenSSID?":Fi("boolean")}))],exports.SDKCreator.prototype,"connectWifi",null),e([t(0,ao("object",{type:Fi("string",{values:["photo","video","file"]}),serverUploadUrl:Fi("url"),"maxItemSize?":Fi("number",{min:0}),"editView?":Fi("object"),"editView.enable?":Fi("boolean"),"editView.aspectRatio?":Fi("string",{regex:/^\d+:\d+$/}),"silentRequest?":Fi("boolean"),"maxSelectItem?":Fi("number",{min:1})}))],exports.SDKCreator.prototype,"openMediaPicker",null),e([t(0,ao("object",{title:Fi("string",{maxLength:100}),"thumbnail?":Fi("url"),"path?":Fi("string"),description:Fi(["string"],{maxLength:400})},{description:""}))],exports.SDKCreator.prototype,"getShareableLink",null),exports.SDKCreator=e([co(lo)],exports.SDKCreator);class go extends exports.SDKCreator{getServiceInstance(){return to.getInstance()}}class mo extends exports.SDKCreator{getServiceInstance(){return new io}}class yo{constructor(){po.set(this,Jt)}static getInstance(){return yo.instance||(yo.instance=new yo),yo.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const i=n(this,po,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",i),t.desc&&o.append("desc",encodeURIComponent(t.desc)),t.extradata&&o.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&o.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const n=yield e.getAccessToken({fail:e=>{throw Ai.loginRequired}});r.headers.authorization=`Bearer ${n}`;const a=yield fetch(yi,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw Ai.badRequest(s.msg);const c=s.data.id,l=s.data.jwt,d=window.APP_VERSION,u=window.APP_ENV,p={miniAppId:i,orderId:c};l&&(p.token=l),d&&(p.version=d),u&&(p.env=u),t.method&&(p.method=t.method);const h=Ti.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let i,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(i=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=Ti.getParameterByName("orderId",o),t=Ti.getParameterByName("appTransID",o)||Ti.getParameterByName("apptransid",o);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw Ai.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(_i),c={transId:i||"",appId:n(this,po,"f")};s.search=new URLSearchParams(c).toString();const l=yield fetch(s.toString(),r),d=yield l.json();if(!d.data||0!==d.err)throw Ai.badRequest(d.msg);const u=d.data||{};return{msg:u.resultMessage,orderId:u.orderId,resultCode:u.resultCode,transTime:u.transTime,createdAt:u.createAt,transId:u.transId}}catch(e){throw e}}))}}po=new WeakMap;class _o{constructor(){ho.set(this,zt)}static getInstance(){return _o.instance||(_o.instance=new _o),_o.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const i={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(i)}}ho=new WeakMap;let So=class{constructor(e){vo.set(this,void 0),fo.set(this,void 0),o(this,vo,this.getInstance(),"f"),o(this,fo,e,"f")}createOrder(e){return n(this,vo,"f").createOrder(n(this,fo,"f"),e)}checkTransaction(e){return n(this,vo,"f").checkTransaction(n(this,fo,"f"),e)}};vo=new WeakMap,fo=new WeakMap,e([t(0,ao("object",{amount:Fi(["string","number"]),desc:Fi("string"),"method?":Fi("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],So.prototype,"createOrder",null),So=e([co(lo)],So);class Eo extends So{getInstance(){return yo.getInstance()}}class Oo extends So{getInstance(){return _o.getInstance()}}const Ao=ki();exports.default=void 0,window.onJSCall=e=>function(t){Fn.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Fn.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){Fn.getInstance().nativeEventHandler(e,t,i)}},exports.Payment=void 0,Ao.isZalo?(exports.default=new go,exports.Payment=new Eo(exports.default)):(exports.default=new mo,exports.Payment=new Oo(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.default=exports.default;
|
|
16
|
+
function e(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 t(e,t){return function(i,n){t(i,n,e)}}function i(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function n(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 o(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}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.prototype;var a=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)};var s=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),c=Object.prototype.hasOwnProperty;var l=function(e){if(!a(e))return s(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 u(e,t){return e(t={exports:{}},t.exports),t.exports}var p="object"==typeof d&&d&&d.Object===Object&&d,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),f=v.Symbol,g=Object.prototype,m=g.hasOwnProperty,y=g.toString,_=f?f.toStringTag:void 0;var S=function(e){var t=m.call(e,_),i=e[_];try{e[_]=void 0;var n=!0}catch(e){}var o=y.call(e);return n&&(t?e[_]=i:delete e[_]),o},E=Object.prototype.toString;var O=function(e){return E.call(e)},A=f?f.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":A&&A in Object(e)?S(e):O(e)};var b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,N=function(e){if(!b(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=v["__core-js_shared__"],I=(w=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var P=function(e){return!!I&&I in e},k=Function.prototype.toString;var R=function(e){if(null!=e){try{return k.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,B=Function.prototype,j=Object.prototype,x=B.toString,U=j.hasOwnProperty,M=RegExp("^"+x.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var L=function(e){return!(!b(e)||P(e))&&(N(e)?M:D).test(R(e))};var W=function(e,t){return null==e?void 0:e[t]};var z=function(e,t){var i=W(e,t);return L(i)?i:void 0},J=z(v,"DataView"),F=z(v,"Map"),K=z(v,"Promise"),G=z(v,"Set"),H=z(v,"WeakMap"),$=R(J),V=R(F),Z=R(K),q=R(G),Q=R(H),Y=T;(J&&"[object DataView]"!=Y(new J(new ArrayBuffer(1)))||F&&"[object Map]"!=Y(new F)||K&&"[object Promise]"!=Y(K.resolve())||G&&"[object Set]"!=Y(new G)||H&&"[object WeakMap]"!=Y(new H))&&(Y=function(e){var t=T(e),i="[object Object]"==t?e.constructor:void 0,n=i?R(i):"";if(n)switch(n){case $:return"[object DataView]";case V:return"[object Map]";case Z:return"[object Promise]";case q:return"[object Set]";case Q:return"[object WeakMap]"}return t});var X=Y;var ee=function(e){return null!=e&&"object"==typeof e};var te=function(e){return ee(e)&&"[object Arguments]"==T(e)},ie=Object.prototype,ne=ie.hasOwnProperty,oe=ie.propertyIsEnumerable,re=te(function(){return arguments}())?te:function(e){return ee(e)&&ne.call(e,"callee")&&!oe.call(e,"callee")},ae=Array.isArray;var se=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ce=function(e){return null!=e&&se(e.length)&&!N(e)};var le=function(){return!1},de=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i?v.Buffer:void 0,r=(o?o.isBuffer:void 0)||le;e.exports=r})),ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var pe=function(e){return ee(e)&&se(e.length)&&!!ue[T(e)]};var he=function(e){return function(t){return e(t)}},ve=u((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,o=n&&n.exports===i&&p.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})),fe=ve&&ve.isTypedArray,ge=fe?he(fe):pe,me=Object.prototype.hasOwnProperty;var ye=function(e){if(null==e)return!0;if(ce(e)&&(ae(e)||"string"==typeof e||"function"==typeof e.splice||de(e)||ge(e)||re(e)))return!e.length;var t=X(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(a(e))return!l(e).length;for(var i in e)if(me.call(e,i))return!1;return!0};var _e=function(e){return void 0===e};var Se=function(e){return null===e};var Ee=function(e){return"string"==typeof e||!ae(e)&&ee(e)&&"[object String]"==T(e)};var Oe=function(e){return"number"==typeof e||ee(e)&&"[object Number]"==T(e)};var Ae=function(e){return ee(e)&&"[object RegExp]"==T(e)},Te=ve&&ve.isRegExp,be=Te?he(Te):Ae;var we=function(e){return"symbol"==typeof e||ee(e)&&"[object Symbol]"==T(e)},Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ce=/^\w*$/;var Ie=function(e,t){if(ae(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!we(e))||(Ce.test(e)||!Ne.test(e)||null!=t&&e in Object(t))},Pe=z(Object,"create");var ke=function(){this.__data__=Pe?Pe(null):{},this.size=0};var Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},De=Object.prototype.hasOwnProperty;var Be=function(e){var t=this.__data__;if(Pe){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return De.call(t,e)?t[e]:void 0},je=Object.prototype.hasOwnProperty;var xe=function(e){var t=this.__data__;return Pe?void 0!==t[e]:je.call(t,e)};var Ue=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Pe&&void 0===t?"__lodash_hash_undefined__":t,this};function Me(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])}}Me.prototype.clear=ke,Me.prototype.delete=Re,Me.prototype.get=Be,Me.prototype.has=xe,Me.prototype.set=Ue;var Le=Me;var We=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},Fe=Array.prototype.splice;var Ke=function(e){var t=this.__data__,i=Je(t,e);return!(i<0)&&(i==t.length-1?t.pop():Fe.call(t,i,1),--this.size,!0)};var Ge=function(e){var t=this.__data__,i=Je(t,e);return i<0?void 0:t[i][1]};var He=function(e){return Je(this.__data__,e)>-1};var $e=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 Ve(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])}}Ve.prototype.clear=We,Ve.prototype.delete=Ke,Ve.prototype.get=Ge,Ve.prototype.has=He,Ve.prototype.set=$e;var Ze=Ve;var qe=function(){this.size=0,this.__data__={hash:new Le,map:new(F||Ze),string:new Le}};var Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ye=function(e,t){var i=e.__data__;return Qe(t)?i["string"==typeof t?"string":"hash"]:i.map};var Xe=function(e){var t=Ye(this,e).delete(e);return this.size-=t?1:0,t};var et=function(e){return Ye(this,e).get(e)};var tt=function(e){return Ye(this,e).has(e)};var it=function(e,t){var i=Ye(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function nt(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])}}nt.prototype.clear=qe,nt.prototype.delete=Xe,nt.prototype.get=et,nt.prototype.has=tt,nt.prototype.set=it;var ot=nt;function rt(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(rt.Cache||ot),i}rt.Cache=ot;var at=rt;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ct=/\\(\\)?/g,lt=function(e){var t=at(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(st,(function(e,i,n,o){t.push(n?o.replace(ct,"$1"):i||e)})),t}));var dt=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},ut=f?f.prototype:void 0,pt=ut?ut.toString:void 0;var ht=function e(t){if("string"==typeof t)return t;if(ae(t))return dt(t,e)+"";if(we(t))return pt?pt.call(t):"";var i=t+"";return"0"==i&&1/t==-Infinity?"-0":i};var vt=function(e){return null==e?"":ht(e)};var ft=function(e,t){return ae(e)?e:Ie(e,t)?[e]:lt(vt(e))};var gt=function(e){if("string"==typeof e||we(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var mt=function(e,t){for(var i=0,n=(t=ft(t,e)).length;null!=e&&i<n;)e=e[gt(t[i++])];return i&&i==n?e:void 0};var yt=function(e,t,i){var n=null==e?void 0:mt(e,t);return void 0===n?i:n},_t=function(){try{var e=z(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var St=function(e,t,i){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},Et=Object.prototype.hasOwnProperty;var Ot=function(e,t,i){var n=e[t];Et.call(e,t)&&ze(n,i)&&(void 0!==i||t in e)||St(e,t,i)},At=/^(?:0|[1-9]\d*)$/;var Tt=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&At.test(e))&&e>-1&&e%1==0&&e<t};var bt=function(e,t,i,n){if(!b(e))return e;for(var o=-1,r=(t=ft(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var c=gt(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=s[c];void 0===(l=n?n(d,c,s):void 0)&&(l=b(d)?d:Tt(t[o+1])?[]:{})}Ot(s,c,l),s=s[c]}return e};var wt,Nt,Ct,It,Pt,kt,Rt,Dt,Bt,jt,xt={isEmpty:ye,isNull:Se,isUndefined:_e,isFunction:N,isObject:b,isString:Ee,isNumber:Oe,isArray:ae,isRegExp:be,get:yt,set:function(e,t,i){return null==e?e:bt(e,t,i)},isPromise:e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};function Ut(e){return"function"==typeof window.Debug?window.Debug(e):function(...e){process.env.NODE_ENV}}exports.NetworkType=void 0,(wt=exports.NetworkType||(exports.NetworkType={})).none="none",wt.wifi="wifi",wt.cellular="cellular",wt.unknown="unknown",exports.PlatformType=void 0,(Nt=exports.PlatformType||(exports.PlatformType={})).wp="wp",Nt.android="android",Nt.iOS="iOS",Nt.unknown="unknown",exports.ProfileType=void 0,(Ct=exports.ProfileType||(exports.ProfileType={}))[Ct.user=1]="user",Ct[Ct.oa=0]="oa",Ct[Ct.aliasOA=2]="aliasOA",exports.ChatType=void 0,(It=exports.ChatType||(exports.ChatType={}))[It.user=1]="user",It[It.oa=0]="oa",exports.PostFeedType=void 0,(Pt=exports.PostFeedType||(exports.PostFeedType={}))[Pt.image=1]="image",Pt[Pt.link=4]="link",Pt[Pt.profile=5]="profile",exports.ShareSheetType=void 0,(kt=exports.ShareSheetType||(exports.ShareSheetType={}))[kt.image=1]="image",kt[kt.gif=11]="gif",kt[kt.video=12]="video",kt[kt.link=4]="link",kt[kt.oa=5]="oa",kt[kt.zmp=20]="zmp",kt[kt.multi_image=21]="multi_image",exports.OrientationType=void 0,(Rt=exports.OrientationType||(exports.OrientationType={}))[Rt.auto=1]="auto",Rt[Rt.portrait=2]="portrait",Rt[Rt.landscape=3]="landscape",exports.VibrateType=void 0,(Dt=exports.VibrateType||(exports.VibrateType={}))[Dt.oneShot=0]="oneShot",exports.Events=void 0,(Bt=exports.Events||(exports.Events={})).AppPaused="h5.event.paused",Bt.AppResumed="h5.event.resumed",Bt.NetworkChanged="h5.event.connection.changed",Bt.OnDataCallback="h5.event.webview.result",Bt.OpenApp="h5.event.open.mp",Bt.AppClose="h5.event.action.close",exports.MediaPickerType=void 0,(jt=exports.MediaPickerType||(exports.MediaPickerType={}))[jt.photo=4]="photo",jt[jt.video=5]="video",jt[jt.file=6]="file";const Mt=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},Lt=e=>Mt(`${window.location.host}_`+e),Wt=e=>Mt((()=>{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),zt=window.zAppID,Jt=window.APP_ID,Ft=window.APP_CONFIG||{},Kt="h5.zdn.vn_zoauth",Gt="h5.zdn.vn_zlink3rd",Ht="h5.zdn.vn_zoauth_vrf",$t="h5.zdn.vn_deviceID",Vt="https://graph.zalo.me/v2.0/me",Zt="https://h5.zalo.me/openapi/access_token",qt="https://oauth.zaloapp.com/v3/access_token",Qt="https://graph.zalo.me/v2.0/me/friends/list",Yt="https://h5.zalo.me/apps/get-info",Xt="https://h5.zalo.me/log/async",ei=e=>({NONE:e?-2:0,WIFI:e?0:1,"2G":2,"3G":e?15:2,"4G":e?13:2}),ti=0,ii=-2e3,ni=-1400,oi=-1500,ri=-1401,ai=-2004,si=-2005,ci={SUCCESS:"Success",UNKNOWN_ERROR:"Unknown error. Please try again later.",TIME_OUT:"Request timeout. Please try again later.",LOGIN_REQUIRED:"Please login (https://miniapp.zalo.me/docs/api/login) before to call this api",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 id. Please check your params again.",INVALID_PARAM:"Invalid parameter",USER_DENIED:"User denied",USER_CANCEL:"User cancel",MEDIA_PICKER_FAIL:"Unable to pick media",SAVE_IMAGE_FAIL:"Unable to save image"},li={SUCCESS:{code:ti,message:ci.SUCCESS},UNKNOWN_ERROR:{code:ii,message:ci.UNKNOWN_ERROR},UNAUTHORIZED:{code:ri,message:ci.LOGIN_REQUIRED},FORBIDDEN:{code:-1403,message:ci.NOT_PERMISSION},CLIENT_NOT_SUPPORT:{code:-1404,message:ci.CLIENT_NOT_SUPPORT},DECODE_FAILED:{code:-2001,message:ci.DECODE_FAILED},TIME_OUT:{code:-1408,message:ci.TIME_OUT},USER_DENIED:{code:-2002,message:ci.USER_DENIED},USER_CANCEL:{code:-2003,message:ci.USER_CANCEL}},di={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",error_list:{android:{"-2":{map_to:li.USER_DENIED}},iOS:{"-2":{map_to:li.USER_DENIED}}}},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,error_list:{android:{"-1":{map_to:li.USER_DENIED}},iOS:{"-1":{map_to:li.USER_DENIED}}}},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},error_list:{android:{"-101":{map_to:{code:si,message:ci.SAVE_IMAGE_FAIL},need_more_detail:!0},"-102":{map_to:{code:si,message:ci.SAVE_IMAGE_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:si,message:ci.SAVE_IMAGE_FAIL},need_more_detail:!0}}}},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},error_list:{android:{"-1":{map_to:li.USER_DENIED},"-101":{map_to:li.USER_DENIED}},iOS:{"-1":{map_to:li.USER_DENIED},"-10":{map_to:li.USER_DENIED}}}},MP_OPEN_PROFILE_PICKER:{name:"action.mp.open.profile.picker",version_live:{iOS:432},error_list:{android:{"-101":{map_to:li.USER_CANCEL}},iOS:{"-101":{map_to:li.USER_CANCEL}}}},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:440},error_list:{android:{"-101":{map_to:li.USER_CANCEL},999:{map_to:{code:ai,message:ci.MEDIA_PICKER_FAIL},need_more_detail:!0}},iOS:{"-10":{map_to:{code:ai,message:ci.MEDIA_PICKER_FAIL}}}}},MP_CLOSE_LOADINGVIEW:{name:"action.mp.close.loadingview"}},ui={android:{"-4":li.DECODE_FAILED,"-5":li.CLIENT_NOT_SUPPORT,"-14":li.TIME_OUT},iOS:{"-9":li.DECODE_FAILED,"-5":li.CLIENT_NOT_SUPPORT,"-14":li.TIME_OUT}},pi={android:12100571,iOS:400,wp:0,unknown:0},hi={android:12100641,iOS:460,wp:0,unknown:0},vi=[di.GET_DOWNLOADED_STICKER.name,di.OPEN_SHARE_STICKER.name,di.OPEN_PROFILE.name,di.OPEN_FEED_DETAIL.name,di.OPEN_FRIEND_RADA.name,di.OPEN_INAPP.name,di.OPEN_OUTAPP.name,di.OPEN_PAGE.name,di.OPEN_PHOTODETAIL.name,di.OPEN_GALARY.name,di.OPEN_GAMECENTER.name,di.OPEN_GAMENEWS.name,di.OPEN_TAB_CONTACT.name,di.OPEN_TAB_SOCIAL.name,di.OPEN_FRIENDSUGGEST.name,di.OPEN_GROUPLIST.name,di.OPEN_NEARBY.name,di.OPEN_ROOM.name,di.OPEN_STICKERSTORE.name,di.OPEN_CREATECHAT.name,di.COPY_LINK_CATESTICKER.name,di.REQUEST_BUY_STICKER.name,di.OPEN_CHAT.name,di.OPEN_TAB_CHAT.name,di.OPEN_CHATGROUP.name,di.OPEN_ADDFRIEND.name,di.OPEN_TAB_MORE.name,di.OPEN_POSTFEED.name,di.OPEN_LOGINDEVICES.name,di.OPEN_SENDSTICKER.name,di.REPORT_ABUSE.name,di.FOLLOW_OA.name,di.UNFOLLOW_OA.name,di.OPEN_GAMEDETAIL.name,di.OPEN_SHARESHEET.name,di.REQUEST_PERMISSION_CAMERA.name,di.CHANGE_TITLE_HEADER.name,di.WEBVIEW_CLEARCACHE.name,di.WEBVIEW_CONFIRMCACHE.name,di.WEBVIEW_ISVISIBLE.name,di.WEBVIEW_NETWORKTYPE.name,di.CHANGE_BUTTON_HEADER.name,di.CREATE_OPTIONS_MENU.name,di.CREATE_SHORTCUT.name,di.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,di.WINDOW_CLOSE.name,di.WEBVIEW_CHECKRESERROR.name,di.IAP_REQUESTPAYMENT.name,di.ZBROWSER_GETSTATS.name,di.ZBROWSER_JSBRIDGE.name,di.PROMPT_AUTHENTICATION.name,di.CHANGE_ACTIONBAR_COLOR.name,di.PROMPT_AUTHENTICATION_CHECK_STATE.name,di.OPEN_APPSTORE.name,di.GET_LOCATION.name,di.QUERY_LOCATION_HIDE.name,di.SHOW_TOAST.name,di.OPEN_APP.name,di.HIDE_KEYBOARD.name,di.OPEN_PHONE.name,di.OPEN_QR.name,di.OPEN_SMS.name,di.VIEW_MYQR.name,di.KEEP_SCREEN.name,di.CHANGE_AUTOROTATE.name,di.CHECK_APP_INSTALLED.name,di.QUERY_SHOW.name,di.QUERY_HIDE.name,di.OPEN_INAPPRW.name,di.ZALORUN_GETTRACKINGSTATUS.name,di.ZALORUN_SETTRACKINGSTATUS.name,di.ZALORUN_GETDAYSTEP.name,di.ZALORUN_FORCESUBMITDATA.name,di.ZALORUN_SETWEIGHT.name,di.OPEN_PROFILE_EXT.name,di.DOWNLOAD_CATE.name,di.JUMP_LOGIN.name,di.OPEN_ADTIMA_ADS_INTERSTITIAL.name,di.OPEN_ADTIMA_ADS.name,di.GET_ADIDCLIENT.name,di.SCAN_IBEACON.name,di.SAVE_IMAGE_GALLERY.name,di.OPEN_MP.name,di.CHANGE_ACTIONBAR.name,di.INTERACTIVE_VIBRATION.name,di.ZBROWSER_MPDS.name],fi=0,gi=3,mi=1,yi=0,_i="https://payment-mini.zalo.me/api/order/create",Si="https://payment-mini.zalo.me/api/transaction";class Ei{constructor(e,t,i){this.code=e,this.message=t,this.api=i}toString(){return`api: ${String(this.api)}; code: ${this.code}; message: ${this.message}`}toJSON(){return{code:this.code,message:this.message,api:this.api}}}const Oi=(e,t)=>e instanceof Ei?((e,t)=>(e.api=t,e.toJSON()))(e,t):((e,t)=>e instanceof Error?new Ei(ii,e.message,t).toJSON():new Ei(ii,ci.UNKNOWN_ERROR,t).toJSON())(e,t),Ai=(e,t)=>({code:ti,message:t||ci.SUCCESS,data:e||{}}),Ti={badRequest:e=>new Ei(ni,e),loginFailed:e=>new Ei(ri,`${ci.LOGIN_FAILED}: ${e}`),loginRequired:()=>new Ei(ri,ci.LOGIN_REQUIRED),missingParam:e=>new Ei(ni,`Missing required argument: ${e}`),wrongTypeParam:(e,t,i)=>new Ei(ni,`Wrong type of parameter '${e}'. Expected ${t}, but got ${i}`),cannotGetShareInfo:()=>new Ei(oi,"Can not get app info to share"),lengthInvalid:e=>new Ei(ni,`${e} length is invalid.`)};const bi={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:bi.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("&")}},wi=new RegExp("[\\u0300-\\u036f]","g"),Ni=new RegExp("[đ|Đ]","g"),Ci=new RegExp("\\s","g"),Ii=Ut("zmp:utils:common"),Pi=e=>{try{new URL(e)}catch(e){return!1}return!0},ki=()=>navigator.userAgent||navigator.vendor||window.opera,Ri=()=>{const e=ki().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)}},Di=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""},Bi=()=>{const e=ki().toLowerCase().split("zalo")[1];if(e){return e.replace(" ","").split("/")[1]||""}return""},ji=()=>{let e=Ri();return e.isWP?exports.PlatformType.wp:e.isAndroid?exports.PlatformType.android:e.isIOS?exports.PlatformType.iOS:exports.PlatformType.unknown},xi=(e,t)=>{const i=t.toLowerCase(),n=i.split(/[<>]/i),o="array"===n[0];return!!("url"===i&&Pi(e)||o&&("array"===i&&Array.isArray(e)||((e,t)=>Array.isArray(t)&&!t.some((t=>"url"===e?!Pi(t):typeof t!==e)))(n[1],e))||!Array.isArray(e)&&typeof e===t)},Ui=e=>(e=>{let t=Lt(e);return t||(t=Wt(e),t)?t:Mt(e)})(e),Mi=e=>{if(xt.isObject(JSON)&&JSON.parse&&xt.isString(e)){const t=e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\x00/g,"");return JSON.parse(t,((e,t)=>t))}return xt.isObject(e)?e:new Function("return "+e)()},Li=e=>{if(xt.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(Li(e[n]));return"["+t.join(",")+"]"}if("object"==typeof e){for(var o in t=new Array,e)t.push('"'+o+'":'+Li(e[o]));return"{"+t.join(",")+"}"}return e.toString()},Wi=()=>{try{const e=Number(Bi()),t=ji();return e>=pi[t]}catch(e){return!0}},zi=e=>JSON.stringify(e).replace(/"/g,'\\"').replace(/'/g,"'"),Ji=e=>{try{if(e){Ii(e);const t=e.replace(/\\/g,"").replace(/'/g,"'");return Ii("formattedValue",t,JSON.parse(t),typeof JSON.parse(t)),JSON.parse(t)}return null}catch(t){return Ii("parse json error:",t),e}},Fi=(e,t,n,o,r,a)=>i(void 0,void 0,void 0,(function*(){const i=new URL(location.href),s=new URLSearchParams;let c=`${i.pathname}${i.search}`;a&&(c=`/zapps/${e}${"/"===a[0]?"":"/"}${a}`);const l=new URL(`https://zalo.me/app/link${c}`);s.append("title",n),s.append("description",o||""),s.append("thumbnail",r),s.append("url",l.href),s.append("accessToken",t||"");const d=yield fetch("https://h5.zalo.me/openapi/create-sharelink",Object.assign({method:"POST",body:s},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})),u=yield d.json();if(!u||0!==u.err)throw Ti.cannotGetShareInfo();return l.search=`${l.search}&zshareId=${u.data.shareId}`,Object.assign(Object.assign({},u.data),{shareableLink:l.href})})),Ki=(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(xt.isNumber(null==t?void 0:t.maxLength))return{error:xt.isString(i)&&i.length>(null==t?void 0:t.maxLength),errorMessage:`data length must <= ${null==t?void 0:t.maxLength}`};if(xt.isNumber(null==t?void 0:t.min)&&xt.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(xt.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(xt.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(xt.isRegExp(null==t?void 0:t.regex))return{error:!t.regex.test(i),errorMessage:"data must valid"}}return{error:!1}},Gi=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i={appId:e,versionStatus:t};xt.isUndefined(n)||(i.currentVersion=n);const o=bi.appendToUrl(Yt,i),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 Hi=u((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),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=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 c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,r),!0;case 6:return d.fn.call(d.context,t,n,o,r,a),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var p,h=d.length;for(l=0;l<h;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!c)for(p=1,c=new Array(u-1);p<u;p++)c[p-1]=arguments[p];d[l].fn.apply(d[l].context,c)}}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 c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||o&&!s[c].once||n&&s[c].context!==n)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l: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 $i extends Hi{constructor(){super(),this.debug=Ut("zmp:event-emitter")}static getInstance(){return $i.instance||($i.instance=new $i),$i.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 Vi,Zi,qi,Qi,Yi;class Xi{static getVersion(){return"2.21.2"}static getSystemInfo(){return{version:Di("version-id")||"",apiVersion:"2.21.2",zaloVersion:Bi(),platform:ji(),language:navigator.language,zaloLanguage:window.zLanguage||"vi",zaloTheme:window.zTheme||"light"}}static getAppInfo(){return i(this,void 0,void 0,(function*(){const e=this.getAppId(),t=this.getSystemInfo();return yield Gi(e,0,t.version)}))}}class en{static setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.CHANGE_TITLE_HEADER,{title:e.title},{haveTimeout:!1})}))}static setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){const t={};let i;xt.isEmpty(e.textColor)||(t.textColor=e.textColor),xt.isString(e.color)&&e.color.length>0?(xt.isEmpty(e.color)||(t.backgroundColor=e.color),i=5):(xt.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.getJSBridge().callNative(di.CHANGE_ACTIONBAR,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBarLeftButton(e,t){return i(this,void 0,void 0,(function*(){let i,n;xt.isString(e)&&(i="none"===e||"home"===e?gi:fi,n="home"===e||"both"===e?mi:yi),this.setActionBarConfig((e=>Object.assign(Object.assign({},e),{buttonType:xt.isNumber(i)?i:e.buttonType,dataConfig:Object.assign(Object.assign({},e.dataConfig),{confirmToExit:xt.isNumber(t)?t:e.dataConfig.confirmToExit,viewInLeftType:xt.isNumber(i)?i:e.dataConfig.viewInLeftType}),homeConfig:Object.assign(Object.assign({},e.homeConfig),{enable:xt.isNumber(n)?n:e.homeConfig.enable})}))),yield this.getJSBridge().callNative(di.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE,Object.assign({},this.getActionBarConfig()),{haveTimeout:!1})}))}static setNavigationBar(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.CHANGE_ACTIONBAR,{data:e},{haveTimeout:!1})}))}}class tn{static setBackgroundColor(e){return i(this,void 0,void 0,(function*(){xt.isString(e.backgroundColor)&&e.backgroundColor.length>0&&(yield this.getJSBridge().callNative(di.CHANGE_ACTIONBAR,{actionbarType:this.isShowNavBar?5:6,dataConfig:{backgroundColor:e.backgroundColor,textColor:e.textColor}}))}))}}class nn{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(" ")}}Vi=new WeakMap,Zi=new WeakMap,qi=new WeakMap,Qi=new WeakMap,Yi=new WeakMap;const on=new class{constructor(){Vi.set(this,3),Zi.set(this,["none","error","warn","info"]),qi.set(this,"[zmp] > "),Qi.set(this,{error:0,warn:0,info:0,firstError:null,lastError:null}),Yi.set(this,((e,t,i)=>{n(this,Qi,"f")[n(this,Zi,"f")[e]]++;const r=n(this,Zi,"f")[e];if(o(this,qi,n(this,qi,"f")+("string"!=typeof t?new nn(t,r,e,i).toString():t),"f"),!(e>n(this,Vi,"f")))switch(e){case 1:console.error(n(this,qi,"f"));break;case 2:console.warn(n(this,qi,"f"));break;case 3:console.info(n(this,qi,"f"));break;default:throw new Error("internal")}}))}setLogLevel(e){o(this,Vi,e,"f")}info(e){n(this,Yi,"f").call(this,3,e)}warn(e,t){n(this,Yi,"f").call(this,2,e,t)}error(e,t){n(this,Yi,"f").call(this,1,e,t)}getMetrics(){return n(this,Qi,"f")}};class rn{static setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.CHANGE_AUTOROTATE,{autoRotate:exports.OrientationType[e.rotate]})}))}static getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.WEBVIEW_NETWORKTYPE,{url:window.location.href,featureId:""}).then((e=>{const t=e.network;let i;const n=Ri().isAndroid;switch(t){case ei(n).NONE:i=exports.NetworkType.none;break;case ei(n).WIFI:i=exports.NetworkType.wifi;break;case ei(n)["2G"]:case ei(n)["3G"]:case ei(n)["4G"]:i=exports.NetworkType.cellular;break;default:i=exports.NetworkType.unknown}return{networkType:i}}))}))}static onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.NetworkChanged,(t=>{const i=t&&t.state;this.getNetworkType().then((t=>{const n={isConnected:"CONNECTED"===i,networkType:t&&t.networkType};e(n)})).catch((e=>{on.error(e,"onNetworkStatusChange")}))}))}))}static startBeaconDiscovery(e){var t,n,o,r,a;return i(this,void 0,void 0,(function*(){const i={subaction:0,scanning_type:xt.isNumber(null==e?void 0:e.scanningType)?e.scanningType:0,data:{scan_from_source:xt.isString(null==e?void 0:e.scanFromSource)?e.scanFromSource:"",expire:xt.isNumber(null==e?void 0:e.expire)?e.expire:3e3,monitor_interval:xt.isNumber(null==e?void 0:e.monitorInterval)?e.monitorInterval:60,domain:xt.isString(null==e?void 0:e.domain)?e.domain:"",scan_config:{scan_time:xt.isNumber(null===(t=null==e?void 0:e.scanConfig)||void 0===t?void 0:t.scanTime)?e.scanConfig.scanTime:15e3,time_between_scan:xt.isNumber(null===(n=null==e?void 0:e.scanConfig)||void 0===n?void 0:n.timeBetweenScan)?e.scanConfig.timeBetweenScan:1e4,beacon_timeout:xt.isNumber(null===(o=null==e?void 0:e.scanConfig)||void 0===o?void 0:o.beaconTimeout)?e.scanConfig.beaconTimeout:3e4,delayCheckConnectedTimeout:xt.isNumber(null===(r=null==e?void 0:e.scanConfig)||void 0===r?void 0:r.delayCheckConnectedTimeout)?e.scanConfig.delayCheckConnectedTimeout:5e3,beaconConnectedTimeout:xt.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.getJSBridge().callNative(di.SCAN_IBEACON,Object.assign({},i)),!0}))}static stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.SCAN_IBEACON,Object.assign({},{subaction:2})),!0}))}static getBeacons(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.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 i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},Object.assign({},e))}))}static openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return Promise.resolve()}))}static getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){const t={services:e.services||[]};return this.getJSBridge().callNative({name:""},t)}))}static getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return this.getJSBridge().callNative({name:""},{})}))}static scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_QR,{skipOpenLink:!0})}))}static showToast(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.SHOW_TOAST,{toast:e.message})}))}static hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.HIDE_KEYBOARD,{})}))}static openPhone(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.OPEN_PHONE,{phoneNum:e.phoneNumber,phoneCode:e.phoneNumber})}))}static openSMS(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.OPEN_SMS,{content:e.content,phoneCode:e.phoneNumber})}))}static keepScreen(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.KEEP_SCREEN,{data:{keep_screen_on:e.keepScreenOn?1:0}})}))}static openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.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 i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.PROMPT_AUTHENTICATION_CHECK_STATE,{}).then((e=>({bioState:null==e?void 0:e.bio_state})))}))}static vibrate(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.INTERACTIVE_VIBRATION,{type:exports.VibrateType[e.type],vibrate_time:e.milliseconds})}))}static connectWifi(e){return i(this,void 0,void 0,(function*(){let t="open";return xt.isString(e.password)&&e.password.length>0&&(t="wpa_wpa2"),yield this.getJSBridge().callNative(di.MP_JOIN_WIFI,{ssid:e.SSID,securityType:t,password:e.password,hiddenSsid:e.hiddenSSID})}))}static openAppStore(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_APPSTORE,e)}))}}var an,sn,cn;class ln{constructor(e){an.set(this,localStorage),sn.set(this,void 0),cn.set(this,void 0),Ri(),o(this,cn,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,sn,e,"f"),this.findAllCurrentDataByApp(e)}findAllCurrentDataByApp(e){try{let t;for(t in n(this,an,"f")){if(e){if(t.split("_")[0]!==e)continue}n(this,cn,"f").keys.add(t)}}catch(e){on.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 n(this,sn,"f")&&(e=`${n(this,sn,"f")}_${e}`),n(this,cn,"f").keys.has(e)?n(this,an,"f").getItem(e):null}set(e){return i(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){n(this,sn,"f")&&(e=`${n(this,sn,"f")}_${e}`),n(this,an,"f").setItem(e,t),n(this,cn,"f").keys.add(e)}getInfo(){return i(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})(n(this,an,"f"),n(this,sn,"f"));return{currentSize:xt.isNumber(e)?Number((e/1024).toFixed(2)):0,limitSize:Number(5120..toFixed(2))}}remove(e){return i(this,void 0,void 0,(function*(){return e.forEach((e=>{this.removeSync(e)})),Promise.resolve({errorKeys:[]})}))}removeSync(e){n(this,sn,"f")&&(e=`${n(this,sn,"f")}_${e}`),n(this,cn,"f").keys.has(e)&&(n(this,an,"f").removeItem(e),n(this,cn,"f").keys.delete(e))}clear(){return i(this,void 0,void 0,(function*(){return Promise.resolve(this.clearSync())}))}clearSync(){n(this,cn,"f").keys.forEach((e=>{n(this,sn,"f")&&e.indexOf(n(this,sn,"f"))<0||(n(this,an,"f").removeItem(e),n(this,cn,"f").keys.delete(e))}))}}an=new WeakMap,sn=new WeakMap,cn=new WeakMap;var dn={},un=function(e,t,i){var n=t||"default";return function(){var t=n in dn?dn[n](e,i):e;return t.apply(this,arguments)}};un.setWrapper=function(e){var t=arguments.length<=1||void 0===arguments[1]?"default":arguments[1];dn[t]=e};var pn={error:{code:1,error_subcode:1357046,message:"Received Invalid JSON reply.",type:"http"}};function hn(e){try{return null===e?pn:JSON.parse(e)}catch(e){return pn}}var vn,fn,gn,mn,yn,_n,Sn,En,On,An,Tn,bn,wn,Nn,Cn,In,Pn,kn,Rn,Dn,Bn,jn,xn,Un,Mn,Ln,Wn,zn,Jn,Fn={execute:function(e,t,i,n){i.suppress_http_code=1;var o=bi.encode(i);"post"!=t&&(e=bi.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=un((function(){r=n,"onload"in o&&o.onload(i)}),"entry","XMLHttpRequest:load"),a=un((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(hn(e.responseText))},r.onerror=function(e){e.responseText?n(hn(e.responseText)):n({error:{code:1,error_subcode:1357045,message:"unknown error (empty response)",status:e.status,type:"http"}})},r.send(o),!0)}};class Kn extends Hi{constructor(){super(),vn.add(this),this.debug=Ut("zmp:ZaloJSBridge"),this.events=$i.getInstance(),this._accessTk=Ui("zacc_session")||"DEFAULT_ACCESS_TOKEN",this._jsAccessTk=Ui("zlink3rd")||"DEFAULT_JS_TOKEN",this.results=[],this._userAgent=ki(),this._device=Ri(),this.isJumped=!1,fn.set(this,null),gn.set(this,void 0),this.jump=()=>new Promise(((e,t)=>{xt.isUndefined(n(this,fn,"f"))||xt.isNull(n(this,fn,"f"))?this.callNative(di.JUMP_LOGIN,{}).then((t=>{const i=t&&t.cookiesOAuthLogins||[],r=t&&t.actionPermission||[];Object.entries(r).forEach((e=>{const t=e[0],i=e[1]||{perm:0,decode:0};n(this,gn,"f")[t]||(n(this,gn,"f")[t]={permission:!1,support:!1}),n(this,gn,"f")[t].permission=1===i.perm}));const a=i.find((e=>e.name===Gt));a&&(this.jsAccessTk=a.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(a.value)),o(this,fn,i,"f"),this.isJumped=!0,e(i)})).catch((e=>{this.isJumped=!1,t(e)})):e(n(this,fn,"f"))})),this._jsCallFuncCallbacks={},o(this,gn,{},"f"),this.events.on(exports.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 Kn.instance||(Kn.instance=new Kn),Kn.instance}set accessTk(e){this._accessTk=e}set jsAccessTk(e){this._jsAccessTk=e}sendLogData(e){try{const t=e.map((e=>({action:e.action,error:e.error})));Fn.execute(Xt,"post",{appId:window.APP_ID,data:JSON.stringify(t)},(e=>{})),window.zmpSentry&&window.zmpSentry.captureMessage("Result from native",{extra:{data:e}})}catch(e){}}onJSCall(e,t){try{this.debug("onJSCall",e,t);const i=Mi(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,message:i.error_message})}catch(e){console.log("onJSCall","error",e)}}onMultiJSCall(e,t){try{this.debug("onMultiJSCall",e,t);const i=Mi(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,message:i.error_message})}catch(e){console.log("onMultiJSCall","error",e)}}nativeEventHandler(e,t,i){this.debug(`eventId: ${e}, eventName: ${t}, eventData: ${i}`);const n=Ji(i);this.debug(n);const o=this.handleEventData(t,n);this.events.emit(t,e,o)}handleEventData(e,t){try{switch(e){case exports.Events.OpenApp:const{url:e}=t,i=new URL(e),n=i.pathname.split(`/zapps/${Jt}`)[1];return{path:`${n||"/"}${i.search}`};default:return t}}catch(e){return t}}defaultCallback(e){null!=e&&(e=Mi(e))}callNative(e,t,o){return this.debug(e.name,t),new Promise(((r,a)=>{const s=t=>i(this,void 0,void 0,(function*(){var i,n,s,c,l,d,u,p;try{if(xt.isUndefined(t)||xt.isNull(t))return a(new Error("Native callback is null"));if(0!==t.error_code){let o=new Ei(t.error_code,t.error_message);const r=ji();if(e===di.JUMP_LOGIN)o=new Ei(ii,`Can not get auth code: ${t.error_message}`);else if(this.isJumped||e.skip_jump){if("permission required!"===String(o.message).toLowerCase()||"no permission!"===String(o.message).toLowerCase())o=new Ei(li.FORBIDDEN.code,li.FORBIDDEN.message);else if(ui[r][t.error_code])o=new Ei(ui[r][t.error_code].code,ui[r][t.error_code].message);else if(null===(n=null===(i=e.error_list)||void 0===i?void 0:i[r])||void 0===n?void 0:n[String(t.error_code)]){let i=e.error_list[r][String(t.error_code)].map_to.message;(null===(l=null===(c=null===(s=e.error_list)||void 0===s?void 0:s[r])||void 0===c?void 0:c[String(t.error_code)])||void 0===l?void 0:l.need_more_detail)&&(i=`${null===(p=null===(u=null===(d=e.error_list)||void 0===d?void 0:d[r])||void 0===u?void 0:u[String(t.error_code)])||void 0===p?void 0:p.map_to.message}: ${t.error_message}`),o=new Ei(e.error_list[r][String(t.error_code)].map_to.code,i)}}else o=new Ei(li.UNAUTHORIZED.code,li.UNAUTHORIZED.message);return a(o)}if(null==o?void 0:o.successCallback){const e=yield o.successCallback(t.data);return r(e)}r(t.data||{})}catch(e){return a(e)}})),c=Ri().isIOS,l=(e=>{var t;const i=Bi(),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(c&&!l){const e=new Ei(-5,"Client isn't support this action");return a(e)}(null==o?void 0:o.delay)?setTimeout((()=>{n(this,vn,"m",mn).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}),o.delay):n(this,vn,"m",mn).call(this,e,t,s,null==o?void 0:o.isMultiCallback,null==o?void 0:o.nRetry,null==o?void 0:o.haveTimeout)}))}}fn=new WeakMap,gn=new WeakMap,vn=new WeakSet,mn=function e(t,i,o,r=!1,a=3,s=!0){try{const c=t.name,l=((e="")=>`${e.normalize("NFD").replace(wi,"").replace(Ni,"d").replace(Ci,"").toLowerCase()}_${Math.random().toString(36).substr(2,4)}`)(c);if(!this._device.isMobile||xt.isEmpty(c))return this.onJSCall(l,{error_code:-13,error_message:"params invalid!",data:{device:this._device.isMobile,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c}),!1;null==i&&(i={}),o||(o=this.defaultCallback);const d={error_code:-14,error_message:"Request Timeout!",data:{},action:c};this._jsCallFuncCallbacks[l]={timeout:s&&t.have_callback&&setTimeout((()=>{this.onJSCall(l,d)}),8e3),callback:o};try{return i=Li(i),r?this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onMultiJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onMultiJSCall('${l}')`):this._device.isIOS?ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,window.onJSCall(l)):ZaloJavaScriptInterface.jsCall(this._jsAccessTk,c,this._accessTk,i,`window.onJSCall('${l}')`)}catch(s){if(!(a-- >0)){const e={error_code:-5,error_message:"Not ready!",data:{userAgent:this._userAgent,options:i,jsToken:this._jsAccessTk,access_token:this._accessTk},action:c,js_error:s};return this.onJSCall(l,e),!1}setTimeout((()=>{n(this,vn,"m",e).call(this,t,i,o,r,a)}),500)}}catch(e){console.log("jsCall","error",e)}return!1};class Gn{constructor(e){yn.set(this,void 0),_n.set(this,void 0),Sn.set(this,void 0),o(this,_n,{keys:new Set,currentSize:0,limitSize:5242880},"f"),o(this,yn,e,"f"),o(this,Sn,Kn.getInstance(),"f")}get(e){return i(this,void 0,void 0,(function*(){return yield n(this,Sn,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.get",mpds_data:{keys:e},appId:n(this,yn,"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 i(this,void 0,void 0,(function*(){return{errorKeys:yield n(this,Sn,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.set",mpds_data:{map:e},appId:n(this,yn,"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 i(this,void 0,void 0,(function*(){const e=yield n(this,Sn,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.get.size",mpds_data:{},appId:n(this,yn,"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:xt.isNumber(e)?Number(e/1024):0,limitSize:Number(5120)}}))}remove(e){return i(this,void 0,void 0,(function*(){return{errorKeys:yield n(this,Sn,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.remove.key",mpds_data:{keys:e},appId:n(this,yn,"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 i(this,void 0,void 0,(function*(){yield n(this,Sn,"f").callNative(di.ZBROWSER_MPDS,{mpds_action:"mpds.clear.appData",mpds_data:{},appId:n(this,yn,"f")})}))}}yn=new WeakMap,_n=new WeakMap,Sn=new WeakMap;class Hn{getDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i=yield t.get(e),n={};return i.forEach(((e,t)=>{n[t]=Ji(e)})),n}))}putDataToStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance(),i={};return Object.entries(e).forEach((([e,t])=>{xt.isUndefined(t)||xt.isNull(t)||(i[e]=zi(t))})),yield t.set(i)}))}removeDataFromStorage(e){return i(this,void 0,void 0,(function*(){const t=this.getInstance();return yield t.remove(e)}))}clearStorage(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();yield e.clear()}))}getStorageInfo(){return i(this,void 0,void 0,(function*(){const e=this.getInstance();return yield e.getInfo()}))}}class $n extends Hn{constructor(e){super(),En.set(this,void 0),o(this,En,e,"f")}getInstance(){return new ln(n(this,En,"f"))}}En=new WeakMap;class Vn extends Hn{constructor(e){super(),On.set(this,void 0),o(this,On,e,"f")}getInstance(){return new Gn(n(this,On,"f"))}}On=new WeakMap;class Zn{static setStorage(e){return i(this,void 0,void 0,(function*(){let t=new $n(this.getAppId());return Wi()&&(t=new Vn(this.getAppId())),yield t.putDataToStorage(e.data)}))}static getStorage(e){return i(this,void 0,void 0,(function*(){let t=new $n(this.getAppId());Wi()&&(t=new Vn(this.getAppId()));return yield t.getDataFromStorage(e.keys)}))}static getStorageInfo(e){return i(this,void 0,void 0,(function*(){let e=new $n(this.getAppId());return Wi()&&(e=new Vn(this.getAppId())),yield e.getStorageInfo()}))}static removeStorage(e){return i(this,void 0,void 0,(function*(){let t=new $n(this.getAppId());return Wi()&&(t=new Vn(this.getAppId())),yield t.removeDataFromStorage(e.keys)}))}static clearStorage(e={}){return i(this,void 0,void 0,(function*(){let e=new $n(this.getAppId());Wi()&&(e=new Vn(this.getAppId())),yield e.clearStorage()}))}}class qn{static getUserInfo(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();let n="id,name,picture";(null==e?void 0:e.avatarType)&&(n=`${n}.type(${null==e?void 0:e.avatarType})`);return{userInfo:yield fetch(`${Vt}?fields=${n}`,{headers:{access_token:t||""}}).then((e=>i(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 i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.MP_GET_NUMBER,{},{isMultiCallback:!0,successCallback:e=>{const t={number:e};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}}class Qn{static closeApp(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.WINDOW_CLOSE,{})}))}static openMiniApp(e){return i(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 Gi(t,0)}catch(e){}const r={appId:t};o&&(r.appName=o.name,r.appAvtUrl=o.logoUrl),yield this.getJSBridge().callNative(di.OPEN_MP,{mpUrl:`https://h5.zdn.vn/zapps/${t}/${n.length>0?"?"+n:""}`,mpInfo:r})}))}static openWebview(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.OPEN_INAPP,{url:e})}))}static closeLoading(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.MP_CLOSE_LOADINGVIEW,{at:(new Date).getTime(),when:e,url:location.href})}))}}class Yn{static getLocation(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.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,successCallback:e=>{const t={latitude:e.latitude,longitude:e.longitude,timestamp:e.timestamp,provider:e.provider};return Promise.resolve(t)},delay:this.isIOS?400:0})}))}static sendLocation(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.QUERY_LOCATION_HIDE,{title:e.title,touserid:e.toUserId,zapp:this.getZAppId()})}))}}class Xn{static requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.REQUEST_PERMISSION_CAMERA,{},{successCallback:()=>Promise.resolve({userAllow:!0,message:"User Allow"})})}))}static saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){let t={};return xt.isEmpty(e.imageBase64Data)?xt.isEmpty(e.imageUrl)||(t={imageUrl:e.imageUrl}):t={imageBase64Data:e.imageBase64Data},yield this.getJSBridge().callNative(di.SAVE_IMAGE_GALLERY,Object.assign({},t))}))}}class eo{static viewOAQr(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.VIEW_MYQR,{dpn:e.displayName,uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openProfile(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_PROFILE,{uId:e.id,type:exports.ProfileType[e.type],zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openChat(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_CHAT,{uId:e.id,type:exports.ChatType[e.type],msg:e.message||"",zapp:this.getZAppId(),sourceId:e.sourceId,sourceIndex:e.sourceIndex})}))}static openPostFeed(e){return i(this,void 0,void 0,(function*(){let t={};switch(e.type){case"image":t={photoUrl:e.data.imageUrl};break;case"link":t={link:e.data.link,title:e.data.title,thumb:e.data.thumb,description:e.data.description};break;case"profile":t={avt:e.data.avatar,uid:e.data.id,dpn:e.data.displayName}}return yield this.getJSBridge().callNative(di.OPEN_POSTFEED,Object.assign(Object.assign({type:exports.PostFeedType[e.type]},t),{zapp:this.getZAppId()})).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static followOA(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.FOLLOW_OA,{uid:e.id,showDialogConfirm:!0,zapp:this.getZAppId()},{haveTimeout:!1})}))}static unfollowOA(e){return i(this,void 0,void 0,(function*(){yield this.getJSBridge().callNative(di.UNFOLLOW_OA,{uid:e.id,zapp:this.getZAppId()},{haveTimeout:!1})}))}static openShareSheet(e){return i(this,void 0,void 0,(function*(){let t={},i=e.type;switch(e.type){case"image":let n=[];const o=Bi(),r=ji();o>=hi[r]&&(i="multi_image"),Array.isArray(e.data.imageUrls)&&e.data.imageUrls.length>0?n=e.data.imageUrls:n.push(e.data.imageUrl),t={photoUrls:n,photoUrl:e.data.imageUrl,caption:e.data.caption};break;case"gif":t={photoUrl:e.data.imageUrl,gifUrl:e.data.gifUrl,width:e.data.width,height:e.data.height};break;case"video":t={videoThumb:e.data.videoThumb,videoUrl:e.data.videoUrl,width:e.data.width,height:e.data.height};break;case"link":t={link:e.data.link,chatOnly:e.data.chatOnly?1:0};break;case"oa":t={uid:e.data.id};break;case"zmp":const a=yield this.getAccessToken(),s=yield Fi(this.getAppId(),a||"",e.data.title||"",e.data.description||"",e.data.thumbnail||"",e.data.path);window.forceShareZMP?t={data:{ZInstantAPIInfo:{url:`${s.zinstantApi}`,zinstantdata_id:`templateId=${s.ztemplateId}&appId=${this.getAppId()}&shareId=${s.shareId}`},previewMsgText:{msg:{en:"Zalo Mini Program",vi:"Chương trình nhỏ"}},enableReactions:1}}:(t={link:s.shareableLink,chatOnly:e.data.chatOnly?1:0},e.type="link")}return yield this.getJSBridge().callNative(di.OPEN_SHARESHEET,Object.assign(Object.assign({type:exports.ShareSheetType[i]},t),{zapp:this.getZAppId()}),{haveTimeout:!1}).then((e=>({status:e.status,shareType:e.share_type,numberOfUser:e.uid_to_size})))}))}static createShortcut(e,t,n){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.CREATE_SHORTCUT,{url:e,title:t,iconUrl:n})}))}static openProfilePicker(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.MP_OPEN_PROFILE_PICKER,{maxProfile:e},{isMultiCallback:!0,successCallback:e=>{if(Array.isArray(e))return Promise.resolve(e.map((e=>e.id)))}})}))}static getActionsSupported(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.GET_SUPPORTED_ACTIONS,{},{isMultiCallback:!1,successCallback:e=>{const t=ji();if(Array.isArray(e.actions)&&e.actions.length>0){const t=Object.keys(di).filter((e=>di[e].skip_jump)),i={actions:[...e.actions,...t]};return Promise.resolve(i)}if(t===exports.PlatformType.iOS){const e={actions:vi};return Promise.resolve(e)}}})}))}static openMediaPicker(e,t,n,o,r,a){return i(this,void 0,void 0,(function*(){const i={type:0,url:t,maxSize:n||1048576};return yield this.getJSBridge().callNative(di.PICK_MEDIA,{media_type:exports.MediaPickerType[e],edit_view:Object.assign(Object.assign({},{enable:1,aspect_ratio:"1:1"}),o),silent_request:r,upload:i,max_select_items:a},{isMultiCallback:!0,successCallback:e=>{const t={data:null==e?void 0:e.result_content};return Promise.resolve(t)}})}))}static openOutApp(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.OPEN_OUTAPP,{url:e})}))}}class to{static getRouteParams(){let e={};const t=window.location.href;try{let i=new URL(t).searchParams.toString();i&&(e=bi.getParamsAsObject(i))}catch(e){throw new Error("Url không hợp lệ")}return e}static sendDataToPreviousMiniApp(e){return i(this,void 0,void 0,(function*(){return yield this.getJSBridge().callNative(di.WEBVIEW_SET_RESULT,{result:zi(e.data)})}))}static onCallbackData(e){return i(this,void 0,void 0,(function*(){yield this.events.on(exports.Events.OnDataCallback,(t=>{e({data:t})}))}))}}class io{constructor(){var e,t,i,r,a,s,c,l,d,u,p,h,v,f,g,m,y;An.set(this,zt),Tn.set(this,Jt),bn.set(this,Ft),wn.set(this,void 0),Nn.set(this,void 0),Cn.set(this,void 0),In.set(this,null),Pn.set(this,{timer:{getToken:0}}),kn.set(this,void 0),Rn.set(this,void 0),Dn.set(this,void 0),Bn.set(this,void 0),this.events=$i.getInstance(),this.isIOS=Ri().isIOS,jn.set(this,void 0),this.getActionBarConfig=()=>n(this,jn,"f"),this.setActionBarConfig=e=>{o(this,jn,e(n(this,jn,"f")),"f")},this.getVersion=Xi.getVersion,this.getSystemInfo=Xi.getSystemInfo,this.setNavigationBarTitle=en.setNavigationBarTitle,this.setNavigationBarColor=en.setNavigationBarColor,this.setNavigationBarLeftButton=en.setNavigationBarLeftButton,this.setBackgroundColor=tn.setBackgroundColor,this.setDeviceOrientation=rn.setDeviceOrientation,this.setStorage=Zn.setStorage,this.getStorage=Zn.getStorage,this.getStorageInfo=Zn.getStorageInfo,this.removeStorage=Zn.removeStorage,this.clearStorage=Zn.clearStorage,this.getUserInfo=qn.getUserInfo,this.getNetworkType=rn.getNetworkType,this.onNetworkStatusChange=rn.onNetworkStatusChange,this.startBeaconDiscovery=rn.startBeaconDiscovery,this.stopBeaconDiscovery=rn.stopBeaconDiscovery,this.getBeacons=rn.getBeacons,this.closeApp=Qn.closeApp,this.getLocation=Yn.getLocation,this.stopBluetoothDevicesDiscovery=rn.stopBluetoothDevicesDiscovery,this.startBluetoothDevicesDiscovery=rn.stopBluetoothDevicesDiscovery,this.openBluetoothAdapter=rn.openBluetoothAdapter,this.onBluetoothDeviceFound=rn.onBluetoothDeviceFound,this.onBluetoothAdapterStateChange=rn.onBluetoothAdapterStateChange,this.getConnectedBluetoothDevices=rn.getConnectedBluetoothDevices,this.getBluetoothDevices=rn.getBluetoothDevices,this.getBluetoothAdapterState=rn.getBluetoothAdapterState,this.closeBluetoothAdapter=rn.closeBluetoothAdapter,this.scanQRCode=rn.scanQRCode,this.openProfile=eo.openProfile,this.openChat=eo.openChat,this.openPostFeed=eo.openPostFeed,this.followOA=eo.followOA,this.unFollowOA=eo.unfollowOA,this.openShareSheet=eo.openShareSheet,this.requestCameraPermission=Xn.requestCameraPermission,this.createShortcut=eo.createShortcut,this.openBioAuthentication=rn.openBioAuthentication,this.checkStateBioAuthentication=rn.checkStateBioAuthentication,this.sendLocation=Yn.sendLocation,this.showToast=rn.showToast,this.hideKeyboard=rn.hideKeyboard,this.openPhone=rn.openPhone,this.openSMS=rn.openSMS,this.viewOAQr=eo.viewOAQr,this.keepScreen=rn.keepScreen,this.saveImageToPhotosAlbum=Xn.saveImageToPhotosAlbum,this.openMiniApp=Qn.openMiniApp,this.vibrate=rn.vibrate,this.openWebview=Qn.openWebview,this.getRouteParams=to.getRouteParams,this.getAppInfo=Xi.getAppInfo,this.sendDataToPreviousMiniApp=to.sendDataToPreviousMiniApp,this.onCallbackData=to.onCallbackData,this.getPhoneNumber=qn.getPhoneNumber,this.openProfilePicker=eo.openProfilePicker,xn.set(this,eo.getActionsSupported),this.connectWifi=rn.connectWifi,this.openMediaPicker=eo.openMediaPicker,this.openOutApp=eo.openOutApp,this.closeLoading=Qn.closeLoading,this.openAppStore=rn.openAppStore,o(this,wn,null,"f"),o(this,Nn,null,"f"),o(this,Cn,null,"f"),this.isShowNavBar=!0,o(this,Rn,0,"f"),o(this,Dn,0,"f"),o(this,Bn,"","f"),o(this,kn,Kn.getInstance(),"f");const _="home"===(null===(t=null===(e=n(this,bn,"f"))||void 0===e?void 0:e.app)||void 0===t?void 0:t.leftButton)||"both"===(null===(r=null===(i=n(this,bn,"f"))||void 0===i?void 0:i.app)||void 0===r?void 0:r.leftButton)?mi:yi,S=new URL(location.href),E=xt.isString(null===(s=null===(a=n(this,bn,"f"))||void 0===a?void 0:a.app)||void 0===s?void 0:s.headerColor)&&(null===(d=null===(l=null===(c=n(this,bn,"f"))||void 0===c?void 0:c.app)||void 0===l?void 0:l.headerColor)||void 0===d?void 0:d.length)>0?5:6,O="none"===(null===(p=null===(u=n(this,bn,"f"))||void 0===u?void 0:u.app)||void 0===p?void 0:p.leftButton)||"home"===(null===(v=null===(h=n(this,bn,"f"))||void 0===h?void 0:h.app)||void 0===v?void 0:v.leftButton)?gi:fi;o(this,jn,{actionbarType:E,buttonType:O,dataConfig:{backgroundColor:(null===(g=null===(f=n(this,bn,"f"))||void 0===f?void 0:f.app)||void 0===g?void 0:g.headerColor)||"",textColor:(null===(y=null===(m=n(this,bn,"f"))||void 0===m?void 0:m.app)||void 0===y?void 0:y.textColor)||"",viewInLeftType:O,confirmToExit:1},homeConfig:{enable:_,url:`https://h5.zdn.vn/zapps/${this.getAppId()}/${S.search}`}},"f")}static getInstance(){return io.instance||(io.instance=new io),io.instance}getLoginStatus(){return xt.isString(n(this,Cn,"f"))&&n(this,Cn,"f").length>0}getAppId(){return n(this,Tn,"f")}getZAppId(){return n(this,An,"f")}getDeviceId(){return n(this,Bn,"f")}getJSBridge(){return n(this,kn,"f")}login(e){return i(this,void 0,void 0,(function*(){const e=yield n(this,kn,"f").jump(),t=e.find((e=>e.name===$t));t&&o(this,Bn,t.value,"f");const i=e.find((e=>e.name===Kt)),r=e.find((e=>e.name===Ht));if(!xt.isUndefined(i)&&!xt.isNull(i)&&xt.isString(i.value)){if(o(this,wn,i.value,"f"),xt.isUndefined(r)||xt.isNull(r)||!xt.isString(r.value)?yield this.loginZaloV3():(o(this,Nn,r.value,"f"),yield this.loginZaloV4()),!n(this,Cn,"f"))throw Ti.loginFailed("Invalid authorization code");return n(this,Cn,"f")}throw Ti.loginFailed("Zalo app has not been activated")}))}loginZaloV3(){return i(this,void 0,void 0,(function*(){return yield fetch(`${qt}?app_id=${n(this,An,"f")}&redirect_uri=https://h5.zdn.vn/zapps/${n(this,Tn,"f")}/&code=${n(this,wn,"f")}&isSDK=true`).then((e=>i(this,void 0,void 0,(function*(){let t=yield e.json();if(t.access_token){o(this,Cn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Dn,e,"f"),o(this,Rn,(new Date).getTime(),"f"),n(this,kn,"f").accessTk=n(this,Cn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Cn,"f")||""),n(this,Cn,"f")}return null}))))}))}loginZaloV4(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;e.append("app_id",n(this,Tn,"f")),e.append("code",n(this,wn,"f")||""),e.append("code_verifier",n(this,Nn,"f")||""),xt.isNull(n(this,In,"f"))?e.append("grant_type","authorization_code"):(e.append("grant_type","refresh_token"),e.append("refresh_token",n(this,In,"f")||""));return yield fetch(Zt,Object.assign({method:"POST",body:e},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((e=>i(this,void 0,void 0,(function*(){const t=yield e.json();if(t.refresh_token&&o(this,In,t.refresh_token,"f"),t.access_token){o(this,Cn,t.access_token,"f");const e=1e3*parseInt(t.expires_in);return o(this,Dn,e,"f"),o(this,Rn,(new Date).getTime(),"f"),n(this,kn,"f").accessTk=n(this,Cn,"f")||"",window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(n(this,Cn,"f")||""),n(this,Cn,"f")}return null}))))}))}getAccessToken(e){return i(this,void 0,void 0,(function*(){const e=(new Date).getTime()-n(this,Rn,"f");if(!n(this,Cn,"f"))throw Ti.loginRequired();return e<n(this,Dn,"f")?n(this,Cn,"f"):yield this.login()}))}}An=new WeakMap,Tn=new WeakMap,bn=new WeakMap,wn=new WeakMap,Nn=new WeakMap,Cn=new WeakMap,In=new WeakMap,Pn=new WeakMap,kn=new WeakMap,Rn=new WeakMap,Dn=new WeakMap,Bn=new WeakMap,jn=new WeakMap,xn=new WeakMap;class no{constructor(){Un.set(this,zt),Mn.set(this,Ft),Ln.set(this,"DEFAULT ZOAUTH"),Wn.set(this,"DEFAULT ACCESS TOKEN"),zn.set(this,{timer:{getToken:0}}),Jn.set(this,!1),this.getLoginStatus=()=>n(this,Jn,"f"),this.getAppId=()=>n(this,Un,"f"),this.getDeviceId=()=>"",this.login=()=>(o(this,Jn,!0,"f"),Promise.resolve(n(this,Ln,"f"))),this.getAccessToken=()=>Promise.resolve(n(this,Wn,"f")),this.getVersion=Xi.getVersion,this.getSystemInfo=Xi.getSystemInfo,this.setNavigationBarTitle=()=>Promise.resolve(),this.setNavigationBarColor=()=>Promise.resolve(),this.setBackgroundColor=()=>Promise.resolve(),this.setNavigationBarLeftButton=()=>Promise.resolve(),this.setDeviceOrientation=()=>Promise.resolve(),this.setStorage=e=>i(this,void 0,void 0,(function*(){const t=new $n(this.getAppId());return yield t.putDataToStorage(e.data),{errorKeys:[]}})),this.getStorage=e=>i(this,void 0,void 0,(function*(){const t=new $n(this.getAppId());return yield t.getDataFromStorage(e.keys)})),this.getStorageInfo=e=>i(this,void 0,void 0,(function*(){const e=new $n(this.getAppId());return yield e.getStorageInfo()})),this.removeStorage=e=>i(this,void 0,void 0,(function*(){const t=new $n(this.getAppId());return yield t.removeDataFromStorage(e.keys)})),this.clearStorage=e=>i(this,void 0,void 0,(function*(){const e=new $n(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 e;switch((navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType){case"none":e=exports.NetworkType.none;break;case"4g":e=exports.NetworkType.wifi;break;case"3g":case"2g":e=exports.NetworkType.cellular;break;default:e=exports.NetworkType.unknown}const t={networkType:e};return Promise.resolve(t)},this.onNetworkStatusChange=e=>{const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=t.effectiveType;return t.addEventListener("change",(function(){let t;switch(i){case"none":t=exports.NetworkType.none;break;case"4g":t=exports.NetworkType.wifi;break;case"3g":case"2g":t=exports.NetworkType.cellular;break;default:t=exports.NetworkType.unknown}e({isConnected:!0,networkType:t})})),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),Promise.resolve()),this.getRouteParams=to.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(),this.openAppStore=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,o,r){return console.warn("This api only works on zalo app"),Promise.resolve({data:""})}}Un=new WeakMap,Mn=new WeakMap,Ln=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Jn=new WeakMap;const oo=Symbol("required"),ro=Symbol("checkType"),ao=(e,t)=>(i,n,o)=>{let r=Reflect.getOwnMetadata(oo,i,n)||[];r.push({parameterIndex:o,fields:e,option:t}),Reflect.defineMetadata(oo,r,i,n)},so=(e,t,i)=>(n,o,r)=>{let a=Reflect.getOwnMetadata(ro,n,o)||[];a.push({parameterIndex:r,type:e,properties:t,defaultValue:i}),Reflect.defineMetadata(ro,a,n,o)};function co(e,t){Reflect.getMetadataKeys(e).map((i=>{const n=Reflect.getMetadata(i,e);Reflect.defineMetadata(i,n,t)}))}const lo=(e,t={})=>i=>{var n;let o=Object.getOwnPropertyDescriptors(i.prototype);if(t.deep){let e=Object.getPrototypeOf(i);for(;e.prototype;){const t=Object.getOwnPropertyDescriptors(e.prototype);o=Object.assign(Object.assign({},t),o),e=Object.getPrototypeOf(e)}}for(const[r,a]of Object.entries(o)){const o="function"==typeof a.value&&"constructor"!=r;if(null===(n=t.exclude)||void 0===n?void 0:n.includes(r))continue;if(t.excludePrefix&&r.startsWith(t.excludePrefix))continue;if(!o)continue;const s=a.value;e(i,r,a),s!=a.value&&co(s,a.value),Object.defineProperty(i.prototype,r,a)}},uo=(e,t,i)=>{const n=i.value,o=function(e){return e.toString().match(/\(.*?\)/)[0].replace(/[()]/gi,"").replace(/\s/gi,"").split(",")}(n);return i.value=function(...i){try{const r=Reflect.getOwnMetadata(oo,e.prototype,t),a=Reflect.getOwnMetadata(ro,e.prototype,t);a&&a.forEach((e=>{const{parameterIndex:t,type:n,properties:r,defaultValue:a}=e;let s=i[t],c=o[t];const l=typeof s;if(!xt.isUndefined(s)){if(!xi(s,n))throw Ti.wrongTypeParam(c,n,Array.isArray(s)?"array":null===s?"null":l);"object"===n&&Object.entries(r).forEach((([e,n])=>{const o=e.split("?")[0],r=xt.get(s,o);if(xt.isUndefined(r)||xt.isNull(r)){if(!e.includes("?"))throw Ti.missingParam(e);xt.get(s,o.split(".")[0])||!a||xt.isUndefined(xt.get(a,o))||xt.set(i[t],o,xt.get(a,o))}else if(xt.isFunction(n)){const e=n(r);if(e&&e.error)throw Ti.wrongTypeParam(`${c}.${o}`,e.errorMessage,typeof r)}}))}})),r&&r.forEach((e=>{const{parameterIndex:t,option:n,fields:o}=e,r=i[t],a=null==n?void 0:n.if,s=null==n?void 0:n.defaultValue;let c=!0;a&&(c=Object.keys(a).every((e=>xt.get(r,e)===a[e]))),c&&o.forEach((e=>{const n=e=>{let n=!1;return xt.isEmpty(xt.get(r,e))&&(xt.isUndefined(xt.get(s,e))||xt.set(i[t],e,xt.get(s,e)),n=!0),n};if(Array.isArray(e)&&e.length>0&&e.every(n))throw Ti.missingParam(e.join(" or "));if(xt.isString(e)&&n(e))throw Ti.missingParam(e)}))}));const s=n.call(this,...i);if(xt.isPromise(s)){const{success:e,fail:n}=Array.isArray(i)&&i.length>0&&i[0];return new Promise(((i,o)=>{s.then((t=>{!xt.isNull(e)&&xt.isFunction(e)?e.call(null,t,this):i(s)})).catch((e=>{const i=Oi(e,t);!xt.isNull(n)&&xt.isFunction(n)?n.call(null,i,this):o(i)}))}))}return s}catch(e){throw Oi(e,t)}},i};var po,ho,vo,fo,go;exports.SDKCreator=class{constructor(){this.events=$i.getInstance(),po.set(this,void 0),o(this,po,this.getServiceInstance(),"f"),this.events.addListener=(e,t,i)=>{const n=e;return this.events.addListener(exports.Events[n],t,i)}}login(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").login(e)}))}getLoginStatus(){return n(this,po,"f").getLoginStatus()}getAccessToken(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getAccessToken(e)}))}getVersion(){return n(this,po,"f").getVersion()}getSystemInfo(){return n(this,po,"f").getSystemInfo()}setNavigationBarTitle(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").setNavigationBarTitle(e)}))}setNavigationBarColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").setNavigationBarColor(e)}))}setBackgroundColor(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").setBackgroundColor(e)}))}setNavigationBarLeftButton(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").setNavigationBarLeftButton(e.type)}))}setDeviceOrientation(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").setDeviceOrientation(e)}))}setStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").setStorage(e)}))}getStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getStorage(e)}))}getStorageInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getStorageInfo(e)}))}removeStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").removeStorage(e)}))}clearStorage(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").clearStorage(e)}))}getUserInfo(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getUserInfo(e)}))}getNetworkType(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getNetworkType(e)}))}onNetworkStatusChange(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").onNetworkStatusChange(e)}))}startBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").startBeaconDiscovery(e)}))}stopBeaconDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").stopBeaconDiscovery(e)}))}getBeacons(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getBeacons(e)}))}closeApp(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").closeApp(e)}))}getLocation(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getLocation(e)}))}stopBluetoothDevicesDiscovery(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").stopBluetoothDevicesDiscovery()}))}startBluetoothDevicesDiscovery(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").startBluetoothDevicesDiscovery(e)}))}openBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").openBluetoothAdapter()}))}onBluetoothDeviceFound(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").onBluetoothDeviceFound()}))}onBluetoothAdapterStateChange(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").onBluetoothAdapterStateChange()}))}getConnectedBluetoothDevices(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getConnectedBluetoothDevices(e)}))}getBluetoothDevices(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getBluetoothDevices()}))}getBluetoothAdapterState(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getBluetoothAdapterState()}))}closeBluetoothAdapter(){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").closeBluetoothAdapter()}))}scanQRCode(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").scanQRCode(e)}))}openProfile(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").openProfile(e)}))}openChat(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").openChat(e)}))}openPostFeed(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").openPostFeed(e)}))}followOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").followOA(e)}))}unfollowOA(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").unFollowOA(e)}))}openShareSheet(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").openShareSheet(e)}))}requestCameraPermission(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").requestCameraPermission(e)}))}createShortcut(e){return i(this,void 0,void 0,(function*(){const t=yield Gi(Jt,0),i=Ri().isIOS,o=t.logoUrl||Di("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",Jt),a.append("appName",r),a.append("appIcon",o);const e=`https://mini.zalo.me/shortcut.html?${a.toString()}`;yield n(this,po,"f").openOutApp(encodeURI(e))}else yield n(this,po,"f").createShortcut(`https://zalo.me/app/link/zapps/${Jt}/?${a.toString()}`,r,o);return Ai()}))}openBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").openBioAuthentication(e)}))}checkStateBioAuthentication(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").checkStateBioAuthentication(e)}))}sendLocation(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").sendLocation(e)}))}showToast(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").showToast(e)}))}hideKeyboard(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").hideKeyboard(e)}))}openPhone(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").openPhone(e)}))}openSMS(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").openSMS(e)}))}viewOAQr(e){return i(this,void 0,void 0,(function*(){yield n(this,po,"f").viewOAQr(e)}))}keepScreen(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").keepScreen(e)}))}saveImageToGallery(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").saveImageToPhotosAlbum(e)}))}saveImageToPhotosAlbum(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").saveImageToPhotosAlbum(e)}))}openMiniApp(e){return i(this,void 0,void 0,(function*(){if(!xt.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 n(this,po,"f").openMiniApp(e)}))}vibrate(e){return i(this,void 0,void 0,(function*(){console.log(e),yield n(this,po,"f").vibrate(e)}))}openWebview(e){return i(this,void 0,void 0,(function*(){const t=new URL(e.url),i=t.searchParams.get("typeInapp");xt.isEmpty(i)&&t.searchParams.set("typeInapp","1"),yield n(this,po,"f").openWebview(t.href)}))}getRouteParams(){return n(this,po,"f").getRouteParams()}getAppInfo(e){return n(this,po,"f").getAppInfo()}sendDataToPreviousMiniApp(e){return n(this,po,"f").sendDataToPreviousMiniApp(e)}onCallbackData(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").onCallbackData(e)}))}getPhoneNumber(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").getPhoneNumber()}))}openProfilePicker(e){return i(this,void 0,void 0,(function*(){const t=yield n(this,po,"f").openProfilePicker(e.maxProfile);let i;if(t.length>0)try{const e=yield this.getAccessToken(),n=yield fetch(Qt,{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,c,l,d,u,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===(l=null===(c=null===(s=null===(a=o.data[e])||void 0===a?void 0:a.user_info)||void 0===s?void 0:s.picture)||void 0===c?void 0:c.data)||void 0===l?void 0:l.url},code:0!==(null===(d=o.data[e])||void 0===d?void 0:d.error)?-1:0,message:`Get profile: ${xt.isUndefined(null===(u=o.data[e])||void 0===u?void 0:u.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 i(this,void 0,void 0,(function*(){return yield n(this,po,"f").connectWifi(e)}))}openMediaPicker(e){var t,o,r;return i(this,void 0,void 0,(function*(){const i={};xt.isUndefined(null===(t=e.editView)||void 0===t?void 0:t.enable)||(null===(o=e.editView)||void 0===o?void 0:o.enable)?i.enable=1:i.enable=0,i.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 n(this,po,"f").openMediaPicker(e.type,e.serverUploadUrl,e.maxItemSize,i,a,s)}))}getShareableLink(e){return i(this,void 0,void 0,(function*(){const t=yield this.getAccessToken();return(yield Fi(window.APP_ID,t||"",e.title,e.description,e.thumbnail,e.path)).shareableLink}))}closeLoading(e){return i(this,void 0,void 0,(function*(){return yield n(this,po,"f").closeLoading("user action")}))}requestUpdateZalo(e){return i(this,void 0,void 0,(function*(){const e=Ri().isIOS?"https://apps.apple.com/vn/app/zalo/id579523206":"https://play.google.com/store/apps/details?id=com.zing.zalo";return yield n(this,po,"f").openOutApp(e)}))}onConfirmToExit(e){this.events.on(exports.Events.AppClose,e,'{"handle_h5": 1}'),n(this,po,"f").setNavigationBarLeftButton(void 0,2)}offConfirmToExit(){this.events.off(exports.Events.AppClose),n(this,po,"f").setNavigationBarLeftButton(void 0,0)}getDeviceId(){return n(this,po,"f").getDeviceId()}},po=new WeakMap,e([t(0,so("object",{title:Ki("string")}))],exports.SDKCreator.prototype,"setNavigationBarTitle",null),e([t(0,so("object",{color:Ki("string"),"textColor?":Ki("string",{values:["white","black"]}),"statusBarColor?":Ki("string")}))],exports.SDKCreator.prototype,"setNavigationBarColor",null),e([t(0,so("object",{backgroundColor:Ki("string"),"textColor?":Ki("string",{values:["white","black"]})}))],exports.SDKCreator.prototype,"setBackgroundColor",null),e([t(0,so("object",{type:Ki("string",{values:["none","back","home","both"]})}))],exports.SDKCreator.prototype,"setNavigationBarLeftButton",null),e([t(0,so("object",{rotate:Ki("string",{values:["auto","portrait","landscape"]})}))],exports.SDKCreator.prototype,"setDeviceOrientation",null),e([t(0,so("object",{data:Ki("object")}))],exports.SDKCreator.prototype,"setStorage",null),e([t(0,so("object",{keys:Ki("array<string>")}))],exports.SDKCreator.prototype,"getStorage",null),e([t(0,so("object",{keys:Ki("array<string>")}))],exports.SDKCreator.prototype,"removeStorage",null),e([t(0,so("object",{"avatarType?":Ki("string",{values:["small","normal","large"]})}))],exports.SDKCreator.prototype,"getUserInfo",null),e([t(0,so("object",{type:Ki("string",{values:["user","oa","aliasOA"]}),id:Ki("string")}))],exports.SDKCreator.prototype,"openProfile",null),e([t(0,so("object",{type:Ki("string",{values:["user","oa"]}),id:Ki("string"),"message?":Ki("string")}))],exports.SDKCreator.prototype,"openChat",null),e([t(0,ao(["data.imageUrl"],{if:{type:"image"}})),t(0,ao(["data.link"],{if:{type:"link"}})),t(0,ao(["data.id"],{if:{type:"profile"}})),t(0,so("object",{type:Ki("string",{values:["image","link","profile"]}),data:Ki("object"),"data.imageUrl?":Ki("url"),"data.link?":Ki("url"),"data.title?":Ki("string"),"data.thumb?":Ki("url"),"data.description?":Ki("string"),"data.avatar?":Ki("url"),"data.id?":Ki("string"),"data.displayName?":Ki("string")}))],exports.SDKCreator.prototype,"openPostFeed",null),e([t(0,so("object",{id:Ki("string"),"showDialogConfirm?":Ki("boolean")}))],exports.SDKCreator.prototype,"followOA",null),e([t(0,so("object",{id:Ki("string")}))],exports.SDKCreator.prototype,"unfollowOA",null),e([t(0,ao([["data.imageUrl","data.imageUrls"]],{if:{type:"image"}})),t(0,ao(["data.link"],{if:{type:"link"}})),t(0,ao(["data.id"],{if:{type:"oa"}})),t(0,ao(["data.gifUrl"],{if:{type:"gif"}})),t(0,ao(["data.videoThumb","data.videoUrl"],{if:{type:"video"}})),t(0,ao(["data.thumbnail","data.title","data.description"],{if:{type:"zmp"},defaultValue:{data:{description:""}}})),t(0,so("object",{type:Ki("string",{values:["image","gif","video","link","oa","zmp"]}),data:Ki("object"),"data.imageUrl?":Ki("url"),"data.imageUrls?":Ki("array<url>",{maxLength:10}),"data.caption?":Ki("string"),"data.gifUrl?":Ki("url"),"data.width?":Ki("number"),"data.height?":Ki("number"),"data.videoThumb?":Ki("url"),"data.videoUrl?":Ki("url"),"data.link?":Ki("url"),"data.chatOnly?":Ki("boolean"),"data.id?":Ki("string"),"data.thumbnail?":Ki("url"),"data.path?":Ki("string"),"data.title?":Ki("string",{maxLength:100}),"data.description?":Ki(["string"],{maxLength:400})}))],exports.SDKCreator.prototype,"openShareSheet",null),e([t(0,so("object",{secretData:Ki("string"),"ui?":Ki("object"),"ui.title?":Ki("string"),"ui.subTitle?":Ki("string"),"ui.negativeButtonText?":Ki("string"),"requireFingerprint?":Ki("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"}}))],exports.SDKCreator.prototype,"openBioAuthentication",null),e([t(0,so("object",{toUserId:Ki("string"),"title?":Ki("string")}))],exports.SDKCreator.prototype,"sendLocation",null),e([t(0,so("object",{message:Ki("string")}))],exports.SDKCreator.prototype,"showToast",null),e([t(0,so("object",{phoneNumber:Ki("string")}))],exports.SDKCreator.prototype,"openPhone",null),e([t(0,so("object",{content:Ki("string"),phoneNumber:Ki("string",{regex:/^\+?\d+$/})}))],exports.SDKCreator.prototype,"openSMS",null),e([t(0,so("object",{id:Ki("string"),"displayName?":Ki("string")},{displayName:""}))],exports.SDKCreator.prototype,"viewOAQr",null),e([t(0,so("object",{"imageBase64Data?":Ki("string"),"imageUrl?":Ki("url")}))],exports.SDKCreator.prototype,"saveImageToGallery",null),e([t(0,so("object",{"imageBase64Data?":Ki("string"),"imageUrl?":Ki("url")}))],exports.SDKCreator.prototype,"saveImageToPhotosAlbum",null),e([t(0,so("object",{appId:Ki("string"),"params?":Ki("object")}))],exports.SDKCreator.prototype,"openMiniApp",null),e([t(0,so("object",{"type?":Ki("string",{values:["oneShot"]}),"milliseconds?":Ki("number")},{type:"oneShot",milliseconds:500}))],exports.SDKCreator.prototype,"vibrate",null),e([t(0,so("object",{url:Ki("url")}))],exports.SDKCreator.prototype,"openWebview",null),e([t(0,so("object",{"maxProfile?":Ki("number",{min:1,max:10})},{maxProfile:1}))],exports.SDKCreator.prototype,"openProfilePicker",null),e([t(0,ao(["SSID"])),t(0,so("object",{SSID:Ki("string"),"password?":Ki("string"),"hiddenSSID?":Ki("boolean")}))],exports.SDKCreator.prototype,"connectWifi",null),e([t(0,so("object",{type:Ki("string",{values:["photo","video","file"]}),serverUploadUrl:Ki("url"),"maxItemSize?":Ki("number",{min:0}),"editView?":Ki("object"),"editView.enable?":Ki("boolean"),"editView.aspectRatio?":Ki("string",{regex:/^\d+:\d+$/}),"silentRequest?":Ki("boolean"),"maxSelectItem?":Ki("number",{min:1})}))],exports.SDKCreator.prototype,"openMediaPicker",null),e([t(0,so("object",{title:Ki("string",{maxLength:100}),"thumbnail?":Ki("url"),"path?":Ki("string"),description:Ki(["string"],{maxLength:400})},{description:""}))],exports.SDKCreator.prototype,"getShareableLink",null),exports.SDKCreator=e([lo(uo)],exports.SDKCreator);class mo extends exports.SDKCreator{getServiceInstance(){return io.getInstance()}}class yo extends exports.SDKCreator{getServiceInstance(){return new no}}class _o{constructor(){ho.set(this,Jt)}static getInstance(){return _o.instance||(_o.instance=new _o),_o.instance}createOrder(e,t){return i(this,void 0,void 0,(function*(){const i=n(this,ho,"f"),o=new URLSearchParams;o.append("amount",t.amount.toString()),o.append("item",encodeURIComponent(JSON.stringify(t.item))),o.append("appId",i),t.desc&&o.append("desc",encodeURIComponent(t.desc)),t.extradata&&o.append("extradata",encodeURIComponent(JSON.stringify(t.extradata))),t.method&&o.append("method",t.method);const r={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}};try{const n=yield e.getAccessToken({fail:e=>{throw Ti.loginRequired}});r.headers.authorization=`Bearer ${n}`;const a=yield fetch(_i,Object.assign(Object.assign({method:"POST"},r),{body:o})),s=yield a.json();if(!s.data||0!==s.err)throw Ti.badRequest(s.msg);const c=s.data.id,l=s.data.jwt,d=window.APP_VERSION,u=window.APP_ENV,p={miniAppId:i,orderId:c};l&&(p.token=l),d&&(p.version=d),u&&(p.env=u),t.method&&(p.method=t.method);const h=bi.encode(p),v=new URL(`?${h}`,"https://payment-mini.zalo.me").toString();return yield e.openWebview({url:v,fail:e=>{throw e}}),{orderId:c}}catch(e){throw e}}))}checkTransaction(e,t){return i(this,void 0,void 0,(function*(){try{let i,{data:o}=t;if(o||(o=e.getRouteParams()),"object"==typeof o&&(i=o.appTransID||o.orderId||o.apptransid),"string"==typeof o){const e=bi.getParameterByName("orderId",o),t=bi.getParameterByName("appTransID",o)||bi.getParameterByName("apptransid",o);i=e||t}const r={headers:{authorization:"Bearer "}},a=yield e.getAccessToken({fail:e=>{throw Ti.loginRequired}});r.headers.authorization=`Bearer ${a}`;const s=new URL(Si),c={transId:i||"",appId:n(this,ho,"f")};s.search=new URLSearchParams(c).toString();const l=yield fetch(s.toString(),r),d=yield l.json();if(!d.data||0!==d.err)throw Ti.badRequest(d.msg);const u=d.data||{};return{msg:u.resultMessage,orderId:u.orderId,resultCode:u.resultCode,transTime:u.transTime,createdAt:u.createAt,transId:u.transId}}catch(e){throw e}}))}}ho=new WeakMap;class So{constructor(){vo.set(this,zt)}static getInstance(){return So.instance||(So.instance=new So),So.instance}createOrder(e,t){return Promise.resolve({orderId:""})}checkTransaction(e,t){const i={msg:"Success",orderId:"",resultCode:1,transTime:(new Date).getTime().toString(),createdAt:(new Date).getTime().toString(),transId:""};return Promise.resolve(i)}}vo=new WeakMap;let Eo=class{constructor(e){fo.set(this,void 0),go.set(this,void 0),o(this,fo,this.getInstance(),"f"),o(this,go,e,"f")}createOrder(e){return n(this,fo,"f").createOrder(n(this,go,"f"),e)}checkTransaction(e){return n(this,fo,"f").checkTransaction(n(this,go,"f"),e)}};fo=new WeakMap,go=new WeakMap,e([t(0,so("object",{amount:Ki(["string","number"]),desc:Ki("string"),"method?":Ki("string",{values:["MOMO","ZALOPAY","MOMO_SANDBOX","ZALOPAY_SANDBOX","CC","CC_SANDBOX","ATM","ATM_SANDBOX"]})}))],Eo.prototype,"createOrder",null),Eo=e([lo(uo)],Eo);class Oo extends Eo{getInstance(){return _o.getInstance()}}class Ao extends Eo{getInstance(){return So.getInstance()}}const To=Ri();exports.default=void 0,window.onJSCall=e=>function(t){Kn.getInstance().onJSCall(e,t)},window.onMultiJSCall=e=>function(t){Kn.getInstance().onMultiJSCall(e,t)},window.zaloJSV2={zalo_h5_event_handler:function(e,t,i){Kn.getInstance().nativeEventHandler(e,t,i)}},exports.Payment=void 0,To.isZalo?(exports.default=new mo,exports.Payment=new Oo(exports.default)):(exports.default=new yo,exports.Payment=new Ao(exports.default)),window.ZaloMiniAppSDK=exports.default,exports.default=exports.default;
|