yavsc/Yavsc/wwwroot/js/jquery.signalR-2.2.1.min.js

1 line
36 KiB
JavaScript

!function(p,g,e){var f={nojQuery:"jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",noTransportOnInit:"No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.",errorOnNegotiate:"Error during negotiation request.",stoppedWhileLoading:"The connection was stopped during page load.",stoppedWhileNegotiating:"The connection was stopped during the negotiate request.",errorParsingNegotiateResponse:"Error parsing negotiate response.",errorDuringStartRequest:"Error during start request. Stopping the connection.",stoppedDuringStartRequest:"The connection was stopped during the start request.",errorParsingStartResponse:"Error parsing start response: '{0}'. Stopping the connection.",invalidStartResponse:"Invalid start response: '{0}'. Stopping the connection.",protocolIncompatible:"You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",sendFailed:"Send failed.",parseFailed:"Failed at parsing response: {0}",longPollFailed:"Long polling request failed.",eventSourceFailedToConnect:"EventSource failed to connect.",eventSourceError:"Error raised by EventSource",webSocketClosed:"WebSocket closed.",pingServerFailedInvalidResponse:"Invalid ping response when pinging server: '{0}'.",pingServerFailed:"Failed to ping server.",pingServerFailedStatusCode:"Failed to ping server. Server responded with status code {0}, stopping the connection.",pingServerFailedParse:"Failed to parse ping server response, stopping the connection.",noConnectionTransport:"Connection is in an invalid state, there is no transport active.",webSocketsInvalidState:"The Web Socket transport is in an invalid state, transitioning into reconnecting.",reconnectTimeout:"Couldn't reconnect within the configured timeout of {0} ms, disconnecting.",reconnectWindowTimeout:"The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection."};if("function"!=typeof p)throw new Error(f.nojQuery);var v,t,n,o,m="complete"===g.document.readyState,h=p(g),S="__Negotiate Aborted__",b={onStart:"onStart",onStarting:"onStarting",onReceived:"onReceived",onError:"onError",onConnectionSlow:"onConnectionSlow",onReconnecting:"onReconnecting",onReconnect:"onReconnect",onStateChanged:"onStateChanged",onDisconnect:"onDisconnect"},_=function(e,t,n){return t===e.state&&(e.state=n,p(e).triggerHandler(b.onStateChanged,[{oldState:t,newState:n}]),!0)},T=function(e){return e._.keepAliveData.activated&&e.transport.supportsKeepAlive(e)};function r(e,t){return t.match(/:\d+$/)?t:t+":"+("http:"===(n=e)?80:"https:"===n?443:void 0);var n}(v=function(e,t,n){return new v.fn.init(e,t,n)})._={defaultContentType:"application/x-www-form-urlencoded; charset=UTF-8",ieVersion:("Microsoft Internet Explorer"===g.navigator.appName&&(o=/MSIE ([0-9]+\.[0-9]+)/.exec(g.navigator.userAgent))&&(n=g.parseFloat(o[1])),n),error:function(e,t,n){var o=new Error(e);return o.source=t,void 0!==n&&(o.context=n),o},transportError:function(e,t,n,o){var r=this.error(e,n,o);return r.transport=t?t.name:void 0,r},format:function(){for(var e=arguments[0],t=0;t<arguments.length-1;t++)e=e.replace("{"+t+"}",arguments[t+1]);return e},firefoxMajorVersion:function(e){var t=e.match(/Firefox\/(\d+)/);return!t||!t.length||t.length<2?0:parseInt(t[1],10)},configurePingInterval:function(t){var e=t._.config,n=function(e){p(t).triggerHandler(b.onError,[e])};e&&!t._.pingIntervalId&&e.pingInterval&&(t._.pingIntervalId=g.setInterval(function(){v.transports._logic.pingServer(t).fail(n)},e.pingInterval))}},v.events=b,v.resources=f,v.ajaxDefaults={processData:!0,timeout:null,async:!0,global:!1,cache:!1},v.changeState=_,v.isDisconnecting=function(e){return e.state===v.connectionState.disconnected},v.connectionState={connecting:0,connected:1,reconnecting:2,disconnected:4},v.hub={start:function(){throw new Error("SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'><\/script>.")}},"function"==typeof h.on?h.on("load",function(){m=!0}):h.load(function(){m=!0}),v.fn=v.prototype={init:function(e,t,n){var o=p(this);this.url=e,this.qs=t,this.lastError=null,this._={keepAliveData:{},connectingMessageBuffer:new function(t,e){var n=[];this.tryBuffer=function(e){return t.state===p.signalR.connectionState.connecting&&(n.push(e),!0)},this.drain=function(){if(t.state===p.signalR.connectionState.connected)for(;0<n.length;)e(n.shift())},this.clear=function(){n=[]}}(this,function(e){o.triggerHandler(b.onReceived,[e])}),lastMessageAt:(new Date).getTime(),lastActiveAt:(new Date).getTime(),beatInterval:5e3,beatHandle:null,totalTransportConnectTimeout:0},"boolean"==typeof n&&(this.logging=n)},_parseResponse:function(e){return e&&"string"==typeof e?this.json.parse(e):e},_originalJson:g.JSON,json:g.JSON,isCrossDomain:function(e,t){var n;return e=p.trim(e),t=t||g.location,0===e.indexOf("http")&&((n=g.document.createElement("a")).href=e,n.protocol+r(n.protocol,n.host)!==t.protocol+r(t.protocol,t.host))},ajaxDataType:"text",contentType:"application/json; charset=UTF-8",logging:!1,state:v.connectionState.disconnected,clientProtocol:"1.5",reconnectDelay:2e3,transportConnectTimeout:0,disconnectTimeout:3e4,reconnectWindow:3e4,keepAliveWarnAt:2/3,start:function(e,n){var a,t,o,r,c=this,s={pingInterval:3e5,waitForPageLoad:!0,transport:"auto",jsonp:!1},l=c._deferral||p.Deferred(),i=g.document.createElement("a");if(c.lastError=null,c._deferral=l,!c.json)throw new Error("SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.");if("function"===p.type(e)?n=e:"object"===p.type(e)&&(p.extend(s,e),"function"===p.type(s.callback)&&(n=s.callback)),s.transport=function(e,t){if(p.isArray(e)){for(var n=e.length-1;0<=n;n--){var o=e[n];"string"===p.type(o)&&v.transports[o]||(t.log("Invalid transport: "+o+", removing it from the transports list."),e.splice(n,1))}0===e.length&&(t.log("No transports remain within the specified transport array."),e=null)}else if(v.transports[e]||"auto"===e){if("auto"===e&&v._.ieVersion<=8)return["longPolling"]}else t.log("Invalid transport: "+e.toString()+"."),e=null;return e}(s.transport,c),!s.transport)throw new Error("SignalR: Invalid transport(s) specified, aborting start.");if(c._.config=s,!m&&!0===s.waitForPageLoad)return c._.deferredStartHandler=function(){c.start(e,n)},h.bind("load",c._.deferredStartHandler),l.promise();if(c.state===v.connectionState.connecting)return l.promise();if(!1===_(c,v.connectionState.disconnected,v.connectionState.connecting))return l.resolve(c),l.promise();(t=c)._.configuredStopReconnectingTimeout||(r=function(e){var t=v._.format(v.resources.reconnectTimeout,e.disconnectTimeout);e.log(t),p(e).triggerHandler(b.onError,[v._.error(t,"TimeoutException")]),e.stop(!1,!1)},t.reconnecting(function(){var e=this;e.state===v.connectionState.reconnecting&&(o=g.setTimeout(function(){r(e)},e.disconnectTimeout))}),t.stateChanged(function(e){e.oldState===v.connectionState.reconnecting&&g.clearTimeout(o)}),t._.configuredStopReconnectingTimeout=!0),i.href=c.url,i.protocol&&":"!==i.protocol?(c.protocol=i.protocol,c.host=i.host):(c.protocol=g.document.location.protocol,c.host=i.host||g.document.location.host),c.baseUrl=c.protocol+"//"+c.host,c.wsProtocol="https:"===c.protocol?"wss://":"ws://","auto"===s.transport&&!0===s.jsonp&&(s.transport="longPolling"),0===c.url.indexOf("//")&&(c.url=g.location.protocol+c.url,c.log("Protocol relative URL detected, normalizing it to '"+c.url+"'.")),this.isCrossDomain(c.url)&&(c.log("Auto detected cross domain url."),"auto"===s.transport&&(s.transport=["webSockets","serverSentEvents","longPolling"]),void 0===s.withCredentials&&(s.withCredentials=!0),s.jsonp||(s.jsonp=!p.support.cors,s.jsonp&&c.log("Using jsonp because this browser doesn't support CORS.")),c.contentType=v._.defaultContentType),c.withCredentials=s.withCredentials,c.ajaxDataType=s.jsonp?"jsonp":"text",p(c).bind(b.onStart,function(e,t){"function"===p.type(n)&&n.call(c),l.resolve(c)}),c._.initHandler=v.transports._logic.initHandler(c),a=function(e,t){var n=v._.error(f.noTransportOnInit);if((t=t||0)>=e.length)return 0===t?c.log("No transports supported by the server were selected."):1===t?c.log("No fallback transports were selected."):c.log("Fallback transports exhausted."),p(c).triggerHandler(b.onError,[n]),l.reject(n),void c.stop();if(c.state!==v.connectionState.disconnected){var o=e[t],r=v.transports[o],i=function(){a(e,t+1)};c.transport=r;try{c._.initHandler.start(r,function(){var e=11<=v._.firefoxMajorVersion(g.navigator.userAgent),t=!!c.withCredentials&&e;c.log("The start request succeeded. Transitioning to the connected state."),T(c)&&v.transports._logic.monitorKeepAlive(c),v.transports._logic.startHeartbeat(c),v._.configurePingInterval(c),_(c,v.connectionState.connecting,v.connectionState.connected)||c.log("WARNING! The connection was not in the connecting state."),c._.connectingMessageBuffer.drain(),p(c).triggerHandler(b.onStart),h.bind("unload",function(){c.log("Window unloading, stopping the connection."),c.stop(t)}),e&&h.bind("beforeunload",function(){g.setTimeout(function(){c.stop(t)},0)})},i)}catch(e){c.log(r.name+" transport threw '"+e.message+"' when attempting to start."),i()}}};var u=c.url+"/negotiate",d=function(e,t){var n=v._.error(f.errorOnNegotiate,e,t._.negotiateRequest);p(t).triggerHandler(b.onError,n),l.reject(n),t.stop()};return p(c).triggerHandler(b.onStarting),u=v.transports._logic.prepareQueryString(c,u),c.log("Negotiating with '"+u+"'."),c._.negotiateRequest=v.transports._logic.ajax(c,{url:u,error:function(e,t){t!==S?d(e,c):l.reject(v._.error(f.stoppedWhileNegotiating,null,c._.negotiateRequest))},success:function(e){var t,n,o,r=[],i=[];try{t=c._parseResponse(e)}catch(e){return void d(v._.error(f.errorParsingNegotiateResponse,e),c)}if(n=c._.keepAliveData,c.appRelativeUrl=t.Url,c.id=t.ConnectionId,c.token=t.ConnectionToken,c.webSocketServerUrl=t.WebSocketServerUrl,c._.pollTimeout=1e3*t.ConnectionTimeout+1e4,c.disconnectTimeout=1e3*t.DisconnectTimeout,c._.totalTransportConnectTimeout=c.transportConnectTimeout+1e3*t.TransportConnectTimeout,t.KeepAliveTimeout?(n.activated=!0,n.timeout=1e3*t.KeepAliveTimeout,n.timeoutWarning=n.timeout*c.keepAliveWarnAt,c._.beatInterval=(n.timeout-n.timeoutWarning)/3):n.activated=!1,c.reconnectWindow=c.disconnectTimeout+(n.timeout||0),!t.ProtocolVersion||t.ProtocolVersion!==c.clientProtocol)return o=v._.error(v._.format(f.protocolIncompatible,c.clientProtocol,t.ProtocolVersion)),p(c).triggerHandler(b.onError,[o]),void l.reject(o);p.each(v.transports,function(e){if(0===e.indexOf("_")||"webSockets"===e&&!t.TryWebSockets)return!0;i.push(e)}),p.isArray(s.transport)?p.each(s.transport,function(e,t){0<=p.inArray(t,i)&&r.push(t)}):"auto"===s.transport?r=i:0<=p.inArray(s.transport,i)&&r.push(s.transport),a(r)}}),l.promise()},starting:function(n){var o=this;return p(o).bind(b.onStarting,function(e,t){n.call(o)}),o},send:function(e){var t=this;if(t.state===v.connectionState.disconnected)throw new Error("SignalR: Connection must be started before data can be sent. Call .start() before .send()");if(t.state===v.connectionState.connecting)throw new Error("SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.");return t.transport.send(t,e),t},received:function(n){var o=this;return p(o).bind(b.onReceived,function(e,t){n.call(o,t)}),o},stateChanged:function(n){var o=this;return p(o).bind(b.onStateChanged,function(e,t){n.call(o,t)}),o},error:function(o){var r=this;return p(r).bind(b.onError,function(e,t,n){r.lastError=t,o.call(r,t,n)}),r},disconnected:function(n){var o=this;return p(o).bind(b.onDisconnect,function(e,t){n.call(o)}),o},connectionSlow:function(n){var o=this;return p(o).bind(b.onConnectionSlow,function(e,t){n.call(o)}),o},reconnecting:function(n){var o=this;return p(o).bind(b.onReconnecting,function(e,t){n.call(o)}),o},reconnected:function(n){var o=this;return p(o).bind(b.onReconnect,function(e,t){n.call(o)}),o},stop:function(e,t){var n=this,o=n._deferral;return n._.deferredStartHandler&&h.unbind("load",n._.deferredStartHandler),delete n._.config,delete n._.deferredStartHandler,m||n._.config&&!0!==n._.config.waitForPageLoad?n.state!==v.connectionState.disconnected?(n.log("Stopping connection."),g.clearTimeout(n._.beatHandle),g.clearInterval(n._.pingIntervalId),n.transport&&(n.transport.stop(n),!1!==t&&n.transport.abort(n,e),T(n)&&v.transports._logic.stopMonitoringKeepAlive(n),n.transport=null),n._.negotiateRequest&&(n._.negotiateRequest.abort(S),delete n._.negotiateRequest),n._.initHandler&&n._.initHandler.stop(),delete n._deferral,delete n.messageId,delete n.groupsToken,delete n.id,delete n._.pingIntervalId,delete n._.lastMessageAt,delete n._.lastActiveAt,n._.connectingMessageBuffer.clear(),_(n,n.state,v.connectionState.disconnected),p(n).triggerHandler(b.onDisconnect),n):void 0:(n.log("Stopping connection prior to negotiate."),void(o&&o.reject(v._.error(f.stoppedWhileLoading))))},log:function(e){var t,n;t=e,!1!==this.logging&&void 0!==g.console&&(n="["+(new Date).toTimeString()+"] SignalR: "+t,g.console.debug?g.console.debug(n):g.console.log&&g.console.log(n))}},v.fn.init.prototype=v.fn,v.noConflict=function(){return p.connection===v&&(p.connection=t),v},p.connection&&(t=p.connection),p.connection=p.signalR=v}(window.jQuery,window),function(c,s,e){var l,u=c.signalR,d=c.signalR.events,t=c.signalR.changeState,p="__Start Aborted__";function r(e){var t,n,o;e._.keepAliveData.monitoring&&(o=(t=e)._.keepAliveData,t.state===u.connectionState.connected&&((n=(new Date).getTime()-t._.lastMessageAt)>=o.timeout?(t.log("Keep alive timed out. Notifying transport that connection has been lost."),t.transport.lostConnection(t)):n>=o.timeoutWarning?o.userNotified||(t.log("Keep alive has been missed, connection may be dead/slow."),c(t).triggerHandler(d.onConnectionSlow),o.userNotified=!0):o.userNotified=!1)),l.markActive(e)&&(e._.beatHandle=s.setTimeout(function(){r(e)},e._.beatInterval))}function g(e,t){var n=e.url+t;return e.transport&&(n+="?transport="+e.transport.name),l.prepareQueryString(e,n)}function n(e){this.connection=e,this.startRequested=!1,this.startCompleted=!1,this.connectionStopped=!1}u.transports={},n.prototype={start:function(t,e,n){var o=this,r=o.connection,i=!1;o.startRequested||o.connectionStopped?r.log("WARNING! "+t.name+" transport cannot be started. Initialization ongoing or completed."):(r.log(t.name+" transport starting."),t.start(r,function(){i||o.initReceived(t,e)},function(e){return i||(i=!0,o.transportFailed(t,e,n)),!o.startCompleted||o.connectionStopped}),o.transportTimeoutHandle=s.setTimeout(function(){i||(i=!0,r.log(t.name+" transport timed out when trying to connect."),o.transportFailed(t,void 0,n))},r._.totalTransportConnectTimeout))},stop:function(){this.connectionStopped=!0,s.clearTimeout(this.transportTimeoutHandle),u.transports._logic.tryAbortStartRequest(this.connection)},initReceived:function(e,t){var n=this,o=n.connection;n.startRequested?o.log("WARNING! The client received multiple init messages."):n.connectionStopped||(n.startRequested=!0,s.clearTimeout(n.transportTimeoutHandle),o.log(e.name+" transport connected. Initiating start request."),u.transports._logic.ajaxStart(o,function(){n.startCompleted=!0,t()}))},transportFailed:function(e,t,n){var o,r=this.connection,i=r._deferral;this.connectionStopped||(s.clearTimeout(this.transportTimeoutHandle),this.startRequested?this.startCompleted||(o=u._.error(u.resources.errorDuringStartRequest,t),r.log(e.name+" transport failed during the start request. Stopping the connection."),c(r).triggerHandler(d.onError,[o]),i&&i.reject(o),r.stop()):(e.stop(r),r.log(e.name+" transport failed to connect. Attempting to fall back."),n()))}},l=u.transports._logic={ajax:function(e,t){return c.ajax(c.extend(!0,{},c.signalR.ajaxDefaults,{type:"GET",data:{},xhrFields:{withCredentials:e.withCredentials},contentType:e.contentType,dataType:e.ajaxDataType},t))},pingServer:function(n){var e,o,r=c.Deferred();return n.transport?(e=n.url+"/ping",e=l.addQs(e,n.qs),o=l.ajax(n,{url:e,success:function(e){var t;try{t=n._parseResponse(e)}catch(e){return r.reject(u._.transportError(u.resources.pingServerFailedParse,n.transport,e,o)),void n.stop()}"pong"===t.Response?r.resolve():r.reject(u._.transportError(u._.format(u.resources.pingServerFailedInvalidResponse,e),n.transport,null,o))},error:function(e){401===e.status||403===e.status?(r.reject(u._.transportError(u._.format(u.resources.pingServerFailedStatusCode,e.status),n.transport,e,o)),n.stop()):r.reject(u._.transportError(u.resources.pingServerFailed,n.transport,e,o))}})):r.reject(u._.transportError(u.resources.noConnectionTransport,n.transport)),r.promise()},prepareQueryString:function(e,t){var n;return n=l.addQs(t,"clientProtocol="+e.clientProtocol),n=l.addQs(n,e.qs),e.token&&(n+="&connectionToken="+s.encodeURIComponent(e.token)),e.data&&(n+="&connectionData="+s.encodeURIComponent(e.data)),n},addQs:function(e,t){var n,o=-1!==e.indexOf("?")?"&":"?";if(!t)return e;if("object"==typeof t)return e+o+c.param(t);if("string"==typeof t)return"?"!==(n=t.charAt(0))&&"&"!==n||(o=""),e+o+t;throw new Error("Query string property must be either a string or object.")},getUrl:function(e,t,n,o,r){var i=("webSockets"===t?"":e.baseUrl)+e.appRelativeUrl,a="transport="+t;return!r&&e.groupsToken&&(a+="&groupsToken="+s.encodeURIComponent(e.groupsToken)),n?(i+=o?"/poll":"/reconnect",!r&&e.messageId&&(a+="&messageId="+s.encodeURIComponent(e.messageId))):i+="/connect",i+="?"+a,i=l.prepareQueryString(e,i),r||(i+="&tid="+Math.floor(11*Math.random())),i},maximizePersistentResponse:function(e){return{MessageId:e.C,Messages:e.M,Initialized:void 0!==e.S,ShouldReconnect:void 0!==e.T,LongPollDelay:e.L,GroupsToken:e.G}},updateGroups:function(e,t){t&&(e.groupsToken=t)},stringifySend:function(e,t){return"string"==typeof t||null==t?t:e.json.stringify(t)},ajaxSend:function(n,o){var r,e=l.stringifySend(n,o),t=g(n,"/send"),i=function(e,t){c(t).triggerHandler(d.onError,[u._.transportError(u.resources.sendFailed,t.transport,e,r),o])};return r=l.ajax(n,{url:t,type:"jsonp"===n.ajaxDataType?"GET":"POST",contentType:u._.defaultContentType,data:{data:e},success:function(e){var t;if(e){try{t=n._parseResponse(e)}catch(e){return i(e,n),void n.stop()}l.triggerReceived(n,t)}},error:function(e,t){"abort"!==t&&"parsererror"!==t&&i(e,n)}})},ajaxAbort:function(e,t){if(void 0!==e.transport){t=void 0===t||t;var n=g(e,"/abort");l.ajax(e,{url:n,async:t,timeout:1e3,type:"POST"}),e.log("Fired ajax abort async = "+t+".")}},ajaxStart:function(r,i){var o=function(e){var t=r._deferral;t&&t.reject(e)},a=function(e){r.log("The start request failed. Stopping the connection."),c(r).triggerHandler(d.onError,[e]),o(e),r.stop()};r._.startRequest=l.ajax(r,{url:g(r,"/start"),success:function(t,e,n){var o;try{o=r._parseResponse(t)}catch(e){return void a(u._.error(u._.format(u.resources.errorParsingStartResponse,t),e,n))}"started"===o.Response?i():a(u._.error(u._.format(u.resources.invalidStartResponse,t),null,n))},error:function(e,t,n){t!==p?a(u._.error(u.resources.errorDuringStartRequest,n,e)):(r.log("The start request aborted because connection.stop() was called."),o(u._.error(u.resources.stoppedDuringStartRequest,null,e)))}})},tryAbortStartRequest:function(e){e._.startRequest&&(e._.startRequest.abort(p),delete e._.startRequest)},tryInitialize:function(e,t,n){t.Initialized&&n?n():t.Initialized&&e.log("WARNING! The client received an init message after reconnecting.")},triggerReceived:function(e,t){e._.connectingMessageBuffer.tryBuffer(t)||c(e).triggerHandler(d.onReceived,[t])},processMessages:function(n,e,t){var o;l.markLastMessage(n),e&&(o=l.maximizePersistentResponse(e),l.updateGroups(n,o.GroupsToken),o.MessageId&&(n.messageId=o.MessageId),o.Messages&&(c.each(o.Messages,function(e,t){l.triggerReceived(n,t)}),l.tryInitialize(n,o,t)))},monitorKeepAlive:function(e){var t=e._.keepAliveData;t.monitoring?e.log("Tried to monitor keep alive but it's already being monitored."):(t.monitoring=!0,l.markLastMessage(e),e._.keepAliveData.reconnectKeepAliveUpdate=function(){l.markLastMessage(e)},c(e).bind(d.onReconnect,e._.keepAliveData.reconnectKeepAliveUpdate),e.log("Now monitoring keep alive with a warning timeout of "+t.timeoutWarning+", keep alive timeout of "+t.timeout+" and disconnecting timeout of "+e.disconnectTimeout))},stopMonitoringKeepAlive:function(e){var t=e._.keepAliveData;t.monitoring&&(t.monitoring=!1,c(e).unbind(d.onReconnect,e._.keepAliveData.reconnectKeepAliveUpdate),e._.keepAliveData={},e.log("Stopping the monitoring of the keep alive."))},startHeartbeat:function(e){e._.lastActiveAt=(new Date).getTime(),r(e)},markLastMessage:function(e){e._.lastMessageAt=(new Date).getTime()},markActive:function(e){return!!l.verifyLastActive(e)&&(e._.lastActiveAt=(new Date).getTime(),!0)},isConnectedOrReconnecting:function(e){return e.state===u.connectionState.connected||e.state===u.connectionState.reconnecting},ensureReconnectingState:function(e){return!0===t(e,u.connectionState.connected,u.connectionState.reconnecting)&&c(e).triggerHandler(d.onReconnecting),e.state===u.connectionState.reconnecting},clearReconnectTimeout:function(e){e&&e._.reconnectTimeout&&(s.clearTimeout(e._.reconnectTimeout),delete e._.reconnectTimeout)},verifyLastActive:function(e){if((new Date).getTime()-e._.lastActiveAt>=e.reconnectWindow){var t=u._.format(u.resources.reconnectWindowTimeout,new Date(e._.lastActiveAt),e.reconnectWindow);return e.log(t),c(e).triggerHandler(d.onError,[u._.error(t,"TimeoutException")]),e.stop(!1,!1),!1}return!0},reconnect:function(e,t){var n=u.transports[t];if(l.isConnectedOrReconnecting(e)&&!e._.reconnectTimeout){if(!l.verifyLastActive(e))return;e._.reconnectTimeout=s.setTimeout(function(){l.verifyLastActive(e)&&(n.stop(e),l.ensureReconnectingState(e)&&(e.log(t+" reconnecting."),n.start(e)))},e.reconnectDelay)}},handleParseFailure:function(e,t,n,o,r){var i=u._.transportError(u._.format(u.resources.parseFailed,t),e.transport,n,r);o&&o(i)?e.log("Failed to parse server response while attempting to connect."):(c(e).triggerHandler(d.onError,[i]),e.stop())},initHandler:function(e){return new n(e)},foreverFrame:{count:0,connections:{}}}}(window.jQuery,window),function(s,l,e){var u=s.signalR,d=s.signalR.events,p=s.signalR.changeState,g=u.transports._logic;u.transports.webSockets={name:"webSockets",supportsKeepAlive:function(){return!0},send:function(t,n){var e=g.stringifySend(t,n);try{t.socket.send(e)}catch(e){s(t).triggerHandler(d.onError,[u._.transportError(u.resources.webSocketsInvalidState,t.transport,e,t.socket),n])}},start:function(n,o,r){var e,i=!1,a=this,t=!o,c=s(n);l.WebSocket?n.socket||(e=n.webSocketServerUrl?n.webSocketServerUrl:n.wsProtocol+n.host,e+=g.getUrl(n,this.name,t),n.log("Connecting to websocket endpoint '"+e+"'."),n.socket=new l.WebSocket(e),n.socket.onopen=function(){i=!0,n.log("Websocket opened."),g.clearReconnectTimeout(n),!0===p(n,u.connectionState.reconnecting,u.connectionState.connected)&&c.triggerHandler(d.onReconnect)},n.socket.onclose=function(e){var t;this===n.socket&&(i&&void 0!==e.wasClean&&!1===e.wasClean?(t=u._.transportError(u.resources.webSocketClosed,n.transport,e),n.log("Unclean disconnect from websocket: "+(e.reason||"[no reason given]."))):n.log("Websocket closed."),r&&r(t)||(t&&s(n).triggerHandler(d.onError,[t]),a.reconnect(n)))},n.socket.onmessage=function(t){var e;try{e=n._parseResponse(t.data)}catch(e){return void g.handleParseFailure(n,t.data,e,r,t)}e&&(s.isEmptyObject(e)||e.M?g.processMessages(n,e,o):g.triggerReceived(n,e))}):r()},reconnect:function(e){g.reconnect(e,this.name)},lostConnection:function(e){this.reconnect(e)},stop:function(e){g.clearReconnectTimeout(e),e.socket&&(e.log("Closing the Websocket."),e.socket.close(),e.socket=null)},abort:function(e,t){g.ajaxAbort(e,t)}}}(window.jQuery,window),function(s,l,e){var u=s.signalR,d=s.signalR.events,p=s.signalR.changeState,g=u.transports._logic,f=function(e){l.clearTimeout(e._.reconnectAttemptTimeoutHandle),delete e._.reconnectAttemptTimeoutHandle};u.transports.serverSentEvents={name:"serverSentEvents",supportsKeepAlive:function(){return!0},timeOut:3e3,start:function(n,o,r){var e,i=this,t=!1,a=s(n),c=!o;if(n.eventSource&&(n.log("The connection already has an event source. Stopping it."),n.stop()),l.EventSource){e=g.getUrl(n,this.name,c);try{n.log("Attempting to connect to SSE endpoint '"+e+"'."),n.eventSource=new l.EventSource(e,{withCredentials:n.withCredentials})}catch(e){return n.log("EventSource failed trying to connect with error "+e.Message+"."),void(r?r():(a.triggerHandler(d.onError,[u._.transportError(u.resources.eventSourceFailedToConnect,n.transport,e)]),c&&i.reconnect(n)))}c&&(n._.reconnectAttemptTimeoutHandle=l.setTimeout(function(){!1===t&&n.eventSource.readyState!==l.EventSource.OPEN&&i.reconnect(n)},i.timeOut)),n.eventSource.addEventListener("open",function(e){n.log("EventSource connected."),f(n),g.clearReconnectTimeout(n),!1===t&&(t=!0)===p(n,u.connectionState.reconnecting,u.connectionState.connected)&&a.triggerHandler(d.onReconnect)},!1),n.eventSource.addEventListener("message",function(t){var e;if("initialized"!==t.data){try{e=n._parseResponse(t.data)}catch(e){return void g.handleParseFailure(n,t.data,e,r,t)}g.processMessages(n,e,o)}},!1),n.eventSource.addEventListener("error",function(e){var t=u._.transportError(u.resources.eventSourceError,n.transport,e);this===n.eventSource&&(r&&r(t)||(n.log("EventSource readyState: "+n.eventSource.readyState+"."),e.eventPhase===l.EventSource.CLOSED?(n.log("EventSource reconnecting due to the server connection ending."),i.reconnect(n)):(n.log("EventSource error."),a.triggerHandler(d.onError,[t]))))},!1)}else r&&(n.log("This browser doesn't support SSE."),r())},reconnect:function(e){g.reconnect(e,this.name)},lostConnection:function(e){this.reconnect(e)},send:function(e,t){g.ajaxSend(e,t)},stop:function(e){f(e),g.clearReconnectTimeout(e),e&&e.eventSource&&(e.log("EventSource calling close()."),e.eventSource.close(),e.eventSource=null,delete e.eventSource)},abort:function(e,t){g.ajaxAbort(e,t)}}}(window.jQuery,window),function(i,s,e){var t,n,a=i.signalR,o=i.signalR.events,r=i.signalR.changeState,l=a.transports._logic,u=function(){var e=s.document.createElement("iframe");return e.setAttribute("style","position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;"),e},d=(t=null,n=0,{prevent:function(){a._.ieVersion<=8&&(0===n&&(t=s.setInterval(function(){var e=u();s.document.body.appendChild(e),s.document.body.removeChild(e),e=null},1e3)),n++)},cancel:function(){1===n&&s.clearInterval(t),0<n&&n--}});a.transports.foreverFrame={name:"foreverFrame",supportsKeepAlive:function(){return!0},iframeClearThreshold:50,start:function(e,t,n){var o,r=this,i=l.foreverFrame.count+=1,a=u(),c=function(){e.log("Forever frame iframe finished loading and is no longer receiving messages."),n&&n()||r.reconnect(e)};s.EventSource?n&&(e.log("Forever Frame is not supported by SignalR on browsers with SSE support."),n()):(a.setAttribute("data-signalr-connection-id",e.id),d.prevent(),o=l.getUrl(e,this.name),o+="&frameId="+i,s.document.documentElement.appendChild(a),e.log("Binding to iframe's load event."),a.addEventListener?a.addEventListener("load",c,!1):a.attachEvent&&a.attachEvent("onload",c),a.src=o,(l.foreverFrame.connections[i]=e).frame=a,e.frameId=i,t&&(e.onSuccess=function(){e.log("Iframe transport started."),t()}))},reconnect:function(n){var o=this;l.isConnectedOrReconnecting(n)&&l.verifyLastActive(n)&&s.setTimeout(function(){if(l.verifyLastActive(n)&&n.frame&&l.ensureReconnectingState(n)){var e=n.frame,t=l.getUrl(n,o.name,!0)+"&frameId="+n.frameId;n.log("Updating iframe src to '"+t+"'."),e.src=t}},n.reconnectDelay)},lostConnection:function(e){this.reconnect(e)},send:function(e,t){l.ajaxSend(e,t)},receive:function(e,t){var n,o,r;if(e.json!==e._originalJson&&(t=e._originalJson.stringify(t)),r=e._parseResponse(t),l.processMessages(e,r,e.onSuccess),e.state===i.signalR.connectionState.connected&&(e.frameMessageCount=(e.frameMessageCount||0)+1,e.frameMessageCount>a.transports.foreverFrame.iframeClearThreshold&&(e.frameMessageCount=0,(n=e.frame.contentWindow||e.frame.contentDocument)&&n.document&&n.document.body)))for(o=n.document.body;o.firstChild;)o.removeChild(o.firstChild)},stop:function(t){var e=null;if(d.cancel(),t.frame){if(t.frame.stop)t.frame.stop();else try{(e=t.frame.contentWindow||t.frame.contentDocument).document&&e.document.execCommand&&e.document.execCommand("Stop")}catch(e){t.log("Error occurred when stopping foreverFrame transport. Message = "+e.message+".")}t.frame.parentNode===s.document.body&&s.document.body.removeChild(t.frame),delete l.foreverFrame.connections[t.frameId],t.frame=null,t.frameId=null,delete t.frame,delete t.frameId,delete t.onSuccess,delete t.frameMessageCount,t.log("Stopping forever frame.")}},abort:function(e,t){l.ajaxAbort(e,t)},getConnection:function(e){return l.foreverFrame.connections[e]},started:function(e){!0===r(e,a.connectionState.reconnecting,a.connectionState.connected)&&i(e).triggerHandler(o.onReconnect)}}}(window.jQuery,window),function(f,v,e){var m=f.signalR,h=f.signalR.events,n=f.signalR.changeState,S=f.signalR.isDisconnecting,b=m.transports._logic;m.transports.longPolling={name:"longPolling",supportsKeepAlive:function(){return!1},reconnectDelay:3e3,start:function(c,e,t){var s=this,l=function(){l=f.noop,c.log("LongPolling connected."),e?e():c.log("WARNING! The client received an init message after reconnecting.")},u=function(e){return!!t(e)&&(c.log("LongPolling failed to connect."),!0)},d=c._,p=0,g=function(e){v.clearTimeout(d.reconnectTimeoutId),d.reconnectTimeoutId=null,!0===n(e,m.connectionState.reconnecting,m.connectionState.connected)&&(e.log("Raising the reconnect event"),f(e).triggerHandler(h.onReconnect))};c.pollXhr&&(c.log("Polling xhr requests already exists, aborting."),c.stop()),c.messageId=null,d.reconnectTimeoutId=null,d.pollTimeoutId=v.setTimeout(function(){!function i(a,e){var t=!(null===a.messageId),n=!e,o=b.getUrl(a,s.name,t,n,!0),r={};a.messageId&&(r.messageId=a.messageId),a.groupsToken&&(r.groupsToken=a.groupsToken),!0!==S(a)&&(c.log("Opening long polling request to '"+o+"'."),a.pollXhr=b.ajax(c,{xhrFields:{onprogress:function(){b.markLastMessage(c)}},url:o,type:"POST",contentType:m._.defaultContentType,data:r,timeout:c._.pollTimeout,success:function(t){var e,n,o,r=0;c.log("Long poll complete."),p=0;try{e=c._parseResponse(t)}catch(e){return void b.handleParseFailure(a,t,e,u,a.pollXhr)}null!==d.reconnectTimeoutId&&g(a),e&&(n=b.maximizePersistentResponse(e)),b.processMessages(a,e,l),n&&"number"===f.type(n.LongPollDelay)&&(r=n.LongPollDelay),!0!==S(a)&&((o=n&&n.ShouldReconnect)&&!b.ensureReconnectingState(a)||(0<r?d.pollTimeoutId=v.setTimeout(function(){i(a,o)},r):i(a,o)))},error:function(e,t){var n=m._.transportError(m.resources.longPollFailed,c.transport,e,a.pollXhr);if(v.clearTimeout(d.reconnectTimeoutId),d.reconnectTimeoutId=null,"abort"!==t){if(!u(n)){if(p++,c.state!==m.connectionState.reconnecting&&(c.log("An error occurred using longPolling. Status = "+t+". Response = "+e.responseText+"."),f(a).triggerHandler(h.onError,[n])),(c.state===m.connectionState.connected||c.state===m.connectionState.reconnecting)&&!b.verifyLastActive(c))return;if(!b.ensureReconnectingState(a))return;d.pollTimeoutId=v.setTimeout(function(){i(a,!0)},s.reconnectDelay)}}else c.log("Aborted xhr request.")}}),t&&!0===e&&(d.reconnectTimeoutId=v.setTimeout(function(){g(a)},Math.min(1e3*(Math.pow(2,p)-1),36e5))))}(c)},250)},lostConnection:function(e){e.pollXhr&&e.pollXhr.abort("lostConnection")},send:function(e,t){b.ajaxSend(e,t)},stop:function(e){v.clearTimeout(e._.pollTimeoutId),v.clearTimeout(e._.reconnectTimeoutId),delete e._.pollTimeoutId,delete e._.reconnectTimeoutId,e.pollXhr&&(e.pollXhr.abort(),e.pollXhr=null,delete e.pollXhr)},abort:function(e,t){b.ajaxAbort(e,t)}}}(window.jQuery,window),function(s,e,t){var n=".hubProxy",l=s.signalR;function u(e){return e+n}function o(e){return s.isFunction(e)?null:"undefined"===s.type(e)?null:e}function i(e){for(var t in e)if(e.hasOwnProperty(t))return!0;return!1}function r(e,t){var n,o=e._.invocationCallbacks;for(var r in i(o)&&e.log("Clearing hub invocation callbacks with error: "+t+"."),e._.invocationCallbackId=0,delete e._.invocationCallbacks,e._.invocationCallbacks={},o)(n=o[r]).method.call(n.scope,{E:t})}function a(e,t){return new a.fn.init(e,t)}function c(e,t){var n={qs:null,logging:!1,useDefaultPath:!0};return s.extend(n,t),e&&!n.useDefaultPath||(e=(e||"")+"/signalr"),new c.fn.init(e,n)}(a.fn=a.prototype={init:function(e,t){this.state={},this.connection=e,this.hubName=t,this._={callbackMap:{}}},constructor:a,hasSubscriptions:function(){return i(this._.callbackMap)},on:function(e,n){var o=this,t=o._.callbackMap;return t[e=e.toLowerCase()]||(t[e]={}),t[e][n]=function(e,t){n.apply(o,t)},s(o).bind(u(e),t[e][n]),o},off:function(e,t){var n,o=this._.callbackMap;return(n=o[e=e.toLowerCase()])&&(n[t]?(s(this).unbind(u(e),n[t]),delete n[t],i(n)||delete o[e]):t||(s(this).unbind(u(e)),delete o[e])),this},invoke:function(r){var i=this,a=i.connection,e=function(e,t,n){var o,r=e.length,i=[];for(o=0;o<r;o+=1)e.hasOwnProperty(o)&&(i[o]=t.call(n,e[o],o,e));return i}(s.makeArray(arguments).slice(1),o),t={H:i.hubName,M:r,A:e,I:a._.invocationCallbackId},c=s.Deferred();return a._.invocationCallbacks[a._.invocationCallbackId.toString()]={scope:i,method:function(e){var t,n,o=i._maximizeHubResponse(e);s.extend(i.state,o.State),o.Progress?c.notifyWith?c.notifyWith(i,[o.Progress.Data]):a._.progressjQueryVersionLogged||(a.log("A hub method invocation progress update was received but the version of jQuery in use ("+s.prototype.jquery+") does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications."),a._.progressjQueryVersionLogged=!0):o.Error?(o.StackTrace&&a.log(o.Error+"\n"+o.StackTrace+"."),t=o.IsHubException?"HubException":"Exception",(n=l._.error(o.Error,t)).data=o.ErrorData,a.log(i.hubName+"."+r+" failed to execute. Error: "+n.message),c.rejectWith(i,[n])):(a.log("Invoked "+i.hubName+"."+r),c.resolveWith(i,[o.Result]))}},a._.invocationCallbackId+=1,s.isEmptyObject(i.state)||(t.S=i.state),a.log("Invoking "+i.hubName+"."+r),a.send(t),c.promise()},_maximizeHubResponse:function(e){return{State:e.S,Result:e.R,Progress:e.P?{Id:e.P.I,Data:e.P.D}:null,Id:e.I,IsHubException:e.H,Error:e.E,StackTrace:e.T,ErrorData:e.D}}}).init.prototype=a.fn,(c.fn=c.prototype=s.connection()).init=function(e,t){var n={qs:null,logging:!1,useDefaultPath:!0},c=this;s.extend(n,t),s.signalR.fn.init.call(c,e,n.qs,n.logging),c.proxies={},c._.invocationCallbackId=0,c._.invocationCallbacks={},c.received(function(e){var t,n,o,r,i,a;e&&(void 0!==e.P?(o=e.P.I.toString(),(r=c._.invocationCallbacks[o])&&r.method.call(r.scope,e)):void 0!==e.I?(o=e.I.toString(),(r=c._.invocationCallbacks[o])&&(c._.invocationCallbacks[o]=null,delete c._.invocationCallbacks[o],r.method.call(r.scope,e))):(t=this._maximizeClientHubInvocation(e),c.log("Triggering client hub event '"+t.Method+"' on hub '"+t.Hub+"'."),i=t.Hub.toLowerCase(),a=t.Method.toLowerCase(),n=this.proxies[i],s.extend(n.state,t.State),s(n).triggerHandler(u(a),[t.Args])))}),c.error(function(e,t){var n,o;t&&(n=t.I,(o=c._.invocationCallbacks[n])&&(c._.invocationCallbacks[n]=null,delete c._.invocationCallbacks[n],o.method.call(o.scope,{E:e})))}),c.reconnecting(function(){c.transport&&"webSockets"===c.transport.name&&r(c,"Connection started reconnecting before invocation result was received.")}),c.disconnected(function(){r(c,"Connection was disconnected before invocation result was received.")})},c.fn._maximizeClientHubInvocation=function(e){return{Hub:e.H,Method:e.M,Args:e.A,State:e.S}},c.fn._registerSubscribedHubs=function(){var n=this;n._subscribedToHubs||(n._subscribedToHubs=!0,n.starting(function(){var t=[];s.each(n.proxies,function(e){this.hasSubscriptions()&&(t.push({name:e}),n.log("Client subscribed to hub '"+e+"'."))}),0===t.length&&n.log("No hubs have been subscribed to. The client will not receive data from hubs. To fix, declare at least one client side function prior to connection start for each hub you wish to subscribe to."),n.data=n.json.stringify(t)}))},c.fn.createHubProxy=function(e){e=e.toLowerCase();var t=this.proxies[e];return t||(t=a(this,e),this.proxies[e]=t),this._registerSubscribedHubs(),t},c.fn.init.prototype=c.fn,s.hubConnection=c}(window.jQuery,window),window.jQuery.signalR.version="2.2.1";