UNPKG

wildfire-im-sdk

Version:
1 lines 1.08 MB
import { default as __WEBPACK_EXTERNAL_MODULE__config_d5dcd965__ } from "../../config";import*as __WEBPACK_EXTERNAL_MODULE__wfc_util_base64_min_a37cf38e__ from"../../wfc/util/base64.min";import { default as __WEBPACK_EXTERNAL_MODULE__client_connectionStatus_c2a76f1d__ } from "../client/connectionStatus";import { default as __WEBPACK_EXTERNAL_MODULE__client_errorCode_2e9bd124__ } from "../client/errorCode";import { default as __WEBPACK_EXTERNAL_MODULE__client_messageConfig_260e924c__ } from "../client/messageConfig";import { default as __WEBPACK_EXTERNAL_MODULE__client_userSettingScope_4f38ced5__ } from "../client/userSettingScope";import { default as __WEBPACK_EXTERNAL_MODULE__client_wfcEvent_0b508125__ } from "../client/wfcEvent";import { default as __WEBPACK_EXTERNAL_MODULE__messages_compositeMessageContent_9a4d6186__ } from "../messages/compositeMessageContent";import { default as __WEBPACK_EXTERNAL_MODULE__messages_markUnreadMessageContent_54ab9b03__ } from "../messages/markUnreadMessageContent";import { default as __WEBPACK_EXTERNAL_MODULE__messages_mediaMessageContent_1493692e__ } from "../messages/mediaMessageContent";import { default as __WEBPACK_EXTERNAL_MODULE__messages_message_e16c15fa__ } from "../messages/message";import { default as __WEBPACK_EXTERNAL_MODULE__messages_messageContentType_8e61d25b__ } from "../messages/messageContentType";import { default as __WEBPACK_EXTERNAL_MODULE__messages_messageStatus_b0bc6c3e__ } from "../messages/messageStatus";import { default as __WEBPACK_EXTERNAL_MODULE__messages_notification_recallMessageNotification_5b6fd530__ } from "../messages/notification/recallMessageNotification";import { default as __WEBPACK_EXTERNAL_MODULE__messages_persistFlag_ba6d601d__ } from "../messages/persistFlag";import { default as __WEBPACK_EXTERNAL_MODULE__model_NullChannelInfo_8d8c537e__ } from "../model/NullChannelInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_channelInfo_39256809__ } from "../model/channelInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_channelMenu_ef29d4f3__ } from "../model/channelMenu";import { default as __WEBPACK_EXTERNAL_MODULE__model_chatRoomInfo_1b4d8f44__ } from "../model/chatRoomInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_chatRoomMemberInfo_bf1c7255__ } from "../model/chatRoomMemberInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_conversation_59fa5c85__ } from "../model/conversation";import { default as __WEBPACK_EXTERNAL_MODULE__model_conversationInfo_a434c746__ } from "../model/conversationInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_conversationType_a777bdd2__ } from "../model/conversationType";import { default as __WEBPACK_EXTERNAL_MODULE__model_domainInfo_829f33e9__ } from "../model/domainInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_fileRecord_a84baa39__ } from "../model/fileRecord";import { default as __WEBPACK_EXTERNAL_MODULE__model_friend_67a2bfc9__ } from "../model/friend";import { default as __WEBPACK_EXTERNAL_MODULE__model_friendRequest_257fa4f2__ } from "../model/friendRequest";import { default as __WEBPACK_EXTERNAL_MODULE__model_groupInfo_39c132de__ } from "../model/groupInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_groupMember_414b93d2__ } from "../model/groupMember";import { default as __WEBPACK_EXTERNAL_MODULE__model_groupMemberType_44e55d75__ } from "../model/groupMemberType";import { default as __WEBPACK_EXTERNAL_MODULE__model_groupSearchResult_6a817d8c__ } from "../model/groupSearchResult";import { default as __WEBPACK_EXTERNAL_MODULE__model_internal_friendInfo_94ae7e7b__ } from "../model/internal/friendInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_nullDomainInfo_6f7d292b__ } from "../model/nullDomainInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_nullGroupInfo_4fd7a065__ } from "../model/nullGroupInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_nullUserInfo_829ee12d__ } from "../model/nullUserInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_readEntry_abc219ba__ } from "../model/readEntry";import { default as __WEBPACK_EXTERNAL_MODULE__model_unreadCount_6b42cdcf__ } from "../model/unreadCount";import { default as __WEBPACK_EXTERNAL_MODULE__model_userClientState_698c9206__ } from "../model/userClientState";import { default as __WEBPACK_EXTERNAL_MODULE__model_userCustomState_8f3e9e6b__ } from "../model/userCustomState";import { default as __WEBPACK_EXTERNAL_MODULE__model_userInfo_d32fe81f__ } from "../model/userInfo";import { default as __WEBPACK_EXTERNAL_MODULE__model_userOnlineState_e3467fae__ } from "../model/userOnlineState";import { default as __WEBPACK_EXTERNAL_MODULE__model_userSettingEntry_aaf607de__ } from "../model/userSettingEntry";import*as __WEBPACK_EXTERNAL_MODULE__util_base64_min_79258e3f__ from"../util/base64.min";import*as __WEBPACK_EXTERNAL_MODULE__util_deep_assign_min_1a97b602__ from"../util/deep-assign.min";import*as __WEBPACK_EXTERNAL_MODULE__util_longUtil_89a9de18__ from"../util/longUtil";import*as __WEBPACK_EXTERNAL_MODULE__util_mime_7efebf1b__ from"../util/mime";var __webpack_modules__={6392:(q0,q1,q2)=>{var q3=q2(4132),q4=q7(q2(696)),q5=q7(q2(6212)),q6=q7(q2(9708));function q7(q0){return q0&&q0.__esModule?q0:{default:q0}}var q8=q2(4936),q9=q2(3792),q10=q2(2300),q11=q2(9496).Writable,q12=q2(8248),q13=q2(6732),q14=q2(5440),q15=q2(9707),q16=q2.g.setImmediate||function(q0){q3.nextTick(q0)},q17={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},q18={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function q19(q0,q1,q2){q0.emit("packetsend",q1),!q10.writeToStream(q1,q0.stream,q0.options)&&q2?q0.stream.once("drain",q2):q2&&q2()}function q20(q0){q0&&(0,q6.default)(q0).forEach((function(q1){"function"==typeof q0[q1]&&(q0[q1](new Error("Connection closed")),delete q0[q1])}))}function q21(q0,q1,q2,q3){q0.outgoingStore.put(q1,(function(q4){if(q4)return q2&&q2(q4);q3(),q19(q0,q1,q2)}))}function q22(){}function q23(q0,q1){var q2,q3=this;if(!(this instanceof q23))return new q23(q0,q1);for(q2 in this.options=q1||{},q17)void 0===this.options[q2]?this.options[q2]=q17[q2]:this.options[q2]=q1[q2];this.options.clientId="string"==typeof q1.clientId?q1.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.options.customHandleAcks=5===q1.protocolVersion&&q1.customHandleAcks?q1.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=q0,this.outgoingStore=q1.outgoingStore||new q9,this.incomingStore=q1.incomingStore||new q9,this.queueQoSZero=void 0===q1.queueQoSZero||q1.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this._firstConnection=!0,this.on("close",(function(){this.connected=!1,clearTimeout(this.connackTimer)})),this.on("connect",(function(){var q0=this.queue;!function q1(){var q2,q4=q0.shift();q4&&(q2=q4.packet,q3._sendPacket(q2,(function(q0){q4.cb&&q4.cb(q0),q1()})))}()})),this.on("close",(function(){null!==q3.pingTimer&&(q3.pingTimer.clear(),q3.pingTimer=null)})),q8.EventEmitter.call(this),this._setupStream()}q12(q23,q8.EventEmitter),q23.prototype._setupStream=function(){var q0,q1=this,q2=new q11,q6=q10.parser(this.options),q7=null,q8=[];function q9(){if(q8.length)q3.nextTick(q12);else{var q0=q7;q7=null,q0()}}function q12(){var q0=q8.shift();if(q0)q1._handlePacket(q0,q9);else{var q2=q7;q7=null,q2&&q2()}}if(this._clearReconnect(),this.stream=this.streamBuilder(this),q6.on("packet",(function(q0){q8.push(q0)})),q2._write=function(q0,q1,q2){q7=q2,q6.parse(q0),q12()},this.stream.pipe(q2),this.stream.on("error",q22),this.stream.on("close",(function(){q1.emit("close")})),(q0=(0,q5.default)(this.options)).cmd="connect",q19(this,q0),q6.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.emit("error",new Error("Packet has no Authentication Method")),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"===(0,q4.default)(this.options.authPacket))q19(this,q15({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){q1._cleanUp(!0)}),this.options.connectTimeout)},q23.prototype._handlePacket=function(q0,q1){var q2=this.options;if(5===q2.protocolVersion&&q2.properties&&q2.properties.maximumPacketSize&&q2.properties.maximumPacketSize<q0.length)return this.emit("error",new Error("exceeding packets size "+q0.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(this.emit("packetreceive",q0),q0.cmd){case"publish":try{this._handlePublish(q0,q1)}catch(q0){console.error(q0)}break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":try{this._handleAck(q0)}catch(q0){console.log(q0)}q1();break;case"pubrel":this._handlePubrel(q0,q1);break;case"connack":this._handleConnack(q0),q1();break;case"pingresp":this._handlePingresp(q0),q1();break;case"disconnect":this._handleDisconnect(q0),q1()}},q23.prototype._checkDisconnecting=function(q0){return this.disconnecting&&(q0?q0(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},q23.prototype.publish=function(q0,q1,q2,q3){var q4,q5=this.options;"function"==typeof q2&&(q3=q2,q2=null);if(q2=q15({qos:0,retain:!1,dup:!1},q2),this._checkDisconnecting(q3))return this;switch(q4={cmd:"publish",topic:q0,payload:q1,qos:q2.qos,retain:q2.retain,messageId:this._nextId(),dup:q2.dup},5===q5.protocolVersion&&(q4.properties=q2.properties,(!q5.properties&&q4.properties&&q4.properties.topicAlias||q2.properties&&q5.properties&&(q2.properties.topicAlias&&q5.properties.topicAliasMaximum&&q2.properties.topicAlias>q5.properties.topicAliasMaximum||!q5.properties.topicAliasMaximum&&q2.properties.topicAlias))&&delete q4.properties.topicAlias),q2.qos){case 1:case 2:this.outgoing[q4.messageId]=q3||q22,this._storeProcessing?(this._packetIdsDuringStoreProcessing[q4.messageId]=!1,this._storePacket(q4,void 0,q2.cbStorePut)):this._sendPacket(q4,void 0,q2.cbStorePut);break;default:this._storeProcessing?this._storePacket(q4,q3,q2.cbStorePut):this._sendPacket(q4,q3,q2.cbStorePut)}return this},q23.prototype.subscribe=function(){for(var q0,q1=new Array(arguments.length),q2=0;q2<arguments.length;q2++)q1[q2]=arguments[q2];var q3,q4=[],q5=q1.shift(),q7=q5.resubscribe,q8=q1.pop()||q22,q9=q1.pop(),q10=this,q11=this.options.protocolVersion;if(delete q5.resubscribe,"string"==typeof q5&&(q5=[q5]),"function"!=typeof q8&&(q9=q8,q8=q22),null!==(q3=q14.validateTopics(q5)))return q16(q8,new Error("Invalid topic "+q3)),this;if(this._checkDisconnecting(q8))return this;var q12={qos:0};if(5===q11&&(q12.nl=!1,q12.rap=!1,q12.rh=0),q9=q15(q12,q9),Array.isArray(q5)?q5.forEach((function(q0){if(!q10._resubscribeTopics.hasOwnProperty(q0)||q10._resubscribeTopics[q0].qos<q9.qos||q7){var q1={topic:q0,qos:q9.qos};5===q11&&(q1.nl=q9.nl,q1.rap=q9.rap,q1.rh=q9.rh,q1.properties=q9.properties),q4.push(q1)}})):(0,q6.default)(q5).forEach((function(q0){if(!q10._resubscribeTopics.hasOwnProperty(q0)||q10._resubscribeTopics[q0].qos<q5[q0].qos||q7){var q1={topic:q0,qos:q5[q0].qos};5===q11&&(q1.nl=q5[q0].nl,q1.rap=q5[q0].rap,q1.rh=q5[q0].rh,q1.properties=q9.properties),q4.push(q1)}})),q0={cmd:"subscribe",subscriptions:q4,qos:1,retain:!1,dup:!1,messageId:this._nextId()},q9.properties&&(q0.properties=q9.properties),q4.length){if(this.options.resubscribe){var q13=[];q4.forEach((function(q0){if(q10.options.reconnectPeriod>0){var q1={qos:q0.qos};5===q11&&(q1.nl=q0.nl||!1,q1.rap=q0.rap||!1,q1.rh=q0.rh||0,q1.properties=q0.properties),q10._resubscribeTopics[q0.topic]=q1,q13.push(q0.topic)}})),q10.messageIdToTopic[q0.messageId]=q13}return this.outgoing[q0.messageId]=function(q0,q1){if(!q0)for(var q2=q1.granted,q3=0;q3<q2.length;q3+=1)q4[q3].qos=q2[q3];q8(q0,q4)},this._sendPacket(q0),this}q8(null,[])},q23.prototype.unsubscribe=function(){for(var q0={cmd:"unsubscribe",qos:1,messageId:this._nextId()},q1=this,q2=new Array(arguments.length),q3=0;q3<arguments.length;q3++)q2[q3]=arguments[q3];var q5=q2.shift(),q6=q2.pop()||q22,q7=q2.pop();return"string"==typeof q5&&(q5=[q5]),"function"!=typeof q6&&(q7=q6,q6=q22),this._checkDisconnecting(q6)||("string"==typeof q5?q0.unsubscriptions=[q5]:"object"===(void 0===q5?"undefined":(0,q4.default)(q5))&&q5.length&&(q0.unsubscriptions=q5),this.options.resubscribe&&q0.unsubscriptions.forEach((function(q0){delete q1._resubscribeTopics[q0]})),"object"===(void 0===q7?"undefined":(0,q4.default)(q7))&&q7.properties&&(q0.properties=q7.properties),this.outgoing[q0.messageId]=q6,this._sendPacket(q0)),this},q23.prototype.end=function(){var q0=this,q1=arguments[0],q2=arguments[1],q3=arguments[2];function q5(){q0.disconnected=!0,q0.incomingStore.close((function(){q0.outgoingStore.close((function(){q3&&q3.apply(null,arguments),q0.emit("end")}))})),q0._deferredReconnect&&q0._deferredReconnect()}function q7(){q0._cleanUp(q1,q16.bind(null,q5),q2)}return null!=q1&&"boolean"==typeof q1||(q3=q2||q22,q2=q1,q1=!1,"object"!==(void 0===q2?"undefined":(0,q4.default)(q2))&&(q3=q2,q2=null,"function"!=typeof q3&&(q3=q22))),"object"!==(void 0===q2?"undefined":(0,q4.default)(q2))&&(q3=q2,q2=null),q3=q3||q22,this.disconnecting||(this._clearReconnect(),this.disconnecting=!0,!q1&&(0,q6.default)(this.outgoing).length>0?this.once("outgoingEmpty",setTimeout.bind(null,q7,10)):q7()),this},q23.prototype.removeOutgoingMessage=function(q0){var q1=this.outgoing[q0];return delete this.outgoing[q0],this.outgoingStore.del({messageId:q0},(function(){q1(new Error("Message removed"))})),this},q23.prototype.reconnect=function(q0){var q1=this,q2=function(){q0?(q1.options.incomingStore=q0.incomingStore,q1.options.outgoingStore=q0.outgoingStore):(q1.options.incomingStore=null,q1.options.outgoingStore=null),q1.incomingStore=q1.options.incomingStore||new q9,q1.outgoingStore=q1.options.outgoingStore||new q9,q1.disconnecting=!1,q1.disconnected=!1,q1._deferredReconnect=null,q1._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=q2:q2(),this},q23.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},q23.prototype._setupReconnect=function(){var q0=this;!q0.disconnecting&&!q0.reconnectTimer&&q0.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),q0.reconnectTimer=setInterval((function(){q0._reconnect()}),q0.options.reconnectPeriod))},q23.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},q23.prototype._cleanUp=function(q0,q1){var q2=arguments[2];if(q1&&this.stream.on("close",q1),q0)0===this.options.reconnectPeriod&&this.options.clean&&q20(this.outgoing),this.stream.destroy();else{var q3=q15({cmd:"disconnect"},q2);this._sendPacket(q3,q16.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),q1&&!this.connected&&(this.stream.removeListener("close",q1),q1())},q23.prototype._sendPacket=function(q0,q1,q2){if(q2=q2||q22,this.connected){switch(this._shiftPingInterval(),q0.cmd){case"publish":break;case"pubrel":return void q21(this,q0,q1,q2);default:return void q19(this,q0,q1)}switch(q0.qos){case 2:case 1:q21(this,q0,q1,q2);break;default:q19(this,q0,q1)}}else this._storePacket(q0,q1,q2)},q23.prototype._storePacket=function(q0,q1,q2){q2=q2||q22,0===(q0.qos||0)&&this.queueQoSZero||"publish"!==q0.cmd?this.queue.push({packet:q0,cb:q1}):q0.qos>0?(q1=this.outgoing[q0.messageId],this.outgoingStore.put(q0,(function(q0){if(q0)return q1&&q1(q0);q2()}))):q1&&q1(new Error("No connection to broker"))},q23.prototype._setupPingTimer=function(){var q0=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=q13((function(){q0._checkPing()}),1e3*this.options.keepalive))},q23.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},q23.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},q23.prototype._handlePingresp=function(){this.pingResp=!0,this.emit("pingresp",(new Date).getTime())},q23.prototype._handleConnack=function(q0){var q1=this.options,q2=5===q1.protocolVersion?q0.reasonCode:q0.returnCode;if(clearTimeout(this.connackTimer),q0.properties&&(q0.properties.topicAliasMaximum&&(q1.properties||(q1.properties={}),q1.properties.topicAliasMaximum=q0.properties.topicAliasMaximum),q0.properties.serverKeepAlive&&q1.keepalive&&(q1.keepalive=q0.properties.serverKeepAlive,this._shiftPingInterval()),q0.properties.maximumPacketSize&&(q1.properties||(q1.properties={}),q1.properties.maximumPacketSize=q0.properties.maximumPacketSize)),0===q2)this.reconnecting=!1,this._onConnect(q0);else if(q2>0){var q3=new Error("Connection refused: "+q18[q2]);q3.code=q2,this.emit("error",q3)}},q23.prototype._handlePublish=function(q0,q1){q1=void 0!==q1?q1:q22;var q2=q0.topic.toString(),q3=q0.payload,q4=q0.qos,q5=q0.messageId,q6=this,q7=this.options,q8=[0,16,128,131,135,144,145,151,153];switch(q4){case 2:q7.customHandleAcks(q2,q3,q0,(function(q2,q3){return q2 instanceof Error||(q3=q2,q2=null),q2?q6.emit("error",q2):-1===q8.indexOf(q3)?q6.emit("error",new Error("Wrong reason code for pubrec")):void(q3?q6._sendPacket({cmd:"pubrec",messageId:q5,reasonCode:q3},q1):q6.incomingStore.put(q0,(function(){q6._sendPacket({cmd:"pubrec",messageId:q5},q1)})))}));break;case 1:q7.customHandleAcks(q2,q3,q0,(function(q4,q7){return q4 instanceof Error||(q7=q4,q4=null),q4?q6.emit("error",q4):-1===q8.indexOf(q7)?q6.emit("error",new Error("Wrong reason code for puback")):(q7||q6.emit("message",q2,q3,q0),void q6.handleMessage(q0,(function(q0){if(q0)return q1&&q1(q0);q6._sendPacket({cmd:"puback",messageId:q5,reasonCode:q7},q1)})))}));break;case 0:this.emit("message",q2,q3,q0),this.handleMessage(q0,q1)}},q23.prototype.handleMessage=function(q0,q1){q1()},q23.prototype._handleAck=function(q0){var q1,q2=q0.messageId,q3=q0.cmd,q4=null,q5=this.outgoing[q2],q7=this;if(q5){switch(q3){case"pubcomp":case"puback":var q8=q0.reasonCode;q8&&q8>0&&16!==q8&&10!==q8?((q1=new Error("Publish error: "+q18[q8])).code=q8,q5(q1,q0)):q8&&10===q8&&q5(null,q0),delete this.outgoing[q2],this.outgoingStore.del(q0,q5);break;case"pubrec":q4={cmd:"pubrel",qos:2,messageId:q2};var q9=q0.reasonCode;q9&&q9>0&&16!==q9?((q1=new Error("Publish error: "+q18[q9])).code=q9,q5(q1,q0)):this._sendPacket(q4);break;case"suback":delete this.outgoing[q2];for(var q10=0;q10<q0.granted.length;q10++)if(0!=(128&q0.granted[q10])){var q11=this.messageIdToTopic[q2];q11&&q11.forEach((function(q0){delete q7._resubscribeTopics[q0]}))}q5(null,q0);break;case"unsuback":delete this.outgoing[q2],q5(null);break;default:q7.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===(0,q6.default)(this.outgoing).length&&this.emit("outgoingEmpty")}},q23.prototype._handlePubrel=function(q0,q1){q1=void 0!==q1?q1:q22;var q2=q0.messageId,q3=this,q4={cmd:"pubcomp",messageId:q2};q3.incomingStore.get(q0,(function(q0,q2){q0?q3._sendPacket(q4,q1):(q3.emit("message",q2.topic,q2.payload,q2),q3.handleMessage(q2,(function(q0){if(q0)return q1(q0);q3.incomingStore.del(q2,q22),q3._sendPacket(q4,q1)})))}))},q23.prototype._handleDisconnect=function(q0){this.emit("disconnect",q0)},q23.prototype._nextId=function(){var q0=this.nextId++;return 65536===this.nextId&&(this.nextId=1),q0},q23.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},q23.prototype._resubscribe=function(q0){var q1=(0,q6.default)(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!q0.sessionPresent)&&q1.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion)for(var q2=0;q2<q1.length;q2++){var q3={};q3[q1[q2]]=this._resubscribeTopics[q1[q2]],q3.resubscribe=!0,this.subscribe(q3,{properties:q3[q1[q2]].properties})}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},q23.prototype._onConnect=function(q0){if(this.disconnected)this.emit("connect",q0);else{var q1=this;this._setupPingTimer(),this._resubscribe(q0),this.connected=!0,function q2(){var q3=q1.outgoingStore.createStream();function q4(){q1._storeProcessing=!1,q1._packetIdsDuringStoreProcessing={}}function q5(){q3.destroy(),q3=null,q4()}q1.once("close",q5),q3.on("error",(function(q0){q4(),q1.removeListener("close",q5),q1.emit("error",q0)})),q3.on("end",(function(){var q3=!0;for(var q6 in q1._packetIdsDuringStoreProcessing)if(!q1._packetIdsDuringStoreProcessing[q6]){q3=!1;break}q3?(q4(),q1.removeListener("close",q5),q1.emit("connect",q0)):q2()})),function q0(){if(q3){q1._storeProcessing=!0;var q2,q4=q3.read(1);q4?q1._packetIdsDuringStoreProcessing[q4.messageId]?q0():q1.disconnecting||q1.reconnectTimer?q3.destroy&&q3.destroy():(q2=q1.outgoing[q4.messageId],q1.outgoing[q4.messageId]=function(q1,q3){q2&&q2(q1,q3),q0()},q1._packetIdsDuringStoreProcessing[q4.messageId]=!0,q1._sendPacket(q4)):q3.once("readable",q0)}}()}()}},q0.exports=q23},9048:(q0,q1,q2)=>{var q3,q4,q5,q6=q2(3296).Buffer,q7=q2(9496).Transform,q8=q2(7491),q9=q2(5704),q10=!1;q0.exports=function(q0,q1){if(q1.hostname=q1.hostname||q1.host,!q1.hostname)throw new Error("Could not determine host. Specify host manually.");var q2="MQIsdp"===q1.protocolId&&3===q1.protocolVersion?"mqttv3.1":"mqtt";!function(q0){q0.hostname||(q0.hostname="localhost"),q0.path||(q0.path="/"),q0.wsOptions||(q0.wsOptions={})}(q1);var q11=function(q0,q1){var q2="alis"===q0.protocol?"wss":"ws",q3=q2+"://"+q0.hostname+q0.path;return q0.port&&80!==q0.port&&443!==q0.port&&(q3=q2+"://"+q0.hostname+":"+q0.port+q0.path),"function"==typeof q0.transformWsUrl&&(q3=q0.transformWsUrl(q3,q0,q1)),q3}(q1,q0);return(q3=q1.my).connectSocket({url:q11,protocols:q2}),q4=function(){var q0=new q7;return q0._write=function(q0,q1,q2){q3.sendSocketMessage({data:q0.buffer,success:function(){q2()},fail:function(){q2(new Error)}})},q0._flush=function(q0){q3.closeSocket({success:function(){q0()}})},q0}(),q5=q8.obj(),q10||(q10=!0,q3.onSocketOpen((function(){q5.setReadable(q4),q5.setWritable(q4),q5.emit("connect")})),q3.onSocketMessage((function(q0){if("string"==typeof q0.data){var q1=q9.toByteArray(q0.data),q2=q6.from(q1);q4.push(q2)}else{var q3=new FileReader;q3.addEventListener("load",(function(){var q0=q3.result;q0=q0 instanceof ArrayBuffer?q6.from(q0):q6.from(q0,"utf8"),q4.push(q0)})),q3.readAsArrayBuffer(q0.data)}})),q3.onSocketClose((function(){q5.end(),q5.destroy()})),q3.onSocketError((function(q0){q5.destroy(q0)}))),q5}},9824:(q0,q1,q2)=>{var q3=q2(4132),q4=q2(3296).Buffer,q5=q8(q2(696)),q6=q2(9444),q7=q8(q2(2816));function q8(q0){return q0&&q0.__esModule?q0:{default:q0}}var q9=q2(6392),q10=q2(3792),q11=q2(4776),q12=q2(9707),q13={},q14="imtest.shengshitong.com",q15="web_12345678",q16="a3f9bf468f31173ba841df6eb1b5585b1f96cfb3";function q17(q0,q1,q3,q5,q8){!function(q0,q1,q3,q5,q8){var q9=void 0,q10=q8&&q8.backupHost&&2===q8.backupAddressStrategy?q8.backupHost:"imtest.shengshitong.com",q11=q8&&q8.backupHost&&2===q8.backupAddressStrategy?q8.backupPort:q7.default.ROUTE_PORT?q7.default.ROUTE_PORT:80;q7.default.USE_WSS?(q20("https route"),q9="https://"+q10+(443!==q11?":"+q11:"")+"/route"):q9="http://"+q10+(80!==q11?":"+q11:"")+"/route";q20("route url",q9);var q12=q2(8120).RouteRequest,q13=q2(8120).RouteResponse,q17=q2(8120).IMHttpWrapper,q21=q2(7480).AESDecrypt,q22=q2(7480).Uint8ToStr,q23=q2(7480).AESEncrypt,q24="",q25="",q26=q2(8).Y,q27=q2(8).O,q28=new XMLHttpRequest,q29=setTimeout((function(){!0,q28.abort(),console.log("request timeout, to abort")}),1e4);q28.open("POST",q9),q28.onerror=function(){q20("route request error"),q5(-1)},q28.onabort=function(){q20("route request abort"),q5(-1)},q28.ontimeout=function(){q20("route request timeout"),q5(-1)},q28.onreadystatechange=function(){if(4===q28.readyState)if(clearTimeout(q29),200===q28.status){var q2=q26(q28.responseText);(!q2||q2.byteLength<1)&&(q20("route response error",q28.responseText),q5(-1));var q3=new Int8Array(q2,0,1);if(0===q3[0]){var q4=q27(q2.slice(1)),q10=q21(q4,q24,!0),q11=q13.decode(q10);q20("route res",q11.host,q11.longPort,q11.wssPort);for(var q12=q11.node+"|"+q14,q15="",q16=0;q16<q12.length;q16++)q15+=String.fromCharCode(90^q12[q16].charCodeAt(0));q12=(0,q6.btoa)(unescape(encodeURIComponent(q15)));var q17={keepalive:q7.default.KEEP_ALIVE_TIMEOUT,clientId:q1,protocolId:"MQTT",protocolVersion:6,clean:!0,reconnectPeriod:0,resubscribe:!1,connectTimeout:2e4,a:q14,will:{topic:q12,payload:"Connection Closed abnormally..!",qos:1,retain:!1},rejectUnauthorized:!1};q17.username=q0,q17.password=q25;var q22=(new Date).getTime(),q23=void 0,q30=(8&q11.commercial)>0,q31=void 0,q32=void 0;if(q8&&q8.backupHost&&2===q8.backupAddressStrategy){var q33=q11.candidate[0];q32=q33.host,q31=q33.wssPort}else q32=q11.host,q31=q7.default.USE_WSS&&(q31=q30?q11.wssPort:q11.longPort)||q11.longPort;q20("connect url",q32,q31),q7.default.USE_WSS?(q20("wss mqtts"),q23=q18("mqtts://"+q32+":"+q31,q17)):(q20("ws mqtt",q7.default.USE_WSS),q23=q18("mqtt://"+q32+":"+q31,q17)),q19=q11.host;var q34={isReceiptEnable:(2&q11.commercial)>0,isClearGroupMsgWhenKickoff:(4&q11.commercial)>0,isDisableRoamingConvList:(16&q11.commercial)>0,isKeepMsgAfterDismiss:(32&q11.commercial)>0,isSupportBigFileUpload:(64&q11.commercial)>0,isBackupDownloadUrl:(128&q11.commercial)>0,isGlobalDisableSyncDraft:(256&q11.commercial)>0,isSupportQos0Message:(512&q11.commercial)>0,isUserOnlineStateEnable:(1024&q11.commercial)>0,isMeshEnable:(32768&q11.commercial)>0};(1&q11.commercial)>0?q5(0,q23,q24,q22,q34):q5(-1)}else q20("route error",q9,q3[0]),q5(q3[0])}else q20("http route error,请先检查下USE_WSS、ROUTE_PORT配置",q9,q28.status),q5(-1)},q28.setRequestHeader("p","web"),q28.setRequestHeader("appId",q15),q28.setRequestHeader("appKey",q16),q28.setRequestHeader("cid",q23(q1)),q28.setRequestHeader("uid",q23(q0)),q28.setRequestHeader("Content-Type","application/octet-stream");var q30=q12.create();q30.app="cn.wildfirechat.chat.web",q30.appVersion="0.1",q30.deviceName="browser",q30.platform=5,q30.phoneName="browser",q30.sdkVersion="0.1",q30.language=q7.default.LANGUAGE;var q31=void 0;try{q31=q22(q21(q3,"",!1))}catch(q0){q20("token error!!!")}var q32=q31.split("|")[0];q24=q31.split("|")[1],q25=new q4(q23(q32,q24),"base64"),q30.host=q23("imtest.shengshitong.com","");var q33=q12.encode(q30).finish(),q34=q17.create();q34.clientId=q1,q34.token=q32,q34.request="ROUTE",q34.data=q33;var q35=q17.encode(q34).finish(),q36=q23(q35,q24);q28.send(q36)}(q0,q1,q3,q5,q8)}function q18(q0,q1){if("object"!==(void 0===q0?"undefined":(0,q5.default)(q0))||q1||(q1=q0,q0=null),q1=q1||{},q0){var q2=q11.parse(q0,!0);if(null!=q2.port&&(q2.port=Number(q2.port)),null===(q1=q12(q2,q1)).protocol)throw new Error("Missing protocol");q1.protocol=q1.protocol.replace(/:$/,"")}if(function(q0){var q1;q0.auth&&((q1=q0.auth.match(/^(.+):(.+)$/))?(q0.username=q1[1],q0.password=q1[2]):q0.username=q0.auth)}(q1),q1.query&&"string"==typeof q1.query.clientId&&(q1.clientId=q1.query.clientId),q1.cert&&q1.key){if(!q1.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(q1.protocol))switch(q1.protocol){case"mqtt":q1.protocol="mqtts";break;case"ws":q1.protocol="wss";break;case"wx":q1.protocol="wxs";break;case"ali":q1.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+q1.protocol+'"!')}}if(!q13[q1.protocol]){var q3=-1!==["mqtts","wss"].indexOf(q1.protocol);q1.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(q0,q1){return(!q3||q1%2!=0)&&"function"==typeof q13[q0]}))[0]}if(!1===q1.clean&&!q1.clientId)throw new Error("Missing clientId for unclean clients");return q1.protocol&&(q1.defaultProtocol=q1.protocol),new q9((function(q0){return q1.servers&&(q0._reconnectCount&&q0._reconnectCount!==q1.servers.length||(q0._reconnectCount=0),q1.host=q1.servers[q0._reconnectCount].host,q1.port=q1.servers[q0._reconnectCount].port,q1.protocol=q1.servers[q0._reconnectCount].protocol?q1.servers[q0._reconnectCount].protocol:q1.defaultProtocol,q1.hostname=q1.host,q0._reconnectCount++),q13[q1.protocol](q0,q1)}),q1)}"browser"!==q3.title?(q13.mqtt=q2(7200),q13.tcp=q2(7200),q13.ssl=q2(8864),q13.tls=q2(8864),q13.mqtts=q2(8864)):(q13.wx=q2(4672),q13.wxs=q2(4672),q13.ali=q2(9048),q13.alis=q2(9048)),q13.ws=q2(7508),q13.wss=q2(7508);var q19="";function q20(q0){if(!q7.default.DISABLE_LOG){for(var q1,q2=arguments.length,q3=Array(q2>1?q2-1:0),q4=1;q4<q2;q4++)q3[q4-1]=arguments[q4];(q1=console).log.apply(q1,[q0].concat(q3))}}q0.exports=q17,q0.exports.connect=q17,q0.exports.MqttClient=q9,q0.exports.Store=q10,q0.exports.host=function(){return q19}},8120:(q0,q1,q2)=>{var q3=q5(q2(696)),q4=q5(q2(9708));function q5(q0){return q0&&q0.__esModule?q0:{default:q0}}var q6=q2(7328),q7=q6.Reader,q8=q6.Writer,q9=q6.util,q10=q6.roots.default||(q6.roots.default={});q10.IMHttpWrapper=function(){function q0(q0){if(q0)for(var q1=(0,q4.default)(q0),q2=0;q2<q1.length;++q2)null!=q0[q1[q2]]&&(this[q1[q2]]=q0[q1[q2]])}return q0.prototype.token="",q0.prototype.clientId="",q0.prototype.request="",q0.prototype.data=q9.newBuffer([]),q0.create=function(q1){return new q0(q1)},q0.encode=function(q0,q1){return q1||(q1=q8.create()),q1.uint32(10).string(q0.token),q1.uint32(18).string(q0.clientId),q1.uint32(26).string(q0.request),null!=q0.data&&q0.hasOwnProperty("data")&&q1.uint32(34).bytes(q0.data),q1},q0.encodeDelimited=function(q0,q1){return this.encode(q0,q1).ldelim()},q0.decode=function(q0,q1){q0 instanceof q7||(q0=q7.create(q0));for(var q2=void 0===q1?q0.len:q0.pos+q1,q3=new q10.IMHttpWrapper;q0.pos<q2;){var q4=q0.uint32();switch(q4>>>3){case 1:q3.token=q0.string();break;case 2:q3.clientId=q0.string();break;case 3:q3.request=q0.string();break;case 4:q3.data=q0.bytes();break;default:q0.skipType(7&q4)}}if(!q3.hasOwnProperty("token"))throw q9.ProtocolError("missing required 'token'",{instance:q3});if(!q3.hasOwnProperty("clientId"))throw q9.ProtocolError("missing required 'clientId'",{instance:q3});if(!q3.hasOwnProperty("request"))throw q9.ProtocolError("missing required 'request'",{instance:q3});return q3},q0.decodeDelimited=function(q0){return q0 instanceof q7||(q0=new q7(q0)),this.decode(q0,q0.uint32())},q0.verify=function(q0){return"object"!==(void 0===q0?"undefined":(0,q3.default)(q0))||null===q0?"object expected":q9.isString(q0.token)?q9.isString(q0.clientId)?q9.isString(q0.request)?null!=q0.data&&q0.hasOwnProperty("data")&&!(q0.data&&"number"==typeof q0.data.length||q9.isString(q0.data))?"data: buffer expected":null:"request: string expected":"clientId: string expected":"token: string expected"},q0.fromObject=function(q0){if(q0 instanceof q10.IMHttpWrapper)return q0;var q1=new q10.IMHttpWrapper;return null!=q0.token&&(q1.token=String(q0.token)),null!=q0.clientId&&(q1.clientId=String(q0.clientId)),null!=q0.request&&(q1.request=String(q0.request)),null!=q0.data&&("string"==typeof q0.data?q9.base64.decode(q0.data,q1.data=q9.newBuffer(q9.base64.length(q0.data)),0):q0.data.length&&(q1.data=q0.data)),q1},q0.toObject=function(q0,q1){q1||(q1={});var q2={};return q1.defaults&&(q2.token="",q2.clientId="",q2.request="",q1.bytes===String?q2.data="":(q2.data=[],q1.bytes!==Array&&(q2.data=q9.newBuffer(q2.data)))),null!=q0.token&&q0.hasOwnProperty("token")&&(q2.token=q0.token),null!=q0.clientId&&q0.hasOwnProperty("clientId")&&(q2.clientId=q0.clientId),null!=q0.request&&q0.hasOwnProperty("request")&&(q2.request=q0.request),null!=q0.data&&q0.hasOwnProperty("data")&&(q2.data=q1.bytes===String?q9.base64.encode(q0.data,0,q0.data.length):q1.bytes===Array?Array.prototype.slice.call(q0.data):q0.data),q2},q0.prototype.toJSON=function(){return this.constructor.toObject(this,q6.util.toJSONOptions)},q0}(),q10.RouteRequest=function(){function q0(q0){if(q0)for(var q1=(0,q4.default)(q0),q2=0;q2<q1.length;++q2)null!=q0[q1[q2]]&&(this[q1[q2]]=q0[q1[q2]])}return q0.prototype.app="",q0.prototype.platform=0,q0.prototype.pushType=0,q0.prototype.deviceName="",q0.prototype.deviceVersion="",q0.prototype.phoneName="",q0.prototype.language="",q0.prototype.carrierName="",q0.prototype.appVersion="",q0.prototype.sdkVersion="",q0.prototype.wxAppId="",q0.prototype.wxAppKey="",q0.prototype.webAppId="",q0.prototype.webAppKey="",q0.prototype.host="",q0.create=function(q1){return new q0(q1)},q0.encode=function(q0,q1){return q1||(q1=q8.create()),null!=q0.app&&q0.hasOwnProperty("app")&&q1.uint32(10).string(q0.app),null!=q0.platform&&q0.hasOwnProperty("platform")&&q1.uint32(16).int32(q0.platform),null!=q0.pushType&&q0.hasOwnProperty("pushType")&&q1.uint32(24).int32(q0.pushType),null!=q0.deviceName&&q0.hasOwnProperty("deviceName")&&q1.uint32(34).string(q0.deviceName),null!=q0.deviceVersion&&q0.hasOwnProperty("deviceVersion")&&q1.uint32(42).string(q0.deviceVersion),null!=q0.phoneName&&q0.hasOwnProperty("phoneName")&&q1.uint32(50).string(q0.phoneName),null!=q0.language&&q0.hasOwnProperty("language")&&q1.uint32(58).string(q0.language),null!=q0.carrierName&&q0.hasOwnProperty("carrierName")&&q1.uint32(66).string(q0.carrierName),null!=q0.appVersion&&q0.hasOwnProperty("appVersion")&&q1.uint32(74).string(q0.appVersion),null!=q0.sdkVersion&&q0.hasOwnProperty("sdkVersion")&&q1.uint32(82).string(q0.sdkVersion),null!=q0.wxAppId&&q0.hasOwnProperty("wxAppId")&&q1.uint32(90).string(q0.wxAppId),null!=q0.wxAppKey&&q0.hasOwnProperty("wxAppKey")&&q1.uint32(98).string(q0.wxAppKey),null!=q0.webAppId&&q0.hasOwnProperty("webAppId")&&q1.uint32(106).string(q0.webAppId),null!=q0.webAppKey&&q0.hasOwnProperty("webAppKey")&&q1.uint32(114).string(q0.webAppKey),null!=q0.host&&q0.hasOwnProperty("host")&&q1.uint32(122).string(q0.host),q1},q0.encodeDelimited=function(q0,q1){return this.encode(q0,q1).ldelim()},q0.decode=function(q0,q1){q0 instanceof q7||(q0=q7.create(q0));for(var q2=void 0===q1?q0.len:q0.pos+q1,q3=new q10.RouteRequest;q0.pos<q2;){var q4=q0.uint32();switch(q4>>>3){case 1:q3.app=q0.string();break;case 2:q3.platform=q0.int32();break;case 3:q3.pushType=q0.int32();break;case 4:q3.deviceName=q0.string();break;case 5:q3.deviceVersion=q0.string();break;case 6:q3.phoneName=q0.string();break;case 7:q3.language=q0.string();break;case 8:q3.carrierName=q0.string();break;case 9:q3.appVersion=q0.string();break;case 10:q3.sdkVersion=q0.string();break;case 11:q3.wxAppId=q0.string();break;case 12:q3.wxAppKey=q0.string();break;case 13:q3.webAppId=q0.string();break;case 14:q3.webAppKey=q0.string();break;case 15:q3.host=q0.string();break;default:q0.skipType(7&q4)}}return q3},q0.decodeDelimited=function(q0){return q0 instanceof q7||(q0=new q7(q0)),this.decode(q0,q0.uint32())},q0.verify=function(q0){return"object"!==(void 0===q0?"undefined":(0,q3.default)(q0))||null===q0?"object expected":null!=q0.app&&q0.hasOwnProperty("app")&&!q9.isString(q0.app)?"app: string expected":null!=q0.platform&&q0.hasOwnProperty("platform")&&!q9.isInteger(q0.platform)?"platform: integer expected":null!=q0.pushType&&q0.hasOwnProperty("pushType")&&!q9.isInteger(q0.pushType)?"pushType: integer expected":null!=q0.deviceName&&q0.hasOwnProperty("deviceName")&&!q9.isString(q0.deviceName)?"deviceName: string expected":null!=q0.deviceVersion&&q0.hasOwnProperty("deviceVersion")&&!q9.isString(q0.deviceVersion)?"deviceVersion: string expected":null!=q0.phoneName&&q0.hasOwnProperty("phoneName")&&!q9.isString(q0.phoneName)?"phoneName: string expected":null!=q0.language&&q0.hasOwnProperty("language")&&!q9.isString(q0.language)?"language: string expected":null!=q0.carrierName&&q0.hasOwnProperty("carrierName")&&!q9.isString(q0.carrierName)?"carrierName: string expected":null!=q0.appVersion&&q0.hasOwnProperty("appVersion")&&!q9.isString(q0.appVersion)?"appVersion: string expected":null!=q0.sdkVersion&&q0.hasOwnProperty("sdkVersion")&&!q9.isString(q0.sdkVersion)?"sdkVersion: string expected":null!=q0.wxAppId&&q0.hasOwnProperty("wxAppId")&&!q9.isString(q0.wxAppId)?"wxAppId: string expected":null!=q0.wxAppKey&&q0.hasOwnProperty("wxAppKey")&&!q9.isString(q0.wxAppKey)?"wxAppKey: string expected":null!=q0.webAppId&&q0.hasOwnProperty("webAppId")&&!q9.isString(q0.webAppId)?"webAppId: string expected":null!=q0.webAppKey&&q0.hasOwnProperty("webAppKey")&&!q9.isString(q0.webAppKey)?"webAppKey: string expected":null!=q0.host&&q0.hasOwnProperty("host")&&!q9.isString(q0.host)?"host: string expected":null},q0.fromObject=function(q0){if(q0 instanceof q10.RouteRequest)return q0;var q1=new q10.RouteRequest;return null!=q0.app&&(q1.app=String(q0.app)),null!=q0.platform&&(q1.platform=0|q0.platform),null!=q0.pushType&&(q1.pushType=0|q0.pushType),null!=q0.deviceName&&(q1.deviceName=String(q0.deviceName)),null!=q0.deviceVersion&&(q1.deviceVersion=String(q0.deviceVersion)),null!=q0.phoneName&&(q1.phoneName=String(q0.phoneName)),null!=q0.language&&(q1.language=String(q0.language)),null!=q0.carrierName&&(q1.carrierName=String(q0.carrierName)),null!=q0.appVersion&&(q1.appVersion=String(q0.appVersion)),null!=q0.sdkVersion&&(q1.sdkVersion=String(q0.sdkVersion)),null!=q0.wxAppId&&(q1.wxAppId=String(q0.wxAppId)),null!=q0.wxAppKey&&(q1.wxAppKey=String(q0.wxAppKey)),null!=q0.webAppId&&(q1.webAppId=String(q0.webAppId)),null!=q0.webAppKey&&(q1.webAppKey=String(q0.webAppKey)),null!=q0.host&&(q1.host=String(q0.host)),q1},q0.toObject=function(q0,q1){q1||(q1={});var q2={};return q1.defaults&&(q2.app="",q2.platform=0,q2.pushType=0,q2.deviceName="",q2.deviceVersion="",q2.phoneName="",q2.language="",q2.carrierName="",q2.appVersion="",q2.sdkVersion="",q2.wxAppId="",q2.wxAppKey="",q2.webAppId="",q2.webAppKey="",q2.host=""),null!=q0.app&&q0.hasOwnProperty("app")&&(q2.app=q0.app),null!=q0.platform&&q0.hasOwnProperty("platform")&&(q2.platform=q0.platform),null!=q0.pushType&&q0.hasOwnProperty("pushType")&&(q2.pushType=q0.pushType),null!=q0.deviceName&&q0.hasOwnProperty("deviceName")&&(q2.deviceName=q0.deviceName),null!=q0.deviceVersion&&q0.hasOwnProperty("deviceVersion")&&(q2.deviceVersion=q0.deviceVersion),null!=q0.phoneName&&q0.hasOwnProperty("phoneName")&&(q2.phoneName=q0.phoneName),null!=q0.language&&q0.hasOwnProperty("language")&&(q2.language=q0.language),null!=q0.carrierName&&q0.hasOwnProperty("carrierName")&&(q2.carrierName=q0.carrierName),null!=q0.appVersion&&q0.hasOwnProperty("appVersion")&&(q2.appVersion=q0.appVersion),null!=q0.sdkVersion&&q0.hasOwnProperty("sdkVersion")&&(q2.sdkVersion=q0.sdkVersion),null!=q0.wxAppId&&q0.hasOwnProperty("wxAppId")&&(q2.wxAppId=q0.wxAppId),null!=q0.wxAppKey&&q0.hasOwnProperty("wxAppKey")&&(q2.wxAppKey=q0.wxAppKey),null!=q0.webAppId&&q0.hasOwnProperty("webAppId")&&(q2.webAppId=q0.webAppId),null!=q0.webAppKey&&q0.hasOwnProperty("webAppKey")&&(q2.webAppKey=q0.webAppKey),null!=q0.host&&q0.hasOwnProperty("host")&&(q2.host=q0.host),q2},q0.prototype.toJSON=function(){return this.constructor.toObject(this,q6.util.toJSONOptions)},q0}(),q10.AddressTriple=function(){function q0(q0){if(q0)for(var q1=(0,q4.default)(q0),q2=0;q2<q1.length;++q2)null!=q0[q1[q2]]&&(this[q1[q2]]=q0[q1[q2]])}return q0.prototype.host="",q0.prototype.longPort=0,q0.prototype.shortPort=0,q0.prototype.wssPort=0,q0.create=function(q1){return new q0(q1)},q0.encode=function(q0,q1){return q1||(q1=q8.create()),q1.uint32(10).string(q0.host),q1.uint32(16).int32(q0.longPort),q1.uint32(24).int32(q0.shortPort),null!=q0.wssPort&&q0.hasOwnProperty("wssPort")&&q1.uint32(32).int32(q0.wssPort),q1},q0.encodeDelimited=function(q0,q1){return this.encode(q0,q1).ldelim()},q0.decode=function(q0,q1){q0 instanceof q7||(q0=q7.create(q0));for(var q2=void 0===q1?q0.len:q0.pos+q1,q3=new q10.AddressTriple;q0.pos<q2;){var q4=q0.uint32();switch(q4>>>3){case 1:q3.host=q0.string();break;case 2:q3.longPort=q0.int32();break;case 3:q3.shortPort=q0.int32();break;case 4:q3.wssPort=q0.int32();break;default:q0.skipType(7&q4)}}if(!q3.hasOwnProperty("host"))throw q9.ProtocolError("missing required 'host'",{instance:q3});if(!q3.hasOwnProperty("longPort"))throw q9.ProtocolError("missing required 'longPort'",{instance:q3});if(!q3.hasOwnProperty("shortPort"))throw q9.ProtocolError("missing required 'shortPort'",{instance:q3});return q3},q0.decodeDelimited=function(q0){return q0 instanceof q7||(q0=new q7(q0)),this.decode(q0,q0.uint32())},q0.verify=function(q0){return"object"!==(void 0===q0?"undefined":(0,q3.default)(q0))||null===q0?"object expected":q9.isString(q0.host)?q9.isInteger(q0.longPort)?q9.isInteger(q0.shortPort)?null!=q0.wssPort&&q0.hasOwnProperty("wssPort")&&!q9.isInteger(q0.wssPort)?"wssPort: integer expected":null:"shortPort: integer expected":"longPort: integer expected":"host: string expected"},q0.fromObject=function(q0){if(q0 instanceof q10.AddressTriple)return q0;var q1=new q10.AddressTriple;return null!=q0.host&&(q1.host=String(q0.host)),null!=q0.longPort&&(q1.longPort=0|q0.longPort),null!=q0.shortPort&&(q1.shortPort=0|q0.shortPort),null!=q0.wssPort&&(q1.wssPort=0|q0.wssPort),q1},q0.toObject=function(q0,q1){q1||(q1={});var q2={};return q1.defaults&&(q2.host="",q2.longPort=0,q2.shortPort=0,q2.wssPort=0),null!=q0.host&&q0.hasOwnProperty("host")&&(q2.host=q0.host),null!=q0.longPort&&q0.hasOwnProperty("longPort")&&(q2.longPort=q0.longPort),null!=q0.shortPort&&q0.hasOwnProperty("shortPort")&&(q2.shortPort=q0.shortPort),null!=q0.wssPort&&q0.hasOwnProperty("wssPort")&&(q2.wssPort=q0.wssPort),q2},q0.prototype.toJSON=function(){return this.constructor.toObject(this,q6.util.toJSONOptions)},q0}(),q10.RouteResponse=function(){function q0(q0){if(this.candidate=[],q0)for(var q1=(0,q4.default)(q0),q2=0;q2<q1.length;++q2)null!=q0[q1[q2]]&&(this[q1[q2]]=q0[q1[q2]])}return q0.prototype.host="",q0.prototype.longPort=0,q0.prototype.shortPort=0,q0.prototype.thumbPara="",q0.prototype.node="",q0.prototype.commercial=0,q0.prototype.wssPort=0,q0.prototype.candidate=q9.emptyArray,q0.create=function(q1){return new q0(q1)},q0.encode=function(q0,q1){if(q1||(q1=q8.create()),q1.uint32(10).string(q0.host),q1.uint32(16).int32(q0.longPort),q1.uint32(24).int32(q0.shortPort),null!=q0.thumbPara&&q0.hasOwnProperty("thumbPara")&&q1.uint32(34).string(q0.thumbPara),null!=q0.node&&q0.hasOwnProperty("node")&&q1.uint32(42).string(q0.node),null!=q0.commercial&&q0.hasOwnProperty("commercial")&&q1.uint32(48).int32(q0.commercial),null!=q0.wssPort&&q0.hasOwnProperty("wssPort")&&q1.uint32(56).int32(q0.wssPort),null!=q0.candidate&&q0.candidate.length)for(var q2=0;q2<q0.candidate.length;++q2)q10.AddressTriple.encode(q0.candidate[q2],q1.uint32(66).fork()).ldelim();return q1},q0.encodeDelimited=function(q0,q1){return this.encode(q0,q1).ldelim()},q0.decode=function(q0,q1){q0 instanceof q7||(q0=q7.create(q0));for(var q2=void 0===q1?q0.len:q0.pos+q1,q3=new q10.RouteResponse;q0.pos<q2;){var q4=q0.uint32();switch(q4>>>3){case 1:q3.host=q0.string();break;case 2:q3.longPort=q0.int32();break;case 3:q3.shortPort=q0.int32();break;case 4:q3.thumbPara=q0.string();break;case 5:q3.node=q0.string();break;case 6:q3.commercial=q0.int32();break;case 7:q3.wssPort=q0.int32();break;case 8:q3.candidate&&q3.candidate.length||(q3.candidate=[]),q3.candidate.push(q10.AddressTriple.decode(q0,q0.uint32()));break;default:q0.skipType(7&q4)}}if(!q3.hasOwnProperty("host"))throw q9.ProtocolError("missing required 'host'",{instance:q3});if(!q3.hasOwnProperty("longPort"))throw q9.ProtocolError("missing required 'longPort'",{instance:q3});if(!q3.hasOwnProperty("shortPort"))throw q9.ProtocolError("missing required 'shortPort'",{instance:q3});return q3},q0.decodeDelimited=function(q0){return q0 instanceof q7||(q0=new q7(q0)),this.decode(q0,q0.uint32())},q0.verify=function(q0){if("object"!==(void 0===q0?"undefined":(0,q3.default)(q0))||null===q0)return"object expected";if(!q9.isString(q0.host))return"host: string expected";if(!q9.isInteger(q0.longPort))return"longPort: integer expected";if(!q9.isInteger(q0.shortPort))return"shortPort: integer expected";if(null!=q0.thumbPara&&q0.hasOwnProperty("thumbPara")&&!q9.isString(q0.thumbPara))return"thumbPara: string expected";if(null!=q0.node&&q0.hasOwnProperty("node")&&!q9.isString(q0.node))return"node: string expected";if(null!=q0.commercial&&q0.hasOwnProperty("commercial")&&!q9.isInteger(q0.commercial))return"commercial: integer expected";if(null!=q0.wssPort&&q0.hasOwnProperty("wssPort")&&!q9.isInteger(q0.wssPort))return"wssPort: integer expected";if(null!=q0.candidate&&q0.hasOwnProperty("candidate")){if(!Array.isArray(q0.candidate))return"candidate: array expected";for(var q1=0;q1<q0.candidate.length;++q1){var q2=q10.AddressTriple.verify(q0.candidate[q1]);if(q2)return"candidate."+q2}}return null},q0.fromObject=function(q0){if(q0 instanceof q10.RouteResponse)return q0;var q1=new q10.RouteResponse;if(null!=q0.host&&(q1.host=String(q0.host)),null!=q0.longPort&&(q1.longPort=0|q0.longPort),null!=q0.shortPort&&(q1.shortPort=0|q0.shortPort),null!=q0.thumbPara&&(q1.thumbPara=String(q0.thumbPara)),null!=q0.node&&(q1.node=String(q0.node)),null!=q0.commercial&&(q1.commercial=0|q0.commercial),null!=q0.wssPort&&(q1.wssPort=0|q0.wssPort),q0.candidate){if(!Array.isArray(q0.candidate))throw TypeError(".RouteResponse.candidate: array expected");q1.candidate=[];for(var q2=0;q2<q0.candidate.length;++q2){if("object"!==(0,q3.default)(q0.candidate[q2]))throw TypeError(".RouteResponse.candidate: object expected");q1.candidate[q2]=q10.AddressTriple.fromObject(q0.candidate[q2])}}return q1},q0.toObject=function(q0,q1){q1||(q1={});var q2={};if((q1.arrays||q1.defaults)&&(q2.candidate=[]),q1.defaults&&(q2.host="",q2.longPort=0,q2.shortPort=0,q2.thumbPara="",q2.node="",q2.commercial=0,q2.wssPort=0),null!=q0.host&&q0.hasOwnProperty("host")&&(q2.host=q0.host),null!=q0.longPort&&q0.hasOwnProperty("longPort")&&(q2.longPort=q0.longPort),null!=q0.shortPort&&q0.hasOwnProperty("shortPort")&&(q2.shortPort=q0.shortPort),null!=q0.thumbPara&&q0.hasOwnProperty("thumbPara")&&(q2.thumbPara=q0.thumbPara),null!=q0.node&&q0.hasOwnProperty("node")&&(q2.node=q0.node),null!=q0.commercial&&q0.hasOwnProperty("commercial")&&(q2.commercial=q0.commercial),null!=q0.wssPort&&q0.hasOwnProperty("wssPort")&&(q2.wssPort=q0.wssPort),q0.candidate&&q0.candidate.length){q2.candidate=[];for(var q3=0;q3<q0.candidate.length;++q3)q2.candidate[q3]=q10.AddressTriple.toObject(q0.candidate[q3],q1)}return q2},q0.prototype.toJSON=function(){return this.constructor.toObject(this,q6.util.toJSONOptions)},q0}(),q0.exports=q10},7200:(q0,q1,q2)=>{var q3=q2(516);q0.exports=function(q0,q1){var q2,q4;return q1.port=q1.port||1883,q1.hostname=q1.hostname||q1.host||"localhost",q2=q1.port,q4=q1.hostname,q3.createConnection(q2,q4)}},8864:(q0,q1,q2)=>{var q3=q2(5036);q0.exports=function(q0,q1){var q2;function q4(q3){q1.rejectUnauthorized&&q0.emit("error",q3),q2.end()}return q1.port=q1.port||8883,q1.host=q1.hostname||q1.host||"localhost",q1.rejectUnauthorized=!1!==q1.rejectUnauthorized,delete q1.path,(q2=q3.connect(q1)).on("secureConnect",(function(){q1.rejectUnauthorized&&!q2.authorized?q2.emit("error",new Error("TLS not authorized")):q2.removeListener("error",q4)})),q2.on("error",q4),q2}},7508:(q0,q1,q2)=>{var q3=q2(4132),q4=q2(2836),q5=q2(4776),q6=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],q7="browser"===q3.title;function q8(q0,q1){var q2="MQIsdp"===q1.protocolId&&3===q1.protocolVersion?"mqttv3.1":"mqtt";!function(q0){q0.hostname||(q0.hostname="localhost"),q0.port||("wss"===q0.protocol?q0.port=443:q0.port=80),q0.path||(q0.path="/"),q0.wsOptions||(q0.wsOptions={}),q7||"wss"!==q0.protocol||q6.forEach((function(q1){q0.hasOwnProperty(q1)&&!q0.wsOptions.hasOwnProperty(q1)&&(q0.wsOptions[q1]=q0[q1])}))}(q1);var q3=function(q0,q1){var q2=q0.protocol+"://"+q0.hostname+":"+q0.port+q0.path;return"function"==typeof q0.transformWsUrl&&(q2=q0.transformWsUrl(q2,q0,q1)),q2}(q1,q0);return q4(q3,[q2],q1.wsOptions)}q0.exports=q7?function(q0,q1){if(q1.hostname||(q1.hostname=q1.host),!q1.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var q2=q5.parse(document.URL);q1.hostname=q2.hostname,q1.port||(q1.port=q2.port)}return q8(q0,q1)}:function(q0,q1){return q8(q0,q1)}},4672:(q0,q1,q2)=>{var q3,q4,q5,q6=q2(3296).Buffer,q7=q2(4132),q8=q2(9496).Transform,q9=q2(7491);q0.exports=function(q0,q1){if(q1.hostname=q1.hostname||q1.host,!q1.hostname)throw new Error("Could not determine host. Specify host manually.");var q2="MQIsdp"===q1.protocolId&&3===q1.protocolVersion?"mqttv3.1":"mqtt";!function(q0){q0.hostname||(q0.hostname="localhost"),q0.path||(q0.p