define(["ember","text!./image-local-tmpl.hbs","fm"],function(a,b,c){var d=function(a){var b=a;return/^\d+$/.test(a)&&(b=a+"px"),b};return a.Component.extend({tagName:"div",layout:a.Handlebars.compile(b),classNames:["image-local"],attributeBindings:["style"],style:function(){var a="";return this.get("maxWidth")?a+="width:"+d(this.get("maxWidth"))+";":this.get("width")&&(a+="width:"+d(this.get("width"))+";"),this.get("maxeight")?a+="height:"+d(this.get("maxHeight"))+";":this.get("height")&&(a+="height:"+d(this.get("height"))+";"),a}.property("width","height","maxWidth","maxHeight"),resource:"",type:"image",online:!0,status:"loading",mode:function(){var a={};return a[this.get("status")]=!0,a}.property("status"),getResource:function(){var a=this;this.get("online")?(this.set("resource",!this.get("thumbq")||!this.get("src")||this.get("src")instanceof Blob?this.get("src")||this.get("default"):"%@@%@w_%@h_%@q.jpg".fmt(this.get("src").replace(/@\d+w_\d+h_\d+q.jpg$/,""),this.get("maxWidth"),this.get("maxHeight"),this.get("thumbq"))),a.set("status","loaded")):"image"==this.get("type")&&this.get("src")?c.achieveThumb({filePath:this.get("src"),width:this.get("maxWidth"),height:this.get("maxHeight")}).then(function(b){a.set("resource",b),a.set("status","loaded")}):"video"==this.get("type")&&this.get("video")&&c.achieveScreenshot({filePath:this.get("video")}).then(function(b){a.set("resource",b),a.set("status","loaded")})},srcChanged:function(){this.setProperties({resource:"",status:"loading"}),this.getResource()}.observes("src"),domReady:function(){this.getResource()}.on("didInsertElement"),recycleImg:function(){console.log("willDestroyElement")}.on("willDestroyElement")})});