import invoker,{BRIDGE_ERROR_CODE,PLATFORM_TYPE_ENUM,API_INVOKER_TYPE}from"./invoker";function toastHandler(e,o){var t=o.resolve,n=o.reject,r=o.context,a=o.containerType,i=o.platformType,s=o.appType,c={type:"error"===e.icon?"fail":"success"===e.icon?"success":"none",content:e.text,duration:1e3*e.duration,taurusToastStyle:e.taurusToastStyle};if(a){var u=function(){invoker.handleBridgeResponse({errorCode:BRIDGE_ERROR_CODE.SUCCESS,result:{}},t,n)},d=function(e){invoker.handleBridgeResponse(e,t,n)};s===API_INVOKER_TYPE.MINI_APP?r&&r({m:"taurus.common.toast",args:c,onSuccess:u,onFail:d}):i===PLATFORM_TYPE_ENUM.ANDROID?r&&r(u,d,"taurus.common","toast",c):i===PLATFORM_TYPE_ENUM.IOS&&r.callHandler("taurus.common.toast",Object.assign({},c),(function(){invoker.handleBridgeResponse({errorCode:BRIDGE_ERROR_CODE.SUCCESS,result:{}},t,n)}))}else r&&r.call("toast",c,(function(){invoker.handleBridgeResponse({errorCode:BRIDGE_ERROR_CODE.SUCCESS,result:{}},t,n)}))}invoker.registerAPI("toast",{mobile:toastHandler,mini:toastHandler,pc:function(e,o){var t=e.icon,n=e.text,r=e.duration,a=e.delay;window.dingtalk.platform.invokeAPI(o.msgId,"device.notification.toast",{type:t,text:n,duration:r,delay:a})}}),toast.version={android:"1.3.2",ios:"1.3.2"};export default function toast(e){return invoker.invoke("toast",e)}