{"version":3,"sources":["dist/angular-websocket.js"],"names":["global","factory","define","amd","exports","module","require","mod","angular","ws","angularWebsocket","this","_angular","_interopRequireDefault","obj","__esModule","default","$WebSocketProvider","$rootScope","$q","$timeout","$websocketBackend","$WebSocket","url","protocols","options","isObject","isArray","undefined","ssl","test","scope","rootScopeFailover","useApplyAsync","initialTimeout","maxTimeout","reconnectIfNotNormalClose","binaryType","_reconnectAttempts","sendQueue","onOpenCallbacks","onMessageCallbacks","onErrorCallbacks","onCloseCallbacks","objectFreeze","_readyStateConstants","_connect","_setInternalState","prototype","CONNECTING","OPEN","CLOSING","CLOSED","RECONNECT_ABORTED","_normalCloseCode","_reconnectableStatusCodes","safeDigest","autoApply","$$phase","$digest","bindToScope","self","$on","force","socket","readyState","create","onmessage","_angular2","bind","_onMessageHandler","onopen","_onOpenHandler","onerror","_onErrorHandler","onclose","_onCloseHandler","fireQueue","length","data","shift","send","isString","message","JSON","stringify","deferred","resolve","notifyOpenCallbacks","event","i","call","notifyCloseCallbacks","notifyErrorCallbacks","onOpen","cb","push","onClose","onError","onMessage","callback","isFunction","Error","isDefined","filter","RegExp","fn","pattern","$applyAsync","code","indexOf","reconnect","applyAsyncOrDigest","args","arraySlice","arguments","apply","currentCallback","exec","close","bufferedAmount","cancelableify","promise","cancel","then","newPromise","reason","splice","reject","defer","isMocked","isConnected","mockSend","backoffDelay","_getBackoffDelay","backoffDelaySeconds","console","log","attempt","R","Math","random","T","F","N","M","floor","min","pow","state","objectDefineProperty","_internalConnectionState","forEach","pending","get","set","$WebSocketBackendProvider","$log","match","Socket","createWebSocketBackend","warn","Object","defineProperty","value","_typeof","Symbol","iterator","constructor","Client","client","e","window","WebSocket","MozWebSocket","noop","freeze","Array","slice","elt","len","from","Number","ceil","service"],"mappings":"CAAA,SAAWA,EAAQC,GACjB,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,SAAU,UAAW,UAAW,MAAOD,OAC1C,IAAuB,mBAAZG,SAChBH,EAAQI,O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