loader-min.js revision f6d14b3bf6e08e09949f6a1e7d5431b7829f3550
YUI.add("loader",function(B){var N="base",M="css",H="js",E="pkg",K="animation",J="reset",S="fonts",O="grids",T="dragdrop",D="json",P="@VERSION@",A=P+"/build/";B.Env.meta={version:P,root:A,base:"http://yui.yahooapis.com/"+A,comboBase:"http://yui.yahooapis.com/combo?",modules:{basecss:{type:M,after:[J,S,O],path:"base/base.css"},fonts:{type:M},grids:{type:M,requires:[S],optional:[J]},log:{optional:[T],path:"log/logreader-min.js",skinnable:1},reset:{type:M},"reset-fonts-grids":{type:M,path:"reset-fonts-grids/reset-fonts-grids.css",supersedes:[J,S,O,"reset-fonts"],rollup:4},"reset-fonts":{type:M,path:"reset-fonts/reset-fonts.css",supersedes:[J,S],rollup:2},animation:{requires:["base"]},attribute:{},base:{requires:["attribute"]},classnamemanager:{},compat:{},cookie:{},css:{},"dd-ddm-base":{path:"dd/dd-ddm-base-min.js",requires:[N]},"dd-ddm":{path:"dd/dd-ddm-min.js",requires:["dd-ddm-base"]},"dd-ddm-drop":{path:"dd/dd-ddm-drop-min.js",requires:["dd-ddm"]},"dd-drag":{path:"dd/dd-drag-min.js",requires:["dd-ddm-base"]},"dd-drop":{path:"dd/dd-drop-min.js",requires:["dd-ddm-drop"]},"dd-proxy":{path:"dd/dd-proxy-min.js",requires:["dd-drag"]},"dd-constrain":{path:"dd/dd-constrain-min.js",requires:["dd-drag","dd-proxy"]},"dd-plugin":{path:"dd/dd-plugin-min.js",requires:["dd-drag"],optional:["dd-constrain","dd-proxy"]},"dd-drop-plugin":{path:"dd/dd-drop-plugin-min.js",requires:["dd-drop"]},"dd-drag-all":{path:"dd/dd-drag-all-min.js",supersedes:["dd-ddm-base","dd-ddm","dd-drag","dd-proxy","dd-constrain","dd-plugin","dd-drag-core","dd-drag-proxy"]},"dd-dragdrop-all":{path:"dd/dd-dragdrop-all-min.js",supersedes:["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-plugin","dd-drop","dd-drop-plugin","dd-drag-core","dd-drag-proxy"]},"dd-drop-core":{path:"dd/dd-drop-core-min.js",supersedes:["dd-ddm-drop","dd-drop","dd-plugin-drop"]},"dd-drag-core":{path:"dd/dd-drag-core-min.js",supersedes:["dd-ddm-base","dd-ddm","dd-drag","dd-plugin"]},"dd-drag-proxy":{path:"dd/dd-drag-proxy-min.js",supersedes:["dd-ddm-base","dd-ddm","dd-drag","dd-proxy","dd-plugin"]},dump:{},io:{},"json-parse":{path:"json/json-parse-min.js"},"json-stringify":{path:"json/json-stringify-min.js"},json:{supersedes:["json-parse","json-stringify"]},logreader:{requires:["css"]},profiler:{},queue:{},substitute:{optional:["dump"]},yuitestcore:{path:"yuitest/yuitest_core-min.js"},yuitest:{requires:["log"],supersedes:["yuitestcore"]}}};var G=B.Lang,Q=B.Env,F="_provides",R="_supersedes",C="expanded";var I={dupsAllowed:{},info:B.Env.meta};B.Loader=function(V){this._internalCallback=null;this._useYahooListener=false;this.scope=this;this.data=null;this.insertBefore=null;this.charset=null;this.varName=null;this.base=I.info.base;this.comboBase=I.info.comboBase;this.combine=false;this.ignoreRegistered=false;this.root=I.info.root;this.timeout=0;this.ignore=null;this.force=null;this.allowRollup=true;this.filter=null;this.required={};this.moduleInfo={};var U=I.info.modules;for(var L in U){if(U.hasOwnProperty(L)){this._internal=true;this.addModule(U[L],L);this._internal=false;}}this.rollups=null;this.loadOptional=false;this.sorted=[];this.loaded={};this.dirty=true;this.inserted={};this._config(V);};B.Loader.prototype={FILTERS:{RAW:{"searchExp":"-min\\.js","replaceStr":".js"},DEBUG:{"searchExp":"-min\\.js","replaceStr":"-debug.js"}},_config:function(V){if(V){for(var L in V){if(B.Object.owns(V,L)){if(L=="require"){this.require(V[L]);}else{if(L.indexOf("on")===0){this.subscribe(L.substr(2).toLowerCase(),V[L]);}else{this[L]=V[L];}}}}}var U=this.filter;if(G.isString(U)){U=U.toUpperCase();if(U==="DEBUG"){this.require("log");}if(!B.LogWriter){B.LogWriter=function(){return B;};}this.filter=this.FILTERS[U];}},addModule:function(U,L){U.name=U.name||L;if(!U||!U.name){return false;}if(!U.type){U.type=H;}if(!U.path&&!U.fullpath){U.path=L+"/"+L+"-min."+U.type;}U.ext=("ext" in U)?U.ext:(this._internal)?false:true;U.requires=U.requires||[];this.moduleInfo[L]=U;this.dirty=true;return U;},require:function(U){var L=(typeof U==="string")?arguments:U;this.dirty=true;B.mix(this.required,B.Array.hash(L));},getRequires:function(a){if(!a){return[];}if(!this.dirty&&a.expanded){return a.expanded;}var Y,Z=[],L=a.requires,U=a.optional,V=this.moduleInfo,W,X,b;for(Y=0;Y<L.length;Y=Y+1){Z.push(L[Y]);W=this.getModule(L[Y]);b=this.getRequires(W);for(X=0;X<b.length;X=X+1){Z.push(b[X]);}}L=a.supersedes;if(L){for(Y=0;Y<L.length;Y=Y+1){Z.push(L[Y]);W=this.getModule(L[Y]);b=this.getRequires(W);for(X=0;X<b.length;X=X+1){Z.push(b[X]);}}}if(U&&this.loadOptional){for(Y=0;Y<U.length;Y=Y+1){Z.push(U[Y]);b=this.getRequires(V[U[Y]]);for(X=0;X<b.length;X=X+1){Z.push(b[X]);}}}a.expanded=B.Object.keys(B.Array.hash(Z));return a.expanded;},getProvides:function(V,a){var U=!(a),L=(U)?F:R,X=this.getModule(V),W={};if(!X){return W;}if(X[L]){return X[L];}var e=X.supersedes,Y={},b=this;var d=function(f){if(!Y[f]){Y[f]=true;B.mix(W,b.getProvides(f));}};if(e){for(var Z=0;Z<e.length;Z=Z+1){d(e[Z]);}}X[R]=W;X[F]=B.merge(W);X[F][V]=true;return X[L];},calculate:function(L){if(L||this.dirty){this._config(L);this._setup();this._explode();if(this.allowRollup){this._rollup();}this._reduce();this._sort();this.dirty=false;}},_setup:function(){var X=this.moduleInfo,V,W,U;var L=B.merge(this.inserted);if(!this.ignoreRegistered){B.mix(L,YUI.Env.mods);}if(this.ignore){B.mix(L,B.Array.hash(this.ignore));}if(this.force){for(W=0;W<this.force.length;W=W+1){if(this.force[W] in L){delete L[this.force[W]];}}}for(U in L){if(B.Object.owns(L,U)){B.mix(L,this.getProvides(U));}}this.loaded=L;},_explode:function(){var W=this.required,U,L;for(U in W){if(W.hasOwnProperty(U)){L=this.getModule(U);var V=this.getRequires(L);if(V){B.mix(W,B.Array.hash(V));}}}},getModule:function(U){var L=this.moduleInfo[U];return L;},_rollup:function(){var Z,Y,X,b,a={},L=this.required,V,W=this.moduleInfo;if(this.dirty||!this.rollups){for(Z in W){if(W.hasOwnProperty(Z)){X=this.getModule(Z);if(X&&X.rollup){a[Z]=X;}}}this.rollups=a;}for(;;){var U=false;for(Z in a){if(!L[Z]&&!this.loaded[Z]){X=this.getModule(Z);
b=X.supersedes||[];V=false;if(!X.rollup){continue;}for(Y=0;Y<b.length;Y=Y+1){if(this.loaded[b[Y]]&&(!I.dupsAllowed[b[Y]])){V=false;break;}else{if(L[b[Y]]){c++;V=(c>=X.rollup);if(V){break;}}}}if(V){L[Z]=true;U=true;this.getRequires(X);}}}if(!U){break;}}},_reduce:function(){var V,U,W,L,X=this.required;for(V in X){if(V in this.loaded){delete X[V];}else{L=this.getModule(V);W=L&&L.supersedes;if(W){for(U=0;U<W.length;U=U+1){if(W[U] in X){delete X[W[U]];}}}}}},_onFailure:function(L){this.fire("failure",{msg:"operation failed: "+L,data:this.data});},_onTimeout:function(L){this.fire("timeout",{msg:"operation timed out: "+L,data:this.data});},_sort:function(){var g=B.Object.keys(this.required),U=this.moduleInfo,Y=this.loaded,Z=this;var h=function(k,n){var m=U[k];if(Y[n]||!m){return false;}var j,b=m.expanded,l=m.after,a=U[n];if(b&&B.Array.indexOf(b,n)>-1){return true;}if(l&&B.Array.indexOf(l,n)>-1){return true;}var i=U[n]&&U[n].supersedes;if(i){for(j=0;j<i.length;j=j+1){if(h(k,i[j])){return true;}}}if(m.ext&&m.type==M&&(!a.ext)){return true;}return false;};var L=0;for(;;){var V=g.length,f,e,X,W,d=false;for(X=L;X<V;X=X+1){f=g[X];for(W=X+1;W<V;W=W+1){if(h(f,g[W])){e=g.splice(W,1);g.splice(X,0,e[0]);d=true;break;}}if(d){break;}else{L=L+1;}}if(!d){break;}}this.sorted=g;},insert:function(V,U){this.calculate(V);if(!U){var L=this;this._internalCallback=function(){L._internalCallback=null;L.insert(null,H);};this.insert(null,M);return ;}this._loading=true;this._combineComplete=false;this.loadType=U;this.loadNext();},loadNext:function(Z){if(!this._loading){return ;}var e,Y,W,V,L;if(this.combine&&!this._combineComplete){this._combining=[];var e=this.sorted,Y=e.length,W,V,L=this.comboBase;for(W=0;W<Y;W=W+1){V=this.getModule(e[W]);if(V.type==H&&!V.ext){L+=this.root+V.path;if(W<Y){L+="&";}this._combining.push(e[W]);}}if(this._combining.length){var d=this,a=function(j){d._combineComplete=true;var k=d._combining,g=k.length,h,f;for(h=0;h<g;h=h+1){d.inserted[k[h]]=true;}d.loadNext(j.data);};B.Get.script(L,{data:e[W],onSuccess:a,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,timeout:this.timeout,scope:d});return ;}else{this._combineComplete=true;}}if(Z){if(Z!==this._loading){return ;}this.inserted[Z]=true;this.fire("progress",{name:Z,data:this.data});}var e=this.sorted,Y=e.length,W,V;for(W=0;W<Y;W=W+1){if(e[W] in this.inserted){continue;}if(e[W]===this._loading){return ;}V=this.getModule(e[W]);if(!V){var U="undefined module "+V;this.fire("failure",{msg:U,data:this.data});return ;}if(!this.loadType||this.loadType===V.type){this._loading=e[W];var b=(V.type===M)?B.Get.css:B.Get.script,L=V.fullpath||this._url(V.path),d=this,a=function(f){d.loadNext(f.data);};b(L,{data:e[W],onSuccess:a,insertBefore:this.insertBefore,charset:this.charset,varName:V.varName,onFailure:this._onFailure,onTimeout:this._onTimeout,timeout:this.timeout,scope:d});return ;}}this._loading=null;if(this._internalCallback){var X=this._internalCallback;this._internalCallback=null;X.call(this);}else{this._pushEvents();B.use(this);this.fire("success",{data:this.data});}},_pushEvents:function(U){var L=U||B;if(L.Event){L.Event._load();}},_url:function(V){var L=this.base||"",U=this.filter;L=L+V;if(U){L=L.replace(new RegExp(U.searchExp),U.replaceStr);}return L;}};B.augment(B.Loader,B.Event.Target);},"@VERSION@");