!function (e) {
    var i = {}, t = {}, n = 0;
    var stateChange;
    e.rocNative = {
        // 参数说明 e:回传回来的移动端服务名称; t:前端自己传递的回调JS方法
        __nativeCall: function (e, t, n) {
            if (window[t]) {
                window[t](n)
            }
        },
        __callNative: function (t, a, o) {
            "function" == typeof o && (n++ , i[n] = o);
            var __funcName = a && a.__funcName ? a.__funcName : '__funcName__' + n
            a && a.__funcName && delete a.__funcName
            var param = a === undefined ? {} : a;
            var r = JSON.stringify({
                name: t,
                callbackId: __funcName,
                param: param
            });
            if (e.__rocAndroid) {
                e.__rocAndroid.postMessage(r);
                return true;
            }
            if (e.webkit && window.webkit.messageHandlers.rociOS) {
                window.webkit.messageHandlers.rociOS.postMessage(r)
                return true;
            }
            return false;
        }, __onEvent: function (e, i) {
            if (e && i && "function" == typeof i) {
                (t[e] || (t[e] = [])).push(i)
            }
        }, __clearEvent: function (e) {
            e && delete t[e]
        }, __fireEvent: function (e, i) {
            var n = t[e];
            n && n.forEach(function (e) {
                e(i)
            })
        }, on: function (e, i) {
            rocNative.__onEvent(e, i)
        }, off: function (e) {
            rocNative.__clearEvent(e)
        }
    }, function () {
        Array.prototype.slice.apply(arguments).forEach(function (i) {
            e.rocNative[i] = function (t) {
                return new Promise(function (n, a) {
                    e.rocNative.__callNative(i, t, function (e, i) {
                        null !== e ? a({ error: e, result: i }) : n(i)
                    }) ? void 0 : n({})
                })
            }
        })
    }("gotoLogin", "dispatchEventByModuleCode", "gotoAuthentication", "shareWechat", "backPreviousPage", "bindingWechat", "getDeviceInfo", "goBack", "appBuryingPointEntrust", "getAuthPermission", "getAppVersionCode", "getToken", "gotoNewActivity", "gotoNewActivityWithParams", "gotoNewWebActivity", "gotoYidianActivity", "readMessage", "openFiveMintusAudio", "getStatusBarSize", "showNativeDialog", "showNativeToast", "gotoViewTop", "appInit", "checkPermissions", "getStatusBarHeight", "setTabMiniIcon", "getUserInfo", "pauseAudioView", "sendBuriedPoint", "openErrorDebug", "upGradeVersion", "getLocalData", "getPositionData", "rocNative", "WXpay", "savePage2Picture");
    if (e.__rocAndroid) {
        e.__isAndroid = true
        e.__isIOS = false
        e.__isWeb = false
    } else if (e.webkit && window.webkit.messageHandlers.rociOS) {
        e.__isAndroid = false
        e.__isIOS = true
        e.__isWeb = false
    } else {
        e.__isAndroid = false
        e.__isIOS = false
        e.__isWeb = true
    }
    if (window.__isIOS) {
        rocNative.appInit()
    }
}(window);
