UNPKG

@dcodegroup-au/dcode-chat-vue

Version:

Frontend vue components for the dcode-laravel-chat package

1,554 lines 240 kB
import { defineComponent as pe, ref as B, watch as ae, createElementBlock as q, openBlock as $, createElementVNode as M, withDirectives as Xt, withKeys as Ii, vModelText as Wt, createCommentVNode as G, normalizeClass as te, toDisplayString as ge, createVNode as Ze, Fragment as Gn, renderList as Zn, computed as Ft, onMounted as ot, onBeforeUnmount as Yn, unref as ce, createTextVNode as Fi, withModifiers as Mi, normalizeStyle as $i, renderSlot as ke, inject as Bi, createBlock as Mt, withCtx as Ye, normalizeProps as et, guardReactiveProps as tt, provide as qi, resolveDynamicComponent as On } from "vue"; class Kt { /** * Listen for a whisper event on the channel instance. */ listenForWhisper(e, n) { return this.listen(".client-" + e, n); } /** * Listen for an event on the channel instance. */ notification(e) { return this.listen( ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated", e ); } /** * Stop listening for a whisper event on the channel instance. */ stopListeningForWhisper(e, n) { return this.stopListening(".client-" + e, n); } } class er { /** * Create a new class instance. */ constructor(e) { this.namespace = e; } /** * Format the given event name. */ format(e) { return [".", "\\"].includes(e.charAt(0)) ? e.substring(1) : (this.namespace && (e = this.namespace + "." + e), e.replace(/\./g, "\\")); } /** * Set the event namespace. */ setNamespace(e) { this.namespace = e; } } function Hi(r) { try { new r(); } catch (e) { if (e instanceof Error && e.message.includes("is not a constructor")) return !1; } return !0; } class Qt extends Kt { /** * Create a new class instance. */ constructor(e, n, s) { super(), this.name = n, this.pusher = e, this.options = s, this.eventFormatter = new er(this.options.namespace), this.subscribe(); } /** * Subscribe to a Pusher channel. */ subscribe() { this.subscription = this.pusher.subscribe(this.name); } /** * Unsubscribe from a Pusher channel. */ unsubscribe() { this.pusher.unsubscribe(this.name); } /** * Listen for an event on the channel instance. */ listen(e, n) { return this.on(this.eventFormatter.format(e), n), this; } /** * Listen for all events on the channel instance. */ listenToAll(e) { return this.subscription.bind_global((n, s) => { if (n.startsWith("pusher:")) return; let a = String(this.options.namespace ?? "").replace( /\./g, "\\" ), u = n.startsWith(a) ? n.substring(a.length + 1) : "." + n; e(u, s); }), this; } /** * Stop listening for an event on the channel instance. */ stopListening(e, n) { return n ? this.subscription.unbind( this.eventFormatter.format(e), n ) : this.subscription.unbind(this.eventFormatter.format(e)), this; } /** * Stop listening for all events on the channel instance. */ stopListeningToAll(e) { return e ? this.subscription.unbind_global(e) : this.subscription.unbind_global(), this; } /** * Register a callback to be called anytime a subscription succeeds. */ subscribed(e) { return this.on("pusher:subscription_succeeded", () => { e(); }), this; } /** * Register a callback to be called anytime a subscription error occurs. */ error(e) { return this.on("pusher:subscription_error", (n) => { e(n); }), this; } /** * Bind a channel to an event. */ on(e, n) { return this.subscription.bind(e, n), this; } } class tr extends Qt { /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this.pusher.channels.channels[this.name].trigger( `client-${e}`, n ), this; } } class zi extends Qt { /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this.pusher.channels.channels[this.name].trigger( `client-${e}`, n ), this; } } class Vi extends tr { /** * Register a callback to be called anytime the member list changes. */ here(e) { return this.on("pusher:subscription_succeeded", (n) => { e(Object.keys(n.members).map((s) => n.members[s])); }), this; } /** * Listen for someone joining the channel. */ joining(e) { return this.on("pusher:member_added", (n) => { e(n.info); }), this; } /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this.pusher.channels.channels[this.name].trigger( `client-${e}`, n ), this; } /** * Listen for someone leaving the channel. */ leaving(e) { return this.on("pusher:member_removed", (n) => { e(n.info); }), this; } } class nr extends Kt { /** * Create a new class instance. */ constructor(e, n, s) { super(), this.events = {}, this.listeners = {}, this.name = n, this.socket = e, this.options = s, this.eventFormatter = new er(this.options.namespace), this.subscribe(); } /** * Subscribe to a Socket.io channel. */ subscribe() { this.socket.emit("subscribe", { channel: this.name, auth: this.options.auth || {} }); } /** * Unsubscribe from channel and ubind event callbacks. */ unsubscribe() { this.unbind(), this.socket.emit("unsubscribe", { channel: this.name, auth: this.options.auth || {} }); } /** * Listen for an event on the channel instance. */ listen(e, n) { return this.on(this.eventFormatter.format(e), n), this; } /** * Stop listening for an event on the channel instance. */ stopListening(e, n) { return this.unbindEvent(this.eventFormatter.format(e), n), this; } /** * Register a callback to be called anytime a subscription succeeds. */ subscribed(e) { return this.on("connect", (n) => { e(n); }), this; } /** * Register a callback to be called anytime an error occurs. */ error(e) { return this; } /** * Bind the channel's socket to an event and store the callback. */ on(e, n) { return this.listeners[e] = this.listeners[e] || [], this.events[e] || (this.events[e] = (s, a) => { this.name === s && this.listeners[e] && this.listeners[e].forEach((u) => u(a)); }, this.socket.on(e, this.events[e])), this.listeners[e].push(n), this; } /** * Unbind the channel's socket from all stored event callbacks. */ unbind() { Object.keys(this.events).forEach((e) => { this.unbindEvent(e); }); } /** * Unbind the listeners for the given event. */ unbindEvent(e, n) { this.listeners[e] = this.listeners[e] || [], n && (this.listeners[e] = this.listeners[e].filter( (s) => s !== n )), (!n || this.listeners[e].length === 0) && (this.events[e] && (this.socket.removeListener(e, this.events[e]), delete this.events[e]), delete this.listeners[e]); } } class rr extends nr { /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this.socket.emit("client event", { channel: this.name, event: `client-${e}`, data: n }), this; } } class Ji extends rr { /** * Register a callback to be called anytime the member list changes. */ here(e) { return this.on("presence:subscribed", (n) => { e(n.map((s) => s.user_info)); }), this; } /** * Listen for someone joining the channel. */ joining(e) { return this.on( "presence:joining", (n) => e(n.user_info) ), this; } /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this.socket.emit("client event", { channel: this.name, event: `client-${e}`, data: n }), this; } /** * Listen for someone leaving the channel. */ leaving(e) { return this.on( "presence:leaving", (n) => e(n.user_info) ), this; } } class nt extends Kt { /** * Subscribe to a channel. */ subscribe() { } /** * Unsubscribe from a channel. */ unsubscribe() { } /** * Listen for an event on the channel instance. */ listen(e, n) { return this; } /** * Listen for all events on the channel instance. */ listenToAll(e) { return this; } /** * Stop listening for an event on the channel instance. */ stopListening(e, n) { return this; } /** * Register a callback to be called anytime a subscription succeeds. */ subscribed(e) { return this; } /** * Register a callback to be called anytime an error occurs. */ error(e) { return this; } /** * Bind a channel to an event. */ on(e, n) { return this; } } class sr extends nt { /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this; } } class Xi extends nt { /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this; } } class Wi extends sr { /** * Register a callback to be called anytime the member list changes. */ here(e) { return this; } /** * Listen for someone joining the channel. */ joining(e) { return this; } /** * Send a whisper event to other clients in the channel. */ whisper(e, n) { return this; } /** * Listen for someone leaving the channel. */ leaving(e) { return this; } } const ir = class or { /** * Create a new class instance. */ constructor(e) { this.setOptions(e), this.connect(); } /** * Merge the custom options with the defaults. */ setOptions(e) { this.options = { ...or._defaultOptions, ...e, broadcaster: e.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); } /** * Extract the CSRF token from the page. */ csrfToken() { var e, n; return typeof window < "u" && (e = window.Laravel) != null && e.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((n = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : n.getAttribute("content")) ?? null : null; } }; ir._defaultOptions = { auth: { headers: {} }, authEndpoint: "/broadcasting/auth", userAuthentication: { endpoint: "/broadcasting/user-auth", headers: {} }, csrfToken: null, bearerToken: null, host: null, key: null, namespace: "App.Events" }; let Gt = ir; class We extends Gt { constructor() { super(...arguments), this.channels = {}; } /** * Create a fresh Pusher connection. */ 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 new Error( "Pusher client not found. Should be globally available or passed via options.client" ); } /** * Sign in the user via Pusher user authentication (https://pusher.com/docs/channels/using_channels/user-authentication/). */ signin() { this.pusher.signin(); } /** * Listen for an event on a channel instance. */ listen(e, n, s) { return this.channel(e).listen(n, s); } /** * Get a channel instance by name. */ channel(e) { return this.channels[e] || (this.channels[e] = new Qt( this.pusher, e, this.options )), this.channels[e]; } /** * Get a private channel instance by name. */ privateChannel(e) { return this.channels["private-" + e] || (this.channels["private-" + e] = new tr( this.pusher, "private-" + e, this.options )), this.channels["private-" + e]; } /** * Get a private encrypted channel instance by name. */ encryptedPrivateChannel(e) { return this.channels["private-encrypted-" + e] || (this.channels["private-encrypted-" + e] = new zi( this.pusher, "private-encrypted-" + e, this.options )), this.channels["private-encrypted-" + e]; } /** * Get a presence channel instance by name. */ presenceChannel(e) { return this.channels["presence-" + e] || (this.channels["presence-" + e] = new Vi( this.pusher, "presence-" + e, this.options )), this.channels["presence-" + e]; } /** * Leave the given channel, as well as its private and presence variants. */ leave(e) { [ e, "private-" + e, "private-encrypted-" + e, "presence-" + e ].forEach((n) => { this.leaveChannel(n); }); } /** * Leave the given channel. */ leaveChannel(e) { this.channels[e] && (this.channels[e].unsubscribe(), delete this.channels[e]); } /** * Get the socket ID for the connection. */ socketId() { return this.pusher.connection.socket_id; } /** * Disconnect Pusher connection. */ disconnect() { this.pusher.disconnect(); } } class Ki extends Gt { constructor() { super(...arguments), this.channels = {}; } /** * Create a fresh Socket.io connection. */ 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((n) => { n.subscribe(); }); }); } /** * Get socket.io module from global scope or options. */ getSocketIO() { if (typeof this.options.client < "u") return this.options.client; if (typeof window < "u" && typeof window.io < "u") return window.io; throw new Error( "Socket.io client not found. Should be globally available or passed via options.client" ); } /** * Listen for an event on a channel instance. */ listen(e, n, s) { return this.channel(e).listen(n, s); } /** * Get a channel instance by name. */ channel(e) { return this.channels[e] || (this.channels[e] = new nr( this.socket, e, this.options )), this.channels[e]; } /** * Get a private channel instance by name. */ privateChannel(e) { return this.channels["private-" + e] || (this.channels["private-" + e] = new rr( this.socket, "private-" + e, this.options )), this.channels["private-" + e]; } /** * Get a presence channel instance by name. */ presenceChannel(e) { return this.channels["presence-" + e] || (this.channels["presence-" + e] = new Ji( this.socket, "presence-" + e, this.options )), this.channels["presence-" + e]; } /** * Leave the given channel, as well as its private and presence variants. */ leave(e) { [e, "private-" + e, "presence-" + e].forEach((n) => { this.leaveChannel(n); }); } /** * Leave the given channel. */ leaveChannel(e) { this.channels[e] && (this.channels[e].unsubscribe(), delete this.channels[e]); } /** * Get the socket ID for the connection. */ socketId() { return this.socket.id; } /** * Disconnect Socketio connection. */ disconnect() { this.socket.disconnect(); } } class Pn extends Gt { constructor() { super(...arguments), this.channels = {}; } /** * Create a fresh connection. */ connect() { } /** * Listen for an event on a channel instance. */ listen(e, n, s) { return new nt(); } /** * Get a channel instance by name. */ channel(e) { return new nt(); } /** * Get a private channel instance by name. */ privateChannel(e) { return new sr(); } /** * Get a private encrypted channel instance by name. */ encryptedPrivateChannel(e) { return new Xi(); } /** * Get a presence channel instance by name. */ presenceChannel(e) { return new Wi(); } /** * Leave the given channel, as well as its private and presence variants. */ leave(e) { } /** * Leave the given channel. */ leaveChannel(e) { } /** * Get the socket ID for the connection. */ socketId() { return "fake-socket-id"; } /** * Disconnect the connection. */ disconnect() { } } class ar { /** * Create a new class instance. */ constructor(e) { this.options = e, this.connect(), this.options.withoutInterceptors || this.registerInterceptors(); } /** * Get a channel instance by name. */ channel(e) { return this.connector.channel(e); } /** * Create a new connection. */ connect() { if (this.options.broadcaster === "reverb") this.connector = new We({ ...this.options, cluster: "" }); else if (this.options.broadcaster === "pusher") this.connector = new We(this.options); else if (this.options.broadcaster === "ably") this.connector = new We({ ...this.options, cluster: "", broadcaster: "pusher" }); else if (this.options.broadcaster === "socket.io") this.connector = new Ki(this.options); else if (this.options.broadcaster === "null") this.connector = new Pn(this.options); else if (typeof this.options.broadcaster == "function" && Hi(this.options.broadcaster)) this.connector = new this.options.broadcaster(this.options); else throw new Error( `Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.` ); } /** * Disconnect from the Echo server. */ disconnect() { this.connector.disconnect(); } /** * Get a presence channel instance by name. */ join(e) { return this.connector.presenceChannel(e); } /** * Leave the given channel, as well as its private and presence variants. */ leave(e) { this.connector.leave(e); } /** * Leave the given channel. */ leaveChannel(e) { this.connector.leaveChannel(e); } /** * Leave all channels. */ leaveAllChannels() { for (const e in this.connector.channels) this.leaveChannel(e); } /** * Listen for an event on a channel instance. */ listen(e, n, s) { return this.connector.listen(e, n, s); } /** * Get a private channel instance by name. */ private(e) { return this.connector.privateChannel(e); } /** * Get a private encrypted channel instance by name. */ encryptedPrivate(e) { if (this.connectorSupportsEncryptedPrivateChannels(this.connector)) return this.connector.encryptedPrivateChannel(e); throw new Error( `Broadcaster ${typeof this.options.broadcaster} ${String( this.options.broadcaster )} does not support encrypted private channels.` ); } connectorSupportsEncryptedPrivateChannels(e) { return e instanceof We || e instanceof Pn; } /** * Get the Socket ID for the connection. */ socketId() { return this.connector.socketId(); } /** * Register 3rd party request interceptiors. These are used to automatically * send a connections socket id to a Laravel app with a X-Socket-Id header. */ registerInterceptors() { typeof Vue < "u" && Vue != null && Vue.http && this.registerVueRequestInterceptor(), typeof axios == "function" && this.registerAxiosRequestInterceptor(), typeof jQuery == "function" && this.registerjQueryAjaxSetup(), typeof Turbo == "object" && this.registerTurboRequestInterceptor(); } /** * Register a Vue HTTP interceptor to add the X-Socket-ID header. */ registerVueRequestInterceptor() { Vue.http.interceptors.push( (e, n) => { this.socketId() && e.headers.set("X-Socket-ID", this.socketId()), n(); } ); } /** * Register an Axios HTTP interceptor to add the X-Socket-ID header. */ registerAxiosRequestInterceptor() { axios.interceptors.request.use( (e) => (this.socketId() && (e.headers["X-Socket-Id"] = this.socketId()), e) ); } /** * Register jQuery AjaxPrefilter to add the X-Socket-ID header. */ registerjQueryAjaxSetup() { typeof jQuery.ajax < "u" && jQuery.ajaxPrefilter( (e, n, s) => { this.socketId() && s.setRequestHeader("X-Socket-Id", this.socketId()); } ); } /** * Register the Turbo Request interceptor to add the X-Socket-ID header. */ registerTurboRequestInterceptor() { document.addEventListener( "turbo:before-fetch-request", (e) => { e.detail.fetchOptions.headers["X-Socket-Id"] = this.socketId(); } ); } } function Qi(r) { return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; } var Rt = { exports: {} }; /*! * Pusher JavaScript Library v8.4.0 * https://pusher.com/ * * Copyright 2020, Pusher * Released under the MIT licence. */ var An; function Gi() { return An || (An = 1, function(r, e) { (function(s, a) { r.exports = a(); })(window, function() { return ( /******/ function(n) { var s = {}; function a(u) { if (s[u]) return s[u].exports; var l = s[u] = { /******/ i: u, /******/ l: !1, /******/ exports: {} /******/ }; return n[u].call(l.exports, l, l.exports, a), l.l = !0, l.exports; } return a.m = n, a.c = s, a.d = function(u, l, m) { a.o(u, l) || Object.defineProperty(u, l, { enumerable: !0, get: m }); }, a.r = function(u) { typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(u, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(u, "__esModule", { value: !0 }); }, a.t = function(u, l) { if (l & 1 && (u = a(u)), l & 8 || l & 4 && typeof u == "object" && u && u.__esModule) return u; var m = /* @__PURE__ */ Object.create(null); if (a.r(m), Object.defineProperty(m, "default", { enumerable: !0, value: u }), l & 2 && typeof u != "string") for (var S in u) a.d(m, S, (function(C) { return u[C]; }).bind(null, S)); return m; }, a.n = function(u) { var l = u && u.__esModule ? ( /******/ function() { return u.default; } ) : ( /******/ function() { return u; } ); return a.d(l, "a", l), l; }, a.o = function(u, l) { return Object.prototype.hasOwnProperty.call(u, l); }, a.p = "", a(a.s = 2); }([ /* 0 */ /***/ function(n, s, a) { var u = this && this.__extends || /* @__PURE__ */ function() { var f = function(h, p) { return f = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, T) { g.__proto__ = T; } || function(g, T) { for (var R in T) T.hasOwnProperty(R) && (g[R] = T[R]); }, f(h, p); }; return function(h, p) { f(h, p); function g() { this.constructor = h; } h.prototype = p === null ? Object.create(p) : (g.prototype = p.prototype, new g()); }; }(); Object.defineProperty(s, "__esModule", { value: !0 }); var l = 256, m = ( /** @class */ function() { function f(h) { h === void 0 && (h = "="), this._paddingCharacter = h; } return f.prototype.encodedLength = function(h) { return this._paddingCharacter ? (h + 2) / 3 * 4 | 0 : (h * 8 + 5) / 6 | 0; }, f.prototype.encode = function(h) { for (var p = "", g = 0; g < h.length - 2; g += 3) { var T = h[g] << 16 | h[g + 1] << 8 | h[g + 2]; p += this._encodeByte(T >>> 3 * 6 & 63), p += this._encodeByte(T >>> 2 * 6 & 63), p += this._encodeByte(T >>> 1 * 6 & 63), p += this._encodeByte(T >>> 0 * 6 & 63); } var R = h.length - g; if (R > 0) { var T = h[g] << 16 | (R === 2 ? h[g + 1] << 8 : 0); p += this._encodeByte(T >>> 3 * 6 & 63), p += this._encodeByte(T >>> 2 * 6 & 63), R === 2 ? p += this._encodeByte(T >>> 1 * 6 & 63) : p += this._paddingCharacter || "", p += this._paddingCharacter || ""; } return p; }, f.prototype.maxDecodedLength = function(h) { return this._paddingCharacter ? h / 4 * 3 | 0 : (h * 6 + 7) / 8 | 0; }, f.prototype.decodedLength = function(h) { return this.maxDecodedLength(h.length - this._getPaddingLength(h)); }, f.prototype.decode = function(h) { if (h.length === 0) return new Uint8Array(0); for (var p = this._getPaddingLength(h), g = h.length - p, T = new Uint8Array(this.maxDecodedLength(g)), R = 0, E = 0, O = 0, N = 0, A = 0, j = 0, F = 0; E < g - 4; E += 4) N = this._decodeChar(h.charCodeAt(E + 0)), A = this._decodeChar(h.charCodeAt(E + 1)), j = this._decodeChar(h.charCodeAt(E + 2)), F = this._decodeChar(h.charCodeAt(E + 3)), T[R++] = N << 2 | A >>> 4, T[R++] = A << 4 | j >>> 2, T[R++] = j << 6 | F, O |= N & l, O |= A & l, O |= j & l, O |= F & l; if (E < g - 1 && (N = this._decodeChar(h.charCodeAt(E)), A = this._decodeChar(h.charCodeAt(E + 1)), T[R++] = N << 2 | A >>> 4, O |= N & l, O |= A & l), E < g - 2 && (j = this._decodeChar(h.charCodeAt(E + 2)), T[R++] = A << 4 | j >>> 2, O |= j & l), E < g - 3 && (F = this._decodeChar(h.charCodeAt(E + 3)), T[R++] = j << 6 | F, O |= F & l), O !== 0) throw new Error("Base64Coder: incorrect characters for decoding"); return T; }, f.prototype._encodeByte = function(h) { var p = h; return p += 65, p += 25 - h >>> 8 & 6, p += 51 - h >>> 8 & -75, p += 61 - h >>> 8 & -15, p += 62 - h >>> 8 & 3, String.fromCharCode(p); }, f.prototype._decodeChar = function(h) { var p = l; return p += (42 - h & h - 44) >>> 8 & -l + h - 43 + 62, p += (46 - h & h - 48) >>> 8 & -l + h - 47 + 63, p += (47 - h & h - 58) >>> 8 & -l + h - 48 + 52, p += (64 - h & h - 91) >>> 8 & -l + h - 65 + 0, p += (96 - h & h - 123) >>> 8 & -l + h - 97 + 26, p; }, f.prototype._getPaddingLength = function(h) { var p = 0; if (this._paddingCharacter) { for (var g = h.length - 1; g >= 0 && h[g] === this._paddingCharacter; g--) p++; if (h.length < 4 || p > 2) throw new Error("Base64Coder: incorrect padding"); } return p; }, f; }() ); s.Coder = m; var S = new m(); function C(f) { return S.encode(f); } s.encode = C; function b(f) { return S.decode(f); } s.decode = b; var y = ( /** @class */ function(f) { u(h, f); function h() { return f !== null && f.apply(this, arguments) || this; } return h.prototype._encodeByte = function(p) { var g = p; return g += 65, g += 25 - p >>> 8 & 6, g += 51 - p >>> 8 & -75, g += 61 - p >>> 8 & -13, g += 62 - p >>> 8 & 49, String.fromCharCode(g); }, h.prototype._decodeChar = function(p) { var g = l; return g += (44 - p & p - 46) >>> 8 & -l + p - 45 + 62, g += (94 - p & p - 96) >>> 8 & -l + p - 95 + 63, g += (47 - p & p - 58) >>> 8 & -l + p - 48 + 52, g += (64 - p & p - 91) >>> 8 & -l + p - 65 + 0, g += (96 - p & p - 123) >>> 8 & -l + p - 97 + 26, g; }, h; }(m) ); s.URLSafeCoder = y; var x = new y(); function w(f) { return x.encode(f); } s.encodeURLSafe = w; function v(f) { return x.decode(f); } s.decodeURLSafe = v, s.encodedLength = function(f) { return S.encodedLength(f); }, s.maxDecodedLength = function(f) { return S.maxDecodedLength(f); }, s.decodedLength = function(f) { return S.decodedLength(f); }; }, /* 1 */ /***/ function(n, s, a) { Object.defineProperty(s, "__esModule", { value: !0 }); var u = "utf8: invalid string", l = "utf8: invalid source encoding"; function m(b) { for (var y = new Uint8Array(S(b)), x = 0, w = 0; w < b.length; w++) { var v = b.charCodeAt(w); v < 128 ? y[x++] = v : v < 2048 ? (y[x++] = 192 | v >> 6, y[x++] = 128 | v & 63) : v < 55296 ? (y[x++] = 224 | v >> 12, y[x++] = 128 | v >> 6 & 63, y[x++] = 128 | v & 63) : (w++, v = (v & 1023) << 10, v |= b.charCodeAt(w) & 1023, v += 65536, y[x++] = 240 | v >> 18, y[x++] = 128 | v >> 12 & 63, y[x++] = 128 | v >> 6 & 63, y[x++] = 128 | v & 63); } return y; } s.encode = m; function S(b) { for (var y = 0, x = 0; x < b.length; x++) { var w = b.charCodeAt(x); if (w < 128) y += 1; else if (w < 2048) y += 2; else if (w < 55296) y += 3; else if (w <= 57343) { if (x >= b.length - 1) throw new Error(u); x++, y += 4; } else throw new Error(u); } return y; } s.encodedLength = S; function C(b) { for (var y = [], x = 0; x < b.length; x++) { var w = b[x]; if (w & 128) { var v = void 0; if (w < 224) { if (x >= b.length) throw new Error(l); var f = b[++x]; if ((f & 192) !== 128) throw new Error(l); w = (w & 31) << 6 | f & 63, v = 128; } else if (w < 240) { if (x >= b.length - 1) throw new Error(l); var f = b[++x], h = b[++x]; if ((f & 192) !== 128 || (h & 192) !== 128) throw new Error(l); w = (w & 15) << 12 | (f & 63) << 6 | h & 63, v = 2048; } else if (w < 248) { if (x >= b.length - 2) throw new Error(l); var f = b[++x], h = b[++x], p = b[++x]; if ((f & 192) !== 128 || (h & 192) !== 128 || (p & 192) !== 128) throw new Error(l); w = (w & 15) << 18 | (f & 63) << 12 | (h & 63) << 6 | p & 63, v = 65536; } else throw new Error(l); if (w < v || w >= 55296 && w <= 57343) throw new Error(l); if (w >= 65536) { if (w > 1114111) throw new Error(l); w -= 65536, y.push(String.fromCharCode(55296 | w >> 10)), w = 56320 | w & 1023; } } y.push(String.fromCharCode(w)); } return y.join(""); } s.decode = C; }, /* 2 */ /***/ function(n, s, a) { n.exports = a(3).default; }, /* 3 */ /***/ function(n, s, a) { a.r(s); class u { constructor(t, i) { this.lastId = 0, this.prefix = t, this.name = i; } create(t) { this.lastId++; var i = this.lastId, c = this.prefix + i, d = this.name + "[" + i + "]", k = !1, P = function() { k || (t.apply(null, arguments), k = !0); }; return this[i] = P, { number: i, id: c, name: d, callback: P }; } remove(t) { delete this[t.number]; } } var l = new u("_pusher_script_", "Pusher.ScriptReceivers"), m = { VERSION: "8.4.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: "" }, S = m; class C { constructor(t) { this.options = t, this.receivers = t.receivers || l, this.loading = {}; } load(t, i, c) { var d = this; if (d.loading[t] && d.loading[t].length > 0) d.loading[t].push(c); else { d.loading[t] = [c]; var k = U.createScriptRequest(d.getPath(t, i)), P = d.receivers.create(function(L) { if (d.receivers.remove(P), d.loading[t]) { var D = d.loading[t]; delete d.loading[t]; for (var H = function(K) { K || k.cleanup(); }, z = 0; z < D.length; z++) D[z](L, H); } }); k.send(P); } } getRoot(t) { var i, c = U.getDocument().location.protocol; return t && t.useTLS || c === "https:" ? i = this.options.cdn_https : i = this.options.cdn_http, i.replace(/\/*$/, "") + "/" + this.options.version; } getPath(t, i) { return this.getRoot(i) + "/" + t + this.options.suffix + ".js"; } } var b = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), y = new C({ cdn_http: S.cdn_http, cdn_https: S.cdn_https, version: S.VERSION, suffix: S.dependency_suffix, receivers: b }); const x = { 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 v = { buildLogSuffix: function(o) { const t = "See:", i = x.urls[o]; if (!i) return ""; let c; return i.fullUrl ? c = i.fullUrl : i.path && (c = x.baseUrl + i.path), c ? `${t} ${c}` : ""; } }, f; (function(o) { o.UserAuthentication = "user-authentication", o.ChannelAuthorization = "channel-authorization"; })(f || (f = {})); class h extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class p extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class g extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class T extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class R extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class E extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class O extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class N extends Error { constructor(t) { super(t), Object.setPrototypeOf(this, new.target.prototype); } } class A extends Error { constructor(t, i) { super(i), this.status = t, Object.setPrototypeOf(this, new.target.prototype); } } var F = function(o, t, i, c, d) { const k = U.createXHR(); k.open("POST", i.endpoint, !0), k.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); for (var P in i.headers) k.setRequestHeader(P, i.headers[P]); if (i.headersProvider != null) { let L = i.headersProvider(); for (var P in L) k.setRequestHeader(P, L[P]); } return k.onreadystatechange = function() { if (k.readyState === 4) if (k.status === 200) { let L, D = !1; try { L = JSON.parse(k.responseText), D = !0; } catch { d(new A(200, `JSON returned from ${c.toString()} endpoint was invalid, yet status code was 200. Data was: ${k.responseText}`), null); } D && d(null, L); } else { let L = ""; switch (c) { case f.UserAuthentication: L = v.buildLogSuffix("authenticationEndpoint"); break; case f.ChannelAuthorization: L = `Clients must be authorized to join private or presence channels. ${v.buildLogSuffix("authorizationEndpoint")}`; break; } d(new A(k.status, `Unable to retrieve auth string from ${c.toString()} endpoint - received status: ${k.status} from ${i.endpoint}. ${L}`), null); } }, k.send(t), k; }; function Q(o) { return xe(Me(o)); } var ie = String.fromCharCode, V = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Fe = function(o) { var t = o.charCodeAt(0); return t < 128 ? o : t < 2048 ? ie(192 | t >>> 6) + ie(128 | t & 63) : ie(224 | t >>> 12 & 15) + ie(128 | t >>> 6 & 63) + ie(128 | t & 63); }, Me = function(o) { return o.replace(/[^\x00-\x7F]/g, Fe); }, $e = function(o) { var t = [0, 2, 1][o.length % 3], i = o.charCodeAt(0) << 16 | (o.length > 1 ? o.charCodeAt(1) : 0) << 8 | (o.length > 2 ? o.charCodeAt(2) : 0), c = [ V.charAt(i >>> 18), V.charAt(i >>> 12 & 63), t >= 2 ? "=" : V.charAt(i >>> 6 & 63), t >= 1 ? "=" : V.charAt(i & 63) ]; return c.join(""); }, xe = window.btoa || function(o) { return o.replace(/[\s\S]{1,3}/g, $e); }; class Oe { constructor(t, i, c, d) { this.clear = i, this.timer = t(() => { this.timer && (this.timer = d(this.timer)); }, c); } isRunning() { return this.timer !== null; } ensureAborted() { this.timer && (this.clear(this.timer), this.timer = null); } } var me = Oe; function Be(o) { window.clearTimeout(o); } function Pe(o) { window.clearInterval(o); } class ee extends me { constructor(t, i) { super(setTimeout, Be, t, function(c) { return i(), null; }); } } class qe extends me { constructor(t, i) { super(setInterval, Pe, t, function(c) { return i(), c; }); } } var pt = { now() { return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf(); }, defer(o) { return new ee(0, o); }, method(o, ...t) { var i = Array.prototype.slice.call(arguments, 1); return function(c) { return c[o].apply(c, i.concat(arguments)); }; } }, W = pt; function ne(o, ...t) { for (var i = 0; i < t.length; i++) { var c = t[i]; for (var d in c) c[d] && c[d].constructor && c[d].constructor === Object ? o[d] = ne(o[d] || {}, c[d]) : o[d] = c[d]; } return o; } function Ir() { for (var o = ["Pusher"], t = 0; t < arguments.length; t++) typeof arguments[t] == "string" ? o.push(arguments[t]) : o.push(He(arguments[t])); return o.join(" : "); } function nn(o, t) { var i = Array.prototype.indexOf; if (o === null) return -1; if (i && o.indexOf === i) return o.indexOf(t); for (var c = 0, d = o.length; c < d; c++) if (o[c] === t) return c; return -1; } function he(o, t) { for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && t(o[i], i, o); } function rn(o) { var t = []; return he(o, function(i, c) { t.push(c); }), t; } function Fr(o) { var t = []; return he(o, function(i) { t.push(i); }), t; } function Ae(o, t, i) { for (var c = 0; c < o.length; c++) t.call(i || window, o[c], c, o); } function sn(o, t) { for (var i = [], c = 0; c < o.length; c++) i.push(t(o[c], c, o, i)); return i; } function Mr(o, t) { var i = {}; return he(o, function(c, d) { i[d] = t(c); }), i; } function on(o, t) { t = t || function(d) { return !!d; }; for (var i = [], c = 0; c < o.length; c++) t(o[c], c, o, i) && i.push(o[c]); return i; } function an(o, t) { var i = {}; return he(o, function(c, d) { (t && t(c, d, o, i) || c) && (i[d] = c); }), i; } function $r(o) { var t = []; return he(o, function(i, c) { t.push([c, i]); }), t; } function cn(o, t) { for (var i = 0; i < o.length; i++) if (t(o[i], i, o)) return !0; return !1; } function Br(o, t) { for (var i = 0; i < o.length; i++) if (!t(o[i], i, o)) return !1; return !0; } function qr(o) { return Mr(o, function(t) { return typeof t == "object" && (t = He(t)), encodeURIComponent(Q(t.toString())); }); } function Hr(o) { var t = an(o, function(c) { return c !== void 0; }), i = sn($r(qr(t)), W.method("join", "=")).join("&"); return i; } function zr(o) { var t = [], i = []; return function c(d, k) { var P, L, D; switch (typeof d) { case "object": if (!d) return null; for (P = 0; P < t.length; P += 1) if (t[P] === d) return { $ref: i[P] }; if (t.push(d), i.push(k), Object.prototype.toString.apply(d) === "[object Array]") for (D = [], P = 0; P < d.length; P += 1) D[P] = c(d[P], k + "[" + P + "]"); else { D = {}; for (L in d) Object.prototype.hasOwnProperty.call(d, L) && (D[L] = c(d[L], k + "[" + JSON.stringify(L) + "]")); } return D; case "number": case "string": case "boolean": return d; } }(o, "$"); } function He(o) { try { return JSON.stringify(o); } catch { return JSON.stringify(zr(o)); } } class Vr { constructor() { this.globalLog = (t) => { window.console && window.console.log && window.console.log(t); }; } debug(...t) { this.log(this.globalLog, t); } warn(...t) { this.log(this.globalLogWarn, t); } error(...t) { this.log(this.globalLogError, t); } globalLogWarn(t) { window.console && window.console.warn ? window.console.warn(t) : this.globalLog(t); } globalLogError(t) { window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t); } log(t, ...i) { var c = Ir.apply(this, arguments); Tt.log ? Tt.log(c) : Tt.logToConsole && t.bind(this)(c); } } var X = new Vr(), Jr = function(o, t, i, c, d) { (i.headers !== void 0 || i.headersProvider != null) && X.warn(`To send headers with the ${c.toString()} request, you must use AJAX, rather than JSONP.`); var k = o.nextAuthCallbackID.toString(); o.nextAuthCallbackID++; var P = o.getDocument(), L = P.createElement("script"); o.auth_callbacks[k] = function(z) { d(null, z); }; var D = "Pusher.auth_callbacks['" + k + "']"; L.src = i.endpoint + "?callback=" + encodeURIComponent(D) + "&" + t; var H = P.getElementsByTagName("head")[0] || P.documentElement; H.insertBefore(L, H.firstChild); }, Xr = Jr; class Wr { constructor(t) { this.src = t; } send(t) { var i = this, c = "Error loading " + i.src; i.script = document.createElement("script"), i.script.id = t.id, i.script.src = i.src, i.script.type = "text/javascript", i.script.charset = "UTF-8", i.script.addEventListener ? (i.script.onerror = function() { t.callback(c); }, i.script.onload = function() { t.callback(n