PageSourceSearch

https://seomaker.ai/_nuxt-v2/BWfMX7go.js

js seomaker.ai collected 2026-10-05 12:36:48 UTC 74,787 bytes, 2 lines download raw bytes

vendor: 10,336 bytes, line 1
1import{a as e,r as t}from"./DQvjNzka.js";import{K as n,cr as r,gr as i,q as a}from"./BPsVqlsv.js";import{t as o}from"./BdOgpimk.js";var s=class{constructor(){this.notificationCreatedEvent=`.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated`}listenForWhisper(e,t){return this.listen(`.client-`+e,t)}notification(e){return this.listen(this.notificationCreatedEvent,e)}stopListeningForNotification(e){return this.stopListening(this.notificationCreatedEvent,e)}stopListeningForWhisper(e,t){return this.stopListening(`.client-`+e,t)}},c=class{constructor(e){this.namespace=e}format(e){return[`.`,`\\`].includes(e.charAt(0))?e.substring(1):(this.namespace&&(e=this.namespace+`.`+e),e.replace(/\./g,`\\`))}setNamespace(e){this.namespace=e}};function l(e){try{return Reflect.construct(String,[],e),!0}catch{return!1}}var u=class extends s{constructor(e,t,n){super(),this.name=t,this.pusher=e,this.options=n,this.eventFormatter=new c(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(e,t){return this.on(this.eventFormatter.format(e),t),this}listenToAll(e){return this.subscription.bind_global((t,n)=>{if(t.startsWith(`pusher:`))return;let r=String(this.options.namespace??``).replace(/\./g,`\\`);e(t.startsWith(r)?t.substring(r.length+1):`.`+t,n)}),this}stopListening(e,t){return t?this.subscription.unbind(this.eventFormatter.format(e),t):this.subscription.unbind(this.eventFormatter.format(e)),this}stopListeningToAll(e){return e?this.subscription.unbind_global(e):this.subscription.unbind_global(),this}subscribed(e){return this.on(`pusher:subscription_succeeded`,()=>{e()}),this}error(e){return this.on(`pusher:subscription_error`,t=>{e(t)}),this}on(e,t){return this.subscription.bind(e,t),this}},d=class extends u{whisper(e,t){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,t),this}},ee=class extends u{whisper(e,t){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,t),this}},te=class extends d{here(e){return this.on(`pusher:subscription_succeeded`,t=>{e(Object.keys(t.members).map(e=>t.members[e]))}),this}joining(e){return this.on(`pusher:member_added`,t=>{e(t.info)}),this}whisper(e,t){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,t),this}leaving(e){return this.on(`pusher:member_removed`,t=>{e(t.info)}),this}},f=class extends s{constructor(e,t,n){super(),this.events={},this.listeners={},this.name=t,this.socket=e,this.options=n,this.eventFormatter=new c(this.options.namespace),this.subscribe()}subscribe(){this.socket.emit(`subscribe`,{channel:this.name,auth:this.options.auth||{}})}unsubscribe(){this.unbind(),this.socket.emit(`unsubscribe`,{channel:this.name,auth:this.options.auth||{}})}listen(e,t){return this.on(this.eventFormatter.format(e),t),this}stopListening(e,t){return this.unbindEvent(this.eventFormatter.format(e),t),this}subscribed(e){return this.on(`connect`,t=>{e(t)}),this}error(e){return this}on(e,t){return this.listeners[e]=this.listeners[e]||[],this.events[e]||(this.events[e]=(t,n)=>{this.name===t&&this.listeners[e]&&this.listeners[e].forEach(e=>e(n))},this.socket.on(e,this.events[e])),this.listeners[e].push(t),this}unbind(){Object.keys(this.events).forEach(e=>{this.unbindEvent(e)})}unbindEvent(e,t){this.listeners[e]=this.listeners[e]||[],t&&(this.listeners[e]=this.listeners[e].filter(e=>e!==t)),(!t||this.listeners[e].length===0)&&(this.events[e]&&(this.socket.removeListener(e,this.events[e]),delete this.events[e]),delete this.listeners[e])}},p=class extends f{whisper(e,t){return this.socket.emit(`client event`,{channel:this.name,event:`client-${e}`,data:t}),this}},m=class extends p{here(e){return this.on(`presence:subscribed`,t=>{e(t.map(e=>e.user_info))}),this}joining(e){return this.on(`presence:joining`,t=>e(t.user_info)),this}whisper(e,t){return this.socket.emit(`client event`,{channel:this.name,event:`client-${e}`,data:t}),this}leaving(e){return this.on(`presence:leaving`,t=>e(t.user_info)),this}},h=class extends s{subscribe(){}unsubscribe(){}listen(e,t){return this}listenToAll(e){return this}stopListening(e,t){return this}subscribed(e){return this}error(e){return this}on(e,t){return this}},g=class extends h{whisper(e,t){return this}},_=class extends h{whisper(e,t){return this}},v=class extends g{here(e){return this}joining(e){return this}whisper(e,t){return this}leaving(e){return this}},y=class e{static{this._defaultOptions={auth:{headers:{}},authEndpoint:`/broadcasting/auth`,userAuthentication:{endpoint:`/broadcasting/user-auth`,headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:`App.Events`}}constructor(e){this.setOptions(e),this.connect()}setOptions(t){this.options={...e._defaultOptions,...t,broadcaster:t.broadcaster};let n=this.csrfToken();n&&(this.options.auth.headers[`X-CSRF-TOKEN`]=n,this.options.userAuthentication.headers[`X-CSRF-TOKEN`]=n),n=this.options.bearerToken,n&&(this.options.auth.headers.Authorization=`Bearer `+n,this.options.userAuthentication.headers.Authorization=`Bearer `+n)}csrfToken(){return typeof window<`u`&&window.Laravel?.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<`u`&&typeof document.querySelector==`function`?document.querySelector(`meta[name="csrf-token"]`)?.getAttribute(`content`)??null:null}},b=class extends y{constructor(){super(...arguments),this.channels={}}connect(){if(typeof this.options.client<`u`)this.pusher=this.options.client;else if(this.options.Pusher)this.pusher=new this.options.Pusher(this.options.key,this.options);else if(typeof window<`u`&&typeof window.Pusher<`u`)this.pusher=new window.Pusher(this.options.key,this.options);else throw Error(`Pusher client not found. Should be globally available or passed via options.client`)}signin(){this.pusher.signin()}listen(e,t,n){return this.channel(e).listen(t,n)}channel(e){return this.channels[e]||(this.channels[e]=new u(this.pusher,e,this.options)),this.channels[e]}privateChannel(e){return this.channels[`private-`+e]||(this.channels[`private-`+e]=new d(this.pusher,`private-`+e,this.options)),this.channels[`private-`+e]}encryptedPrivateChannel(e){return this.channels[`private-encrypted-`+e]||(this.channels[`private-encrypted-`+e]=new ee(this.pusher,`private-encrypted-`+e,this.options)),this.channels[`private-encrypted-`+e]}presenceChannel(e){return this.channels[`presence-`+e]||(this.channels[`presence-`+e]=new te(this.pusher,`presence-`+e,this.options)),this.channels[`presence-`+e]}leave(e){[e,`private-`+e,`private-encrypted-`+e,`presence-`+e].forEach(e=>{this.leaveChannel(e)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.pusher.connection.socket_id}connectionStatus(){let e=this.pusher.connection.state;switch(e){case`connected`:case`connecting`:return e;case`failed`:case`unavailable`:return`failed`;default:return`disconnected`}}onConnectionChange(e){let t=()=>{e(this.connectionStatus())},n=[`state_change`,`connected`,`disconnected`];return n.forEach(e=>{this.pusher.connection.bind(e,t)}),()=>{n.forEach(e=>{this.pusher.connection.unbind(e,t)})}}disconnect(){this.pusher.disconnect()}},x=class extends y{constructor(){super(...arguments),this.channels={}}connect(){let e=this.getSocketIO();this.socket=e(this.options.host??void 0,this.options),this.socket.io.on(`reconnect`,()=>{Object.values(this.channels).forEach(e=>{e.subscribe()})})}getSocketIO(){if(typeof this.options.client<`u`)return this.options.client;if(typeof window<`u`&&typeof window.io<`u`)return window.io;throw Error(`Socket.io client not found. Should be globally available or passed via options.client`)}listen(e,t,n){return this.channel(e).listen(t,n)}channel(e){return this.channels[e]||(this.channels[e]=new f(this.socket,e,this.options)),this.channels[e]}privateChannel(e){return this.channels[`private-`+e]||(this.channels[`private-`+e]=new p(this.socket,`private-`+e,this.options)),this.channels[`private-`+e]}presenceChannel(e){return this.channels[`presence-`+e]||(this.channels[`presence-`+e]=new m(this.socket,`presence-`+e,this.options)),this.channels[`presence-`+e]}leave(e){[e,`private-`+e,`presence-`+e].forEach(e=>{this.leaveChannel(e)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.socket.id}connectionStatus(){return this.socket.connected?`connected`:this.socket.io._reconnecting?`reconnecting`:this.socket.id===void 0?`connecting`:`disconnected`}onConnectionChange(e){let t=()=>{e(this.connectionStatus())},n=[`connect`,`disconnect`,`connect_error`,`reconnect_attempt`,`reconnect`,`reconnect_error`,`reconnect_failed`];return n.forEach(e=>{this.socket.on(e,t)}),()=>{n.forEach(e=>{this.socket.off(e,t)})}}disconnect(){this.socket.disconnect()}},S=class extends y{constructor(){super(...arguments),this.channels={}}connect(){}listen(e,t,n){return new h}channel(e){return new h}privateChannel(e){return new g}encryptedPrivateChannel(e){return new _}presenceChannel(e){return new v}leave(e){}leaveChannel(e){}socketId(){return`fake-socket-id`}connectionStatus(){return`connected`}onConnectionChange(e){return()=>{}}disconnect(){}},ne=class{constructor(e){this.options=e,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}channel(e){return this.connector.channel(e)}connect(){if(this.options.broadcaster===`reverb`)this.connector=new b({...this.options,cluster:``});else if(this.options.broadcaster===`pusher`)this.connector=new b(this.options);else if(this.options.broadcaster===`ably`)this.connector=new b({...this.options,cluster:``,broadcaster:`pusher`});else if(this.options.broadcaster===`socket.io`)this.connector=new x(this.options);else if(this.options.broadcaster===`null`)this.connector=new S(this.options);else if(typeof this.options.broadcaster==`function`&&l(this.options.broadcaster))this.connector=new this.options.broadcaster(this.options);else throw Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.`)}disconnect(){this.connector.disconnect()}join(e){return this.connector.presenceChannel(e)}leave(e){this.connector.leave(e)}leaveChannel(e){this.connector.leaveChannel(e)}leaveAllChannels(){for(let e in this.connector.channels)this.leaveChannel(e)}
1listen(e,t,n){return this.connector.listen(e,t,n)}private(e){return this.connector.privateChannel(e)}encryptedPrivate(e){if(this.connectorSupportsEncryptedPrivateChannels(this.connector))return this.connector.encryptedPrivateChannel(e);throw Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} does not support encrypted private channels.`)}connectorSupportsEncryptedPrivateChannels(e){return e instanceof b||e instanceof S}socketId(){return this.connector.socketId()}connectionStatus(){return this.connector.connectionStatus()}registerInterceptors(){typeof Vue<`u`&&Vue?.http&&this.registerVueRequestInterceptor(),typeof axios==`function`&&this.registerAxiosRequestInterceptor(),typeof jQuery==`function`&&this.registerjQueryAjaxSetup(),typeof Turbo==`object`&&this.registerTurboRequestInterceptor()}registerVueRequestInterceptor(){Vue.http.interceptors.push((e,t)=>{this.socketId()&&e.headers.set(`X-Socket-ID`,this.socketId()),t()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(e=>(this.socketId()&&(e.headers[`X-Socket-Id`]=this.socketId()),e))}registerjQueryAjaxSetup(){typeof jQuery.ajax<`u`&&jQuery.ajaxPrefilter((e,t,n)=>{this.socketId()&&n.setRequestHeader(`X-Socket-Id`,this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener(`turbo:before-fetch-request`,e=>{e.detail.fetchOptions.headers[`X-Socket-Id`]=this.socketId()})}},C=e(t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.Pusher=r():n.Pusher=r()})(self,()=>(()=>{var e={594(e,t){var n=this&&this.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(t,"__esModule",{value:!0});var r=256,i=function(){function e(e){e===void 0&&(e=`=`),this._paddingCharacter=e}return e.prototype.encodedLength=function(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0},e.prototype.encode=function(e){for(var t=``,n=0;n<e.length-2;n+=3){var r=e[n]<<16|e[n+1]<<8|e[n+2];t+=this._encodeByte(r>>>18&63),t+=this._encodeByte(r>>>12&63),t+=this._encodeByte(r>>>6&63),t+=this._encodeByte(r>>>0&63)}var i=e.length-n;if(i>0){var r=e[n]<<16|(i===2?e[n+1]<<8:0);t+=this._encodeByte(r>>>18&63),t+=this._encodeByte(r>>>12&63),t+=i===2?this._encodeByte(r>>>6&63):this._paddingCharacter||``,t+=this._paddingCharacter||``}return t},e.prototype.maxDecodedLength=function(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0},e.prototype.decodedLength=function(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))},e.prototype.decode=function(e){if(e.length===0)return new Uint8Array;for(var t=this._getPaddingLength(e),n=e.length-t,i=new Uint8Array(this.maxDecodedLength(n)),a=0,o=0,s=0,c=0,l=0,u=0,d=0;o<n-4;o+=4)c=this._decodeChar(e.charCodeAt(o+0)),l=this._decodeChar(e.charCodeAt(o+1)),u=this._decodeChar(e.charCodeAt(o+2)),d=this._decodeChar(e.charCodeAt(o+3)),i[a++]=c<<2|l>>>4,i[a++]=l<<4|u>>>2,i[a++]=u<<6|d,s|=c&r,s|=l&r,s|=u&r,s|=d&r;if(o<n-1&&(c=this._decodeChar(e.charCodeAt(o)),l=this._decodeChar(e.charCodeAt(o+1)),i[a++]=c<<2|l>>>4,s|=c&r,s|=l&r),o<n-2&&(u=this._decodeChar(e.charCodeAt(o+2)),i[a++]=l<<4|u>>>2,s|=u&r),o<n-3&&(d=this._decodeChar(e.charCodeAt(o+3)),i[a++]=u<<6|d,s|=d&r),s!==0)throw Error(`Base64Coder: incorrect characters for decoding`);return i},e.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)},e.prototype._decodeChar=function(e){var t=r;return t+=(42-e&e-44)>>>8&-r+e-43+62,t+=(46-e&e-48)>>>8&-r+e-47+63,t+=(47-e&e-58)>>>8&-r+e-48+52,t+=(64-e&e-91)>>>8&-r+e-65+0,t+=(96-e&e-123)>>>8&-r+e-97+26,t},e.prototype._getPaddingLength=function(e){var t=0;if(this._paddingCharacter){for(var n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw Error(`Base64Coder: incorrect padding`)}return t},e}();t.Coder=i;var a=new i;function o(e){return a.encode(e)}t.encode=o;function s(e){return a.decode(e)}t.decode=s;var c=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-13,t+=62-e>>>8&49,String.fromCharCode(t)},t.prototype._decodeChar=function(e){var t=r;return t+=(44-e&e-46)>>>8&-r+e-45+62,t+=(94-e&e-96)>>>8&-r+e-95+63,t+=(47-e&e-58)>>>8&-r+e-48+52,t+=(64-e&e-91)>>>8&-r+e-65+0,t+=(96-e&e-123)>>>8&-r+e-97+26,t},t}(i);t.URLSafeCoder=c;var l=new c;function u(e){return l.encode(e)}t.encodeURLSafe=u;function d(e){return l.decode(e)}
1t.decodeURLSafe=d,t.encodedLength=function(e){return a.encodedLength(e)},t.maxDecodedLength=function(e){return a.maxDecodedLength(e)},t.decodedLength=function(e){return a.decodedLength(e)}},978(e,t){var n=`utf8: invalid source encoding`;function r(e){for(var t=[],r=0;r<e.length;r++){var i=e[r];if(i&128){var a=void 0;if(i<224){if(r>=e.length)throw Error(n);var o=e[++r];if((o&192)!=128)throw Error(n);i=(i&31)<<6|o&63,a=128}else if(i<240){if(r>=e.length-1)throw Error(n);var o=e[++r],s=e[++r];if((o&192)!=128||(s&192)!=128)throw Error(n);i=(i&15)<<12|(o&63)<<6|s&63,a=2048}else if(i<248){if(r>=e.length-2)throw Error(n);var o=e[++r],s=e[++r],c=e[++r];if((o&192)!=128||(s&192)!=128||(c&192)!=128)throw Error(n);i=(i&15)<<18|(o&63)<<12|(s&63)<<6|c&63,a=65536}else throw Error(n);if(i<a||i>=55296&&i<=57343)throw Error(n);if(i>=65536){if(i>1114111)throw Error(n);i-=65536,t.push(String.fromCharCode(55296|i>>10)),i=56320|i&1023}}t.push(String.fromCharCode(i))}return t.join(``)}t.D4=r},721(e,t,n){e.exports=n(207).default},207(e,t,n){n.d(t,{default:()=>$});class r{constructor(e,t){this.lastId=0,this.prefix=e,this.name=t}create(e){this.lastId++;var t=this.lastId,n=this.prefix+t,r=this.name+`[`+t+`]`,i=!1,a=function(){i||=(e.apply(null,arguments),!0)};return this[t]=a,{number:t,id:n,name:r,callback:a}}remove(e){delete this[e.number]}}var i=new r(`_pusher_script_`,`Pusher.ScriptReceivers`);let a={VERSION:`8.6.0`,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:``};class o{constructor(e){this.options=e,this.receivers=e.receivers||i,this.loading={}}load(e,t,n){var r=this;if(r.loading[e]&&r.loading[e].length>0)r.loading[e].push(n);else{r.loading[e]=[n];var i=X.createScriptRequest(r.getPath(e,t)),a=r.receivers.create(function(t){if(r.receivers.remove(a),r.loading[e]){var n=r.loading[e];delete r.loading[e];for(var o=function(e){e||i.cleanup()},s=0;s<n.length;s++)n[s](t,o)}});i.send(a)}}getRoot(e){var t,n=X.getDocument().location.protocol;return t=e&&e.useTLS||n===`https:`?this.options.cdn_https:this.options.cdn_http,t.replace(/\/*$/,``)+`/`+this.options.version}getPath(e,t){return this.getRoot(t)+`/`+e+this.options.suffix+`.js`}}var s=new r(`_pusher_dependencies`,`Pusher.DependenciesReceivers`),c=new o({cdn_http:a.cdn_http,cdn_https:a.cdn_https,version:a.VERSION,suffix:a.dependency_suffix,receivers:s});let l={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`}}},u={buildLogSuffix:function(e){let t=l.urls[e];if(!t)return``;let n;return t.fullUrl?n=t.fullUrl:t.path&&(n=l.baseUrl+t.path),n?`See: ${n}`:``}};var d;(function(e){e.UserAuthentication=`user-authentication`,e.ChannelAuthorization=`channel-authorization`})(d||={});class ee extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class te extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class f extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}
1class p extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class m extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class h extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class g extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class v extends Error{constructor(e,t){super(t),this.status=e,Object.setPrototypeOf(this,new.target.prototype)}}let y=function(e,t,n,r,i){let a=X.createXHR();for(var o in a.open(`POST`,n.endpoint,!0),a.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),n.headers)a.setRequestHeader(o,n.headers[o]);if(n.headersProvider!=null){let e=n.headersProvider();for(var o in e)a.setRequestHeader(o,e[o])}return a.onreadystatechange=function(){if(a.readyState===4)if(a.status===200){let e,t=!1;try{e=JSON.parse(a.responseText),t=!0}catch{i(new v(200,`JSON returned from ${r.toString()}
1 endpoint was invalid, yet status code was 200. Data was: ${a.responseText}`),null)}t&&i(null,e)}else{let e=``;switch(r){case d.UserAuthentication:e=u.buildLogSuffix(`authenticationEndpoint`);break;case d.ChannelAuthorization:e=`Clients must be authorized to join private or presence channels. ${u.buildLogSuffix(`authorizationEndpoint`)}`}i(new v(a.status,`Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${a.status} from ${n.endpoint}. ${e}`),null)}},a.send(t),a};function b(e){return se(ae(e))}for(var x=String.fromCharCode,S=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ne={},C=0,re=S.length;C<re;C++)ne[S.charAt(C)]=C;var ie=function(e){var t=e.charCodeAt(0);return t<128?e:t<2048?x(192|t>>>6)+x(128|t&63):x(224|t>>>12&15)+x(128|t>>>6&63)+x(128|t&63)},ae=function(e){return e.replace(/[^\x00-\x7F]/g,ie)},oe=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[S.charAt(n>>>18),S.charAt(n>>>12&63),t>=2?`=`:S.charAt(n>>>6&63),t>=1?`=`:S.charAt(n&63)].join(``)},se=typeof window<`u`&&window.btoa||function(e){return e.replace(/[\s\S]{1,3}/g,oe)};class w{constructor(e,t,n,r){this.clear=t,this.timer=e(()=>{this.timer&&=r(this.timer)},n)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&=(this.clear(this.timer),null)}}let T=w;function ce(e){window.clearTimeout(e)}function le(e){window.clearInterval(e)}class E extends T{constructor(e,t){super(setTimeout,ce,e,function(e){return t(),null})}}class ue extends T{constructor(e,t){super(setInterval,le,e,function(e){return t(),e})}}let D={now(){return Date.now?Date.now():new Date().valueOf()},defer(e){return new E(0,e)},method(e,...t){var n=Array.prototype.slice.call(arguments,1);return function(t){return t[e].apply(t,n.concat(arguments))}}};function O(e,...t){for(var n=0;n<t.length;n++){var r=t[n];for(var i in r)i!==`__proto__`&&i!==`constructor`&&i!==`prototype`&&(e[i]=r[i]&&r[i].c
1onstructor&&r[i].constructor===Object?O(e[i]||{},r[i]):r[i])}return e}function k(){for(var e=[`Pusher`],t=0;t<arguments.length;t++)typeof arguments[t]==`string`?e.push(arguments[t]):e.push(M(arguments[t]));return e.join(` : `)}function de(e,t){var n=Array.prototype.indexOf;if(e===null)return-1;if(n&&e.indexOf===n)return e.indexOf(t);for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}function A(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(e[n],n,e)}function fe(e){var t=[];return A(e,function(e,n){t.push(n)}),t}function pe(e){var t=[];return A(e,function(e){t.push(e)}),t}function j(e,t,n){for(var r=0;r<e.length;r++)t.call(n||window,e[r],r,e)}function me(e,t){for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r,e,n));return n}function he(e,t){var n={};return A(e,function(e,r){n[r]=t(e)}),n}function ge(e,t){t||=function(e){return!!e};for(var n=[],r=0;r<e.length;r++)t(e[r],r,e,n)&&n.push(e[r]);return n}function _e(e,t){var n={};return A(e,function(r,i){(t&&t(r,i,e,n)||r)&&(n[i]=r)}),n}function ve(e){var t=[];return A(e,function(e,n){t.push([n,e])}),t}function ye(e,t){for(var n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1}function be(e,t){for(var n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0}function xe(e){return he(e,function(e){return e===null?``:(typeof e==`object`&&(e=M(e)),encodeURIComponent(b(e.toString())))})}function Se(e){return me(ve(xe(_e(e,function(e){return e!==void 0}))),D.method(`join`,`=`)).join(`&`)}function Ce(e){var t=[],n=[];return(function e(r,i){var a,o,s;switch(typeof r){case`object`:if(!r)return null;for(a=0;a<t.length;a+=1)if(t[a]===r)return{$ref:n[a]};if(t.push(r),n.push(i),Object.prototype.toString.apply(r)===`[object Array]`)for(s=[],a=0;a<r.length;a+=1)s[a]=e(r[a],i+`[`+a+`]`);else for(o in s={},r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=e(r[o],i+`[`+JSON.stringify(o)+`]`));return s;case`number`:case`string`:case`boolean`:return r}})(e,`$`)}function M(e){try{return JSON.stringify(e)}catch{return JSON.stringify(Ce(e))}}class we{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 n=k.apply(this,arguments);$.log?$.log(n):$.logToConsole&&e.bind(this)(n)}}let N=new we,Te=function(e,t,n,r,i){(n.headers!==void 0||n.headersProvider!=null)&&N.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);var a=e.nextAuthCallbackID.toString();e.nextAuthCallbackID++;var o=e.getDocument(),s=o.createElement(`script`);e.auth_callbacks[a]=function(e){i(null,e)};var c=`Pusher.auth_callbacks['`+a+`']`;s.src=n.endpoint+`?callback=`+encodeURIComponent(c)+`&`+t;var l=o.getElementsByTagName(`head`)[0]||o.documentElement;l.insertBefore(s,l.firstChild)};class Ee{constructor(e){this.src=e}send(e){var t=this,n=`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(n)},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+`('`+n+`');`,t.script.async=t.errorScript.async=!1):t.script.async=!0;var r=document.getElementsByTagName(`head`)[0];r.insertBefore(t.script,r.firstChild),t.errorScript&&r.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 De{constructor(e,t){this.url=e,this.data=t}send(e){if(!this.request){var t=Se(this.data),n=this.url+`/`+e.number+`?`+t;this.request=X.createScriptRequest(n),this.request.send(e)}}cleanup(){this.request&&this.request.cleanup()}}let Oe={name:`jsonp`,getAgent:function(e,t){return function(n,r){var a=`http`+(t?`s`:``)+`://`+(e.host||e.options.host)+e.options.path,o=X.createJSONPRequest(a,n),s=X.ScriptReceivers.create(function(t,n){i.remove(s),o.cleanup(),n&&n.host&&(e.host=n.host),r&&r(t,n)});o.send(s)}}};function P(e,t,n){var r=e+(t.useTLS?`s`:``),i=t.useTLS?t.hostTLS:t.hostNonTLS;return r+`://`+i+n}function F(e,t){return`/app/`+e+(`?protocol=`+a.PROTOCOL+`&client=js&ver
1sion=`+a.VERSION+(t?`&`+t:``))}var ke={getInitial:function(e,t){return P(`ws`,t,(t.httpPath||``)+F(e,`flash=false`))}},Ae={getInitial:function(e,t){return P(`http`,t,(t.httpPath||`/pusher`)+F(e))}},je={getInitial:function(e,t){return P(`http`,t,t.httpPath||`/pusher`)},getPath:function(e,t){return F(e)}};class Me{constructor(){this._callbacks={}}get(e){return this._callbacks[I(e)]}add(e,t,n){var r=I(e);this._callbacks[r]=this._callbacks[r]||[],this._callbacks[r].push({fn:t,context:n})}remove(e,t,n){if(!e&&!t&&!n){this._callbacks={};return}var r=e?[I(e)]:fe(this._callbacks);t||n?this.removeCallback(r,t,n):this.removeAllCallbacks(r)}removeCallback(e,t,n){j(e,function(e){this._callbacks[e]=ge(this._callbacks[e]||[],function(e){return t&&t!==e.fn||n&&n!==e.context}),this._callbacks[e].length===0&&delete this._callbacks[e]},this)}removeAllCallbacks(e){j(e,function(e){delete this._callbacks[e]},this)}}function I(e){return`_`+e}class L{constructor(e){this.callbacks=new Me,this.global_callbacks=[],this.failThrough=e}bind(e,t,n){return this.callbacks.add(e,t,n),this}bind_global(e){return this.global_callbacks.push(e),this}unbind(e,t,n){return this.callbacks.remove(e,t,n),this}unbind_global(e){return e?(this.global_callbacks=ge(this.global_callbacks||[],t=>t!==e),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(e,t,n){for(var r=0;r<this.global_callbacks.length;r++)this.global_callbacks[r](e,t);var i=this.callbacks.get(e),a=[];if(n?a.push(t,n):t&&a.push(t),i&&i.length>0)for(var r=0;r<i.length;r++)i[r].fn.apply(i[r].context||window,a);else this.failThrough&&this.failThrough(e,t);return this}}class Ne extends L{constructor(e,t,n,r,i){super(),this.initialize=X.transportConnectionInitializer,this.hooks=e,this.name=t,this.priority=n,this.key=r,this.options=i,this.state=`new`,this.timeline=i.timeline,this.activityTimeout=i.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(e){return D.defer(()=>{this.onError(e),this.changeState(`closed`)}),!1}return this.bindListeners(),N.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`&&(D.defer(()=>{this.socket&&this.socket.send(e)}),!0)}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 O({cid:this.id},e)}}class R{constructor(e){this.hooks=e}isSupported(e){return this.hooks.isSupported(e)}createConnection(e,t,n,r){return new Ne(this.hooks,e,t,n,r)}}var Pe=new R({urls:ke,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!X.getWebSocketAPI()},isSupported:function(){return!!X.getWebSocketAPI()},getSocket:function(e){return X.createWebSocket(e)}}),Fe={urls:Ae,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Ie=O({getSocket:function(e){return X.HTTPFactory.createStreamingSocket(e)}},Fe),Le=O({getSocket:function(e){return X.HTTPFactory.createPollingSocket(e)}},Fe),Re={isSupported:function(){return X.isXHRSupported()}};let z={ws:Pe,xhr_streaming:new R(O({},Ie,Re)),xhr_polling:new R(O({},Le,Re))};var ze=new R({file:`sockjs`,urls:je,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(e,t){return new window.SockJS(e,null,{js_path:c.getPath(`sockjs`,{useTLS:t.useTLS}),ignore_null_origin:t.ignoreNullOrigin})},beforeOpen:function(e,t){e.send(JSON.stringify({path:t}))}}),Be={isSupported:function(e){return X.isXDRSupported(e.useTLS)}},Ve=new R(O({},Ie,Be)),He=new R(O({},Le,Be));z.xdr_streaming=Ve,z.xdr_polling=He,z.sockjs=ze;let Ue=z;class We extends L{constructor(){super();var e=this;typeof window<`u`&&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||window.navigator.onLine}}var Ge=new We;class Ke{constructor(e,t,n){this.manager=e,this.transport=t,this.minPingDelay=n.minPingDelay,this.maxPingDelay=n.maxPingDelay,this.pingDelay=void 0}createConnection(e,t,n,r){r=O({},r,{activityTimeout:this.pingDelay});var i=this.transport.createConnection(e,t,n,r),a=null,o=function(){i.unbind(`open`,o),i.bind(`closed`,s),a=D.now()},s=e=>{if(i.unbind(`closed`,s),e.code===1002||e.code===1003)this.manager.reportDeath();else if(!e.wasClean&&a){var t=D.now()-a;t<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(t/2,this.minPingDelay))}};return i.bind(`open`,o),i}isSupported(e){return this.manager.isAlive()&&this.transport.isSupported(e)}}let qe={decodeMessage:function(e){try{var t=JSON.parse(e.data),n=t.data;if(typeof n==`string`)try{n=JSON.parse(t.data)}catch{}var r={event:t.event,channel:t.channel,data:n};return t.user_id&&(r.user_id=t.user_id),r}catch(t){throw{type:`MessageParseError`,error:t,data:e.data}}},encodeMessage:function(e){return JSON.stringify(e)},processHandshake:function(e){var t=qe.decodeMessage(e);if(t.event===`pusher:connection_established`){if(!t.data.activity_timeout)throw`No activity timeout specified in handshake`;return{action:`connected`,id:t.data.socket_id,activityTimeout:t.data.activity_timeout*1e3}}if(t.event===`pusher:error`)return{action:this.getCloseAction(t.data),error:this.getCloseError(t.data)};throw`Invalid handshake`},getCloseAction:function(e){return e.code<4e3?e.code>=1002&&e.code<=1004?`backoff`:null:e.code===4e3?`tls_only`:e.code<4100?`refused`:e.code<4200?`backoff`:e.code<4300?`retry`:`refused`},getCloseError:function(e){return e.code!==1e3&&e.code!==1001?{type:`PusherError`,data:{code:e.code,message:e.reason||e.message}}:null}},B=qe;class Je extends L{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,n){var r={event:e,data:t};return n&&(r.channel=n),N.debug(`Event sent`,r),this.send(B.encodeMessage(r))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event(`pusher:ping`,{})}close(){this.transport.close()}bindListeners(){var e={message:e=>{var t;try{t=B.decodeMessage(e)}
1catch(t){this.emit(`error`,{type:`MessageParseError`,error:t,data:e.data})}if(t!==void 0){switch(N.debug(`Event recd`,t),t.event){case`pusher:error`:this.emit(`error`,{type:`PusherError`,data:t.data});break;case`pusher:ping`:this.emit(`ping`);break;case`pusher:pong`:this.emit(`pong`)}this.emit(`message`,t)}},activity:()=>{this.emit(`activity`)},error:e=>{this.emit(`error`,e)},closed:e=>{t(),e&&e.code&&this.handleCloseEvent(e),this.transport=null,this.emit(`closed`)}},t=()=>{A(e,(e,t)=>{this.transport.unbind(t,e)})};A(e,(e,t)=>{this.transport.bind(t,e)})}handleCloseEvent(e){var t=B.getCloseAction(e),n=B.getCloseError(e);n&&this.emit(`error`,n),t&&this.emit(t,{action:t,error:n})}}class Ye{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=B.processHandshake(e)}catch(e){this.finish(`error`,{error:e}),this.transport.close();return}t.action===`connected`?this.finish(`connected`,{connection:new Je(t.id,this.transport),activityTimeout:t.activityTimeout}):(this.finish(t.action,{error:t.error}),this.transport.close())},this.onClosed=e=>{this.unbindListeners();var t=B.getCloseAction(e)||`backoff`,n=B.getCloseError(e);this.finish(t,{error:n})},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(O({transport:this.transport,action:e},t))}}class Xe{constructor(e,t){this.timeline=e,this.options=t||{}}send(e,t){this.timeline.isEmpty()||this.timeline.send(X.TimelineTransport.getAgent(this,e),t)}}class V extends L{constructor(e,t){super(function(t,n){N.debug(`No callbacks on `+e+` for `+t)}),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 ee(`Event '`+e+`' does not start with 'client-'`);if(!this.subscribed){var n=u.buildLogSuffix(`triggeringClientEvents`);N.warn(`Client event triggered before channel 'subscription_succeeded' event . ${n}`)}return this.pusher.send_event(e,t,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(e){var t=e.event,n=e.data;t===`pusher_internal:subscription_succeeded`?this.handleSubscriptionSucceededEvent(e):t===`pusher_internal:subscription_count`?this.handleSubscriptionCountEvent(e):t.indexOf(`pusher_internal:`)!==0&&this.emit(t,n,{})}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,N.error(e.toString()),this.emit(`pusher:subscription_error`,Object.assign({},{type:`AuthError`,error:e.message},e instanceof v?{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 H extends V{authorize(e,t){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:e},t)}}class Ze{constructor(){this.reset()}get(e){return Object.prototype.hasOwnProperty.call(this.members,e)?{id:e,info:this.members[e]}:null}each(e){A(this.members,(t,n)=>{e(this.get(n))})}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 Qe=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};class $e extends H{constructor(e,t){super(e,t),this.members=new Ze}authorize(e,t){super.authorize(e,(e,n)=>Qe(this,void 0,void 0,function*(){if(!e)if(n=n,n.channel_data!=null){var r=JSON.parse(n.channel_data);this.members.setMyID(r.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 e=u.buildLogSuffix(`authorizationEndpoint`);N.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${e}, or the user should be signed in.`),t(`Invalid auth response`);return}t(e,n)}))}handleEvent(e){var t=e.event;if(t.indexOf(`pusher_internal:`)===0)this.handleInternalEvent(e);else{var n=e.data,r={};
1e.user_id&&(r.user_id=e.user_id),this.emit(t,n,r)}}handleInternalEvent(e){var t=e.event,n=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 r=this.members.addMember(n);this.emit(`pusher:member_added`,r);break;case`pusher_internal:member_removed`:var i=this.members.removeMember(n);i&&this.emit(`pusher:member_removed`,i)}}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 et=n(978),U=n(594);class tt extends H{constructor(e,t,n){super(e,t),this.key=null,this.nacl=n}authorize(e,t){super.authorize(e,(e,n)=>{if(e){t(e,n);return}let r=n.shared_secret;if(!r){t(Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,U.decode)(r),delete n.shared_secret,t(null,n)})}trigger(e,t){throw new h(`Client events are not currently supported for encrypted channels`)}handleEvent(e){var t=e.event,n=e.data;if(t.indexOf(`pusher_internal:`)===0||t.indexOf(`pusher:`)===0){super.handleEvent(e);return}this.handleEncryptedEvent(t,n)}handleEncryptedEvent(e,t){if(!this.key){N.debug(`Received encrypted event before key has been retrieved from the authEndpoint`);return}if(!t.ciphertext||!t.nonce){N.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+t);return}let n=(0,U.decode)(t.ciphertext);if(n.length<this.nacl.secretbox.overheadLength){N.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${n.length}`);return}let r=(0,U.decode)(t.nonce);if(r.length<this.nacl.secretbox.nonceLength){N.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${r.length}`);return}let i=this.nacl.secretbox.open(n,r,this.key);if(i===null){N.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,(t,a)=>{if(t){N.error(`Failed to make a request to the authEndpoint: ${a}. Unable to fetch new key, so dropping encrypted event`);return}if(i=this.nacl.secretbox.open(n,r,this.key),i===null){N.error(`Failed to decrypt event with new key. Dropping encrypted event`);return}this.emit(e,this.getDataToEmit(i))});return}this.emit(e,this.getDataToEmit(i))}getDataToEmit(e){let t=(0,et.D4)(e);try{return JSON.parse(t)}catch{return t}}}class nt extends L{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 n=X.getNetwork();n.bind(`online`,()=>{this.timeline.info({netinfo:`online`}),(this.state===`connecting`||this.state===`unavailable`)&&this.retryIn(0)}),n.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,n){return this.connection?this.connection.send_event(e,t,n):!1}disconnect(){this.disconnectInternally(),this.updateState(`disconnected`)}isUsingTLS(){return this.usingTLS}startConnecting(){var e=(t,n)=>{t?this.runner=this.strategy.connect(0,e):n.action===`error`?(this.emit
1(`error`,{type:`HandshakeError`,error:n.error}),this.timeline.error({handshakeError:n.error})):(this.abortConnecting(),this.handshakeCallbacks[n.action](n))};this.runner=this.strategy.connect(0,e)}abortConnecting(){this.runner&&=(this.runner.abort(),null)}disconnectInternally(){this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection&&this.abandonConnection().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 E(e||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&=(this.retryTimer.ensureAborted(),null)}setUnavailableTimer(){this.unavailableTimer=new E(this.options.unavailableTimeout,()=>{this.updateState(`unavailable`)})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new E(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 E(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(e){return O({},e,{message:e=>{this.resetActivityCheck(),this.emit(`message`,e)},ping:()=>{this.send_event(`pusher:pong`,{})},activity:()=>{this.resetActivityCheck()},error:e=>{this.emit(`error`,e)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(e){return O({},e,{connected:e=>{this.activityTimeout=Math.min(this.options.activityTimeout,e.activityTimeout,e.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(e.connection),this.socket_id=this.connection.id,this.updateState(`connected`,{socket_id:this.socket_id})}})}buildErrorCallbacks(){let e=e=>t=>{t.error&&this.emit(`error`,{type:`WebSocketError`,error:t.error}),e(t)};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){for(var t in this.connection=e,this.connectionCallbacks)this.connection.bind(t,this.connectionCallbacks[t]);this.resetActivityCheck()}abandonConnection(){if(this.connection){for(var e in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(e,this.connectionCallbacks[e]);var t=this.connection;return this.connection=null,t}}updateState(e,t){var n=this.state;if(this.state=e,n!==e){var r=e;r===`connected`&&(r+=` with new socket ID `+t.socket_id),N.debug(`State changed`,n+` -> `+r),this.timeline.info({state:e,params:t}),this.emit(`state_change`,{previous:n,current:e}),this.emit(e,t)}}shouldRetry(){return this.state===`connecting`||this.state===`connected`}}class rt{constructor(){this.channels={}}add(e,t){return this.channels[e]||(this.channels[e]=it(e,t)),this.channels[e]}all(){return pe(this.channels)}find(e){return this.channels[e]}remove(e){var t=this.channels[e];return delete this.channels[e],t}disconnect(){A(this.channels,function(e){e.disconnect()})}}function it(e,t){if(e.indexOf(`private-encrypted-`)===0){if(t.config.nacl)return W.createEncryptedChannel(e,t,t.config.nacl);let n=u.buildLogSuffix(`encryptedChannelSupport`);throw new h(`Tried to subscribe to a private-encrypted- channel but no nacl implementation available. ${n}`)}if(e.indexOf(`private-`)===0)return W.createPrivateChannel(e,t);if(e.indexOf(`presence-`)===0)return W.createPresenceChannel(e,t);if(e.indexOf(`#`)===0)throw new te(`Cannot create a channel with name "`+e+`".`);return W.createChannel(e,t)}let W={createChannels(){return new rt},createConnectionManager(e,t){return new nt(e,t)},createChannel(e,t){return new V(e,t)},createPrivateChannel(e,t){return new H(e,t)},createPresenceChannel(e,t){return new $e(e,t)}
1,createEncryptedChannel(e,t,n){return new tt(e,t,n)},createTimelineSender(e,t){return new Xe(e,t)},createHandshake(e,t){return new Ye(e,t)},createAssistantToTheTransportManager(e,t,n){return new Ke(e,t,n)}};class at{constructor(e){this.options=e||{},this.livesLeft=this.options.lives||1/0}getAssistant(e){return W.createAssistantToTheTransportManager(this,e,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){--this.livesLeft}}class G{constructor(e,t){this.strategies=e,this.loop=!!t.loop,this.failFast=!!t.failFast,this.timeout=t.timeout,this.timeoutLimit=t.timeoutLimit}isSupported(){return ye(this.strategies,D.method(`isSupported`))}connect(e,t){var n=this.strategies,r=0,i=this.timeout,a=null,o=(s,c)=>{c?t(null,c):(r+=1,this.loop&&(r%=n.length),r<n.length?(i&&(i*=2,this.timeoutLimit&&(i=Math.min(i,this.timeoutLimit))),a=this.tryStrategy(n[r],e,{timeout:i,failFast:this.failFast},o)):t(!0))};return a=this.tryStrategy(n[r],e,{timeout:i,failFast:this.failFast},o),{abort:function(){a.abort()},forceMinPriority:function(t){e=t,a&&a.forceMinPriority(t)}}}tryStrategy(e,t,n,r){var i=null,a=null;return n.timeout>0&&(i=new E(n.timeout,function(){a.abort(),r(!0)})),a=e.connect(t,function(e,t){e&&i&&i.isRunning()&&!n.failFast||(i&&i.ensureAborted(),r(e,t))}),{abort:function(){i&&i.ensureAborted(),a.abort()},forceMinPriority:function(e){a.forceMinPriority(e)}}}}class ot{constructor(e){this.strategies=e}isSupported(){return ye(this.strategies,D.method(`isSupported`))}connect(e,t){return st(this.strategies,e,function(e,n){return function(r,i){if(n[e].error=r,r){ct(n)&&t(!0);return}j(n,function(e){e.forceMinPriority(i.transport.priority)}),t(null,i)}})}}function st(e,t,n){var r=me(e,function(e,r,i,a){return e.connect(t,n(r,a))});return{abort:function(){j(r,lt)},forceMinPriority:function(e){j(r,function(t){t.forceMinPriority(e)})}}}function ct(e){return be(e,function(e){return!!e.error})}function lt(e){!e.error&&!e.aborted&&(e.abort(),e.aborted=!0)}class ut{constructor(e,t,n){this.strategy=e,this.transports=t,this.ttl=n.ttl||18e5,this.usingTLS=n.useTLS,this.timeline=n.timeline}isSupported(){return this.strategy.isSupported()}connect(e,t){var n=this.usingTLS,r=ft(n),i=r&&r.cacheSkipCount?r.cacheSkipCount:0,a=[this.strategy];if(r&&r.timestamp+this.ttl>=D.now()){var o=this.transports[r.transport];o&&([`ws`,`wss`].includes(r.transport)||i>3?(this.timeline.info({cached:!0,transport:r.transport,latency:r.latency}),a.push(new G([o],{timeout:r.latency*2+1e3,failFast:!0}))):i++)}var s=D.now(),c=a.pop().connect(e,function r(o,l){o?(mt(n),a.length>0?(s=D.now(),c=a.pop().connect(e,r)):t(o)):(pt(n,l.transport.name,D.now()-s,i),t(null,l))});return{abort:function(){c.abort()},forceMinPriority:function(t){e=t,c&&c.forceMinPriority(t)}}}}function dt(e){return`pusherTransport`+(e?`TLS`:`NonTLS`)}function ft(e){var t=X.getLocalStorage();if(t)try{var n=t[dt(e)];if(n)return JSON.parse(n)}catch{mt(e)}return null}function pt(e,t,n,r){var i=X.getLocalStorage();if(i)try{i[dt(e)]=M({timestamp:D.now(),transport:t,latency:n,cacheSkipCount:r})}catch{}}function mt(e){var t=X.getLocalStorage();if(t)try{delete t[dt(e)]}catch{}}class K{constructor(e,{delay:t}){this.strategy=e,this.options={delay:t}}isSupported(){return this.strategy.isSupported()}connect(e,t){var n=this.strategy,r,i=new E(this.options.delay,function(){r=n.connect(e,t)});return{abort:function(){i.ensureAborted(),r&&r.abort()},forceMinPriority:function(t){e=t,r&&r.forceMinPriority(t)}}}}class q{constructor(e,t,n){this.test=e,this.trueBranch=t,this.falseBranch=n}isSupported(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()}connect(e,t){return(this.test()?this.trueBranch:this.falseBranch).connect(e,t)}}class ht{constructor(e){this.strategy=e}isSupported(){return this.strategy.isSupported()}connect(e,t){var n=this.strategy.connect(e,function(e,r){r&&n.abort(),t(e,r)});return n}}function J(e){return function(){return e.isSupported()}}let gt=function(e,t,n){var r={};function i(t,i,a,o,s){var c=n(e,t,i,a,o,s);return r[t]=c,c}var a=Object.assign({},t,{hostNonTLS:e.wsHost+`:`+e.wsPort,hostTLS:e.wsHost+`:`+e.wssPort,httpPath:e.wsPath}),o=Object.assign({},a,{useTLS:!0}),s=Object.assign({},t,{hostNonTLS:e.httpHost+`:`+e.httpPort,hostTLS:e.httpHost+`:`+e.httpsPort,httpPath:e.httpPath}),c={loop:!0,timeout:15e3,timeoutLimit:6e4},l=new at({minPingDelay:1e4,maxPingDelay:e.activityTimeout}),u=new at({lives:2,minPingDelay:1e4,maxPingDelay:e.activityTimeout}),d=i(`ws`,`ws`,3,a,l),ee=i(`wss`,`ws`,3,o,l),te=i(`sockjs`,`sockjs`,1,s),f=i(`xhr_streaming`,`xhr_streaming`,1,s,u),p=i(`xdr_streaming`,`xdr_streaming`,1,s,u),m=i(`xhr_polling`,`xhr_polling`,1,s),h=i(`xdr_polling`,`xdr_polling`,1,s),g=new G([d],c),_=new G([ee],c),v=new G([te],c),y=new G([new q(J(f),f,p)],c),b=new G([new q(J(m),m,h)],c),x=new G([new q(J(y),new ot([y,new K(b,{delay:4e3})]),b)],c),S=new q(J(x),x,v),ne=t.useTLS?new ot([g,new K(S,{delay:2e3})]):new ot([g,new K(_,{delay:2e3}),new K(S,{delay:5e3})]);return new ut(new ht(new q(J(d),ne,S)),r,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})};function _t(){var e=this;e.timeline.info(e.buildTimelineMessage({transport:e.name+(e.options.useTLS?`s`:``)})),e.hooks.isInitialized()?e.changeState(`initialized`):e.hooks.file?(e.changeState(`initializing`),c.load(e.hooks.file,{useTLS:e.options.useTLS},function(t,n){e.hooks.isInitialized()?(e.changeState(`initialized`),n(!0)):(t&&e.onError(t),e.onClose(),n(!1))})):e.onClose()}let vt={getRequest:function(e){var t=new window.XDomainRequest;
1return t.ontimeout=function(){e.emit(`error`,new f),e.close()},t.onerror=function(t){e.emit(`error`,t),e.close()},t.onprogress=function(){t.responseText&&t.responseText.length>0&&e.onChunk(200,t.responseText)},t.onload=function(){t.responseText&&t.responseText.length>0&&e.onChunk(200,t.responseText),e.emit(`finished`,200),e.close()},t},abortRequest:function(e){e.ontimeout=e.onerror=e.onprogress=e.onload=null,e.abort()}};class yt extends L{constructor(e,t,n){super(),this.hooks=e,this.method=t,this.url=n}start(e){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},X.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&&=(X.removeUnloadListener(this.unloader),null),this.xhr&&=(this.hooks.abortRequest(this.xhr),null)}onChunk(e,t){for(;;){var n=this.advanceBuffer(t);if(n)this.emit(`chunk`,{status:e,data:n});else break}this.isBufferTooLong(t)&&this.emit(`buffer_too_long`)}advanceBuffer(e){var t=e.slice(this.position),n=t.indexOf(`
2`);return n===-1?null:(this.position+=n+1,t.slice(0,n))}isBufferTooLong(e){return this.position===e.length&&e.length>262144}}var bt;(function(e){e[e.CONNECTING=0]=`CONNECTING`,e[e.OPEN=1]=`OPEN`,e[e.CLOSED=3]=`CLOSED`})(bt||={});let Y=bt;var xt=1;class St{constructor(e,t){this.hooks=e,this.session=Dt(1e3)+`/`+Ot(8),this.location=Ct(t),this.readyState=Y.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===Y.OPEN)try{return X.createSocketRequest(`POST`,Tt(wt(this.location,this.session))).start(e),!0}catch{return!1}return!1}reconnect(){this.closeStream(),this.openStream()}onClose(e,t,n){this.closeStream(),this.readyState=Y.CLOSED,this.onclose&&this.onclose({code:e,reason:t,wasClean:n})}onChunk(e){if(e.status===200){this.readyState===Y.OPEN&&this.onActivity();var t;switch(e.data.slice(0,1)){case`o`:t=JSON.parse(e.data.slice(1)||`{}`),this.onOpen(t);break;case`a`:t=JSON.parse(e.data.slice(1)||`[]`);for(var n=0;n<t.length;n++)this.onEvent(t[n]);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)}}}onOpen(e){this.readyState===Y.CONNECTING?(e&&e.hostname&&(this.location.base=Et(this.location.base,e.hostname)),this.readyState=Y.OPEN,this.onopen&&this.onopen()):this.onClose(1006,`Server lost session`,!0)}onEvent(e){this.readyState===Y.OPEN&&this.onmessage&&this.onmessage({data:e})}onActivity(){this.onactivity&&this.onactivity()}onError(e){this.onerror&&this.onerror(e)}openStream(){this.stream=X.createSocketRequest(`POST`,Tt(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){D.defer(()=>{this.onError(e),this.onClose(1006,`Could not start streaming`,!1)})}}closeStream(){this.stream&&=(this.stream.unbind_all(),this.stream.close(),null)}}function Ct(e){var t=/([^\?]*)\/*(\??.*)/.exec(e);return{base:t[1],queryString:t[2]}}function wt(e,t){return e.base+`/`+t+`/xhr_send`}function Tt(e){return e+(e.indexOf(`?`)===-1?`?`:`&`)+`t=`+ +new Date+`&n=`+xt++}function Et(e,t){var n=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(e);return n[1]+t+n[3]}function Dt(e){return X.randomInt(e)}function Ot(e){for(var t=[],n=0;n<e;n++)t.push(Dt(32).toString(32));return t.join(``)}let kt=St,At={getReceiveURL:function(e,t){return e.base+`/`+t+`/xhr_streaming`+e.queryString},onHeartbeat:function(e){e.sendRaw(`[]`)},sendHeartbeat:function(e){e.sendRaw(`[]`)},onFinished:function(e,t){e.onClose(1006,`Connection interrupted (`+t+`)`,!1)}},jt={getReceiveURL:function(e,t){return e.base+`/`+t+`/xhr`+e.queryString},onHeartbeat:function(){},sendHeartbeat:function(e){e.sendRaw(`[]`)},onFinished:function(e,t){t===200?e.reconnect():e.onClose(1006,`Connection interrupted (`+t+`)`,!1)}},Mt={getRequest:function(e){var t=new(X.getXHRAPI());return t.onreadystatechange=t.onprogress=function(){switch(t.readyState){case 3:t.responseText&&t.responseText.length>0&&e.onChunk(t.status,t.responseText);break;case 4:t.responseText&&t.responseText.length>0&&e.onChunk(t.status,t.responseText),e.emit(`finished`,t.status),e.close()}},t},abortRequest:function(e){e.onreadystatechange=null,e.abort()}},Nt={createStreamingSocket(e){return this.createSocket(At,e)},createPollingSocket(e){return this.createSocket(jt,e)},createSocket(e,t){return new kt(e,t)},createXHR(e,t){return this.createRequest(Mt,e,t)},createRequest(e,t,n){return new yt(e,t,n)}};Nt.createXDR=function(e,t){return this.createRequest(vt,e,t)};let X={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:i,DependenciesReceivers:s,getDefaultStrategy:gt,Transports:Ue,transportConnectionInitializer:_t,HTTPFactory:Nt,TimelineTransport:Oe,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(e){if(typeof window<`u`){window.Pusher=e;var t=()=>{this.onDocumentBody(e.ready)};window.JSON?t():c.load(`json2`,{},t)}},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:y,jsonp:Te}},onDocumentBody(e){document.body?e():setTimeout(()=>{this.onDocumentBody(e)},0)},createJSONPRequest(e,t){return new De(e,t)},createScriptRequest(e){return new Ee(e)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){return new(this.getXHRAPI())},createMicrosoftXHR(){return new ActiveXObject(`Microsoft.XMLHTTP`)},getNetwork(){return Ge},createWebSocket(e){return new(this.getWebSocketAPI())(e)}
2,createSocketRequest(e,t){if(this.isXHRSupported())return this.HTTPFactory.createXHR(e,t);if(this.isXDRSupported(t.indexOf(`https:`)===0))return this.HTTPFactory.createXDR(e,t);throw`Cross-origin HTTP requests are not supported`},isXHRSupported(){var e=this.getXHRAPI();return!!e&&new e().withCredentials!==void 0},isXDRSupported(e){var t=e?`https:`:`http:`,n=this.getProtocol();return!!window.XDomainRequest&&n===t},addUnloadListener(e){window.addEventListener===void 0?window.attachEvent!==void 0&&window.attachEvent(`onunload`,e):window.addEventListener(`pagehide`,e,!1)},removeUnloadListener(e){window.addEventListener===void 0?window.detachEvent!==void 0&&window.detachEvent(`onunload`,e):window.removeEventListener(`pagehide`,e,!1)},randomInt(e){let t=window.crypto||window.msCrypto,n=Math.floor(2**32/e)*e,r;do r=t.getRandomValues(new Uint32Array(1))[0];while(r>=n);return r%e}};var Pt;(function(e){e[e.ERROR=3]=`ERROR`,e[e.INFO=6]=`INFO`,e[e.DEBUG=7]=`DEBUG`})(Pt||={});let Z=Pt;class Ft{constructor(e,t,n){this.key=e,this.session=t,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}log(e,t){e<=this.options.level&&(this.events.push(O({},t,{timestamp:D.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(e){this.log(Z.ERROR,e)}info(e){this.log(Z.INFO,e)}debug(e){this.log(Z.DEBUG,e)}isEmpty(){return this.events.length===0}send(e,t){var n=O({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(n,(e,n)=>{e||this.sent++,t&&t(e,n)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class It{constructor(e,t,n,r){this.name=e,this.priority=t,this.transport=n,this.options=r||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(e,t){if(!this.isSupported())return Lt(new _,t);if(this.priority<e)return Lt(new p,t);var n=!1,r=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),i=null,a=function(){r.unbind(`initialized`,a),r.connect()},o=function(){i=W.createHandshake(r,function(e){n=!0,l(),t(null,e)})},s=function(e){l(),t(e)},c=function(){l();var e=M(r);t(new m(e))},l=function(){r.unbind(`initialized`,a),r.unbind(`open`,o),r.unbind(`error`,s),r.unbind(`closed`,c)};return r.bind(`initialized`,a),r.bind(`open`,o),r.bind(`error`,s),r.bind(`closed`,c),r.initialize(),{abort:()=>{n||(l(),i?i.close():r.close())},forceMinPriority:e=>{n||this.priority<e&&(i?i.close():r.close())}}}}function Lt(e,t){return D.defer(function(){t(e)}),{abort:function(){},forceMinPriority:function(){}}}let{Transports:Rt}=X;var zt=function(e,t,n,r,i,a){var o=Rt[n];if(!o)throw new g(n);var s=(!e.enabledTransports||de(e.enabledTransports,t)!==-1)&&(!e.disabledTransports||de(e.disabledTransports,t)===-1),c;return s?(i=Object.assign({ignoreNullOrigin:e.ignoreNullOrigin},i),c=new It(t,r,a?a.getAssistant(o):o,i)):c=Bt,c},Bt={isSupported:function(){return!1},connect:function(e,t){var n=D.defer(function(){t(new _)});return{abort:function(){n.ensureAborted()},forceMinPriority:function(){}}}};function Vt(e){if(e==null)throw`You must pass an options object`;if(e.cluster==null)throw`Options object must provide a cluster`;`disableStats`in e&&N.warn(`The disableStats option is deprecated in favor of enableStats`)}let Ht=(e,t)=>{var n=`socket_id=`+encodeURIComponent(e.socketId);for(var r in t.params)n+=`&`+encodeURIComponent(r)+`=`+encodeURIComponent(t.params[r]);if(t.paramsProvider!=null){let e=t.paramsProvider();for(var r in e)n+=`&`+encodeURIComponent(r)+`=`+encodeURIComponent(e[r])}return n},Ut=e=>{if(X.getAuthorizers()[e.transport]===void 0)throw`'${e.transport}' is not a recognized auth transport`;return(t,n)=>{let r=Ht(t,e);X.getAuthorizers()[e.transport](X,r,e,d.UserAuthentication,n)}},Wt=(e,t)=>{var n=`socket_id=`+encodeURIComponent(e.socketId);for(var r in n+=`&channel_name=`+encodeURIComponent(e.channelName),t.params)n+=`&`+encodeURIComponent(r)+`=`+encodeURIComponent(t.params[r]);if(t.paramsProvider!=null){let e=t.paramsProvider();for(var r in e)n+=`&`+encodeURIComponent(r)+`=`+encodeURIComponent(e[r])}return n},Gt=e=>{if(X.getAuthorizers()[e.transport]===void 0)throw`'${e.transport}' is not a recognized auth transport`;return(t,n)=>{let r=Wt(t,e);X.getAuthorizers()[e.transport](X,r,e,d.ChannelAuthorization,n)}}
2,Kt=(e,t,n)=>{let r={authTransport:t.transport,authEndpoint:t.endpoint,auth:{params:t.params,headers:t.headers}};return(t,i)=>{n(e.channel(t.channelName),r).authorize(t.socketId,i)}};function qt(e,t){let n={activityTimeout:e.activityTimeout||a.activityTimeout,cluster:e.cluster,httpPath:e.httpPath||a.httpPath,httpPort:e.httpPort||a.httpPort,httpsPort:e.httpsPort||a.httpsPort,pongTimeout:e.pongTimeout||a.pongTimeout,statsHost:e.statsHost||a.stats_host,unavailableTimeout:e.unavailableTimeout||a.unavailableTimeout,wsPath:e.wsPath||a.wsPath,wsPort:e.wsPort||a.wsPort,wssPort:e.wssPort||a.wssPort,enableStats:Qt(e),httpHost:Jt(e),useTLS:Zt(e),wsHost:Yt(e),userAuthenticator:en(e),channelAuthorizer:nn(e,t)};return`disabledTransports`in e&&(n.disabledTransports=e.disabledTransports),`enabledTransports`in e&&(n.enabledTransports=e.enabledTransports),`ignoreNullOrigin`in e&&(n.ignoreNullOrigin=e.ignoreNullOrigin),`timelineParams`in e&&(n.timelineParams=e.timelineParams),`nacl`in e&&(n.nacl=e.nacl),n}function Jt(e){return e.httpHost?e.httpHost:e.cluster?`sockjs-${e.cluster}.pusher.com`:a.httpHost}function Yt(e){return e.wsHost?e.wsHost:Xt(e.cluster)}function Xt(e){return`ws-${e}.pusher.com`}function Zt(e){return X.getProtocol()===`https:`||e.forceTLS!==!1}function Qt(e){return`enableStats`in e?e.enableStats:`disableStats`in e&&!e.disableStats}let $t=e=>`customHandler`in e&&e.customHandler!=null;function en(e){let t=Object.assign(Object.assign({},a.userAuthentication),e.userAuthentication);return $t(t)?t.customHandler:Ut(t)}function tn(e,t){let n;return`channelAuthorization`in e?n=Object.assign(Object.assign({},a.channelAuthorization),e.channelAuthorization):(n={transport:e.authTransport||a.authTransport,endpoint:e.authEndpoint||a.authEndpoint},`auth`in e&&(`params`in e.auth&&(n.params=e.auth.params),`headers`in e.auth&&(n.headers=e.auth.headers)),`authorizer`in e&&(n.customHandler=Kt(t,n,e.authorizer))),n}function nn(e,t){let n=tn(e,t);return $t(n)?n.customHandler:Gt(n)}class rn extends L{constructor(e){super(function(e,t){N.debug(`No callbacks on watchlist events for ${e}`)}),this.pusher=e,this.bindWatchlistInternalEvent()}handleEvent(e){e.data.events.forEach(e=>{this.emit(e.name,e)})}bindWatchlistInternalEvent(){this.pusher.connection.bind(`message`,e=>{e.event===`pusher_internal:watchlist_events`&&this.handleEvent(e)})}}function an(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}let on=an;class sn extends L{constructor(e){super(function(e,t){N.debug(`No callbacks on user for `+e)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(e,t)=>{if(e){N.warn(`Error during signin: ${e}`),this.emit(`pusher:signin_error`,Object.assign({},{type:`AuthError`,error:e.message},e instanceof v?{status:e.status}:{})),this._cleanup();return}this.pusher.send_event(`pusher:signin`,{auth:t.auth,user_data:t.user_data})},this.pusher=e,this.pusher.connection.bind(`state_change`,({previous:e,current:t})=>{e!==`connected`&&t===`connected`&&this._signin(),e===`connected`&&t!==`connected`&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new rn(e),this.pusher.connection.bind(`message`,e=>{e.event===`pusher:signin_success`&&this._onSigninSuccess(e.data),this.serverToUserChannel&&this.serverToUserChannel.name===e.channel&&this.serverToUserChannel.handleEvent(e)})}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{N.error(`Failed parsing user data after signin: ${e.user_data}`),this._cleanup();return}if(typeof this.user_data.id!=`string`||this.user_data.id===``){N.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){let e=e=>{e.subscriptionPending&&e.subscriptionCancelled?e.reinstateSubscription():!e.subscriptionPending&&this.pusher.connection.state===`connected`&&e.subscribe()};this.serverToUserChannel=new V(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((e,t)=>
2{e.indexOf(`pusher_internal:`)!==0&&e.indexOf(`pusher:`)!==0&&this.emit(e,t)}),e(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&=(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;let{promise:e,resolve:t,reject:n}=on();e.done=!1;let r=()=>{e.done=!0};e.then(r).catch(r),this.signinDonePromise=e,this._signinDoneResolve=t}}class Q{static ready(){Q.isReady=!0;for(var e=0,t=Q.instances.length;e<t;e++)Q.instances[e].connect()}static getClientFeatures(){return fe(_e({ws:X.Transports.ws},function(e){return e.isSupported({})}))}constructor(e,t){cn(e),Vt(t),this.key=e,this.options=t,this.config=qt(this.options,this),this.channels=W.createChannels(),this.global_emitter=new L,this.sessionID=X.randomInt(1e9),this.timeline=new Ft(this.key,this.sessionID,{cluster:this.config.cluster,features:Q.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Z.INFO,version:a.VERSION}),this.config.enableStats&&(this.timelineSender=W.createTimelineSender(this.timeline,{host:this.config.statsHost,path:`/timeline/v2/`+X.TimelineTransport.name}));var n=e=>X.getDefaultStrategy(this.config,e,zt);this.connection=W.createConnectionManager(this.key,{getStrategy:n,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`,e=>{var t=e.event.indexOf(`pusher_internal:`)===0;if(e.channel){var n=this.channel(e.channel);n&&n.handleEvent(e)}t||this.global_emitter.emit(e.event,e.data)}),this.connection.bind(`connecting`,()=>{this.channels.disconnect()}),this.connection.bind(`disconnected`,()=>{this.channels.disconnect()}),this.connection.bind(`error`,e=>{N.warn(e)}),Q.instances.push(this),this.timeline.info({instances:Q.instances.length}),this.user=new sn(this),Q.isReady&&this.connect()}switchCluster(e){let{appKey:t,cluster:n}=e;this.key=t,this.options=Object.assign(Object.assign({},this.options),{cluster:n}),this.config=qt(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 ue(6e4,function(){t.send(e)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&=(this.timelineSenderTimer.ensureAborted(),null)}bind(e,t,n){return this.global_emitter.bind(e,t,n),this}unbind(e,t,n){return this.global_emitter.unbind(e,t,n),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(){for(var 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,n){return this.connection.send_event(e,t,n)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Q.instances=[],Q.isReady=!1,Q.logToConsole=!1,Q.Runtime=X,Q.ScriptReceivers=X.ScriptReceivers,Q.DependenciesReceivers=X.DependenciesReceivers,Q.auth_callbacks=X.auth_callbacks;let $=Q;function cn(e){if(e==null)throw`You must pass your app key when you instantiate Pusher.`}X.setup(Q)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(721)})())}))(),1),re=8080;function ie(e,t){let n=e.key.trim();if(!n)return null;let r=se(t),i=oe(e.scheme)??r?.scheme,a=e.host.trim()||r?.host;if(!i||!a)return null;let o=i===`https`;return{key:n,host:a,port:e.port>0?e.port:o?443:re,forceTLS:o}}function ae(e,t){return{broadcaster:`reverb`,key:e.key,wsHost:e.host,wsPort:e.port,wssPort:e.port,forceTLS:e.forceTLS,enabledTransports:[`ws`,`wss`],disableStats:!0,channelAuthorization:t,withoutInterceptors:!0,Pusher:C.default}}function oe(e){let t=e.trim().toLowerCase();return t===`http`||t===`https`?t:null}function se(e){try{let t=new URL(e);return{host:t.hostname,scheme:t.protocol===`https:`?`https`:`http`}}catch{return null}}var w=`private-`,T=e=>new ne(e);function ce(e){let t=e.factory??T,n=new Map,r=null;function i(){return e.connection?(r??=t(ae(e.connection,e.channelAuthorization)),r):null}function a(e,t,r,a){let o=i();if(!o)return()=>{};let s=t?`${w}${e}`:e,c=n.get(s)??{channel:t?o.private(e):o.channel(e),listeners:0};n.set(s,c),c.listeners+=1;let l=e=>a(e);c.channel.listen(r,l);let u=!1;return()=>{if(u||n.get(s)!==c){u=!0;return}u=!0,c.channel.stopListening(r,l),--c.listeners,c.listeners<=0&&(n.delete(s),o.leaveChannel(s))}}function o(e){if(r)for(let t of[e,`${w}${e}`])n.delete(t)&&r.leaveChannel(t)}function s(){n.clear(),r?.disconnect(),r=null}return{instance:i,listen:(e,t,n)=>
2a(e,!1,t,n),listenPrivate:(e,t,n)=>a(e,!0,t,n),leave:o,subscribedChannels:()=>[...n.keys()],disconnect:s}}var le=`/broadcasting/auth`;function E(e){return({socketId:t,channelName:n},r)=>{e.post(le,{socket_id:t,channel_name:n},{skipGlobalErrorHandler:!0}).then(e=>{r(null,e)}).catch(e=>{r(ue(e,n),null)})}}function ue(e,t){return e instanceof Error?e:Error(`Authorization of channel ${t} failed.`,{cause:e})}function D(){let e=n();e._echoClient??=O();let t=e._echoClient;return{...t,listen:(e,n,r)=>k(t.listen(e,n,r)),listenPrivate:(e,n,r)=>k(t.listenPrivate(e,n,r))}}function O(){let e=a().public;return ce({connection:ie(e.reverb,e.apiUrl),channelAuthorization:{customHandler:E(o())}})}function k(e){return r()&&i(e),e}export{D as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.