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