"use strict";exports.__esModule=!0,exports.default=void 0;var _invoker=_interopRequireWildcard(require("./invoker"));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 r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var TASK_COMPLETE=1;function downloadFile(e){return _invoker.default.invoke("downloadFile",e)}_invoker.default.registerAPI("downloadFile",{mini:function(e,t){var n=t.resolve,r=t.reject,i=t.containerType,o=t.context;if(i===_invoker.Container_Type_Enum.isDingTalk){o&&o({m:"taurus.common.downloadFile",args:e,onSuccess:function(e){_invoker.default.handleBridgeResponse(e,n,r)},onFail:function(e){_invoker.default.handleBridgeResponse(e,n,r)}})}else o&&o.call("downloadFile",e,(function(e){e.error?r(e):n(e)}))},pc:function(e,t){window.dingtalk.platform.invokeAPI(t.msgId,"biz.util.downloadFile",e),_invoker.default.registerContinuesEvent(t.msgId,(function(n,r){"im.fileTask.addNewTask"===n&&(_invoker.default.removeContinuesEvent(t.msgId),_invoker.default.registerContinuesEvent(r.taskId,(function(t,n){if("im.fileTask.updateTask"===t){var r=n.doneSize,i=n.fileName,o=n.filePath,a=n.fileSize,l=n.speed;e.onProgress({doneSize:r,fileName:i,filePath:o,fileSize:a,speed:l}),n.status===TASK_COMPLETE&&_invoker.default.removeContinuesEvent(n.taskId)}})))}))}}),downloadFile.version={pc:"1.3.5"};var _default=downloadFile;exports.default=_default,module.exports=exports.default,module.exports.default=exports.default;