(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2f460e6a","chunk-2d0e5dd1"],{"5ff2":function(e,t,n){"use strict";n.r(t);var o=n("95fe"),s=n("60bb"),r=n.n(s),a=n("1d2a");t["default"]={options:void 0,init(e){this.options=e},async upload({file:e,fileName:t,onProgress:n,onError:s,config:i}){const u=r.a.cloneDeep(this.options);r.a.merge(u,i),i=u;const c={file:e,onProgress:n,onError:s,...i};let d=i.buildKey(t,{file:e,...i.custom||{}});return d instanceof Promise&&(d=await d),null==u.data&&(u.data={}),u.data.key=d,a["a"].debug("upload option ",u),new Promise((e,t)=>{Object(o["default"])(c,async n=>{try{const t=await i.successHandle(n,c);t&&"object"===typeof t&&null==t.key&&(t.key=d),e(t)}catch(o){s(o),t(o)}},e=>{s(e),t(e)})})}}},"95fe":function(e,t,n){"use strict";function o(e,t,n){let o;o=n.response?""+(n.response.error||n.response):n.responseText?""+n.responseText:`fail to post ${e} ${n.status}`;const s=new Error(o);return s.status=n.status,s.method="post",s.url=e,s}function s(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(n){return t}}function r(e,t,n){if("undefined"===typeof XMLHttpRequest)return;const r=new XMLHttpRequest,a=e.action;r.upload&&(r.upload.onprogress=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress(t)});const i=new FormData;e.data&&Object.keys(e.data).forEach(t=>{i.append(t,e.data[t])}),i.append(e.name,e.file,e.file.name),r.onerror=function(e){n(e)},r.onload=function(){if(r.status<200||r.status>=300)return e.onError(o(a,e,r));t(s(r))},r.open("post",a,!0),e.withCredentials&&"withCredentials"in r&&(r.withCredentials=!0);const u=e.headers||{};for(const o in u)u.hasOwnProperty(o)&&null!==u[o]&&r.setRequestHeader(o,u[o]);return r.send(i),r}n.r(t),n.d(t,"default",(function(){return r}))}}]);