import invoker,{BRIDGE_ERROR_CODE,API_INVOKER_TYPE,PLATFORM_TYPE_ENUM}from"./invoker";function promptHandler(e,o){var n=o.resolve,r=o.reject,t=o.context,i=o.containerType,p=o.appType,a=o.platformType,s={message:e.message,title:e.title,okButton:e.buttonLabels[0],cancelButton:e.buttonLabels[1]};if(i){var l=function(e){invoker.handleBridgeResponse(e,n,r)},m=function(e){invoker.handleBridgeResponse(e,n,r)};p===API_INVOKER_TYPE.MINI_APP?t&&t({m:"taurus.common.prompt",args:s,onSuccess:l,onFail:m}):a===PLATFORM_TYPE_ENUM.ANDROID?t&&t(l,m,"taurus.common","prompt",s):a===PLATFORM_TYPE_ENUM.IOS&&t.callHandler("taurus.common.prompt",Object.assign({},s),(function(e){invoker.handleBridgeResponse(e,n,r)}))}else t&&t.call("prompt",s,(function(e){var o={errorCode:BRIDGE_ERROR_CODE.SUCCESS,result:{buttonIndex:e.ok?0:1,value:e.inputValue}};invoker.handleBridgeResponse(o,n,r)}))}invoker.registerAPI("prompt",{mini:promptHandler,mobile:promptHandler,pc:function(e,o){window.dingtalk.platform.invokeAPI(o.msgId,"device.notification.prompt",e)}}),prompt.version={android:"1.3.2",ios:"1.3.2",pc:"1.3.2"};export default function prompt(e){return invoker.invoke("prompt",e)}