(function(){var b={}.hasOwnProperty,c=function(g,e){for(var d in e){if(b.call(e,d)){g[d]=e[d]}}function f(){this.constructor=g}f.prototype=e.prototype;g.prototype=new f();g.__super__=e.prototype;return g},a=function(d,e){return function(){return d.apply(e,arguments)}};window.Controls.dialog=(function(e){c(d,e);function d(){return d.__super__.constructor.apply(this,arguments)}d.prototype.createDom=function(){var i,h,k,g,j,f,l=this;this.dom=$('<div class="control container dialog">\n    <div class="backdrop">\n        <div class="content">\n            <div class="children">\n            </div>\n        </div>\n    </div>\n</div>');this.childContainer=this.dom.find(".children");if(this.properties.buttons){this.buttons=$('<div class="buttons"></div>');this.dom.find(".content").append(this.buttons);h=new Controls.hc(this.ui);this.buttons.append(h.dom);j=this.properties.buttons;f=[];for(k=0,g=j.length;k<g;k++){i=j[k];f.push((function(n){var m;m=new Controls.button(l.ui,{text:n.text,icon:n.icon,style:"normal"});m.on_click=function(){return l.event("button",{button:n.id})};return h.append(m)})(i))}return f}};return d})(window.Control);window.Controls.inputdialog=(function(e){c(d,e);function d(){return d.__super__.constructor.apply(this,arguments)}d.prototype.createDom=function(){this.properties.buttons=[{text:"OK",id:"ok"},{text:"Cancel",id:"cancel"}];d.__super__.createDom.call(this);this.input=new Controls.textbox(this.ui,{value:this.properties.value},[]);return this.append(new Controls.pad(this.ui,{},[new Controls.hc(this.ui,{},[new Controls.label(this.ui,{text:this.properties.text},[]),this.input])]))};d.prototype.detectUpdates=function(){var f,g;f={};g=this.input.properties.value;if(g!==this.properties.value){f.value=g}this.properties.value=g;return f};return d})(Controls.dialog);window.Controls.openfiledialog=(function(e){c(d,e);function d(){return d.__super__.constructor.apply(this,arguments)}d.prototype.createDom=function(){var h,g,l,m,k,p,f,n,j,i,o=this;this.properties.buttons=[{text:"Cancel",id:"cancel"}];d.__super__.createDom.call(this);this.container=new Controls.list(this.ui);this.append(new Controls.pad(this.ui,{},[new Controls.box(this.ui,{width:"auto",height:300,scroll:true},[this.container])]));n=this.properties._dirs;l=function(q){var r;r=new Controls.hc(o.ui,{},[new Controls.icon(o.ui,{icon:"folder-open"}),new Controls.label(o.ui,{text:q})]);$(r.dom).click(function(){return o.event("item-click",{item:q})});return o.container.append(new Controls.listitem(o.ui,{},[r]))};for(m=0,p=n.length;m<p;m++){h=n[m];l(h)}j=this.properties._files;i=[];for(k=0,f=j.length;k<f;k++){g=j[k];i.push((function(q){var r;r=new Controls.hc(o.ui,{},[new Controls.icon(o.ui,{icon:"file"}),new Controls.label(o.ui,{text:q})]);$(r.dom).click(function(){return o.event("item-click",{item:q})});return o.container.append(new Controls.listitem(o.ui,{},[r]))})(g))}return i};return d})(Controls.dialog);window.Controls.opendirdialog=(function(e){c(d,e);function d(){return d.__super__.constructor.apply(this,arguments)}d.prototype.createDom=function(){var h,j,g,i,f,k=this;this.properties.buttons=[{text:"Select",id:"select"},{text:"Cancel",id:"cancel"}];d.__super__.createDom.call(this);this.container=new Controls.list(this.ui);this.append(new Controls.pad(this.ui,{},[new Controls.box(this.ui,{width:"auto",height:300,scroll:true},[this.container])]));i=this.properties._dirs;f=[];for(j=0,g=i.length;j<g;j++){h=i[j];f.push((function(l){var m;m=new Controls.hc(k.ui,{},[new Controls.icon(k.ui,{icon:"folder-open"}),new Controls.label(k.ui,{text:l})]);$(m.dom).click(function(){return k.event("item-click",{item:l})});return k.container.append(new Controls.listitem(k.ui,{},[m]))})(h))}return f};return d})(Controls.dialog);window.Controls.savefiledialog=(function(d){c(e,d);function e(){this.on_button=a(this.on_button,this);return e.__super__.constructor.apply(this,arguments)}e.prototype.createDom=function(){var h,j,g,i,f,k=this;this.properties.buttons=[{text:"Cancel",id:"cancel"},{text:"Save",id:"ok"}];e.__super__.createDom.call(this);this.input=new Controls.textbox(this.ui,{value:""});this.container=new Controls.list(this.ui);this.append(new Controls.pad(this.ui,{},[new Controls.vc(this.ui,{},[new Controls.box(this.ui,{width:"auto",height:300,scroll:true},[this.container]),new Controls.hc(this.ui,{},[new Controls.label(this.ui,{text:"Name: "}),this.input])])]));i=this.properties._dirs;f=[];for(j=0,g=i.length;j<g;j++){h=i[j];f.push((function(l){var m;m=new Controls.hc(k.ui,{},[new Controls.icon(k.ui,{icon:"folder-open"}),new Controls.label(k.ui,{text:l})]);$(m.dom).click(function(){return k.event("item-click",{item:l})});return k.container.append(new Controls.listitem(k.ui,{},[m]))})(h))}return f};e.prototype.on_button=function(f){if(f.button!=="ok"){return true}if(this.input.properties.value.length>0){return this.event("select",{path:this.properties.path+"/"+this.input.properties.value})}};return e})(Controls.dialog)}).call(this);