io-base-min.js revision 5e7b6e8d16b2bca98076a60e7bf31aa5120cb110
YUI.add("io-base",function(D){var d="io:start",P="io:complete",B="io:success",F="io:failure",e="io:end",X=0,O={"X-Requested-With":"XMLHttpRequest"},Z={},K=D.config.win;function L(){return K.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");}function E(){var Y=X;X++;return Y;}function W(g,Y){var f={};f.id=D.Lang.isNumber(Y)?Y:E();g=g||{};if(!g.use&&!g.upload){f.c=L();}else{if(g.use){if(g.use==="native"){if(K.XDomainRequest){f.c=new XDomainRequest();f.t=g.use;}else{f.c=L();}}else{f.c=D.io._transport[g.use];f.t=g.use;}}else{f.c={};}}return f;}function I(Y){if(K&&K.XMLHttpRequest){if(Y.c){Y.c.onreadystatechange=null;}}Y.c=null;Y=null;}function Q(h,i){var g=new D.EventTarget().publish("transaction:"+h),Y=i.arguments,f=i.context||D;if(Y){g.on(i.on[h],f,Y);}else{g.on(i.on[h],f);}return g;}function U(g,f){var Y=f.arguments;if(Y){D.fire(d,g,Y);}else{D.fire(d,g);}if(f.on&&f.on.start){Q("start",f).fire(g);}}function G(g,h){var f=g.e?{status:0,statusText:g.e}:g.c,Y=h.arguments;if(Y){D.fire(P,g.id,f,Y);}else{D.fire(P,g.id,f);}if(h.on&&h.on.complete){Q("complete",h).fire(g.id,f);}}function J(f,g){var Y=g.arguments;if(Y){D.fire(e,f.id,Y);}else{D.fire(e,f.id);}if(g.on&&g.on.end){Q("end",g).fire(f.id);}I(f);}function T(f,g){var Y=g.arguments;if(Y){D.fire(B,f.id,f.c,Y);}else{D.fire(B,f.id,f.c);}if(g.on&&g.on.success){Q("success",g).fire(f.id,f.c);}J(f,g);}function H(g,h){var f=g.e?{status:0,statusText:g.e}:g.c,Y=h.arguments;if(Y){D.fire(F,g.id,f,Y);}else{D.fire(F,g.id,f);}if(h.on&&h.on.failure){Q("failure",h).fire(g.id,f);}J(g,h);}function A(g,Y,h,f){I(g);h.xdr.use="flash";h.data=h.form&&f?f:null;return D.io(Y,h,g.id);}function R(Y,f){Y+=((Y.indexOf("?")==-1)?"?":"&")+f;return Y;}function V(Y,f){if(f){O[Y]=f;}else{delete O[Y];}}function C(g,Y){var f;Y=Y||{};for(f in O){if(O.hasOwnProperty(f)){if(Y[f]){continue;}else{Y[f]=O[f];}}}for(f in Y){if(Y.hasOwnProperty(f)){g.setRequestHeader(f,Y[f]);}}}function N(f,Y){if(f&&f.c){f.e=Y;f.c.abort();}}function S(f,Y){Z[f.id]=K.setTimeout(function(){N(f,"timeout");},Y);}function M(Y){K.clearTimeout(Z[Y]);delete Z[Y];}function b(g,h){var Y;try{if(g.c.status&&g.c.status!==0){Y=g.c.status;}else{Y=0;}}catch(f){Y=0;}if(Y>=200&&Y<300||Y===1223){T(g,h);}else{H(g,h);}}function c(Y,f){if(Y.c.readyState===4){if(f.timeout){M(Y.id);}K.setTimeout(function(){G(Y,f);b(Y,f);},0);}}function a(h,w,p){var q,g,t,k,Y,AA,n,y,l,z=h;w=D.Object(w);g=W(w.xdr||w.form,p);k=w.method?w.method=w.method.toUpperCase():w.method="GET";AA=w.sync;n=w.data;if(D.Lang.isObject(w.data)&&D.QueryString){w.data=D.QueryString.stringify(w.data);}if(w.form){if(w.form.upload){return D.io.upload(g,h,w);}else{q=D.io._serialize(w.form,w.data);if(k==="POST"||k==="PUT"){w.data=q;}else{if(k==="GET"){h=R(h,q);}}}}if(w.data&&k==="GET"){h=R(h,w.data);}if(w.data&&k==="POST"){w.headers=D.merge({"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},w.headers);}if(g.t){return D.io.xdr(h,g,w);}if(!AA){g.c.onreadystatechange=function(){c(g,w);};}try{g.c.open(k,h,AA?false:true);if(w.xdr&&w.xdr.credentials){g.c.withCredentials=true;}}catch(x){if(w.xdr){return A(g,z,w,n);}}C(g.c,w.headers);U(g.id,w);try{g.c.send(w.data||"");if(AA){t=g.c;y=["status","statusText","responseText","responseXML"];Y=w.arguments?{id:g.id,arguments:w.arguments}:{id:g.id};for(l=0;l<4;l++){Y[y[l]]=g.c[y[l]];}Y.getAllResponseHeaders=function(){return t.getAllResponseHeaders();};Y.getResponseHeader=function(f){return t.getResponseHeader(f);};G(g,w);b(g,w);return Y;}}catch(v){if(w.xdr){return A(g,z,w,n);}}if(w.timeout){S(g,w.timeout);}return{id:g.id,abort:function(){return g.c?N(g,"abort"):false;},isInProgress:function(){return g.c?g.c.readyState!==4&&g.c.readyState!==0:false;}};}a.start=U;a.complete=G;a.success=T;a.failure=H;a.end=J;a._id=E;a._timeout=Z;a.header=V;D.io=a;D.io.http=a;},"@VERSION@",{optional:["querystring-stringify-simple"],requires:["event-custom-base"]});