UNPKG

angularjs-shoe

Version:

Use shoe with angularjs

2 lines 78.7 kB
!function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i}({1:[function(require,module,exports){var shoe=require("shoe"),reconnect=require("reconnect");angular.module("eugeneware.shoe",[]).factory("reconnect",function($rootScope){return function(cb){var shoe=reconnect(function(stream){var _emit=stream.emit;stream.emit=function(){var args=[].slice.call(arguments);return $rootScope.$apply(function(){return _emit.apply(stream,args)})};cb.call(shoe,stream)});return shoe}}).factory("shoe",function($rootScope){return function(uri,cb){var stream=shoe(uri,function(){var _emit=stream.emit;stream.emit=function(){var args=[].slice.call(arguments);return $rootScope.$apply(function(){return _emit.apply(stream,args)})};$rootScope.$apply(function(){if(cb)cb.call(stream)})});return stream}})},{shoe:2,reconnect:3}],4:[function(require,module,exports){var events=require("events");var util=require("util");function Stream(){events.EventEmitter.call(this)}util.inherits(Stream,events.EventEmitter);module.exports=Stream;Stream.Stream=Stream;Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){dest._pipeCount=dest._pipeCount||0;dest._pipeCount++;source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest._pipeCount--;cleanup();if(dest._pipeCount>0){return}dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;dest._pipeCount--;cleanup();if(dest._pipeCount>0){return}dest.destroy()}function onerror(er){cleanup();if(this.listeners("error").length===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("end",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("end",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:5,util:6}],7:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){if(ev.source===window&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],5:[function(require,module,exports){!function(process){if(!process.EventEmitter)process.EventEmitter=function(){};var EventEmitter=exports.EventEmitter=process.EventEmitter;var isArray=typeof Array.isArray==="function"?Array.isArray:function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function indexOf(xs,x){if(xs.indexOf)return xs.indexOf(x);for(var i=0;i<xs.length;i++){if(x===xs[i])return i}return-1}var defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!this._events)this._events={};this._events.maxListeners=n};EventEmitter.prototype.emit=function(type){if(type==="error"){if(!this._events||!this._events.error||isArray(this._events.error)&&!this._events.error.length){if(arguments[1]instanceof Error){throw arguments[1]}else{throw new Error("Uncaught, unspecified 'error' event.")}return false}}if(!this._events)return false;var handler=this._events[type];if(!handler)return false;if(typeof handler=="function"){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:var args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}return true}else if(isArray(handler)){var args=Array.prototype.slice.call(arguments,1);var listeners=handler.slice();for(var i=0,l=listeners.length;i<l;i++){listeners[i].apply(this,args)}return true}else{return false}};EventEmitter.prototype.addListener=function(type,listener){if("function"!==typeof listener){throw new Error("addListener only takes instances of Function")}if(!this._events)this._events={};this.emit("newListener",type,listener);if(!this._events[type]){this._events[type]=listener}else if(isArray(this._events[type])){if(!this._events[type].warned){var m;if(this._events.maxListeners!==undefined){m=this._events.maxListeners}else{m=defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);console.trace()}}this._events[type].push(listener)}else{this._events[type]=[this._events[type],listener]}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){var self=this;self.on(type,function g(){self.removeListener(type,g);listener.apply(this,arguments)});return this};EventEmitter.prototype.removeListener=function(type,listener){if("function"!==typeof listener){throw new Error("removeListener only takes instances of Function")}if(!this._events||!this._events[type])return this;var list=this._events[type];if(isArray(list)){var i=indexOf(list,listener);if(i<0)return this;list.splice(i,1);if(list.length==0)delete this._events[type]}else if(this._events[type]===listener){delete this._events[type]}return this};EventEmitter.prototype.removeAllListeners=function(type){if(arguments.length===0){this._events={};return this}if(type&&this._events&&this._events[type])this._events[type]=null;return this};EventEmitter.prototype.listeners=function(type){if(!this._events)this._events={};if(!this._events[type])this._events[type]=[];if(!isArray(this._events[type])){this._events[type]=[this._events[type]]}return this._events[type]}}(require("__browserify_process"))},{__browserify_process:7}],6:[function(require,module,exports){var events=require("events");exports.isArray=isArray;exports.isDate=function(obj){return Object.prototype.toString.call(obj)==="[object Date]"};exports.isRegExp=function(obj){return Object.prototype.toString.call(obj)==="[object RegExp]"};exports.print=function(){};exports.puts=function(){};exports.debug=function(){};exports.inspect=function(obj,showHidden,depth,colors){var seen=[];var stylize=function(str,styleType){var styles={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};var style={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[styleType];if(style){return"["+styles[style][0]+"m"+str+"["+styles[style][1]+"m"}else{return str}};if(!colors){stylize=function(str,styleType){return str}}function format(value,recurseTimes){if(value&&typeof value.inspect==="function"&&value!==exports&&!(value.constructor&&value.constructor.prototype===value)){return value.inspect(recurseTimes)}switch(typeof value){case"undefined":return stylize("undefined","undefined");case"string":var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return stylize(simple,"string");case"number":return stylize(""+value,"number");case"boolean":return stylize(""+value,"boolean")}if(value===null){return stylize("null","null")}var visible_keys=Object_keys(value);var keys=showHidden?Object_getOwnPropertyNames(value):visible_keys;if(typeof value==="function"&&keys.length===0){if(isRegExp(value)){return stylize(""+value,"regexp")}else{var name=value.name?": "+value.name:"";return stylize("[Function"+name+"]","special")}}if(isDate(value)&&keys.length===0){return stylize(value.toUTCString(),"date")}var base,type,braces;if(isArray(value)){type="Array";braces=["[","]"]}else{type="Object";braces=["{","}"]}if(typeof value==="function"){var n=value.name?": "+value.name:"";base=isRegExp(value)?" "+value:" [Function"+n+"]"}else{base=""}if(isDate(value)){base=" "+value.toUTCString()}if(keys.length===0){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return stylize(""+value,"regexp")}else{return stylize("[Object]","special")}}seen.push(value);var output=keys.map(function(key){var name,str;if(value.__lookupGetter__){if(value.__lookupGetter__(key)){if(value.__lookupSetter__(key)){str=stylize("[Getter/Setter]","special")}else{str=stylize("[Getter]","special")}}else{if(value.__lookupSetter__(key)){str=stylize("[Setter]","special")}}}if(visible_keys.indexOf(key)<0){name="["+key+"]"}if(!str){if(seen.indexOf(value[key])<0){if(recurseTimes===null){str=format(value[key])}else{str=format(value[key],recurseTimes-1)}if(str.indexOf("\n")>-1){if(isArray(value)){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=stylize("[Circular]","special")}}if(typeof name==="undefined"){if(type==="Array"&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=stylize(name,"string")}}return name+": "+str});seen.pop();var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.length+1},0);if(length>50){output=braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}else{output=braces[0]+base+" "+output.join(", ")+" "+braces[1]}return output}return format(obj,typeof depth==="undefined"?2:depth)};function isArray(ar){return ar instanceof Array||Array.isArray(ar)||ar&&ar!==Object.prototype&&isArray(ar.__proto__)}function isRegExp(re){return re instanceof RegExp||typeof re==="object"&&Object.prototype.toString.call(re)==="[object RegExp]"}function isDate(d){if(d instanceof Date)return true;if(typeof d!=="object")return false;var properties=Date.prototype&&Object_getOwnPropertyNames(Date.prototype);var proto=d.__proto__&&Object_getOwnPropertyNames(d.__proto__);return JSON.stringify(proto)===JSON.stringify(properties)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(msg){};exports.pump=null;var Object_keys=Object.keys||function(obj){var res=[];for(var key in obj)res.push(key);return res};var Object_getOwnPropertyNames=Object.getOwnPropertyNames||function(obj){var res=[];for(var key in obj){if(Object.hasOwnProperty.call(obj,key))res.push(key)}return res};var Object_create=Object.create||function(prototype,properties){var object;if(prototype===null){object={__proto__:null}}else{if(typeof prototype!=="object"){throw new TypeError("typeof prototype["+typeof prototype+"] != 'object'")}var Type=function(){};Type.prototype=prototype;object=new Type;object.__proto__=prototype}if(typeof properties!=="undefined"&&Object.defineProperties){Object.defineProperties(object,properties)}return object};exports.inherits=function(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object_create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})};var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(typeof f!=="string"){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(exports.inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":return JSON.stringify(args[i++]);default:return x}});for(var x=args[i];i<len;x=args[++i]){if(x===null||typeof x!=="object"){str+=" "+x}else{str+=" "+exports.inspect(x)}}return str}},{events:5}],2:[function(require,module,exports){var Stream=require("stream");var sockjs=require("sockjs-client");module.exports=function(uri,cb){if(/^\/\/[^\/]+\//.test(uri)){uri=window.location.protocol+uri}else if(!/^https?:\/\//.test(uri)){uri=window.location.protocol+"//"+window.location.host+(/^\//.test(uri)?uri:"/"+uri)}var stream=new Stream;stream.readable=true;stream.writable=true;var ready=false;var buffer=[];var sock=sockjs(uri);stream.sock=sock;stream.write=function(msg){if(!ready||buffer.length)buffer.push(msg);else sock.send(msg)};stream.end=function(msg){if(msg!==undefined)stream.write(msg);if(!ready){stream._ended=true;return}stream.writable=false;sock.close()};stream.destroy=function(){stream._ended=true;stream.writable=stream.readable=false;buffer.length=0;sock.close()};sock.onopen=function(){if(typeof cb==="function")cb();ready=true;for(var i=0;i<buffer.length;i++){sock.send(buffer[i])}buffer=[];stream.emit("connect");if(stream._ended)stream.end()};sock.onmessage=function(e){stream.emit("data",e.data)};sock.onclose=function(){stream.emit("end");stream.writable=false;stream.readable=false};return stream}},{stream:4,"sockjs-client":8}],8:[function(require,module,exports){!function(){var JSON;JSON||(JSON={}),function(){function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g;return e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)typeof rep[c]=="string"&&(d=rep[c],e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g;return e}}function quote(a){escapable.lastIndex=0;return escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function f(a){return a<10?"0"+a:a}"use strict",typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver=="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")})}();var SockJS=function(){var _document=document;var _window=window;var utils={};var REventTarget=function(){};REventTarget.prototype.addEventListener=function(eventType,listener){if(!this._listeners){this._listeners={}}if(!(eventType in this._listeners)){this._listeners[eventType]=[]}var arr=this._listeners[eventType];if(utils.arrIndexOf(arr,listener)===-1){arr.push(listener)}return};REventTarget.prototype.removeEventListener=function(eventType,listener){if(!(this._listeners&&eventType in this._listeners)){return}var arr=this._listeners[eventType];var idx=utils.arrIndexOf(arr,listener);if(idx!==-1){if(arr.length>1){this._listeners[eventType]=arr.slice(0,idx).concat(arr.slice(idx+1))}else{delete this._listeners[eventType]}return}return};REventTarget.prototype.dispatchEvent=function(event){var t=event.type;var args=Array.prototype.slice.call(arguments,0);if(this["on"+t]){this["on"+t].apply(this,args)}if(this._listeners&&t in this._listeners){for(var i=0;i<this._listeners[t].length;i++){this._listeners[t][i].apply(this,args)}}};var SimpleEvent=function(type,obj){this.type=type;if(typeof obj!=="undefined"){for(var k in obj){if(!obj.hasOwnProperty(k))continue;this[k]=obj[k]}}};SimpleEvent.prototype.toString=function(){var r=[];for(var k in this){if(!this.hasOwnProperty(k))continue;var v=this[k];if(typeof v==="function")v="[function]";r.push(k+"="+v)}return"SimpleEvent("+r.join(", ")+")"};var EventEmitter=function(events){this.events=events||[]};EventEmitter.prototype.emit=function(type){var that=this;var args=Array.prototype.slice.call(arguments,1);if(!that.nuked&&that["on"+type]){that["on"+type].apply(that,args)}if(utils.arrIndexOf(that.events,type)===-1){utils.log("Event "+JSON.stringify(type)+" not listed "+JSON.stringify(that.events)+" in "+that)}};EventEmitter.prototype.nuke=function(type){var that=this;that.nuked=true;for(var i=0;i<that.events.length;i++){delete that[that.events[i]]}};var random_string_chars="abcdefghijklmnopqrstuvwxyz0123456789_";utils.random_string=function(length,max){max=max||random_string_chars.length;var i,ret=[];for(i=0;i<length;i++){ret.push(random_string_chars.substr(Math.floor(Math.random()*max),1))}return ret.join("")};utils.random_number=function(max){return Math.floor(Math.random()*max)};utils.random_number_string=function(max){var t=(""+(max-1)).length;var p=Array(t+1).join("0");return(p+utils.random_number(max)).slice(-t)};utils.getOrigin=function(url){url+="/";var parts=url.split("/").slice(0,3);return parts.join("/")};utils.isSameOriginUrl=function(url_a,url_b){if(!url_b)url_b=_window.location.href;return url_a.split("/").slice(0,3).join("/")===url_b.split("/").slice(0,3).join("/")};utils.getParentDomain=function(url){if(/^[0-9.]*$/.test(url))return url;if(/^\[/.test(url))return url;if(!/[.]/.test(url))return url;var parts=url.split(".").slice(1);return parts.join(".")};utils.objectExtend=function(dst,src){for(var k in src){if(src.hasOwnProperty(k)){dst[k]=src[k]}}return dst};var WPrefix="_jp";utils.polluteGlobalNamespace=function(){if(!(WPrefix in _window)){_window[WPrefix]={}}};utils.closeFrame=function(code,reason){return"c"+JSON.stringify([code,reason])};utils.userSetCode=function(code){return code===1e3||code>=3e3&&code<=4999};utils.countRTO=function(rtt){var rto;if(rtt>100){rto=3*rtt}else{rto=rtt+200}return rto};utils.log=function(){if(_window.console&&console.log&&console.log.apply){console.log.apply(console,arguments)}};utils.bind=function(fun,that){if(fun.bind){return fun.bind(that)}else{return function(){return fun.apply(that,arguments)}}};utils.flatUrl=function(url){return url.indexOf("?")===-1&&url.indexOf("#")===-1};utils.amendUrl=function(url){var dl=_document.location;if(!url){throw new Error("Wrong url for SockJS")}if(!utils.flatUrl(url)){throw new Error("Only basic urls are supported in SockJS")}if(url.indexOf("//")===0){url=dl.protocol+url}if(url.indexOf("/")===0){url=dl.protocol+"//"+dl.host+url}url=url.replace(/[/]+$/,"");return url};utils.arrIndexOf=function(arr,obj){for(var i=0;i<arr.length;i++){if(arr[i]===obj){return i}}return-1};utils.arrSkip=function(arr,obj){var idx=utils.arrIndexOf(arr,obj);if(idx===-1){return arr.slice()}else{var dst=arr.slice(0,idx);return dst.concat(arr.slice(idx+1))}};utils.isArray=Array.isArray||function(value){return{}.toString.call(value).indexOf("Array")>=0};utils.delay=function(t,fun){if(typeof t==="function"){fun=t;t=0}return setTimeout(fun,t)};var json_escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,json_lookup={"\0":"\\u0000","":"\\u0001","":"\\u0002","":"\\u0003","":"\\u0004","":"\\u0005","":"\\u0006","":"\\u0007","\b":"\\b"," ":"\\t","\n":"\\n"," ":"\\u000b","\f":"\\f","\r":"\\r","":"\\u000e","":"\\u000f","":"\\u0010","":"\\u0011","":"\\u0012","":"\\u0013","":"\\u0014","":"\\u0015","":"\\u0016","":"\\u0017","":"\\u0018","":"\\u0019","":"\\u001a","":"\\u001b","":"\\u001c","":"\\u001d","":"\\u001e","":"\\u001f",'"':'\\"',"\\":"\\\\","":"\\u007f","€":"\\u0080","":"\\u0081","‚":"\\u0082","ƒ":"\\u0083","„":"\\u0084","…":"\\u0085","†":"\\u0086","‡":"\\u0087","ˆ":"\\u0088","‰":"\\u0089","Š":"\\u008a","‹":"\\u008b","Œ":"\\u008c","":"\\u008d","Ž":"\\u008e","":"\\u008f","":"\\u0090","‘":"\\u0091","’":"\\u0092","“":"\\u0093","”":"\\u0094","•":"\\u0095","–":"\\u0096","—":"\\u0097","˜":"\\u0098","™":"\\u0099","š":"\\u009a","›":"\\u009b","œ":"\\u009c","":"\\u009d","ž":"\\u009e","Ÿ":"\\u009f","­":"\\u00ad","؀":"\\u0600","؁":"\\u0601","؂":"\\u0602","؃":"\\u0603","؄":"\\u0604","܏":"\\u070f","឴":"\\u17b4","឵":"\\u17b5","‌":"\\u200c","‍":"\\u200d","‎":"\\u200e","‏":"\\u200f","\u2028":"\\u2028","\u2029":"\\u2029","‪":"\\u202a","‫":"\\u202b","‬":"\\u202c","‭":"\\u202d","‮":"\\u202e"," ":"\\u202f","⁠":"\\u2060","⁡":"\\u2061","⁢":"\\u2062","⁣":"\\u2063","⁤":"\\u2064","⁥":"\\u2065","⁦":"\\u2066","⁧":"\\u2067","⁨":"\\u2068","⁩":"\\u2069","":"\\u206a","":"\\u206b","":"\\u206c","":"\\u206d","":"\\u206e","":"\\u206f","":"\\ufeff","￰":"\\ufff0","￱":"\\ufff1","￲":"\\ufff2","￳":"\\ufff3","￴":"\\ufff4","￵":"\\ufff5","￶":"\\ufff6","￷":"\\ufff7","￸":"\\ufff8","":"\\ufff9","":"\\ufffa","":"\\ufffb","":"\\ufffc","�":"\\ufffd","￾":"\\ufffe","￿":"\\uffff"};var extra_escapable=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,extra_lookup;var JSONQuote=JSON&&JSON.stringify||function(string){json_escapable.lastIndex=0;if(json_escapable.test(string)){string=string.replace(json_escapable,function(a){return json_lookup[a]})}return'"'+string+'"'};var unroll_lookup=function(escapable){var i;var unrolled={};var c=[];for(i=0;i<65536;i++){c.push(String.fromCharCode(i))}escapable.lastIndex=0;c.join("").replace(escapable,function(a){unrolled[a]="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return""});escapable.lastIndex=0;return unrolled};utils.quote=function(string){var quoted=JSONQuote(string);extra_escapable.lastIndex=0;if(!extra_escapable.test(quoted)){return quoted}if(!extra_lookup)extra_lookup=unroll_lookup(extra_escapable);return quoted.replace(extra_escapable,function(a){return extra_lookup[a]})};var _all_protocols=["websocket","xdr-streaming","xhr-streaming","iframe-eventsource","iframe-htmlfile","xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"];utils.probeProtocols=function(){var probed={};for(var i=0;i<_all_protocols.length;i++){var protocol=_all_protocols[i];probed[protocol]=SockJS[protocol]&&SockJS[protocol].enabled()}return probed};utils.detectProtocols=function(probed,protocols_whitelist,info){var pe={},protocols=[];if(!protocols_whitelist)protocols_whitelist=_all_protocols;for(var i=0;i<protocols_whitelist.length;i++){var protocol=protocols_whitelist[i];pe[protocol]=probed[protocol]}var maybe_push=function(protos){var proto=protos.shift();if(pe[proto]){protocols.push(proto)}else{if(protos.length>0){maybe_push(protos)}}};if(info.websocket!==false){maybe_push(["websocket"])}if(pe["xhr-streaming"]&&!info.null_origin){protocols.push("xhr-streaming")}else{if(pe["xdr-streaming"]&&!info.cookie_needed&&!info.null_origin){protocols.push("xdr-streaming")}else{maybe_push(["iframe-eventsource","iframe-htmlfile"])}}if(pe["xhr-polling"]&&!info.null_origin){protocols.push("xhr-polling")}else{if(pe["xdr-polling"]&&!info.cookie_needed&&!info.null_origin){protocols.push("xdr-polling")}else{maybe_push(["iframe-xhr-polling","jsonp-polling"])}}return protocols};var MPrefix="_sockjs_global";utils.createHook=function(){var window_id="a"+utils.random_string(8);if(!(MPrefix in _window)){var map={};_window[MPrefix]=function(window_id){if(!(window_id in map)){map[window_id]={id:window_id,del:function(){delete map[window_id]}}}return map[window_id]}}return _window[MPrefix](window_id)};utils.attachMessage=function(listener){utils.attachEvent("message",listener)};utils.attachEvent=function(event,listener){if(typeof _window.addEventListener!=="undefined"){_window.addEventListener(event,listener,false)}else{_document.attachEvent("on"+event,listener);_window.attachEvent("on"+event,listener)}};utils.detachMessage=function(listener){utils.detachEvent("message",listener)};utils.detachEvent=function(event,listener){if(typeof _window.addEventListener!=="undefined"){_window.removeEventListener(event,listener,false)}else{_document.detachEvent("on"+event,listener);_window.detachEvent("on"+event,listener)}};var on_unload={};var after_unload=false;var trigger_unload_callbacks=function(){for(var ref in on_unload){on_unload[ref]();delete on_unload[ref]}};var unload_triggered=function(){if(after_unload)return;after_unload=true;trigger_unload_callbacks()};utils.attachEvent("beforeunload",unload_triggered);utils.attachEvent("unload",unload_triggered);utils.unload_add=function(listener){var ref=utils.random_string(8);on_unload[ref]=listener;if(after_unload){utils.delay(trigger_unload_callbacks)}return ref};utils.unload_del=function(ref){if(ref in on_unload)delete on_unload[ref]};utils.createIframe=function(iframe_url,error_callback){var iframe=_document.createElement("iframe");var tref,unload_ref;var unattach=function(){clearTimeout(tref);try{iframe.onload=null}catch(x){}iframe.onerror=null};var cleanup=function(){if(iframe){unattach();setTimeout(function(){if(iframe){iframe.parentNode.removeChild(iframe)}iframe=null},0);utils.unload_del(unload_ref)}};var onerror=function(r){if(iframe){cleanup();error_callback(r)}};var post=function(msg,origin){try{if(iframe&&iframe.contentWindow){iframe.contentWindow.postMessage(msg,origin)}}catch(x){}};iframe.src=iframe_url;iframe.style.display="none";iframe.style.position="absolute";iframe.onerror=function(){onerror("onerror")};iframe.onload=function(){clearTimeout(tref);tref=setTimeout(function(){onerror("onload timeout")},2e3)};_document.body.appendChild(iframe);tref=setTimeout(function(){onerror("timeout")},15e3);unload_ref=utils.unload_add(cleanup);return{post:post,cleanup:cleanup,loaded:unattach}};utils.createHtmlfile=function(iframe_url,error_callback){var doc=new ActiveXObject("htmlfile");var tref,unload_ref;var iframe;var unattach=function(){clearTimeout(tref)};var cleanup=function(){if(doc){unattach();utils.unload_del(unload_ref);iframe.parentNode.removeChild(iframe);iframe=doc=null;CollectGarbage()}};var onerror=function(r){if(doc){cleanup();error_callback(r)}};var post=function(msg,origin){try{if(iframe&&iframe.contentWindow){iframe.contentWindow.postMessage(msg,origin)}}catch(x){}};doc.open();doc.write("<html><s"+"cript>"+'document.domain="'+document.domain+'";'+"</s"+"cript></html>");doc.close();doc.parentWindow[WPrefix]=_window[WPrefix];var c=doc.createElement("div");doc.body.appendChild(c);iframe=doc.createElement("iframe");c.appendChild(iframe);iframe.src=iframe_url;tref=setTimeout(function(){onerror("timeout")},15e3);unload_ref=utils.unload_add(cleanup);return{post:post,cleanup:cleanup,loaded:unattach}};var AbstractXHRObject=function(){};AbstractXHRObject.prototype=new EventEmitter(["chunk","finish"]);AbstractXHRObject.prototype._start=function(method,url,payload,opts){var that=this;try{that.xhr=new XMLHttpRequest}catch(x){}if(!that.xhr){try{that.xhr=new _window.ActiveXObject("Microsoft.XMLHTTP")}catch(x){}}if(_window.ActiveXObject||_window.XDomainRequest){url+=(url.indexOf("?")===-1?"?":"&")+"t="+ +new Date}that.unload_ref=utils.unload_add(function(){that._cleanup(true)});try{that.xhr.open(method,url,true)}catch(e){that.emit("finish",0,"");that._cleanup();return}if(!opts||!opts.no_credentials){that.xhr.withCredentials="true"}if(opts&&opts.headers){for(var key in opts.headers){that.xhr.setRequestHeader(key,opts.headers[key])}}that.xhr.onreadystatechange=function(){if(that.xhr){var x=that.xhr;switch(x.readyState){case 3:try{var status=x.status;var text=x.responseText}catch(x){};if(text&&text.length>0){that.emit("chunk",status,text)}break;case 4:that.emit("finish",x.status,x.responseText);that._cleanup(false);break}}};that.xhr.send(payload)};AbstractXHRObject.prototype._cleanup=function(abort){var that=this;if(!that.xhr)return;utils.unload_del(that.unload_ref);that.xhr.onreadystatechange=function(){};if(abort){try{that.xhr.abort()}catch(x){}}that.unload_ref=that.xhr=null};AbstractXHRObject.prototype.close=function(){var that=this;that.nuke();that._cleanup(true)};var XHRCorsObject=utils.XHRCorsObject=function(){var that=this,args=arguments;utils.delay(function(){that._start.apply(that,args)})};XHRCorsObject.prototype=new AbstractXHRObject;var XHRLocalObject=utils.XHRLocalObject=function(method,url,payload){var that=this;utils.delay(function(){that._start(method,url,payload,{no_credentials:true})})};XHRLocalObject.prototype=new AbstractXHRObject; var XDRObject=utils.XDRObject=function(method,url,payload){var that=this;utils.delay(function(){that._start(method,url,payload)})};XDRObject.prototype=new EventEmitter(["chunk","finish"]);XDRObject.prototype._start=function(method,url,payload){var that=this;var xdr=new XDomainRequest;url+=(url.indexOf("?")===-1?"?":"&")+"t="+ +new Date;var onerror=xdr.ontimeout=xdr.onerror=function(){that.emit("finish",0,"");that._cleanup(false)};xdr.onprogress=function(){that.emit("chunk",200,xdr.responseText)};xdr.onload=function(){that.emit("finish",200,xdr.responseText);that._cleanup(false)};that.xdr=xdr;that.unload_ref=utils.unload_add(function(){that._cleanup(true)});try{that.xdr.open(method,url);that.xdr.send(payload)}catch(x){onerror()}};XDRObject.prototype._cleanup=function(abort){var that=this;if(!that.xdr)return;utils.unload_del(that.unload_ref);that.xdr.ontimeout=that.xdr.onerror=that.xdr.onprogress=that.xdr.onload=null;if(abort){try{that.xdr.abort()}catch(x){}}that.unload_ref=that.xdr=null};XDRObject.prototype.close=function(){var that=this;that.nuke();that._cleanup(true)};utils.isXHRCorsCapable=function(){if(_window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest){return 1}if(_window.XDomainRequest&&_document.domain){return 2}if(IframeTransport.enabled()){return 3}return 4};var SockJS=function(url,dep_protocols_whitelist,options){if(this===window){return new SockJS(url,dep_protocols_whitelist,options)}var that=this,protocols_whitelist;that._options={devel:false,debug:false,protocols_whitelist:[],info:undefined,rtt:undefined};if(options){utils.objectExtend(that._options,options)}that._base_url=utils.amendUrl(url);that._server=that._options.server||utils.random_number_string(1e3);if(that._options.protocols_whitelist&&that._options.protocols_whitelist.length){protocols_whitelist=that._options.protocols_whitelist}else{if(typeof dep_protocols_whitelist==="string"&&dep_protocols_whitelist.length>0){protocols_whitelist=[dep_protocols_whitelist]}else if(utils.isArray(dep_protocols_whitelist)){protocols_whitelist=dep_protocols_whitelist}else{protocols_whitelist=null}if(protocols_whitelist){that._debug('Deprecated API: Use "protocols_whitelist" option '+"instead of supplying protocol list as a second "+"parameter to SockJS constructor.")}}that._protocols=[];that.protocol=null;that.readyState=SockJS.CONNECTING;that._ir=createInfoReceiver(that._base_url);that._ir.onfinish=function(info,rtt){that._ir=null;if(info){if(that._options.info){info=utils.objectExtend(info,that._options.info)}if(that._options.rtt){rtt=that._options.rtt}that._applyInfo(info,rtt,protocols_whitelist);that._didClose()}else{that._didClose(1002,"Can't connect to server",true)}}};SockJS.prototype=new REventTarget;SockJS.version="0.3.1.7.ga67f.dirty";SockJS.CONNECTING=0;SockJS.OPEN=1;SockJS.CLOSING=2;SockJS.CLOSED=3;SockJS.prototype._debug=function(){if(this._options.debug)utils.log.apply(utils,arguments)};SockJS.prototype._dispatchOpen=function(){var that=this;if(that.readyState===SockJS.CONNECTING){if(that._transport_tref){clearTimeout(that._transport_tref);that._transport_tref=null}that.readyState=SockJS.OPEN;that.dispatchEvent(new SimpleEvent("open"))}else{that._didClose(1006,"Server lost session")}};SockJS.prototype._dispatchMessage=function(data){var that=this;if(that.readyState!==SockJS.OPEN)return;that.dispatchEvent(new SimpleEvent("message",{data:data}))};SockJS.prototype._dispatchHeartbeat=function(data){var that=this;if(that.readyState!==SockJS.OPEN)return;that.dispatchEvent(new SimpleEvent("heartbeat",{}))};SockJS.prototype._didClose=function(code,reason,force){var that=this;if(that.readyState!==SockJS.CONNECTING&&that.readyState!==SockJS.OPEN&&that.readyState!==SockJS.CLOSING)throw new Error("INVALID_STATE_ERR");if(that._ir){that._ir.nuke();that._ir=null}if(that._transport){that._transport.doCleanup();that._transport=null}var close_event=new SimpleEvent("close",{code:code,reason:reason,wasClean:utils.userSetCode(code)});if(!utils.userSetCode(code)&&that.readyState===SockJS.CONNECTING&&!force){if(that._try_next_protocol(close_event)){return}close_event=new SimpleEvent("close",{code:2e3,reason:"All transports failed",wasClean:false,last_event:close_event})}that.readyState=SockJS.CLOSED;utils.delay(function(){that.dispatchEvent(close_event)})};SockJS.prototype._didMessage=function(data){var that=this;var type=data.slice(0,1);switch(type){case"o":that._dispatchOpen();break;case"a":var payload=JSON.parse(data.slice(1)||"[]");for(var i=0;i<payload.length;i++){that._dispatchMessage(payload[i])}break;case"m":var payload=JSON.parse(data.slice(1)||"null");that._dispatchMessage(payload);break;case"c":var payload=JSON.parse(data.slice(1)||"[]");that._didClose(payload[0],payload[1]);break;case"h":that._dispatchHeartbeat();break}};SockJS.prototype._try_next_protocol=function(close_event){var that=this;if(that.protocol){that._debug("Closed transport:",that.protocol,""+close_event);that.protocol=null}if(that._transport_tref){clearTimeout(that._transport_tref);that._transport_tref=null}while(1){var protocol=that.protocol=that._protocols.shift();if(!protocol){return false}if(SockJS[protocol]&&SockJS[protocol].need_body===true&&(!_document.body||typeof _document.readyState!=="undefined"&&_document.readyState!=="complete")){that._protocols.unshift(protocol);that.protocol="waiting-for-load";utils.attachEvent("load",function(){that._try_next_protocol()});return true}if(!SockJS[protocol]||!SockJS[protocol].enabled(that._options)){that._debug("Skipping transport:",protocol)}else{var roundTrips=SockJS[protocol].roundTrips||1;var to=(that._options.rto||0)*roundTrips||5e3;that._transport_tref=utils.delay(to,function(){if(that.readyState===SockJS.CONNECTING){that._didClose(2007,"Transport timeouted")}});var connid=utils.random_string(8);var trans_url=that._base_url+"/"+that._server+"/"+connid;that._debug("Opening transport:",protocol," url:"+trans_url," RTO:"+that._options.rto);that._transport=new SockJS[protocol](that,trans_url,that._base_url);return true}}};SockJS.prototype.close=function(code,reason){var that=this;if(code&&!utils.userSetCode(code))throw new Error("INVALID_ACCESS_ERR");if(that.readyState!==SockJS.CONNECTING&&that.readyState!==SockJS.OPEN){return false}that.readyState=SockJS.CLOSING;that._didClose(code||1e3,reason||"Normal closure");return true};SockJS.prototype.send=function(data){var that=this;if(that.readyState===SockJS.CONNECTING)throw new Error("INVALID_STATE_ERR");if(that.readyState===SockJS.OPEN){that._transport.doSend(utils.quote(""+data))}return true};SockJS.prototype._applyInfo=function(info,rtt,protocols_whitelist){var that=this;that._options.info=info;that._options.rtt=rtt;that._options.rto=utils.countRTO(rtt);that._options.info.null_origin=!_document.domain;var probed=utils.probeProtocols();that._protocols=utils.detectProtocols(probed,protocols_whitelist,info)};var WebSocketTransport=SockJS.websocket=function(ri,trans_url){var that=this;var url=trans_url+"/websocket";if(url.slice(0,5)==="https"){url="wss"+url.slice(5)}else{url="ws"+url.slice(4)}that.ri=ri;that.url=url;var Constructor=_window.WebSocket||_window.MozWebSocket;that.ws=new Constructor(that.url);that.ws.onmessage=function(e){that.ri._didMessage(e.data)};that.unload_ref=utils.unload_add(function(){that.ws.close()});that.ws.onclose=function(){that.ri._didMessage(utils.closeFrame(1006,"WebSocket connection broken"))}};WebSocketTransport.prototype.doSend=function(data){this.ws.send("["+data+"]")};WebSocketTransport.prototype.doCleanup=function(){var that=this;var ws=that.ws;if(ws){ws.onmessage=ws.onclose=null;ws.close();utils.unload_del(that.unload_ref);that.unload_ref=that.ri=that.ws=null}};WebSocketTransport.enabled=function(){return!!(_window.WebSocket||_window.MozWebSocket)};WebSocketTransport.roundTrips=2;var BufferedSender=function(){};BufferedSender.prototype.send_constructor=function(sender){var that=this;that.send_buffer=[];that.sender=sender};BufferedSender.prototype.doSend=function(message){var that=this;that.send_buffer.push(message);if(!that.send_stop){that.send_schedule()}};BufferedSender.prototype.send_schedule_wait=function(){var that=this;var tref;that.send_stop=function(){that.send_stop=null;clearTimeout(tref)};tref=utils.delay(25,function(){that.send_stop=null;that.send_schedule()})};BufferedSender.prototype.send_schedule=function(){var that=this;if(that.send_buffer.length>0){var payload="["+that.send_buffer.join(",")+"]";that.send_stop=that.sender(that.trans_url,payload,function(){that.send_stop=null;that.send_schedule_wait()});that.send_buffer=[]}};BufferedSender.prototype.send_destructor=function(){var that=this;if(that._send_stop){that._send_stop()}that._send_stop=null};var jsonPGenericSender=function(url,payload,callback){var that=this;if(!("_send_form"in that)){var form=that._send_form=_document.createElement("form");var area=that._send_area=_document.createElement("textarea");area.name="d";form.style.display="none";form.style.position="absolute";form.method="POST";form.enctype="application/x-www-form-urlencoded";form.acceptCharset="UTF-8";form.appendChild(area);_document.body.appendChild(form)}var form=that._send_form;var area=that._send_area;var id="a"+utils.random_string(8);form.target=id;form.action=url+"/jsonp_send?i="+id;var iframe;try{iframe=_document.createElement('<iframe name="'+id+'">')}catch(x){iframe=_document.createElement("iframe");iframe.name=id}iframe.id=id;form.appendChild(iframe);iframe.style.display="none";try{area.value=payload}catch(e){utils.log("Your browser is seriously broken. Go home! "+e.message)}form.submit();var completed=function(e){if(!iframe.onerror)return;iframe.onreadystatechange=iframe.onerror=iframe.onload=null;utils.delay(500,function(){iframe.parentNode.removeChild(iframe);iframe=null});area.value="";callback()};iframe.onerror=iframe.onload=completed;iframe.onreadystatechange=function(e){if(iframe.readyState=="complete")completed()};return completed};var createAjaxSender=function(AjaxObject){return function(url,payload,callback){var xo=new AjaxObject("POST",url+"/xhr_send",payload);xo.onfinish=function(status,text){callback(status)};return function(abort_reason){callback(0,abort_reason)}}};var jsonPGenericReceiver=function(url,callback){var tref;var script=_document.createElement("script");var script2;var close_script=function(frame){if(script2){script2.parentNode.removeChild(script2);script2=null}if(script){clearTimeout(tref);script.parentNode.removeChild(script);script.onreadystatechange=script.onerror=script.onload=script.onclick=null;script=null;callback(frame);callback=null}};var loaded_okay=false;var error_timer=null;script.id="a"+utils.random_string(8);script.src=url;script.type="text/javascript";script.charset="UTF-8";script.onerror=function(e){if(!error_timer){error_timer=setTimeout(function(){if(!loaded_okay){close_script(utils.closeFrame(1006,"JSONP script loaded abnormally (onerror)"))}},1e3)}};script.onload=function(e){close_script(utils.closeFrame(1006,"JSONP script loaded abnormally (onload)"))};script.onreadystatechange=function(e){if(/loaded|closed/.test(script.readyState)){if(script&&script.htmlFor&&script.onclick){loaded_okay=true;try{script.onclick()}catch(x){}}if(script){close_script(utils.closeFrame(1006,"JSONP script loaded abnormally (onreadystatechange)"))}}};if(typeof script.async==="undefined"&&_document.attachEvent){if(!/opera/i.test(navigator.userAgent)){try{script.htmlFor=script.id;script.event="onclick"}catch(x){}script.async=true}else{script2=_document.createElement("script");script2.text="try{var a = document.getElementById('"+script.id+"'); if(a)a.onerror();}catch(x){};";script.async=script2.async=false}}if(typeof script.async!=="undefined"){script.async=true}tref=setTimeout(function(){close_script(utils.closeFrame(1006,"JSONP script loaded abnormally (timeout)"))},35e3);var head=_document.getElementsByTagName("head")[0];head.insertBefore(script,head.firstChild);if(script2){head.insertBefore(script2,head.firstChild)}return close_script};var JsonPTransport=SockJS["jsonp-polling"]=function(ri,trans_url){utils.polluteGlobalNamespace();var that=this;that.ri=ri;that.trans_url=trans_url;that.send_constructor(jsonPGenericSender);that._schedule_recv()};JsonPTransport.prototype=new BufferedSender;JsonPTransport.prototype._schedule_recv=function(){var that=this;var callback=function(data){that._recv_stop=null;if(data){if(!that._is_closing){that.ri._didMessage(data)}}if(!that._is_closing){that._schedule_recv()}};that._recv_stop=jsonPReceiverWrapper(that.trans_url+"/jsonp",jsonPGenericReceiver,callback)};JsonPTransport.enabled=function(){return true};JsonPTransport.need_body=true;JsonPTransport.prototype.doCleanup=function(){var that=this;that._is_closing=true;if(that._recv_stop){that._recv_stop()}that.ri=that._recv_stop=null;that.send_destructor()};var jsonPReceiverWrapper=function(url,constructReceiver,user_callback){var id="a"+utils.random_string(6);var url_id=url+"?c="+escape(WPrefix+"."+id);var callback=function(frame){delete _window[WPrefix][id];user_callback(frame)};var close_script=constructReceiver(url_id,callback);_window[WPrefix][id]=close_script;var stop=function(){if(_window[WPrefix][id]){_window[WPrefix][id](utils.closeFrame(1e3,"JSONP user aborted read"))}};return stop};var AjaxBasedTransport=function(){};AjaxBasedTransport.prototype=new BufferedSender;AjaxBasedTransport.prototype.run=function(ri,trans_url,url_suffix,Receiver,AjaxObject){var that=this;that.ri=ri;that.trans_url=trans_url;that.send_constructor(createAjaxSender(AjaxObject));that.poll=new Polling(ri,Receiver,trans_url+url_suffix,AjaxObject)};AjaxBasedTransport.prototype.doCleanup=function(){var that=this;if(that.poll){that.poll.abort();that.poll=null}};var XhrStreamingTransport=SockJS["xhr-streaming"]=function(ri,trans_url){this.run(ri,trans_url,"/xhr_streaming",XhrReceiver,utils.XHRCorsObject)};XhrStreamingTransport.prototype=new AjaxBasedTransport;XhrStreamingTransport.enabled=function(){return _window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest&&!/opera/i.test(navigator.userAgent)};XhrStreamingTransport.roundTrips=2;XhrStreamingTransport.need_body=true;var XdrStreamingTransport=SockJS["xdr-streaming"]=function(ri,trans_url){this.run(ri,trans_url,"/xhr_streaming",XhrReceiver,utils.XDRObject)};XdrStreamingTransport.prototype=new AjaxBasedTransport;XdrStreamingTransport.enabled=function(){return!!_window.XDomainRequest};XdrStreamingTransport.roundTrips=2;var XhrPollingTransport=SockJS["xhr-polling"]=function(ri,trans_url){this.run(ri,trans_url,"/xhr",XhrReceiver,utils.XHRCorsObject)};XhrPollingTransport.prototype=new AjaxBasedTransport;XhrPollingTransport.enabled=XhrStreamingTransport.enabled;XhrPollingTransport.roundTrips=2;var XdrPollingTransport=SockJS["xdr-polling"]=function(ri,trans_url){this.run(ri,trans_url,"/xhr",XhrReceiver,utils.XDRObject)};XdrPollingTransport.prototype=new AjaxBasedTransport;XdrPollingTransport.enabled=XdrStreamingTransport.enabled;XdrPollingTransport.roundTrips=2;var IframeTransport=function(){};IframeTransport.prototype.i_constructor=function(ri,trans_url,base_url){var that=this;that.ri=ri;that.origin=utils.getOrigin(base_url);that.base_url=base_url;that.trans_url=trans_url;var iframe_url=base_url+"/iframe.html";if(that.ri._options.devel){iframe_url+="?t="+ +new Date}that.window_id=utils.random_string(8);iframe_url+="#"+that.window_id;that.iframeObj=utils.createIframe(iframe_url,function(r){that.ri._didClose(1006,"Unable to load an iframe ("+r+")")});that.onmessage_cb=utils.bind(that.onmessage,that);utils.attachMessage(that.onmessage_cb)};IframeTransport.prototype.doCleanup=function(){var that=this;if(that.iframeObj){utils.detachMessage(that.onmessage_cb);try{if(that.iframeObj.iframe.contentWindow){that.postMessage("c")}}catch(x){}that.iframeObj.cleanup();that.iframeObj=null;that.onmessage_cb=that.iframeObj=null}};IframeTransport.prototype.onmessage=function(e){var that=this;if(e.origin!==that.origin)return;var window_id=e.data.slice(0,8);var type=e.data.slice(8,9);var data=e.data.slice(9);if(window_id!==that.window_id)return;switch(type){case"s":that.iframeObj.loaded();that.postMessage("s",JSON.stringify([SockJS.version,that.protocol,that.trans_url,that.base_url]));break;case"t":that.ri._didMessage(data);break}};IframeTransport.prototype.postMessage=function(type,data){var that=this;that.iframeObj.post(that.window_id+type+(data||""),that.origin)};IframeTransport.prototype.doSend=function(message){this.postMessage("m",message)};IframeTransport.enabled=function(){var konqueror=navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Konqueror")!==-1;return(typeof _window.postMessage==="function"||typeof _window.postMessage==="object")&&!konqueror};var curr_window_id;var postMessage=function(type,data){if(parent!==_window){parent.postMessage(curr_window_id+type+(data||""),"*")}else{utils.log("Can't postMessage, no parent window.",type,data)}};var FacadeJS=function(){};FacadeJS.prototype._didClose=function(code,reason){postMessage("t",utils.closeFrame(code,reason))};FacadeJS.prototype._didMessage=function(frame){postMessage("t",frame)};FacadeJS.prototype._doSend=function(data){this._transport.doSend(data)};FacadeJS.prototype._doCleanup=function(){this._transport.doCleanup()};utils.parent_origin=undefined;SockJS.bootstrap_iframe=function(){var facade;curr_window_id=_document.location.hash.slice(1);var onMessage=function(e){if(e.source!==parent)return;if(typeof utils.parent_origin==="undefined")utils.parent_origin=e.origin;if(e.origin!==utils.parent_origin)return;var window_id=e.data.slice(0,8);var type=e.data.slice(8,9);var data=e.data.slice(9);if(window_id!==curr_window_id)return;switch(type){case"s":var p=JSON.parse(data);var version=p[0];var protocol=p[1];var trans_url=p[2];var base_url=p[3];if(version!==SockJS.version){utils.log("Incompatibile SockJS! Main site uses:"+' "'+version+'", the iframe:'+' "'+SockJS.version+'".')}if(!utils.flatUrl(trans_url)||!utils.flatUrl(base_url)){utils.log("Only basi