diff --git a/bin/build.js b/bin/build.js index f61993ea46..373f66663b 100644 --- a/bin/build.js +++ b/bin/build.js @@ -23,6 +23,24 @@ packages.forEach((package) => { .catch(() => process.exit(1)) }) +esbuild + .build({ + define: { + 'process.env.NODE_ENV': shouldWatch + ? `'production'` + : `'development'`, + }, + entryPoints: [`packages/admin/resources/js/echo.js`], + outfile: `packages/admin/dist/echo.js`, + bundle: true, + platform: 'neutral', + mainFields: ['module', 'main'], + watch: shouldWatch, + minifySyntax: true, + minifyWhitespace: true, + }) + .catch(() => process.exit(1)) + const formComponents = [ 'color-picker', 'date-time-picker', diff --git a/packages/admin/dist/echo.js b/packages/admin/dist/echo.js index 9c8cb7d691..1c8251da19 100644 --- a/packages/admin/dist/echo.js +++ b/packages/admin/dist/echo.js @@ -1,4 +1,5 @@ -(()=>{var t={606:t=>{ +var __create=Object.create,__defProp=Object.defineProperty,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropDesc=Object.getOwnPropertyDescriptor;var __markAsModule=target=>__defProp(target,"__esModule",{value:!0});var __commonJS=(callback,module)=>()=>(module||(module={exports:{}},callback(module.exports,module)),module.exports);var __exportStar=(target,module,desc)=>{if(module&&typeof module=="object"||typeof module=="function")for(let key of __getOwnPropNames(module))!__hasOwnProp.call(target,key)&&key!=="default"&&__defProp(target,key,{get:()=>module[key],enumerable:!(desc=__getOwnPropDesc(module,key))||desc.enumerable});return target},__toModule=module=>__exportStar(__markAsModule(__defProp(module!=null?__create(__getProtoOf(module)):{},"default",module&&module.__esModule&&"default"in module?{get:()=>module.default,enumerable:!0}:{value:module,enumerable:!0})),module);var require_pusher=__commonJS((exports,module)=>{(function(root,factory){typeof exports=="object"&&typeof module=="object"?module.exports=factory():typeof define=="function"&&define.amd?define([],factory):typeof exports=="object"?exports.Pusher=factory():root.Pusher=factory()})(window,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module2=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module2.exports,module2,module2.exports,__webpack_require__),module2.l=!0,module2.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports2,name,getter){__webpack_require__.o(exports2,name)||Object.defineProperty(exports2,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports2){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports2,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(mode&1&&(value=__webpack_require__(value)),mode&8||mode&4&&typeof value=="object"&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value}),mode&2&&typeof value!="string")for(var key in value)__webpack_require__.d(ns,key,function(key2){return value[key2]}.bind(null,key));return ns},__webpack_require__.n=function(module2){var getter=module2&&module2.__esModule?function(){return module2.default}:function(){return module2};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(module2,exports2,__webpack_require__){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports2,"__esModule",{value:!0});var INVALID_BYTE=256,Coder=function(){function Coder2(_paddingCharacter){_paddingCharacter===void 0&&(_paddingCharacter="="),this._paddingCharacter=_paddingCharacter}return Coder2.prototype.encodedLength=function(length){return this._paddingCharacter?(length+2)/3*4|0:(length*8+5)/6|0},Coder2.prototype.encode=function(data){for(var out="",i=0;i>>3*6&63),out+=this._encodeByte(c>>>2*6&63),out+=this._encodeByte(c>>>1*6&63),out+=this._encodeByte(c>>>0*6&63)}var left=data.length-i;if(left>0){var c=data[i]<<16|(left===2?data[i+1]<<8:0);out+=this._encodeByte(c>>>3*6&63),out+=this._encodeByte(c>>>2*6&63),left===2?out+=this._encodeByte(c>>>1*6&63):out+=this._paddingCharacter||"",out+=this._paddingCharacter||""}return out},Coder2.prototype.maxDecodedLength=function(length){return this._paddingCharacter?length/4*3|0:(length*6+7)/8|0},Coder2.prototype.decodedLength=function(s){return this.maxDecodedLength(s.length-this._getPaddingLength(s))},Coder2.prototype.decode=function(s){if(s.length===0)return new Uint8Array(0);for(var paddingLength=this._getPaddingLength(s),length=s.length-paddingLength,out=new Uint8Array(this.maxDecodedLength(length)),op=0,i=0,haveBad=0,v0=0,v1=0,v2=0,v3=0;i>>4,out[op++]=v1<<4|v2>>>2,out[op++]=v2<<6|v3,haveBad|=v0&INVALID_BYTE,haveBad|=v1&INVALID_BYTE,haveBad|=v2&INVALID_BYTE,haveBad|=v3&INVALID_BYTE;if(i>>4,haveBad|=v0&INVALID_BYTE,haveBad|=v1&INVALID_BYTE),i>>2,haveBad|=v2&INVALID_BYTE),i>>8&0-65-26+97,result+=51-b>>>8&26-97-52+48,result+=61-b>>>8&52-48-62+43,result+=62-b>>>8&62-43-63+47,String.fromCharCode(result)},Coder2.prototype._decodeChar=function(c){var result=INVALID_BYTE;return result+=(42-c&c-44)>>>8&-INVALID_BYTE+c-43+62,result+=(46-c&c-48)>>>8&-INVALID_BYTE+c-47+63,result+=(47-c&c-58)>>>8&-INVALID_BYTE+c-48+52,result+=(64-c&c-91)>>>8&-INVALID_BYTE+c-65+0,result+=(96-c&c-123)>>>8&-INVALID_BYTE+c-97+26,result},Coder2.prototype._getPaddingLength=function(s){var paddingLength=0;if(this._paddingCharacter){for(var i=s.length-1;i>=0&&s[i]===this._paddingCharacter;i--)paddingLength++;if(s.length<4||paddingLength>2)throw new Error("Base64Coder: incorrect padding")}return paddingLength},Coder2}();exports2.Coder=Coder;var stdCoder=new Coder;function encode(data){return stdCoder.encode(data)}exports2.encode=encode;function decode(s){return stdCoder.decode(s)}exports2.decode=decode;var URLSafeCoder=function(_super){__extends(URLSafeCoder2,_super);function URLSafeCoder2(){return _super!==null&&_super.apply(this,arguments)||this}return URLSafeCoder2.prototype._encodeByte=function(b){var result=b;return result+=65,result+=25-b>>>8&0-65-26+97,result+=51-b>>>8&26-97-52+48,result+=61-b>>>8&52-48-62+45,result+=62-b>>>8&62-45-63+95,String.fromCharCode(result)},URLSafeCoder2.prototype._decodeChar=function(c){var result=INVALID_BYTE;return result+=(44-c&c-46)>>>8&-INVALID_BYTE+c-45+62,result+=(94-c&c-96)>>>8&-INVALID_BYTE+c-95+63,result+=(47-c&c-58)>>>8&-INVALID_BYTE+c-48+52,result+=(64-c&c-91)>>>8&-INVALID_BYTE+c-65+0,result+=(96-c&c-123)>>>8&-INVALID_BYTE+c-97+26,result},URLSafeCoder2}(Coder);exports2.URLSafeCoder=URLSafeCoder;var urlSafeCoder=new URLSafeCoder;function encodeURLSafe(data){return urlSafeCoder.encode(data)}exports2.encodeURLSafe=encodeURLSafe;function decodeURLSafe(s){return urlSafeCoder.decode(s)}exports2.decodeURLSafe=decodeURLSafe,exports2.encodedLength=function(length){return stdCoder.encodedLength(length)},exports2.maxDecodedLength=function(length){return stdCoder.maxDecodedLength(length)},exports2.decodedLength=function(s){return stdCoder.decodedLength(s)}},function(module2,exports2,__webpack_require__){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});var INVALID_UTF16="utf8: invalid string",INVALID_UTF8="utf8: invalid source encoding";function encode(s){for(var arr=new Uint8Array(encodedLength(s)),pos=0,i=0;i>6,arr[pos++]=128|c&63):c<55296?(arr[pos++]=224|c>>12,arr[pos++]=128|c>>6&63,arr[pos++]=128|c&63):(i++,c=(c&1023)<<10,c|=s.charCodeAt(i)&1023,c+=65536,arr[pos++]=240|c>>18,arr[pos++]=128|c>>12&63,arr[pos++]=128|c>>6&63,arr[pos++]=128|c&63)}return arr}exports2.encode=encode;function encodedLength(s){for(var result=0,i=0;i=s.length-1)throw new Error(INVALID_UTF16);i++,result+=4}else throw new Error(INVALID_UTF16)}return result}exports2.encodedLength=encodedLength;function decode(arr){for(var chars=[],i=0;i=arr.length)throw new Error(INVALID_UTF8);var n1=arr[++i];if((n1&192)!=128)throw new Error(INVALID_UTF8);b=(b&31)<<6|n1&63,min=128}else if(b<240){if(i>=arr.length-1)throw new Error(INVALID_UTF8);var n1=arr[++i],n2=arr[++i];if((n1&192)!=128||(n2&192)!=128)throw new Error(INVALID_UTF8);b=(b&15)<<12|(n1&63)<<6|n2&63,min=2048}else if(b<248){if(i>=arr.length-2)throw new Error(INVALID_UTF8);var n1=arr[++i],n2=arr[++i],n3=arr[++i];if((n1&192)!=128||(n2&192)!=128||(n3&192)!=128)throw new Error(INVALID_UTF8);b=(b&15)<<18|(n1&63)<<12|(n2&63)<<6|n3&63,min=65536}else throw new Error(INVALID_UTF8);if(b=55296&&b<=57343)throw new Error(INVALID_UTF8);if(b>=65536){if(b>1114111)throw new Error(INVALID_UTF8);b-=65536,chars.push(String.fromCharCode(55296|b>>10)),b=56320|b&1023}}chars.push(String.fromCharCode(b))}return chars.join("")}exports2.decode=decode},function(module2,exports2,__webpack_require__){module2.exports=__webpack_require__(3).default},function(module2,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var ScriptReceiverFactory=function(){function ScriptReceiverFactory2(prefix2,name){this.lastId=0,this.prefix=prefix2,this.name=name}return ScriptReceiverFactory2.prototype.create=function(callback){this.lastId++;var number=this.lastId,id=this.prefix+number,name=this.name+"["+number+"]",called=!1,callbackWrapper=function(){called||(callback.apply(null,arguments),called=!0)};return this[number]=callbackWrapper,{number,id,name,callback:callbackWrapper}},ScriptReceiverFactory2.prototype.remove=function(receiver){delete this[receiver.number]},ScriptReceiverFactory2}(),ScriptReceivers=new ScriptReceiverFactory("_pusher_script_","Pusher.ScriptReceivers"),Defaults={VERSION:"7.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,cluster:"mt1",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:""},defaults=Defaults,dependency_loader_DependencyLoader=function(){function DependencyLoader(options){this.options=options,this.receivers=options.receivers||ScriptReceivers,this.loading={}}return DependencyLoader.prototype.load=function(name,options,callback){var self=this;if(self.loading[name]&&self.loading[name].length>0)self.loading[name].push(callback);else{self.loading[name]=[callback];var request=runtime.createScriptRequest(self.getPath(name,options)),receiver=self.receivers.create(function(error){if(self.receivers.remove(receiver),self.loading[name]){var callbacks=self.loading[name];delete self.loading[name];for(var successCallback=function(wasSuccessful){wasSuccessful||request.cleanup()},i=0;i>>6)+fromCharCode(128|cc&63):fromCharCode(224|cc>>>12&15)+fromCharCode(128|cc>>>6&63)+fromCharCode(128|cc&63)},utob=function(u){return u.replace(/[^\x00-\x7F]/g,cb_utob)},cb_encode=function(ccc){var padlen=[0,2,1][ccc.length%3],ord=ccc.charCodeAt(0)<<16|(ccc.length>1?ccc.charCodeAt(1):0)<<8|(ccc.length>2?ccc.charCodeAt(2):0),chars=[b64chars.charAt(ord>>>18),b64chars.charAt(ord>>>12&63),padlen>=2?"=":b64chars.charAt(ord>>>6&63),padlen>=1?"=":b64chars.charAt(ord&63)];return chars.join("")},btoa=window.btoa||function(b){return b.replace(/[\s\S]{1,3}/g,cb_encode)},Timer=function(){function Timer2(set,clear,delay,callback){var _this=this;this.clear=clear,this.timer=set(function(){_this.timer&&(_this.timer=callback(_this.timer))},delay)}return Timer2.prototype.isRunning=function(){return this.timer!==null},Timer2.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},Timer2}(),abstract_timer=Timer,timers_extends=function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();function timers_clearTimeout(timer){window.clearTimeout(timer)}function timers_clearInterval(timer){window.clearInterval(timer)}var OneOffTimer=function(_super){timers_extends(OneOffTimer2,_super);function OneOffTimer2(delay,callback){return _super.call(this,setTimeout,timers_clearTimeout,delay,function(timer){return callback(),null})||this}return OneOffTimer2}(abstract_timer),PeriodicTimer=function(_super){timers_extends(PeriodicTimer2,_super);function PeriodicTimer2(delay,callback){return _super.call(this,setInterval,timers_clearInterval,delay,function(timer){return callback(),timer})||this}return PeriodicTimer2}(abstract_timer),Util={now:function(){return Date.now?Date.now():new Date().valueOf()},defer:function(callback){return new OneOffTimer(0,callback)},method:function(name){for(var args=[],_i=1;_i0)for(var i=0;i=1002&&closeEvent.code<=1004?"backoff":null:closeEvent.code===4e3?"tls_only":closeEvent.code<4100?"refused":closeEvent.code<4200?"backoff":closeEvent.code<4300?"retry":"refused"},getCloseError:function(closeEvent){return closeEvent.code!==1e3&&closeEvent.code!==1001?{type:"PusherError",data:{code:closeEvent.code,message:closeEvent.reason||closeEvent.message}}:null}},protocol_protocol=Protocol,connection_extends=function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),connection_Connection=function(_super){connection_extends(Connection,_super);function Connection(id,transport){var _this=_super.call(this)||this;return _this.id=id,_this.transport=transport,_this.activityTimeout=transport.activityTimeout,_this.bindListeners(),_this}return Connection.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},Connection.prototype.send=function(data){return this.transport.send(data)},Connection.prototype.send_event=function(name,data,channel){var event={event:name,data};return channel&&(event.channel=channel),logger.debug("Event sent",event),this.send(protocol_protocol.encodeMessage(event))},Connection.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},Connection.prototype.close=function(){this.transport.close()},Connection.prototype.bindListeners=function(){var _this=this,listeners={message:function(messageEvent){var pusherEvent;try{pusherEvent=protocol_protocol.decodeMessage(messageEvent)}catch(e){_this.emit("error",{type:"MessageParseError",error:e,data:messageEvent.data})}if(pusherEvent!==void 0){switch(logger.debug("Event recd",pusherEvent),pusherEvent.event){case"pusher:error":_this.emit("error",{type:"PusherError",data:pusherEvent.data});break;case"pusher:ping":_this.emit("ping");break;case"pusher:pong":_this.emit("pong");break}_this.emit("message",pusherEvent)}},activity:function(){_this.emit("activity")},error:function(error){_this.emit("error",error)},closed:function(closeEvent){unbindListeners(),closeEvent&&closeEvent.code&&_this.handleCloseEvent(closeEvent),_this.transport=null,_this.emit("closed")}},unbindListeners=function(){objectApply(listeners,function(listener,event){_this.transport.unbind(event,listener)})};objectApply(listeners,function(listener,event){_this.transport.bind(event,listener)})},Connection.prototype.handleCloseEvent=function(closeEvent){var action=protocol_protocol.getCloseAction(closeEvent),error=protocol_protocol.getCloseError(closeEvent);error&&this.emit("error",error),action&&this.emit(action,{action,error})},Connection}(dispatcher),connection_connection=connection_Connection,handshake_Handshake=function(){function Handshake(transport,callback){this.transport=transport,this.callback=callback,this.bindListeners()}return Handshake.prototype.close=function(){this.unbindListeners(),this.transport.close()},Handshake.prototype.bindListeners=function(){var _this=this;this.onMessage=function(m){_this.unbindListeners();var result;try{result=protocol_protocol.processHandshake(m)}catch(e){_this.finish("error",{error:e}),_this.transport.close();return}result.action==="connected"?_this.finish("connected",{connection:new connection_connection(result.id,_this.transport),activityTimeout:result.activityTimeout}):(_this.finish(result.action,{error:result.error}),_this.transport.close())},this.onClosed=function(closeEvent){_this.unbindListeners();var action=protocol_protocol.getCloseAction(closeEvent)||"backoff",error=protocol_protocol.getCloseError(closeEvent);_this.finish(action,{error})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},Handshake.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},Handshake.prototype.finish=function(action,params){this.callback(extend({transport:this.transport,action},params))},Handshake}(),connection_handshake=handshake_Handshake,timeline_sender_TimelineSender=function(){function TimelineSender(timeline,options){this.timeline=timeline,this.options=options||{}}return TimelineSender.prototype.send=function(useTLS,callback){this.timeline.isEmpty()||this.timeline.send(runtime.TimelineTransport.getAgent(this,useTLS),callback)},TimelineSender}(),timeline_sender=timeline_sender_TimelineSender,channel_extends=function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),channel_Channel=function(_super){channel_extends(Channel2,_super);function Channel2(name,pusher){var _this=_super.call(this,function(event,data){logger.debug("No callbacks on "+name+" for "+event)})||this;return _this.name=name,_this.pusher=pusher,_this.subscribed=!1,_this.subscriptionPending=!1,_this.subscriptionCancelled=!1,_this}return Channel2.prototype.authorize=function(socketId,callback){return callback(null,{auth:""})},Channel2.prototype.trigger=function(event,data){if(event.indexOf("client-")!==0)throw new BadEventName("Event '"+event+"' does not start with 'client-'");if(!this.subscribed){var suffix=url_store.buildLogSuffix("triggeringClientEvents");logger.warn("Client event triggered before channel 'subscription_succeeded' event . "+suffix)}return this.pusher.send_event(event,data,this.name)},Channel2.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},Channel2.prototype.handleEvent=function(event){var eventName=event.event,data=event.data;if(eventName==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(event);else if(eventName==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(event);else if(eventName.indexOf("pusher_internal:")!==0){var metadata={};this.emit(eventName,data,metadata)}},Channel2.prototype.handleSubscriptionSucceededEvent=function(event){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",event.data)},Channel2.prototype.handleSubscriptionCountEvent=function(event){event.data.subscription_count&&(this.subscriptionCount=event.data.subscription_count),this.emit("pusher:subscription_count",event.data)},Channel2.prototype.subscribe=function(){var _this=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,function(error,data){error?(_this.subscriptionPending=!1,logger.error(error.toString()),_this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:error.message},error instanceof HTTPAuthError?{status:error.status}:{}))):_this.pusher.send_event("pusher:subscribe",{auth:data.auth,channel_data:data.channel_data,channel:_this.name})}))},Channel2.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},Channel2.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},Channel2.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},Channel2}(dispatcher),channels_channel=channel_Channel,private_channel_extends=function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),PrivateChannel=function(_super){private_channel_extends(PrivateChannel2,_super);function PrivateChannel2(){return _super!==null&&_super.apply(this,arguments)||this}return PrivateChannel2.prototype.authorize=function(socketId,callback){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId},callback)},PrivateChannel2}(channels_channel),private_channel=PrivateChannel,members_Members=function(){function Members(){this.reset()}return Members.prototype.get=function(id){return Object.prototype.hasOwnProperty.call(this.members,id)?{id,info:this.members[id]}:null},Members.prototype.each=function(callback){var _this=this;objectApply(this.members,function(member,id){callback(_this.get(id))})},Members.prototype.setMyID=function(id){this.myID=id},Members.prototype.onSubscription=function(subscriptionData){this.members=subscriptionData.presence.hash,this.count=subscriptionData.presence.count,this.me=this.get(this.myID)},Members.prototype.addMember=function(memberData){return this.get(memberData.user_id)===null&&this.count++,this.members[memberData.user_id]=memberData.user_info,this.get(memberData.user_id)},Members.prototype.removeMember=function(memberData){var member=this.get(memberData.user_id);return member&&(delete this.members[memberData.user_id],this.count--),member},Members.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},Members}(),members=members_Members,presence_channel_extends=function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),__awaiter=function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve2){resolve2(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=op[0]&2?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[op[0]&2,t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(t=_.trys,!(t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]0&&this.emit("connecting_in",Math.round(delay/1e3)),this.retryTimer=new OneOffTimer(delay||0,function(){_this.disconnectInternally(),_this.connect()})},ConnectionManager.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},ConnectionManager.prototype.setUnavailableTimer=function(){var _this=this;this.unavailableTimer=new OneOffTimer(this.options.unavailableTimeout,function(){_this.updateState("unavailable")})},ConnectionManager.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},ConnectionManager.prototype.sendActivityCheck=function(){var _this=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new OneOffTimer(this.options.pongTimeout,function(){_this.timeline.error({pong_timed_out:_this.options.pongTimeout}),_this.retryIn(0)})},ConnectionManager.prototype.resetActivityCheck=function(){var _this=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new OneOffTimer(this.activityTimeout,function(){_this.sendActivityCheck()}))},ConnectionManager.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},ConnectionManager.prototype.buildConnectionCallbacks=function(errorCallbacks){var _this=this;return extend({},errorCallbacks,{message:function(message){_this.resetActivityCheck(),_this.emit("message",message)},ping:function(){_this.send_event("pusher:pong",{})},activity:function(){_this.resetActivityCheck()},error:function(error){_this.emit("error",error)},closed:function(){_this.abandonConnection(),_this.shouldRetry()&&_this.retryIn(1e3)}})},ConnectionManager.prototype.buildHandshakeCallbacks=function(errorCallbacks){var _this=this;return extend({},errorCallbacks,{connected:function(handshake){_this.activityTimeout=Math.min(_this.options.activityTimeout,handshake.activityTimeout,handshake.connection.activityTimeout||Infinity),_this.clearUnavailableTimer(),_this.setConnection(handshake.connection),_this.socket_id=_this.connection.id,_this.updateState("connected",{socket_id:_this.socket_id})}})},ConnectionManager.prototype.buildErrorCallbacks=function(){var _this=this,withErrorEmitted=function(callback){return function(result){result.error&&_this.emit("error",{type:"WebSocketError",error:result.error}),callback(result)}};return{tls_only:withErrorEmitted(function(){_this.usingTLS=!0,_this.updateStrategy(),_this.retryIn(0)}),refused:withErrorEmitted(function(){_this.disconnect()}),backoff:withErrorEmitted(function(){_this.retryIn(1e3)}),retry:withErrorEmitted(function(){_this.retryIn(0)})}},ConnectionManager.prototype.setConnection=function(connection){this.connection=connection;for(var event in this.connectionCallbacks)this.connection.bind(event,this.connectionCallbacks[event]);this.resetActivityCheck()},ConnectionManager.prototype.abandonConnection=function(){if(!!this.connection){this.stopActivityCheck();for(var event in this.connectionCallbacks)this.connection.unbind(event,this.connectionCallbacks[event]);var connection=this.connection;return this.connection=null,connection}},ConnectionManager.prototype.updateState=function(newState,data){var previousState=this.state;if(this.state=newState,previousState!==newState){var newStateDescription=newState;newStateDescription==="connected"&&(newStateDescription+=" with new socket ID "+data.socket_id),logger.debug("State changed",previousState+" -> "+newStateDescription),this.timeline.info({state:newState,params:data}),this.emit("state_change",{previous:previousState,current:newState}),this.emit(newState,data)}},ConnectionManager.prototype.shouldRetry=function(){return this.state==="connecting"||this.state==="connected"},ConnectionManager}(dispatcher),connection_manager=connection_manager_ConnectionManager,channels_Channels=function(){function Channels(){this.channels={}}return Channels.prototype.add=function(name,pusher){return this.channels[name]||(this.channels[name]=createChannel(name,pusher)),this.channels[name]},Channels.prototype.all=function(){return values(this.channels)},Channels.prototype.find=function(name){return this.channels[name]},Channels.prototype.remove=function(name){var channel=this.channels[name];return delete this.channels[name],channel},Channels.prototype.disconnect=function(){objectApply(this.channels,function(channel){channel.disconnect()})},Channels}(),channels=channels_Channels;function createChannel(name,pusher){if(name.indexOf("private-encrypted-")===0){if(pusher.config.nacl)return factory.createEncryptedChannel(name,pusher,pusher.config.nacl);var errMsg="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",suffix=url_store.buildLogSuffix("encryptedChannelSupport");throw new UnsupportedFeature(errMsg+". "+suffix)}else{if(name.indexOf("private-")===0)return factory.createPrivateChannel(name,pusher);if(name.indexOf("presence-")===0)return factory.createPresenceChannel(name,pusher);if(name.indexOf("#")===0)throw new BadChannelName('Cannot create a channel with name "'+name+'".');return factory.createChannel(name,pusher)}}var Factory={createChannels:function(){return new channels},createConnectionManager:function(key,options){return new connection_manager(key,options)},createChannel:function(name,pusher){return new channels_channel(name,pusher)},createPrivateChannel:function(name,pusher){return new private_channel(name,pusher)},createPresenceChannel:function(name,pusher){return new presence_channel(name,pusher)},createEncryptedChannel:function(name,pusher,nacl){return new encrypted_channel(name,pusher,nacl)},createTimelineSender:function(timeline,options){return new timeline_sender(timeline,options)},createHandshake:function(transport,callback){return new connection_handshake(transport,callback)},createAssistantToTheTransportManager:function(manager,transport,options){return new assistant_to_the_transport_manager(manager,transport,options)}},factory=Factory,transport_manager_TransportManager=function(){function TransportManager(options){this.options=options||{},this.livesLeft=this.options.lives||Infinity}return TransportManager.prototype.getAssistant=function(transport){return factory.createAssistantToTheTransportManager(this,transport,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},TransportManager.prototype.isAlive=function(){return this.livesLeft>0},TransportManager.prototype.reportDeath=function(){this.livesLeft-=1},TransportManager}(),transport_manager=transport_manager_TransportManager,sequential_strategy_SequentialStrategy=function(){function SequentialStrategy(strategies,options){this.strategies=strategies,this.loop=Boolean(options.loop),this.failFast=Boolean(options.failFast),this.timeout=options.timeout,this.timeoutLimit=options.timeoutLimit}return SequentialStrategy.prototype.isSupported=function(){return any(this.strategies,util.method("isSupported"))},SequentialStrategy.prototype.connect=function(minPriority,callback){var _this=this,strategies=this.strategies,current=0,timeout=this.timeout,runner=null,tryNextStrategy=function(error,handshake){handshake?callback(null,handshake):(current=current+1,_this.loop&&(current=current%strategies.length),current0&&(timer=new OneOffTimer(options.timeout,function(){runner.abort(),callback(!0)})),runner=strategy.connect(minPriority,function(error,handshake){error&&timer&&timer.isRunning()&&!options.failFast||(timer&&timer.ensureAborted(),callback(error,handshake))}),{abort:function(){timer&&timer.ensureAborted(),runner.abort()},forceMinPriority:function(p){runner.forceMinPriority(p)}}},SequentialStrategy}(),sequential_strategy=sequential_strategy_SequentialStrategy,best_connected_ever_strategy_BestConnectedEverStrategy=function(){function BestConnectedEverStrategy(strategies){this.strategies=strategies}return BestConnectedEverStrategy.prototype.isSupported=function(){return any(this.strategies,util.method("isSupported"))},BestConnectedEverStrategy.prototype.connect=function(minPriority,callback){return connect(this.strategies,minPriority,function(i,runners){return function(error,handshake){if(runners[i].error=error,error){allRunnersFailed(runners)&&callback(!0);return}apply(runners,function(runner){runner.forceMinPriority(handshake.transport.priority)}),callback(null,handshake)}})},BestConnectedEverStrategy}(),best_connected_ever_strategy=best_connected_ever_strategy_BestConnectedEverStrategy;function connect(strategies,minPriority,callbackBuilder){var runners=map(strategies,function(strategy,i,_,rs){return strategy.connect(minPriority,callbackBuilder(i,rs))});return{abort:function(){apply(runners,abortRunner)},forceMinPriority:function(p){apply(runners,function(runner){runner.forceMinPriority(p)})}}}function allRunnersFailed(runners){return collections_all(runners,function(runner){return Boolean(runner.error)})}function abortRunner(runner){!runner.error&&!runner.aborted&&(runner.abort(),runner.aborted=!0)}var cached_strategy_CachedStrategy=function(){function CachedStrategy(strategy,transports2,options){this.strategy=strategy,this.transports=transports2,this.ttl=options.ttl||1800*1e3,this.usingTLS=options.useTLS,this.timeline=options.timeline}return CachedStrategy.prototype.isSupported=function(){return this.strategy.isSupported()},CachedStrategy.prototype.connect=function(minPriority,callback){var usingTLS=this.usingTLS,info=fetchTransportCache(usingTLS),strategies=[this.strategy];if(info&&info.timestamp+this.ttl>=util.now()){var transport=this.transports[info.transport];transport&&(this.timeline.info({cached:!0,transport:info.transport,latency:info.latency}),strategies.push(new sequential_strategy([transport],{timeout:info.latency*2+1e3,failFast:!0})))}var startTimestamp=util.now(),runner=strategies.pop().connect(minPriority,function cb(error,handshake){error?(flushTransportCache(usingTLS),strategies.length>0?(startTimestamp=util.now(),runner=strategies.pop().connect(minPriority,cb)):callback(error)):(storeTransportCache(usingTLS,handshake.transport.name,util.now()-startTimestamp),callback(null,handshake))});return{abort:function(){runner.abort()},forceMinPriority:function(p){minPriority=p,runner&&runner.forceMinPriority(p)}}},CachedStrategy}(),cached_strategy=cached_strategy_CachedStrategy;function getTransportCacheKey(usingTLS){return"pusherTransport"+(usingTLS?"TLS":"NonTLS")}function fetchTransportCache(usingTLS){var storage=runtime.getLocalStorage();if(storage)try{var serializedCache=storage[getTransportCacheKey(usingTLS)];if(serializedCache)return JSON.parse(serializedCache)}catch(e){flushTransportCache(usingTLS)}return null}function storeTransportCache(usingTLS,transport,latency){var storage=runtime.getLocalStorage();if(storage)try{storage[getTransportCacheKey(usingTLS)]=safeJSONStringify({timestamp:util.now(),transport,latency})}catch(e){}}function flushTransportCache(usingTLS){var storage=runtime.getLocalStorage();if(storage)try{delete storage[getTransportCacheKey(usingTLS)]}catch(e){}}var delayed_strategy_DelayedStrategy=function(){function DelayedStrategy(strategy,_a){var number=_a.delay;this.strategy=strategy,this.options={delay:number}}return DelayedStrategy.prototype.isSupported=function(){return this.strategy.isSupported()},DelayedStrategy.prototype.connect=function(minPriority,callback){var strategy=this.strategy,runner,timer=new OneOffTimer(this.options.delay,function(){runner=strategy.connect(minPriority,callback)});return{abort:function(){timer.ensureAborted(),runner&&runner.abort()},forceMinPriority:function(p){minPriority=p,runner&&runner.forceMinPriority(p)}}},DelayedStrategy}(),delayed_strategy=delayed_strategy_DelayedStrategy,IfStrategy=function(){function IfStrategy2(test,trueBranch,falseBranch){this.test=test,this.trueBranch=trueBranch,this.falseBranch=falseBranch}return IfStrategy2.prototype.isSupported=function(){var branch=this.test()?this.trueBranch:this.falseBranch;return branch.isSupported()},IfStrategy2.prototype.connect=function(minPriority,callback){var branch=this.test()?this.trueBranch:this.falseBranch;return branch.connect(minPriority,callback)},IfStrategy2}(),if_strategy=IfStrategy,FirstConnectedStrategy=function(){function FirstConnectedStrategy2(strategy){this.strategy=strategy}return FirstConnectedStrategy2.prototype.isSupported=function(){return this.strategy.isSupported()},FirstConnectedStrategy2.prototype.connect=function(minPriority,callback){var runner=this.strategy.connect(minPriority,function(error,handshake){handshake&&runner.abort(),callback(error,handshake)});return runner},FirstConnectedStrategy2}(),first_connected_strategy=FirstConnectedStrategy;function testSupportsStrategy(strategy){return function(){return strategy.isSupported()}}var getDefaultStrategy=function(config,baseOptions,defineTransport){var definedTransports={};function defineTransportStrategy(name,type,priority,options,manager){var transport=defineTransport(config,name,type,priority,options,manager);return definedTransports[name]=transport,transport}var ws_options=Object.assign({},baseOptions,{hostNonTLS:config.wsHost+":"+config.wsPort,hostTLS:config.wsHost+":"+config.wssPort,httpPath:config.wsPath}),wss_options=Object.assign({},ws_options,{useTLS:!0}),sockjs_options=Object.assign({},baseOptions,{hostNonTLS:config.httpHost+":"+config.httpPort,hostTLS:config.httpHost+":"+config.httpsPort,httpPath:config.httpPath}),timeouts={loop:!0,timeout:15e3,timeoutLimit:6e4},ws_manager=new transport_manager({lives:2,minPingDelay:1e4,maxPingDelay:config.activityTimeout}),streaming_manager=new transport_manager({lives:2,minPingDelay:1e4,maxPingDelay:config.activityTimeout}),ws_transport=defineTransportStrategy("ws","ws",3,ws_options,ws_manager),wss_transport=defineTransportStrategy("wss","ws",3,wss_options,ws_manager),sockjs_transport=defineTransportStrategy("sockjs","sockjs",1,sockjs_options),xhr_streaming_transport=defineTransportStrategy("xhr_streaming","xhr_streaming",1,sockjs_options,streaming_manager),xdr_streaming_transport=defineTransportStrategy("xdr_streaming","xdr_streaming",1,sockjs_options,streaming_manager),xhr_polling_transport=defineTransportStrategy("xhr_polling","xhr_polling",1,sockjs_options),xdr_polling_transport=defineTransportStrategy("xdr_polling","xdr_polling",1,sockjs_options),ws_loop=new sequential_strategy([ws_transport],timeouts),wss_loop=new sequential_strategy([wss_transport],timeouts),sockjs_loop=new sequential_strategy([sockjs_transport],timeouts),streaming_loop=new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport),xhr_streaming_transport,xdr_streaming_transport)],timeouts),polling_loop=new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport),xhr_polling_transport,xdr_polling_transport)],timeouts),http_loop=new sequential_strategy([new if_strategy(testSupportsStrategy(streaming_loop),new best_connected_ever_strategy([streaming_loop,new delayed_strategy(polling_loop,{delay:4e3})]),polling_loop)],timeouts),http_fallback_loop=new if_strategy(testSupportsStrategy(http_loop),http_loop,sockjs_loop),wsStrategy;return baseOptions.useTLS?wsStrategy=new best_connected_ever_strategy([ws_loop,new delayed_strategy(http_fallback_loop,{delay:2e3})]):wsStrategy=new best_connected_ever_strategy([ws_loop,new delayed_strategy(wss_loop,{delay:2e3}),new delayed_strategy(http_fallback_loop,{delay:5e3})]),new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport),wsStrategy,http_fallback_loop)),definedTransports,{ttl:18e5,timeline:baseOptions.timeline,useTLS:baseOptions.useTLS})},default_strategy=getDefaultStrategy,transport_connection_initializer=function(){var self=this;self.timeline.info(self.buildTimelineMessage({transport:self.name+(self.options.useTLS?"s":"")})),self.hooks.isInitialized()?self.changeState("initialized"):self.hooks.file?(self.changeState("initializing"),Dependencies.load(self.hooks.file,{useTLS:self.options.useTLS},function(error,callback){self.hooks.isInitialized()?(self.changeState("initialized"),callback(!0)):(error&&self.onError(error),self.onClose(),callback(!1))})):self.onClose()},http_xdomain_request_hooks={getRequest:function(socket){var xdr=new window.XDomainRequest;return xdr.ontimeout=function(){socket.emit("error",new RequestTimedOut),socket.close()},xdr.onerror=function(e){socket.emit("error",e),socket.close()},xdr.onprogress=function(){xdr.responseText&&xdr.responseText.length>0&&socket.onChunk(200,xdr.responseText)},xdr.onload=function(){xdr.responseText&&xdr.responseText.length>0&&socket.onChunk(200,xdr.responseText),socket.emit("finished",200),socket.close()},xdr},abortRequest:function(xdr){xdr.ontimeout=xdr.onerror=xdr.onprogress=xdr.onload=null,xdr.abort()}},http_xdomain_request=http_xdomain_request_hooks,http_request_extends=function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)b2.hasOwnProperty(p)&&(d2[p]=b2[p])},extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),MAX_BUFFER_LENGTH=256*1024,http_request_HTTPRequest=function(_super){http_request_extends(HTTPRequest,_super);function HTTPRequest(hooks,method,url){var _this=_super.call(this)||this;return _this.hooks=hooks,_this.method=method,_this.url=url,_this}return HTTPRequest.prototype.start=function(payload){var _this=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){_this.close()},runtime.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(payload)},HTTPRequest.prototype.close=function(){this.unloader&&(runtime.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},HTTPRequest.prototype.onChunk=function(status,data){for(;;){var chunk=this.advanceBuffer(data);if(chunk)this.emit("chunk",{status,data:chunk});else break}this.isBufferTooLong(data)&&this.emit("buffer_too_long")},HTTPRequest.prototype.advanceBuffer=function(buffer){var unreadData=buffer.slice(this.position),endOfLinePosition=unreadData.indexOf(` +`);return endOfLinePosition!==-1?(this.position+=endOfLinePosition+1,unreadData.slice(0,endOfLinePosition)):null},HTTPRequest.prototype.isBufferTooLong=function(buffer){return this.position===buffer.length&&buffer.length>MAX_BUFFER_LENGTH},HTTPRequest}(dispatcher),http_request=http_request_HTTPRequest,State;(function(State2){State2[State2.CONNECTING=0]="CONNECTING",State2[State2.OPEN=1]="OPEN",State2[State2.CLOSED=3]="CLOSED"})(State||(State={}));var state=State,autoIncrement=1,http_socket_HTTPSocket=function(){function HTTPSocket(hooks,url){this.hooks=hooks,this.session=randomNumber(1e3)+"/"+randomString(8),this.location=getLocation(url),this.readyState=state.CONNECTING,this.openStream()}return HTTPSocket.prototype.send=function(payload){return this.sendRaw(JSON.stringify([payload]))},HTTPSocket.prototype.ping=function(){this.hooks.sendHeartbeat(this)},HTTPSocket.prototype.close=function(code,reason){this.onClose(code,reason,!0)},HTTPSocket.prototype.sendRaw=function(payload){if(this.readyState===state.OPEN)try{return runtime.createSocketRequest("POST",getUniqueURL(getSendURL(this.location,this.session))).start(payload),!0}catch(e){return!1}else return!1},HTTPSocket.prototype.reconnect=function(){this.closeStream(),this.openStream()},HTTPSocket.prototype.onClose=function(code,reason,wasClean){this.closeStream(),this.readyState=state.CLOSED,this.onclose&&this.onclose({code,reason,wasClean})},HTTPSocket.prototype.onChunk=function(chunk){if(chunk.status===200){this.readyState===state.OPEN&&this.onActivity();var payload,type=chunk.data.slice(0,1);switch(type){case"o":payload=JSON.parse(chunk.data.slice(1)||"{}"),this.onOpen(payload);break;case"a":payload=JSON.parse(chunk.data.slice(1)||"[]");for(var i=0;i0&&socket.onChunk(xhr.status,xhr.responseText);break;case 4:xhr.responseText&&xhr.responseText.length>0&&socket.onChunk(xhr.status,xhr.responseText),socket.emit("finished",xhr.status),socket.close();break}},xhr},abortRequest:function(xhr){xhr.onreadystatechange=null,xhr.abort()}},http_xhr_request=http_xhr_request_hooks,HTTP={createStreamingSocket:function(url){return this.createSocket(http_streaming_socket,url)},createPollingSocket:function(url){return this.createSocket(http_polling_socket,url)},createSocket:function(hooks,url){return new http_socket(hooks,url)},createXHR:function(method,url){return this.createRequest(http_xhr_request,method,url)},createRequest:function(hooks,method,url){return new http_request(hooks,method,url)}},http_http=HTTP;http_http.createXDR=function(method,url){return this.createRequest(http_xdomain_request,method,url)};var web_http_http=http_http,Runtime={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers,DependenciesReceivers,getDefaultStrategy:default_strategy,Transports:transports_transports,transportConnectionInitializer:transport_connection_initializer,HTTPFactory:web_http_http,TimelineTransport:jsonp_timeline,getXHRAPI:function(){return window.XMLHttpRequest},getWebSocketAPI:function(){return window.WebSocket||window.MozWebSocket},setup:function(PusherClass){var _this=this;window.Pusher=PusherClass;var initializeOnDocumentBody=function(){_this.onDocumentBody(PusherClass.ready)};window.JSON?initializeOnDocumentBody():Dependencies.load("json2",{},initializeOnDocumentBody)},getDocument:function(){return document},getProtocol:function(){return this.getDocument().location.protocol},getAuthorizers:function(){return{ajax:xhr_auth,jsonp:jsonp_auth}},onDocumentBody:function(callback){var _this=this;document.body?callback():setTimeout(function(){_this.onDocumentBody(callback)},0)},createJSONPRequest:function(url,data){return new jsonp_request(url,data)},createScriptRequest:function(src){return new script_request(src)},getLocalStorage:function(){try{return window.localStorage}catch(e){return}},createXHR:function(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest:function(){var Constructor=this.getXHRAPI();return new Constructor},createMicrosoftXHR:function(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork:function(){return net_info_Network},createWebSocket:function(url){var Constructor=this.getWebSocketAPI();return new Constructor(url)},createSocketRequest:function(method,url){if(this.isXHRSupported())return this.HTTPFactory.createXHR(method,url);if(this.isXDRSupported(url.indexOf("https:")===0))return this.HTTPFactory.createXDR(method,url);throw"Cross-origin HTTP requests are not supported"},isXHRSupported:function(){var Constructor=this.getXHRAPI();return Boolean(Constructor)&&new Constructor().withCredentials!==void 0},isXDRSupported:function(useTLS){var protocol=useTLS?"https:":"http:",documentProtocol=this.getProtocol();return Boolean(window.XDomainRequest)&&documentProtocol===protocol},addUnloadListener:function(listener){window.addEventListener!==void 0?window.addEventListener("unload",listener,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",listener)},removeUnloadListener:function(listener){window.addEventListener!==void 0?window.removeEventListener("unload",listener,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",listener)}},runtime=Runtime,TimelineLevel;(function(TimelineLevel2){TimelineLevel2[TimelineLevel2.ERROR=3]="ERROR",TimelineLevel2[TimelineLevel2.INFO=6]="INFO",TimelineLevel2[TimelineLevel2.DEBUG=7]="DEBUG"})(TimelineLevel||(TimelineLevel={}));var timeline_level=TimelineLevel,timeline_Timeline=function(){function Timeline(key,session,options){this.key=key,this.session=session,this.events=[],this.options=options||{},this.sent=0,this.uniqueID=0}return Timeline.prototype.log=function(level,event){level<=this.options.level&&(this.events.push(extend({},event,{timestamp:util.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},Timeline.prototype.error=function(event){this.log(timeline_level.ERROR,event)},Timeline.prototype.info=function(event){this.log(timeline_level.INFO,event)},Timeline.prototype.debug=function(event){this.log(timeline_level.DEBUG,event)},Timeline.prototype.isEmpty=function(){return this.events.length===0},Timeline.prototype.send=function(sendfn,callback){var _this=this,data=extend({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=[],sendfn(data,function(error,result){error||_this.sent++,callback&&callback(error,result)}),!0},Timeline.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},Timeline}(),timeline_timeline=timeline_Timeline,transport_strategy_TransportStrategy=function(){function TransportStrategy(name,priority,transport,options){this.name=name,this.priority=priority,this.transport=transport,this.options=options||{}}return TransportStrategy.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},TransportStrategy.prototype.connect=function(minPriority,callback){var _this=this;if(this.isSupported()){if(this.priority>>18&63),e+=this._encodeByte(r>>>12&63),e+=this._encodeByte(r>>>6&63),e+=this._encodeByte(r>>>0&63)}var i=t.length-n;return i>0&&(r=t[n]<<16|(2===i?t[n+1]<<8:0),e+=this._encodeByte(r>>>18&63),e+=this._encodeByte(r>>>12&63),e+=2===i?this._encodeByte(r>>>6&63):this._paddingCharacter||"",e+=this._paddingCharacter||""),e},t.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(6*t+7)/8|0},t.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},t.prototype.decode=function(t){if(0===t.length)return new Uint8Array(0);for(var e=this._getPaddingLength(t),n=t.length-e,r=new Uint8Array(this.maxDecodedLength(n)),i=0,s=0,c=0,a=0,u=0,h=0,l=0;s>>4,r[i++]=u<<4|h>>>2,r[i++]=h<<6|l,c|=a&o,c|=u&o,c|=h&o,c|=l&o;if(s>>4,c|=a&o,c|=u&o),s>>2,c|=h&o),s>>8&6,e+=51-t>>>8&-75,e+=61-t>>>8&-15,e+=62-t>>>8&3,String.fromCharCode(e)},t.prototype._decodeChar=function(t){var e=o;return e+=(42-t&t-44)>>>8&-256+t-43+62,e+=(46-t&t-48)>>>8&-256+t-47+63,e+=(47-t&t-58)>>>8&-256+t-48+52,e+=(64-t&t-91)>>>8&-256+t-65+0,e+=(96-t&t-123)>>>8&-256+t-97+26},t.prototype._getPaddingLength=function(t){var e=0;if(this._paddingCharacter){for(var n=t.length-1;n>=0&&t[n]===this._paddingCharacter;n--)e++;if(t.length<4||e>2)throw new Error("Base64Coder: incorrect padding")}return e},t}();e.Coder=s;var c=new s;e.encode=function(t){return c.encode(t)},e.decode=function(t){return c.decode(t)};var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._encodeByte=function(t){var e=t;return e+=65,e+=25-t>>>8&6,e+=51-t>>>8&-75,e+=61-t>>>8&-13,e+=62-t>>>8&49,String.fromCharCode(e)},e.prototype._decodeChar=function(t){var e=o;return e+=(44-t&t-46)>>>8&-256+t-45+62,e+=(94-t&t-96)>>>8&-256+t-95+63,e+=(47-t&t-58)>>>8&-256+t-48+52,e+=(64-t&t-91)>>>8&-256+t-65+0,e+=(96-t&t-123)>>>8&-256+t-97+26},e}(s);e.URLSafeCoder=a;var u=new a;e.encodeURLSafe=function(t){return u.encode(t)},e.decodeURLSafe=function(t){return u.decode(t)},e.encodedLength=function(t){return c.encodedLength(t)},e.maxDecodedLength=function(t){return c.maxDecodedLength(t)},e.decodedLength=function(t){return c.decodedLength(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="utf8: invalid string",i="utf8: invalid source encoding";function o(t){for(var e=0,n=0;n=t.length-1)throw new Error(r);n++,e+=4}}return e}e.encode=function(t){for(var e=new Uint8Array(o(t)),n=0,r=0;r>6,e[n++]=128|63&i):i<55296?(e[n++]=224|i>>12,e[n++]=128|i>>6&63,e[n++]=128|63&i):(r++,i=(1023&i)<<10,i|=1023&t.charCodeAt(r),i+=65536,e[n++]=240|i>>18,e[n++]=128|i>>12&63,e[n++]=128|i>>6&63,e[n++]=128|63&i)}return e},e.encodedLength=o,e.decode=function(t){for(var e=[],n=0;n=t.length)throw new Error(i);if(128!=(192&(s=t[++n])))throw new Error(i);r=(31&r)<<6|63&s,o=128}else if(r<240){if(n>=t.length-1)throw new Error(i);var s=t[++n],c=t[++n];if(128!=(192&s)||128!=(192&c))throw new Error(i);r=(15&r)<<12|(63&s)<<6|63&c,o=2048}else{if(!(r<248))throw new Error(i);if(n>=t.length-2)throw new Error(i);s=t[++n],c=t[++n];var a=t[++n];if(128!=(192&s)||128!=(192&c)||128!=(192&a))throw new Error(i);r=(15&r)<<18|(63&s)<<12|(63&c)<<6|63&a,o=65536}if(r=55296&&r<=57343)throw new Error(i);if(r>=65536){if(r>1114111)throw new Error(i);r-=65536,e.push(String.fromCharCode(55296|r>>10)),r=56320|1023&r}}e.push(String.fromCharCode(r))}return e.join("")}},function(t,e,n){t.exports=n(3).default},function(t,e,n){"use strict";n.r(e);var r,i=function(){function t(t,e){this.lastId=0,this.prefix=t,this.name=e}return t.prototype.create=function(t){this.lastId++;var e=this.lastId,n=this.prefix+e,r=this.name+"["+e+"]",i=!1,o=function(){i||(t.apply(null,arguments),i=!0)};return this[e]=o,{number:e,id:n,name:r,callback:o}},t.prototype.remove=function(t){delete this[t.number]},t}(),o=new i("_pusher_script_","Pusher.ScriptReceivers"),s={VERSION:"7.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,cluster:"mt1",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:""},c=function(){function t(t){this.options=t,this.receivers=t.receivers||o,this.loading={}}return t.prototype.load=function(t,e,n){var r=this;if(r.loading[t]&&r.loading[t].length>0)r.loading[t].push(n);else{r.loading[t]=[n];var i=xe.createScriptRequest(r.getPath(t,e)),o=r.receivers.create((function(e){if(r.receivers.remove(o),r.loading[t]){var n=r.loading[t];delete r.loading[t];for(var s=function(t){t||i.cleanup()},c=0;c>>6)+C(128|63&e):C(224|e>>>12&15)+C(128|e>>>6&63)+C(128|63&e)},x=function(t){return t.replace(/[^\x00-\x7F]/g,A)},L=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[T.charAt(n>>>18),T.charAt(n>>>12&63),e>=2?"=":T.charAt(n>>>6&63),e>=1?"=":T.charAt(63&n)].join("")},j=window.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,L)},R=function(){function t(t,e,n,r){var i=this;this.clear=e,this.timer=t((function(){i.timer&&(i.timer=r(i.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),I=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function D(t){window.clearTimeout(t)}function N(t){window.clearInterval(t)}var H=function(t){function e(e,n){return t.call(this,setTimeout,D,e,(function(t){return n(),null}))||this}return I(e,t),e}(R),M=function(t){function e(e,n){return t.call(this,setInterval,N,e,(function(t){return n(),t}))||this}return I(e,t),e}(R),q={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new H(0,t)},method:function(t){for(var e=[],n=1;n0)for(r=0;r=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},Rt=jt,It=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dt=function(t){function e(e,n){var r=t.call(this)||this;return r.id=e,r.transport=n,r.activityTimeout=n.activityTimeout,r.bindListeners(),r}return It(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var r={event:t,data:e};return n&&(r.channel=n),et.debug("Event sent",r),this.send(Rt.encodeMessage(r))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=Rt.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(et.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",e)},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){X(e,(function(e,n){t.transport.unbind(n,e)}))};X(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=Rt.getCloseAction(t),n=Rt.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(ft),Nt=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=Rt.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new Dt(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=Rt.getCloseAction(e)||"backoff",r=Rt.getCloseError(e);t.finish(n,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(z({transport:this.transport,action:t},e))},t}(),Ht=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(xe.TimelineTransport.getAgent(this,t),e)},t}(),Mt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qt=function(t){function e(e,n){var r=t.call(this,(function(t,n){et.debug("No callbacks on "+e+" for "+t)}))||this;return r.name=e,r.pusher=n,r.subscribed=!1,r.subscriptionPending=!1,r.subscriptionCancelled=!1,r}return Mt(e,t),e.prototype.authorize=function(t,e){return e(null,{auth:""})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new d("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=l("triggeringClientEvents");et.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;"pusher_internal:subscription_succeeded"===e?this.handleSubscriptionSucceededEvent(t):"pusher_internal:subscription_count"===e?this.handleSubscriptionCountEvent(t):0!==e.indexOf("pusher_internal:")&&this.emit(e,n,{})},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.handleSubscriptionCountEvent=function(t){t.data.subscription_count&&(this.subscriptionCount=t.data.subscription_count),this.emit("pusher:subscription_count",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(t.subscriptionPending=!1,et.error(e.toString()),t.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:e.message},e instanceof _?{status:e.status}:{}))):t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name})})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(ft),Ut=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),zt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ut(e,t),e.prototype.authorize=function(t,e){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:t},e)},e}(qt),Bt=zt,Ft=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;X(this.members,(function(n,r){t(e.get(r))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),Xt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Jt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(s,c)}a((r=r.apply(t,e||[])).next())}))},Wt=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new H(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new H(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new H(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new H(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return z({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",t)},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return z({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var r=t;"connected"===r&&(r+=" with new socket ID "+e.socket_id),et.debug("State changed",n+" -> "+r),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(ft),te=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){if(0===t.indexOf("private-encrypted-")){if(e.config.nacl)return ne.createEncryptedChannel(t,e,e.config.nacl);var n="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",r=l("encryptedChannelSupport");throw new m(n+". "+r)}if(0===t.indexOf("private-"))return ne.createPrivateChannel(t,e);if(0===t.indexOf("presence-"))return ne.createPresenceChannel(t,e);if(0===t.indexOf("#"))throw new y('Cannot create a channel with name "'+t+'".');return ne.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return X(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){X(this.channels,(function(t){t.disconnect()}))},t}(),ee=te,ne={createChannels:function(){return new ee},createConnectionManager:function(t,e){return new Zt(t,e)},createChannel:function(t,e){return new qt(t,e)},createPrivateChannel:function(t,e){return new Bt(t,e)},createPresenceChannel:function(t,e){return new Vt(t,e)},createEncryptedChannel:function(t,e,n){return new Yt(t,e,n)},createTimelineSender:function(t,e){return new Ht(t,e)},createHandshake:function(t,e){return new Nt(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new Lt(t,e,n)}},re=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return ne.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),ie=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return K(this.strategies,U.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,r=this.strategies,i=0,o=this.timeout,s=null,c=function(a,u){u?e(null,u):(i+=1,n.loop&&(i%=r.length),i0&&(i=new H(n.timeout,(function(){o.abort(),r(!0)}))),o=t.connect(e,(function(t,e){t&&i&&i.isRunning()&&!n.failFast||(i&&i.ensureAborted(),r(t,e))})),{abort:function(){i&&i.ensureAborted(),o.abort()},forceMinPriority:function(t){o.forceMinPriority(t)}}},t}(),oe=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return K(this.strategies,U.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var r=V(t,(function(t,r,i,o){return t.connect(e,n(r,o))}));return{abort:function(){W(r,se)},forceMinPriority:function(t){W(r,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(r,i){n[t].error=r,r?function(t){return function(t,e){for(var n=0;n=U.now()){var o=this.transports[r.transport];o&&(this.timeline.info({cached:!0,transport:r.transport,latency:r.latency}),i.push(new ie([o],{timeout:2*r.latency+1e3,failFast:!0})))}var s=U.now(),c=i.pop().connect(t,(function r(o,a){o?(he(n),i.length>0?(s=U.now(),c=i.pop().connect(t,r)):e(o)):(function(t,e,n){var r=xe.getLocalStorage();if(r)try{r[ue(t)]=Z({timestamp:U.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,U.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}(),ae=ce;function ue(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function he(t){var e=xe.getLocalStorage();if(e)try{delete e[ue(t)]}catch(t){}}var le=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,r=this.strategy,i=new H(this.options.delay,(function(){n=r.connect(t,e)}));return{abort:function(){i.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),pe=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),fe=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,r){r&&n.abort(),e(t,r)}));return n},t}();function de(t){return function(){return t.isSupported()}}var ye,ve=function(t,e,n){var r={};function i(e,i,o,s,c){var a=n(t,e,i,o,s,c);return r[e]=a,a}var o,s=Object.assign({},e,{hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath}),c=Object.assign({},s,{useTLS:!0}),a=Object.assign({},e,{hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath}),u={loop:!0,timeout:15e3,timeoutLimit:6e4},h=new re({lives:2,minPingDelay:1e4,maxPingDelay:t.activityTimeout}),l=new re({lives:2,minPingDelay:1e4,maxPingDelay:t.activityTimeout}),p=i("ws","ws",3,s,h),f=i("wss","ws",3,c,h),d=i("sockjs","sockjs",1,a),y=i("xhr_streaming","xhr_streaming",1,a,l),v=i("xdr_streaming","xdr_streaming",1,a,l),b=i("xhr_polling","xhr_polling",1,a),g=i("xdr_polling","xdr_polling",1,a),m=new ie([p],u),w=new ie([f],u),k=new ie([d],u),_=new ie([new pe(de(y),y,v)],u),S=new ie([new pe(de(b),b,g)],u),C=new ie([new pe(de(_),new oe([_,new le(S,{delay:4e3})]),S)],u),T=new pe(de(C),C,k);return o=e.useTLS?new oe([m,new le(T,{delay:2e3})]):new oe([m,new le(w,{delay:2e3}),new le(T,{delay:5e3})]),new ae(new fe(new pe(de(p),o,T)),r,{ttl:18e5,timeline:e.timeline,useTLS:e.useTLS})},be={getRequest:function(t){var e=new window.XDomainRequest;return e.ontimeout=function(){t.emit("error",new v),t.close()},e.onerror=function(e){t.emit("error",e),t.close()},e.onprogress=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText)},e.onload=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText),t.emit("finished",200),t.close()},e},abortRequest:function(t){t.ontimeout=t.onerror=t.onprogress=t.onload=null,t.abort()}},ge=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),me=function(t){function e(e,n,r){var i=t.call(this)||this;return i.hooks=e,i.method=n,i.url=r,i}return ge(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},xe.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(xe.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(ft);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(ye||(ye={}));var we=ye,ke=1;function _e(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+ke++}function Se(t){return Math.floor(Math.random()*t)}var Ce,Te=function(){function t(t,e){this.hooks=t,this.session=Se(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},Ae={createStreamingSocket:function(t){return this.createSocket(Oe,t)},createPollingSocket:function(t){return this.createSocket(Pe,t)},createSocket:function(t,e){return new Te(t,e)},createXHR:function(t,e){return this.createRequest(Ee,t,e)},createRequest:function(t,e,n){return new me(t,e,n)},createXDR:function(t,e){return this.createRequest(be,t,e)}},xe={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:o,DependenciesReceivers:a,getDefaultStrategy:ve,Transports:Et,transportConnectionInitializer:function(){var t=this;t.timeline.info(t.buildTimelineMessage({transport:t.name+(t.options.useTLS?"s":"")})),t.hooks.isInitialized()?t.changeState("initialized"):t.hooks.file?(t.changeState("initializing"),u.load(t.hooks.file,{useTLS:t.options.useTLS},(function(e,n){t.hooks.isInitialized()?(t.changeState("initialized"),n(!0)):(e&&t.onError(e),t.onClose(),n(!1))}))):t.onClose()},HTTPFactory:Ae,TimelineTransport:ot,getXHRAPI:function(){return window.XMLHttpRequest},getWebSocketAPI:function(){return window.WebSocket||window.MozWebSocket},setup:function(t){var e=this;window.Pusher=t;var n=function(){e.onDocumentBody(t.ready)};window.JSON?n():u.load("json2",{},n)},getDocument:function(){return document},getProtocol:function(){return this.getDocument().location.protocol},getAuthorizers:function(){return{ajax:S,jsonp:nt}},onDocumentBody:function(t){var e=this;document.body?t():setTimeout((function(){e.onDocumentBody(t)}),0)},createJSONPRequest:function(t,e){return new it(t,e)},createScriptRequest:function(t){return new rt(t)},getLocalStorage:function(){try{return window.localStorage}catch(t){return}},createXHR:function(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest:function(){return new(this.getXHRAPI())},createMicrosoftXHR:function(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork:function(){return xt},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);if(this.isXDRSupported(0===e.indexOf("https:")))return this.HTTPFactory.createXDR(t,e);throw"Cross-origin HTTP requests are not supported"},isXHRSupported:function(){var t=this.getXHRAPI();return Boolean(t)&&void 0!==(new t).withCredentials},isXDRSupported:function(t){var e=t?"https:":"http:",n=this.getProtocol();return Boolean(window.XDomainRequest)&&n===e},addUnloadListener:function(t){void 0!==window.addEventListener?window.addEventListener("unload",t,!1):void 0!==window.attachEvent&&window.attachEvent("onunload",t)},removeUnloadListener:function(t){void 0!==window.addEventListener?window.removeEventListener("unload",t,!1):void 0!==window.detachEvent&&window.detachEvent("onunload",t)}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(Ce||(Ce={}));var Le=Ce,je=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(z({},e,{timestamp:U.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(Le.ERROR,t)},t.prototype.info=function(t){this.log(Le.INFO,t)},t.prototype.debug=function(t){this.log(Le.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,r=z({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=[],t(r,(function(t,r){t||n.sent++,e&&e(t,r)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),Re=function(){function t(t,e,n,r){this.name=t,this.priority=e,this.transport=n,this.options=r||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return Ie(new k,e);if(this.priority{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n { - window.Alpine.plugin(Collapse) - window.Alpine.plugin(Focus) - window.Alpine.plugin(Mousetrap) - window.Alpine.plugin(Persist) - window.Alpine.plugin(Tooltip) - - window.Alpine.store('sidebar', { - isOpen: window.Alpine.$persist(true).as('isOpen'), - - collapsedGroups: window.Alpine.$persist([]).as('collapsedGroups'), - - groupIsCollapsed: function (group) { - return this.collapsedGroups.includes(group) - }, - - collapseGroup: function (group) { - if (this.collapsedGroups.includes(group)) { - return - } - - this.collapsedGroups = this.collapsedGroups.concat(group) - }, - - toggleCollapsedGroup: function (group) { - this.collapsedGroups = this.collapsedGroups.includes(group) - ? this.collapsedGroups.filter( - (collapsedGroup) => collapsedGroup !== group, - ) - : this.collapsedGroups.concat(group) - }, - - close: function () { - this.isOpen = false - }, - - open: function () { - this.isOpen = true - }, - }) - - window.Alpine.store( - 'theme', - window.matchMedia('(prefers-color-scheme: dark)').matches - ? 'dark' - : 'light', - ) - - window.addEventListener('dark-mode-toggled', (event) => { - window.Alpine.store('theme', event.detail) - }) - - window - .matchMedia('(prefers-color-scheme: dark)') - .addEventListener('change', (event) => { - window.Alpine.store('theme', event.matches ? 'dark' : 'light') - }) -}) - -Chart.defaults.font.family = `'DM Sans', sans-serif` -Chart.defaults.color = '#6b7280' - -window.Chart = Chart diff --git a/packages/admin/resources/js/echo.js b/packages/admin/resources/js/echo.js index 447693780f..904b86153f 100644 --- a/packages/admin/resources/js/echo.js +++ b/packages/admin/resources/js/echo.js @@ -1,5 +1,5 @@ import Echo from 'laravel-echo' -import Pusher from 'pusher-js' +import Pusher from 'pusher-js/dist/web/pusher' window.EchoFactory = Echo window.Pusher = Pusher diff --git a/packages/admin/routes/web.php b/packages/admin/routes/web.php index 581d3d9b88..d15775361d 100644 --- a/packages/admin/routes/web.php +++ b/packages/admin/routes/web.php @@ -11,8 +11,6 @@ Route::domain(config('filament.domain')) ->name('filament.') ->group(function () { Route::prefix(config('filament.core_path'))->group(function () { - Route::get('/assets/{file}', AssetController::class)->where('file', '.*')->name('asset'); - Route::post('/logout', function (Request $request): LogoutResponse { Filament::auth()->logout(); diff --git a/packages/admin/src/Http/Controllers/AssetController.php b/packages/admin/src/Http/Controllers/AssetController.php deleted file mode 100644 index 40081f952a..0000000000 --- a/packages/admin/src/Http/Controllers/AssetController.php +++ /dev/null @@ -1,84 +0,0 @@ -pretendResponseIsFile(__DIR__ . '/../../../dist/app.css', 'text/css; charset=utf-8'); - case 'app.css.map': - return $this->pretendResponseIsFile(__DIR__ . '/../../../dist/app.css.map', 'text/css; charset=utf-8'); - case 'app.js': - return $this->pretendResponseIsFile(__DIR__ . '/../../../dist/app.js', 'application/javascript; charset=utf-8'); - case 'app.js.map': - return $this->pretendResponseIsFile(__DIR__ . '/../../../dist/app.js.map', 'application/json; charset=utf-8'); - case 'echo.js': - return $this->pretendResponseIsFile(__DIR__ . '/../../../dist/echo.js', 'application/javascript; charset=utf-8'); - case 'echo.js.map': - return $this->pretendResponseIsFile(__DIR__ . '/../../../dist/echo.js.map', 'application/json; charset=utf-8'); - } - - if (Str::endsWith($file, '.js')) { - $name = Str::beforeLast($file, '.js'); - - if (array_key_exists($name, Filament::getScripts())) { - return $this->pretendResponseIsFile(Filament::getScripts()[$name], 'application/javascript; charset=utf-8'); - } elseif (array_key_exists($name, Filament::getBeforeCoreScripts())) { - return $this->pretendResponseIsFile(Filament::getBeforeCoreScripts()[$name], 'application/javascript; charset=utf-8'); - } else { - abort(404); - } - } - - if (Str::endsWith($file, '.css')) { - $name = Str::beforeLast($file, '.css'); - - abort_unless( - array_key_exists($name, Filament::getStyles()), - 404, - ); - - return $this->pretendResponseIsFile(Filament::getStyles()[$name], 'text/css; charset=utf-8'); - } - - abort(404); - } - - protected function getHttpDate(int $timestamp) - { - return sprintf('%s GMT', gmdate('D, d M Y H:i:s', $timestamp)); - } - - protected function pretendResponseIsFile(string $path, string $contentType) - { - abort_unless( - file_exists($path) || file_exists($path = base_path($path)), - 404, - ); - - $cacheControl = 'public, max-age=31536000'; - $expires = strtotime('+1 year'); - - $lastModified = filemtime($path); - - if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? '') === $lastModified) { - return response()->noContent(304, [ - 'Expires' => $this->getHttpDate($expires), - 'Cache-Control' => $cacheControl, - ]); - } - - return response()->file($path, [ - 'Content-Type' => $contentType, - 'Expires' => $this->getHttpDate($expires), - 'Cache-Control' => $cacheControl, - 'Last-Modified' => $this->getHttpDate($lastModified), - ]); - } -} diff --git a/packages/admin/src/helpers.php b/packages/admin/src/helpers.php index b9efe0120e..a713c5e60e 100644 --- a/packages/admin/src/helpers.php +++ b/packages/admin/src/helpers.php @@ -5,33 +5,6 @@ namespace Filament; use Illuminate\Support\Str; use Illuminate\Translation\MessageSelector; -if (! function_exists('Filament\get_asset_id')) { - function get_asset_id(string $file, string $manifestPath = null): ?string - { - $manifestPath ??= __DIR__ . '/../dist/mix-manifest.json'; - - if (! file_exists($manifestPath)) { - return null; - } - - $manifest = json_decode(file_get_contents($manifestPath), associative: true); - - $file = "/{$file}"; - - if (! array_key_exists($file, $manifest)) { - return null; - } - - $file = $manifest[$file]; - - if (! str_contains($file, 'id=')) { - return null; - } - - return (string) Str::of($file)->after('id='); - } -} - if (! function_exists('Filament\locale_has_pluralization')) { function locale_has_pluralization(): bool { diff --git a/webpack.mix.js b/webpack.mix.js index 75a21fa62e..f718cfc0c0 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -1,5 +1,4 @@ const mix = require('laravel-mix') -const tailwindcss = require('tailwindcss') mix.disableSuccessNotifications() mix.options({ @@ -11,11 +10,4 @@ mix.setPublicPath('packages/admin/dist') mix.setResourceRoot('packages/admin/resources') mix.version() -mix.js('packages/admin/resources/js/app.js', 'packages/admin/dist') -mix.js('packages/admin/resources/js/echo.js', 'packages/admin/dist') - -mix.postCss('packages/admin/resources/css/app.css', 'packages/admin/dist', [ - tailwindcss('packages/admin/tailwind.config.js'), -]).options({ - processCssUrls: false, -}) +mix.js('packages/admin/resources/js/index.js', 'packages/admin/dist')