function _typeof(e) { return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e })(e) } !function () { function t(e) { if (-1 === navigator.userAgent.indexOf("MAGAPP")) console.log("当前环境不支持"); else if (!window.MagAndroidClient) { if (window.WebViewJavascriptBridge) return e(window.WebViewJavascriptBridge); if (document.addEventListener("WebViewJavascriptBridgeReady", function () { e(window.WebViewJavascriptBridge) }, !1), window.WVJBCallbacks) return window.WVJBCallbacks.push(e); window.WVJBCallbacks = [e]; var c = document.createElement("iframe"); c.style.display = "none", c.src = "https://__bridge_loaded__", document.documentElement.appendChild(c), setTimeout(function () { document.documentElement.removeChild(c) }, 0) } } function a(c, e) { var s = null == e ? "" : "object" === _typeof(e) ? JSON.stringify(e) : e; window.MagAndroidClient && (window.MagAndroidClient[c] && "function" == typeof window.MagAndroidClient[c] ? window.MagAndroidClient[c](s) : console.warn("Android 不支持 " + c + " 方法")), t(function (e) { e.callHandler(c, s, function () { }) }) } function c(c) { window.MagAndroidClient && (window.MagAndroidClient[c] && "function" == typeof window.MagAndroidClient[c] ? window.MagAndroidClient[c]() : console.warn("Android 不支持 " + c + " 方法")), t(function (e) { e.callHandler(c, "", function () { }) }) } t(function (e) { e.init && "function" == typeof e.init && e.init(function () { }), e.registerHandler("jsCallBack", function (e) { var e = JSON.parse(e), c = e.id, e = e.val, c = n.callbacks[c]; c && (c.type && "json" == c.type && (e = e && JSON.parse(e)), c.success(e)) }) }); var n = { VERSION: "1.4.1", ready: function (e) { t(function () { e() }), window.MagAndroidClient && e() }, callbacks: {}, iosConnect: t, jsCallBack: function (e, c) { e = n.callbacks[e]; e && (e.type && "json" == e.type && (c = c && JSON.parse(c)), e.success(c)) }, getLocation: function (e) { e && (n.callbacks.getLocation = {type: "json", success: e}), c("getLocation") }, showLocation: function (e) { a("showLocation", e) }, mapPick: function (e) { e && (n.callbacks.mapPick = {type: "json", success: e}), c("mapPick") }, closeWin: function () { c("closeWin") }, previewImage: function (e) { a("previewImage", e) }, picPick: function (e) { e && "object" === _typeof(e) && (e.preview && (n.callbacks.picPickPreview = { type: "json", success: e.preview }), e.success && (n.callbacks.picPickSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.picPickFail = {type: "json", success: e.fail}), a("picPick", e) }, previewFile: function (e) { a("previewFile", e) }, filePick: function (e) { e && "object" === _typeof(e) && (e.preview && (n.callbacks.filePickPreview = { type: "json", success: e.preview }), e.success && (n.callbacks.filePickSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.filePickFail = {type: "json", success: e.fail}), a("filePick", e) }, camera: function (e) { e && "object" === _typeof(e) && (e.preview && (n.callbacks.cameraPreview = { type: "json", success: e.preview }), e.success && (n.callbacks.cameraSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.cameraFail = {type: "json", success: e.fail}), a("camera", e) }, recordIdentifyVideo: function (e) { e && "object" === _typeof(e) && (e.preview && (n.callbacks.identifyVideoPreview = { type: "json", success: e.preview }), e.success && (n.callbacks.identifyVideoSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.identifyVideoFail = {type: "json", success: e.fail}), a("recordIdentifyVideo", e) }, setData: function (e) { a("setData", e) }, setShareCallback: function (e) { e && "object" === _typeof(e) && (e.pageShareSuccess && (n.callbacks.pageShareSuccess = { type: "", success: e.pageShareSuccess }), e.pageShareFailed) && (n.callbacks.pageShareFailed = {type: "", success: e.pageShareFailed}) }, share: function (e, c, s) { c && (n.callbacks.shareSuccess = {type: "", success: c}), s && (n.callbacks.shareFailed = { type: "", success: s }), a("share", e) }, shareCard: function (e, c, s) { c && (n.callbacks.shareSuccess = {type: "", success: c}), s && (n.callbacks.shareFailed = { type: "", success: s }), a("shareCard", e) }, socialBind: function (e, c, s) { c && (n.callbacks.bindOnSuccess = {type: "json", success: c}), s && (n.callbacks.bindOnFail = { type: "json", success: s }), a("socialBind", e) }, report: function (e) { a("report", e) }, scanQR: function (e) { e && (n.callbacks.scanQR = {type: "", success: e}), c("scanQR") }, actionSheet: function (e, c) { c && (n.callbacks.actionSheet = {type: "json", success: c}), a("actionSheet", e) }, toast: function (e) { a("toast", e) }, dialog: function (e) { e && "object" === _typeof(e) && (e.success && (n.callbacks.dialogSuccess = { type: "json", success: e.success }), e.cancel) && (n.callbacks.dialogCancel = {type: "json", success: e.cancel}), a("dialog", e) }, progress: function () { c("progress") }, hideProgress: function () { c("hideProgress") }, setTitle: function (e) { a("setTitle", e) }, showNavigation: function () { c("showNavigation") }, hideNavigation: function () { c("hideNavigation") }, setNavigationColor: function (e) { a("setNavigationColor", e) }, emailBind: function (e) { e && (n.callbacks.emailBindSuccess = {type: "string", success: e}), c("emailBind") }, hideMore: function () { c("hideMore") }, showMore: function () { c("showMore") }, tel: function (e) { a("tel", e) }, sms: function (e, c) { a("sms", {phone: e, content: c}) }, toLogin: function (e) { e && (n.callbacks.loginSuccess = {type: "json", success: e}), c("toLogin") }, toUserHome: function (e) { a("toUserHome", e) }, addRedPacket: function (e) { a("addRedPacket", e) }, setNavigationBarStyle: function (e) { a("setNavigationBarStyle", e) }, showApplaud: function (e) { a("showApplaud", e) }, toUserHomeByName: function (e) { e && a("toUserHomeByName", e) }, commentBar: function (e) { e && "object" === _typeof(e) && (e.onComment && (n.callbacks.commentBar = { type: "json", success: e.onComment }), e.onCommentShow && (n.callbacks.onCommentShow = { type: "", success: e.onCommentShow }), e.onPageSelect && (n.callbacks.pageSelect = { type: "json", success: e.onPageSelect }), e.onApplaud && (n.callbacks.applaud = { type: "json", success: e.onApplaud }), e.has_reply_red_packet) && (n.callbacks.has_reply_red_packet = { type: "json", success: e.has_reply_red_packet }), a("commentBar", e) }, toComment: function (e) { e && "object" === _typeof(e) && e.success && (n.callbacks.comment = { type: "json", success: e.success }), a("toComment", e) }, newWin: function (e, c) { for (var s in e.indexOf("?") < 0 && (e += "?"), c) e += "&" + s + "=" + c[s]; a("newWin", e) }, setPageLife: function (e) { e && "object" === _typeof(e) && (e.pageAppear && (n.callbacks.pageAppear = { type: "", success: e.pageAppear }), e.pageDisappear) && (n.callbacks.pageDisappear = {type: "", success: e.pageDisappear}) }, followAuthorFromNative: function (e) { e && "object" === _typeof(e) && (n.callbacks.followAuthorFromNative = { type: "", success: e.followAuthorFromNative }) }, availableSharePlatform: function (e) { e && "object" === _typeof(e) && e.availableSharePlatform && (n.callbacks.availableSharePlatform = { type: "json", success: e.availableSharePlatform }), c("availableSharePlatform") }, pay: function (e, c, s) { c && (n.callbacks.payOnSuccess = {type: "", success: c}), s && (n.callbacks.payOnFail = { type: "", success: s }), a("pay", e) }, alipay: function (e, c, s) { e && (c && (n.callbacks.alipayOnSuccess = {type: "", success: c}, n.callbacks.alipaySuccess = { type: "", success: c }), s && (n.callbacks.alipayOnFail = {type: "", success: s}), a("alipay", e)) }, inAppPay: function (e, c, s) { c && (n.callbacks.inAppPaySuccess = {type: "", success: c}), s && (n.callbacks.inAppPayOnFail = { type: "", success: s }), a("inAppPay", e) }, deviceLogin: function (e) { e && (n.callbacks.loginSuccess = {type: "json", success: e}), c("deviceLogin") }, phoneBind: function (e) { e && (n.callbacks.phoneBindSuccess = {type: "string", success: e}), c("phoneBind") }, qqConnectLogin: function (e) { a("qqConnectLogin", e) }, bounceEnable: function (e) { a("bounceEnable", e) }, showNaviAuthor: function () { c("showNaviAuthor") }, hideNaviAuthor: function () { c("hideNaviAuthor") }, followAuthorFromWeb: function (e) { a("followAuthorFromWeb", e) }, addRefreshComponent: function () { c("addRefreshComponent") }, sappHome: function (e) { a("sappHome", e) }, chat: function (e) { a("chat", e) }, newExternalWin: function (e) { a("newExternalWin", e) }, getAppAuthKey: function (e) { e && (n.callbacks.getAppAuthKey = {type: "json", success: e}), c("getAppAuthKey") }, sendGift: function (e, c) { c && (n.callbacks.giftSendSuccess = {type: "json", success: c}), a("sendGift", e) }, showPhoneSettings: function () { c("showPhoneSettings") }, getNotificationStatus: function (e) { e && (n.callbacks.getNotificationStatus = {type: "string", success: e}), c("getNotificationStatus") }, downloadAttachment: function (e) { a("downloadAttachment", e) }, getNetworkState: function (e) { e && (n.callbacks.getNetworkState = {type: "string", success: e}), c("getNetworkState") }, getDeviceId: function (e) { e && (n.callbacks.getDeviceId = {type: "string", success: e}), c("getDeviceId") }, getNavigationHeight: function (e) { e && (n.callbacks.getNavigationHeight = {type: "json", success: e}), c("getNavigationHeight") }, showTaskVideoAd: function (e, c, s) { c && (n.callbacks.rewardOnEffective = {type: "", success: c}), s && (n.callbacks.rewardOnFailure = { type: "json", success: s }), a("showTaskVideoAd", e) }, showNativeVideoAd: function (e, c, s) { c && (n.callbacks.rewardOnEffective = {type: "", success: c}), s && (n.callbacks.rewardOnFailure = { type: "json", success: s }), a("showNativeVideoAd", e) }, getOaid: function (e) { e && (n.callbacks.getOaid = {type: "string", success: e}), c("getOaid") }, getAndroidVersion: function (e) { e && (n.callbacks.getAndroidVersion = {type: "string", success: e}), c("getAndroidVersion") }, getImei1: function (e) { e && (n.callbacks.getImei1 = {type: "string", success: e}), c("getImei1") }, rewardToast: function (e) { a("rewardToast", e) }, showCommentRewardDetail: function (e) { a("showCommentRewardDetail", e) }, addEmotionGroup: function (e) { e && "object" === _typeof(e) && (e.success && (n.callbacks.addEmotionGroupSuccess = { type: "", success: e.success }), e.fail) && (n.callbacks.addEmotionGroupFail = {type: "", success: e.fail}), a("addEmotionGroup", e) }, getEmotionGroupState: function (e) { e && "object" === _typeof(e) && e.success && (n.callbacks.getEmotionGroupState = { type: "", success: e.success }), a("getEmotionGroupState", e) }, recognizeUserFace: function (e) { e && "object" === _typeof(e) && (e.success && (n.callbacks.recognizeUserFaceSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.recognizeUserFaceFail = {type: "json", success: e.fail}), c("recognizeUserFace") }, verifyPhoneBind: function (e) { a("verifyPhoneBind", e) }, omiseCreditCardPayCallback: function (e) { a("omiseCreditCardPayCallback", e) }, alibcTradeLogin: function (e) { e && "object" === _typeof(e) && (e.success && (n.callbacks.alibcTradeLoginSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.alibcTradeLoginFail = {type: "json", success: e.fail}), c("alibcTradeLogin") }, alibcTradeLogout: function () { c("alibcTradeLogout") }, alibcTradeAuthorize: function (e) { e && "object" === _typeof(e) && (e.success && (n.callbacks.alibcTradeAuthorizeSuccess = { type: "json", success: e.success }), e.fail) && (n.callbacks.alibcTradeAuthorizeFail = {type: "json", success: e.fail}), c("alibcTradeAuthorize") }, setSkymapCallback: function (e) { e && "object" === _typeof(e) && (e.centerAndZoom && (n.callbacks.centerAndZoom = { type: "", success: e.centerAndZoom }), e.pageDisappear) && (n.callbacks.pageDisappear = {type: "", success: e.pageDisappear}) }, setSkymapLocation: function (e) { a("setSkymapLocation", e) }, switchTab: function (e) { a("switchTab", e = e || {index: 0}) }, impactFeedback: function () { a("impactFeedback") }, vibrate: function () { a("vibrate") }, startSpeeking: function (e) { e && "object" === _typeof(e) && (e.onNext && (n.callbacks.startSpeekingOnNext = { type: "json", success: e.onNext }), e.onPlayFinish && (n.callbacks.startSpeekingOnPlayFinish = { type: "json", success: e.onPlayFinish }), e.onStatus) && (n.callbacks.startSpeekingOnStatus = { type: "json", success: e.onStatus }), a("startSpeeking", e) }, stopSpeeking: function (e) { (e = "function" == typeof e ? {success: e} : e) && "object" === _typeof(e) && e.success && (n.callbacks.stopSpeakingOnSuccess = { type: "", success: e.success }), a("stopSpeeking", e) }, openChat: function (e) { e && "object" === _typeof(e) && (e.query && (n.callbacks.openChatOnQuery = { type: "json", success: e.query }), e.stop && (n.callbacks.openChatOnStop = { type: "json", success: e.stop }), e.close && (n.callbacks.openChatOnClose = { type: "json", success: e.close }), e.error) && (n.callbacks.openChatOnError = {type: "json", success: e.error}); var c = {}; a("openChat", c = "object" === _typeof(e.params) ? e.params : c) }, answerAI: function (e) { a("answerAI", e) }, startAsrRecord: function (e) { e && "object" === _typeof(e) && (e.success && (n.callbacks.startAsrRecordOnSuccess = { type: "json", success: e.success }), e.error && (n.callbacks.startAsrRecordOnError = { type: "json", success: e.error }), e.onVolume) && (n.callbacks.startAsrRecordOnVolume = {type: "", success: e.onVolume}), a("startAsrRecord", e) }, stopAsrRecord: function (e) { (e = "function" == typeof e ? {success: e} : e) && "object" === _typeof(e) && e.success && (n.callbacks.stopAsrRecordOnSuccess = { type: "", success: e.success }), a("stopAsrRecord", e) }, initChatSpeaking: function (e) { a("initChatSpeaking", e) }, startChatSpeaking: function (e) { e && "object" === _typeof(e) && e.onFinish && (n.callbacks.startChatSpeakingOnFinish = { type: "", success: e.onFinish }), a("startChatSpeaking", e) }, stopChatSpeaking: function (e) { (e = "function" == typeof e ? {success: e} : e) && "object" === _typeof(e) && e.success && (n.callbacks.stopChatSpeakingOnSuccess = { type: "", success: e.success }), a("stopChatSpeaking", e) } }; window.mag = n }();