"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports.default=setOptionMenu;var _invoker=_interopRequireWildcard(require("./invoker")),_getContainerType=_interopRequireDefault(require("./getContainerType"));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:t})(e)}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(t);if(n&&n.has(e))return n.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var u=r?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(i,o,u):i[o]=e[o]}return i.default=e,n&&n.set(e,i),i}function setOptionMenu(e){var t=(0,_getContainerType.default)();return _invoker.default.invoke("setOptionMenu",t===_invoker.Container_Type_Enum.isDingTalk?Object.assign({watch:!0,show:!0,control:!1,showIcon:!0,text:""},e):e,t===_invoker.Container_Type_Enum.isDingTalk?{dingTalkAPIName:"biz.navigation.setRight"}:null)}_invoker.default.registerAPI("setOptionMenu",{mobile:function(e,t){var n=t.resolve,i=t.reject,r=t.context,o=t.containerType,u=t.platformType;if(o){var l,a,s={text:e.title,show:void 0===e.show||e.show,control:void 0===e.control||e.control};if(u===_invoker.PLATFORM_TYPE_ENUM.ANDROID)r&&r((function(t){e.onSuccess&&e.onSuccess(t),n(t)}),(function t(n){e.onFail&&e.onFail(n),i(t)}),"biz.navigation",(null==e||null===(l=e.menus)||void 0===l?void 0:l.length)>1?"setMenu":"setRight",(null==e||null===(a=e.menus)||void 0===a?void 0:a.length)>1?e:s);else if(u===_invoker.PLATFORM_TYPE_ENUM.IOS){var c,p;r.callHandler((null==e||null===(c=e.menus)||void 0===c?void 0:c.length)>1?"biz.navigation.setMenu":"biz.navigation.setRight",Object.assign({},(null==e||null===(p=e.menus)||void 0===p?void 0:p.length)>1?e:s),(function(){n()}))}}else r&&r.call("setOptionMenu",e,(function(){n()}))}}),setOptionMenu.version={android:"1.1.0",ios:"1.1.0"},module.exports=exports.default,module.exports.default=exports.default;