wildfire-im-sdk
Version:
野火IM SDK for Vue3 projects
1 lines • 1.08 MB
JavaScript
import { default as __WEBPACK_EXTERNAL_MODULE__config_d5dcd965__ } from "../../config";import*as __WEBPACK_EXTERNAL_MODULE__wfc_util_base64_min_a37cf38e__ from"../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:(d0,d1,d2)=>{var d3=d2(4132),d4=d7(d2(696)),d5=d7(d2(6212)),d6=d7(d2(9708));function d7(d0){return d0&&d0.__esModule?d0:{default:d0}}var d8=d2(4936),d9=d2(3792),d10=d2(2300),d11=d2(9496).Writable,d12=d2(8248),d13=d2(6732),d14=d2(5440),d15=d2(9707),d16=d2.g.setImmediate||function(d0){d3.nextTick(d0)},d17={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},d18={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 d19(d0,d1,d2){d0.emit("packetsend",d1),!d10.writeToStream(d1,d0.stream,d0.options)&&d2?d0.stream.once("drain",d2):d2&&d2()}function d20(d0){d0&&(0,d6.default)(d0).forEach((function(d1){"function"==typeof d0[d1]&&(d0[d1](new Error("Connection closed")),delete d0[d1])}))}function d21(d0,d1,d2,d3){d0.outgoingStore.put(d1,(function(d4){if(d4)return d2&&d2(d4);d3(),d19(d0,d1,d2)}))}function d22(){}function d23(d0,d1){var d2,d3=this;if(!(this instanceof d23))return new d23(d0,d1);for(d2 in this.options=d1||{},d17)void 0===this.options[d2]?this.options[d2]=d17[d2]:this.options[d2]=d1[d2];this.options.clientId="string"==typeof d1.clientId?d1.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.options.customHandleAcks=5===d1.protocolVersion&&d1.customHandleAcks?d1.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=d0,this.outgoingStore=d1.outgoingStore||new d9,this.incomingStore=d1.incomingStore||new d9,this.queueQoSZero=void 0===d1.queueQoSZero||d1.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 d0=this.queue;!function d1(){var d2,d4=d0.shift();d4&&(d2=d4.packet,d3._sendPacket(d2,(function(d0){d4.cb&&d4.cb(d0),d1()})))}()})),this.on("close",(function(){null!==d3.pingTimer&&(d3.pingTimer.clear(),d3.pingTimer=null)})),d8.EventEmitter.call(this),this._setupStream()}d12(d23,d8.EventEmitter),d23.prototype._setupStream=function(){var d0,d1=this,d2=new d11,d6=d10.parser(this.options),d7=null,d8=[];function d9(){if(d8.length)d3.nextTick(d12);else{var d0=d7;d7=null,d0()}}function d12(){var d0=d8.shift();if(d0)d1._handlePacket(d0,d9);else{var d2=d7;d7=null,d2&&d2()}}if(this._clearReconnect(),this.stream=this.streamBuilder(this),d6.on("packet",(function(d0){d8.push(d0)})),d2._write=function(d0,d1,d2){d7=d2,d6.parse(d0),d12()},this.stream.pipe(d2),this.stream.on("error",d22),this.stream.on("close",(function(){d1.emit("close")})),(d0=(0,d5.default)(this.options)).cmd="connect",d19(this,d0),d6.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,d4.default)(this.options.authPacket))d19(this,d15({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){d1._cleanUp(!0)}),this.options.connectTimeout)},d23.prototype._handlePacket=function(d0,d1){var d2=this.options;if(5===d2.protocolVersion&&d2.properties&&d2.properties.maximumPacketSize&&d2.properties.maximumPacketSize<d0.length)return this.emit("error",new Error("exceeding packets size "+d0.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(this.emit("packetreceive",d0),d0.cmd){case"publish":try{this._handlePublish(d0,d1)}catch(d0){console.error(d0)}break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":try{this._handleAck(d0)}catch(d0){console.log(d0)}d1();break;case"pubrel":this._handlePubrel(d0,d1);break;case"connack":this._handleConnack(d0),d1();break;case"pingresp":this._handlePingresp(d0),d1();break;case"disconnect":this._handleDisconnect(d0),d1()}},d23.prototype._checkDisconnecting=function(d0){return this.disconnecting&&(d0?d0(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},d23.prototype.publish=function(d0,d1,d2,d3){var d4,d5=this.options;"function"==typeof d2&&(d3=d2,d2=null);if(d2=d15({qos:0,retain:!1,dup:!1},d2),this._checkDisconnecting(d3))return this;switch(d4={cmd:"publish",topic:d0,payload:d1,qos:d2.qos,retain:d2.retain,messageId:this._nextId(),dup:d2.dup},5===d5.protocolVersion&&(d4.properties=d2.properties,(!d5.properties&&d4.properties&&d4.properties.topicAlias||d2.properties&&d5.properties&&(d2.properties.topicAlias&&d5.properties.topicAliasMaximum&&d2.properties.topicAlias>d5.properties.topicAliasMaximum||!d5.properties.topicAliasMaximum&&d2.properties.topicAlias))&&delete d4.properties.topicAlias),d2.qos){case 1:case 2:this.outgoing[d4.messageId]=d3||d22,this._storeProcessing?(this._packetIdsDuringStoreProcessing[d4.messageId]=!1,this._storePacket(d4,void 0,d2.cbStorePut)):this._sendPacket(d4,void 0,d2.cbStorePut);break;default:this._storeProcessing?this._storePacket(d4,d3,d2.cbStorePut):this._sendPacket(d4,d3,d2.cbStorePut)}return this},d23.prototype.subscribe=function(){for(var d0,d1=new Array(arguments.length),d2=0;d2<arguments.length;d2++)d1[d2]=arguments[d2];var d3,d4=[],d5=d1.shift(),d7=d5.resubscribe,d8=d1.pop()||d22,d9=d1.pop(),d10=this,d11=this.options.protocolVersion;if(delete d5.resubscribe,"string"==typeof d5&&(d5=[d5]),"function"!=typeof d8&&(d9=d8,d8=d22),null!==(d3=d14.validateTopics(d5)))return d16(d8,new Error("Invalid topic "+d3)),this;if(this._checkDisconnecting(d8))return this;var d12={qos:0};if(5===d11&&(d12.nl=!1,d12.rap=!1,d12.rh=0),d9=d15(d12,d9),Array.isArray(d5)?d5.forEach((function(d0){if(!d10._resubscribeTopics.hasOwnProperty(d0)||d10._resubscribeTopics[d0].qos<d9.qos||d7){var d1={topic:d0,qos:d9.qos};5===d11&&(d1.nl=d9.nl,d1.rap=d9.rap,d1.rh=d9.rh,d1.properties=d9.properties),d4.push(d1)}})):(0,d6.default)(d5).forEach((function(d0){if(!d10._resubscribeTopics.hasOwnProperty(d0)||d10._resubscribeTopics[d0].qos<d5[d0].qos||d7){var d1={topic:d0,qos:d5[d0].qos};5===d11&&(d1.nl=d5[d0].nl,d1.rap=d5[d0].rap,d1.rh=d5[d0].rh,d1.properties=d9.properties),d4.push(d1)}})),d0={cmd:"subscribe",subscriptions:d4,qos:1,retain:!1,dup:!1,messageId:this._nextId()},d9.properties&&(d0.properties=d9.properties),d4.length){if(this.options.resubscribe){var d13=[];d4.forEach((function(d0){if(d10.options.reconnectPeriod>0){var d1={qos:d0.qos};5===d11&&(d1.nl=d0.nl||!1,d1.rap=d0.rap||!1,d1.rh=d0.rh||0,d1.properties=d0.properties),d10._resubscribeTopics[d0.topic]=d1,d13.push(d0.topic)}})),d10.messageIdToTopic[d0.messageId]=d13}return this.outgoing[d0.messageId]=function(d0,d1){if(!d0)for(var d2=d1.granted,d3=0;d3<d2.length;d3+=1)d4[d3].qos=d2[d3];d8(d0,d4)},this._sendPacket(d0),this}d8(null,[])},d23.prototype.unsubscribe=function(){for(var d0={cmd:"unsubscribe",qos:1,messageId:this._nextId()},d1=this,d2=new Array(arguments.length),d3=0;d3<arguments.length;d3++)d2[d3]=arguments[d3];var d5=d2.shift(),d6=d2.pop()||d22,d7=d2.pop();return"string"==typeof d5&&(d5=[d5]),"function"!=typeof d6&&(d7=d6,d6=d22),this._checkDisconnecting(d6)||("string"==typeof d5?d0.unsubscriptions=[d5]:"object"===(void 0===d5?"undefined":(0,d4.default)(d5))&&d5.length&&(d0.unsubscriptions=d5),this.options.resubscribe&&d0.unsubscriptions.forEach((function(d0){delete d1._resubscribeTopics[d0]})),"object"===(void 0===d7?"undefined":(0,d4.default)(d7))&&d7.properties&&(d0.properties=d7.properties),this.outgoing[d0.messageId]=d6,this._sendPacket(d0)),this},d23.prototype.end=function(){var d0=this,d1=arguments[0],d2=arguments[1],d3=arguments[2];function d5(){d0.disconnected=!0,d0.incomingStore.close((function(){d0.outgoingStore.close((function(){d3&&d3.apply(null,arguments),d0.emit("end")}))})),d0._deferredReconnect&&d0._deferredReconnect()}function d7(){d0._cleanUp(d1,d16.bind(null,d5),d2)}return null!=d1&&"boolean"==typeof d1||(d3=d2||d22,d2=d1,d1=!1,"object"!==(void 0===d2?"undefined":(0,d4.default)(d2))&&(d3=d2,d2=null,"function"!=typeof d3&&(d3=d22))),"object"!==(void 0===d2?"undefined":(0,d4.default)(d2))&&(d3=d2,d2=null),d3=d3||d22,this.disconnecting||(this._clearReconnect(),this.disconnecting=!0,!d1&&(0,d6.default)(this.outgoing).length>0?this.once("outgoingEmpty",setTimeout.bind(null,d7,10)):d7()),this},d23.prototype.removeOutgoingMessage=function(d0){var d1=this.outgoing[d0];return delete this.outgoing[d0],this.outgoingStore.del({messageId:d0},(function(){d1(new Error("Message removed"))})),this},d23.prototype.reconnect=function(d0){var d1=this,d2=function(){d0?(d1.options.incomingStore=d0.incomingStore,d1.options.outgoingStore=d0.outgoingStore):(d1.options.incomingStore=null,d1.options.outgoingStore=null),d1.incomingStore=d1.options.incomingStore||new d9,d1.outgoingStore=d1.options.outgoingStore||new d9,d1.disconnecting=!1,d1.disconnected=!1,d1._deferredReconnect=null,d1._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=d2:d2(),this},d23.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},d23.prototype._setupReconnect=function(){var d0=this;!d0.disconnecting&&!d0.reconnectTimer&&d0.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),d0.reconnectTimer=setInterval((function(){d0._reconnect()}),d0.options.reconnectPeriod))},d23.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},d23.prototype._cleanUp=function(d0,d1){var d2=arguments[2];if(d1&&this.stream.on("close",d1),d0)0===this.options.reconnectPeriod&&this.options.clean&&d20(this.outgoing),this.stream.destroy();else{var d3=d15({cmd:"disconnect"},d2);this._sendPacket(d3,d16.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),d1&&!this.connected&&(this.stream.removeListener("close",d1),d1())},d23.prototype._sendPacket=function(d0,d1,d2){if(d2=d2||d22,this.connected){switch(this._shiftPingInterval(),d0.cmd){case"publish":break;case"pubrel":return void d21(this,d0,d1,d2);default:return void d19(this,d0,d1)}switch(d0.qos){case 2:case 1:d21(this,d0,d1,d2);break;default:d19(this,d0,d1)}}else this._storePacket(d0,d1,d2)},d23.prototype._storePacket=function(d0,d1,d2){d2=d2||d22,0===(d0.qos||0)&&this.queueQoSZero||"publish"!==d0.cmd?this.queue.push({packet:d0,cb:d1}):d0.qos>0?(d1=this.outgoing[d0.messageId],this.outgoingStore.put(d0,(function(d0){if(d0)return d1&&d1(d0);d2()}))):d1&&d1(new Error("No connection to broker"))},d23.prototype._setupPingTimer=function(){var d0=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=d13((function(){d0._checkPing()}),1e3*this.options.keepalive))},d23.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},d23.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},d23.prototype._handlePingresp=function(){this.pingResp=!0,this.emit("pingresp",(new Date).getTime())},d23.prototype._handleConnack=function(d0){var d1=this.options,d2=5===d1.protocolVersion?d0.reasonCode:d0.returnCode;if(clearTimeout(this.connackTimer),d0.properties&&(d0.properties.topicAliasMaximum&&(d1.properties||(d1.properties={}),d1.properties.topicAliasMaximum=d0.properties.topicAliasMaximum),d0.properties.serverKeepAlive&&d1.keepalive&&(d1.keepalive=d0.properties.serverKeepAlive,this._shiftPingInterval()),d0.properties.maximumPacketSize&&(d1.properties||(d1.properties={}),d1.properties.maximumPacketSize=d0.properties.maximumPacketSize)),0===d2)this.reconnecting=!1,this._onConnect(d0);else if(d2>0){var d3=new Error("Connection refused: "+d18[d2]);d3.code=d2,this.emit("error",d3)}},d23.prototype._handlePublish=function(d0,d1){d1=void 0!==d1?d1:d22;var d2=d0.topic.toString(),d3=d0.payload,d4=d0.qos,d5=d0.messageId,d6=this,d7=this.options,d8=[0,16,128,131,135,144,145,151,153];switch(d4){case 2:d7.customHandleAcks(d2,d3,d0,(function(d2,d3){return d2 instanceof Error||(d3=d2,d2=null),d2?d6.emit("error",d2):-1===d8.indexOf(d3)?d6.emit("error",new Error("Wrong reason code for pubrec")):void(d3?d6._sendPacket({cmd:"pubrec",messageId:d5,reasonCode:d3},d1):d6.incomingStore.put(d0,(function(){d6._sendPacket({cmd:"pubrec",messageId:d5},d1)})))}));break;case 1:d7.customHandleAcks(d2,d3,d0,(function(d4,d7){return d4 instanceof Error||(d7=d4,d4=null),d4?d6.emit("error",d4):-1===d8.indexOf(d7)?d6.emit("error",new Error("Wrong reason code for puback")):(d7||d6.emit("message",d2,d3,d0),void d6.handleMessage(d0,(function(d0){if(d0)return d1&&d1(d0);d6._sendPacket({cmd:"puback",messageId:d5,reasonCode:d7},d1)})))}));break;case 0:this.emit("message",d2,d3,d0),this.handleMessage(d0,d1)}},d23.prototype.handleMessage=function(d0,d1){d1()},d23.prototype._handleAck=function(d0){var d1,d2=d0.messageId,d3=d0.cmd,d4=null,d5=this.outgoing[d2],d7=this;if(d5){switch(d3){case"pubcomp":case"puback":var d8=d0.reasonCode;d8&&d8>0&&16!==d8&&10!==d8?((d1=new Error("Publish error: "+d18[d8])).code=d8,d5(d1,d0)):d8&&10===d8&&d5(null,d0),delete this.outgoing[d2],this.outgoingStore.del(d0,d5);break;case"pubrec":d4={cmd:"pubrel",qos:2,messageId:d2};var d9=d0.reasonCode;d9&&d9>0&&16!==d9?((d1=new Error("Publish error: "+d18[d9])).code=d9,d5(d1,d0)):this._sendPacket(d4);break;case"suback":delete this.outgoing[d2];for(var d10=0;d10<d0.granted.length;d10++)if(0!=(128&d0.granted[d10])){var d11=this.messageIdToTopic[d2];d11&&d11.forEach((function(d0){delete d7._resubscribeTopics[d0]}))}d5(null,d0);break;case"unsuback":delete this.outgoing[d2],d5(null);break;default:d7.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===(0,d6.default)(this.outgoing).length&&this.emit("outgoingEmpty")}},d23.prototype._handlePubrel=function(d0,d1){d1=void 0!==d1?d1:d22;var d2=d0.messageId,d3=this,d4={cmd:"pubcomp",messageId:d2};d3.incomingStore.get(d0,(function(d0,d2){d0?d3._sendPacket(d4,d1):(d3.emit("message",d2.topic,d2.payload,d2),d3.handleMessage(d2,(function(d0){if(d0)return d1(d0);d3.incomingStore.del(d2,d22),d3._sendPacket(d4,d1)})))}))},d23.prototype._handleDisconnect=function(d0){this.emit("disconnect",d0)},d23.prototype._nextId=function(){var d0=this.nextId++;return 65536===this.nextId&&(this.nextId=1),d0},d23.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},d23.prototype._resubscribe=function(d0){var d1=(0,d6.default)(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!d0.sessionPresent)&&d1.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion)for(var d2=0;d2<d1.length;d2++){var d3={};d3[d1[d2]]=this._resubscribeTopics[d1[d2]],d3.resubscribe=!0,this.subscribe(d3,{properties:d3[d1[d2]].properties})}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},d23.prototype._onConnect=function(d0){if(this.disconnected)this.emit("connect",d0);else{var d1=this;this._setupPingTimer(),this._resubscribe(d0),this.connected=!0,function d2(){var d3=d1.outgoingStore.createStream();function d4(){d1._storeProcessing=!1,d1._packetIdsDuringStoreProcessing={}}function d5(){d3.destroy(),d3=null,d4()}d1.once("close",d5),d3.on("error",(function(d0){d4(),d1.removeListener("close",d5),d1.emit("error",d0)})),d3.on("end",(function(){var d3=!0;for(var d6 in d1._packetIdsDuringStoreProcessing)if(!d1._packetIdsDuringStoreProcessing[d6]){d3=!1;break}d3?(d4(),d1.removeListener("close",d5),d1.emit("connect",d0)):d2()})),function d0(){if(d3){d1._storeProcessing=!0;var d2,d4=d3.read(1);d4?d1._packetIdsDuringStoreProcessing[d4.messageId]?d0():d1.disconnecting||d1.reconnectTimer?d3.destroy&&d3.destroy():(d2=d1.outgoing[d4.messageId],d1.outgoing[d4.messageId]=function(d1,d3){d2&&d2(d1,d3),d0()},d1._packetIdsDuringStoreProcessing[d4.messageId]=!0,d1._sendPacket(d4)):d3.once("readable",d0)}}()}()}},d0.exports=d23},9048:(d0,d1,d2)=>{var d3,d4,d5,d6=d2(3296).Buffer,d7=d2(9496).Transform,d8=d2(7491),d9=d2(5704),d10=!1;d0.exports=function(d0,d1){if(d1.hostname=d1.hostname||d1.host,!d1.hostname)throw new Error("Could not determine host. Specify host manually.");var d2="MQIsdp"===d1.protocolId&&3===d1.protocolVersion?"mqttv3.1":"mqtt";!function(d0){d0.hostname||(d0.hostname="localhost"),d0.path||(d0.path="/"),d0.wsOptions||(d0.wsOptions={})}(d1);var d11=function(d0,d1){var d2="alis"===d0.protocol?"wss":"ws",d3=d2+"://"+d0.hostname+d0.path;return d0.port&&80!==d0.port&&443!==d0.port&&(d3=d2+"://"+d0.hostname+":"+d0.port+d0.path),"function"==typeof d0.transformWsUrl&&(d3=d0.transformWsUrl(d3,d0,d1)),d3}(d1,d0);return(d3=d1.my).connectSocket({url:d11,protocols:d2}),d4=function(){var d0=new d7;return d0._write=function(d0,d1,d2){d3.sendSocketMessage({data:d0.buffer,success:function(){d2()},fail:function(){d2(new Error)}})},d0._flush=function(d0){d3.closeSocket({success:function(){d0()}})},d0}(),d5=d8.obj(),d10||(d10=!0,d3.onSocketOpen((function(){d5.setReadable(d4),d5.setWritable(d4),d5.emit("connect")})),d3.onSocketMessage((function(d0){if("string"==typeof d0.data){var d1=d9.toByteArray(d0.data),d2=d6.from(d1);d4.push(d2)}else{var d3=new FileReader;d3.addEventListener("load",(function(){var d0=d3.result;d0=d0 instanceof ArrayBuffer?d6.from(d0):d6.from(d0,"utf8"),d4.push(d0)})),d3.readAsArrayBuffer(d0.data)}})),d3.onSocketClose((function(){d5.end(),d5.destroy()})),d3.onSocketError((function(d0){d5.destroy(d0)}))),d5}},9824:(d0,d1,d2)=>{var d3=d2(4132),d4=d2(3296).Buffer,d5=d8(d2(696)),d6=d2(9444),d7=d8(d2(2816));function d8(d0){return d0&&d0.__esModule?d0:{default:d0}}var d9=d2(6392),d10=d2(3792),d11=d2(4776),d12=d2(9707),d13={},d14="imtest.shengshitong.com",d15="web_12345678",d16="a3f9bf468f31173ba841df6eb1b5585b1f96cfb3";function d17(d0,d1,d3,d5,d8){!function(d0,d1,d3,d5,d8){var d9=void 0,d10=d8&&d8.backupHost&&2===d8.backupAddressStrategy?d8.backupHost:"imtest.shengshitong.com",d11=d8&&d8.backupHost&&2===d8.backupAddressStrategy?d8.backupPort:d7.default.ROUTE_PORT?d7.default.ROUTE_PORT:80;d7.default.USE_WSS?(d20("https route"),d9="https://"+d10+(443!==d11?":"+d11:"")+"/route"):d9="http://"+d10+(80!==d11?":"+d11:"")+"/route";d20("route url",d9);var d12=d2(8120).RouteRequest,d13=d2(8120).RouteResponse,d17=d2(8120).IMHttpWrapper,d21=d2(7480).AESDecrypt,d22=d2(7480).Uint8ToStr,d23=d2(7480).AESEncrypt,d24="",d25="",d26=d2(8).Y,d27=d2(8).O,d28=new XMLHttpRequest,d29=setTimeout((function(){!0,d28.abort(),console.log("request timeout, to abort")}),1e4);d28.open("POST",d9),d28.onerror=function(){d20("route request error"),d5(-1)},d28.onabort=function(){d20("route request abort"),d5(-1)},d28.ontimeout=function(){d20("route request timeout"),d5(-1)},d28.onreadystatechange=function(){if(4===d28.readyState)if(clearTimeout(d29),200===d28.status){var d2=d26(d28.responseText);(!d2||d2.byteLength<1)&&(d20("route response error",d28.responseText),d5(-1));var d3=new Int8Array(d2,0,1);if(0===d3[0]){var d4=d27(d2.slice(1)),d10=d21(d4,d24,!0),d11=d13.decode(d10);d20("route res",d11.host,d11.longPort,d11.wssPort);for(var d12=d11.node+"|"+d14,d15="",d16=0;d16<d12.length;d16++)d15+=String.fromCharCode(90^d12[d16].charCodeAt(0));d12=(0,d6.btoa)(unescape(encodeURIComponent(d15)));var d17={keepalive:d7.default.KEEP_ALIVE_TIMEOUT,clientId:d1,protocolId:"MQTT",protocolVersion:6,clean:!0,reconnectPeriod:0,resubscribe:!1,connectTimeout:2e4,a:d14,will:{topic:d12,payload:"Connection Closed abnormally..!",qos:1,retain:!1},rejectUnauthorized:!1};d17.username=d0,d17.password=d25;var d22=(new Date).getTime(),d23=void 0,d30=(8&d11.commercial)>0,d31=void 0,d32=void 0;if(d8&&d8.backupHost&&2===d8.backupAddressStrategy){var d33=d11.candidate[0];d32=d33.host,d31=d33.wssPort}else d32=d11.host,d31=d7.default.USE_WSS&&(d31=d30?d11.wssPort:d11.longPort)||d11.longPort;d20("connect url",d32,d31),d7.default.USE_WSS?(d20("wss mqtts"),d23=d18("mqtts://"+d32+":"+d31,d17)):(d20("ws mqtt",d7.default.USE_WSS),d23=d18("mqtt://"+d32+":"+d31,d17)),d19=d11.host;var d34={isReceiptEnable:(2&d11.commercial)>0,isClearGroupMsgWhenKickoff:(4&d11.commercial)>0,isDisableRoamingConvList:(16&d11.commercial)>0,isKeepMsgAfterDismiss:(32&d11.commercial)>0,isSupportBigFileUpload:(64&d11.commercial)>0,isBackupDownloadUrl:(128&d11.commercial)>0,isGlobalDisableSyncDraft:(256&d11.commercial)>0,isSupportQos0Message:(512&d11.commercial)>0,isUserOnlineStateEnable:(1024&d11.commercial)>0,isMeshEnable:(32768&d11.commercial)>0};(1&d11.commercial)>0?d5(0,d23,d24,d22,d34):d5(-1)}else d20("route error",d9,d3[0]),d5(d3[0])}else d20("http route error,请先检查下USE_WSS、ROUTE_PORT配置",d9,d28.status),d5(-1)},d28.setRequestHeader("p","web"),d28.setRequestHeader("appId",d15),d28.setRequestHeader("appKey",d16),d28.setRequestHeader("cid",d23(d1)),d28.setRequestHeader("uid",d23(d0)),d28.setRequestHeader("Content-Type","application/octet-stream");var d30=d12.create();d30.app="cn.wildfirechat.chat.web",d30.appVersion="0.1",d30.deviceName="browser",d30.platform=5,d30.phoneName="browser",d30.sdkVersion="0.1",d30.language=d7.default.LANGUAGE;var d31=void 0;try{d31=d22(d21(d3,"",!1))}catch(d0){d20("token error!!!")}var d32=d31.split("|")[0];d24=d31.split("|")[1],d25=new d4(d23(d32,d24),"base64"),d30.host=d23("imtest.shengshitong.com","");var d33=d12.encode(d30).finish(),d34=d17.create();d34.clientId=d1,d34.token=d32,d34.request="ROUTE",d34.data=d33;var d35=d17.encode(d34).finish(),d36=d23(d35,d24);d28.send(d36)}(d0,d1,d3,d5,d8)}function d18(d0,d1){if("object"!==(void 0===d0?"undefined":(0,d5.default)(d0))||d1||(d1=d0,d0=null),d1=d1||{},d0){var d2=d11.parse(d0,!0);if(null!=d2.port&&(d2.port=Number(d2.port)),null===(d1=d12(d2,d1)).protocol)throw new Error("Missing protocol");d1.protocol=d1.protocol.replace(/:$/,"")}if(function(d0){var d1;d0.auth&&((d1=d0.auth.match(/^(.+):(.+)$/))?(d0.username=d1[1],d0.password=d1[2]):d0.username=d0.auth)}(d1),d1.query&&"string"==typeof d1.query.clientId&&(d1.clientId=d1.query.clientId),d1.cert&&d1.key){if(!d1.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(d1.protocol))switch(d1.protocol){case"mqtt":d1.protocol="mqtts";break;case"ws":d1.protocol="wss";break;case"wx":d1.protocol="wxs";break;case"ali":d1.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+d1.protocol+'"!')}}if(!d13[d1.protocol]){var d3=-1!==["mqtts","wss"].indexOf(d1.protocol);d1.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(d0,d1){return(!d3||d1%2!=0)&&"function"==typeof d13[d0]}))[0]}if(!1===d1.clean&&!d1.clientId)throw new Error("Missing clientId for unclean clients");return d1.protocol&&(d1.defaultProtocol=d1.protocol),new d9((function(d0){return d1.servers&&(d0._reconnectCount&&d0._reconnectCount!==d1.servers.length||(d0._reconnectCount=0),d1.host=d1.servers[d0._reconnectCount].host,d1.port=d1.servers[d0._reconnectCount].port,d1.protocol=d1.servers[d0._reconnectCount].protocol?d1.servers[d0._reconnectCount].protocol:d1.defaultProtocol,d1.hostname=d1.host,d0._reconnectCount++),d13[d1.protocol](d0,d1)}),d1)}"browser"!==d3.title?(d13.mqtt=d2(7200),d13.tcp=d2(7200),d13.ssl=d2(8864),d13.tls=d2(8864),d13.mqtts=d2(8864)):(d13.wx=d2(4672),d13.wxs=d2(4672),d13.ali=d2(9048),d13.alis=d2(9048)),d13.ws=d2(7508),d13.wss=d2(7508);var d19="";function d20(d0){if(!d7.default.DISABLE_LOG){for(var d1,d2=arguments.length,d3=Array(d2>1?d2-1:0),d4=1;d4<d2;d4++)d3[d4-1]=arguments[d4];(d1=console).log.apply(d1,[d0].concat(d3))}}d0.exports=d17,d0.exports.connect=d17,d0.exports.MqttClient=d9,d0.exports.Store=d10,d0.exports.host=function(){return d19}},8120:(d0,d1,d2)=>{var d3=d5(d2(696)),d4=d5(d2(9708));function d5(d0){return d0&&d0.__esModule?d0:{default:d0}}var d6=d2(7328),d7=d6.Reader,d8=d6.Writer,d9=d6.util,d10=d6.roots.default||(d6.roots.default={});d10.IMHttpWrapper=function(){function d0(d0){if(d0)for(var d1=(0,d4.default)(d0),d2=0;d2<d1.length;++d2)null!=d0[d1[d2]]&&(this[d1[d2]]=d0[d1[d2]])}return d0.prototype.token="",d0.prototype.clientId="",d0.prototype.request="",d0.prototype.data=d9.newBuffer([]),d0.create=function(d1){return new d0(d1)},d0.encode=function(d0,d1){return d1||(d1=d8.create()),d1.uint32(10).string(d0.token),d1.uint32(18).string(d0.clientId),d1.uint32(26).string(d0.request),null!=d0.data&&d0.hasOwnProperty("data")&&d1.uint32(34).bytes(d0.data),d1},d0.encodeDelimited=function(d0,d1){return this.encode(d0,d1).ldelim()},d0.decode=function(d0,d1){d0 instanceof d7||(d0=d7.create(d0));for(var d2=void 0===d1?d0.len:d0.pos+d1,d3=new d10.IMHttpWrapper;d0.pos<d2;){var d4=d0.uint32();switch(d4>>>3){case 1:d3.token=d0.string();break;case 2:d3.clientId=d0.string();break;case 3:d3.request=d0.string();break;case 4:d3.data=d0.bytes();break;default:d0.skipType(7&d4)}}if(!d3.hasOwnProperty("token"))throw d9.ProtocolError("missing required 'token'",{instance:d3});if(!d3.hasOwnProperty("clientId"))throw d9.ProtocolError("missing required 'clientId'",{instance:d3});if(!d3.hasOwnProperty("request"))throw d9.ProtocolError("missing required 'request'",{instance:d3});return d3},d0.decodeDelimited=function(d0){return d0 instanceof d7||(d0=new d7(d0)),this.decode(d0,d0.uint32())},d0.verify=function(d0){return"object"!==(void 0===d0?"undefined":(0,d3.default)(d0))||null===d0?"object expected":d9.isString(d0.token)?d9.isString(d0.clientId)?d9.isString(d0.request)?null!=d0.data&&d0.hasOwnProperty("data")&&!(d0.data&&"number"==typeof d0.data.length||d9.isString(d0.data))?"data: buffer expected":null:"request: string expected":"clientId: string expected":"token: string expected"},d0.fromObject=function(d0){if(d0 instanceof d10.IMHttpWrapper)return d0;var d1=new d10.IMHttpWrapper;return null!=d0.token&&(d1.token=String(d0.token)),null!=d0.clientId&&(d1.clientId=String(d0.clientId)),null!=d0.request&&(d1.request=String(d0.request)),null!=d0.data&&("string"==typeof d0.data?d9.base64.decode(d0.data,d1.data=d9.newBuffer(d9.base64.length(d0.data)),0):d0.data.length&&(d1.data=d0.data)),d1},d0.toObject=function(d0,d1){d1||(d1={});var d2={};return d1.defaults&&(d2.token="",d2.clientId="",d2.request="",d1.bytes===String?d2.data="":(d2.data=[],d1.bytes!==Array&&(d2.data=d9.newBuffer(d2.data)))),null!=d0.token&&d0.hasOwnProperty("token")&&(d2.token=d0.token),null!=d0.clientId&&d0.hasOwnProperty("clientId")&&(d2.clientId=d0.clientId),null!=d0.request&&d0.hasOwnProperty("request")&&(d2.request=d0.request),null!=d0.data&&d0.hasOwnProperty("data")&&(d2.data=d1.bytes===String?d9.base64.encode(d0.data,0,d0.data.length):d1.bytes===Array?Array.prototype.slice.call(d0.data):d0.data),d2},d0.prototype.toJSON=function(){return this.constructor.toObject(this,d6.util.toJSONOptions)},d0}(),d10.RouteRequest=function(){function d0(d0){if(d0)for(var d1=(0,d4.default)(d0),d2=0;d2<d1.length;++d2)null!=d0[d1[d2]]&&(this[d1[d2]]=d0[d1[d2]])}return d0.prototype.app="",d0.prototype.platform=0,d0.prototype.pushType=0,d0.prototype.deviceName="",d0.prototype.deviceVersion="",d0.prototype.phoneName="",d0.prototype.language="",d0.prototype.carrierName="",d0.prototype.appVersion="",d0.prototype.sdkVersion="",d0.prototype.wxAppId="",d0.prototype.wxAppKey="",d0.prototype.webAppId="",d0.prototype.webAppKey="",d0.prototype.host="",d0.create=function(d1){return new d0(d1)},d0.encode=function(d0,d1){return d1||(d1=d8.create()),null!=d0.app&&d0.hasOwnProperty("app")&&d1.uint32(10).string(d0.app),null!=d0.platform&&d0.hasOwnProperty("platform")&&d1.uint32(16).int32(d0.platform),null!=d0.pushType&&d0.hasOwnProperty("pushType")&&d1.uint32(24).int32(d0.pushType),null!=d0.deviceName&&d0.hasOwnProperty("deviceName")&&d1.uint32(34).string(d0.deviceName),null!=d0.deviceVersion&&d0.hasOwnProperty("deviceVersion")&&d1.uint32(42).string(d0.deviceVersion),null!=d0.phoneName&&d0.hasOwnProperty("phoneName")&&d1.uint32(50).string(d0.phoneName),null!=d0.language&&d0.hasOwnProperty("language")&&d1.uint32(58).string(d0.language),null!=d0.carrierName&&d0.hasOwnProperty("carrierName")&&d1.uint32(66).string(d0.carrierName),null!=d0.appVersion&&d0.hasOwnProperty("appVersion")&&d1.uint32(74).string(d0.appVersion),null!=d0.sdkVersion&&d0.hasOwnProperty("sdkVersion")&&d1.uint32(82).string(d0.sdkVersion),null!=d0.wxAppId&&d0.hasOwnProperty("wxAppId")&&d1.uint32(90).string(d0.wxAppId),null!=d0.wxAppKey&&d0.hasOwnProperty("wxAppKey")&&d1.uint32(98).string(d0.wxAppKey),null!=d0.webAppId&&d0.hasOwnProperty("webAppId")&&d1.uint32(106).string(d0.webAppId),null!=d0.webAppKey&&d0.hasOwnProperty("webAppKey")&&d1.uint32(114).string(d0.webAppKey),null!=d0.host&&d0.hasOwnProperty("host")&&d1.uint32(122).string(d0.host),d1},d0.encodeDelimited=function(d0,d1){return this.encode(d0,d1).ldelim()},d0.decode=function(d0,d1){d0 instanceof d7||(d0=d7.create(d0));for(var d2=void 0===d1?d0.len:d0.pos+d1,d3=new d10.RouteRequest;d0.pos<d2;){var d4=d0.uint32();switch(d4>>>3){case 1:d3.app=d0.string();break;case 2:d3.platform=d0.int32();break;case 3:d3.pushType=d0.int32();break;case 4:d3.deviceName=d0.string();break;case 5:d3.deviceVersion=d0.string();break;case 6:d3.phoneName=d0.string();break;case 7:d3.language=d0.string();break;case 8:d3.carrierName=d0.string();break;case 9:d3.appVersion=d0.string();break;case 10:d3.sdkVersion=d0.string();break;case 11:d3.wxAppId=d0.string();break;case 12:d3.wxAppKey=d0.string();break;case 13:d3.webAppId=d0.string();break;case 14:d3.webAppKey=d0.string();break;case 15:d3.host=d0.string();break;default:d0.skipType(7&d4)}}return d3},d0.decodeDelimited=function(d0){return d0 instanceof d7||(d0=new d7(d0)),this.decode(d0,d0.uint32())},d0.verify=function(d0){return"object"!==(void 0===d0?"undefined":(0,d3.default)(d0))||null===d0?"object expected":null!=d0.app&&d0.hasOwnProperty("app")&&!d9.isString(d0.app)?"app: string expected":null!=d0.platform&&d0.hasOwnProperty("platform")&&!d9.isInteger(d0.platform)?"platform: integer expected":null!=d0.pushType&&d0.hasOwnProperty("pushType")&&!d9.isInteger(d0.pushType)?"pushType: integer expected":null!=d0.deviceName&&d0.hasOwnProperty("deviceName")&&!d9.isString(d0.deviceName)?"deviceName: string expected":null!=d0.deviceVersion&&d0.hasOwnProperty("deviceVersion")&&!d9.isString(d0.deviceVersion)?"deviceVersion: string expected":null!=d0.phoneName&&d0.hasOwnProperty("phoneName")&&!d9.isString(d0.phoneName)?"phoneName: string expected":null!=d0.language&&d0.hasOwnProperty("language")&&!d9.isString(d0.language)?"language: string expected":null!=d0.carrierName&&d0.hasOwnProperty("carrierName")&&!d9.isString(d0.carrierName)?"carrierName: string expected":null!=d0.appVersion&&d0.hasOwnProperty("appVersion")&&!d9.isString(d0.appVersion)?"appVersion: string expected":null!=d0.sdkVersion&&d0.hasOwnProperty("sdkVersion")&&!d9.isString(d0.sdkVersion)?"sdkVersion: string expected":null!=d0.wxAppId&&d0.hasOwnProperty("wxAppId")&&!d9.isString(d0.wxAppId)?"wxAppId: string expected":null!=d0.wxAppKey&&d0.hasOwnProperty("wxAppKey")&&!d9.isString(d0.wxAppKey)?"wxAppKey: string expected":null!=d0.webAppId&&d0.hasOwnProperty("webAppId")&&!d9.isString(d0.webAppId)?"webAppId: string expected":null!=d0.webAppKey&&d0.hasOwnProperty("webAppKey")&&!d9.isString(d0.webAppKey)?"webAppKey: string expected":null!=d0.host&&d0.hasOwnProperty("host")&&!d9.isString(d0.host)?"host: string expected":null},d0.fromObject=function(d0){if(d0 instanceof d10.RouteRequest)return d0;var d1=new d10.RouteRequest;return null!=d0.app&&(d1.app=String(d0.app)),null!=d0.platform&&(d1.platform=0|d0.platform),null!=d0.pushType&&(d1.pushType=0|d0.pushType),null!=d0.deviceName&&(d1.deviceName=String(d0.deviceName)),null!=d0.deviceVersion&&(d1.deviceVersion=String(d0.deviceVersion)),null!=d0.phoneName&&(d1.phoneName=String(d0.phoneName)),null!=d0.language&&(d1.language=String(d0.language)),null!=d0.carrierName&&(d1.carrierName=String(d0.carrierName)),null!=d0.appVersion&&(d1.appVersion=String(d0.appVersion)),null!=d0.sdkVersion&&(d1.sdkVersion=String(d0.sdkVersion)),null!=d0.wxAppId&&(d1.wxAppId=String(d0.wxAppId)),null!=d0.wxAppKey&&(d1.wxAppKey=String(d0.wxAppKey)),null!=d0.webAppId&&(d1.webAppId=String(d0.webAppId)),null!=d0.webAppKey&&(d1.webAppKey=String(d0.webAppKey)),null!=d0.host&&(d1.host=String(d0.host)),d1},d0.toObject=function(d0,d1){d1||(d1={});var d2={};return d1.defaults&&(d2.app="",d2.platform=0,d2.pushType=0,d2.deviceName="",d2.deviceVersion="",d2.phoneName="",d2.language="",d2.carrierName="",d2.appVersion="",d2.sdkVersion="",d2.wxAppId="",d2.wxAppKey="",d2.webAppId="",d2.webAppKey="",d2.host=""),null!=d0.app&&d0.hasOwnProperty("app")&&(d2.app=d0.app),null!=d0.platform&&d0.hasOwnProperty("platform")&&(d2.platform=d0.platform),null!=d0.pushType&&d0.hasOwnProperty("pushType")&&(d2.pushType=d0.pushType),null!=d0.deviceName&&d0.hasOwnProperty("deviceName")&&(d2.deviceName=d0.deviceName),null!=d0.deviceVersion&&d0.hasOwnProperty("deviceVersion")&&(d2.deviceVersion=d0.deviceVersion),null!=d0.phoneName&&d0.hasOwnProperty("phoneName")&&(d2.phoneName=d0.phoneName),null!=d0.language&&d0.hasOwnProperty("language")&&(d2.language=d0.language),null!=d0.carrierName&&d0.hasOwnProperty("carrierName")&&(d2.carrierName=d0.carrierName),null!=d0.appVersion&&d0.hasOwnProperty("appVersion")&&(d2.appVersion=d0.appVersion),null!=d0.sdkVersion&&d0.hasOwnProperty("sdkVersion")&&(d2.sdkVersion=d0.sdkVersion),null!=d0.wxAppId&&d0.hasOwnProperty("wxAppId")&&(d2.wxAppId=d0.wxAppId),null!=d0.wxAppKey&&d0.hasOwnProperty("wxAppKey")&&(d2.wxAppKey=d0.wxAppKey),null!=d0.webAppId&&d0.hasOwnProperty("webAppId")&&(d2.webAppId=d0.webAppId),null!=d0.webAppKey&&d0.hasOwnProperty("webAppKey")&&(d2.webAppKey=d0.webAppKey),null!=d0.host&&d0.hasOwnProperty("host")&&(d2.host=d0.host),d2},d0.prototype.toJSON=function(){return this.constructor.toObject(this,d6.util.toJSONOptions)},d0}(),d10.AddressTriple=function(){function d0(d0){if(d0)for(var d1=(0,d4.default)(d0),d2=0;d2<d1.length;++d2)null!=d0[d1[d2]]&&(this[d1[d2]]=d0[d1[d2]])}return d0.prototype.host="",d0.prototype.longPort=0,d0.prototype.shortPort=0,d0.prototype.wssPort=0,d0.create=function(d1){return new d0(d1)},d0.encode=function(d0,d1){return d1||(d1=d8.create()),d1.uint32(10).string(d0.host),d1.uint32(16).int32(d0.longPort),d1.uint32(24).int32(d0.shortPort),null!=d0.wssPort&&d0.hasOwnProperty("wssPort")&&d1.uint32(32).int32(d0.wssPort),d1},d0.encodeDelimited=function(d0,d1){return this.encode(d0,d1).ldelim()},d0.decode=function(d0,d1){d0 instanceof d7||(d0=d7.create(d0));for(var d2=void 0===d1?d0.len:d0.pos+d1,d3=new d10.AddressTriple;d0.pos<d2;){var d4=d0.uint32();switch(d4>>>3){case 1:d3.host=d0.string();break;case 2:d3.longPort=d0.int32();break;case 3:d3.shortPort=d0.int32();break;case 4:d3.wssPort=d0.int32();break;default:d0.skipType(7&d4)}}if(!d3.hasOwnProperty("host"))throw d9.ProtocolError("missing required 'host'",{instance:d3});if(!d3.hasOwnProperty("longPort"))throw d9.ProtocolError("missing required 'longPort'",{instance:d3});if(!d3.hasOwnProperty("shortPort"))throw d9.ProtocolError("missing required 'shortPort'",{instance:d3});return d3},d0.decodeDelimited=function(d0){return d0 instanceof d7||(d0=new d7(d0)),this.decode(d0,d0.uint32())},d0.verify=function(d0){return"object"!==(void 0===d0?"undefined":(0,d3.default)(d0))||null===d0?"object expected":d9.isString(d0.host)?d9.isInteger(d0.longPort)?d9.isInteger(d0.shortPort)?null!=d0.wssPort&&d0.hasOwnProperty("wssPort")&&!d9.isInteger(d0.wssPort)?"wssPort: integer expected":null:"shortPort: integer expected":"longPort: integer expected":"host: string expected"},d0.fromObject=function(d0){if(d0 instanceof d10.AddressTriple)return d0;var d1=new d10.AddressTriple;return null!=d0.host&&(d1.host=String(d0.host)),null!=d0.longPort&&(d1.longPort=0|d0.longPort),null!=d0.shortPort&&(d1.shortPort=0|d0.shortPort),null!=d0.wssPort&&(d1.wssPort=0|d0.wssPort),d1},d0.toObject=function(d0,d1){d1||(d1={});var d2={};return d1.defaults&&(d2.host="",d2.longPort=0,d2.shortPort=0,d2.wssPort=0),null!=d0.host&&d0.hasOwnProperty("host")&&(d2.host=d0.host),null!=d0.longPort&&d0.hasOwnProperty("longPort")&&(d2.longPort=d0.longPort),null!=d0.shortPort&&d0.hasOwnProperty("shortPort")&&(d2.shortPort=d0.shortPort),null!=d0.wssPort&&d0.hasOwnProperty("wssPort")&&(d2.wssPort=d0.wssPort),d2},d0.prototype.toJSON=function(){return this.constructor.toObject(this,d6.util.toJSONOptions)},d0}(),d10.RouteResponse=function(){function d0(d0){if(this.candidate=[],d0)for(var d1=(0,d4.default)(d0),d2=0;d2<d1.length;++d2)null!=d0[d1[d2]]&&(this[d1[d2]]=d0[d1[d2]])}return d0.prototype.host="",d0.prototype.longPort=0,d0.prototype.shortPort=0,d0.prototype.thumbPara="",d0.prototype.node="",d0.prototype.commercial=0,d0.prototype.wssPort=0,d0.prototype.candidate=d9.emptyArray,d0.create=function(d1){return new d0(d1)},d0.encode=function(d0,d1){if(d1||(d1=d8.create()),d1.uint32(10).string(d0.host),d1.uint32(16).int32(d0.longPort),d1.uint32(24).int32(d0.shortPort),null!=d0.thumbPara&&d0.hasOwnProperty("thumbPara")&&d1.uint32(34).string(d0.thumbPara),null!=d0.node&&d0.hasOwnProperty("node")&&d1.uint32(42).string(d0.node),null!=d0.commercial&&d0.hasOwnProperty("commercial")&&d1.uint32(48).int32(d0.commercial),null!=d0.wssPort&&d0.hasOwnProperty("wssPort")&&d1.uint32(56).int32(d0.wssPort),null!=d0.candidate&&d0.candidate.length)for(var d2=0;d2<d0.candidate.length;++d2)d10.AddressTriple.encode(d0.candidate[d2],d1.uint32(66).fork()).ldelim();return d1},d0.encodeDelimited=function(d0,d1){return this.encode(d0,d1).ldelim()},d0.decode=function(d0,d1){d0 instanceof d7||(d0=d7.create(d0));for(var d2=void 0===d1?d0.len:d0.pos+d1,d3=new d10.RouteResponse;d0.pos<d2;){var d4=d0.uint32();switch(d4>>>3){case 1:d3.host=d0.string();break;case 2:d3.longPort=d0.int32();break;case 3:d3.shortPort=d0.int32();break;case 4:d3.thumbPara=d0.string();break;case 5:d3.node=d0.string();break;case 6:d3.commercial=d0.int32();break;case 7:d3.wssPort=d0.int32();break;case 8:d3.candidate&&d3.candidate.length||(d3.candidate=[]),d3.candidate.push(d10.AddressTriple.decode(d0,d0.uint32()));break;default:d0.skipType(7&d4)}}if(!d3.hasOwnProperty("host"))throw d9.ProtocolError("missing required 'host'",{instance:d3});if(!d3.hasOwnProperty("longPort"))throw d9.ProtocolError("missing required 'longPort'",{instance:d3});if(!d3.hasOwnProperty("shortPort"))throw d9.ProtocolError("missing required 'shortPort'",{instance:d3});return d3},d0.decodeDelimited=function(d0){return d0 instanceof d7||(d0=new d7(d0)),this.decode(d0,d0.uint32())},d0.verify=function(d0){if("object"!==(void 0===d0?"undefined":(0,d3.default)(d0))||null===d0)return"object expected";if(!d9.isString(d0.host))return"host: string expected";if(!d9.isInteger(d0.longPort))return"longPort: integer expected";if(!d9.isInteger(d0.shortPort))return"shortPort: integer expected";if(null!=d0.thumbPara&&d0.hasOwnProperty("thumbPara")&&!d9.isString(d0.thumbPara))return"thumbPara: string expected";if(null!=d0.node&&d0.hasOwnProperty("node")&&!d9.isString(d0.node))return"node: string expected";if(null!=d0.commercial&&d0.hasOwnProperty("commercial")&&!d9.isInteger(d0.commercial))return"commercial: integer expected";if(null!=d0.wssPort&&d0.hasOwnProperty("wssPort")&&!d9.isInteger(d0.wssPort))return"wssPort: integer expected";if(null!=d0.candidate&&d0.hasOwnProperty("candidate")){if(!Array.isArray(d0.candidate))return"candidate: array expected";for(var d1=0;d1<d0.candidate.length;++d1){var d2=d10.AddressTriple.verify(d0.candidate[d1]);if(d2)return"candidate."+d2}}return null},d0.fromObject=function(d0){if(d0 instanceof d10.RouteResponse)return d0;var d1=new d10.RouteResponse;if(null!=d0.host&&(d1.host=String(d0.host)),null!=d0.longPort&&(d1.longPort=0|d0.longPort),null!=d0.shortPort&&(d1.shortPort=0|d0.shortPort),null!=d0.thumbPara&&(d1.thumbPara=String(d0.thumbPara)),null!=d0.node&&(d1.node=String(d0.node)),null!=d0.commercial&&(d1.commercial=0|d0.commercial),null!=d0.wssPort&&(d1.wssPort=0|d0.wssPort),d0.candidate){if(!Array.isArray(d0.candidate))throw TypeError(".RouteResponse.candidate: array expected");d1.candidate=[];for(var d2=0;d2<d0.candidate.length;++d2){if("object"!==(0,d3.default)(d0.candidate[d2]))throw TypeError(".RouteResponse.candidate: object expected");d1.candidate[d2]=d10.AddressTriple.fromObject(d0.candidate[d2])}}return d1},d0.toObject=function(d0,d1){d1||(d1={});var d2={};if((d1.arrays||d1.defaults)&&(d2.candidate=[]),d1.defaults&&(d2.host="",d2.longPort=0,d2.shortPort=0,d2.thumbPara="",d2.node="",d2.commercial=0,d2.wssPort=0),null!=d0.host&&d0.hasOwnProperty("host")&&(d2.host=d0.host),null!=d0.longPort&&d0.hasOwnProperty("longPort")&&(d2.longPort=d0.longPort),null!=d0.shortPort&&d0.hasOwnProperty("shortPort")&&(d2.shortPort=d0.shortPort),null!=d0.thumbPara&&d0.hasOwnProperty("thumbPara")&&(d2.thumbPara=d0.thumbPara),null!=d0.node&&d0.hasOwnProperty("node")&&(d2.node=d0.node),null!=d0.commercial&&d0.hasOwnProperty("commercial")&&(d2.commercial=d0.commercial),null!=d0.wssPort&&d0.hasOwnProperty("wssPort")&&(d2.wssPort=d0.wssPort),d0.candidate&&d0.candidate.length){d2.candidate=[];for(var d3=0;d3<d0.candidate.length;++d3)d2.candidate[d3]=d10.AddressTriple.toObject(d0.candidate[d3],d1)}return d2},d0.prototype.toJSON=function(){return this.constructor.toObject(this,d6.util.toJSONOptions)},d0}(),d0.exports=d10},7200:(d0,d1,d2)=>{var d3=d2(516);d0.exports=function(d0,d1){var d2,d4;return d1.port=d1.port||1883,d1.hostname=d1.hostname||d1.host||"localhost",d2=d1.port,d4=d1.hostname,d3.createConnection(d2,d4)}},8864:(d0,d1,d2)=>{var d3=d2(5036);d0.exports=function(d0,d1){var d2;function d4(d3){d1.rejectUnauthorized&&d0.emit("error",d3),d2.end()}return d1.port=d1.port||8883,d1.host=d1.hostname||d1.host||"localhost",d1.rejectUnauthorized=!1!==d1.rejectUnauthorized,delete d1.path,(d2=d3.connect(d1)).on("secureConnect",(function(){d1.rejectUnauthorized&&!d2.authorized?d2.emit("error",new Error("TLS not authorized")):d2.removeListener("error",d4)})),d2.on("error",d4),d2}},7508:(d0,d1,d2)=>{var d3=d2(4132),d4=d2(2836),d5=d2(4776),d6=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],d7="browser"===d3.title;function d8(d0,d1){var d2="MQIsdp"===d1.protocolId&&3===d1.protocolVersion?"mqttv3.1":"mqtt";!function(d0){d0.hostname||(d0.hostname="localhost"),d0.port||("wss"===d0.protocol?d0.port=443:d0.port=80),d0.path||(d0.path="/"),d0.wsOptions||(d0.wsOptions={}),d7||"wss"!==d0.protocol||d6.forEach((function(d1){d0.hasOwnProperty(d1)&&!d0.wsOptions.hasOwnProperty(d1)&&(d0.wsOptions[d1]=d0[d1])}))}(d1);var d3=function(d0,d1){var d2=d0.protocol+"://"+d0.hostname+":"+d0.port+d0.path;return"function"==typeof d0.transformWsUrl&&(d2=d0.transformWsUrl(d2,d0,d1)),d2}(d1,d0);return d4(d3,[d2],d1.wsOptions)}d0.exports=d7?function(d0,d1){if(d1.hostname||(d1.hostname=d1.host),!d1.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var d2=d5.parse(document.URL);d1.hostname=d2.hostname,d1.port||(d1.port=d2.port)}return d8(d0,d1)}:function(d0,d1){return d8(d0,d1)}},4672:(d0,d1,d2)=>{var d3,d4,d5,d6=d2(3296).Buffer,d7=d2(4132),d8=d2(9496).Transform,d9=d2(7491);d0.exports=function(d0,d1){if(d1.hostname=d1.hostname||d1.host,!d1.hostname)throw new Error("Could not determine host. Specify host manually.");var d2="MQIsdp"===d1.protocolId&&3===d1.protocolVersion?"mqttv3.1":"mqtt";!function(d0){d0.hostname||(d0.hostname="localhost"),d0.path||(d0.path="/"