//>>built
define("dojox/form/manager/_NodeMixin","dojo/_base/lang dojo/_base/array dojo/on dojo/dom dojo/dom-attr dojo/query ./_Mixin dijit/form/_FormWidget dijit/_base/manager dojo/_base/declare".split(" "),function(h,g,u,n,l,k,m,v,w,x){m=h.getObject("dojox.form.manager",!0);var p=m.actionAdapter,y=m._keys,z=m.changeEvent=function(a){var b="click";switch(a.tagName.toLowerCase()){case "textarea":b="keyup";break;case "select":b="change";break;case "input":switch(a.type.toLowerCase()){case "text":case "password":b=
"keyup"}}return b},q=function(a,b){var e=l.get(a,"name");b=b||this.domNode;if(!e||e in this.formWidgets)e=null;else{for(var d=a;d&&d!==b;d=d.parentNode)if(l.get(d,"widgetId")&&w.byNode(d).isInstanceOf(v))return null;"input"==a.tagName.toLowerCase()&&"radio"==a.type.toLowerCase()?(d=(d=this.formNodes[e])&&d.node)&&h.isArray(d)?d.push(a):this.formNodes[e]={node:[a],connections:[]}:this.formNodes[e]={node:a,connections:[]}}return e},r=function(a){var b={};p(function(e,d){var f=l.get(d,"data-dojo-observer")||
l.get(d,"observer");f&&"string"==typeof f&&g.forEach(f.split(","),function(c){(c=h.trim(c))&&h.isFunction(this[c])&&(b[c]=1)},this)}).call(this,null,this.formNodes[a].node);return y(b)},t=function(a,b){var e=this.formNodes[a],d=e.connections;d.length&&(g.forEach(d,function(f){f.remove()}),d=e.connections=[]);p(function(f,c){var A=z(c);g.forEach(b,function(B){d.push(u(c,A,h.hitch(this,function(C){if(this.watching)this[B](this.formNodeValue(a),a,c,C)})))},this)}).call(this,null,e.node)};return x("dojox.form.manager._NodeMixin",
null,{destroy:function(){for(var a in this.formNodes)g.forEach(this.formNodes[a].connections,function(b){b.remove()});this.formNodes={};this.inherited(arguments)},registerNode:function(a){"string"==typeof a&&(a=n.byId(a));(a=q.call(this,a))&&t.call(this,a,r.call(this,a));return this},unregisterNode:function(a){a in this.formNodes&&(g.forEach(this.formNodes[a].connections,function(b){b.remove()}),delete this.formNodes[a]);return this},registerNodeDescendants:function(a){"string"==typeof a&&(a=n.byId(a));
k("input, select, textarea, button",a).map(function(b){return q.call(this,b,a)},this).forEach(function(b){b&&t.call(this,b,r.call(this,b))},this);return this},unregisterNodeDescendants:function(a){"string"==typeof a&&(a=n.byId(a));k("input, select, textarea, button",a).map(function(b){return l.get(a,"name")||null}).forEach(function(b){b&&this.unregisterNode(b)},this);return this},formNodeValue:function(a,b){var e=2==arguments.length&&void 0!==b;"string"==typeof a&&(a=this.formNodes[a])&&(a=a.node);
if(!a)return null;if(h.isArray(a)){if(e)return g.forEach(a,function(c){c.checked=""}),g.forEach(a,function(c){c.checked=c.value===b?"checked":""}),this;g.some(a,function(c){return c.checked?(f=c,!0):!1});return f?f.value:""}switch(a.tagName.toLowerCase()){case "select":if(a.multiple){if(e){if(h.isArray(b)){var d={};g.forEach(b,function(c){d[c]=1});k("\x3e option",a).forEach(function(c){c.selected=c.value in d});return this}k("\x3e option",a).forEach(function(c){c.selected=c.value===b});return this}var f=
k("\x3e option",a).filter(function(c){return c.selected}).map(function(c){return c.value});return 1==f.length?f[0]:f}return e?(k("\x3e option",a).forEach(function(c){c.selected=c.value===b}),this):a.value||"";case "button":return e?(a.innerHTML=""+b,this):a.innerHTML;case "input":if("checkbox"==a.type.toLowerCase())return e?(a.checked=b?"checked":"",this):!!a.checked}return e?(a.value=""+b,this):a.value},inspectFormNodes:function(a,b,e){var d,f={};if(b)if(h.isArray(b))g.forEach(b,function(c){c in
this.formNodes&&(f[c]=a.call(this,c,this.formNodes[c].node,e))},this);else for(d in b)d in this.formNodes&&(f[d]=a.call(this,d,this.formNodes[d].node,b[d]));else for(d in this.formNodes)f[d]=a.call(this,d,this.formNodes[d].node,e);return f}})});