w-ftp 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci-test.yml +3 -3
- package/README.md +1 -0
- package/babel.config.js +4 -3
- package/dist/w-ftp.umd.js +2 -2
- package/dist/w-ftp.umd.js.map +1 -1
- package/docs/WFtp.mjs.html +3 -3
- package/docs/global.html +2 -2
- package/docs/index.html +1 -1
- package/package.json +7 -6
- package/script.txt +0 -1
- package/src/CoreFTP.mjs +28 -6
- package/src/CoreSFTP.mjs +7 -7
- package/src/WFtp.mjs +2 -2
- package/test/api-ftp-flow.test.mjs +126 -0
- package/test/api-ftp-stall-exit.test.mjs +49 -0
- package/test/api-ftp-stall.test.mjs +54 -0
- package/test/api-sftp-flow.test.mjs +92 -0
- package/test/lib/clientQuitFlow.mjs +32 -0
- package/test/lib/fakeFtpServer.mjs +275 -0
- package/test/lib/fakeSftpServer.mjs +202 -0
- package/test/unit-sep-tree-folders.test.mjs +18 -0
- package/test/all.test.mjs +0 -10
|
@@ -9,12 +9,12 @@ jobs:
|
|
|
9
9
|
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
node-version: [
|
|
12
|
+
node-version: [24.x]
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
16
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
17
|
-
uses: actions/setup-node@
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
18
|
with:
|
|
19
19
|
node-version: ${{ matrix.node-version }}
|
|
20
20
|
- run: npm cache clean -f
|
package/README.md
CHANGED
package/babel.config.js
CHANGED
|
@@ -7,9 +7,10 @@ module.exports = {
|
|
|
7
7
|
],
|
|
8
8
|
'plugins': [
|
|
9
9
|
'@babel/plugin-transform-runtime',
|
|
10
|
-
'@babel/plugin-syntax-import-assertions',
|
|
11
10
|
'@babel/plugin-proposal-export-default-from',
|
|
12
|
-
'@babel/plugin-
|
|
13
|
-
'@babel/plugin-proposal-
|
|
11
|
+
// '@babel/plugin-syntax-import-assertions', //已被棄用
|
|
12
|
+
// '@babel/plugin-proposal-nullish-coalescing-operator', //browser與nodejs已支援
|
|
13
|
+
// '@babel/plugin-proposal-object-rest-spread', //browser與nodejs已支援
|
|
14
|
+
// '@babel/plugin-proposal-optional-chaining', //browser與nodejs已支援
|
|
14
15
|
]
|
|
15
16
|
}
|
package/dist/w-ftp.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* w-ftp v1.0.
|
|
2
|
+
* w-ftp v1.0.18
|
|
3
3
|
* (c) 2018-2021 yuda-lyu(semisphere)
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("fs"),require("net"),require("events"),require("util"),require("stream"),require("stream-combiner"),require("ftp-response-parser"),require("parse-listing"),require("once"),require("unorm"),require("debug"),require("ssh2-sftp-client")):"function"==typeof define&&define.amd?define(["path","fs","net","events","util","stream","stream-combiner","ftp-response-parser","parse-listing","once","unorm","debug","ssh2-sftp-client"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-ftp"]=e(t.path,t.fs,t.net,t.events,t.util,t.stream,t["stream-combiner"],t["ftp-response-parser"],t["parse-listing"],t.once,t.unorm,t.debug,t["ssh2-sftp-client"])}(this,(function(t,e,r,n,i,o,u,s,a,c,f,l,p){"use strict";var h=Array.isArray,d="object"==typeof global&&global&&global.Object===Object&&global,y="object"==typeof self&&self&&self.Object===Object&&self,v=d||y||Function("return this")(),m=v.Symbol,g=Object.prototype,b=g.hasOwnProperty,j=g.toString,w=m?m.toStringTag:void 0;var _=Object.prototype.toString;var O="[object Null]",$="[object Undefined]",S=m?m.toStringTag:void 0;function k(t){return null==t?void 0===t?$:O:S&&S in Object(t)?function(t){var e=b.call(t,w),r=t[w];try{t[w]=void 0;var n=!0}catch(t){}var i=j.call(t);return n&&(e?t[w]=r:delete t[w]),i}(t):function(t){return _.call(t)}(t)}function P(t){return null!=t&&"object"==typeof t}var T="[object Symbol]";function x(t){return"symbol"==typeof t||P(t)&&k(t)==T}var D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/;function F(t,e){if(h(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!x(t))||(M.test(t)||!D.test(t)||null!=e&&t in Object(e))}function z(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var L="[object AsyncFunction]",E="[object Function]",A="[object GeneratorFunction]",R="[object Proxy]";function Y(t){if(!z(t))return!1;var e=k(t);return e==E||e==A||e==L||e==R}var C,I=v["__core-js_shared__"],H=(C=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var U=Function.prototype.toString;function q(t){if(null!=t){try{return U.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var N=/^\[object .+?Constructor\]$/,W=Function.prototype,B=Object.prototype,Q=W.toString,V=B.hasOwnProperty,Z=RegExp("^"+Q.call(V).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(t){return!(!z(t)||(e=t,H&&H in e))&&(Y(t)?Z:N).test(q(t));var e}function J(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return G(r)?r:void 0}var K=J(Object,"create");var X=Object.prototype.hasOwnProperty;var tt=Object.prototype.hasOwnProperty;function et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t,e){return t===e||t!=t&&e!=e}function nt(t,e){for(var r=t.length;r--;)if(rt(t[r][0],e))return r;return-1}et.prototype.clear=function(){this.__data__=K?K(null):{},this.size=0},et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},et.prototype.get=function(t){var e=this.__data__;if(K){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return X.call(e,t)?e[t]:void 0},et.prototype.has=function(t){var e=this.__data__;return K?void 0!==e[t]:tt.call(e,t)},et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=K&&void 0===e?"__lodash_hash_undefined__":e,this};var it=Array.prototype.splice;function ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ot.prototype.clear=function(){this.__data__=[],this.size=0},ot.prototype.delete=function(t){var e=this.__data__,r=nt(e,t);return!(r<0)&&(r==e.length-1?e.pop():it.call(e,r,1),--this.size,!0)},ot.prototype.get=function(t){var e=this.__data__,r=nt(e,t);return r<0?void 0:e[r][1]},ot.prototype.has=function(t){return nt(this.__data__,t)>-1},ot.prototype.set=function(t,e){var r=this.__data__,n=nt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var ut=J(v,"Map");function st(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function at(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}at.prototype.clear=function(){this.size=0,this.__data__={hash:new et,map:new(ut||ot),string:new et}},at.prototype.delete=function(t){var e=st(this,t).delete(t);return this.size-=e?1:0,e},at.prototype.get=function(t){return st(this,t).get(t)},at.prototype.has=function(t){return st(this,t).has(t)},at.prototype.set=function(t,e){var r=st(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};var ct="Expected a function";function ft(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(ct);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var u=t.apply(this,n);return r.cache=o.set(i,u)||o,u};return r.cache=new(ft.Cache||at),r}ft.Cache=at;var lt,pt,ht,dt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yt=/\\(\\)?/g,vt=(lt=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(dt,(function(t,r,n,i){e.push(n?i.replace(yt,"$1"):r||t)})),e},pt=ft(lt,(function(t){return 500===ht.size&&ht.clear(),t})),ht=pt.cache,pt),mt=vt;function gt(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var bt=1/0,jt=m?m.prototype:void 0,wt=jt?jt.toString:void 0;function _t(t){if("string"==typeof t)return t;if(h(t))return gt(t,_t)+"";if(x(t))return wt?wt.call(t):"";var e=t+"";return"0"==e&&1/t==-bt?"-0":e}function Ot(t){return null==t?"":_t(t)}function $t(t,e){return h(t)?t:F(t,e)?[t]:mt(Ot(t))}var St=1/0;function kt(t){if("string"==typeof t||x(t))return t;var e=t+"";return"0"==e&&1/t==-St?"-0":e}function Pt(t,e){for(var r=0,n=(e=$t(e,t)).length;null!=t&&r<n;)t=t[kt(e[r++])];return r&&r==n?t:void 0}function Tt(t,e,r){var n=null==t?void 0:Pt(t,e);return void 0===n?r:n}function xt(t){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(t)}function Dt(t){var e=function(t,e){if("object"!==xt(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===xt(e)?e:String(e)}function Mt(t,e,r){return(e=Dt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ft(t){var e=this.__data__=new ot(t);this.size=e.size}Ft.prototype.clear=function(){this.__data__=new ot,this.size=0},Ft.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Ft.prototype.get=function(t){return this.__data__.get(t)},Ft.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.set=function(t,e){var r=this.__data__;if(r instanceof ot){var n=r.__data__;if(!ut||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new at(n)}return r.set(t,e),this.size=r.size,this};function zt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new at;++e<r;)this.add(t[e])}function Lt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function Et(t,e){return t.has(e)}zt.prototype.add=zt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},zt.prototype.has=function(t){return this.__data__.has(t)};var At=1,Rt=2;function Yt(t,e,r,n,i,o){var u=r&At,s=t.length,a=e.length;if(s!=a&&!(u&&a>s))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,p=!0,h=r&Rt?new zt:void 0;for(o.set(t,e),o.set(e,t);++l<s;){var d=t[l],y=e[l];if(n)var v=u?n(y,d,l,e,t,o):n(d,y,l,t,e,o);if(void 0!==v){if(v)continue;p=!1;break}if(h){if(!Lt(e,(function(t,e){if(!Et(h,e)&&(d===t||i(d,t,r,n,o)))return h.push(e)}))){p=!1;break}}else if(d!==y&&!i(d,y,r,n,o)){p=!1;break}}return o.delete(t),o.delete(e),p}var Ct=v.Uint8Array;function It(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function Ht(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var Ut=1,qt=2,Nt="[object Boolean]",Wt="[object Date]",Bt="[object Error]",Qt="[object Map]",Vt="[object Number]",Zt="[object RegExp]",Gt="[object Set]",Jt="[object String]",Kt="[object Symbol]",Xt="[object ArrayBuffer]",te="[object DataView]",ee=m?m.prototype:void 0,re=ee?ee.valueOf:void 0;function ne(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var u=t[r];e(u,r,t)&&(o[i++]=u)}return o}var ie=Object.prototype.propertyIsEnumerable,oe=Object.getOwnPropertySymbols,ue=oe?function(t){return null==t?[]:(t=Object(t),ne(oe(t),(function(e){return ie.call(t,e)})))}:function(){return[]};function se(t){return P(t)&&"[object Arguments]"==k(t)}var ae=Object.prototype,ce=ae.hasOwnProperty,fe=ae.propertyIsEnumerable,le=se(function(){return arguments}())?se:function(t){return P(t)&&ce.call(t,"callee")&&!fe.call(t,"callee")},pe=le;var he="object"==typeof exports&&exports&&!exports.nodeType&&exports,de=he&&"object"==typeof module&&module&&!module.nodeType&&module,ye=de&&de.exports===he?v.Buffer:void 0,ve=(ye?ye.isBuffer:void 0)||function(){return!1},me=9007199254740991,ge=/^(?:0|[1-9]\d*)$/;function be(t,e){var r=typeof t;return!!(e=null==e?me:e)&&("number"==r||"symbol"!=r&&ge.test(t))&&t>-1&&t%1==0&&t<e}var je=9007199254740991;function we(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=je}var _e={};_e["[object Float32Array]"]=_e["[object Float64Array]"]=_e["[object Int8Array]"]=_e["[object Int16Array]"]=_e["[object Int32Array]"]=_e["[object Uint8Array]"]=_e["[object Uint8ClampedArray]"]=_e["[object Uint16Array]"]=_e["[object Uint32Array]"]=!0,_e["[object Arguments]"]=_e["[object Array]"]=_e["[object ArrayBuffer]"]=_e["[object Boolean]"]=_e["[object DataView]"]=_e["[object Date]"]=_e["[object Error]"]=_e["[object Function]"]=_e["[object Map]"]=_e["[object Number]"]=_e["[object Object]"]=_e["[object RegExp]"]=_e["[object Set]"]=_e["[object String]"]=_e["[object WeakMap]"]=!1;var Oe="object"==typeof exports&&exports&&!exports.nodeType&&exports,$e=Oe&&"object"==typeof module&&module&&!module.nodeType&&module,Se=$e&&$e.exports===Oe&&d.process,ke=function(){try{var t=$e&&$e.require&&$e.require("util").types;return t||Se&&Se.binding&&Se.binding("util")}catch(t){}}(),Pe=ke&&ke.isTypedArray,Te=Pe?function(t){return function(e){return t(e)}}(Pe):function(t){return P(t)&&we(t.length)&&!!_e[k(t)]},xe=Te,De=Object.prototype.hasOwnProperty;function Me(t,e){var r=h(t),n=!r&&pe(t),i=!r&&!n&&ve(t),o=!r&&!n&&!i&&xe(t),u=r||n||i||o,s=u?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],a=s.length;for(var c in t)!e&&!De.call(t,c)||u&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||be(c,a))||s.push(c);return s}var Fe=Object.prototype;var ze=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Le=ze,Ee=Object.prototype.hasOwnProperty;function Ae(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||Fe))return Le(t);var e,r,n=[];for(var i in Object(t))Ee.call(t,i)&&"constructor"!=i&&n.push(i);return n}function Re(t){return null!=t&&we(t.length)&&!Y(t)}function Ye(t){return Re(t)?Me(t):Ae(t)}function Ce(t){return function(t,e,r){var n=e(t);return h(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Ye,ue)}var Ie=1,He=Object.prototype.hasOwnProperty;var Ue=J(v,"DataView"),qe=J(v,"Promise"),Ne=J(v,"Set"),We=J(v,"WeakMap"),Be="[object Map]",Qe="[object Promise]",Ve="[object Set]",Ze="[object WeakMap]",Ge="[object DataView]",Je=q(Ue),Ke=q(ut),Xe=q(qe),tr=q(Ne),er=q(We),rr=k;(Ue&&rr(new Ue(new ArrayBuffer(1)))!=Ge||ut&&rr(new ut)!=Be||qe&&rr(qe.resolve())!=Qe||Ne&&rr(new Ne)!=Ve||We&&rr(new We)!=Ze)&&(rr=function(t){var e=k(t),r="[object Object]"==e?t.constructor:void 0,n=r?q(r):"";if(n)switch(n){case Je:return Ge;case Ke:return Be;case Xe:return Qe;case tr:return Ve;case er:return Ze}return e});var nr=rr,ir=1,or="[object Arguments]",ur="[object Array]",sr="[object Object]",ar=Object.prototype.hasOwnProperty;function cr(t,e,r,n,i,o){var u=h(t),s=h(e),a=u?ur:nr(t),c=s?ur:nr(e),f=(a=a==or?sr:a)==sr,l=(c=c==or?sr:c)==sr,p=a==c;if(p&&ve(t)){if(!ve(e))return!1;u=!0,f=!1}if(p&&!f)return o||(o=new Ft),u||xe(t)?Yt(t,e,r,n,i,o):function(t,e,r,n,i,o,u){switch(r){case te:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Xt:return!(t.byteLength!=e.byteLength||!o(new Ct(t),new Ct(e)));case Nt:case Wt:case Vt:return rt(+t,+e);case Bt:return t.name==e.name&&t.message==e.message;case Zt:case Jt:return t==e+"";case Qt:var s=It;case Gt:var a=n&Ut;if(s||(s=Ht),t.size!=e.size&&!a)return!1;var c=u.get(t);if(c)return c==e;n|=qt,u.set(t,e);var f=Yt(s(t),s(e),n,i,o,u);return u.delete(t),f;case Kt:if(re)return re.call(t)==re.call(e)}return!1}(t,e,a,r,n,i,o);if(!(r&ir)){var d=f&&ar.call(t,"__wrapped__"),y=l&&ar.call(e,"__wrapped__");if(d||y){var v=d?t.value():t,m=y?e.value():e;return o||(o=new Ft),i(v,m,r,n,o)}}return!!p&&(o||(o=new Ft),function(t,e,r,n,i,o){var u=r&Ie,s=Ce(t),a=s.length;if(a!=Ce(e).length&&!u)return!1;for(var c=a;c--;){var f=s[c];if(!(u?f in e:He.call(e,f)))return!1}var l=o.get(t),p=o.get(e);if(l&&p)return l==e&&p==t;var h=!0;o.set(t,e),o.set(e,t);for(var d=u;++c<a;){var y=t[f=s[c]],v=e[f];if(n)var m=u?n(v,y,f,e,t,o):n(y,v,f,t,e,o);if(!(void 0===m?y===v||i(y,v,r,n,o):m)){h=!1;break}d||(d="constructor"==f)}if(h&&!d){var g=t.constructor,b=e.constructor;g==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof b&&b instanceof b||(h=!1)}return o.delete(t),o.delete(e),h}(t,e,r,n,i,o))}function fr(t,e,r,n,i){return t===e||(null==t||null==e||!P(t)&&!P(e)?t!=t&&e!=e:cr(t,e,r,n,fr,i))}var lr=1,pr=2;function hr(t){return t==t&&!z(t)}function dr(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function yr(t){var e=function(t){for(var e=Ye(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,hr(i)]}return e}(t);return 1==e.length&&e[0][2]?dr(e[0][0],e[0][1]):function(r){return r===t||function(t,e,r,n){var i=r.length,o=i,u=!n;if(null==t)return!o;for(t=Object(t);i--;){var s=r[i];if(u&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var a=(s=r[i])[0],c=t[a],f=s[1];if(u&&s[2]){if(void 0===c&&!(a in t))return!1}else{var l=new Ft;if(n)var p=n(c,f,a,t,e,l);if(!(void 0===p?fr(f,c,lr|pr,n,l):p))return!1}}return!0}(r,t,e)}}function vr(t,e){return null!=t&&e in Object(t)}function mr(t,e){return null!=t&&function(t,e,r){for(var n=-1,i=(e=$t(e,t)).length,o=!1;++n<i;){var u=kt(e[n]);if(!(o=null!=t&&r(t,u)))break;t=t[u]}return o||++n!=i?o:!!(i=null==t?0:t.length)&&we(i)&&be(u,i)&&(h(t)||pe(t))}(t,e,vr)}var gr=1,br=2;function jr(t){return t}function wr(t){return function(e){return null==e?void 0:e[t]}}function _r(t){return F(t)?wr(kt(t)):function(t){return function(e){return Pt(e,t)}}(t)}function Or(t){return"function"==typeof t?t:null==t?jr:"object"==typeof t?h(t)?function(t,e){return F(t)&&hr(e)?dr(kt(t),e):function(r){var n=Tt(r,t);return void 0===n&&n===e?mr(r,t):fr(e,n,gr|br)}}(t[0],t[1]):yr(t):_r(t)}var $r,Sr=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),u=o.length;u--;){var s=o[$r?u:++n];if(!1===e(i[s],s,i))break}return t};var kr=function(t,e){return function(r,n){if(null==r)return r;if(!Re(r))return t(r,n);for(var i=r.length,o=e?i:-1,u=Object(r);(e?o--:++o<i)&&!1!==n(u[o],o,u););return r}}((function(t,e){return t&&Sr(t,e,Ye)})),Pr=kr;function Tr(t,e){var r=-1,n=Re(t)?Array(t.length):[];return Pr(t,(function(t,i,o){n[++r]=e(t,i,o)})),n}function xr(t,e){return(h(t)?gt:Tr)(t,Or(e))}function Dr(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function Mr(t,e){var r;return(h(t)?Dr:Pr)(t,"function"==typeof(r=e)?r:jr)}var Fr="[object String]";var zr=wr("length"),Lr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function Er(t){return Lr.test(t)}var Ar="\\ud800-\\udfff",Rr="["+Ar+"]",Yr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Cr="\\ud83c[\\udffb-\\udfff]",Ir="[^"+Ar+"]",Hr="(?:\\ud83c[\\udde6-\\uddff]){2}",Ur="[\\ud800-\\udbff][\\udc00-\\udfff]",qr="(?:"+Yr+"|"+Cr+")"+"?",Nr="[\\ufe0e\\ufe0f]?",Wr=Nr+qr+("(?:\\u200d(?:"+[Ir,Hr,Ur].join("|")+")"+Nr+qr+")*"),Br="(?:"+[Ir+Yr+"?",Yr,Hr,Ur,Rr].join("|")+")",Qr=RegExp(Cr+"(?="+Cr+")|"+Br+Wr,"g");function Vr(t){return Er(t)?function(t){for(var e=Qr.lastIndex=0;Qr.test(t);)++e;return e}(t):zr(t)}var Zr="[object Map]",Gr="[object Set]";function Jr(t){if(null==t)return 0;if(Re(t))return"string"==typeof(e=t)||!h(e)&&P(e)&&k(e)==Fr?Vr(t):t.length;var e,r=nr(t);return r==Zr||r==Gr?t.size:Ae(t).length}function Kr(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}function Xr(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var tn=/\s/;var en=/^\s+/;function rn(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&tn.test(t.charAt(e)););return e}(t)+1).replace(en,""):t}var nn=NaN,on=/^[-+]0x[0-9a-f]+$/i,un=/^0b[01]+$/i,sn=/^0o[0-7]+$/i,an=parseInt;function cn(t){if("number"==typeof t)return t;if(x(t))return nn;if(z(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=z(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=rn(t);var r=un.test(t);return r||sn.test(t)?an(t.slice(2),r?2:8):on.test(t)?nn:+t}var fn=1/0,ln=17976931348623157e292;function pn(t){return t?(t=cn(t))===fn||t===-fn?(t<0?-1:1)*ln:t==t?t:0:0===t?t:0}function hn(t){var e=pn(t),r=e%1;return e==e?r?e-r:e:0}var dn=v.isFinite,yn=Math.min;var vn=function(t){var e=Math[t];return function(t,r){if(t=cn(t),(r=null==r?0:yn(hn(r),292))&&dn(t)){var n=(Ot(t)+"e").split("e");return+((n=(Ot(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round"),mn=vn;function gn(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function bn(t){let e=!1;if(gn(t))e=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(function(t){return t!=t}(t))return!1;e=!0}return e}function jn(t){if(!bn(t))return 0;return pn(t)}function wn(t){if(!bn(t))return 0;t=jn(t);let e=mn(t);return"0"===String(e)?0:e}function _n(t){return!!bn(t)&&(t=jn(t),"number"==typeof(e=t)&&e==hn(e));var e}function On(t){if(!_n(t))return!1;return wn(t)>0}function $n(t){return"[object Object]"===Object.prototype.toString.call(t)}function Sn(t){if($n(t)){for(let e in t)return!0;return!1}return!1}function kn(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Pn(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function Tn(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function xn(t){return t!=t}function Dn(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):Tn(t,xn,r)}var Mn="\\ud800-\\udfff",Fn="["+Mn+"]",zn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ln="\\ud83c[\\udffb-\\udfff]",En="[^"+Mn+"]",An="(?:\\ud83c[\\udde6-\\uddff]){2}",Rn="[\\ud800-\\udbff][\\udc00-\\udfff]",Yn="(?:"+zn+"|"+Ln+")"+"?",Cn="[\\ufe0e\\ufe0f]?",In=Cn+Yn+("(?:\\u200d(?:"+[En,An,Rn].join("|")+")"+Cn+Yn+")*"),Hn="(?:"+[En+zn+"?",zn,An,Rn,Fn].join("|")+")",Un=RegExp(Ln+"(?="+Ln+")|"+Hn+In,"g");function qn(t){return Er(t)?function(t){return t.match(Un)||[]}(t):function(t){return t.split("")}(t)}function Nn(t,e,r){if((t=Ot(t))&&(r||void 0===e))return rn(t);if(!t||!(e=_t(e)))return t;var n=qn(t),i=qn(e),o=function(t,e){for(var r=-1,n=t.length;++r<n&&Dn(e,t[r],0)>-1;);return r}(n,i),u=function(t,e){for(var r=t.length;r--&&Dn(e,t[r],0)>-1;);return r}(n,i)+1;return function(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:Pn(t,e,r)}(n,o,u).join("")}function Wn(t,e){if(!gn(t))return[];if(!gn(e))return[];let r=function(t,e){return gn(t)&&gn(e)?t.split(e):[]}(t,e);r=xr(r,Nn);let n=[];return Mr(r,(function(t){gn(t)&&n.push(t)})),n}function Bn(t){if(!_n(t))return!1;return wn(t)>=0}function Qn(t,e){return gn(t)&&Bn(e)?0===(e=wn(e))?"":t.substring(0,e):""}function Vn(t,e){let r=Xr();if(n=t,"[object Array]"!==Object.prototype.toString.call(n)&&!$n(t))return r.reject("rs is not an array or object"),r;var n;let i=!1;if($n(t)){i=!0;let e=[];Mr(t,((t,r)=>{e.push({k:r,v:t})})),t=e}kn(e)||(e=function(t){return t});let o=-1,u=[];return t.reduce((function(t,r){return t.then((function(t){u.push(t),o+=1;let n=o,s=r;return i&&(n=r.k,s=r.v),kn(e)?e(s,n):s}))}),Promise.resolve()).then((function(t){var e,n,i,o;u.push(t),o=null==(e=u)?0:e.length,u=o?Pn(e,(n=i||void 0===n?1:hn(n))<0?0:n,o):[],r.resolve(u)})).catch((function(t){r.reject(t)})),r}function Zn(t,e){if(!gn(t))return"";if(!Bn(e))return"";if(0===(e=wn(e)))return"";let r=t.length-e;return r<0&&(r=0),t.substring(r,r+e)}function Gn(t,e){return gn(t)&&Bn(e)?0===(e=wn(e))?t:Qn(t,t.length-e):""}function Jn(t){if(!gn(t))return"";let e=function(t){if(!gn(t))return{path:"",isRoot:!1};for(;t.indexOf("\\\\")>=0;)t=t.replace("\\\\","\\");for(;t.indexOf("//")>=0;)t=t.replace("//","/");if(":"===Zn(t,1))return{path:`${t}\\`,isRoot:!0};if("\\"===Zn(t,1)){let e=Gn(t,1);return":"===Zn(e,1)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}if("/"===Zn(t,1)){let e=Gn(t,1);return 0===e.length?{path:t,isRoot:!0}:{path:e,isRoot:!1}}return{path:t,isRoot:!1}}(t);if(e.isRoot)return e.path;let r=e.path;try{r=r.split("\\").pop().split("/").pop()}catch(t){}return r}function Kn(t){let e=Tt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");if(!e.existsSync(t))return!1;let r=e.lstatSync(t);return!r.isFile()&&!r.isSymbolicLink()}function Xn(t){return Kn(t,{fs:e})}function ti(t){return function(t){let e=Tt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");return!!e.existsSync(t)&&!e.lstatSync(t).isDirectory()&&!e.lstatSync(t).isSymbolicLink()}(t,{fs:e})}function ei(t){return function(t){let e=Tt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");if(Kn(t,{fs:e}))return{success:"input folder is already exists: "+t};if(e.existsSync(t))return{error:"input path already exists: "+t};try{e.mkdirSync(t,{recursive:!0})}catch(t){return{error:t}}return{success:"done: "+t}}(t,{fs:e})}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ri(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ni={};!function(t,e){t.exports=function(){var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",o="minute",u="hour",s="day",a="week",c="month",f="quarter",l="year",p="date",h="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],r=t%100;return"["+t+(e[(r-20)%10]||e[r]||e[0])+"]"}},m=function(t,e,r){var n=String(t);return!n||n.length>=e?t:""+Array(e+1-n.length).join(r)+t},g={s:m,z:function(t){var e=-t.utcOffset(),r=Math.abs(e),n=Math.floor(r/60),i=r%60;return(e<=0?"+":"-")+m(n,2,"0")+":"+m(i,2,"0")},m:function t(e,r){if(e.date()<r.date())return-t(r,e);var n=12*(r.year()-e.year())+(r.month()-e.month()),i=e.clone().add(n,c),o=r-i<0,u=e.clone().add(n+(o?-1:1),c);return+(-(n+(r-i)/(o?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:l,w:a,d:s,D:p,h:u,m:o,s:i,ms:n,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},b="en",j={};j[b]=v;var w="$isDayjsObject",_=function(t){return t instanceof k||!(!t||!t[w])},O=function t(e,r,n){var i;if(!e)return b;if("string"==typeof e){var o=e.toLowerCase();j[o]&&(i=o),r&&(j[o]=r,i=o);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var s=e.name;j[s]=e,i=s}return!n&&i&&(b=i),i||!n&&b},$=function(t,e){if(_(t))return t.clone();var r="object"==typeof e?e:{};return r.date=t,r.args=arguments,new k(r)},S=g;S.l=O,S.i=_,S.w=function(t,e){return $(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var k=function(){function v(t){this.$L=O(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[w]=!0}var m=v.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,r=t.utc;if(null===e)return new Date(NaN);if(S.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var n=e.match(d);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return S},m.isValid=function(){return!(this.$d.toString()===h)},m.isSame=function(t,e){var r=$(t);return this.startOf(e)<=r&&r<=this.endOf(e)},m.isAfter=function(t,e){return $(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<$(t)},m.$g=function(t,e,r){return S.u(t)?this[e]:this.set(r,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var r=this,n=!!S.u(e)||e,f=S.p(t),h=function(t,e){var i=S.w(r.$u?Date.UTC(r.$y,e,t):new Date(r.$y,e,t),r);return n?i:i.endOf(s)},d=function(t,e){return S.w(r.toDate()[t].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(e)),r)},y=this.$W,v=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(f){case l:return n?h(1,0):h(31,11);case c:return n?h(1,v):h(0,v+1);case a:var b=this.$locale().weekStart||0,j=(y<b?y+7:y)-b;return h(n?m-j:m+(6-j),v);case s:case p:return d(g+"Hours",0);case u:return d(g+"Minutes",1);case o:return d(g+"Seconds",2);case i:return d(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var r,a=S.p(t),f="set"+(this.$u?"UTC":""),h=(r={},r[s]=f+"Date",r[p]=f+"Date",r[c]=f+"Month",r[l]=f+"FullYear",r[u]=f+"Hours",r[o]=f+"Minutes",r[i]=f+"Seconds",r[n]=f+"Milliseconds",r)[a],d=a===s?this.$D+(e-this.$W):e;if(a===c||a===l){var y=this.clone().set(p,1);y.$d[h](d),y.init(),this.$d=y.set(p,Math.min(this.$D,y.daysInMonth())).$d}else h&&this.$d[h](d);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[S.p(t)]()},m.add=function(n,f){var p,h=this;n=Number(n);var d=S.p(f),y=function(t){var e=$(h);return S.w(e.date(e.date()+Math.round(t*n)),h)};if(d===c)return this.set(c,this.$M+n);if(d===l)return this.set(l,this.$y+n);if(d===s)return y(1);if(d===a)return y(7);var v=(p={},p[o]=e,p[u]=r,p[i]=t,p)[d]||1,m=this.$d.getTime()+n*v;return S.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,r=this.$locale();if(!this.isValid())return r.invalidDate||h;var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=S.z(this),o=this.$H,u=this.$m,s=this.$M,a=r.weekdays,c=r.months,f=r.meridiem,l=function(t,r,i,o){return t&&(t[r]||t(e,n))||i[r].slice(0,o)},p=function(t){return S.s(o%12||12,t,"0")},d=f||function(t,e,r){var n=t<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(y,(function(t,n){return n||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return S.s(e.$y,4,"0");case"M":return s+1;case"MM":return S.s(s+1,2,"0");case"MMM":return l(r.monthsShort,s,c,3);case"MMMM":return l(c,s);case"D":return e.$D;case"DD":return S.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(r.weekdaysMin,e.$W,a,2);case"ddd":return l(r.weekdaysShort,e.$W,a,3);case"dddd":return a[e.$W];case"H":return String(o);case"HH":return S.s(o,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return d(o,u,!0);case"A":return d(o,u,!1);case"m":return String(u);case"mm":return S.s(u,2,"0");case"s":return String(e.$s);case"ss":return S.s(e.$s,2,"0");case"SSS":return S.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(n,p,h){var d,y=this,v=S.p(p),m=$(n),g=(m.utcOffset()-this.utcOffset())*e,b=this-m,j=function(){return S.m(y,m)};switch(v){case l:d=j()/12;break;case c:d=j();break;case f:d=j()/3;break;case a:d=(b-g)/6048e5;break;case s:d=(b-g)/864e5;break;case u:d=b/r;break;case o:d=b/e;break;case i:d=b/t;break;default:d=b}return h?d:S.a(d)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return j[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var r=this.clone(),n=O(t,e,!0);return n&&(r.$L=n),r},m.clone=function(){return S.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},v}(),P=k.prototype;return $.prototype=P,[["$ms",n],["$s",i],["$m",o],["$H",u],["$W",s],["$M",c],["$y",l],["$D",p]].forEach((function(t){P[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),$.extend=function(t,e){return t.$i||(t(e,k,$),t.$i=!0),$},$.locale=O,$.isDayjs=_,$.unix=function(t){return $(1e3*t)},$.en=j[b],$.Ls=j,$.p={},$}()}({get exports(){return ni},set exports(t){ni=t}});var ii=ni,oi={},ui={get exports(){return oi},set exports(t){oi=t}};const si=r.createConnection,ai=n.EventEmitter,ci=i.inherits,fi=o,li=e,pi=u,hi=s,di=a,yi=c,vi=f.nfc,mi=l("jsftp:general"),gi=l("jsftp:command"),bi=l("jsftp:response"),ji=function(){},wi={marks:[125,150],ignore:226},_i=/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/,Oi=/\r\n|\n/;function $i(t){let e=ji,r=t+" ";for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];"function"==typeof i[i.length-1]&&(e=i.pop()),r+=i.join(" "),this.execute(r.trim(),e)}function Si(t){this.host=t.host||"localhost",this.port=t.port||21,this.user=t.user||"anonymous",this.pass=t.pass||"@anonymous",this.createSocket=t.createSocket,this.useList=t.useList||!1,this.commandQueue=[],ai.call(this),this.on("data",bi),this._createSocket(this.port,this.host)}ci(Si,ai),Si.prototype.raw=function(){$i.apply(this,arguments)},Si.prototype.reemit=function(t){return e=>{this.emit(t,e),mi(`event:${t}`,e||{})}},Si.prototype._createSocket=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ji;this.socket&&this.socket.destroy&&this.socket.destroy(),this.resParser&&this.resParser.end(),this.resParser=new hi,this.authenticated=!1,this.socket=this.createSocket?this.createSocket({port:t,host:e},r):si(t,e,r),this.socket.on("connect",this.reemit("connect")),this.socket.on("timeout",this.reemit("timeout")),this.pipeline=pi(this.socket,this.resParser),this.pipeline.on("data",(t=>{this.emit("data",t),bi(t.text),this.parseResponse(t)})),this.pipeline.on("error",this.reemit("error"))},Si.prototype.parseResponse=function(t){if(0===this.commandQueue.length)return;if([220].indexOf(t.code)>-1)return;const e=this.commandQueue[0].callback;if(t.isMark){if(!e.expectsMark||-1===e.expectsMark.marks.indexOf(t.code))return;e.expectsMark.ignore&&(this.ignoreCmdCode=e.expectsMark.ignore)}this.ignoreCmdCode!==t.code?this.parse(t,this.commandQueue.shift()):this.ignoreCmdCode=null},Si.prototype.send=function(t){t&&(gi(t),this.pipeline.write(t+"\r\n"),gi(t))},Si.prototype.nextCmd=function(){const t=this.commandQueue[0];!this.inProgress&&t&&(this.send(t.action),this.inProgress=!0)},Si.prototype.execute=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ji;if(this.socket&&this.socket.writable)return this.runCommand({action:t,callback:e});this.authenticated=!1,this._createSocket(this.port,this.host,(()=>{this.runCommand({action:t,callback:e})}))},Si.prototype.runCommand=function(t){if(this.authenticated||/^(feat|syst|user|pass)/.test(t.action))return this.commandQueue.push(t),void this.nextCmd();this.getFeatures((()=>{this.auth(this.user,this.pass,(()=>{this.commandQueue.push(t),this.nextCmd()}))}))},Si.prototype.parse=function(t,e){let r=null;t.isError&&(r=new Error(t.text||"Unknown FTP error."),r.code=t.code),this.inProgress=!1,e.callback(r,t),this.nextCmd()},Si.prototype.getPasvPort=function(t){const e=_i.exec(t);if(!e)return null;let r=e[1].replace(/,/g,".");return"127.0.0.1"===r&&(r=this.host),{host:r,port:256*(255&parseInt(e[2],10))+(255&parseInt(e[3],10))}},Si.prototype.hasFeat=function(t){return!!t&&this.features.indexOf(t.toLowerCase())>-1},Si.prototype._parseFeats=function(t){return t.split(Oi).slice(1,-1).map((t=>t.trim().toLowerCase())).filter((t=>!!t))},Si.prototype.getFeatures=function(t){if(this.features)return t(null,this.features);this.raw("feat",((e,r)=>{this.features=e?[]:this._parseFeats(r.text),this.raw("syst",((e,r)=>{e||215!==r.code||(this.system=r.text.toLowerCase()),t(null,this.features)}))}))},Si.prototype.auth=function(t,e,r){if(!0===this.authenticating)return r(new Error("This client is already authenticating"));t||(t="anonymous"),e||(e="@anonymous"),this.authenticating=!0,this.raw("user",t,((n,i)=>{if(n||-1===[230,331,332].indexOf(i.code))return this.authenticating=!1,void r(n);this.raw("pass",e,((n,i)=>{this.authenticating=!1,n?r(n):[230,202].indexOf(i.code)>-1?(this.authenticated=!0,this.user=t,this.pass=e,this.raw("type","I",(()=>{r(void 0,i)}))):332===i.code&&this.raw("acct","")}))}))},Si.prototype.setType=function(t,e){if(t=t.toUpperCase(),this.type===t)return e();this.raw("type",t,((r,n)=>{r||(this.type=t),e(r,n)}))},Si.prototype.list=function(t,e){1===arguments.length&&(e=arguments[0],t="");let r="";e=yi(e),this.getPasvSocket(((n,i)=>{if(n)return e(n);function o(t,r){if(t)return e(t);wi.marks.some((t=>t===r.code))||e(new Error(`Expected marks ${wi.toString()} instead of: ${r.text}`))}i.setEncoding("utf8"),i.on("data",(t=>{r+=t})),this.pasvTimeout(i,e),i.once("close",(n=>n?e(n):r?void e(null,r):e({code:451,text:`Could not retrieve a file listing for ${t}.`,isMark:!1,isError:!0}))),i.once("error",e),o.expectsMark=wi,this.execute(`list ${t||""}`,o)}))},Si.prototype.emitProgress=function(t){this.emit("progress",{filename:t.filename,action:t.action,total:t.totalSize||0,transferred:t.socket["get"===t.action?"bytesRead":"bytesWritten"]})},Si.prototype.get=function(t,e){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ji;const i=typeof e;"function"===i?r=e:"string"===i&&(n=yi(n),r=(r,i)=>{if(r)return n(r);const o=li.createWriteStream(e);o.on("error",n),i.on("readable",(()=>{this.emitProgress({filename:t,action:"get",socket:i})})),i.on("error",n),i.on("end",n),i.on("close",n),i.pipe(o)}),this.getGetSocket(t,yi(r))},Si.prototype.getGetSocket=function(t,e){e=yi(e),this.getPasvSocket(((r,n)=>{if(r)return i(r);function i(t,r){return t?(n&&n.destroy(),e(t)):n?125===r.code||150===r.code?e(null,n):(n.destroy(),e(new Error("Unexpected command "+r.text))):e(new Error("Error when retrieving PASV socket"))}n.on("error",(t=>{"ECONNREFUSED"===t.code&&(t.msg="Probably trying a PASV operation while one is in progress"),i(t)})),this.pasvTimeout(n,i),n.pause(),i.expectsMark=wi,this.execute("retr "+t,i)}))},Si.prototype.put=function(t,e,r){const n=(t,e,n)=>{t.on("readable",(()=>{this.emitProgress({filename:e,action:"put",socket:t,totalSize:n})})),this.getPutSocket(t,e,r)};t instanceof Buffer?this.getPutSocket(t,e,r):"string"==typeof t?li.stat(t,((i,o)=>{if(i&&"ENOENT"===i.code)return r(new Error("Local file doesn't exist."));if(o.isDirectory())return r(new Error("Local path cannot be a directory"));const u=i?0:o.size;n(li.createReadStream(t),e,u)})):t instanceof fi.Readable?n(t,e,0):r(new Error("Expected `from` parameter to be a Buffer, Stream, or a String"))},Si.prototype.getPutSocket=function(t,e,r){r=yi(r||ji),this.getPasvSocket(((n,i)=>{if(n)return i&&i.destroy(),r(n);i.on("close",r),i.on("error",r);const o=yi(((e,n)=>e?(i&&i.destroy(),r(e)):125!==n.code&&150!==n.code?(i&&i.destroy(),r(new Error("Unexpected command "+n.text))):(this.pasvTimeout(i,r),void(t instanceof Buffer?i.end(t):t instanceof fi.Readable&&t.pipe(i)))));o.expectsMark=wi,this.execute(`stor ${e}`,o)}))},Si.prototype.pasvTimeout=function(t,e){t.once("timeout",(()=>{mi("PASV socket timeout"),this.emit("timeout"),t.end(),e(new Error("Passive socket timeout"))}))},Si.prototype.getPasvSocket=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ji;t=yi(t),this.execute("pasv",((e,r)=>{if(e)return t(e);const n=this.getPasvPort(r.text);if(!n)return t(new Error("Bad passive host/port combination"));const i=this._pasvSocket=this.createSocket?this.createSocket(n):si(n);i.setTimeout(this.timeout||6e5),i.once("close",(()=>{this._pasvSocket=void 0})),t(null,i)}))},Si.prototype.ls=function(t,e){function r(t,r){if(t)return e(t);di.parseFtpEntries(r.text||r,((t,r)=>{if(t)return e(t);r.forEach((t=>{t.name=vi(t.name)})),e(null,r)}))}this.useList?this.list(t,r):this.raw("stat",t,((e,n)=>{const i=e&&(502===e.code||500===e.code),o=this.system&&this.system.indexOf("hummingbird")>-1;i||o?(this.useList=!0,this.list(t,r)):r(e,n)}))},Si.prototype.rename=function(t,e,r){this.raw("rnfr",t,(t=>{if(t)return r(t);this.raw("rnto",e,r)}))},Si.prototype.keepAlive=function(t){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this._keepAliveInterval=setInterval(this.raw.bind(this,"noop"),t||3e4)},Si.prototype.destroy=function(){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this.socket&&this.socket.writable&&this.socket.end(),this._pasvSocket&&this._pasvSocket.writable&&this._pasvSocket.end(),this.resParser.end(),this.socket=void 0,this._pasvSocket=void 0,this.features=null,this.authenticated=!1};var ki=Si;!function(t){t.exports=ki}(ui);var Pi=ri(oi);function Ti(t,e){return gn(t)&&Bn(e)?0===(e=wn(e))?t:Zn(t,t.length-e):""}function xi(t){"."===Qn(t,1)&&(t=Ti(t,1));let e=Wn(t,"/");var r,n,i,o;e=(o=null==(r=e)?0:r.length)?Pn(r,0,(n=o-(n=i||void 0===n?1:hn(n)))<0?0:n):[];let u=[],s=".";return Mr(e,(t=>{s+="/"+t,u.push(s)})),u}var Di=Math.max;var Mi,Fi=(Mi=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:hn(r);return i<0&&(i=Di(n+i,0)),Tn(t,Or(e),i)},function(t,e,r){var n=Object(t);if(!Re(t)){var i=Or(e);t=Ye(t),e=function(t){return i(n[t],t,n)}}var o=Mi(t,e,r);return o>-1?n[i?t[o]:o]:void 0}),zi="[object Boolean]";function Li(t){return!0===(e=t)||!1===e||P(e)&&k(e)==zi;var e}function Ei(t,e){var r=[];return Pr(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function Ai(t,e){return(h(t)?ne:Ei)(t,Or(e))}var Ri=Array.prototype.join;function Yi(r){return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=1,i=Tt(r,"path"),o=Tt(r,"fs");if(!Kn(t,{fs:o}))throw new Error(`fd[${t}] is not a folder`);return function t(r){let u=[];return Kn(r,{fs:o})?(Mr(o.readdirSync(r),(function(s){let a=i.resolve(r,s),c=null;try{c=o.statSync(a)}catch(t){}c&&c.isDirectory()?(u.push({isFolder:!0,level:n,path:a,name:i.basename(a)}),n+=1,(n<=e||null===e)&&(u=u.concat(t(a))),n-=1):u.push({isFolder:!1,level:n,path:a,name:i.basename(a)})})),u):u}(t)}(r,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{path:t,fs:e})}function Ci(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ii(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ci(Object(r),!0).forEach((function(e){Mt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ci(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}async function Hi(r,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Xn(n))return Promise.reject(`fdLocal[${n}] is not a folder`);let o=Tt(i,"ftpLs");if(!kn(o))return Promise.reject("opt.ftpLs is not a function");let u=Tt(i,"levelLimit");On(u)||(u=null),n=t.resolve(n);let s=e=>{let i=(e=t.resolve(e)).replace(n,""),o=new RegExp("\\\\","g");i=String(i).replace(o,"/");let u=r;var s,a;return"."===Qn(r,1)&&(u=Ti(r,1)),i=[...Wn(u,"/"),...Wn(i,"/")],a="/",i=null==(s=i)?"":Ri.call(s,a),i=`./${i}`,i},a=Yi(n,u);a=Ai(a,(t=>!t.isFolder)),a=xr(a,(t=>{let r=e.statSync(t.path);return t.size=Tt(r,"size",0),t.rpath=s(t.path),t}));let c=await function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=1;if(!kn(e))return Promise.reject("ftpLs is not a function");let i=Tt(r,"levelLimit");On(i)||(i=null);let o=async t=>{let r=[],u=await e(t);return await Vn(u,(async e=>{let u=`${t}/${e.name}`;if(e.isFolder){if(r.push(Ii(Ii({},e),{},{isFolder:!0,level:n,rpath:u,name:Jn(u)})),n+=1,n<=i||null===i){let t=await o(u);r=r.concat(t)}n-=1}else r.push(Ii(Ii({},e),{},{isFolder:!1,level:n,rpath:u,name:Jn(u)}))})),r};return o(t)}(r,o,{levelLimit:u});return c=Ai(c,(t=>!t.isFolder)),c=xr(c,(e=>{var i;return e.lpath=(i=e.rpath,"."!==r&&(i=i.replace(r,"")),"."===Qn(i,1)&&(i=Ti(i,1)),"/"===Qn(i,1)&&(i=Ti(i,1)),t.resolve(n,i)),e})),{fsRemote:c,fsLocal:a}}async function Ui(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=Tt(n,"ftpLs");if(!kn(i))return Promise.reject("opt.ftpLs is not a function");let o=Tt(n,"ftpDownload");if(!kn(o))return Promise.reject("opt.ftpDownload is not a function");let u=Tt(n,"forceOverwriteWhenSync");Li(u)||(u=!1);let s=Tt(n,"levelLimit");On(s)||(s=null),Xn(e)||ei(e);let a=await Hi(t,e,{ftpLs:i,levelLimit:s}),c=a.fsRemote,f=a.fsLocal,l=0,p=[];return await Vn(c,(async t=>{let e=Tt(t,"lpath",""),n=Fi(f,{path:e}),i=Tt(t,"rpath",""),s=Tt(t,"lpath",""),a=t=>{kn(r)&&r(t)};Sn(n)?(u||t.size!==n.size)&&(await o(i,s,a),l++,p.push({path:t.rpath,reason:`size[${n.size}] of local file != size[${t.size}] of remote file`})):(await o(i,s,a),l++,p.push({path:t.rpath,reason:"no local file"}))})),{num:l,files:p}}async function qi(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=Tt(n,"ftpLs");if(!kn(i))return Promise.reject("opt.ftpLs is not a function");let o=Tt(n,"ftpUpload");if(!kn(o))return Promise.reject("opt.ftpUpload is not a function");let u=Tt(n,"forceOverwriteWhenSync");Li(u)||(u=!1);let s=Tt(n,"levelLimit");On(s)||(s=null);let a=await Hi(e,t,{ftpLs:i,levelLimit:s}),c=a.fsRemote,f=a.fsLocal,l=0,p=[];return await Vn(f,(async t=>{let e=Tt(t,"rpath",""),n=Fi(c,{rpath:e}),i=Tt(t,"rpath",""),s=Tt(t,"path",""),a=t=>{kn(r)&&r(t)};Sn(n)?(u||t.size!==n.size)&&(await o(s,i,a),l++,p.push({name:t.rpath,reason:`size[${n.size}] of remote file != size[${t.size}] of local file`})):(await o(s,i,a),l++,p.push({name:t.rpath,reason:"no Remote file"}))})),{num:l,files:p}}function Ni(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Wi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ni(Object(r),!0).forEach((function(e){Mt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ni(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Bi(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null,i=Tt(r,"hostname");if(!gn(i))throw new Error(`hostname[${i}] is not an effective string`);let o=Tt(r,"port");On(o)||(o=21),o=wn(o);let u=Tt(r,"username");if(!gn(u))throw new Error(`username[${u}] is not an effective string`);let s=Tt(r,"password");if(!gn(s))throw new Error(`password[${s}] is not an effective string`);let a=Tt(r,"timeLimit");function c(t){let e="";if(!bn(t)&&!gn(t))return e;try{let r=ii(t),n=r.format("YYYY-MM-DDTHH:mm:ss");n=`${n}+00:00`,r=ii(n),e=r.format("YYYY-MM-DDTHH:mm:ssZ")}catch(t){}return e}async function f(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",e=Xr();if(null===n)return e.reject("FTP has not been initialized. please use 'conn' to construct FTP"),e;let r=setTimeout((()=>{e.reject(`ftpLs timeout[${a}]`)}),a);return n.ls(t,((t,n)=>{clearTimeout(r),t?451===Tt(t,"code")?e.resolve([]):e.reject(t):(n=xr(n,(t=>(t.mtime=c(t.time),t.size=wn(t.size),t.isFolder=y(t),t))),e.resolve(n))})),e}async function l(t,e){let r=Xr();if(null===n)return r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r;let i=setTimeout((()=>{r.reject(`ftpRaw[${t}] timeout[${a}]`)}),a);return n.raw(t,e,((t,e)=>{clearTimeout(i),t?r.reject(t):r.resolve(e)})),r}async function p(t){let e=xi(t);return Jr(e)>=1&&await Vn(e,(async t=>{await v(t)||await async function(t){return l("mkd",t)}(t)})),"ok"}async function h(t){return l("cwd",t)}async function d(t){if(null===n)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let e={},r=null;if(await async function(t){return l("mlst",t)}(t).then((t=>{r=t})).catch((t=>{r={err:t.toString()}})),!Sn(r))return Promise.reject("invalid result from ftpMlst");{let t=Tt(r,"text",""),n=t.indexOf("type=dir;")>=0,i=t.indexOf("type=file;")>=0,o=(t=>{let e=Wn(t,";"),r="";return Mr(e,(t=>{if("modify="===Qn(t,7)){let e=Wn(t,"=");r=Tt(e,1,"")}})),r})(t),u=c(o);e=Wi(Wi({},e),{},{rmlst:r,mtime:u,isFolder:n,isFile:i})}let i=null;if(await async function(t){return l("size",t)}(t).then((t=>{i=t})).catch((t=>{i={err:t.toString()}})),!Sn(i))return Promise.reject("invalid result from ftpSize");{let t=Tt(i,"code",""),r=Tt(i,"text","").replace(`${t} `,"");r=wn(r),e=Wi(Wi({},e),{},{rsize:i,size:r})}return e}function y(t){if(!Sn(t))return!1;let e;return e=Tt(t,"isFolder",!1),e||(e=1===Tt(t,"type",-1),e||e)}async function v(t){return y(await d(t))}function m(t){if(!Sn(t))return!1;let e;return e=Tt(t,"isFile",!1),e||(e=0===Tt(t,"type",-1),e||e)}async function g(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=Xr();if(null===n)return u.reject("FTP has not been initialized. please use 'conn' to construct FTP"),u;if(!gn(r))return u.reject(`fpRemote[${r}] is not an effective string`),u;if(!gn(i))return u.reject(`fpLocal[${i}] is not an effective string`),u;let s=t.dirname(i);ti(i)&&e.unlinkSync(i),Xn(s)||ei(s);let c=await d(r);if(!m(c))return u.reject(`fpRemote[${r}] is not a file`),u;if(!Sn(c)||(l="err",$n(f=c)&&(gn(l)||bn(l))&&l in f))return u.reject(`fpRemote[${r}] does not have information`),u;var f,l;let p=Tt(c,"size","");if(!bn(p))return u.reject(`can not get the size of file[${r}]`),u;p=wn(p);let h=setTimeout((()=>{u.reject(`ftpDownload timeout[${a}]`)}),a);return n.get(r,((t,n)=>{if(t)return clearTimeout(h),void u.reject(t);let s=e.createWriteStream(i),a=0;n.on("data",(t=>{if(kn(o)){let e=Jr(t);a+=e,o({progress:a/p*100,name:Jn(i),fpRemote:r,fpLocal:i})}s.write(t)})),n.on("close",(()=>{s.end()})),s.on("finish",(()=>{clearTimeout(h),t?u.reject(t):u.resolve("ok")})),s.on("error",(t=>{console.log("writer error",t)})),n.resume()})),u}async function b(t,r,i){let o=null;if(null===n)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");if(!gn(r))return Promise.reject(`fpRemote[${r}] is not an effective string`);let u=xi(r),s=r;if(Jr(u)>=1){await p(r);let t=Kr(u);await h(t),s="."+r.replace(t,"")}let c=await async function(t,r,i){let o=Xr();if(null===n)return o.reject("FTP has not been initialized. please use 'conn' to construct FTP"),o;if(!gn(r))return o.reject(`fpRemote[${r}] is not an effective string`),o;if(!gn(t))return o.reject(`fpLocal[${t}] is not an effective string`),o;if(!ti(t))return o.reject(`fpLocal[${t}] is not a file`),o;let u=Tt(e.statSync(t),"size",0);if(!bn(u))return o.reject(`can not get the size of file[${t}]`),o;u=wn(u);let s=e.readFileSync(t),c=setTimeout((()=>{o.reject(`ftpUploadCore timeout[${a}]`)}),a),f=0;return n.put(s,r,((e,n)=>{if(e)return clearTimeout(c),void o.reject(e);if(0===Jr(n))return clearTimeout(c),void o.resolve("ok");if(kn(i)){let e=Jr(n);f+=e,i({progress:f/u*100,name:Jn(t),fpRemote:r,fpLocal:t})}})),o}(t,s,i).catch((t=>{o=t}));return Jr(u)>=1&&await h("/"),null!==o?Promise.reject(o):c}return bn(a)||(a=6e4),a=wn(a),{conn:async function(){let t=Xr();try{n=new Pi({host:i,port:o,user:u,pass:s}),t.resolve("ok")}catch(e){t.reject(e)}return t},quit:async function(){let t=Xr();if(null===n)return t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t;let e=setTimeout((()=>{n.destroy(),n=null,t.reject(`ftpQuit timeout[${a}]`)}),a);return n.raw("quit",((r,i)=>{clearTimeout(e),n.destroy(),n=null,r?t.reject(r):t.resolve(i)})),t},ls:f,isFile:async function(t){return m(await d(t))},isFolder:v,download:g,upload:b,syncToLocal:async function(t,e,r){return Ui(t,e,r,Wi(Wi({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},{ftpLs:f,ftpDownload:g}))},syncToRemote:async function(t,e,r){return qi(t,e,r,Wi(Wi({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},{ftpLs:f,ftpUpload:b}))},stat:d,mkdir:p,cwd:h,pwd:async function(){return l("pwd")}}}function Qi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Vi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Qi(Object(r),!0).forEach((function(e){Mt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qi(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Zi(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null,i=Tt(r,"hostname");if(!gn(i))throw new Error(`hostname[${i}] is not an effective string`);let o=Tt(r,"port");On(o)||(o=22),o=wn(o);let u=Tt(r,"username");if(!gn(u))throw new Error(`username[${u}] is not an effective string`);let s=Tt(r,"password");if(!gn(s))throw new Error(`password[${s}] is not an effective string`);let a=Tt(r,"timeLimit");async function c(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",e=null,r=Xr();if(null===n)return r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r;let i=setTimeout((()=>{r.reject(`ftpLs timeout[${a}]`)}),a),o=await n.list(t).catch((t=>{e=t}));return clearTimeout(i),null!==e?(r.reject(e),r):(o=xr(o,(t=>{let e;return e=ii(t.accessTime),t.atime=e.format("YYYY-MM-DDTHH:mm:ssZ"),e=ii(t.modifyTime),t.mtime=e.format("YYYY-MM-DDTHH:mm:ssZ"),t.isFolder=h(t),t})),r.resolve(o),r)}async function f(t){let e=xi(t);if(Jr(e)>=1){let t=Kr(e);await async function(t){return n.mkdir(t,!0)}(t)}return"ok"}async function l(t){let e=null;return await n.stat(t).then((r=>{let n;n=ii(r.accessTime);let i=n.format("YYYY-MM-DDTHH:mm:ssZ");n=ii(r.modifyTime);let o=n.format("YYYY-MM-DDTHH:mm:ssZ");e=Vi(Vi({},r),{},{atime:i,mtime:o,name:t})})).catch((t=>{e={err:t.toString()}})),e}function h(t){if(!Sn(t))return!1;let e;return e=!0===Tt(t,"isDirectory",null),e||(e="d"===Tt(t,"type",""),e||!1)}function d(t){if(!Sn(t))return!1;let e;return e=!0===Tt(t,"isFile",null),e||(e="-"===Tt(t,"type",""),e||e)}async function y(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=Xr();if(null===n)return u.reject("FTP has not been initialized. please use 'conn' to construct FTP"),u;if(!gn(r))return u.reject(`fpRemote[${r}] is not an effective string`),u;if(!gn(i))return u.reject(`fpLocal[${i}] is not an effective string`),u;let s=t.dirname(i);Xn(s)||ei(s);let c=await l(r);if(!d(c))return u.reject(`fpRemote[${r}] is not a file`),u;if(!Sn(c))return u.reject(`fpRemote[${r}] does not have information`),u;let f=Tt(c,"size","");if(!bn(f))return u.reject(`can not get the size of file[${r}]`),u;f=wn(f),ti(i)&&e.unlinkSync(i);let p=setTimeout((()=>{u.reject(`ftpDownload timeout[${a}]`)}),a);return n.fastGet(r,i,{step:(t,e,n)=>{if(kn(o)){o({progress:t/n*100,name:Jn(i),fpRemote:r,fpLocal:i})}}}).then((()=>{u.resolve("ok")})).catch((t=>{u.reject(t)})).finally((()=>{clearTimeout(p)})),clearTimeout(p),u}async function v(t,r,i){let o=Xr();if(null===n)return o.reject("FTP has not been initialized. please use 'conn' to construct FTP"),o;if(!gn(r))return o.reject(`fpRemote[${r}] is not an effective string`),o;if(!gn(t))return o.reject(`fpLocal[${t}] is not an effective string`),o;if(!ti(t))return o.reject(`fpLocal[${t}] is not a file`),o;await f(r);let u=Tt(e.statSync(t),"size",0);if(!bn(u))return o.reject(`can not get the size of file[${t}]`),o;u=wn(u);let s=setTimeout((()=>{o.reject(`ftpUploadCore timeout[${a}]`)}),a);return n.fastPut(t,r,{step:(e,n,o)=>{if(kn(i)){i({progress:e/o*100,name:Jn(t),fpRemote:r,fpLocal:t})}}}).then((()=>{o.resolve("ok")})).catch((t=>{o.reject(t)})).finally((()=>{clearTimeout(s)})),clearTimeout(s),o}return bn(a)||(a=6e4),a=wn(a),{conn:async function(){return n=new p,await n.connect({host:i,port:o,username:u,password:s}),"ok"},quit:async function(){let t=Xr();if(null===n)return t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t;let e=setTimeout((()=>{n.end(),n=null,t.reject(`ftpQuit timeout[${a}]`)}),a);try{n.end(),n=null,clearTimeout(e),t.resolve("ok")}catch(e){t.reject(e)}return t},ls:c,isFile:async function(t){return d(await l(t))},isFolder:async function(t){return h(await l(t))},download:y,upload:v,syncToLocal:async(t,e,r)=>Ui(t,e,r,{ftpLs:c,ftpDownload:y}),syncToRemote:async(t,e,r)=>qi(t,e,r,{ftpLs:c,ftpUpload:v}),stat:l,mkdir:f,cwd:async function(t){return n.cwd(t)},pwd:async function(){return n.pwd()}}}async function Gi(){return null}async function Ji(){return null}async function Ki(){return null}async function Xi(t){return null}async function to(t){return null}async function eo(t,e){return null}async function ro(t,e,r){return null}async function no(t,e,r){return null}async function io(t,e,r){return null}async function oo(t){return null}async function uo(t){return null}async function so(t){return null}async function ao(t){return null}return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Tt(t,"transportation","FTP");if("FTP"!==e&&"SFTP"!==e)throw new Error(`transportation[${e}] is not FTP or SFTP`);let r=null;"FTP"===e?r=new Bi(t):"SFTP"===e&&(r=new Zi(t));let n={doc_conn:Gi,doc_quit:Ji,doc_ls:Ki,doc_isFile:Xi,doc_isFolder:to,doc_download:eo,doc_upload:ro,doc_syncToLocal:no,doc_syncToRemote:io,doc_stat:oo,doc_mkdir:uo,doc_cwd:so,doc_pwd:ao};return r.__doc___=n,r}}));
|
|
6
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("fs"),require("net"),require("events"),require("util"),require("stream"),require("stream-combiner"),require("ftp-response-parser"),require("parse-listing"),require("once"),require("unorm"),require("debug"),require("ssh2-sftp-client")):"function"==typeof define&&define.amd?define(["path","fs","net","events","util","stream","stream-combiner","ftp-response-parser","parse-listing","once","unorm","debug","ssh2-sftp-client"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-ftp"]=e(t.path,t.fs,t.net,t.events,t.util,t.stream,t["stream-combiner"],t["ftp-response-parser"],t["parse-listing"],t.once,t.unorm,t.debug,t["ssh2-sftp-client"])}(this,(function(t,e,r,n,i,o,u,s,a,c,f,l,h){"use strict";var p=Array.isArray,d="object"==typeof global&&global&&global.Object===Object&&global,v="object"==typeof self&&self&&self.Object===Object&&self,y=d||v||Function("return this")(),m=y.Symbol,g=Object.prototype,b=g.hasOwnProperty,w=g.toString,j=m?m.toStringTag:void 0;var _=Object.prototype.toString;var $="[object Null]",S="[object Undefined]",k=m?m.toStringTag:void 0;function T(t){return null==t?void 0===t?S:$:k&&k in Object(t)?function(t){var e=b.call(t,j),r=t[j];try{t[j]=void 0;var n=!0}catch(t){}var i=w.call(t);return n&&(e?t[j]=r:delete t[j]),i}(t):function(t){return _.call(t)}(t)}function O(t){return null!=t&&"object"==typeof t}var P="[object Symbol]";function x(t){return"symbol"==typeof t||O(t)&&T(t)==P}var M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/;function z(t,e){if(p(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!x(t))||(F.test(t)||!M.test(t)||null!=e&&t in Object(e))}function D(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var L="[object AsyncFunction]",A="[object Function]",E="[object GeneratorFunction]",R="[object Proxy]";function Y(t){if(!D(t))return!1;var e=T(t);return e==A||e==E||e==L||e==R}var C,I=y["__core-js_shared__"],H=(C=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var U=Function.prototype.toString;function q(t){if(null!=t){try{return U.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var N=/^\[object .+?Constructor\]$/,W=Function.prototype,B=Object.prototype,Q=W.toString,V=B.hasOwnProperty,Z=RegExp("^"+Q.call(V).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(t){return!(!D(t)||(e=t,H&&H in e))&&(Y(t)?Z:N).test(q(t));var e}function J(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return G(r)?r:void 0}var K=J(Object,"create");var X=Object.prototype.hasOwnProperty;var tt=Object.prototype.hasOwnProperty;function et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t,e){return t===e||t!=t&&e!=e}function nt(t,e){for(var r=t.length;r--;)if(rt(t[r][0],e))return r;return-1}et.prototype.clear=function(){this.__data__=K?K(null):{},this.size=0},et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},et.prototype.get=function(t){var e=this.__data__;if(K){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return X.call(e,t)?e[t]:void 0},et.prototype.has=function(t){var e=this.__data__;return K?void 0!==e[t]:tt.call(e,t)},et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=K&&void 0===e?"__lodash_hash_undefined__":e,this};var it=Array.prototype.splice;function ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ot.prototype.clear=function(){this.__data__=[],this.size=0},ot.prototype.delete=function(t){var e=this.__data__,r=nt(e,t);return!(r<0)&&(r==e.length-1?e.pop():it.call(e,r,1),--this.size,!0)},ot.prototype.get=function(t){var e=this.__data__,r=nt(e,t);return r<0?void 0:e[r][1]},ot.prototype.has=function(t){return nt(this.__data__,t)>-1},ot.prototype.set=function(t,e){var r=this.__data__,n=nt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var ut=J(y,"Map");function st(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function at(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}at.prototype.clear=function(){this.size=0,this.__data__={hash:new et,map:new(ut||ot),string:new et}},at.prototype.delete=function(t){var e=st(this,t).delete(t);return this.size-=e?1:0,e},at.prototype.get=function(t){return st(this,t).get(t)},at.prototype.has=function(t){return st(this,t).has(t)},at.prototype.set=function(t,e){var r=st(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};var ct="Expected a function";function ft(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(ct);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var u=t.apply(this,n);return r.cache=o.set(i,u)||o,u};return r.cache=new(ft.Cache||at),r}ft.Cache=at;var lt,ht,pt,dt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vt=/\\(\\)?/g,yt=(lt=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(dt,(function(t,r,n,i){e.push(n?i.replace(vt,"$1"):r||t)})),e},ht=ft(lt,(function(t){return 500===pt.size&&pt.clear(),t})),pt=ht.cache,ht),mt=yt;function gt(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var bt=1/0,wt=m?m.prototype:void 0,jt=wt?wt.toString:void 0;function _t(t){if("string"==typeof t)return t;if(p(t))return gt(t,_t)+"";if(x(t))return jt?jt.call(t):"";var e=t+"";return"0"==e&&1/t==-bt?"-0":e}function $t(t){return null==t?"":_t(t)}function St(t,e){return p(t)?t:z(t,e)?[t]:mt($t(t))}var kt=1/0;function Tt(t){if("string"==typeof t||x(t))return t;var e=t+"";return"0"==e&&1/t==-kt?"-0":e}function Ot(t,e){for(var r=0,n=(e=St(e,t)).length;null!=t&&r<n;)t=t[Tt(e[r++])];return r&&r==n?t:void 0}function Pt(t,e,r){var n=null==t?void 0:Ot(t,e);return void 0===n?r:n}function xt(t){var e=this.__data__=new ot(t);this.size=e.size}xt.prototype.clear=function(){this.__data__=new ot,this.size=0},xt.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},xt.prototype.get=function(t){return this.__data__.get(t)},xt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof ot){var n=r.__data__;if(!ut||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new at(n)}return r.set(t,e),this.size=r.size,this};function Mt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new at;++e<r;)this.add(t[e])}function Ft(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function zt(t,e){return t.has(e)}Mt.prototype.add=Mt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Mt.prototype.has=function(t){return this.__data__.has(t)};var Dt=1,Lt=2;function At(t,e,r,n,i,o){var u=r&Dt,s=t.length,a=e.length;if(s!=a&&!(u&&a>s))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,h=!0,p=r&Lt?new Mt:void 0;for(o.set(t,e),o.set(e,t);++l<s;){var d=t[l],v=e[l];if(n)var y=u?n(v,d,l,e,t,o):n(d,v,l,t,e,o);if(void 0!==y){if(y)continue;h=!1;break}if(p){if(!Ft(e,(function(t,e){if(!zt(p,e)&&(d===t||i(d,t,r,n,o)))return p.push(e)}))){h=!1;break}}else if(d!==v&&!i(d,v,r,n,o)){h=!1;break}}return o.delete(t),o.delete(e),h}var Et=y.Uint8Array;function Rt(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function Yt(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var Ct=1,It=2,Ht="[object Boolean]",Ut="[object Date]",qt="[object Error]",Nt="[object Map]",Wt="[object Number]",Bt="[object RegExp]",Qt="[object Set]",Vt="[object String]",Zt="[object Symbol]",Gt="[object ArrayBuffer]",Jt="[object DataView]",Kt=m?m.prototype:void 0,Xt=Kt?Kt.valueOf:void 0;function te(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var u=t[r];e(u,r,t)&&(o[i++]=u)}return o}var ee=Object.prototype.propertyIsEnumerable,re=Object.getOwnPropertySymbols,ne=re?function(t){return null==t?[]:(t=Object(t),te(re(t),(function(e){return ee.call(t,e)})))}:function(){return[]};function ie(t){return O(t)&&"[object Arguments]"==T(t)}var oe=Object.prototype,ue=oe.hasOwnProperty,se=oe.propertyIsEnumerable,ae=ie(function(){return arguments}())?ie:function(t){return O(t)&&ue.call(t,"callee")&&!se.call(t,"callee")},ce=ae;var fe="object"==typeof exports&&exports&&!exports.nodeType&&exports,le=fe&&"object"==typeof module&&module&&!module.nodeType&&module,he=le&&le.exports===fe?y.Buffer:void 0,pe=(he?he.isBuffer:void 0)||function(){return!1},de=9007199254740991,ve=/^(?:0|[1-9]\d*)$/;function ye(t,e){var r=typeof t;return!!(e=null==e?de:e)&&("number"==r||"symbol"!=r&&ve.test(t))&&t>-1&&t%1==0&&t<e}var me=9007199254740991;function ge(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=me}var be={};be["[object Float32Array]"]=be["[object Float64Array]"]=be["[object Int8Array]"]=be["[object Int16Array]"]=be["[object Int32Array]"]=be["[object Uint8Array]"]=be["[object Uint8ClampedArray]"]=be["[object Uint16Array]"]=be["[object Uint32Array]"]=!0,be["[object Arguments]"]=be["[object Array]"]=be["[object ArrayBuffer]"]=be["[object Boolean]"]=be["[object DataView]"]=be["[object Date]"]=be["[object Error]"]=be["[object Function]"]=be["[object Map]"]=be["[object Number]"]=be["[object Object]"]=be["[object RegExp]"]=be["[object Set]"]=be["[object String]"]=be["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=we&&"object"==typeof module&&module&&!module.nodeType&&module,_e=je&&je.exports===we&&d.process,$e=function(){try{var t=je&&je.require&&je.require("util").types;return t||_e&&_e.binding&&_e.binding("util")}catch(t){}}(),Se=$e&&$e.isTypedArray,ke=Se?function(t){return function(e){return t(e)}}(Se):function(t){return O(t)&&ge(t.length)&&!!be[T(t)]},Te=ke,Oe=Object.prototype.hasOwnProperty;function Pe(t,e){var r=p(t),n=!r&&ce(t),i=!r&&!n&&pe(t),o=!r&&!n&&!i&&Te(t),u=r||n||i||o,s=u?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],a=s.length;for(var c in t)!e&&!Oe.call(t,c)||u&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ye(c,a))||s.push(c);return s}var xe=Object.prototype;var Me=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Fe=Me,ze=Object.prototype.hasOwnProperty;function De(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||xe))return Fe(t);var e,r,n=[];for(var i in Object(t))ze.call(t,i)&&"constructor"!=i&&n.push(i);return n}function Le(t){return null!=t&&ge(t.length)&&!Y(t)}function Ae(t){return Le(t)?Pe(t):De(t)}function Ee(t){return function(t,e,r){var n=e(t);return p(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Ae,ne)}var Re=1,Ye=Object.prototype.hasOwnProperty;var Ce=J(y,"DataView"),Ie=J(y,"Promise"),He=J(y,"Set"),Ue=J(y,"WeakMap"),qe="[object Map]",Ne="[object Promise]",We="[object Set]",Be="[object WeakMap]",Qe="[object DataView]",Ve=q(Ce),Ze=q(ut),Ge=q(Ie),Je=q(He),Ke=q(Ue),Xe=T;(Ce&&Xe(new Ce(new ArrayBuffer(1)))!=Qe||ut&&Xe(new ut)!=qe||Ie&&Xe(Ie.resolve())!=Ne||He&&Xe(new He)!=We||Ue&&Xe(new Ue)!=Be)&&(Xe=function(t){var e=T(t),r="[object Object]"==e?t.constructor:void 0,n=r?q(r):"";if(n)switch(n){case Ve:return Qe;case Ze:return qe;case Ge:return Ne;case Je:return We;case Ke:return Be}return e});var tr=Xe,er=1,rr="[object Arguments]",nr="[object Array]",ir="[object Object]",or=Object.prototype.hasOwnProperty;function ur(t,e,r,n,i,o){var u=p(t),s=p(e),a=u?nr:tr(t),c=s?nr:tr(e),f=(a=a==rr?ir:a)==ir,l=(c=c==rr?ir:c)==ir,h=a==c;if(h&&pe(t)){if(!pe(e))return!1;u=!0,f=!1}if(h&&!f)return o||(o=new xt),u||Te(t)?At(t,e,r,n,i,o):function(t,e,r,n,i,o,u){switch(r){case Jt:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Gt:return!(t.byteLength!=e.byteLength||!o(new Et(t),new Et(e)));case Ht:case Ut:case Wt:return rt(+t,+e);case qt:return t.name==e.name&&t.message==e.message;case Bt:case Vt:return t==e+"";case Nt:var s=Rt;case Qt:var a=n&Ct;if(s||(s=Yt),t.size!=e.size&&!a)return!1;var c=u.get(t);if(c)return c==e;n|=It,u.set(t,e);var f=At(s(t),s(e),n,i,o,u);return u.delete(t),f;case Zt:if(Xt)return Xt.call(t)==Xt.call(e)}return!1}(t,e,a,r,n,i,o);if(!(r&er)){var d=f&&or.call(t,"__wrapped__"),v=l&&or.call(e,"__wrapped__");if(d||v){var y=d?t.value():t,m=v?e.value():e;return o||(o=new xt),i(y,m,r,n,o)}}return!!h&&(o||(o=new xt),function(t,e,r,n,i,o){var u=r&Re,s=Ee(t),a=s.length;if(a!=Ee(e).length&&!u)return!1;for(var c=a;c--;){var f=s[c];if(!(u?f in e:Ye.call(e,f)))return!1}var l=o.get(t),h=o.get(e);if(l&&h)return l==e&&h==t;var p=!0;o.set(t,e),o.set(e,t);for(var d=u;++c<a;){var v=t[f=s[c]],y=e[f];if(n)var m=u?n(y,v,f,e,t,o):n(v,y,f,t,e,o);if(!(void 0===m?v===y||i(v,y,r,n,o):m)){p=!1;break}d||(d="constructor"==f)}if(p&&!d){var g=t.constructor,b=e.constructor;g==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof b&&b instanceof b||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,r,n,i,o))}function sr(t,e,r,n,i){return t===e||(null==t||null==e||!O(t)&&!O(e)?t!=t&&e!=e:ur(t,e,r,n,sr,i))}var ar=1,cr=2;function fr(t){return t==t&&!D(t)}function lr(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function hr(t){var e=function(t){for(var e=Ae(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,fr(i)]}return e}(t);return 1==e.length&&e[0][2]?lr(e[0][0],e[0][1]):function(r){return r===t||function(t,e,r,n){var i=r.length,o=i,u=!n;if(null==t)return!o;for(t=Object(t);i--;){var s=r[i];if(u&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var a=(s=r[i])[0],c=t[a],f=s[1];if(u&&s[2]){if(void 0===c&&!(a in t))return!1}else{var l=new xt;if(n)var h=n(c,f,a,t,e,l);if(!(void 0===h?sr(f,c,ar|cr,n,l):h))return!1}}return!0}(r,t,e)}}function pr(t,e){return null!=t&&e in Object(t)}function dr(t,e){return null!=t&&function(t,e,r){for(var n=-1,i=(e=St(e,t)).length,o=!1;++n<i;){var u=Tt(e[n]);if(!(o=null!=t&&r(t,u)))break;t=t[u]}return o||++n!=i?o:!!(i=null==t?0:t.length)&&ge(i)&&ye(u,i)&&(p(t)||ce(t))}(t,e,pr)}var vr=1,yr=2;function mr(t){return t}function gr(t){return function(e){return null==e?void 0:e[t]}}function br(t){return z(t)?gr(Tt(t)):function(t){return function(e){return Ot(e,t)}}(t)}function wr(t){return"function"==typeof t?t:null==t?mr:"object"==typeof t?p(t)?function(t,e){return z(t)&&fr(e)?lr(Tt(t),e):function(r){var n=Pt(r,t);return void 0===n&&n===e?dr(r,t):sr(e,n,vr|yr)}}(t[0],t[1]):hr(t):br(t)}var jr,_r=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),u=o.length;u--;){var s=o[jr?u:++n];if(!1===e(i[s],s,i))break}return t};var $r=function(t,e){return function(r,n){if(null==r)return r;if(!Le(r))return t(r,n);for(var i=r.length,o=e?i:-1,u=Object(r);(e?o--:++o<i)&&!1!==n(u[o],o,u););return r}}((function(t,e){return t&&_r(t,e,Ae)})),Sr=$r;function kr(t,e){var r=-1,n=Le(t)?Array(t.length):[];return Sr(t,(function(t,i,o){n[++r]=e(t,i,o)})),n}function Tr(t,e){return(p(t)?gt:kr)(t,wr(e))}function Or(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function Pr(t,e){var r;return(p(t)?Or:Sr)(t,"function"==typeof(r=e)?r:mr)}var xr="[object String]";var Mr=gr("length"),Fr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function zr(t){return Fr.test(t)}var Dr="\\ud800-\\udfff",Lr="["+Dr+"]",Ar="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Er="\\ud83c[\\udffb-\\udfff]",Rr="[^"+Dr+"]",Yr="(?:\\ud83c[\\udde6-\\uddff]){2}",Cr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ir="(?:"+Ar+"|"+Er+")"+"?",Hr="[\\ufe0e\\ufe0f]?",Ur=Hr+Ir+("(?:\\u200d(?:"+[Rr,Yr,Cr].join("|")+")"+Hr+Ir+")*"),qr="(?:"+[Rr+Ar+"?",Ar,Yr,Cr,Lr].join("|")+")",Nr=RegExp(Er+"(?="+Er+")|"+qr+Ur,"g");function Wr(t){return zr(t)?function(t){for(var e=Nr.lastIndex=0;Nr.test(t);)++e;return e}(t):Mr(t)}var Br="[object Map]",Qr="[object Set]";function Vr(t){if(null==t)return 0;if(Le(t))return"string"==typeof(e=t)||!p(e)&&O(e)&&T(e)==xr?Wr(t):t.length;var e,r=tr(t);return r==Br||r==Qr?t.size:De(t).length}function Zr(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}function Gr(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var Jr=/\s/;var Kr=/^\s+/;function Xr(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&Jr.test(t.charAt(e)););return e}(t)+1).replace(Kr,""):t}var tn=NaN,en=/^[-+]0x[0-9a-f]+$/i,rn=/^0b[01]+$/i,nn=/^0o[0-7]+$/i,on=parseInt;function un(t){if("number"==typeof t)return t;if(x(t))return tn;if(D(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=D(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xr(t);var r=rn.test(t);return r||nn.test(t)?on(t.slice(2),r?2:8):en.test(t)?tn:+t}var sn=1/0,an=17976931348623157e292;function cn(t){return t?(t=un(t))===sn||t===-sn?(t<0?-1:1)*an:t==t?t:0:0===t?t:0}function fn(t){var e=cn(t),r=e%1;return e==e?r?e-r:e:0}var ln=y.isFinite,hn=Math.min;var pn=function(t){var e=Math[t];return function(t,r){if(t=un(t),(r=null==r?0:hn(fn(r),292))&&ln(t)){var n=($t(t)+"e").split("e");return+((n=($t(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round"),dn=pn;function vn(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function yn(t){let e=!1;if(vn(t))e=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(function(t){return t!=t}(t))return!1;e=!0}return e}function mn(t){if(!yn(t))return 0;return cn(t)}function gn(t){if(!yn(t))return 0;t=mn(t);let e=dn(t);return"0"===String(e)?0:e}function bn(t){return!!yn(t)&&(t=mn(t),"number"==typeof(e=t)&&e==fn(e));var e}function wn(t){if(!bn(t))return!1;return gn(t)>0}function jn(t){return"[object Object]"===Object.prototype.toString.call(t)}function _n(t){if(jn(t)){for(let e in t)return!0;return!1}return!1}function $n(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Sn(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function kn(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Tn(t){return t!=t}function On(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):kn(t,Tn,r)}var Pn="\\ud800-\\udfff",xn="["+Pn+"]",Mn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Fn="\\ud83c[\\udffb-\\udfff]",zn="[^"+Pn+"]",Dn="(?:\\ud83c[\\udde6-\\uddff]){2}",Ln="[\\ud800-\\udbff][\\udc00-\\udfff]",An="(?:"+Mn+"|"+Fn+")"+"?",En="[\\ufe0e\\ufe0f]?",Rn=En+An+("(?:\\u200d(?:"+[zn,Dn,Ln].join("|")+")"+En+An+")*"),Yn="(?:"+[zn+Mn+"?",Mn,Dn,Ln,xn].join("|")+")",Cn=RegExp(Fn+"(?="+Fn+")|"+Yn+Rn,"g");function In(t){return zr(t)?function(t){return t.match(Cn)||[]}(t):function(t){return t.split("")}(t)}function Hn(t,e,r){if((t=$t(t))&&(r||void 0===e))return Xr(t);if(!t||!(e=_t(e)))return t;var n=In(t),i=In(e),o=function(t,e){for(var r=-1,n=t.length;++r<n&&On(e,t[r],0)>-1;);return r}(n,i),u=function(t,e){for(var r=t.length;r--&&On(e,t[r],0)>-1;);return r}(n,i)+1;return function(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:Sn(t,e,r)}(n,o,u).join("")}function Un(t,e){if(!vn(t))return[];if(!vn(e))return[];let r=function(t,e){return vn(t)&&vn(e)?t.split(e):[]}(t,e);r=Tr(r,Hn);let n=[];return Pr(r,(function(t){vn(t)&&n.push(t)})),n}function qn(t){if(!bn(t))return!1;return gn(t)>=0}function Nn(t,e){return vn(t)&&qn(e)?0===(e=gn(e))?"":t.substring(0,e):""}function Wn(t,e){let r=Gr();if(n=t,"[object Array]"!==Object.prototype.toString.call(n)&&!jn(t))return r.reject("rs is not an array or object"),r;var n;let i=!1;if(jn(t)){i=!0;let e=[];Pr(t,((t,r)=>{e.push({k:r,v:t})})),t=e}$n(e)||(e=function(t){return t});let o=-1,u=[];return t.reduce((function(t,r){return t.then((function(t){u.push(t),o+=1;let n=o,s=r;return i&&(n=r.k,s=r.v),$n(e)?e(s,n):s}))}),Promise.resolve()).then((function(t){var e,n,i,o;u.push(t),o=null==(e=u)?0:e.length,u=o?Sn(e,(n=i||void 0===n?1:fn(n))<0?0:n,o):[],r.resolve(u)})).catch((function(t){r.reject(t)})),r}function Bn(t,e){if(!vn(t))return"";if(!qn(e))return"";if(0===(e=gn(e)))return"";let r=t.length-e;return r<0&&(r=0),t.substring(r,r+e)}function Qn(t,e){return vn(t)&&qn(e)?0===(e=gn(e))?t:Nn(t,t.length-e):""}function Vn(t){if(!vn(t))return"";let e=function(t){if(!vn(t))return{path:"",isRoot:!1};for(;t.indexOf("\\\\")>=0;)t=t.replace("\\\\","\\");for(;t.indexOf("//")>=0;)t=t.replace("//","/");if(":"===Bn(t,1))return{path:`${t}\\`,isRoot:!0};if("\\"===Bn(t,1)){let e=Qn(t,1);return":"===Bn(e,1)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}if("/"===Bn(t,1)){let e=Qn(t,1);return 0===e.length?{path:t,isRoot:!0}:{path:e,isRoot:!1}}return{path:t,isRoot:!1}}(t);if(e.isRoot)return e.path;let r=e.path;try{r=r.split("\\").pop().split("/").pop()}catch(t){}return r}function Zn(t){let e=Pt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs"),r=!1;try{e.statSync(t),r=!0}catch{r=!1}return r}function Gn(t){let e=Pt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");if(!Zn(t,{fs:e}))return!1;let r=e.lstatSync(t);return!r.isFile()&&!r.isSymbolicLink()}function Jn(t){return Gn(t,{fs:e})}function Kn(t){return function(t){let e=Pt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");return!!Zn(t,{fs:e})&&!e.lstatSync(t).isDirectory()&&!e.lstatSync(t).isSymbolicLink()}(t,{fs:e})}function Xn(t){return function(t){let e=Pt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");if(Gn(t,{fs:e}))return{success:"input folder is already exists: "+t};if(Zn(t,{fs:e}))return{error:"input path already exists: "+t};try{e.mkdirSync(t,{recursive:!0})}catch(t){return{error:t}}return{success:"done: "+t}}(t,{fs:e})}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ei={};!function(t,e){t.exports=function(){var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",o="minute",u="hour",s="day",a="week",c="month",f="quarter",l="year",h="date",p="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],r=t%100;return"["+t+(e[(r-20)%10]||e[r]||e[0])+"]"}},m=function(t,e,r){var n=String(t);return!n||n.length>=e?t:""+Array(e+1-n.length).join(r)+t},g={s:m,z:function(t){var e=-t.utcOffset(),r=Math.abs(e),n=Math.floor(r/60),i=r%60;return(e<=0?"+":"-")+m(n,2,"0")+":"+m(i,2,"0")},m:function t(e,r){if(e.date()<r.date())return-t(r,e);var n=12*(r.year()-e.year())+(r.month()-e.month()),i=e.clone().add(n,c),o=r-i<0,u=e.clone().add(n+(o?-1:1),c);return+(-(n+(r-i)/(o?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:l,w:a,d:s,D:h,h:u,m:o,s:i,ms:n,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},b="en",w={};w[b]=y;var j="$isDayjsObject",_=function(t){return t instanceof T||!(!t||!t[j])},$=function t(e,r,n){var i;if(!e)return b;if("string"==typeof e){var o=e.toLowerCase();w[o]&&(i=o),r&&(w[o]=r,i=o);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var s=e.name;w[s]=e,i=s}return!n&&i&&(b=i),i||!n&&b},S=function(t,e){if(_(t))return t.clone();var r="object"==typeof e?e:{};return r.date=t,r.args=arguments,new T(r)},k=g;k.l=$,k.i=_,k.w=function(t,e){return S(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var T=function(){function y(t){this.$L=$(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[j]=!0}var m=y.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,r=t.utc;if(null===e)return new Date(NaN);if(k.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var n=e.match(d);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return k},m.isValid=function(){return!(this.$d.toString()===p)},m.isSame=function(t,e){var r=S(t);return this.startOf(e)<=r&&r<=this.endOf(e)},m.isAfter=function(t,e){return S(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<S(t)},m.$g=function(t,e,r){return k.u(t)?this[e]:this.set(r,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var r=this,n=!!k.u(e)||e,f=k.p(t),p=function(t,e){var i=k.w(r.$u?Date.UTC(r.$y,e,t):new Date(r.$y,e,t),r);return n?i:i.endOf(s)},d=function(t,e){return k.w(r.toDate()[t].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(e)),r)},v=this.$W,y=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(f){case l:return n?p(1,0):p(31,11);case c:return n?p(1,y):p(0,y+1);case a:var b=this.$locale().weekStart||0,w=(v<b?v+7:v)-b;return p(n?m-w:m+(6-w),y);case s:case h:return d(g+"Hours",0);case u:return d(g+"Minutes",1);case o:return d(g+"Seconds",2);case i:return d(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var r,a=k.p(t),f="set"+(this.$u?"UTC":""),p=(r={},r[s]=f+"Date",r[h]=f+"Date",r[c]=f+"Month",r[l]=f+"FullYear",r[u]=f+"Hours",r[o]=f+"Minutes",r[i]=f+"Seconds",r[n]=f+"Milliseconds",r)[a],d=a===s?this.$D+(e-this.$W):e;if(a===c||a===l){var v=this.clone().set(h,1);v.$d[p](d),v.init(),this.$d=v.set(h,Math.min(this.$D,v.daysInMonth())).$d}else p&&this.$d[p](d);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[k.p(t)]()},m.add=function(n,f){var h,p=this;n=Number(n);var d=k.p(f),v=function(t){var e=S(p);return k.w(e.date(e.date()+Math.round(t*n)),p)};if(d===c)return this.set(c,this.$M+n);if(d===l)return this.set(l,this.$y+n);if(d===s)return v(1);if(d===a)return v(7);var y=(h={},h[o]=e,h[u]=r,h[i]=t,h)[d]||1,m=this.$d.getTime()+n*y;return k.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,r=this.$locale();if(!this.isValid())return r.invalidDate||p;var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=k.z(this),o=this.$H,u=this.$m,s=this.$M,a=r.weekdays,c=r.months,f=r.meridiem,l=function(t,r,i,o){return t&&(t[r]||t(e,n))||i[r].slice(0,o)},h=function(t){return k.s(o%12||12,t,"0")},d=f||function(t,e,r){var n=t<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(v,(function(t,n){return n||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return k.s(e.$y,4,"0");case"M":return s+1;case"MM":return k.s(s+1,2,"0");case"MMM":return l(r.monthsShort,s,c,3);case"MMMM":return l(c,s);case"D":return e.$D;case"DD":return k.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(r.weekdaysMin,e.$W,a,2);case"ddd":return l(r.weekdaysShort,e.$W,a,3);case"dddd":return a[e.$W];case"H":return String(o);case"HH":return k.s(o,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return d(o,u,!0);case"A":return d(o,u,!1);case"m":return String(u);case"mm":return k.s(u,2,"0");case"s":return String(e.$s);case"ss":return k.s(e.$s,2,"0");case"SSS":return k.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(n,h,p){var d,v=this,y=k.p(h),m=S(n),g=(m.utcOffset()-this.utcOffset())*e,b=this-m,w=function(){return k.m(v,m)};switch(y){case l:d=w()/12;break;case c:d=w();break;case f:d=w()/3;break;case a:d=(b-g)/6048e5;break;case s:d=(b-g)/864e5;break;case u:d=b/r;break;case o:d=b/e;break;case i:d=b/t;break;default:d=b}return p?d:k.a(d)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return w[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var r=this.clone(),n=$(t,e,!0);return n&&(r.$L=n),r},m.clone=function(){return k.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},y}(),O=T.prototype;return S.prototype=O,[["$ms",n],["$s",i],["$m",o],["$H",u],["$W",s],["$M",c],["$y",l],["$D",h]].forEach((function(t){O[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),S.extend=function(t,e){return t.$i||(t(e,T,S),t.$i=!0),S},S.locale=$,S.isDayjs=_,S.unix=function(t){return S(1e3*t)},S.en=w[b],S.Ls=w,S.p={},S}()}({get exports(){return ei},set exports(t){ei=t}});var ri=ei,ni={},ii={get exports(){return ni},set exports(t){ni=t}};const oi=r.createConnection,ui=n.EventEmitter,si=i.inherits,ai=o,ci=e,fi=u,li=s,hi=a,pi=c,di=f.nfc,vi=l("jsftp:general"),yi=l("jsftp:command"),mi=l("jsftp:response"),gi=function(){},bi={marks:[125,150],ignore:226},wi=/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/,ji=/\r\n|\n/;function _i(t){let e=gi,r=t+" ";for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];"function"==typeof i[i.length-1]&&(e=i.pop()),r+=i.join(" "),this.execute(r.trim(),e)}function $i(t){this.host=t.host||"localhost",this.port=t.port||21,this.user=t.user||"anonymous",this.pass=t.pass||"@anonymous",this.createSocket=t.createSocket,this.useList=t.useList||!1,this.commandQueue=[],ui.call(this),this.on("data",mi),this._createSocket(this.port,this.host)}si($i,ui),$i.prototype.raw=function(){_i.apply(this,arguments)},$i.prototype.reemit=function(t){return e=>{this.emit(t,e),vi(`event:${t}`,e||{})}},$i.prototype._createSocket=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gi;this.socket&&this.socket.destroy&&this.socket.destroy(),this.resParser&&this.resParser.end(),this.resParser=new li,this.authenticated=!1,this.socket=this.createSocket?this.createSocket({port:t,host:e},r):oi(t,e,r),this.socket.on("connect",this.reemit("connect")),this.socket.on("timeout",this.reemit("timeout")),this.pipeline=fi(this.socket,this.resParser),this.pipeline.on("data",(t=>{this.emit("data",t),mi(t.text),this.parseResponse(t)})),this.pipeline.on("error",this.reemit("error"))},$i.prototype.parseResponse=function(t){if(0===this.commandQueue.length)return;if([220].indexOf(t.code)>-1)return;const e=this.commandQueue[0].callback;if(t.isMark){if(!e.expectsMark||-1===e.expectsMark.marks.indexOf(t.code))return;e.expectsMark.ignore&&(this.ignoreCmdCode=e.expectsMark.ignore)}this.ignoreCmdCode!==t.code?this.parse(t,this.commandQueue.shift()):this.ignoreCmdCode=null},$i.prototype.send=function(t){t&&(yi(t),this.pipeline.write(t+"\r\n"),yi(t))},$i.prototype.nextCmd=function(){const t=this.commandQueue[0];!this.inProgress&&t&&(this.send(t.action),this.inProgress=!0)},$i.prototype.execute=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gi;if(this.socket&&this.socket.writable)return this.runCommand({action:t,callback:e});this.authenticated=!1,this._createSocket(this.port,this.host,(()=>{this.runCommand({action:t,callback:e})}))},$i.prototype.runCommand=function(t){if(this.authenticated||/^(feat|syst|user|pass)/.test(t.action))return this.commandQueue.push(t),void this.nextCmd();this.getFeatures((()=>{this.auth(this.user,this.pass,(()=>{this.commandQueue.push(t),this.nextCmd()}))}))},$i.prototype.parse=function(t,e){let r=null;t.isError&&(r=new Error(t.text||"Unknown FTP error."),r.code=t.code),this.inProgress=!1,e.callback(r,t),this.nextCmd()},$i.prototype.getPasvPort=function(t){const e=wi.exec(t);if(!e)return null;let r=e[1].replace(/,/g,".");return"127.0.0.1"===r&&(r=this.host),{host:r,port:256*(255&parseInt(e[2],10))+(255&parseInt(e[3],10))}},$i.prototype.hasFeat=function(t){return!!t&&this.features.indexOf(t.toLowerCase())>-1},$i.prototype._parseFeats=function(t){return t.split(ji).slice(1,-1).map((t=>t.trim().toLowerCase())).filter((t=>!!t))},$i.prototype.getFeatures=function(t){if(this.features)return t(null,this.features);this.raw("feat",((e,r)=>{this.features=e?[]:this._parseFeats(r.text),this.raw("syst",((e,r)=>{e||215!==r.code||(this.system=r.text.toLowerCase()),t(null,this.features)}))}))},$i.prototype.auth=function(t,e,r){if(!0===this.authenticating)return r(new Error("This client is already authenticating"));t||(t="anonymous"),e||(e="@anonymous"),this.authenticating=!0,this.raw("user",t,((n,i)=>{if(n||-1===[230,331,332].indexOf(i.code))return this.authenticating=!1,void r(n);this.raw("pass",e,((n,i)=>{this.authenticating=!1,n?r(n):[230,202].indexOf(i.code)>-1?(this.authenticated=!0,this.user=t,this.pass=e,this.raw("type","I",(()=>{r(void 0,i)}))):332===i.code&&this.raw("acct","")}))}))},$i.prototype.setType=function(t,e){if(t=t.toUpperCase(),this.type===t)return e();this.raw("type",t,((r,n)=>{r||(this.type=t),e(r,n)}))},$i.prototype.list=function(t,e){1===arguments.length&&(e=arguments[0],t="");let r="";e=pi(e),this.getPasvSocket(((n,i)=>{if(n)return e(n);function o(t,r){if(t)return e(t);bi.marks.some((t=>t===r.code))||e(new Error(`Expected marks ${bi.toString()} instead of: ${r.text}`))}i.setEncoding("utf8"),i.on("data",(t=>{r+=t})),this.pasvTimeout(i,e),i.once("close",(n=>n?e(n):r?void e(null,r):e({code:451,text:`Could not retrieve a file listing for ${t}.`,isMark:!1,isError:!0}))),i.once("error",e),o.expectsMark=bi,this.execute(`list ${t||""}`,o)}))},$i.prototype.emitProgress=function(t){this.emit("progress",{filename:t.filename,action:t.action,total:t.totalSize||0,transferred:t.socket["get"===t.action?"bytesRead":"bytesWritten"]})},$i.prototype.get=function(t,e){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gi;const i=typeof e;"function"===i?r=e:"string"===i&&(n=pi(n),r=(r,i)=>{if(r)return n(r);const o=ci.createWriteStream(e);o.on("error",n),i.on("readable",(()=>{this.emitProgress({filename:t,action:"get",socket:i})})),i.on("error",n),i.on("end",n),i.on("close",n),i.pipe(o)}),this.getGetSocket(t,pi(r))},$i.prototype.getGetSocket=function(t,e){e=pi(e),this.getPasvSocket(((r,n)=>{if(r)return i(r);function i(t,r){return t?(n&&n.destroy(),e(t)):n?125===r.code||150===r.code?e(null,n):(n.destroy(),e(new Error("Unexpected command "+r.text))):e(new Error("Error when retrieving PASV socket"))}n.on("error",(t=>{"ECONNREFUSED"===t.code&&(t.msg="Probably trying a PASV operation while one is in progress"),i(t)})),this.pasvTimeout(n,i),n.pause(),i.expectsMark=bi,this.execute("retr "+t,i)}))},$i.prototype.put=function(t,e,r){const n=(t,e,n)=>{t.on("readable",(()=>{this.emitProgress({filename:e,action:"put",socket:t,totalSize:n})})),this.getPutSocket(t,e,r)};t instanceof Buffer?this.getPutSocket(t,e,r):"string"==typeof t?ci.stat(t,((i,o)=>{if(i&&"ENOENT"===i.code)return r(new Error("Local file doesn't exist."));if(o.isDirectory())return r(new Error("Local path cannot be a directory"));const u=i?0:o.size;n(ci.createReadStream(t),e,u)})):t instanceof ai.Readable?n(t,e,0):r(new Error("Expected `from` parameter to be a Buffer, Stream, or a String"))},$i.prototype.getPutSocket=function(t,e,r){r=pi(r||gi),this.getPasvSocket(((n,i)=>{if(n)return i&&i.destroy(),r(n);i.on("close",r),i.on("error",r);const o=pi(((e,n)=>e?(i&&i.destroy(),r(e)):125!==n.code&&150!==n.code?(i&&i.destroy(),r(new Error("Unexpected command "+n.text))):(this.pasvTimeout(i,r),void(t instanceof Buffer?i.end(t):t instanceof ai.Readable&&t.pipe(i)))));o.expectsMark=bi,this.execute(`stor ${e}`,o)}))},$i.prototype.pasvTimeout=function(t,e){t.once("timeout",(()=>{vi("PASV socket timeout"),this.emit("timeout"),t.end(),e(new Error("Passive socket timeout"))}))},$i.prototype.getPasvSocket=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gi;t=pi(t),this.execute("pasv",((e,r)=>{if(e)return t(e);const n=this.getPasvPort(r.text);if(!n)return t(new Error("Bad passive host/port combination"));const i=this._pasvSocket=this.createSocket?this.createSocket(n):oi(n);i.setTimeout(this.timeout||6e5),i.once("close",(()=>{this._pasvSocket=void 0})),t(null,i)}))},$i.prototype.ls=function(t,e){function r(t,r){if(t)return e(t);hi.parseFtpEntries(r.text||r,((t,r)=>{if(t)return e(t);r.forEach((t=>{t.name=di(t.name)})),e(null,r)}))}this.useList?this.list(t,r):this.raw("stat",t,((e,n)=>{const i=e&&(502===e.code||500===e.code),o=this.system&&this.system.indexOf("hummingbird")>-1;i||o?(this.useList=!0,this.list(t,r)):r(e,n)}))},$i.prototype.rename=function(t,e,r){this.raw("rnfr",t,(t=>{if(t)return r(t);this.raw("rnto",e,r)}))},$i.prototype.keepAlive=function(t){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this._keepAliveInterval=setInterval(this.raw.bind(this,"noop"),t||3e4)},$i.prototype.destroy=function(){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this.socket&&this.socket.writable&&this.socket.end(),this._pasvSocket&&this._pasvSocket.writable&&this._pasvSocket.end(),this.resParser.end(),this.socket=void 0,this._pasvSocket=void 0,this.features=null,this.authenticated=!1};var Si=$i;!function(t){t.exports=Si}(ii);var ki=ti(ni);function Ti(t,e){return vn(t)&&qn(e)?0===(e=gn(e))?t:Bn(t,t.length-e):""}function Oi(t){"."===Nn(t,1)&&(t=Ti(t,1));let e=Un(t,"/");var r,n,i,o;e=(o=null==(r=e)?0:r.length)?Sn(r,0,(n=o-(n=i||void 0===n?1:fn(n)))<0?0:n):[];let u=[],s=".";return Pr(e,(t=>{s+="/"+t,u.push(s)})),u}var Pi=Math.max;var xi,Mi=(xi=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:fn(r);return i<0&&(i=Pi(n+i,0)),kn(t,wr(e),i)},function(t,e,r){var n=Object(t);if(!Le(t)){var i=wr(e);t=Ae(t),e=function(t){return i(n[t],t,n)}}var o=xi(t,e,r);return o>-1?n[i?t[o]:o]:void 0}),Fi="[object Boolean]";function zi(t){return!0===(e=t)||!1===e||O(e)&&T(e)==Fi;var e}function Di(t,e){var r=[];return Sr(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function Li(t,e){return(p(t)?te:Di)(t,wr(e))}var Ai=Array.prototype.join;function Ei(r){return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=1,i=Pt(r,"path"),o=Pt(r,"fs");if(!Gn(t,{fs:o}))throw new Error(`fd[${t}] is not a folder`);return null!==e&&wn(e)&&(e=gn(e),e<1&&(e=1)),function t(r){let u=[];return Gn(r,{fs:o})?(Pr(o.readdirSync(r),(function(s){let a=i.resolve(r,s),c=null;try{c=o.statSync(a)}catch(t){}c&&c.isDirectory()?(u.push({isFolder:!0,level:n,path:a,name:i.basename(a)}),n+=1,(n<=e||null===e)&&(u=u.concat(t(a))),n-=1):u.push({isFolder:!1,level:n,path:a,name:i.basename(a)})})),u):u}(t)}(r,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{path:t,fs:e})}async function Ri(r,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Jn(n))return Promise.reject(`fdLocal[${n}] is not a folder`);let o=Pt(i,"ftpLs");if(!$n(o))return Promise.reject("opt.ftpLs is not a function");let u=Pt(i,"levelLimit");wn(u)||(u=null),n=t.resolve(n);let s=e=>{let i=(e=t.resolve(e)).replace(n,""),o=new RegExp("\\\\","g");i=String(i).replace(o,"/");let u=r;var s,a;return"."===Nn(r,1)&&(u=Ti(r,1)),i=[...Un(u,"/"),...Un(i,"/")],a="/",i=null==(s=i)?"":Ai.call(s,a),i=`./${i}`,i},a=Ei(n,u);a=Li(a,(t=>!t.isFolder)),a=Tr(a,(t=>{let r=e.statSync(t.path);return t.size=Pt(r,"size",0),t.rpath=s(t.path),t}));let c=await function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=1;if(!$n(e))return Promise.reject("ftpLs is not a function");let i=Pt(r,"levelLimit");wn(i)||(i=null);let o=async t=>{let r=[],u=await e(t);return await Wn(u,(async e=>{let u=`${t}/${e.name}`;if(e.isFolder){if(r.push({...e,isFolder:!0,level:n,rpath:u,name:Vn(u)}),n+=1,n<=i||null===i){let t=await o(u);r=r.concat(t)}n-=1}else r.push({...e,isFolder:!1,level:n,rpath:u,name:Vn(u)})})),r};return o(t)}(r,o,{levelLimit:u});return c=Li(c,(t=>!t.isFolder)),c=Tr(c,(e=>{var i;return e.lpath=(i=e.rpath,"."!==r&&(i=i.replace(r,"")),"."===Nn(i,1)&&(i=Ti(i,1)),"/"===Nn(i,1)&&(i=Ti(i,1)),t.resolve(n,i)),e})),{fsRemote:c,fsLocal:a}}async function Yi(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=Pt(n,"ftpLs");if(!$n(i))return Promise.reject("opt.ftpLs is not a function");let o=Pt(n,"ftpDownload");if(!$n(o))return Promise.reject("opt.ftpDownload is not a function");let u=Pt(n,"forceOverwriteWhenSync");zi(u)||(u=!1);let s=Pt(n,"levelLimit");wn(s)||(s=null),Jn(e)||Xn(e);let a=await Ri(t,e,{ftpLs:i,levelLimit:s}),c=a.fsRemote,f=a.fsLocal,l=0,h=[];return await Wn(c,(async t=>{let e=Pt(t,"lpath",""),n=Mi(f,{path:e}),i=Pt(t,"rpath",""),s=Pt(t,"lpath",""),a=t=>{$n(r)&&r(t)};_n(n)?(u||t.size!==n.size)&&(await o(i,s,a),l++,h.push({path:t.rpath,reason:`size[${n.size}] of local file != size[${t.size}] of remote file`})):(await o(i,s,a),l++,h.push({path:t.rpath,reason:"no local file"}))})),{num:l,files:h}}async function Ci(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=Pt(n,"ftpLs");if(!$n(i))return Promise.reject("opt.ftpLs is not a function");let o=Pt(n,"ftpUpload");if(!$n(o))return Promise.reject("opt.ftpUpload is not a function");let u=Pt(n,"forceOverwriteWhenSync");zi(u)||(u=!1);let s=Pt(n,"levelLimit");wn(s)||(s=null);let a=await Ri(e,t,{ftpLs:i,levelLimit:s}),c=a.fsRemote,f=a.fsLocal,l=0,h=[];return await Wn(f,(async t=>{let e=Pt(t,"rpath",""),n=Mi(c,{rpath:e}),i=Pt(t,"rpath",""),s=Pt(t,"path",""),a=t=>{$n(r)&&r(t)};_n(n)?(u||t.size!==n.size)&&(await o(s,i,a),l++,h.push({name:t.rpath,reason:`size[${n.size}] of remote file != size[${t.size}] of local file`})):(await o(s,i,a),l++,h.push({name:t.rpath,reason:"no Remote file"}))})),{num:l,files:h}}function Ii(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null,i=Pt(r,"hostname");if(!vn(i))throw new Error(`hostname[${i}] is not an effective string`);let o=Pt(r,"port");wn(o)||(o=21),o=gn(o);let u=Pt(r,"username");if(!vn(u))throw new Error(`username[${u}] is not an effective string`);let s=Pt(r,"password");if(!vn(s))throw new Error(`password[${s}] is not an effective string`);let a=Pt(r,"timeLimit");function c(t){let e="";if(!yn(t)&&!vn(t))return e;try{let r=ri(t),n=r.format("YYYY-MM-DDTHH:mm:ss");n=`${n}+00:00`,r=ri(n),e=r.format("YYYY-MM-DDTHH:mm:ssZ")}catch(t){}return e}async function f(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",e=Gr();if(null===n)return e.reject("FTP has not been initialized. please use 'conn' to construct FTP"),e;let r=setTimeout((()=>{e.reject(`ftpLs timeout[${a}]`)}),a);return n.ls(t,((t,n)=>{clearTimeout(r),t?451===Pt(t,"code")?e.resolve([]):e.reject(t):(n=Tr(n,(t=>(t.mtime=c(t.time),t.size=gn(t.size),t.isFolder=v(t),t))),e.resolve(n))})),e}async function l(t,e){let r=Gr();if(null===n)return r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r;let i=setTimeout((()=>{r.reject(`ftpRaw[${t}] timeout[${a}]`)}),a);return n.raw(t,e,((t,e)=>{clearTimeout(i),t?r.reject(t):r.resolve(e)})),r}async function h(t){let e=Oi(t);return Vr(e)>=1&&await Wn(e,(async t=>{await y(t)||await async function(t){return l("mkd",t)}(t)})),"ok"}async function p(t){return l("cwd",t)}async function d(t){if(null===n)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let e={},r=null;if(await async function(t){return l("mlst",t)}(t).then((t=>{r=t})).catch((t=>{r={err:t.toString()}})),!_n(r))return Promise.reject("invalid result from ftpMlst");{let t=Pt(r,"text",""),n=t.indexOf("type=dir;")>=0,i=t.indexOf("type=file;")>=0,o=(t=>{let e=Un(t,";"),r="";return Pr(e,(t=>{if("modify="===Nn(t,7)){let e=Un(t,"=");r=Pt(e,1,"")}})),r})(t),u=c(o);e={...e,rmlst:r,mtime:u,isFolder:n,isFile:i}}let i=null;if(await async function(t){return l("size",t)}(t).then((t=>{i=t})).catch((t=>{i={err:t.toString()}})),!_n(i))return Promise.reject("invalid result from ftpSize");{let t=Pt(i,"code",""),r=Pt(i,"text","").replace(`${t} `,"");r=gn(r),e={...e,rsize:i,size:r}}return e}function v(t){if(!_n(t))return!1;let e;return e=Pt(t,"isFolder",!1),e||(e=1===Pt(t,"type",-1),e||e)}async function y(t){return v(await d(t))}function m(t){if(!_n(t))return!1;let e;return e=Pt(t,"isFile",!1),e||(e=0===Pt(t,"type",-1),e||e)}async function g(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=Gr();if(null===n)return u.reject("FTP has not been initialized. please use 'conn' to construct FTP"),u;if(!vn(r))return u.reject(`fpRemote[${r}] is not an effective string`),u;if(!vn(i))return u.reject(`fpLocal[${i}] is not an effective string`),u;let s=t.dirname(i);Kn(i)&&e.unlinkSync(i),Jn(s)||Xn(s);let c=await d(r);if(!m(c))return u.reject(`fpRemote[${r}] is not a file`),u;if(!_n(c)||(l="err",jn(f=c)&&(vn(l)||yn(l))&&l in f))return u.reject(`fpRemote[${r}] does not have information`),u;var f,l;let h=Pt(c,"size","");if(!yn(h))return u.reject(`can not get the size of file[${r}]`),u;h=gn(h);let p=setTimeout((()=>{u.reject(`ftpDownload timeout[${a}]`)}),a);return n.get(r,((t,n)=>{if(t)return clearTimeout(p),void u.reject(t);let s=e.createWriteStream(i),a=0;n.on("data",(t=>{if($n(o)){let e=Vr(t);a+=e,o({progress:a/h*100,name:Vn(i),fpRemote:r,fpLocal:i})}s.write(t)})),n.on("close",(()=>{s.end()})),s.on("finish",(()=>{clearTimeout(p),t?u.reject(t):u.resolve("ok")})),s.on("error",(t=>{console.log("writer error",t)})),n.resume()})),u}async function b(t,r,i){let o=null;if(null===n)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");if(!vn(r))return Promise.reject(`fpRemote[${r}] is not an effective string`);let u=Oi(r),s=r;if(Vr(u)>=1){await h(r);let t=Zr(u);await p(t),s="."+r.replace(t,"")}let c=await async function(t,r,i){let o=Gr();if(null===n)return o.reject("FTP has not been initialized. please use 'conn' to construct FTP"),o;if(!vn(r))return o.reject(`fpRemote[${r}] is not an effective string`),o;if(!vn(t))return o.reject(`fpLocal[${t}] is not an effective string`),o;if(!Kn(t))return o.reject(`fpLocal[${t}] is not a file`),o;let u=Pt(e.statSync(t),"size",0);if(!yn(u))return o.reject(`can not get the size of file[${t}]`),o;u=gn(u);let s=e.readFileSync(t),c=setTimeout((()=>{o.reject(`ftpUploadCore timeout[${a}]`)}),a),f=0;return n.put(s,r,((e,n)=>{if(e)return clearTimeout(c),void o.reject(e);if(0===Vr(n))return clearTimeout(c),void o.resolve("ok");if($n(i)){let e=Vr(n);f+=e,i({progress:f/u*100,name:Vn(t),fpRemote:r,fpLocal:t})}})),o}(t,s,i).catch((t=>{o=t}));return Vr(u)>=1&&await p("/"),null!==o?Promise.reject(o):c}return yn(a)||(a=6e4),a=gn(a),{conn:async function(){let t=Gr();try{n=new ki({host:i,port:o,user:u,pass:s}),t.resolve("ok")}catch(e){t.reject(e)}return t},quit:async function(){let t=Gr();if(null===n)return t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t;let e=()=>{let t=n.socket,e=n._pasvSocket;n.destroy(),t&&t.destroy(),e&&e.destroy(),n=null},r=setTimeout((()=>{e(),t.reject(`ftpQuit timeout[${a}]`)}),a);return n.raw("quit",((i,o)=>{clearTimeout(r),null!==n&&(e(),i?t.reject(i):t.resolve(o))})),t},ls:f,isFile:async function(t){return m(await d(t))},isFolder:y,download:g,upload:b,syncToLocal:async function(t,e,r){return Yi(t,e,r,{...arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},ftpLs:f,ftpDownload:g})},syncToRemote:async function(t,e,r){return Ci(t,e,r,{...arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},ftpLs:f,ftpUpload:b})},stat:d,mkdir:h,cwd:p,pwd:async function(){return l("pwd")}}}function Hi(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null,i=Pt(r,"hostname");if(!vn(i))throw new Error(`hostname[${i}] is not an effective string`);let o=Pt(r,"port");wn(o)||(o=22),o=gn(o);let u=Pt(r,"username");if(!vn(u))throw new Error(`username[${u}] is not an effective string`);let s=Pt(r,"password");if(!vn(s))throw new Error(`password[${s}] is not an effective string`);let a=Pt(r,"timeLimit");async function c(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",e=null,r=Gr();if(null===n)return r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r;let i=setTimeout((()=>{r.reject(`ftpLs timeout[${a}]`)}),a),o=await n.list(t).catch((t=>{e=t}));return clearTimeout(i),null!==e?(r.reject(e),r):(o=Tr(o,(t=>{let e;return e=ri(t.accessTime),t.atime=e.format("YYYY-MM-DDTHH:mm:ssZ"),e=ri(t.modifyTime),t.mtime=e.format("YYYY-MM-DDTHH:mm:ssZ"),t.isFolder=p(t),t})),r.resolve(o),r)}async function f(t){let e=Oi(t);if(Vr(e)>=1){let t=Zr(e);await async function(t){return n.mkdir(t,!0)}(t)}return"ok"}async function l(t){let e=null;return await n.stat(t).then((r=>{let n;n=ri(r.accessTime);let i=n.format("YYYY-MM-DDTHH:mm:ssZ");n=ri(r.modifyTime);let o=n.format("YYYY-MM-DDTHH:mm:ssZ");e={...r,atime:i,mtime:o,name:t}})).catch((t=>{e={err:t.toString()}})),e}function p(t){if(!_n(t))return!1;let e;return e=!0===Pt(t,"isDirectory",null),e||(e="d"===Pt(t,"type",""),e||!1)}function d(t){if(!_n(t))return!1;let e;return e=!0===Pt(t,"isFile",null),e||(e="-"===Pt(t,"type",""),e||e)}async function v(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=Gr();if(null===n)return u.reject("FTP has not been initialized. please use 'conn' to construct FTP"),u;if(!vn(r))return u.reject(`fpRemote[${r}] is not an effective string`),u;if(!vn(i))return u.reject(`fpLocal[${i}] is not an effective string`),u;let s=t.dirname(i);Jn(s)||Xn(s);let c=await l(r);if(!d(c))return u.reject(`fpRemote[${r}] is not a file`),u;if(!_n(c))return u.reject(`fpRemote[${r}] does not have information`),u;let f=Pt(c,"size","");if(!yn(f))return u.reject(`can not get the size of file[${r}]`),u;f=gn(f),Kn(i)&&e.unlinkSync(i);let h=setTimeout((()=>{u.reject(`ftpDownload timeout[${a}]`)}),a);return n.fastGet(r,i,{step:(t,e,n)=>{if($n(o)){o({progress:t/n*100,name:Vn(i),fpRemote:r,fpLocal:i})}}}).then((()=>{u.resolve("ok")})).catch((t=>{u.reject(t)})).finally((()=>{clearTimeout(h)})),clearTimeout(h),u}async function y(t,r,i){let o=Gr();if(null===n)return o.reject("FTP has not been initialized. please use 'conn' to construct FTP"),o;if(!vn(r))return o.reject(`fpRemote[${r}] is not an effective string`),o;if(!vn(t))return o.reject(`fpLocal[${t}] is not an effective string`),o;if(!Kn(t))return o.reject(`fpLocal[${t}] is not a file`),o;await f(r);let u=Pt(e.statSync(t),"size",0);if(!yn(u))return o.reject(`can not get the size of file[${t}]`),o;u=gn(u);let s=setTimeout((()=>{o.reject(`ftpUploadCore timeout[${a}]`)}),a);return n.fastPut(t,r,{step:(e,n,o)=>{if($n(i)){i({progress:e/o*100,name:Vn(t),fpRemote:r,fpLocal:t})}}}).then((()=>{o.resolve("ok")})).catch((t=>{o.reject(t)})).finally((()=>{clearTimeout(s)})),clearTimeout(s),o}return yn(a)||(a=6e4),a=gn(a),{conn:async function(){return n=new h,await n.connect({host:i,port:o,username:u,password:s}),"ok"},quit:async function(){let t=Gr();if(null===n)return t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t;let e=setTimeout((()=>{n.end(),n=null,t.reject(`ftpQuit timeout[${a}]`)}),a);try{n.end(),n=null,clearTimeout(e),t.resolve("ok")}catch(e){t.reject(e)}return t},ls:c,isFile:async function(t){return d(await l(t))},isFolder:async function(t){return p(await l(t))},download:v,upload:y,syncToLocal:async(t,e,r)=>Yi(t,e,r,{ftpLs:c,ftpDownload:v}),syncToRemote:async(t,e,r)=>Ci(t,e,r,{ftpLs:c,ftpUpload:y}),stat:l,mkdir:f,cwd:async function(t){return n.cwd(t)},pwd:async function(){return n.pwd()}}}async function Ui(){return null}async function qi(){return null}async function Ni(){return null}async function Wi(t){return null}async function Bi(t){return null}async function Qi(t,e){return null}async function Vi(t,e,r){return null}async function Zi(t,e,r){return null}async function Gi(t,e,r){return null}async function Ji(t){return null}async function Ki(t){return null}async function Xi(t){return null}async function to(t){return null}return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Pt(t,"transportation","FTP");if("FTP"!==e&&"SFTP"!==e)throw new Error(`transportation[${e}] is not FTP or SFTP`);let r=null;"FTP"===e?r=new Ii(t):"SFTP"===e&&(r=new Hi(t));let n={doc_conn:Ui,doc_quit:qi,doc_ls:Ni,doc_isFile:Wi,doc_isFolder:Bi,doc_download:Qi,doc_upload:Vi,doc_syncToLocal:Zi,doc_syncToRemote:Gi,doc_stat:Ji,doc_mkdir:Ki,doc_cwd:Xi,doc_pwd:to};return r.__doc___=n,r}}));
|
|
7
7
|
//# sourceMappingURL=w-ftp.umd.js.map
|