BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
home
/
imagivibe
/
www
/
app.imagivibe.com
/
public
/
build
/
assets
📤 Upload
📝 New File
📁 New Folder
Close
Editing: pusher-Do4Cs7gJ.js
import{g as ar}from"./app-Bx6BHQ6V.js";var ye={exports:{}};/*! * Pusher JavaScript Library v8.4.0-rc2 * https://pusher.com/ * * Copyright 2020, Pusher * Released under the MIT licence. */var Ve;function cr(){return Ve||(Ve=1,function(Qe,lr){(function(T,C){Qe.exports=C()})(window,function(){return function(B){var T={};function C(g){if(T[g])return T[g].exports;var l=T[g]={i:g,l:!1,exports:{}};return B[g].call(l.exports,l,l.exports,C),l.l=!0,l.exports}return C.m=B,C.c=T,C.d=function(g,l,O){C.o(g,l)||Object.defineProperty(g,l,{enumerable:!0,get:O})},C.r=function(g){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(g,"__esModule",{value:!0})},C.t=function(g,l){if(l&1&&(g=C(g)),l&8||l&4&&typeof g=="object"&&g&&g.__esModule)return g;var O=Object.create(null);if(C.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:g}),l&2&&typeof g!="string")for(var m in g)C.d(O,m,(function($){return g[$]}).bind(null,m));return O},C.n=function(g){var l=g&&g.__esModule?function(){return g.default}:function(){return g};return C.d(l,"a",l),l},C.o=function(g,l){return Object.prototype.hasOwnProperty.call(g,l)},C.p="",C(C.s=2)}([function(B,T,C){var g=this&&this.__extends||function(){var u=function(a,c){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,x){p.__proto__=x}||function(p,x){for(var R in x)x.hasOwnProperty(R)&&(p[R]=x[R])},u(a,c)};return function(a,c){u(a,c);function p(){this.constructor=a}a.prototype=c===null?Object.create(c):(p.prototype=c.prototype,new p)}}();Object.defineProperty(T,"__esModule",{value:!0});var l=256,O=function(){function u(a){a===void 0&&(a="="),this._paddingCharacter=a}return u.prototype.encodedLength=function(a){return this._paddingCharacter?(a+2)/3*4|0:(a*8+5)/6|0},u.prototype.encode=function(a){for(var c="",p=0;p<a.length-2;p+=3){var x=a[p]<<16|a[p+1]<<8|a[p+2];c+=this._encodeByte(x>>>3*6&63),c+=this._encodeByte(x>>>2*6&63),c+=this._encodeByte(x>>>1*6&63),c+=this._encodeByte(x>>>0*6&63)}var R=a.length-p;if(R>0){var x=a[p]<<16|(R===2?a[p+1]<<8:0);c+=this._encodeByte(x>>>3*6&63),c+=this._encodeByte(x>>>2*6&63),R===2?c+=this._encodeByte(x>>>1*6&63):c+=this._paddingCharacter||"",c+=this._paddingCharacter||""}return c},u.prototype.maxDecodedLength=function(a){return this._paddingCharacter?a/4*3|0:(a*6+7)/8|0},u.prototype.decodedLength=function(a){return this.maxDecodedLength(a.length-this._getPaddingLength(a))},u.prototype.decode=function(a){if(a.length===0)return new Uint8Array(0);for(var c=this._getPaddingLength(a),p=a.length-c,x=new Uint8Array(this.maxDecodedLength(p)),R=0,E=0,U=0,D=0,N=0,H=0,F=0;E<p-4;E+=4)D=this._decodeChar(a.charCodeAt(E+0)),N=this._decodeChar(a.charCodeAt(E+1)),H=this._decodeChar(a.charCodeAt(E+2)),F=this._decodeChar(a.charCodeAt(E+3)),x[R++]=D<<2|N>>>4,x[R++]=N<<4|H>>>2,x[R++]=H<<6|F,U|=D&l,U|=N&l,U|=H&l,U|=F&l;if(E<p-1&&(D=this._decodeChar(a.charCodeAt(E)),N=this._decodeChar(a.charCodeAt(E+1)),x[R++]=D<<2|N>>>4,U|=D&l,U|=N&l),E<p-2&&(H=this._decodeChar(a.charCodeAt(E+2)),x[R++]=N<<4|H>>>2,U|=H&l),E<p-3&&(F=this._decodeChar(a.charCodeAt(E+3)),x[R++]=H<<6|F,U|=F&l),U!==0)throw new Error("Base64Coder: incorrect characters for decoding");return x},u.prototype._encodeByte=function(a){var c=a;return c+=65,c+=25-a>>>8&6,c+=51-a>>>8&-75,c+=61-a>>>8&-15,c+=62-a>>>8&3,String.fromCharCode(c)},u.prototype._decodeChar=function(a){var c=l;return c+=(42-a&a-44)>>>8&-256+a-43+62,c+=(46-a&a-48)>>>8&-256+a-47+63,c+=(47-a&a-58)>>>8&-256+a-48+52,c+=(64-a&a-91)>>>8&-256+a-65+0,c+=(96-a&a-123)>>>8&-256+a-97+26,c},u.prototype._getPaddingLength=function(a){var c=0;if(this._paddingCharacter){for(var p=a.length-1;p>=0&&a[p]===this._paddingCharacter;p--)c++;if(a.length<4||c>2)throw new Error("Base64Coder: incorrect padding")}return c},u}();T.Coder=O;var m=new O;function $(u){return m.encode(u)}T.encode=$;function k(u){return m.decode(u)}T.decode=k;var S=function(u){g(a,u);function a(){return u!==null&&u.apply(this,arguments)||this}return a.prototype._encodeByte=function(c){var p=c;return p+=65,p+=25-c>>>8&6,p+=51-c>>>8&-75,p+=61-c>>>8&-13,p+=62-c>>>8&49,String.fromCharCode(p)},a.prototype._decodeChar=function(c){var p=l;return p+=(44-c&c-46)>>>8&-256+c-45+62,p+=(94-c&c-96)>>>8&-256+c-95+63,p+=(47-c&c-58)>>>8&-256+c-48+52,p+=(64-c&c-91)>>>8&-256+c-65+0,p+=(96-c&c-123)>>>8&-256+c-97+26,p},a}(O);T.URLSafeCoder=S;var v=new S;function b(u){return v.encode(u)}T.encodeURLSafe=b;function _(u){return v.decode(u)}T.decodeURLSafe=_,T.encodedLength=function(u){return m.encodedLength(u)},T.maxDecodedLength=function(u){return m.maxDecodedLength(u)},T.decodedLength=function(u){return m.decodedLength(u)}},function(B,T,C){Object.defineProperty(T,"__esModule",{value:!0});var g="utf8: invalid string",l="utf8: invalid source encoding";function O(k){for(var S=new Uint8Array(m(k)),v=0,b=0;b<k.length;b++){var _=k.charCodeAt(b);_<128?S[v++]=_:_<2048?(S[v++]=192|_>>6,S[v++]=128|_&63):_<55296?(S[v++]=224|_>>12,S[v++]=128|_>>6&63,S[v++]=128|_&63):(b++,_=(_&1023)<<10,_|=k.charCodeAt(b)&1023,_+=65536,S[v++]=240|_>>18,S[v++]=128|_>>12&63,S[v++]=128|_>>6&63,S[v++]=128|_&63)}return S}T.encode=O;function m(k){for(var S=0,v=0;v<k.length;v++){var b=k.charCodeAt(v);if(b<128)S+=1;else if(b<2048)S+=2;else if(b<55296)S+=3;else if(b<=57343){if(v>=k.length-1)throw new Error(g);v++,S+=4}else throw new Error(g)}return S}T.encodedLength=m;function $(k){for(var S=[],v=0;v<k.length;v++){var b=k[v];if(b&128){var _=void 0;if(b<224){if(v>=k.length)throw new Error(l);var u=k[++v];if((u&192)!==128)throw new Error(l);b=(b&31)<<6|u&63,_=128}else if(b<240){if(v>=k.length-1)throw new Error(l);var u=k[++v],a=k[++v];if((u&192)!==128||(a&192)!==128)throw new Error(l);b=(b&15)<<12|(u&63)<<6|a&63,_=2048}else if(b<248){if(v>=k.length-2)throw new Error(l);var u=k[++v],a=k[++v],c=k[++v];if((u&192)!==128||(a&192)!==128||(c&192)!==128)throw new Error(l);b=(b&15)<<18|(u&63)<<12|(a&63)<<6|c&63,_=65536}else throw new Error(l);if(b<_||b>=55296&&b<=57343)throw new Error(l);if(b>=65536){if(b>1114111)throw new Error(l);b-=65536,S.push(String.fromCharCode(55296|b>>10)),b=56320|b&1023}}S.push(String.fromCharCode(b))}return S.join("")}T.decode=$},function(B,T,C){B.exports=C(3).default},function(B,T,C){C.r(T);class g{constructor(e,t){this.lastId=0,this.prefix=e,this.name=t}create(e){this.lastId++;var t=this.lastId,r=this.prefix+t,i=this.name+"["+t+"]",s=!1,o=function(){s||(e.apply(null,arguments),s=!0)};return this[t]=o,{number:t,id:r,name:i,callback:o}}remove(e){delete this[e.number]}}var l=new g("_pusher_script_","Pusher.ScriptReceivers"),O={VERSION:"8.4.0-rc2",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},m=O;class ${constructor(e){this.options=e,this.receivers=e.receivers||l,this.loading={}}load(e,t,r){var i=this;if(i.loading[e]&&i.loading[e].length>0)i.loading[e].push(r);else{i.loading[e]=[r];var s=f.createScriptRequest(i.getPath(e,t)),o=i.receivers.create(function(h){if(i.receivers.remove(o),i.loading[e]){var d=i.loading[e];delete i.loading[e];for(var y=function(L){L||s.cleanup()},w=0;w<d.length;w++)d[w](h,y)}});s.send(o)}}getRoot(e){var t,r=f.getDocument().location.protocol;return e&&e.useTLS||r==="https:"?t=this.options.cdn_https:t=this.options.cdn_http,t.replace(/\/*$/,"")+"/"+this.options.version}getPath(e,t){return this.getRoot(t)+"/"+e+this.options.suffix+".js"}}var k=new g("_pusher_dependencies","Pusher.DependenciesReceivers"),S=new $({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:k});const v={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var _={buildLogSuffix:function(n){const e="See:",t=v.urls[n];if(!t)return"";let r;return t.fullUrl?r=t.fullUrl:t.path&&(r=v.baseUrl+t.path),r?`${e} ${r}`:""}},u;(function(n){n.UserAuthentication="user-authentication",n.ChannelAuthorization="channel-authorization"})(u||(u={}));class a extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class c extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class p extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class x extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(e,t){super(t),this.status=e,Object.setPrototypeOf(this,new.target.prototype)}}var F=function(n,e,t,r,i){const s=f.createXHR();s.open("POST",t.endpoint,!0),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var o in t.headers)s.setRequestHeader(o,t.headers[o]);if(t.headersProvider!=null){let h=t.headersProvider();for(var o in h)s.setRequestHeader(o,h[o])}return s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){let h,d=!1;try{h=JSON.parse(s.responseText),d=!0}catch{i(new N(200,`JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${s.responseText}`),null)}d&&i(null,h)}else{let h="";switch(r){case u.UserAuthentication:h=_.buildLogSuffix("authenticationEndpoint");break;case u.ChannelAuthorization:h=`Clients must be authorized to join private or presence channels. ${_.buildLogSuffix("authorizationEndpoint")}`;break}i(new N(s.status,`Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${s.status} from ${t.endpoint}. ${h}`),null)}},s.send(e),s};function Ke(n){return tt(Ze(n))}var Q=String.fromCharCode,ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ye=function(n){var e=n.charCodeAt(0);return e<128?n:e<2048?Q(192|e>>>6)+Q(128|e&63):Q(224|e>>>12&15)+Q(128|e>>>6&63)+Q(128|e&63)},Ze=function(n){return n.replace(/[^\x00-\x7F]/g,Ye)},et=function(n){var e=[0,2,1][n.length%3],t=n.charCodeAt(0)<<16|(n.length>1?n.charCodeAt(1):0)<<8|(n.length>2?n.charCodeAt(2):0),r=[ee.charAt(t>>>18),ee.charAt(t>>>12&63),e>=2?"=":ee.charAt(t>>>6&63),e>=1?"=":ee.charAt(t&63)];return r.join("")},tt=window.btoa||function(n){return n.replace(/[\s\S]{1,3}/g,et)};class nt{constructor(e,t,r,i){this.clear=t,this.timer=e(()=>{this.timer&&(this.timer=i(this.timer))},r)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var _e=nt;function rt(n){window.clearTimeout(n)}function it(n){window.clearInterval(n)}class X extends _e{constructor(e,t){super(setTimeout,rt,e,function(r){return t(),null})}}class st extends _e{constructor(e,t){super(setInterval,it,e,function(r){return t(),r})}}var ot={now(){return Date.now?Date.now():new Date().valueOf()},defer(n){return new X(0,n)},method(n,...e){var t=Array.prototype.slice.call(arguments,1);return function(r){return r[n].apply(r,t.concat(arguments))}}},I=ot;function j(n,...e){for(var t=0;t<e.length;t++){var r=e[t];for(var i in r)r[i]&&r[i].constructor&&r[i].constructor===Object?n[i]=j(n[i]||{},r[i]):n[i]=r[i]}return n}function at(){for(var n=["Pusher"],e=0;e<arguments.length;e++)typeof arguments[e]=="string"?n.push(arguments[e]):n.push(te(arguments[e]));return n.join(" : ")}function we(n,e){var t=Array.prototype.indexOf;if(n===null)return-1;if(t&&n.indexOf===t)return n.indexOf(e);for(var r=0,i=n.length;r<i;r++)if(n[r]===e)return r;return-1}function z(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(n[t],t,n)}function Se(n){var e=[];return z(n,function(t,r){e.push(r)}),e}function ct(n){var e=[];return z(n,function(t){e.push(t)}),e}function K(n,e,t){for(var r=0;r<n.length;r++)e.call(t||window,n[r],r,n)}function Ce(n,e){for(var t=[],r=0;r<n.length;r++)t.push(e(n[r],r,n,t));return t}function ht(n,e){var t={};return z(n,function(r,i){t[i]=e(r)}),t}function Te(n,e){e=e||function(i){return!!i};for(var t=[],r=0;r<n.length;r++)e(n[r],r,n,t)&&t.push(n[r]);return t}function ke(n,e){var t={};return z(n,function(r,i){(e&&e(r,i,n,t)||r)&&(t[i]=r)}),t}function ut(n){var e=[];return z(n,function(t,r){e.push([r,t])}),e}function xe(n,e){for(var t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1}function lt(n,e){for(var t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0}function dt(n){return ht(n,function(e){return typeof e=="object"&&(e=te(e)),encodeURIComponent(Ke(e.toString()))})}function ft(n){var e=ke(n,function(r){return r!==void 0}),t=Ce(ut(dt(e)),I.method("join","=")).join("&");return t}function pt(n){var e=[],t=[];return function r(i,s){var o,h,d;switch(typeof i){case"object":if(!i)return null;for(o=0;o<e.length;o+=1)if(e[o]===i)return{$ref:t[o]};if(e.push(i),t.push(s),Object.prototype.toString.apply(i)==="[object Array]")for(d=[],o=0;o<i.length;o+=1)d[o]=r(i[o],s+"["+o+"]");else{d={};for(h in i)Object.prototype.hasOwnProperty.call(i,h)&&(d[h]=r(i[h],s+"["+JSON.stringify(h)+"]"))}return d;case"number":case"string":case"boolean":return i}}(n,"$")}function te(n){try{return JSON.stringify(n)}catch{return JSON.stringify(pt(n))}}class gt{constructor(){this.globalLog=e=>{window.console&&window.console.log&&window.console.log(e)}}debug(...e){this.log(this.globalLog,e)}warn(...e){this.log(this.globalLogWarn,e)}error(...e){this.log(this.globalLogError,e)}globalLogWarn(e){window.console&&window.console.warn?window.console.warn(e):this.globalLog(e)}globalLogError(e){window.console&&window.console.error?window.console.error(e):this.globalLogWarn(e)}log(e,...t){var r=at.apply(this,arguments);ve.log?ve.log(r):ve.logToConsole&&e.bind(this)(r)}}var P=new gt,vt=function(n,e,t,r,i){(t.headers!==void 0||t.headersProvider!=null)&&P.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);var s=n.nextAuthCallbackID.toString();n.nextAuthCallbackID++;var o=n.getDocument(),h=o.createElement("script");n.auth_callbacks[s]=function(w){i(null,w)};var d="Pusher.auth_callbacks['"+s+"']";h.src=t.endpoint+"?callback="+encodeURIComponent(d)+"&"+e;var y=o.getElementsByTagName("head")[0]||o.documentElement;y.insertBefore(h,y.firstChild)},mt=vt;class bt{constructor(e){this.src=e}send(e){var t=this,r="Error loading "+t.src;t.script=document.createElement("script"),t.script.id=e.id,t.script.src=t.src,t.script.type="text/javascript",t.script.charset="UTF-8",t.script.addEventListener?(t.script.onerror=function(){e.callback(r)},t.script.onload=function(){e.callback(null)}):t.script.onreadystatechange=function(){(t.script.readyState==="loaded"||t.script.readyState==="complete")&&e.callback(null)},t.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(t.errorScript=document.createElement("script"),t.errorScript.id=e.id+"_error",t.errorScript.text=e.name+"('"+r+"');",t.script.async=t.errorScript.async=!1):t.script.async=!0;var i=document.getElementsByTagName("head")[0];i.insertBefore(t.script,i.firstChild),t.errorScript&&i.insertBefore(t.errorScript,t.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class yt{constructor(e,t){this.url=e,this.data=t}send(e){if(!this.request){var t=ft(this.data),r=this.url+"/"+e.number+"?"+t;this.request=f.createScriptRequest(r),this.request.send(e)}}cleanup(){this.request&&this.request.cleanup()}}var _t=function(n,e){return function(t,r){var i="http"+(e?"s":"")+"://",s=i+(n.host||n.options.host)+n.options.path,o=f.createJSONPRequest(s,t),h=f.ScriptReceivers.create(function(d,y){l.remove(h),o.cleanup(),y&&y.host&&(n.host=y.host),r&&r(d,y)});o.send(h)}},wt={name:"jsonp",getAgent:_t},St=wt;function oe(n,e,t){var r=n+(e.useTLS?"s":""),i=e.useTLS?e.hostTLS:e.hostNonTLS;return r+"://"+i+t}function ae(n,e){var t="/app/"+n,r="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(e?"&"+e:"");return t+r}var Ct={getInitial:function(n,e){var t=(e.httpPath||"")+ae(n,"flash=false");return oe("ws",e,t)}},Tt={getInitial:function(n,e){var t=(e.httpPath||"/pusher")+ae(n);return oe("http",e,t)}},kt={getInitial:function(n,e){return oe("http",e,e.httpPath||"/pusher")},getPath:function(n,e){return ae(n)}};class xt{constructor(){this._callbacks={}}get(e){return this._callbacks[ce(e)]}add(e,t,r){var i=ce(e);this._callbacks[i]=this._callbacks[i]||[],this._callbacks[i].push({fn:t,context:r})}remove(e,t,r){if(!e&&!t&&!r){this._callbacks={};return}var i=e?[ce(e)]:Se(this._callbacks);t||r?this.removeCallback(i,t,r):this.removeAllCallbacks(i)}removeCallback(e,t,r){K(e,function(i){this._callbacks[i]=Te(this._callbacks[i]||[],function(s){return t&&t!==s.fn||r&&r!==s.context}),this._callbacks[i].length===0&&delete this._callbacks[i]},this)}removeAllCallbacks(e){K(e,function(t){delete this._callbacks[t]},this)}}function ce(n){return"_"+n}class q{constructor(e){this.callbacks=new xt,this.global_callbacks=[],this.failThrough=e}bind(e,t,r){return this.callbacks.add(e,t,r),this}bind_global(e){return this.global_callbacks.push(e),this}unbind(e,t,r){return this.callbacks.remove(e,t,r),this}unbind_global(e){return e?(this.global_callbacks=Te(this.global_callbacks||[],t=>t!==e),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(e,t,r){for(var i=0;i<this.global_callbacks.length;i++)this.global_callbacks[i](e,t);var s=this.callbacks.get(e),o=[];if(r?o.push(t,r):t&&o.push(t),s&&s.length>0)for(var i=0;i<s.length;i++)s[i].fn.apply(s[i].context||window,o);else this.failThrough&&this.failThrough(e,t);return this}}class Pt extends q{constructor(e,t,r,i,s){super(),this.initialize=f.transportConnectionInitializer,this.hooks=e,this.name=t,this.priority=r,this.key=i,this.options=s,this.state="new",this.timeline=s.timeline,this.activityTimeout=s.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var e=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(e,this.options)}catch(t){return I.defer(()=>{this.onError(t),this.changeState("closed")}),!1}return this.bindListeners(),P.debug("Connecting",{transport:this.name,url:e}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(e){return this.state==="open"?(I.defer(()=>{this.socket&&this.socket.send(e)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(e){this.emit("error",{type:"WebSocketError",error:e}),this.timeline.error(this.buildTimelineMessage({error:e.toString()}))}onClose(e){e?this.changeState("closed",{code:e.code,reason:e.reason,wasClean:e.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(e){this.emit("message",e)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=e=>{this.onError(e)},this.socket.onclose=e=>{this.onClose(e)},this.socket.onmessage=e=>{this.onMessage(e)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(e,t){this.state=e,this.timeline.info(this.buildTimelineMessage({state:e,params:t})),this.emit(e,t)}buildTimelineMessage(e){return j({cid:this.id},e)}}class V{constructor(e){this.hooks=e}isSupported(e){return this.hooks.isSupported(e)}createConnection(e,t,r,i){return new Pt(this.hooks,e,t,r,i)}}var Lt=new V({urls:Ct,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!f.getWebSocketAPI()},isSupported:function(){return!!f.getWebSocketAPI()},getSocket:function(n){return f.createWebSocket(n)}}),Pe={urls:Tt,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Le=j({getSocket:function(n){return f.HTTPFactory.createStreamingSocket(n)}},Pe),Ae=j({getSocket:function(n){return f.HTTPFactory.createPollingSocket(n)}},Pe),Oe={isSupported:function(){return f.isXHRSupported()}},At=new V(j({},Le,Oe)),Ot=new V(j({},Ae,Oe)),Rt={ws:Lt,xhr_streaming:At,xhr_polling:Ot},ne=Rt,Et=new V({file:"sockjs",urls:kt,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(n,e){return new window.SockJS(n,null,{js_path:S.getPath("sockjs",{useTLS:e.useTLS}),ignore_null_origin:e.ignoreNullOrigin})},beforeOpen:function(n,e){n.send(JSON.stringify({path:e}))}}),Re={isSupported:function(n){var e=f.isXDRSupported(n.useTLS);return e}},It=new V(j({},Le,Re)),jt=new V(j({},Ae,Re));ne.xdr_streaming=It,ne.xdr_polling=jt,ne.sockjs=Et;var Nt=ne;class Ut extends q{constructor(){super();var e=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){e.emit("online")},!1),window.addEventListener("offline",function(){e.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Dt=new Ut;class Ht{constructor(e,t,r){this.manager=e,this.transport=t,this.minPingDelay=r.minPingDelay,this.maxPingDelay=r.maxPingDelay,this.pingDelay=void 0}createConnection(e,t,r,i){i=j({},i,{activityTimeout:this.pingDelay});var s=this.transport.createConnection(e,t,r,i),o=null,h=function(){s.unbind("open",h),s.bind("closed",d),o=I.now()},d=y=>{if(s.unbind("closed",d),y.code===1002||y.code===1003)this.manager.reportDeath();else if(!y.wasClean&&o){var w=I.now()-o;w<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(w/2,this.minPingDelay))}};return s.bind("open",h),s}isSupported(e){return this.manager.isAlive()&&this.transport.isSupported(e)}}const Ee={decodeMessage:function(n){try{var e=JSON.parse(n.data),t=e.data;if(typeof t=="string")try{t=JSON.parse(e.data)}catch{}var r={event:e.event,channel:e.channel,data:t};return e.user_id&&(r.user_id=e.user_id),r}catch(i){throw{type:"MessageParseError",error:i,data:n.data}}},encodeMessage:function(n){return JSON.stringify(n)},processHandshake:function(n){var e=Ee.decodeMessage(n);if(e.event==="pusher:connection_established"){if(!e.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:e.data.socket_id,activityTimeout:e.data.activity_timeout*1e3}}else{if(e.event==="pusher:error")return{action:this.getCloseAction(e.data),error:this.getCloseError(e.data)};throw"Invalid handshake"}},getCloseAction:function(n){return n.code<4e3?n.code>=1002&&n.code<=1004?"backoff":null:n.code===4e3?"tls_only":n.code<4100?"refused":n.code<4200?"backoff":n.code<4300?"retry":"refused"},getCloseError:function(n){return n.code!==1e3&&n.code!==1001?{type:"PusherError",data:{code:n.code,message:n.reason||n.message}}:null}};var J=Ee;class zt extends q{constructor(e,t){super(),this.id=e,this.transport=t,this.activityTimeout=t.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(e){return this.transport.send(e)}send_event(e,t,r){var i={event:e,data:t};return r&&(i.channel=r),P.debug("Event sent",i),this.send(J.encodeMessage(i))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var e={message:r=>{var i;try{i=J.decodeMessage(r)}catch(s){this.emit("error",{type:"MessageParseError",error:s,data:r.data})}if(i!==void 0){switch(P.debug("Event recd",i),i.event){case"pusher:error":this.emit("error",{type:"PusherError",data:i.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",i)}},activity:()=>{this.emit("activity")},error:r=>{this.emit("error",r)},closed:r=>{t(),r&&r.code&&this.handleCloseEvent(r),this.transport=null,this.emit("closed")}},t=()=>{z(e,(r,i)=>{this.transport.unbind(i,r)})};z(e,(r,i)=>{this.transport.bind(i,r)})}handleCloseEvent(e){var t=J.getCloseAction(e),r=J.getCloseError(e);r&&this.emit("error",r),t&&this.emit(t,{action:t,error:r})}}class qt{constructor(e,t){this.transport=e,this.callback=t,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=e=>{this.unbindListeners();var t;try{t=J.processHandshake(e)}catch(r){this.finish("error",{error:r}),this.transport.close();return}t.action==="connected"?this.finish("connected",{connection:new zt(t.id,this.transport),activityTimeout:t.activityTimeout}):(this.finish(t.action,{error:t.error}),this.transport.close())},this.onClosed=e=>{this.unbindListeners();var t=J.getCloseAction(e)||"backoff",r=J.getCloseError(e);this.finish(t,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(e,t){this.callback(j({transport:this.transport,action:e},t))}}class Mt{constructor(e,t){this.timeline=e,this.options=t||{}}send(e,t){this.timeline.isEmpty()||this.timeline.send(f.TimelineTransport.getAgent(this,e),t)}}class he extends q{constructor(e,t){super(function(r,i){P.debug("No callbacks on "+e+" for "+r)}),this.name=e,this.pusher=t,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(e,t){return t(null,{auth:""})}trigger(e,t){if(e.indexOf("client-")!==0)throw new a("Event '"+e+"' does not start with 'client-'");if(!this.subscribed){var r=_.buildLogSuffix("triggeringClientEvents");P.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`)}return this.pusher.send_event(e,t,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(e){var t=e.event,r=e.data;if(t==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(e);else if(t==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(e);else if(t.indexOf("pusher_internal:")!==0){var i={};this.emit(t,r,i)}}handleSubscriptionSucceededEvent(e){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",e.data)}handleSubscriptionCountEvent(e){e.data.subscription_count&&(this.subscriptionCount=e.data.subscription_count),this.emit("pusher:subscription_count",e.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(e,t)=>{e?(this.subscriptionPending=!1,P.error(e.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:e.message},e instanceof N?{status:e.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:t.auth,channel_data:t.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ue extends he{authorize(e,t){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:e},t)}}class Bt{constructor(){this.reset()}get(e){return Object.prototype.hasOwnProperty.call(this.members,e)?{id:e,info:this.members[e]}:null}each(e){z(this.members,(t,r)=>{e(this.get(r))})}setMyID(e){this.myID=e}onSubscription(e){this.members=e.presence.hash,this.count=e.presence.count,this.me=this.get(this.myID)}addMember(e){return this.get(e.user_id)===null&&this.count++,this.members[e.user_id]=e.user_info,this.get(e.user_id)}removeMember(e){var t=this.get(e.user_id);return t&&(delete this.members[e.user_id],this.count--),t}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Ft=function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function h(w){try{y(r.next(w))}catch(L){o(L)}}function d(w){try{y(r.throw(w))}catch(L){o(L)}}function y(w){w.done?s(w.value):i(w.value).then(h,d)}y((r=r.apply(n,e||[])).next())})};class $t extends ue{constructor(e,t){super(e,t),this.members=new Bt}authorize(e,t){super.authorize(e,(r,i)=>Ft(this,void 0,void 0,function*(){if(!r)if(i=i,i.channel_data!=null){var s=JSON.parse(i.channel_data);this.members.setMyID(s.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let o=_.buildLogSuffix("authorizationEndpoint");P.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${o}, or the user should be signed in.`),t("Invalid auth response");return}t(r,i)}))}handleEvent(e){var t=e.event;if(t.indexOf("pusher_internal:")===0)this.handleInternalEvent(e);else{var r=e.data,i={};e.user_id&&(i.user_id=e.user_id),this.emit(t,r,i)}}handleInternalEvent(e){var t=e.event,r=e.data;switch(t){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(e);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(e);break;case"pusher_internal:member_added":var i=this.members.addMember(r);this.emit("pusher:member_added",i);break;case"pusher_internal:member_removed":var s=this.members.removeMember(r);s&&this.emit("pusher:member_removed",s);break}}handleSubscriptionSucceededEvent(e){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(e.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Xt=C(1),le=C(0);class Jt extends ue{constructor(e,t,r){super(e,t),this.key=null,this.nacl=r}authorize(e,t){super.authorize(e,(r,i)=>{if(r){t(r,i);return}let s=i.shared_secret;if(!s){t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(le.decode)(s),delete i.shared_secret,t(null,i)})}trigger(e,t){throw new E("Client events are not currently supported for encrypted channels")}handleEvent(e){var t=e.event,r=e.data;if(t.indexOf("pusher_internal:")===0||t.indexOf("pusher:")===0){super.handleEvent(e);return}this.handleEncryptedEvent(t,r)}handleEncryptedEvent(e,t){if(!this.key){P.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!t.ciphertext||!t.nonce){P.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+t);return}let r=Object(le.decode)(t.ciphertext);if(r.length<this.nacl.secretbox.overheadLength){P.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);return}let i=Object(le.decode)(t.nonce);if(i.length<this.nacl.secretbox.nonceLength){P.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${i.length}`);return}let s=this.nacl.secretbox.open(r,i,this.key);if(s===null){P.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(o,h)=>{if(o){P.error(`Failed to make a request to the authEndpoint: ${h}. Unable to fetch new key, so dropping encrypted event`);return}if(s=this.nacl.secretbox.open(r,i,this.key),s===null){P.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(e,this.getDataToEmit(s))});return}this.emit(e,this.getDataToEmit(s))}getDataToEmit(e){let t=Object(Xt.decode)(e);try{return JSON.parse(t)}catch{return t}}}class Wt extends q{constructor(e,t){super(),this.state="initialized",this.connection=null,this.key=e,this.options=t,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var r=f.getNetwork();r.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),r.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(e){this.key=e,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(e){return this.connection?this.connection.send(e):!1}send_event(e,t,r){return this.connection?this.connection.send_event(e,t,r):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var e=(t,r)=>{t?this.runner=this.strategy.connect(0,e):r.action==="error"?(this.emit("error",{type:"HandshakeError",error:r.error}),this.timeline.error({handshakeError:r.error})):(this.abortConnecting(),this.handshakeCallbacks[r.action](r))};this.runner=this.strategy.connect(0,e)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var e=this.abandonConnection();e.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(e){this.timeline.info({action:"retry",delay:e}),e>0&&this.emit("connecting_in",Math.round(e/1e3)),this.retryTimer=new X(e||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new X(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new X(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new X(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(e){return j({},e,{message:t=>{this.resetActivityCheck(),this.emit("message",t)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:t=>{this.emit("error",t)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(e){return j({},e,{connected:t=>{this.activityTimeout=Math.min(this.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(t.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let e=t=>r=>{r.error&&this.emit("error",{type:"WebSocketError",error:r.error}),t(r)};return{tls_only:e(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:e(()=>{this.disconnect()}),backoff:e(()=>{this.retryIn(1e3)}),retry:e(()=>{this.retryIn(0)})}}setConnection(e){this.connection=e;for(var t in this.connectionCallbacks)this.connection.bind(t,this.connectionCallbacks[t]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var e in this.connectionCallbacks)this.connection.unbind(e,this.connectionCallbacks[e]);var t=this.connection;return this.connection=null,t}}updateState(e,t){var r=this.state;if(this.state=e,r!==e){var i=e;i==="connected"&&(i+=" with new socket ID "+t.socket_id),P.debug("State changed",r+" -> "+i),this.timeline.info({state:e,params:t}),this.emit("state_change",{previous:r,current:e}),this.emit(e,t)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Gt{constructor(){this.channels={}}add(e,t){return this.channels[e]||(this.channels[e]=Vt(e,t)),this.channels[e]}all(){return ct(this.channels)}find(e){return this.channels[e]}remove(e){var t=this.channels[e];return delete this.channels[e],t}disconnect(){z(this.channels,function(e){e.disconnect()})}}function Vt(n,e){if(n.indexOf("private-encrypted-")===0){if(e.config.nacl)return M.createEncryptedChannel(n,e,e.config.nacl);let t="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",r=_.buildLogSuffix("encryptedChannelSupport");throw new E(`${t}. ${r}`)}else{if(n.indexOf("private-")===0)return M.createPrivateChannel(n,e);if(n.indexOf("presence-")===0)return M.createPresenceChannel(n,e);if(n.indexOf("#")===0)throw new c('Cannot create a channel with name "'+n+'".');return M.createChannel(n,e)}}var Qt={createChannels(){return new Gt},createConnectionManager(n,e){return new Wt(n,e)},createChannel(n,e){return new he(n,e)},createPrivateChannel(n,e){return new ue(n,e)},createPresenceChannel(n,e){return new $t(n,e)},createEncryptedChannel(n,e,t){return new Jt(n,e,t)},createTimelineSender(n,e){return new Mt(n,e)},createHandshake(n,e){return new qt(n,e)},createAssistantToTheTransportManager(n,e,t){return new Ht(n,e,t)}},M=Qt;class Ie{constructor(e){this.options=e||{},this.livesLeft=this.options.lives||1/0}getAssistant(e){return M.createAssistantToTheTransportManager(this,e,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class W{constructor(e,t){this.strategies=e,this.loop=!!t.loop,this.failFast=!!t.failFast,this.timeout=t.timeout,this.timeoutLimit=t.timeoutLimit}isSupported(){return xe(this.strategies,I.method("isSupported"))}connect(e,t){var r=this.strategies,i=0,s=this.timeout,o=null,h=(d,y)=>{y?t(null,y):(i=i+1,this.loop&&(i=i%r.length),i<r.length?(s&&(s=s*2,this.timeoutLimit&&(s=Math.min(s,this.timeoutLimit))),o=this.tryStrategy(r[i],e,{timeout:s,failFast:this.failFast},h)):t(!0))};return o=this.tryStrategy(r[i],e,{timeout:s,failFast:this.failFast},h),{abort:function(){o.abort()},forceMinPriority:function(d){e=d,o&&o.forceMinPriority(d)}}}tryStrategy(e,t,r,i){var s=null,o=null;return r.timeout>0&&(s=new X(r.timeout,function(){o.abort(),i(!0)})),o=e.connect(t,function(h,d){h&&s&&s.isRunning()&&!r.failFast||(s&&s.ensureAborted(),i(h,d))}),{abort:function(){s&&s.ensureAborted(),o.abort()},forceMinPriority:function(h){o.forceMinPriority(h)}}}}class de{constructor(e){this.strategies=e}isSupported(){return xe(this.strategies,I.method("isSupported"))}connect(e,t){return Kt(this.strategies,e,function(r,i){return function(s,o){if(i[r].error=s,s){Yt(i)&&t(!0);return}K(i,function(h){h.forceMinPriority(o.transport.priority)}),t(null,o)}})}}function Kt(n,e,t){var r=Ce(n,function(i,s,o,h){return i.connect(e,t(s,h))});return{abort:function(){K(r,Zt)},forceMinPriority:function(i){K(r,function(s){s.forceMinPriority(i)})}}}function Yt(n){return lt(n,function(e){return!!e.error})}function Zt(n){!n.error&&!n.aborted&&(n.abort(),n.aborted=!0)}class en{constructor(e,t,r){this.strategy=e,this.transports=t,this.ttl=r.ttl||1800*1e3,this.usingTLS=r.useTLS,this.timeline=r.timeline}isSupported(){return this.strategy.isSupported()}connect(e,t){var r=this.usingTLS,i=tn(r),s=i&&i.cacheSkipCount?i.cacheSkipCount:0,o=[this.strategy];if(i&&i.timestamp+this.ttl>=I.now()){var h=this.transports[i.transport];h&&(["ws","wss"].includes(i.transport)||s>3?(this.timeline.info({cached:!0,transport:i.transport,latency:i.latency}),o.push(new W([h],{timeout:i.latency*2+1e3,failFast:!0}))):s++)}var d=I.now(),y=o.pop().connect(e,function w(L,se){L?(je(r),o.length>0?(d=I.now(),y=o.pop().connect(e,w)):t(L)):(nn(r,se.transport.name,I.now()-d,s),t(null,se))});return{abort:function(){y.abort()},forceMinPriority:function(w){e=w,y&&y.forceMinPriority(w)}}}}function fe(n){return"pusherTransport"+(n?"TLS":"NonTLS")}function tn(n){var e=f.getLocalStorage();if(e)try{var t=e[fe(n)];if(t)return JSON.parse(t)}catch{je(n)}return null}function nn(n,e,t,r){var i=f.getLocalStorage();if(i)try{i[fe(n)]=te({timestamp:I.now(),transport:e,latency:t,cacheSkipCount:r})}catch{}}function je(n){var e=f.getLocalStorage();if(e)try{delete e[fe(n)]}catch{}}class re{constructor(e,{delay:t}){this.strategy=e,this.options={delay:t}}isSupported(){return this.strategy.isSupported()}connect(e,t){var r=this.strategy,i,s=new X(this.options.delay,function(){i=r.connect(e,t)});return{abort:function(){s.ensureAborted(),i&&i.abort()},forceMinPriority:function(o){e=o,i&&i.forceMinPriority(o)}}}}class Y{constructor(e,t,r){this.test=e,this.trueBranch=t,this.falseBranch=r}isSupported(){var e=this.test()?this.trueBranch:this.falseBranch;return e.isSupported()}connect(e,t){var r=this.test()?this.trueBranch:this.falseBranch;return r.connect(e,t)}}class rn{constructor(e){this.strategy=e}isSupported(){return this.strategy.isSupported()}connect(e,t){var r=this.strategy.connect(e,function(i,s){s&&r.abort(),t(i,s)});return r}}function Z(n){return function(){return n.isSupported()}}var sn=function(n,e,t){var r={};function i(We,rr,ir,sr,or){var Ge=t(n,We,rr,ir,sr,or);return r[We]=Ge,Ge}var s=Object.assign({},e,{hostNonTLS:n.wsHost+":"+n.wsPort,hostTLS:n.wsHost+":"+n.wssPort,httpPath:n.wsPath}),o=Object.assign({},s,{useTLS:!0}),h=Object.assign({},e,{hostNonTLS:n.httpHost+":"+n.httpPort,hostTLS:n.httpHost+":"+n.httpsPort,httpPath:n.httpPath}),d={loop:!0,timeout:15e3,timeoutLimit:6e4},y=new Ie({minPingDelay:1e4,maxPingDelay:n.activityTimeout}),w=new Ie({lives:2,minPingDelay:1e4,maxPingDelay:n.activityTimeout}),L=i("ws","ws",3,s,y),se=i("wss","ws",3,o,y),Yn=i("sockjs","sockjs",1,h),Me=i("xhr_streaming","xhr_streaming",1,h,w),Zn=i("xdr_streaming","xdr_streaming",1,h,w),Be=i("xhr_polling","xhr_polling",1,h),er=i("xdr_polling","xdr_polling",1,h),Fe=new W([L],d),tr=new W([se],d),nr=new W([Yn],d),$e=new W([new Y(Z(Me),Me,Zn)],d),Xe=new W([new Y(Z(Be),Be,er)],d),Je=new W([new Y(Z($e),new de([$e,new re(Xe,{delay:4e3})]),Xe)],d),me=new Y(Z(Je),Je,nr),be;return e.useTLS?be=new de([Fe,new re(me,{delay:2e3})]):be=new de([Fe,new re(tr,{delay:2e3}),new re(me,{delay:5e3})]),new en(new rn(new Y(Z(L),be,me)),r,{ttl:18e5,timeline:e.timeline,useTLS:e.useTLS})},on=sn,an=function(){var n=this;n.timeline.info(n.buildTimelineMessage({transport:n.name+(n.options.useTLS?"s":"")})),n.hooks.isInitialized()?n.changeState("initialized"):n.hooks.file?(n.changeState("initializing"),S.load(n.hooks.file,{useTLS:n.options.useTLS},function(e,t){n.hooks.isInitialized()?(n.changeState("initialized"),t(!0)):(e&&n.onError(e),n.onClose(),t(!1))})):n.onClose()},cn={getRequest:function(n){var e=new window.XDomainRequest;return e.ontimeout=function(){n.emit("error",new p),n.close()},e.onerror=function(t){n.emit("error",t),n.close()},e.onprogress=function(){e.responseText&&e.responseText.length>0&&n.onChunk(200,e.responseText)},e.onload=function(){e.responseText&&e.responseText.length>0&&n.onChunk(200,e.responseText),n.emit("finished",200),n.close()},e},abortRequest:function(n){n.ontimeout=n.onerror=n.onprogress=n.onload=null,n.abort()}},hn=cn;const un=256*1024;class ln extends q{constructor(e,t,r){super(),this.hooks=e,this.method=t,this.url=r}start(e){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},f.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(e)}close(){this.unloader&&(f.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(e,t){for(;;){var r=this.advanceBuffer(t);if(r)this.emit("chunk",{status:e,data:r});else break}this.isBufferTooLong(t)&&this.emit("buffer_too_long")}advanceBuffer(e){var t=e.slice(this.position),r=t.indexOf(` `);return r!==-1?(this.position+=r+1,t.slice(0,r)):null}isBufferTooLong(e){return this.position===e.length&&e.length>un}}var pe;(function(n){n[n.CONNECTING=0]="CONNECTING",n[n.OPEN=1]="OPEN",n[n.CLOSED=3]="CLOSED"})(pe||(pe={}));var G=pe,dn=1;class fn{constructor(e,t){this.hooks=e,this.session=Ue(1e3)+"/"+mn(8),this.location=pn(t),this.readyState=G.CONNECTING,this.openStream()}send(e){return this.sendRaw(JSON.stringify([e]))}ping(){this.hooks.sendHeartbeat(this)}close(e,t){this.onClose(e,t,!0)}sendRaw(e){if(this.readyState===G.OPEN)try{return f.createSocketRequest("POST",Ne(gn(this.location,this.session))).start(e),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(e,t,r){this.closeStream(),this.readyState=G.CLOSED,this.onclose&&this.onclose({code:e,reason:t,wasClean:r})}onChunk(e){if(e.status===200){this.readyState===G.OPEN&&this.onActivity();var t,r=e.data.slice(0,1);switch(r){case"o":t=JSON.parse(e.data.slice(1)||"{}"),this.onOpen(t);break;case"a":t=JSON.parse(e.data.slice(1)||"[]");for(var i=0;i<t.length;i++)this.onEvent(t[i]);break;case"m":t=JSON.parse(e.data.slice(1)||"null"),this.onEvent(t);break;case"h":this.hooks.onHeartbeat(this);break;case"c":t=JSON.parse(e.data.slice(1)||"[]"),this.onClose(t[0],t[1],!0);break}}}onOpen(e){this.readyState===G.CONNECTING?(e&&e.hostname&&(this.location.base=vn(this.location.base,e.hostname)),this.readyState=G.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(e){this.readyState===G.OPEN&&this.onmessage&&this.onmessage({data:e})}onActivity(){this.onactivity&&this.onactivity()}onError(e){this.onerror&&this.onerror(e)}openStream(){this.stream=f.createSocketRequest("POST",Ne(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",e=>{this.onChunk(e)}),this.stream.bind("finished",e=>{this.hooks.onFinished(this,e)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(e){I.defer(()=>{this.onError(e),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function pn(n){var e=/([^\?]*)\/*(\??.*)/.exec(n);return{base:e[1],queryString:e[2]}}function gn(n,e){return n.base+"/"+e+"/xhr_send"}function Ne(n){var e=n.indexOf("?")===-1?"?":"&";return n+e+"t="+ +new Date+"&n="+dn++}function vn(n,e){var t=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(n);return t[1]+e+t[3]}function Ue(n){return f.randomInt(n)}function mn(n){for(var e=[],t=0;t<n;t++)e.push(Ue(32).toString(32));return e.join("")}var bn=fn,yn={getReceiveURL:function(n,e){return n.base+"/"+e+"/xhr_streaming"+n.queryString},onHeartbeat:function(n){n.sendRaw("[]")},sendHeartbeat:function(n){n.sendRaw("[]")},onFinished:function(n,e){n.onClose(1006,"Connection interrupted ("+e+")",!1)}},_n=yn,wn={getReceiveURL:function(n,e){return n.base+"/"+e+"/xhr"+n.queryString},onHeartbeat:function(){},sendHeartbeat:function(n){n.sendRaw("[]")},onFinished:function(n,e){e===200?n.reconnect():n.onClose(1006,"Connection interrupted ("+e+")",!1)}},Sn=wn,Cn={getRequest:function(n){var e=f.getXHRAPI(),t=new e;return t.onreadystatechange=t.onprogress=function(){switch(t.readyState){case 3:t.responseText&&t.responseText.length>0&&n.onChunk(t.status,t.responseText);break;case 4:t.responseText&&t.responseText.length>0&&n.onChunk(t.status,t.responseText),n.emit("finished",t.status),n.close();break}},t},abortRequest:function(n){n.onreadystatechange=null,n.abort()}},Tn=Cn,kn={createStreamingSocket(n){return this.createSocket(_n,n)},createPollingSocket(n){return this.createSocket(Sn,n)},createSocket(n,e){return new bn(n,e)},createXHR(n,e){return this.createRequest(Tn,n,e)},createRequest(n,e,t){return new ln(n,e,t)}},De=kn;De.createXDR=function(n,e){return this.createRequest(hn,n,e)};var xn=De,Pn={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:l,DependenciesReceivers:k,getDefaultStrategy:on,Transports:Nt,transportConnectionInitializer:an,HTTPFactory:xn,TimelineTransport:St,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(n){window.Pusher=n;var e=()=>{this.onDocumentBody(n.ready)};window.JSON?e():S.load("json2",{},e)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:F,jsonp:mt}},onDocumentBody(n){document.body?n():setTimeout(()=>{this.onDocumentBody(n)},0)},createJSONPRequest(n,e){return new yt(n,e)},createScriptRequest(n){return new bt(n)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var n=this.getXHRAPI();return new n},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Dt},createWebSocket(n){var e=this.getWebSocketAPI();return new e(n)},createSocketRequest(n,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(n,e);if(this.isXDRSupported(e.indexOf("https:")===0))return this.HTTPFactory.createXDR(n,e);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var n=this.getXHRAPI();return!!n&&new n().withCredentials!==void 0},isXDRSupported(n){var e=n?"https:":"http:",t=this.getProtocol();return!!window.XDomainRequest&&t===e},addUnloadListener(n){window.addEventListener!==void 0?window.addEventListener("unload",n,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",n)},removeUnloadListener(n){window.addEventListener!==void 0?window.removeEventListener("unload",n,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",n)},randomInt(n){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*n)}},f=Pn,ge;(function(n){n[n.ERROR=3]="ERROR",n[n.INFO=6]="INFO",n[n.DEBUG=7]="DEBUG"})(ge||(ge={}));var ie=ge;class Ln{constructor(e,t,r){this.key=e,this.session=t,this.events=[],this.options=r||{},this.sent=0,this.uniqueID=0}log(e,t){e<=this.options.level&&(this.events.push(j({},t,{timestamp:I.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(e){this.log(ie.ERROR,e)}info(e){this.log(ie.INFO,e)}debug(e){this.log(ie.DEBUG,e)}isEmpty(){return this.events.length===0}send(e,t){var r=j({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],e(r,(i,s)=>{i||this.sent++,t&&t(i,s)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class An{constructor(e,t,r,i){this.name=e,this.priority=t,this.transport=r,this.options=i||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(e,t){if(this.isSupported()){if(this.priority<e)return He(new x,t)}else return He(new D,t);var r=!1,i=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),s=null,o=function(){i.unbind("initialized",o),i.connect()},h=function(){s=M.createHandshake(i,function(L){r=!0,w(),t(null,L)})},d=function(L){w(),t(L)},y=function(){w();var L;L=te(i),t(new R(L))},w=function(){i.unbind("initialized",o),i.unbind("open",h),i.unbind("error",d),i.unbind("closed",y)};return i.bind("initialized",o),i.bind("open",h),i.bind("error",d),i.bind("closed",y),i.initialize(),{abort:()=>{r||(w(),s?s.close():i.close())},forceMinPriority:L=>{r||this.priority<L&&(s?s.close():i.close())}}}}function He(n,e){return I.defer(function(){e(n)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:On}=f;var Rn=function(n,e,t,r,i,s){var o=On[t];if(!o)throw new U(t);var h=(!n.enabledTransports||we(n.enabledTransports,e)!==-1)&&(!n.disabledTransports||we(n.disabledTransports,e)===-1),d;return h?(i=Object.assign({ignoreNullOrigin:n.ignoreNullOrigin},i),d=new An(e,r,s?s.getAssistant(o):o,i)):d=En,d},En={isSupported:function(){return!1},connect:function(n,e){var t=I.defer(function(){e(new D)});return{abort:function(){t.ensureAborted()},forceMinPriority:function(){}}}};function In(n){if(n==null)throw"You must pass an options object";if(n.cluster==null)throw"Options object must provide a cluster";"disableStats"in n&&P.warn("The disableStats option is deprecated in favor of enableStats")}const jn=(n,e)=>{var t="socket_id="+encodeURIComponent(n.socketId);for(var r in e.params)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(e.params[r]);if(e.paramsProvider!=null){let i=e.paramsProvider();for(var r in i)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(i[r])}return t};var Nn=n=>{if(typeof f.getAuthorizers()[n.transport]>"u")throw`'${n.transport}' is not a recognized auth transport`;return(e,t)=>{const r=jn(e,n);f.getAuthorizers()[n.transport](f,r,n,u.UserAuthentication,t)}};const Un=(n,e)=>{var t="socket_id="+encodeURIComponent(n.socketId);t+="&channel_name="+encodeURIComponent(n.channelName);for(var r in e.params)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(e.params[r]);if(e.paramsProvider!=null){let i=e.paramsProvider();for(var r in i)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(i[r])}return t};var Dn=n=>{if(typeof f.getAuthorizers()[n.transport]>"u")throw`'${n.transport}' is not a recognized auth transport`;return(e,t)=>{const r=Un(e,n);f.getAuthorizers()[n.transport](f,r,n,u.ChannelAuthorization,t)}};const Hn=(n,e,t)=>{const r={authTransport:e.transport,authEndpoint:e.endpoint,auth:{params:e.params,headers:e.headers}};return(i,s)=>{const o=n.channel(i.channelName);t(o,r).authorize(i.socketId,s)}};function ze(n,e){let t={activityTimeout:n.activityTimeout||m.activityTimeout,cluster:n.cluster,httpPath:n.httpPath||m.httpPath,httpPort:n.httpPort||m.httpPort,httpsPort:n.httpsPort||m.httpsPort,pongTimeout:n.pongTimeout||m.pongTimeout,statsHost:n.statsHost||m.stats_host,unavailableTimeout:n.unavailableTimeout||m.unavailableTimeout,wsPath:n.wsPath||m.wsPath,wsPort:n.wsPort||m.wsPort,wssPort:n.wssPort||m.wssPort,enableStats:Fn(n),httpHost:zn(n),useTLS:Bn(n),wsHost:qn(n),userAuthenticator:$n(n),channelAuthorizer:Jn(n,e)};return"disabledTransports"in n&&(t.disabledTransports=n.disabledTransports),"enabledTransports"in n&&(t.enabledTransports=n.enabledTransports),"ignoreNullOrigin"in n&&(t.ignoreNullOrigin=n.ignoreNullOrigin),"timelineParams"in n&&(t.timelineParams=n.timelineParams),"nacl"in n&&(t.nacl=n.nacl),t}function zn(n){return n.httpHost?n.httpHost:n.cluster?`sockjs-${n.cluster}.pusher.com`:m.httpHost}function qn(n){return n.wsHost?n.wsHost:Mn(n.cluster)}function Mn(n){return`ws-${n}.pusher.com`}function Bn(n){return f.getProtocol()==="https:"?!0:n.forceTLS!==!1}function Fn(n){return"enableStats"in n?n.enableStats:"disableStats"in n?!n.disableStats:!1}const qe=n=>"customHandler"in n&&n.customHandler!=null;function $n(n){const e=Object.assign(Object.assign({},m.userAuthentication),n.userAuthentication);return qe(e)?e.customHandler:Nn(e)}function Xn(n,e){let t;if("channelAuthorization"in n)t=Object.assign(Object.assign({},m.channelAuthorization),n.channelAuthorization);else if(t={transport:n.authTransport||m.authTransport,endpoint:n.authEndpoint||m.authEndpoint},"auth"in n&&("params"in n.auth&&(t.params=n.auth.params),"headers"in n.auth&&(t.headers=n.auth.headers)),"authorizer"in n)return{customHandler:Hn(e,t,n.authorizer)};return t}function Jn(n,e){const t=Xn(n,e);return qe(t)?t.customHandler:Dn(t)}class Wn extends q{constructor(e){super(function(t,r){P.debug(`No callbacks on watchlist events for ${t}`)}),this.pusher=e,this.bindWatchlistInternalEvent()}handleEvent(e){e.data.events.forEach(t=>{this.emit(t.name,t)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",e=>{var t=e.event;t==="pusher_internal:watchlist_events"&&this.handleEvent(e)})}}function Gn(){let n,e;return{promise:new Promise((r,i)=>{n=r,e=i}),resolve:n,reject:e}}var Vn=Gn;class Qn extends q{constructor(e){super(function(t,r){P.debug("No callbacks on user for "+t)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(t,r)=>{if(t){P.warn(`Error during signin: ${t}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:r.auth,user_data:r.user_data})},this.pusher=e,this.pusher.connection.bind("state_change",({previous:t,current:r})=>{t!=="connected"&&r==="connected"&&this._signin(),t==="connected"&&r!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Wn(e),this.pusher.connection.bind("message",t=>{var r=t.event;r==="pusher:signin_success"&&this._onSigninSuccess(t.data),this.serverToUserChannel&&this.serverToUserChannel.name===t.channel&&this.serverToUserChannel.handleEvent(t)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(e){try{this.user_data=JSON.parse(e.user_data)}catch{P.error(`Failed parsing user data after signin: ${e.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){P.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const e=t=>{t.subscriptionPending&&t.subscriptionCancelled?t.reinstateSubscription():!t.subscriptionPending&&this.pusher.connection.state==="connected"&&t.subscribe()};this.serverToUserChannel=new he(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((t,r)=>{t.indexOf("pusher_internal:")===0||t.indexOf("pusher:")===0||this.emit(t,r)}),e(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:e,resolve:t}=Vn();e.done=!1;const r=()=>{e.done=!0};e.then(r).catch(r),this.signinDonePromise=e,this._signinDoneResolve=t}}class A{static ready(){A.isReady=!0;for(var e=0,t=A.instances.length;e<t;e++)A.instances[e].connect()}static getClientFeatures(){return Se(ke({ws:f.Transports.ws},function(e){return e.isSupported({})}))}constructor(e,t){Kn(e),In(t),this.key=e,this.options=t,this.config=ze(this.options,this),this.channels=M.createChannels(),this.global_emitter=new q,this.sessionID=f.randomInt(1e9),this.timeline=new Ln(this.key,this.sessionID,{cluster:this.config.cluster,features:A.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:ie.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=M.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+f.TimelineTransport.name}));var r=i=>f.getDefaultStrategy(this.config,i,Rn);this.connection=M.createConnectionManager(this.key,{getStrategy:r,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",i=>{var s=i.event,o=s.indexOf("pusher_internal:")===0;if(i.channel){var h=this.channel(i.channel);h&&h.handleEvent(i)}o||this.global_emitter.emit(i.event,i.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",i=>{P.warn(i)}),A.instances.push(this),this.timeline.info({instances:A.instances.length}),this.user=new Qn(this),A.isReady&&this.connect()}switchCluster(e){const{appKey:t,cluster:r}=e;this.key=t,this.options=Object.assign(Object.assign({},this.options),{cluster:r}),this.config=ze(this.options,this),this.connection.switchCluster(this.key)}channel(e){return this.channels.find(e)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var e=this.connection.isUsingTLS(),t=this.timelineSender;this.timelineSenderTimer=new st(6e4,function(){t.send(e)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(e,t,r){return this.global_emitter.bind(e,t,r),this}unbind(e,t,r){return this.global_emitter.unbind(e,t,r),this}bind_global(e){return this.global_emitter.bind_global(e),this}unbind_global(e){return this.global_emitter.unbind_global(e),this}unbind_all(e){return this.global_emitter.unbind_all(),this}subscribeAll(){var e;for(e in this.channels.channels)this.channels.channels.hasOwnProperty(e)&&this.subscribe(e)}subscribe(e){var t=this.channels.add(e,this);return t.subscriptionPending&&t.subscriptionCancelled?t.reinstateSubscription():!t.subscriptionPending&&this.connection.state==="connected"&&t.subscribe(),t}unsubscribe(e){var t=this.channels.find(e);t&&t.subscriptionPending?t.cancelSubscription():(t=this.channels.remove(e),t&&t.subscribed&&t.unsubscribe())}send_event(e,t,r){return this.connection.send_event(e,t,r)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}A.instances=[],A.isReady=!1,A.logToConsole=!1,A.Runtime=f,A.ScriptReceivers=f.ScriptReceivers,A.DependenciesReceivers=f.DependenciesReceivers,A.auth_callbacks=f.auth_callbacks;var ve=T.default=A;function Kn(n){if(n==null)throw"You must pass your app key when you instantiate Pusher."}f.setup(A)}])})}(ye)),ye.exports}var hr=cr();const ur=ar(hr),gr=Object.freeze(Object.defineProperty({__proto__:null,default:ur},Symbol.toStringTag,{value:"Module"}));export{gr as p};
Save
Cancel