//>>builtdefine("dojo/_base/kernel dojo/_base/lang dojo/_base/array dojo/_base/declare dojo/Stateful ./getStateful ./getPlainValue ./StatefulArray".split(" "),function(l,e,g,m,p,h,f,k){l.deprecated("dojox/mvc/StatefulModel","Use dojox/mvc/getStateful, dojox/mvc/getPlainValue, dojox/mvc/StatefulArray or one of the dojox/mvc/*RefControllers instead");vard=m("dojox.mvc.StatefulModel",[p],{data:null,store:null,valid:!0,value:"",reset:function(){if(!e.isObject(this.data)||this.datainstanceofDate||this.datainstanceofRegExp)this.set("value",this.data);elsefor(varainthis)this[a]&&e.isFunction(this[a].reset)&&this[a].reset()},commit:function(a){this._commit();(a=a||this.store)&&this._saveToStore(a)},toPlainObject:function(){returnf(this,d.getPlainValueOptions)},splice:function(a,b){for(varc=(newk([])).splice.apply(this,e._toArray(arguments)),d=0;d<c.length;d++)(this._removals=this._removals||[]).push(c[d].toPlainObject());returnc},add:function(a,b){if("number"===typeofthis.get("length")&&/^[0-9]+$/.test(a.toString())){if(this.get("length")<a-0)throwError("Out of bounds insert attempted, must be contiguous.");this.splice(a-0,0,b)}elsethis.set(a,b)},remove:function(a){if("number"===typeofthis.get("length")&&/^[0-9]+$/.test(a.toString()))if(this.get(a))this.splice(a-0,1);elsethrowError("Out of bounds delete attempted - no such index: "+n);else{varb=this.get(a);if(b)this._removals=this._removals||[],this._removals.push(b.toPlainObject()),this.set(a,void0),deletethis[a];elsethrowError("Illegal delete attempted - no such property: "+a);}},valueOf:function(){returnthis.toPlainObject()},toString:function(){return""===this.value&&this.data?this.data.toString():this.value.toString()},constructor:function(a){this._createModel(a&&"data"ina?a.data:this.data)},_createModel:function(a){if(null!=a)if(a=h(a,d.getStatefulOptions),e.isArray(a))this.length=0,[].splice.apply(this,a);elseif(e.isObject(a))for(varbina)a.hasOwnProperty(b)&&(this[b]=a[b]);elsethis.set("value",a)},_commit:function(){for(varainthis)this[a]&&e.isFunction(this[a]._commit)&&this[a]._commit();this.data=this.toPlainObject()},_saveToStore:function(a){this._removals&&(g.forEach(this._removals,function(b){a.remove(a.getIdentity(b))},this),deletethis._removals);varb=this.toPlainObject();e.isArray(b)?g.forEach(b,function(b){a.put(b)},this):a.put(b)}});e.mixin(d,{getStatefulOptions:{getType:function(a){returne.isArray(a)?"array":null!=a&&"[object Object]"=={}.toString.call(a)?"object":"value"},getStatefulArray:function(a){varb=this,c=e.mixin(newk(g.map(a,function(a){returnh(a,b)}))),f;for(find.prototype)"set"!=f&&(c[f]=d.prototype[f]);c.data=a;returnc},getStatefulObject:function(a){varb=newd;b.data=a;for(varcina)b.set(c,h(a[c],this));returnb},getStatefulValue:function(a){varb=newd;b.data=a;b.set("value",a);returnb}},getPlainValueOptions:{getType:function(a){if(e.isArray(a))return"array";if(e.isObject(a))for(varbina)if(a.hasOwnProperty(b)&&"value"!=b&&(a[b]||{}).get&&(a[b]||{}).watch)return"object";return"value"},getPlainArray:function(a){returng.map(a,function(a){returnf(a,this)},this)},getPlainObject:function(a){varb={},c;for(cina)"_watchCallbacks"==c||cind.prototype||(b[c]=f(a[c],this));returnb},getPlainValue:function(a){return(a||{}).set&&(a||{}).watch?f(a.value,this):a}}});returnd});