loader-base-min.js revision e371fe50702011b7021c8d79181e88184c23448b
YUI.add("loader-base",function(A){(function(){var O=A.version,N=A.config,I="/build/",J=O+I,H=A.Env.base,D=N.gallery||"gallery-2010.03.10-18",L=D+I,G="2in3",E=N[G]||"1",C=N.yui2||"2.8.0",F=G+"."+E+"/"+C+I,K=H+"combo?",M={version:O,root:J,base:A.Env,comboBase:K,skin:{defaultSkin:"sam",base:"assets/skins/",path:"skin.css",after:["cssreset","cssfonts","cssreset-context","cssfonts-context"]},groups:{},modules:{},patterns:{}},B=M.groups;B[O]={};B.gallery={base:H+L,ext:false,combine:true,root:L,comboBase:K,patterns:{"gallery-":{}}};B.yui2={base:H+F,combine:true,ext:false,root:F,comboBase:K,patterns:{"yui2-":{configFn:function(P){if(/-skin|reset|fonts|grids|base/.test(P.name)){P.type="css";P.path=P.path.replace(/\.js/,".css");P.path=P.path.replace(/\/yui2-skin/,"/assets/skins/sam/yui2-skin");}}}}};YUI.Env[O]=M;}());(function(){var P={},D=[],E=(A.UA.ie)?2048:8192,C=YUI.Env,F=C._loaded,B="css",H="js",Q=A.version,G="",K=A.Object,N=A.Array,J=YUI.Env._loaderQueue,O=C[Q],I=A.Lang,M=A.cached(function(R,S,T,L){var U=R+"/"+S;if(!L){U+="-min";}U+="."+(T||B);return U;});A.Env.meta=O;A.Loader=function(U){var T=A.Env.meta.modules,R,S=C.mods,L=this;L.context=A;L.base=A.Env.meta.base;L.comboBase=A.Env.meta.comboBase;L.combine=U.base&&(U.base.indexOf(L.comboBase.substr(0,20))>-1);L.maxURLLength=E;L.root=A.Env.meta.root;L.timeout=0;L.forceMap={};L.allowRollup=true;L.filters={};L.required={};L.patterns={};L.moduleInfo={};L.groups=A.merge(A.Env.meta.groups);L.skin=A.merge(A.Env.meta.skin);L._internal=true;for(R in T){if(T.hasOwnProperty(R)){L.addModule(T[R],R);}}for(R in S){if(!L.moduleInfo[R]&&S[R].details){L.addModule(S[R].details,R);}}L._internal=false;L.sorted=[];L.loaded=F[Q];L.dirty=true;L.inserted={};L.skipped={};L.config=U;L._config(U);};A.Loader.prototype={FILTER_DEFS:{RAW:{"searchExp":"-min\\.js","replaceStr":".js"},DEBUG:{"searchExp":"-min\\.js","replaceStr":"-debug.js"}},SKIN_PREFIX:"skin-",_config:function(W){var S,R,V,T,U,X,L=this;if(W){for(S in W){if(W.hasOwnProperty(S)){V=W[S];if(S=="require"){L.require(V);}else{if(S=="groups"){for(R in V){if(V.hasOwnProperty(R)){X=R;U=V[R];L.addGroup(U,X);}}}else{if(S=="modules"){K.each(V,L.addModule,L);}else{if(S=="maxURLLength"){L[S]=Math.min(E,V);}else{L[S]=V;}}}}}}}T=L.filter;if(I.isString(T)){T=T.toUpperCase();L.filterName=T;L.filter=L.FILTER_DEFS[T];if(T=="DEBUG"){L.require("yui-log","dump");}}},formatSkin:function(S,L){var R=this.SKIN_PREFIX+S;if(L){R=R+"-"+L;}return R;},_addSkin:function(Y,W,X){var V,U,L=this.formatSkin(Y),T=this.moduleInfo,R=this.skin,S=T[W]&&T[W].ext;if(W){L=this.formatSkin(Y,W);if(!T[L]){V=T[W];U=V.pkg||W;this.addModule({name:L,group:V.group,type:"css",after:R.after,path:(X||U)+"/"+R.base+Y+"/"+W+".css",ext:S});}}return L;},addGroup:function(T,R){var S=T.modules,L=this;R=R||T.name;T.name=R;L.groups[R]=T;if(T.patterns){K.each(T.patterns,function(V,U){V.group=R;L.patterns[U]=V;});}if(S){K.each(S,function(V,U){V.group=R;L.addModule(V,U);},L);}},addModule:function(a,h){h=h||a.name;a.name=h;if(!a||!a.name){return false;}if(!a.type){a.type=H;}if(!a.path&&!a.fullpath){a.path=M(h,h,a.type);}a.ext=("ext" in a)?a.ext:(this._internal)?false:true;a.requires=a.requires||[];this.moduleInfo[h]=a;var e=a.submodules,d,b,L,X,S,Z,R,c,Y,W,V,U,T,g,f;if(e){L=a.supersedes||[];b=0;for(d in e){if(e.hasOwnProperty(d)){X=e[d];X.path=X.path||M(h,d,a.type);X.pkg=h;X.group=a.group;if(X.supersedes){L=L.concat(X.supersedes);}this.addModule(X,d);L.push(d);if(a.skinnable){S=this._addSkin(this.skin.defaultSkin,d,h);L.push(S.name);}if(X.lang&&X.lang.length){Y=N(X.lang);for(c=0;c<Y.length;c++){g=Y[c];W=this.getLangPackName(g,h);V=this.getLangPackName(g,d);S=this.moduleInfo[W];if(!S){S=this._addLangPack(g,a,W);}U=U||N.hash(S.supersedes);if(!(V in U)){S.supersedes.push(V);}a.lang=a.lang||[];T=T||N.hash(a.lang);if(!(g in T)){a.lang.push(g);}}}b++;}}a.supersedes=K.keys(N.hash(L));a.rollup=(b<4)?b:Math.min(b-1,4);}Z=a.plugins;if(Z){for(d in Z){if(Z.hasOwnProperty(d)){R=Z[d];R.path=R.path||M(h,d,a.type);R.requires=R.requires||[];R.group=a.group;this.addModule(R,d);if(a.skinnable){this._addSkin(this.skin.defaultSkin,d,h);}}}}this.dirty=true;if(a.configFn){f=a.configFn(a);if(f===false){delete this.moduleInfo[h];a=null;}}return a;},require:function(R){var L=(typeof R==="string")?arguments:R;this.dirty=true;A.mix(this.required,N.hash(L));},getRequires:function(a){if(!a||a._parsed){return D;}if(!this.dirty&&a.expanded&&(!a.langCache||a.langCache==this.lang)){return a.expanded;}a._parsed=true;var X,V,W,b,R,T,Z=[],L=a.requires,S=a.optional,Y=a.lang||a.intl,U=this.moduleInfo;for(X=0;X<L.length;X++){Z.push(L[X]);V=this.getModule(L[X]);b=this.getRequires(V);Y=Y||N.indexOf(b,"intl")>-1;for(W=0;W<b.length;W++){Z.push(b[W]);}}L=a.supersedes;if(L){for(X=0;X<L.length;X++){Z.push(L[X]);V=this.getModule(L[X]);b=this.getRequires(V);Y=Y||N.indexOf(b,"intl")>-1;for(W=0;W<b.length;W++){Z.push(b[W]);}}}if(S&&this.loadOptional){for(X=0;X<S.length;X++){Z.push(S[X]);b=this.getRequires(U[S[X]]);Y=Y||N.indexOf(b,"intl")>-1;for(W=0;W<b.length;W++){Z.push(b[W]);}}}a._parsed=false;if(Y){if(a.lang&&!a.langPack&&A.Intl){T=A.Intl.lookupBestLang(this.lang||G,a.lang);a.langCache=this.lang;R=this.getLangPackName(T,a.name);if(R){Z.unshift(R);}}Z.unshift("intl");}a.expanded=K.keys(N.hash(Z));return a.expanded;},getProvides:function(R){var L=this.getModule(R),T,S;if(!L){return P;}if(L&&!L.provides){T={};S=L.supersedes;if(S){N.each(S,function(U){A.mix(T,this.getProvides(U));},this);}T[R]=true;L.provides=T;}return L.provides;},calculate:function(R,L){if(R||L||this.dirty){this._config(R);this._setup();this._explode();if(this.allowRollup){this._rollup();}this._reduce();this._sort();}},_addLangPack:function(U,L,T){var S=L.name,R=M((L.pkg||S),T,H,true);this.addModule({path:R,intl:true,langPack:true,ext:L.ext,group:L.group,supersedes:[]},T,true);if(U){A.Env.lang=A.Env.lang||{};A.Env.lang[U]=A.Env.lang[U]||{};A.Env.lang[U][S]=true;}return this.moduleInfo[T];},_setup:function(){var U=this.moduleInfo,R,Z,Y,V,T,W,a,X,S,L;for(R in U){if(U.hasOwnProperty(R)){V=U[R];
if(V&&V.skinnable){T=this.skin.overrides;if(T&&T[R]){for(Z=0;Z<T[R].length;Z=Z+1){a=this._addSkin(T[R][Z],R);}}else{a=this._addSkin(this.skin.defaultSkin,R);}V.requires.push(a);}if(V&&V.lang&&V.lang.length){X=N(V.lang);for(Z=0;Z<X.length;Z=Z+1){S=X[Z];L=this.getLangPackName(S,R);this._addLangPack(S,V,L);}L=this.getLangPackName(G,R);this._addLangPack(null,V,L);}}}W=A.merge(this.inserted);if(!this.ignoreRegistered){A.mix(W,C.mods);}if(this.ignore){A.mix(W,N.hash(this.ignore));}for(Y in W){if(W.hasOwnProperty(Y)){A.mix(W,this.getProvides(Y));}}if(this.force){for(Z=0;Z<this.force.length;Z=Z+1){if(this.force[Z] in W){delete W[this.force[Z]];}}}A.mix(this.loaded,W);},getLangPackName:A.cached(function(R,L){return("lang/"+L+((R)?"_"+R:""));}),_explode:function(){var S=this.required,L,R;this.dirty=false;K.each(S,function(T,U){L=this.getModule(U);if(L){var V=L.expound;if(V){S[V]=this.getModule(V);R=this.getRequires(S[V]);A.mix(S,N.hash(R));}R=this.getRequires(L);A.mix(S,N.hash(R));}},this);},getModule:function(W){if(!W){return null;}var V,T,U,R,L=this.moduleInfo[W],S=this.patterns;if(!L){for(R in S){if(S.hasOwnProperty(R)){V=S[R];T=V.type;if(W.indexOf(R)>-1){U=V;break;}}}if(U){if(V.action){V.action.call(this,W,R);}else{L=this.addModule(A.merge(U),W);}}}return L;},_rollup:function(){},_reduce:function(){var S,R,U,L,V=this.required,T=this.loadType;for(S in V){if(V.hasOwnProperty(S)){L=this.getModule(S);if((this.loaded[S]&&(!this.forceMap[S])&&!this.ignoreRegistered)||(T&&L&&L.type!=T)){delete V[S];}else{U=L&&L.supersedes;if(U){for(R=0;R<U.length;R=R+1){if(U[R] in V){delete V[U[R]];}}}}}}},_finish:function(S,R){J.running=false;var L=this.onEnd;if(L){L.call(this.context,{msg:S,data:this.data,success:R});}this._continue();},_onSuccess:function(){var L=A.merge(this.skipped),R;K.each(L,function(S){delete this.inserted[S];},this);this.skipped={};R=this.onSuccess;if(R){R.call(this.context,{msg:"success",data:this.data,success:true,skipped:L});}this._finish("success",true);},_onFailure:function(S){var L=this.onFailure,R="failure: "+S.msg;if(L){L.call(this.context,{msg:R,data:this.data,success:false});}this._finish(R,false);},_onTimeout:function(){var L=this.onTimeout;if(L){L.call(this.context,{msg:"timeout",data:this.data,success:false});}this._finish("timeout",false);},_sort:function(){var e=K.keys(this.required),S=this.moduleInfo,X=this.loaded,W={},L=0,T,c,Z,V,U,Y,R,d=A.cached(function(k,h){var b=S[k],f,j,l,a=S[h],g;if(X[h]||!b||!a){return false;}j=b.expanded;l=b.after;if(j&&N.indexOf(j,h)>-1){return true;}if(l&&N.indexOf(l,h)>-1){return true;}g=S[h]&&S[h].supersedes;if(g){for(f=0;f<g.length;f=f+1){if(d(k,g[f])){return true;}}}if(b.ext&&b.type==B&&!a.ext&&a.type==B){return true;}return false;});for(;;){T=e.length;Y=false;for(V=L;V<T;V=V+1){c=e[V];for(U=V+1;U<T;U=U+1){R=c+e[U];if(!W[R]&&d(c,e[U])){Z=e.splice(U,1);e.splice(V,0,Z[0]);W[R]=true;Y=true;break;}}if(Y){break;}else{L=L+1;}}if(!Y){break;}}this.sorted=e;},_insert:function(S,T,R){if(S){this._config(S);}this.calculate(T);this.loadType=R;if(!R){var L=this;this._internalCallback=function(){var U=L.onCSS;if(U){U.call(L.context,A);}L._internalCallback=null;L._insert(null,null,H);};this._insert(null,null,B);return;}this._loading=true;this._combineComplete={};this.loadNext();},_continue:function(){if(!(J.running)&&J.size()>0){J.running=true;J.next()();}},insert:function(S,R){var L=this,T=A.merge(this,true);delete T.require;delete T.dirty;J.add(function(){L._insert(T,S,R);});this._continue();},loadNext:function(U){if(!this._loading){return;}var b,l,k,g,T,Y,V,f,X,a,h,L,W,e,S,Z,n,o,R=this.loadType,d=this,p=function(i){d.loadNext(i.data);},c=function(q){d._combineComplete[R]=true;var m,j=Z.length;for(m=0;m<j;m++){d.loaded[Z[m]]=true;d.inserted[Z[m]]=true;}p(q);};if(this.combine&&(!this._combineComplete[R])){Z=[];this._combining=Z;b=this.sorted;l=b.length;o=this.comboBase;T=o;n=[];e={};for(k=0;k<l;k++){W=o;g=this.getModule(b[k]);a=g&&g.group;if(a){X=this.groups[a];if(!X.combine){g.combine=false;continue;}g.combine=true;if(X.comboBase){W=X.comboBase;}if(X.root){g.root=X.root;}}e[W]=e[W]||[];e[W].push(g);}for(h in e){if(e.hasOwnProperty(h)){T=h;S=e[h];l=S.length;for(k=0;k<l;k++){g=S[k];if(g&&(g.type===R)&&(g.combine||!g.ext)){L=(g.root||this.root)+g.path;if((T!==h)&&(k<(l-1))&&((L.length+T.length)>this.maxURLLength)){n.push(this._filter(T));T=h;}T+=L;if(k<(l-1)){T+="&";}Z.push(g.name);}}if(Z.length&&(T!=h)){n.push(this._filter(T));}}}if(Z.length){if(R===B){Y=A.Get.css;f=this.cssAttributes;}else{Y=A.Get.script;f=this.jsAttributes;}Y(n,{data:this._loading,onSuccess:c,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,attributes:f,timeout:this.timeout,autopurge:false,context:this});return;}else{this._combineComplete[R]=true;}}if(U){if(U!==this._loading){return;}this.inserted[U]=true;this.loaded[U]=true;if(this.onProgress){this.onProgress.call(this.context,{name:U,data:this.data});}}b=this.sorted;l=b.length;for(k=0;k<l;k=k+1){if(b[k] in this.inserted){continue;}if(b[k]===this._loading){return;}g=this.getModule(b[k]);if(!g){V="Undefined module "+b[k]+" skipped";this.inserted[b[k]]=true;this.skipped[b[k]]=true;continue;}X=(g.group&&this.groups[g.group])||P;if(!R||R===g.type){this._loading=b[k];if(g.type===B){Y=A.Get.css;f=this.cssAttributes;}else{Y=A.Get.script;f=this.jsAttributes;}T=(g.fullpath)?this._filter(g.fullpath,b[k]):this._url(g.path,b[k],X.base||g.base);Y(T,{data:b[k],onSuccess:p,insertBefore:this.insertBefore,charset:this.charset,attributes:f,onFailure:this._onFailure,onTimeout:this._onTimeout,timeout:this.timeout,autopurge:false,context:d});return;}}this._loading=null;Y=this._internalCallback;if(Y){this._internalCallback=null;Y.call(this);}else{this._onSuccess();}},_filter:function(S,R){var U=this.filter,L=R&&(R in this.filters),T=L&&this.filters[R];if(S){if(L){U=(I.isString(T))?this.FILTER_DEFS[T.toUpperCase()]||null:T;}if(U){S=S.replace(new RegExp(U.searchExp,"g"),U.replaceStr);}}return S;},_url:function(S,L,R){return this._filter((R||this.base||"")+S,L);