text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("rxjs"),require("rxjs/operators"),require("@stomp/stompjs")):"function"==typeof define&&define.amd?define("RxStomp",["rxjs","rxjs/operators","@stomp/stompjs"],t):"object"==typeof exports?exports.RxStomp=t(require("rxjs"),require("rxjs/operators"),require("@stomp/stompjs")):e.RxStomp=t(e.rxjs,e.rxjs.operators,e.StompJs)}("undefined"!=typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";var r=function(){function e(){}return e.UUID=function(){if("undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.getRandomValues){var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.pad4(e[0])+this.pad4(e[1])+"-"+this.pad4(e[2])+"-"+this.pad4(e[3])+"-"+this.pad4(e[4])+"-"+this.pad4(e[5])+this.pad4(e[6])+this.pad4(e[7])}return this.random4()+this.random4()+"-"+this.random4()+"-"+this.random4()+"-"+this.random4()+"-"+this.random4()+this.random4()+this.random4()},e.pad4=function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t},e.random4=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},e}();t.UUID=r},function(e,t,n){e.exports=n(5)},function(e,t,n){"use strict";n.r(t),n.d(t,"RxStompConfig",(function(){return o})),n.d(t,"RxStomp",(function(){return p})),n.d(t,"RxStompState",(function(){return r})),n.d(t,"RxStompRPCConfig",(function(){return f})),n.d(t,"RxStompRPC",(function(){return l}));var r,o=function(){},i=n(0),s=n(1),u=n(2);!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(r||(r={}));var c=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}c((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},p=function(){function e(){var e=this;this._queuedMessages=[],this._stompClient=new u.Client;var t=function(){};this._beforeConnect=t,this._debug=t,this._connectionStatePre$=new i.BehaviorSubject(r.CLOSED),this._connectedPre$=this._connectionStatePre$.pipe(Object(s.filter)((function(e){return e===r.OPEN}))),this.connectionState$=new i.BehaviorSubject(r.CLOSED),this.connected$=this.connectionState$.pipe(Object(s.filter)((function(e){return e===r.OPEN}))),this.connected$.subscribe((function(){e._sendQueuedMessages()})),this._serverHeadersBehaviourSubject$=new i.BehaviorSubject(null),this.serverHeaders$=this._serverHeadersBehaviourSubject$.pipe(Object(s.filter)((function(e){return null!==e}))),this.stompErrors$=new i.Subject,this.unhandledMessage$=new i.Subject,this.unhandledReceipts$=new i.Subject,this.unhandledFrame$=new i.Subject,this.webSocketErrors$=new i.Subject}return Object.defineProperty(e.prototype,"stompClient",{get:function(){return this._stompClient},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){var t=Object.assign({},e);t.beforeConnect&&(this._beforeConnect=t.beforeConnect,delete t.beforeConnect),this._stompClient.configure(t),t.debug&&(this._debug=t.debug)},e.prototype.activate=function(){var e=this;this._stompClient.configure({beforeConnect:function(){return c(e,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this._changeState(r.CONNECTING),[4,this._beforeConnect(this)];case 1:return e.sent(),[2]}}))}))},onConnect:function(t){e._serverHeadersBehaviourSubject$.next(t.headers),e._changeState(r.OPEN)},onStompError:function(t){e.stompErrors$.next(t)},onWebSocketClose:function(){e._changeState(r.CLOSED)},onUnhandledMessage:function(t){e.unhandledMessage$.next(t)},onUnhandledReceipt:function(t){e.unhandledReceipts$.next(t)},onUnhandledFrame:function(t){e.unhandledFrame$.next(t)},onWebSocketError:function(t){e.webSocketErrors$.next(t)}}),this._stompClient.activate()},e.prototype.deactivate=function(){return c(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this._changeState(r.CLOSING),[4,this._stompClient.deactivate()];case 1:return e.sent(),this._changeState(r.CLOSED),[2]}}))}))},e.prototype.connected=function(){return this.connectionState$.getValue()===r.OPEN},Object.defineProperty(e.prototype,"active",{get:function(){return this.stompClient.active},enumerable:!0,configurable:!0}),e.prototype.publish=function(e){var t=null==e.retryIfDisconnected||e.retryIfDisconnected;if(this.connected())this._stompClient.publish(e);else{if(!t)throw new Error("Cannot publish while broker is not connected");this._debug("Not connected, queueing"),this._queuedMessages.push(e)}},e.prototype._sendQueuedMessages=function(){var e=this._queuedMessages;if(this._queuedMessages=[],0!==e.length){this._debug("Will try sending  "+e.length+" queued message(s)");for(var t=0,n=e;t<n.length;t++){var r=n[t];this._debug("Attempting to send "+r),this.publish(r)}}},e.prototype.watch=function(e,t){var n=this;void 0===t&&(t={});var r,o={subHeaders:{},unsubHeaders:{},subscribeOnlyOnce:!1};return r="string"==typeof e?Object.assign({},o,{destination:e,subHeaders:t}):Object.assign({},o,e),this._debug("Request to subscribe "+r.destination),i.Observable.create((function(e){var t,o,i=n._connectedPre$;return r.subscribeOnlyOnce&&(i=i.pipe(Object(s.take)(1))),o=i.subscribe((function(){n._debug("Will subscribe to "+r.destination),t=n._stompClient.subscribe(r.destination,(function(t){e.next(t)}),r.subHeaders)})),function(){if(n._debug("Stop watching connection state (for "+r.destination+")"),o.unsubscribe(),n.connected()){n._debug("Will unsubscribe from "+r.destination+" at Stomp");var e=r.unsubHeaders;"function"==typeof e&&(e=e()),t.unsubscribe(e)}else n._debug("Stomp not connected, no need to unsubscribe from "+r.destination+" at Stomp")}})).pipe(Object(s.share)())},e.prototype.watchForReceipt=function(e,t){this._stompClient.watchForReceipt(e,t)},e.prototype._changeState=function(e){this._connectionStatePre$.next(e),this.connectionState$.next(e)},e}(),f=function(){},d=n(3),l=function(){function e(e,t){var n=this;this.rxStomp=e,this.stompRPCConfig=t,this._replyQueueName="/temp-queue/rpc-replies",this._setupReplyQueue=function(){return n.rxStomp.unhandledMessage$},t&&(t.replyQueueName&&(this._replyQueueName=t.replyQueueName),t.setupReplyQueue&&(this._setupReplyQueue=t.setupReplyQueue))}return e.prototype.rpc=function(e){return this.stream(e).pipe(Object(s.first)())},e.prototype.stream=function(e){var t=this,n=Object.assign({},e.headers||{}),r=e.destination,o=e.body,u=e.binaryBody;return this._repliesObservable||(this._repliesObservable=this._setupReplyQueue(this._replyQueueName,this.rxStomp)),i.Observable.create((function(e){var i,c=n["correlation-id"]||d.UUID.UUID();return i=t._repliesObservable.pipe(Object(s.filter)((function(e){return e.headers["correlation-id"]===c}))).subscribe((function(t){e.next(t)})),n["reply-to"]=t._replyQueueName,n["correlation-id"]=c,t.rxStomp.publish({destination:r,body:o,binaryBody:u,headers:n}),function(){i.unsubscribe()}}))},e}()}])}));
  //# sourceMappingURL=rx-stomp.umd.min.js.map