define(["jquery","cilantro/vendor/base"],function(a){var b=Base.extend({constructor:function(b,c){this.state="INIT",this.ds={},this.viewset=b,this.concept_pk=c,this.dom=a(),this.render(),this.dom.delegate("input,select,textarea","change keyup",a.proxy(this.elementChanged,this)),this.dom.bind("UpdateElementEvent",a.proxy(this.updateElement,this)),this.dom.bind("UpdateDSEvent",a.proxy(this.updateDS,this)),this.dom.bind("GainedFocusEvent",a.proxy(this.gainedFocus,this)),this.dom.bind("LostFocusEvent",a.proxy(this.lostFocus,this)),this.dom.bind("RegisterElementsEvent",a.proxy(this.registerElements,this)),this.dom.bind("HideDependentsEvent",a.proxy(this.hideDependents,this)),this.dom.bind("ShowDependentsEvent",a.proxy(this.showDependents,this))},render:function(){throw{name:"FunctionNotImplementedException",message:'This function needs to set the "dom" attribute of this object.'}},elementChanged:function(a){throw{name:"FunctionNotImplementedException",message:"This function needs to trigger an ElementChangedEvent with the new value of the evt.target."}},updateElement:function(a,b){throw{name:"FunctionNotImplementedException",message:"This function needs to find the element whose name = element.name, and set its value to element.value."}},updateDS:function(a,b){for(var c in b)this.updateElement("UpdateElementEvent",{name:c,value:b[c]});this.ds=b,this.dom.data("datasource",b)},registerElements:function(b){a("input,select",this.dom).change()},gainedFocus:function(){this.state="ONSCREEN"},lostFocus:function(){this.state="OFFSCREEN"},hideDependents:function(b){this.dom[0]!==(b.originalEvent?b.originalEvent.target:b.target)&&this.dom.has(b.target).length===0&&a("input,select,label",this.dom).attr("disabled","true").change()},showDependents:function(b){this.dom[0]!==(b.originalEvent?b.originalEvent.target:b.target)&&this.dom.has(b.target).length===0&&a("input,select,label",this.dom).filter(":disabled").removeAttr("disabled").change()}});return b})