define(["ember","mm"],function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;return d=function(a,b){b=b||"";for(var c=1024,d=atob(a),e=d.length,f=Math.ceil(e/c),g=new Array(f),h=0;f>h;++h){for(var i=h*c,j=Math.min(i+c,e),k=new Array(j-i),l=i,m=0;j>l;++m,++l)k[m]=d[l].charCodeAt(0);g[h]=new Uint8Array(k)}return new Blob(g,{type:b})},g=function(a){return b.request({name:a},{module:"fileManager",action:"getBase64"})},c=a.Object.extend({thumbpath:function(){return"file:///"+this.get("thumb.src")}.property("thumb.src"),save:function(){return b.request({name:this.name,attrs:this.attrs},{module:"fileManager",action:"setAttrs"})},achieveBlob:function(){return g(this.name).then(function(a){return function(b){return a.set("blob",d(b,"image/jpg"))}}(this))},destroy:function(){return b.request({name:this.name},{module:"fileManager",action:"clean"})}}),n=k=i=null,f=b.comn({module:"instruction",action:"fileRoot"}).then(function(a){return n=a}),j=b.comn({module:"instruction",action:"resolveUserFolder"}).then(function(a){var b,c;return c=a.relativePath,b=a.absolutePath,k=c,i=b,c}),h=function(a){return new URL(a).pathname},l=function(a){return j.then(function(b){return""+b+"/"+a+"/fileLocal"})},m=function(a,b){return j.then(function(c){return""+c+"/"+b+"/resources"+h(a)})},e=function(a){var b,c,d,e,f,g;return g=a.url,e=a.path,b=a.cache,c=""+n+"/"+e+"/fileLocal",f=""+n+"/"+e+"/resources"+h(g),d={url:g,to:f,cache:b,terminal:{path:e,interceptor:{data:[c,{id:g,Status:"fetched"}],module:"repoManager",action:"patch"}},abort:{path:e,interceptor:{data:[c,{id:g,Status:"unreachable"}],module:"repoManager",action:"patch"}}}},a.CoreObject.extend({filter:function(a){return b.comn(a,{module:"fileManager",action:"queryAttrs"}).then(function(a){return a.map(function(a){return c.create(a)})})},thumb:function(a){return b.comn(a,{module:"fileManager",action:"thumb"}).then(function(a){return c.create(a)})},download:function(a){var c;return c=e(a),b.comn(c,{module:"fileManager",action:"download"})},downloadFM:function(a){var c,d,e;return d=a.folder,e=a.url,c=""+k+"/"+d+"/fileLocal",m(e,d).then(function(a){var d;return d={url:e,to:a,terminal:{interceptor:{data:[c,{id:e,Status:"fetched"}],module:"repoManager",action:"patch"}},abort:{interceptor:{data:[c,{id:e,Status:"unreachable"}],module:"repoManager",action:"patch"}}},b.comn(d,{module:"fileManager",action:"download"})})},achieveSync:function(a){var b,c,d;return b=a.folder,d=a.url,c=new URL(d).pathname,""+i+"/"+b+"/resources"+c},achieveThumb:function(a){var c,d,e,f,g,h;return e=a.folder,g=a.url,f=a.height,h=a.width,d=a.filePath,c=function(a){return b.comn({filePath:a,height:f,width:h},{module:"fileManager",action:"achieveThumb"})},d?c(d):m(g,e).then(c)},achieveScreenshot:function(a){var c,d,e,f;return e=a.folder,f=a.url,d=a.filePath,c=function(a){return b.comn({filePath:a},{module:"fileManager",action:"achieveScreenshot"})},d?c(d):m(f,e).then(c)}}).create()});