attribute-min.js revision b739fa18392d5b0246ada4f88f0fde5cf67ef2fb
YUI.add("attribute-base",function(C){C.State=function(){this.data={};};C.State.prototype={add:function(O,Y,c){var b=this.data;b[Y]=b[Y]||{};b[Y][O]=c;},addAll:function(O,b){var Y;for(Y in b){if(b.hasOwnProperty(Y)){this.add(O,Y,b[Y]);}}},remove:function(O,Y){var b=this.data;if(b[Y]&&(O in b[Y])){delete b[Y][O];}},removeAll:function(O,b){var Y=this.data;C.each(b||Y,function(d,c){if(C.Lang.isString(c)){this.remove(O,c);}else{this.remove(O,d);}},this);},get:function(O,Y){var b=this.data;return(b[Y]&&O in b[Y])?b[Y][O]:undefined;},getAll:function(O){var b=this.data,Y;C.each(b,function(d,c){if(O in b[c]){Y=Y||{};Y[c]=d[O];}},this);return Y;}};var J=C.Object,F=C.Lang,K=C.EventTarget,V=".",T="Change",M="getter",L="setter",N="readOnly",W="writeOnce",a="validator",H="value",P="valueFn",E="broadcast",R="lazyAdd",Z="added",B="initializing",I="initValue",U="published",S="defaultValue",A="lazy",Q="isLazyAdd",G,X={};X[N]=1;X[W]=1;X[M]=1;X[E]=1;function D(){var b=this,O=this.constructor.ATTRS,Y=C.Base;b._ATTR_E_FACADE={};K.call(b,{emitFacade:true});b._conf=b._state=new C.State();b._stateProxy=b._stateProxy||null;b._requireAddAttr=b._requireAddAttr||false;if(O&&!(Y&&b instanceof Y)){b.addAttrs(C.merge(O));}}D.INVALID_VALUE={};G=D.INVALID_VALUE;D._ATTR_CFG=[L,M,a,H,P,W,N,R,E];D.prototype={addAttr:function(Y,O,c){var d=this,f=d._state,e,b;c=(R in O)?O[R]:c;if(c&&!d.attrAdded(Y)){f.add(Y,A,O||{});f.add(Y,Z,true);}else{if(!d.attrAdded(Y)||f.get(Y,Q)){O=O||{};b=(H in O);if(b){e=O.value;delete O.value;}O.added=true;O.initializing=true;f.addAll(Y,O);if(b){d.set(Y,e);}f.remove(Y,B);}}return d;},attrAdded:function(O){return !!this._state.get(O,Z);},modifyAttr:function(Y,O){var b=this,d,c;if(b.attrAdded(Y)){if(b._isLazyAttr(Y)){b._addLazyAttr(Y);}c=b._state;for(d in O){if(X[d]&&O.hasOwnProperty(d)){c.add(Y,d,O[d]);if(d===E){c.remove(Y,U);}}}}},removeAttr:function(O){this._state.removeAll(O);},get:function(O){return this._getAttr(O);},_isLazyAttr:function(O){return this._state.get(O,A);},_addLazyAttr:function(Y){var b=this._state,O=b.get(Y,A);b.add(Y,Q,true);b.remove(Y,A);this.addAttr(Y,O);},set:function(O,b,Y){return this._setAttr(O,b,Y);},reset:function(O){var b=this,Y;if(O){if(b._isLazyAttr(O)){b._addLazyAttr(O);}b.set(O,b._state.get(O,I));}else{Y=b._state.data.added;C.each(Y,function(c,d){b.reset(d);},b);}return b;},_set:function(O,b,Y){return this._setAttr(O,b,Y,true);},_getAttr:function(b){var c=this,g=b,d=c._state,e,O,f,Y;if(b.indexOf(V)!==-1){e=b.split(V);b=e.shift();}if(c._tCfgs&&c._tCfgs[b]){Y={};Y[b]=c._tCfgs[b];delete c._tCfgs[b];c._addAttrs(Y,c._tVals);}if(c._isLazyAttr(b)){c._addLazyAttr(b);}f=c._getStateVal(b);O=d.get(b,M);f=(O)?O.call(c,f,g):f;f=(e)?J.getValue(f,e):f;return f;},_setAttr:function(b,e,O,c){var g=true,Y=this._state,h=Y.data,f,i,j,d;if(b.indexOf(V)!==-1){i=b;j=b.split(V);b=j.shift();}if(this._isLazyAttr(b)){this._addLazyAttr(b);}f=(!h.value||!(b in h.value));if(this._requireAddAttr&&!this.attrAdded(b)){}else{if(!f&&!c){if(Y.get(b,W)){g=false;}if(Y.get(b,N)){g=false;}}if(g){if(!f){d=this.get(b);}if(j){e=J.setValue(C.clone(d),j,e);if(e===undefined){g=false;}}if(g){if(Y.get(b,B)){this._setAttrVal(b,i,d,e);}else{this._fireAttrChange(b,i,d,e,O);}}}}return this;},_fireAttrChange:function(f,e,c,b,O){var h=this,d=f+T,Y=h._state,g;if(!Y.get(f,U)){h.publish(d,{queuable:false,defaultFn:h._defAttrChangeFn,silent:true,broadcast:Y.get(f,E)});Y.add(f,U,true);}g=(O)?C.merge(O):h._ATTR_E_FACADE;g.type=d;g.attrName=f;g.subAttrName=e;g.prevVal=c;g.newVal=b;h.fire(g);},_defAttrChangeFn:function(O){if(!this._setAttrVal(O.attrName,O.subAttrName,O.prevVal,O.newVal)){O.stopImmediatePropagation();}else{O.newVal=this._getStateVal(O.attrName);}},_getStateVal:function(O){var Y=this._stateProxy;if(!Y||this.attrAdded(O)){return this._state.get(O,H);}else{return(Y&&Y[O]);}},_setStateVal:function(O,b){var Y=this._stateProxy;if(!Y||this.attrAdded(O)){this._state.add(O,H,b);}else{Y[O]=b;}},_setAttrVal:function(k,j,g,e){var l=this,h=true,b=l._state,c=b.get(k,a),f=b.get(k,L),i=b.get(k,B),Y=j||k,d,O;if(c){O=c.call(l,e,Y);if(!O&&i){e=b.get(k,S);O=true;}}if(!c||O){if(f){d=f.call(l,e,Y);if(d===G){h=false;}else{if(d!==undefined){e=d;}}}if(h){if(!j&&e===g&&!F.isObject(e)){h=false;}else{if(b.get(k,I)===undefined){b.add(k,I,e);}l._setStateVal(k,e);}}}else{h=false;}return h;},setAttrs:function(O,Y){return this._setAttrs(O,Y);},_setAttrs:function(Y,b){for(var O in Y){if(Y.hasOwnProperty(O)){this.set(O,Y[O]);}}return this;},getAttrs:function(O){return this._getAttrs(O);},_getAttrs:function(c){var e=this,g={},d,Y,O,f,b=(c===true);c=(c&&!b)?c:J.keys(e._state.data.added);for(d=0,Y=c.length;d<Y;d++){O=c[d];f=e.get(O);if(!b||e._getStateVal(O)!=e._state.get(O,I)){g[O]=e.get(O);}}return g;},addAttrs:function(O,Y,b){var c=this;if(O){c._tCfgs=O;c._tVals=c._normAttrVals(Y);c._addAttrs(O,c._tVals,b);c._tCfgs=c._tVals=null;}return c;},_addAttrs:function(Y,b,c){var e=this,O,d,f;for(O in Y){if(Y.hasOwnProperty(O)){d=Y[O];d.defaultValue=d.value;f=e._getAttrInitVal(O,d,e._tVals);if(f!==undefined){d.value=f;}if(e._tCfgs[O]){delete e._tCfgs[O];}e.addAttr(O,d,c);}}},_normAttrVals:function(O){return(O)?C.merge(O):null;},_getAttrInitVal:function(O,Y,b){var c=(!Y[N]&&b&&b.hasOwnProperty(O))?c=b[O]:(Y[P])?Y[P].call(this):Y[H];return c;}};C.mix(D,K,false,null,1);C.Attribute=D;},"@VERSION@",{requires:["event-custom"]});YUI.add("attribute-complex",function(B){var A=B.Object,C=".";B.Attribute.Complex=function(){};B.Attribute.Complex.prototype={_normAttrVals:function(G){var I={},H={},J,D,F,E;if(G){for(E in G){if(G.hasOwnProperty(E)){if(E.indexOf(C)!==-1){J=E.split(C);D=J.shift();F=H[D]=H[D]||[];F[F.length]={path:J,value:G[E]};}else{I[E]=G[E];}}}return{simple:I,complex:H};}else{return null;}},_getAttrInitVal:function(K,I,M){var E=(I.valueFn)?I.valueFn.call(this):I.value,D,F,H,G,N,L,J;if(!I.readOnly&&M){D=M.simple;if(D&&D.hasOwnProperty(K)){E=D[K];}F=M.complex;if(F&&F.hasOwnProperty(K)){J=F[K];for(H=0,G=J.length;H<G;++H){N=J[H].path;L=J[H].value;A.setValue(E,N,L);