PluginProbe
WPIDE – File Manager & Code Editor / 3.0
WPIDE – File Manager & Code Editor v3.0
3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 3.4 All 54 releases
wpide / dist / js / chunks / FileManager / FileManager-Download.js

FileManager-Download.js in WPIDE – File Manager & Code Editor 3.0, at dist/js/chunks/FileManager/FileManager-Download.js

2 lines 14.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! For license information please see FileManager-Download.js.LICENSE.txt */
2 (self.webpackChunkwpide=self.webpackChunkwpide||[]).push([[243],{1599:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>s});r(6977);var n=r(124),o=r(8534),i=(r(8309),r(7327),r(1539),r(561),r(144)),a=r(8898),c=r(9696);const u={name:"Download",props:["zip","name","items","manager"],data:function(){return{max:100,downloading:!1,uniqid:null,totalSize:0,downloadedSize:0,cancelled:!1}},computed:{progress:function(){return Math.floor(this.downloadedSize/this.totalSize*100)}},mounted:function(){var t=this;return(0,o.Z)((0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.initDownload();case 2:case"end":return e.stop()}}),e)})))()},beforeDestroy:function(){this.cancelled=!0},methods:{initDownload:function(){var t=this;return(0,o.Z)((0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t.totalSize,e.next=3,t.getItemsSize(t.items,!0);case 3:return t.totalSize=e.t0+=e.sent,t.downloading=!0,e.next=7,t.processItems(t.items);case 7:if(t.downloading=!1,t.cancelled){e.next=20;break}if(!t.zip){e.next=17;break}return e.next=12,a.Z.zipItems({name:t.name,destination:t.$store.state.cwd.location,items:[],zipaction:"store",uniqid:t.uniqid});case 12:return t.hideModal(),e.next=15,t.manager.loadFiles();case 15:e.next=18;break;case 17:t.showModalDialog((0,c.__)("Download File","wpide"),(0,c.__)("Your file is ready","wpide"),(0,c.__)("Download","wpide"),(function(){window.open(i.default.config.baseURL+"/batchdownload&uniqid="+t.uniqid,"_blank")}));case 18:e.next=22;break;case 20:return e.next=22,a.Z.batchDownloadCancelled(t.uniqid);case 22:case"end":return e.stop()}}),e)})))()},getItemsSize:function(t){var e=arguments,r=this;return(0,o.Z)((0,n.Z)().mark((function o(){var i,a,c,u;return(0,n.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:i=e.length>1&&void 0!==e[1]&&e[1],a=0,u=0;case 3:if(!(u<t.length)){n.next=16;break}if(c=t[u],!i||"dir"!==c.type){n.next=12;break}return n.t0=a,n.next=9,r.manager.getFolderSize(c);case 9:a=n.t0+=n.sent,n.next=13;break;case 12:"file"===c.type&&(a+=c.size);case 13:u++,n.next=3;break;case 16:return n.abrupt("return",a);case 17:case"end":return n.stop()}}),o)})))()},processItems:function(t){var e=this;return(0,o.Z)((0,n.Z)().mark((function r(){var o,i,c,u,s;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t=(t=t&&t.length?t:[]).filter((function(t){return"back"!==t.type})),!(o=e.spliceIntoChunks(t,100))||!o.length){r.next=19;break}case 4:if(!(i=o.shift())||!i.length){r.next=18;break}return r.next=8,e.processChunk(i);case 8:c=r.sent,!e.uniqid&&c&&(e.uniqid=c);case 10:if("dir"!==(u=i.shift()).type){r.next=17;break}return r.next=14,a.Z.getDir({dir:u.path});case 14:return s=r.sent,r.next=17,e.processItems(s.files);case 17:if(i&&i.length&&!e.cancelled){r.next=10;break}case 18:if(o&&o.length&&!e.cancelled){r.next=4;break}case 19:case"end":return r.stop()}}),r)})))()},processChunk:function(t){var e=this;return(0,o.Z)((0,n.Z)().mark((function r(){var o,i;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o="create",e.uniqid&&(o="append"),!e.zip){r.next=8;break}return r.next=5,a.Z.zipItems({name:e.name,destination:e.$store.state.cwd.location,items:t,zipaction:o,uniqid:e.uniqid});case 5:i=r.sent,r.next=11;break;case 8:return r.next=10,a.Z.batchDownload({destination:e.$store.state.cwd.location,items:t,zipaction:o,uniqid:e.uniqid});case 10:i=r.sent;case 11:return r.t0=e.downloadedSize,r.next=14,e.getItemsSize(t);case 14:return e.downloadedSize=r.t0+=r.sent,r.abrupt("return",i&&i.uniqid?i.uniqid:null);case 16:case"end":return r.stop()}}),r)})))()},spliceIntoChunks:function(t,e){for(var r=[];t.length>0;){var n=t.splice(0,e);r.push(n)}return r}}};const s=(0,r(1001).Z)(u,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"download"},[e("b-progress",{attrs:{animated:!0,"show-value":!0,max:t.max,height:"1.5rem"}},[e("b-progress-bar",{attrs:{value:t.progress,label:"".concat((t.progress/t.max*100).toFixed(0),"%")}})],1)],1)}),[],!1,null,null,null).exports},7741:(t,e,r)=>{var n=r(1702),o=Error,i=n("".replace),a=String(o("zxcasd").stack),c=/\n\s*at [^:]*:[^\n]*/,u=c.test(a);t.exports=function(t,e){if(u&&"string"==typeof t&&!o.prepareStackTrace)for(;e--;)t=i(t,c,"");return t}},2914:(t,e,r)=>{var n=r(7293),o=r(9114);t.exports=!n((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",o(1,7)),7!==t.stack)}))},7762:(t,e,r)=>{"use strict";var n=r(9781),o=r(7293),i=r(9670),a=r(30),c=r(6277),u=Error.prototype.toString,s=o((function(){if(n){var t=a(Object.defineProperty({},"name",{get:function(){return this===t}}));if("true"!==u.call(t))return!0}return"2: 1"!==u.call({message:1,name:2})||"Error"!==u.call({})}));t.exports=s?function(){var t=i(this),e=c(t.name,"Error"),r=c(t.message);return e?r?e+": "+r:e:r}:u},9587:(t,e,r)=>{var n=r(614),o=r(111),i=r(7674);t.exports=function(t,e,r){var a,c;return i&&n(a=e.constructor)&&a!==r&&o(c=a.prototype)&&c!==r.prototype&&i(t,c),t}},8340:(t,e,r)=>{var n=r(111),o=r(8880);t.exports=function(t,e){n(e)&&"cause"in e&&o(t,"cause",e.cause)}},6277:(t,e,r)=>{var n=r(1340);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:n(t)}},2626:(t,e,r)=>{var n=r(3070).f;t.exports=function(t,e,r){r in t||n(t,r,{configurable:!0,get:function(){return e[r]},set:function(t){e[r]=t}})}},9191:(t,e,r)=>{"use strict";var n=r(5005),o=r(2597),i=r(8880),a=r(7976),c=r(7674),u=r(9920),s=r(2626),f=r(9587),l=r(6277),h=r(8340),p=r(7741),d=r(2914),v=r(9781),g=r(1913);t.exports=function(t,e,r,y){var m="stackTraceLimit",w=y?2:1,x=t.split("."),b=x[x.length-1],k=n.apply(null,x);if(k){var E=k.prototype;if(!g&&o(E,"cause")&&delete E.cause,!r)return k;var S=n("Error"),L=e((function(t,e){var r=l(y?e:t,void 0),n=y?new k(t):new k;return void 0!==r&&i(n,"message",r),d&&i(n,"stack",p(n.stack,2)),this&&a(E,this)&&f(n,this,L),arguments.length>w&&h(n,arguments[w]),n}));if(L.prototype=E,"Error"!==b?c?c(L,S):u(L,S,{name:!0}):v&&m in k&&(s(L,k,m),s(L,k,"prepareStackTrace")),u(L,k),!g)try{E.name!==b&&i(E,"name",b),E.constructor=L}catch(t){}return L}}},5069:(t,e,r)=>{"use strict";var n=r(2109),o=r(1702),i=r(3157),a=o([].reverse),c=[1,2];n({target:"Array",proto:!0,forced:String(c)===String(c.reverse())},{reverse:function(){return i(this)&&(this.length=this.length),a(this)}})},1703:(t,e,r)=>{var n=r(2109),o=r(7854),i=r(2104),a=r(9191),c="WebAssembly",u=o.WebAssembly,s=7!==Error("e",{cause:7}).cause,f=function(t,e){var r={};r[t]=a(t,e,s),n({global:!0,constructor:!0,arity:1,forced:s},r)},l=function(t,e){if(u&&u[t]){var r={};r[t]=a("WebAssembly."+t,e,s),n({target:c,stat:!0,constructor:!0,arity:1,forced:s},r)}};f("Error",(function(t){return function(e){return i(t,this,arguments)}})),f("EvalError",(function(t){return function(e){return i(t,this,arguments)}})),f("RangeError",(function(t){return function(e){return i(t,this,arguments)}})),f("ReferenceError",(function(t){return function(e){return i(t,this,arguments)}})),f("SyntaxError",(function(t){return function(e){return i(t,this,arguments)}})),f("TypeError",(function(t){return function(e){return i(t,this,arguments)}})),f("URIError",(function(t){return function(e){return i(t,this,arguments)}})),l("CompileError",(function(t){return function(e){return i(t,this,arguments)}})),l("LinkError",(function(t){return function(e){return i(t,this,arguments)}})),l("RuntimeError",(function(t){return function(e){return i(t,this,arguments)}}))},6647:(t,e,r)=>{var n=r(8052),o=r(7762),i=Error.prototype;i.toString!==o&&n(i,"toString",o)},3706:(t,e,r)=>{var n=r(7854);r(8003)(n.JSON,"JSON",!0)},2703:(t,e,r)=>{r(8003)(Math,"Math",!0)},8011:(t,e,r)=>{r(2109)({target:"Object",stat:!0,sham:!r(9781)},{create:r(30)})},489:(t,e,r)=>{var n=r(2109),o=r(7293),i=r(7908),a=r(9518),c=r(8544);n({target:"Object",stat:!0,forced:o((function(){a(1)})),sham:!c},{getPrototypeOf:function(t){return a(i(t))}})},8304:(t,e,r)=>{r(2109)({target:"Object",stat:!0},{setPrototypeOf:r(7674)})},2443:(t,e,r)=>{r(7235)("asyncIterator")},3680:(t,e,r)=>{var n=r(5005),o=r(7235),i=r(8003);o("toStringTag"),i(n("Symbol"),"Symbol")},8534:(t,e,r)=>{"use strict";r.d(e,{Z:()=>o});r(1539);function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}},124:(t,e,r)=>{"use strict";r.d(e,{Z:()=>o});r(2526),r(1817),r(1539),r(2165),r(8783),r(3948),r(2443),r(3680),r(3706),r(2703),r(9070),r(8011),r(1703),r(6647),r(489),r(9554),r(4747),r(8309),r(8304),r(5069),r(7042);var n=r(3336);function o(){o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return _()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h={};function p(){}function d(){}function v(){}var g={};s(g,a,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(Z([])));m&&m!==e&&r.call(m,a)&&(g=m);var w=v.prototype=p.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function o(i,a,c,u){var s=l(t[i],t,a);if("throw"!==s.type){var f=s.arg,h=f.value;return h&&"object"==(0,n.Z)(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(h).then((function(t){f.value=t,c(f)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}}function k(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function Z(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=v,s(w,"constructor",v),s(v,"constructor",d),d.displayName=s(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(b.prototype),s(b.prototype,c,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),s(w,u,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=Z,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:Z(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}}}]);