//>>built
define("dojox/mvc/StatefulArray",["dojo/_base/lang","dojo/Stateful"],function(g,m){function p(h){h._watchElementCallbacks&&h._watchElementCallbacks(void 0,[],[]);return h}var k=function(h){h=g._toArray(h||[]);h.constructor=k;return g.mixin(h,{pop:function(){return this.splice(this.get("length")-1,1)[0]},push:function(){this.splice.apply(this,[this.get("length"),0].concat(g._toArray(arguments)));return this.get("length")},reverse:function(){return p([].reverse.apply(this,g._toArray(arguments)))},shift:function(){return this.splice(0,
1)[0]},sort:function(){return p([].sort.apply(this,g._toArray(arguments)))},splice:function(c,a){var b=this.get("length");c+=0>c?b:0;var d=Math.min(c,b),f=this.slice(c,c+a),e=g._toArray(arguments).slice(2);[].splice.apply(this,[c,a].concat(Array(e.length)));for(var l=0;l<e.length;l++)this[d+l]=e[l];this._watchElementCallbacks&&this._watchElementCallbacks(c,f,e);this._watchCallbacks&&this._watchCallbacks("length",b,b-f.length+e.length);return f},unshift:function(){this.splice.apply(this,[0,0].concat(g._toArray(arguments)));
return this.get("length")},concat:function(c){return new k([].concat.apply(this,arguments))},join:function(c){for(var a=[],b=this.get("length"),d=0;d<b;d++)a.push(this.get(d));return a.join(c)},slice:function(c,a){var b=this.get("length");c+=0>c?b:0;a=(void 0===a?b:a)+(0>a?b:0);b=[];for(var d=c||0;d<Math.min(a,this.get("length"));d++)b.push(this.get(d));return new k(b)},watchElements:function(c){var a=this._watchElementCallbacks,b=this;a||(a=this._watchElementCallbacks=function(f,e,l){for(var q=[].concat(a.list),
n=0;n<q.length;n++)q[n].call(b,f,e,l)},a.list=[]);a.list.push(c);var d={};d.unwatch=d.remove=function(){for(var f=a.list,e=0;e<f.length;e++)if(f[e]==c){f.splice(e,1);break}};return d}},m.prototype,{set:function(c,a){if("length"==c){var b=this.get("length");b<a?this.splice.apply(this,[b,0].concat(Array(a-b))):a<b&&this.splice.apply(this,[a,b-a])}else b=this.length,m.prototype.set.call(this,c,a),b!=this.length&&m.prototype.set.call(this,"length",this.length);return this},isInstanceOf:function(c){return m.prototype.isInstanceOf.apply(this,
arguments)||c==k}})};k._meta={bases:[m]};return g.setObject("dojox.mvc.StatefulArray",k)});