define(["scripts/upfront/preset-settings/show-state-settings-button","scripts/upfront/preset-settings/state-settings"],function(e,t){var n=Upfront.Views.Editor.Settings.Item.extend({className:"preset_specific",get_title:function(){return"Edit "+this.options.model.get("name")},initialize:function(n){this.options=n||{};var r=this,i=!1,s=!1,o=[new Upfront.Views.Editor.Field.Button({model:this.model,label:"Delete Preset",className:"delete_preset",compact:!0,on_click:function(){r.deletePreset()}})];_.each(this.options.stateFields,function(t,n){var r=new e({state:n});o.push(r),this.listenTo(r,"upfront:presets:state_show",this.showState),i||(i=r)},this),_.each(this.options.stateFields,function(e,n){var r=new t({model:this.model,fields:e,state:n});o.push(r),s?r.$el.hide():s=r},this),i.$el.addClass("active"),s.$el.show(),this.fields=_(o)},deletePreset:function(){this.trigger("upfront:presets:delete",this.model)},showState:function(e){this.$el.find(".state_settings_button").removeClass("active"),this.$el.find(".state_settings_button_"+e).addClass("active"),this.$el.find(".state_settings").hide(),this.$el.find(".state_settings_"+e).show()}});return n});