!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="93fbf736-7b7d-46a6-949f-2944dfbe1b87",e._sentryDebugIdIdentifier="sentry-dbid-93fbf736-7b7d-46a6-949f-2944dfbe1b87")}catch(e){}}();var _global="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};_global.SENTRY_RELEASE={id:"14f6a097859d0d8b3d6211949e2cbf557516f71e"},(window.webpackJsonp=window.webpackJsonp||[]).push([[116],{1196:function(e,t,n){"use strict";n(8),n(6),n(5),n(9),n(10),n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.generateId=T,n(4),n(71),n(18),n(11),n(15),n(17),n(29),n(57),n(39),n(79),n(7),n(32);var r=o(n(69)),c=o(n(70)),l=o(n(3)),h=n(1197),f=n(1198),d=n(370);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _(e){for(var t=1;t1&&void 0!==arguments[1])||arguments[1];o._clearTimeouts(),t&&o._connect(),o._listeners.close.forEach((function(t){return t(e)}))})),(0,l.default)(this,"_handleMessage",(function(e){var t=e.data;o._heartbeats=0,o._options.compress?o._inflateMessage(t):o._dispatchMessage(t)})),this._url=t,this._options=n,this._init()}return(0,c.default)(e,[{key:"begin",value:function(e){this.changeProduct(e),this._connect()}},{key:"changeProduct",value:function(e){this.productCode=e}},{key:"_init",value:function(){this.version="2.0",this._binaryType="blob",this._protocols="",this._retryCount=-1,this._heartbeats=0,this._closeCalled=!1,this._connectLock=!1,this._connectTimeout=null,this._messageQueue=[],this._shouldReconnect=!0,this._listeners={open:new Map,close:new Map,error:new Map,message:new Map},this._channelMap=new Map}},{key:"CONNECTING",get:function(){return e.CONNECTING}},{key:"OPEN",get:function(){return e.OPEN}},{key:"CLOSING",get:function(){return e.CLOSING}},{key:"CLOSED",get:function(){return e.CLOSED}},{key:"retryCount",get:function(){return Math.max(this._retryCount,0)}},{key:"readyState",get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}},{key:"_inflateMessage",value:function(e){if(e instanceof Blob){var t=new FileReader,n=this;t.addEventListener("loadend",(function(){var e=(0,d.inflate)(t.result,{to:"string"});n._dispatchMessage(e)})),t.onerror=function(e){console.log("Problem with decompression",e)},t.readAsArrayBuffer(e)}else this._dispatchMessage(e)}},{key:"_dispatchMessage",value:function(e){var data=JSON.parse(String(e)),t=T(data.action,data);this._listeners.message.forEach((function(e){return e(data,t)}))}},{key:"_handleError",value:function(e){this._debug("error event",e.message),this._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),this._listeners.error.forEach((function(t){return t(e)})),this._connect()}},{key:"_handleTimeout",value:function(){this._debug("timeout event"),this._handleError(new f.WrappedErrorEvent(null,f.TIMEOUT_ERROR,this))}},{key:"_initListeners",value:function(){var e=this;this._ws&&(this._ws.onopen=this._handleOpen,this._ws.onclose=function(t){var n=new f.WrappedCloseEvent(t);n.target=e,e._handleClose(n,"terminate"!==n.reason)},this._ws.onmessage=this._handleMessage,this._ws.onerror=function(t){e._handleError(new f.WrappedErrorEvent(t,f.CONNECTION_ERROR,e))})}},{key:"_removeListeners",value:function(){this._ws&&(this._debug("removeListeners"),this._ws.onclose=k,this._ws.onopen=k,this._ws.onerror=k,this._ws.onmessage=k)}},{key:"_wait",value:function(){return new Promise((function(e){setTimeout(e,1e3)}))}},{key:"_getNextUrl",value:function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e(this._options.compress);if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")}},{key:"_connect",value:function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,n=t.maxRetries,o=void 0===n?y.maxRetries:n,r=t.connectionTimeout,c=void 0===r?y.connectionTimeout:r;this._retryCount>=o?this._debug("max retries reached",this._retryCount,">=",o):(this._retryCount++,this._debug("connect retryCount:",this._retryCount),this._removeListeners(),this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._ws=e._protocols?new WebSocket(t,e._protocols):new WebSocket(t),e._connectLock=!1,e._initListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),c))})))}}},{key:"_disconnect",value:function(){var code=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,e=arguments.length>1?arguments[1]:void 0;if(this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(code,e);var t=new f.WrappedCloseEvent(null,code,e);t.target=this,this._handleClose(t)}catch(e){}}}},{key:"_heartbeat",value:function(){var e=this;this._beatTimeout&&clearTimeout(this._beatTimeout);!function t(){var n=e._options,o=n.maxHeartbeat,r=void 0===o?y.maxHeartbeat:o,c=n.heartbeatInterval,l=void 0===c?y.heartbeatInterval:c;e._heartbeats>r?e.reconnect(4999,"heartbeat"):(e._ws.send(JSON.stringify({action:"ping"})),e._heartbeats++,e._beatTimeout=setTimeout((function(){t()}),l))}()}},{key:"close",value:function(){var code=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,e=arguments.length>1?arguments[1]:void 0;this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(code,e):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")}},{key:"terminate",value:function(){var t=this;t.close(1e3,"terminate"),t._debug("execute termination"),e.instance=null,t._init()}},{key:"reconnect",value:function(code,e){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(code,e),this._connect()):this._connect()}},{key:"_debug",value:function(){if(this._options.debug){for(var e=arguments.length,t=new Array(e),n=0;n"].concat(t))}}},{key:"_clearTimeouts",value:function(){clearTimeout(this._connectTimeout),clearTimeout(this._beatTimeout)}},{key:"registerEventListener",value:function(t,n){var o=t+String(Date.now());return this._listeners[t].set(o,n),"open"===t&&this.readyState===e.OPEN&&n(),o}},{key:"removeEventListener",value:function(e,t){this._listeners[e].delete(t)}},{key:"send",value:function(data){this._ws&&this._ws.readyState===this.OPEN?this._ws.send(data):(this._debug("enqueue",data),this._messageQueue.push(data))}},{key:"subscribe",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;n instanceof Function&&(o=n,n={});var r=T(e,n);this._listeners.message.get(r)&&this._listeners.message.delete(r),this._listeners.message.set(r,(function(e,n){e.productCode&&e.productCode!==t.productCode&&""!=t.productCode||n===r&&o(e,n)}));var c="message"+String(Date.now());return this.send(JSON.stringify(_(_({action:e},n),{},{msgId:c}))),r+"#"+c}},{key:"unsubscribe",value:function(e){this._listeners.message=new Map}},{key:"unsubscribeAll",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if("currentTraceOrders"===e)return e;var n=e;return Object.keys(t).sort((function(a,b){return a-1&&(n+="|".concat(e,":").concat(t[e]))})),n}},1197:function(e,t,n){"use strict";n(8),n(86),n(68),n(7),n(6),n(5),n(9),n(10),n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.UrlManager=void 0,n(14),n(57),n(32),n(31),n(39),n(38),n(18),n(11),n(15),n(17),n(29),n(4),n(35),n(43);var r=o(n(74)),c=o(n(69)),l=o(n(70)),h=o(n(3));function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function d(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,c=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return c=e.done,e},e:function(e){l=!0,r=e},f:function(){try{c||null==n.return||n.return()}finally{if(l)throw r}}}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i0&&void 0!==arguments[0]&&arguments[0];t.evaluateTask();var n=function(e,t,n){if(!e||e.length<0)return;var o=e[0];return e.forEach((function(e){var r=t(e),c=n(e);r>0&&(r-1?"&":"?")+"compress=true"),o})),(0,h.default)(this,"evaluateTask",(function(){t.counter&&clearTimeout(t.counter);!function e(){t.evaluate(),t.counter=setTimeout(e,18e5)}()}));var n=JSON.parse(localStorage.getItem("bitget::socket::score")||"[]"),o=[],l=location.hostname.split(".").slice(1).join("."),f={name:"new-prod-3",socketUrl:"wss://contract-websocket.#/websocket".replace("#",l)};"beta"===m.env&&(f.socketUrl=f.socketUrl+"?beta=true"),"bitget.com"===l?(o.push(f),o.push.apply(o,(0,r.default)(m.backupSocketUrl))):"bitget.cc"===l||"bitget.me"===l||"bitget.io"===l?(o.push.apply(o,(0,r.default)(m.backupSocketUrl)),o.push(f)):o.push.apply(o,(0,r.default)(m.backupSocketUrl)),this.records=function(e,t){var n,o=[],r=v(e);try{var c=function(){var e=n.value,r=t.find((function(i){return i.name===e.name}));r?o.push(r):o.push(d(d({},e),{},{cost:-1,lastTestTime:-1,lastUsedTime:-1}))};for(r.s();!(n=r.n()).done;)c()}catch(e){r.e(e)}finally{r.f()}return o}(o,n)}return(0,l.default)(e,[{key:"saveRecord",value:function(){localStorage.setItem("bitget::socket::score",JSON.stringify(this.records))}},{key:"evaluate",value:function(){var e=this,t=this.records.map((function(e){return t=e,new Promise((function(e){var n=Date.now(),o=new WebSocket(t.socketUrl+(t.socketUrl.indexOf("?")>-1?"&":"?")+"check=1"),r=null,c=!1,l=!1,h=setTimeout((function(){l=!0,t.lastTestTime=Date.now(),t.cost=99999,e()}),4e3);o.onopen=function(){l?o.close():(clearTimeout(h),r=setTimeout((function(){o&&o.readyState===o.OPEN&&o.close()}),1e4))},o.onerror=function(){l||(t.cost=99999,t.lastTestTime=Date.now(),r&&clearTimeout(r),h&&clearTimeout(h),e())},o.onmessage=function(){if(!l){var o=Date.now();t.lastTestTime=o,t.cost=o-n,c=!0,e()}},o.onclose=function(){l||c||(t.lastTestTime=Date.now(),t.cost=99999,e())}}));var t}));Promise.all(t).then((function(){e.saveRecord()}))}},{key:"stop",value:function(){this.counter&&clearTimeout(this.counter)}}]),e}()},1198:function(e,t,n){"use strict";n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.WrappedErrorEvent=t.WrappedCloseEvent=t.TIMEOUT_ERROR=t.CONNECTION_ERROR=void 0;var r=o(n(70)),c=o(n(69)),l=o(n(3));t.TIMEOUT_ERROR="TIMEOUT",t.CONNECTION_ERROR="SYSTEM",t.WrappedErrorEvent=(0,r.default)((function e(t,n,o){(0,c.default)(this,e),(0,l.default)(this,"event",void 0),(0,l.default)(this,"message",void 0),(0,l.default)(this,"target",void 0),this.event=t,this.message=n,this.target=o})),t.WrappedCloseEvent=(0,r.default)((function e(t,code,n){(0,c.default)(this,e),(0,l.default)(this,"code",void 0),(0,l.default)(this,"reason",void 0),(0,l.default)(this,"wasClean",void 0),(0,l.default)(this,"event",void 0),(0,l.default)(this,"target",void 0),this.event=t,this.code=t?t.code:code||1e3,this.reason=t?t.reason:n||"",this.wasClean=!t||t.wasClean,this.target=null}))},1199:function(e,t,n){"use strict";(function(e){n(7),n(8),n(6),n(5),n(9),n(10),n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.generateId=k,n(4),n(71),n(18),n(11),n(15),n(17),n(29),n(57),n(31);var r=o(n(74)),c=o(n(69)),l=o(n(70)),h=o(n(3)),f=o(n(772)),d=n(773),v=n(370);function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}n(87);var m={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),reconnectionDelayGrowFactor:1.3,connectionTimeout:1e4,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:"online"!==e.env.REACT_APP_ENV,maxHeartbeat:6,heartbeatInterval:2e4,compress:!!e.env.socketCompress};function y(){}var w=function(){function e(t,n){var o=this;(0,c.default)(this,e),(0,h.default)(this,"_url",void 0),(0,h.default)(this,"_options",void 0),(0,h.default)(this,"_ws",void 0),(0,h.default)(this,"_binaryType",void 0),(0,h.default)(this,"_protocols",void 0),(0,h.default)(this,"_retryCount",void 0),(0,h.default)(this,"_heartbeats",void 0),(0,h.default)(this,"_closeCalled",void 0),(0,h.default)(this,"_shouldReconnect",void 0),(0,h.default)(this,"_connectLock",void 0),(0,h.default)(this,"_connectTimeout",void 0),(0,h.default)(this,"_beatTimeout",void 0),(0,h.default)(this,"_messageQueue",void 0),(0,h.default)(this,"_listeners",void 0),(0,h.default)(this,"_channelMap",void 0),(0,h.default)(this,"productCode",void 0),(0,h.default)(this,"urlManager",void 0),(0,h.default)(this,"onLogin",void 0),(0,h.default)(this,"isLogin",void 0),(0,h.default)(this,"_handleOpen",(function(e){clearTimeout(o._connectTimeout),o._heartbeats=0,o._retryCount=0,o._debug("send queued message:",o._messageQueue.length),o._messageQueue.forEach((function(e){return o._ws.send(e)})),o._messageQueue=[],o._heartbeat(),o._listeners.open.forEach((function(t){return t(e)}))})),(0,h.default)(this,"_handleClose",(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];o._clearTimeouts(),o._listeners.close.forEach((function(t){return t(e)})),t&&o._connect(),o.isLogin=!1})),(0,h.default)(this,"_handleMessage",(function(e){var t=e.data;o._heartbeats=0,window.stopDispatchMessage||(o._options.compress||t instanceof Blob?o._inflateMessage(t):o._dispatchMessage(t))})),this._url=t,this._options=n,this._init()}return(0,l.default)(e,[{key:"CONNECTING",get:function(){return e.CONNECTING}},{key:"OPEN",get:function(){return e.OPEN}},{key:"CLOSING",get:function(){return e.CLOSING}},{key:"CLOSED",get:function(){return e.CLOSED}},{key:"_init",value:function(){this._binaryType="blob",this._protocols="",this._retryCount=-1,this._heartbeats=0,this._closeCalled=!1,this._connectLock=!1,this._connectTimeout=null,this._messageQueue=[],this._shouldReconnect=!0,this._listeners={open:new Map,close:new Map,error:new Map,message:new Map},this._channelMap=new Map,this.onLogin=[],this.isLogin=!1}},{key:"_connect",value:function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,n=t.maxRetries,o=void 0===n?m.maxRetries:n,r=t.connectionTimeout,c=void 0===r?m.connectionTimeout:r;this._retryCount>=o?this._debug("max retries reached",this._retryCount,">=",o):(this._retryCount++,this._debug("connect retryCount:",this._retryCount),this._removeListeners(),this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._ws=e._protocols?new WebSocket(t,e._protocols):new WebSocket(t),e._connectLock=!1,e._initListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),c))})))}}},{key:"_disconnect",value:function(){var code=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,e=arguments.length>1?arguments[1]:void 0;if(this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(code,e);var t=new d.WrappedCloseEvent(null,code,e);t.target=this,this._handleClose(t)}catch(e){}}}},{key:"_initListeners",value:function(){var e=this;this._ws&&(this._ws.onopen=this._handleOpen,this._ws.onclose=function(t){var n=new d.WrappedCloseEvent(t);n.target=e,e._debug("close event:",t.code,t.reason),e._handleClose(n,"terminate"!==n.reason)},this._ws.onmessage=this._handleMessage,this._ws.onerror=function(t){e._handleError(new d.WrappedErrorEvent(t,d.CONNECTION_ERROR,e))})}},{key:"_removeListeners",value:function(){this._ws&&(this._debug("removeListeners"),this._ws.onclose=y,this._ws.onopen=y,this._ws.onerror=y,this._ws.onmessage=y)}},{key:"_wait",value:function(){return new Promise((function(e){setTimeout(e,1e3)}))}},{key:"_heartbeat",value:function(){var e=this;this._beatTimeout&&clearTimeout(this._beatTimeout);!function t(){var n=e._options,o=n.maxHeartbeat,r=void 0===o?m.maxHeartbeat:o,c=n.heartbeatInterval,l=void 0===c?m.heartbeatInterval:c;e._heartbeats>r?e.reconnect(4999,"heartbeat"):(e._ws.send("ping"),e._heartbeats++,e._beatTimeout=setTimeout((function(){t()}),l))}()}},{key:"_inflateMessage",value:function(e){if(e instanceof Blob){var t=new FileReader,n=this;t.addEventListener("loadend",(function(){if(t.result){var e=(0,v.inflate)(t.result,{to:"string"});n._dispatchMessage(e)}})),t.onerror=function(e){console.log("Mixcopy decompression issue:",e)},t.readAsArrayBuffer(e)}else this._dispatchMessage(e)}},{key:"_dispatchMessage",value:function(e){if("pong"!==e){var data=JSON.parse(String(e)),t=k(data.arg);if("event"in data){if("auth"===data.event){for(;this.onLogin.length;){this.onLogin.pop()(data)}this.onLogin=[],this.isLogin=!0}}else this._listeners.message.forEach((function(e){return e(data,t)}))}}},{key:"_handleError",value:function(e){this._debug("error event",e.message),this._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),this._listeners.error.forEach((function(t){return t(e)})),this._connect()}},{key:"_handleTimeout",value:function(){this._debug("timeout event"),this._handleError(new d.WrappedErrorEvent(null,d.TIMEOUT_ERROR,this))}},{key:"reconnect",value:function(code,e){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(code,e),this._connect()):this._connect()}},{key:"registerEventListener",value:function(t,n,o){var c=t+String(Date.now()),l=this._listeners[t];function h(){var e=Array.prototype.slice.call(arguments);n.apply(void 0,(0,r.default)(e)),o&&l.delete(c)}return l.set(c,h),"open"===t&&this._ws&&this._ws.readyState===e.OPEN&&h(),c}},{key:"close",value:function(){var code=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,e=arguments.length>1?arguments[1]:void 0;this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(code,e):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")}},{key:"terminate",value:function(){this.close(1e3,"terminate"),this._debug("execute termination"),e.instance=null,this._init()}},{key:"removeEventListener",value:function(e,t){this._listeners[e].delete(t)}},{key:"send",value:function(data){this._ws&&this._ws.readyState===this.OPEN?this._ws.send(data):(this._debug("enqueue",data),this._messageQueue.push(data))}},{key:"login",value:function(e,t){if(this.isLogin)t({event:"auth",code:0});else{var n=this.onLogin.length;this.onLogin.push(t),0===n&&this.send(JSON.stringify({op:"auth",args:[e]}))}}},{key:"subscribe",value:function(e,t,n){var o=function(e){for(var t=1;t"].concat(t))}}},{key:"_clearTimeouts",value:function(){clearTimeout(this._connectTimeout),clearTimeout(this._beatTimeout)}},{key:"_getNextUrl",value:function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e(this._options.compress);if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")}},{key:"selfDestruct",value:function(){this.terminate(),this.urlManager&&this.urlManager.stop()}},{key:"changeProduct",value:function(e){this.productCode=e}},{key:"begin",value:function(){this._connect()}}],[{key:"getInstance",value:function(){if(e.instance)return e.instance;var t=new f.default,n=new e(t.url,m);return e.instance=n,n.urlManager=t,n}},{key:"CONNECTING",get:function(){return 0}},{key:"OPEN",get:function(){return 1}},{key:"CLOSING",get:function(){return 2}},{key:"CLOSED",get:function(){return 3}}]),e}();function k(data){return data?data.channel+data.instId+data.instType:""}(0,h.default)(w,"instance",void 0);t.default=w}).call(this,n(128))},401:function(e,t,n){"use strict";n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.uuid=m;var r=o(n(34)),c=o(n(69)),l=o(n(70)),h=o(n(3));n(39),n(31),n(71),n(18),n(11),n(15),n(17),n(4),n(79),n(6),n(7),n(21);var f=o(n(891)),d=o(n(87)),v=n(22);var _=t.default=function(){function e(t){var n=this;(0,c.default)(this,e),this._ws=new f.default(t),this.listenerList=new Map,this._ws.connect(),this._ws.on("ws:message",(function(e){var data=e.data;if(data)try{data=JSON.parse(data)}catch(e){console.log(e),data={}}n.dispatch(data)})),this._ws.on("ws:open",(function(){n._ws.send()})),this._ws.on("ws:send",(function(){}))}return(0,l.default)(e,[{key:"sub",value:function(e,param){var t=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o="";if(v.type.isArray(param))param.forEach((function(o){var r=m(e,o);o.id=r,t.listenerList.has(r)?t.listenerList.get(r).push(n):t.listenerList.set(r,[n])})),o=param;else{var r=m(e,param);if(param.id=r,o=[param],this.listenerList.has(r))return void this.listenerList.get(r).push(n);this.listenerList.set(r,[n])}this._ws.send({action:e,args:o,terminaltype:"1"})}},{key:"unsub",value:function(e){var param=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=m(e,param);param.id=t,this.listenerList.has(t)&&this.listenerList.delete(t),this._ws.send({action:"unsub_"+e})}},{key:"unsubAll",value:function(){var e=this;this.clearListener();for(var t=arguments.length,n=new Array(t),o=0;o1&&void 0!==arguments[1]?arguments[1]:{},n=e,param=t;t.params&&(param=(0,r.default)({},t,t.params));var filter=["topic","bizNo"];return Object.keys(param).filter((function(e){return filter.includes(e)})).sort((function(a,b){return a-1?h.webSocketUrl:h.newMixSocketUrl;/test|dev/.test(h.env)&&"https:"===location.protocol&&(t=t.replace("ws:","wss:").replace("upex-stream-rest.","upex-stream-rest-"));var n=location.host.split(".").slice(1).join("."),o=location.href.indexOf("spot")>-1?"wss://stream.#/spot/v1/stream".replace("#",n):"wss://stream.#/mix/v1/stream".replace("#",n);"bitget.bike"!==n&&"online"===h.env&&(t=o+"?compress=true"),this.url=function(e,t){var n=e;return e.includes("?compress")||e.includes("?beta")?n+="&".concat(f):n+="?".concat(f),t&&(n+="&".concat(t)),n}(t)}return(0,c.default)(e,[{key:"saveRecord",value:function(){localStorage.setItem("bitget::socket::score",JSON.stringify(this.records))}},{key:"urlProvider",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.evaluateTask();var t=function(e,t,n){if(!e||e.length<0)return;var o=e[0];return e.forEach((function(e){var r=t(e),c=n(e);r>0&&(r-1?"&":"?")+"compress=true"),n}},{key:"evaluateTask",value:function(){var e=this;this.counter&&clearTimeout(this.counter);!function t(){e.evaluate(),e.counter=setTimeout(t,18e5)}()}},{key:"evaluate",value:function(){var e=this,t=this.records.map((function(e){return t=e,new Promise((function(e){var n=Date.now(),o=new WebSocket(t.socketUrl+(t.socketUrl.indexOf("?")>-1?"&":"?")+"check=1"),r=null,c=!1,l=!1,h=setTimeout((function(){l=!0,t.lastTestTime=Date.now(),t.cost=99999,e()}),4e3);o.onopen=function(){l?o.close():(clearTimeout(h),r=setTimeout((function(){o&&o.readyState===o.OPEN&&o.close()}),1e4))},o.onerror=function(){l||(t.cost=99999,t.lastTestTime=Date.now(),r&&clearTimeout(r),h&&clearTimeout(h),e())},o.onmessage=function(){if(!l){var o=Date.now();t.lastTestTime=o,t.cost=o-n,c=!0,e()}},o.onclose=function(){l||c||(t.lastTestTime=Date.now(),t.cost=99999,e())}}));var t}));Promise.all(t).then((function(){e.saveRecord()}))}},{key:"stop",value:function(){this.counter&&clearTimeout(this.counter)}}]),e}();t.default=d},773:function(e,t,n){"use strict";n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.WrappedErrorEvent=t.WrappedCloseEvent=t.TIMEOUT_ERROR=t.CONNECTION_ERROR=void 0;var r=o(n(70)),c=o(n(69)),l=o(n(3));t.TIMEOUT_ERROR="TIMEOUT",t.CONNECTION_ERROR="SYSTEM",t.WrappedErrorEvent=(0,r.default)((function e(t,n,o){(0,c.default)(this,e),(0,l.default)(this,"event",void 0),(0,l.default)(this,"message",void 0),(0,l.default)(this,"target",void 0),this.event=t,this.message=n,this.target=o})),t.WrappedCloseEvent=(0,r.default)((function e(t,code,n){(0,c.default)(this,e),(0,l.default)(this,"code",void 0),(0,l.default)(this,"reason",void 0),(0,l.default)(this,"wasClean",void 0),(0,l.default)(this,"event",void 0),(0,l.default)(this,"target",void 0),this.event=t,this.code=t?t.code:code||1e3,this.reason=t?t.reason:n||"",this.wasClean=!t||t.wasClean,this.target=null}))},891:function(e,t,n){"use strict";n(749),n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n(33);var r=o(n(69)),c=o(n(70)),l=o(n(520)),h=o(n(750)),f=o(n(751)),d=o(n(752)),v=o(n(3)),_=o(n(893));function m(e){var t=y();return function(){var n,o=(0,d.default)(e);if(t){var r=(0,d.default)(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return(0,f.default)(this,n)}}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(y=function(){return!!e})()}var w=n(87),k=function(e){(0,h.default)(n,e);var t=m(n);function n(e){var o,option=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,r.default)(this,n),o=t.call(this),(0,v.default)((0,l.default)(o),"reconnectTime",0),o.url=e,o.option=option,o.heartCount=0,o.sendList=[],o.heartCheckTimer=null,o}return(0,c.default)(n,[{key:"connect",value:function(){var e=this;/test|dev/.test(w.env)&&"https:"===location.protocol&&(this.url=this.url.replace("ws:","wss:").replace("upex-websocket.","upex-websocket-")),this.ws=new WebSocket(this.url);var t=this;this.ws.onopen=function(e){t.emit("ws:open"),t.emit("ws:send"),console.log("Socket connected"),t.heartCheck()},this.ws.onmessage=function(e){t.heartCount=0,t.emit("ws:message",e)},this.ws.onerror=function(n){t.emit("error"),console.log("Socket error",n),e.reconnect("Socket error causing reconnection")},this.ws.onclose=function(n){t.emit("close"),console.log("Socket closed"),e.reconnect("Close socket for reconnection")}}},{key:"readyState",value:function(){return this.ws?this.ws.readyState:0}},{key:"send",value:function(param){if(1==this.readyState()){if(this.sendList.length)for(;;){var e=this.sendList.shift();if(!e)break;this.ws.send(JSON.stringify(e)),this.emit("ws:send",param)}param&&(this.ws.send(JSON.stringify(param)),this.emit("ws:send",param))}else param&&"ping"!==param.action&&this.sendList.push(param)}},{key:"close",value:function(){this.heartCheckTimer&&(console.log("Pause heartbeat detection first"),clearTimeout(this.heartCheckTimer),this.heartCheckTimer=null),3!=this.readyState()&&this.ws.close(),console.log("close")}},{key:"reconnect",value:function(e){console.log(e),this.close(),this.reconnectTime++,this.reconnectTime<6?this.connect():console.log("Problem with ws, unable to connect")}},{key:"heartCheck",value:function(){this.heartCheckTimer&&(clearTimeout(this.heartCheckTimer),this.heartCheckTimer=null);var e=this;!function t(){e.heartCount>6?e.reconnect("Heartbeat detection failed, reconnected"):(e.send({action:"ping",args:[{params:{}}]}),e.heartCount++,e.heartCheckTimer=setTimeout((function(){t()}),1e4))}()}}]),n}(_.default);t.default=k},893:function(e,t,n){"use strict";n(0);var o=n(2);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n(71),n(18),n(11),n(15),n(17),n(4),n(6);var r=o(n(69)),c=o(n(70)),l=function(){function e(){(0,r.default)(this,e),this.listenerList=new Map}return(0,c.default)(e,[{key:"on",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};this.listenerList.has(e)&&this.listenerList.get(e).push(t),this.listenerList.set(e,[t])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o