(window.webpackJsonp=window.webpackJsonp||[]).push([[124],{2612:function(e,t,n){"use strict";var r=n(0),o=n(1);r(t,"__esModule",{value:!0}),t.stringifyObjectWithMap=t.parseObjectWithMap=void 0;var l=o(n(56)),c=o(n(85)),d=o(n(325)),f=o(n(772)),v=o(n(782));t.stringifyObjectWithMap=function(object){return(0,l.default)(object,(function(e,t){return(0,v.default)(t)?{dataType:"Map",value:(0,f.default)((0,c.default)(t.entries()),(function(e){return e}))}:t}))},t.parseObjectWithMap=function(e){return JSON.parse(e,(function(e,t){return t&&"Map"===t.dataType?new d.default(t.value):t}))}},3414:function(e,t,n){"use strict";n.r(t);var r=n(3415),o=n.n(r);for(var l in r)["default"].indexOf(l)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(l);t.default=o.a},3415:function(e,t,n){"use strict";var r=n(17),o=n(20),l=n(12),c=n(21),d=n(22),f=n(0),v=n(1);f(t,"__esModule",{value:!0}),t.default=void 0;var h=v(n(32)),m=v(n(33)),w=v(n(13)),S=v(n(5081)),y=v(n(5084)),_=n(24),C=n(27);function T(e,t){var n=r(e);if(o){var c=o(e);t&&(c=c.filter((function(t){return l(e,t).enumerable}))),n.push.apply(n,c)}return n}t.default={name:"index",components:{"kline-menu":S.default,"trading-view":y.default},data:function(){return{intervalButtons:[{text:this.$t("trade.kline.realtime"),interval:1},{text:"1m",interval:1},{text:"5m",interval:5},{text:"15m",interval:15},{text:"30m",interval:30},{text:"1H",interval:60},{text:"4H",interval:240},{text:"12H",interval:720},{text:"1D",interval:"1D"},{text:"1W",interval:"1W"}],currentIntervalIndex:1,currentInterval:1,isFullScreen:!1,openListener:null}},computed:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){(0,w.default)(e,t,n[t])})):c?d(e,c(n)):T(Object(n)).forEach((function(t){f(e,t,l(n,t))}))}return e}({},(0,_.mapState)({marketDetailReady:function(e){return e.spot.marketDetailReady},theme:function(e){return e.theme}})),watch:{$route:function(e,t){e.path!==t.path&&this.$refs.widget&&this.$refs.widget.changeSymbol()},theme:function(e){this.$refs.widget.changeTheme(e)},marketDetailReady:{handler:function(e){var t;e&&(null===(t=this.$refs.widget)||void 0===t||t.initTradingView())}}},methods:{handleIntervalChange:function(e){this.currentIntervalIndex=e,this.currentInterval=this.intervalButtons[e].interval,C.TradeLocal.TRADE_USER_INTERVAL=e,this.$refs.widget.changeInterval()},delegateOpenSetting:function(){this.$refs.widget.delegateOpenSetting()},delegateOpenStudy:function(){this.$refs.widget.delegateOpenStudy()},delegateFullScreen:function(){var e,t=this,n=this.$refs.chartWindow;this.isFullScreen?n&&function(){var e=document.exitFullscreen||document.msExitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen;e&&(e.call(document),document.body.style.overflow="",t.isFullScreen=!1)}():n&&((e=n.requestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen||n.webkitRequestFullscreen)&&(e.call(n),document.body.style.overflow="hidden",t.isFullScreen=!0))},getWSInstance:function(){var e=this;return(0,m.default)(h.default.mark((function t(){var n;return h.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.$hero.getInstance();case 2:return n=t.sent,t.abrupt("return",n);case 4:case"end":return t.stop()}}),t)})))()},handleVisibilityChange:function(){var e;"visible"===document.visibilityState&&(this.marketDetailReady&&(null===(e=this.$refs.widget)||void 0===e||e.initTradingView()))},handleNetworkChange:function(){var e;navigator.onLine&&(null===(e=this.$refs.widget)||void 0===e||e.initTradingView())},initInterval:function(){var e=Number(C.TradeLocal.TRADE_USER_INTERVAL||"1");e>=this.intervalButtons.length&&(e=1,C.TradeLocal.TRADE_USER_INTERVAL=e),this.currentIntervalIndex=e,this.currentInterval=this.intervalButtons[e].interval}},mounted:function(){var e,t=this;this.initInterval(),this.marketDetailReady&&(null===(e=this.$refs.widget)||void 0===e||e.initTradingView()),document.addEventListener&&(document.addEventListener("fullscreenchange",(function(e){t.isFullScreen=e.target===document.fullscreenElement})),document.addEventListener("webkitfullscreenchange",(function(e){t.isFullScreen=e.target===document.webkitCurrentFullScreenElement})),document.addEventListener("visibilitychange",this.handleVisibilityChange))},beforeDestroy:function(){this.isFullScreen&&this.delegateFullScreen()}}},3416:function(e,t,n){"use strict";n.r(t);var r=n(3417),o=n.n(r);for(var l in r)["default"].indexOf(l)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(l);t.default=o.a},3417:function(e,t,n){"use strict";var r=n(17),o=n(20),l=n(12),c=n(21),d=n(22),f=n(0),v=n(1);f(t,"__esModule",{value:!0}),t.default=void 0;var h=v(n(13)),m=n(24);function w(e,t){var n=r(e);if(o){var c=o(e);t&&(c=c.filter((function(t){return l(e,t).enumerable}))),n.push.apply(n,c)}return n}t.default={name:"KlineMenu",props:{intervals:{type:Array,default:function(){return[]}},currentIntervalIndex:Number,isFullScreen:Boolean},computed:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){(0,h.default)(e,t,n[t])})):c?d(e,c(n)):w(Object(n)).forEach((function(t){f(e,t,l(n,t))}))}return e}({},(0,m.mapState)(["newTheme"])),data:function(){return{}}}},3418:function(e,t,n){"use strict";n.r(t);var r=n(3419),o=n.n(r);for(var l in r)["default"].indexOf(l)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(l);t.default=o.a},3419:function(e,t,n){"use strict";var r=n(17),o=n(20),l=n(12),c=n(21),d=n(22),f=n(0),v=n(85),h=n(86),m=n(87),w=n(61),S=n(1);f(t,"__esModule",{value:!0}),t.default=void 0;var y=S(n(56)),_=S(n(85)),C=S(n(35)),T=S(n(52)),R=S(n(13)),I=n(758),E=n(24),F=n(212),O=n(2612),k=n(60),D=S(n(3855)),x=S(n(3854)),A=n(48),L=n(27);function M(e,t){var n=void 0!==h&&e[m]||e["@@iterator"];if(!n){if(w(e)||(n=function(e,a){if(e){if("string"==typeof e)return N(e,a);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?v(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?N(e,a):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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 l,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,l=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw l}}}}function N(e,a){(null==a||a>e.length)&&(a=e.length);for(var t=0,n=Array(a);t<a;t++)n[t]=e[t];return n}function P(e,t){var n=r(e);if(o){var c=o(e);t&&(c=c.filter((function(t){return l(e,t).enumerable}))),n.push.apply(n,c)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){(0,R.default)(e,t,n[t])})):c?d(e,c(n)):P(Object(n)).forEach((function(t){f(e,t,l(n,t))}))}return e}t.default={name:"tradingview",data:function(){return{widget:null}},computed:B(B(B({},(0,E.mapGetters)("spot",{symbolInfo:F.SPOT_GETTERS_TYPE.SYMBOL_INFO,tradeInfo:F.SPOT_GETTERS_TYPE.TRADE_INFO})),(0,E.mapState)({marketDetailReady:function(e){return e.spot.marketDetailReady},locale:function(e){return e.locale},theme:function(e){return e.theme}})),{},{interval:function(){return String(this.$parent.currentInterval)}}),watch:{theme:function(e){this.destroyWidget(),this.initTradingView()}},methods:{handleLocalStorageChange:function(e){if(e&&"tradingview.chartproperties.mainSeriesProperties"===e.key){var t=e.newValue;t&&("#089981"===(t=JSON.parse(t)).candleStyle.upColor&&(t.candleStyle.upColor="#28C452"),"#F23645"===t.candleStyle.downColor&&(t.candleStyle.downColor="#EC4551"),"#089981"===t.candleStyle.borderUpColor&&(t.candleStyle.borderUpColor="#28C452"),"#F23645"===t.candleStyle.borderDownColor&&(t.candleStyle.borderDownColor="#EC4551"),"#089981"===t.candleStyle.wickUpColor&&(t.candleStyle.wickUpColor="#28C452"),"#F23645"===t.candleStyle.wickDownColor&&(t.candleStyle.wickDownColor="#EC4551"),t.candleStyle&&(L.TradeLocal.TRADE_TV_COLOR=(0,y.default)(t.candleStyle)))}},initTradingView:function(){var e=this;if(!this.widget){var t=(0,A.getTradingViewLanByLanguage)(this.$store.state.locale),n=this.getChartConfig(t),r=window.tvWidget=new this.TradingView.widget(n);r.onChartReady((function(){return e.onChartReadyHandler(r)})),this.widget=r,(0,T.default)(r,{changingInterval:!1,chartType:Number(L.FuturesLocal.CHART_TYPE||"1")})}},getChartConfig:function(e){var t=this,symbol=this.symbolInfo.symbol.replace("_","/").toUpperCase(),n=this.interval,r=new x.default(this.$websocket,(function(){return t.tradeInfo.pricePlace})),o=Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai",l=(0,I.getDefaultChartConfig)(symbol,n,r,I.CHARTING_LIBRARY,e,this.theme);l.timezone=o,l.overrides.timezone=o,l.disabled_features.push("header_widget");var c=L.TradeLocal.TRADE_KLINE_CONFIG;if(c)try{var d=JSON.parse(c);d.panes[0].sources[0].state.symbol=symbol,d.panes[0].sources[0].state.interval=n,l.saved_data=d}catch(e){}return l},onChartReadyHandler:function(e){var t,n=this;document.getElementById("main_chart").childNodes[0].style="display:block;width:100%;height:100%;",this.changeTheme(this.theme),e.onContextMenu(this.customizeContextMenu);var r=null==e?void 0:e.activeChart();null==r||null===(t=r.getPanes())||void 0===t||t.forEach((function(e){var t;null==e||null===(t=e.getMainSourcePriceScale())||void 0===t||t.setAutoScale(!0)})),r&&r.dataReady((function(){n.initializeChart(e,r),n.restoreDrawings(r);var t=setTimeout((function(){n.setupDrawingEvent(e,r),n.setupAutoSave(e,r),clearTimeout(t)}),300)}))},setupAutoSave:function(e,t){e.subscribe("onAutoSaveNeeded",(function(){e.save((function(e){if(e&&e.charts&&0!==e.charts.length){var t=e.charts[0];t.panes[0].sources=t.panes[0].sources.filter((function(i){return"study_Compare"!==i.type})),L.TradeLocal.TRADE_KLINE_CONFIG=(0,y.default)(t)}}),{includeDrawings:!1})}))},saveDrawings:function(e){var t=this,n=setTimeout((function(){t.saveDrawingsToLocalStorage(e),clearTimeout(n)}),200)},saveDrawingsToLocalStorage:function(e){var t,n=e.getLineToolsState(),r=null==n?void 0:n.sources,o=M(r);try{for(o.s();!(t=o.n()).done;){var l=(0,C.default)(t.value,2),c=l[0],d=l[1];null!==d&&null!==d.state||r.delete(c)}}catch(e){o.e(e)}finally{o.f()}n.sources=r,n.lineToolsToValidate=(0,_.default)(r.keys()),L.TradeLocal.SWAP_KLINE_DRAWINGS_CONFIG=(0,O.stringifyObjectWithMap)(n)},setupDrawingEvent:function(e,t){var n=this;e.subscribe("drawing_event",(function(e,r){"properties_changed"!==r&&n.saveDrawings(t)}))},initializeChart:function(e,t){if(!L.TradeLocal.TRADE_KLINE_CONFIG){var n=["#965fc4","#84aad5","#55b263","#b7248a"];e.maStudies=[5,10,15,30].map((function(t,r){return e.chart().createStudy("Moving Average",!1,!1,{length:t},null,{"plot.color.0":n[r]})}))}e.applyOverrides({"mainSeriesProperties.style":0===this.$parent.currentIntervalIndex?3:t.chartType()})},customizeContextMenu:function(e,t){return[{text:"-Objects Tree..."},{text:"-变更代码..."},{text:"-变更周期..."},{text:"-Hide Marks On Bars"},{text:"-Change Symbol..."},{text:"-Change Interval..."}]},restoreDrawings:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t=L.TradeLocal.SWAP_KLINE_DRAWINGS_CONFIG),t){var n=(0,O.parseObjectWithMap)(t),r=null==n?void 0:n.sources;r&&r.size>0&&e.applyLineToolsState(n).then((function(){}))}},changeInterval:function(){var e=this,t=this.$parent.currentIntervalIndex;if(this.widget){var n=this.widget;n.onChartReady((function(){var r;if(null===(r=n.activeChart())||void 0===r||null===(r=r.getPanes())||void 0===r||r.forEach((function(e){var t;null==e||null===(t=e.getMainSourcePriceScale())||void 0===t||t.setAutoScale(!0)})),!n.changingInterval){n.changingInterval=!0,n.activeChart().setResolution(e.interval.toString());var o=n.chartType;0===t&&(o=3),n.applyOverrides({"mainSeriesProperties.style":o}),n.changingInterval=!1;var l=I.RESOLUTION_TO_SECOND_MAP[e.interval.toString()];D.default.trigger("getBars_".concat(l)),setTimeout((function(){D.default.trigger("subscribeBars_".concat(l))}))}}))}},delegateOpenStudy:function(){var e;this.widget.closePopupsAndDialogs(),null===(e=this.widget)||void 0===e||e.chart().executeActionById("insertIndicator")},delegateOpenSetting:function(){var e;this.widget.closePopupsAndDialogs(),null===(e=this.widget)||void 0===e||e.chart().executeActionById("chartProperties")},changeTheme:function(e){var t=this;this.widget&&this.widget.onChartReady((function(){var n=e===k.SUPPORTED_THEME[0]?I.OVERRIDES_BLACK:I.OVERRIDES_WHITE,r=JSON.parse((0,y.default)(n)),o=L.TradeLocal.TRADE_TV_COLOR;o&&((o=JSON.parse(o)).upColor&&(r["mainSeriesProperties.candleStyle.upColor"]=o.upColor),o.downColor&&(r["mainSeriesProperties.candleStyle.downColor"]=o.downColor),o.borderColor&&(r["mainSeriesProperties.candleStyle.borderColor"]=o.borderColor),o.borderUpColor&&(r["mainSeriesProperties.candleStyle.borderUpColor"]=o.borderUpColor),o.borderDownColor&&(r["mainSeriesProperties.candleStyle.borderDownColor"]=o.borderDownColor),o.wickUpColor&&(r["mainSeriesProperties.candleStyle.wickUpColor"]=o.wickUpColor),o.wickDownColor&&(r["mainSeriesProperties.candleStyle.wickDownColor"]=o.wickDownColor)),t.widget.applyOverrides(r),t.widget.addCustomCSSFile(e===k.SUPPORTED_THEME[0]?"night.css":"white.css"),t.widget.save((function(e){if(e&&e.charts&&0!==e.charts.length){var t=e.charts[0];L.TradeLocal.TRADE_KLINE_CONFIG=(0,y.default)(t)}}))}))},changeSymbol:function(){var e=this;this.widget?this.widget&&this.widget.onChartReady((function(){var t=e.widget,n=t.activeChart();if(n){n.resetData(),t._innerAPI();var r=L.TradeLocal.SWAP_KLINE_DRAWINGS_CONFIG;n.setSymbol(e.symbolInfo.symbol.replace("_","/").toUpperCase(),(function(){var t;e.restoreDrawings(n,r);var o=(null===(t=n._chartWidget)||void 0===t||null===(t=t._model)||void 0===t?void 0:t.m_model).m_mainSeries.priceScale().properties(),l=o.log._value,i=o.percentage._value;o.log.setValue(l),o.percentage.setValue(i)})),D.default.clear()}})):this.initTradingView()},destroyWidget:function(){var e=this.widget;e&&(e.unsubscribe("onAutoSaveNeeded"),e.unsubscribe("drawing_event"),e.remove(),this.widget=e=null)}},mounted:function(){var e=this;setTimeout((function(t){"undefined"!=typeof window&&"undefined"!=typeof localStorage&&"onstorage"in window&&window.addEventListener("storage",e.handleLocalStorageChange)}))},beforeDestroy:function(){D.default.clear(),"undefined"!=typeof window&&"undefined"!=typeof localStorage&&"onstorage"in window&&window.removeEventListener("storage",this.handleLocalStorageChange),this.destroyWidget()}}},4225:function(e,t,n){"use strict";n(0)(t,"__esModule",{value:!0}),t.staticRenderFns=t.render=void 0;t.render=function(){var e=this,t=e._self._c;return t("div",{ref:"chartWindow",class:["chartWindowTrade",e.isFullScreen?"full-screen":""]},[t("kline-menu",{attrs:{intervals:e.intervalButtons,"is-full-screen":e.isFullScreen,"current-interval-index":e.currentIntervalIndex},on:{"interval-change":e.handleIntervalChange}}),e._v(" "),t("trading-view",{ref:"widget"})],1)},t.staticRenderFns=[]},4226:function(e,t,n){"use strict";n(0)(t,"__esModule",{value:!0}),t.staticRenderFns=t.render=void 0;t.render=function(){var e=this,t=e._self._c;return t("div",{staticClass:"spot-kline__menu"},[t("ul",{staticClass:"spot-kline__menu-group"},e._l(e.intervals,(function(n,r){return t("li",{key:"interval"+r,class:["spot-kline__menu-item",e.currentIntervalIndex===r?"selected":""],on:{click:function(){return e.$emit("interval-change",r)}}},[e._v("\n      "+e._s(n.text)+"\n    ")])})),0),e._v(" "),t("ul",{staticClass:"spot-kline__menu-group"},[t("client-only",[t("el-tooltip",{attrs:{placement:"top","popper-class":"swap",effect:"black"==e.newTheme?"dark":"light"}},[t("p",{attrs:{slot:"content"},slot:"content"},[e._v(e._s(e.$t("contract.trade.kline_chart_properties")))]),e._v(" "),t("li",{staticClass:"spot-kline__menu-item",on:{click:function(t){return e.$parent.delegateOpenSetting()}}},[t("i",{staticClass:"iconfont icon-tubiaoshuxing"})])]),e._v(" "),t("el-tooltip",{attrs:{placement:"top","popper-class":"swap",effect:"black"==e.newTheme?"dark":"light"}},[t("p",{attrs:{slot:"content"},slot:"content"},[e._v(e._s(e.$t("contract.trade.kline_indicators")))]),e._v(" "),t("li",{staticClass:"spot-kline__menu-item",on:{click:function(t){return e.$parent.delegateOpenStudy()}}},[t("i",{staticClass:"iconfont icon-zhibiao"})])]),e._v(" "),t("li",{staticClass:"spot-kline__menu-item",on:{click:function(t){return e.$parent.delegateFullScreen()}}},[e.isFullScreen?t("i",{staticClass:"iconfont icon-close2"}):t("i",{staticClass:"iconfont icon-quanping"})])],1)],1)])},t.staticRenderFns=[]},4227:function(e,t,n){e.exports={regularFont:"Roboto-Regular, Arial-Regular, -apple-system, BlinkMacSystemFont, sans-serif",mediumFont:"Roboto-Medium, Arial-Medium, -apple-system, BlinkMacSystemFont, sans-serif",boldFont:"Roboto-Bold, Arial-Bold, -apple-system, BlinkMacSystemFont, sans-serif"}},4228:function(e,t,n){"use strict";n(0)(t,"__esModule",{value:!0}),t.staticRenderFns=t.render=void 0;t.render=function(){return(0,this._self._c)("div",{attrs:{id:"main_chart"}})},t.staticRenderFns=[]},4229:function(e,t,n){e.exports={regularFont:"Roboto-Regular, Arial-Regular, -apple-system, BlinkMacSystemFont, sans-serif",mediumFont:"Roboto-Medium, Arial-Medium, -apple-system, BlinkMacSystemFont, sans-serif",boldFont:"Roboto-Bold, Arial-Bold, -apple-system, BlinkMacSystemFont, sans-serif"}},4230:function(e,t,n){},5079:function(e,t,n){"use strict";n.r(t);var r=n(5080),o=n(3414);for(var l in o)["default"].indexOf(l)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(l);n(5087);var c=n(11),component=Object(c.a)(o.default,r.render,r.staticRenderFns,!1,null,"04e09d88",null);t.default=component.exports},5080:function(e,t,n){"use strict";var r=n(4225);n.o(r,"render")&&n.d(t,"render",(function(){return r.render})),n.o(r,"staticRenderFns")&&n.d(t,"staticRenderFns",(function(){return r.staticRenderFns}))},5081:function(e,t,n){"use strict";n.r(t);var r=n(5082),o=n(3416);for(var l in o)["default"].indexOf(l)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(l);n(5083);var c=n(11),component=Object(c.a)(o.default,r.render,r.staticRenderFns,!1,null,null,null);t.default=component.exports},5082:function(e,t,n){"use strict";var r=n(4226);n.o(r,"render")&&n.d(t,"render",(function(){return r.render})),n.o(r,"staticRenderFns")&&n.d(t,"staticRenderFns",(function(){return r.staticRenderFns}))},5083:function(e,t,n){"use strict";n(4227)},5084:function(e,t,n){"use strict";n.r(t);var r=n(5085),o=n(3418);for(var l in o)["default"].indexOf(l)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(l);n(5086);var c=n(11),component=Object(c.a)(o.default,r.render,r.staticRenderFns,!1,null,null,null);t.default=component.exports},5085:function(e,t,n){"use strict";var r=n(4228);n.o(r,"render")&&n.d(t,"render",(function(){return r.render})),n.o(r,"staticRenderFns")&&n.d(t,"staticRenderFns",(function(){return r.staticRenderFns}))},5086:function(e,t,n){"use strict";n(4229)},5087:function(e,t,n){"use strict";n(4230)}}]);
//# sourceMappingURL=416ddb1.js.map