import{s as Be}from"./utils.62547028.js";var V={exports:{}},fe=function(e,r){return function(){for(var n=new Array(arguments.length),u=0;u=0)return;a==="set-cookie"?r[a]=(r[a]?r[a]:[]).concat([n]):r[a]=r[a]?r[a]+", "+n:n}}),r},te=p,nt=te.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),a;function n(u){var s=u;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return a=n(window.location.href),function(s){var o=te.isString(s)?n(s):s;return o.protocol===a.protocol&&o.host===a.host}}():function(){return function(){return!0}}();function X(t){this.message=t}X.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};X.prototype.__CANCEL__=!0;var P=X,g=p,at=Ge,ut=Xe,st=pe,it=et,ot=rt,lt=nt,_=ve,ct=L,ft=P,re=function(e){return new Promise(function(a,n){var u=e.data,s=e.headers,o=e.responseType,l;function v(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}g.isFormData(u)&&delete s["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+d)}var S=it(e.baseURL,e.url);i.open(e.method.toUpperCase(),st(S,e.params,e.paramsSerializer),!0),i.timeout=e.timeout;function Q(){if(!!i){var m="getAllResponseHeaders"in i?ot(i.getAllResponseHeaders()):null,w=!o||o==="text"||o==="json"?i.responseText:i.response,y={data:w,status:i.status,statusText:i.statusText,headers:m,config:e,request:i};at(function(q){a(q),v()},function(q){n(q),v()},y),i=null}}if("onloadend"in i?i.onloadend=Q:i.onreadystatechange=function(){!i||i.readyState!==4||i.status===0&&!(i.responseURL&&i.responseURL.indexOf("file:")===0)||setTimeout(Q)},i.onabort=function(){!i||(n(_("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(_("Network Error",e,null,i)),i=null},i.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||ct.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),n(_(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",i)),i=null},g.isStandardBrowserEnv()){var Z=(e.withCredentials||lt(S))&&e.xsrfCookieName?ut.read(e.xsrfCookieName):void 0;Z&&(s[e.xsrfHeaderName]=Z)}"setRequestHeader"in i&&g.forEach(s,function(w,y){typeof u=="undefined"&&y.toLowerCase()==="content-type"?delete s[y]:i.setRequestHeader(y,w)}),g.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),o&&o!=="json"&&(i.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&i.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(m){!i||(n(!m||m&&m.type?new ft("canceled"):m),i.abort(),i=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),u||(u=null),i.send(u)})},f=p,ne=ze,dt=me,ht={"Content-Type":"application/x-www-form-urlencoded"};function ae(t,e){!f.isUndefined(t)&&f.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function pt(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=re),t}function mt(t,e,r){if(f.isString(t))try{return(e||JSON.parse)(t),f.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(r||JSON.stringify)(t)}var N={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:pt(),transformRequest:[function(e,r){return ne(r,"Accept"),ne(r,"Content-Type"),f.isFormData(e)||f.isArrayBuffer(e)||f.isBuffer(e)||f.isStream(e)||f.isFile(e)||f.isBlob(e)?e:f.isArrayBufferView(e)?e.buffer:f.isURLSearchParams(e)?(ae(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):f.isObject(e)||r&&r["Content-Type"]==="application/json"?(ae(r,"application/json"),mt(e)):e}],transformResponse:[function(e){var r=this.transitional||N.transitional,a=r&&r.silentJSONParsing,n=r&&r.forcedJSONParsing,u=!a&&this.responseType==="json";if(u||n&&f.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(u)throw s.name==="SyntaxError"?dt(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};f.forEach(["delete","get","head"],function(e){N.headers[e]={}});f.forEach(["post","put","patch"],function(e){N.headers[e]=f.merge(ht)});var L=N,vt=p,Et=L,yt=function(e,r,a){var n=this||Et;return vt.forEach(a,function(s){e=s.call(n,e,r)}),e},Ee=function(e){return!!(e&&e.__CANCEL__)},ue=p,H=yt,Ft=Ee,wt=L,bt=P;function M(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bt("canceled")}var Ct=function(e){M(e),e.headers=e.headers||{},e.data=H.call(e,e.data,e.headers,e.transformRequest),e.headers=ue.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ue.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var r=e.adapter||wt.adapter;return r(e).then(function(n){return M(e),n.data=H.call(e,n.data,n.headers,e.transformResponse),n},function(n){return Ft(n)||(M(e),n&&n.response&&(n.response.data=H.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})},h=p,ye=function(e,r){r=r||{};var a={};function n(i,c){return h.isPlainObject(i)&&h.isPlainObject(c)?h.merge(i,c):h.isPlainObject(c)?h.merge({},c):h.isArray(c)?c.slice():c}function u(i){if(h.isUndefined(r[i])){if(!h.isUndefined(e[i]))return n(void 0,e[i])}else return n(e[i],r[i])}function s(i){if(!h.isUndefined(r[i]))return n(void 0,r[i])}function o(i){if(h.isUndefined(r[i])){if(!h.isUndefined(e[i]))return n(void 0,e[i])}else return n(void 0,r[i])}function l(i){if(i in r)return n(e[i],r[i]);if(i in e)return n(void 0,e[i])}var v={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l};return h.forEach(Object.keys(e).concat(Object.keys(r)),function(c){var d=v[c]||u,S=d(c);h.isUndefined(S)&&d!==l||(a[c]=S)}),a},Fe={version:"0.23.0"},At=Fe.version,Y={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Y[t]=function(a){return typeof a===t||"a"+(e<1?"n ":" ")+t}});var se={};Y.transitional=function(e,r,a){function n(u,s){return"[Axios v"+At+"] Transitional option '"+u+"'"+s+(a?". "+a:"")}return function(u,s,o){if(e===!1)throw new Error(n(s," has been removed"+(r?" in "+r:"")));return r&&!se[s]&&(se[s]=!0,console.warn(n(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(u,s,o):!0}};function St(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var a=Object.keys(t),n=a.length;n-- >0;){var u=a[n],s=e[u];if(s){var o=t[u],l=o===void 0||s(o,u,t);if(l!==!0)throw new TypeError("option "+u+" must be "+l);continue}if(r!==!0)throw Error("Unknown option "+u)}}var Bt={assertOptions:St,validators:Y},we=p,xt=pe,ie=Ie,oe=Ct,j=ye,be=Bt,C=be.validators;function D(t){this.defaults=t,this.interceptors={request:new ie,response:new ie}}D.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=j(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&be.assertOptions(r,{silentJSONParsing:C.transitional(C.boolean),forcedJSONParsing:C.transitional(C.boolean),clarifyTimeoutError:C.transitional(C.boolean)},!1);var a=[],n=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(n=n&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});var u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});var s;if(!n){var o=[oe,void 0];for(Array.prototype.unshift.apply(o,a),o=o.concat(u),s=Promise.resolve(e);o.length;)s=s.then(o.shift(),o.shift());return s}for(var l=e;a.length;){var v=a.shift(),i=a.shift();try{l=v(l)}catch(c){i(c);break}}try{s=oe(l)}catch(c){return Promise.reject(c)}for(;u.length;)s=s.then(u.shift(),u.shift());return s};D.prototype.getUri=function(e){return e=j(this.defaults,e),xt(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};we.forEach(["delete","get","head","options"],function(e){D.prototype[e]=function(r,a){return this.request(j(a||{},{method:e,url:r,data:(a||{}).data}))}});we.forEach(["post","put","patch"],function(e){D.prototype[e]=function(r,a,n){return this.request(j(n||{},{method:e,url:r,data:a}))}});var Rt=D,Dt=P;function A(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var r=this;this.promise.then(function(a){if(!!r._listeners){var n,u=r._listeners.length;for(n=0;n{if(t&&(t==null?void 0:t.status)){const e=jt[t.status]||t.statusText,{status:r,url:a}=t;(t==null?void 0:t.status)===401?setTimeout(()=>{window.sessionStorage.clear(),window.location.href=`${window.location.origin}/login`},1e3):console.log(`\u8BF7\u6C42\u9519\u8BEF ${r}: ${a},${e}`)}return t},z=[];R.interceptors.request.use(t=>{const e=t;return e.cancelToken=new K.CancelToken(r=>{z.push(r)}),e},()=>{});window.$cancelRequest=()=>{z.forEach((t,e)=>{t("cancel"),delete z[e]})};const Ae=[{url:Nt.exportDetails,type:"export",export:1}];R.interceptors.request.use(t=>{var a;const e=Ae.find(n=>t.url.includes(n.url)),r=((a=t[t.method.toUpperCase()==="GET"?"params":"data"])==null?void 0:a.export)||0;return e&&r===1&&(t.responseType="blob"),t},t=>{console.log(t)});R.interceptors.response.use(async t=>{var n,u;const e=t.config,r=Ae.find(s=>e.url.includes(s.url)),a=((n=e[e.method.toUpperCase()==="GET"?"params":"data"])==null?void 0:n.export)||0;if(r&&a===1&&t.status===200){const s=new Blob([t.data],{type:"application/vnd.ms-excel"});let o=((u=e[e.method.toUpperCase()==="GET"?"params":"data"])==null?void 0:u.fileName)||new Date().Format("YYYY-MM-DD hh:mm:ss");const l=document.createElement("a");return l.download=o,l.style.display="none",l.href=URL.createObjectURL(s),document.body.appendChild(l),l.click(),URL.revokeObjectURL(l.href),document.body.removeChild(l),s}if(t.status===200)try{t.data.code&&t.data.code!==200&&(t.data.code===ce.loginFail&&setTimeout(()=>{window.sessionStorage.clear(),window.location.href=`${window.location.origin}/login`},1e3),t.data.code===ce.toast?alert(t.data.errorMsg):console.log(t.data.errorMsg))}catch{console.log("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25")}else qt(t);return t.data});K.defaults.withCredentials=!0;const B=(t,e)=>{let r=Be.get("token"),a=null;return t!=="FILE"?(t==="POST"||t==="PUT"?a={data:JSON.stringify(e.data)}:(t==="GET"||t==="DELETE")&&(a={params:e.data}),new Promise((n,u)=>{R(e.url,{method:t,...a,headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:r||"Basic aHc6aHc=","with-credentials":!0,...e.header}}).then(s=>{n(s)}).catch(s=>{console.log(s,"\u5F02\u5E38")})})):new Promise((n,u)=>{R(e.url,{method:"post",data:e.data,requestType:"form",headers:{Authorization:r||"Basic aHc6aHc="}}).then(s=>{n(s)}).catch(s=>{console.log(s,"\u5F02\u5E38")})})};var _t={post:t=>B("POST",t),get:t=>B("GET",t),delete:t=>B("DELETE",t),put:t=>B("PUT",t),file:t=>B("FILE",t)};export{K as a,Nt as b,_t as r};