import invoker,{PLATFORM_TYPE_ENUM,API_INVOKER_TYPE}from"./invoker";import getVersion from"./version";import compareVersion from"./utils/compareVersion";function openLinkHandler(n,o){var e=o.resolve,i=o.reject,r=o.context,p=o.containerType,s=o.appType,t=o.platformType;getVersion().then((function(o){var a=o.version,u=-1!==compareVersion(a,"1.6.2");if(p){var c=function(n){invoker.handleBridgeResponse(n,e,i)},m=function(n){invoker.handleBridgeResponse(n,e,i)};s===API_INVOKER_TYPE.MINI_APP?r&&r({m:u?"taurus.common.openLink":"taurus.common.pushWindow",args:n,onSuccess:c,onFail:m}):t===PLATFORM_TYPE_ENUM.ANDROID?r&&r(c,m,"taurus.common",u?"openLink":"pushWindow",n):t===PLATFORM_TYPE_ENUM.IOS&&r.callHandler(u?"taurus.common.openLink":"taurus.common.pushWindow",Object.assign({},n),(function(n){invoker.handleBridgeResponse(n,e,i)}))}else r&&r.call(u?"openLink":"pushWindow",n,(function(n){invoker.handleBridgeResponse(n,e,i)}))}))}invoker.registerAPI("openLink",{mini:openLinkHandler,mobile:openLinkHandler,pc:function(n,o){window.dingtalk.platform.invokeAPI(o.msgId,"biz.util.openLink",n)}}),openLink.version={android:"1.2.0",ios:"1.2.0",pc:"1.2.0"};export default function openLink(n){return invoker.invoke("openLink",n)}