"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.androidWeexBridge=exports.iosWeexBridge=exports.requireModule=void 0;var STATUS_NO_RESULT=0,STATUS_OK=1,STATUS_ERROR=2,WEEX_IOS_BIZ_SUCCESS_CODE="0";exports.requireModule=function(e){return"undefined"!=typeof __weex_require__?__weex_require__("@weex-module/"+e):"undefined"!=typeof weex?weex.requireModule(e):void 0},exports.iosWeexBridge=function(){return Promise.resolve(function(e,o){return new Promise(function(r,s){var n=exports.requireModule("nuvajs-exec"),t=e.split("."),i=t.pop(),u=t.join(".");n.exec({plugin:u,action:i,args:o},function(e){e&&e.errorCode===WEEX_IOS_BIZ_SUCCESS_CODE?("function"==typeof o.success?o.success(e.result):"function"==typeof o.onSuccess&&o.onSuccess(e.result),r(e.result)):("function"==typeof o.fail?o.fail(e.result):"function"==typeof o.onFail&&o.onFail(e.result),s(e.result))})})})},exports.androidWeexBridge=function(){return Promise.resolve(function(e,o){return new Promise(function(r,s){var n=exports.requireModule("nuvajs-exec"),t=e.split("."),i=t.pop(),u=t.join(".");n.exec({plugin:u,action:i,args:o},function(e){var n={};try{if(e&&e.__message__)if("object"==typeof e.__message__)n=e.__message__;else try{n=JSON.parse(e.__message__)}catch(o){"string"==typeof e.__message__&&(n=e.__message__)}}catch(e){}e&&parseInt(e.__status__+"",10)===STATUS_OK?("function"==typeof o.onSuccess&&o.onSuccess(n),r(n)):("function"==typeof o.onFail&&o.onFail(n),s(n))})})})};