Comparing version 2.3.0 to 2.3.1
/*! | ||
* vue-sse v2.3.0 | ||
* vue-sse v2.3.1 | ||
* (c) 2021 James Churchard | ||
@@ -1106,5 +1106,5 @@ * @license MIT | ||
if (this.forcePolyfill) { | ||
this._source = eventsource.EventSourcePolyfill( | ||
this._source = new eventsource.EventSourcePolyfill( | ||
this.url, | ||
Object.assign({}, this.config.polyfillOptions, { | ||
Object.assign({}, this.polyfillOptions, { | ||
withCredentials: this.withCredentials, | ||
@@ -1111,0 +1111,0 @@ }) |
/*! | ||
* vue-sse v2.3.0 | ||
* vue-sse v2.3.1 | ||
* (c) 2021 James Churchard | ||
@@ -1101,5 +1101,5 @@ * @license MIT | ||
if (this.forcePolyfill) { | ||
this._source = eventsource.EventSourcePolyfill( | ||
this._source = new eventsource.EventSourcePolyfill( | ||
this.url, | ||
Object.assign({}, this.config.polyfillOptions, { | ||
Object.assign({}, this.polyfillOptions, { | ||
withCredentials: this.withCredentials, | ||
@@ -1106,0 +1106,0 @@ }), |
/*! | ||
* vue-sse v2.3.0 | ||
* vue-sse v2.3.1 | ||
* (c) 2021 James Churchard | ||
@@ -12,2 +12,2 @@ * @license MIT | ||
*/ | ||
var t,n=(function(t,n){!function(e){var r=e.setTimeout,o=e.clearTimeout,s=e.XMLHttpRequest,i=e.XDomainRequest,a=e.ActiveXObject,l=e.EventSource,c=e.document,u=e.Promise,h=e.fetch,d=e.Response,f=e.TextDecoder,p=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var v=h;h=function(e,t){var n=t.signal;return v(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var l=e[a];0!==s&&(l<128||l>191||!t(i<<6|63&l,s-6,n(s,i)))&&(s=0,i=r,o+=String.fromCharCode(i)),0===s?(l>=0&&l<=127?(s=0,i=l):l>=192&&l<=223?(s=6,i=31&l):l>=224&&l<=239?(s=12,i=15&l):l>=240&&l<=247?(s=18,i=7&l):(s=0,i=r),0===s||t(i,s,n(s,i))||(s=0,i=r)):(s-=6,i=i<<6|63&l),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o},null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=g);var _=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=_,this.onload=_,this.onerror=_,this.onreadystatechange=_,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=_}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function m(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),s=o.shift(),i=o.join(": ");t[b(s)]=i}this._map=t}function C(){}function E(e){this._headers=e}function T(){}function S(){this._listeners=Object.create(null)}function x(e){r((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function A(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function R(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function D(e,t){O.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,i=this._xhr,a=1,l=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=_,i.onerror=_,i.onabort=_,i.onprogress=_,i.onreadystatechange=_,i.abort(),0!==l&&(o(l),l=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in i)e=200,t="OK",r=i.contentType;else try{e=i.status,t=i.statusText,r=i.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},u=function(){if(c(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:_}),u(),1===a||2===a||3===a){if(a=4,0!==l&&(o(l),l=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){l=r((function(){d()}),500),3===i.readyState&&u()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=u),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||u():2===i.readyState&&c())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(l=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r((function(){t._sendTimeout=0,t.send()}),4)}},m.prototype.get=function(e){return this._map[b(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),C.prototype.open=function(e,t,n,r,o,i,a){e.open("GET",o);var l=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(l);l+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(n,r,o,new m(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},E.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,n,r,o,s,i){var a=null,l=new y,c=l.signal,d=new f;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new E(e.headers)),new u((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(e)})),{abort:function(){null!=a&&a.cancel(),l.abort()}}},S.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){x(e)}}},S.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,s=0;s<r.length;s+=1)r[s]===t&&(o=!0);o||r.push(t)},S.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],s=0;s<r.length;s+=1)r[s]!==t&&o.push(r[s]);0===o.length?delete n[e]:n[e]=o}},A.prototype=Object.create(O.prototype),R.prototype=Object.create(O.prototype),D.prototype=Object.create(O.prototype);var j=-1,$=-1,N=/^text\/event\-stream(;.*)?$/i,P=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),H(n)},H=function(e){return Math.min(Math.max(e,1e3),18e6)},I=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){x(e)}};function L(e,t){S.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),l=n.lastEventIdQueryParameterName||"lastEventId",c=H(1e3),u=P(n.heartbeatTimeout,45e3),h="",d=c,f=!1,p=0,y=n.headers||{},v=n.Transport,g=M&&null==v?void 0:new w(null!=v?new v:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),_=null!=v&&"string"!=typeof v?new v:null==g?new T:new C,b=void 0,m=0,E=j,S="",x="",O="",L="",q=0,X=0,G=0,V=function(t,n,r,o){if(0===E)if(200===t&&null!=r&&N.test(r)){E=1,f=Date.now(),d=c,e.readyState=1;var s=new R("open",{status:t,statusText:n,headers:o});e.dispatchEvent(s),I(e,e.onopen,s)}else{var i="";200!==t?(n&&(n=n.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",U(),s=new R("error",{status:t,statusText:n,headers:o}),e.dispatchEvent(s),I(e,e.onerror,s),console.error(i)}},z=function(t){if(1===E){for(var n=-1,s=0;s<t.length;s+=1)(l=t.charCodeAt(s))!=="\n".charCodeAt(0)&&l!=="\r".charCodeAt(0)||(n=s);var i=(-1!==n?L:"")+t.slice(0,n+1);L=(-1===n?L:"")+t.slice(n+1),""!==t&&(f=Date.now(),p+=t.length);for(var a=0;a<i.length;a+=1){var l=i.charCodeAt(a);if(q===$&&l==="\n".charCodeAt(0))q=0;else if(q===$&&(q=0),l==="\r".charCodeAt(0)||l==="\n".charCodeAt(0)){if(0!==q){1===q&&(G=a+1);var y=i.slice(X,G-1),v=i.slice(G+(G<a&&i.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(S+="\n",S+=v):"id"===y?x=v:"event"===y?O=v:"retry"===y?(c=P(v,c),d=c):"heartbeatTimeout"===y&&(u=P(v,u),0!==m&&(o(m),m=r((function(){k()}),u)))}if(0===q){if(""!==S){h=x,""===O&&(O="message");var g=new A(O,{data:S.slice(1),lastEventId:x});if(e.dispatchEvent(g),"open"===O?I(e,e.onopen,g):"message"===O?I(e,e.onmessage,g):"error"===O&&I(e,e.onerror,g),2===E)return}S="",O=""}q=l==="\r".charCodeAt(0)?$:0}else 0===q&&(X=a,q=1),1===q?l===":".charCodeAt(0)&&(G=a+1,q=2):2===q&&(q=3)}}},B=function(t){if(1===E||0===E){E=j,0!==m&&(o(m),m=0),m=r((function(){k()}),d),d=H(Math.min(16*c,2*d)),e.readyState=0;var n=new D("error",{error:t});e.dispatchEvent(n),I(e,e.onerror,n),null!=t&&console.error(t)}},U=function(){E=2,null!=b&&(b.abort(),b=void 0),0!==m&&(o(m),m=0),e.readyState=2},k=function(){if(m=0,E===j){f=!1,p=0,m=r((function(){k()}),u),E=0,S="",O="",x=h,L="",X=0,G=0,q=0;var n=t;"data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h&&(n+=(-1===t.indexOf("?")?"?":"&")+l+"="+encodeURIComponent(h));var o=e.withCredentials,s={Accept:"text/event-stream"},i=e.headers;if(null!=i)for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=i[a]);try{b=_.open(g,V,z,B,n,o,s)}catch(e){throw U(),e}}else if(f||null==b){var c=Math.max((f||Date.now())+u-Date.now(),1);f=!1,m=r((function(){k()}),c)}else B(new Error("No activity within "+u+" milliseconds. "+(0===E?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=U,k()}(this,e,t)}var M=null!=h&&null!=d&&"body"in d.prototype;L.prototype=Object.create(S.prototype),L.prototype.CONNECTING=0,L.prototype.OPEN=1,L.prototype.CLOSED=2,L.prototype.close=function(){this._close()},L.CONNECTING=0,L.OPEN=1,L.CLOSED=2,L.prototype.withCredentials=void 0;var q,X=l;null==s||null!=l&&"withCredentials"in l.prototype||(X=L),void 0!==(q=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=l,e.EventSource=X}(n))&&(t.exports=q)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:e:globalThis)}(t={exports:{}},t.exports),t.exports),r=Object.freeze(Object.assign(Object.create(null),n,{default:n}));const o=e=>e.data,s=e=>JSON.parse(e.data);class i{constructor(e){if(this._handlers={},this._listeners={},this._source=null,e.format?"string"==typeof e.format?"plain"===e.format?this._format=o:"json"===e.format?this._format=s:this._format=o:"function"==typeof e.format?this._format=e.format:this._format=o:this._format=o,e.handlers)for(const t in e.handlers)this.on(t,e.handlers[t]);this.url=e.url,this.withCredentials=!!e.withCredentials,this.polyfillOptions=e.polyfillOptions||{},this.forcePolyfill=!!e.forcePolyfill}get source(){return this._source}connect(){return this.forcePolyfill?this._source=n.EventSourcePolyfill(this.url,Object.assign({},this.config.polyfillOptions,{withCredentials:this.withCredentials})):this._source=new window.EventSource(this.url,{withCredentials:this.withCredentials}),new Promise(((e,t)=>{this._source.onopen=()=>{for(let e in this._listeners)this._source.addEventListener(e,this._listeners[e]);this._source.onerror=null,e(this)},this._source.onerror=t}))}disconnect(){null!==this._source&&(this._source.close(),this._source=null)}on(e,t){return e||(e="message"),this._listeners[e]||this._create(e),this._handlers[e].push(t),this}once(e,t){return this.on(e,(n=>{this.off(e,t),t(n)})),this}off(e,t){if(!this._handlers[e])return this;const n=this._handlers[e].indexOf(t);return-1===n||(this._handlers[e].splice(n,1),0===this._handlers[e].length&&(this._source.removeEventListener(e,this._listeners[e]),delete this._handlers[e],delete this._listeners[e])),this}_create(e){this._handlers[e]=[],this._listeners[e]=t=>{let n;try{n=this._format(t)}catch(e){return void("function"==typeof this._source.onerror&&this._source.onerror(e))}this._handlers[e].forEach((e=>e(n)))},this._source&&this._source.addEventListener(e,this._listeners[e])}}function a(e,t){e.$sse=e.prototype.$sse=new l(t),t&&t.polyfill&&Promise.resolve().then((function(){return r})),e.mixin({beforeCreate(){this.$options.sse&&this.$options.sse.cleanup&&(this.$sse=new l,this.$sse.$clients=[])},beforeDestroy(){null!==this.$sse.$clients&&(this.$sse.$clients.forEach((e=>e.disconnect())),this.$sse.$clients=[])}})}class l{constructor(e){this.$defaultConfig=Object.assign({format:o,sendCredentials:!1},e),this.$clients=null}create(e){let t;t="object"==typeof e?e:"string"==typeof e?{url:e}:{};const n=new i(Object.assign({},this.$defaultConfig,t));return null!==this.$clients&&this.$clients.push(n),n}}var c={install:a};export default c;export{l as SSEManager,a as install}; | ||
var t,n=(function(t,n){!function(e){var r=e.setTimeout,o=e.clearTimeout,s=e.XMLHttpRequest,i=e.XDomainRequest,a=e.ActiveXObject,l=e.EventSource,c=e.document,u=e.Promise,h=e.fetch,d=e.Response,f=e.TextDecoder,p=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var v=h;h=function(e,t){var n=t.signal;return v(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var l=e[a];0!==s&&(l<128||l>191||!t(i<<6|63&l,s-6,n(s,i)))&&(s=0,i=r,o+=String.fromCharCode(i)),0===s?(l>=0&&l<=127?(s=0,i=l):l>=192&&l<=223?(s=6,i=31&l):l>=224&&l<=239?(s=12,i=15&l):l>=240&&l<=247?(s=18,i=7&l):(s=0,i=r),0===s||t(i,s,n(s,i))||(s=0,i=r)):(s-=6,i=i<<6|63&l),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o},null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=g);var _=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=_,this.onload=_,this.onerror=_,this.onreadystatechange=_,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=_}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function m(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),s=o.shift(),i=o.join(": ");t[b(s)]=i}this._map=t}function C(){}function E(e){this._headers=e}function T(){}function S(){this._listeners=Object.create(null)}function x(e){r((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function A(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function R(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function D(e,t){O.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,i=this._xhr,a=1,l=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=_,i.onerror=_,i.onabort=_,i.onprogress=_,i.onreadystatechange=_,i.abort(),0!==l&&(o(l),l=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in i)e=200,t="OK",r=i.contentType;else try{e=i.status,t=i.statusText,r=i.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},u=function(){if(c(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:_}),u(),1===a||2===a||3===a){if(a=4,0!==l&&(o(l),l=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){l=r((function(){d()}),500),3===i.readyState&&u()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=u),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||u():2===i.readyState&&c())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(l=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r((function(){t._sendTimeout=0,t.send()}),4)}},m.prototype.get=function(e){return this._map[b(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),C.prototype.open=function(e,t,n,r,o,i,a){e.open("GET",o);var l=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(l);l+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(n,r,o,new m(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},E.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,n,r,o,s,i){var a=null,l=new y,c=l.signal,d=new f;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new E(e.headers)),new u((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(e)})),{abort:function(){null!=a&&a.cancel(),l.abort()}}},S.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){x(e)}}},S.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,s=0;s<r.length;s+=1)r[s]===t&&(o=!0);o||r.push(t)},S.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],s=0;s<r.length;s+=1)r[s]!==t&&o.push(r[s]);0===o.length?delete n[e]:n[e]=o}},A.prototype=Object.create(O.prototype),R.prototype=Object.create(O.prototype),D.prototype=Object.create(O.prototype);var j=-1,$=-1,N=/^text\/event\-stream(;.*)?$/i,P=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),H(n)},H=function(e){return Math.min(Math.max(e,1e3),18e6)},I=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){x(e)}};function L(e,t){S.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),l=n.lastEventIdQueryParameterName||"lastEventId",c=H(1e3),u=P(n.heartbeatTimeout,45e3),h="",d=c,f=!1,p=0,y=n.headers||{},v=n.Transport,g=M&&null==v?void 0:new w(null!=v?new v:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),_=null!=v&&"string"!=typeof v?new v:null==g?new T:new C,b=void 0,m=0,E=j,S="",x="",O="",L="",q=0,X=0,G=0,V=function(t,n,r,o){if(0===E)if(200===t&&null!=r&&N.test(r)){E=1,f=Date.now(),d=c,e.readyState=1;var s=new R("open",{status:t,statusText:n,headers:o});e.dispatchEvent(s),I(e,e.onopen,s)}else{var i="";200!==t?(n&&(n=n.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",U(),s=new R("error",{status:t,statusText:n,headers:o}),e.dispatchEvent(s),I(e,e.onerror,s),console.error(i)}},z=function(t){if(1===E){for(var n=-1,s=0;s<t.length;s+=1)(l=t.charCodeAt(s))!=="\n".charCodeAt(0)&&l!=="\r".charCodeAt(0)||(n=s);var i=(-1!==n?L:"")+t.slice(0,n+1);L=(-1===n?L:"")+t.slice(n+1),""!==t&&(f=Date.now(),p+=t.length);for(var a=0;a<i.length;a+=1){var l=i.charCodeAt(a);if(q===$&&l==="\n".charCodeAt(0))q=0;else if(q===$&&(q=0),l==="\r".charCodeAt(0)||l==="\n".charCodeAt(0)){if(0!==q){1===q&&(G=a+1);var y=i.slice(X,G-1),v=i.slice(G+(G<a&&i.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(S+="\n",S+=v):"id"===y?x=v:"event"===y?O=v:"retry"===y?(c=P(v,c),d=c):"heartbeatTimeout"===y&&(u=P(v,u),0!==m&&(o(m),m=r((function(){k()}),u)))}if(0===q){if(""!==S){h=x,""===O&&(O="message");var g=new A(O,{data:S.slice(1),lastEventId:x});if(e.dispatchEvent(g),"open"===O?I(e,e.onopen,g):"message"===O?I(e,e.onmessage,g):"error"===O&&I(e,e.onerror,g),2===E)return}S="",O=""}q=l==="\r".charCodeAt(0)?$:0}else 0===q&&(X=a,q=1),1===q?l===":".charCodeAt(0)&&(G=a+1,q=2):2===q&&(q=3)}}},B=function(t){if(1===E||0===E){E=j,0!==m&&(o(m),m=0),m=r((function(){k()}),d),d=H(Math.min(16*c,2*d)),e.readyState=0;var n=new D("error",{error:t});e.dispatchEvent(n),I(e,e.onerror,n),null!=t&&console.error(t)}},U=function(){E=2,null!=b&&(b.abort(),b=void 0),0!==m&&(o(m),m=0),e.readyState=2},k=function(){if(m=0,E===j){f=!1,p=0,m=r((function(){k()}),u),E=0,S="",O="",x=h,L="",X=0,G=0,q=0;var n=t;"data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h&&(n+=(-1===t.indexOf("?")?"?":"&")+l+"="+encodeURIComponent(h));var o=e.withCredentials,s={Accept:"text/event-stream"},i=e.headers;if(null!=i)for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=i[a]);try{b=_.open(g,V,z,B,n,o,s)}catch(e){throw U(),e}}else if(f||null==b){var c=Math.max((f||Date.now())+u-Date.now(),1);f=!1,m=r((function(){k()}),c)}else B(new Error("No activity within "+u+" milliseconds. "+(0===E?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=U,k()}(this,e,t)}var M=null!=h&&null!=d&&"body"in d.prototype;L.prototype=Object.create(S.prototype),L.prototype.CONNECTING=0,L.prototype.OPEN=1,L.prototype.CLOSED=2,L.prototype.close=function(){this._close()},L.CONNECTING=0,L.OPEN=1,L.CLOSED=2,L.prototype.withCredentials=void 0;var q,X=l;null==s||null!=l&&"withCredentials"in l.prototype||(X=L),void 0!==(q=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=l,e.EventSource=X}(n))&&(t.exports=q)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:e:globalThis)}(t={exports:{}},t.exports),t.exports),r=Object.freeze(Object.assign(Object.create(null),n,{default:n}));const o=e=>e.data,s=e=>JSON.parse(e.data);class i{constructor(e){if(this._handlers={},this._listeners={},this._source=null,e.format?"string"==typeof e.format?"plain"===e.format?this._format=o:"json"===e.format?this._format=s:this._format=o:"function"==typeof e.format?this._format=e.format:this._format=o:this._format=o,e.handlers)for(const t in e.handlers)this.on(t,e.handlers[t]);this.url=e.url,this.withCredentials=!!e.withCredentials,this.polyfillOptions=e.polyfillOptions||{},this.forcePolyfill=!!e.forcePolyfill}get source(){return this._source}connect(){return this.forcePolyfill?this._source=new n.EventSourcePolyfill(this.url,Object.assign({},this.polyfillOptions,{withCredentials:this.withCredentials})):this._source=new window.EventSource(this.url,{withCredentials:this.withCredentials}),new Promise(((e,t)=>{this._source.onopen=()=>{for(let e in this._listeners)this._source.addEventListener(e,this._listeners[e]);this._source.onerror=null,e(this)},this._source.onerror=t}))}disconnect(){null!==this._source&&(this._source.close(),this._source=null)}on(e,t){return e||(e="message"),this._listeners[e]||this._create(e),this._handlers[e].push(t),this}once(e,t){return this.on(e,(n=>{this.off(e,t),t(n)})),this}off(e,t){if(!this._handlers[e])return this;const n=this._handlers[e].indexOf(t);return-1===n||(this._handlers[e].splice(n,1),0===this._handlers[e].length&&(this._source.removeEventListener(e,this._listeners[e]),delete this._handlers[e],delete this._listeners[e])),this}_create(e){this._handlers[e]=[],this._listeners[e]=t=>{let n;try{n=this._format(t)}catch(e){return void("function"==typeof this._source.onerror&&this._source.onerror(e))}this._handlers[e].forEach((e=>e(n)))},this._source&&this._source.addEventListener(e,this._listeners[e])}}function a(e,t){e.$sse=e.prototype.$sse=new l(t),t&&t.polyfill&&Promise.resolve().then((function(){return r})),e.mixin({beforeCreate(){this.$options.sse&&this.$options.sse.cleanup&&(this.$sse=new l,this.$sse.$clients=[])},beforeDestroy(){null!==this.$sse.$clients&&(this.$sse.$clients.forEach((e=>e.disconnect())),this.$sse.$clients=[])}})}class l{constructor(e){this.$defaultConfig=Object.assign({format:o,sendCredentials:!1},e),this.$clients=null}create(e){let t;t="object"==typeof e?e:"string"==typeof e?{url:e}:{};const n=new i(Object.assign({},this.$defaultConfig,t));return null!==this.$clients&&this.$clients.push(n),n}}var c={install:a};export default c;export{l as SSEManager,a as install}; |
/*! | ||
* vue-sse v2.3.0 | ||
* vue-sse v2.3.1 | ||
* (c) 2021 James Churchard | ||
@@ -1104,5 +1104,5 @@ * @license MIT | ||
if (this.forcePolyfill) { | ||
this._source = eventsource.EventSourcePolyfill( | ||
this._source = new eventsource.EventSourcePolyfill( | ||
this.url, | ||
Object.assign({}, this.config.polyfillOptions, { | ||
Object.assign({}, this.polyfillOptions, { | ||
withCredentials: this.withCredentials, | ||
@@ -1109,0 +1109,0 @@ }) |
/*! | ||
* vue-sse v2.3.0 | ||
* vue-sse v2.3.1 | ||
* (c) 2021 James Churchard | ||
@@ -1110,5 +1110,5 @@ * @license MIT | ||
if (this.forcePolyfill) { | ||
this._source = eventsource.EventSourcePolyfill( | ||
this._source = new eventsource.EventSourcePolyfill( | ||
this.url, | ||
Object.assign({}, this.config.polyfillOptions, { | ||
Object.assign({}, this.polyfillOptions, { | ||
withCredentials: this.withCredentials, | ||
@@ -1115,0 +1115,0 @@ }) |
/*! | ||
* vue-sse v2.3.0 | ||
* vue-sse v2.3.1 | ||
* (c) 2021 James Churchard | ||
@@ -12,2 +12,2 @@ * @license MIT | ||
*/ | ||
var t=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(t,n){!function(e){var r=e.setTimeout,o=e.clearTimeout,i=e.XMLHttpRequest,s=e.XDomainRequest,a=e.ActiveXObject,l=e.EventSource,c=e.document,u=e.Promise,h=e.fetch,d=e.Response,f=e.TextDecoder,p=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var v=h;h=function(e,t){var n=t.signal;return v(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,o="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var l=e[a];0!==i&&(l<128||l>191||!t(s<<6|63&l,i-6,n(i,s)))&&(i=0,s=r,o+=String.fromCharCode(s)),0===i?(l>=0&&l<=127?(i=0,s=l):l>=192&&l<=223?(i=6,s=31&l):l>=224&&l<=239?(i=12,s=15&l):l>=240&&l<=247?(i=18,s=7&l):(i=0,s=r),0===i||t(s,i,n(i,s))||(i=0,s=r)):(i-=6,s=s<<6|63&l),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=g);var _=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=_,this.onload=_,this.onerror=_,this.onreadystatechange=_,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=_}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function m(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),s=o.join(": ");t[b(i)]=s}this._map=t}function E(){}function C(e){this._headers=e}function T(){}function S(){this._listeners=Object.create(null)}function x(e){r((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function A(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function R(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function j(e,t){O.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,s=this._xhr,a=1,l=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=_,s.onerror=_,s.onabort=_,s.onprogress=_,s.onreadystatechange=_,s.abort(),0!==l&&(o(l),l=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in s)e=200,t="OK",r=s.contentType;else try{e=s.status,t=s.statusText,r=s.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},u=function(){if(c(),2===a||3===a){a=3;var e="";try{e=s.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:_}),u(),1===a||2===a||3===a){if(a=4,0!==l&&(o(l),l=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){l=r((function(){d()}),500),3===s.readyState&&u()};"onload"in s&&(s.onload=function(e){h("load",e)}),"onerror"in s&&(s.onerror=function(e){h("error",e)}),"onabort"in s&&(s.onabort=function(e){h("abort",e)}),"onprogress"in s&&(s.onprogress=u),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||h(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||u():2===s.readyState&&c())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(l=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r((function(){t._sendTimeout=0,t.send()}),4)}},m.prototype.get=function(e){return this._map[b(e)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,n,r,o,s,a){e.open("GET",o);var l=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(l);l+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===i.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(n,r,o,new m(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},C.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,n,r,o,i,s){var a=null,l=new y,c=l.signal,d=new f;return h(o,{headers:s,credentials:i?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new C(e.headers)),new u((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(e)})),{abort:function(){null!=a&&a.cancel(),l.abort()}}},S.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){x(e)}}},S.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,i=0;i<r.length;i+=1)r[i]===t&&(o=!0);o||r.push(t)},S.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],i=0;i<r.length;i+=1)r[i]!==t&&o.push(r[i]);0===o.length?delete n[e]:n[e]=o}},A.prototype=Object.create(O.prototype),R.prototype=Object.create(O.prototype),j.prototype=Object.create(O.prototype);var D=-1,$=-1,P=/^text\/event\-stream(;.*)?$/i,N=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),H(n)},H=function(e){return Math.min(Math.max(e,1e3),18e6)},I=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){x(e)}};function L(e,t){S.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),l=n.lastEventIdQueryParameterName||"lastEventId",c=H(1e3),u=N(n.heartbeatTimeout,45e3),h="",d=c,f=!1,p=0,y=n.headers||{},v=n.Transport,g=M&&null==v?void 0:new w(null!=v?new v:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),_=null!=v&&"string"!=typeof v?new v:null==g?new T:new E,b=void 0,m=0,C=D,S="",x="",O="",L="",q=0,V=0,X=0,G=function(t,n,r,o){if(0===C)if(200===t&&null!=r&&P.test(r)){C=1,f=Date.now(),d=c,e.readyState=1;var i=new R("open",{status:t,statusText:n,headers:o});e.dispatchEvent(i),I(e,e.onopen,i)}else{var s="";200!==t?(n&&(n=n.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",U();i=new R("error",{status:t,statusText:n,headers:o});e.dispatchEvent(i),I(e,e.onerror,i),console.error(s)}},z=function(t){if(1===C){for(var n=-1,i=0;i<t.length;i+=1){(l=t.charCodeAt(i))!=="\n".charCodeAt(0)&&l!=="\r".charCodeAt(0)||(n=i)}var s=(-1!==n?L:"")+t.slice(0,n+1);L=(-1===n?L:"")+t.slice(n+1),""!==t&&(f=Date.now(),p+=t.length);for(var a=0;a<s.length;a+=1){var l=s.charCodeAt(a);if(q===$&&l==="\n".charCodeAt(0))q=0;else if(q===$&&(q=0),l==="\r".charCodeAt(0)||l==="\n".charCodeAt(0)){if(0!==q){1===q&&(X=a+1);var y=s.slice(V,X-1),v=s.slice(X+(X<a&&s.charCodeAt(X)===" ".charCodeAt(0)?1:0),a);"data"===y?(S+="\n",S+=v):"id"===y?x=v:"event"===y?O=v:"retry"===y?(c=N(v,c),d=c):"heartbeatTimeout"===y&&(u=N(v,u),0!==m&&(o(m),m=r((function(){k()}),u)))}if(0===q){if(""!==S){h=x,""===O&&(O="message");var g=new A(O,{data:S.slice(1),lastEventId:x});if(e.dispatchEvent(g),"open"===O?I(e,e.onopen,g):"message"===O?I(e,e.onmessage,g):"error"===O&&I(e,e.onerror,g),2===C)return}S="",O=""}q=l==="\r".charCodeAt(0)?$:0}else 0===q&&(V=a,q=1),1===q?l===":".charCodeAt(0)&&(X=a+1,q=2):2===q&&(q=3)}}},B=function(t){if(1===C||0===C){C=D,0!==m&&(o(m),m=0),m=r((function(){k()}),d),d=H(Math.min(16*c,2*d)),e.readyState=0;var n=new j("error",{error:t});e.dispatchEvent(n),I(e,e.onerror,n),null!=t&&console.error(t)}},U=function(){C=2,null!=b&&(b.abort(),b=void 0),0!==m&&(o(m),m=0),e.readyState=2},k=function(){if(m=0,C===D){f=!1,p=0,m=r((function(){k()}),u),C=0,S="",O="",x=h,L="",V=0,X=0,q=0;var n=t;"data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h&&(n+=(-1===t.indexOf("?")?"?":"&")+l+"="+encodeURIComponent(h));var o=e.withCredentials,i={Accept:"text/event-stream"},s=e.headers;if(null!=s)for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(i[a]=s[a]);try{b=_.open(g,G,z,B,n,o,i)}catch(e){throw U(),e}}else if(f||null==b){var c=Math.max((f||Date.now())+u-Date.now(),1);f=!1,m=r((function(){k()}),c)}else B(new Error("No activity within "+u+" milliseconds. "+(0===C?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=U,k()}(this,e,t)}var M=null!=h&&null!=d&&"body"in d.prototype;L.prototype=Object.create(S.prototype),L.prototype.CONNECTING=0,L.prototype.OPEN=1,L.prototype.CLOSED=2,L.prototype.close=function(){this._close()},L.CONNECTING=0,L.OPEN=1,L.CLOSED=2,L.prototype.withCredentials=void 0;var q,V=l;null==i||null!=l&&"withCredentials"in l.prototype||(V=L),void 0!==(q=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=l,e.EventSource=V}(n))&&(t.exports=q)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:e:globalThis)})),n=Object.freeze(Object.assign(Object.create(null),t,{default:t})),r=function(e){return e.data},o=function(e){return JSON.parse(e.data)},i=function(e){if(this._handlers={},this._listeners={},this._source=null,e.format?"string"==typeof e.format?"plain"===e.format?this._format=r:"json"===e.format?this._format=o:this._format=r:"function"==typeof e.format?this._format=e.format:this._format=r:this._format=r,e.handlers)for(var t in e.handlers)this.on(t,e.handlers[t]);this.url=e.url,this.withCredentials=!!e.withCredentials,this.polyfillOptions=e.polyfillOptions||{},this.forcePolyfill=!!e.forcePolyfill},s={source:{configurable:!0}};s.source.get=function(){return this._source},i.prototype.connect=function(){var e=this;return this.forcePolyfill?this._source=t.EventSourcePolyfill(this.url,Object.assign({},this.config.polyfillOptions,{withCredentials:this.withCredentials})):this._source=new window.EventSource(this.url,{withCredentials:this.withCredentials}),new Promise((function(t,n){e._source.onopen=function(){for(var n in e._listeners)e._source.addEventListener(n,e._listeners[n]);e._source.onerror=null,t(e)},e._source.onerror=n}))},i.prototype.disconnect=function(){null!==this._source&&(this._source.close(),this._source=null)},i.prototype.on=function(e,t){return e||(e="message"),this._listeners[e]||this._create(e),this._handlers[e].push(t),this},i.prototype.once=function(e,t){var n=this;return this.on(e,(function(r){n.off(e,t),t(r)})),this},i.prototype.off=function(e,t){if(!this._handlers[e])return this;var n=this._handlers[e].indexOf(t);return-1===n||(this._handlers[e].splice(n,1),0===this._handlers[e].length&&(this._source.removeEventListener(e,this._listeners[e]),delete this._handlers[e],delete this._listeners[e])),this},i.prototype._create=function(e){var t=this;this._handlers[e]=[],this._listeners[e]=function(n){var r;try{r=t._format(n)}catch(e){return void("function"==typeof t._source.onerror&&t._source.onerror(e))}t._handlers[e].forEach((function(e){return e(r)}))},this._source&&this._source.addEventListener(e,this._listeners[e])},Object.defineProperties(i.prototype,s);var a=function(e){this.$defaultConfig=Object.assign({format:r,sendCredentials:!1},e),this.$clients=null};return a.prototype.create=function(e){var t;t="object"==typeof e?e:"string"==typeof e?{url:e}:{};var n=new i(Object.assign({},this.$defaultConfig,t));return null!==this.$clients&&this.$clients.push(n),n},{SSEManager:a,install:function(e,t){e.$sse=e.prototype.$sse=new a(t),t&&t.polyfill&&Promise.resolve().then((function(){return n})),e.mixin({beforeCreate:function(){this.$options.sse&&this.$options.sse.cleanup&&(this.$sse=new a,this.$sse.$clients=[])},beforeDestroy:function(){null!==this.$sse.$clients&&(this.$sse.$clients.forEach((function(e){return e.disconnect()})),this.$sse.$clients=[])}})}}})); | ||
var t=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(t,n){!function(e){var r=e.setTimeout,o=e.clearTimeout,i=e.XMLHttpRequest,s=e.XDomainRequest,a=e.ActiveXObject,l=e.EventSource,c=e.document,u=e.Promise,h=e.fetch,d=e.Response,f=e.TextDecoder,p=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var v=h;h=function(e,t){var n=t.signal;return v(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,o="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var l=e[a];0!==i&&(l<128||l>191||!t(s<<6|63&l,i-6,n(i,s)))&&(i=0,s=r,o+=String.fromCharCode(s)),0===i?(l>=0&&l<=127?(i=0,s=l):l>=192&&l<=223?(i=6,s=31&l):l>=224&&l<=239?(i=12,s=15&l):l>=240&&l<=247?(i=18,s=7&l):(i=0,s=r),0===i||t(s,i,n(i,s))||(i=0,s=r)):(i-=6,s=s<<6|63&l),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=g);var _=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=_,this.onload=_,this.onerror=_,this.onreadystatechange=_,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=_}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function m(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),s=o.join(": ");t[b(i)]=s}this._map=t}function E(){}function C(e){this._headers=e}function T(){}function S(){this._listeners=Object.create(null)}function x(e){r((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function A(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function R(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function j(e,t){O.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,s=this._xhr,a=1,l=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=_,s.onerror=_,s.onabort=_,s.onprogress=_,s.onreadystatechange=_,s.abort(),0!==l&&(o(l),l=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in s)e=200,t="OK",r=s.contentType;else try{e=s.status,t=s.statusText,r=s.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},u=function(){if(c(),2===a||3===a){a=3;var e="";try{e=s.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:_}),u(),1===a||2===a||3===a){if(a=4,0!==l&&(o(l),l=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){l=r((function(){d()}),500),3===s.readyState&&u()};"onload"in s&&(s.onload=function(e){h("load",e)}),"onerror"in s&&(s.onerror=function(e){h("error",e)}),"onabort"in s&&(s.onabort=function(e){h("abort",e)}),"onprogress"in s&&(s.onprogress=u),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||h(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||u():2===s.readyState&&c())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(l=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r((function(){t._sendTimeout=0,t.send()}),4)}},m.prototype.get=function(e){return this._map[b(e)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,n,r,o,s,a){e.open("GET",o);var l=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(l);l+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===i.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(n,r,o,new m(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},C.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,n,r,o,i,s){var a=null,l=new y,c=l.signal,d=new f;return h(o,{headers:s,credentials:i?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new C(e.headers)),new u((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(e)})),{abort:function(){null!=a&&a.cancel(),l.abort()}}},S.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){x(e)}}},S.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,i=0;i<r.length;i+=1)r[i]===t&&(o=!0);o||r.push(t)},S.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],i=0;i<r.length;i+=1)r[i]!==t&&o.push(r[i]);0===o.length?delete n[e]:n[e]=o}},A.prototype=Object.create(O.prototype),R.prototype=Object.create(O.prototype),j.prototype=Object.create(O.prototype);var D=-1,$=-1,P=/^text\/event\-stream(;.*)?$/i,N=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),H(n)},H=function(e){return Math.min(Math.max(e,1e3),18e6)},I=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){x(e)}};function L(e,t){S.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),l=n.lastEventIdQueryParameterName||"lastEventId",c=H(1e3),u=N(n.heartbeatTimeout,45e3),h="",d=c,f=!1,p=0,y=n.headers||{},v=n.Transport,g=M&&null==v?void 0:new w(null!=v?new v:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),_=null!=v&&"string"!=typeof v?new v:null==g?new T:new E,b=void 0,m=0,C=D,S="",x="",O="",L="",q=0,V=0,X=0,G=function(t,n,r,o){if(0===C)if(200===t&&null!=r&&P.test(r)){C=1,f=Date.now(),d=c,e.readyState=1;var i=new R("open",{status:t,statusText:n,headers:o});e.dispatchEvent(i),I(e,e.onopen,i)}else{var s="";200!==t?(n&&(n=n.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",U();i=new R("error",{status:t,statusText:n,headers:o});e.dispatchEvent(i),I(e,e.onerror,i),console.error(s)}},z=function(t){if(1===C){for(var n=-1,i=0;i<t.length;i+=1){(l=t.charCodeAt(i))!=="\n".charCodeAt(0)&&l!=="\r".charCodeAt(0)||(n=i)}var s=(-1!==n?L:"")+t.slice(0,n+1);L=(-1===n?L:"")+t.slice(n+1),""!==t&&(f=Date.now(),p+=t.length);for(var a=0;a<s.length;a+=1){var l=s.charCodeAt(a);if(q===$&&l==="\n".charCodeAt(0))q=0;else if(q===$&&(q=0),l==="\r".charCodeAt(0)||l==="\n".charCodeAt(0)){if(0!==q){1===q&&(X=a+1);var y=s.slice(V,X-1),v=s.slice(X+(X<a&&s.charCodeAt(X)===" ".charCodeAt(0)?1:0),a);"data"===y?(S+="\n",S+=v):"id"===y?x=v:"event"===y?O=v:"retry"===y?(c=N(v,c),d=c):"heartbeatTimeout"===y&&(u=N(v,u),0!==m&&(o(m),m=r((function(){k()}),u)))}if(0===q){if(""!==S){h=x,""===O&&(O="message");var g=new A(O,{data:S.slice(1),lastEventId:x});if(e.dispatchEvent(g),"open"===O?I(e,e.onopen,g):"message"===O?I(e,e.onmessage,g):"error"===O&&I(e,e.onerror,g),2===C)return}S="",O=""}q=l==="\r".charCodeAt(0)?$:0}else 0===q&&(V=a,q=1),1===q?l===":".charCodeAt(0)&&(X=a+1,q=2):2===q&&(q=3)}}},B=function(t){if(1===C||0===C){C=D,0!==m&&(o(m),m=0),m=r((function(){k()}),d),d=H(Math.min(16*c,2*d)),e.readyState=0;var n=new j("error",{error:t});e.dispatchEvent(n),I(e,e.onerror,n),null!=t&&console.error(t)}},U=function(){C=2,null!=b&&(b.abort(),b=void 0),0!==m&&(o(m),m=0),e.readyState=2},k=function(){if(m=0,C===D){f=!1,p=0,m=r((function(){k()}),u),C=0,S="",O="",x=h,L="",V=0,X=0,q=0;var n=t;"data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h&&(n+=(-1===t.indexOf("?")?"?":"&")+l+"="+encodeURIComponent(h));var o=e.withCredentials,i={Accept:"text/event-stream"},s=e.headers;if(null!=s)for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(i[a]=s[a]);try{b=_.open(g,G,z,B,n,o,i)}catch(e){throw U(),e}}else if(f||null==b){var c=Math.max((f||Date.now())+u-Date.now(),1);f=!1,m=r((function(){k()}),c)}else B(new Error("No activity within "+u+" milliseconds. "+(0===C?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=U,k()}(this,e,t)}var M=null!=h&&null!=d&&"body"in d.prototype;L.prototype=Object.create(S.prototype),L.prototype.CONNECTING=0,L.prototype.OPEN=1,L.prototype.CLOSED=2,L.prototype.close=function(){this._close()},L.CONNECTING=0,L.OPEN=1,L.CLOSED=2,L.prototype.withCredentials=void 0;var q,V=l;null==i||null!=l&&"withCredentials"in l.prototype||(V=L),void 0!==(q=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=l,e.EventSource=V}(n))&&(t.exports=q)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:e:globalThis)})),n=Object.freeze(Object.assign(Object.create(null),t,{default:t})),r=function(e){return e.data},o=function(e){return JSON.parse(e.data)},i=function(e){if(this._handlers={},this._listeners={},this._source=null,e.format?"string"==typeof e.format?"plain"===e.format?this._format=r:"json"===e.format?this._format=o:this._format=r:"function"==typeof e.format?this._format=e.format:this._format=r:this._format=r,e.handlers)for(var t in e.handlers)this.on(t,e.handlers[t]);this.url=e.url,this.withCredentials=!!e.withCredentials,this.polyfillOptions=e.polyfillOptions||{},this.forcePolyfill=!!e.forcePolyfill},s={source:{configurable:!0}};s.source.get=function(){return this._source},i.prototype.connect=function(){var e=this;return this.forcePolyfill?this._source=new t.EventSourcePolyfill(this.url,Object.assign({},this.polyfillOptions,{withCredentials:this.withCredentials})):this._source=new window.EventSource(this.url,{withCredentials:this.withCredentials}),new Promise((function(t,n){e._source.onopen=function(){for(var n in e._listeners)e._source.addEventListener(n,e._listeners[n]);e._source.onerror=null,t(e)},e._source.onerror=n}))},i.prototype.disconnect=function(){null!==this._source&&(this._source.close(),this._source=null)},i.prototype.on=function(e,t){return e||(e="message"),this._listeners[e]||this._create(e),this._handlers[e].push(t),this},i.prototype.once=function(e,t){var n=this;return this.on(e,(function(r){n.off(e,t),t(r)})),this},i.prototype.off=function(e,t){if(!this._handlers[e])return this;var n=this._handlers[e].indexOf(t);return-1===n||(this._handlers[e].splice(n,1),0===this._handlers[e].length&&(this._source.removeEventListener(e,this._listeners[e]),delete this._handlers[e],delete this._listeners[e])),this},i.prototype._create=function(e){var t=this;this._handlers[e]=[],this._listeners[e]=function(n){var r;try{r=t._format(n)}catch(e){return void("function"==typeof t._source.onerror&&t._source.onerror(e))}t._handlers[e].forEach((function(e){return e(r)}))},this._source&&this._source.addEventListener(e,this._listeners[e])},Object.defineProperties(i.prototype,s);var a=function(e){this.$defaultConfig=Object.assign({format:r,sendCredentials:!1},e),this.$clients=null};return a.prototype.create=function(e){var t;t="object"==typeof e?e:"string"==typeof e?{url:e}:{};var n=new i(Object.assign({},this.$defaultConfig,t));return null!==this.$clients&&this.$clients.push(n),n},{SSEManager:a,install:function(e,t){e.$sse=e.prototype.$sse=new a(t),t&&t.polyfill&&Promise.resolve().then((function(){return n})),e.mixin({beforeCreate:function(){this.$options.sse&&this.$options.sse.cleanup&&(this.$sse=new a,this.$sse.$clients=[])},beforeDestroy:function(){null!==this.$sse.$clients&&(this.$sse.$clients.forEach((function(e){return e.disconnect()})),this.$sse.$clients=[])}})}}})); |
{ | ||
"name": "vue-sse", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "A Vue plugin for using Server-Sent Events (EventSource)", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-sse.common.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204880