/**
 * Copyright (c) 2007-2010, Kaazing Corporation. All rights reserved.
 * 
 * Licensed under the Kaazing Corporation Developer Agreement (2010-02-22), see:
 * 
 *   http://www.kaazing.com/license
 */

var browser=null;
if(typeof (ActiveXObject)!="undefined"){
browser="ie";
}else{
if(typeof (window.addEventStream)==="function"){
browser="opera";
}else{
if(navigator.vendor.indexOf("Apple")!=-1){
browser="safari";
}else{
if(navigator.vendor.indexOf("Google")!=-1){
browser="chrome";
}else{
if(navigator.product=="Gecko"&&window.find&&!navigator.savePreferences){
browser="firefox";
}else{
throw new Error("couldn't detect browser");
}
}
}
}
}
switch(browser){
case "ie":
(function(){
if(document.createEvent===undefined){
var _1=function(){
};
_1.prototype.initEvent=function(_2,_3,_4){
this.type=_2;
this.bubbles=_3;
this.cancelable=_4;
};
document.createEvent=function(_5){
if(_5!="Events"){
throw new Error("Unsupported event name: "+_5);
}
return new _1();
};
}
document._w_3_c_d_o_m_e_v_e_n_t_s_createElement=document.createElement;
document.createElement=function(_6){
var _7=this._w_3_c_d_o_m_e_v_e_n_t_s_createElement(_6);
if(_7.addEventListener===undefined){
var _8={};
_7.addEventListener=function(_9,_a,_b){
return addEventListener(_8,_9,_a,_b);
};
_7.removeEventListener=function(_c,_d,_e){
return removeEventListener(_8,_c,_d,_e);
};
_7.dispatchEvent=function(_f){
return dispatchEvent(_8,_f);
};
}
return _7;
};
if(window.addEventListener===undefined){
var _10=document.createElement("div");
var _11=(typeof (postMessage)==="undefined");
window.addEventListener=function(_12,_13,_14){
if(_11&&_12=="message"){
_10.addEventListener(_12,_13,_14);
}else{
window.attachEvent("on"+_12,_13);
}
};
window.removeEventListener=function(_15,_16,_17){
if(_11&&_15=="message"){
_10.removeEventListener(_15,_16,_17);
}else{
window.detachEvent("on"+_15,_16);
}
};
window.dispatchEvent=function(_18){
if(_11&&_18.type=="message"){
_10.dispatchEvent(_18);
}else{
window.fireEvent("on"+_18.type,_18);
}
};
}
function addEventListener(_19,_1a,_1b,_1c){
if(_1c){
throw new Error("Not implemented");
}
var _1d=_19[_1a]||{};
_19[_1a]=_1d;
_1d[_1b]=_1b;
};
function removeEventListener(_1e,_1f,_20,_21){
if(_21){
throw new Error("Not implemented");
}
var _22=_1e[_1f]||{};
delete _22[_20];
};
function dispatchEvent(_23,_24){
var _25=_24.type;
var _26=_23[_25]||{};
for(var key in _26){
if(typeof (_26[key])=="function"){
try{
_26[key](_24);
}
catch(e){
}
}
}
};
})();
break;
case "chrome":
case "safari":
if(typeof (window.postMessage)==="undefined"&&typeof (window.dispatchEvent)==="undefined"&&typeof (document.dispatchEvent)==="function"){
window.dispatchEvent=function(_28){
document.dispatchEvent(_28);
};
var addEventListener0=window.addEventListener;
window.addEventListener=function(_29,_2a,_2b){
if(_29==="message"){
document.addEventListener(_29,_2a,_2b);
}else{
addEventListener0.call(window,_29,_2a,_2b);
}
};
var removeEventListener0=window.removeEventListener;
window.removeEventListener=function(_2c,_2d,_2e){
if(_2c==="message"){
document.removeEventListener(_2c,_2d,_2e);
}else{
removeEventListener0.call(window,_2c,_2d,_2e);
}
};
}
break;
case "opera":
var addEventListener0=window.addEventListener;
window.addEventListener=function(_2f,_30,_31){
var _32=_30;
if(_2f==="message"){
_32=function(_33){
if(_33.origin===undefined&&_33.uri!==undefined){
var uri=new URI(_33.uri);
delete uri.path;
delete uri.query;
delete uri.fragment;
_33.origin=uri.toString();
}
return _30(_33);
};
_30._$=_32;
}
addEventListener0.call(window,_2f,_32,_31);
};
var removeEventListener0=window.removeEventListener;
window.removeEventListener=function(_35,_36,_37){
var _38=_36;
if(_35==="message"){
_38=_36._$;
}
removeEventListener0.call(window,_35,_38,_37);
};
break;
}
function URI(str){
str=str||"";
var _3a=0;
var _3b=str.indexOf("://");
if(_3b!=-1){
this.scheme=str.slice(0,_3b);
_3a=_3b+3;
var _3c=str.indexOf("/",_3a);
if(_3c==-1){
_3c=str.length;
str+="/";
}
var _3d=str.slice(_3a,_3c);
this.authority=_3d;
_3a=_3c;
this.host=_3d;
var _3e=_3d.indexOf(":");
if(_3e!=-1){
this.host=_3d.slice(0,_3e);
this.port=parseInt(_3d.slice(_3e+1),10);
if(isNaN(this.port)){
throw new Error("Invalid URI syntax");
}
}
}
var _3f=str.indexOf("?",_3a);
if(_3f!=-1){
this.path=str.slice(_3a,_3f);
_3a=_3f+1;
}
var _40=str.indexOf("#",_3a);
if(_40!=-1){
if(_3f!=-1){
this.query=str.slice(_3a,_40);
}else{
this.path=str.slice(_3a,_40);
}
_3a=_40+1;
this.fragment=str.slice(_3a);
}else{
if(_3f!=-1){
this.query=str.slice(_3a);
}else{
this.path=str.slice(_3a);
}
}
};
(function(){
var _41=URI.prototype;
_41.toString=function(){
var sb=[];
var _43=this.scheme;
if(_43!==undefined){
sb.push(_43);
sb.push("://");
sb.push(this.host);
var _44=this.port;
if(_44!==undefined){
sb.push(":");
sb.push(_44.toString());
}
}
if(this.path!==undefined){
sb.push(this.path);
}
if(this.query!==undefined){
sb.push("?");
sb.push(this.query);
}
if(this.fragment!==undefined){
sb.push("#");
sb.push(this.fragment);
}
return sb.join("");
};
var _45={"http":80,"ws":81,"https":443,"wss":815};
})();
(function(){
Base64={};
Base64.encode=function(_46){
var _47=[];
var _48;
var _49;
var _4a;
while(_46.length){
switch(_46.length){
case 1:
_48=_46.shift();
_47.push(_4b[(_48>>2)&63]);
_47.push(_4b[((_48<<4)&48)]);
_47.push("=");
_47.push("=");
break;
case 2:
_48=_46.shift();
_49=_46.shift();
_47.push(_4b[(_48>>2)&63]);
_47.push(_4b[((_48<<4)&48)|((_49>>4)&15)]);
_47.push(_4b[(_49<<2)&60]);
_47.push("=");
break;
default:
_48=_46.shift();
_49=_46.shift();
_4a=_46.shift();
_47.push(_4b[(_48>>2)&63]);
_47.push(_4b[((_48<<4)&48)|((_49>>4)&15)]);
_47.push(_4b[((_49<<2)&60)|((_4a>>6)&3)]);
_47.push(_4b[_4a&63]);
break;
}
}
return _47.join("");
};
Base64.decode=function(_4c){
if(_4c.length===0){
return [];
}
if(_4c.length%4!==0){
throw new Error("Invalid base64 string (must be quads)");
}
var _4d=[];
for(var i=0;i<_4c.length;i+=4){
var _4f=_4c.charAt(i);
var _50=_4c.charAt(i+1);
var _51=_4c.charAt(i+2);
var _52=_4c.charAt(i+3);
var _53=_54[_4f];
var _55=_54[_50];
var _56=_54[_51];
var _57=_54[_52];
_4d.push(((_53<<2)&252)|((_55>>4)&3));
if(_51!="="){
_4d.push(((_55<<4)&240)|((_56>>2)&15));
if(_52!="="){
_4d.push(((_56<<6)&192)|(_57&63));
}
}
}
return _4d;
};
var _4b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
var _54={"=":0};
for(var i=0;i<_4b.length;i++){
_54[_4b[i]]=i;
}
if(typeof (window.btoa)==="undefined"){
window.btoa=function(s){
var _5a=s.split("");
for(var i=0;i<_5a.length;i++){
_5a[i]=(_5a[i]).charCodeAt();
}
return Base64.encode(_5a);
};
window.atob=function(_5c){
var _5d=Base64.decode(_5c);
for(var i=0;i<_5d.length;i++){
_5d[i]=String.fromCharCode(_5d[i]);
}
return _5d.join("");
};
}
})();
var postMessage0=(function(){
var _5f=new URI((browser=="ie")?document.URL:location.href);
var _60={"http":80,"https":443};
if(_5f.port==null){
_5f.port=_60[_5f.scheme];
_5f.authority=_5f.host+":"+_5f.port;
}
var _61=_5f.scheme+"://"+_5f.authority;
var _62="/.kr";
if(typeof (postMessage)!=="undefined"){
return function(_63,_64,_65){
switch(browser){
case "ie":
case "opera":
case "firefox":
setTimeout(function(){
_63.postMessage(_64,_65);
},0);
break;
default:
_63.postMessage(_64,_65);
break;
}
};
}else{
function MessagePipe(_66){
this.sourceToken=toPaddedHex(Math.floor(Math.random()*(Math.pow(2,32)-1)),8);
this.iframe=_66;
this.bridged=false;
this.lastWrite=0;
this.lastRead=0;
this.lastReadIndex=2;
this.lastSyn=0;
this.lastAck=0;
this.queue=[];
this.escapedFragments=[];
};
var _67=MessagePipe.prototype;
_67.attach=function(_68,_69,_6a,_6b,_6c,_6d){
this.target=_68;
this.targetOrigin=_69;
this.targetToken=_6a;
this.reader=_6b;
this.writer=_6c;
this.writerURL=_6d;
try{
this._lastHash=_6b.location.hash;
this.poll=pollLocationHash;
}
catch(permissionDenied){
this._lastDocumentURL=_6b.document.URL;
this.poll=pollDocumentURL;
}
if(_68==parent){
dequeue(this,true);
}
};
_67.detach=function(){
this.poll=function(){
};
delete this.target;
delete this.targetOrigin;
delete this.reader;
delete this.lastFragment;
delete this.writer;
delete this.writerURL;
};
_67.poll=function(){
};
function pollLocationHash(){
var _6e=this.reader.location.hash;
if(this._lastHash!=_6e){
process(this,_6e.substring(1));
this._lastHash=_6e;
}
};
function pollDocumentURL(){
var _6f=this.reader.document.URL;
if(this._lastDocumentURL!=_6f){
var _70=_6f.indexOf("#");
if(_70!=-1){
process(this,_6f.substring(_70+1));
this._lastDocumentURL=_6f;
}
}
};
_67.post=function(_71,_72,_73){
bridgeIfNecessary(this,_71);
var _74=1000;
var _75=escape(_72);
var _76=[];
while(_75.length>_74){
var _77=_75.substring(0,_74);
_75=_75.substring(_74);
_76.push(_77);
}
_76.push(_75);
this.queue.push([_73,_76]);
if(this.writer!=null&&this.lastAck>=this.lastSyn){
dequeue(this,false);
}
};
function bridgeIfNecessary(_78,_79){
if(_78.lastWrite<1&&!_78.bridged){
if(_79.parent==window){
var src=_78.iframe.src;
var _7b=src.split("#");
var _7c=null;
var _7d=document.getElementsByTagName("meta");
for(var i=0;i<_7d.length;i++){
if(_7d[i].name=="kaazing:resources"){
alert("kaazing:resources is no longer supported. Please refer to the Administrator's Guide section entitled \"Configuring a Web Server to Integrate with Kaazing Gateway\"");
}
}
var _7f=_61;
var _80=_7f.toString()+_62+"?.kr=xsp&.kv=9.06";
if(_7c){
var _81=new URI(_7f.toString());
var _7b=_7c.split(":");
_81.host=_7b.shift();
if(_7b.length){
_81.port=_7b.shift();
}
_80=_81.toString()+_62+"?.kr=xsp&.kv=9.06";
}
for(var i=0;i<_7d.length;i++){
if(_7d[i].name=="kaazing:postMessageBridgeURL"){
var _82=_7d[i].content;
var _83=new URI(_82);
var _84=new URI(location.toString());
if(!_83.authority){
_83.host=_84.host;
_83.port=_84.port;
_83.scheme=_84.scheme;
if(_82.indexOf("/")!=0){
var _85=_84.path.split("/");
_85.pop();
_85.push(_82);
_83.path=_85.join("/");
}
}
postMessage0.BridgeURL=_83.toString();
}
}
if(postMessage0.BridgeURL){
_80=postMessage0.BridgeURL;
}
var _86=["I",_7f,_78.sourceToken,escape(_80)];
if(_7b.length>1){
var _87=_7b[1];
_86.push(escape(_87));
}
_7b[1]=_86.join("!");
setTimeout(function(){
_79.location.replace(_7b.join("#"));
},200);
_78.bridged=true;
}
}
};
function flush(_88,_89){
var _8a=_88.writerURL+"#"+_89;
_88.writer.location.replace(_8a);
};
function fromHex(_8b){
return parseInt(_8b,16);
};
function toPaddedHex(_8c,_8d){
var hex=_8c.toString(16);
var _8f=[];
_8d-=hex.length;
while(_8d-->0){
_8f.push("0");
}
_8f.push(hex);
return _8f.join("");
};
function dequeue(_90,_91){
var _92=_90.queue;
var _93=_90.lastRead;
if((_92.length>0||_91)&&_90.lastSyn>_90.lastAck){
var _94=_90.lastFrames;
var _95=_90.lastReadIndex;
if(fromHex(_94[_95])!=_93){
_94[_95]=toPaddedHex(_93,8);
flush(_90,_94.join(""));
}
}else{
if(_92.length>0){
var _96=_92.shift();
var _97=_96[0];
if(_97=="*"||_97==_90.targetOrigin){
_90.lastWrite++;
var _98=_96[1];
var _99=_98.shift();
var _9a=3;
var _94=[_90.targetToken,toPaddedHex(_90.lastWrite,8),toPaddedHex(_93,8),"F",toPaddedHex(_99.length,4),_99];
var _95=2;
if(_98.length>0){
_94[_9a]="f";
_90.queue.unshift(_96);
}
if(_90.resendAck){
var _9b=[_90.targetToken,toPaddedHex(_90.lastWrite-1,8),toPaddedHex(_93,8),"a"];
_94=_9b.concat(_94);
_95+=_9b.length;
}
flush(_90,_94.join(""));
_90.lastFrames=_94;
_90.lastReadIndex=_95;
_90.lastSyn=_90.lastWrite;
_90.resendAck=false;
}
}else{
if(_91){
_90.lastWrite++;
var _94=[_90.targetToken,toPaddedHex(_90.lastWrite,8),toPaddedHex(_93,8),"a"];
var _95=2;
if(_90.resendAck){
var _9b=[_90.targetToken,toPaddedHex(_90.lastWrite-1,8),toPaddedHex(_93,8),"a"];
_94=_9b.concat(_94);
_95+=_9b.length;
}
flush(_90,_94.join(""));
_90.lastFrames=_94;
_90.lastReadIndex=_95;
_90.resendAck=true;
}
}
}
};
function process(_9c,_9d){
var _9e=_9d.substring(0,8);
var _9f=fromHex(_9d.substring(8,16));
var _a0=fromHex(_9d.substring(16,24));
var _a1=_9d.charAt(24);
if(_9e!=_9c.sourceToken){
throw new Error("postMessage emulation tampering detected");
}
var _a2=_9c.lastRead;
var _a3=_a2+1;
if(_9f==_a3){
_9c.lastRead=_a3;
}
if(_9f==_a3||_9f==_a2){
_9c.lastAck=_a0;
}
if(_9f==_a3||(_9f==_a2&&_a1=="a")){
switch(_a1){
case "f":
var _a4=_9d.substr(29,fromHex(_9d.substring(25,29)));
_9c.escapedFragments.push(_a4);
dequeue(_9c,true);
break;
case "F":
var _a5=_9d.substr(29,fromHex(_9d.substring(25,29)));
if(_9c.escapedFragments!==undefined){
_9c.escapedFragments.push(_a5);
_a5=_9c.escapedFragments.join("");
_9c.escapedFragments=[];
}
var _a6=unescape(_a5);
dispatch(_a6,_9c.target,_9c.targetOrigin);
dequeue(_9c,true);
break;
case "a":
if(_9d.length>25){
process(_9c,_9d.substring(25));
}else{
dequeue(_9c,false);
}
break;
default:
throw new Error("unknown postMessage emulation payload type: "+_a1);
}
}
};
function dispatch(_a7,_a8,_a9){
var _aa=document.createEvent("Events");
_aa.initEvent("message",false,true);
_aa.data=_a7;
_aa.origin=_a9;
_aa.source=_a8;
dispatchEvent(_aa);
};
var _ab={};
var _ac=[];
function pollReaders(){
for(var i=0,len=_ac.length;i<len;i++){
var _af=_ac[i];
_af.poll();
}
setTimeout(pollReaders,20);
};
function findMessagePipe(_b0){
if(_b0==parent){
return _ab["parent"];
}else{
if(_b0.parent==window){
var _b1=document.getElementsByTagName("iframe");
for(var i=0;i<_b1.length;i++){
var _b3=_b1[i];
if(_b0==_b3.contentWindow){
return supplyIFrameMessagePipe(_b3);
}
}
}else{
throw new Error("Generic peer postMessage not yet implemented");
}
}
};
function supplyIFrameMessagePipe(_b4){
var _b5=_b4._name;
if(_b5===undefined){
_b5="iframe$"+String(Math.random()).substring(2);
_b4._name=_b5;
}
var _b6=_ab[_b5];
if(_b6===undefined){
_b6=new MessagePipe(_b4);
_ab[_b5]=_b6;
}
return _b6;
};
function postMessage0(_b7,_b8,_b9){
if(_b7==window){
if(_b9=="*"||_b9==_61){
dispatch(_b8,window,_61);
}
}else{
var _ba=findMessagePipe(_b7);
_ba.post(_b7,_b8,_b9);
}
};
postMessage0.attach=function(_bb,_bc,_bd,_be,_bf,_c0){
var _c1=findMessagePipe(_bb);
_c1.attach(_bb,_bc,_bd,_be,_bf,_c0);
_ac.push(_c1);
};
var _c2=function(_c3){
var _c4=new URI((browser=="ie")?document.URL:location.href);
var _c5;
var _c6={"http":80,"https":443};
if(_c4.port==null){
_c4.port=_c6[_c4.scheme];
_c4.authority=_c4.host+":"+_c4.port;
}
var _c7=unescape(_c4.fragment||"");
if(_c7.length>0){
var _c8=_c7.split(",");
var _c9=_c8.shift();
var _ca=_c8.shift();
var _cb=_c8.shift();
var _cc=_c4.scheme+"://"+document.domain+":"+_c4.port;
var _cd=_c4.scheme+"://"+_c4.authority;
var _ce=_c9+"/.kr?.kr=xsc&.kv=9.06";
var _cf=document.location.toString().split("#")[0];
var _d0=_ce+"#"+escape([_cc,_ca,escape(_cf)].join(","));
if(typeof (ActiveXObject)!="undefined"){
_c5=new ActiveXObject("htmlfile");
_c5.open();
try{
_c5.parentWindow.opener=window;
}
catch(domainError){
if(_c3){
_c5.domain=_c3;
}
_c5.parentWindow.opener=window;
}
_c5.write("<html>");
_c5.write("<body>");
if(_c3){
_c5.write("<script>CollectGarbage();document.domain='"+_c3+"';</"+"script>");
}
_c5.write("<iframe src=\""+_ce+"\"></iframe>");
_c5.write("</body>");
_c5.write("</html>");
_c5.close();
var _d1=_c5.body.lastChild;
var _d2=_c5.parentWindow;
var _d3=parent;
var _d4=_d3.parent.postMessage0;
if(typeof (_d4)!="undefined"){
_d1.onload=function(){
var _d5=_d1.contentWindow;
_d5.location.replace(_d0);
_d4.attach(_d3,_c9,_cb,_d2,_d5,_ce);
};
}
}else{
var _d1=document.createElement("iframe");
_d1.src=_d0;
document.body.appendChild(_d1);
var _d2=window;
var _d6=_d1.contentWindow;
var _d3=parent;
var _d4=_d3.parent.postMessage0;
if(typeof (_d4)!="undefined"){
_d4.attach(_d3,_c9,_cb,_d2,_d6,_ce);
}
}
}
window.onunload=function(){
try{
var _d7=window.parent.parent.postMessage0;
if(typeof (_d7)!="undefined"){
_d7.detach(_d3);
}
}
catch(permissionDenied){
}
if(typeof (_c5)!=="undefined"){
_c5.parentWindow.opener=null;
_c5.open();
_c5.close();
_c5=null;
CollectGarbage();
}
};
};
postMessage0.__init__=function(_d8,_d9){
var _da=_c2.toString();
_d8.URI=URI;
_d8.browser=browser;
if(!_d9){
_d9="";
}
_d8.setTimeout("("+_da+")('"+_d9+"')",0);
};
postMessage0.bridgeURL=false;
postMessage0.detach=function(_db){
var _dc=findMessagePipe(_db);
for(var i=0;i<_ac.length;i++){
if(_ac[i]==_dc){
_ac.splice(i,1);
}
}
_dc.detach();
};
if(window!=top){
_ab["parent"]=new MessagePipe();
function initializeAsTargetIfNecessary(){
var _de=new URI((browser=="ie")?document.URL:location.href);
var _df=_de.fragment||"";
if(document.body!=null&&_df.length>0&&_df.charAt(0)=="I"){
var _e0=unescape(_df);
var _e1=_e0.split("!");
if(_e1.shift()=="I"){
var _e2=_e1.shift();
var _e3=_e1.shift();
var _e4=unescape(_e1.shift());
var _e5=_61;
if(_e2==_e5){
try{
parent.location.hash;
}
catch(permissionDenied){
document.domain=document.domain;
}
}
var _e6=_e1.shift()||"";
switch(browser){
case "firefox":
location.replace([location.href.split("#")[0],_e6].join("#"));
break;
default:
location.hash=_e6;
break;
}
var _e7=findMessagePipe(parent);
_e7.targetToken=_e3;
var _e8=_e7.sourceToken;
var _e9=_e4+"#"+escape([_e5,_e3,_e8].join(","));
var _ea;
_ea=document.createElement("iframe");
_ea.src=_e9;
_ea.style.position="absolute";
_ea.style.left="-10px";
_ea.style.top="10px";
_ea.style.visibility="hidden";
_ea.style.width="0px";
_ea.style.height="0px";
document.body.appendChild(_ea);
return;
}
}
setTimeout(initializeAsTargetIfNecessary,20);
};
initializeAsTargetIfNecessary();
}
var _eb=document.getElementsByTagName("meta");
for(var i=0;i<_eb.length;i++){
if(_eb[i].name==="kaazing:postMessage"){
if("immediate"==_eb[i].content){
var _ed=function(){
var _ee=document.getElementsByTagName("iframe");
for(var i=0;i<_ee.length;i++){
var _f0=_ee[i];
if(_f0.style["KaaPostMessage"]=="immediate"){
_f0.style["KaaPostMessage"]="none";
var _f1=supplyIFrameMessagePipe(_f0);
bridgeIfNecessary(_f1,_f0.contentWindow);
}
}
setTimeout(_ed,20);
};
setTimeout(_ed,20);
}
break;
}
}
for(var i=0;i<_eb.length;i++){
if(_eb[i].name==="kaazing:postMessagePrefix"){
var _f2=_eb[i].content;
if(_f2!=null&&_f2.length>0){
if(_f2.charAt(0)!="/"){
_f2="/"+_f2;
}
_62=_f2;
}
}
}
setTimeout(pollReaders,20);
return postMessage0;
}
})();
var XMLHttpRequest0=(function(){
var _f3=new URI((browser=="ie")?document.URL:location.href);
var _f4={"http":80,"https":443};
if(_f3.port==null){
_f3.port=_f4[_f3.scheme];
_f3.authority=_f3.host+":"+_f3.port;
}
var _f5={};
var _f6={};
var _f7=0;
function XMLHttpRequest0(){
if(browser=="firefox"&&typeof (Object.getPrototypeOf)=="function"){
var xhr=new XMLHttpRequest();
xhr.withCredentials=true;
return xhr;
}
};
var _f9=XMLHttpRequest0.prototype;
_f9.readyState=0;
_f9.responseText="";
_f9.status=0;
_f9.statusText="";
_f9.timeout=0;
_f9.onreadystatechange;
_f9.onerror;
_f9.onload;
_f9.onprogress;
_f9.open=function(_fa,_fb,_fc){
if(!_fc){
throw new Error("Asynchronous is required for cross-origin XMLHttpRequest emulation");
}
switch(this.readyState){
case 0:
case 4:
break;
default:
throw new Error("Invalid ready state");
}
if(this._id===undefined){
var id=toPaddedHex(_f7++,8);
_f6[id]=this;
this._id=id;
}
if(_fb.indexOf(".kv=")==-1){
_fb+=((_fb.indexOf("?")==-1)?"?":"&")+".kv=9.06";
}else{
_fb=_fb.replace(/\.kv=[^&]*(.*)/,".kv=9.06$1");
}
var uri=new URI(_fb);
var _ff=(uri.scheme!=null&&uri.authority!=null);
var _100=_ff?uri.scheme:_f3.scheme;
var _101=_ff?uri.authority:_f3.authority;
if(_101!=null&&uri.port==null){
_101=uri.host+":"+_f4[_100];
}
var _102=_100+"://"+_101;
var pipe=_f5[_102];
if(pipe===undefined){
var _104=document.createElement("iframe");
_104.style.position="absolute";
_104.style.left="-10px";
_104.style.top="10px";
_104.style.visibility="hidden";
_104.style.width="0px";
_104.style.height="0px";
var _105=new URI(_102);
_105.query=".kr=xs&.kv=9.06";
_105.path="/";
_104.src=_105.toString();
function post(_106){
this.buffer.push(_106);
};
function attach(id){
var _108=this.attached[id];
if(_108===undefined){
_108={};
this.attached[id]=_108;
}
if(_108.timerID!==undefined){
clearTimeout(_108.timerID);
delete _108.timerID;
}
};
function detach(id){
var _10a=this.attached[id];
if(_10a!==undefined&&_10a.timerID===undefined){
var _10b=this;
_10a.timerID=setTimeout(function(){
delete _10b.attached[id];
var xhr=_f6[id];
if(xhr._pipe==pipe){
delete _f6[id];
delete xhr._id;
delete xhr._pipe;
}
postMessage0(pipe.iframe.contentWindow,["d",id].join(""),pipe.targetOrigin);
},10000);
}
};
pipe={"targetOrigin":_102,"iframe":_104,"buffer":[],"post":post,"attach":attach,"detach":detach,"attached":{count:0}};
_f5[_102]=pipe;
var _10d=this;
function sendInitWhenReady(){
var _10e=_104.contentWindow;
if(!_10e){
setTimeout(sendInitWhenReady,20);
}else{
postMessage0(_10e,"I",_102);
}
};
pipe.handshakeID=setTimeout(function(){
_f5[_102]=undefined;
pipe.post=function(_10f){
_10d.readyState=4;
_10d.status=0;
onreadystatechange(_10d);
};
if(pipe.buffer.length>0){
pipe.post();
}
},30000);
document.body.appendChild(_104);
sendInitWhenReady();
}
this._pipe=pipe;
this._requestHeaders=[];
this._method=_fa;
this._location=_fb;
this._responseHeaders=null;
this._readyState=1;
this.status=0;
this.statusText="";
this.responseText="";
pipe.attach(this._id);
var _10d=this;
setTimeout(function(){
_10d.readyState=1;
onreadystatechange(_10d);
},0);
};
_f9.setRequestHeader=function(_110,_111){
if(this._readyState!==1){
throw new Error("Invalid ready state");
}
this._requestHeaders.push([_110,_111]);
};
_f9.send=function(_112){
if(this._readyState!==1){
throw new Error("Invalid ready state");
}
if(typeof (_112)!=="string"){
_112="";
}
var _113=this;
setTimeout(function(){
_113.readyState=2;
onreadystatechange(_113);
},0);
var _114=this._method.substring(0,10);
var _115=this._location;
var _116=this._requestHeaders;
var _117=toPaddedHex(this.timeout,4);
var _118=(this.onprogress!==undefined)?"t":"f";
var _119=["s",this._id,_114.length,_114,toPaddedHex(_115.length,4),_115,toPaddedHex(_116.length,4)];
for(var i=0;i<_116.length;i++){
var _11b=_116[i];
_119.push(toPaddedHex(_11b[0].length,4));
_119.push(_11b[0]);
_119.push(toPaddedHex(_11b[1].length,4));
_119.push(_11b[1]);
}
_119.push(toPaddedHex(_112.length,8),_112,toPaddedHex(_117,4),_118);
this._pipe.post(_119.join(""));
};
_f9.abort=function(){
var pipe=this._pipe;
if(pipe!==undefined){
pipe.post(["a",this._id].join(""));
pipe.detach(this._id);
}
};
_f9.getResponseHeader=function(_11d){
if(this.status==0){
throw new Error("Invalid ready state");
}
var _11e=this._responseHeaders;
return _11e[_11d];
};
_f9.getAllResponseHeaders=function(){
if(this.status==0){
throw new Error("Invalid ready state");
}
return null;
};
function onreadystatechange(_11f){
if(typeof (_11f.onreadystatechange)!=="undefined"){
_11f.onreadystatechange();
}
switch(_11f.readyState){
case 3:
if(typeof (_11f.onprogress)!=="undefined"){
_11f.onprogress();
}
break;
case 4:
switch(Math.floor(_11f.status/100)){
case 0:
case 5:
if(typeof (_11f.onerror)!=="undefined"){
_11f.onerror();
}
break;
default:
if(typeof (_11f.onprogress)!=="undefined"){
_11f.onprogress();
}
if(typeof (_11f.onload)!=="undefined"){
_11f.onload();
}
break;
}
break;
}
};
function onmessage(_120){
var _121=_120.origin;
var _122={"http":":80","https":":443"};
var _123=_121.split(":");
if(_123.length===2){
_121+=_122[_123[0]];
}
var pipe=_f5[_121];
if(pipe!==undefined&&pipe.iframe!==undefined&&_120.source==pipe.iframe.contentWindow){
if(_120.data=="I"){
clearTimeout(pipe.handshakeID);
var _125;
while((_125=pipe.buffer.shift())!==undefined){
postMessage0(pipe.iframe.contentWindow,_125,pipe.targetOrigin);
}
pipe.post=function(_126){
postMessage0(pipe.iframe.contentWindow,_126,pipe.targetOrigin);
};
}else{
var _125=_120.data;
if(_125.length>=9){
var _127=0;
var type=_125.substring(_127,_127+=1);
var id=_125.substring(_127,_127+=8);
var _12a=_f6[id];
if(_12a!==undefined){
switch(type){
case "r":
var _12b={};
var _12c=fromHex(_125.substring(_127,_127+=2));
for(var i=0;i<_12c;i++){
var _12e=fromHex(_125.substring(_127,_127+=4));
var _12f=_125.substring(_127,_127+=_12e);
var _130=fromHex(_125.substring(_127,_127+=4));
var _131=_125.substring(_127,_127+=_130);
_12b[_12f]=_131;
}
_12a._responseHeaders=_12b;
_12a.status=fromHex(_125.substring(_127,_127+=4));
var _132=fromHex(_125.substring(_127,_127+=2));
_12a.statusText=_125.substring(_127,_127+=_132);
break;
case "p":
_12a.readyState=parseInt(_125.substring(_127,_127+=1));
var _133=fromHex(_125.substring(_127,_127+=8));
var _134=_125.substring(_127,_127+=_133);
if(_134.length>0){
_12a.responseText+=_134;
}
onreadystatechange(_12a);
if(_12a.readyState==4){
pipe.detach(id);
}
break;
case "e":
_12a.status=0;
_12a.statusText="";
_12a.readyState=4;
onreadystatechange(_12a);
pipe.detach(id);
break;
case "t":
_12a.status=0;
_12a.statusText="";
_12a.readyState=4;
if(typeof ($this.ontimeout)!=="undefined"){
$this.ontimeout();
}
pipe.detach(id);
break;
}
}
}
}
}else{
}
};
function fromHex(_135){
return parseInt(_135,16);
};
function toPaddedHex(_136,_137){
var hex=_136.toString(16);
var _139=[];
_137-=hex.length;
while(_137-->0){
_139.push("0");
}
_139.push(hex);
return _139.join("");
};
window.addEventListener("message",onmessage,false);
return XMLHttpRequest0;
})();
ByteOrder=function(){
};
(function(){
var _13a=ByteOrder.prototype;
_13a.toString=function(){
throw new Error("Abstract");
};
var _13b=function(v){
return (v&255);
};
var _13d=function(_13e){
return (_13e&128)?(_13e|-256):_13e;
};
var _13f=function(v){
return [((v>>8)&255),(v&255)];
};
var _141=function(_142,_143){
return (_13d(_142)<<8)|(_143&255);
};
var _144=function(_145,_146){
return ((_145&255)<<8)|(_146&255);
};
var _147=function(v){
return [((v>>16)&255),((v>>8)&255),(v&255)];
};
var _149=function(_14a,_14b,_14c){
return ((_14a&255)<<16)|((_14b&255)<<8)|(_14c&255);
};
var _14d=function(v){
return [((v>>24)&255),((v>>16)&255),((v>>8)&255),(v&255)];
};
var _14f=function(_150,_151,_152,_153){
return (_13d(_150)<<24)|((_151&255)<<16)|((_152&255)<<8)|(_153&255);
};
var _154=function(_155,_156,_157,_158){
var _159=_144(_155,_156);
var _15a=_144(_157,_158);
return (_159*65536+_15a);
};
var _15b=function(v){
var v1=Math.floor(v/4294967296);
var v0=v%4294967296;
var a1=_14d(v1);
var a2=_14d(v0);
return a1.concat(a2);
};
var _161=function(_162,_163,_164,_165,_166,_167,_168,_169){
var v1=_14f(_162,_163,_164,_165);
var v0=_154(_166,_167,_168,_169);
return (v1*4294967296+v0);
};
ByteOrder.BIG_ENDIAN=(function(){
var _16c=function(){
};
_16c.prototype=new ByteOrder();
var _16d=_16c.prototype;
_16d._toUnsignedByte=_13b;
_16d._toByte=_13d;
_16d._fromShort=_13f;
_16d._toShort=_141;
_16d._toUnsignedShort=_144;
_16d._fromMediumInt=_147;
_16d._toMediumInt=_149;
_16d._fromInt=_14d;
_16d._toInt=_14f;
_16d._toUnsignedInt=_154;
_16d._fromLong=_15b;
_16d._toLong=_161;
_16d.toString=function(){
return "<ByteOrder.BIG_ENDIAN>";
};
return new _16c();
})();
ByteOrder.LITTLE_ENDIAN=(function(){
var _16e=function(){
};
_16e.prototype=new ByteOrder();
var _16f=_16e.prototype;
_16f._toByte=_13d;
_16f._toUnsignedByte=_13b;
_16f._fromShort=function(v){
return _13f(v).reverse();
};
_16f._toShort=function(_171,_172){
return _141(_172,_171);
};
_16f._toUnsignedShort=function(_173,_174){
return _144(_174,_173);
};
_16f._fromMediumInt=function(v){
return _147(v).reverse();
};
_16f._toMediumInt=function(_176,_177,_178,_179,_17a,_17b){
return _149(_17b,_17a,_179,_178,_177,_176);
};
_16f._fromInt=function(v){
return _14d(v).reverse();
};
_16f._toInt=function(_17d,_17e,_17f,_180){
return _14f(_180,_17f,_17e,_17d);
};
_16f._toUnsignedInt=function(_181,_182,_183,_184){
return _154(_184,_183,_182,_181);
};
_16f._fromLong=function(v){
return _15b(v).reverse();
};
_16f._toLong=function(_186,_187,_188,_189,_18a,_18b,_18c,_18d){
return _161(_18d,_18c,_18b,_18a,_189,_188,_187,_186);
};
_16f.toString=function(){
return "<ByteOrder.LITTLE_ENDIAN>";
};
return new _16e();
})();
})();
function ByteBuffer(_18e){
this.array=_18e||[];
this._mark=-1;
this.limit=this.capacity=this.array.length;
this.order=ByteOrder.BIG_ENDIAN;
};
(function(){
ByteBuffer.allocate=function(_18f){
var buf=new ByteBuffer();
buf.capacity=_18f;
return buf;
};
ByteBuffer.wrap=function(_191){
return new ByteBuffer(_191);
};
var _192=ByteBuffer.prototype;
_192.autoExpand=true;
_192.capacity=0;
_192.position=0;
_192.limit=0;
_192.order=ByteOrder.BIG_ENDIAN;
_192.array=[];
_192.mark=function(){
this._mark=this.position;
return this;
};
_192.reset=function(){
var m=this._mark;
if(m<0){
throw new Error("Invalid mark");
}
this.position=m;
return this;
};
_192.compact=function(){
this.array.splice(0,this.position);
this.limit-=this.position;
this.position=0;
return this;
};
_192.duplicate=function(){
var buf=new ByteBuffer(this.array);
buf.position=this.position;
buf.limit=this.limit;
buf.capacity=this.capacity;
return buf;
};
_192.fill=function(size){
_autoExpand(this,size);
while(size-->0){
this.put(0);
}
return this;
};
_192.fillWith=function(b,size){
_autoExpand(this,size);
while(size-->0){
this.put(b);
}
return this;
};
_192.indexOf=function(b){
var _199=this.limit;
var _19a=this.array;
for(var i=this.position;i<_199;i++){
if(_19a[i]==b){
return i;
}
}
return -1;
};
_192.put=function(v){
_autoExpand(this,1);
this.putAt(this.position++,v);
return this;
};
_192.putAt=function(i,v){
_checkIndex(this,i);
this.array[i]=this.order._toUnsignedByte(v);
return this;
};
_192.putShort=function(v){
_autoExpand(this,2);
this.putShortAt(this.position,v);
this.position+=2;
return this;
};
_192.putShortAt=function(i,v){
this.putBytesAt(i,this.order._fromShort(v));
return this;
};
_192.putMediumInt=function(v){
_autoExpand(this,3);
this.putMediumIntAt(this.position,v);
this.position+=3;
return this;
};
_192.putMediumIntAt=function(i,v){
this.putBytesAt(i,this.order._fromMediumInt(v));
return this;
};
_192.putInt=function(v){
_autoExpand(this,4);
this.putIntAt(this.position,v);
this.position+=4;
return this;
};
_192.putIntAt=function(i,v){
this.putBytesAt(i,this.order._fromInt(v));
return this;
};
_192.putLong=function(v){
_autoExpand(this,8);
this.putLongAt(this.position,v);
this.position+=8;
return this;
};
_192.putLongAt=function(i,v){
this.putBytesAt(i,this.order._fromLong(v));
return this;
};
_192.putString=function(v,cs){
cs.encode(v,this);
return this;
};
_192.putPrefixedString=function(_1ad,v,cs){
if(typeof (cs)==="undefined"||typeof (cs.encode)==="undefined"){
throw new Error("ByteBuffer.putPrefixedString: character set parameter missing");
}
if(_1ad===0){
return this;
}
_autoExpand(this,_1ad);
var len=v.length;
switch(_1ad){
case 1:
this.put(len);
break;
case 2:
this.putShort(len);
break;
case 4:
this.putInt(len);
break;
}
cs.encode(v,this);
return this;
};
_192.putBytes=function(v){
_autoExpand(this,v.length);
this.putBytesAt(this.position,v);
this.position+=v.length;
return this;
};
_192.putBytesAt=function(i,v){
for(var j=0,k=i,len=v.length;j<len;j++,k++){
this.putAt(k,v[j]);
}
return this;
};
_192.putBuffer=function(v){
this.putBytes(v.array.slice(v.position,v.limit));
return this;
};
_192.putBufferAt=function(i,v){
this.putBytesAt(i,v.array.slice(v.position,v.limit));
return this;
};
_192.get=function(){
return this.getAt(this.position++);
};
_192.getAt=function(i){
return this.order._toByte(this.array[i]);
};
_192.getShort=function(){
var val=this.getShortAt(this.position);
this.position+=2;
return val;
};
_192.getShortAt=function(i){
var _1bd=this.array;
return this.order._toShort(_1bd[i++],_1bd[i++]);
};
_192.getMediumInt=function(){
var val=this.getMediumIntAt(this.position);
this.position+=3;
return val;
};
_192.getMediumIntAt=function(i){
var _1c0=this.array;
return this.order._toMediumInt(_1c0[i++],_1c0[i++],_1c0[i++]);
};
_192.getInt=function(){
var val=this.getIntAt(this.position);
this.position+=4;
return val;
};
_192.getIntAt=function(i){
var _1c3=this.array;
return this.order._toInt(_1c3[i++],_1c3[i++],_1c3[i++],_1c3[i++]);
};
_192.getLong=function(){
var val=this.getLongAt(this.position);
this.position+=8;
return val;
};
_192.getLongAt=function(i){
var _1c6=this.array;
return this.order._toLong(_1c6[i++],_1c6[i++],_1c6[i++],_1c6[i++],_1c6[i++],_1c6[i++],_1c6[i++],_1c6[i++]);
};
_192.getUnsigned=function(){
return this.order._toUnsignedByte(this.array[this.position++]);
};
_192.getUnsignedShort=function(){
var _1c7=this.array;
return this.order._toUnsignedShort(_1c7[this.position++],_1c7[this.position++]);
};
_192.getUnsignedMediumInt=function(){
var _1c8=this.array;
return this.order._toUnsignedMediumInt(_1c8[this.position++],_1c8[this.position++],_1c8[this.position++]);
};
_192.getUnsignedInt=function(){
var _1c9=this.array;
return this.order._toUnsignedInt(_1c9[this.position++],_1c9[this.position++],_1c9[this.position++],_1c9[this.position++]);
return val;
};
_192.getPrefixedString=function(_1ca,cs){
var len=0;
switch(_1ca||2){
case 1:
len=this.getUnsigned();
break;
case 2:
len=this.getUnsignedShort();
break;
case 4:
len=this.getInt();
break;
}
if(len===0){
return "";
}
var _1cd=this.limit;
try{
this.limit=this.position+len;
return cs.decode(this);
}
finally{
this.limit=_1cd;
}
};
_192.getString=function(cs){
var _1cf=this.position;
var _1d0=this.limit;
var _1d1=this.array;
while(_1cf<_1d0&&_1d1[_1cf]!==0){
_1cf++;
}
try{
this.limit=_1cf;
return cs.decode(this);
}
finally{
if(_1cf!=_1d0){
this.limit=_1d0;
this.position=_1cf+1;
}
}
};
_192.slice=function(){
return new ByteBuffer(this.array.slice(this.position,this.limit));
};
_192.flip=function(){
this.limit=this.position;
this.position=0;
this._mark=-1;
return this;
};
_192.rewind=function(){
this.position=0;
this._mark=-1;
return this;
};
_192.clear=function(){
this.position=0;
this.limit=this.capacity;
this._mark=-1;
return this;
};
_192.remaining=function(){
return (this.limit-this.position);
};
_192.hasRemaining=function(){
return (this.limit>this.position);
};
_192.skip=function(size){
this.position+=size;
return this;
};
_192.getHexDump=function(){
var _1d3=this.array;
var pos=this.position;
var _1d5=this.limit;
if(pos==_1d5){
return "empty";
}
var _1d6=[];
for(var i=pos;i<_1d5;i++){
var hex=(_1d3[i]||0).toString(16);
if(hex.length==1){
hex="0"+hex;
}
_1d6.push(hex);
}
return _1d6.join(" ");
};
_192.toString=_192.getHexDump;
_192.expand=function(_1d9){
return this.expandAt(this.position,_1d9);
};
_192.expandAt=function(i,_1db){
var end=i+_1db;
if(end>this.capacity){
this.capacity=end;
}
if(end>this.limit){
this.limit=end;
}
return this;
};
function _autoExpand(_1dd,_1de){
if(_1dd.autoExpand){
_1dd.expand(_1de);
}
return this;
};
function _checkIndex(_1df,_1e0){
if(_1e0<0||_1e0>_1df.capacity){
throw new Error("Index out of bounds");
}
return this;
};
})();
function Charset(){
};
(function(){
var _1e1=Charset.prototype;
_1e1.decode=function(buf){
};
_1e1.encode=function(text){
};
Charset.UTF8=(function(){
function UTF8(){
};
UTF8.prototype=new Charset();
var _1e4=UTF8.prototype;
_1e4.decode=function(buf){
var _1e6=[];
while(buf.hasRemaining()){
var _1e7=buf.remaining();
var _1e8=buf.getUnsigned();
var _1e9=charByteCount(_1e8);
if(_1e7<_1e9){
buf.skip(-1);
break;
}
var _1ea=null;
switch(_1e9){
case 1:
_1ea=_1e8;
break;
case 2:
_1ea=((_1e8&31)<<6)|(buf.getUnsigned()&63);
break;
case 3:
_1ea=((_1e8&15)<<12)|((buf.getUnsigned()&63)<<6)|(buf.getUnsigned()&63);
break;
case 4:
_1ea=((_1e8&7)<<18)|((buf.getUnsigned()&63)<<12)|((buf.getUnsigned()&63)<<6)|(buf.getUnsigned()&63);
break;
}
_1e6.push(_1ea);
}
return String.fromCharCode.apply(null,_1e6);
};
_1e4.encode=function(str,buf){
for(var i=0;i<str.length;i++){
var _1ee=str.charCodeAt(i);
if(_1ee<128){
buf.put(_1ee);
}else{
if(_1ee<2048){
buf.put((_1ee>>6)|192);
buf.put((_1ee&63)|128);
}else{
if(_1ee<65536){
buf.put((_1ee>>12)|224);
buf.put(((_1ee>>6)&63)|128);
buf.put((_1ee&63)|128);
}else{
if(_1ee<1114112){
buf.put((_1ee>>18)|240);
buf.put(((_1ee>>12)&63)|128);
buf.put(((_1ee>>6)&63)|128);
buf.put((_1ee&63)|128);
}else{
throw new Error("Invalid UTF-8 string");
}
}
}
}
}
};
function charByteCount(b){
if((b&128)===0){
return 1;
}
if((b&32)===0){
return 2;
}
if((b&16)===0){
return 3;
}
if((b&8)===0){
return 4;
}
throw new Error("Invalid UTF-8 bytes");
};
return new UTF8();
})();
})();
if(true||typeof (window.EventSource)==="undefined"){
var EventSource=(function(){
function EventSource(_1f0){
this.lastEventId=null;
this.immediate=false;
this.retry=3000;
if(_1f0.indexOf(".kv="==-1)){
_1f0+=((_1f0.indexOf("?")==-1)?"?":"&")+".kv=9.06";
}else{
_1f0=_1f0.replace(/\.kv=[^&]*(.*)/,".kv=9.06$1");
}
var _1f1=new URI(_1f0);
var _1f2={"http":80,"https":443};
if(_1f1.port==null){
_1f1.port=_1f2[_1f1.scheme];
_1f1.authority=_1f1.host+":"+_1f1.port;
}
this.origin=_1f1.scheme+"://"+_1f1.authority;
this.location=_1f0;
this.lineQueue=[];
this.xhr=null;
this.reconnectTimer=null;
var _1f3=this;
setTimeout(function(){
_connect(_1f3,false);
},0);
};
var _1f4=EventSource.prototype;
_1f4.readyState=0;
_1f4.onopen=function(){
};
_1f4.onmessage=function(_1f5){
};
_1f4.onerror=function(){
};
_1f4.disconnect=function(){
if(this.readyState!==2){
_disconnect(this);
}
};
function _connect(_1f6,_1f7){
if(_1f6.reconnectTimer!==null){
_1f6.reconnectTimer=null;
}
var _1f8=new URI(_1f6.location);
var _1f9=[];
if(_1f6.lastEventId!==null){
_1f9.push(".ka="+this.lastEventId);
}
if(_1f6.location.indexOf("&.kb=")===-1&&_1f6.location.indexOf("?.kb=")===-1){
_1f9.push(".kb=512");
}
switch(browser){
case "ie":
case "safari":
_1f9.push(".kp=256");
break;
case "firefox":
_1f9.push(".kp=1025");
_1f9.push(String(Math.random()).substring(2));
break;
}
if(_1f9.length>0){
if(_1f8.query===undefined){
_1f8.query=_1f9.join("&");
}else{
_1f8.query+="&"+_1f9.join("&");
}
}
var xhr=_1f6.xhr=new XMLHttpRequest0();
var _1fb={"xhr":xhr,"position":0};
if(_1f6.location.indexOf(".ki=p")==-1||_1f6.location.indexOf("https://")==0){
xhr.onprogress=function(){
setTimeout(function(){
_process(_1f6,_1fb);
},0);
};
}
xhr.onload=function(){
_process(_1f6,_1fb);
if(_1f6.xhr==_1fb.xhr&&_1f6.readyState!=2){
_reconnect(_1f6);
}
};
xhr.onerror=function(){
if(_1f6.readyState!=2){
_disconnect(_1f6);
_error(_1f6);
}
};
xhr.ontimeout=function(){
if(_1f6.readyState!=2){
_disconnect(_1f6);
_error(_1f6);
}
};
xhr.onreadystatechange=function(){
if(!_1f7){
if(xhr.readyState>=3){
_1f6.readyState=1;
if(typeof (_1f6.onopen)==="function"){
_1f6.onopen();
}
xhr.onreadystatechange=function(){
};
}
}
};
xhr.open("GET",_1f8.toString(),true);
xhr.send(null);
if(_1f6.location.indexOf("&.ki=p")==-1){
setTimeout(function(){
if(xhr.readyState<3&&_1f6.readyState<2){
_1f6.location+="&.ki=p";
_connect(_1f6,false);
}
},3000);
}
};
function _disconnect(_1fc){
if(_1fc.reconnectTimer!==null){
clearTimeout(_1fc.reconnectTimer);
_1fc.reconnectTimer=null;
}
if(_1fc.xhr!==null){
_1fc.xhr.onprogress=function(){
};
_1fc.xhr.onload=function(){
};
_1fc.xhr.onerror=function(){
};
_1fc.xhr.abort();
}
_1fc.lineQueue=[];
_1fc.lastEventId=null;
_1fc.location=null;
_1fc.readyState=2;
};
function _reconnect(_1fd){
_1fd.readyState=0;
if(_1fd.location!==null){
var _1fe=_1fd.retry;
var _1ff=_1fd.immediate;
if(_1ff){
_1fd.immediate=false;
_1fe=0;
}else{
_error(_1fd);
}
if(_1fd.readyState==0){
_1fd.reconnectTimer=setTimeout(function(){
_connect(_1fd,_1ff);
},_1fe);
}
}
};
var _200=/[^\r\n]+|\r\n|\r|\n/g;
function _process(_201,_202){
var _203=_202.xhr.responseText;
var _204=_203.slice(_202.position);
var _205=_204.match(_200)||[];
var _206=_201.lineQueue;
var _207="";
while(_205.length>0){
var _208=_205.shift();
switch(_208.charAt(0)){
case "\r":
case "\n":
_202.position+=_207.length+_208.length;
if(_207===""){
_dispatch(_201);
}else{
_206.push(_207);
_207="";
}
break;
default:
_207=_208;
break;
}
}
};
function _dispatch(_209){
var data="";
var name="message";
var _20c=_209.lineQueue;
while(_20c.length>0){
var line=_20c.shift();
var _20e=null;
var _20f="";
var _210=line.indexOf(":");
if(_210==-1){
_20e=line;
_20f="";
}else{
if(_210===0){
continue;
}else{
_20e=line.slice(0,_210);
var _211=_210+1;
if(line.charAt(_211)==" "){
_211++;
}
_20f=line.slice(_211);
}
}
switch(_20e){
case "event":
name=_20f;
break;
case "id":
_209.lastEventId=_20f;
break;
case "retry":
_20f=parseInt(_20f,10);
if(!isNaN(_20f)){
_209.retry=_20f;
}
break;
case "data":
if(data.length>0){
data+="\n";
}
data+=_20f;
break;
case "location":
if(_20f!=""){
_209.location=_20f;
}
break;
case "reconnect":
_209.immediate=true;
break;
default:
break;
}
}
if(data.length>0||(name.length>0&&name!="message")){
var e=document.createEvent("Events");
e.initEvent(name,true,true);
e.lastEventId=_209.lastEventId;
e.data=data;
e.origin=_209.origin;
if(e.source!==null){
e.source=null;
}
if(typeof (_209.onmessage)==="function"){
_209.onmessage(e);
}
}
};
function _error(_213){
var e=document.createEvent("Events");
e.initEvent("error",true,true);
if(typeof (_213.onerror)==="function"){
_213.onerror(e);
}
};
return EventSource;
})();
}
(function(){
var _215=function(key){
var tags=document.getElementsByTagName("meta");
for(var i=0;i<tags.length;i++){
if(tags[i].name===key){
return tags[i].content;
}
}
};
var _219=function(_21a){
var _21b=[];
for(var i=0;i<_21a.length;i++){
_21b.push(_21a[i]);
}
return _21b;
};
var _21d=function(_21e,_21f){
var _220=[];
for(var i=0;i<_21e.length;i++){
var elt=_21e[i];
if(_21f(elt)){
_220.push(_21e[i]);
}
}
return _220;
};
var _223=function(_224,_225){
for(var i=0;i<_224.length;i++){
if(_224[i]==_225){
return i;
}
}
return -1;
};
var _227=window.WebSocket;
var _228=function(_229,_22a){
if(typeof (_227)==="undefined"){
doError(this);
return;
}
this.readyState=0;
if(_229.indexOf("javascript:")==0){
_229=_229.substr("javascript:".length);
}
try{
if(_22a){
this._delegate=new _227(_229,_22a);
}else{
this._delegate=new _227(_229);
}
}
catch(e){
doError(this);
return;
}
bindHandlers(this);
};
var _22b=_228.prototype;
_22b.onerror=function(){
};
_22b.onmessage=function(){
};
_22b.onopen=function(){
};
_22b.onclose=function(){
};
_22b.close=function(){
this._delegate.close();
};
_22b.send=function(_22c){
this._delegate.send(_22c);
};
function doError(_22d,e){
setTimeout(function(){
if(_22d.onerror){
_22d.onerror(e);
}
},0);
};
function messageHandler(_22f,e){
_22f.onmessage(e);
};
function closeHandler(_231,e){
if(_231.readyState==0){
doError(_231,e);
}else{
_231.readyState=2;
_231.onclose(e);
}
};
function openHandler(_233,e){
_233.readyState=1;
_233.onopen(e);
};
function bindHandlers(_235){
var _236=_235._delegate;
_236.onopen=function(e){
openHandler(_235,e);
};
_236.onmessage=function(e){
messageHandler(_235,e);
};
_236.onclose=function(e){
closeHandler(_235,e);
};
};
function unbindHandlers(_23a){
var _23b=_23a._delegate;
_23b.onmessage=undefined;
_23b.onclose=undefined;
_23b.onopen=undefined;
};
var _23c=(function(){
var _23d=function(_23e){
this.URL=_23e;
var _23f=this;
try{
_240(_23f,_23e);
}
catch(e){
doError(_23f,e);
}
this.constructor=_23d;
};
var _241=_23d.prototype;
_23d._flashBridge={};
_23d._flashBridge.readyWaitQueue=[];
_23d._flashBridge.failWaitQueue=[];
_23d._flashBridge.flashHasLoaded=false;
_23d._flashBridge.flashHasFailed=false;
_241.URL="";
_241.readyState=0;
_241.bufferedAmount=0;
_241.onopen=function(){
};
_241.onmessage=function(_242){
};
_241.onclose=function(){
};
_241.onerror=function(){
};
_241.send=function(data){
switch(this.readyState){
case 0:
throw new Error("INVALID_STATE_ERR");
break;
case 1:
if(data===null){
throw new Error("data is null");
}
_23d._flashBridge.sendText(this._instanceId,data);
_244(this);
return true;
break;
case 2:
return false;
break;
default:
throw new Error("INVALID_STATE_ERR");
}
};
_241.close=function(){
switch(this.readyState){
case 1:
case 2:
_23d._flashBridge.disconnect(this._instanceId);
break;
}
};
_241.disconnect=_241.close;
var _244=function(_245){
_245.bufferedAmount=_23d._flashBridge.getBufferedAmount(_245._instanceId);
if(_245.bufferedAmount!=0){
setTimeout(function(){
_244(_245);
},1000);
}
};
var _240=function(_246,_247){
var _248=function(key,_24a){
_24a[key]=_246;
_246._instanceId=key;
};
var _24b=function(){
doError(_246);
};
_23d._flashBridge.registerWebSocket(_247,_248,_24b);
};
function doError(_24c,e){
setTimeout(function(){
if(_24c.onerror){
_24c.onerror(e);
}
},0);
};
return _23d;
})();
var _24e=(function(){
var _24f=function(_250){
this.URL=_250;
var _251=this;
try{
_252(_251,_250);
}
catch(e){
doError(_251,e);
}
this.constructor=_24f;
};
var _253=_24f.prototype;
_253.URL="";
_253.readyState=0;
_253.bufferedAmount=0;
_253.onopen=function(){
};
_253.onmessage=function(_254){
};
_253.onclose=function(){
};
_253.onerror=function(){
};
_253.send=function(data){
switch(this.readyState){
case 0:
throw new Error("INVALID_STATE_ERR");
break;
case 1:
if(data===null){
throw new Error("data is null");
}
var _256=data.duplicate().compact().array;
_23c._flashBridge.sendBinary(this._instanceId,_256);
_257(this);
return true;
break;
case 2:
return false;
break;
default:
throw new Error("INVALID_STATE_ERR");
}
};
_253.close=function(){
switch(this.readyState){
case 1:
case 2:
_23c._flashBridge.disconnect(this._instanceId);
break;
}
};
_253.disconnect=_253.close;
var _257=function(_258){
_258.bufferedAmount=_23c._flashBridge.getBufferedAmount(_258._instanceId);
if(_258.bufferedAmount!=0){
setTimeout(function(){
_257(_258);
},1000);
}
};
var _259=function(){
if(browser==="firefox"){
var e=document.createElement("iframe");
e.style.display="none";
document.body.appendChild(e);
document.body.removeChild(e);
}
};
var _252=function(_25b,_25c){
var _25d=function(key,_25f){
_25f[key]=_25b;
_25b._instanceId=key;
};
var _260=function(){
doError(_25b);
};
_23c._flashBridge.registerByteSocket(_25c,_25d,_260);
};
function doError(_261,e){
setTimeout(function(){
if(_261.onerror){
_261.onerror(e);
}
},0);
};
return _24f;
})();
(function(){
var _263={};
_23c._flashBridge.registerWebSocket=function(_264,_265,_266){
var _267=function(){
var key=_23c._flashBridge.doRegisterWebSocket(_264);
_265(key,_263);
};
if(_23c._flashBridge.flashHasLoaded){
if(_23c._flashBridge.flashHasFailed){
_266();
}else{
_267();
}
}else{
this.readyWaitQueue.push(_267);
this.failWaitQueue.push(_266);
}
};
_23c._flashBridge.doRegisterWebSocket=function(_269){
var key=_23c._flashBridge.elt.registerWebSocket(_269);
return key;
};
_23c._flashBridge.registerByteSocket=function(_26b,_26c,_26d){
var _26e=function(){
var key=_23c._flashBridge.doRegisterByteSocket(_26b);
_26c(key,_263);
};
if(_23c._flashBridge.flashHasLoaded){
if(_23c._flashBridge.flashHasFailed){
_26d();
}else{
_26e();
}
}else{
this.readyWaitQueue.push(_26e);
this.failWaitQueue.push(_26d);
}
};
_23c._flashBridge.doRegisterByteSocket=function(_270){
var key=_23c._flashBridge.elt.registerByteSocket(_270);
return key;
};
_23c._flashBridge.onready=function(){
var _272=_23c._flashBridge.readyWaitQueue;
for(var i=0;i<_272.length;i++){
var _274=_272[i];
_274();
}
};
_23c._flashBridge.onfail=function(){
var _275=_23c._flashBridge.failWaitQueue;
for(var i=0;i<_275.length;i++){
var _277=_275[i];
_277();
}
};
_23c._flashBridge.doOpen=function(key){
_263[key].readyState=1;
_263[key].onopen();
_279();
};
_23c._flashBridge.doClose=function(key){
_263[key].readyState=2;
_263[key].onclose();
};
_23c._flashBridge.doBinaryMessage=function(key,data){
_23c._flashBridge.doMessage(key,new ByteBuffer(data.array));
};
_23c._flashBridge.doMessage=function(key,data){
var _27f=_263[key];
if(_27f.readyState==1){
var e;
try{
e=document.createEvent("Events");
e.initEvent("message",true,true);
}
catch(ie){
e={type:"message",bubbles:true,cancelable:true};
}
e.data=data;
e.origin=document.domain;
e.source=null;
_27f.onmessage(e);
}
};
var _279=function(){
if(browser==="firefox"){
var e=document.createElement("iframe");
e.style.display="none";
document.body.appendChild(e);
document.body.removeChild(e);
}
};
_23c._flashBridge.sendText=function(key,_283){
this.elt.wsSend(key,_283);
setTimeout(_279,200);
};
_23c._flashBridge.sendBinary=function(key,_285){
this.elt.bsSend(key,_285);
setTimeout(_279,200);
};
_23c._flashBridge.disconnect=function(key){
this.elt.wsDisconnect(key);
};
_23c._flashBridge.getBufferedAmount=function(key){
return this.elt.getBufferedAmount(key);
};
})();
(function(){
var _288=function(_289){
var self=this;
var _28b=300;
var ID="Loader";
var ie=false;
var _28e=-1;
self.elt=null;
var _28f=function(){
var exp=exp=new RegExp(".*"+_289+".js$");
var _291=document.getElementsByTagName("script");
for(var i=0;i<_291.length;i++){
if(_291[i].src){
var name=(_291[i].src).match(exp);
if(name){
name=name.pop();
var _294=name.split("/");
_294.pop();
var s=_294.join("/")+"/";
return s;
}
}
}
};
var _296=_28f();
var _297=_296+"Loader.swf?.kv=9.06";
self.loader=function(){
var _298="flash";
var tags=document.getElementsByTagName("meta");
for(var i=0;i<tags.length;i++){
if(tags[i].name==="kaazing:upgrade"){
_298=tags[i].content;
}
}
if(_298!="flash"||!_29b([9,0,115])){
_29c();
}else{
_28e=setTimeout(_29c,_28b);
_29d();
}
};
self.clearFlashTimer=function(){
clearTimeout(_28e);
_28e="cleared";
setTimeout(function(){
_29e(self.elt.handshake(_289));
},0);
};
var _29e=function(_29f){
if(_29f){
_23c._flashBridge.flashHasLoaded=true;
_23c._flashBridge.elt=self.elt;
_23c._flashBridge.onready();
}else{
_29c();
}
window.___Loader=undefined;
};
var _29c=function(){
_23c._flashBridge.flashHasLoaded=true;
_23c._flashBridge.flashHasFailed=true;
_23c._flashBridge.onfail();
};
var _2a0=function(){
var _2a1=null;
if(typeof (ActiveXObject)!="undefined"){
try{
ie=true;
var swf=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
var _2a3=swf.GetVariable("$version");
var _2a4=_2a3.split(" ")[1].split(",");
_2a1=[];
for(var i=0;i<_2a4.length;i++){
_2a1[i]=parseInt(_2a4[i]);
}
}
catch(e){
ie=false;
}
}
if(typeof navigator.plugins!="undefined"){
if(typeof navigator.plugins["Shockwave Flash"]!="undefined"){
var _2a3=navigator.plugins["Shockwave Flash"].description;
_2a3=_2a3.replace(/\s*r/g,".");
var _2a4=_2a3.split(" ")[2].split(".");
_2a1=[];
for(var i=0;i<_2a4.length;i++){
_2a1[i]=parseInt(_2a4[i]);
}
}
}
var _2a6=navigator.userAgent;
if(_2a1!==null&&_2a1[0]===10&&_2a6.indexOf("Windows NT 6.0")!==-1){
_2a1=null;
}
return _2a1;
};
var _29b=function(_2a7){
var _2a8=_2a0();
if(_2a8==null){
return false;
}
for(var i=0;i<Math.max(_2a8.length,_2a7.length);i++){
var _2aa=_2a8[i]-_2a7[i];
if(_2aa!=0){
return (_2aa>0)?true:false;
}
}
return true;
};
var _29d=function(){
if(ie){
var elt=document.createElement("div");
document.body.appendChild(elt);
elt.outerHTML="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" height=\"0\" width=\"0\" id=\""+ID+"\"><param name=\"movie\" value=\""+_297+"\"></param></object>";
self.elt=document.getElementById(ID);
}else{
var elt=document.createElement("object");
elt.setAttribute("type","application/x-shockwave-flash");
elt.setAttribute("width",0);
elt.setAttribute("height",0);
elt.setAttribute("id",ID);
elt.setAttribute("data",_297);
document.body.appendChild(elt);
self.elt=elt;
}
};
self.attachToOnload=function(_2ac){
if(window.addEventListener){
window.addEventListener("load",_2ac,true);
}else{
if(window.attachEvent){
window.attachEvent("onload",_2ac);
}else{
onload=_2ac;
}
}
};
self.attachToOnload(self.loader);
};
var _2ad=(function(){
var _2ae={"javascript:wse":{scheme:"http",port:81},"javascript:wse+ssl":{scheme:"https",port:815},"ws":{scheme:"http",port:81},"wss":{scheme:"https",port:815},"wse":{scheme:"http",port:81},"wse+ssl":{scheme:"https",port:815}};
var _2af=function(_2b0,_2b1){
this.URL=_2b0;
if(_2b0.indexOf(".kv=")==-1){
_2b0+=((_2b0.indexOf("?")==-1)?"?":"&")+".kv=9.06";
}else{
_2b0=_2b0.replace(/\.kv=[^&]*(.*)/,".kv=9.06$1");
}
var _2b2=new URI(_2b0);
var _2b3=_2ae[_2b2.scheme];
if(_2b3===undefined){
throw new Error("SYNTAX_ERR: WebSocket location must use scheme \"ws\" or \"wss\"");
}
_2b2.scheme=_2b3.scheme;
if(_2b2.port===undefined){
_2b2.port=_2b3.port;
}
this._sendQueue=[];
doHandshake(this,_2b2);
};
var _2b4=_2af.prototype;
_2b4.readyState=0;
_2b4.bufferedAmount=0;
_2b4.URL="";
_2b4.onopen=function(){
};
_2b4.onerror=function(){
};
_2b4.onmessage=function(_2b5){
};
_2b4.onclose=function(){
};
_2b4.send=function(data){
switch(this.readyState){
case 0:
throw new Error("INVALID_STATE_ERR");
break;
case 1:
if(data===null){
throw new Error("data is null");
}
var _2b7=[];
_2b7.push("data:");
_2b7.push(data.split("\n").join("\r\ndata:"));
_2b7.push("\r\n\r\n");
doSend(this,_2b7.join(""));
return true;
break;
case 2:
return false;
break;
default:
throw new Error("INVALID_STATE_ERR");
}
};
_2b4.postMessage=function(data){
this.send(data);
};
_2b4.close=function(){
switch(this.readyState){
case 1:
doSend(this,"event:close\r\n\r\n");
doClose(this);
break;
}
};
_2b4.disconnect=_2b4.close;
function doHandshake(_2b9,_2ba){
var xhr=new XMLHttpRequest0();
xhr.open("POST",_2ba.toString(),true);
xhr.onreadystatechange=function(){
if(xhr.readyState==4){
switch(xhr.status){
case 201:
var _2bc=xhr.responseText.split("\n");
_2b9.upstream=new URI(_2bc[0]).toString();
_2b9.downstream=(_2bc.length>=2)?_2bc[1]:_2bc[0];
doBind(_2b9);
doOpen(_2b9);
break;
default:
doClose(_2b9);
break;
}
}
};
xhr.send(null);
};
function doBind(_2bd){
var _2be=_2bd.downstream;
var _2bf=new EventSource(_2bd.downstream);
_2bf.onmessage=function(_2c0){
switch(_2c0.type){
case "message":
if(_2bd.readyState==1){
_2bd.onmessage(_2c0);
}
break;
}
};
_2bf.onerror=function(){
_2bf.disconnect();
doClose(_2bd);
};
_2bd._eventSource=_2bf;
};
function doOpen(_2c1){
_2c1.readyState=1;
_2c1.onopen();
};
function doSend(_2c2,_2c3){
_2c2.bufferedAmount+=_2c3.length;
_2c2._sendQueue.push(_2c3);
if(!_2c2._writeSuspended){
_doFlush(_2c2);
}
};
function doError(_2c4){
_2c4.onerror();
};
function _doFlush(_2c5){
var _2c6=_2c5._sendQueue;
var _2c7=_2c6.length;
_2c5._writeSuspended=(_2c7>0);
if(_2c7>0){
var xhr=new XMLHttpRequest0();
xhr.open("POST",_2c5.upstream,true);
xhr.setRequestHeader("Content-Type","text/plain; charset=UTF-8");
xhr.onreadystatechange=function(){
if(xhr.readyState===4){
switch(xhr.status){
case 200:
_2c6.splice(0,_2c7);
setTimeout(function(){
_doFlush(_2c5);
},0);
break;
default:
doClose(_2c5);
break;
}
}
};
xhr.send(_2c6.join(""));
}
_2c5.bufferedAmount=0;
};
function doClose(_2c9){
if(_2c9.readyState<2){
_2c9.readyState=2;
if(typeof (_2c9.onclose)!=="undefined"){
_2c9.onclose();
}
}
};
return _2af;
})();
var _2ca=(function(){
var _2cb=function(_2cc,_2cd){
var _2ce=this;
this.URL=_2cc;
var _2cf=new URI(_2cc);
var _2d0=_2cf.query;
var _2d1=(_2d0!==undefined)?_2d0.split("&"):[];
_2d1.push("encoding=base64");
var _2d2=new RegExp(/Chrome\/([\d\.]+)/);
var _2d3=navigator.userAgent.match(_2d2);
if(_2d3&&_2d3.length>1){
var _2d4=_2d3[1].split(".");
var _2d5=parseInt(_2d4[0]);
var _2d6=parseInt(_2d4[2]);
if(_2d5==4&&_2d6>=248){
_2d1.push(".kl=nq");
}
}
_2cf.query=_2d1.join("&");
var ws;
if(_2cd){
ws=new WebSocket(_2cf.toString(),_2cd);
}else{
ws=new WebSocket(_2cf.toString());
}
ws.onopen=function(){
_2ce.readyState=ws.readyState;
_2ce.onopen();
};
ws.onmessage=function(e){
var _2d9=fromBase64(e.data);
var _2da=document.createEvent("Events");
_2da.initEvent("message",true,false);
_2da.data=_2d9;
_2da.origin=e.origin;
_2ce.onmessage(_2da);
};
ws.onclose=function(){
_2ce.readyState=ws.readyState;
if(typeof (_2ce.onclose)!=="undefined"){
_2ce.onclose();
}
};
_2ce._ws=ws;
};
var _2db=_2cb.prototype;
_2db.onopen=function(){
};
_2db.onclose=function(){
};
_2db.onmessage=function(evt){
};
_2db.readyState=0;
_2db.bufferedAmount=0;
_2db.URL="";
_2db.send=function(data){
if(data.constructor!==ByteBuffer){
throw new Error("Sending binary data requires using a ByteBuffer");
}
updateBufferedAmount(this);
return this._ws.send(toBase64(data));
};
_2db.postMessage=function(data){
this.send(data);
};
_2db.close=function(){
this._ws.close();
};
_2db.disconnect=_2db.close;
function updateBufferedAmount(_2df){
_2df.bufferedAmount=_2df._ws.bufferedAmount;
if(_2df.bufferedAmount!=0){
setTimeout(function(){
updateBufferedAmount(_2df);
},1000);
}
};
function fromBase64(_2e0){
if(_2e0.length===0){
return [];
}
if(_2e0.length%4!==0){
throw new Error("Invalid base64 string (must be quads)");
}
var _2e1=new ByteBuffer();
for(var i=0;i<_2e0.length;i+=4){
var _2e3=_2e0.charAt(i);
var _2e4=_2e0.charAt(i+1);
var _2e5=_2e0.charAt(i+2);
var _2e6=_2e0.charAt(i+3);
var _2e7=_2e8[_2e3];
var _2e9=_2e8[_2e4];
var _2ea=_2e8[_2e5];
var _2eb=_2e8[_2e6];
_2e1.put(((_2e7<<2)&252)|((_2e9>>4)&3));
if(_2e5!="="){
_2e1.put(((_2e9<<4)&240)|((_2ea>>2)&15));
if(_2e6!="="){
_2e1.put(((_2ea<<6)&192)|(_2eb&63));
}
}
}
return _2e1.flip();
};
function toBase64(buf){
var _2ed=[];
var _2ee;
var _2ef;
var _2f0;
while(buf.hasRemaining()){
switch(buf.remaining()){
case 1:
_2ee=buf.getUnsigned();
_2ed.push(_2f1[(_2ee>>2)&63]);
_2ed.push(_2f1[((_2ee<<4)&48)]);
_2ed.push("=");
_2ed.push("=");
break;
case 2:
_2ee=buf.getUnsigned();
_2ef=buf.getUnsigned();
_2ed.push(_2f1[(_2ee>>2)&63]);
_2ed.push(_2f1[((_2ee<<4)&48)|((_2ef>>4)&15)]);
_2ed.push(_2f1[(_2ef<<2)&60]);
_2ed.push("=");
break;
default:
_2ee=buf.getUnsigned();
_2ef=buf.getUnsigned();
_2f0=buf.getUnsigned();
_2ed.push(_2f1[(_2ee>>2)&63]);
_2ed.push(_2f1[((_2ee<<4)&48)|((_2ef>>4)&15)]);
_2ed.push(_2f1[((_2ef<<2)&60)|((_2f0>>6)&3)]);
_2ed.push(_2f1[_2f0&63]);
break;
}
}
return _2ed.join("");
};
var _2f1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
var _2e8={"=":0};
for(var i=0;i<_2f1.length;i++){
_2e8[_2f1[i]]=i;
}
return _2cb;
})();
(function(){
var _2f3={"javascript:ws":_2ca,"javascript:wse":_2ca,"flash:ws":_24e,"flash:wse":_24e,"javascript:wss":_2ca,"javascript:wse+ssl":_2ca,"flash:wss":_24e,"flash:wse+ssl":_24e};
window.ByteSocket=function(url,_2f5){
this.URL=url;
this.readyState=0;
this._subprotocol=_2f5;
var _2f6=splitScheme(url);
var _2f7=_2f6.shift();
this._urlRemainder=_2f6.shift();
if(_2f7=="ws"||_2f7=="wse"||_2f7=="wss"||_2f7=="wse+ssl"){
var _2f8=_215("kaazing:ByteSocketConnectionStrategies");
if(_2f8){
var _2f9=_2f8.split(" ");
}
if(!_2f9){
if(_2f7=="ws"||_2f7=="wss"){
this._connectionStrategies=_219(ByteSocket.connectionStrategies);
}else{
if(_2f7.match("wse")){
var _2fa=function(s){
return s.match("wse");
};
this._connectionStrategies=_21d(ByteSocket.connectionStrategies,_2fa);
}
}
}
}else{
if(_223(ByteSocket.connectionStrategies,_2f7)!=-1){
this._connectionStrategies=[_2f7];
}else{
throw new Error("Unsupported composite scheme: "+_2f7);
}
}
fallbackNext(this);
};
window.ByteSocket.connectionStrategies=["javascript:ws","flash:ws","flash:wse","javascript:wse","javascript:wss","flash:wss","flash:wse+ssl","javascript:wse+ssl"];
window.ByteSocket.__impls__=_2f3;
var _2fc=ByteSocket.prototype;
function splitScheme(url){
var _2fe=url.split("://");
var _2ff=_2fe.shift();
var _300=_2fe.shift();
return [_2ff,_300];
};
_2fc.send=function(data){
switch(this.readyState){
case 0:
throw new Error("INVALID_STATE_ERR");
break;
case 1:
if(data===null){
throw new Error("data is null");
}
this._delegate.send(data);
_302(this);
return true;
break;
case 2:
return false;
break;
default:
throw new Error("INVALID_STATE_ERR");
}
};
var _302=function(_303){
_303.bufferedAmount=_303._delegate.bufferedAmount;
if(_303.bufferedAmount!=0){
setTimeout(function(){
_302(_303);
},1000);
}
};
_2fc.postMessage=_2fc.send;
_2fc.disconnect=_2fc.close;
_2fc.close=function(){
switch(this.readyState){
case 1:
case 2:
this._delegate.close();
break;
}
};
function initDelegate(_304,_305){
if(typeof (_304._subprotocol)!=="undefined"){
_304._delegate=new _305(_304.URL,_304._subprotocol);
}else{
_304._delegate=new _305(_304.URL);
}
bindHandlers(_304);
};
function fallbackNext(_306){
var _307=_306._connectionStrategies.shift();
var _308=_2f3[_307];
var _309=[_307,"://",_306._urlRemainder].join();
if(_308){
initDelegate(_306,_308,_309);
}else{
doClose(_306);
}
};
function doMessage(_30a,e){
if(typeof (_30a.onmessage)==="function"){
_30a.onmessage(e);
}
};
function doClose(_30c){
if(typeof (_30c.onclose)==="function"){
_30c.onclose();
}
};
function doOpen(_30d){
if(typeof (_30d.onopen)==="function"){
_30d.onopen();
}
};
function errorHandler(_30e,e){
unbindHandlers(_30e);
fallbackNext(_30e);
};
function messageHandler(_310,e){
switch(_310.readyState){
case 1:
_310.readyState=1;
setTimeout(function(){
doMessage(_310,e);
},0);
break;
case 0:
case 2:
break;
default:
throw new Error("Socket has invalid readyState: "+_310.readyState);
}
};
function openHandler(_312,e){
switch(_312.readyState){
case 0:
_312.readyState=1;
setTimeout(function(){
doOpen(_312);
},0);
break;
case 1:
case 2:
throw new Error("Invalid readyState for open event from "+e.target);
break;
default:
throw new Error("Socket has invalid readyState: "+_312.readyState);
}
};
function closeHandler(_314,e){
switch(_314.readyState){
case 0:
unbindHandlers(_314);
doClose(_314);
break;
case 1:
_314.readyState=2;
setTimeout(function(){
doClose(_314);
},0);
break;
case 2:
throw new Error("Invalid readyState for close event from "+e.target);
break;
default:
throw new Error("Socket has invalid readyState: "+_314.readyState);
}
};
function bindHandlers(_316){
var _317=_316._delegate;
_317.onmessage=function(e){
messageHandler(_316,e);
};
_317.onclose=function(e){
closeHandler(_316,e);
};
_317.onopen=function(e){
openHandler(_316,e);
};
_317.onerror=function(e){
errorHandler(_316,e);
};
};
function unbindHandlers(_31c){
var _31d=_31c._delegate;
if(_31d){
_31d.onerror=undefined;
_31d.onmessage=undefined;
_31d.onclose=undefined;
_31d.onopen=undefined;
}
};
}());
(function(){
var _31e={"javascript:ws":_228,"javascript:wse":_2ad,"flash:ws":_23c,"flash:wse":_23c,"javascript:wss":_228,"javascript:wse+ssl":_2ad,"flash:wss":_23c,"flash:wse+ssl":_23c};
window.WebSocket=function(url,_320){
this.URL=url;
this.readyState=0;
this._subprotocol=_320;
var _321=splitScheme(url);
var _322=_321.shift();
this._urlRemainder=_321.shift();
if(_322=="ws"||_322=="wse"||_322=="wss"||_322=="wse+ssl"){
var _323=_215("kaazing:WebSocketConnectionStrategies");
if(_323){
var _324=_323.split(" ");
}
if(!_324){
if(_322=="ws"||_322=="wss"){
this._connectionStrategies=_219(WebSocket.connectionStrategies);
}else{
if(_322.match("wse")){
var _325=function(s){
return s.match("wse");
};
this._connectionStrategies=_21d(WebSocket.connectionStrategies,_325);
}
}
}
}else{
if(_223(WebSocket.connectionStrategies,_322)!=-1){
this._connectionStrategies=[_322];
}else{
throw new Error("Unsupported composite scheme: "+_322);
}
}
fallbackNext(this);
};
window.WebSocket.connectionStrategies=["javascript:ws","flash:ws","flash:wse","javascript:wse","javascript:wss","flash:wss","flash:wse+ssl","javascript:wse+ssl"];
window.WebSocket.__impls__=_31e;
var _327=WebSocket.prototype;
function splitScheme(url){
var _329=url.split("://");
var _32a=_329.shift();
var _32b=_329.shift();
return [_32a,_32b];
};
_327.send=function(data){
switch(this.readyState){
case 0:
throw new Error("INVALID_STATE_ERR");
break;
case 1:
if(data===null){
throw new Error("data is null");
}
this._delegate.send(data);
_32d(this);
return true;
break;
case 2:
return false;
break;
default:
throw new Error("INVALID_STATE_ERR");
}
};
var _32d=function(_32e){
_32e.bufferedAmount=_32e._delegate.bufferedAmount;
if(_32e.bufferedAmount!=0){
setTimeout(function(){
_32d(_32e);
},1000);
}
};
_327.postMessage=_327.send;
_327.disconnect=_327.close;
_327.close=function(){
switch(this.readyState){
case 1:
case 2:
this._delegate.close();
break;
}
};
function initDelegate(_32f,_330){
if(typeof (_32f._subprotocol)!=="undefined"){
_32f._delegate=new _330(_32f.URL,_32f._subprotocol);
}else{
_32f._delegate=new _330(_32f.URL);
}
bindHandlers(_32f);
};
function fallbackNext(_331){
var _332=_331._connectionStrategies.shift();
var _333=_31e[_332];
var _334=[_332,"://",_331._urlRemainder].join();
if(_333){
initDelegate(_331,_333,_334);
}else{
doClose(_331);
}
};
function doMessage(_335,e){
if(typeof (_335.onmessage)==="function"){
_335.onmessage(e);
}
};
function doClose(_337){
if(typeof (_337.onclose)==="function"){
_337.onclose();
}
};
function doOpen(_338){
if(typeof (_338.onopen)==="function"){
_338.onopen();
}
};
function errorHandler(_339,e){
unbindHandlers(_339);
fallbackNext(_339);
};
function messageHandler(_33b,e){
switch(_33b.readyState){
case 1:
_33b.readyState=1;
setTimeout(function(){
doMessage(_33b,e);
},0);
break;
case 0:
case 2:
break;
default:
throw new Error("Socket has invalid readyState: "+_33b.readyState);
}
};
function openHandler(_33d,e){
switch(_33d.readyState){
case 0:
_33d.readyState=1;
setTimeout(function(){
doOpen(_33d);
},0);
break;
case 1:
case 2:
throw new Error("Invalid readyState for open event from "+e.target);
break;
default:
throw new Error("Socket has invalid readyState: "+_33d.readyState);
}
};
function closeHandler(_33f,e){
switch(_33f.readyState){
case 0:
unbindHandlers(_33f);
doClose(_33f);
break;
case 1:
_33f.readyState=2;
setTimeout(function(){
doClose(_33f);
},0);
break;
case 2:
throw new Error("Invalid readyState for close event from "+e.target);
break;
default:
throw new Error("Socket has invalid readyState: "+_33f.readyState);
}
};
function bindHandlers(_341){
var _342=_341._delegate;
_342.onmessage=function(e){
messageHandler(_341,e);
};
_342.onclose=function(e){
closeHandler(_341,e);
};
_342.onopen=function(e){
openHandler(_341,e);
};
_342.onerror=function(e){
errorHandler(_341,e);
};
};
function unbindHandlers(_347){
var _348=_347._delegate;
if(_348){
_348.onerror=undefined;
_348.onmessage=undefined;
_348.onclose=undefined;
_348.onopen=undefined;
}
};
}());
window.___Loader=new _288("ByteSocket",[window.WebSocket,window.ByteSocket],["WebSocket","ByteSocket"]);
})();
})();
