UNPKG

@tencentcloud/lite-chat

Version:

Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut

1 lines 204 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TencentCloudChat=t()}(this,(function(){"use strict";class e{constructor(){this.listeners={}}on(e,t,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({fn:t,context:n})}off(e,t,n){var s;t&&(this.listeners[e]=null===(s=this.listeners[e])||void 0===s?void 0:s.filter((e=>{const s=e.fn===t,i=!n||e.context===n;return!(s&&i)})))}emit(e,...t){const n=this.listeners[e];n&&n.forEach((e=>{const{fn:n,context:s}=e;n.apply(s,t)}))}once(e,t,n){const s=(...i)=>{t.apply(n,i),this.off(e,s)};this.on(e,s)}}var t;!function(e){e.BUSINESS_COMMAND="business_command",e.C2C_REALTIME_MESSAGE="c2c_realtime_message",e.C2C_MESSAGE_MODIFIED="c2c_message_modified",e.C2C_REVOKED_MESSAGE="c2c_message_revoked",e.GROUP_REALTIME_MESSAGE="group_realtime_message",e.GROUP_MESSAGE_MODIFIED="group_message_modified",e.GROUP_MESSAGE_REVOKED="group_message_revoked",e.C2C_MESSAGE_READ_RECEIPT="c2c_message_read_receipt",e.MESSAGE_REACTION_UPDATED="message_reaction_updated",e.MESSAGE_REACTION_UPDATED_SYNC="message_reaction_updated_sync",e.GROUP_AT_TIPS="group_at_tips",e.USER_STATUS_UPDATE="user_status_update",e.FRIEND_LIST_MODIFIED="friend_list_modified",e.PROFILE_MODIFIED="profile_modified",e.CONV_MODIFIED="conversation_modified",e.GROUP_TIPS_NOTIFICATION="group_tips_notification",e.GROUP_MESSAGE_READ_RECEIPT="group_message_read_receipt",e.GROUP_MESSAGE_READ_SYNC="group_message_read_sync",e.GROUP_SYSTEM_NOTIFICATION="group_system_notification",e.C2C_MESSAGE_PEER_READ="c2c_message_peer_read",e.C2C_MESSAGE_READ_SYNC="c2c_message_read_sync",e.C2C_REMIND_TYPE_SYNC="c2c_remind_type_sync"}(t||(t={}));const n=[{conditions:[{type:"event",value:100}],subType:t.BUSINESS_COMMAND},{conditions:[{type:"hasKey",value:"C2cMsgArray"}],subType:t.C2C_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgModNotifys"}],subType:t.C2C_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"ProfileDataMod"}],subType:t.PROFILE_MODIFIED},{conditions:[{type:"hasKey",value:"UserStatusList"}],subType:t.USER_STATUS_UPDATE},{conditions:[{type:"hasKey",value:"FriendListMod"}],subType:t.FRIEND_LIST_MODIFIED},{conditions:[{type:"hasKey",value:"GroupMsgArray"}],subType:t.GROUP_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"GroupMsgModNotifys"}],subType:t.GROUP_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"C2cNotifyMsgArray"}],subTypeParser:function(e){var n;const s=[];return null===(n=null==e?void 0:e.C2cNotifyMsgArray)||void 0===n||n.forEach((e=>{e.WithdrawC2cMsgNotify&&s.push(t.C2C_REVOKED_MESSAGE),e.C2cReadedReceipt&&s.push(t.C2C_MESSAGE_PEER_READ),e.ReadC2cMsgNotify&&s.push(t.C2C_MESSAGE_READ_SYNC),e.MuteNotificationsSync&&s.push(t.C2C_REMIND_TYPE_SYNC)})),s}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:4}],subType:t.GROUP_TIPS_NOTIFICATION},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:5}],subTypeParser:function(e){var n;const s=[];return null===(n=null==e?void 0:e.GroupTips)||void 0===n||n.forEach((e=>{Array.isArray(e.MsgBody.GroupWithdrawInfoArray)&&s.push(t.GROUP_MESSAGE_REVOKED),Array.isArray(e.MsgBody.GroupMsgReceiptList)&&s.push(t.GROUP_MESSAGE_READ_RECEIPT),Array.isArray(e.MsgBody.GroupReadInfoArray)?s.push(t.GROUP_MESSAGE_READ_SYNC):s.push(t.GROUP_SYSTEM_NOTIFICATION)})),s}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:6}],subType:t.GROUP_TIPS_NOTIFICATION},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:12}],subType:t.GROUP_AT_TIPS},{conditions:[{type:"hasKey",value:"RecentContactMod"}],subType:t.CONV_MODIFIED},{conditions:[{type:"hasKey",value:"MsgReactionNotifyList"}],subType:t.MESSAGE_REACTION_UPDATED},{conditions:[{type:"hasKey",value:"MsgReactionNotify"}],subType:t.MESSAGE_REACTION_UPDATED_SYNC},{conditions:[{type:"hasKey",value:"C2cMsgInfo"}],subType:t.C2C_MESSAGE_READ_RECEIPT}];var s;!function(e){e.SERVER_PUSH_MESSAGE="im_open_push.msg_push",e.ERROR="error"}(s||(s={}));const i={[s.SERVER_PUSH_MESSAGE]:function(e){var t;const i=Array.isArray(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.EventArray)?e.body.EventArray:[],o=[];return i.forEach((t=>{t.Flag=e.body.Flag;const i=n.find((e=>e.conditions.every((e=>{switch(e.type){case"event":return t.Event===e.value;case"hasKey":return Object.prototype.hasOwnProperty.call(t,e.value);default:return!1}}))));if(!i)return null;let r=[];"function"==typeof i.subTypeParser?r=i.subTypeParser(t):i.subType&&(r=i.subType),Array.isArray(r)?r.forEach((e=>{o.push({type:`${s.SERVER_PUSH_MESSAGE}:${e}`,data:t})})):o.push({type:`${s.SERVER_PUSH_MESSAGE}:${r}`,data:t})})),o},[s.ERROR]:function(e){const{errorCode:t}=e;return[{type:`error:${t}`,data:e}]}};const o=new class{constructor(){this._outerEventEmitter=null,this._innerEventEmitter=null,this._outerEventEmitter=new e,this._innerEventEmitter=new e,this.InnerEventSubType=t}subscribeInnerEvent(e,t,n,s){var i,o;if(["string","number"].includes(typeof t)){const o=t,r=n;null===(i=this._innerEventEmitter)||void 0===i||i.on(`${e}:${o}`,r,s)}else{const s=t;null===(o=this._innerEventEmitter)||void 0===o||o.on(e,s,n)}}emitInnerEvent(e,t){var n,s;if(null===(n=this._innerEventEmitter)||void 0===n||n.emit(e,t),Object.keys(i).includes(e)){const n=null===(s=i[e])||void 0===s?void 0:s.call(i,t);null==n||n.forEach((e=>{var t;e&&(null===(t=this._innerEventEmitter)||void 0===t||t.emit(e.type,e.data))}))}}unSubscribeInnerEvent(e,t,n,s){var i,o;if(["string","number"].includes(typeof t)){const o=t,r=n;null===(i=this._innerEventEmitter)||void 0===i||i.off(`${e}:${o}`,r,s)}else{const s=t;null===(o=this._innerEventEmitter)||void 0===o||o.off(e,s,n)}}subscribeOuterEvent(e,t,n){var s;null===(s=this._outerEventEmitter)||void 0===s||s.on(e,t,n)}unSubscribeOuterEvent(e,t,n){var s;null===(s=this._outerEventEmitter)||void 0===s||s.off(e,t,n)}emitOuterEvent(e,t){var n;null===(n=this._outerEventEmitter)||void 0===n||n.emit(e,t)}getOuterEventEmitter(){return this._outerEventEmitter}rest(){this._outerEventEmitter=null,this._innerEventEmitter=null}};function r(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]])}return n}function a(e,t,n,s){return new(n||(n=Promise))((function(i,o){function r(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const c=e=>void 0===e,l=e=>"string"==typeof e,d=e=>{var t;return null===(t=Object.prototype.toString.call(e).match(/^\[object (.*)\]$/))||void 0===t?void 0:t[1].toLowerCase()},u=e=>"function"==typeof Array.isArray?Array.isArray(e):"array"===d(e),_=e=>null!==e&&"object"==typeof e,h=e=>u(e)||_(e),g=e=>{if("string"!=typeof e)return!1;const t=e[0];return!/[^a-zA-Z0-9]/.test(t)},f=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n};function E(e=99999999){return Math.round(Math.random()*e)}const p=(e,t,n,s)=>{if(!h(e)||!h(t))return 0;let i=0;const o=Object.keys(t);let r;for(let a=0,l=o.length;a<l;a++)if(r=o[a],!(c(t[r])||n&&n.includes(r)))if(h(e[r])&&h(t[r]))i+=p(e[r],t[r],n,s);else{if(s&&s.includes(t[r]))continue;e[r]!==t[r]&&(e[r]=t[r],i+=1)}return i};function m(e){let t,n,s=e;e.length%8!=0&&(s="0".repeat(8-e.length%8)+e);let i="";for(let e=0,{length:o}=s;e<o;e+=8)t=parseInt(s.slice(e,e+4),2),n=parseInt(s.slice(e+4,e+8),2),i+=base16Map.get(t)+base16Map.get(n);return i}const S={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},v=["heartbeat.alive","im_open_status.wslogin","im_open_status.wslogout","group_open_long_polling_http_svc.get_msg","group_open_long_polling_http_noauth_svc.get_msg"];var I=Object.freeze({__proto__:null,ENUM_PLATFORM:S,NOT_NEED_CRC_SERVCMD:v});const C="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),y=C&&"function"==typeof wx.createGamePortal,O="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),M="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),T="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),A="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),N="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,D="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,R=C&&"object"==typeof wx.miniapp,b="undefined"!=typeof uni,w=C||O||M||T||A||D||N,L="undefined"==typeof window&&!w&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,k="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),P="undefined"!=typeof uni?!w:"undefined"!=typeof window&&!w&&!k,U=O?qq:M?tt:T?swan:A?my:C?wx:D?uni:N?jd:{},F=P&&window&&window.navigator&&window.navigator.userAgent||"",G=/(micromessenger|webbrowser)/i.test(F),x=function(){let e="WEB";return G?e="WEB":O?e="QQ_MP":M?e="TT_MP":T?e="BAIDU_MP":A?e="ALI_MP":C?e=R?"DONUT_NATIVE_APP":"WX_MP":D?e="UNI_NATIVE_APP":L?e="NS_NATIVE_APP":k&&(e="RN_NATIVE_APP"),S[e]}(),B=/iPad/i.test(F),$=/iPhone/i.test(F)&&!B,V=/iPod/i.test(F),q=$||B||V,j=function(){const e=F.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Y=/Android/i.test(F),W=function(){const e=F.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(`${e[1]}.${e[2]}`):t||null}(),K=/Firefox/i.test(F),H=/Edge/i.test(F),z=!H&&/Chrome/i.test(F),J=/MSIE/.test(F)||F.indexOf("Trident")>-1&&F.indexOf("rv:11.0")>-1,Z=function(){const e=/MSIE\s(\d+)\.\d/.exec(F);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(F)&&/rv:11.0/.test(F)&&(t=11),t}(),X=/Safari/i.test(F)&&!z&&!Y&&!H,Q=/Windows/i.test(F),ee=/MAC OS X/i.test(F),te=P&&"undefined"!=typeof Worker&&!J,ne=Y||q,se=P&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,ie=function(){if("undefined"==typeof window||void 0===window.navigator)return!1;const{standalone:e}=window.navigator;return!(!q||e||X)}();function oe(){let e="unknown";if(ee&&(e="mac"),Q&&(e="windows"),q&&(e="ios"),Y&&(e="android"),w)try{const{platform:t}=wx.getSystemInfoSync();void 0!==t&&(e=t)}catch(e){console.error(e)}return e}const re=2800,ae=2801,ce=3e3,le="application/x-www-form-urlencoded;charset=UTF-8";function de(e){return a(this,arguments,void 0,(function*({method:e,url:t,data:n,timeout:s=ce}){return new Promise(w?(i,o)=>{U.request({url:t,data:n,method:e,timeout:s,header:{"content-type":le},success:e=>i(e.data),fail:()=>o(new Error(`{"message":"Network error","code":${re}}`))})}:(i,o)=>{const r=new XMLHttpRequest,a=setTimeout((()=>{r.abort(),o(new Error(`{"message":"Request timeout","code":${ae}}`))}),s);r.onreadystatechange=function(){if(4===r.readyState)if(clearTimeout(a),200===r.status||304===r.status)try{i(r.responseText?JSON.parse(r.responseText):null)}catch(e){i(r.responseText)}else o(new Error(`{"message":"Network error","code":${re}}`))},r.open(e,t,!0),r.setRequestHeader("Content-type",le),r.send(n||null)})}))}function ue(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(f(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return("[object Map]"===Object.prototype.toString.call(e)||"[object Set]"===Object.prototype.toString.call(e)||"[object File]"===Object.prototype.toString.call(e))&&0===e.size}function _e(){let e,t;return{promise:new Promise(((n,s)=>{e=n,t=s})),resolve:e,reject:t}}var he,ge=Object.freeze({__proto__:null,ANDROID_VERSION:W,IE_VERSION:Z,IN_ALIPAY_MINI_APP:A,IN_BAIDU_MINI_APP:T,IN_BROWSER:P,IN_DONUT_NATIVE_APP:R,IN_JD_MINI_APP:N,IN_MINI_APP:w,IN_NS_NATIVE_APP:L,IN_QQ_MINI_APP:O,IN_RN_APP:k,IN_TT_MINI_APP:M,IN_UNI_APP:b,IN_UNI_NATIVE_APP:D,IN_WX_MINI_APP:C,IN_WX_MINI_GAME:y,IOS_VERSION:j,IS_ANDROID:Y,IS_CHROME:z,IS_EDGE:H,IS_FIREFOX:K,IS_IE:J,IS_IOS:q,IS_IPAD:B,IS_IPHONE:$,IS_IPOD:V,IS_MAC:ee,IS_SAFARI:X,IS_WECHAT:G,IS_WIN:Q,IS_WORKER_AVAILABLE:te,MINI_APP_NAMESPACE:U,USER_AGENT:F,base16EncodeBinaryString:m,deepCopyWithMethods:function e(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;return t.forEach(((t,s)=>{n.set(e(s),e(t))})),n}if(t instanceof Set){const n=new Set;return t.forEach((t=>{n.add(e(t))})),n}if(Array.isArray(t))return t.map((t=>e(t)));const n=Object.getPrototypeOf(t),s=Object.create(n);return[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].forEach((n=>{const i=Object.getOwnPropertyDescriptor(t,n);i&&(i.get||i.set?Object.defineProperty(s,n,i):s[n]=e(t[n]))})),s},deepMerge:p,generatePromise:_e,getPlatformType:oe,getType:d,httpRequest:de,isArray:u,isArrayOrObject:h,isEmpty:ue,isFlutterWeb:se,isH5:ne,isIOSWebView:ie,isNumber:e=>null!==e&&("number"==typeof e&&!Number.isNaN(e-0)||"object"==typeof e&&e.constructor===Number),isObject:_,isPlainObject:f,isString:l,isUndefined:c,isValidRequestKey:g,platform:x,randomInt:E});class fe{constructor(){this._socket=null}connectSocket(e){return this._socket=new WebSocket(e),this._socket}send(e){var t,n;try{null===(t=this._socket)||void 0===t||t.send(e)}catch(e){null===(n=this._onSendFail)||void 0===n||n.call(this,e)}}bindSocketHandlers(e){const{onOpen:t,onMessage:n,onClose:s,onError:i,onSendFail:o}=e;this._socket&&(this._socket.binaryType="arraybuffer",this._socket.onopen=t,this._socket.onmessage=n,this._socket.onclose=s,this._socket.onerror=i,this._onSendFail=o)}unbindSocketHandlers(){this._socket&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null)}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}class Ee{connectSocket(e){return this._socket=wx.connectSocket({url:e,header:{"content-type":"application/json"},complete:()=>{}}),this._socket}send(e){var t;null===(t=this._socket)||void 0===t||t.send({data:e,fail:this._onSendFail})}bindSocketHandlers(e){const{onOpen:t,onMessage:n,onClose:s,onError:i,onSendFail:o}=e;this._socket.onClose(s),this._socket.onOpen(t),this._socket.onMessage(n),this._socket.onError(i),this._onSendFail=o}unbindSocketHandlers(){this._socket&&(this._socket.onClose((()=>{})),this._socket.onOpen((()=>{})),this._socket.onMessage((()=>{})),this._socket.onError((()=>{})))}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED"}(he||(he={}));class pe{constructor(t){this._url="",this._readyState=he.DISCONNECTED,this._url=t,this._id=E(),this._emitter=new e,this._socket=C?new Ee:new fe,this.connect()}connect(){this.doOpen(),this._bindSocketHandlers()}doOpen(){[he.CONNECTED,he.CONNECTING].includes(this._readyState)||(this._readyState=he.CONNECTING,this._ws=this._socket.connectSocket(this._url))}send(e){this._readyState!==he.CONNECTED?this.reconnect():this._socket.send(e)}reconnect(){[he.CONNECTED,he.CONNECTING].includes(this._readyState)||(this.disconnect(),this.doOpen())}getId(){return this._id}on(e,t,n){this._emitter.on(e,t,n)}off(e,t,n){this._emitter.off(e,t,n)}isConnected(){return this._readyState===he.CONNECTED}disconnect(){this._readyState=he.DISCONNECTED,this._unbindSocketHandlers(),this._socket.disconnect()}_onOpen(e){this._readyState===he.CONNECTING&&(this._readyState=he.CONNECTED,this._emitter.emit("connect",{socketId:this._id,event:e}))}_onMessage(e){this._emitter.emit("message",e)}_onClose(e){this._readyState=he.DISCONNECTED,this._emitter.emit("close",{socketId:this._id,event:e})}_onError(e){this._readyState=he.DISCONNECTED,this._emitter.emit("error",{socketId:this._id,error:e})}_onSendFail(e){this._readyState=he.DISCONNECTED,this._emitter.emit("sendFail",{socketId:this._id,error:e})}_bindSocketHandlers(){this._socket.bindSocketHandlers({onOpen:this._onOpen.bind(this),onMessage:this._onMessage.bind(this),onClose:this._onClose.bind(this),onError:this._onError.bind(this),onSendFail:this._onSendFail.bind(this)})}_unbindSocketHandlers(){this._socket.unbindSocketHandlers()}}const me="CHINA",Se="SINGAPORE",ve="KOREA",Ie="GERMANY",Ce="IND",ye="JPN",Oe="USA",Me="INDONESIA",Te={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{INITIAL:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{INITIAL:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{INITIAL:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{INITIAL:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.18.188"},JPN:{INITIAL:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{INITIAL:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{INITIAL:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},Ae={[Se]:[[2e7,3e7],[172e7,173e7]],[ve]:[[3e7,4e7],[173e7,174e7]],[Ie]:[[4e7,5e7],[174e7,175e7]],[Ce]:[[5e7,6e7],[175e7,176e7]],[ye]:[[6e7,7e7],[176e7,177e7]],[Oe]:[[7e7,8e7],[177e7,178e7]],[Me]:[[8e7,9e7],[178e7,179e7]]};function Ne(e){for(const t of Object.keys(Ae))for(const[n,s]of Ae[t])if(e>=n&&e<s)return t;return me}var De,Re=new class{constructor(){this._store=new Map}get(e){return this._store.get(e)}getStorage(e){if(w){if(A){return my.getStorageSync({key:e}).data}return U.getStorageSync(e)}return this._canUseLocalStorage()?localStorage.getItem(e):{}}set(e,t){const n=this._store.get(e)||{};t instanceof Map?this._store.set(e,t):this._store.set(e,Object.assign(Object.assign({},n),t))}setStorage(e,t){w?A?my.setStorageSync({key:e,data:JSON.stringify(t)}):U.setStorageSync(e,JSON.stringify(t)):this._canUseLocalStorage()&&localStorage.setItem(e,JSON.stringify(t))}clear(e){"string"==typeof e?this._store.set(e,{}):this._store.clear()}clearLocalStorage(e){this._canUseLocalStorage()&&("string"==typeof e?localStorage.setItem(e,""):localStorage.clear())}reset(){this.clear()}_canUseLocalStorage(){return"undefined"!=typeof window&&(navigator&&navigator.cookieEnabled&&localStorage)}},be="1.2.0";!function(e){e.INITIAL="INITIAL",e.DEFAULT="DEFAULT",e.BACKUP="BACKUP",e.ANYCAST="ANYCAST"}(De||(De={}));let we=De.INITIAL;function Le(){const e=Math.random();return 0===e?Le():e}function ke(e,t){const{isBinary:n=!1}=t||{},s=Re.get("instance"),{sdkAppId:i,instanceId:o}=s,r=Le(),a=oe(),c=function(){const e=oe();let t=-1;"ios"===e?t=j||-1:"android"===e&&(t=W||-1);return t}(),l=(d={sdkappid:i,instanceid:o,random:r,platform:x,host:a,version:c,sdkversion:be},Object.keys(d).map((e=>`${e}=${d[e]}`)).join("&"));var d;return n?`${e}/binfo?${l}&compress=gzip`:`${e}/info?${l}`}var Pe=new class{constructor(){this._timeOffsetWithServer=0}getServerTimeMs(){return Date.now()+this._timeOffsetWithServer}getServerTimeSeconds(){return Math.floor(this.getServerTimeMs()/1e3)}getTimeOffsetWithServer(){return this._timeOffsetWithServer}calculateTimeOffsetWithServer(e,t){const n=Date.now(),s=n-e;this._timeOffsetWithServer=t+s-n}};const Ue=16;var Fe=new class{constructor(){this._tasks=[],this._timer=null,this._taskMap=new Map}_addTaskToScheduler(e){const{id:t}=e;this.removeTask(t),this._tasks.push(e),this._taskMap.set(t,e),this._sort(),this._scheduleNextTask()}_createTask(e){const{id:t,callback:n,context:s,isOnce:i=!1,intervalMs:o=Ue}=e,r=Math.max(o,Ue);return{id:t,nextExecuteTime:Date.now()+r,intervalMs:o,callback:n,context:s,isOnce:i}}addTask(e){const t=this._createTask(e);this._addTaskToScheduler(t)}addOnceTask(e){const t=this._createTask(Object.assign(Object.assign({},e),{isOnce:!0}));this._addTaskToScheduler(t)}removeTask(e){const t=this._tasks.findIndex((t=>t.id===e));t>-1&&(this._tasks.splice(t,1),this._taskMap.delete(e),this._scheduleNextTask())}updateTaskInterval(e,t){const n=this._taskMap.get(e);n&&(n.intervalMs=t,n.nextExecuteTime=Date.now()+t,this._sort(),this._scheduleNextTask())}clearAllTasks(){this._tasks=[],this._taskMap.clear(),this._timer&&(clearTimeout(this._timer),this._timer=null)}dispose(){this.clearAllTasks()}_sort(){this._tasks.sort(((e,t)=>e.nextExecuteTime-t.nextExecuteTime))}_scheduleNextTask(){this._timer&&(clearTimeout(this._timer),this._timer=null);const e=this._tasks[0];if(e){const t=Math.max(0,e.nextExecuteTime-Date.now());this._timer=setTimeout((()=>this._execute()),t)}}_execute(){const e=Date.now();for(;this._tasks.length&&this._tasks[0].nextExecuteTime<=e;){const t=this._tasks[0];try{t.context?t.callback.call(t.context):t.callback(),t.isOnce?this.removeTask(t.id):(t.nextExecuteTime=e+t.intervalMs,this._sort())}catch(e){console.warn(`Task ${t.id} execution failed:`,e),t.isOnce&&this.removeTask(t.id)}}this._scheduleNextTask()}};function Ge(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e.charCodeAt(n);if(s>=55296&&s<=56319){const i=e.charCodeAt(++n)-56320+(s-55296<<10)+65536;t.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i)}else s<=127?t.push(s):s<=2047?t.push(192|s>>6,128|63&s):t.push(224|s>>12,128|s>>6&63,128|63&s)}return new Uint8Array(t)}function xe(e){const t=Array.isArray(e)?[]:Object.create(null);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&g(n)&&null!=e[n]&&(null===e[n]||"object"!=typeof e[n]?t[n]=e[n]:t[n]=xe(e[n]));return t}function Be(e,t){if(v.includes(e))return 0;const n=Ge(JSON.stringify(t));let s=4294967295;const{length:i}=n;for(let e=0;e<i;e++){s^=n[e];for(let e=0;e<8;e++)1&~s?s>>>=1:s=s>>>1^3988292384}return(4294967295^s)>>>0}function $e(e){const{servcmd:t,data:n}=e,s=function(e){const t=Re.get("login")||{},n=Re.get("instance")||{};return{servcmd:e,ver:"v4",platform:x,websdkappid:537048168,websdkversion:"1.7.3",a2:t.a2Key||void 0,tinyid:t.tinyID||void 0,status_instid:t.statusInstanceId||0,sdkappid:n.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:t.a2Key?void 0:t.userId,usersig:t.a2Key?void 0:t.userSig,sdkability:75689843,sdkability_ext:m(""),cappid:t.cappid||0,tjgID:"",seq:je(),cs:0}}(t),i=xe(n);return s.cs=Be(t,i),{head:s,body:i}}function Ve(e){const{servcmd:t,data:n}=e,s=function(e){const t=Re.get("login")||{},n=Re.get("instance")||{};return{servcmd:e,ver:"v4",platform:x,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:n.sdkAppId,contenttype:"",reqtime:Math.floor(Date.now()/1e3),identifier:"",usersig:"",status_instid:t.statusInstanceId||0,sdkability:75689843,sdkability_ext:m(""),cappid:t.cappid||0,seq:je(),cs:0}}(t),i=xe(n);return s.cs=Be(t,i),{head:s,body:i}}let qe=E();function je(){return qe=qe<2415919103?qe+1:E(),qe}var Ye,We=Object.freeze({__proto__:null,generateCosSpecifiedData:function(e){const{servcmd:t,data:n}=e,s=function(e){const t=Re.get("login")||{},n=Re.get("instance")||{};return{servcmd:e,ver:"v4",platform:x,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:n.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:t.userId,usersig:t.userSig,status_instid:t.statusInstanceId||0,sdkability:75689843,sdkability_ext:m(""),cappid:t.cappid||0,seq:je(),cs:0}}(t),i=xe(n);return s.cs=Be(t,i),{head:s,body:i}},generateProtocolData:$e,generateSSOLogProtocolData:Ve,generateSequence:je,taskScheduler:Fe,timeManager:Pe});!function(e){e[e.info=4]="info",e[e.warning=5]="warning",e[e.error=6]="error"}(Ye||(Ye={}));const Ke={method:"extension",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",uiPlatform:"ui_platform",timestamp:"timestamp"};class He{constructor(e){this.level=Ye.info,this._canSendLog=!0,this._logCreatedAt=Pe.getServerTimeMs(),this.timestamp=0,this.networkType=8,this.code=0,this.moreMessage="",this.method="",this.message="",this.costTime=0,this.duplicate=!1,this.eventType=0,this.uiPlatform=void 0;const{method:t,eventType:n=0}=e||{};this.eventType=n,this.method=t}setMoreMessage(e){this.moreMessage=`${this.moreMessage} ${e}`}updateLogCreatedAtByTimeOffset(){this._logCreatedAt+=Pe.getTimeOffsetWithServer()}end(e=!1){if(!this._canSendLog)return;const t=Pe.getServerTimeMs();0===this.costTime&&(this.costTime=t-this._logCreatedAt),this.setMoreMessage(`startts:${this._logCreatedAt} endts:${t}`),e?(this._canSendLog=!1,this.timestamp=Pe.getServerTimeMs(),this._ssoLogModule.pushToLogQueue(this._convertSSOLogDataKeyToServe())):setTimeout((()=>{this._canSendLog=!1,this.timestamp=Pe.getServerTimeMs(),this._ssoLogModule.pushToLogQueue(this._convertSSOLogDataKeyToServe())}),0)}setError(e){var t;if(!(e instanceof Error))return console.warn("SSOLogData.setError value not instanceof Error, please check!"),this;if(!this._canSendLog)return this;return(null===(t=Re.get("netWorkMonitor"))||void 0===t?void 0:t.isNetworkOnline)&&(e.errorCode&&(this.code=e.errorCode),e.errorMessage&&this.setMoreMessage(e.errorMessage)),this.level=Ye.error,this}setLogInfo(e){return Object.keys(e).forEach((t=>{Object.keys(Ke).includes(t)&&(this[t]=e[t])})),this}setSSOLogModule(e){this._ssoLogModule=e}_convertSSOLogDataKeyToServe(){const e={};return Object.keys(this).forEach((t=>{const n=t;Ke[n]&&(e[Ke[n]]=this[n])})),e}}var ze;function Je(){const e=Re.get("login")||{},t=Re.get("instance")||{};return{sdk_type:30,sdk_app_id:t.sdkAppId,sdk_version:"1.2.0",tiny_id:Number(e.tinyID),user_id:e.userId,platform:x,instance_id:t.instanceId,trace_id:(new Date).getTime()}}!function(e){e.RECONNECTED="reconnected",e.CLOUD_CONFIG_UPDATE="cloud_config_update",e.SOCKET_DISCONNECTED="socket_disconnected"}(ze||(ze={}));var Ze=ze;const Xe=20,Qe=6e4,et=[4,5,6],nt=[],st=[],it="report-logger";var ot=new class{constructor(){this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._reportLevel=[4,5,6],this._minThreshold=Xe,this._maxThreshold=100,this._waitingTime=Qe,this._lastReportAt=Date.now(),this._ssoLogMap=new Map,o.subscribeInnerEvent(Ze.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),Fe.addTask({id:it,intervalMs:1e3,callback:this._checkAndReportIfDue,context:this}),this._logQueue=[],this._savePlatFormInfo()}_handleCloudConfigUpdate(e){const{evt_rpt_threshold:t=Xe,evt_rpt_waiting:n=Qe,evt_rpt_level:s=et,evt_rpt_sdkappid_bl:i=nt,evt_rpt_tinyid_wl:o=st}=e||{};this._sdkAppIdBlackList=i,this._waitingTime=n,this._minThreshold=t,this._reportLevel=s,this._tinyIdWhiteList=o}createSSOLogData(e){const t=new He(e);return t.setSSOLogModule(this),this._ssoLogMap.set(e.method,t),t}getSSOLogData(e){return this._ssoLogMap.get(e)||{}}pushToLogQueue(e){e&&(this._logQueue.push(e),this._shouldUploadImmediately()&&this._uploadSSOLogData())}_shouldUploadImmediately(){return this._logQueue.length>=this._minThreshold}_isReportDue(){return Date.now()>=this._lastReportAt+this._waitingTime}_checkAndReportIfDue(){this._isReportDue()&&this._logQueue.length>0&&this._uploadSSOLogData()}_uploadSSOLogData(){return a(this,void 0,void 0,(function*(){if(0===this._logQueue.length)return;const e=this._logQueue.slice(),t=this._filterLogs(e);if(this._logQueue=[],0===t.length)return void(this._lastReportAt=Date.now());const n={Header:Je(),Event:t};yield function(e){const t="imopenstat.tim_web_report_v2",n=Ve({servcmd:t,data:e}),s=`${n.head.seq}${t}`;Mt.sendPacket(n,{requestId:s})}(n),this._lastReportAt=Date.now()}))}_savePlatFormInfo(){var e,t;if(C){const n=null===(t=null===(e=wx.getAccountInfoSync)||void 0===e?void 0:e.call(wx))||void 0===t?void 0:t.miniProgram;if(n){const{appId:e,envVersion:t}=n;Re.set("instance",{appId:e,envVersion:t})}}else P&&Re.set("instance",{href:window.location.href})}_filterLogs(e){const{tinyID:t}=Re.get("login")||{},{sdkAppId:n}=Re.get("instance")||{};return this._sdkAppIdBlackList.includes(n)&&!this._tinyIdWhiteList.includes(t)?[]:e.filter((e=>this._reportLevel.includes(e.level)))}reset(){console.log("SSO_LOG_MODULE.reset"),Fe.removeTask(it),o.unSubscribeInnerEvent(Ze.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),this._lastReportAt=0,this._uploadSSOLogData(),this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._minThreshold=Xe,this._maxThreshold=100,this._waitingTime=Qe,this._logQueue=[]}};const rt=15e3,at="Channel",ct="channel_schedule_task",lt="channel_reconnect_task",dt="connected",ut="connecting",_t="disconnected",ht=500,gt="network_status_change",ft="activity_status_change",Et="send_fail",pt="reconnect_failed",mt="socket_error",St="socket_close";function vt(e){return vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vt(e)}function It(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ct,yt={exports:{}};var Ot=(Ct||(Ct=1,function(e){e.exports=function e(t,n,s){function i(r,a){if(!n[r]){if(!t[r]){if(!a&&It)return It(r);if(o)return o(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[r]={exports:{}};t[r][0].call(l.exports,(function(e){return i(t[r][1][e]||e)}),l,l.exports,e,t,n,s)}return n[r].exports}for(var o=It,r=0;r<s.length;r++)i(s[r]);return i}({1:[function(e,t,n){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t,n,s=Array.prototype.slice.call(arguments,1);s.length;){var i=s.shift();if(i){if("object"!=vt(i))throw new TypeError(i+"must be non-object");for(var o in i)t=i,n=o,Object.prototype.hasOwnProperty.call(t,n)&&(e[o]=i[o])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,s,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+s),i);else for(var o=0;o<s;o++)e[i+o]=t[n+o]},flattenChunks:function(e){var t,n,s,i,o,r;for(t=s=0,n=e.length;t<n;t++)s+=e[t].length;for(r=new Uint8Array(s),t=i=0,n=e.length;t<n;t++)o=e[t],r.set(o,i),i+=o.length;return r}},o={arraySet:function(e,t,n,s,i){for(var o=0;o<s;o++)e[i+o]=t[n+o]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(s)},{}],2:[function(e,t,n){var s=e("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var r=new s.Buf8(256),a=0;a<256;a++)r[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(e,t){if(t<65534&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var n="",r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n}r[254]=r[254]=1,n.string2buf=function(e){var t,n,i,o,r,a=e.length,c=0;for(o=0;o<a;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new s.Buf8(c),o=r=0;r<c;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?t[r++]=n:(n<2048?t[r++]=192|n>>>6:(n<65536?t[r++]=224|n>>>12:(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63),t[r++]=128|n>>>6&63),t[r++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new s.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,s,i,o,a=t||e.length,l=new Array(2*a);for(n=s=0;n<a;)if((i=e[n++])<128)l[s++]=i;else if(4<(o=r[i]))l[s++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;1<o&&n<a;)i=i<<6|63&e[n++],o--;1<o?l[s++]=65533:i<65536?l[s++]=i:(i-=65536,l[s++]=55296|i>>10&1023,l[s++]=56320|1023&i)}return c(l,s)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+r[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){t.exports=function(e,t,n,s){for(var i=65535&e,o=e>>>16&65535,r=0;0!==n;){for(n-=r=2e3<n?2e3:n;o=o+(i=i+t[s++]|0)|0,--r;);i%=65521,o%=65521}return i|o<<16}},{}],4:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){var s=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var o=s,r=i+n;e^=-1;for(var a=i;a<r;a++)e=e>>>8^o[255&(e^t[a])];return~e}},{}],6:[function(e,t,n){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(e,t,n){t.exports=function(e,t){var n,s,i,o,r,a,c,l,d,u,_,h,g,f,E,p,m,S,v,I,C,y,O,M,T;n=e.state,s=e.next_in,M=e.input,i=s+(e.avail_in-5),o=e.next_out,T=e.output,r=o-(t-e.avail_out),a=o+(e.avail_out-257),c=n.dmax,l=n.wsize,d=n.whave,u=n.wnext,_=n.window,h=n.hold,g=n.bits,f=n.lencode,E=n.distcode,p=(1<<n.lenbits)-1,m=(1<<n.distbits)-1;e:do{g<15&&(h+=M[s++]<<g,g+=8,h+=M[s++]<<g,g+=8),S=f[h&p];t:for(;;){if(h>>>=v=S>>>24,g-=v,0==(v=S>>>16&255))T[o++]=65535&S;else{if(!(16&v)){if(!(64&v)){S=f[(65535&S)+(h&(1<<v)-1)];continue t}if(32&v){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}I=65535&S,(v&=15)&&(g<v&&(h+=M[s++]<<g,g+=8),I+=h&(1<<v)-1,h>>>=v,g-=v),g<15&&(h+=M[s++]<<g,g+=8,h+=M[s++]<<g,g+=8),S=E[h&m];n:for(;;){if(h>>>=v=S>>>24,g-=v,!(16&(v=S>>>16&255))){if(!(64&v)){S=E[(65535&S)+(h&(1<<v)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(C=65535&S,g<(v&=15)&&(h+=M[s++]<<g,(g+=8)<v&&(h+=M[s++]<<g,g+=8)),c<(C+=h&(1<<v)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(h>>>=v,g-=v,(v=o-r)<C){if(d<(v=C-v)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(O=_,(y=0)===u){if(y+=l-v,v<I){for(I-=v;T[o++]=_[y++],--v;);y=o-C,O=T}}else if(u<v){if(y+=l+u-v,(v-=u)<I){for(I-=v;T[o++]=_[y++],--v;);if(y=0,u<I){for(I-=v=u;T[o++]=_[y++],--v;);y=o-C,O=T}}}else if(y+=u-v,v<I){for(I-=v;T[o++]=_[y++],--v;);y=o-C,O=T}for(;2<I;)T[o++]=O[y++],T[o++]=O[y++],T[o++]=O[y++],I-=3;I&&(T[o++]=O[y++],1<I&&(T[o++]=O[y++]))}else{for(y=o-C;T[o++]=T[y++],T[o++]=T[y++],T[o++]=T[y++],2<(I-=3););I&&(T[o++]=T[y++],1<I&&(T[o++]=T[y++]))}break}}break}}while(s<i&&o<a);s-=I=g>>3,h&=(1<<(g-=I<<3))-1,e.next_in=s,e.next_out=o,e.avail_in=s<i?i-s+5:5-(s-i),e.avail_out=o<a?a-o+257:257-(o-a),n.hold=h,n.bits=g}},{}],8:[function(e,t,n){var s=e("../utils/common"),i=e("./adler32"),o=e("./crc32"),r=e("./inffast"),a=e("./inftrees"),c=1,l=2,d=0,u=-2,_=1,h=852,g=592;function f(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function E(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function p(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=_,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(h),t.distcode=t.distdyn=new s.Buf32(g),t.sane=1,t.back=-1,d):u}function m(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,p(e)):u}function S(e,t){var n,s;return e&&e.state?(s=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?u:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,m(e))):u}function v(e,t){var n,s;return e?(s=new E,(e.state=s).window=null,(n=S(e,t))!==d&&(e.state=null),n):u}var I,C,y=!0;function O(e){if(y){var t;for(I=new s.Buf32(512),C=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,I,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(l,e.lens,0,32,C,0,e.work,{bits:5}),y=!1}e.lencode=I,e.lenbits=9,e.distcode=C,e.distbits=5}function M(e,t,n,i){var o,r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new s.Buf8(r.wsize)),i>=r.wsize?(s.arraySet(r.window,t,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(i<(o=r.wsize-r.wnext)&&(o=i),s.arraySet(r.window,t,n-i,o,r.wnext),(i-=o)?(s.arraySet(r.window,t,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=o,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=o))),0}n.inflateReset=m,n.inflateReset2=S,n.inflateResetKeep=p,n.inflateInit=function(e){return v(e,15)},n.inflateInit2=v,n.inflate=function(e,t){var n,h,g,E,p,m,S,v,I,C,y,T,A,N,D,R,b,w,L,k,P,U,F,G,x=0,B=new s.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return u;12===(n=e.state).mode&&(n.mode=13),p=e.next_out,g=e.output,S=e.avail_out,E=e.next_in,h=e.input,m=e.avail_in,v=n.hold,I=n.bits,C=m,y=S,U=d;e:for(;;)switch(n.mode){case _:if(0===n.wrap){n.mode=13;break}for(;I<16;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(2&n.wrap&&35615===v){B[n.check=0]=255&v,B[1]=v>>>8&255,n.check=o(n.check,B,2,0),I=v=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&v)<<8)+(v>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&v)){e.msg="unknown compression method",n.mode=30;break}if(I-=4,P=8+(15&(v>>>=4)),0===n.wbits)n.wbits=P;else if(P>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<P,e.adler=n.check=1,n.mode=512&v?10:12,I=v=0;break;case 2:for(;I<16;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(n.flags=v,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=v>>8&1),512&n.flags&&(B[0]=255&v,B[1]=v>>>8&255,n.check=o(n.check,B,2,0)),I=v=0,n.mode=3;case 3:for(;I<32;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}n.head&&(n.head.time=v),512&n.flags&&(B[0]=255&v,B[1]=v>>>8&255,B[2]=v>>>16&255,B[3]=v>>>24&255,n.check=o(n.check,B,4,0)),I=v=0,n.mode=4;case 4:for(;I<16;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}n.head&&(n.head.xflags=255&v,n.head.os=v>>8),512&n.flags&&(B[0]=255&v,B[1]=v>>>8&255,n.check=o(n.check,B,2,0)),I=v=0,n.mode=5;case 5:if(1024&n.flags){for(;I<16;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}n.length=v,n.head&&(n.head.extra_len=v),512&n.flags&&(B[0]=255&v,B[1]=v>>>8&255,n.check=o(n.check,B,2,0)),I=v=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(m<(T=n.length)&&(T=m),T&&(n.head&&(P=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),s.arraySet(n.head.extra,h,E,T,P)),512&n.flags&&(n.check=o(n.check,h,T,E)),m-=T,E+=T,n.length-=T),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===m)break e;for(T=0;P=h[E+T++],n.head&&P&&n.length<65536&&(n.head.name+=String.fromCharCode(P)),P&&T<m;);if(512&n.flags&&(n.check=o(n.check,h,T,E)),m-=T,E+=T,P)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===m)break e;for(T=0;P=h[E+T++],n.head&&P&&n.length<65536&&(n.head.comment+=String.fromCharCode(P)),P&&T<m;);if(512&n.flags&&(n.check=o(n.check,h,T,E)),m-=T,E+=T,P)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;I<16;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(v!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}I=v=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;I<32;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}e.adler=n.check=f(v),I=v=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=p,e.avail_out=S,e.next_in=E,e.avail_in=m,n.hold=v,n.bits=I,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){v>>>=7&I,I-=7&I,n.mode=27;break}for(;I<3;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}switch(n.last=1&v,I-=1,3&(v>>>=1)){case 0:n.mode=14;break;case 1:if(O(n),n.mode=20,6!==t)break;v>>>=2,I-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}v>>>=2,I-=2;break;case 14:for(v>>>=7&I,I-=7&I;I<32;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if((65535&v)!=(v>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&v,I=v=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(T=n.length){if(m<T&&(T=m),S<T&&(T=S),0===T)break e;s.arraySet(g,h,E,T,p),m-=T,E+=T,S-=T,p+=T,n.length-=T;break}n.mode=12;break;case 17:for(;I<14;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(n.nlen=257+(31&v),v>>>=5,I-=5,n.ndist=1+(31&v),v>>>=5,I-=5,n.ncode=4+(15&v),v>>>=4,I-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;I<3;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}n.lens[$[n.have++]]=7&v,v>>>=3,I-=3}for(;n.have<19;)n.lens[$[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,F={bits:n.lenbits},U=a(0,n.lens,0,19,n.lencode,0,n.work,F),n.lenbits=F.bits,U){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;R=(x=n.lencode[v&(1<<n.lenbits)-1])>>>16&255,b=65535&x,!((D=x>>>24)<=I);){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(b<16)v>>>=D,I-=D,n.lens[n.have++]=b;else{if(16===b){for(G=D+2;I<G;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(v>>>=D,I-=D,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}P=n.lens[n.have-1],T=3+(3&v),v>>>=2,I-=2}else if(17===b){for(G=D+3;I<G;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}I-=D,P=0,T=3+(7&(v>>>=D)),v>>>=3,I-=3}else{for(G=D+7;I<G;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}I-=D,P=0,T=11+(127&(v>>>=D)),v>>>=7,I-=7}if(n.have+T>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;T--;)n.lens[n.have++]=P}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,F={bits:n.lenbits},U=a(c,n.lens,0,n.nlen,n.lencode,0,n.work,F),n.lenbits=F.bits,U){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,F={bits:n.distbits},U=a(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,F),n.distbits=F.bits,U){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=m&&258<=S){e.next_out=p,e.avail_out=S,e.next_in=E,e.avail_in=m,n.hold=v,n.bits=I,r(e,y),p=e.next_out,g=e.output,S=e.avail_out,E=e.next_in,h=e.input,m=e.avail_in,v=n.hold,I=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;R=(x=n.lencode[v&(1<<n.lenbits)-1])>>>16&255,b=65535&x,!((D=x>>>24)<=I);){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(R&&!(240&R)){for(w=D,L=R,k=b;R=(x=n.lencode[k+((v&(1<<w+L)-1)>>w)])>>>16&255,b=65535&x,!(w+(D=x>>>24)<=I);){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}v>>>=w,I-=w,n.back+=w}if(v>>>=D,I-=D,n.back+=D,n.length=b,0===R){n.mode=26;break}if(32&R){n.back=-1,n.mode=12;break}if(64&R){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&R,n.mode=22;case 22:if(n.extra){for(G=n.extra;I<G;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}n.length+=v&(1<<n.extra)-1,v>>>=n.extra,I-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;R=(x=n.distcode[v&(1<<n.distbits)-1])>>>16&255,b=65535&x,!((D=x>>>24)<=I);){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(!(240&R)){for(w=D,L=R,k=b;R=(x=n.distcode[k+((v&(1<<w+L)-1)>>w)])>>>16&255,b=65535&x,!(w+(D=x>>>24)<=I);){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}v>>>=w,I-=w,n.back+=w}if(v>>>=D,I-=D,n.back+=D,64&R){e.msg="invalid distance code",n.mode=30;break}n.offset=b,n.extra=15&R,n.mode=24;case 24:if(n.extra){for(G=n.extra;I<G;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}n.offset+=v&(1<<n.extra)-1,v>>>=n.extra,I-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===S)break e;if(T=y-S,n.offset>T){if((T=n.offset-T)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}T>n.wnext?(T-=n.wnext,A=n.wsize-T):A=n.wnext-T,T>n.length&&(T=n.length),N=n.window}else N=g,A=p-n.offset,T=n.length;for(S<T&&(T=S),S-=T,n.length-=T;g[p++]=N[A++],--T;);0===n.length&&(n.mode=21);break;case 26:if(0===S)break e;g[p++]=n.length,S--,n.mode=21;break;case 27:if(n.wrap){for(;I<32;){if(0===m)break e;m--,v|=h[E++]<<I,I+=8}if(y-=S,e.total_out+=y,n.total+=y,y&&(e.adler=n.check=n.flags?o(n.check,g,y,p-y):i(n.check,g,y,p-y)),y=S,(n.flags?v:f(v))!==n.check){e.msg="incorrect data check",n.mode=30;break}I=v=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;I<32;){if(0===m)break e;m--,v+=h[E++]<<I,I+=8}if(v!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}I=v=0}n.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;default:return u}return e.next_out=p,e.avail_out=S,e.next_in=E,e.avail_in=m,n.hold=v,n.bits=I,(n.wsize||y!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&M(e,e.output,e.next_out,y-e.avail_out)?(n.mode=31,-4):(C-=e.avail_in,y-=e.avail_out,e.total_in+=C,e.total_out+=y,n.total+=y,n.wrap&&y&&(e.adler=n.check=n.flags?o(n.check,g,y,e.next_out-y):i(n.check,g,y,e.next_out-y)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0===C&&0===y||4===t)&&U===d&&(U=-5),U)},n.inflateEnd=function(e){if(!e||!e.state)return u;var t=e.state;return t.window&&(t.window=null),e.state=null,d},n.inflateGetHeader=function(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?((n.head=t).done=!1,d):u},n.inflateSetDictionary=function(e,t){var n,s=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?u:11===n.mode&&i(1,t,s,0)!==n.check?-3:M(e,t,s,s)?(n.mode=31,-4):(n.havedict=1,d):u},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(e,t,n){var s=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],r=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,c,l,d,u,_){var h,g,f,E,p,m,S,v,I,C=_.bits,y=0,O=0,M=0,T=0,A=0,N=0,D=0,R=0,b=0,w=0,L=null,k=0,P=new s.Buf16(16),U=new s.Buf16(16),F=null,G=0;for(y=0;y<=15;y++)P[y]=0;for(O=0;O<c;O++)P[t[n+O]]++;for(A=C,T=15;1<=T&&0===P[T];T--);if(T<A&&(A=T),0===T)return l[d++]=20971520,l[d++]=20971520,_.bits=1,0;for(M=1;M<T&&0===P[M];M++);for(A<M&&(A=M),y=R=1;y<=15;y++)if(R<<=1,(R-=P[y])<0)return-1;if(0<R&&(0===e||1!==T))return-1;for(U[1]=0,y=1;y<15;y++)U[y+1]=U[y]+P[y];for(O=0;O<c;O++)0!==t[n+O]&&(u[U[t[n+O]]++]=O);if(0===e?(L=F=u,m=19):1===e?(L=i,k-=257,F=o,G-=257,m=256):(L=r,F=a,m=-1),y=M,p=d,D=O=w=0,f=-1,E=(b=1<<(N=A))-1,1===e&&852<b||2===e&&592<b)return 1;for(;;){for(S=y-D,u[O]<m?(v=0,I=u[O]):u[O]>m?(v=F[G+u[O]],I=L[k+u[O]]):(v=96,I=0),h=1<<y-D,M=g=1<<N;l[p+(w>>D)+(g-=h)]=S<<24|v<<16|I,0!==g;);for(h=1<<y-1;w&h;)h>>=1;if(0!==h?(w&=h-1,w+=h):w=0,O++,0==--P[y]){if(y===T)break;y=t[n+u[O]]}if(A<y&&(w&E)!==f){for(0===D&&(D=A),p+=M,R=1<<(N=y-D);N+D<T&&!((R-=P[N+D])<=0);)N++,R<<=1;if(b+=1<<N,1===e&&852<b||2===e&&592<b)return 1;l[f=w&E]=A<<24|N<<16|p-d}}return 0!==w&&(l[p+w]=y-D<<24|64<<16),_.bits=A,0}},{"../utils/common":1}],10:[function(e,t,n){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){t.exports=function(){this.input=null,this.n