base-min.js revision 2980f571d488bbedf898e7bf587bdcd3020720a5
YUI.add("base",function(A){var J=A.Lang;function D(L){this._plugins={};this.after("init",function(P,O){this._initPlugins(O);});this.after("destroy",this._destroyPlugins);}D.prototype={plug:function(Q,L){if(Q){if(J.isFunction(Q)){this._plug(Q,L);}else{if(J.isArray(Q)){for(var O=0,P=Q.length;O<P;O++){this.plug(Q[O]);}}else{this._plug(Q.fn,Q.cfg);}}}return this;},unplug:function(L){if(L){this._unplug(L);}else{for(L in this._plugins){if(A.Object.owns(this._plugins,L)){this._unplug(L);}}}return this;},hasPlugin:function(L){return(this._plugins[L]&&this[L]);},_initPlugins:function(L){var P=this._getClasses(),Q,O;for(O=P.length-1;O>=0;O--){Q=P[O];if(Q.PLUGINS){this.plug(Q.PLUGINS);}}if(L&&L.plugins){this.plug(L.plugins);}},_destroyPlugins:function(){this._unplug();},_plug:function(P,L){if(P&&P.NS){var O=P.NS;L=L||{};L.owner=this;if(this.hasPlugin(O)){this[O].setAttrs(L);}else{this[O]=new P(L);this._plugins[O]=P;}}},_unplug:function(L){if(L){if(this[L]){this[L].destroy();delete this[L];}if(this._plugins[L]){delete this._plugins[L];}}}};A.PluginHost=D;var H=A.Object,I=".",F="destroy",N="init",M="initialized",G="destroyed",C="initializer",B=Object.prototype.constructor,K="destructor";function E(){A.Attribute.call(this);this.init.apply(this,arguments);}E.NAME="base";E.ATTRS={initialized:{readOnly:true,value:false},destroyed:{readOnly:true,value:false}};E._buildCfg={aggregates:["ATTRS","PLUGINS"]};E.build=function(L,S,W,V){var Y=E.build,O=Y._getClass(S,V),U=Y._getAggregates(S,V),Q=O._yuibuild.dynamic,T,R,P,X;if(Q){if(U){for(T=0,R=U.length;T<R;++T){P=U[T];if(S.hasOwnProperty(P)){O[P]=J.isArray(S[P])?[]:{};}}A.aggregate(O,S,true,U);}}for(T=0,R=W.length;T<R;T++){X=W[T];if(U){A.aggregate(O,X,true,U);}A.mix(O,X,true,null,1);O._yuibuild.exts.push(X);}O.prototype.hasImpl=Y._hasImpl;if(Q){O.NAME=L;O.prototype.constructor=O;}return O;};A.mix(E.build,{_template:function(L){function O(){O.superclass.constructor.apply(this,arguments);var R=O._yuibuild.exts,P=R.length,Q;for(Q=0;Q<P;Q++){R[Q].apply(this,arguments);}return this;}A.extend(O,L);return O;},_hasImpl:function(O){if(this.constructor._yuibuild){var Q=this.constructor._yuibuild.exts,L=Q.length,P;for(P=0;P<L;P++){if(Q[P]===O){return true;}}}return false;},_getClass:function(L,O){var P=(O&&false===O.dynamic)?false:true,Q=(P)?E.build._template(L):L;Q._yuibuild={id:null,exts:[],dynamic:P};return Q;},_getAggregates:function(L,O){var P=[],R=(O&&O.aggregates),S=L,Q;while(S&&S.prototype){Q=S._buildCfg&&S._buildCfg.aggregates;if(Q){P=P.concat(Q);}S=S.superclass?S.superclass.constructor:null;}if(R){P=P.concat(R);}return P;}});E.prototype={init:function(L){this.name=this.constructor.NAME;this._yuievt.config.prefix=this.name;this.publish(N,{queuable:false,defaultFn:this._defInitFn});A.PluginHost.call(this);this.fire(N,null,L);return this;},destroy:function(){this.publish(F,{queuable:false,defaultFn:this._defDestroyFn});this.fire(F);return this;},_defInitFn:function(O,L){this._initHierarchy(L);this._set(M,true);},_defDestroyFn:function(L){this._destroyHierarchy();this._set(G,true);},_getClasses:function(){if(!this._classes){this._initHierarchyData();}return this._classes;},_getAttrCfgs:function(){if(!this._attrs){this._initHierarchyData();}return this._attrs;},_filterAttrCfgs:function(P,L){var O={};if(P.ATTRS){A.each(P.ATTRS,function(R,Q){if(L[Q]){O[Q]=L[Q];delete L[Q];}});}return O;},_initHierarchyData:function(){var P=this.constructor,O=[],L=[];while(P&&P.prototype){O[O.length]=P;if(P.ATTRS){L[L.length]=P.ATTRS;}P=P.superclass?P.superclass.constructor:null;}this._classes=O;this._attrs=this._aggregateAttrs(L);},_aggregateAttrs:function(R){var L,P,O,U,T,Q,S={};if(R){for(Q=R.length-1;Q>=0;--Q){P=R[Q];for(L in P){if(P.hasOwnProperty(L)){O=A.merge(P[L]);U=O.value;if(U&&!O.useRef&&(B===U.constructor||J.isArray(U))){O.value=A.clone(U);}if(L.indexOf(I)!==-1){T=L.split(I);L=T.shift();}else{T=null;}if(T&&S[L]&&S[L].value){H.setValue(S[L].value,T,U);}else{if(!T){if(!S[L]){S[L]=O;}else{S[L]=A.mix(S[L],O,true);}}}}}}}return S;},_initHierarchy:function(S){var R,L,P,U,Q,O=this._getClasses(),T=this._getAttrCfgs();for(P=O.length-1;P>=0;P--){R=O[P];L=R.prototype;if(R._yuibuild&&R._yuibuild.exts&&!R._yuibuild.dynamic){for(U=0,Q=R._yuibuild.exts.length;U<Q;U++){R._yuibuild.exts[U].apply(this,arguments);}}this.addAttrs(this._filterAttrCfgs(R,T),S);if(L.hasOwnProperty(C)){L[C].apply(this,arguments);}}},_destroyHierarchy:function(){var R,O,Q,L,P=this._getClasses();for(Q=0,L=P.length;Q<L;Q++){R=P[Q];O=R.prototype;if(O.hasOwnProperty(K)){O[K].apply(this,arguments);}}},toString:function(){return this.constructor.NAME+"["+A.stamp(this)+"]";}};A.mix(E,A.Attribute,false,null,1);A.mix(E,A.PluginHost,false,null,1);E.prototype.constructor=E;A.Base=E;},"@VERSION@",{requires:["attribute"]});