if(typeof Solo=="undefined"){var Solo={}}if(typeof Solo.Update=="undefined"){Solo.Update={errorCallback:null,statistics:{inbytes:0,outbytes:0,files:0},factory:null,password:null,ajaxURL:null,mainURL:null,translations:{},nextStepUrl:"",finaliseUrl:""}}(function(a){Solo.Update.downloadErrorCallback=function(b){a("#downloadProgressInfo").hide();a("#downloadProgressBarContainer").addClass("progress-danger").removeClass("active").removeClass("progress-striped");a("#downloadErrorText").html(b);a("#downloadError").show("fast")};Solo.Update.extractErrorCallback=function(b){a("#extractProgressInfo").hide();a("#extractProgressBarContainer").addClass("progress-danger").removeClass("active").removeClass("progress-striped");a("#extractErrorText").html(b);a("#extractError").show("fast")};Solo.Update.nextStep=function(){window.location=Solo.Update.nextStepUrl};Solo.Update.onGenericError=function(b){alert(b)};Solo.Update.setProgressBar=function(c,b){if(b==undefined){b="downloadProgressBar"}var d=0;if(c<=1){d=100*c}else{d=c}if(d<0){d=0}if(d>100){d=100}if(d<100){a("#"+b+"Container").addClass("active");a("#"+b+"Container").addClass("progress-striped");a("#"+b+"Container").removeClass("progress-danger");a("#"+b+"Container").removeClass("progress-success")}else{a("#"+b+"Container").removeClass("active");a("#"+b+"Container").removeClass("progress-striped");a("#"+b+"Container").removeClass("progress-danger");a("#"+b+"Container").addClass("progress-success")}a("#"+b).css("width",d+"%");a("#"+b+"Info").text(d+"%");Piecon.setProgress(d)};Solo.Update.humanFileSize=function(b,e){var f=e?1000:1024;if(b=f);return b.toFixed(1)+" "+c[d]};Solo.Update.startDownload=function(){Solo.Update.setProgressBar(0,"downloadProgressBar");Piecon.setOptions({color:"#333333",background:"#e0e0e0",shadow:"#000000",fallback:"force"});a("#downloadProgressBarText").html("");var b={frag:-1,totalSize:-1};var c={task:"downloader",json:JSON.stringify(b)};Solo.System.doAjax(c,function(d){Solo.Update.stepDownload(d)},null,false)};Solo.Update.stepDownload=function(g){if(!g.status){if((g.errorCode>=300)&&(g.errorCode<500)){Solo.Update.downloadErrorCallback(Solo.Update.translations.ERR_INVALIDDOWNLOADID);return}Solo.Update.downloadErrorCallback(g.error);return}var b=0;var d=0;var f=0;var i=-1;if(g.totalSize!=undefined){b=g.totalSize}if(g.doneSize!=undefined){d=g.doneSize}if(g.percent!=undefined){f=g.percent}if(g.frag!=undefined){i=g.frag}Solo.Update.setProgressBar(f,"downloadProgressBar");a("#downloadProgressBarText").text(f.toFixed(1)+"%");var c={frag:i,totalSize:b,doneSize:d};post={task:"downloader",json:JSON.stringify(c)};if(f<100){Solo.System.doAjax(post,function(e){Solo.Update.stepDownload(e)},null,false)}else{Solo.Update.setProgressBar(100,"downloadProgressBar");try{Piecon.reset()}catch(h){}Solo.Update.nextStep()}};Solo.Update.pingExtract=function(){Solo.Update.statistics.files=0;Solo.Update.statistics.inbytes=0;Solo.Update.statistics.outbytes=0;var b={task:"ping"};Solo.System.doEncryptedAjax(b,function(c){Solo.Update.startExtract(c)},function(c){a("#extractProgress").hide();a("#extractPingError").show()})};Solo.Update.startExtract=function(){Solo.Update.statistics.files=0;Solo.Update.statistics.inbytes=0;Solo.Update.statistics.outbytes=0;var b={task:"startRestore"};Solo.System.doEncryptedAjax(b,function(c){Solo.Update.stepExtract(c)})};Solo.Update.stepExtract=function(c){if(c.status==false){Solo.System.errorCallback(c.message);return}if(c.totalsize!=undefined){if(is_array(c.filelist)){Solo.Update.statistics.totalSize=0;a.each(c.filelist,function(d,e){Solo.Update.statistics.totalSize+=e[1]})}Solo.Update.statistics.files=0;Solo.Update.statistics.inbytes=0;Solo.Update.statistics.outbytes=0}Solo.Update.statistics.files+=c.files;Solo.Update.statistics.inbytes+=c.bytesIn;Solo.Update.statistics.outbytes+=c.bytesOut;var b=0;if(Solo.Update.statistics.totalSize>0){b=100*Solo.Update.statistics.inbytes/Solo.Update.statistics.totalSize;if(b<0){b=0}else{if(b>100){b=100}}}if(c.done){b=100}Solo.Update.setProgressBar(b,"extractProgressBar");a("#extractProgressBarTextPercent").text(b.toFixed(1));a("#extractProgressBarTextIn").text(Solo.Update.humanFileSize(Solo.Update.statistics.inbytes,0)+" / "+Solo.Update.humanFileSize(Solo.Update.statistics.totalSize,0));a("#extractProgressBarTextOut").text(Solo.Update.humanFileSize(Solo.Update.outbytes,0));a("#extractProgressBarTextFile").text(c.lastfile);if(!empty(c.factory)){Solo.Update.factory=c.factory}if(c.done){Solo.Update.finalizeUpdate()}else{post={task:"stepRestore",factory:c.factory};Solo.System.doEncryptedAjax(post,function(d){Solo.Update.stepExtract(d)})}};Solo.Update.finalizeUpdate=function(){var b={task:"finalizeRestore",factory:Solo.Update.factory};Solo.System.doEncryptedAjax(b,function(c){window.location=Solo.Update.finaliseUrl})}}(akeeba.jQuery));