lightstreamer-client-node
Version:
This package includes the resources needed to write a Lightstreamer client.
12 lines • 258 kB
JavaScript
/**
* @preserve
* LIGHTSTREAMER - www.lightstreamer.com
* Lightstreamer Node.js Client
* Version 9.2.2+20250131
* Copyright (c) Lightstreamer Srl. All Rights Reserved.
* Contains: LightstreamerClient, Subscription, ConsoleLogLevel,
* ConsoleLoggerProvider, Logger, LoggerProvider, ClientListener,
* ClientMessageListener, ItemUpdate, SubscriptionListener
* CJS
*/
"use strict";var t=function(){};t.prototype={fatal:function(t,e){},isFatalEnabled:function(){},error:function(t,e){},isErrorEnabled:function(){},warn:function(t,e){},isWarnEnabled:function(){},info:function(t,e){},isInfoEnabled:function(){},debug:function(t,e){},isDebugEnabled:function(){},trace:function(t,e){},isTraceEnabled:function(){}};var e=function(){};function s(){}function i(){}e.prototype={getLogger:function(t){}},s.prototype={onServerError:function(t,e){},onStatusChange:function(t){},onPropertyChange:function(t){},onListenStart:function(){},onListenEnd:function(){}},i.prototype={onAbort:function(t,e){},onError:function(t){},onDiscarded:function(t){},onDeny:function(t,e,s){},onProcessed:function(t,e){}};var n=function(){};n.prototype={getItemName:function(){},getItemPos:function(){},getValue:function(t){},getValueAsJSONPatchIfAvailable:function(t){return null},isValueChanged:function(t){},isSnapshot:function(){},forEachChangedField:function(t){},forEachField:function(t){}};var r=function(){};r.prototype={onItemUpdate:function(t){},onItemLostUpdates:function(t,e,s){},onCommandSecondLevelItemLostUpdates:function(t,e){},onEndOfSnapshot:function(t,e){},onClearSnapshot:function(t,e){},onSubscription:function(){},onUnsubscription:function(){},onSubscriptionError:function(t,e){},onCommandSecondLevelSubscriptionError:function(t,e,s){},onListenStart:function(){},onListenEnd:function(){},onRealMaxFrequency:function(t){}};var a={};!function(s){var i,o=function(){return ls.__string_rec(this,"")},h=h||{};function c(t,e){var s=Object.create(t);for(var i in e)s[i]=e[i];return e.toString!==Object.prototype.toString&&(s.toString=e.toString),s}var l=function(t,e){this.r=new RegExp(t,e.split("u").join(""))};l.__name__=!0,l.prototype={match:function(t){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(t),this.r.s=t,null!=this.r.m},__class__:l};var u=function(){};u.__name__=!0,u.dateStr=function(t){var e=t.getMonth()+1,s=t.getDate(),i=t.getHours(),n=t.getMinutes(),r=t.getSeconds();return t.getFullYear()+"-"+(e<10?"0"+e:""+e)+"-"+(s<10?"0"+s:""+s)+" "+(i<10?"0"+i:""+i)+":"+(n<10?"0"+n:""+n)+":"+(r<10?"0"+r:""+r)},u.cca=function(t,e){var s=t.charCodeAt(e);if(s==s)return s},u.substr=function(t,e,s){if(null==s)s=t.length;else if(s<0){if(0!=e)return"";s=t.length+s}return t.substr(e,s)},u.remove=function(t,e){var s=t.indexOf(e);return-1!=s&&(t.splice(s,1),!0)},u.now=function(){return Date.now()};var _=function(t,e){this.min=t,this.max=e};_.__name__=!0,_.prototype={hasNext:function(){return this.min<this.max},next:function(){return this.min++},__class__:_};var d=function(){};d.__name__=!0,d.has=function(t,e){for(var s=ms(t);s.hasNext();)if(s.next()==e)return!0;return!1},d.exists=function(t,e){for(var s=ms(t);s.hasNext();)if(e(s.next()))return!0;return!1},d.count=function(t,e){var s=0;if(null==e)for(var i=ms(t);i.hasNext();)i.next(),++s;else for(var n=ms(t);n.hasNext();)e(n.next())&&++s;return s},d.empty=function(t){return!ms(t).hasNext()},d.find=function(t,e){for(var s=ms(t);s.hasNext();){var i=s.next();if(e(i))return i}return null},Math.__name__=!0;var f=function(){};f.__name__=!0,f.field=function(t,e){try{return t[e]}catch(t){return null}},f.fields=function(t){var e=[];if(null!=t){var s=Object.prototype.hasOwnProperty;for(var i in t)"__id__"!=i&&"hx__closures__"!=i&&s.call(t,i)&&e.push(i)}return e},f.copy=function(t){if(null==t)return null;for(var e={},s=0,i=f.fields(t);s<i.length;){var n=i[s];++s,e[n]=f.field(t,n)}return e};var m=function(){};m.__name__=!0,m.string=function(t){return ls.__string_rec(t,"")},m.parseInt=function(t){var e=parseInt(t);return isNaN(e)?null:e},m.random=function(t){return t<=0?0:Math.floor(Math.random()*t)};var g=function(){this.b=""};g.__name__=!0,g.prototype={__class__:g};var p=function(){};p.__name__=!0,p.startsWith=function(t,e){return t.length>=e.length&&0==t.lastIndexOf(e,0)},p.endsWith=function(t,e){var s=e.length,i=t.length;return i>=s&&t.indexOf(e,i-s)==i-s},p.isSpace=function(t,e){var s=u.cca(t,e);return s>8&&s<14||32==s},p.ltrim=function(t){for(var e=t.length,s=0;s<e&&p.isSpace(t,s);)++s;return s>0?u.substr(t,s,e-s):t},p.rtrim=function(t){for(var e=t.length,s=0;s<e&&p.isSpace(t,e-s-1);)++s;return s>0?u.substr(t,0,e-s):t},p.trim=function(t){return p.ltrim(p.rtrim(t))},p.replace=function(t,e,s){return t.split(e).join(s)};var v=function(){};v.__name__=!0,v.enumEq=function(t,e){if(t==e)return!0;try{var s=t.__enum__;if(null==s||s!=e.__enum__)return!1;if(t._hx_index!=e._hx_index)return!1;for(var i=h[s].__constructs__[t._hx_index].__params__,n=0;n<i.length;){var r=i[n];if(++n,!v.enumEq(t[r],e[r]))return!1}}catch(n){return!1}return!0};var S=a.LSConnectionDetails=function(t){this.serverAddress=ws,this.client=t,this.lock=t.lock};S.__name__=!0,S.prototype={getServerAddress:function(){return this.serverAddress},setServerAddress:function(t){var e=ye.fromString(t);if(e!=this.serverAddress){Fs.isInfoEnabled()&&Fs.info("serverAddress changed: "+e);var s=this.serverAddress;this.serverAddress=e,this.client.eventDispatcher.onPropertyChange("serverAddress"),s!=e&&this.client.machine.evtServerAddressChanged()}},getAdapterSet:function(){return this.adapterSet},setAdapterSet:function(t){t!=this.adapterSet&&(Fs.isInfoEnabled()&&Fs.info("adapterSet changed: "+t),this.adapterSet=t,this.client.eventDispatcher.onPropertyChange("adapterSet"))},getUser:function(){return this.user},setUser:function(t){t!=this.user&&(Fs.isInfoEnabled()&&Fs.info("user changed: "+t),this.user=t,this.client.eventDispatcher.onPropertyChange("user"))},setPassword:function(t){t!=this.password&&(Fs.isInfoEnabled()&&Fs.info("password changed"),this.password=t,this.client.eventDispatcher.onPropertyChange("password"))},getSessionId:function(){return this.sessionId},setSessionId:function(t){t!=this.sessionId&&(this.sessionId=t,this.client.eventDispatcher.onPropertyChange("sessionId"))},getServerInstanceAddress:function(){return this.serverInstanceAddress},setServerInstanceAddress:function(t){t!=this.serverInstanceAddress&&(this.serverInstanceAddress=t,this.client.eventDispatcher.onPropertyChange("serverInstanceAddress"))},getServerSocketName:function(){return this.serverSocketName},setServerSocketName:function(t){t!=this.serverSocketName&&(this.serverSocketName=t,this.client.eventDispatcher.onPropertyChange("serverSocketName"))},getClientIp:function(){return this.clientIp},setClientIp:function(t){t!=this.clientIp&&(this.clientIp=t,this.client.eventDispatcher.onPropertyChange("clientIp"))},toString:function(){var t=Ht._new();return Ht.set(t,"serverAddress",this.serverAddress),Ht.set(t,"adapterSet",this.adapterSet),Ht.set(t,"user",this.user),Ht.set(t,"sessionId",this.sessionId),Ht.set(t,"serverInstanceAddress",this.serverInstanceAddress),Ht.set(t,"serverSocketName",this.serverSocketName),Ht.set(t,"clientIp",this.clientIp),Ht.set(t,"libVersion",w.LIB_NAME+" "+w.LIB_VERSION),is.stringify(t.h)},__class__:S};var y=a.LSConnectionOptions=function(t){this.cookieHandlingRequired=!1,this.slowingEnabled=!1,this.serverInstanceAddressIgnored=!1,this.httpExtraHeadersOnSessionCreationOnly=!1,this.stalledTimeout=2e3,this.sessionRecoveryTimeout=15e3,this.reverseHeartbeatInterval=0,this.retryDelay=4e3,this.reconnectTimeout=3e3,this.pollingInterval=0,this.realMaxBandwidth=null,this.requestedMaxBandwidth=be.BWUnlimited,this.keepaliveInterval=0,this.idleTimeout=19e3,this.httpExtraHeaders=null,this.forcedTransport=null,this.firstRetryMaxDelay=100,this.contentLength=5e7,this.client=t,this.lock=t.lock};y.__name__=!0,y.prototype={getContentLength:function(){return this.contentLength},setContentLength:function(t){var e=ve.fromIntGt0(t);e!=this.contentLength&&(Fs.isInfoEnabled()&&Fs.info("contentLength changed: "+e),this.contentLength=e,this.client.eventDispatcher.onPropertyChange("contentLength"))},getFirstRetryMaxDelay:function(){return this.firstRetryMaxDelay},setFirstRetryMaxDelay:function(t){var e=pe.fromIntGt0(t);e!=this.firstRetryMaxDelay&&(Fs.isInfoEnabled()&&Fs.info("firstRetryMaxDelay changed: "+e),this.firstRetryMaxDelay=e,this.client.eventDispatcher.onPropertyChange("firstRetryMaxDelay"))},getForcedTransport:function(){return this.forcedTransport},setForcedTransport:function(t){var e=Se.fromString(t);e!=this.forcedTransport&&(Fs.isInfoEnabled()&&Fs.info("forcedTransport changed: "+e),this.forcedTransport=e,this.client.eventDispatcher.onPropertyChange("forcedTransport"),this.client.machine.evtExtSetForcedTransport())},getHttpExtraHeaders:function(){return null==this.httpExtraHeaders?null:Qt.fromMapToDynamicAccess(this.httpExtraHeaders)},setHttpExtraHeaders:function(t){var e=null!=t?Qt.toHaxe(t):null;this.mapEq(e,this.httpExtraHeaders)||(Fs.isInfoEnabled()&&Fs.info("httpExtraHeaders changed: "+(null==e?"null":is.stringify(e.h))),this.httpExtraHeaders=e,this.client.eventDispatcher.onPropertyChange("httpExtraHeaders"))},mapEq:function(t,e){if(t==e)return!0;if(null==t||null==e)return!1;if(d.count(t)!=d.count(e))return!1;for(var s=t.h,i=Object.keys(s),n=i.length,r=0;r<n;){var a=i[r++];if(s[a]!=e.h[a])return!1}return!0},getIdleTimeout:function(){return this.idleTimeout},setIdleTimeout:function(t){var e=pe.fromIntGtEq0(t);e!=this.idleTimeout&&(Fs.isInfoEnabled()&&Fs.info("idleTimeout changed: "+e),this.idleTimeout=e,this.client.eventDispatcher.onPropertyChange("idleTimeout"))},getKeepaliveInterval:function(){return this.keepaliveInterval},setKeepaliveInterval:function(t){var e=pe.fromIntGtEq0(t);e!=this.keepaliveInterval&&(Fs.isInfoEnabled()&&Fs.info("keepaliveInterval changed: "+e),this.keepaliveInterval=e,this.client.eventDispatcher.onPropertyChange("keepaliveInterval"))},getRequestedMaxBandwidth:function(){return Ee.toString(this.requestedMaxBandwidth)},setRequestedMaxBandwidth:function(t){null!=t&&(t=null==t?"null":""+t);var e=Ee.fromString(t);v.enumEq(e,this.requestedMaxBandwidth)||(Fs.isInfoEnabled()&&Fs.info("requestedMaxBandwidth changed: "+Ee.toString(e)),this.requestedMaxBandwidth=e,this.client.eventDispatcher.onPropertyChange("requestedMaxBandwidth"),this.client.machine.evtExtSetRequestedMaxBandwidth())},getRealMaxBandwidth:function(){return Ne.toString(this.realMaxBandwidth)},setRealMaxBandwidth:function(t){Ne.eq(t,this.realMaxBandwidth)||(this.realMaxBandwidth=t,this.client.eventDispatcher.onPropertyChange("realMaxBandwidth"))},getPollingInterval:function(){return this.pollingInterval},setPollingInterval:function(t){var e=pe.fromIntGtEq0(t);e!=this.pollingInterval&&(Fs.isInfoEnabled()&&Fs.info("pollingInterval changed: "+e),this.pollingInterval=e,this.client.eventDispatcher.onPropertyChange("pollingInterval"))},getReconnectTimeout:function(){return this.reconnectTimeout},setReconnectTimeout:function(t){var e=pe.fromIntGt0(t);e!=this.reconnectTimeout&&(Fs.isInfoEnabled()&&Fs.info("reconnectTimeout changed: "+e),this.reconnectTimeout=e,this.client.eventDispatcher.onPropertyChange("reconnectTimeout"))},getRetryDelay:function(){return this.retryDelay},setRetryDelay:function(t){var e=pe.fromIntGt0(t);e!=this.retryDelay&&(Fs.isInfoEnabled()&&Fs.info("retryDelay changed: "+e),this.retryDelay=e,this.client.eventDispatcher.onPropertyChange("retryDelay"))},getReverseHeartbeatInterval:function(){return this.reverseHeartbeatInterval},setReverseHeartbeatInterval:function(t){var e=pe.fromIntGtEq0(t);e!=this.reverseHeartbeatInterval&&(Fs.isInfoEnabled()&&Fs.info("reverseHeartbeatInterval changed: "+e),this.reverseHeartbeatInterval=e,this.client.eventDispatcher.onPropertyChange("reverseHeartbeatInterval"),this.client.machine.evtExtSetReverseHeartbeatInterval())},getSessionRecoveryTimeout:function(){return this.sessionRecoveryTimeout},setSessionRecoveryTimeout:function(t){var e=pe.fromIntGtEq0(t);e!=this.sessionRecoveryTimeout&&(Fs.isInfoEnabled()&&Fs.info("sessionRecoveryTimeout changed: "+e),this.sessionRecoveryTimeout=e,this.client.eventDispatcher.onPropertyChange("sessionRecoveryTimeout"))},getStalledTimeout:function(){return this.stalledTimeout},setStalledTimeout:function(t){var e=pe.fromIntGt0(t);e!=this.stalledTimeout&&(Fs.isInfoEnabled()&&Fs.info("stalledTimeout changed: "+e),this.stalledTimeout=e,this.client.eventDispatcher.onPropertyChange("stalledTimeout"))},isHttpExtraHeadersOnSessionCreationOnly:function(){return this.httpExtraHeadersOnSessionCreationOnly},setHttpExtraHeadersOnSessionCreationOnly:function(t){t!=this.httpExtraHeadersOnSessionCreationOnly&&(Fs.isInfoEnabled()&&Fs.info("httpExtraHeadersOnSessionCreationOnly changed: "+(null==t?"null":""+t)),this.httpExtraHeadersOnSessionCreationOnly=t,this.client.eventDispatcher.onPropertyChange("httpExtraHeadersOnSessionCreationOnly"))},isServerInstanceAddressIgnored:function(){return this.serverInstanceAddressIgnored},setServerInstanceAddressIgnored:function(t){t!=this.serverInstanceAddressIgnored&&(Fs.isInfoEnabled()&&Fs.info("serverInstanceAddressIgnored changed: "+(null==t?"null":""+t)),this.serverInstanceAddressIgnored=t,this.client.eventDispatcher.onPropertyChange("serverInstanceAddressIgnored"))},setCookieHandlingRequired:function(t){t!=this.cookieHandlingRequired&&(Fs.isInfoEnabled()&&Fs.info("cookieHandlingRequired changed: "+(null==t?"null":""+t)),this.cookieHandlingRequired=t,this.client.eventDispatcher.onPropertyChange("cookieHandlingRequired"))},isCookieHandlingRequired:function(){return this.cookieHandlingRequired},isSlowingEnabled:function(){return this.slowingEnabled},setSlowingEnabled:function(t){t!=this.slowingEnabled&&(Fs.isInfoEnabled()&&Fs.info("slowingEnabled changed: "+(null==t?"null":""+t)),this.slowingEnabled=t,this.client.eventDispatcher.onPropertyChange("slowingEnabled"))},toString:function(){var t=Ht._new();return Ht.set(t,"forcedTransport",this.forcedTransport),Ht.set(t,"requestedMaxBandwidth",this.requestedMaxBandwidth),Ht.set(t,"realMaxBandwidth",this.realMaxBandwidth),Ht.set(t,"retryDelay",this.retryDelay),Ht.set(t,"firstRetryMaxDelay",this.firstRetryMaxDelay),Ht.set(t,"sessionRecoveryTimeout",this.sessionRecoveryTimeout),Ht.set(t,"reverseHeartbeatInterval",this.reverseHeartbeatInterval),Ht.set(t,"stalledTimeout",this.stalledTimeout),Ht.set(t,"reconnectTimeout",this.reconnectTimeout),Ht.set(t,"keepaliveInterval",this.keepaliveInterval),Ht.set(t,"pollingInterval",this.pollingInterval),Ht.set(t,"idleTimeout",this.idleTimeout),Ht.set(t,"contentLength",this.contentLength),Ht.set(t,"slowingEnabled",this.slowingEnabled),Ht.set(t,"serverInstanceAddressIgnored",this.serverInstanceAddressIgnored),Ht.set(t,"HTTPExtraHeadersOnSessionCreationOnly",this.httpExtraHeadersOnSessionCreationOnly),Ht.set(t,"HTTPExtraHeaders",this.httpExtraHeaders),Ht.set(t,"cookieHandlingRequired",this.cookieHandlingRequired),is.stringify(t.h)},__class__:y};var b=function(){this.listeners=[]};b.__name__=!0,b.prototype={addListener:function(t){return-1==this.listeners.indexOf(t)&&(this.listeners.push(t),!0)},removeListener:function(t){return u.remove(this.listeners,t)},getListeners:function(){return this.listeners},dispatchToAll:function(t){for(var e=0,s=this.listeners;e<s.length;)this.dispatchToOne(s[e++],t)},dispatchToOne:function(t,e){global.setImmediate((function(){try{e(t)}catch(t){var s=Gt.caught(t);Fs.isErrorEnabled()&&Fs.error("Uncaught exception\n"+s.details())}}))},__class__:b};var E=function(){b.call(this)};E.__name__=!0,E.__super__=b,E.prototype=c(b.prototype,{removeListenerAndFireOnListenEnd:function(t,e){this.removeListener(t)&&this.dispatchToOne(t,(function(t){null!=t.onListenEnd&&t.onListenEnd(e)}))},addListenerAndFireOnListenStart:function(t,e){this.addListener(t)&&this.dispatchToOne(t,(function(t){null!=t.onListenStart&&t.onListenStart(e)}))},onServerError:function(t,e){this.dispatchToAll((function(s){null!=s.onServerError&&s.onServerError(t,e)}))},onStatusChange:function(t){this.dispatchToAll((function(e){null!=e.onStatusChange&&e.onStatusChange(t)}))},onPropertyChange:function(t){this.dispatchToAll((function(e){null!=e.onPropertyChange&&e.onPropertyChange(t)}))},__class__:E});var w=a.LSLightstreamerClient=function(t,e){this.lock=new oe,this.eventDispatcher=new E,this.connectionDetails=new S(this),this.connectionOptions=new y(this),this.machine=new L(this,new ae(this)),null!=t&&this.connectionDetails.setServerAddress(t),null!=e&&this.connectionDetails.setAdapterSet(e)};w.__name__=!0,w.setLoggerProvider=function(t){Ye.setLoggerProvider(t)},w.addCookies=function(t,e){Mt.instance.addCookies(t,e)},w.getCookies=function(t){return Mt.instance.getCookies(t)},w.prototype={addListener:function(t){this.eventDispatcher.addListenerAndFireOnListenStart(t,this)},removeListener:function(t){this.eventDispatcher.removeListenerAndFireOnListenEnd(t,this)},getListeners:function(){return this.eventDispatcher.getListeners().slice()},connect:function(){this.machine.connect()},disconnect:function(){this.machine.disconnect()},getStatus:function(){return this.machine.getStatus()},sendMessage:function(t,e,s,i,n){null==n&&(n=!1),null==s&&(s=-1),this.machine.sendMessage(t,e,null!=s?s:-1,i,null!=n&&n)},subscribe:function(t){this.machine.subscribeExt(t)},unsubscribe:function(t){this.machine.unsubscribe(t)},getSubscriptions:function(){return this.machine.getSubscriptions().slice()},getSubscriptionWrappers:function(){for(var t=[],e=0,s=this.machine.getSubscriptions();e<s.length;){var i=s[e];++e,null!=i.wrapper&&t.push(i.wrapper)}return t.slice()},__class__:w};var T=h["com.lightstreamer.client._Subscription.SubscriptionState"]={__ename__:!0,__constructs__:null,Inactive:{_hx_name:"Inactive",_hx_index:0,__enum__:"com.lightstreamer.client._Subscription.SubscriptionState",toString:o},Active:{_hx_name:"Active",_hx_index:1,__enum__:"com.lightstreamer.client._Subscription.SubscriptionState",toString:o},Subscribed:{_hx_name:"Subscribed",_hx_index:2,__enum__:"com.lightstreamer.client._Subscription.SubscriptionState",toString:o}};T.__constructs__=[T.Inactive,T.Active,T.Subscribed];var R=function(){b.call(this)};R.__name__=!0,R.__super__=b,R.prototype=c(b.prototype,{onClearSnapshot:function(t,e){this.dispatchToAll((function(s){null!=s.onClearSnapshot&&s.onClearSnapshot(t,e)}))},onCommandSecondLevelItemLostUpdates:function(t,e){this.dispatchToAll((function(s){null!=s.onCommandSecondLevelItemLostUpdates&&s.onCommandSecondLevelItemLostUpdates(t,e)}))},onCommandSecondLevelSubscriptionError:function(t,e,s){this.dispatchToAll((function(i){null!=i.onCommandSecondLevelSubscriptionError&&i.onCommandSecondLevelSubscriptionError(t,e,s)}))},onEndOfSnapshot:function(t,e){this.dispatchToAll((function(s){null!=s.onEndOfSnapshot&&s.onEndOfSnapshot(t,e)}))},onItemLostUpdates:function(t,e,s){this.dispatchToAll((function(i){null!=i.onItemLostUpdates&&i.onItemLostUpdates(t,e,s)}))},onItemUpdate:function(t){this.dispatchToAll((function(e){null!=e.onItemUpdate&&e.onItemUpdate(t)}))},removeListenerAndFireOnListenEnd:function(t,e){this.removeListener(t)&&this.dispatchToOne(t,(function(t){null!=t.onListenEnd&&t.onListenEnd(e)}))},addListenerAndFireOnListenStart:function(t,e){this.addListener(t)&&this.dispatchToOne(t,(function(t){null!=t.onListenStart&&t.onListenStart(e)}))},onSubscription:function(){this.dispatchToAll((function(t){null!=t.onSubscription&&t.onSubscription()}))},onSubscriptionError:function(t,e){this.dispatchToAll((function(s){null!=s.onSubscriptionError&&s.onSubscriptionError(t,e)}))},onUnsubscription:function(){this.dispatchToAll((function(t){null!=t.onUnsubscription&&t.onUnsubscription()}))},onRealMaxFrequency:function(t){this.dispatchToAll((function(e){null!=e.onRealMaxFrequency&&e.onRealMaxFrequency(t)}))},__class__:R});var x=a.LSSubscription=function(t,e,s,i){this.lock=new oe,this.m_internal=!1,this.state=T.Inactive,this.eventDispatcher=new R,this.wrapper=i,this.mode=Oe.fromString(t),this.initSnapshot(),this.initItemsAndFields("string"==typeof e?[e].slice():e,s)};x.__name__=!0,x.prototype={initSnapshot:function(){this.snapshot="RAW"==this.mode?null:Re.SnpYes},initItemsAndFields:function(t,e){if(null!=t){if(null==e)throw new zt("Please specify a valid field list");if(this.items=ke.fromArray(jt.copy(t,t)),this.fields=Pe.fromArray(jt.copy(e,e)),"COMMAND"==this.mode&&-1==this.fields.indexOf("key"))throw new zt("Field 'key' is missing");if("COMMAND"==this.mode&&-1==this.fields.indexOf("command"))throw new zt("Field 'command' is missing")}else if(null!=e)throw new zt("Please specify a valid item or item list")},addListener:function(t){this.eventDispatcher.addListenerAndFireOnListenStart(t,this)},removeListener:function(t){this.eventDispatcher.removeListenerAndFireOnListenEnd(t,this)},getListeners:function(){return this.eventDispatcher.getListeners().slice()},isActive:function(){return this.state!=T.Inactive},isSubscribed:function(){return this.state==T.Subscribed},getDataAdapter:function(){return this.dataAdapter},setDataAdapter:function(t){this.checkActive(),this.dataAdapter=Me.fromString(t)},getMode:function(){return this.mode},getItems:function(){return null==this.items?null:this.items.slice()},fetchItems:function(){return this.items},setItems:function(t){this.checkActive(),this.items=ke.fromArray(null==t?null:jt.copy(t,t)),this.group=null},getItemGroup:function(){return this.group},setItemGroup:function(t){this.checkActive(),this.group=Me.fromString(t),this.items=null},getFields:function(){return null==this.fields?null:this.fields.slice()},fetchFields:function(){return this.fields},setFields:function(t){this.checkActive();var e=Pe.fromArray(null==t?null:jt.copy(t,t));if("COMMAND"==this.mode&&null!=e){if(-1==e.indexOf("command"))throw new zt("Field 'command' is missing");if(-1==e.indexOf("key"))throw new zt("Field 'key' is missing")}this.fields=e,this.schema=null},getFieldSchema:function(){return this.schema},setFieldSchema:function(t){this.checkActive(),this.schema=Me.fromString(t),this.fields=null},getRequestedBufferSize:function(){return Te.toString(this.bufferSize)},setRequestedBufferSize:function(t){null!=t&&(t=null==t?"null":""+t),this.checkActive(),this.bufferSize=Te.fromString(t)},getRequestedSnapshot:function(){return xe.toString(this.snapshot)},setRequestedSnapshot:function(t){null!=t&&(t=null==t?"null":""+t),this.checkActive();var e=xe.fromString(t);switch(this.mode){case"COMMAND":case"MERGE":if(null!=e&&null!=e&&2==e._hx_index)throw new zt("Snapshot length is not permitted if MERGE or COMMAND was specified as mode");break;case"RAW":if(null!=e)throw new zt("Snapshot is not permitted if RAW was specified as mode")}this.snapshot=e},getRequestedMaxFrequency:function(){return Ie.toString(this.requestedMaxFrequency)},setRequestedMaxFrequency:function(t){var e,s=this;null!=t&&(t=null==t?"null":""+t),this.lock.synchronized((function(){var i=Ie.fromString(t);switch(s.mode){case"COMMAND":case"DISTINCT":case"MERGE":break;default:throw new zt("The operation in only available on MERGE, DISTINCT and COMMAND Subscripitons")}if(s.isActive()&&(null==i||i==Ce.FreqUnfiltered||s.requestedMaxFrequency==Ce.FreqUnfiltered))throw new zt("Cannot change the frequency from/to 'unfiltered' or to null while the Subscription is active");return null!=s.subId&&As.isInfoEnabled()&&As.info("Subscription "+s.subId+" requested max frequency changed: "+t),s.requestedMaxFrequency=i,e=s.manager})),null!=e&&e.evtExtConfigure()},getSelector:function(){return this.selector},setSelector:function(t){this.checkActive(),this.selector=Me.fromString(t)},getCommandPosition:function(){if(this.checkCommand(),null==this.cmdIdx)throw new Yt("The position of the command field is currently unknown");return this.cmdIdx},getKeyPosition:function(){if(this.checkCommand(),null==this.keyIdx)throw new Yt("The position of the key field is currently unknown");return this.keyIdx},getCommandSecondLevelDataAdapter:function(){return this.dataAdapter2},setCommandSecondLevelDataAdapter:function(t){this.checkActive(),this.checkCommand(),this.dataAdapter2=Me.fromString(t)},getCommandSecondLevelFields:function(){return null==this.fields2?null:this.fields2.slice()},setCommandSecondLevelFields:function(t){this.checkActive(),this.checkCommand(),this.fields2=Pe.fromArray(null==t?null:jt.copy(t,t)),this.schema2=null},getCommandSecondLevelFieldSchema:function(){return this.schema2},setCommandSecondLevelFieldSchema:function(t){this.checkActive(),this.checkCommand(),this.schema2=Me.fromString(t),this.fields2=null},getValue:function(t,e){var s="number"==typeof t&&(0|t)===t,i="string"==typeof t,n="number"==typeof e&&(0|e)===e,r="string"==typeof e;if(s&&n)return this.getValuePosPos(t,e);if(s&&r)return this.getValuePosName(t,e);if(i&&n)return this.getValueNamePos(t,e);if(i&&r)return this.getValueNameName(t,e);throw new zt("Invalid argument type")},getCommandValue:function(t,e,s){var i="number"==typeof t&&(0|t)===t,n="string"==typeof t,r="number"==typeof s&&(0|s)===s,a="string"==typeof s;if(i&&r)return this.getCommandValuePosPos(t,e,s);if(i&&a)return this.getCommandValuePosName(t,e,s);if(n&&r)return this.getCommandValueNamePos(t,e,s);if(n&&a)return this.getCommandValueNameName(t,e,s);throw new zt("Invalid argument type")},getValuePosPos:function(t,e){var s,i=this;if(t<1||e<1)throw new zt("The specified position is out of bounds");return this.lock.synchronized((function(){return s=i.manager})),null!=s?s.getValue(t,e):null},getValuePosName:function(t,e){var s=this;return this.getValuePosPos(t,this.lock.synchronized((function(){return s.getFieldPos(e)})))},getValueNamePos:function(t,e){var s=this;return this.getValuePosPos(this.lock.synchronized((function(){return s.getItemPos(t)})),e)},getValueNameName:function(t,e){var s=this;return this.getValuePosPos(this.lock.synchronized((function(){return s.getItemPos(t)})),this.lock.synchronized((function(){return s.getFieldPos(e)})))},getCommandValuePosPos:function(t,e,s){var i,n=this;if(this.checkCommand(),t<1||s<1)throw new zt("The specified position is out of bounds");return this.lock.synchronized((function(){return i=n.manager})),null!=i?i.getCommandValue(t,e,s):null},getCommandValuePosName:function(t,e,s){var i=this;return this.getCommandValuePosPos(t,e,this.lock.synchronized((function(){return i.getFieldPos(s)})))},getCommandValueNamePos:function(t,e,s){var i=this;return this.getCommandValuePosPos(this.lock.synchronized((function(){return i.getItemPos(t)})),e,s)},getCommandValueNameName:function(t,e,s){var i=this;return this.getCommandValuePosPos(this.lock.synchronized((function(){return i.getItemPos(t)})),e,this.lock.synchronized((function(){return i.getFieldPos(s)})))},getItemPos:function(t){var e;if(null==this.items||-1==(e=ke.getPos(this.items,t)))throw new zt("Unknown item name");return e},getFieldPos:function(t){var e;if(null==this.fields||-1==(e=Pe.getPos(this.fields,t)))throw new zt("Unknown field name");return e},checkActive:function(){if(this.isActive())throw new Yt("Cannot modify an active Subscription. Please unsubscribe before applying any change")},checkCommand:function(){if("COMMAND"!=this.mode)throw new Yt("This method can only be used on COMMAND subscriptions")},fetch_items:function(){return this.items},fetch_fields:function(){return this.fields},fetch_fields2:function(){return this.fields2},fetch_mode:function(){return this.mode},fetch_requestedBufferSize:function(){return this.bufferSize},fetch_requestedSnapshot:function(){return this.snapshot},fetch_requestedMaxFrequency:function(){return this.requestedMaxFrequency},fetch_nItems:function(){return this.nItems},fetch_subManager:function(){return this.manager},setActive:function(){this.state=T.Active},setInactive:function(){this.state=T.Inactive,this.subId=null,this.cmdIdx=null,this.keyIdx=null,this.nItems=null,this.nFields=null},setSubscribed:function(t,e,s){this.state=T.Subscribed,this.subId=t,this.nItems=e,this.nFields=s},setSubscribedCMD:function(t,e,s,i,n){this.state=T.Subscribed,this.subId=t,this.cmdIdx=i,this.keyIdx=n,this.nItems=e,this.nFields=s},fetch_nFields:function(){return this.nFields},isInternal:function(){return this.m_internal},setInternal:function(){this.m_internal=!0},getItemName:function(t){return null!=this.items?this.items[t-1]:null},relate:function(t){this.manager=t},unrelate:function(t){this.manager==t&&(this.manager=null)},hasSnapshot:function(){return!(null==this.snapshot||this.snapshot==Re.SnpNo)},getItemNameOrPos:function(t){return null!=this.items?this.items[t-1]:""+t},fireOnSubscription:function(t){As.isInfoEnabled()&&As.info("Subscription "+t+" added"),this.eventDispatcher.onSubscription()},fireOnUnsubscription:function(t){As.isInfoEnabled()&&As.info("Subscription "+t+" deleted"),this.eventDispatcher.onUnsubscription()},fireOnSubscriptionError:function(t,e,s){As.isWarnEnabled()&&As.warn("Subscription "+t+" failed: "+e+" - "+s),this.eventDispatcher.onSubscriptionError(e,s)},fireOnEndOfSnapshot:function(t,e){As.isDebugEnabled()&&As.debug("Subscription "+e+":"+this.getItemNameOrPos(t)+": snapshot ended"),this.eventDispatcher.onEndOfSnapshot(this.getItemName(t),t)},fireOnClearSnapshot:function(t,e){As.isDebugEnabled()&&As.debug("Subscription "+e+":"+this.getItemNameOrPos(t)+": snapshot cleared"),this.eventDispatcher.onClearSnapshot(this.getItemName(t),t)},fireOnLostUpdates:function(t,e,s){As.isDebugEnabled()&&As.debug("Subscription "+s+":"+this.getItemNameOrPos(t)+": lost "+e+" updates"),this.eventDispatcher.onItemLostUpdates(this.getItemName(t),t,e)},fireOnItemUpdate:function(t,e){As.isDebugEnabled()&&As.debug("Subscription "+e+":"+this.getItemNameOrPos(t.getItemPos())+" update: "+m.string(t)),this.eventDispatcher.onItemUpdate(t)},fireOnRealMaxFrequency:function(t,e){As.isDebugEnabled()&&As.debug("Subscription "+e+" real max frequency changed: "+m.string(t)),this.eventDispatcher.onRealMaxFrequency(function(t){if(null==t)return"null";switch(t._hx_index){case 0:return""+t.freq;case 1:return"unlimited"}}(t))},fireOnSubscriptionError2Level:function(t,e,s,i,n){As.isWarnEnabled()&&As.warn("Subscription "+i+":"+this.getItemNameOrPos(n)+":"+t+" failed: "+e+" - "+s),this.eventDispatcher.onCommandSecondLevelSubscriptionError(e,s,t)},fireOnLostUpdates2Level:function(t,e,s,i){As.isDebugEnabled()&&As.debug("Subscription "+s+":"+this.getItemNameOrPos(i)+":"+t+": lost "+e+" updates"),this.eventDispatcher.onCommandSecondLevelItemLostUpdates(e,t)},toString:function(){var t=Ht._new();return Ht.set(t,"mode",this.mode),Ht.set(t,"items",null!=this.items?m.string(this.items):this.group),Ht.set(t,"fields",null!=this.fields?m.string(this.fields):this.schema),Ht.set(t,"dataAdapter",this.dataAdapter),Ht.set(t,"requestedBufferSize",this.bufferSize),Ht.set(t,"requestedSnapshot",this.snapshot),Ht.set(t,"requestedMaxFrequency",this.requestedMaxFrequency),Ht.set(t,"selector",this.selector),Ht.set(t,"secondLevelFields",null!=this.fields2?m.string(this.fields2):this.schema2),Ht.set(t,"secondLevelDataAdapter",this.dataAdapter2),is.stringify(t.h)},__class__:x};var C=function(){};C.__name__=!0,C.__isInterface__=!0,C.prototype={__class__:C};var I=function(t){this.frozen=!1};I.__name__=!0,I.__interfaces__=[C],I.newLoggingInstance=function(){return new I},I.prototype={startListening:function(){},stopListening:function(){},__class__:I};var L=function(t,e){this.slw_m=.5,this.slw_hugeDelayMs=2e4,this.slw_maxAvgDelayMs=7e3,this.slw_avgDelayMs=0,this.slw_refTime=0,this.rec_clientProg=0,this.rec_serverProg=0,this.subscriptionManagers=new Zt,this.messageManagers=new Ut,this.sequenceMap=new is,this.disabledTransports=new ue,this.suspendedTransports=new ue,this.ctrl_connectTs=0,this.recoverTs=0,this.connectTs=0,this.m_nextSubId=0,this.m_nextReqId=0,this.m_status="DISCONNECTED",this.delayCounter=new lt,this.state=new G,this.client=t,this.lock=t.lock,this.details=t.connectionDetails,this.options=t.connectionOptions,this.wsFactory=gs(e,e.createWsClient),this.httpFactory=gs(e,e.createHttpClient),this.ctrlFactory=gs(e,e.createCtrlClient),this.timerFactory=gs(e,e.createTimer),this.randomGenerator=gs(e,e.randomMillis),this.reachabilityFactory=gs(e,e.createReachabilityManager),this.frz_pageLifecycleFactory=gs(e,e.createPageLifecycleFactory),this.clientEventDispatcher=t.eventDispatcher,this.switchRequest=new A(this),this.constrainRequest=new W(this),this.delayCounter.reset(this.options.retryDelay)};L.__name__=!0,L.prototype={disposeSession:function(){this.disposeWS(),this.disposeHTTP(),this.disposeCtrl(),this.details.setServerInstanceAddress(null),this.details.setSessionId(null),this.details.setServerSocketName(null),this.details.setClientIp(null),this.options.setRealMaxBandwidth(null),this.lastKnownClientIp=null,this.resetSequenceMap(),this.rec_serverProg=0,this.rec_clientProg=0,this.bw_lastReqId=null,this.bw_requestedMaxBandwidth=null,this.swt_lastReqId=null},disposeClient:function(){this.sessionId=null,this.enableAllTransports(),this.resetCurrentRetryDelay(),this.resetSequenceMap(),this.cause=null},evtExtConnect:function(){this.traceEvent("connect");var t,e=!0;100==this.state.s_m&&(L.frz_globalPageLifecycle.frozen?(Hs.isWarnEnabled()&&Hs.warn("connection requested while page is frozen"),this.cause="page.frozen",this.resetCurrentRetryDelay(),this.doInstallPageLifecycle(),this.state.s_m=117,this.state.traceState(),e=this.evtExtConnect_NextRegion(),null!=(t=this.frz_pageLifecycle)&&t.startListening(),this.evtRetry(k.page_frozen)):(this.cause="api",this.resetCurrentRetryDelay(),this.doInstallPageLifecycle(),this.state.s_m=101,this.state.traceState(),e=this.evtExtConnect_NextRegion(),null!=(t=this.frz_pageLifecycle)&&t.startListening(),this.evtSelectCreate()));e&&this.evtExtConnect_NextRegion()},evtExtConnect_NextRegion:function(){return this.evtExtConnect_NetworkReachabilityRegion()},evtExtConnect_NetworkReachabilityRegion:function(){var t=this;if(1400==this.state.s_nr){var e=new qe(this.getServerAddress()).get_hostname();this.nr_reachabilityManager=this.reachabilityFactory(e),this.state.s_nr=1410,this.state.traceState(),this.nr_reachabilityManager.startListening((function(s){switch(s._hx_index){case 0:t.evtNetworkReachable(e);break;case 1:t.evtNetworkNotReachable(e)}}))}return!1},doInstallPageLifecycle:function(){var t=this;this.frz_pageLifecycle=this.frz_pageLifecycleFactory((function(e){switch(e._hx_index){case 0:t.evtPageFrozen();break;case 1:t.evtPageResumed()}}))},doUnistallPageLifecycle:function(){var t=this.frz_pageLifecycle;null!=t&&t.stopListening(),this.frz_pageLifecycle=null},evtPageFrozen:function(){switch(this.traceEvent("page.frozen"),this.state.s_m){case 110:case 111:case 112:case 113:case 114:case 115:case 116:this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.s_m=117,this.state.traceState(),this.cancel_evtRetryTimeout();break;case 120:case 121:case 122:this.disposeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.s_m=117,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtRetry(k.page_frozen);break;case 130:case 140:this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.s_m=117,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtRetry(k.page_frozen);break;case 150:var t=this.state.s_tr;if(null!=t)switch(t){case 210:this.sendDestroyWS("page.frozen"),this.closeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.clear_w(),this.state.goto_m_from_session(117),this.exit_w(),this.evtEndSession(),this.evtRetry(k.page_frozen);break;case 220:case 230:this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_session(117),this.cancel_evtTransportTimeout(),this.evtEndSession(),this.evtRetry(k.page_frozen);break;case 240:if(500==(null!=(i=this.state.s_ws)?i.m:null))this.disposeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_ws(117),this.exit_ws_to_m(),this.evtRetry(k.page_frozen);else{var e;if(501!=(null!=(e=this.state.s_ws)?e.m:null))s=502==(null!=(e=this.state.s_ws)?e.m:null);else s=!0;if(s)i=!0;else i=503==(null!=(s=this.state.s_ws)?s.m:null);i&&(this.sendDestroyWS("page.frozen"),this.closeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_ws(117),this.exit_ws_to_m(),this.evtRetry(k.page_frozen))}break;case 250:var s,i;if(600!=(null!=(s=this.state.s_wp)?s.m:null))i=601==(null!=(s=this.state.s_wp)?s.m:null);else i=!0;if(i)this.disposeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_wp(117),this.exit_ws_to_m(),this.evtRetry(k.page_frozen);else 602==(null!=(i=this.state.s_wp)?i.m:null)&&(this.sendDestroyWS("page.frozen"),this.closeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_wp(117),this.exit_wp_to_m(),this.evtRetry(k.page_frozen));break;case 260:this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_rec(117),this.exit_rec_to_m(),this.evtRetry(k.page_frozen);break;case 270:710==this.state.s_h?(this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_hs(117),this.exit_hs_to_m(),this.evtRetry(k.page_frozen)):720==this.state.s_h&&(this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="page.frozen",this.state.goto_m_from_hp(117),this.exit_hp_to_m(),this.evtRetry(k.page_frozen))}}},evtPageResumed:function(){this.traceEvent("page.resumed"),117==this.state.s_m&&(this.state.s_m=116,this.state.traceState(),this.evtSelectCreate())},evtNetworkNotReachable:function(t){qs.isInfoEnabled()&&qs.info(t+" is NOT reachable"),this.traceEvent("nr:network.not.reachable"),(1410==this.state.s_nr||1412==this.state.s_nr)&&(this.state.s_nr=1411,this.state.traceState())},evtNetworkReachable:function(t){qs.isInfoEnabled()&&qs.info(t+" is reachable"),this.traceEvent("nr:network.reachable"),1410==this.state.s_nr?(this.state.s_nr=1412,this.state.traceState()):1411==this.state.s_nr&&(this.state.s_nr=1412,this.state.traceState(),this.evtOnlineAgain())},evtOnlineAgain:function(){this.traceEvent("online.again"),112==this.state.s_m?(this.state.s_m=116,this.state.traceState(),this.cancel_evtRetryTimeout(),this.evtSelectCreate()):1003==this.state.s_rec&&(this.sendRecovery(),this.state.s_rec=1001,this.state.traceState(),this.cancel_evtRetryTimeout(),this.schedule_evtTransportTimeout(this.options.retryDelay))},evtServerAddressChanged:function(){var t=this;switch(this.traceEvent("nr:serverAddress.changed"),this.state.s_nr){case 1410:case 1411:case 1412:var e=this.nr_reachabilityManager,s=new qe(this.getServerAddress()).get_hostname();this.nr_reachabilityManager=this.reachabilityFactory(s),this.state.s_nr=1410,this.state.traceState(),null!=e&&e.stopListening(),this.nr_reachabilityManager.startListening((function(e){switch(e._hx_index){case 0:t.evtNetworkReachable(s);break;case 1:t.evtNetworkNotReachable(s)}}))}},evtExtDisconnect:function(t){switch(this.traceEvent("disconnect: cause="+m.string(t)),this.state.s_m){case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.s_m=100,this.state.traceState(),this.cancel_evtRetryTimeout(),this.evtTerminate(t);break;case 120:case 121:case 122:this.disposeWS(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.s_m=100,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtTerminate(t);break;case 130:case 140:this.disposeHTTP(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.s_m=100,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtTerminate(t);break;case 150:var e=this.state.s_tr;if(null!=e)switch(e){case 210:this.sendDestroyWS(),this.closeWS(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.clear_w(),this.state.goto_m_from_session(100),this.exit_w(),this.evtEndSession(),this.evtTerminate(t);break;case 220:case 230:this.disposeHTTP(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_session(100),this.cancel_evtTransportTimeout(),this.evtEndSession(),this.evtTerminate(t);break;case 240:if(500==(null!=(n=this.state.s_ws)?n.m:null))this.disposeWS(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_ws(100),this.exit_ws_to_m(),this.evtTerminate(t);else{var s;if(501!=(null!=(s=this.state.s_ws)?s.m:null))i=502==(null!=(s=this.state.s_ws)?s.m:null);else i=!0;if(i)n=!0;else n=503==(null!=(i=this.state.s_ws)?i.m:null);n&&(this.sendDestroyWS(),this.closeWS(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_ws(100),this.exit_ws_to_m(),this.evtTerminate(t))}break;case 250:var i,n;if(600!=(null!=(i=this.state.s_wp)?i.m:null))n=601==(null!=(i=this.state.s_wp)?i.m:null);else n=!0;if(n)this.disposeWS(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_wp(100),this.exit_ws_to_m(),this.evtTerminate(t);else 602==(null!=(n=this.state.s_wp)?n.m:null)&&(this.sendDestroyWS(),this.closeWS(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_wp(100),this.exit_wp_to_m(),this.evtTerminate(t));break;case 260:this.disposeHTTP(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_rec(100),this.exit_rec_to_m(),this.evtTerminate(t);break;case 270:710==this.state.s_h?(this.disposeHTTP(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_hs(100),this.exit_hs_to_m(),this.evtTerminate(t)):720==this.state.s_h&&(this.disposeHTTP(),this.notifyStatus("DISCONNECTED"),this.notifyServerErrorIfCauseIsError(t),this.state.goto_m_from_hp(100),this.exit_hp_to_m(),this.evtTerminate(t))}}},evtSelectCreate:function(){if(this.traceEvent("select.create"),101==this.state.s_m||116==this.state.s_m)switch(this.getBestForCreating()._hx_index){case 0:this.notifyStatus("CONNECTING"),this.openWS_Create(),this.state.s_m=120,this.state.traceState(),this.evtCreate(),this.schedule_evtTransportTimeout(this.delayCounter.get_currentRetryDelay());break;case 1:this.notifyStatus("CONNECTING"),this.sendCreateHTTP(),this.state.s_m=130,this.state.traceState(),this.evtCreate(),this.schedule_evtTransportTimeout(this.delayCounter.get_currentRetryDelay());break;case 2:this.notifyStatus("DISCONNECTED"),this.state.s_m=100,this.state.traceState(),this.evtTerminate(P.TC_otherError("Unable to select a transport"))}},evtWSOpen:function(){var t;(this.traceEvent("ws.open"),120==this.state.s_m)?(this.sendCreateWS(),this.state.s_m=121,this.state.traceState()):500==(null!=(t=this.state.s_ws)?t.m:null)?(this.sendBindWS_Streaming(),this.state.s_ws.m=501,this.state.traceState()):600==(null!=(t=this.state.s_wp)?t.m:null)&&(Jt.sure(this.ws).send("wsok"),this.state.s_wp.m=601,this.state.traceState())},evtMessage:function(t){var e=!0;if(p.startsWith(t,"U,")){var s=function(t){var e=nt(t,",")+1,s=nt(t,",",e)+1,i=nt(t,",",s)+1,n=st(t.substring(e,s-1)),r=st(t.substring(s,i-1)),a=new es,o=i-1,h=1;for(;o<t.length;){var c=t.indexOf("|",o+1);-1==c&&(c=t.length);var l=t.substring(o+1,c);if(""==l)a.h[h]=ge.unchanged,++h;else if("#"==l)a.h[h]=ge.changed(null),++h;else if("$"==l)a.h[h]=ge.changed(""),++h;else if("^"==l.charAt(0))if("P"==l.charAt(1)){var u=rt(l.substring(2));try{var _=Be._new(u);a.h[h]=ge.jsonPatch(_),++h}catch(t){var d=Gt.caught(t);throw Ms.isErrorEnabled()&&Ms.error("Invalid JSON patch "+u+": "+d.get_message()+"\n"+d.details()),new Yt("The JSON Patch for the field "+h+" is not well-formed")}}else if("T"==l.charAt(1)){var f=rt(l.substring(2));a.h[h]=ge.diffPatch(f),++h}else for(var m=st(l.substring(1)),g=0;g<m;)++g,a.h[h]=ge.unchanged,++h;else{var p=ge.changed(rt(l));a.h[h]=p,++h}o=c}return new et(n,r,a)}(t);this.evtU(s.subId,s.itemIdx,s.values,t)}else if(p.startsWith(t,"REQOK"))"REQOK"==t?this.evtREQOK_withoutReqId():this.evtREQOK(st(t.split(",")[1]));else if(p.startsWith(t,"PROBE"))this.evtPROBE();else if(p.startsWith(t,"LOOP"))this.evtLOOP(st(t.split(",")[1]));else if(p.startsWith(t,"CONOK")){var i=t.split(",");this.evtCONOK(i[1],st(i[2]),st(i[3]),i[4])}else if(p.startsWith(t,"WSOK"))this.evtWSOK();else if(p.startsWith(t,"SERVNAME"))this.evtSERVNAME(t.split(",")[1]);else if(p.startsWith(t,"CLIENTIP"))this.evtCLIENTIP(t.split(",")[1]);else if(p.startsWith(t,"CONS")){var n=t.split(",")[1];switch(n){case"unlimited":this.evtCONS(De.BWUnlimited);break;case"unmanaged":this.evtCONS(De.BWUnmanaged);break;default:this.evtCONS(De.BWLimited(it(n)))}}else if(p.startsWith(t,"MSGDONE")){"*"==(o=(i=t.split(","))[1])&&(o="UNORDERED_MESSAGES");var r=st(i[2]),a=i[3];this.evtMSGDONE(o,r,""==a?"":rt(a))}else if(p.startsWith(t,"MSGFAIL")){var o;"*"==(o=(i=t.split(","))[1])&&(o="UNORDERED_MESSAGES"),this.evtMSGFAIL(o,st(i[2]),st(i[3]),rt(i[4]))}else if(p.startsWith(t,"REQERR")){i=t.split(",");this.evtREQERR(st(i[1]),st(i[2]),rt(i[3]))}else if(p.startsWith(t,"PROG"))this.evtPROG(st(t.split(",")[1]));else if(p.startsWith(t,"SUBOK")){i=t.split(",");this.evtSUBOK(st(i[1]),st(i[2]),st(i[3]))}else if(p.startsWith(t,"SUBCMD")){i=t.split(",");this.evtSUBCMD(st(i[1]),st(i[2]),st(i[3]),st(i[4]),st(i[5]))}else if(p.startsWith(t,"UNSUB"))this.evtUNSUB(st(t.split(",")[1]));else if(p.startsWith(t,"CONF")){var h=st((i=t.split(","))[1]);"unlimited"==i[2]?this.evtCONF(h,Le.RFreqUnlimited):this.evtCONF(h,Le.RFreqLimited(it(i[2])))}else if(p.startsWith(t,"EOS")){i=t.split(",");this.evtEOS(st(i[1]),st(i[2]))}else if(p.startsWith(t,"CS")){i=t.split(",");this.evtCS(st(i[1]),st(i[2]))}else if(p.startsWith(t,"OV")){i=t.split(",");this.evtOV(st(i[1]),st(i[2]),st(i[3]))}else if(p.startsWith(t,"NOOP"))this.evtNOOP();else if(p.startsWith(t,"CONERR")){i=t.split(",");this.evtCONERR(st(i[1]),rt(i[2]))}else if(p.startsWith(t,"END")){i=t.split(",");this.evtEND(st(i[1]),rt(i[2]))}else if(p.startsWith(t,"ERROR")){i=t.split(",");this.evtERROR(st(i[1]),rt(i[2]))}else p.startsWith(t,"SYNC")?this.evtSYNC(st(t.split(",")[1])):e=!1;return e},evtCtrlMessage:function(t){if(p.startsWith(t,"REQOK"))"REQOK"==t?this.evtREQOK_withoutReqId():this.evtREQOK(st(t.split(",")[1]));else if(p.startsWith(t,"REQERR")){var e=t.split(",");this.evtREQERR(st(e[1]),st(e[2]),rt(e[3]))}else if(p.startsWith(t,"ERROR")){e=t.split(",");this.evtERROR(st(e[1]),rt(e[2]))}},evtTransportTimeout:function(){switch(this.traceEvent("transport.timeout"),this.state.s_m){case 120:case 121:this.suspendWS_Streaming(),this.disposeWS(),this.cause="ws.unavailable",this.state.s_m=115,this.state.traceState(),this.cancel_evtTransportTimeout(),this.entry_m115(k.ws_unavailable);break;case 122:this.disposeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="ws.timeout",this.state.s_m=112,this.state.traceState(),this.cancel_evtTransportTimeout(),this.entry_m112(k.ws_timeout);break;case 130:this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="http.timeout",this.state.s_m=112,this.state.traceState(),this.cancel_evtTransportTimeout(),this.entry_m112(k.http_timeout);break;case 140:this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="ttl.timeout";var t=this.waitingInterval(this.delayCounter.get_currentRetryDelay(),this.connectTs);this.state.s_m=111,this.state.traceState(),this.cancel_evtTransportTimeout(),this.entry_m111(k.http_error,t);break;case 150:if(null!=(s=this.state.s_tr))switch(s){case 220:if(0==this.options.sessionRecoveryTimeout)this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="http.timeout",this.state.goto_m_from_session(112),this.cancel_evtTransportTimeout(),this.evtEndSession(),this.entry_m112(k.http_timeout);else{this.disposeHTTP(),this.notifyStatus("DISCONNECTED:TRYING-RECOVERY"),this.cause="http.timeout";t=this.randomGenerator(this.options.firstRetryMaxDelay);this.state.goto_rec(),this.cancel_evtTransportTimeout(),this.entry_rec(t,k.http_timeout)}break;case 230:if(0==this.options.sessionRecoveryTimeout)this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="ttl.timeout",this.state.goto_m_from_session(112),this.cancel_evtTransportTimeout(),this.evtEndSession(),this.entry_m112(k.http_timeout);else{this.disposeHTTP(),this.notifyStatus("DISCONNECTED:TRYING-RECOVERY"),this.cause="ttl.timeout";t=this.randomGenerator(this.options.firstRetryMaxDelay);this.state.goto_rec(),this.cancel_evtTransportTimeout(),this.entry_rec(t,k.http_error)}break;case 240:if(null!=(s=null!=(e=this.state.s_ws)?e.m:null))switch(s){case 500:this.disableWS(),this.disposeWS(),this.cause="ws.unavailable",this.state.clear_ws(),this.state.s_tr=200,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtSwitchTransport();break;case 501:if(0==this.options.sessionRecoveryTimeout)this.disableWS(),this.disposeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="ws.unavailable",this.state.goto_m_from_ws(112),this.exit_ws_to_m(),this.entry_m112(k.ws_unavailable);else{this.disableWS(),this.disposeWS(),this.notifyStatus("DISCONNECTED:TRYING-RECOVERY"),this.cause="ws.unavailable";t=this.randomGenerator(this.options.firstRetryMaxDelay);this.state.goto_rec_from_ws(),this.exit_ws(),this.entry_rec(t,k.ws_unavailable)}break;case 502:if(0==this.options.sessionRecoveryTimeout)this.disposeWS(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="ws.timeout",this.state.goto_m_from_ws(112),this.exit_ws_to_m(),this.entry_m112(k.ws_timeout);else{this.disposeWS(),this.notifyStatus("DISCONNECTED:TRYING-RECOVERY"),this.cause="ws.timeout";t=this.randomGenerator(this.options.firstRetryMaxDelay);this.state.goto_rec_from_ws(),this.exit_ws(),this.entry_rec(t,k.ws_timeout)}}break;case 250:if(null!=(s=null!=(e=this.state.s_wp)?e.m:null))switch(s){case 600:case 601:this.disableWS(),this.disposeWS(),this.cause="ws