Files
DinQuant/frontend/dist/js/99-legacy.4dc22e38.js
T
TIANHE b7451c63fb fix: Fix trading precision issues and improve error handling
- Fix quantity precision calculation for Binance, OKX, Bybit, Bitget, Deepcoin exchanges
- Improve OpenRouter API error handling with detailed error messages
- Add SECRET_KEY validation in Docker deployment entrypoint
- Fix K-line chart measurement tool click issue
- Adapt billing page text colors for dark theme
- Update frontend build files
2026-03-12 00:02:53 +08:00

18 lines
613 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(self["webpackChunkvue_antd_pro"]=self["webpackChunkvue_antd_pro"]||[]).push([[99],{6372:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){
/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/
return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function i(t){if(255===(t>>24&255)){var e=t>>16&255,i=t>>8&255,n=255&t;255===e?(e=0,255===i?(i=0,255===n?n=0:++n):++i):++e,t=0,t+=e<<16,t+=i<<8,t+=n}else t+=1<<24;return t}function n(t){return 0===(t[0]=i(t[0]))&&(t[1]=i(t[1])),t}var r=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,r=i.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),n(o);var s=o.slice(0);i.encryptBlock(s,0);for(var l=0;l<r;l++)t[e+l]^=s[l]}});return e.Decryptor=r,e}(),t.mode.CTRGladman})},6440:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){if("function"==typeof ArrayBuffer){var e=t,i=e.lib,n=i.WordArray,r=n.init,a=n.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!==typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,i=[],n=0;n<e;n++)i[n>>>2]|=t[n]<<24-n%4*8;r.call(this,i,e)}else r.apply(this,arguments)};a.prototype=n}}(),t.lib.WordArray})},7628:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=i.BlockCipher,a=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=r.extend({_doReset:function(){for(var t=this._key,e=t.words,i=[],n=0;n<56;n++){var r=o[n]-1;i[n]=e[r>>>5]>>>31-r%32&1}for(var a=this._subKeys=[],c=0;c<16;c++){var u=a[c]=[],d=l[c];for(n=0;n<24;n++)u[n/6|0]|=i[(s[n]-1+d)%28]<<31-n%6,u[4+(n/6|0)]|=i[28+(s[n+24]-1+d)%28]<<31-n%6;u[0]=u[0]<<1|u[0]>>>31;for(n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(n=0;n<16;n++)h[n]=a[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,i){this._lBlock=t[e],this._rBlock=t[e+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var r=i[n],a=this._lBlock,o=this._rBlock,s=0,l=0;l<8;l++)s|=c[l][((o^r[l])&u[l])>>>0];this._lBlock=o,this._rBlock=a^s}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(t,e){var i=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=i,this._lBlock^=i<<t}function p(t,e){var i=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=i,this._rBlock^=i<<t}e.DES=r._createHelper(d);var f=a.TripleDES=r.extend({_doReset:function(){var t=this._key,e=t.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var i=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),a=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(i)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(a))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),t.TripleDES})},10482:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.Iso97971={pad:function(e,i){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,i)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})},15237:function(t){(function(e,i){t.exports=i()})(0,function(){"use strict";var t=navigator.userAgent,e=navigator.platform,i=/gecko\/\d/i.test(t),n=/MSIE \d/.test(t),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),a=/Edge\/(\d+)/.exec(t),o=n||r||a,s=o&&(n?document.documentMode||6:+(a||r)[1]),l=!a&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!a&&/Chrome\/(\d+)/.exec(t),d=u&&+u[1],h=/Opera\//.test(t),p=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),v=/PhantomJS/.test(t),g=p&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),m=/Android/.test(t),y=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),b=g||/Mac/.test(e),x=/\bCrOS\b/.test(t),_=/win/i.test(e),w=h&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(h=!1,l=!0);var C=b&&(c||h&&(null==w||w<12.11)),S=i||o&&s>=9;function k(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var A,T=function(t,e){var i=t.className,n=k(e).exec(i);if(n){var r=i.slice(n.index+n[0].length);t.className=i.slice(0,n.index)+(r?n[1]+r:"")}};function M(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function I(t,e){return M(t).appendChild(e)}function E(t,e,i,n){var r=document.createElement(t);if(i&&(r.className=i),n&&(r.style.cssText=n),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var a=0;a<e.length;++a)r.appendChild(e[a]);return r}function D(t,e,i,n){var r=E(t,e,i,n);return r.setAttribute("role","presentation"),r}function P(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function L(t){var e,i=t.ownerDocument||t;try{e=t.activeElement}catch(n){e=i.body||null}while(e&&e.shadowRoot&&e.shadowRoot.activeElement)e=e.shadowRoot.activeElement;return e}function R(t,e){var i=t.className;k(e).test(i)||(t.className+=(i?" ":"")+e)}function F(t,e){for(var i=t.split(" "),n=0;n<i.length;n++)i[n]&&!k(i[n]).test(e)&&(e+=" "+i[n]);return e}A=document.createRange?function(t,e,i,n){var r=document.createRange();return r.setEnd(n||t,i),r.setStart(t,e),r}:function(t,e,i){var n=document.body.createTextRange();try{n.moveToElementText(t.parentNode)}catch(r){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",e),n};var B=function(t){t.select()};function N(t){return t.display.wrapper.ownerDocument}function O(t){return z(t.display.wrapper)}function z(t){return t.getRootNode?t.getRootNode():t.ownerDocument}function W(t){return N(t).defaultView}function $(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function H(t,e,i){for(var n in e||(e={}),t)!t.hasOwnProperty(n)||!1===i&&e.hasOwnProperty(n)||(e[n]=t[n]);return e}function V(t,e,i,n,r){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var a=n||0,o=r||0;;){var s=t.indexOf("\t",a);if(s<0||s>=e)return o+(e-a);o+=s-a,o+=i-o%i,a=s+1}}g?B=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:o&&(B=function(t){try{t.select()}catch(e){}});var K=function(){this.id=null,this.f=null,this.time=0,this.handler=$(this.onTimeout,this)};function Y(t,e){for(var i=0;i<t.length;++i)if(t[i]==e)return i;return-1}K.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},K.prototype.set=function(t,e){this.f=e;var i=+new Date+t;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=i)};var X=50,U={toString:function(){return"CodeMirror.Pass"}},G={scroll:!1},j={origin:"*mouse"},q={origin:"+move"};function Z(t,e,i){for(var n=0,r=0;;){var a=t.indexOf("\t",n);-1==a&&(a=t.length);var o=a-n;if(a==t.length||r+o>=e)return n+Math.min(o,e-r);if(r+=a-n,r+=i-r%i,n=a+1,r>=e)return n}}var J=[""];function Q(t){while(J.length<=t)J.push(tt(J)+" ");return J[t]}function tt(t){return t[t.length-1]}function et(t,e){for(var i=[],n=0;n<t.length;n++)i[n]=e(t[n],n);return i}function it(t,e,i){var n=0,r=i(e);while(n<t.length&&i(t[n])<=r)n++;t.splice(n,0,e)}function nt(){}function rt(t,e){var i;return Object.create?i=Object.create(t):(nt.prototype=t,i=new nt),e&&H(e,i),i}var at=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ot(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||at.test(t))}function st(t,e){return e?!!(e.source.indexOf("\\w")>-1&&ot(t))||e.test(t):ot(t)}function lt(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var ct=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ut(t){return t.charCodeAt(0)>=768&&ct.test(t)}function dt(t,e,i){while((i<0?e>0:e<t.length)&&ut(t.charAt(e)))e+=i;return e}function ht(t,e,i){for(var n=e>i?-1:1;;){if(e==i)return e;var r=(e+i)/2,a=n<0?Math.ceil(r):Math.floor(r);if(a==e)return t(a)?e:i;t(a)?i=a:e=a+n}}function pt(t,e,i,n){if(!t)return n(e,i,"ltr",0);for(var r=!1,a=0;a<t.length;++a){var o=t[a];(o.from<i&&o.to>e||e==i&&o.to==e)&&(n(Math.max(o.from,e),Math.min(o.to,i),1==o.level?"rtl":"ltr",a),r=!0)}r||n(e,i,"ltr")}var ft=null;function vt(t,e,i){var n;ft=null;for(var r=0;r<t.length;++r){var a=t[r];if(a.from<e&&a.to>e)return r;a.to==e&&(a.from!=a.to&&"before"==i?n=r:ft=r),a.from==e&&(a.from!=a.to&&"before"!=i?n=r:ft=r)}return null!=n?n:ft}var gt=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(i){return i<=247?t.charAt(i):1424<=i&&i<=1524?"R":1536<=i&&i<=1785?e.charAt(i-1536):1774<=i&&i<=2220?"r":8192<=i&&i<=8203?"w":8204==i?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,a=/[LRr]/,o=/[Lb1n]/,s=/[1n]/;function l(t,e,i){this.level=t,this.from=e,this.to=i}return function(t,e){var c="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!n.test(t))return!1;for(var u=t.length,d=[],h=0;h<u;++h)d.push(i(t.charCodeAt(h)));for(var p=0,f=c;p<u;++p){var v=d[p];"m"==v?d[p]=f:f=v}for(var g=0,m=c;g<u;++g){var y=d[g];"1"==y&&"r"==m?d[g]="n":a.test(y)&&(m=y,"r"==y&&(d[g]="R"))}for(var b=1,x=d[0];b<u-1;++b){var _=d[b];"+"==_&&"1"==x&&"1"==d[b+1]?d[b]="1":","!=_||x!=d[b+1]||"1"!=x&&"n"!=x||(d[b]=x),x=_}for(var w=0;w<u;++w){var C=d[w];if(","==C)d[w]="N";else if("%"==C){var S=void 0;for(S=w+1;S<u&&"%"==d[S];++S);for(var k=w&&"!"==d[w-1]||S<u&&"1"==d[S]?"1":"N",A=w;A<S;++A)d[A]=k;w=S-1}}for(var T=0,M=c;T<u;++T){var I=d[T];"L"==M&&"1"==I?d[T]="L":a.test(I)&&(M=I)}for(var E=0;E<u;++E)if(r.test(d[E])){var D=void 0;for(D=E+1;D<u&&r.test(d[D]);++D);for(var P="L"==(E?d[E-1]:c),L="L"==(D<u?d[D]:c),R=P==L?P?"L":"R":c,F=E;F<D;++F)d[F]=R;E=D-1}for(var B,N=[],O=0;O<u;)if(o.test(d[O])){var z=O;for(++O;O<u&&o.test(d[O]);++O);N.push(new l(0,z,O))}else{var W=O,$=N.length,H="rtl"==e?1:0;for(++O;O<u&&"L"!=d[O];++O);for(var V=W;V<O;)if(s.test(d[V])){W<V&&(N.splice($,0,new l(1,W,V)),$+=H);var K=V;for(++V;V<O&&s.test(d[V]);++V);N.splice($,0,new l(2,K,V)),$+=H,W=V}else++V;W<O&&N.splice($,0,new l(1,W,O))}return"ltr"==e&&(1==N[0].level&&(B=t.match(/^\s+/))&&(N[0].from=B[0].length,N.unshift(new l(0,0,B[0].length))),1==tt(N).level&&(B=t.match(/\s+$/))&&(tt(N).to-=B[0].length,N.push(new l(0,u-B[0].length,u)))),"rtl"==e?N.reverse():N}}();function mt(t,e){var i=t.order;return null==i&&(i=t.order=gt(t.text,e)),i}var yt=[],bt=function(t,e,i){if(t.addEventListener)t.addEventListener(e,i,!1);else if(t.attachEvent)t.attachEvent("on"+e,i);else{var n=t._handlers||(t._handlers={});n[e]=(n[e]||yt).concat(i)}};function xt(t,e){return t._handlers&&t._handlers[e]||yt}function _t(t,e,i){if(t.removeEventListener)t.removeEventListener(e,i,!1);else if(t.detachEvent)t.detachEvent("on"+e,i);else{var n=t._handlers,r=n&&n[e];if(r){var a=Y(r,i);a>-1&&(n[e]=r.slice(0,a).concat(r.slice(a+1)))}}}function wt(t,e){var i=xt(t,e);if(i.length)for(var n=Array.prototype.slice.call(arguments,2),r=0;r<i.length;++r)i[r].apply(null,n)}function Ct(t,e,i){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),wt(t,i||e.type,t,e),It(e)||e.codemirrorIgnore}function St(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var i=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),n=0;n<e.length;++n)-1==Y(i,e[n])&&i.push(e[n])}function kt(t,e){return xt(t,e).length>0}function At(t){t.prototype.on=function(t,e){bt(this,t,e)},t.prototype.off=function(t,e){_t(this,t,e)}}function Tt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Mt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function It(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Et(t){Tt(t),Mt(t)}function Dt(t){return t.target||t.srcElement}function Pt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),b&&t.ctrlKey&&1==e&&(e=3),e}var Lt,Rt,Ft=function(){if(o&&s<9)return!1;var t=E("div");return"draggable"in t||"dragDrop"in t}();function Bt(t){if(null==Lt){var e=E("span","");I(t,E("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Lt=e.offsetWidth<=1&&e.offsetHeight>2&&!(o&&s<8))}var i=Lt?E("span",""):E("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Nt(t){if(null!=Rt)return Rt;var e=I(t,document.createTextNode("AخA")),i=A(e,0,1).getBoundingClientRect(),n=A(e,1,2).getBoundingClientRect();return M(t),!(!i||i.left==i.right)&&(Rt=n.right-i.right<3)}var Ot=3!="\n\nb".split(/\n/).length?function(t){var e=0,i=[],n=t.length;while(e<=n){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var a=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),o=a.indexOf("\r");-1!=o?(i.push(a.slice(0,o)),e+=o+1):(i.push(a),e=r+1)}return i}:function(t){return t.split(/\r\n?|\n/)},zt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(i){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Wt=function(){var t=E("div");return"oncopy"in t||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),$t=null;function Ht(t){if(null!=$t)return $t;var e=I(t,E("span","x")),i=e.getBoundingClientRect(),n=A(e,0,1).getBoundingClientRect();return $t=Math.abs(i.left-n.left)>1}var Vt={},Kt={};function Yt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Vt[t]=e}function Xt(t,e){Kt[t]=e}function Ut(t){if("string"==typeof t&&Kt.hasOwnProperty(t))t=Kt[t];else if(t&&"string"==typeof t.name&&Kt.hasOwnProperty(t.name)){var e=Kt[t.name];"string"==typeof e&&(e={name:e}),t=rt(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Ut("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Ut("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Gt(t,e){e=Ut(e);var i=Vt[e.name];if(!i)return Gt(t,"text/plain");var n=i(t,e);if(jt.hasOwnProperty(e.name)){var r=jt[e.name];for(var a in r)r.hasOwnProperty(a)&&(n.hasOwnProperty(a)&&(n["_"+a]=n[a]),n[a]=r[a])}if(n.name=e.name,e.helperType&&(n.helperType=e.helperType),e.modeProps)for(var o in e.modeProps)n[o]=e.modeProps[o];return n}var jt={};function qt(t,e){var i=jt.hasOwnProperty(t)?jt[t]:jt[t]={};H(e,i)}function Zt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var i={};for(var n in e){var r=e[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i}function Jt(t,e){var i;while(t.innerMode){if(i=t.innerMode(e),!i||i.mode==t)break;e=i.state,t=i.mode}return i||{mode:t,state:e}}function Qt(t,e,i){return!t.startState||t.startState(e,i)}var te=function(t,e,i){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};function ee(t,e){if(e-=t.first,e<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");var i=t;while(!i.lines)for(var n=0;;++n){var r=i.children[n],a=r.chunkSize();if(e<a){i=r;break}e-=a}return i.lines[e]}function ie(t,e,i){var n=[],r=e.line;return t.iter(e.line,i.line+1,function(t){var a=t.text;r==i.line&&(a=a.slice(0,i.ch)),r==e.line&&(a=a.slice(e.ch)),n.push(a),++r}),n}function ne(t,e,i){var n=[];return t.iter(e,i,function(t){n.push(t.text)}),n}function re(t,e){var i=e-t.height;if(i)for(var n=t;n;n=n.parent)n.height+=i}function ae(t){if(null==t.parent)return null;for(var e=t.parent,i=Y(e.lines,t),n=e.parent;n;e=n,n=n.parent)for(var r=0;;++r){if(n.children[r]==e)break;i+=n.children[r].chunkSize()}return i+e.first}function oe(t,e){var i=t.first;t:do{for(var n=0;n<t.children.length;++n){var r=t.children[n],a=r.height;if(e<a){t=r;continue t}e-=a,i+=r.chunkSize()}return i}while(!t.lines);for(var o=0;o<t.lines.length;++o){var s=t.lines[o],l=s.height;if(e<l)break;e-=l}return i+o}function se(t,e){return e>=t.first&&e<t.first+t.size}function le(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function ce(t,e,i){if(void 0===i&&(i=null),!(this instanceof ce))return new ce(t,e,i);this.line=t,this.ch=e,this.sticky=i}function ue(t,e){return t.line-e.line||t.ch-e.ch}function de(t,e){return t.sticky==e.sticky&&0==ue(t,e)}function he(t){return ce(t.line,t.ch)}function pe(t,e){return ue(t,e)<0?e:t}function fe(t,e){return ue(t,e)<0?t:e}function ve(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function ge(t,e){if(e.line<t.first)return ce(t.first,0);var i=t.first+t.size-1;return e.line>i?ce(i,ee(t,i).text.length):me(e,ee(t,e.line).text.length)}function me(t,e){var i=t.ch;return null==i||i>e?ce(t.line,e):i<0?ce(t.line,0):t}function ye(t,e){for(var i=[],n=0;n<e.length;n++)i[n]=ge(t,e[n]);return i}te.prototype.eol=function(){return this.pos>=this.string.length},te.prototype.sol=function(){return this.pos==this.lineStart},te.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},te.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},te.prototype.eat=function(t){var e,i=this.string.charAt(this.pos);if(e="string"==typeof t?i==t:i&&(t.test?t.test(i):t(i)),e)return++this.pos,i},te.prototype.eatWhile=function(t){var e=this.pos;while(this.eat(t));return this.pos>e},te.prototype.eatSpace=function(){var t=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>t},te.prototype.skipToEnd=function(){this.pos=this.string.length},te.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},te.prototype.backUp=function(t){this.pos-=t},te.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},te.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},te.prototype.match=function(t,e,i){if("string"!=typeof t){var n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&!1!==e&&(this.pos+=n[0].length),n)}var r=function(t){return i?t.toLowerCase():t},a=this.string.substr(this.pos,t.length);if(r(a)==r(t))return!1!==e&&(this.pos+=t.length),!0},te.prototype.current=function(){return this.string.slice(this.start,this.pos)},te.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},te.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},te.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var be=function(t,e){this.state=t,this.lookAhead=e},xe=function(t,e,i,n){this.state=e,this.doc=t,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function _e(t,e,i,n){var r=[t.state.modeGen],a={};Ee(t,e.text,t.doc.mode,i,function(t,e){return r.push(t,e)},a,n);for(var o=i.state,s=function(n){i.baseTokens=r;var s=t.state.overlays[n],l=1,c=0;i.state=!0,Ee(t,e.text,s.mode,i,function(t,e){var i=l;while(c<t){var n=r[l];n>t&&r.splice(l,1,t,r[l+1],n),l+=2,c=Math.min(t,n)}if(e)if(s.opaque)r.splice(i,l-i,t,"overlay "+e),l=i+2;else for(;i<l;i+=2){var a=r[i+1];r[i+1]=(a?a+" ":"")+"overlay "+e}},a),i.state=o,i.baseTokens=null,i.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)s(l);return{styles:r,classes:a.bgClass||a.textClass?a:null}}function we(t,e,i){if(!e.styles||e.styles[0]!=t.state.modeGen){var n=Ce(t,ae(e)),r=e.text.length>t.options.maxHighlightLength&&Zt(t.doc.mode,n.state),a=_e(t,e,n);r&&(n.state=r),e.stateAfter=n.save(!r),e.styles=a.styles,a.classes?e.styleClasses=a.classes:e.styleClasses&&(e.styleClasses=null),i===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Ce(t,e,i){var n=t.doc,r=t.display;if(!n.mode.startState)return new xe(n,!0,e);var a=De(t,e,i),o=a>n.first&&ee(n,a-1).stateAfter,s=o?xe.fromSaved(n,o,a):new xe(n,Qt(n.mode),a);return n.iter(a,e,function(i){Se(t,i.text,s);var n=s.line;i.stateAfter=n==e-1||n%5==0||n>=r.viewFrom&&n<r.viewTo?s.save():null,s.nextLine()}),i&&(n.modeFrontier=s.line),s}function Se(t,e,i,n){var r=t.doc.mode,a=new te(e,t.options.tabSize,i);a.start=a.pos=n||0,""==e&&ke(r,i.state);while(!a.eol())Ae(r,a,i.state),a.start=a.pos}function ke(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var i=Jt(t,e);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function Ae(t,e,i,n){for(var r=0;r<10;r++){n&&(n[0]=Jt(t,i).mode);var a=t.token(e,i);if(e.pos>e.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}xe.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},xe.prototype.baseToken=function(t){if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=t)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},xe.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},xe.fromSaved=function(t,e,i){return e instanceof be?new xe(t,Zt(t.mode,e.state),i,e.lookAhead):new xe(t,Zt(t.mode,e),i)},xe.prototype.save=function(t){var e=!1!==t?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new be(e,this.maxLookAhead):e};var Te=function(t,e,i){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=i};function Me(t,e,i,n){var r,a=t.doc,o=a.mode;e=ge(a,e);var s,l=ee(a,e.line),c=Ce(t,e.line,i),u=new te(l.text,t.options.tabSize,c);n&&(s=[]);while((n||u.pos<e.ch)&&!u.eol())u.start=u.pos,r=Ae(o,u,c.state),n&&s.push(new Te(u,r,Zt(a.mode,c.state)));return n?s:new Te(u,r,c.state)}function Ie(t,e){if(t)for(;;){var i=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;t=t.slice(0,i.index)+t.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";null==e[n]?e[n]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(e[n])||(e[n]+=" "+i[2])}return t}function Ee(t,e,i,n,r,a,o){var s=i.flattenSpans;null==s&&(s=t.options.flattenSpans);var l,c=0,u=null,d=new te(e,t.options.tabSize,n),h=t.options.addModeClass&&[null];""==e&&Ie(ke(i,n.state),a);while(!d.eol()){if(d.pos>t.options.maxHighlightLength?(s=!1,o&&Se(t,e,n,d.pos),d.pos=e.length,l=null):l=Ie(Ae(i,d,n.state,h),a),h){var p=h[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){while(c<d.start)c=Math.min(d.start,c+5e3),r(c,u);u=l}d.start=d.pos}while(c<d.pos){var f=Math.min(d.pos,c+5e3);r(f,u),c=f}}function De(t,e,i){for(var n,r,a=t.doc,o=i?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>o;--s){if(s<=a.first)return a.first;var l=ee(a,s-1),c=l.stateAfter;if(c&&(!i||s+(c instanceof be?c.lookAhead:0)<=a.modeFrontier))return s;var u=V(l.text,null,t.options.tabSize);(null==r||n>u)&&(r=s-1,n=u)}return r}function Pe(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var i=t.first,n=e-1;n>i;n--){var r=ee(t,n).stateAfter;if(r&&(!(r instanceof be)||n+r.lookAhead<e)){i=n+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,i)}}var Le=!1,Re=!1;function Fe(){Le=!0}function Be(){Re=!0}function Ne(t,e,i){this.marker=t,this.from=e,this.to=i}function Oe(t,e){if(t)for(var i=0;i<t.length;++i){var n=t[i];if(n.marker==e)return n}}function ze(t,e){for(var i,n=0;n<t.length;++n)t[n]!=e&&(i||(i=[])).push(t[n]);return i}function We(t,e,i){var n=i&&window.WeakSet&&(i.markedSpans||(i.markedSpans=new WeakSet));n&&t.markedSpans&&n.has(t.markedSpans)?t.markedSpans.push(e):(t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],n&&n.add(t.markedSpans)),e.marker.attachLine(t)}function $e(t,e,i){var n;if(t)for(var r=0;r<t.length;++r){var a=t[r],o=a.marker,s=null==a.from||(o.inclusiveLeft?a.from<=e:a.from<e);if(s||a.from==e&&"bookmark"==o.type&&(!i||!a.marker.insertLeft)){var l=null==a.to||(o.inclusiveRight?a.to>=e:a.to>e);(n||(n=[])).push(new Ne(o,a.from,l?null:a.to))}}return n}function He(t,e,i){var n;if(t)for(var r=0;r<t.length;++r){var a=t[r],o=a.marker,s=null==a.to||(o.inclusiveRight?a.to>=e:a.to>e);if(s||a.from==e&&"bookmark"==o.type&&(!i||a.marker.insertLeft)){var l=null==a.from||(o.inclusiveLeft?a.from<=e:a.from<e);(n||(n=[])).push(new Ne(o,l?null:a.from-e,null==a.to?null:a.to-e))}}return n}function Ve(t,e){if(e.full)return null;var i=se(t,e.from.line)&&ee(t,e.from.line).markedSpans,n=se(t,e.to.line)&&ee(t,e.to.line).markedSpans;if(!i&&!n)return null;var r=e.from.ch,a=e.to.ch,o=0==ue(e.from,e.to),s=$e(i,r,o),l=He(n,a,o),c=1==e.text.length,u=tt(e.text).length+(c?r:0);if(s)for(var d=0;d<s.length;++d){var h=s[d];if(null==h.to){var p=Oe(l,h.marker);p?c&&(h.to=null==p.to?null:p.to+u):h.to=r}}if(l)for(var f=0;f<l.length;++f){var v=l[f];if(null!=v.to&&(v.to+=u),null==v.from){var g=Oe(s,v.marker);g||(v.from=u,c&&(s||(s=[])).push(v))}else v.from+=u,c&&(s||(s=[])).push(v)}s&&(s=Ke(s)),l&&l!=s&&(l=Ke(l));var m=[s];if(!c){var y,b=e.text.length-2;if(b>0&&s)for(var x=0;x<s.length;++x)null==s[x].to&&(y||(y=[])).push(new Ne(s[x].marker,null,null));for(var _=0;_<b;++_)m.push(y);m.push(l)}return m}function Ke(t){for(var e=0;e<t.length;++e){var i=t[e];null!=i.from&&i.from==i.to&&!1!==i.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function Ye(t,e,i){var n=null;if(t.iter(e.line,i.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var i=t.markedSpans[e].marker;!i.readOnly||n&&-1!=Y(n,i)||(n||(n=[])).push(i)}}),!n)return null;for(var r=[{from:e,to:i}],a=0;a<n.length;++a)for(var o=n[a],s=o.find(0),l=0;l<r.length;++l){var c=r[l];if(!(ue(c.to,s.from)<0||ue(c.from,s.to)>0)){var u=[l,1],d=ue(c.from,s.from),h=ue(c.to,s.to);(d<0||!o.inclusiveLeft&&!d)&&u.push({from:c.from,to:s.from}),(h>0||!o.inclusiveRight&&!h)&&u.push({from:s.to,to:c.to}),r.splice.apply(r,u),l+=u.length-3}}return r}function Xe(t){var e=t.markedSpans;if(e){for(var i=0;i<e.length;++i)e[i].marker.detachLine(t);t.markedSpans=null}}function Ue(t,e){if(e){for(var i=0;i<e.length;++i)e[i].marker.attachLine(t);t.markedSpans=e}}function Ge(t){return t.inclusiveLeft?-1:0}function je(t){return t.inclusiveRight?1:0}function qe(t,e){var i=t.lines.length-e.lines.length;if(0!=i)return i;var n=t.find(),r=e.find(),a=ue(n.from,r.from)||Ge(t)-Ge(e);if(a)return-a;var o=ue(n.to,r.to)||je(t)-je(e);return o||e.id-t.id}function Ze(t,e){var i,n=Re&&t.markedSpans;if(n)for(var r=void 0,a=0;a<n.length;++a)r=n[a],r.marker.collapsed&&null==(e?r.from:r.to)&&(!i||qe(i,r.marker)<0)&&(i=r.marker);return i}function Je(t){return Ze(t,!0)}function Qe(t){return Ze(t,!1)}function ti(t,e){var i,n=Re&&t.markedSpans;if(n)for(var r=0;r<n.length;++r){var a=n[r];a.marker.collapsed&&(null==a.from||a.from<e)&&(null==a.to||a.to>e)&&(!i||qe(i,a.marker)<0)&&(i=a.marker)}return i}function ei(t,e,i,n,r){var a=ee(t,e),o=Re&&a.markedSpans;if(o)for(var s=0;s<o.length;++s){var l=o[s];if(l.marker.collapsed){var c=l.marker.find(0),u=ue(c.from,i)||Ge(l.marker)-Ge(r),d=ue(c.to,n)||je(l.marker)-je(r);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ue(c.to,i)>=0:ue(c.to,i)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ue(c.from,n)<=0:ue(c.from,n)<0)))return!0}}}function ii(t){var e;while(e=Je(t))t=e.find(-1,!0).line;return t}function ni(t){var e;while(e=Qe(t))t=e.find(1,!0).line;return t}function ri(t){var e,i;while(e=Qe(t))t=e.find(1,!0).line,(i||(i=[])).push(t);return i}function ai(t,e){var i=ee(t,e),n=ii(i);return i==n?e:ae(n)}function oi(t,e){if(e>t.lastLine())return e;var i,n=ee(t,e);if(!si(t,n))return e;while(i=Qe(n))n=i.find(1,!0).line;return ae(n)+1}function si(t,e){var i=Re&&e.markedSpans;if(i)for(var n=void 0,r=0;r<i.length;++r)if(n=i[r],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&li(t,e,n))return!0}}function li(t,e,i){if(null==i.to){var n=i.marker.find(1,!0);return li(t,n.line,Oe(n.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==e.text.length)return!0;for(var r=void 0,a=0;a<e.markedSpans.length;++a)if(r=e.markedSpans[a],r.marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(null==r.to||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&li(t,e,r))return!0}function ci(t){t=ii(t);for(var e=0,i=t.parent,n=0;n<i.lines.length;++n){var r=i.lines[n];if(r==t)break;e+=r.height}for(var a=i.parent;a;i=a,a=i.parent)for(var o=0;o<a.children.length;++o){var s=a.children[o];if(s==i)break;e+=s.height}return e}function ui(t){if(0==t.height)return 0;var e,i=t.text.length,n=t;while(e=Je(n)){var r=e.find(0,!0);n=r.from.line,i+=r.from.ch-r.to.ch}n=t;while(e=Qe(n)){var a=e.find(0,!0);i-=n.text.length-a.from.ch,n=a.to.line,i+=n.text.length-a.to.ch}return i}function di(t){var e=t.display,i=t.doc;e.maxLine=ee(i,i.first),e.maxLineLength=ui(e.maxLine),e.maxLineChanged=!0,i.iter(function(t){var i=ui(t);i>e.maxLineLength&&(e.maxLineLength=i,e.maxLine=t)})}var hi=function(t,e,i){this.text=t,Ue(this,e),this.height=i?i(this):1};function pi(t,e,i,n){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Xe(t),Ue(t,i);var r=n?n(t):1;r!=t.height&&re(t,r)}function fi(t){t.parent=null,Xe(t)}hi.prototype.lineNo=function(){return ae(this)},At(hi);var vi={},gi={};function mi(t,e){if(!t||/^\s*$/.test(t))return null;var i=e.addModeClass?gi:vi;return i[t]||(i[t]=t.replace(/\S+/g,"cm-$&"))}function yi(t,e){var i=D("span",null,null,l?"padding-right: .1px":null),n={pre:D("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var r=0;r<=(e.rest?e.rest.length:0);r++){var a=r?e.rest[r-1]:e.line,o=void 0;n.pos=0,n.addToken=xi,Nt(t.display.measure)&&(o=mt(a,t.doc.direction))&&(n.addToken=wi(n.addToken,o)),n.map=[];var s=e!=t.display.externalMeasured&&ae(a);Si(a,n,we(t,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=F(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=F(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Bt(t.display.measure))),0==r?(e.measure.map=n.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(n.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var c=n.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return wt(t,"renderLine",t,e.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function bi(t){var e=E("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function xi(t,e,i,n,r,a,l){if(e){var c,u=t.splitSpaces?_i(e,t.trailingSpace):e,d=t.cm.state.specialChars,h=!1;if(d.test(e)){c=document.createDocumentFragment();var p=0;while(1){d.lastIndex=p;var f=d.exec(e),v=f?f.index-p:e.length-p;if(v){var g=document.createTextNode(u.slice(p,p+v));o&&s<9?c.appendChild(E("span",[g])):c.appendChild(g),t.map.push(t.pos,t.pos+v,g),t.col+=v,t.pos+=v}if(!f)break;p+=v+1;var m=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,b=y-t.col%y;m=c.appendChild(E("span",Q(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),t.col+=b}else"\r"==f[0]||"\n"==f[0]?(m=c.appendChild(E("span","\r"==f[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",f[0]),t.col+=1):(m=t.cm.options.specialCharPlaceholder(f[0]),m.setAttribute("cm-text",f[0]),o&&s<9?c.appendChild(E("span",[m])):c.appendChild(m),t.col+=1);t.map.push(t.pos,t.pos+1,m),t.pos++}}else t.col+=e.length,c=document.createTextNode(u),t.map.push(t.pos,t.pos+e.length,c),o&&s<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==u.charCodeAt(e.length-1),i||n||r||h||a||l){var x=i||"";n&&(x+=n),r&&(x+=r);var _=E("span",[c],x,a);if(l)for(var w in l)l.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&_.setAttribute(w,l[w]);return t.content.appendChild(_)}t.content.appendChild(c)}}function _i(t,e){if(t.length>1&&!/ /.test(t))return t;for(var i=e,n="",r=0;r<t.length;r++){var a=t.charAt(r);" "!=a||!i||r!=t.length-1&&32!=t.charCodeAt(r+1)||(a=" "),n+=a,i=" "==a}return n}function wi(t,e){return function(i,n,r,a,o,s,l){r=r?r+" cm-force-border":"cm-force-border";for(var c=i.pos,u=c+n.length;;){for(var d=void 0,h=0;h<e.length;h++)if(d=e[h],d.to>c&&d.from<=c)break;if(d.to>=u)return t(i,n,r,a,o,s,l);t(i,n.slice(0,d.to-c),r,a,null,s,l),a=null,n=n.slice(d.to-c),c=d.to}}}function Ci(t,e,i,n){var r=!n&&i.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!n&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function Si(t,e,i){var n=t.markedSpans,r=t.text,a=0;if(n)for(var o,s,l,c,u,d,h,p=r.length,f=0,v=1,g="",m=0;;){if(m==f){l=c=u=s="",h=null,d=null,m=1/0;for(var y=[],b=void 0,x=0;x<n.length;++x){var _=n[x],w=_.marker;if("bookmark"==w.type&&_.from==f&&w.widgetNode)y.push(w);else if(_.from<=f&&(null==_.to||_.to>f||w.collapsed&&_.to==f&&_.from==f)){if(null!=_.to&&_.to!=f&&m>_.to&&(m=_.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&_.from==f&&(u+=" "+w.startStyle),w.endStyle&&_.to==m&&(b||(b=[])).push(w.endStyle,_.to),w.title&&((h||(h={})).title=w.title),w.attributes)for(var C in w.attributes)(h||(h={}))[C]=w.attributes[C];w.collapsed&&(!d||qe(d.marker,w)<0)&&(d=_)}else _.from>f&&m>_.from&&(m=_.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==m&&(c+=" "+b[S]);if(!d||d.from==f)for(var k=0;k<y.length;++k)Ci(e,0,y[k]);if(d&&(d.from||0)==f){if(Ci(e,(null==d.to?p+1:d.to)-f,d.marker,null==d.from),null==d.to)return;d.to==f&&(d=!1)}}if(f>=p)break;var A=Math.min(p,m);while(1){if(g){var T=f+g.length;if(!d){var M=T>A?g.slice(0,A-f):g;e.addToken(e,M,o?o+l:l,u,f+M.length==m?c:"",s,h)}if(T>=A){g=g.slice(A-f),f=A;break}f=T,u=""}g=r.slice(a,a=i[v++]),o=mi(i[v++],e.cm.options)}}else for(var I=1;I<i.length;I+=2)e.addToken(e,r.slice(a,a=i[I]),mi(i[I+1],e.cm.options))}function ki(t,e,i){this.line=e,this.rest=ri(e),this.size=this.rest?ae(tt(this.rest))-i+1:1,this.node=this.text=null,this.hidden=si(t,e)}function Ai(t,e,i){for(var n,r=[],a=e;a<i;a=n){var o=new ki(t.doc,ee(t.doc,a),a);n=a+o.size,r.push(o)}return r}var Ti=null;function Mi(t){Ti?Ti.ops.push(t):t.ownsGroup=Ti={ops:[t],delayedCallbacks:[]}}function Ii(t){var e=t.delayedCallbacks,i=0;do{for(;i<e.length;i++)e[i].call(null);for(var n=0;n<t.ops.length;n++){var r=t.ops[n];if(r.cursorActivityHandlers)while(r.cursorActivityCalled<r.cursorActivityHandlers.length)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(i<e.length)}function Ei(t,e){var i=t.ownsGroup;if(i)try{Ii(i)}finally{Ti=null,e(i)}}var Di=null;function Pi(t,e){var i=xt(t,e);if(i.length){var n,r=Array.prototype.slice.call(arguments,2);Ti?n=Ti.delayedCallbacks:Di?n=Di:(n=Di=[],setTimeout(Li,0));for(var a=function(t){n.push(function(){return i[t].apply(null,r)})},o=0;o<i.length;++o)a(o)}}function Li(){var t=Di;Di=null;for(var e=0;e<t.length;++e)t[e]()}function Ri(t,e,i,n){for(var r=0;r<e.changes.length;r++){var a=e.changes[r];"text"==a?Oi(t,e):"gutter"==a?Wi(t,e,i,n):"class"==a?zi(t,e):"widget"==a&&$i(t,e,n)}e.changes=null}function Fi(t){return t.node==t.text&&(t.node=E("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),o&&s<8&&(t.node.style.zIndex=2)),t.node}function Bi(t,e){var i=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),e.background)i?e.background.className=i:(e.background.parentNode.removeChild(e.background),e.background=null);else if(i){var n=Fi(e);e.background=n.insertBefore(E("div",null,i),n.firstChild),t.display.input.setUneditable(e.background)}}function Ni(t,e){var i=t.display.externalMeasured;return i&&i.line==e.line?(t.display.externalMeasured=null,e.measure=i.measure,i.built):yi(t,e)}function Oi(t,e){var i=e.text.className,n=Ni(t,e);e.text==e.node&&(e.node=n.pre),e.text.parentNode.replaceChild(n.pre,e.text),e.text=n.pre,n.bgClass!=e.bgClass||n.textClass!=e.textClass?(e.bgClass=n.bgClass,e.textClass=n.textClass,zi(t,e)):i&&(e.text.className=i)}function zi(t,e){Bi(t,e),e.line.wrapClass?Fi(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var i=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=i||""}function Wi(t,e,i,n){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var r=Fi(e);e.gutterBackground=E("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),r.insertBefore(e.gutterBackground,e.text)}var a=e.line.gutterMarkers;if(t.options.lineNumbers||a){var o=Fi(e),s=e.gutter=E("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(s.setAttribute("aria-hidden","true"),t.display.input.setUneditable(s),o.insertBefore(s,e.text),e.line.gutterClass&&(s.className+=" "+e.line.gutterClass),!t.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(e.lineNumber=s.appendChild(E("div",le(t.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),a)for(var l=0;l<t.display.gutterSpecs.length;++l){var c=t.display.gutterSpecs[l].className,u=a.hasOwnProperty(c)&&a[c];u&&s.appendChild(E("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function $i(t,e,i){e.alignable&&(e.alignable=null);for(var n=k("CodeMirror-linewidget"),r=e.node.firstChild,a=void 0;r;r=a)a=r.nextSibling,n.test(r.className)&&e.node.removeChild(r);Vi(t,e,i)}function Hi(t,e,i,n){var r=Ni(t,e);return e.text=e.node=r.pre,r.bgClass&&(e.bgClass=r.bgClass),r.textClass&&(e.textClass=r.textClass),zi(t,e),Wi(t,e,i,n),Vi(t,e,n),e.node}function Vi(t,e,i){if(Ki(t,e.line,e,i,!0),e.rest)for(var n=0;n<e.rest.length;n++)Ki(t,e.rest[n],e,i,!1)}function Ki(t,e,i,n,r){if(e.widgets)for(var a=Fi(i),o=0,s=e.widgets;o<s.length;++o){var l=s[o],c=E("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Yi(l,c,i,n),t.display.input.setUneditable(c),r&&l.above?a.insertBefore(c,i.gutter||i.text):a.appendChild(c),Pi(l,"redraw")}}function Yi(t,e,i,n){if(t.noHScroll){(i.alignable||(i.alignable=[])).push(e);var r=n.wrapperWidth;e.style.left=n.fixedPos+"px",t.coverGutter||(r-=n.gutterTotalWidth,e.style.paddingLeft=n.gutterTotalWidth+"px"),e.style.width=r+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-n.gutterTotalWidth+"px"))}function Xi(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!P(document.body,t.node)){var i="position: relative;";t.coverGutter&&(i+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(i+="width: "+e.display.wrapper.clientWidth+"px;"),I(e.display.measure,E("div",[t.node],null,i))}return t.height=t.node.parentNode.offsetHeight}function Ui(t,e){for(var i=Dt(e);i!=t.wrapper;i=i.parentNode)if(!i||1==i.nodeType&&"true"==i.getAttribute("cm-ignore-events")||i.parentNode==t.sizer&&i!=t.mover)return!0}function Gi(t){return t.lineSpace.offsetTop}function ji(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function qi(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=I(t.measure,E("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,n={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(t.cachedPaddingH=n),n}function Zi(t){return X-t.display.nativeBarWidth}function Ji(t){return t.display.scroller.clientWidth-Zi(t)-t.display.barWidth}function Qi(t){return t.display.scroller.clientHeight-Zi(t)-t.display.barHeight}function tn(t,e,i){var n=t.options.lineWrapping,r=n&&Ji(t);if(!e.measure.heights||n&&e.measure.width!=r){var a=e.measure.heights=[];if(n){e.measure.width=r;for(var o=e.text.firstChild.getClientRects(),s=0;s<o.length-1;s++){var l=o[s],c=o[s+1];Math.abs(l.bottom-c.bottom)>2&&a.push((l.bottom+c.top)/2-i.top)}}a.push(i.bottom-i.top)}}function en(t,e,i){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var n=0;n<t.rest.length;n++)if(t.rest[n]==e)return{map:t.measure.maps[n],cache:t.measure.caches[n]};for(var r=0;r<t.rest.length;r++)if(ae(t.rest[r])>i)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}}function nn(t,e){e=ii(e);var i=ae(e),n=t.display.externalMeasured=new ki(t.doc,e,i);n.lineN=i;var r=n.built=yi(t,n);return n.text=r.pre,I(t.display.lineMeasure,r.pre),n}function rn(t,e,i,n){return sn(t,on(t,e),i,n)}function an(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[Wn(t,e)];var i=t.display.externalMeasured;return i&&e>=i.lineN&&e<i.lineN+i.size?i:void 0}function on(t,e){var i=ae(e),n=an(t,i);n&&!n.text?n=null:n&&n.changes&&(Ri(t,n,i,Fn(t)),t.curOp.forceUpdate=!0),n||(n=nn(t,e));var r=en(n,e,i);return{line:e,view:n,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function sn(t,e,i,n,r){e.before&&(i=-1);var a,o=i+(n||"");return e.cache.hasOwnProperty(o)?a=e.cache[o]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(tn(t,e.view,e.rect),e.hasHeights=!0),a=hn(t,e,i,n),a.bogus||(e.cache[o]=a)),{left:a.left,right:a.right,top:r?a.rtop:a.top,bottom:r?a.rbottom:a.bottom}}var ln,cn={left:0,right:0,top:0,bottom:0};function un(t,e,i){for(var n,r,a,o,s,l,c=0;c<t.length;c+=3)if(s=t[c],l=t[c+1],e<s?(r=0,a=1,o="left"):e<l?(r=e-s,a=r+1):(c==t.length-3||e==l&&t[c+3]>e)&&(a=l-s,r=a-1,e>=l&&(o="right")),null!=r){if(n=t[c+2],s==l&&i==(n.insertLeft?"left":"right")&&(o=i),"left"==i&&0==r)while(c&&t[c-2]==t[c-3]&&t[c-1].insertLeft)n=t[2+(c-=3)],o="left";if("right"==i&&r==l-s)while(c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft)n=t[(c+=3)+2],o="right";break}return{node:n,start:r,end:a,collapse:o,coverStart:s,coverEnd:l}}function dn(t,e){var i=cn;if("left"==e){for(var n=0;n<t.length;n++)if((i=t[n]).left!=i.right)break}else for(var r=t.length-1;r>=0;r--)if((i=t[r]).left!=i.right)break;return i}function hn(t,e,i,n){var r,a=un(e.map,i,n),l=a.node,c=a.start,u=a.end,d=a.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){while(c&&ut(e.line.text.charAt(a.coverStart+c)))--c;while(a.coverStart+u<a.coverEnd&&ut(e.line.text.charAt(a.coverStart+u)))++u;if(r=o&&s<9&&0==c&&u==a.coverEnd-a.coverStart?l.parentNode.getBoundingClientRect():dn(A(l,c,u).getClientRects(),n),r.left||r.right||0==c)break;u=c,c-=1,d="right"}o&&s<11&&(r=pn(t.display.measure,r))}else{var p;c>0&&(d=n="right"),r=t.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==n?p.length-1:0]:l.getBoundingClientRect()}if(o&&s<9&&!c&&(!r||!r.left&&!r.right)){var f=l.parentNode.getClientRects()[0];r=f?{left:f.left,right:f.left+Rn(t.display),top:f.top,bottom:f.bottom}:cn}for(var v=r.top-e.rect.top,g=r.bottom-e.rect.top,m=(v+g)/2,y=e.view.measure.heights,b=0;b<y.length-1;b++)if(m<y[b])break;var x=b?y[b-1]:0,_=y[b],w={left:("right"==d?r.right:r.left)-e.rect.left,right:("left"==d?r.left:r.right)-e.rect.left,top:x,bottom:_};return r.left||r.right||(w.bogus=!0),t.options.singleCursorHeightPerLine||(w.rtop=v,w.rbottom=g),w}function pn(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ht(t))return e;var i=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*i,right:e.right*i,top:e.top*n,bottom:e.bottom*n}}function fn(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function vn(t){t.display.externalMeasure=null,M(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)fn(t.display.view[e])}function gn(t){vn(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function mn(t){return u&&m?-(t.body.getBoundingClientRect().left-parseInt(getComputedStyle(t.body).marginLeft)):t.defaultView.pageXOffset||(t.documentElement||t.body).scrollLeft}function yn(t){return u&&m?-(t.body.getBoundingClientRect().top-parseInt(getComputedStyle(t.body).marginTop)):t.defaultView.pageYOffset||(t.documentElement||t.body).scrollTop}function bn(t){var e=ii(t),i=e.widgets,n=0;if(i)for(var r=0;r<i.length;++r)i[r].above&&(n+=Xi(i[r]));return n}function xn(t,e,i,n,r){if(!r){var a=bn(e);i.top+=a,i.bottom+=a}if("line"==n)return i;n||(n="local");var o=ci(e);if("local"==n?o+=Gi(t.display):o-=t.display.viewOffset,"page"==n||"window"==n){var s=t.display.lineSpace.getBoundingClientRect();o+=s.top+("window"==n?0:yn(N(t)));var l=s.left+("window"==n?0:mn(N(t)));i.left+=l,i.right+=l}return i.top+=o,i.bottom+=o,i}function _n(t,e,i){if("div"==i)return e;var n=e.left,r=e.top;if("page"==i)n-=mn(N(t)),r-=yn(N(t));else if("local"==i||!i){var a=t.display.sizer.getBoundingClientRect();n+=a.left,r+=a.top}var o=t.display.lineSpace.getBoundingClientRect();return{left:n-o.left,top:r-o.top}}function wn(t,e,i,n,r){return n||(n=ee(t.doc,e.line)),xn(t,n,rn(t,n,e.ch,r),i)}function Cn(t,e,i,n,r,a){function o(e,o){var s=sn(t,r,e,o?"right":"left",a);return o?s.left=s.right:s.right=s.left,xn(t,n,s,i)}n=n||ee(t.doc,e.line),r||(r=on(t,n));var s=mt(n,t.doc.direction),l=e.ch,c=e.sticky;if(l>=n.text.length?(l=n.text.length,c="before"):l<=0&&(l=0,c="after"),!s)return o("before"==c?l-1:l,"before"==c);function u(t,e,i){var n=s[e],r=1==n.level;return o(i?t-1:t,r!=i)}var d=vt(s,l,c),h=ft,p=u(l,d,"before"==c);return null!=h&&(p.other=u(l,h,"before"!=c)),p}function Sn(t,e){var i=0;e=ge(t.doc,e),t.options.lineWrapping||(i=Rn(t.display)*e.ch);var n=ee(t.doc,e.line),r=ci(n)+Gi(t.display);return{left:i,right:i,top:r,bottom:r+n.height}}function kn(t,e,i,n,r){var a=ce(t,e,i);return a.xRel=r,n&&(a.outside=n),a}function An(t,e,i){var n=t.doc;if(i+=t.display.viewOffset,i<0)return kn(n.first,0,null,-1,-1);var r=oe(n,i),a=n.first+n.size-1;if(r>a)return kn(n.first+n.size-1,ee(n,a).text.length,null,1,1);e<0&&(e=0);for(var o=ee(n,r);;){var s=En(t,o,r,e,i),l=ti(o,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var c=l.find(1);if(c.line==r)return c;o=ee(n,r=c.line)}}function Tn(t,e,i,n){n-=bn(e);var r=e.text.length,a=ht(function(e){return sn(t,i,e-1).bottom<=n},r,0);return r=ht(function(e){return sn(t,i,e).top>n},a,r),{begin:a,end:r}}function Mn(t,e,i,n){i||(i=on(t,e));var r=xn(t,e,sn(t,i,n),"line").top;return Tn(t,e,i,r)}function In(t,e,i,n){return!(t.bottom<=i)&&(t.top>i||(n?t.left:t.right)>e)}function En(t,e,i,n,r){r-=ci(e);var a=on(t,e),o=bn(e),s=0,l=e.text.length,c=!0,u=mt(e,t.doc.direction);if(u){var d=(t.options.lineWrapping?Pn:Dn)(t,e,i,a,u,n,r);c=1!=d.level,s=c?d.from:d.to-1,l=c?d.to:d.from-1}var h,p,f=null,v=null,g=ht(function(e){var i=sn(t,a,e);return i.top+=o,i.bottom+=o,!!In(i,n,r,!1)&&(i.top<=r&&i.left<=n&&(f=e,v=i),!0)},s,l),m=!1;if(v){var y=n-v.left<v.right-n,b=y==c;g=f+(b?0:1),p=b?"after":"before",h=y?v.left:v.right}else{c||g!=l&&g!=s||g++,p=0==g?"after":g==e.text.length?"before":sn(t,a,g-(c?1:0)).bottom+o<=r==c?"after":"before";var x=Cn(t,ce(i,g,p),"line",e,a);h=x.left,m=r<x.top?-1:r>=x.bottom?1:0}return g=dt(e.text,g,1),kn(i,g,p,m,n-h)}function Dn(t,e,i,n,r,a,o){var s=ht(function(s){var l=r[s],c=1!=l.level;return In(Cn(t,ce(i,c?l.to:l.from,c?"before":"after"),"line",e,n),a,o,!0)},0,r.length-1),l=r[s];if(s>0){var c=1!=l.level,u=Cn(t,ce(i,c?l.from:l.to,c?"after":"before"),"line",e,n);In(u,a,o,!0)&&u.top>o&&(l=r[s-1])}return l}function Pn(t,e,i,n,r,a,o){var s=Tn(t,e,n,o),l=s.begin,c=s.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,d=null,h=0;h<r.length;h++){var p=r[h];if(!(p.from>=c||p.to<=l)){var f=1!=p.level,v=sn(t,n,f?Math.min(c,p.to)-1:Math.max(l,p.from)).right,g=v<a?a-v+1e9:v-a;(!u||d>g)&&(u=p,d=g)}}return u||(u=r[r.length-1]),u.from<l&&(u={from:l,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function Ln(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ln){ln=E("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)ln.appendChild(document.createTextNode("x")),ln.appendChild(E("br"));ln.appendChild(document.createTextNode("x"))}I(t.measure,ln);var i=ln.offsetHeight/50;return i>3&&(t.cachedTextHeight=i),M(t.measure),i||1}function Rn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=E("span","xxxxxxxxxx"),i=E("pre",[e],"CodeMirror-line-like");I(t.measure,i);var n=e.getBoundingClientRect(),r=(n.right-n.left)/10;return r>2&&(t.cachedCharWidth=r),r||10}function Fn(t){for(var e=t.display,i={},n={},r=e.gutters.clientLeft,a=e.gutters.firstChild,o=0;a;a=a.nextSibling,++o){var s=t.display.gutterSpecs[o].className;i[s]=a.offsetLeft+a.clientLeft+r,n[s]=a.clientWidth}return{fixedPos:Bn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:e.wrapper.clientWidth}}function Bn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Nn(t){var e=Ln(t.display),i=t.options.lineWrapping,n=i&&Math.max(5,t.display.scroller.clientWidth/Rn(t.display)-3);return function(r){if(si(t.doc,r))return 0;var a=0;if(r.widgets)for(var o=0;o<r.widgets.length;o++)r.widgets[o].height&&(a+=r.widgets[o].height);return i?a+(Math.ceil(r.text.length/n)||1)*e:a+e}}function On(t){var e=t.doc,i=Nn(t);e.iter(function(t){var e=i(t);e!=t.height&&re(t,e)})}function zn(t,e,i,n){var r=t.display;if(!i&&"true"==Dt(e).getAttribute("cm-not-content"))return null;var a,o,s=r.lineSpace.getBoundingClientRect();try{a=e.clientX-s.left,o=e.clientY-s.top}catch(d){return null}var l,c=An(t,a,o);if(n&&c.xRel>0&&(l=ee(t.doc,c.line).text).length==c.ch){var u=V(l,l.length,t.options.tabSize)-l.length;c=ce(c.line,Math.max(0,Math.round((a-qi(t.display).left)/Rn(t.display))-u))}return c}function Wn(t,e){if(e>=t.display.viewTo)return null;if(e-=t.display.viewFrom,e<0)return null;for(var i=t.display.view,n=0;n<i.length;n++)if(e-=i[n].size,e<0)return n}function $n(t,e,i,n){null==e&&(e=t.doc.first),null==i&&(i=t.doc.first+t.doc.size),n||(n=0);var r=t.display;if(n&&i<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>e)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Re&&ai(t.doc,e)<r.viewTo&&Vn(t);else if(i<=r.viewFrom)Re&&oi(t.doc,i+n)>r.viewFrom?Vn(t):(r.viewFrom+=n,r.viewTo+=n);else if(e<=r.viewFrom&&i>=r.viewTo)Vn(t);else if(e<=r.viewFrom){var a=Kn(t,i,i+n,1);a?(r.view=r.view.slice(a.index),r.viewFrom=a.lineN,r.viewTo+=n):Vn(t)}else if(i>=r.viewTo){var o=Kn(t,e,e,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):Vn(t)}else{var s=Kn(t,e,e,-1),l=Kn(t,i,i+n,1);s&&l?(r.view=r.view.slice(0,s.index).concat(Ai(t,s.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=n):Vn(t)}var c=r.externalMeasured;c&&(i<c.lineN?c.lineN+=n:e<c.lineN+c.size&&(r.externalMeasured=null))}function Hn(t,e,i){t.curOp.viewChanged=!0;var n=t.display,r=t.display.externalMeasured;if(r&&e>=r.lineN&&e<r.lineN+r.size&&(n.externalMeasured=null),!(e<n.viewFrom||e>=n.viewTo)){var a=n.view[Wn(t,e)];if(null!=a.node){var o=a.changes||(a.changes=[]);-1==Y(o,i)&&o.push(i)}}}function Vn(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Kn(t,e,i,n){var r,a=Wn(t,e),o=t.display.view;if(!Re||i==t.doc.first+t.doc.size)return{index:a,lineN:i};for(var s=t.display.viewFrom,l=0;l<a;l++)s+=o[l].size;if(s!=e){if(n>0){if(a==o.length-1)return null;r=s+o[a].size-e,a++}else r=s-e;e+=r,i+=r}while(ai(t.doc,i)!=i){if(a==(n<0?0:o.length-1))return null;i+=n*o[a-(n<0?1:0)].size,a+=n}return{index:a,lineN:i}}function Yn(t,e,i){var n=t.display,r=n.view;0==r.length||e>=n.viewTo||i<=n.viewFrom?(n.view=Ai(t,e,i),n.viewFrom=e):(n.viewFrom>e?n.view=Ai(t,e,n.viewFrom).concat(n.view):n.viewFrom<e&&(n.view=n.view.slice(Wn(t,e))),n.viewFrom=e,n.viewTo<i?n.view=n.view.concat(Ai(t,n.viewTo,i)):n.viewTo>i&&(n.view=n.view.slice(0,Wn(t,i)))),n.viewTo=i}function Xn(t){for(var e=t.display.view,i=0,n=0;n<e.length;n++){var r=e[n];r.hidden||r.node&&!r.changes||++i}return i}function Un(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Gn(t,e){void 0===e&&(e=!0);var i=t.doc,n={},r=n.cursors=document.createDocumentFragment(),a=n.selection=document.createDocumentFragment(),o=t.options.$customCursor;o&&(e=!0);for(var s=0;s<i.sel.ranges.length;s++)if(e||s!=i.sel.primIndex){var l=i.sel.ranges[s];if(!(l.from().line>=t.display.viewTo||l.to().line<t.display.viewFrom)){var c=l.empty();if(o){var u=o(t,l);u&&jn(t,u,r)}else(c||t.options.showCursorWhenSelecting)&&jn(t,l.head,r);c||Zn(t,l,a)}}return n}function jn(t,e,i){var n=Cn(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),r=i.appendChild(E("div"," ","CodeMirror-cursor"));if(r.style.left=n.left+"px",r.style.top=n.top+"px",r.style.height=Math.max(0,n.bottom-n.top)*t.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(t.getWrapperElement().className)){var a=wn(t,e,"div",null,null),o=a.right-a.left;r.style.width=(o>0?o:t.defaultCharWidth())+"px"}if(n.other){var s=i.appendChild(E("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=n.other.left+"px",s.style.top=n.other.top+"px",s.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function qn(t,e){return t.top-e.top||t.left-e.left}function Zn(t,e,i){var n=t.display,r=t.doc,a=document.createDocumentFragment(),o=qi(t.display),s=o.left,l=Math.max(n.sizerWidth,Ji(t)-n.sizer.offsetLeft)-o.right,c="ltr"==r.direction;function u(t,e,i,n){e<0&&(e=0),e=Math.round(e),n=Math.round(n),a.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==i?l-t:i)+"px;\n height: "+(n-e)+"px"))}function d(e,i,n){var a,o,d=ee(r,e),h=d.text.length;function p(i,n){return wn(t,ce(e,i),"div",d,n)}function f(e,i,n){var r=Mn(t,d,null,e),a="ltr"==i==("after"==n)?"left":"right",o="after"==n?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1);return p(o,a)[a]}var v=mt(d,r.direction);return pt(v,i||0,null==n?h:n,function(t,e,r,d){var g="ltr"==r,m=p(t,g?"left":"right"),y=p(e-1,g?"right":"left"),b=null==i&&0==t,x=null==n&&e==h,_=0==d,w=!v||d==v.length-1;if(y.top-m.top<=3){var C=(c?b:x)&&_,S=(c?x:b)&&w,k=C?s:(g?m:y).left,A=S?l:(g?y:m).right;u(k,m.top,A-k,m.bottom)}else{var T,M,I,E;g?(T=c&&b&&_?s:m.left,M=c?l:f(t,r,"before"),I=c?s:f(e,r,"after"),E=c&&x&&w?l:y.right):(T=c?f(t,r,"before"):s,M=!c&&b&&_?l:m.right,I=!c&&x&&w?s:y.left,E=c?f(e,r,"after"):l),u(T,m.top,M-T,m.bottom),m.bottom<y.top&&u(s,m.bottom,null,y.top),u(I,y.top,E-I,y.bottom)}(!a||qn(m,a)<0)&&(a=m),qn(y,a)<0&&(a=y),(!o||qn(m,o)<0)&&(o=m),qn(y,o)<0&&(o=y)}),{start:a,end:o}}var h=e.from(),p=e.to();if(h.line==p.line)d(h.line,h.ch,p.ch);else{var f=ee(r,h.line),v=ee(r,p.line),g=ii(f)==ii(v),m=d(h.line,h.ch,g?f.text.length+1:null).end,y=d(p.line,g?0:null,p.ch).start;g&&(m.top<y.top-2?(u(m.right,m.top,null,m.bottom),u(s,y.top,y.left,y.bottom)):u(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&u(s,m.bottom,null,y.top)}i.appendChild(a)}function Jn(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var i=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval(function(){t.hasFocus()||ir(t),e.cursorDiv.style.visibility=(i=!i)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Qn(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||er(t))}function tr(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&ir(t))},100)}function er(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(wt(t,"focus",t,e),t.state.focused=!0,R(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Jn(t))}function ir(t,e){t.state.delayingBlurEvent||(t.state.focused&&(wt(t,"blur",t,e),t.state.focused=!1,T(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function nr(t){for(var e=t.display,i=e.lineDiv.offsetTop,n=Math.max(0,e.scroller.getBoundingClientRect().top),r=e.lineDiv.getBoundingClientRect().top,a=0,l=0;l<e.view.length;l++){var c=e.view[l],u=t.options.lineWrapping,d=void 0,h=0;if(!c.hidden){if(r+=c.line.height,o&&s<8){var p=c.node.offsetTop+c.node.offsetHeight;d=p-i,i=p}else{var f=c.node.getBoundingClientRect();d=f.bottom-f.top,!u&&c.text.firstChild&&(h=c.text.firstChild.getBoundingClientRect().right-f.left-1)}var v=c.line.height-d;if((v>.005||v<-.005)&&(r<n&&(a-=v),re(c.line,d),rr(c.line),c.rest))for(var g=0;g<c.rest.length;g++)rr(c.rest[g]);if(h>t.display.sizerWidth){var m=Math.ceil(h/Rn(t.display));m>t.display.maxLineLength&&(t.display.maxLineLength=m,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}}Math.abs(a)>2&&(e.scroller.scrollTop+=a)}function rr(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e){var i=t.widgets[e],n=i.node.parentNode;n&&(i.height=n.offsetHeight)}}function ar(t,e,i){var n=i&&null!=i.top?Math.max(0,i.top):t.scroller.scrollTop;n=Math.floor(n-Gi(t));var r=i&&null!=i.bottom?i.bottom:n+t.wrapper.clientHeight,a=oe(e,n),o=oe(e,r);if(i&&i.ensure){var s=i.ensure.from.line,l=i.ensure.to.line;s<a?(a=s,o=oe(e,ci(ee(e,s))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=o&&(a=oe(e,ci(ee(e,l))-t.wrapper.clientHeight),o=l)}return{from:a,to:Math.max(o,a+1)}}function or(t,e){if(!Ct(t,"scrollCursorIntoView")){var i=t.display,n=i.sizer.getBoundingClientRect(),r=null,a=i.wrapper.ownerDocument;if(e.top+n.top<0?r=!0:e.bottom+n.top>(a.defaultView.innerHeight||a.documentElement.clientHeight)&&(r=!1),null!=r&&!v){var o=E("div","",null,"position: absolute;\n top: "+(e.top-i.viewOffset-Gi(t.display))+"px;\n height: "+(e.bottom-e.top+Zi(t)+i.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(r),t.display.lineSpace.removeChild(o)}}}function sr(t,e,i,n){var r;null==n&&(n=0),t.options.lineWrapping||e!=i||(i="before"==e.sticky?ce(e.line,e.ch+1,"before"):e,e=e.ch?ce(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e);for(var a=0;a<5;a++){var o=!1,s=Cn(t,e),l=i&&i!=e?Cn(t,i):s;r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-n,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+n};var c=cr(t,r),u=t.doc.scrollTop,d=t.doc.scrollLeft;if(null!=c.scrollTop&&(gr(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(o=!0)),null!=c.scrollLeft&&(yr(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-d)>1&&(o=!0)),!o)break}return r}function lr(t,e){var i=cr(t,e);null!=i.scrollTop&&gr(t,i.scrollTop),null!=i.scrollLeft&&yr(t,i.scrollLeft)}function cr(t,e){var i=t.display,n=Ln(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:i.scroller.scrollTop,a=Qi(t),o={};e.bottom-e.top>a&&(e.bottom=e.top+a);var s=t.doc.height+ji(i),l=e.top<n,c=e.bottom>s-n;if(e.top<r)o.scrollTop=l?0:e.top;else if(e.bottom>r+a){var u=Math.min(e.top,(c?s:e.bottom)-a);u!=r&&(o.scrollTop=u)}var d=t.options.fixedGutter?0:i.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:i.scroller.scrollLeft-d,p=Ji(t)-i.gutters.offsetWidth,f=e.right-e.left>p;return f&&(e.right=e.left+p),e.left<10?o.scrollLeft=0:e.left<h?o.scrollLeft=Math.max(0,e.left+d-(f?0:10)):e.right>p+h-3&&(o.scrollLeft=e.right+(f?0:10)-p),o}function ur(t,e){null!=e&&(fr(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function dr(t){fr(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function hr(t,e,i){null==e&&null==i||fr(t),null!=e&&(t.curOp.scrollLeft=e),null!=i&&(t.curOp.scrollTop=i)}function pr(t,e){fr(t),t.curOp.scrollToPos=e}function fr(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var i=Sn(t,e.from),n=Sn(t,e.to);vr(t,i,n,e.margin)}}function vr(t,e,i,n){var r=cr(t,{left:Math.min(e.left,i.left),top:Math.min(e.top,i.top)-n,right:Math.max(e.right,i.right),bottom:Math.max(e.bottom,i.bottom)+n});hr(t,r.scrollLeft,r.scrollTop)}function gr(t,e){Math.abs(t.doc.scrollTop-e)<2||(i||Ur(t,{top:e}),mr(t,e,!0),i&&Ur(t),zr(t,100))}function mr(t,e,i){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||i)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function yr(t,e,i,n){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(i?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!n||(t.doc.scrollLeft=e,Zr(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function br(t){var e=t.display,i=e.gutters.offsetWidth,n=Math.round(t.doc.height+ji(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?i:0,docHeight:n,scrollHeight:n+Zi(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:i}}var xr=function(t,e,i){this.cm=i;var n=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=r.tabIndex=-1,t(n),t(r),bt(n,"scroll",function(){n.clientHeight&&e(n.scrollTop,"vertical")}),bt(r,"scroll",function(){r.clientWidth&&e(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,o&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,i=t.scrollHeight>t.clientHeight+1,n=t.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=e?n+"px":"0";var r=t.viewHeight-(e?n:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=t.barLeft+"px";var a=t.viewWidth-t.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+a)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:e?n:0}},xr.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var t=b&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new K,this.disableVert=new K},xr.prototype.enableZeroWidthBar=function(t,e,i){function n(){var r=t.getBoundingClientRect(),a="vert"==i?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);a!=t?t.style.visibility="hidden":e.set(1e3,n)}t.style.visibility="",e.set(1e3,n)},xr.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var _r=function(){};function wr(t,e){e||(e=br(t));var i=t.display.barWidth,n=t.display.barHeight;Cr(t,e);for(var r=0;r<4&&i!=t.display.barWidth||n!=t.display.barHeight;r++)i!=t.display.barWidth&&t.options.lineWrapping&&nr(t),Cr(t,br(t)),i=t.display.barWidth,n=t.display.barHeight}function Cr(t,e){var i=t.display,n=i.scrollbars.update(e);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=e.gutterWidth+"px"):i.gutterFiller.style.display=""}_r.prototype.update=function(){return{bottom:0,right:0}},_r.prototype.setScrollLeft=function(){},_r.prototype.setScrollTop=function(){},_r.prototype.clear=function(){};var Sr={native:xr,null:_r};function kr(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&T(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Sr[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),bt(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,i){"horizontal"==i?yr(t,e):gr(t,e)},t),t.display.scrollbars.addClass&&R(t.display.wrapper,t.display.scrollbars.addClass)}var Ar=0;function Tr(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ar,markArrays:null},Mi(t.curOp)}function Mr(t){var e=t.curOp;e&&Ei(e,function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;Ir(t)})}function Ir(t){for(var e=t.ops,i=0;i<e.length;i++)Er(e[i]);for(var n=0;n<e.length;n++)Dr(e[n]);for(var r=0;r<e.length;r++)Pr(e[r]);for(var a=0;a<e.length;a++)Lr(e[a]);for(var o=0;o<e.length;o++)Rr(e[o])}function Er(t){var e=t.cm,i=e.display;Hr(e),t.updateMaxLine&&di(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<i.viewFrom||t.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new $r(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Dr(t){t.updatedDisplay=t.mustUpdate&&Yr(t.cm,t.update)}function Pr(t){var e=t.cm,i=e.display;t.updatedDisplay&&nr(e),t.barMeasure=br(e),i.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=rn(e,i.maxLine,i.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+t.adjustWidthTo+Zi(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+t.adjustWidthTo-Ji(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=i.input.prepareSelection())}function Lr(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&yr(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var i=t.focus&&t.focus==L(O(e));t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,i),(t.updatedDisplay||t.startHeight!=e.doc.height)&&wr(e,t.barMeasure),t.updatedDisplay&&qr(e,t.barMeasure),t.selectionChanged&&Jn(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),i&&Qn(t.cm)}function Rr(t){var e=t.cm,i=e.display,n=e.doc;if(t.updatedDisplay&&Xr(e,t.update),null==i.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(i.wheelStartX=i.wheelStartY=null),null!=t.scrollTop&&mr(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&yr(e,t.scrollLeft,!0,!0),t.scrollToPos){var r=sr(e,ge(n,t.scrollToPos.from),ge(n,t.scrollToPos.to),t.scrollToPos.margin);or(e,r)}var a=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(a)for(var s=0;s<a.length;++s)a[s].lines.length||wt(a[s],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&wt(o[l],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&wt(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function Fr(t,e){if(t.curOp)return e();Tr(t);try{return e()}finally{Mr(t)}}function Br(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Tr(t);try{return e.apply(t,arguments)}finally{Mr(t)}}}function Nr(t){return function(){if(this.curOp)return t.apply(this,arguments);Tr(this);try{return t.apply(this,arguments)}finally{Mr(this)}}}function Or(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Tr(e);try{return t.apply(this,arguments)}finally{Mr(e)}}}function zr(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,$(Wr,t))}function Wr(t){var e=t.doc;if(!(e.highlightFrontier>=t.display.viewTo)){var i=+new Date+t.options.workTime,n=Ce(t,e.highlightFrontier),r=[];e.iter(n.line,Math.min(e.first+e.size,t.display.viewTo+500),function(a){if(n.line>=t.display.viewFrom){var o=a.styles,s=a.text.length>t.options.maxHighlightLength?Zt(e.mode,n.state):null,l=_e(t,a,n,!0);s&&(n.state=s),a.styles=l.styles;var c=a.styleClasses,u=l.classes;u?a.styleClasses=u:c&&(a.styleClasses=null);for(var d=!o||o.length!=a.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&h<o.length;++h)d=o[h]!=a.styles[h];d&&r.push(n.line),a.stateAfter=n.save(),n.nextLine()}else a.text.length<=t.options.maxHighlightLength&&Se(t,a.text,n),a.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>i)return zr(t,t.options.workDelay),!0}),e.highlightFrontier=n.line,e.modeFrontier=Math.max(e.modeFrontier,n.line),r.length&&Fr(t,function(){for(var e=0;e<r.length;e++)Hn(t,r[e],"text")})}}var $r=function(t,e,i){var n=t.display;this.viewport=e,this.visible=ar(n,t.doc,e),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ji(t),this.force=i,this.dims=Fn(t),this.events=[]};function Hr(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=Zi(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=Zi(t)+"px",e.scrollbarsClipped=!0)}function Vr(t){if(t.hasFocus())return null;var e=L(O(t));if(!e||!P(t.display.lineDiv,e))return null;var i={activeElt:e};if(window.getSelection){var n=W(t).getSelection();n.anchorNode&&n.extend&&P(t.display.lineDiv,n.anchorNode)&&(i.anchorNode=n.anchorNode,i.anchorOffset=n.anchorOffset,i.focusNode=n.focusNode,i.focusOffset=n.focusOffset)}return i}function Kr(t){if(t&&t.activeElt&&t.activeElt!=L(z(t.activeElt))&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&P(document.body,t.anchorNode)&&P(document.body,t.focusNode))){var e=t.activeElt.ownerDocument,i=e.defaultView.getSelection(),n=e.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),i.removeAllRanges(),i.addRange(n),i.extend(t.focusNode,t.focusOffset)}}function Yr(t,e){var i=t.display,n=t.doc;if(e.editorIsHidden)return Vn(t),!1;if(!e.force&&e.visible.from>=i.viewFrom&&e.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Xn(t))return!1;Jr(t)&&(Vn(t),e.dims=Fn(t));var r=n.first+n.size,a=Math.max(e.visible.from-t.options.viewportMargin,n.first),o=Math.min(r,e.visible.to+t.options.viewportMargin);i.viewFrom<a&&a-i.viewFrom<20&&(a=Math.max(n.first,i.viewFrom)),i.viewTo>o&&i.viewTo-o<20&&(o=Math.min(r,i.viewTo)),Re&&(a=ai(t.doc,a),o=oi(t.doc,o));var s=a!=i.viewFrom||o!=i.viewTo||i.lastWrapHeight!=e.wrapperHeight||i.lastWrapWidth!=e.wrapperWidth;Yn(t,a,o),i.viewOffset=ci(ee(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var l=Xn(t);if(!s&&0==l&&!e.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var c=Vr(t);return l>4&&(i.lineDiv.style.display="none"),Gr(t,i.updateLineNumbers,e.dims),l>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Kr(c),M(i.cursorDiv),M(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,s&&(i.lastWrapHeight=e.wrapperHeight,i.lastWrapWidth=e.wrapperWidth,zr(t,400)),i.updateLineNumbers=null,!0}function Xr(t,e){for(var i=e.viewport,n=!0;;n=!1){if(n&&t.options.lineWrapping&&e.oldDisplayWidth!=Ji(t))n&&(e.visible=ar(t.display,t.doc,i));else if(i&&null!=i.top&&(i={top:Math.min(t.doc.height+ji(t.display)-Qi(t),i.top)}),e.visible=ar(t.display,t.doc,i),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!Yr(t,e))break;nr(t);var r=br(t);Un(t),wr(t,r),qr(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Ur(t,e){var i=new $r(t,e);if(Yr(t,i)){nr(t),Xr(t,i);var n=br(t);Un(t),wr(t,n),qr(t,n),i.finish()}}function Gr(t,e,i){var n=t.display,r=t.options.lineNumbers,a=n.lineDiv,o=a.firstChild;function s(e){var i=e.nextSibling;return l&&b&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),i}for(var c=n.view,u=n.viewFrom,d=0;d<c.length;d++){var h=c[d];if(h.hidden);else if(h.node&&h.node.parentNode==a){while(o!=h.node)o=s(o);var p=r&&null!=e&&e<=u&&h.lineNumber;h.changes&&(Y(h.changes,"gutter")>-1&&(p=!1),Ri(t,h,u,i)),p&&(M(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(le(t.options,u)))),o=h.node.nextSibling}else{var f=Hi(t,h,u,i);a.insertBefore(f,o)}u+=h.size}while(o)o=s(o)}function jr(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px",Pi(t,"gutterChanged",t)}function qr(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+Zi(t)+"px"}function Zr(t){var e=t.display,i=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var n=Bn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,a=n+"px",o=0;o<i.length;o++)if(!i[o].hidden){t.options.fixedGutter&&(i[o].gutter&&(i[o].gutter.style.left=a),i[o].gutterBackground&&(i[o].gutterBackground.style.left=a));var s=i[o].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=a}t.options.fixedGutter&&(e.gutters.style.left=n+r+"px")}}function Jr(t){if(!t.options.lineNumbers)return!1;var e=t.doc,i=le(t.options,e.first+e.size-1),n=t.display;if(i.length!=n.lineNumChars){var r=n.measure.appendChild(E("div",[E("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),a=r.firstChild.offsetWidth,o=r.offsetWidth-a;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(a,n.lineGutter.offsetWidth-o)+1,n.lineNumWidth=n.lineNumInnerWidth+o,n.lineNumChars=n.lineNumInnerWidth?i.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",jr(t.display),!0}return!1}function Qr(t,e){for(var i=[],n=!1,r=0;r<t.length;r++){var a=t[r],o=null;if("string"!=typeof a&&(o=a.style,a=a.className),"CodeMirror-linenumbers"==a){if(!e)continue;n=!0}i.push({className:a,style:o})}return e&&!n&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ta(t){var e=t.gutters,i=t.gutterSpecs;M(e),t.lineGutter=null;for(var n=0;n<i.length;++n){var r=i[n],a=r.className,o=r.style,s=e.appendChild(E("div",null,"CodeMirror-gutter "+a));o&&(s.style.cssText=o),"CodeMirror-linenumbers"==a&&(t.lineGutter=s,s.style.width=(t.lineNumWidth||1)+"px")}e.style.display=i.length?"":"none",jr(t)}function ea(t){ta(t.display),$n(t),Zr(t)}function ia(t,e,n,r){var a=this;this.input=n,a.scrollbarFiller=E("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=E("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=D("div",null,"CodeMirror-code"),a.selectionDiv=E("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=E("div",null,"CodeMirror-cursors"),a.measure=E("div",null,"CodeMirror-measure"),a.lineMeasure=E("div",null,"CodeMirror-measure"),a.lineSpace=D("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var c=D("div",[a.lineSpace],"CodeMirror-lines");a.mover=E("div",[c],null,"position: relative"),a.sizer=E("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=E("div",null,null,"position: absolute; height: "+X+"px; width: 1px;"),a.gutters=E("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=E("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=E("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),u&&d>=105&&(a.wrapper.style.clipPath="inset(0px)"),a.wrapper.setAttribute("translate","no"),o&&s<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),l||i&&y||(a.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(a.wrapper):t(a.wrapper)),a.viewFrom=a.viewTo=e.first,a.reportedViewFrom=a.reportedViewTo=e.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=Qr(r.gutters,r.lineNumbers),ta(a),n.init(a)}$r.prototype.signal=function(t,e){kt(t,e)&&this.events.push(arguments)},$r.prototype.finish=function(){for(var t=0;t<this.events.length;t++)wt.apply(null,this.events[t])};var na=0,ra=null;function aa(t){var e=t.wheelDeltaX,i=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta),{x:e,y:i}}function oa(t){var e=aa(t);return e.x*=ra,e.y*=ra,e}function sa(t,e){u&&102==d&&(null==t.display.chromeScrollHack?t.display.sizer.style.pointerEvents="none":clearTimeout(t.display.chromeScrollHack),t.display.chromeScrollHack=setTimeout(function(){t.display.chromeScrollHack=null,t.display.sizer.style.pointerEvents=""},100));var n=aa(e),r=n.x,a=n.y,o=ra;0===e.deltaMode&&(r=e.deltaX,a=e.deltaY,o=1);var s=t.display,c=s.scroller,p=c.scrollWidth>c.clientWidth,f=c.scrollHeight>c.clientHeight;if(r&&p||a&&f){if(a&&b&&l)t:for(var v=e.target,g=s.view;v!=c;v=v.parentNode)for(var m=0;m<g.length;m++)if(g[m].node==v){t.display.currentWheelTarget=v;break t}if(r&&!i&&!h&&null!=o)return a&&f&&gr(t,Math.max(0,c.scrollTop+a*o)),yr(t,Math.max(0,c.scrollLeft+r*o)),(!a||a&&f)&&Tt(e),void(s.wheelStartX=null);if(a&&null!=o){var y=a*o,x=t.doc.scrollTop,_=x+s.wrapper.clientHeight;y<0?x=Math.max(0,x+y-50):_=Math.min(t.doc.height,_+y+50),Ur(t,{top:x,bottom:_})}na<20&&0!==e.deltaMode&&(null==s.wheelStartX?(s.wheelStartX=c.scrollLeft,s.wheelStartY=c.scrollTop,s.wheelDX=r,s.wheelDY=a,setTimeout(function(){if(null!=s.wheelStartX){var t=c.scrollLeft-s.wheelStartX,e=c.scrollTop-s.wheelStartY,i=e&&s.wheelDY&&e/s.wheelDY||t&&s.wheelDX&&t/s.wheelDX;s.wheelStartX=s.wheelStartY=null,i&&(ra=(ra*na+i)/(na+1),++na)}},200)):(s.wheelDX+=r,s.wheelDY+=a))}}o?ra=-.53:i?ra=15:u?ra=-.7:p&&(ra=-1/3);var la=function(t,e){this.ranges=t,this.primIndex=e};la.prototype.primary=function(){return this.ranges[this.primIndex]},la.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var i=this.ranges[e],n=t.ranges[e];if(!de(i.anchor,n.anchor)||!de(i.head,n.head))return!1}return!0},la.prototype.deepCopy=function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new ca(he(this.ranges[e].anchor),he(this.ranges[e].head));return new la(t,this.primIndex)},la.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},la.prototype.contains=function(t,e){e||(e=t);for(var i=0;i<this.ranges.length;i++){var n=this.ranges[i];if(ue(e,n.from())>=0&&ue(t,n.to())<=0)return i}return-1};var ca=function(t,e){this.anchor=t,this.head=e};function ua(t,e,i){var n=t&&t.options.selectionsMayTouch,r=e[i];e.sort(function(t,e){return ue(t.from(),e.from())}),i=Y(e,r);for(var a=1;a<e.length;a++){var o=e[a],s=e[a-1],l=ue(s.to(),o.from());if(n&&!o.empty()?l>0:l>=0){var c=fe(s.from(),o.from()),u=pe(s.to(),o.to()),d=s.empty()?o.from()==o.head:s.from()==s.head;a<=i&&--i,e.splice(--a,2,new ca(d?u:c,d?c:u))}}return new la(e,i)}function da(t,e){return new la([new ca(t,e||t)],0)}function ha(t){return t.text?ce(t.from.line+t.text.length-1,tt(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function pa(t,e){if(ue(t,e.from)<0)return t;if(ue(t,e.to)<=0)return ha(e);var i=t.line+e.text.length-(e.to.line-e.from.line)-1,n=t.ch;return t.line==e.to.line&&(n+=ha(e).ch-e.to.ch),ce(i,n)}function fa(t,e){for(var i=[],n=0;n<t.sel.ranges.length;n++){var r=t.sel.ranges[n];i.push(new ca(pa(r.anchor,e),pa(r.head,e)))}return ua(t.cm,i,t.sel.primIndex)}function va(t,e,i){return t.line==e.line?ce(i.line,t.ch-e.ch+i.ch):ce(i.line+(t.line-e.line),t.ch)}function ga(t,e,i){for(var n=[],r=ce(t.first,0),a=r,o=0;o<e.length;o++){var s=e[o],l=va(s.from,r,a),c=va(ha(s),r,a);if(r=s.to,a=c,"around"==i){var u=t.sel.ranges[o],d=ue(u.head,u.anchor)<0;n[o]=new ca(d?c:l,d?l:c)}else n[o]=new ca(l,l)}return new la(n,t.sel.primIndex)}function ma(t){t.doc.mode=Gt(t.options,t.doc.modeOption),ya(t)}function ya(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,zr(t,100),t.state.modeGen++,t.curOp&&$n(t)}function ba(t,e){return 0==e.from.ch&&0==e.to.ch&&""==tt(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function xa(t,e,i,n){function r(t){return i?i[t]:null}function a(t,i,r){pi(t,i,r,n),Pi(t,"change",t,e)}function o(t,e){for(var i=[],a=t;a<e;++a)i.push(new hi(c[a],r(a),n));return i}var s=e.from,l=e.to,c=e.text,u=ee(t,s.line),d=ee(t,l.line),h=tt(c),p=r(c.length-1),f=l.line-s.line;if(e.full)t.insert(0,o(0,c.length)),t.remove(c.length,t.size-c.length);else if(ba(t,e)){var v=o(0,c.length-1);a(d,d.text,p),f&&t.remove(s.line,f),v.length&&t.insert(s.line,v)}else if(u==d)if(1==c.length)a(u,u.text.slice(0,s.ch)+h+u.text.slice(l.ch),p);else{var g=o(1,c.length-1);g.push(new hi(h+u.text.slice(l.ch),p,n)),a(u,u.text.slice(0,s.ch)+c[0],r(0)),t.insert(s.line+1,g)}else if(1==c.length)a(u,u.text.slice(0,s.ch)+c[0]+d.text.slice(l.ch),r(0)),t.remove(s.line+1,f);else{a(u,u.text.slice(0,s.ch)+c[0],r(0)),a(d,h+d.text.slice(l.ch),p);var m=o(1,c.length-1);f>1&&t.remove(s.line+1,f-1),t.insert(s.line+1,m)}Pi(t,"change",t,e)}function _a(t,e,i){function n(t,r,a){if(t.linked)for(var o=0;o<t.linked.length;++o){var s=t.linked[o];if(s.doc!=r){var l=a&&s.sharedHist;i&&!l||(e(s.doc,l),n(s.doc,t,l))}}}n(t,null,!0)}function wa(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,On(t),ma(t),Ca(t),t.options.direction=e.direction,t.options.lineWrapping||di(t),t.options.mode=e.modeOption,$n(t)}function Ca(t){("rtl"==t.doc.direction?R:T)(t.display.lineDiv,"CodeMirror-rtl")}function Sa(t){Fr(t,function(){Ca(t),$n(t)})}function ka(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function Aa(t,e){var i={from:he(e.from),to:ha(e),text:ie(t,e.from,e.to)};return La(t,i,e.from.line,e.to.line+1),_a(t,function(t){return La(t,i,e.from.line,e.to.line+1)},!0),i}function Ta(t){while(t.length){var e=tt(t);if(!e.ranges)break;t.pop()}}function Ma(t,e){return e?(Ta(t.done),tt(t.done)):t.done.length&&!tt(t.done).ranges?tt(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),tt(t.done)):void 0}function Ia(t,e,i,n){var r=t.history;r.undone.length=0;var a,o,s=+new Date;if((r.lastOp==n||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&r.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(a=Ma(r,r.lastOp==n)))o=tt(a.changes),0==ue(e.from,e.to)&&0==ue(e.from,o.to)?o.to=ha(e):a.changes.push(Aa(t,e));else{var l=tt(r.done);l&&l.ranges||Pa(t.sel,r.done),a={changes:[Aa(t,e)],generation:r.generation},r.done.push(a);while(r.done.length>r.undoDepth)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=e.origin,o||wt(t,"historyAdded")}function Ea(t,e,i,n){var r=e.charAt(0);return"*"==r||"+"==r&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Da(t,e,i,n){var r=t.history,a=n&&n.origin;i==r.lastSelOp||a&&r.lastSelOrigin==a&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==a||Ea(t,a,tt(r.done),e))?r.done[r.done.length-1]=e:Pa(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=a,r.lastSelOp=i,n&&!1!==n.clearRedo&&Ta(r.undone)}function Pa(t,e){var i=tt(e);i&&i.ranges&&i.equals(t)||e.push(t)}function La(t,e,i,n){var r=e["spans_"+t.id],a=0;t.iter(Math.max(t.first,i),Math.min(t.first+t.size,n),function(i){i.markedSpans&&((r||(r=e["spans_"+t.id]={}))[a]=i.markedSpans),++a})}function Ra(t){if(!t)return null;for(var e,i=0;i<t.length;++i)t[i].marker.explicitlyCleared?e||(e=t.slice(0,i)):e&&e.push(t[i]);return e?e.length?e:null:t}function Fa(t,e){var i=e["spans_"+t.id];if(!i)return null;for(var n=[],r=0;r<e.text.length;++r)n.push(Ra(i[r]));return n}function Ba(t,e){var i=Fa(t,e),n=Ve(t,e);if(!i)return n;if(!n)return i;for(var r=0;r<i.length;++r){var a=i[r],o=n[r];if(a&&o)t:for(var s=0;s<o.length;++s){for(var l=o[s],c=0;c<a.length;++c)if(a[c].marker==l.marker)continue t;a.push(l)}else o&&(i[r]=o)}return i}function Na(t,e,i){for(var n=[],r=0;r<t.length;++r){var a=t[r];if(a.ranges)n.push(i?la.prototype.deepCopy.call(a):a);else{var o=a.changes,s=[];n.push({changes:s});for(var l=0;l<o.length;++l){var c=o[l],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),e)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&Y(e,Number(u[1]))>-1&&(tt(s)[d]=c[d],delete c[d])}}}return n}function Oa(t,e,i,n){if(n){var r=t.anchor;if(i){var a=ue(e,r)<0;a!=ue(i,r)<0?(r=e,e=i):a!=ue(e,i)<0&&(e=i)}return new ca(r,e)}return new ca(i||e,e)}function za(t,e,i,n,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),Ya(t,new la([Oa(t.sel.primary(),e,i,r)],0),n)}function Wa(t,e,i){for(var n=[],r=t.cm&&(t.cm.display.shift||t.extend),a=0;a<t.sel.ranges.length;a++)n[a]=Oa(t.sel.ranges[a],e[a],null,r);var o=ua(t.cm,n,t.sel.primIndex);Ya(t,o,i)}function $a(t,e,i,n){var r=t.sel.ranges.slice(0);r[e]=i,Ya(t,ua(t.cm,r,t.sel.primIndex),n)}function Ha(t,e,i,n){Ya(t,da(e,i),n)}function Va(t,e,i){var n={ranges:e.ranges,update:function(e){this.ranges=[];for(var i=0;i<e.length;i++)this.ranges[i]=new ca(ge(t,e[i].anchor),ge(t,e[i].head))},origin:i&&i.origin};return wt(t,"beforeSelectionChange",t,n),t.cm&&wt(t.cm,"beforeSelectionChange",t.cm,n),n.ranges!=e.ranges?ua(t.cm,n.ranges,n.ranges.length-1):e}function Ka(t,e,i){var n=t.history.done,r=tt(n);r&&r.ranges?(n[n.length-1]=e,Xa(t,e,i)):Ya(t,e,i)}function Ya(t,e,i){Xa(t,e,i),Da(t,t.sel,t.cm?t.cm.curOp.id:NaN,i)}function Xa(t,e,i){(kt(t,"beforeSelectionChange")||t.cm&&kt(t.cm,"beforeSelectionChange"))&&(e=Va(t,e,i));var n=i&&i.bias||(ue(e.primary().head,t.sel.primary().head)<0?-1:1);Ua(t,ja(t,e,n,!0)),i&&!1===i.scroll||!t.cm||"nocursor"==t.cm.getOption("readOnly")||dr(t.cm)}function Ua(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,St(t.cm)),Pi(t,"cursorActivity",t))}function Ga(t){Ua(t,ja(t,t.sel,null,!1))}function ja(t,e,i,n){for(var r,a=0;a<e.ranges.length;a++){var o=e.ranges[a],s=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[a],l=Za(t,o.anchor,s&&s.anchor,i,n),c=o.head==o.anchor?l:Za(t,o.head,s&&s.head,i,n);(r||l!=o.anchor||c!=o.head)&&(r||(r=e.ranges.slice(0,a)),r[a]=new ca(l,c))}return r?ua(t.cm,r,e.primIndex):e}function qa(t,e,i,n,r){var a=ee(t,e.line);if(a.markedSpans)for(var o=0;o<a.markedSpans.length;++o){var s=a.markedSpans[o],l=s.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(c?s.from<=e.ch:s.from<e.ch))&&(null==s.to||(u?s.to>=e.ch:s.to>e.ch))){if(r&&(wt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(a.markedSpans){--o;continue}break}if(!l.atomic)continue;if(i){var d=l.find(n<0?1:-1),h=void 0;if((n<0?u:c)&&(d=Ja(t,d,-n,d&&d.line==e.line?a:null)),d&&d.line==e.line&&(h=ue(d,i))&&(n<0?h<0:h>0))return qa(t,d,e,n,r)}var p=l.find(n<0?-1:1);return(n<0?c:u)&&(p=Ja(t,p,n,p.line==e.line?a:null)),p?qa(t,p,e,n,r):null}}return e}function Za(t,e,i,n,r){var a=n||1,o=qa(t,e,i,a,r)||!r&&qa(t,e,i,a,!0)||qa(t,e,i,-a,r)||!r&&qa(t,e,i,-a,!0);return o||(t.cantEdit=!0,ce(t.first,0))}function Ja(t,e,i,n){return i<0&&0==e.ch?e.line>t.first?ge(t,ce(e.line-1)):null:i>0&&e.ch==(n||ee(t,e.line)).text.length?e.line<t.first+t.size-1?ce(e.line+1,0):null:new ce(e.line,e.ch+i)}function Qa(t){t.setSelection(ce(t.firstLine(),0),ce(t.lastLine()),G)}function to(t,e,i){var n={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return n.canceled=!0}};return i&&(n.update=function(e,i,r,a){e&&(n.from=ge(t,e)),i&&(n.to=ge(t,i)),r&&(n.text=r),void 0!==a&&(n.origin=a)}),wt(t,"beforeChange",t,n),t.cm&&wt(t.cm,"beforeChange",t.cm,n),n.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function eo(t,e,i){if(t.cm){if(!t.cm.curOp)return Br(t.cm,eo)(t,e,i);if(t.cm.state.suppressEdits)return}if(!(kt(t,"beforeChange")||t.cm&&kt(t.cm,"beforeChange"))||(e=to(t,e,!0),e)){var n=Le&&!i&&Ye(t,e.from,e.to);if(n)for(var r=n.length-1;r>=0;--r)io(t,{from:n[r].from,to:n[r].to,text:r?[""]:e.text,origin:e.origin});else io(t,e)}}function io(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ue(e.from,e.to)){var i=fa(t,e);Ia(t,e,i,t.cm?t.cm.curOp.id:NaN),ao(t,e,i,Ve(t,e));var n=[];_a(t,function(t,i){i||-1!=Y(n,t.history)||(uo(t.history,e),n.push(t.history)),ao(t,e,null,Ve(t,e))})}}function no(t,e,i){var n=t.cm&&t.cm.state.suppressEdits;if(!n||i){for(var r,a=t.history,o=t.sel,s="undo"==e?a.done:a.undone,l="undo"==e?a.undone:a.done,c=0;c<s.length;c++)if(r=s[c],i?r.ranges&&!r.equals(t.sel):!r.ranges)break;if(c!=s.length){for(a.lastOrigin=a.lastSelOrigin=null;;){if(r=s.pop(),!r.ranges){if(n)return void s.push(r);break}if(Pa(r,l),i&&!r.equals(t.sel))return void Ya(t,r,{clearRedo:!1});o=r}var u=[];Pa(o,l),l.push({changes:u,generation:a.generation}),a.generation=r.generation||++a.maxGeneration;for(var d=kt(t,"beforeChange")||t.cm&&kt(t.cm,"beforeChange"),h=function(i){var n=r.changes[i];if(n.origin=e,d&&!to(t,n,!1))return s.length=0,{};u.push(Aa(t,n));var a=i?fa(t,n):tt(s);ao(t,n,a,Ba(t,n)),!i&&t.cm&&t.cm.scrollIntoView({from:n.from,to:ha(n)});var o=[];_a(t,function(t,e){e||-1!=Y(o,t.history)||(uo(t.history,n),o.push(t.history)),ao(t,n,null,Ba(t,n))})},p=r.changes.length-1;p>=0;--p){var f=h(p);if(f)return f.v}}}}function ro(t,e){if(0!=e&&(t.first+=e,t.sel=new la(et(t.sel.ranges,function(t){return new ca(ce(t.anchor.line+e,t.anchor.ch),ce(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){$n(t.cm,t.first,t.first-e,e);for(var i=t.cm.display,n=i.viewFrom;n<i.viewTo;n++)Hn(t.cm,n,"gutter")}}function ao(t,e,i,n){if(t.cm&&!t.cm.curOp)return Br(t.cm,ao)(t,e,i,n);if(e.to.line<t.first)ro(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var r=e.text.length-1-(t.first-e.from.line);ro(t,r),e={from:ce(t.first,0),to:ce(e.to.line+r,e.to.ch),text:[tt(e.text)],origin:e.origin}}var a=t.lastLine();e.to.line>a&&(e={from:e.from,to:ce(a,ee(t,a).text.length),text:[e.text[0]],origin:e.origin}),e.removed=ie(t,e.from,e.to),i||(i=fa(t,e)),t.cm?oo(t.cm,e,n):xa(t,e,n),Xa(t,i,G),t.cantEdit&&Za(t,ce(t.firstLine(),0))&&(t.cantEdit=!1)}}function oo(t,e,i){var n=t.doc,r=t.display,a=e.from,o=e.to,s=!1,l=a.line;t.options.lineWrapping||(l=ae(ii(ee(n,a.line))),n.iter(l,o.line+1,function(t){if(t==r.maxLine)return s=!0,!0})),n.sel.contains(e.from,e.to)>-1&&St(t),xa(n,e,i,Nn(t)),t.options.lineWrapping||(n.iter(l,a.line+e.text.length,function(t){var e=ui(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,s=!1)}),s&&(t.curOp.updateMaxLine=!0)),Pe(n,a.line),zr(t,400);var c=e.text.length-(o.line-a.line)-1;e.full?$n(t):a.line!=o.line||1!=e.text.length||ba(t.doc,e)?$n(t,a.line,o.line+1,c):Hn(t,a.line,"text");var u=kt(t,"changes"),d=kt(t,"change");if(d||u){var h={from:a,to:o,text:e.text,removed:e.removed,origin:e.origin};d&&Pi(t,"change",t,h),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(h)}t.display.selForContextMenu=null}function so(t,e,i,n,r){var a;n||(n=i),ue(n,i)<0&&(a=[n,i],i=a[0],n=a[1]),"string"==typeof e&&(e=t.splitLines(e)),eo(t,{from:i,to:n,text:e,origin:r})}function lo(t,e,i,n){i<t.line?t.line+=n:e<t.line&&(t.line=e,t.ch=0)}function co(t,e,i,n){for(var r=0;r<t.length;++r){var a=t[r],o=!0;if(a.ranges){a.copied||(a=t[r]=a.deepCopy(),a.copied=!0);for(var s=0;s<a.ranges.length;s++)lo(a.ranges[s].anchor,e,i,n),lo(a.ranges[s].head,e,i,n)}else{for(var l=0;l<a.changes.length;++l){var c=a.changes[l];if(i<c.from.line)c.from=ce(c.from.line+n,c.from.ch),c.to=ce(c.to.line+n,c.to.ch);else if(e<=c.to.line){o=!1;break}}o||(t.splice(0,r+1),r=0)}}}function uo(t,e){var i=e.from.line,n=e.to.line,r=e.text.length-(n-i)-1;co(t.done,i,n,r),co(t.undone,i,n,r)}function ho(t,e,i,n){var r=e,a=e;return"number"==typeof e?a=ee(t,ve(t,e)):r=ae(e),null==r?null:(n(a,r)&&t.cm&&Hn(t.cm,r,i),a)}function po(t){this.lines=t,this.parent=null;for(var e=0,i=0;i<t.length;++i)t[i].parent=this,e+=t[i].height;this.height=e}function fo(t){this.children=t;for(var e=0,i=0,n=0;n<t.length;++n){var r=t[n];e+=r.chunkSize(),i+=r.height,r.parent=this}this.size=e,this.height=i,this.parent=null}ca.prototype.from=function(){return fe(this.anchor,this.head)},ca.prototype.to=function(){return pe(this.anchor,this.head)},ca.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var i=t,n=t+e;i<n;++i){var r=this.lines[i];this.height-=r.height,fi(r),Pi(r,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,i){this.height+=i,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var n=0;n<e.length;++n)e[n].parent=this},iterN:function(t,e,i){for(var n=t+e;t<n;++t)if(i(this.lines[t]))return!0}},fo.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var i=0;i<this.children.length;++i){var n=this.children[i],r=n.chunkSize();if(t<r){var a=Math.min(e,r-t),o=n.height;if(n.removeInner(t,a),this.height-=o-n.height,r==a&&(this.children.splice(i--,1),n.parent=null),0==(e-=a))break;t=0}else t-=r}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof po))){var s=[];this.collapse(s),this.children=[new po(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,i){this.size+=e.length,this.height+=i;for(var n=0;n<this.children.length;++n){var r=this.children[n],a=r.chunkSize();if(t<=a){if(r.insertInner(t,e,i),r.lines&&r.lines.length>50){for(var o=r.lines.length%25+25,s=o;s<r.lines.length;){var l=new po(r.lines.slice(s,s+=25));r.height-=l.height,this.children.splice(++n,0,l),l.parent=this}r.lines=r.lines.slice(0,o),this.maybeSpill()}break}t-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),i=new fo(e);if(t.parent){t.size-=i.size,t.height-=i.height;var n=Y(t.parent.children,t);t.parent.children.splice(n+1,0,i)}else{var r=new fo(t.children);r.parent=t,t.children=[r,i],t=r}i.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,i){for(var n=0;n<this.children.length;++n){var r=this.children[n],a=r.chunkSize();if(t<a){var o=Math.min(e,a-t);if(r.iterN(t,o,i))return!0;if(0==(e-=o))break;t=0}else t-=a}}};var vo=function(t,e,i){if(i)for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n]);this.doc=t,this.node=e};function go(t,e,i){ci(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&ur(t,i)}function mo(t,e,i,n){var r=new vo(t,i,n),a=t.cm;return a&&r.noHScroll&&(a.display.alignWidgets=!0),ho(t,e,"widget",function(e){var i=e.widgets||(e.widgets=[]);if(null==r.insertAt?i.push(r):i.splice(Math.min(i.length,Math.max(0,r.insertAt)),0,r),r.line=e,a&&!si(t,e)){var n=ci(e)<t.scrollTop;re(e,e.height+Xi(r)),n&&ur(a,r.height),a.curOp.forceUpdate=!0}return!0}),a&&Pi(a,"lineWidgetAdded",a,r,"number"==typeof e?e:ae(e)),r}vo.prototype.clear=function(){var t=this.doc.cm,e=this.line.widgets,i=this.line,n=ae(i);if(null!=n&&e){for(var r=0;r<e.length;++r)e[r]==this&&e.splice(r--,1);e.length||(i.widgets=null);var a=Xi(this);re(i,Math.max(0,i.height-a)),t&&(Fr(t,function(){go(t,i,-a),Hn(t,n,"widget")}),Pi(t,"lineWidgetCleared",t,this,n))}},vo.prototype.changed=function(){var t=this,e=this.height,i=this.doc.cm,n=this.line;this.height=null;var r=Xi(this)-e;r&&(si(this.doc,n)||re(n,n.height+r),i&&Fr(i,function(){i.curOp.forceUpdate=!0,go(i,n,r),Pi(i,"lineWidgetChanged",i,t,ae(n))}))},At(vo);var yo=0,bo=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++yo};function xo(t,e,i,n,r){if(n&&n.shared)return wo(t,e,i,n,r);if(t.cm&&!t.cm.curOp)return Br(t.cm,xo)(t,e,i,n,r);var a=new bo(t,r),o=ue(e,i);if(n&&H(n,a,!1),o>0||0==o&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=D("span",[a.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ei(t,e.line,e,i,a)||e.line!=i.line&&ei(t,i.line,e,i,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Be()}a.addToHistory&&Ia(t,{from:e,to:i,origin:"markText"},t.sel,NaN);var s,l=e.line,c=t.cm;if(t.iter(l,i.line+1,function(n){c&&a.collapsed&&!c.options.lineWrapping&&ii(n)==c.display.maxLine&&(s=!0),a.collapsed&&l!=e.line&&re(n,0),We(n,new Ne(a,l==e.line?e.ch:null,l==i.line?i.ch:null),t.cm&&t.cm.curOp),++l}),a.collapsed&&t.iter(e.line,i.line+1,function(e){si(t,e)&&re(e,0)}),a.clearOnEnter&&bt(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(Fe(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),a.collapsed&&(a.id=++yo,a.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),a.collapsed)$n(c,e.line,i.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var u=e.line;u<=i.line;u++)Hn(c,u,"text");a.atomic&&Ga(c.doc),Pi(c,"markerAdded",c,a)}return a}bo.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Tr(t),kt(this,"clear")){var i=this.find();i&&Pi(this,"clear",i.from,i.to)}for(var n=null,r=null,a=0;a<this.lines.length;++a){var o=this.lines[a],s=Oe(o.markedSpans,this);t&&!this.collapsed?Hn(t,ae(o),"text"):t&&(null!=s.to&&(r=ae(o)),null!=s.from&&(n=ae(o))),o.markedSpans=ze(o.markedSpans,s),null==s.from&&this.collapsed&&!si(this.doc,o)&&t&&re(o,Ln(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=ii(this.lines[l]),u=ui(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=n&&t&&this.collapsed&&$n(t,n,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ga(t.doc)),t&&Pi(t,"markerCleared",t,this,n,r),e&&Mr(t),this.parent&&this.parent.clear()}},bo.prototype.find=function(t,e){var i,n;null==t&&"bookmark"==this.type&&(t=1);for(var r=0;r<this.lines.length;++r){var a=this.lines[r],o=Oe(a.markedSpans,this);if(null!=o.from&&(i=ce(e?a:ae(a),o.from),-1==t))return i;if(null!=o.to&&(n=ce(e?a:ae(a),o.to),1==t))return n}return i&&{from:i,to:n}},bo.prototype.changed=function(){var t=this,e=this.find(-1,!0),i=this,n=this.doc.cm;e&&n&&Fr(n,function(){var r=e.line,a=ae(e.line),o=an(n,a);if(o&&(fn(o),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!si(i.doc,r)&&null!=i.height){var s=i.height;i.height=null;var l=Xi(i)-s;l&&re(r,r.height+l)}Pi(n,"markerChanged",n,t)})},bo.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=Y(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},bo.prototype.detachLine=function(t){if(this.lines.splice(Y(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},At(bo);var _o=function(t,e){this.markers=t,this.primary=e;for(var i=0;i<t.length;++i)t[i].parent=this};function wo(t,e,i,n,r){n=H(n),n.shared=!1;var a=[xo(t,e,i,n,r)],o=a[0],s=n.widgetNode;return _a(t,function(t){s&&(n.widgetNode=s.cloneNode(!0)),a.push(xo(t,ge(t,e),ge(t,i),n,r));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;o=tt(a)}),new _o(a,o)}function Co(t){return t.findMarks(ce(t.first,0),t.clipPos(ce(t.lastLine())),function(t){return t.parent})}function So(t,e){for(var i=0;i<e.length;i++){var n=e[i],r=n.find(),a=t.clipPos(r.from),o=t.clipPos(r.to);if(ue(a,o)){var s=xo(t,a,o,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}function ko(t){for(var e=function(e){var i=t[e],n=[i.primary.doc];_a(i.primary.doc,function(t){return n.push(t)});for(var r=0;r<i.markers.length;r++){var a=i.markers[r];-1==Y(n,a.doc)&&(a.parent=null,i.markers.splice(r--,1))}},i=0;i<t.length;i++)e(i)}_o.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();Pi(this,"clear")}},_o.prototype.find=function(t,e){return this.primary.find(t,e)},At(_o);var Ao=0,To=function(t,e,i,n,r){if(!(this instanceof To))return new To(t,e,i,n,r);null==i&&(i=0),fo.call(this,[new po([new hi("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var a=ce(i,0);this.sel=da(a),this.history=new ka(null),this.id=++Ao,this.modeOption=e,this.lineSep=n,this.direction="rtl"==r?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),xa(this,{from:a,to:a,text:t}),Ya(this,da(a),G)};To.prototype=rt(fo.prototype,{constructor:To,iter:function(t,e,i){i?this.iterN(t-this.first,e-t,i):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var i=0,n=0;n<e.length;++n)i+=e[n].height;this.insertInner(t-this.first,e,i)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=ne(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:Or(function(t){var e=ce(this.first,0),i=this.first+this.size-1;eo(this,{from:e,to:ce(i,ee(this,i).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&hr(this.cm,0,0),Ya(this,da(e),G)}),replaceRange:function(t,e,i,n){e=ge(this,e),i=i?ge(this,i):e,so(this,t,e,i,n)},getRange:function(t,e,i){var n=ie(this,ge(this,t),ge(this,e));return!1===i?n:""===i?n.join(""):n.join(i||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(se(this,t))return ee(this,t)},getLineNumber:function(t){return ae(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=ee(this,t)),ii(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return ge(this,t)},getCursor:function(t){var e,i=this.sel.primary();return e=null==t||"head"==t?i.head:"anchor"==t?i.anchor:"end"==t||"to"==t||!1===t?i.to():i.from(),e},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Or(function(t,e,i){Ha(this,ge(this,"number"==typeof t?ce(t,e||0):t),null,i)}),setSelection:Or(function(t,e,i){Ha(this,ge(this,t),ge(this,e||t),i)}),extendSelection:Or(function(t,e,i){za(this,ge(this,t),e&&ge(this,e),i)}),extendSelections:Or(function(t,e){Wa(this,ye(this,t),e)}),extendSelectionsBy:Or(function(t,e){var i=et(this.sel.ranges,t);Wa(this,ye(this,i),e)}),setSelections:Or(function(t,e,i){if(t.length){for(var n=[],r=0;r<t.length;r++)n[r]=new ca(ge(this,t[r].anchor),ge(this,t[r].head||t[r].anchor));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),Ya(this,ua(this.cm,n,e),i)}}),addSelection:Or(function(t,e,i){var n=this.sel.ranges.slice(0);n.push(new ca(ge(this,t),ge(this,e||t))),Ya(this,ua(this.cm,n,n.length-1),i)}),getSelection:function(t){for(var e,i=this.sel.ranges,n=0;n<i.length;n++){var r=ie(this,i[n].from(),i[n].to());e=e?e.concat(r):r}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=[],i=this.sel.ranges,n=0;n<i.length;n++){var r=ie(this,i[n].from(),i[n].to());!1!==t&&(r=r.join(t||this.lineSeparator())),e[n]=r}return e},replaceSelection:function(t,e,i){for(var n=[],r=0;r<this.sel.ranges.length;r++)n[r]=t;this.replaceSelections(n,e,i||"+input")},replaceSelections:Or(function(t,e,i){for(var n=[],r=this.sel,a=0;a<r.ranges.length;a++){var o=r.ranges[a];n[a]={from:o.from(),to:o.to(),text:this.splitLines(t[a]),origin:i}}for(var s=e&&"end"!=e&&ga(this,n,e),l=n.length-1;l>=0;l--)eo(this,n[l]);s?Ka(this,s):this.cm&&dr(this.cm)}),undo:Or(function(){no(this,"undo")}),redo:Or(function(){no(this,"redo")}),undoSelection:Or(function(){no(this,"undo",!0)}),redoSelection:Or(function(){no(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,i=0,n=0;n<t.done.length;n++)t.done[n].ranges||++e;for(var r=0;r<t.undone.length;r++)t.undone[r].ranges||++i;return{undo:e,redo:i}},clearHistory:function(){var t=this;this.history=new ka(this.history),_a(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Na(this.history.done),undone:Na(this.history.undone)}},setHistory:function(t){var e=this.history=new ka(this.history);e.done=Na(t.done.slice(0),null,!0),e.undone=Na(t.undone.slice(0),null,!0)},setGutterMarker:Or(function(t,e,i){return ho(this,t,"gutter",function(t){var n=t.gutterMarkers||(t.gutterMarkers={});return n[e]=i,!i&&lt(n)&&(t.gutterMarkers=null),!0})}),clearGutter:Or(function(t){var e=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[t]&&ho(e,i,"gutter",function(){return i.gutterMarkers[t]=null,lt(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(t){var e;if("number"==typeof t){if(!se(this,t))return null;if(e=t,t=ee(this,t),!t)return null}else if(e=ae(t),null==e)return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:Or(function(t,e,i){return ho(this,t,"gutter"==e?"gutter":"class",function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass";if(t[n]){if(k(i).test(t[n]))return!1;t[n]+=" "+i}else t[n]=i;return!0})}),removeLineClass:Or(function(t,e,i){return ho(this,t,"gutter"==e?"gutter":"class",function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass",r=t[n];if(!r)return!1;if(null==i)t[n]=null;else{var a=r.match(k(i));if(!a)return!1;var o=a.index+a[0].length;t[n]=r.slice(0,a.index)+(a.index&&o!=r.length?" ":"")+r.slice(o)||null}return!0})}),addLineWidget:Or(function(t,e,i){return mo(this,t,e,i)}),removeLineWidget:function(t){t.clear()},markText:function(t,e,i){return xo(this,ge(this,t),ge(this,e),i,i&&i.type||"range")},setBookmark:function(t,e){var i={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return t=ge(this,t),xo(this,t,t,i,"bookmark")},findMarksAt:function(t){t=ge(this,t);var e=[],i=ee(this,t.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var r=i[n];(null==r.from||r.from<=t.ch)&&(null==r.to||r.to>=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,i){t=ge(this,t),e=ge(this,e);var n=[],r=t.line;return this.iter(t.line,e.line+1,function(a){var o=a.markedSpans;if(o)for(var s=0;s<o.length;s++){var l=o[s];null!=l.to&&r==t.line&&t.ch>=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||i&&!i(l.marker)||n.push(l.marker.parent||l.marker)}++r}),n},getAllMarks:function(){var t=[];return this.iter(function(e){var i=e.markedSpans;if(i)for(var n=0;n<i.length;++n)null!=i[n].from&&t.push(i[n].marker)}),t},posFromIndex:function(t){var e,i=this.first,n=this.lineSeparator().length;return this.iter(function(r){var a=r.text.length+n;if(a>t)return e=t,!0;t-=a,++i}),ge(this,ce(i,e))},indexFromPos:function(t){t=ge(this,t);var e=t.ch;if(t.line<this.first||t.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,t.line,function(t){e+=t.text.length+i}),e},copy:function(t){var e=new To(ne(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,i=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<i&&(i=t.to);var n=new To(ne(this,e,i),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:t.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],So(n,Co(this)),n},unlinkDoc:function(t){if(t instanceof $s&&(t=t.doc),this.linked)for(var e=0;e<this.linked.length;++e){var i=this.linked[e];if(i.doc==t){this.linked.splice(e,1),t.unlinkDoc(this),ko(Co(this));break}}if(t.history==this.history){var n=[t.id];_a(t,function(t){return n.push(t.id)},!0),t.history=new ka(null),t.history.done=Na(this.history.done,n),t.history.undone=Na(this.history.undone,n)}},iterLinkedDocs:function(t){_a(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Ot(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Or(function(t){"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter(function(t){return t.order=null}),this.cm&&Sa(this.cm))})}),To.prototype.eachLine=To.prototype.iter;var Mo=0;function Io(t){var e=this;if(Po(e),!Ct(e,t)&&!Ui(e.display,t)){Tt(t),o&&(Mo=+new Date);var i=zn(e,t,!0),n=t.dataTransfer.files;if(i&&!e.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var r=n.length,a=Array(r),s=0,l=function(){++s==r&&Br(e,function(){i=ge(e.doc,i);var t={from:i,to:i,text:e.doc.splitLines(a.filter(function(t){return null!=t}).join(e.doc.lineSeparator())),origin:"paste"};eo(e.doc,t),Ka(e.doc,da(ge(e.doc,i),ge(e.doc,ha(t))))})()},c=function(t,i){if(e.options.allowDropFileTypes&&-1==Y(e.options.allowDropFileTypes,t.type))l();else{var n=new FileReader;n.onerror=function(){return l()},n.onload=function(){var t=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(a[i]=t),l()},n.readAsText(t)}},u=0;u<n.length;u++)c(n[u],u);else{if(e.state.draggingText&&e.doc.sel.contains(i)>-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var d=t.dataTransfer.getData("Text");if(d){var h;if(e.state.draggingText&&!e.state.draggingText.copy&&(h=e.listSelections()),Xa(e.doc,da(i,i)),h)for(var p=0;p<h.length;++p)so(e.doc,"",h[p].anchor,h[p].head,"drag");e.replaceSelection(d,"around","paste"),e.display.input.focus()}}catch(f){}}}}function Eo(t,e){if(o&&(!t.state.draggingText||+new Date-Mo<100))Et(e);else if(!Ct(t,e)&&!Ui(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!p)){var i=E("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(i.width=i.height=1,t.display.wrapper.appendChild(i),i._top=i.offsetTop),e.dataTransfer.setDragImage(i,0,0),h&&i.parentNode.removeChild(i)}}function Do(t,e){var i=zn(t,e);if(i){var n=document.createDocumentFragment();jn(t,i,n),t.display.dragCursor||(t.display.dragCursor=E("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),I(t.display.dragCursor,n)}}function Po(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Lo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),i=[],n=0;n<e.length;n++){var r=e[n].CodeMirror;r&&i.push(r)}i.length&&i[0].operation(function(){for(var e=0;e<i.length;e++)t(i[e])})}}var Ro=!1;function Fo(){Ro||(Bo(),Ro=!0)}function Bo(){var t;bt(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null,Lo(No)},100))}),bt(window,"blur",function(){return Lo(ir)})}function No(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize()}for(var Oo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},zo=0;zo<10;zo++)Oo[zo+48]=Oo[zo+96]=String(zo);for(var Wo=65;Wo<=90;Wo++)Oo[Wo]=String.fromCharCode(Wo);for(var $o=1;$o<=12;$o++)Oo[$o+111]=Oo[$o+63235]="F"+$o;var Ho={};function Vo(t){var e,i,n,r,a=t.split(/-(?!$)/);t=a[a.length-1];for(var o=0;o<a.length-1;o++){var s=a[o];if(/^(cmd|meta|m)$/i.test(s))r=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))i=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return e&&(t="Alt-"+t),i&&(t="Ctrl-"+t),r&&(t="Cmd-"+t),n&&(t="Shift-"+t),t}function Ko(t){var e={};for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if("..."==n){delete t[i];continue}for(var r=et(i.split(" "),Vo),a=0;a<r.length;a++){var o=void 0,s=void 0;a==r.length-1?(s=r.join(" "),o=n):(s=r.slice(0,a+1).join(" "),o="...");var l=e[s];if(l){if(l!=o)throw new Error("Inconsistent bindings for "+s)}else e[s]=o}delete t[i]}for(var c in e)t[c]=e[c];return t}function Yo(t,e,i,n){e=jo(e);var r=e.call?e.call(t,n):e[t];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&i(r))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Yo(t,e.fallthrough,i,n);for(var a=0;a<e.fallthrough.length;a++){var o=Yo(t,e.fallthrough[a],i,n);if(o)return o}}}function Xo(t){var e="string"==typeof t?t:Oo[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Uo(t,e,i){var n=t;return e.altKey&&"Alt"!=n&&(t="Alt-"+t),(C?e.metaKey:e.ctrlKey)&&"Ctrl"!=n&&(t="Ctrl-"+t),(C?e.ctrlKey:e.metaKey)&&"Mod"!=n&&(t="Cmd-"+t),!i&&e.shiftKey&&"Shift"!=n&&(t="Shift-"+t),t}function Go(t,e){if(h&&34==t.keyCode&&t["char"])return!1;var i=Oo[t.keyCode];return null!=i&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(i=t.code),Uo(i,t,e))}function jo(t){return"string"==typeof t?Ho[t]:t}function qo(t,e){for(var i=t.doc.sel.ranges,n=[],r=0;r<i.length;r++){var a=e(i[r]);while(n.length&&ue(a.from,tt(n).to)<=0){var o=n.pop();if(ue(o.from,a.from)<0){a.from=o.from;break}}n.push(a)}Fr(t,function(){for(var e=n.length-1;e>=0;e--)so(t.doc,"",n[e].from,n[e].to,"+delete");dr(t)})}function Zo(t,e,i){var n=dt(t.text,e+i,i);return n<0||n>t.text.length?null:n}function Jo(t,e,i){var n=Zo(t,e.ch,i);return null==n?null:new ce(e.line,n,i<0?"after":"before")}function Qo(t,e,i,n,r){if(t){"rtl"==e.doc.direction&&(r=-r);var a=mt(i,e.doc.direction);if(a){var o,s=r<0?tt(a):a[0],l=r<0==(1==s.level),c=l?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var u=on(e,i);o=r<0?i.text.length-1:0;var d=sn(e,u,o).top;o=ht(function(t){return sn(e,u,t).top==d},r<0==(1==s.level)?s.from:s.to-1,o),"before"==c&&(o=Zo(i,o,1))}else o=r<0?s.to:s.from;return new ce(n,o,c)}}return new ce(n,r<0?i.text.length:0,r<0?"before":"after")}function ts(t,e,i,n){var r=mt(e,t.doc.direction);if(!r)return Jo(e,i,n);i.ch>=e.text.length?(i.ch=e.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var a=vt(r,i.ch,i.sticky),o=r[a];if("ltr"==t.doc.direction&&o.level%2==0&&(n>0?o.to>i.ch:o.from<i.ch))return Jo(e,i,n);var s,l=function(t,i){return Zo(e,t instanceof ce?t.ch:t,i)},c=function(i){return t.options.lineWrapping?(s=s||on(t,e),Mn(t,e,s,i)):{begin:0,end:e.text.length}},u=c("before"==i.sticky?l(i,-1):i.ch);if("rtl"==t.doc.direction||1==o.level){var d=1==o.level==n<0,h=l(i,d?1:-1);if(null!=h&&(d?h<=o.to&&h<=u.end:h>=o.from&&h>=u.begin)){var p=d?"before":"after";return new ce(i.line,h,p)}}var f=function(t,e,n){for(var a=function(t,e){return e?new ce(i.line,l(t,1),"before"):new ce(i.line,t,"after")};t>=0&&t<r.length;t+=e){var o=r[t],s=e>0==(1!=o.level),c=s?n.begin:l(n.end,-1);if(o.from<=c&&c<o.to)return a(c,s);if(c=s?o.from:l(o.to,-1),n.begin<=c&&c<n.end)return a(c,s)}},v=f(a+n,n,u);if(v)return v;var g=n>0?u.end:l(u.begin,-1);return null==g||n>0&&g==e.text.length||(v=f(n>0?0:r.length-1,n,c(g)),!v)?null:v}Ho.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ho.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ho.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ho.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ho["default"]=b?Ho.macDefault:Ho.pcDefault;var es={selectAll:Qa,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),G)},killLine:function(t){return qo(t,function(e){if(e.empty()){var i=ee(t.doc,e.head.line).text.length;return e.head.ch==i&&e.head.line<t.lastLine()?{from:e.head,to:ce(e.head.line+1,0)}:{from:e.head,to:ce(e.head.line,i)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return qo(t,function(e){return{from:ce(e.from().line,0),to:ge(t.doc,ce(e.to().line+1,0))}})},delLineLeft:function(t){return qo(t,function(t){return{from:ce(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(t){return qo(t,function(e){var i=t.charCoords(e.head,"div").top+5,n=t.coordsChar({left:0,top:i},"div");return{from:n,to:e.from()}})},delWrappedLineRight:function(t){return qo(t,function(e){var i=t.charCoords(e.head,"div").top+5,n=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:i},"div");return{from:e.from(),to:n}})},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(ce(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(ce(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return is(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return rs(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return ns(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){var i=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:i},"div")},q)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){var i=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:i},"div")},q)},goLineLeftSmart:function(t){return t.extendSelectionsBy(function(e){var i=t.cursorCoords(e.head,"div").top+5,n=t.coordsChar({left:0,top:i},"div");return n.ch<t.getLine(n.line).search(/\S/)?rs(t,e.head):n},q)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],i=t.listSelections(),n=t.options.tabSize,r=0;r<i.length;r++){var a=i[r].from(),o=V(t.getLine(a.line),a.ch,n);e.push(Q(n-o%n))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return Fr(t,function(){for(var e=t.listSelections(),i=[],n=0;n<e.length;n++)if(e[n].empty()){var r=e[n].head,a=ee(t.doc,r.line).text;if(a)if(r.ch==a.length&&(r=new ce(r.line,r.ch-1)),r.ch>0)r=new ce(r.line,r.ch+1),t.replaceRange(a.charAt(r.ch-1)+a.charAt(r.ch-2),ce(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var o=ee(t.doc,r.line-1).text;o&&(r=new ce(r.line,1),t.replaceRange(a.charAt(0)+t.doc.lineSeparator()+o.charAt(o.length-1),ce(r.line-1,o.length-1),r,"+transpose"))}i.push(new ca(r,r))}t.setSelections(i)})},newlineAndIndent:function(t){return Fr(t,function(){for(var e=t.listSelections(),i=e.length-1;i>=0;i--)t.replaceRange(t.doc.lineSeparator(),e[i].anchor,e[i].head,"+input");e=t.listSelections();for(var n=0;n<e.length;n++)t.indentLine(e[n].from().line,null,!0);dr(t)})},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function is(t,e){var i=ee(t.doc,e),n=ii(i);return n!=i&&(e=ae(n)),Qo(!0,t,n,e,1)}function ns(t,e){var i=ee(t.doc,e),n=ni(i);return n!=i&&(e=ae(n)),Qo(!0,t,i,e,-1)}function rs(t,e){var i=is(t,e.line),n=ee(t.doc,i.line),r=mt(n,t.doc.direction);if(!r||0==r[0].level){var a=Math.max(i.ch,n.text.search(/\S/)),o=e.line==i.line&&e.ch<=a&&e.ch;return ce(i.line,o?0:a,i.sticky)}return i}function as(t,e,i){if("string"==typeof e&&(e=es[e],!e))return!1;t.display.input.ensurePolled();var n=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i&&(t.display.shift=!1),r=e(t)!=U}finally{t.display.shift=n,t.state.suppressEdits=!1}return r}function os(t,e,i){for(var n=0;n<t.state.keyMaps.length;n++){var r=Yo(e,t.state.keyMaps[n],i,t);if(r)return r}return t.options.extraKeys&&Yo(e,t.options.extraKeys,i,t)||Yo(e,t.options.keyMap,i,t)}var ss=new K;function ls(t,e,i,n){var r=t.state.keySeq;if(r){if(Xo(e))return"handled";if(/\'$/.test(e)?t.state.keySeq=null:ss.set(50,function(){t.state.keySeq==r&&(t.state.keySeq=null,t.display.input.reset())}),cs(t,r+" "+e,i,n))return!0}return cs(t,e,i,n)}function cs(t,e,i,n){var r=os(t,e,n);return"multi"==r&&(t.state.keySeq=e),"handled"==r&&Pi(t,"keyHandled",t,e,i),"handled"!=r&&"multi"!=r||(Tt(i),Jn(t)),!!r}function us(t,e){var i=Go(e,!0);return!!i&&(e.shiftKey&&!t.state.keySeq?ls(t,"Shift-"+i,e,function(e){return as(t,e,!0)})||ls(t,i,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return as(t,e)}):ls(t,i,e,function(e){return as(t,e)}))}function ds(t,e,i){return ls(t,"'"+i+"'",e,function(e){return as(t,e,!0)})}var hs=null;function ps(t){var e=this;if((!t.target||t.target==e.display.input.getField())&&(e.curOp.focus=L(O(e)),!Ct(e,t))){o&&s<11&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var r=us(e,t);h&&(hs=r?n:null,r||88!=n||Wt||!(b?t.metaKey:t.ctrlKey)||e.replaceSelection("",null,"cut")),i&&!b&&!r&&46==n&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||fs(e)}}function fs(t){var e=t.display.lineDiv;function i(t){18!=t.keyCode&&t.altKey||(T(e,"CodeMirror-crosshair"),_t(document,"keyup",i),_t(document,"mouseover",i))}R(e,"CodeMirror-crosshair"),bt(document,"keyup",i),bt(document,"mouseover",i)}function vs(t){16==t.keyCode&&(this.doc.sel.shift=!1),Ct(this,t)}function gs(t){var e=this;if((!t.target||t.target==e.display.input.getField())&&!(Ui(e.display,t)||Ct(e,t)||t.ctrlKey&&!t.altKey||b&&t.metaKey)){var i=t.keyCode,n=t.charCode;if(h&&i==hs)return hs=null,void Tt(t);if(!h||t.which&&!(t.which<10)||!us(e,t)){var r=String.fromCharCode(null==n?i:n);"\b"!=r&&(ds(e,t,r)||e.display.input.onKeyPress(t))}}}var ms,ys,bs=400,xs=function(t,e,i){this.time=t,this.pos=e,this.button=i};function _s(t,e){var i=+new Date;return ys&&ys.compare(i,t,e)?(ms=ys=null,"triple"):ms&&ms.compare(i,t,e)?(ys=new xs(i,t,e),ms=null,"double"):(ms=new xs(i,t,e),ys=null,"single")}function ws(t){var e=this,i=e.display;if(!(Ct(e,t)||i.activeTouch&&i.input.supportsTouch()))if(i.input.ensurePolled(),i.shift=t.shiftKey,Ui(i,t))l||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));else if(!Ds(e,t)){var n=zn(e,t),r=Pt(t),a=n?_s(n,r):"single";W(e).focus(),1==r&&e.state.selectingText&&e.state.selectingText(t),n&&Cs(e,r,n,a,t)||(1==r?n?ks(e,n,a,t):Dt(t)==i.scroller&&Tt(t):2==r?(n&&za(e.doc,n),setTimeout(function(){return i.input.focus()},20)):3==r&&(S?e.display.input.onContextMenu(t):tr(e)))}}function Cs(t,e,i,n,r){var a="Click";return"double"==n?a="Double"+a:"triple"==n&&(a="Triple"+a),a=(1==e?"Left":2==e?"Middle":"Right")+a,ls(t,Uo(a,r),r,function(e){if("string"==typeof e&&(e=es[e]),!e)return!1;var n=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n=e(t,i)!=U}finally{t.state.suppressEdits=!1}return n})}function Ss(t,e,i){var n=t.getOption("configureMouse"),r=n?n(t,e,i):{};if(null==r.unit){var a=x?i.shiftKey&&i.metaKey:i.altKey;r.unit=a?"rectangle":"single"==e?"char":"double"==e?"word":"line"}return(null==r.extend||t.doc.extend)&&(r.extend=t.doc.extend||i.shiftKey),null==r.addNew&&(r.addNew=b?i.metaKey:i.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=!(b?i.altKey:i.ctrlKey)),r}function ks(t,e,i,n){o?setTimeout($(Qn,t),0):t.curOp.focus=L(O(t));var r,a=Ss(t,i,n),s=t.doc.sel;t.options.dragDrop&&Ft&&!t.isReadOnly()&&"single"==i&&(r=s.contains(e))>-1&&(ue((r=s.ranges[r]).from(),e)<0||e.xRel>0)&&(ue(r.to(),e)>0||e.xRel<0)?As(t,n,e,a):Ms(t,n,e,a)}function As(t,e,i,n){var r=t.display,a=!1,c=Br(t,function(e){l&&(r.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:tr(t)),_t(r.wrapper.ownerDocument,"mouseup",c),_t(r.wrapper.ownerDocument,"mousemove",u),_t(r.scroller,"dragstart",d),_t(r.scroller,"drop",c),a||(Tt(e),n.addNew||za(t.doc,i,null,null,n.extend),l&&!p||o&&9==s?setTimeout(function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()},20):r.input.focus())}),u=function(t){a=a||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},d=function(){return a=!0};l&&(r.scroller.draggable=!0),t.state.draggingText=c,c.copy=!n.moveOnDrag,bt(r.wrapper.ownerDocument,"mouseup",c),bt(r.wrapper.ownerDocument,"mousemove",u),bt(r.scroller,"dragstart",d),bt(r.scroller,"drop",c),t.state.delayingBlurEvent=!0,setTimeout(function(){return r.input.focus()},20),r.scroller.dragDrop&&r.scroller.dragDrop()}function Ts(t,e,i){if("char"==i)return new ca(e,e);if("word"==i)return t.findWordAt(e);if("line"==i)return new ca(ce(e.line,0),ge(t.doc,ce(e.line+1,0)));var n=i(t,e);return new ca(n.from,n.to)}function Ms(t,e,i,n){o&&tr(t);var r=t.display,a=t.doc;Tt(e);var s,l,c=a.sel,u=c.ranges;if(n.addNew&&!n.extend?(l=a.sel.contains(i),s=l>-1?u[l]:new ca(i,i)):(s=a.sel.primary(),l=a.sel.primIndex),"rectangle"==n.unit)n.addNew||(s=new ca(i,i)),i=zn(t,e,!0,!0),l=-1;else{var d=Ts(t,i,n.unit);s=n.extend?Oa(s,d.anchor,d.head,n.extend):d}n.addNew?-1==l?(l=u.length,Ya(a,ua(t,u.concat([s]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==n.unit&&!n.extend?(Ya(a,ua(t,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),c=a.sel):$a(a,l,s,j):(l=0,Ya(a,new la([s],0),j),c=a.sel);var h=i;function p(e){if(0!=ue(h,e))if(h=e,"rectangle"==n.unit){for(var r=[],o=t.options.tabSize,u=V(ee(a,i.line).text,i.ch,o),d=V(ee(a,e.line).text,e.ch,o),p=Math.min(u,d),f=Math.max(u,d),v=Math.min(i.line,e.line),g=Math.min(t.lastLine(),Math.max(i.line,e.line));v<=g;v++){var m=ee(a,v).text,y=Z(m,p,o);p==f?r.push(new ca(ce(v,y),ce(v,y))):m.length>y&&r.push(new ca(ce(v,y),ce(v,Z(m,f,o))))}r.length||r.push(new ca(i,i)),Ya(a,ua(t,c.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var b,x=s,_=Ts(t,e,n.unit),w=x.anchor;ue(_.anchor,w)>0?(b=_.head,w=fe(x.from(),_.anchor)):(b=_.anchor,w=pe(x.to(),_.head));var C=c.ranges.slice(0);C[l]=Is(t,new ca(ge(a,w),b)),Ya(a,ua(t,C,l),j)}}var f=r.wrapper.getBoundingClientRect(),v=0;function g(e){var i=++v,o=zn(t,e,!0,"rectangle"==n.unit);if(o)if(0!=ue(o,h)){t.curOp.focus=L(O(t)),p(o);var s=ar(r,a);(o.line>=s.to||o.line<s.from)&&setTimeout(Br(t,function(){v==i&&g(e)}),150)}else{var l=e.clientY<f.top?-20:e.clientY>f.bottom?20:0;l&&setTimeout(Br(t,function(){v==i&&(r.scroller.scrollTop+=l,g(e))}),50)}}function m(e){t.state.selectingText=!1,v=1/0,e&&(Tt(e),r.input.focus()),_t(r.wrapper.ownerDocument,"mousemove",y),_t(r.wrapper.ownerDocument,"mouseup",b),a.history.lastSelOrigin=null}var y=Br(t,function(t){0!==t.buttons&&Pt(t)?g(t):m(t)}),b=Br(t,m);t.state.selectingText=b,bt(r.wrapper.ownerDocument,"mousemove",y),bt(r.wrapper.ownerDocument,"mouseup",b)}function Is(t,e){var i=e.anchor,n=e.head,r=ee(t.doc,i.line);if(0==ue(i,n)&&i.sticky==n.sticky)return e;var a=mt(r);if(!a)return e;var o=vt(a,i.ch,i.sticky),s=a[o];if(s.from!=i.ch&&s.to!=i.ch)return e;var l,c=o+(s.from==i.ch==(1!=s.level)?0:1);if(0==c||c==a.length)return e;if(n.line!=i.line)l=(n.line-i.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=vt(a,n.ch,n.sticky),d=u-o||(n.ch-i.ch)*(1==s.level?-1:1);l=u==c-1||u==c?d<0:d>0}var h=a[c+(l?-1:0)],p=l==(1==h.level),f=p?h.from:h.to,v=p?"after":"before";return i.ch==f&&i.sticky==v?e:new ca(new ce(i.line,f,v),n)}function Es(t,e,i,n){var r,a;if(e.touches)r=e.touches[0].clientX,a=e.touches[0].clientY;else try{r=e.clientX,a=e.clientY}catch(h){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;n&&Tt(e);var o=t.display,s=o.lineDiv.getBoundingClientRect();if(a>s.bottom||!kt(t,i))return It(e);a-=s.top-o.viewOffset;for(var l=0;l<t.display.gutterSpecs.length;++l){var c=o.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=r){var u=oe(t.doc,a),d=t.display.gutterSpecs[l];return wt(t,i,t,u,d.className,e),It(e)}}}function Ds(t,e){return Es(t,e,"gutterClick",!0)}function Ps(t,e){Ui(t.display,e)||Ls(t,e)||Ct(t,e,"contextmenu")||S||t.display.input.onContextMenu(e)}function Ls(t,e){return!!kt(t,"gutterContextMenu")&&Es(t,e,"gutterContextMenu",!1)}function Rs(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),gn(t)}xs.prototype.compare=function(t,e,i){return this.time+bs>t&&0==ue(e,this.pos)&&i==this.button};var Fs={toString:function(){return"CodeMirror.Init"}},Bs={},Ns={};function Os(t){var e=t.optionHandlers;function i(i,n,r,a){t.defaults[i]=n,r&&(e[i]=a?function(t,e,i){i!=Fs&&r(t,e,i)}:r)}t.defineOption=i,t.Init=Fs,i("value","",function(t,e){return t.setValue(e)},!0),i("mode",null,function(t,e){t.doc.modeOption=e,ma(t)},!0),i("indentUnit",2,ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(t){ya(t),gn(t),$n(t)},!0),i("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var i=[],n=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var a=t.text.indexOf(e,r);if(-1==a)break;r=a+e.length,i.push(ce(n,a))}n++});for(var r=i.length-1;r>=0;r--)so(t.doc,e,i[r],ce(i[r].line,i[r].ch+e.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(t,e,i){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),i!=Fs&&t.refresh()}),i("specialCharPlaceholder",bi,function(t){return t.refresh()},!0),i("electricChars",!0),i("inputStyle",y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),i("autocorrect",!1,function(t,e){return t.getInputField().autocorrect=e},!0),i("autocapitalize",!1,function(t,e){return t.getInputField().autocapitalize=e},!0),i("rtlMoveVisually",!_),i("wholeLineUpdateBefore",!0),i("theme","default",function(t){Rs(t),ea(t)},!0),i("keyMap","default",function(t,e,i){var n=jo(e),r=i!=Fs&&jo(i);r&&r.detach&&r.detach(t,n),n.attach&&n.attach(t,r||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Ws,!0),i("gutters",[],function(t,e){t.display.gutterSpecs=Qr(e,t.options.lineNumbers),ea(t)},!0),i("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?Bn(t.display)+"px":"0",t.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(t){return wr(t)},!0),i("scrollbarStyle","native",function(t){kr(t),wr(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),i("lineNumbers",!1,function(t,e){t.display.gutterSpecs=Qr(t.options.gutters,e),ea(t)},!0),i("firstLineNumber",1,ea,!0),i("lineNumberFormatter",function(t){return t},ea,!0),i("showCursorWhenSelecting",!1,Un,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(t,e){"nocursor"==e&&(ir(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),i("screenReaderLabel",null,function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)}),i("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),i("dragDrop",!0,zs),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Un,!0),i("singleCursorHeightPerLine",!0,Un,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,ya,!0),i("addModeClass",!1,ya,!0),i("pollInterval",100),i("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),i("historyEventDelay",1250),i("viewportMargin",10,function(t){return t.refresh()},!0),i("maxHighlightLength",1e4,ya,!0),i("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),i("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),i("autofocus",null),i("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0),i("phrases",null)}function zs(t,e,i){var n=i&&i!=Fs;if(!e!=!n){var r=t.display.dragFunctions,a=e?bt:_t;a(t.display.scroller,"dragstart",r.start),a(t.display.scroller,"dragenter",r.enter),a(t.display.scroller,"dragover",r.over),a(t.display.scroller,"dragleave",r.leave),a(t.display.scroller,"drop",r.drop)}}function Ws(t){t.options.lineWrapping?(R(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(T(t.display.wrapper,"CodeMirror-wrap"),di(t)),On(t),$n(t),gn(t),setTimeout(function(){return wr(t)},100)}function $s(t,e){var i=this;if(!(this instanceof $s))return new $s(t,e);this.options=e=e?H(e):{},H(Bs,e,!1);var n=e.value;"string"==typeof n?n=new To(n,e.mode,null,e.lineSeparator,e.direction):e.mode&&(n.modeOption=e.mode),this.doc=n;var r=new $s.inputStyles[e.inputStyle](this),a=this.display=new ia(t,n,r,e);for(var c in a.wrapper.CodeMirror=this,Rs(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),kr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new K,keySeq:null,specialChars:null},e.autofocus&&!y&&a.input.focus(),o&&s<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Hs(this),Fo(),Tr(this),this.curOp.forceUpdate=!0,wa(this,n),e.autofocus&&!y||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&er(i)},20):ir(this),Ns)Ns.hasOwnProperty(c)&&Ns[c](this,e[c],Fs);Jr(this),e.finishInit&&e.finishInit(this);for(var u=0;u<Vs.length;++u)Vs[u](this);Mr(this),l&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Hs(t){var e=t.display;bt(e.scroller,"mousedown",Br(t,ws)),bt(e.scroller,"dblclick",o&&s<11?Br(t,function(e){if(!Ct(t,e)){var i=zn(t,e);if(i&&!Ds(t,e)&&!Ui(t.display,e)){Tt(e);var n=t.findWordAt(i);za(t.doc,n.anchor,n.head)}}}):function(e){return Ct(t,e)||Tt(e)}),bt(e.scroller,"contextmenu",function(e){return Ps(t,e)}),bt(e.input.getField(),"contextmenu",function(i){e.scroller.contains(i.target)||Ps(t,i)});var i,n={end:0};function r(){e.activeTouch&&(i=setTimeout(function(){return e.activeTouch=null},1e3),n=e.activeTouch,n.end=+new Date)}function a(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}function l(t,e){if(null==e.left)return!0;var i=e.left-t.left,n=e.top-t.top;return i*i+n*n>400}bt(e.scroller,"touchstart",function(r){if(!Ct(t,r)&&!a(r)&&!Ds(t,r)){e.input.ensurePolled(),clearTimeout(i);var o=+new Date;e.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==r.touches.length&&(e.activeTouch.left=r.touches[0].pageX,e.activeTouch.top=r.touches[0].pageY)}}),bt(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),bt(e.scroller,"touchend",function(i){var n=e.activeTouch;if(n&&!Ui(e,i)&&null!=n.left&&!n.moved&&new Date-n.start<300){var a,o=t.coordsChar(e.activeTouch,"page");a=!n.prev||l(n,n.prev)?new ca(o,o):!n.prev.prev||l(n,n.prev.prev)?t.findWordAt(o):new ca(ce(o.line,0),ge(t.doc,ce(o.line+1,0))),t.setSelection(a.anchor,a.head),t.focus(),Tt(i)}r()}),bt(e.scroller,"touchcancel",r),bt(e.scroller,"scroll",function(){e.scroller.clientHeight&&(gr(t,e.scroller.scrollTop),yr(t,e.scroller.scrollLeft,!0),wt(t,"scroll",t))}),bt(e.scroller,"mousewheel",function(e){return sa(t,e)}),bt(e.scroller,"DOMMouseScroll",function(e){return sa(t,e)}),bt(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(e){Ct(t,e)||Et(e)},over:function(e){Ct(t,e)||(Do(t,e),Et(e))},start:function(e){return Eo(t,e)},drop:Br(t,Io),leave:function(e){Ct(t,e)||Po(t)}};var c=e.input.getField();bt(c,"keyup",function(e){return vs.call(t,e)}),bt(c,"keydown",Br(t,ps)),bt(c,"keypress",Br(t,gs)),bt(c,"focus",function(e){return er(t,e)}),bt(c,"blur",function(e){return ir(t,e)})}$s.defaults=Bs,$s.optionHandlers=Ns;var Vs=[];function Ks(t,e,i,n){var r,a=t.doc;null==i&&(i="add"),"smart"==i&&(a.mode.indent?r=Ce(t,e).state:i="prev");var o=t.options.tabSize,s=ee(a,e),l=V(s.text,null,o);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==i&&(c=a.mode.indent(r,s.text.slice(u.length),s.text),c==U||c>150)){if(!n)return;i="prev"}}else c=0,i="not";"prev"==i?c=e>a.first?V(ee(a,e-1).text,null,o):0:"add"==i?c=l+t.options.indentUnit:"subtract"==i?c=l-t.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var d="",h=0;if(t.options.indentWithTabs)for(var p=Math.floor(c/o);p;--p)h+=o,d+="\t";if(h<c&&(d+=Q(c-h)),d!=u)return so(a,d,ce(e,0),ce(e,u.length),"+input"),s.stateAfter=null,!0;for(var f=0;f<a.sel.ranges.length;f++){var v=a.sel.ranges[f];if(v.head.line==e&&v.head.ch<u.length){var g=ce(e,u.length);$a(a,f,new ca(g,g));break}}}$s.defineInitHook=function(t){return Vs.push(t)};var Ys=null;function Xs(t){Ys=t}function Us(t,e,i,n,r){var a=t.doc;t.display.shift=!1,n||(n=a.sel);var o=+new Date-200,s="paste"==r||t.state.pasteIncoming>o,l=Ot(e),c=null;if(s&&n.ranges.length>1)if(Ys&&Ys.text.join("\n")==e){if(n.ranges.length%Ys.text.length==0){c=[];for(var u=0;u<Ys.text.length;u++)c.push(a.splitLines(Ys.text[u]))}}else l.length==n.ranges.length&&t.options.pasteLinesPerSelection&&(c=et(l,function(t){return[t]}));for(var d=t.curOp.updateInput,h=n.ranges.length-1;h>=0;h--){var p=n.ranges[h],f=p.from(),v=p.to();p.empty()&&(i&&i>0?f=ce(f.line,f.ch-i):t.state.overwrite&&!s?v=ce(v.line,Math.min(ee(a,v.line).text.length,v.ch+tt(l).length)):s&&Ys&&Ys.lineWise&&Ys.text.join("\n")==l.join("\n")&&(f=v=ce(f.line,0)));var g={from:f,to:v,text:c?c[h%c.length]:l,origin:r||(s?"paste":t.state.cutIncoming>o?"cut":"+input")};eo(t.doc,g),Pi(t,"inputRead",t,g)}e&&!s&&js(t,e),dr(t),t.curOp.updateInput<2&&(t.curOp.updateInput=d),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Gs(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||!e.hasFocus()||Fr(e,function(){return Us(e,i,0,null,"paste")}),!0}function js(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var i=t.doc.sel,n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(!(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line)){var a=t.getModeAt(r.head),o=!1;if(a.electricChars){for(var s=0;s<a.electricChars.length;s++)if(e.indexOf(a.electricChars.charAt(s))>-1){o=Ks(t,r.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(ee(t.doc,r.head.line).text.slice(0,r.head.ch))&&(o=Ks(t,r.head.line,"smart"));o&&Pi(t,"electricInput",t,r.head.line)}}}function qs(t){for(var e=[],i=[],n=0;n<t.doc.sel.ranges.length;n++){var r=t.doc.sel.ranges[n].head.line,a={anchor:ce(r,0),head:ce(r+1,0)};i.push(a),e.push(t.getRange(a.anchor,a.head))}return{text:e,ranges:i}}function Zs(t,e,i,n){t.setAttribute("autocorrect",i?"on":"off"),t.setAttribute("autocapitalize",n?"on":"off"),t.setAttribute("spellcheck",!!e)}function Js(){var t=E("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),e=E("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return l?t.style.width="1000px":t.setAttribute("wrap","off"),g&&(t.style.border="1px solid black"),e}function Qs(t){var e=t.optionHandlers,i=t.helpers={};t.prototype={constructor:t,focus:function(){W(this).focus(),this.display.input.focus()},setOption:function(t,i){var n=this.options,r=n[t];n[t]==i&&"mode"!=t||(n[t]=i,e.hasOwnProperty(t)&&Br(this,e[t])(this,i,r),wt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](jo(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,i=0;i<e.length;++i)if(e[i]==t||e[i].name==t)return e.splice(i,1),!0},addOverlay:Nr(function(e,i){var n=e.token?e:t.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");it(this.state.overlays,{mode:n,modeSpec:e,opaque:i&&i.opaque,priority:i&&i.priority||0},function(t){return t.priority}),this.state.modeGen++,$n(this)}),removeOverlay:Nr(function(t){for(var e=this.state.overlays,i=0;i<e.length;++i){var n=e[i].modeSpec;if(n==t||"string"==typeof t&&n.name==t)return e.splice(i,1),this.state.modeGen++,void $n(this)}}),indentLine:Nr(function(t,e,i){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),se(this.doc,t)&&Ks(this,t,e,i)}),indentSelection:Nr(function(t){for(var e=this.doc.sel.ranges,i=-1,n=0;n<e.length;n++){var r=e[n];if(r.empty())r.head.line>i&&(Ks(this,r.head.line,t,!0),i=r.head.line,n==this.doc.sel.primIndex&&dr(this));else{var a=r.from(),o=r.to(),s=Math.max(i,a.line);i=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=s;l<i;++l)Ks(this,l,t);var c=this.doc.sel.ranges;0==a.ch&&e.length==c.length&&c[n].from().ch>0&&$a(this.doc,n,new ca(a,c[n].to()),G)}}}),getTokenAt:function(t,e){return Me(this,t,e)},getLineTokens:function(t,e){return Me(this,ce(t),e,!0)},getTokenTypeAt:function(t){t=ge(this.doc,t);var e,i=we(this,ee(this.doc,t.line)),n=0,r=(i.length-1)/2,a=t.ch;if(0==a)e=i[2];else for(;;){var o=n+r>>1;if((o?i[2*o-1]:0)>=a)r=o;else{if(!(i[2*o+1]<a)){e=i[2*o+2];break}n=o+1}}var s=e?e.indexOf("overlay "):-1;return s<0?e:0==s?null:e.slice(0,s-1)},getModeAt:function(e){var i=this.doc.mode;return i.innerMode?t.innerMode(i,this.getTokenAt(e).state).mode:i},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var n=[];if(!i.hasOwnProperty(e))return n;var r=i[e],a=this.getModeAt(t);if("string"==typeof a[e])r[a[e]]&&n.push(r[a[e]]);else if(a[e])for(var o=0;o<a[e].length;o++){var s=r[a[e][o]];s&&n.push(s)}else a.helperType&&r[a.helperType]?n.push(r[a.helperType]):r[a.name]&&n.push(r[a.name]);for(var l=0;l<r._global.length;l++){var c=r._global[l];c.pred(a,this)&&-1==Y(n,c.val)&&n.push(c.val)}return n},getStateAfter:function(t,e){var i=this.doc;return t=ve(i,null==t?i.first+i.size-1:t),Ce(this,t+1,e).state},cursorCoords:function(t,e){var i,n=this.doc.sel.primary();return i=null==t?n.head:"object"==typeof t?ge(this.doc,t):t?n.from():n.to(),Cn(this,i,e||"page")},charCoords:function(t,e){return wn(this,ge(this.doc,t),e||"page")},coordsChar:function(t,e){return t=_n(this,t,e||"page"),An(this,t.left,t.top)},lineAtHeight:function(t,e){return t=_n(this,{top:t,left:0},e||"page").top,oe(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,i){var n,r=!1;if("number"==typeof t){var a=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>a&&(t=a,r=!0),n=ee(this.doc,t)}else n=t;return xn(this,n,{top:0,left:0},e||"page",i||r).top+(r?this.doc.height-ci(n):0)},defaultTextHeight:function(){return Ln(this.display)},defaultCharWidth:function(){return Rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,i,n,r){var a=this.display;t=Cn(this,ge(this.doc,t));var o=t.bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),a.sizer.appendChild(e),"over"==n)o=t.top;else if("above"==n||"near"==n){var l=Math.max(a.wrapper.clientHeight,this.doc.height),c=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?o=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(o=t.bottom),s+e.offsetWidth>c&&(s=c-e.offsetWidth)}e.style.top=o+"px",e.style.left=e.style.right="","right"==r?(s=a.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(a.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),i&&lr(this,{left:s,top:o,right:s+e.offsetWidth,bottom:o+e.offsetHeight})},triggerOnKeyDown:Nr(ps),triggerOnKeyPress:Nr(gs),triggerOnKeyUp:vs,triggerOnMouseDown:Nr(ws),execCommand:function(t){if(es.hasOwnProperty(t))return es[t].call(null,this)},triggerElectric:Nr(function(t){js(this,t)}),findPosH:function(t,e,i,n){var r=1;e<0&&(r=-1,e=-e);for(var a=ge(this.doc,t),o=0;o<e;++o)if(a=tl(this.doc,a,r,i,n),a.hitSide)break;return a},moveH:Nr(function(t,e){var i=this;this.extendSelectionsBy(function(n){return i.display.shift||i.doc.extend||n.empty()?tl(i.doc,n.head,t,e,i.options.rtlMoveVisually):t<0?n.from():n.to()},q)}),deleteH:Nr(function(t,e){var i=this.doc.sel,n=this.doc;i.somethingSelected()?n.replaceSelection("",null,"+delete"):qo(this,function(i){var r=tl(n,i.head,t,e,!1);return t<0?{from:r,to:i.head}:{from:i.head,to:r}})}),findPosV:function(t,e,i,n){var r=1,a=n;e<0&&(r=-1,e=-e);for(var o=ge(this.doc,t),s=0;s<e;++s){var l=Cn(this,o,"div");if(null==a?a=l.left:l.left=a,o=el(this,l,r,i),o.hitSide)break}return o},moveV:Nr(function(t,e){var i=this,n=this.doc,r=[],a=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(o){if(a)return t<0?o.from():o.to();var s=Cn(i,o.head,"div");null!=o.goalColumn&&(s.left=o.goalColumn),r.push(s.left);var l=el(i,s,t,e);return"page"==e&&o==n.sel.primary()&&ur(i,wn(i,l,"div").top-s.top),l},q),r.length)for(var o=0;o<n.sel.ranges.length;o++)n.sel.ranges[o].goalColumn=r[o]}),findWordAt:function(t){var e=this.doc,i=ee(e,t.line).text,n=t.ch,r=t.ch;if(i){var a=this.getHelper(t,"wordChars");"before"!=t.sticky&&r!=i.length||!n?++r:--n;var o=i.charAt(n),s=st(o,a)?function(t){return st(t,a)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!st(t)};while(n>0&&s(i.charAt(n-1)))--n;while(r<i.length&&s(i.charAt(r)))++r}return new ca(ce(t.line,n),ce(t.line,r))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?R(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),wt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==L(O(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Nr(function(t,e){hr(this,t,e)}),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Zi(this)-this.display.barHeight,width:t.scrollWidth-Zi(this)-this.display.barWidth,clientHeight:Qi(this),clientWidth:Ji(this)}},scrollIntoView:Nr(function(t,e){null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:ce(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?pr(this,t):vr(this,t.from,t.to,t.margin)}),setSize:Nr(function(t,e){var i=this,n=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=n(t)),null!=e&&(this.display.wrapper.style.height=n(e)),this.options.lineWrapping&&vn(this);var r=this.display.viewFrom;this.doc.iter(r,this.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){Hn(i,r,"widget");break}++r}),this.curOp.forceUpdate=!0,wt(this,"refresh",this)}),operation:function(t){return Fr(this,t)},startOperation:function(){return Tr(this)},endOperation:function(){return Mr(this)},refresh:Nr(function(){var t=this.display.cachedTextHeight;$n(this),this.curOp.forceUpdate=!0,gn(this),hr(this,this.doc.scrollLeft,this.doc.scrollTop),jr(this.display),(null==t||Math.abs(t-Ln(this.display))>.5||this.options.lineWrapping)&&On(this),wt(this,"refresh",this)}),swapDoc:Nr(function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),wa(this,t),gn(this),this.display.input.reset(),hr(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,Pi(this,"swapDoc",this,e),e}),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},At(t),t.registerHelper=function(e,n,r){i.hasOwnProperty(e)||(i[e]=t[e]={_global:[]}),i[e][n]=r},t.registerGlobalHelper=function(e,n,r,a){t.registerHelper(e,n,a),i[e]._global.push({pred:r,val:a})}}function tl(t,e,i,n,r){var a=e,o=i,s=ee(t,e.line),l=r&&"rtl"==t.direction?-i:i;function c(){var i=e.line+l;return!(i<t.first||i>=t.first+t.size)&&(e=new ce(i,e.ch,e.sticky),s=ee(t,i))}function u(a){var o;if("codepoint"==n){var u=s.text.charCodeAt(e.ch+(i>0?0:-1));if(isNaN(u))o=null;else{var d=i>0?u>=55296&&u<56320:u>=56320&&u<57343;o=new ce(e.line,Math.max(0,Math.min(s.text.length,e.ch+i*(d?2:1))),-i)}}else o=r?ts(t.cm,s,e,i):Jo(s,e,i);if(null==o){if(a||!c())return!1;e=Qo(r,t.cm,s,e.line,l)}else e=o;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,p=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;;f=!1){if(i<0&&!u(!f))break;var v=s.text.charAt(e.ch)||"\n",g=st(v,p)?"w":h&&"\n"==v?"n":!h||/\s/.test(v)?null:"p";if(!h||f||g||(g="s"),d&&d!=g){i<0&&(i=1,u(),e.sticky="after");break}if(g&&(d=g),i>0&&!u(!f))break}var m=Za(t,e,a,o,!0);return de(a,m)&&(m.hitSide=!0),m}function el(t,e,i,n){var r,a,o=t.doc,s=e.left;if("page"==n){var l=Math.min(t.display.wrapper.clientHeight,W(t).innerHeight||o(t).documentElement.clientHeight),c=Math.max(l-.5*Ln(t.display),3);r=(i>0?e.bottom:e.top)+i*c}else"line"==n&&(r=i>0?e.bottom+3:e.top-3);for(;;){if(a=An(t,s,r),!a.outside)break;if(i<0?r<=0:r>=o.height){a.hitSide=!0;break}r+=5*i}return a}var il=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new K,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function nl(t,e){var i=an(t,e.line);if(!i||i.hidden)return null;var n=ee(t.doc,e.line),r=en(i,n,e.line),a=mt(n,t.doc.direction),o="left";if(a){var s=vt(a,e.ch);o=s%2?"right":"left"}var l=un(r.map,e.ch,o);return l.offset="right"==l.collapse?l.end:l.start,l}function rl(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function al(t,e){return e&&(t.bad=!0),t}function ol(t,e,i,n,r){var a="",o=!1,s=t.doc.lineSeparator(),l=!1;function c(t){return function(e){return e.id==t}}function u(){o&&(a+=s,l&&(a+=s),o=l=!1)}function d(t){t&&(u(),a+=t)}function h(e){if(1==e.nodeType){var i=e.getAttribute("cm-text");if(i)return void d(i);var a,p=e.getAttribute("cm-marker");if(p){var f=t.findMarks(ce(n,0),ce(r+1,0),c(+p));return void(f.length&&(a=f[0].find(0))&&d(ie(t.doc,a.from,a.to).join(s)))}if("false"==e.getAttribute("contenteditable"))return;var v=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;v&&u();for(var g=0;g<e.childNodes.length;g++)h(e.childNodes[g]);/^(pre|p)$/i.test(e.nodeName)&&(l=!0),v&&(o=!0)}else 3==e.nodeType&&d(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;;){if(h(e),e==i)break;e=e.nextSibling,l=!1}return a}function sl(t,e,i){var n;if(e==t.display.lineDiv){if(n=t.display.lineDiv.childNodes[i],!n)return al(t.clipPos(ce(t.display.viewTo-1)),!0);e=null,i=0}else for(n=e;;n=n.parentNode){if(!n||n==t.display.lineDiv)return null;if(n.parentNode&&n.parentNode==t.display.lineDiv)break}for(var r=0;r<t.display.view.length;r++){var a=t.display.view[r];if(a.node==n)return ll(a,e,i)}}function ll(t,e,i){var n=t.text.firstChild,r=!1;if(!e||!P(n,e))return al(ce(ae(t.line),0),!0);if(e==n&&(r=!0,e=n.childNodes[i],i=0,!e)){var a=t.rest?tt(t.rest):t.line;return al(ce(ae(a),a.text.length),r)}var o=3==e.nodeType?e:null,s=e;o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,i&&(i=o.nodeValue.length));while(s.parentNode!=n)s=s.parentNode;var l=t.measure,c=l.maps;function u(e,i,n){for(var r=-1;r<(c?c.length:0);r++)for(var a=r<0?l.map:c[r],o=0;o<a.length;o+=3){var s=a[o+2];if(s==e||s==i){var u=ae(r<0?t.line:t.rest[r]),d=a[o]+n;return(n<0||s!=e)&&(d=a[o+(n?1:0)]),ce(u,d)}}}var d=u(o,s,i);if(d)return al(d,r);for(var h=s.nextSibling,p=o?o.nodeValue.length-i:0;h;h=h.nextSibling){if(d=u(h,h.firstChild,0),d)return al(ce(d.line,d.ch-p),r);p+=h.textContent.length}for(var f=s.previousSibling,v=i;f;f=f.previousSibling){if(d=u(f,f.firstChild,-1),d)return al(ce(d.line,d.ch+v),r);v+=f.textContent.length}}il.prototype.init=function(t){var e=this,i=this,n=i.cm,r=i.div=t.lineDiv;function a(t){for(var e=t.target;e;e=e.parentNode){if(e==r)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(e.className))break}return!1}function o(t){if(a(t)&&!Ct(n,t)){if(n.somethingSelected())Xs({lineWise:!1,text:n.getSelections()}),"cut"==t.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var e=qs(n);Xs({lineWise:!0,text:e.text}),"cut"==t.type&&n.operation(function(){n.setSelections(e.ranges,0,G),n.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var o=Ys.text.join("\n");if(t.clipboardData.setData("Text",o),t.clipboardData.getData("Text")==o)return void t.preventDefault()}var s=Js(),l=s.firstChild;Zs(l),n.display.lineSpace.insertBefore(s,n.display.lineSpace.firstChild),l.value=Ys.text.join("\n");var c=L(z(r));B(l),setTimeout(function(){n.display.lineSpace.removeChild(s),c.focus(),c==r&&i.showPrimarySelection()},50)}}r.contentEditable=!0,Zs(r,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),bt(r,"paste",function(t){!a(t)||Ct(n,t)||Gs(t,n)||s<=11&&setTimeout(Br(n,function(){return e.updateFromDOM()}),20)}),bt(r,"compositionstart",function(t){e.composing={data:t.data,done:!1}}),bt(r,"compositionupdate",function(t){e.composing||(e.composing={data:t.data,done:!1})}),bt(r,"compositionend",function(t){e.composing&&(t.data!=e.composing.data&&e.readFromDOMSoon(),e.composing.done=!0)}),bt(r,"touchstart",function(){return i.forceCompositionEnd()}),bt(r,"input",function(){e.composing||e.readFromDOMSoon()}),bt(r,"copy",o),bt(r,"cut",o)},il.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},il.prototype.prepareSelection=function(){var t=Gn(this.cm,!1);return t.focus=L(z(this.div))==this.div,t},il.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},il.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},il.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,n=e.doc.sel.primary(),r=n.from(),a=n.to();if(e.display.viewTo==e.display.viewFrom||r.line>=e.display.viewTo||a.line<e.display.viewFrom)t.removeAllRanges();else{var o=sl(e,t.anchorNode,t.anchorOffset),s=sl(e,t.focusNode,t.focusOffset);if(!o||o.bad||!s||s.bad||0!=ue(fe(o,s),r)||0!=ue(pe(o,s),a)){var l=e.display.view,c=r.line>=e.display.viewFrom&&nl(e,r)||{node:l[0].measure.map[2],offset:0},u=a.line<e.display.viewTo&&nl(e,a);if(!u){var d=l[l.length-1].measure,h=d.maps?d.maps[d.maps.length-1]:d.map;u={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(c&&u){var p,f=t.rangeCount&&t.getRangeAt(0);try{p=A(c.node,c.offset,u.offset,u.node)}catch(v){}p&&(!i&&e.state.focused?(t.collapse(c.node,c.offset),p.collapsed||(t.removeAllRanges(),t.addRange(p))):(t.removeAllRanges(),t.addRange(p)),f&&null==t.anchorNode?t.addRange(f):i&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},il.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation(function(){return t.cm.curOp.selectionChanged=!0})},20)},il.prototype.showMultipleSelections=function(t){I(this.cm.display.cursorDiv,t.cursors),I(this.cm.display.selectionDiv,t.selection)},il.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},il.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return P(this.div,e)},il.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&L(z(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},il.prototype.blur=function(){this.div.blur()},il.prototype.getField=function(){return this.div},il.prototype.supportsTouch=function(){return!0},il.prototype.receivedFocus=function(){var t=this,e=this;function i(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,i))}this.selectionInEditor()?setTimeout(function(){return t.pollSelection()},20):Fr(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,i)},il.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},il.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),e=this.cm;if(m&&u&&this.cm.display.gutterSpecs.length&&rl(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var i=sl(e,t.anchorNode,t.anchorOffset),n=sl(e,t.focusNode,t.focusOffset);i&&n&&Fr(e,function(){Ya(e.doc,da(i,n),G),(i.bad||n.bad)&&(e.curOp.selectionChanged=!0)})}}},il.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,e,i,n=this.cm,r=n.display,a=n.doc.sel.primary(),o=a.from(),s=a.to();if(0==o.ch&&o.line>n.firstLine()&&(o=ce(o.line-1,ee(n.doc,o.line-1).length)),s.ch==ee(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=ce(s.line+1,0)),o.line<r.viewFrom||s.line>r.viewTo-1)return!1;o.line==r.viewFrom||0==(t=Wn(n,o.line))?(e=ae(r.view[0].line),i=r.view[0].node):(e=ae(r.view[t].line),i=r.view[t-1].node.nextSibling);var l,c,u=Wn(n,s.line);if(u==r.view.length-1?(l=r.viewTo-1,c=r.lineDiv.lastChild):(l=ae(r.view[u+1].line)-1,c=r.view[u+1].node.previousSibling),!i)return!1;var d=n.doc.splitLines(ol(n,i,c,e,l)),h=ie(n.doc,ce(e,0),ce(l,ee(n.doc,l).text.length));while(d.length>1&&h.length>1)if(tt(d)==tt(h))d.pop(),h.pop(),l--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),e++}var p=0,f=0,v=d[0],g=h[0],m=Math.min(v.length,g.length);while(p<m&&v.charCodeAt(p)==g.charCodeAt(p))++p;var y=tt(d),b=tt(h),x=Math.min(y.length-(1==d.length?p:0),b.length-(1==h.length?p:0));while(f<x&&y.charCodeAt(y.length-f-1)==b.charCodeAt(b.length-f-1))++f;if(1==d.length&&1==h.length&&e==o.line)while(p&&p>o.ch&&y.charCodeAt(y.length-f-1)==b.charCodeAt(b.length-f-1))p--,f++;d[d.length-1]=y.slice(0,y.length-f).replace(/^\u200b+/,""),d[0]=d[0].slice(p).replace(/\u200b+$/,"");var _=ce(e,p),w=ce(l,h.length?tt(h).length-f:0);return d.length>1||d[0]||ue(_,w)?(so(n.doc,d,_,w,"+input"),!0):void 0},il.prototype.ensurePolled=function(){this.forceCompositionEnd()},il.prototype.reset=function(){this.forceCompositionEnd()},il.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},il.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},il.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Fr(this.cm,function(){return $n(t.cm)})},il.prototype.setUneditable=function(t){t.contentEditable="false"},il.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||Br(this.cm,Us)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},il.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},il.prototype.onContextMenu=function(){},il.prototype.resetPosition=function(){},il.prototype.needsContentAttribute=!0;var cl=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new K,this.hasSelection=!1,this.composing=null,this.resetting=!1};function ul(t,e){if(e=e?H(e):{},e.value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var i=L(z(t));e.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}function n(){t.value=s.getValue()}var r;if(t.form&&(bt(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var a=t.form;r=a.submit;try{var o=a.submit=function(){n(),a.submit=r,a.submit(),a.submit=o}}catch(l){}}e.finishInit=function(i){i.save=n,i.getTextArea=function(){return t},i.toTextArea=function(){i.toTextArea=isNaN,n(),t.parentNode.removeChild(i.getWrapperElement()),t.style.display="",t.form&&(_t(t.form,"submit",n),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=r))}},t.style.display="none";var s=$s(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return s}function dl(t){t.off=_t,t.on=bt,t.wheelEventPixels=oa,t.Doc=To,t.splitLines=Ot,t.countColumn=V,t.findColumn=Z,t.isWordChar=ot,t.Pass=U,t.signal=wt,t.Line=hi,t.changeEnd=ha,t.scrollbarModel=Sr,t.Pos=ce,t.cmpPos=ue,t.modes=Vt,t.mimeModes=Kt,t.resolveMode=Ut,t.getMode=Gt,t.modeExtensions=jt,t.extendMode=qt,t.copyState=Zt,t.startState=Qt,t.innerMode=Jt,t.commands=es,t.keyMap=Ho,t.keyName=Go,t.isModifierKey=Xo,t.lookupKey=Yo,t.normalizeKeyMap=Ko,t.StringStream=te,t.SharedTextMarker=_o,t.TextMarker=bo,t.LineWidget=vo,t.e_preventDefault=Tt,t.e_stopPropagation=Mt,t.e_stop=Et,t.addClass=R,t.contains=P,t.rmClass=T,t.keyNames=Oo}cl.prototype.init=function(t){var e=this,i=this,n=this.cm;this.createField(t);var r=this.textarea;function a(t){if(!Ct(n,t)){if(n.somethingSelected())Xs({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var e=qs(n);Xs({lineWise:!0,text:e.text}),"cut"==t.type?n.setSelections(e.ranges,null,G):(i.prevInput="",r.value=e.text.join("\n"),B(r))}"cut"==t.type&&(n.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(r.style.width="0px"),bt(r,"input",function(){o&&s>=9&&e.hasSelection&&(e.hasSelection=null),i.poll()}),bt(r,"paste",function(t){Ct(n,t)||Gs(t,n)||(n.state.pasteIncoming=+new Date,i.fastPoll())}),bt(r,"cut",a),bt(r,"copy",a),bt(t.scroller,"paste",function(e){if(!Ui(t,e)&&!Ct(n,e)){if(!r.dispatchEvent)return n.state.pasteIncoming=+new Date,void i.focus();var a=new Event("paste");a.clipboardData=e.clipboardData,r.dispatchEvent(a)}}),bt(t.lineSpace,"selectstart",function(e){Ui(t,e)||Tt(e)}),bt(r,"compositionstart",function(){var t=n.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:n.markText(t,n.getCursor("to"),{className:"CodeMirror-composing"})}}),bt(r,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},cl.prototype.createField=function(t){this.wrapper=Js(),this.textarea=this.wrapper.firstChild;var e=this.cm.options;Zs(this.textarea,e.spellcheck,e.autocorrect,e.autocapitalize)},cl.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},cl.prototype.prepareSelection=function(){var t=this.cm,e=t.display,i=t.doc,n=Gn(t);if(t.options.moveInputWithCursor){var r=Cn(t,i.sel.primary().head,"div"),a=e.wrapper.getBoundingClientRect(),o=e.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+o.top-a.top)),n.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+o.left-a.left))}return n},cl.prototype.showSelection=function(t){var e=this.cm,i=e.display;I(i.cursorDiv,t.cursors),I(i.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},cl.prototype.reset=function(t){if(!(this.contextMenuPending||this.composing&&t)){var e=this.cm;if(this.resetting=!0,e.somethingSelected()){this.prevInput="";var i=e.getSelection();this.textarea.value=i,e.state.focused&&B(this.textarea),o&&s>=9&&(this.hasSelection=i)}else t||(this.prevInput=this.textarea.value="",o&&s>=9&&(this.hasSelection=null));this.resetting=!1}},cl.prototype.getField=function(){return this.textarea},cl.prototype.supportsTouch=function(){return!1},cl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||L(z(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(t){}},cl.prototype.blur=function(){this.textarea.blur()},cl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},cl.prototype.receivedFocus=function(){this.slowPoll()},cl.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},cl.prototype.fastPoll=function(){var t=!1,e=this;function i(){var n=e.poll();n||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,i))}e.pollingFast=!0,e.polling.set(20,i)},cl.prototype.poll=function(){var t=this,e=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!e.state.focused||zt(i)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=i.value;if(r==n&&!e.somethingSelected())return!1;if(o&&s>=9&&this.hasSelection===r||b&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var a=r.charCodeAt(0);if(8203!=a||n||(n=""),8666==a)return this.reset(),this.cm.execCommand("undo")}var l=0,c=Math.min(n.length,r.length);while(l<c&&n.charCodeAt(l)==r.charCodeAt(l))++l;return Fr(e,function(){Us(e,r.slice(l),n.length-l,null,t.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?i.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},cl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},cl.prototype.onKeyPress=function(){o&&s>=9&&(this.hasSelection=null),this.fastPoll()},cl.prototype.onContextMenu=function(t){var e=this,i=e.cm,n=i.display,r=e.textarea;e.contextMenuPending&&e.contextMenuPending();var a=zn(i,t),c=n.scroller.scrollTop;if(a&&!h){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(a)&&Br(i,Ya)(i.doc,da(a),G);var d,p=r.style.cssText,f=e.wrapper.style.cssText,v=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-v.top-5)+"px; left: "+(t.clientX-v.left-5)+"px;\n z-index: 1000; background: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(d=r.ownerDocument.defaultView.scrollY),n.input.focus(),l&&r.ownerDocument.defaultView.scrollTo(null,d),n.input.reset(),i.somethingSelected()||(r.value=e.prevInput=" "),e.contextMenuPending=y,n.selForContextMenu=i.doc.sel,clearTimeout(n.detectingSelectAll),o&&s>=9&&m(),S){Et(t);var g=function(){_t(window,"mouseup",g),setTimeout(y,20)};bt(window,"mouseup",g)}else setTimeout(y,50)}function m(){if(null!=r.selectionStart){var t=i.somethingSelected(),a=""+(t?r.value:"");r.value="⇚",r.value=a,e.prevInput=t?"":"",r.selectionStart=1,r.selectionEnd=a.length,n.selForContextMenu=i.doc.sel}}function y(){if(e.contextMenuPending==y&&(e.contextMenuPending=!1,e.wrapper.style.cssText=f,r.style.cssText=p,o&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=c),null!=r.selectionStart)){(!o||o&&s<9)&&m();var t=0,a=function(){n.selForContextMenu==i.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&""==e.prevInput?Br(i,Qa)(i):t++<10?n.detectingSelectAll=setTimeout(a,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(a,200)}}},cl.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},cl.prototype.setUneditable=function(){},cl.prototype.needsContentAttribute=!1,Os($s),Qs($s);var hl="iter insert remove copy getEditor constructor".split(" ");for(var pl in To.prototype)To.prototype.hasOwnProperty(pl)&&Y(hl,pl)<0&&($s.prototype[pl]=function(t){return function(){return t.apply(this.doc,arguments)}}(To.prototype[pl]));return At(To),$s.inputStyles={textarea:cl,contenteditable:il},$s.defineMode=function(t){$s.defaults.mode||"null"==t||($s.defaults.mode=t),Yt.apply(this,arguments)},$s.defineMIME=Xt,$s.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),$s.defineMIME("text/plain","null"),$s.defineExtension=function(t,e){$s.prototype[t]=e},$s.defineDocExtension=function(t,e){To.prototype[t]=e},$s.fromTextArea=ul,dl($s),$s.version="5.65.16",$s})},19021:function(t,e,i){(function(e,i){t.exports=i()})(0,function(){var t=t||function(t,e){var n;if("undefined"!==typeof window&&window.crypto&&(n=window.crypto),"undefined"!==typeof self&&self.crypto&&(n=self.crypto),"undefined"!==typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!==typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&"undefined"!==typeof i.g&&i.g.crypto&&(n=i.g.crypto),!n)try{n=i(50477)}catch(g){}var r=function(){if(n){if("function"===typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(g){}if("function"===typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(e){var i;return t.prototype=e,i=new t,t.prototype=null,i}}(),o={},s=o.lib={},l=s.Base=function(){return{extend:function(t){var e=a(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),c=s.WordArray=l.extend({init:function(t,i){t=this.words=t||[],this.sigBytes=i!=e?i:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes,r=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a<r;a++){var o=i[a>>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s<r;s+=4)e[n+s>>>2]=i[s>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i<t;i+=4)e.push(r());return new c.init(e,t)}}),u=o.enc={},d=u.Hex={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r++){var a=e[r>>>2]>>>24-r%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n<e;n+=2)i[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new c.init(i,e/2)}},h=u.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r++){var a=e[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n<e;n++)i[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new c.init(i,e)}},p=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},f=s.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var i,n=this._data,r=n.words,a=n.sigBytes,o=this.blockSize,s=4*o,l=a/s;l=e?t.ceil(l):t.max((0|l)-this._minBufferSize,0);var u=l*o,d=t.min(4*u,a);if(u){for(var h=0;h<u;h+=o)this._doProcessBlock(r,h);i=r.splice(0,u),n.sigBytes-=d}return new c.init(i,d)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),v=(s.Hasher=f.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,i){return new t.init(i).finalize(e)}},_createHmacHelper:function(t){return function(e,i){return new v.HMAC.init(t,i).finalize(e)}}}),o.algo={});return o}(Math);return t})},21396:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(43240),i(6440),i(45503),i(80754),i(64725),i(84636),i(45471),i(63009),i(36308),i(81380),i(89557),i(45953),i(78056),i(51025),i(70019),i(39506),i(57165),i(82169),i(96939),i(6372),i(73797),i(38454),i(42073),i(54905),i(10482),i(52155),i(58124),i(70025),i(40955),i(7628),i(77193),i(96298),i(22696),i(43128))})(0,function(t){return t})},22696:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.StreamCipher,r=e.algo,a=[],o=[],s=[],l=r.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(e){var a=e.words,o=a[0],s=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=h;for(r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(t,e){var i=this._X;c.call(this),a[0]=i[0]^i[5]>>>16^i[3]<<16,a[1]=i[2]^i[7]>>>16^i[5]<<16,a[2]=i[4]^i[1]>>>16^i[7]<<16,a[3]=i[6]^i[3]>>>16^i[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),t[e+n]^=a[n]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,i=0;i<8;i++)o[i]=e[i];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0;for(i=0;i<8;i++){var n=t[i]+e[i],r=65535&n,a=n>>>16,l=((r*r>>>17)+r*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[i]=l^c}t[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,t[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,t[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,t[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,t[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,t[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,t[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,t[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(l)}(),t.RabbitLegacy})},35038:function(t,e,i){"use strict";i.d(e,{Qo:function(){return a},_3:function(){return u},dp:function(){return o},iO:function(){return c},mk:function(){return s},ms:function(){return l},z6:function(){return d}});var n=i(75769),r={GetWatchlist:"/api/market/watchlist/get",AddWatchlist:"/api/market/watchlist/add",RemoveWatchlist:"/api/market/watchlist/remove",GetWatchlistPrices:"/api/market/watchlist/prices",MultiAnalysis:"/api/analysis/multiAnalysis",CreateAnalysisTask:"/api/analysis/createTask",GetAnalysisTaskStatus:"/api/analysis/getTaskStatus",GetAnalysisHistoryList:"/api/analysis/getHistoryList",DeleteAnalysisTask:"/api/analysis/deleteTask",ReflectAnalysis:"/api/analysis/reflect",ChatMessage:"/api/ai/chat/message",GetChatHistory:"/api/ai/chat/history",SaveChatHistory:"/api/ai/chat/history/save",GetConfig:"/api/market/config",GetMenuFooterConfig:"/api/market/menuFooterConfig",GetMarketTypes:"/api/market/types",SearchSymbols:"/api/market/symbols/search",GetHotSymbols:"/api/market/symbols/hot"};function a(t){return(0,n.Ay)({url:r.GetWatchlist,method:"get",params:t})}function o(t){return(0,n.Ay)({url:r.AddWatchlist,method:"post",data:t})}function s(t){return(0,n.Ay)({url:r.RemoveWatchlist,method:"post",data:t})}function l(t){return(0,n.Ay)({url:r.GetWatchlistPrices,method:"get",params:{watchlist:JSON.stringify(t.watchlist||[])}})}function c(){return(0,n.Ay)({url:r.GetMarketTypes,method:"get"})}function u(t){return(0,n.Ay)({url:r.SearchSymbols,method:"get",params:t})}function d(t){return(0,n.Ay)({url:r.GetHotSymbols,method:"get",params:t})}},36308:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(63009))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.algo,a=r.SHA256,o=r.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=4,t}});e.SHA224=a._createHelper(o),e.HmacSHA224=a._createHmacHelper(o)}(),t.SHA224})},38454:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e}(),t.mode.ECB})},39506:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(45471),i(51025))})(0,function(t){return function(){var e=t,i=e.lib,n=i.Base,r=i.WordArray,a=e.algo,o=a.MD5,s=a.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var i,n=this.cfg,a=n.hasher.create(),o=r.create(),s=o.words,l=n.keySize,c=n.iterations;while(s.length<l){i&&a.update(i),i=a.update(t).finalize(e),a.reset();for(var u=1;u<c;u++)i=a.finalize(i),a.reset();o.concat(i)}return o.sigBytes=4*l,o}});e.EvpKDF=function(t,e,i){return s.create(i).compute(t,e)}}(),t.EvpKDF})},40955:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.BlockCipher,r=e.algo,a=[],o=[],s=[],l=[],c=[],u=[],d=[],h=[],p=[],f=[];(function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var i=0,n=0;for(e=0;e<256;e++){var r=n^n<<1^n<<2^n<<3^n<<4;r=r>>>8^255&r^99,a[i]=r,o[r]=i;var v=t[i],g=t[v],m=t[g],y=257*t[r]^16843008*r;s[i]=y<<24|y>>>8,l[i]=y<<16|y>>>16,c[i]=y<<8|y>>>24,u[i]=y;y=16843009*m^65537*g^257*v^16843008*i;d[r]=y<<24|y>>>8,h[r]=y<<16|y>>>16,p[r]=y<<8|y>>>24,f[r]=y,i?(i=v^t[t[t[m^v]]],n^=t[t[n]]):i=n=1}})();var v=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,i=t.sigBytes/4,n=this._nRounds=i+6,r=4*(n+1),o=this._keySchedule=[],s=0;s<r;s++)s<i?o[s]=e[s]:(u=o[s-1],s%i?i>6&&s%i==4&&(u=a[u>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u]):(u=u<<8|u>>>24,u=a[u>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u],u^=v[s/i|0]<<24),o[s]=o[s-i]^u);for(var l=this._invKeySchedule=[],c=0;c<r;c++){s=r-c;if(c%4)var u=o[s];else u=o[s-4];l[c]=c<4||s<=4?u:d[a[u>>>24]]^h[a[u>>>16&255]]^p[a[u>>>8&255]]^f[a[255&u]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,l,c,u,a)},decryptBlock:function(t,e){var i=t[e+1];t[e+1]=t[e+3],t[e+3]=i,this._doCryptBlock(t,e,this._invKeySchedule,d,h,p,f,o);i=t[e+1];t[e+1]=t[e+3],t[e+3]=i},_doCryptBlock:function(t,e,i,n,r,a,o,s){for(var l=this._nRounds,c=t[e]^i[0],u=t[e+1]^i[1],d=t[e+2]^i[2],h=t[e+3]^i[3],p=4,f=1;f<l;f++){var v=n[c>>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&h]^i[p++],g=n[u>>>24]^r[d>>>16&255]^a[h>>>8&255]^o[255&c]^i[p++],m=n[d>>>24]^r[h>>>16&255]^a[c>>>8&255]^o[255&u]^i[p++],y=n[h>>>24]^r[c>>>16&255]^a[u>>>8&255]^o[255&d]^i[p++];c=v,u=g,d=m,h=y}v=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^i[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^i[p++],m=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^i[p++],y=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++];t[e]=v,t[e+1]=g,t[e+2]=m,t[e+3]=y},keySize:8});e.AES=n._createHelper(g)}(),t.AES})},42073:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.AnsiX923={pad:function(t,e){var i=t.sigBytes,n=4*e,r=n-i%n,a=i+r-1;t.clamp(),t.words[a>>>2]|=r<<24-a%4*8,t.sigBytes+=r},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923})},43128:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.BlockCipher,r=e.algo;const a=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function c(t,e){let i=e>>24&255,n=e>>16&255,r=e>>8&255,a=255&e,o=t.sbox[0][i]+t.sbox[1][n];return o^=t.sbox[2][r],o+=t.sbox[3][a],o}function u(t,e,i){let n,r=e,o=i;for(let s=0;s<a;++s)r^=t.pbox[s],o=c(t,r)^o,n=r,r=o,o=n;return n=r,r=o,o=n,o^=t.pbox[a],r^=t.pbox[a+1],{left:r,right:o}}function d(t,e,i){let n,r=e,o=i;for(let s=a+1;s>1;--s)r^=t.pbox[s],o=c(t,r)^o,n=r,r=o,o=n;return n=r,r=o,o=n,o^=t.pbox[1],r^=t.pbox[0],{left:r,right:o}}function h(t,e,i){for(let a=0;a<4;a++){t.sbox[a]=[];for(let e=0;e<256;e++)t.sbox[a][e]=s[a][e]}let n=0;for(let s=0;s<a+2;s++)t.pbox[s]=o[s]^e[n],n++,n>=i&&(n=0);let r=0,l=0,c=0;for(let o=0;o<a+2;o+=2)c=u(t,r,l),r=c.left,l=c.right,t.pbox[o]=r,t.pbox[o+1]=l;for(let a=0;a<4;a++)for(let e=0;e<256;e+=2)c=u(t,r,l),r=c.left,l=c.right,t.sbox[a][e]=r,t.sbox[a][e+1]=l;return!0}var p=r.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,i=t.sigBytes/4;h(l,e,i)}},encryptBlock:function(t,e){var i=u(l,t[e],t[e+1]);t[e]=i.left,t[e+1]=i.right},decryptBlock:function(t,e){var i=d(l,t[e],t[e+1]);t[e]=i.left,t[e+1]=i.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=n._createHelper(p)}(),t.Blowfish})},43240:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.Base,a=n.WordArray,o=i.x64={};o.Word=r.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=r.extend({init:function(t,i){t=this.words=t||[],this.sigBytes=i!=e?i:8*t.length},toX32:function(){for(var t=this.words,e=t.length,i=[],n=0;n<e;n++){var r=t[n];i.push(r.high),i.push(r.low)}return a.create(i,this.sigBytes)},clone:function(){for(var t=r.clone.call(this),e=t.words=this.words.slice(0),i=e.length,n=0;n<i;n++)e[n]=e[n].clone();return t}})}(),t})},45471:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=i.Hasher,a=e.algo,o=[],s=a.SHA1=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],a=i[2],s=i[3],l=i[4],c=0;c<80;c++){if(c<16)o[c]=0|t[e+c];else{var u=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=u<<1|u>>>31}var d=(n<<5|n>>>27)+l+o[c];d+=c<20?1518500249+(r&a|~r&s):c<40?1859775393+(r^a^s):c<60?(r&a|r&s|a&s)-1894007588:(r^a^s)-899497514,l=s,s=a,a=r<<30|r>>>2,r=n,n=d}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+s|0,i[4]=i[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(i/4294967296),e[15+(n+64>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA1=r._createHelper(s),e.HmacSHA1=r._createHmacHelper(s)}(),t.SHA1})},45503:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.enc;r.Utf16=r.Utf16BE={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r+=2){var a=e[r>>>2]>>>16-r%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r<e;r++)i[r>>>1]|=t.charCodeAt(r)<<16-r%2*16;return n.create(i,2*e)}};function a(t){return t<<8&4278255360|t>>>8&16711935}r.Utf16LE={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r+=2){var o=a(e[r>>>2]>>>16-r%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r<e;r++)i[r>>>1]|=a(t.charCodeAt(r)<<16-r%2*16);return n.create(i,2*e)}}}(),t.enc.Utf16})},45953:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(43240))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.WordArray,a=n.Hasher,o=i.x64,s=o.Word,l=i.algo,c=[],u=[],d=[];(function(){for(var t=1,e=0,i=0;i<24;i++){c[t+5*e]=(i+1)*(i+2)/2%64;var n=e%5,r=(2*t+3*e)%5;t=n,e=r}for(t=0;t<5;t++)for(e=0;e<5;e++)u[t+5*e]=e+(2*t+3*e)%5*5;for(var a=1,o=0;o<24;o++){for(var l=0,h=0,p=0;p<7;p++){if(1&a){var f=(1<<p)-1;f<32?h^=1<<f:l^=1<<f-32}128&a?a=a<<1^113:a<<=1}d[o]=s.create(l,h)}})();var h=[];(function(){for(var t=0;t<25;t++)h[t]=s.create()})();var p=l.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var i=this._state,n=this.blockSize/2,r=0;r<n;r++){var a=t[e+2*r],o=t[e+2*r+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8);var s=i[r];s.high^=o,s.low^=a}for(var l=0;l<24;l++){for(var p=0;p<5;p++){for(var f=0,v=0,g=0;g<5;g++){s=i[p+5*g];f^=s.high,v^=s.low}var m=h[p];m.high=f,m.low=v}for(p=0;p<5;p++){var y=h[(p+4)%5],b=h[(p+1)%5],x=b.high,_=b.low;for(f=y.high^(x<<1|_>>>31),v=y.low^(_<<1|x>>>31),g=0;g<5;g++){s=i[p+5*g];s.high^=f,s.low^=v}}for(var w=1;w<25;w++){s=i[w];var C=s.high,S=s.low,k=c[w];k<32?(f=C<<k|S>>>32-k,v=S<<k|C>>>32-k):(f=S<<k-32|C>>>64-k,v=C<<k-32|S>>>64-k);var A=h[u[w]];A.high=f,A.low=v}var T=h[0],M=i[0];T.high=M.high,T.low=M.low;for(p=0;p<5;p++)for(g=0;g<5;g++){w=p+5*g,s=i[w];var I=h[w],E=h[(p+1)%5+5*g],D=h[(p+2)%5+5*g];s.high=I.high^~E.high&D.high,s.low=I.low^~E.low&D.low}s=i[0];var P=d[l];s.high^=P.high,s.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words,n=(this._nDataBytes,8*t.sigBytes),a=32*this.blockSize;i[n>>>5]|=1<<24-n%32,i[(e.ceil((n+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,l=s/8,c=[],u=0;u<l;u++){var d=o[u],h=d.high,p=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new r.init(c,s)},clone:function(){for(var t=a.clone.call(this),e=t._state=this._state.slice(0),i=0;i<25;i++)e[i]=e[i].clone();return t}});i.SHA3=a._createHelper(p),i.HmacSHA3=a._createHmacHelper(p)}(Math),t.SHA3})},50436:function(t,e,i){(function(t){t(i(15237))})(function(t){"use strict";var e="CodeMirror-activeline",i="CodeMirror-activeline-background",n="CodeMirror-activeline-gutter";function r(t){for(var r=0;r<t.state.activeLines.length;r++)t.removeLineClass(t.state.activeLines[r],"wrap",e),t.removeLineClass(t.state.activeLines[r],"background",i),t.removeLineClass(t.state.activeLines[r],"gutter",n)}function a(t,e){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!=e[i])return!1;return!0}function o(t,o){for(var s=[],l=0;l<o.length;l++){var c=o[l],u=t.getOption("styleActiveLine");if("object"==typeof u&&u.nonEmpty?c.anchor.line==c.head.line:c.empty()){var d=t.getLineHandleVisualStart(c.head.line);s[s.length-1]!=d&&s.push(d)}}a(t.state.activeLines,s)||t.operation(function(){r(t);for(var a=0;a<s.length;a++)t.addLineClass(s[a],"wrap",e),t.addLineClass(s[a],"background",i),t.addLineClass(s[a],"gutter",n);t.state.activeLines=s})}function s(t,e){o(t,e.ranges)}t.defineOption("styleActiveLine",!1,function(e,i,n){var a=n!=t.Init&&n;i!=a&&(a&&(e.off("beforeSelectionChange",s),r(e),delete e.state.activeLines),i&&(e.state.activeLines=[],o(e,e.listSelections()),e.on("beforeSelectionChange",s)))})})},50477:function(){},51025:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){(function(){var e=t,i=e.lib,n=i.Base,r=e.enc,a=r.Utf8,o=e.algo;o.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=a.parse(e));var i=t.blockSize,n=4*i;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),s=r.words,l=o.words,c=0;c<i;c++)s[c]^=1549556828,l[c]^=909522486;r.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,i=e.finalize(t);e.reset();var n=e.finalize(this._oKey.clone().concat(i));return n}})})()})},52155:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.ZeroPadding={pad:function(t,e){var i=4*e;t.clamp(),t.sigBytes+=i-(t.sigBytes%i||i)},unpad:function(t){var e=t.words,i=t.sigBytes-1;for(i=t.sigBytes-1;i>=0;i--)if(e[i>>>2]>>>24-i%4*8&255){t.sigBytes=i+1;break}}},t.pad.ZeroPadding})},54905:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.Iso10126={pad:function(e,i){var n=4*i,r=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(r-1)).concat(t.lib.WordArray.create([r<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126})},55218:function(t,e,i){(function(t){t(i(15237))})(function(t){var e={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},i=t.Pos;function n(t,i){return"pairs"==i&&"string"==typeof t?t:"object"==typeof t&&null!=t[i]?t[i]:e[i]}t.defineOption("autoCloseBrackets",!1,function(e,i,o){o&&o!=t.Init&&(e.removeKeyMap(r),e.state.closeBrackets=null),i&&(a(n(i,"pairs")),e.state.closeBrackets=i,e.addKeyMap(r))});var r={Backspace:l,Enter:c};function a(t){for(var e=0;e<t.length;e++){var i=t.charAt(e),n="'"+i+"'";r[n]||(r[n]=o(i))}}function o(t){return function(e){return h(e,t)}}function s(t){var e=t.state.closeBrackets;if(!e||e.override)return e;var i=t.getModeAt(t.getCursor());return i.closeBrackets||e}function l(e){var r=s(e);if(!r||e.getOption("disableInput"))return t.Pass;for(var a=n(r,"pairs"),o=e.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return t.Pass;var c=p(e,o[l].head);if(!c||a.indexOf(c)%2!=0)return t.Pass}for(l=o.length-1;l>=0;l--){var u=o[l].head;e.replaceRange("",i(u.line,u.ch-1),i(u.line,u.ch+1),"+delete")}}function c(e){var i=s(e),r=i&&n(i,"explode");if(!r||e.getOption("disableInput"))return t.Pass;for(var a=e.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return t.Pass;var l=p(e,a[o].head);if(!l||r.indexOf(l)%2!=0)return t.Pass}e.operation(function(){var t=e.lineSeparator()||"\n";e.replaceSelection(t+t,null),u(e,-1),a=e.listSelections();for(var i=0;i<a.length;i++){var n=a[i].head.line;e.indentLine(n,null,!0),e.indentLine(n+1,null,!0)}})}function u(t,e){for(var i=[],n=t.listSelections(),r=0,a=0;a<n.length;a++){var o=n[a];o.head==t.getCursor()&&(r=a);var s=o.head.ch||e>0?{line:o.head.line,ch:o.head.ch+e}:{line:o.head.line-1};i.push({anchor:s,head:s})}t.setSelections(i,r)}function d(e){var n=t.cmpPos(e.anchor,e.head)>0;return{anchor:new i(e.anchor.line,e.anchor.ch+(n?-1:1)),head:new i(e.head.line,e.head.ch+(n?1:-1))}}function h(e,r){var a=s(e);if(!a||e.getOption("disableInput"))return t.Pass;var o=n(a,"pairs"),l=o.indexOf(r);if(-1==l)return t.Pass;for(var c,h=n(a,"closeBefore"),p=n(a,"triples"),v=o.charAt(l+1)==r,g=e.listSelections(),m=l%2==0,y=0;y<g.length;y++){var b,x=g[y],_=x.head,w=e.getRange(_,i(_.line,_.ch+1));if(m&&!x.empty())b="surround";else if(!v&&m||w!=r)if(v&&_.ch>1&&p.indexOf(r)>=0&&e.getRange(i(_.line,_.ch-2),_)==r+r){if(_.ch>2&&/\bstring/.test(e.getTokenTypeAt(i(_.line,_.ch-2))))return t.Pass;b="addFour"}else if(v){var C=0==_.ch?" ":e.getRange(i(_.line,_.ch-1),_);if(t.isWordChar(w)||C==r||t.isWordChar(C))return t.Pass;b="both"}else{if(!m||!(0===w.length||/\s/.test(w)||h.indexOf(w)>-1))return t.Pass;b="both"}else b=v&&f(e,_)?"both":p.indexOf(r)>=0&&e.getRange(_,i(_.line,_.ch+3))==r+r+r?"skipThree":"skip";if(c){if(c!=b)return t.Pass}else c=b}var S=l%2?o.charAt(l-1):r,k=l%2?r:o.charAt(l+1);e.operation(function(){if("skip"==c)u(e,1);else if("skipThree"==c)u(e,3);else if("surround"==c){for(var t=e.getSelections(),i=0;i<t.length;i++)t[i]=S+t[i]+k;e.replaceSelections(t,"around"),t=e.listSelections().slice();for(i=0;i<t.length;i++)t[i]=d(t[i]);e.setSelections(t)}else"both"==c?(e.replaceSelection(S+k,null),e.triggerElectric(S+k),u(e,-1)):"addFour"==c&&(e.replaceSelection(S+S+S+S,"before"),u(e,1))})}function p(t,e){var n=t.getRange(i(e.line,e.ch-1),i(e.line,e.ch+1));return 2==n.length?n:null}function f(t,e){var n=t.getTokenAt(i(e.line,e.ch+1));return/\bstring/.test(n.type)&&n.start==e.ch&&(0==e.ch||!/\bstring/.test(t.getTokenTypeAt(e)))}a(e.pairs+"`")})},57165:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(39506))})(0,function(t){t.lib.Cipher||function(e){var i=t,n=i.lib,r=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,s=i.enc,l=(s.Utf8,s.Base64),c=i.algo,u=c.EvpKDF,d=n.Cipher=o.extend({cfg:r.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,i){this.cfg=this.cfg.extend(i),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?C:x}return function(e){return{encrypt:function(i,n,r){return t(n).encrypt(e,i,n,r)},decrypt:function(i,n,r){return t(n).decrypt(e,i,n,r)}}}}()}),h=(n.StreamCipher=d.extend({_doFinalize:function(){var t=this._process(!0);return t},blockSize:1}),i.mode={}),p=n.BlockCipherMode=r.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),f=h.CBC=function(){var t=p.extend();function i(t,i,n){var r,a=this._iv;a?(r=a,this._iv=e):r=this._prevBlock;for(var o=0;o<n;o++)t[i+o]^=r[o]}return t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize;i.call(this,t,e,r),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+r)}}),t.Decryptor=t.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,a=t.slice(e,e+r);n.decryptBlock(t,e),i.call(this,t,e,r),this._prevBlock=a}}),t}(),v=i.pad={},g=v.Pkcs7={pad:function(t,e){for(var i=4*e,n=i-t.sigBytes%i,r=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(r);var l=a.create(o,n);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},m=(n.BlockCipher=d.extend({cfg:d.cfg.extend({mode:f,padding:g}),reset:function(){var t;d.reset.call(this);var e=this.cfg,i=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,i&&i.words):(this._mode=t.call(n,this,i&&i.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),n.CipherParams=r.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),y=i.format={},b=y.OpenSSL={stringify:function(t){var e,i=t.ciphertext,n=t.salt;return e=n?a.create([1398893684,1701076831]).concat(n).concat(i):i,e.toString(l)},parse:function(t){var e,i=l.parse(t),n=i.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=a.create(n.slice(2,4)),n.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:e})}},x=n.SerializableCipher=r.extend({cfg:r.extend({format:b}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=t.createEncryptor(i,n),a=r.finalize(e),o=r.cfg;return m.create({ciphertext:a,key:i,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,i,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var r=t.createDecryptor(i,n).finalize(e.ciphertext);return r},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),_=i.kdf={},w=_.OpenSSL={execute:function(t,e,i,n,r){if(n||(n=a.random(8)),r)o=u.create({keySize:e+i,hasher:r}).compute(t,n);else var o=u.create({keySize:e+i}).compute(t,n);var s=a.create(o.words.slice(e),4*i);return o.sigBytes=4*e,m.create({key:o,iv:s,salt:n})}},C=n.PasswordBasedCipher=x.extend({cfg:x.cfg.extend({kdf:w}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=n.kdf.execute(i,t.keySize,t.ivSize,n.salt,n.hasher);n.iv=r.iv;var a=x.encrypt.call(this,t,e,r.key,n);return a.mixIn(r),a},decrypt:function(t,e,i,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var r=n.kdf.execute(i,t.keySize,t.ivSize,e.salt,n.hasher);n.iv=r.iv;var a=x.decrypt.call(this,t,e,r.key,n);return a}})}()})},58124:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})},63009:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.WordArray,a=n.Hasher,o=i.algo,s=[],l=[];(function(){function t(t){for(var i=e.sqrt(t),n=2;n<=i;n++)if(!(t%n))return!1;return!0}function i(t){return 4294967296*(t-(0|t))|0}var n=2,r=0;while(r<64)t(n)&&(r<8&&(s[r]=i(e.pow(n,.5))),l[r]=i(e.pow(n,1/3)),r++),n++})();var c=[],u=o.SHA256=a.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],u=i[5],d=i[6],h=i[7],p=0;p<64;p++){if(p<16)c[p]=0|t[e+p];else{var f=c[p-15],v=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=c[p-2],m=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=v+c[p-7]+m+c[p-16]}var y=s&u^~s&d,b=n&r^n&a^r&a,x=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),w=h+_+y+l[p]+c[p],C=x+b;h=d,d=u,u=s,s=o+w|0,o=a,a=r,r=n,n=w+C|0}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+s|0,i[5]=i[5]+u|0,i[6]=i[6]+d|0,i[7]=i[7]+h|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(n/4294967296),i[15+(r+64>>>9<<4)]=n,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}});i.SHA256=a._createHelper(u),i.HmacSHA256=a._createHmacHelper(u)}(Math),t.SHA256})},64725:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.enc;r.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var i=t.words,n=t.sigBytes,r=e?this._safe_map:this._map;t.clamp();for(var a=[],o=0;o<n;o+=3)for(var s=i[o>>>2]>>>24-o%4*8&255,l=i[o+1>>>2]>>>24-(o+1)%4*8&255,c=i[o+2>>>2]>>>24-(o+2)%4*8&255,u=s<<16|l<<8|c,d=0;d<4&&o+.75*d<n;d++)a.push(r.charAt(u>>>6*(3-d)&63));var h=r.charAt(64);if(h)while(a.length%4)a.push(h);return a.join("")},parse:function(t,e){void 0===e&&(e=!0);var i=t.length,n=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var l=t.indexOf(s);-1!==l&&(i=l)}return a(t,i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(t,e,i){for(var r=[],a=0,o=0;o<e;o++)if(o%4){var s=i[t.charCodeAt(o-1)]<<o%4*2,l=i[t.charCodeAt(o)]>>>6-o%4*2,c=s|l;r[a>>>2]|=c<<24-a%4*8,a++}return n.create(r,a)}}(),t.enc.Base64url})},70019:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(63009),i(51025))})(0,function(t){return function(){var e=t,i=e.lib,n=i.Base,r=i.WordArray,a=e.algo,o=a.SHA256,s=a.HMAC,l=a.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var i=this.cfg,n=s.create(i.hasher,t),a=r.create(),o=r.create([1]),l=a.words,c=o.words,u=i.keySize,d=i.iterations;while(l.length<u){var h=n.update(e).finalize(o);n.reset();for(var p=h.words,f=p.length,v=h,g=1;g<d;g++){v=n.finalize(v),n.reset();for(var m=v.words,y=0;y<f;y++)p[y]^=m[y]}a.concat(h),c[0]++}return a.sigBytes=4*u,a}});e.PBKDF2=function(t,e,i){return l.create(i).compute(t,e)}}(),t.PBKDF2})},70025:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.CipherParams,r=e.enc,a=r.Hex,o=e.format;o.Hex={stringify:function(t){return t.ciphertext.toString(a)},parse:function(t){var e=a.parse(t);return n.create({ciphertext:e})}}}(),t.format.Hex})},73797:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),i=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,r=this._iv,a=this._keystream;r&&(a=this._keystream=r.slice(0),this._iv=void 0),i.encryptBlock(a,0);for(var o=0;o<n;o++)t[e+o]^=a[o]}});return e.Decryptor=i,e}(),t.mode.OFB})},74806:function(t,e,i){(function(t){t(i(15237))})(function(t){"use strict";function e(t){return new RegExp("^(("+t.join(")|(")+"))\\b")}var i=e(["and","or","not","is"]),n=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in","False","True"],r=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function a(t){return t.scopes[t.scopes.length-1]}t.registerHelper("hintWords","python",n.concat(r).concat(["exec","print"])),t.defineMode("python",function(o,s){for(var l="error",c=s.delimiters||s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,u=[s.singleOperators,s.doubleOperators,s.doubleDelimiters,s.tripleDelimiters,s.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],d=0;d<u.length;d++)u[d]||u.splice(d--,1);var h=s.hangingIndent||o.indentUnit,p=n,f=r;void 0!=s.extra_keywords&&(p=p.concat(s.extra_keywords)),void 0!=s.extra_builtins&&(f=f.concat(s.extra_builtins));var v=!(s.version&&Number(s.version)<3);if(v){var g=s.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;p=p.concat(["nonlocal","None","aiter","anext","async","await","breakpoint","match","case"]),f=f.concat(["ascii","bytes","exec","print"]);var m=new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))","i")}else{g=s.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;p=p.concat(["exec","print"]),f=f.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","None"]);m=new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var y=e(p),b=e(f);function x(t,e){var i=t.sol()&&"\\"!=e.lastToken;if(i&&(e.indent=t.indentation()),i&&"py"==a(e).type){var n=a(e).offset;if(t.eatSpace()){var r=t.indentation();return r>n?S(e):r<n&&A(t,e)&&"#"!=t.peek()&&(e.errorToken=!0),null}var o=_(t,e);return n>0&&A(t,e)&&(o+=" "+l),o}return _(t,e)}function _(t,e,n){if(t.eatSpace())return null;if(!n&&t.match(/^#.*/))return"comment";if(t.match(/^[0-9\.]/,!1)){var r=!1;if(t.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),t.match(/^[\d_]+\.\d*/)&&(r=!0),t.match(/^\.\d+/)&&(r=!0),r)return t.eat(/J/i),"number";var a=!1;if(t.match(/^0x[0-9a-f_]+/i)&&(a=!0),t.match(/^0b[01_]+/i)&&(a=!0),t.match(/^0o[0-7_]+/i)&&(a=!0),t.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(t.eat(/J/i),a=!0),t.match(/^0(?![\dx])/i)&&(a=!0),a)return t.eat(/L/i),"number"}if(t.match(m)){var o=-1!==t.current().toLowerCase().indexOf("f");return o?(e.tokenize=w(t.current(),e.tokenize),e.tokenize(t,e)):(e.tokenize=C(t.current(),e.tokenize),e.tokenize(t,e))}for(var s=0;s<u.length;s++)if(t.match(u[s]))return"operator";return t.match(c)?"punctuation":"."==e.lastToken&&t.match(g)?"property":t.match(y)||t.match(i)?"keyword":t.match(b)?"builtin":t.match(/^(self|cls)\b/)?"variable-2":t.match(g)?"def"==e.lastToken||"class"==e.lastToken?"def":"variable":(t.next(),n?null:l)}function w(t,e){while("rubf".indexOf(t.charAt(0).toLowerCase())>=0)t=t.substr(1);var i=1==t.length,n="string";function r(t){return function(e,i){var n=_(e,i,!0);return"punctuation"==n&&("{"==e.current()?i.tokenize=r(t+1):"}"==e.current()&&(i.tokenize=t>1?r(t-1):a)),n}}function a(a,o){while(!a.eol())if(a.eatWhile(/[^'"\{\}\\]/),a.eat("\\")){if(a.next(),i&&a.eol())return n}else{if(a.match(t))return o.tokenize=e,n;if(a.match("{{"))return n;if(a.match("{",!1))return o.tokenize=r(0),a.current()?n:o.tokenize(a,o);if(a.match("}}"))return n;if(a.match("}"))return l;a.eat(/['"]/)}if(i){if(s.singleLineStringErrors)return l;o.tokenize=e}return n}return a.isString=!0,a}function C(t,e){while("rubf".indexOf(t.charAt(0).toLowerCase())>=0)t=t.substr(1);var i=1==t.length,n="string";function r(r,a){while(!r.eol())if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),i&&r.eol())return n}else{if(r.match(t))return a.tokenize=e,n;r.eat(/['"]/)}if(i){if(s.singleLineStringErrors)return l;a.tokenize=e}return n}return r.isString=!0,r}function S(t){while("py"!=a(t).type)t.scopes.pop();t.scopes.push({offset:a(t).offset+o.indentUnit,type:"py",align:null})}function k(t,e,i){var n=t.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:t.column()+1;e.scopes.push({offset:e.indent+h,type:i,align:n})}function A(t,e){var i=t.indentation();while(e.scopes.length>1&&a(e).offset>i){if("py"!=a(e).type)return!0;e.scopes.pop()}return a(e).offset!=i}function T(t,e){t.sol()&&(e.beginningOfLine=!0,e.dedent=!1);var i=e.tokenize(t,e),n=t.current();if(e.beginningOfLine&&"@"==n)return t.match(g,!1)?"meta":v?"operator":l;if(/\S/.test(n)&&(e.beginningOfLine=!1),"variable"!=i&&"builtin"!=i||"meta"!=e.lastToken||(i="meta"),"pass"!=n&&"return"!=n||(e.dedent=!0),"lambda"==n&&(e.lambda=!0),":"==n&&!e.lambda&&"py"==a(e).type&&t.match(/^\s*(?:#|$)/,!1)&&S(e),1==n.length&&!/string|comment/.test(i)){var r="[({".indexOf(n);if(-1!=r&&k(t,e,"])}".slice(r,r+1)),r="])}".indexOf(n),-1!=r){if(a(e).type!=n)return l;e.indent=e.scopes.pop().offset-h}}return e.dedent&&t.eol()&&"py"==a(e).type&&e.scopes.length>1&&e.scopes.pop(),i}var M={startState:function(t){return{tokenize:x,scopes:[{offset:t||0,type:"py",align:null}],indent:t||0,lastToken:null,lambda:!1,dedent:0}},token:function(t,e){var i=e.errorToken;i&&(e.errorToken=!1);var n=T(t,e);return n&&"comment"!=n&&(e.lastToken="keyword"==n||"punctuation"==n?t.current():n),"punctuation"==n&&(n=null),t.eol()&&e.lambda&&(e.lambda=!1),i?n+" "+l:n},indent:function(e,i){if(e.tokenize!=x)return e.tokenize.isString?t.Pass:0;var n=a(e),r=n.type==i.charAt(0)||"py"==n.type&&!e.dedent&&/^(else:|elif |except |finally:)/.test(i);return null!=n.align?n.align-(r?1:0):n.offset-(r?h:0)},electricInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return M}),t.defineMIME("text/x-python","python");var o=function(t){return t.split(" ")};t.defineMIME("text/x-cython",{name:"python",extra_keywords:o("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")})})},77193:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.StreamCipher,r=e.algo,a=r.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,i=t.sigBytes,n=this._S=[],r=0;r<256;r++)n[r]=r;r=0;for(var a=0;r<256;r++){var o=r%i,s=e[o>>>2]>>>24-o%4*8&255;a=(a+n[r]+s)%256;var l=n[r];n[r]=n[a],n[a]=l}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var t=this._S,e=this._i,i=this._j,n=0,r=0;r<4;r++){e=(e+1)%256,i=(i+t[e])%256;var a=t[e];t[e]=t[i],t[i]=a,n|=t[(t[e]+t[i])%256]<<24-8*r}return this._i=e,this._j=i,n}e.RC4=n._createHelper(a);var s=r.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)o.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})},78056:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){
/** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
return function(){var e=t,i=e.lib,n=i.WordArray,r=i.Hasher,a=e.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),d=n.create([1352829926,1548603684,1836072691,2053994217,0]),h=a.RIPEMD160=r.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var i=0;i<16;i++){var n=e+i,r=t[n];t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a,h,b,x,_,w,C,S,k,A,T,M=this._hash.words,I=u.words,E=d.words,D=o.words,P=s.words,L=l.words,R=c.words;w=a=M[0],C=h=M[1],S=b=M[2],k=x=M[3],A=_=M[4];for(i=0;i<80;i+=1)T=a+t[e+D[i]]|0,T+=i<16?p(h,b,x)+I[0]:i<32?f(h,b,x)+I[1]:i<48?v(h,b,x)+I[2]:i<64?g(h,b,x)+I[3]:m(h,b,x)+I[4],T|=0,T=y(T,L[i]),T=T+_|0,a=_,_=x,x=y(b,10),b=h,h=T,T=w+t[e+P[i]]|0,T+=i<16?m(C,S,k)+E[0]:i<32?g(C,S,k)+E[1]:i<48?v(C,S,k)+E[2]:i<64?f(C,S,k)+E[3]:p(C,S,k)+E[4],T|=0,T=y(T,R[i]),T=T+A|0,w=A,A=k,k=y(S,10),S=C,C=T;T=M[1]+b+k|0,M[1]=M[2]+x+A|0,M[2]=M[3]+_+w|0,M[3]=M[4]+a+C|0,M[4]=M[0]+h+S|0,M[0]=T},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(e.length+1),this._process();for(var r=this._hash,a=r.words,o=0;o<5;o++){var s=a[o];a[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return r},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,i){return t^e^i}function f(t,e,i){return t&e|~t&i}function v(t,e,i){return(t|~e)^i}function g(t,e,i){return t&i|e&~i}function m(t,e,i){return t^(e|~i)}function y(t,e){return t<<e|t>>>32-e}e.RIPEMD160=r._createHelper(h),e.HmacRIPEMD160=r._createHmacHelper(h)}(Math),t.RIPEMD160})},80754:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.enc;r.Base64={stringify:function(t){var e=t.words,i=t.sigBytes,n=this._map;t.clamp();for(var r=[],a=0;a<i;a+=3)for(var o=e[a>>>2]>>>24-a%4*8&255,s=e[a+1>>>2]>>>24-(a+1)%4*8&255,l=e[a+2>>>2]>>>24-(a+2)%4*8&255,c=o<<16|s<<8|l,u=0;u<4&&a+.75*u<i;u++)r.push(n.charAt(c>>>6*(3-u)&63));var d=n.charAt(64);if(d)while(r.length%4)r.push(d);return r.join("")},parse:function(t){var e=t.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var r=0;r<i.length;r++)n[i.charCodeAt(r)]=r}var o=i.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(e=s)}return a(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(t,e,i){for(var r=[],a=0,o=0;o<e;o++)if(o%4){var s=i[t.charCodeAt(o-1)]<<o%4*2,l=i[t.charCodeAt(o)]>>>6-o%4*2,c=s|l;r[a>>>2]|=c<<24-a%4*8,a++}return n.create(r,a)}}(),t.enc.Base64})},81380:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(43240))})(0,function(t){return function(){var e=t,i=e.lib,n=i.Hasher,r=e.x64,a=r.Word,o=r.WordArray,s=e.algo;function l(){return a.create.apply(a,arguments)}var c=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],u=[];(function(){for(var t=0;t<80;t++)u[t]=l()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],l=i[5],d=i[6],h=i[7],p=n.high,f=n.low,v=r.high,g=r.low,m=a.high,y=a.low,b=o.high,x=o.low,_=s.high,w=s.low,C=l.high,S=l.low,k=d.high,A=d.low,T=h.high,M=h.low,I=p,E=f,D=v,P=g,L=m,R=y,F=b,B=x,N=_,O=w,z=C,W=S,$=k,H=A,V=T,K=M,Y=0;Y<80;Y++){var X,U,G=u[Y];if(Y<16)U=G.high=0|t[e+2*Y],X=G.low=0|t[e+2*Y+1];else{var j=u[Y-15],q=j.high,Z=j.low,J=(q>>>1|Z<<31)^(q>>>8|Z<<24)^q>>>7,Q=(Z>>>1|q<<31)^(Z>>>8|q<<24)^(Z>>>7|q<<25),tt=u[Y-2],et=tt.high,it=tt.low,nt=(et>>>19|it<<13)^(et<<3|it>>>29)^et>>>6,rt=(it>>>19|et<<13)^(it<<3|et>>>29)^(it>>>6|et<<26),at=u[Y-7],ot=at.high,st=at.low,lt=u[Y-16],ct=lt.high,ut=lt.low;X=Q+st,U=J+ot+(X>>>0<Q>>>0?1:0),X+=rt,U=U+nt+(X>>>0<rt>>>0?1:0),X+=ut,U=U+ct+(X>>>0<ut>>>0?1:0),G.high=U,G.low=X}var dt=N&z^~N&$,ht=O&W^~O&H,pt=I&D^I&L^D&L,ft=E&P^E&R^P&R,vt=(I>>>28|E<<4)^(I<<30|E>>>2)^(I<<25|E>>>7),gt=(E>>>28|I<<4)^(E<<30|I>>>2)^(E<<25|I>>>7),mt=(N>>>14|O<<18)^(N>>>18|O<<14)^(N<<23|O>>>9),yt=(O>>>14|N<<18)^(O>>>18|N<<14)^(O<<23|N>>>9),bt=c[Y],xt=bt.high,_t=bt.low,wt=K+yt,Ct=V+mt+(wt>>>0<K>>>0?1:0),St=(wt=wt+ht,Ct=Ct+dt+(wt>>>0<ht>>>0?1:0),wt=wt+_t,Ct=Ct+xt+(wt>>>0<_t>>>0?1:0),wt=wt+X,Ct=Ct+U+(wt>>>0<X>>>0?1:0),gt+ft),kt=vt+pt+(St>>>0<gt>>>0?1:0);V=$,K=H,$=z,H=W,z=N,W=O,O=B+wt|0,N=F+Ct+(O>>>0<B>>>0?1:0)|0,F=L,B=R,L=D,R=P,D=I,P=E,E=wt+St|0,I=Ct+kt+(E>>>0<wt>>>0?1:0)|0}f=n.low=f+E,n.high=p+I+(f>>>0<E>>>0?1:0),g=r.low=g+P,r.high=v+D+(g>>>0<P>>>0?1:0),y=a.low=y+R,a.high=m+L+(y>>>0<R>>>0?1:0),x=o.low=x+B,o.high=b+F+(x>>>0<B>>>0?1:0),w=s.low=w+O,s.high=_+N+(w>>>0<O>>>0?1:0),S=l.low=S+W,l.high=C+z+(S>>>0<W>>>0?1:0),A=d.low=A+H,d.high=k+$+(A>>>0<H>>>0?1:0),M=h.low=M+K,h.high=T+V+(M>>>0<K>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(i/4294967296),e[31+(n+128>>>10<<5)]=i,t.sigBytes=4*e.length,this._process();var r=this._hash.toX32();return r},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})},82169:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function i(t,e,i,n){var r,a=this._iv;a?(r=a.slice(0),this._iv=void 0):r=this._prevBlock,n.encryptBlock(r,0);for(var o=0;o<i;o++)t[e+o]^=r[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize;i.call(this,t,e,r,n),this._prevBlock=t.slice(e,e+r)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,a=t.slice(e,e+r);i.call(this,t,e,r,n),this._prevBlock=a}}),e}(),t.mode.CFB})},82952:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return la}});i(52675),i(89463),i(62010),i(9868);var n=function(){var t=this,e=t._self._c;return e("div",{staticClass:"chart-container",class:{"theme-dark":t.isDarkTheme}},[e("div",{staticClass:"chart-header"},[e("div",{staticClass:"header-top"},[e("div",{staticClass:"header-left"},[e("div",{staticClass:"search-section"},[e("a-select",{staticClass:"symbol-select",attrs:{"show-search":"",placeholder:t.$t("dashboard.indicator.selectSymbol"),dropdownClassName:"dark-dropdown","filter-option":t.filterSymbolOption,"not-found-content":null,open:t.symbolSearchOpen},on:{search:t.handleSymbolSearch,change:t.handleSymbolSelect,dropdownVisibleChange:t.handleDropdownVisibleChange},model:{value:t.searchSymbol,callback:function(e){t.searchSymbol=e},expression:"searchSymbol"}},[e("a-icon",{staticStyle:{color:"#999"},attrs:{slot:"suffixIcon",type:"search"},slot:"suffixIcon"}),t._l(t.symbolSuggestions,function(i){return e("a-select-option",{key:i.value,attrs:{value:i.value}},[e("div",{staticClass:"symbol-option"},[e("a-tag",{staticStyle:{"margin-right":"8px","margin-bottom":"0"},attrs:{color:t.getMarketColor(i.market)}},[t._v(" "+t._s(t.getMarketName(i.market))+" ")]),e("span",{staticClass:"symbol-name"},[t._v(t._s(i.symbol))]),i.name?e("span",{staticClass:"symbol-name-extra"},[t._v(t._s(i.name))]):t._e()],1)])}),e("a-select-option",{key:"add-stock-option",staticClass:"add-stock-option",attrs:{value:"__add_stock_option__"}},[e("div",{staticStyle:{width:"100%","text-align":"center",padding:"4px 0",color:"#1890ff",cursor:"pointer"}},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"plus"}}),e("span",[t._v(t._s(t.$t("dashboard.analysis.watchlist.add")))])],1)])],2)],1),e("div",{staticClass:"timeframe-group"},t._l(["1m","5m","15m","30m","1H","4H","1D","1W"],function(i){return e("div",{key:i,staticClass:"timeframe-item",class:{active:t.timeframe===i},on:{click:function(e){return t.setTimeframe(i)}}},[t._v(" "+t._s(i)+" ")])}),0)]),t.currentSymbol?e("div",{staticClass:"current-symbol"},[e("div",{staticClass:"symbol-info"},[e("span",{staticClass:"symbol-label"},[t._v(t._s(t.currentSymbol))]),e("span",{staticClass:"market-tag"},[t._v(t._s(t.currentMarket))])]),e("div",{staticClass:"price-info",class:t.priceChangeClass},[e("span",{staticClass:"symbol-price"},[t._v(t._s(t.currentPrice))]),e("span",{staticClass:"symbol-change"},[t._v(" "+t._s(t.priceChange>0?"+":"")+t._s(t.priceChange.toFixed(2))+"% ")])]),t.isCryptoMarket?e("a-button",{staticClass:"qt-header-btn",attrs:{size:"small"},on:{click:t.openQuickTrade}},[e("a-icon",{attrs:{type:"thunderbolt",theme:"filled"}}),t._v(" "+t._s(t.$t("quickTrade.openPanel"))+" ")],1):t._e()],1):t._e()])]),e("div",{staticClass:"chart-content"},[e("div",{staticClass:"chart-main-row"},[t.currentSymbol?e("div",{staticClass:"mobile-symbol-price"},[e("div",{staticClass:"mobile-symbol-info"},[e("span",{staticClass:"mobile-market-tag"},[t._v(t._s(t.currentMarket))]),e("span",[t._v("-")]),e("span",{staticClass:"mobile-symbol-label"},[t._v(t._s(t.currentSymbol))])]),e("div",{staticClass:"mobile-price-info",class:t.priceChangeClass},[e("span",{staticClass:"mobile-symbol-price"},[t._v(t._s(t.currentPrice))]),e("span",{staticClass:"mobile-symbol-change"},[t._v(" "+t._s(t.priceChange>0?"+":"")+t._s(t.priceChange.toFixed(2))+"% ")])])]):t._e(),e("kline-chart",{ref:"klineChart",attrs:{symbol:t.currentSymbol,market:t.currentMarket,timeframe:t.timeframe,theme:t.chartTheme,activeIndicators:t.activeIndicators,realtimeEnabled:t.realtimeEnabled},on:{"price-change":t.handlePriceChange,retry:t.handleChartRetry,"indicator-toggle":t.handleIndicatorToggle}}),e("div",{staticClass:"chart-right"},[e("div",{staticClass:"indicators-panel"},[e("div",{staticClass:"panel-header"},[e("span",[t._v(t._s(t.$t("dashboard.indicator.panel.title")))]),e("div",{staticStyle:{display:"flex","align-items":"center","margin-left":"auto",gap:"8px"}},[t.isMobile?e("a-button",{staticClass:"mobile-header-create-btn",attrs:{type:"primary",size:"small",icon:"plus"},on:{click:t.handleCreateIndicator}},[t._v(" "+t._s(t.$t("dashboard.indicator.create"))+" ")]):t._e(),e("a-tooltip",{attrs:{title:t.realtimeEnabled?t.$t("dashboard.indicator.panel.realtimeOn"):t.$t("dashboard.indicator.panel.realtimeOff")}},[e("a-button",{staticClass:"realtime-toggle-btn",class:{active:t.realtimeEnabled},attrs:{type:"text"},on:{click:t.toggleRealtime}},[e("a-icon",{attrs:{type:t.realtimeEnabled?"sync":"pause-circle",spin:t.realtimeEnabled}})],1)],1)],1)]),e("div",{staticClass:"panel-body"},[t.isMobile?[e("div",{staticClass:"mobile-tab-content"},[e("div",{staticClass:"section-content custom-scrollbar"},[t._l(t.customIndicators,function(i){return e("div",{key:"custom-"+i.id,class:["indicator-card",{"indicator-active":t.isIndicatorActive("custom-"+i.id)}],on:{click:function(e){return t.toggleIndicator(i,"custom")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[t._v(t._s(i.name))]),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.edit")}},[e("a-icon",{staticClass:"action-icon edit-icon",attrs:{type:"edit"},on:{click:function(e){return e.stopPropagation(),t.handleEditIndicator(i)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.delete")}},[e("a-icon",{staticClass:"action-icon delete-icon",attrs:{type:"delete"},on:{click:function(e){return e.stopPropagation(),t.handleDeleteIndicator(i)}}})],1),e("a-tooltip",{attrs:{title:t.isIndicatorActive("custom-"+i.id)?t.$t("dashboard.indicator.action.stop"):t.$t("dashboard.indicator.action.start")}},[e("a-icon",{class:["action-icon","toggle-icon",{active:t.isIndicatorActive("custom-"+i.id)}],attrs:{type:t.isIndicatorActive("custom-"+i.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(i,"custom")}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.title")}},[e("a-icon",{staticClass:"action-icon backtest-icon",attrs:{type:"experiment"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktest(i)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle")}},[e("a-icon",{staticClass:"action-icon backtest-history-icon",attrs:{type:"clock-circle"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktestHistory(i)}}})],1),e("a-tooltip",{attrs:{title:i.publish_to_community?t.$t("dashboard.indicator.action.unpublish"):t.$t("dashboard.indicator.action.publish")}},[e("a-icon",{class:["action-icon","publish-icon",{published:i.publish_to_community}],attrs:{type:i.publish_to_community?"cloud":"cloud-upload"},on:{click:function(e){return e.stopPropagation(),t.handlePublishIndicator(i)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(i.description||""))])])])}),0===t.customIndicators.length?e("div",{staticClass:"empty-indicators"},[e("a-icon",{attrs:{type:"info-circle"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.empty")))])],1):t._e()],2)])]:[e("div",{staticClass:"indicator-section",class:{"section-empty":0===t.customIndicators.length}},[e("div",{staticClass:"section-label"},[e("div",{staticClass:"section-label-left",on:{click:t.toggleCustomSection}},[e("a-icon",{staticClass:"collapse-icon",attrs:{type:t.customSectionCollapsed?"right":"down"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.section.myCreated"))+" ("+t._s(t.customIndicators.length)+")")])],1),e("a-button",{staticClass:"create-indicator-btn",attrs:{type:"primary",size:"small",icon:"plus"},on:{click:function(e){return e.stopPropagation(),t.handleCreateIndicator.apply(null,arguments)}}},[t._v(" "+t._s(t.$t("dashboard.indicator.create"))+" ")])],1),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.customSectionCollapsed,expression:"!customSectionCollapsed"}],staticClass:"section-content custom-scrollbar"},[t._l(t.customIndicators,function(i){return e("div",{key:"custom-"+i.id,class:["indicator-card",{"indicator-active":t.isIndicatorActive("custom-"+i.id)}],on:{click:function(e){return t.toggleIndicator(i,"custom")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[t._v(t._s(i.name))]),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.edit")}},[e("a-icon",{staticClass:"action-icon edit-icon",attrs:{type:"edit"},on:{click:function(e){return e.stopPropagation(),t.handleEditIndicator(i)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.delete")}},[e("a-icon",{staticClass:"action-icon delete-icon",attrs:{type:"delete"},on:{click:function(e){return e.stopPropagation(),t.handleDeleteIndicator(i)}}})],1),e("a-tooltip",{attrs:{title:t.isIndicatorActive("custom-"+i.id)?t.$t("dashboard.indicator.action.stop"):t.$t("dashboard.indicator.action.start")}},[e("a-icon",{class:["action-icon","toggle-icon",{active:t.isIndicatorActive("custom-"+i.id)}],attrs:{type:t.isIndicatorActive("custom-"+i.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(i,"custom")}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.title")}},[e("a-icon",{staticClass:"action-icon backtest-icon",attrs:{type:"experiment"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktest(i)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle")}},[e("a-icon",{staticClass:"action-icon backtest-history-icon",attrs:{type:"clock-circle"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktestHistory(i)}}})],1),e("a-tooltip",{attrs:{title:i.publish_to_community?t.$t("dashboard.indicator.action.unpublish"):t.$t("dashboard.indicator.action.publish")}},[e("a-icon",{class:["action-icon","publish-icon",{published:i.publish_to_community}],attrs:{type:i.publish_to_community?"cloud":"cloud-upload"},on:{click:function(e){return e.stopPropagation(),t.handlePublishIndicator(i)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(i.description||""))])])])}),0===t.customIndicators.length?e("div",{staticClass:"empty-indicators"},[e("a-icon",{attrs:{type:"info-circle"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.empty")))])],1):t._e()],2)]),e("div",{staticClass:"indicator-section",class:{"section-empty":0===t.purchasedIndicators.length}},[e("div",{staticClass:"section-label"},[e("div",{staticClass:"section-label-left",on:{click:function(e){t.purchasedSectionCollapsed=!t.purchasedSectionCollapsed}}},[e("a-icon",{staticClass:"collapse-icon",attrs:{type:t.purchasedSectionCollapsed?"right":"down"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.section.purchased"))+" ("+t._s(t.purchasedIndicators.length)+")")])],1),e("a-button",{staticClass:"buy-indicator-btn",attrs:{type:"link",size:"small",icon:"shop"},on:{click:function(e){return e.stopPropagation(),t.goToIndicatorMarket.apply(null,arguments)}}},[t._v(" "+t._s(t.$t("menu.dashboard.community"))+" ")])],1),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.purchasedSectionCollapsed,expression:"!purchasedSectionCollapsed"}],staticClass:"section-content custom-scrollbar"},[t._l(t.purchasedIndicators,function(i){return e("div",{key:"purchased-"+i.id,class:["indicator-card","purchased-indicator",{"indicator-active":t.isIndicatorActive("purchased-"+i.id)}],on:{click:function(e){return t.toggleIndicator(i,"purchased")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[e("a-icon",{staticClass:"purchased-icon",attrs:{type:"shopping"}}),t._v(" "+t._s(i.name)+" ")],1),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.isIndicatorActive("purchased-"+i.id)?t.$t("dashboard.indicator.action.stop"):t.$t("dashboard.indicator.action.start")}},[e("a-icon",{class:["action-icon","toggle-icon",{active:t.isIndicatorActive("purchased-"+i.id)}],attrs:{type:t.isIndicatorActive("purchased-"+i.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(i,"purchased")}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.title")}},[e("a-icon",{staticClass:"action-icon backtest-icon",attrs:{type:"experiment"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktest(i)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle")}},[e("a-icon",{staticClass:"action-icon backtest-history-icon",attrs:{type:"clock-circle"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktestHistory(i)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(i.description||""))])])])}),0===t.purchasedIndicators.length?e("div",{staticClass:"empty-indicators"},[e("a-icon",{attrs:{type:"shopping"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.emptyPurchased")))])],1):t._e()],2)])]],2)])])],1),e("indicator-editor",{ref:"indicatorEditor",attrs:{visible:t.showIndicatorEditor,indicator:t.editingIndicator,userId:t.userId},on:{run:t.handleRunIndicator,save:t.handleSaveIndicator,cancel:function(e){t.showIndicatorEditor=!1,t.editingIndicator=null}}}),e("backtest-modal",{attrs:{visible:t.showBacktestModal,userId:t.userId,indicator:t.backtestIndicator,symbol:t.selectedSymbol,market:t.selectedMarket,timeframe:t.selectedTimeframe},on:{cancel:function(e){t.showBacktestModal=!1,t.backtestIndicator=null}}}),e("a-modal",{attrs:{visible:t.showParamsModal,title:t.$t("dashboard.indicator.paramsConfig.title"),confirmLoading:t.loadingParams,width:500,maskClosable:!1,keyboard:!1},on:{ok:t.confirmIndicatorParams,cancel:t.cancelIndicatorParams,afterClose:t.handleParamsModalAfterClose}},[t.pendingIndicator?e("div",{staticClass:"params-config-modal"},[e("div",{staticClass:"indicator-info"},[e("span",{staticClass:"indicator-name"},[t._v(t._s(t.pendingIndicator.name))])]),e("a-divider"),t.indicatorParams.length>0?e("div",{staticClass:"params-form"},t._l(t.indicatorParams,function(i){return e("div",{key:i.name,staticClass:"param-item"},[e("div",{staticClass:"param-header"},[e("label",{staticClass:"param-label"},[t._v(t._s(i.name))]),i.description?e("a-tooltip",{attrs:{title:i.description}},[e("a-icon",{staticStyle:{color:"#999","margin-left":"4px"},attrs:{type:"question-circle"}})],1):t._e()],1),"int"===i.type?e("a-input-number",{staticStyle:{width:"100%"},attrs:{precision:0},model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}}):"float"===i.type?e("a-input-number",{staticStyle:{width:"100%"},attrs:{precision:4},model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}}):"bool"===i.type?e("a-switch",{model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}}):e("a-input",{model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}})],1)}),0):e("a-empty",{attrs:{description:t.$t("dashboard.indicator.paramsConfig.noParams")}})],1):t._e()]),e("backtest-history-drawer",{attrs:{visible:t.showBacktestHistoryDrawer,userId:t.userId,indicatorId:t.backtestHistoryIndicator?t.backtestHistoryIndicator.id:null,symbol:t.selectedSymbol,market:t.selectedMarket,timeframe:t.selectedTimeframe,isMobile:t.isMobile},on:{cancel:function(e){t.showBacktestHistoryDrawer=!1,t.backtestHistoryIndicator=null},view:t.handleViewBacktestRun}}),e("backtest-run-viewer",{attrs:{visible:t.showBacktestRunViewer,run:t.selectedBacktestRun},on:{cancel:function(e){t.showBacktestRunViewer=!1,t.selectedBacktestRun=null}}}),e("a-modal",{attrs:{title:t.publishIndicator&&t.publishIndicator.publish_to_community?t.$t("dashboard.indicator.publish.editTitle"):t.$t("dashboard.indicator.publish.title"),visible:t.showPublishModal,confirmLoading:t.publishing,width:"500px",okText:t.publishIndicator&&t.publishIndicator.publish_to_community?t.$t("dashboard.indicator.publish.update"):t.$t("dashboard.indicator.publish.confirm"),cancelText:t.$t("common.cancel")},on:{ok:t.handleConfirmPublish,cancel:function(e){t.showPublishModal=!1,t.publishIndicator=null}}},[e("a-form-model",{ref:"publishForm",attrs:{model:t.publishForm,rules:t.publishRules,layout:"vertical"}},[e("a-alert",{staticStyle:{"margin-bottom":"16px"},attrs:{type:"info","show-icon":"",message:t.$t("dashboard.indicator.publish.hint")}}),e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.pricingType"),prop:"pricingType"}},[e("a-radio-group",{model:{value:t.publishPricingType,callback:function(e){t.publishPricingType=e},expression:"publishPricingType"}},[e("a-radio",{attrs:{value:"free"}},[t._v(t._s(t.$t("dashboard.indicator.publish.free")))]),e("a-radio",{attrs:{value:"paid"}},[t._v(t._s(t.$t("dashboard.indicator.publish.paid")))])],1)],1),"paid"===t.publishPricingType?e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.price"),prop:"price"}},[e("a-input-number",{staticStyle:{width:"200px"},attrs:{min:1,max:1e4,precision:0},model:{value:t.publishPrice,callback:function(e){t.publishPrice=e},expression:"publishPrice"}}),e("span",{staticStyle:{"margin-left":"8px"}},[t._v(t._s(t.$t("community.credits")))])],1):t._e(),"paid"===t.publishPricingType?e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.vipFree")}},[e("a-switch",{model:{value:t.publishVipFree,callback:function(e){t.publishVipFree=e},expression:"publishVipFree"}}),e("div",{staticStyle:{"margin-top":"6px",color:"rgba(0,0,0,0.45)","font-size":"12px"}},[t._v(" "+t._s(t.$t("dashboard.indicator.publish.vipFreeHint"))+" ")])],1):t._e(),e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.description"),prop:"description"}},[e("a-textarea",{attrs:{placeholder:t.$t("dashboard.indicator.publish.descriptionPlaceholder"),rows:4,maxLength:500},model:{value:t.publishDescription,callback:function(e){t.publishDescription=e},expression:"publishDescription"}})],1),t.publishIndicator&&t.publishIndicator.publish_to_community?e("div",{staticStyle:{"margin-top":"16px"}},[e("a-button",{attrs:{type:"danger",ghost:"",loading:t.unpublishing},on:{click:t.handleUnpublish}},[e("a-icon",{attrs:{type:"close-circle"}}),t._v(" "+t._s(t.$t("dashboard.indicator.publish.unpublish"))+" ")],1)],1):t._e()],1)],1),e("a-modal",{attrs:{title:t.$t("dashboard.analysis.modal.addStock.title"),visible:t.showAddStockModal,confirmLoading:t.addingStock,width:"600px",okText:t.$t("dashboard.analysis.modal.addStock.confirm"),cancelText:t.$t("dashboard.analysis.modal.addStock.cancel")},on:{ok:t.handleAddStock,cancel:t.handleCloseAddStockModal}},[e("div",{staticClass:"add-stock-modal-content"},[e("a-tabs",{staticClass:"market-tabs",on:{change:t.handleMarketTabChange},model:{value:t.selectedMarketTab,callback:function(e){t.selectedMarketTab=e},expression:"selectedMarketTab"}},t._l(t.marketTypes,function(i){return e("a-tab-pane",{key:i.value,attrs:{tab:t.$t(i.i18nKey||"dashboard.analysis.market.".concat(i.value))}})}),1),e("div",{staticClass:"symbol-search-section"},[e("a-input-search",{attrs:{placeholder:t.$t("dashboard.analysis.modal.addStock.searchOrInputPlaceholder"),loading:t.searchingSymbols,size:"large","allow-clear":""},on:{search:t.handleSearchOrInput,change:t.handleSymbolSearchInput},model:{value:t.symbolSearchKeyword,callback:function(e){t.symbolSearchKeyword=e},expression:"symbolSearchKeyword"}},[e("a-button",{attrs:{slot:"enterButton",type:"primary",icon:"search"},slot:"enterButton"},[t._v(" "+t._s(t.$t("dashboard.analysis.modal.addStock.search"))+" ")])],1)],1),t.symbolSearchResults.length>0?e("div",{staticClass:"search-results-section"},[e("div",{staticClass:"section-title"},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"search"}}),t._v(" "+t._s(t.$t("dashboard.analysis.modal.addStock.searchResults"))+" ")],1),e("a-list",{staticClass:"symbol-list",attrs:{"data-source":t.symbolSearchResults,loading:t.searchingSymbols,size:"small"},scopedSlots:t._u([{key:"renderItem",fn:function(i){return e("a-list-item",{staticClass:"symbol-list-item",on:{click:function(e){return t.selectSymbol(i)}}},[e("a-list-item-meta",[e("template",{slot:"title"},[e("div",{staticClass:"symbol-item-content"},[e("span",{staticClass:"symbol-code"},[t._v(t._s(i.symbol))]),e("span",{staticClass:"symbol-name"},[t._v(t._s(i.name))]),i.exchange?e("a-tag",{staticStyle:{"margin-left":"8px"},attrs:{size:"small",color:"blue"}},[t._v(" "+t._s(i.exchange)+" ")]):t._e()],1)])],2)],1)}}],null,!1,1074844145)})],1):t._e(),e("div",{staticClass:"hot-symbols-section"},[e("div",{staticClass:"section-title"},[e("a-icon",{staticStyle:{color:"#ff4d4f","margin-right":"4px"},attrs:{type:"fire"}}),t._v(" "+t._s(t.$t("dashboard.analysis.modal.addStock.hotSymbols"))+" ")],1),e("a-spin",{attrs:{spinning:t.loadingHotSymbols}},[t.hotSymbols.length>0?e("a-list",{staticClass:"symbol-list",attrs:{"data-source":t.hotSymbols,size:"small"},scopedSlots:t._u([{key:"renderItem",fn:function(i){return e("a-list-item",{staticClass:"symbol-list-item",on:{click:function(e){return t.selectSymbol(i)}}},[e("a-list-item-meta",[e("template",{slot:"title"},[e("div",{staticClass:"symbol-item-content"},[e("span",{staticClass:"symbol-code"},[t._v(t._s(i.symbol))]),e("span",{staticClass:"symbol-name"},[t._v(t._s(i.name))]),i.exchange?e("a-tag",{staticStyle:{"margin-left":"8px"},attrs:{size:"small",color:"orange"}},[t._v(" "+t._s(i.exchange)+" ")]):t._e()],1)])],2)],1)}}],null,!1,2177647935)}):e("a-empty",{attrs:{description:t.$t("dashboard.analysis.modal.addStock.noHotSymbols"),image:!1}})],1)],1),t.selectedSymbolForAdd?e("div",{staticClass:"selected-symbol-section"},[e("a-alert",{attrs:{message:t.$t("dashboard.analysis.modal.addStock.selectedSymbol"),type:"info","show-icon":"",closable:""},on:{close:function(e){t.selectedSymbolForAdd=null}}},[e("template",{slot:"description"},[e("div",{staticClass:"selected-symbol-info"},[e("a-tag",{staticStyle:{"margin-right":"8px"},attrs:{color:t.getMarketColor(t.selectedSymbolForAdd.market)}},[t._v(" "+t._s(t.$t("dashboard.analysis.market.".concat(t.selectedSymbolForAdd.market)))+" ")]),e("strong",[t._v(t._s(t.selectedSymbolForAdd.symbol))]),t.selectedSymbolForAdd.name?e("span",{staticStyle:{color:"#999","margin-left":"8px"}},[t._v(t._s(t.selectedSymbolForAdd.name))]):e("span",{staticStyle:{color:"#999","margin-left":"8px","font-style":"italic"}},[t._v(t._s(t.$t("dashboard.analysis.modal.addStock.nameWillBeFetched")))])],1)])],2)],1):t._e()],1)])],1),e("a-tooltip",{attrs:{title:t.$t("quickTrade.openPanel"),placement:"left"}},[!t.showQuickTrade&&t.currentSymbol&&t.isCryptoMarket?e("div",{staticClass:"qt-floating-btn",on:{click:t.openQuickTrade}},[e("a-icon",{attrs:{type:"thunderbolt",theme:"filled"}})],1):t._e()]),e("quick-trade-panel",{attrs:{visible:t.showQuickTrade,symbol:t.qtSymbol,"preset-side":t.qtSide,"preset-price":t.qtPrice,source:"indicator","market-type":"swap"},on:{close:function(e){t.showQuickTrade=!1},"order-success":t.onQuickTradeSuccess,"update:symbol":t.handleQuickTradeSymbolChange}})],1)},r=[],a=(i(96305),i(43898)),o=i(44735),s=i(15863),l=i(81127),c=i(56252),u=(i(89999),i(18787)),d=i(76338),h=(i(28706),i(2008),i(50113),i(48980),i(74423),i(48598),i(62062),i(54554),i(79432),i(26099),i(16034),i(38781),i(31415),i(21699),i(47764),i(42762),i(23500),i(62953),i(85471)),p=i(95353),f=i(75769),v=i(35038),g=i(505),m=function(){var t=this,e=t._self._c;return e("div",[e("a-modal",{staticClass:"indicator-editor-modal",style:t.isMobile?{top:0,paddingBottom:0}:{top:"2%"},attrs:{title:t.$t("dashboard.indicator.editor.title"),visible:t.visible,width:t.isMobile?"100%":"95vw",confirmLoading:t.saving,okText:t.$t("dashboard.indicator.editor.save"),cancelText:t.$t("dashboard.indicator.editor.cancel"),maskClosable:!1,centered:!1},on:{ok:t.handleSave,cancel:t.handleCancel,afterClose:t.handleAfterClose}},[e("div",{staticClass:"editor-content"},[e("a-row",{staticClass:"editor-layout",class:{"mobile-layout":t.isMobile},attrs:{gutter:16}},[e("a-col",{staticClass:"code-editor-column",attrs:{span:24,xs:24,sm:24,md:24}},[e("div",{staticClass:"code-section"},[e("div",{staticClass:"section-header"},[e("div",{staticClass:"header-left"},[e("span",{staticClass:"section-title"},[t._v(t._s(t.$t("dashboard.indicator.editor.code")))])]),e("div",{staticClass:"section-actions"},[e("a-button",{staticStyle:{padding:"0 8px",color:"#52c41a","font-weight":"bold"},attrs:{type:"link",size:"small",loading:t.verifying},on:{click:t.handleVerifyCode}},[e("a-icon",{attrs:{type:"check-circle"}}),t._v(" "+t._s(t.$t("dashboard.indicator.editor.verifyCode"))+" ")],1),e("a-button",{staticStyle:{padding:"0"},attrs:{type:"link",size:"small"},on:{click:t.goToDocs}},[e("a-icon",{attrs:{type:"book"}}),t._v(" "+t._s(t.$t("dashboard.indicator.editor.guide"))+" ")],1)],1)]),e("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"info","show-icon":"",message:t.$t("dashboard.indicator.boundary.message"),description:t.$t("dashboard.indicator.boundary.indicatorRule")}}),e("div",{staticClass:"code-mode-split"},[e("a-row",{staticClass:"code-mode-row",attrs:{gutter:16}},[e("a-col",{staticClass:"code-pane",attrs:{xs:24,sm:24,md:18}},[e("div",{ref:"codeEditorContainer",staticClass:"code-editor-container"})]),e("a-col",{staticClass:"ai-pane",attrs:{xs:24,sm:24,md:6}},[e("div",{staticClass:"ai-panel"},[e("div",{staticClass:"ai-panel-title"},[e("a-icon",{attrs:{type:"robot"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.editor.aiGenerate")))])],1),e("a-textarea",{attrs:{placeholder:t.$t("dashboard.indicator.editor.aiPromptPlaceholder"),rows:12,"auto-size":{minRows:12,maxRows:20}},model:{value:t.aiPrompt,callback:function(e){t.aiPrompt=e},expression:"aiPrompt"}}),e("a-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"primary",block:"",loading:t.aiGenerating,size:"large"},on:{click:t.handleAIGenerate}},[t._v(" "+t._s(t.$t("dashboard.indicator.editor.aiGenerateBtn"))+" ")])],1)])],1)],1)],1)])],1)],1),e("div",{staticClass:"editor-footer",attrs:{slot:"footer"},slot:"footer"},[e("a-button",{on:{click:t.handleCancel}},[t._v(" "+t._s(t.$t("dashboard.indicator.editor.cancel"))+" ")]),e("a-button",{attrs:{type:"primary",loading:t.saving},on:{click:t.handleSave}},[t._v(" "+t._s(t.$t("dashboard.indicator.editor.save"))+" ")])],1)])],1)},y=[],b=i(57532),x=(i(2892),i(27495),i(99449),i(25440),i(11392),i(15237)),_=i.n(x),w=(i(74806),i(55218),i(97923),i(50436),i(74053)),C=i.n(w),S=i(75314),k={name:"IndicatorEditor",props:{visible:{type:Boolean,default:!1},indicator:{type:Object,default:null},userId:{type:Number,default:null}},data:function(){return{saving:!1,codeEditor:null,aiPrompt:"",aiGenerating:!1,verifying:!1,isMobile:!1}},computed:{},watch:{visible:function(t){var e=this;t?this.$nextTick(function(){setTimeout(function(){!e.codeEditor&&e.$refs.codeEditorContainer&&e.initCodeEditor(),e.initFormData()},200)}):this.codeEditor&&this.codeEditor.refresh()},indicator:{handler:function(t){var e=this;t&&this.visible&&this.$nextTick(function(){setTimeout(function(){e.initFormData()},100)})},deep:!0}},mounted:function(){var t=this;this.checkMobile(),window.addEventListener("resize",this.checkMobile),this.visible&&this.$nextTick(function(){setTimeout(function(){t.initCodeEditor()},100)})},beforeDestroy:function(){if(window.removeEventListener("resize",this.checkMobile),this.codeEditor)try{if("function"===typeof this.codeEditor.toTextArea)this.codeEditor.toTextArea();else if("function"===typeof this.codeEditor.getWrapperElement){var t=this.codeEditor.getWrapperElement();t&&t.parentNode&&t.parentNode.removeChild(t)}}catch(e){}finally{this.codeEditor=null}},methods:{getDefaultIndicatorCode:function(){return'#Demo Code:\n#my_indicator_name = "My Buy/Sell Indicator"\n#my_indicator_description = "Buy/Sell only; execution is normalized in backend."\n\n#df = df.copy()\n#sma = df["close"].rolling(14).mean()\n#buy = (df["close"] > sma) & (df["close"].shift(1) <= sma.shift(1))\n#sell = (df["close"] < sma) & (df["close"].shift(1) >= sma.shift(1))\n#df["buy"] = buy.fillna(False).astype(bool)\n#df["sell"] = sell.fillna(False).astype(bool)\n\n#buy_marks = [df["low"].iloc[i] * 0.995 if df["buy"].iloc[i] else None for i in range(len(df))]\n#sell_marks = [df["high"].iloc[i] * 1.005 if df["sell"].iloc[i] else None for i in range(len(df))]\n\n#output = {\n# "name": my_indicator_name,\n# "plots": [],\n# "signals": [\n# {"type": "buy", "text": "B", "data": buy_marks, "color": "#00E676"},\n# {"type": "sell", "text": "S", "data": sell_marks, "color": "#FF5252"}\n# ]\n#}\n'},checkMobile:function(){this.isMobile=window.innerWidth<=768},goToDocs:function(){window.open("https://github.com/brokermr810/QuantDinger/blob/main/docs/STRATEGY_DEV_GUIDE.md","_blank")},handleVerifyCode:function(){var t=this,e=this.codeEditor?this.codeEditor.getValue():"";e&&e.trim()?(this.verifying=!0,(0,f.Ay)({url:"/api/indicator/verifyCode",method:"post",data:{code:e}}).then(function(e){if(1===e.code){var i=e.data||{};t.$message.success("".concat(t.$t("dashboard.indicator.editor.verifyCodeSuccess")," (").concat(i.plots_count||0," plots, ").concat(i.signals_count||0," signals)"))}else{var n=e.data||{};t.$error({title:t.$t("dashboard.indicator.editor.verifyCodeFailed"),width:600,content:function(t){return t("div",[t("p",{style:{fontWeight:"bold",color:"#ff4d4f"}},e.msg),n.details?t("pre",{style:{background:"#f5f5f5",padding:"8px",overflow:"auto",maxHeight:"300px",marginTop:"8px",fontSize:"12px",fontFamily:"monospace"}},n.details):null])}})}}).catch(function(e){t.$message.error("Request Failed: "+(e.message||"Unknown Error"))}).finally(function(){t.verifying=!1})):this.$message.warning(this.$t("dashboard.indicator.editor.verifyCodeEmpty"))},cleanMarkdownCodeBlocks:function(t){if(!t||"string"!==typeof t)return t;var e=t.trim(),i=/```/.test(e);return i?(e=e.replace(/^```[\w]*\s*\n?/i,""),e.startsWith("```")&&(e=e.replace(/^```\s*\n?/g,"")),e.endsWith("```")&&(e=e.replace(/\n?```\s*$/g,"")),e=e.replace(/^\s*```[\w]*\s*$/gm,""),e=e.replace(/^\s*```\s*$/gm,""),e=e.replace(/\n{3,}/g,"\n\n"),e=e.trim(),e):e},initFormData:function(){var t=this;if(this.visible){var e=this.indicator&&this.indicator.code||"";e&&String(e).trim()||(e=this.getDefaultIndicatorCode()),this.$nextTick(function(){setTimeout(function(){t.aiPrompt="",t.codeEditor&&(t.codeEditor.setValue(e),t.codeEditor.refresh())},50)})}},initCodeEditor:function(){var t=this;if(this.$refs.codeEditorContainer){if(this.codeEditor){try{if("function"===typeof this.codeEditor.toTextArea)this.codeEditor.toTextArea();else if("function"===typeof this.codeEditor.getWrapperElement){var e=this.codeEditor.getWrapperElement();e&&e.parentNode&&e.parentNode.removeChild(e)}}catch(i){}this.codeEditor=null}try{this.$refs.codeEditorContainer.innerHTML="",this.codeEditor=_()(this.$refs.codeEditorContainer,{value:function(){var e=t.indicator&&t.indicator.code||"";return e&&String(e).trim()?e:t.getDefaultIndicatorCode()}(),mode:"python",theme:"eclipse",lineNumbers:!0,lineWrapping:!0,indentUnit:4,indentWithTabs:!1,smartIndent:!0,matchBrackets:!0,autoCloseBrackets:!0,styleActiveLine:!0,foldGutter:!1,gutters:["CodeMirror-linenumbers"],tabSize:4,viewportMargin:1/0}),this.codeEditor.on("change",function(t){t.getValue()}),this.$nextTick(function(){t.codeEditor&&t.codeEditor.refresh()})}catch(n){}}},handleSave:function(){var t=this.codeEditor?this.codeEditor.getValue():"",e=t||"";e.trim()?(this.saving=!0,this.$emit("save",{id:this.indicator?this.indicator.id:0,code:e,userid:this.userId})):this.$message.warning(this.$t("dashboard.indicator.editor.codeRequired"))},handleCancel:function(){this.codeEditor&&this.codeEditor.setValue(""),this.$emit("cancel")},handleAfterClose:function(){var t=this;this.codeEditor&&this.$nextTick(function(){t.codeEditor&&t.codeEditor.refresh()}),this.aiPrompt=""},handleAIGenerate:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var i,n,r,a,o,s,c,u,d,h,p,f,v,g,m,y,x,_,w,k,A,T,M,I,E;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.aiPrompt&&t.aiPrompt.trim()){e.n=1;break}return t.$message.warning(t.$t("dashboard.indicator.editor.aiPromptRequired")),e.a(2);case 1:return t.aiGenerating=!0,i="",t.codeEditor&&(i=t.codeEditor.getValue()||""),t.codeEditor&&(t.codeEditor.setValue("# AI generating...\n"),t.codeEditor.refresh()),n="",e.p=2,r="/api/indicator/aiGenerate",a=C().get(S.Xh),o={prompt:t.aiPrompt.trim()},i.trim()&&(o.existingCode=i.trim()),e.n=3,fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:a?"Bearer ".concat(a):"","Access-Token":a||"",Token:a||""},body:JSON.stringify(o),credentials:"include"});case 3:if(s=e.v,s.ok){e.n=5;break}return e.n=4,s.text().catch(function(){return""});case 4:throw c=e.v,new Error(c||"HTTP error! status: ".concat(s.status));case 5:if(s.body&&"function"===typeof s.body.getReader){e.n=6;break}throw new Error("AI 服务未返回可读取的流(response.body 不存在)");case 6:u=s.body.getReader(),d=new TextDecoder,h="";case 7:return e.n=8,u.read();case 8:if(p=e.v,f=p.done,v=p.value,!f){e.n=9;break}return e.a(3,21);case 9:h+=d.decode(v,{stream:!0}),g=h.split("\n\n"),h=g.pop()||"",m=(0,b.A)(g),e.p=10,m.s();case 11:if((y=m.n()).done){e.n=17;break}if(x=y.value,x.trim()&&x.startsWith("data: ")){e.n=12;break}return e.a(3,16);case 12:if(_=x.substring(6),"[DONE]"!==_){e.n=13;break}return e.a(3,17);case 13:if(e.p=13,w=JSON.parse(_),!w.error){e.n=14;break}throw new Error(w.error);case 14:w.content&&(n+=w.content,k=t.cleanMarkdownCodeBlocks(n),t.codeEditor&&(t.codeEditor.setValue(k),A=t.codeEditor.lineCount(),t.codeEditor.setCursor({line:A-1,ch:0}),t.codeEditor.refresh())),e.n=16;break;case 15:e.p=15,e.v;case 16:e.n=11;break;case 17:e.n=19;break;case 18:e.p=18,I=e.v,m.e(I);case 19:return e.p=19,m.f(),e.f(19);case 20:e.n=7;break;case 21:t.codeEditor&&n?(T=t.cleanMarkdownCodeBlocks(n),t.codeEditor.setValue(T),t.codeEditor.refresh(),t.$message.success(t.$t("dashboard.indicator.editor.aiGenerateSuccess"))):n||t.$message.warning("未生成任何代码,请尝试更详细的提示词"),e.n=23;break;case 22:e.p=22,E=e.v,t.$message.error(E.message||t.$t("dashboard.indicator.editor.aiGenerateError")),n&&t.codeEditor&&(M=t.cleanMarkdownCodeBlocks(n),t.codeEditor.setValue(M));case 23:return e.p=23,t.aiGenerating=!1,e.f(23);case 24:return e.a(2)}},e,null,[[13,15],[10,18,19,20],[2,22,23,24]])}))()}}},A=k,T=i(81656),M=(0,T.A)(A,m,y,!1,null,"4fea1865",null),I=M.exports,E=function(){var t=this,e=t._self._c;return e("div",{staticClass:"chart-left",class:{"theme-dark":"dark"===t.chartTheme}},[e("div",{staticClass:"chart-wrapper"},[e("div",{staticClass:"drawing-toolbar"},[t._l(t.drawingTools,function(i){return e("a-tooltip",{key:i.name,attrs:{title:i.title,placement:"right"}},[e("div",{staticClass:"drawing-tool-btn",class:{active:t.activeDrawingTool===i.name},on:{click:function(e){return t.selectDrawingTool(i.name)}}},[e("a-icon",{attrs:{type:i.icon}})],1)])}),e("a-divider",{attrs:{type:"vertical"}}),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.drawing.clearAll"),placement:"right"}},[e("div",{staticClass:"drawing-tool-btn",on:{click:t.clearAllDrawings}},[e("a-icon",{attrs:{type:"delete"}})],1)])],2),e("div",{staticClass:"chart-content-area"},[e("div",{staticClass:"indicator-toolbar"},t._l(t.indicatorButtons,function(i){return e("div",{key:i.id,staticClass:"indicator-btn",class:{active:t.isIndicatorActive(i.id)},attrs:{title:i.name},on:{click:function(e){return t.toggleIndicator(i)}}},[t._v(" "+t._s(i.shortName)+" ")])}),0),e("div",{staticClass:"kline-chart-container",attrs:{id:"kline-chart-container"}})]),t.loading?e("div",{staticClass:"chart-overlay"},[e("a-spin",{attrs:{size:"large"}},[e("a-icon",{staticStyle:{"font-size":"24px",color:"#13c2c2"},attrs:{slot:"indicator",type:"loading",spin:""},slot:"indicator"})],1)],1):t._e(),t.error?e("div",{staticClass:"chart-overlay"},[e("div",{staticClass:"error-box"},[e("a-icon",{staticStyle:{"font-size":"24px",color:"#ef5350","margin-bottom":"10px"},attrs:{type:"warning"}}),e("span",[t._v(t._s(t.error))]),e("a-button",{staticStyle:{"margin-top":"12px"},attrs:{type:"primary",size:"small",ghost:""},on:{click:t.handleRetry}},[t._v(" "+t._s(t.$t("dashboard.indicator.retry"))+" ")])],1)]):t._e(),t.pyodideLoadFailed?e("div",{staticClass:"chart-overlay pyodide-warning"},[e("div",{staticClass:"warning-box"},[e("a-icon",{staticStyle:{"font-size":"32px",color:"#faad14","margin-bottom":"12px"},attrs:{type:"warning"}}),e("div",{staticClass:"warning-title"},[t._v(t._s(t.$t("dashboard.indicator.warning.pyodideLoadFailed")))]),e("div",{staticClass:"warning-desc"},[t._v(t._s(t.$t("dashboard.indicator.warning.pyodideLoadFailedDesc")))])],1)]):t._e(),t.symbol||t.loading||t.error||t.pyodideLoadFailed?t._e():e("div",{staticClass:"chart-overlay initial-hint"},[e("div",{staticClass:"hint-box"},[e("a-icon",{staticStyle:{"font-size":"48px",color:"#1890ff","margin-bottom":"16px"},attrs:{type:"line-chart"}}),e("div",{staticClass:"hint-title"},[t._v(t._s(t.$t("dashboard.indicator.hint.selectSymbol")))]),e("div",{staticClass:"hint-desc"},[t._v(t._s(t.$t("dashboard.indicator.hint.selectSymbolDesc")))])],1)])])])},D=[];i(2259);function P(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],i=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}throw new TypeError((0,o.A)(t)+" is not iterable")}var L=i(26297),R=i(2403),F=(i(34782),i(26910),i(71761),function(t,e){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},F(t,e)});function B(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}F(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var N,O,z,W,$,H,V,K,Y,X=function(){return X=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i],e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},X.apply(this,arguments)};function U(t,e,i,n){function r(t){return t instanceof i?t:new i(function(e){e(t)})}return new(i||(i=Promise))(function(i,a){function o(t){try{l(n.next(t))}catch(e){a(e)}}function s(t){try{l(n["throw"](t))}catch(e){a(e)}}function l(t){t.done?i(t.value):r(t.value).then(o,s)}l((n=n.apply(t,e||[])).next())})}function G(t,e){var i,n,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return l([t,e])}}function l(s){if(i)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(i=1,n&&(r=2&s[0]?n["return"]:s[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(r=o.trys,!(r=r.length>0&&r[r.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function j(t){var e="function"===typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"===typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(t,e){var i="function"===typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,a=i.call(t),o=[];try{while((void 0===e||e-- >0)&&!(n=a.next()).done)o.push(n.value)}catch(s){r={error:s}}finally{try{n&&!n.done&&(i=a["return"])&&i.call(a)}finally{if(r)throw r.error}}return o}function Z(t,e,i){if(i||2===arguments.length)for(var n,r=0,a=e.length;r<a;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}"function"===typeof SuppressedError&&SuppressedError,function(t){t["Dashed"]="dashed",t["Solid"]="solid"}(N||(N={})),function(t){t["Stroke"]="stroke",t["Fill"]="fill",t["StrokeFill"]="stroke_fill"}(O||(O={})),function(t){t["Always"]="always",t["FollowCross"]="follow_cross",t["None"]="none"}(z||(z={})),function(t){t["Standard"]="standard",t["Rect"]="rect"}(W||(W={})),function(t){t["Left"]="left",t["Middle"]="middle",t["Right"]="right"}($||($={})),function(t){t["Fixed"]="fixed",t["Pointer"]="pointer"}(H||(H={})),function(t){t["CandleSolid"]="candle_solid",t["CandleStroke"]="candle_stroke",t["CandleUpStroke"]="candle_up_stroke",t["CandleDownStroke"]="candle_down_stroke",t["Ohlc"]="ohlc",t["Area"]="area"}(V||(V={})),function(t){t["Left"]="left",t["Right"]="right"}(K||(K={})),function(t){t["Normal"]="normal",t["Percentage"]="percentage",t["Log"]="log"}(Y||(Y={}));var J="#F92855",Q="rgba(249, 40, 85, .7)",tt="#2DC08E",et="rgba(45, 192, 142, .7)",it="#888888",nt="#FFFFFF",rt="#1677FF",at="#76808F",ot="#DDDDDD";function st(t){return"rgba(22, 119, 255, ".concat(t,")")}function lt(){function t(){return{show:!0,size:1,color:"#EDEDED",style:N.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:t(),vertical:t()}}function ct(){var t={show:!0,color:at,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"};return{type:V.CandleSolid,bar:{upColor:tt,downColor:J,noChangeColor:it,upBorderColor:tt,downBorderColor:J,noChangeBorderColor:it,upWickColor:tt,downWickColor:J,noChangeWickColor:it},area:{lineSize:2,lineColor:rt,value:"close",backgroundColor:[{offset:0,color:st(.01)},{offset:1,color:st(.2)}]},priceMark:{show:!0,high:X({},t),low:X({},t),last:{show:!0,upColor:tt,downColor:J,noChangeColor:it,line:{show:!0,style:N.Dashed,dashedValue:[4,4],size:1},text:{show:!0,style:O.Fill,size:12,paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderColor:"transparent",borderStyle:N.Solid,borderSize:0,borderDashedValue:[2,2],color:nt,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{showRule:z.Always,showType:W.Standard,custom:null,defaultValue:"n/a",rect:{position:H.Fixed,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:8,offsetLeft:10,offsetTop:8,offsetRight:10,offsetBottom:8,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE"},text:{size:12,family:"Helvetica Neue",weight:"normal",color:at,marginLeft:10,marginTop:8,marginRight:6,marginBottom:0},icons:[]}}}function ut(){var t=["#FF9600","#935EBD",rt,"#E11D74","#01C5C4"].map(function(t){return{style:N.Solid,smooth:!1,size:1,dashedValue:[2,2],color:t}});return{ohlc:{upColor:et,downColor:Q,noChangeColor:it},bars:[{style:O.Fill,borderStyle:N.Solid,borderSize:1,borderDashedValue:[2,2],upColor:et,downColor:Q,noChangeColor:it}],lines:t,circles:[{style:O.Fill,borderStyle:N.Solid,borderSize:1,borderDashedValue:[2,2],upColor:et,downColor:Q,noChangeColor:it}],lastValueMark:{show:!1,text:{show:!1,style:O.Fill,color:nt,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:N.Solid,borderColor:"transparent",borderSize:0,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{showRule:z.Always,showType:W.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:at,marginLeft:10,marginTop:8,marginRight:6,marginBottom:0},icons:[]}}}function dt(){return{show:!0,size:"auto",axisLine:{show:!0,color:ot,size:1},tickText:{show:!0,color:at,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:4},tickLine:{show:!0,size:1,length:3,color:ot}}}function ht(){var t=dt();return t.type=Y.Normal,t.position=K.Right,t.inside=!1,t.reverse=!1,t}function pt(){function t(){return{show:!0,line:{show:!0,style:N.Dashed,dashedValue:[4,2],size:1,color:at},text:{show:!0,style:O.Fill,color:nt,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:N.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:at,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:at}}}return{show:!0,horizontal:t(),vertical:t()}}function ft(){var t=st(.35),e=st(.25);function i(){return{style:O.Fill,color:nt,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:N.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:rt,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:rt}}return{point:{color:rt,borderColor:t,borderSize:1,radius:5,activeColor:rt,activeBorderColor:t,activeBorderSize:3,activeRadius:5},line:{style:N.Solid,smooth:!1,color:rt,size:1,dashedValue:[2,2]},rect:{style:O.Fill,color:e,borderColor:rt,borderSize:1,borderRadius:0,borderStyle:N.Solid,borderDashedValue:[2,2]},polygon:{style:O.Fill,color:rt,borderColor:rt,borderSize:1,borderStyle:N.Solid,borderDashedValue:[2,2]},circle:{style:O.Fill,color:e,borderColor:rt,borderSize:1,borderStyle:N.Solid,borderDashedValue:[2,2]},arc:{style:N.Solid,color:rt,size:1,dashedValue:[2,2]},text:i(),rectText:i()}}function vt(){return{size:1,color:ot,fill:!0,activeBackgroundColor:st(.08)}}function gt(){return{grid:lt(),candle:ct(),indicator:ut(),xAxis:dt(),yAxis:ht(),separator:vt(),crosshair:pt(),overlay:ft()}}var mt=!1;function yt(t,e,i,n,r,a){if(mt){var o=""!==n?"Call api `".concat(n,"`").concat(""!==r||""!==a?", ":"."):"",s=""!==r?"invalid parameter `".concat(r,"`").concat(""!==a?", ":"."):"",l=""!==a?a:"";console.log(t,e,i,o,s,l)}}function bt(t,e,i){yt("%c😑 klinecharts warning%c %s%s%s","padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#FF9600","color:#FF9600",t,e,null!==i&&void 0!==i?i:"")}function xt(t,e,i){yt("%c😟 klinecharts error%c %s%s%s","padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#F92855;","color:#F92855;",t,e,null!==i&&void 0!==i?i:"")}function _t(){yt("%c❤️ Welcome to klinecharts. Version is 9.8.0","border-radius:4px;border:dashed 1px #1677FF;line-height:70px;padding:0 20px;margin:16px 0;font-size:14px;color:#1677FF;","","","","")}function wt(t,e){if(At(t)||At(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=t[i],r=e[i];At(r)&&At(n)?wt(n,r):Mt(e[i])&&(t[i]=Ct(e[i]))}}function Ct(t){if(!At(t))return t;var e;for(var i in e=St(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];At(n)?e[i]=Ct(n):e[i]=n}return e}function St(t){return"[object Array]"===Object.prototype.toString.call(t)}function kt(t){return"function"===typeof t}function At(t){return"object"===typeof t&&Mt(t)}function Tt(t){return"number"===typeof t&&!isNaN(t)}function Mt(t){return null!==t&&void 0!==t}function It(t){return"boolean"===typeof t}function Et(t){return"string"===typeof t}var Dt,Pt,Lt=/\\(\\)?/g,Rt=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function Ft(t,e,i){if(Mt(t)){var n=[];e.replace(Rt,function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var r=t;return Mt(e[1])?r=e[2].replace(Lt,"$1"):Mt(e[0])&&(r=e[0].trim()),n.push(r),""});var r=t,a=0,o=n.length;while(Mt(r)&&a<o)r=null===r||void 0===r?void 0:r[n[a++]];return Mt(r)?r:null!==i&&void 0!==i?i:"--"}return null!==i&&void 0!==i?i:"--"}function Bt(t,e,i){var n={};return t.formatToParts(new Date(e)).forEach(function(t){var e=t.type,i=t.value;switch(e){case"year":n.YYYY=i;break;case"month":n.MM=i;break;case"day":n.DD=i;break;case"hour":n.HH="24"===i?"00":i;break;case"minute":n.mm=i;break;case"second":n.ss=i;break}}),i.replace(/YYYY|MM|DD|HH|mm|ss/g,function(t){return n[t]})}function Nt(t,e){var i=+t;return Tt(i)?i.toFixed(null!==e&&void 0!==e?e:2):"".concat(t)}function Ot(t){var e=+t;if(Tt(e)){if(e>1e9)return"".concat(+(e/1e9).toFixed(3),"B");if(e>1e6)return"".concat(+(e/1e6).toFixed(3),"M");if(e>1e3)return"".concat(+(e/1e3).toFixed(3),"K")}return"".concat(t)}function zt(t,e){var i="".concat(t);if(0===e.length)return i;if(i.includes(".")){var n=i.split(".");return"".concat(n[0].replace(/(\d)(?=(\d{3})+$)/g,function(t){return"".concat(t).concat(e)}),".").concat(n[1])}return i.replace(/(\d)(?=(\d{3})+$)/g,function(t){return"".concat(t).concat(e)})}function Wt(t,e){var i="".concat(t),n=i.match(/\.0*(\d+)/);if(Mt(n)&&parseInt(n[1])>0){var r=n[0].length-1-n[1].length;if(r>=e)return i.replace(/\.0*/,".0{".concat(r,"}"))}return i}function $t(t){var e,i,n;return null!==(n=null===(i=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0===i?void 0:i.devicePixelRatio)&&void 0!==n?n:1}function Ht(t,e,i){return"".concat(null!==e&&void 0!==e?e:"normal"," ").concat(null!==t&&void 0!==t?t:12,"px ").concat(null!==i&&void 0!==i?i:"Helvetica Neue")}function Vt(t,e,i,n){if(!Mt(Dt)){var r=document.createElement("canvas"),a=$t(r);Dt=r.getContext("2d"),Dt.scale(a,a)}return Dt.font=Ht(e,i,n),Math.round(Dt.measureText(t).width)}(function(t){t["OnDataReady"]="onDataReady",t["OnZoom"]="onZoom",t["OnScroll"]="onScroll",t["OnVisibleRangeChange"]="onVisibleRangeChange",t["OnTooltipIconClick"]="onTooltipIconClick",t["OnCrosshairChange"]="onCrosshairChange",t["OnCandleBarClick"]="onCandleBarClick",t["OnPaneDrag"]="onPaneDrag"})(Pt||(Pt={}));var Kt,Yt=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){var e,i=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;i<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){var e;if(kt(t)){var i=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;i>-1&&this._callbacks.splice(i,1)}else this._callbacks=[]},t.prototype.execute=function(t){this._callbacks.forEach(function(e){e(t)})},t.prototype.isEmpty=function(){return 0===this._callbacks.length},t}();function Xt(t,e,i,n,r){var a,o=e.result,s=e.figures,l=e.styles,c=Ft(l,"circles",n.circles),u=c.length,d=Ft(l,"bars",n.bars),h=d.length,p=Ft(l,"lines",n.lines),f=p.length,v=0,g=0,m=0;s.forEach(function(s){var l;switch(s.type){case"circle":var y=c[v%u];a=X(X({},y),{color:y.noChangeColor}),v++;break;case"bar":var b=d[g%h];a=X(X({},b),{color:b.noChangeColor}),g++;break;case"line":a=p[m%f],m++;break}if(Mt(a)){var x={prev:{kLineData:t[i-1],indicatorData:o[i-1]},current:{kLineData:t[i],indicatorData:o[i]},next:{kLineData:t[i+1],indicatorData:o[i+1]}},_=null===(l=s.styles)||void 0===l?void 0:l.call(s,x,e,n);r(s,X(X({},a),_))}})}(function(t){t["Normal"]="normal",t["Price"]="price",t["Volume"]="volume"})(Kt||(Kt={}));var Ut,Gt=function(){function t(t){this.result=[],this._precisionFlag=!1;var e=t.name,i=t.shortName,n=t.series,r=t.calcParams,a=t.figures,o=t.precision,s=t.shouldOhlc,l=t.shouldFormatBigNumber,c=t.visible,u=t.zLevel,d=t.minValue,h=t.maxValue,p=t.styles,f=t.extendData,v=t.regenerateFigures,g=t.createTooltipDataSource,m=t.draw;this.name=e,this.shortName=null!==i&&void 0!==i?i:e,this.series=null!==n&&void 0!==n?n:Kt.Normal,this.precision=null!==o&&void 0!==o?o:4,this.calcParams=null!==r&&void 0!==r?r:[],this.figures=null!==a&&void 0!==a?a:[],this.shouldOhlc=null!==s&&void 0!==s&&s,this.shouldFormatBigNumber=null!==l&&void 0!==l&&l,this.visible=null===c||void 0===c||c,this.zLevel=null!==u&&void 0!==u?u:0,this.minValue=null!==d&&void 0!==d?d:null,this.maxValue=null!==h&&void 0!==h?h:null,this.styles=Ct(null!==p&&void 0!==p?p:{}),this.extendData=f,this.regenerateFigures=null!==v&&void 0!==v?v:null,this.createTooltipDataSource=null!==g&&void 0!==g?g:null,this.draw=null!==m&&void 0!==m?m:null}return t.prototype.setShortName=function(t){return this.shortName!==t&&(this.shortName=t,!0)},t.prototype.setSeries=function(t){return this.series!==t&&(this.series=t,!0)},t.prototype.setPrecision=function(t,e){var i=null!==e&&void 0!==e&&e,n=Math.floor(t);return!(!(n!==this.precision&&t>=0)||i&&(!i||this._precisionFlag))&&(this.precision=n,i||(this._precisionFlag=!0),!0)},t.prototype.setCalcParams=function(t){var e,i;return this.calcParams=t,this.figures=null!==(i=null===(e=this.regenerateFigures)||void 0===e?void 0:e.call(this,t))&&void 0!==i?i:this.figures,!0},t.prototype.setShouldOhlc=function(t){return this.shouldOhlc!==t&&(this.shouldOhlc=t,!0)},t.prototype.setShouldFormatBigNumber=function(t){return this.shouldFormatBigNumber!==t&&(this.shouldFormatBigNumber=t,!0)},t.prototype.setVisible=function(t){return this.visible!==t&&(this.visible=t,!0)},t.prototype.setZLevel=function(t){return this.zLevel!==t&&(this.zLevel=t,!0)},t.prototype.setStyles=function(t){return wt(this.styles,t),!0},t.prototype.setExtendData=function(t){return this.extendData!==t&&(this.extendData=t,!0)},t.prototype.setFigures=function(t){return this.figures!==t&&(this.figures=t,!0)},t.prototype.setMinValue=function(t){return this.minValue!==t&&(this.minValue=t,!0)},t.prototype.setMaxValue=function(t){return this.maxValue!==t&&(this.maxValue=t,!0)},t.prototype.setRegenerateFigures=function(t){return this.regenerateFigures!==t&&(this.regenerateFigures=t,!0)},t.prototype.setCreateTooltipDataSource=function(t){return this.createTooltipDataSource!==t&&(this.createTooltipDataSource=t,!0)},t.prototype.setDraw=function(t){return this.draw!==t&&(this.draw=t,!0)},t.prototype.calcIndicator=function(t){return U(this,void 0,void 0,function(){var e;return G(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return e=i.sent(),this.result=e,[2,!0];case 2:return i.sent(),[2,!1];case 3:return[2]}})})},t.extend=function(e){var i=function(t){function i(){return t.call(this,e)||this}return B(i,t),i.prototype.calc=function(t,i){return e.calc(t,i)},i}(t);return i},t}();function jt(){return["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]}(function(t){t["Normal"]="normal",t["WeakMagnet"]="weak_magnet",t["StrongMagnet"]="strong_magnet"})(Ut||(Ut={}));var qt,Zt=1,Jt=-1,Qt="overlay_",te="overlay_figure_",ee=Number.MAX_SAFE_INTEGER,ie=function(){function t(t){this.currentStep=Zt,this.points=[],this._prevPressedPoint=null,this._prevPressedPoints=[];var e=t.mode,i=t.modeSensitivity,n=t.extendData,r=t.styles,a=t.name,o=t.totalStep,s=t.lock,l=t.visible,c=t.zLevel,u=t.needDefaultPointFigure,d=t.needDefaultXAxisFigure,h=t.needDefaultYAxisFigure,p=t.createPointFigures,f=t.createXAxisFigures,v=t.createYAxisFigures,g=t.performEventPressedMove,m=t.performEventMoveForDrawing,y=t.onDrawStart,b=t.onDrawing,x=t.onDrawEnd,_=t.onClick,w=t.onDoubleClick,C=t.onRightClick,S=t.onPressedMoveStart,k=t.onPressedMoving,A=t.onPressedMoveEnd,T=t.onMouseEnter,M=t.onMouseLeave,I=t.onRemoved,E=t.onSelected,D=t.onDeselected;this.name=a,this.totalStep=!Tt(o)||o<2?1:o,this.lock=null!==s&&void 0!==s&&s,this.visible=null===l||void 0===l||l,this.zLevel=null!==c&&void 0!==c?c:0,this.needDefaultPointFigure=null!==u&&void 0!==u&&u,this.needDefaultXAxisFigure=null!==d&&void 0!==d&&d,this.needDefaultYAxisFigure=null!==h&&void 0!==h&&h,this.mode=null!==e&&void 0!==e?e:Ut.Normal,this.modeSensitivity=null!==i&&void 0!==i?i:8,this.extendData=n,this.styles=Ct(null!==r&&void 0!==r?r:{}),this.createPointFigures=null!==p&&void 0!==p?p:null,this.createXAxisFigures=null!==f&&void 0!==f?f:null,this.createYAxisFigures=null!==v&&void 0!==v?v:null,this.performEventPressedMove=null!==g&&void 0!==g?g:null,this.performEventMoveForDrawing=null!==m&&void 0!==m?m:null,this.onDrawStart=null!==y&&void 0!==y?y:null,this.onDrawing=null!==b&&void 0!==b?b:null,this.onDrawEnd=null!==x&&void 0!==x?x:null,this.onClick=null!==_&&void 0!==_?_:null,this.onDoubleClick=null!==w&&void 0!==w?w:null,this.onRightClick=null!==C&&void 0!==C?C:null,this.onPressedMoveStart=null!==S&&void 0!==S?S:null,this.onPressedMoving=null!==k&&void 0!==k?k:null,this.onPressedMoveEnd=null!==A&&void 0!==A?A:null,this.onMouseEnter=null!==T&&void 0!==T?T:null,this.onMouseLeave=null!==M&&void 0!==M?M:null,this.onRemoved=null!==I&&void 0!==I?I:null,this.onSelected=null!==E&&void 0!==E?E:null,this.onDeselected=null!==D&&void 0!==D?D:null}return t.prototype.setId=function(t){return!Et(this.id)&&(this.id=t,!0)},t.prototype.setGroupId=function(t){return!Et(this.groupId)&&(this.groupId=t,!0)},t.prototype.setPaneId=function(t){this.paneId=t},t.prototype.setExtendData=function(t){return t!==this.extendData&&(this.extendData=t,!0)},t.prototype.setStyles=function(t){return wt(this.styles,t),!0},t.prototype.setPoints=function(t){if(t.length>0){var e=void 0;if(this.points=Z([],q(t),!1),t.length>=this.totalStep-1?(this.currentStep=Jt,e=this.totalStep-1):(this.currentStep=t.length+1,e=t.length),null!==this.performEventMoveForDrawing)for(var i=0;i<e;i++)this.performEventMoveForDrawing({currentStep:i+2,mode:this.mode,points:this.points,performPointIndex:i,performPoint:this.points[i]});return this.currentStep===Jt&&null!==this.performEventPressedMove&&this.performEventPressedMove({currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:this.points.length-1,performPoint:this.points[this.points.length-1]}),!0}return!1},t.prototype.setLock=function(t){return this.lock!==t&&(this.lock=t,!0)},t.prototype.setVisible=function(t){return this.visible!==t&&(this.visible=t,!0)},t.prototype.setZLevel=function(t){return this.zLevel!==t&&(this.zLevel=t,!0)},t.prototype.setMode=function(t){return this.mode!==t&&(this.mode=t,!0)},t.prototype.setModeSensitivity=function(t){return this.modeSensitivity!==t&&(this.modeSensitivity=t,!0)},t.prototype.setOnDrawStartCallback=function(t){return this.onDrawStart!==t&&(this.onDrawStart=t,!0)},t.prototype.setOnDrawingCallback=function(t){return this.onDrawing!==t&&(this.onDrawing=t,!0)},t.prototype.setOnDrawEndCallback=function(t){return this.onDrawEnd!==t&&(this.onDrawEnd=t,!0)},t.prototype.setOnClickCallback=function(t){return this.onClick!==t&&(this.onClick=t,!0)},t.prototype.setOnDoubleClickCallback=function(t){return this.onDoubleClick!==t&&(this.onDoubleClick=t,!0)},t.prototype.setOnRightClickCallback=function(t){return this.onRightClick!==t&&(this.onRightClick=t,!0)},t.prototype.setOnPressedMoveStartCallback=function(t){return this.onPressedMoveStart!==t&&(this.onPressedMoveStart=t,!0)},t.prototype.setOnPressedMovingCallback=function(t){return this.onPressedMoving!==t&&(this.onPressedMoving=t,!0)},t.prototype.setOnPressedMoveEndCallback=function(t){return this.onPressedMoveEnd!==t&&(this.onPressedMoveEnd=t,!0)},t.prototype.setOnMouseEnterCallback=function(t){return this.onMouseEnter!==t&&(this.onMouseEnter=t,!0)},t.prototype.setOnMouseLeaveCallback=function(t){return this.onMouseLeave!==t&&(this.onMouseLeave=t,!0)},t.prototype.setOnRemovedCallback=function(t){return this.onRemoved!==t&&(this.onRemoved=t,!0)},t.prototype.setOnSelectedCallback=function(t){return this.onSelected!==t&&(this.onSelected=t,!0)},t.prototype.setOnDeselectedCallback=function(t){return this.onDeselected!==t&&(this.onDeselected=t,!0)},t.prototype.nextStep=function(){this.currentStep===this.totalStep-1?this.currentStep=Jt:this.currentStep++},t.prototype.forceComplete=function(){this.currentStep=Jt},t.prototype.isDrawing=function(){return this.currentStep!==Jt},t.prototype.isStart=function(){return this.currentStep===Zt},t.prototype.eventMoveForDrawing=function(t){var e,i=this.currentStep-1,n={};Tt(t.timestamp)&&(n.timestamp=t.timestamp),Tt(t.dataIndex)&&(n.dataIndex=t.dataIndex),Tt(t.value)&&(n.value=t.value),this.points[i]=n,null===(e=this.performEventMoveForDrawing)||void 0===e||e.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:i,performPoint:n})},t.prototype.eventPressedPointMove=function(t,e){var i;Tt(t.dataIndex)&&(this.points[e].dataIndex=t.dataIndex,this.points[e].timestamp=t.timestamp),Tt(t.value)&&(this.points[e].value=t.value),null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,points:this.points,mode:this.mode,performPointIndex:e,performPoint:this.points[e]})},t.prototype.startPressedMove=function(t){this._prevPressedPoint=X({},t),this._prevPressedPoints=Ct(this.points)},t.prototype.eventPressedOtherMove=function(t,e){var i,n;null!==this._prevPressedPoint&&(Tt(t.dataIndex)&&Tt(this._prevPressedPoint.dataIndex)&&(i=t.dataIndex-this._prevPressedPoint.dataIndex),Tt(t.value)&&Tt(this._prevPressedPoint.value)&&(n=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map(function(t){var r;Tt(t.dataIndex)&&Tt(t.timestamp)&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var a=X({},t);return Tt(i)&&Tt(t.dataIndex)&&(a.dataIndex=t.dataIndex+i,a.timestamp=null!==(r=e.dataIndexToTimestamp(a.dataIndex))&&void 0!==r?r:void 0),Tt(n)&&Tt(t.value)&&(a.value=t.value+n),a}))},t.extend=function(e){var i=function(t){function i(){return t.call(this,e)||this}return B(i,t),i}(t);return i},t}();function ne(){return{formatDate:Bt,formatBigNumber:Ot}}(function(t){t[t["Tooltip"]=0]="Tooltip",t[t["Crosshair"]=1]="Crosshair",t[t["XAxis"]=2]="XAxis"})(qt||(qt={}));var re,ae="en-US",oe=1,se=(new Date).getTime();function le(t){var e=(new Date).getTime();return e===se?++oe:oe=1,se=e,"".concat(null!==t&&void 0!==t?t:"").concat(e,"_").concat(oe)}function ce(t,e){var i,n=document.createElement(t),r=null!==e&&void 0!==e?e:{};for(var a in r)n.style[a]=null!==(i=r[a])&&void 0!==i?i:"";return n}function ue(t,e,i){var n=0,r=0;for(r=t.length-1;n!==r;){var a=Math.floor((r+n)/2),o=r-n,s=t[a][e];if(i===t[n][e])return n;if(i===t[r][e])return r;if(i===s)return a;if(i>s?n=a:r=a,o<=2)break}return n}function de(t){var e=Math.floor(ve(t)),i=ge(e),n=t/i,r=0;return r=n<1.5?1:n<2.5?2:n<3.5?3:n<4.5?4:n<5.5?5:n<6.5?6:8,t=r*i,e>=-20?+t.toFixed(e<0?-e:0):t}function he(t,e){null==e&&(e=10),e=Math.min(Math.max(0,e),20);var i=(+t).toFixed(e);return+i}function pe(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var r=e.indexOf(".");return r<0?0:e.length-1-r}function fe(t,e,i){var n=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER];return t.forEach(function(t){var r,a;n[0]=Math.max(null!==(r=t[e])&&void 0!==r?r:t,n[0]),n[1]=Math.min(null!==(a=t[i])&&void 0!==a?a:t,n[1])}),n}function ve(t){return Math.log(t)/Math.log(10)}function ge(t){return Math.pow(10,t)}function me(){return{from:0,to:0,realFrom:0,realTo:0}}(function(t){t["Forward"]="forward",t["Backward"]="backward"})(re||(re={}));var ye={MIN:1,MAX:50},be=6,xe=50,_e=function(){function t(t){this._dateTimeFormat=this._buildDateTimeFormat(),this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=be,this._offsetRightDistance=xe,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange=me(),this._chartStore=t,this._gapBarSpace=this._calcGapBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace}return t.prototype._calcGapBarSpace=function(){var t=Math.floor(.82*this._barSpace),e=Math.floor(this._barSpace),i=Math.min(t,e-1);return Math.max(1,i)},t.prototype.adjustVisibleRange=function(){var t,e,i,n,r=this._chartStore.getDataList(),a=r.length,o=this._totalBarSpace/this._barSpace;1===this._scrollLimitRole?(i=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,n=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(i=this._minVisibleBarCount.left,n=this._minVisibleBarCount.right),i=Math.max(0,i),n=Math.max(0,n);var s=o-Math.min(i,a);this._lastBarRightSideDiffBarCount>s&&(this._lastBarRightSideDiffBarCount=s);var l=-a+Math.min(n,a);this._lastBarRightSideDiffBarCount<l&&(this._lastBarRightSideDiffBarCount=l);var c=Math.round(this._lastBarRightSideDiffBarCount+a+.5),u=c;c>a&&(c=a);var d=Math.round(c-o)-1;d<0&&(d=0);var h=this._lastBarRightSideDiffBarCount>0?Math.round(a+this._lastBarRightSideDiffBarCount-o)-1:d;if(this._visibleRange={from:d,to:c,realFrom:h,realTo:u},this._chartStore.getActionStore().execute(Pt.OnVisibleRangeChange,this._visibleRange),this._chartStore.adjustVisibleDataList(),0===d){var p=r[0];this._chartStore.executeLoadMoreCallback(null!==(t=null===p||void 0===p?void 0:p.timestamp)&&void 0!==t?t:null),this._chartStore.executeLoadDataCallback({type:re.Forward,data:null!==p&&void 0!==p?p:null})}c===a&&this._chartStore.executeLoadDataCallback({type:re.Backward,data:null!==(e=r[a-1])&&void 0!==e?e:null})},t.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},t.prototype._buildDateTimeFormat=function(t){var e={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};Et(t)&&(e.timeZone=t);var i=null;try{i=new Intl.DateTimeFormat("en",e)}catch(n){bt("","","Timezone is error!!!")}return i},t.prototype.setTimezone=function(t){var e=this._buildDateTimeFormat(t);null!==e&&(this._dateTimeFormat=e)},t.prototype.getTimezone=function(){return this._dateTimeFormat.resolvedOptions().timeZone},t.prototype.getBarSpace=function(){return{bar:this._barSpace,halfBar:this._barSpace/2,gapBar:this._gapBarSpace,halfGapBar:this._gapBarSpace/2}},t.prototype.setBarSpace=function(t,e){t<ye.MIN||t>ye.MAX||this._barSpace===t||(this._barSpace=t,this._gapBarSpace=this._calcGapBarSpace(),null===e||void 0===e||e(),this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0))},t.prototype.setTotalBarSpace=function(t){return this._totalBarSpace!==t&&(this._totalBarSpace=t,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0)),this},t.prototype.setOffsetRightDistance=function(t,e){return this._offsetRightDistance=1===this._scrollLimitRole?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace,null!==e&&void 0!==e&&e&&(this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0)),this},t.prototype.resetOffsetRightDistance=function(){this.setOffsetRightDistance(this._offsetRightDistance)},t.prototype.getInitialOffsetRightDistance=function(){return this._offsetRightDistance},t.prototype.getOffsetRightDistance=function(){return Math.max(0,this._lastBarRightSideDiffBarCount*this._barSpace)},t.prototype.getLastBarRightSideDiffBarCount=function(){return this._lastBarRightSideDiffBarCount},t.prototype.setLastBarRightSideDiffBarCount=function(t){return this._lastBarRightSideDiffBarCount=t,this},t.prototype.setMaxOffsetLeftDistance=function(t){return this._scrollLimitRole=1,this._maxOffsetDistance.left=t,this},t.prototype.setMaxOffsetRightDistance=function(t){return this._scrollLimitRole=1,this._maxOffsetDistance.right=t,this},t.prototype.setLeftMinVisibleBarCount=function(t){return this._scrollLimitRole=0,this._minVisibleBarCount.left=t,this},t.prototype.setRightMinVisibleBarCount=function(t){return this._scrollLimitRole=0,this._minVisibleBarCount.right=t,this},t.prototype.getVisibleRange=function(){return this._visibleRange},t.prototype.startScroll=function(){this._startLastBarRightSideDiffBarCount=this._lastBarRightSideDiffBarCount},t.prototype.scroll=function(t){if(this._scrollEnabled){var e=t/this._barSpace;this._chartStore.getActionStore().execute(Pt.OnScroll),this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-e,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0)}},t.prototype.getDataByDataIndex=function(t){var e;return null!==(e=this._chartStore.getDataList()[t])&&void 0!==e?e:null},t.prototype.coordinateToFloatIndex=function(t){var e=this._chartStore.getDataList().length,i=(this._totalBarSpace-t)/this._barSpace,n=e+this._lastBarRightSideDiffBarCount-i;return Math.round(1e6*n)/1e6},t.prototype.dataIndexToTimestamp=function(t){var e,i=this.getDataByDataIndex(t);return null!==(e=null===i||void 0===i?void 0:i.timestamp)&&void 0!==e?e:null},t.prototype.timestampToDataIndex=function(t){var e=this._chartStore.getDataList();return 0===e.length?0:ue(e,"timestamp",t)},t.prototype.dataIndexToCoordinate=function(t){var e=this._chartStore.getDataList().length,i=e+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(i-.5)*this._barSpace)-.5},t.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},t.prototype.zoom=function(t,e){var i,n=this;if(this._zoomEnabled){var r=null!==e&&void 0!==e?e:null;if(!Tt(null===r||void 0===r?void 0:r.x)){var a=this._chartStore.getTooltipStore().getCrosshair();r={x:null!==(i=null===a||void 0===a?void 0:a.x)&&void 0!==i?i:this._totalBarSpace/2}}this._chartStore.getActionStore().execute(Pt.OnZoom);var o=r.x,s=this.coordinateToFloatIndex(o),l=this._barSpace+t*(this._barSpace/10);this.setBarSpace(l,function(){n._lastBarRightSideDiffBarCount+=s-n.coordinateToFloatIndex(o)})}},t.prototype.setZoomEnabled=function(t){return this._zoomEnabled=t,this},t.prototype.getZoomEnabled=function(){return this._zoomEnabled},t.prototype.setScrollEnabled=function(t){return this._scrollEnabled=t,this},t.prototype.getScrollEnabled=function(){return this._scrollEnabled},t.prototype.clear=function(){this._visibleRange=me()},t}(),we={name:"AVP",shortName:"AVP",series:Kt.Price,precision:2,figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(t){var e=0,i=0;return t.map(function(t){var n,r,a={},o=null!==(n=null===t||void 0===t?void 0:t.turnover)&&void 0!==n?n:0,s=null!==(r=null===t||void 0===t?void 0:t.volume)&&void 0!==r?r:0;return e+=o,i+=s,0!==i&&(a.avp=e/i),a})}},Ce={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(t,e,i){var n,r,a,o,s,l=t.prev,c=t.current,u=null!==(r=null===(n=l.indicatorData)||void 0===n?void 0:n.ao)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,d=null!==(o=null===(a=c.indicatorData)||void 0===a?void 0:a.ao)&&void 0!==o?o:Number.MIN_SAFE_INTEGER;s=d>u?Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):Ft(e.styles,"bars[0].downColor",i.bars[0].downColor);var h=d>u?O.Stroke:O.Fill;return{color:s,style:h,borderColor:s}}}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),r=0,a=0,o=0,s=0;return t.map(function(e,l){var c={},u=(e.low+e.high)/2;if(r+=u,a+=u,l>=i[0]-1){o=r/i[0];var d=t[l-(i[0]-1)];r-=(d.low+d.high)/2}if(l>=i[1]-1){s=a/i[1];d=t[l-(i[1]-1)];a-=(d.low+d.high)/2}return l>=n-1&&(c.ao=o-s),c})}},Se={name:"BIAS",shortName:"BIAS",calcParams:[6,12,24],figures:[{key:"bias1",title:"BIAS6: ",type:"line"},{key:"bias2",title:"BIAS12: ",type:"line"},{key:"bias3",title:"BIAS24: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"bias".concat(e+1),title:"BIAS".concat(t,": "),type:"line"}})},calc:function(t,e){var i=e.calcParams,n=e.figures,r=[];return t.map(function(e,a){var o={},s=e.close;return i.forEach(function(e,l){var c;if(r[l]=(null!==(c=r[l])&&void 0!==c?c:0)+s,a>=e-1){var u=r[l]/i[l];o[n[l].key]=(s-u)/u*100,r[l]-=t[a-(e-1)].close}}),o})}};function ke(t,e){var i=t.length,n=0;return t.forEach(function(t){var i=t.close-e;n+=i*i}),n=Math.abs(n),Math.sqrt(n/i)}var Ae={name:"BOLL",shortName:"BOLL",series:Kt.Price,calcParams:[20,2],precision:2,shouldOhlc:!0,figures:[{key:"up",title:"UP: ",type:"line"},{key:"mid",title:"MID: ",type:"line"},{key:"dn",title:"DN: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,r=0;return t.map(function(e,a){var o=e.close,s={};if(r+=o,a>=n){s.mid=r/i[0];var l=ke(t.slice(a-n,a+1),s.mid);s.up=s.mid+i[1]*l,s.dn=s.mid-i[1]*l,r-=t[a-n].close}return s})}},Te={name:"BRAR",shortName:"BRAR",calcParams:[26],figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=0,a=0,o=0;return t.map(function(e,s){var l,c,u={},d=e.high,h=e.low,p=e.open,f=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(a+=d-p,o+=p-h,n+=d-f,r+=f-h,s>=i[0]-1){u.ar=0!==o?a/o*100:0,u.br=0!==r?n/r*100:0;var v=t[s-(i[0]-1)],g=v.high,m=v.low,y=v.open,b=(null!==(c=t[s-i[0]])&&void 0!==c?c:t[s-(i[0]-1)]).close;n-=g-b,r-=b-m,a-=g-y,o-=y-m}return u})}},Me={name:"BBI",shortName:"BBI",series:Kt.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max.apply(Math,Z([],q(i),!1)),r=[],a=[];return t.map(function(e,o){var s={},l=e.close;if(i.forEach(function(e,i){var n;r[i]=(null!==(n=r[i])&&void 0!==n?n:0)+l,o>=e-1&&(a[i]=r[i]/e,r[i]-=t[o-(e-1)].close)}),o>=n-1){var c=0;a.forEach(function(t){c+=t}),s.bbi=c/4}return s})}},Ie={name:"CCI",shortName:"CCI",calcParams:[20],figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,r=0,a=[];return t.map(function(e,o){var s={},l=(e.high+e.low+e.close)/3;if(r+=l,a.push(l),o>=n){var c=r/i[0],u=a.slice(o-n,o+1),d=0;u.forEach(function(t){d+=Math.abs(t-c)});var h=d/i[0];s.cci=0!==h?(l-c)/h/.015:0;var p=(t[o-n].high+t[o-n].low+t[o-n].close)/3;r-=p}return s})}},Ee={name:"CR",shortName:"CR",calcParams:[26,10,20,40,60],figures:[{key:"cr",title:"CR: ",type:"line"},{key:"ma1",title:"MA1: ",type:"line"},{key:"ma2",title:"MA2: ",type:"line"},{key:"ma3",title:"MA3: ",type:"line"},{key:"ma4",title:"MA4: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.ceil(i[1]/2.5+1),r=Math.ceil(i[2]/2.5+1),a=Math.ceil(i[3]/2.5+1),o=Math.ceil(i[4]/2.5+1),s=0,l=[],c=0,u=[],d=0,h=[],p=0,f=[],v=[];return t.forEach(function(e,g){var m,y,b,x,_,w={},C=null!==(m=t[g-1])&&void 0!==m?m:e,S=(C.high+C.close+C.low+C.open)/4,k=Math.max(0,e.high-S),A=Math.max(0,S-e.low);g>=i[0]-1&&(w.cr=0!==A?k/A*100:0,s+=w.cr,c+=w.cr,d+=w.cr,p+=w.cr,g>=i[0]+i[1]-2&&(l.push(s/i[1]),g>=i[0]+i[1]+n-3&&(w.ma1=l[l.length-1-n]),s-=null!==(y=v[g-(i[1]-1)].cr)&&void 0!==y?y:0),g>=i[0]+i[2]-2&&(u.push(c/i[2]),g>=i[0]+i[2]+r-3&&(w.ma2=u[u.length-1-r]),c-=null!==(b=v[g-(i[2]-1)].cr)&&void 0!==b?b:0),g>=i[0]+i[3]-2&&(h.push(d/i[3]),g>=i[0]+i[3]+a-3&&(w.ma3=h[h.length-1-a]),d-=null!==(x=v[g-(i[3]-1)].cr)&&void 0!==x?x:0),g>=i[0]+i[4]-2&&(f.push(p/i[4]),g>=i[0]+i[4]+o-3&&(w.ma4=f[f.length-1-o]),p-=null!==(_=v[g-(i[4]-1)].cr)&&void 0!==_?_:0)),v.push(w)}),v}},De={name:"DMA",shortName:"DMA",calcParams:[10,50,10],figures:[{key:"dma",title:"DMA: ",type:"line"},{key:"ama",title:"AMA: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),r=0,a=0,o=0,s=[];return t.forEach(function(e,l){var c,u={},d=e.close;r+=d,a+=d;var h=0,p=0;if(l>=i[0]-1&&(h=r/i[0],r-=t[l-(i[0]-1)].close),l>=i[1]-1&&(p=a/i[1],a-=t[l-(i[1]-1)].close),l>=n-1){var f=h-p;u.dma=f,o+=f,l>=n+i[2]-2&&(u.ama=o/i[2],o-=null!==(c=s[l-(i[2]-1)].dma)&&void 0!==c?c:0)}s.push(u)}),s}},Pe={name:"DMI",shortName:"DMI",calcParams:[14,6],figures:[{key:"pdi",title:"PDI: ",type:"line"},{key:"mdi",title:"MDI: ",type:"line"},{key:"adx",title:"ADX: ",type:"line"},{key:"adxr",title:"ADXR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=0,a=0,o=0,s=0,l=0,c=0,u=0,d=[];return t.forEach(function(e,h){var p,f,v={},g=null!==(p=t[h-1])&&void 0!==p?p:e,m=g.close,y=e.high,b=e.low,x=y-b,_=Math.abs(y-m),w=Math.abs(m-b),C=y-g.high,S=g.low-b,k=Math.max(Math.max(x,_),w),A=C>0&&C>S?C:0,T=S>0&&S>C?S:0;if(n+=k,r+=A,a+=T,h>=i[0]-1){h>i[0]-1?(o=o-o/i[0]+k,s=s-s/i[0]+A,l=l-l/i[0]+T):(o=n,s=r,l=a);var M=0,I=0;0!==o&&(M=100*s/o,I=100*l/o),v.pdi=M,v.mdi=I;var E=0;I+M!==0&&(E=Math.abs(I-M)/(I+M)*100),c+=E,h>=2*i[0]-2&&(u=h>2*i[0]-2?(u*(i[0]-1)+E)/i[0]:c/i[0],v.adx=u,h>=2*i[0]+i[1]-3&&(v.adxr=((null!==(f=d[h-(i[1]-1)].adx)&&void 0!==f?f:0)+u)/2))}d.push(v)}),d}},Le={name:"EMV",shortName:"EMV",calcParams:[14,9],figures:[{key:"emv",title:"EMV: ",type:"line"},{key:"maEmv",title:"MAEMV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=[];return t.map(function(e,a){var o,s={};if(a>0){var l=t[a-1],c=e.high,u=e.low,d=null!==(o=e.volume)&&void 0!==o?o:0,h=(c+u)/2-(l.high+l.low)/2;if(0===d||c-u===0)s.emv=0;else{var p=d/1e8/(c-u);s.emv=h/p}n+=s.emv,r.push(s.emv),a>=i[0]&&(s.maEmv=n/i[0],n-=r[a-i[0]])}return s})}},Re={name:"EMA",shortName:"EMA",series:Kt.Price,calcParams:[6,12,20],precision:2,shouldOhlc:!0,figures:[{key:"ema1",title:"EMA6: ",type:"line"},{key:"ema2",title:"EMA12: ",type:"line"},{key:"ema3",title:"EMA20: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"ema".concat(e+1),title:"EMA".concat(t,": "),type:"line"}})},calc:function(t,e){var i=e.calcParams,n=e.figures,r=0,a=[];return t.map(function(t,e){var o={},s=t.close;return r+=s,i.forEach(function(t,i){e>=t-1&&(a[i]=e>t-1?(2*s+(t-1)*a[i])/(t+1):r/t,o[n[i].key]=a[i])}),o})}},Fe={name:"MTM",shortName:"MTM",calcParams:[12,6],figures:[{key:"mtm",title:"MTM: ",type:"line"},{key:"maMtm",title:"MAMTM: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=[];return t.forEach(function(e,a){var o,s={};if(a>=i[0]){var l=e.close,c=t[a-i[0]].close;s.mtm=l-c,n+=s.mtm,a>=i[0]+i[1]-1&&(s.maMtm=n/i[1],n-=null!==(o=r[a-(i[1]-1)].mtm)&&void 0!==o?o:0)}r.push(s)}),r}},Be={name:"MA",shortName:"MA",series:Kt.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma5",title:"MA5: ",type:"line"},{key:"ma10",title:"MA10: ",type:"line"},{key:"ma30",title:"MA30: ",type:"line"},{key:"ma60",title:"MA60: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}})},calc:function(t,e){var i=e.calcParams,n=e.figures,r=[];return t.map(function(e,a){var o={},s=e.close;return i.forEach(function(e,i){var l;r[i]=(null!==(l=r[i])&&void 0!==l?l:0)+s,a>=e-1&&(o[n[i].key]=r[i]/e,r[i]-=t[a-(e-1)].close)}),o})}},Ne={name:"MACD",shortName:"MACD",calcParams:[12,26,9],figures:[{key:"dif",title:"DIF: ",type:"line"},{key:"dea",title:"DEA: ",type:"line"},{key:"macd",title:"MACD: ",type:"bar",baseValue:0,styles:function(t,e,i){var n,r,a,o,s,l=t.prev,c=t.current,u=null!==(r=null===(n=l.indicatorData)||void 0===n?void 0:n.macd)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,d=null!==(o=null===(a=c.indicatorData)||void 0===a?void 0:a.macd)&&void 0!==o?o:Number.MIN_SAFE_INTEGER;s=d>0?Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):d<0?Ft(e.styles,"bars[0].downColor",i.bars[0].downColor):Ft(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor);var h=u<d?O.Stroke:O.Fill;return{style:h,color:s,borderColor:s}}}],calc:function(t,e){var i,n,r=e.calcParams,a=0,o=0,s=0,l=0,c=Math.max(r[0],r[1]);return t.map(function(t,e){var u={},d=t.close;return a+=d,e>=r[0]-1&&(i=e>r[0]-1?(2*d+(r[0]-1)*i)/(r[0]+1):a/r[0]),e>=r[1]-1&&(n=e>r[1]-1?(2*d+(r[1]-1)*n)/(r[1]+1):a/r[1]),e>=c-1&&(o=i-n,u.dif=o,s+=o,e>=c+r[2]-2&&(l=e>c+r[2]-2?(2*o+l*(r[2]-1))/(r[2]+1):s/r[2],u.macd=2*(o-l),u.dea=l)),u})}},Oe={name:"OBV",shortName:"OBV",calcParams:[30],figures:[{key:"obv",title:"OBV: ",type:"line"},{key:"maObv",title:"MAOBV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=0,a=[];return t.forEach(function(e,o){var s,l,c,u,d=null!==(s=t[o-1])&&void 0!==s?s:e;e.close<d.close?r-=null!==(l=e.volume)&&void 0!==l?l:0:e.close>d.close&&(r+=null!==(c=e.volume)&&void 0!==c?c:0);var h={obv:r};n+=r,o>=i[0]-1&&(h.maObv=n/i[0],n-=null!==(u=a[o-(i[0]-1)].obv)&&void 0!==u?u:0),a.push(h)}),a}},ze={name:"PVT",shortName:"PVT",figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map(function(i,n){var r,a,o={},s=i.close,l=null!==(r=i.volume)&&void 0!==r?r:1,c=(null!==(a=t[n-1])&&void 0!==a?a:i).close,u=0,d=c*l;return 0!==d&&(u=(s-c)/d),e+=u,o.pvt=e,o})}},We={name:"PSY",shortName:"PSY",calcParams:[12,6],figures:[{key:"psy",title:"PSY: ",type:"line"},{key:"maPsy",title:"MAPSY: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=0,a=[],o=[];return t.forEach(function(e,s){var l,c,u={},d=(null!==(l=t[s-1])&&void 0!==l?l:e).close,h=e.close-d>0?1:0;a.push(h),n+=h,s>=i[0]-1&&(u.psy=n/i[0]*100,r+=u.psy,s>=i[0]+i[1]-2&&(u.maPsy=r/i[1],r-=null!==(c=o[s-(i[1]-1)].psy)&&void 0!==c?c:0),n-=a[s-(i[0]-1)]),o.push(u)}),o}},$e={name:"ROC",shortName:"ROC",calcParams:[12,6],figures:[{key:"roc",title:"ROC: ",type:"line"},{key:"maRoc",title:"MAROC: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[],r=0;return t.forEach(function(e,a){var o,s,l={};if(a>=i[0]-1){var c=e.close,u=(null!==(o=t[a-i[0]])&&void 0!==o?o:t[a-(i[0]-1)]).close;l.roc=0!==u?(c-u)/u*100:0,r+=l.roc,a>=i[0]-1+i[1]-1&&(l.maRoc=r/i[1],r-=null!==(s=n[a-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)}),n}},He={name:"RSI",shortName:"RSI",calcParams:[6,12,24],figures:[{key:"rsi1",title:"RSI1: ",type:"line"},{key:"rsi2",title:"RSI2: ",type:"line"},{key:"rsi3",title:"RSI3: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){var i=e+1;return{key:"rsi".concat(i),title:"RSI".concat(i,": "),type:"line"}})},calc:function(t,e){var i=e.calcParams,n=e.figures,r=[],a=[];return t.map(function(e,o){var s,l={},c=(null!==(s=t[o-1])&&void 0!==s?s:e).close,u=e.close-c;return i.forEach(function(e,i){var s,c,d;if(u>0?r[i]=(null!==(s=r[i])&&void 0!==s?s:0)+u:a[i]=(null!==(c=a[i])&&void 0!==c?c:0)+Math.abs(u),o>=e-1){0!==a[i]?l[n[i].key]=100-100/(1+r[i]/a[i]):l[n[i].key]=0;var h=t[o-(e-1)],p=null!==(d=t[o-e])&&void 0!==d?d:h,f=h.close-p.close;f>0?r[i]-=f:a[i]-=Math.abs(f)}}),l})}},Ve={name:"SMA",shortName:"SMA",series:Kt.Price,calcParams:[12,2],precision:2,figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams,n=0,r=0;return t.map(function(t,e){var a={},o=t.close;return n+=o,e>=i[0]-1&&(r=e>i[0]-1?(o*i[1]+r*(i[0]-i[1]+1))/(i[0]+1):n/i[0],a.sma=r),a})}},Ke={name:"KDJ",shortName:"KDJ",calcParams:[9,3,3],figures:[{key:"k",title:"K: ",type:"line"},{key:"d",title:"D: ",type:"line"},{key:"j",title:"J: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[];return t.forEach(function(e,r){var a,o,s,l,c={},u=e.close;if(r>=i[0]-1){var d=fe(t.slice(r-(i[0]-1),r+1),"high","low"),h=d[0],p=d[1],f=h-p,v=(u-p)/(0===f?1:f)*100;c.k=((i[1]-1)*(null!==(o=null===(a=n[r-1])||void 0===a?void 0:a.k)&&void 0!==o?o:50)+v)/i[1],c.d=((i[2]-1)*(null!==(l=null===(s=n[r-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+c.k)/i[2],c.j=3*c.k-2*c.d}n.push(c)}),n}},Ye={name:"SAR",shortName:"SAR",series:Kt.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t,e,i){var n,r,a=t.current,o=null!==(r=null===(n=a.indicatorData)||void 0===n?void 0:n.sar)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,s=a.kLineData,l=((null===s||void 0===s?void 0:s.high)+(null===s||void 0===s?void 0:s.low))/2,c=o<l?Ft(e.styles,"circles[0].upColor",i.circles[0].upColor):Ft(e.styles,"circles[0].downColor",i.circles[0].downColor);return{color:c}}}],calc:function(t,e){var i=e.calcParams,n=i[0]/100,r=i[1]/100,a=i[2]/100,o=n,s=-100,l=!1,c=0;return t.map(function(e,i){var u=c,d=e.high,h=e.low;if(l){(-100===s||s<d)&&(s=d,o=Math.min(o+r,a)),c=u+o*(s-u);var p=Math.min(t[Math.max(1,i)-1].low,h);c>e.low?(c=s,o=n,s=-100,l=!l):c>p&&(c=p)}else{(-100===s||s>h)&&(s=h,o=Math.min(o+r,a)),c=u+o*(s-u);var f=Math.max(t[Math.max(1,i)-1].high,d);c<e.high?(c=s,o=0,s=-100,l=!l):c<f&&(c=f)}return{sar:c}})}},Xe={name:"TRIX",shortName:"TRIX",calcParams:[12,9],figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",type:"line"}],calc:function(t,e){var i,n,r,a=e.calcParams,o=0,s=0,l=0,c=0,u=[];return t.forEach(function(t,e){var d,h={},p=t.close;if(o+=p,e>=a[0]-1&&(i=e>a[0]-1?(2*p+(a[0]-1)*i)/(a[0]+1):o/a[0],s+=i,e>=2*a[0]-2&&(n=e>2*a[0]-2?(2*i+(a[0]-1)*n)/(a[0]+1):s/a[0],l+=n,e>=3*a[0]-3))){var f=void 0,v=0;e>3*a[0]-3?(f=(2*n+(a[0]-1)*r)/(a[0]+1),v=(f-r)/r*100):f=l/a[0],r=f,h.trix=v,c+=v,e>=3*a[0]+a[1]-4&&(h.maTrix=c/a[1],c-=null!==(d=u[e-(a[1]-1)].trix)&&void 0!==d?d:0)}u.push(h)}),u}},Ue={name:"VOL",shortName:"VOL",series:Kt.Volume,calcParams:[5,10,20],shouldFormatBigNumber:!0,precision:0,minValue:0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA20: ",type:"line"},{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t,e,i){var n=t.current.kLineData,r=Ft(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor);return Mt(n)&&(n.close>n.open?r=Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):n.close<n.open&&(r=Ft(e.styles,"bars[0].downColor",i.bars[0].downColor))),{color:r}}}],regenerateFigures:function(t){var e=t.map(function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}});return e.push({key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t,e,i){var n,r=t.current.kLineData;return n=r.close>r.open?Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):r.close<r.open?Ft(e.styles,"bars[0].downColor",i.bars[0].downColor):Ft(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor),{color:n}}}),e},calc:function(t,e){var i=e.calcParams,n=e.figures,r=[];return t.map(function(e,a){var o,s=null!==(o=e.volume)&&void 0!==o?o:0,l={volume:s};return i.forEach(function(e,i){var o,c;r[i]=(null!==(o=r[i])&&void 0!==o?o:0)+s,a>=e-1&&(l[n[i].key]=r[i]/e,r[i]-=null!==(c=t[a-(e-1)].volume)&&void 0!==c?c:0)}),l})}},Ge={name:"VR",shortName:"VR",calcParams:[26,6],figures:[{key:"vr",title:"VR: ",type:"line"},{key:"maVr",title:"MAVR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=0,a=0,o=0,s=[];return t.forEach(function(e,l){var c,u,d,h,p,f={},v=e.close,g=(null!==(c=t[l-1])&&void 0!==c?c:e).close,m=null!==(u=e.volume)&&void 0!==u?u:0;if(v>g?n+=m:v<g?r+=m:a+=m,l>=i[0]-1){var y=a/2;f.vr=r+y===0?0:(n+y)/(r+y)*100,o+=f.vr,l>=i[0]+i[1]-2&&(f.maVr=o/i[1],o-=null!==(d=s[l-(i[1]-1)].vr)&&void 0!==d?d:0);var b=t[l-(i[0]-1)],x=null!==(h=t[l-i[0]])&&void 0!==h?h:b,_=b.close,w=null!==(p=b.volume)&&void 0!==p?p:0;_>x.close?n-=w:_<x.close?r-=w:a-=w}s.push(f)}),s}},je={name:"WR",shortName:"WR",calcParams:[6,10,14],figures:[{key:"wr1",title:"WR1: ",type:"line"},{key:"wr2",title:"WR2: ",type:"line"},{key:"wr3",title:"WR3: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"wr".concat(e+1),title:"WR".concat(e+1,": "),type:"line"}})},calc:function(t,e){var i=e.calcParams,n=e.figures;return t.map(function(e,r){var a={},o=e.close;return i.forEach(function(e,i){var s=e-1;if(r>=s){var l=fe(t.slice(r-s,r+1),"high","low"),c=l[0],u=l[1],d=c-u;a[n[i].key]=0===d?0:(o-c)/d*100}}),a})}},qe={},Ze=[we,Ce,Se,Ae,Te,Me,Ie,Ee,De,Pe,Le,Re,Fe,Be,Ne,Oe,ze,We,$e,He,Ve,Ke,Ye,Xe,Ue,Ge,je];function Je(t){qe[t.name]=Gt.extend(t)}function Qe(t){var e;return null!==(e=qe[t])&&void 0!==e?e:null}Ze.forEach(function(t){qe[t.name]=Gt.extend(t)});var ti=function(){function t(t){this._instances=new Map,this._chartStore=t}return t.prototype._overrideInstance=function(t,e){var i=e.shortName,n=e.series,r=e.calcParams,a=e.precision,o=e.figures,s=e.minValue,l=e.maxValue,c=e.shouldOhlc,u=e.shouldFormatBigNumber,d=e.visible,h=e.zLevel,p=e.styles,f=e.extendData,v=e.regenerateFigures,g=e.createTooltipDataSource,m=e.draw,y=e.calc,b=!1;Et(i)&&t.setShortName(i)&&(b=!0),Mt(n)&&t.setSeries(n)&&(b=!0);var x=!1;St(r)&&t.setCalcParams(r)&&(b=!0,x=!0),St(o)&&t.setFigures(o)&&(b=!0,x=!0),void 0!==s&&t.setMinValue(s)&&(b=!0),void 0!==l&&t.setMinValue(l)&&(b=!0),Tt(a)&&t.setPrecision(a)&&(b=!0),It(c)&&t.setShouldOhlc(c)&&(b=!0),It(u)&&t.setShouldFormatBigNumber(u)&&(b=!0),It(d)&&t.setVisible(d)&&(b=!0);var _=!1;return Tt(h)&&t.setZLevel(h)&&(b=!0,_=!0),Mt(p)&&t.setStyles(p)&&(b=!0),t.setExtendData(f)&&(b=!0,x=!0),void 0!==v&&t.setRegenerateFigures(v)&&(b=!0),void 0!==g&&t.setCreateTooltipDataSource(g)&&(b=!0),void 0!==m&&t.setDraw(m)&&(b=!0),kt(y)&&(t.calc=y,x=!0),[b,x,_]},t.prototype._sort=function(t){var e;Et(t)?null===(e=this._instances.get(t))||void 0===e||e.sort(function(t,e){return t.zLevel-e.zLevel}):this._instances.forEach(function(t){t.sort(function(t,e){return t.zLevel-e.zLevel})})},t.prototype.addInstance=function(t,e,i){return U(this,void 0,void 0,function(){var n,r,a,o,s;return G(this,function(l){switch(l.label){case 0:return n=t.name,r=this._instances.get(e),Mt(r)?(a=r.find(function(t){return t.name===n}),Mt(a)?[4,Promise.reject(new Error("Duplicate indicators."))]:[3,2]):[3,2];case 1:return[2,l.sent()];case 2:return Mt(r)||(r=[]),o=Qe(n),s=new o,this._overrideInstance(s,t),i||(r=[]),r.push(s),this._instances.set(e,r),this._sort(e),[4,s.calcIndicator(this._chartStore.getDataList())];case 3:return[2,l.sent()]}})})},t.prototype.getInstances=function(t){var e;return null!==(e=this._instances.get(t))&&void 0!==e?e:[]},t.prototype.removeInstance=function(t,e){var i,n=!1,r=this._instances.get(t);if(Mt(r)){if(Et(e)){var a=r.findIndex(function(t){return t.name===e});a>-1&&(r.splice(a,1),n=!0)}else this._instances.set(t,[]),n=!0;0===(null===(i=this._instances.get(t))||void 0===i?void 0:i.length)&&this._instances.delete(t)}return n},t.prototype.hasInstances=function(t){return this._instances.has(t)},t.prototype.calcInstance=function(t,e){return U(this,void 0,void 0,function(){var i,n,r,a,o=this;return G(this,function(s){switch(s.label){case 0:return i=[],Et(t)?Et(e)?(n=this._instances.get(e),Mt(n)&&(r=n.find(function(e){return e.name===t}),Mt(r)&&i.push(r.calcIndicator(this._chartStore.getDataList())))):this._instances.forEach(function(e){var n=e.find(function(e){return e.name===t});Mt(n)&&i.push(n.calcIndicator(o._chartStore.getDataList()))}):this._instances.forEach(function(t){t.forEach(function(t){i.push(t.calcIndicator(o._chartStore.getDataList()))})}),[4,Promise.all(i)];case 1:return a=s.sent(),[2,a.includes(!0)]}})})},t.prototype.getInstanceByPaneId=function(t,e){var i,n,r=function(t){var e=new Map;return t.forEach(function(t){e.set(t.name,t)}),e};if(Et(t)){var a=null!==(i=this._instances.get(t))&&void 0!==i?i:[];return Et(e)?null!==(n=null===a||void 0===a?void 0:a.find(function(t){return t.name===e}))&&void 0!==n?n:null:r(a)}var o=new Map;return this._instances.forEach(function(t,e){o.set(e,r(t))}),o},t.prototype.setSeriesPrecision=function(t){this._instances.forEach(function(e){e.forEach(function(e){e.series===Kt.Price&&e.setPrecision(t.price,!0),e.series===Kt.Volume&&e.setPrecision(t.volume,!0)})})},t.prototype.override=function(t,e){return U(this,void 0,void 0,function(){var i,n,r,a,o,s,l,c=this;return G(this,function(u){switch(u.label){case 0:return i=t.name,n=new Map,null!==e?(r=this._instances.get(e),Mt(r)&&n.set(e,r)):n=this._instances,a=!1,o=[],s=!1,n.forEach(function(e){var n=e.find(function(t){return t.name===i});if(Mt(n)){var r=c._overrideInstance(n,t);r[2]&&(s=!0),r[1]?o.push(n.calcIndicator(c._chartStore.getDataList())):r[0]&&(a=!0)}}),s&&this._sort(),[4,Promise.all(o)];case 1:return l=u.sent(),[2,[a,l.includes(!0)]]}})})},t}(),ei=function(){function t(t){this._crosshair={},this._activeIcon=null,this._chartStore=t}return t.prototype.setCrosshair=function(t,e){var i,n,r=this._chartStore.getDataList(),a=null!==t&&void 0!==t?t:{};Tt(a.x)?(i=this._chartStore.getTimeScaleStore().coordinateToDataIndex(a.x),n=i<0?0:i>r.length-1?r.length-1:i):(i=r.length-1,n=i);var o=r[n],s=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(i),l={x:this._crosshair.x,y:this._crosshair.y,paneId:this._crosshair.paneId};this._crosshair=X(X({},a),{realX:s,kLineData:o,realDataIndex:i,dataIndex:n}),l.x===a.x&&l.y===a.y&&l.paneId===a.paneId||(null!==o&&this._chartStore.getChart().crosshairChange(this._crosshair),null!==e&&void 0!==e&&e||this._chartStore.getChart().updatePane(1))},t.prototype.recalculateCrosshair=function(t){this.setCrosshair(this._crosshair,t)},t.prototype.getCrosshair=function(){return this._crosshair},t.prototype.setActiveIcon=function(t){this._activeIcon=null!==t&&void 0!==t?t:null},t.prototype.getActiveIcon=function(){return this._activeIcon},t.prototype.clear=function(){this.setCrosshair({},!0),this.setActiveIcon()},t}(),ii={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n=t.overlay,r=t.precision,a=t.thousandsSeparator,o=t.decimalFoldThreshold,s=n.points;if(e.length>0){var l=[],c=[],u=0,d=i.width;if(e.length>1&&Tt(s[0].value)&&Tt(s[1].value)){var h=[1,.786,.618,.5,.382,.236,0],p=e[0].y-e[1].y,f=s[0].value-s[1].value;h.forEach(function(t){var i,n=e[1].y+p*t,h=Wt(zt(((null!==(i=s[1].value)&&void 0!==i?i:0)+f*t).toFixed(r.price),a),o);l.push({coordinates:[{x:u,y:n},{x:d,y:n}]}),c.push({x:u,y:n,text:"".concat(h," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})})}return[{type:"line",attrs:l},{type:"text",isCheckEvent:!1,attrs:c}]}return[]}},ni={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n={x:0,y:e[0].y};return Mt(e[1])&&e[0].x<e[1].x&&(n.x=i.width),[{type:"line",attrs:{coordinates:[e[0],n]}}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},ri={name:"horizontalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=[];return 2===e.length&&i.push({coordinates:e}),[{type:"line",attrs:i}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},ai={name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:i.width,y:e[0].y}]}}]}},oi=function(){function t(){this._children=[],this._callbacks=new Map}return t.prototype.registerEvent=function(t,e){return this._callbacks.set(t,e),this},t.prototype.onEvent=function(t,e,i){var n=this._callbacks.get(t);return!(!Mt(n)||!this.checkEventOn(e))&&n(e,i)},t.prototype.checkEventOn=function(t){var e,i;try{for(var n=j(this._children),r=n.next();!r.done;r=n.next()){var a=r.value;if(a.checkEventOn(t))return!0}}catch(o){e={error:o}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return!1},t.prototype.dispatchEvent=function(t,e,i){var n=this._children.length-1;if(n>-1)for(var r=n;r>-1;r--)if(this._children[r].dispatchEvent(t,e,i))return!0;return this.onEvent(t,e,i)},t.prototype.addChild=function(t){return this._children.push(t),this},t.prototype.clear=function(){this._children=[]},t}(),si=2,li=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return B(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return B(i,e),i.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},i.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},i}(e);return i},e}(oi);function ci(t,e){return Math.sqrt(Math.pow(t.x+e.x,2)+Math.pow(t.y+e.y,2))}function ui(t){var e=ci(t[0],t[1]),i=ci(t[1],t[2]),n=e+i,r=[t[2].x-t[0].x,t[2].y-t[0].y];return[{x:t[1].x-.5*r[0]*e/n,y:t[1].y-.5*r[1]*e/n},{x:t[1].x+.5*r[0]*e/n,y:t[1].y+.5*r[1]*e/n}]}function di(t,e){var i=e.coordinates;if(i.length>1)for(var n=1;n<i.length;n++){var r=i[n-1],a=i[n];if(r.x===a.x){if(Math.abs(r.y-t.y)+Math.abs(a.y-t.y)-Math.abs(r.y-a.y)<si+si&&Math.abs(t.x-r.x)<si)return!0}else{var o=fi(r,a),s=hi(o,t),l=Math.abs(s-t.y);if(Math.abs(r.x-t.x)+Math.abs(a.x-t.x)-Math.abs(r.x-a.x)<si+si&&l*l/(o[0]*o[0]+1)<si*si)return!0}}return!1}function hi(t,e){return null!=t?e.x*t[0]+t[1]:e.y}function pi(t,e,i){var n=fi(t,e);return hi(n,i)}function fi(t,e){var i=t.x-e.x;if(0!==i){var n=(t.y-e.y)/i,r=t.y-n*t.x;return[n,r]}return null}function vi(t,e,i){var n=e.coordinates,r=n.length;if(r>1){var a=i.style,o=void 0===a?N.Solid:a,s=i.smooth,l=i.size,c=void 0===l?1:l,u=i.color,d=void 0===u?"currentColor":u,h=i.dashedValue,p=void 0===h?[2,2]:h;if(t.lineWidth=c,t.strokeStyle=d,o===N.Dashed?t.setLineDash(p):t.setLineDash([]),t.beginPath(),t.moveTo(n[0].x,n[0].y),null!==s&&void 0!==s&&s){for(var f=[],v=1;v<r-1;v++)f=f.concat(ui([n[v-1],n[v],n[v+1]]));t.quadraticCurveTo(f[0].x,f[0].y,n[1].x,n[1].y);for(var g=2;g<r-1;g++)t.bezierCurveTo(f[2*(g-2)+1].x,f[2*(g-2)+1].y,f[2*(g-1)].x,f[2*(g-1)].y,n[g].x,n[g].y);t.quadraticCurveTo(f[2*(g-2)+1].x,f[2*(g-2)+1].y,n[g].x,n[g].y)}else for(g=1;g<n.length;g++)t.lineTo(n[g].x,n[g].y);t.stroke(),t.closePath()}}var gi={name:"line",checkEventOn:di,draw:function(t,e,i){vi(t,e,i)}};function mi(t,e,i){var n=null!==i&&void 0!==i?i:0,r=[];if(t.length>1)if(t[0].x===t[1].x){var a=0,o=e.height;if(r.push({coordinates:[{x:t[0].x,y:a},{x:t[0].x,y:o}]}),t.length>2){r.push({coordinates:[{x:t[2].x,y:a},{x:t[2].x,y:o}]});for(var s=t[0].x-t[2].x,l=0;l<n;l++){var c=s*(l+1);r.push({coordinates:[{x:t[0].x+c,y:a},{x:t[0].x+c,y:o}]})}}}else{var u=0,d=e.width,h=fi(t[0],t[1]),p=h[0],f=h[1];if(r.push({coordinates:[{x:u,y:u*p+f},{x:d,y:d*p+f}]}),t.length>2){var v=t[2].y-p*t[2].x;r.push({coordinates:[{x:u,y:u*p+v},{x:d,y:d*p+v}]});for(s=f-v,l=0;l<n;l++){var g=f+s*(l+1);r.push({coordinates:[{x:u,y:u*p+g},{x:d,y:d*p+g}]})}}}return r}var yi={name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:mi(e,i)}]}},bi={name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:mi(e,i,1)}]}},xi={name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n=t.precision,r=t.overlay,a=t.thousandsSeparator,o=t.decimalFoldThreshold,s=r.points[0].value,l=void 0===s?0:s;return[{type:"line",attrs:{coordinates:[e[0],{x:i.width,y:e[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:e[0].x,y:e[0].y,text:Wt(zt(l.toFixed(n.price),a),o),baseline:"bottom"}}]}};function _i(t,e){if(t.length>1){var i=void 0;return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[0].y<t[1].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:pi(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:pi(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var wi={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:_i(e,i)}]}},Ci={name:"segment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]}},Si={name:"straightLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return 2===e.length?e[0].x===e[1].x?[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]:[{type:"line",attrs:{coordinates:[{x:0,y:pi(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:pi(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},ki={name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;if(2===e.length){var n={x:e[0].x,y:0};return e[0].y<e[1].y&&(n.y=i.height),[{type:"line",attrs:{coordinates:[e[0],n]}}]}return[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},Ai={name:"verticalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},Ti={name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]}},Mi={name:"simpleAnnotation",totalStep:2,styles:{line:{style:N.Dashed}},createPointFigures:function(t){var e,i,n=t.overlay,r=t.coordinates;Mt(n.extendData)&&(i=kt(n.extendData)?n.extendData(n):null!==(e=n.extendData)&&void 0!==e?e:"");var a=r[0].x,o=r[0].y-6,s=o-50,l=s-5;return[{type:"line",attrs:{coordinates:[{x:a,y:o},{x:a,y:s}]},ignoreEvent:!0},{type:"polygon",attrs:{coordinates:[{x:a,y:s},{x:a-4,y:l},{x:a+4,y:l}]},ignoreEvent:!0},{type:"text",attrs:{x:a,y:l,text:null!==i&&void 0!==i?i:"",align:"center",baseline:"bottom"},ignoreEvent:!0}]}},Ii={name:"simpleTag",totalStep:2,styles:{line:{style:N.Dashed}},createPointFigures:function(t){var e=t.bounding,i=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:i[0].y},{x:e.width,y:i[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,i,n,r,a,o=t.overlay,s=t.coordinates,l=t.bounding,c=t.yAxis,u=t.precision,d=null!==(e=null===c||void 0===c?void 0:c.isFromZero())&&void 0!==e&&e;return d?(n="left",r=0):(n="right",r=l.width),Mt(o.extendData)&&(a=kt(o.extendData)?o.extendData(o):null!==(i=o.extendData)&&void 0!==i?i:""),!Mt(a)&&Tt(o.points[0].value)&&(a=Nt(o.points[0].value,u.price)),{type:"text",attrs:{x:r,y:s[0].y,text:null!==a&&void 0!==a?a:"",align:n,baseline:"middle"}}}},Ei={},Di=[ii,ni,ri,ai,yi,bi,xi,wi,Ci,Si,ki,Ai,Ti,Mi,Ii];function Pi(t){Ei[t.name]=ie.extend(t)}function Li(t){var e;return null!==(e=Ei[t])&&void 0!==e?e:null}Di.forEach(function(t){Ei[t.name]=ie.extend(t)});var Ri=30,Fi=100,Bi={CANDLE:"candle_pane",INDICATOR:"indicator_pane_",X_AXIS:"x_axis_pane"},Ni=function(){function t(t){this._instances=new Map,this._progressInstanceInfo=null,this._pressedInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._hoverInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._clickInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._chartStore=t}return t.prototype._overrideInstance=function(t,e){var i=e.id,n=e.groupId,r=e.points,a=e.styles,o=e.lock,s=e.visible,l=e.zLevel,c=e.mode,u=e.modeSensitivity,d=e.extendData,h=e.onDrawStart,p=e.onDrawing,f=e.onDrawEnd,v=e.onClick,g=e.onDoubleClick,m=e.onRightClick,y=e.onPressedMoveStart,b=e.onPressedMoving,x=e.onPressedMoveEnd,_=e.onMouseEnter,w=e.onMouseLeave,C=e.onRemoved,S=e.onSelected,k=e.onDeselected,A=!1,T=!1;return Et(i)&&t.setId(i),Et(n)&&t.setGroupId(n),St(r)&&t.setPoints(r)&&(A=!0),Mt(a)&&t.setStyles(a)&&(A=!0),It(o)&&t.setLock(o),It(s)&&t.setVisible(s)&&(A=!0),Tt(l)&&t.setZLevel(l)&&(A=!0,T=!0),Mt(c)&&t.setMode(c),Tt(u)&&t.setModeSensitivity(u),t.setExtendData(d)&&(A=!0),void 0!==h&&t.setOnDrawStartCallback(h),void 0!==p&&t.setOnDrawingCallback(p),void 0!==f&&t.setOnDrawEndCallback(f),void 0!==v&&t.setOnClickCallback(v),void 0!==g&&t.setOnDoubleClickCallback(g),void 0!==m&&t.setOnRightClickCallback(m),void 0!==y&&t.setOnPressedMoveStartCallback(y),void 0!==b&&t.setOnPressedMovingCallback(b),void 0!==x&&t.setOnPressedMoveEndCallback(x),void 0!==_&&t.setOnMouseEnterCallback(_),void 0!==w&&t.setOnMouseLeaveCallback(w),void 0!==C&&t.setOnRemovedCallback(C),void 0!==S&&t.setOnSelectedCallback(S),void 0!==k&&t.setOnDeselectedCallback(k),[A,T]},t.prototype.getInstanceById=function(t){var e,i;try{for(var n=j(this._instances),r=n.next();!r.done;r=n.next()){var a=r.value,o=a[1],s=o.find(function(e){return e.id===t});if(Mt(s))return s}}catch(l){e={error:l}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return null!==this._progressInstanceInfo&&this._progressInstanceInfo.instance.id===t?this._progressInstanceInfo.instance:null},t.prototype._sort=function(t){var e;Et(t)?null===(e=this._instances.get(t))||void 0===e||e.sort(function(t,e){return t.zLevel-e.zLevel}):this._instances.forEach(function(t){t.sort(function(t,e){return t.zLevel-e.zLevel})})},t.prototype.addInstances=function(t,e,i){var n=this,r=t.map(function(t){var r,a,o,s,l=null!==(r=t.id)&&void 0!==r?r:le(Qt);if(null===n.getInstanceById(l)){var c=Li(t.name);if(null!==c){var u=new c;u.setPaneId(e);var d=null!==(a=t.groupId)&&void 0!==a?a:l;return t.id=l,t.groupId=d,n._overrideInstance(u,t),u.isDrawing()?n._progressInstanceInfo={paneId:e,instance:u,appointPaneFlag:i}:(n._instances.has(e)||n._instances.set(e,[]),null===(o=n._instances.get(e))||void 0===o||o.push(u)),u.isStart()&&(null===(s=u.onDrawStart)||void 0===s||s.call(u,{overlay:u})),l}}return null});if(r.some(function(t){return null!==t})){this._sort();var a=this._chartStore.getChart();a.updatePane(1,e),a.updatePane(1,Bi.X_AXIS)}return r},t.prototype.getProgressInstanceInfo=function(){return this._progressInstanceInfo},t.prototype.progressInstanceComplete=function(){var t;if(null!==this._progressInstanceInfo){var e=this._progressInstanceInfo,i=e.instance,n=e.paneId;i.isDrawing()||(this._instances.has(n)||this._instances.set(n,[]),null===(t=this._instances.get(n))||void 0===t||t.push(i),this._sort(n),this._progressInstanceInfo=null)}},t.prototype.updateProgressInstanceInfo=function(t,e){null!==this._progressInstanceInfo&&(It(e)&&e&&(this._progressInstanceInfo.appointPaneFlag=e),this._progressInstanceInfo.paneId=t,this._progressInstanceInfo.instance.setPaneId(t))},t.prototype.getInstances=function(t){var e;if(!Et(t)){var i=[];return this._instances.forEach(function(t){i=i.concat(t)}),i}return null!==(e=this._instances.get(t))&&void 0!==e?e:[]},t.prototype.override=function(t){var e=this,i=t.id,n=t.groupId,r=t.name,a=!1,o=!1,s=function(i){var n=e._overrideInstance(i,t);n[0]&&(a=!0),n[1]&&(o=!0)};if(Et(i)){var l=this.getInstanceById(i);null!==l&&s(l)}else{var c=Et(r),u=Et(n);if(this._instances.forEach(function(t){t.forEach(function(t){(c&&t.name===r||u&&t.groupId===n||!c&&!u)&&s(t)})}),null!==this._progressInstanceInfo){var d=this._progressInstanceInfo.instance;(c&&d.name===r||u&&d.groupId===n||!c&&!u)&&s(d)}}o&&this._sort(),a&&this._chartStore.getChart().updatePane(1)},t.prototype.removeInstance=function(t){var e,i,n,r=function(t,e){if(Et(t.id)){if(e.id!==t.id)return!1}else if(Et(t.groupId)){if(e.groupId!==t.groupId)return!1}else if(Et(t.name)&&e.name!==t.name)return!1;return!0},a=[],o=Mt(t);if(null!==this._progressInstanceInfo){var s=this._progressInstanceInfo.instance;(!o||o&&r(t,s))&&(a.push(this._progressInstanceInfo.paneId),null===(n=s.onRemoved)||void 0===n||n.call(s,{overlay:s}),this._progressInstanceInfo=null)}if(o){var l=new Map,c=function(e){var i=e[1],n=i.filter(function(i){var n;return!r(t,i)||(a.includes(e[0])||a.push(e[0]),null===(n=i.onRemoved)||void 0===n||n.call(i,{overlay:i}),!1)});n.length>0&&l.set(e[0],n)};try{for(var u=j(this._instances),d=u.next();!d.done;d=u.next()){var h=d.value;c(h)}}catch(f){e={error:f}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}this._instances=l}else this._instances.forEach(function(t,e){a.push(e),t.forEach(function(t){var e;null===(e=t.onRemoved)||void 0===e||e.call(t,{overlay:t})})}),this._instances.clear();if(a.length>0){var p=this._chartStore.getChart();a.forEach(function(t){p.updatePane(1,t)}),p.updatePane(1,Bi.X_AXIS)}},t.prototype.setPressedInstanceInfo=function(t){this._pressedInstanceInfo=t},t.prototype.getPressedInstanceInfo=function(){return this._pressedInstanceInfo},t.prototype.setHoverInstanceInfo=function(t,e){var i,n,r=this._hoverInstanceInfo,a=r.instance,o=r.figureType,s=r.figureKey,l=r.figureIndex;if(((null===a||void 0===a?void 0:a.id)!==(null===(i=t.instance)||void 0===i?void 0:i.id)||o!==t.figureType||l!==t.figureIndex)&&(this._hoverInstanceInfo=t,(null===a||void 0===a?void 0:a.id)!==(null===(n=t.instance)||void 0===n?void 0:n.id))){var c=!1,u=!1;null!==a&&(u=!0,kt(a.onMouseLeave)&&(a.onMouseLeave(X({overlay:a,figureKey:s,figureIndex:l},e)),c=!0)),null!==t.instance&&(u=!0,t.instance.setZLevel(ee),kt(t.instance.onMouseEnter)&&(t.instance.onMouseEnter(X({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),c=!0)),u&&this._sort(),c||this._chartStore.getChart().updatePane(1)}},t.prototype.getHoverInstanceInfo=function(){return this._hoverInstanceInfo},t.prototype.setClickInstanceInfo=function(t,e){var i,n,r,a,o,s,l,c,u,d=this._clickInstanceInfo,h=d.paneId,p=d.instance,f=d.figureType,v=d.figureKey,g=d.figureIndex;if(null!==(n=null===(i=t.instance)||void 0===i?void 0:i.isDrawing())&&void 0!==n&&n||null===(a=null===(r=t.instance)||void 0===r?void 0:r.onClick)||void 0===a||a.call(r,X({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),((null===p||void 0===p?void 0:p.id)!==(null===(o=t.instance)||void 0===o?void 0:o.id)||f!==t.figureType||g!==t.figureIndex)&&(this._clickInstanceInfo=t,(null===p||void 0===p?void 0:p.id)!==(null===(s=t.instance)||void 0===s?void 0:s.id))){null===(l=null===p||void 0===p?void 0:p.onDeselected)||void 0===l||l.call(p,X({overlay:p,figureKey:v,figureIndex:g},e)),null===(u=null===(c=t.instance)||void 0===c?void 0:c.onSelected)||void 0===u||u.call(c,X({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e));var m=this._chartStore.getChart();m.updatePane(1,t.paneId),h!==t.paneId&&m.updatePane(1,h),m.updatePane(1,Bi.X_AXIS)}},t.prototype.getClickInstanceInfo=function(){return this._clickInstanceInfo},t.prototype.isEmpty=function(){return 0===this._instances.size&&null===this._progressInstanceInfo},t.prototype.isDrawing=function(){var t,e;return null!==this._progressInstanceInfo&&null!==(e=null===(t=this._progressInstanceInfo)||void 0===t?void 0:t.instance.isDrawing())&&void 0!==e&&e},t}(),Oi=function(){function t(){this._actions=new Map}return t.prototype.execute=function(t,e){var i;null===(i=this._actions.get(t))||void 0===i||i.execute(e)},t.prototype.subscribe=function(t,e){var i;this._actions.has(t)||this._actions.set(t,new Yt),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},t.prototype.unsubscribe=function(t,e){var i=this._actions.get(t);Mt(i)&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},t.prototype.has=function(t){var e=this._actions.get(t);return Mt(e)&&!e.isEmpty()},t}(),zi={grid:{horizontal:{color:"#EDEDED"},vertical:{color:"#EDEDED"}},candle:{priceMark:{high:{color:"#76808F"},low:{color:"#76808F"}},tooltip:{rect:{color:"#FEFEFE",borderColor:"#F2F3F5"},text:{color:"#76808F"}}},indicator:{tooltip:{text:{color:"#76808F"}}},xAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},yAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},separator:{color:"#DDDDDD"},crosshair:{horizontal:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}},vertical:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}}}},Wi={grid:{horizontal:{color:"#292929"},vertical:{color:"#292929"}},candle:{priceMark:{high:{color:"#929AA5"},low:{color:"#929AA5"}},tooltip:{rect:{color:"rgba(10, 10, 10, .6)",borderColor:"rgba(10, 10, 10, .6)"},text:{color:"#929AA5"}}},indicator:{tooltip:{text:{color:"#929AA5"}}},xAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},yAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},separator:{color:"#333333"},crosshair:{horizontal:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}},vertical:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}}}},$i={light:zi,dark:Wi};function Hi(t){var e;return null!==(e=$i[t])&&void 0!==e?e:null}var Vi=function(){function t(t,e){this._styles=gt(),this._customApi=ne(),this._locale=ae,this._precision={price:2,volume:0},this._thousandsSeparator=",",this._decimalFoldThreshold=3,this._dataList=[],this._loadMoreCallback=null,this._loadDataCallback=null,this._loading=!0,this._forwardMore=!0,this._backwardMore=!0,this._timeScaleStore=new _e(this),this._indicatorStore=new ti(this),this._overlayStore=new Ni(this),this._tooltipStore=new ei(this),this._actionStore=new Oi,this._visibleDataList=[],this._chart=t,this.setOptions(e)}return t.prototype.adjustVisibleDataList=function(){this._visibleDataList=[];for(var t=this._timeScaleStore.getVisibleRange(),e=t.realFrom,i=t.realTo,n=e;n<i;n++){var r=this._dataList[n],a=this._timeScaleStore.dataIndexToCoordinate(n);this._visibleDataList.push({dataIndex:n,x:a,data:r})}},t.prototype.setOptions=function(t){if(Mt(t)){var e=t.locale,i=t.timezone,n=t.styles,r=t.customApi,a=t.thousandsSeparator,o=t.decimalFoldThreshold;Et(e)&&(this._locale=e),Et(i)&&this._timeScaleStore.setTimezone(i),Mt(n)&&(Et(n)?wt(this._styles,Hi(n)):wt(this._styles,n)),Mt(r)&&wt(this._customApi,r),Et(a)&&(this._thousandsSeparator=a),Tt(o)&&(this._decimalFoldThreshold=o)}return this},t.prototype.getStyles=function(){return this._styles},t.prototype.getLocale=function(){return this._locale},t.prototype.getCustomApi=function(){return this._customApi},t.prototype.getThousandsSeparator=function(){return this._thousandsSeparator},t.prototype.getDecimalFoldThreshold=function(){return this._decimalFoldThreshold},t.prototype.getPrecision=function(){return this._precision},t.prototype.setPrecision=function(t){return this._precision=t,this._indicatorStore.setSeriesPrecision(t),this},t.prototype.getDataList=function(){return this._dataList},t.prototype.getVisibleDataList=function(){return this._visibleDataList},t.prototype.addData=function(t,e,i){return U(this,void 0,void 0,function(){var n,r,a,o,s;return G(this,function(l){switch(l.label){case 0:if(n=!1,St(t)?(e?(this.clear(),this._dataList=t,this._forwardMore=null===i||void 0===i||i,this._timeScaleStore.resetOffsetRightDistance()):(this._dataList=t,It(i)&&(this._forwardMore=i)),this._loading=!1,n=!0):(r=this._dataList.length,a=t.timestamp,o=Ft(this._dataList[r-1],"timestamp",0),a>o?(this._dataList.push(t),s=this._timeScaleStore.getLastBarRightSideDiffBarCount(),s<0&&this._timeScaleStore.setLastBarRightSideDiffBarCount(--s),n=!0):a===o&&(this._dataList[r-1]=t,n=!0)),!n)return[3,4];this._timeScaleStore.adjustVisibleRange(),this._tooltipStore.recalculateCrosshair(!0),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this._indicatorStore.calcInstance()];case 2:return l.sent(),this._chart.adjustPaneViewport(!1,!0,!0,!0),this._actionStore.execute(Pt.OnDataReady),[3,4];case 3:return l.sent(),[3,4];case 4:return[2]}})})},t.prototype.setLoadMoreCallback=function(t){this._loadMoreCallback=t},t.prototype.executeLoadMoreCallback=function(t){this._forwardMore&&!this._loading&&Mt(this._loadMoreCallback)&&(this._loading=!0,this._loadMoreCallback(t))},t.prototype.setLoadDataCallback=function(t){this._loadDataCallback=t},t.prototype.executeLoadDataCallback=function(t){var e=this;if(!this._loading&&Mt(this._loadDataCallback)&&(this._forwardMore&&t.type===re.Forward||this._backwardMore&&t.type===re.Backward)){var i=function(i,n){var r=[];t.type===re.Backward?(r=e._dataList.concat(i),e._backwardMore=null!==n&&void 0!==n&&n):(r=i.concat(e._dataList),e._forwardMore=null!==n&&void 0!==n&&n),e.addData(r,!1).then(function(){}).catch(function(){})};this._loading=!0,this._loadDataCallback(X(X({},t),{callback:i}))}},t.prototype.clear=function(){this._forwardMore=!0,this._backwardMore=!0,this._loading=!0,this._dataList=[],this._visibleDataList=[],this._timeScaleStore.clear(),this._tooltipStore.clear()},t.prototype.getTimeScaleStore=function(){return this._timeScaleStore},t.prototype.getIndicatorStore=function(){return this._indicatorStore},t.prototype.getOverlayStore=function(){return this._overlayStore},t.prototype.getTooltipStore=function(){return this._tooltipStore},t.prototype.getActionStore=function(){return this._actionStore},t.prototype.getChart=function(){return this._chart},t}(),Ki={MAIN:"main",X_AXIS:"xAxis",Y_AXIS:"yAxis",SEPARATOR:"separator"},Yi=7,Xi=-1;function Ui(t){return kt(window.requestAnimationFrame)?window.requestAnimationFrame(t):window.setTimeout(t,20)}function Gi(t){kt(window.cancelAnimationFrame)?window.cancelAnimationFrame(t):window.clearTimeout(t)}function ji(){return U(this,void 0,void 0,function(){return G(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){var e=new ResizeObserver(function(i){t(i.every(function(t){return"devicePixelContentBoxSize"in t})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})];case 1:return[2,t.sent()]}})})}var qi=function(){function t(t,e){var i=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._requestAnimationId=Xi,this._mediaQueryListener=function(){var t=$t(i._element);i._resetPixelRatio(Math.round(i._element.clientWidth*t),Math.round(i._element.clientHeight*t),t,t)},this._listener=e,this._element=ce("canvas",t),this._ctx=this._element.getContext("2d",{willReadFrequently:!0}),ji().then(function(t){i._supportedDevicePixelContentBox=t,t?(i._resizeObserver=new ResizeObserver(function(t){var e,n=t.find(function(t){return t.target===i._element}),r=null===(e=null===n||void 0===n?void 0:n.devicePixelContentBoxSize)||void 0===e?void 0:e[0];if(Mt(r)){var a=r.inlineSize,o=r.blockSize;i._pixelWidth===a&&i._pixelHeight===o||i._resetPixelRatio(a,o,a/i._element.clientWidth,o/i._element.clientHeight)}}),i._resizeObserver.observe(i._element,{box:"device-pixel-content-box"})):(i._mediaQueryList=window.matchMedia("(resolution: ".concat($t(i._element),"dppx)")),i._mediaQueryList.addListener(i._mediaQueryListener))}).catch(function(t){return!1})}return t.prototype._resetPixelRatio=function(t,e,i,n){var r=this;this._executeListener(function(){var a=r._element.clientWidth,o=r._element.clientHeight;r._width=a,r._height=o,r._pixelWidth=t,r._pixelHeight=e,r._element.width=t,r._element.height=e,r._ctx.scale(i,n)})},t.prototype._executeListener=function(t){var e=this;this._requestAnimationId!==Xi&&(Gi(this._requestAnimationId),this._requestAnimationId=Xi),this._requestAnimationId=Ui(function(){e._ctx.clearRect(0,0,e._width,e._height),null===t||void 0===t||t(),e._listener()})},t.prototype.update=function(t,e){if(this._width!==t||this._height!==e){if(this._element.style.width="".concat(t,"px"),this._element.style.height="".concat(e,"px"),!this._supportedDevicePixelContentBox){var i=$t(this._element);this._resetPixelRatio(Math.round(t*i),Math.round(e*i),i,i)}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){var t,e;null===(t=this._resizeObserver)||void 0===t||t.unobserve(this._element),null===(e=this._mediaQueryList)||void 0===e||e.removeListener(this._mediaQueryListener)},t}();function Zi(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return Mt(t)&&wt(e,t),e}var Ji=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=Zi(),n._pane=i,n.init(e),n}return B(e,t),e.prototype.init=function(t){this._rootContainer=t,this._container=this.createContainer(),t.appendChild(this._container)},e.prototype.setBounding=function(t){return wt(this._bounding,t),this},e.prototype.getContainer=function(){return this._container},e.prototype.getBounding=function(){return this._bounding},e.prototype.getPane=function(){return this._pane},e.prototype.update=function(t){this.updateImp(this._container,this._bounding,null!==t&&void 0!==t?t:3)},e.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},e}(oi),Qi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.init=function(e){var i=this;t.prototype.init.call(this,e),this._mainCanvas=new qi({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},function(){i.updateMain(i._mainCanvas.getContext())}),this._overlayCanvas=new qi({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},function(){i.updateOverlay(i._overlayCanvas.getContext())});var n=this.getContainer();n.appendChild(this._mainCanvas.getElement()),n.appendChild(this._overlayCanvas.getElement())},e.prototype.createContainer=function(){return ce("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype.updateImp=function(t,e,i){var n=e.width,r=e.height,a=e.left;t.style.left="".concat(a,"px");var o=i,s=t.clientWidth,l=t.clientHeight;switch(n===s&&r===l||(t.style.width="".concat(n,"px"),t.style.height="".concat(r,"px"),o=3),o){case 0:this._mainCanvas.update(n,r);break;case 1:this._overlayCanvas.update(n,r);break;case 3:case 4:this._mainCanvas.update(n,r),this._overlayCanvas.update(n,r);break}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,r=ce("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),o=$t(r);return r.width=i*o,r.height=n*o,a.scale(o,o),a.drawImage(this._mainCanvas.getElement(),0,0,i,n),t&&a.drawImage(this._overlayCanvas.getElement(),0,0,i,n),r},e}(Ji);function tn(t){return"transparent"===t||"none"===t||/^[rR][gG][Bb][Aa]\(([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\s]*,){3}[\s]*0[\s]*\)$/.test(t)||/^[hH][Ss][Ll][Aa]\(([\s]*(3603[0-5][0-9]|[012]?[0-9][0-9]?)[\s]*,)([\s]*((100|[0-9][0-9]?)%|0)[\s]*,){2}([\s]*0[\s]*)\)$/.test(t)}function en(t,e){var i=t.x-e.x,n=t.y-e.y,r=e.r;return!(i*i+n*n>r*r)}function nn(t,e,i){var n=e.x,r=e.y,a=e.r,o=i.style,s=void 0===o?O.Fill:o,l=i.color,c=void 0===l?"currentColor":l,u=i.borderSize,d=void 0===u?1:u,h=i.borderColor,p=void 0===h?"currentColor":h,f=i.borderStyle,v=void 0===f?N.Solid:f,g=i.borderDashedValue,m=void 0===g?[2,2]:g;s!==O.Fill&&i.style!==O.StrokeFill||Et(c)&&tn(c)||(t.fillStyle=c,t.beginPath(),t.arc(n,r,a,0,2*Math.PI),t.closePath(),t.fill()),(s===O.Stroke||i.style===O.StrokeFill)&&d>0&&!tn(p)&&(t.strokeStyle=p,t.lineWidth=d,v===N.Dashed?t.setLineDash(m):t.setLineDash([]),t.beginPath(),t.arc(n,r,a,0,2*Math.PI),t.closePath(),t.stroke())}var rn={name:"circle",checkEventOn:en,draw:function(t,e,i){nn(t,e,i)}};function an(t,e){for(var i=!1,n=e.coordinates,r=0,a=n.length-1;r<n.length;a=r++)n[r].y>t.y!==n[a].y>t.y&&t.x<(n[a].x-n[r].x)*(t.y-n[r].y)/(n[a].y-n[r].y)+n[r].x&&(i=!i);return i}function on(t,e,i){var n=e.coordinates,r=i.style,a=void 0===r?O.Fill:r,o=i.color,s=void 0===o?"currentColor":o,l=i.borderSize,c=void 0===l?1:l,u=i.borderColor,d=void 0===u?"currentColor":u,h=i.borderStyle,p=void 0===h?N.Solid:h,f=i.borderDashedValue,v=void 0===f?[2,2]:f;if((a===O.Fill||i.style===O.StrokeFill)&&(!Et(s)||!tn(s))){t.fillStyle=s,t.beginPath(),t.moveTo(n[0].x,n[0].y);for(var g=1;g<n.length;g++)t.lineTo(n[g].x,n[g].y);t.closePath(),t.fill()}if((a===O.Stroke||i.style===O.StrokeFill)&&c>0&&!tn(d)){t.strokeStyle=d,t.lineWidth=c,p===N.Dashed?t.setLineDash(v):t.setLineDash([]),t.beginPath(),t.moveTo(n[0].x,n[0].y);for(g=1;g<n.length;g++)t.lineTo(n[g].x,n[g].y);t.closePath(),t.stroke()}}var sn={name:"polygon",checkEventOn:an,draw:function(t,e,i){on(t,e,i)}};function ln(t,e){var i=e.x,n=e.width;n<2*si&&(i-=si,n=2*si);var r=e.y,a=e.height;return a<2*si&&(r-=si,a=2*si),t.x>=i&&t.x<=i+n&&t.y>=r&&t.y<=r+a}function cn(t,e,i){var n=e.x,r=e.y,a=e.width,o=e.height,s=i.style,l=void 0===s?O.Fill:s,c=i.color,u=void 0===c?"transparent":c,d=i.borderSize,h=void 0===d?1:d,p=i.borderColor,f=void 0===p?"transparent":p,v=i.borderStyle,g=void 0===v?N.Solid:v,m=i.borderRadius,y=void 0===m?0:m,b=i.borderDashedValue,x=void 0===b?[2,2]:b;l!==O.Fill&&i.style!==O.StrokeFill||Et(u)&&tn(u)||(t.fillStyle=u,t.beginPath(),t.moveTo(n+y,r),t.arcTo(n+a,r,n+a,r+o,y),t.arcTo(n+a,r+o,n,r+o,y),t.arcTo(n,r+o,n,r,y),t.arcTo(n,r,n+a,r,y),t.closePath(),t.fill()),(l===O.Stroke||i.style===O.StrokeFill)&&h>0&&!tn(f)&&(t.strokeStyle=f,t.lineWidth=h,g===N.Dashed?t.setLineDash(x):t.setLineDash([]),t.beginPath(),t.moveTo(n+y,r),t.arcTo(n+a,r,n+a,r+o,y),t.arcTo(n+a,r+o,n,r+o,y),t.arcTo(n,r+o,n,r,y),t.arcTo(n,r,n+a,r,y),t.closePath(),t.stroke())}var un={name:"rect",checkEventOn:ln,draw:function(t,e,i){cn(t,e,i)}};function dn(t,e){var i,n,r=e.size,a=void 0===r?12:r,o=e.paddingLeft,s=void 0===o?0:o,l=e.paddingTop,c=void 0===l?0:l,u=e.paddingRight,d=void 0===u?0:u,h=e.paddingBottom,p=void 0===h?0:h,f=e.weight,v=void 0===f?"normal":f,g=e.family,m=t.x,y=t.y,b=t.text,x=t.align,_=void 0===x?"left":x,w=t.baseline,C=void 0===w?"top":w,S=t.width,k=t.height,A=null!==S&&void 0!==S?S:s+Vt(b,a,v,g)+d,T=null!==k&&void 0!==k?k:c+a+p;switch(_){case"left":case"start":i=m;break;case"right":case"end":i=m-A;break;default:i=m-A/2;break}switch(C){case"top":case"hanging":n=y;break;case"bottom":case"ideographic":case"alphabetic":n=y-T;break;default:n=y-T/2;break}return{x:i,y:n,width:A,height:T}}function hn(t,e,i){var n=dn(e,i),r=n.x,a=n.y,o=n.width,s=n.height;return t.x>=r&&t.x<=r+o&&t.y>=a&&t.y<=a+s}function pn(t,e,i){var n=e.text,r=i.color,a=void 0===r?"currentColor":r,o=i.size,s=void 0===o?12:o,l=i.family,c=i.weight,u=i.paddingLeft,d=void 0===u?0:u,h=i.paddingTop,p=void 0===h?0:h,f=i.paddingRight,v=void 0===f?0:f,g=dn(e,i);cn(t,g,X(X({},i),{color:i.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=Ht(s,c,l),t.fillStyle=a,t.fillText(n,g.x+d,g.y+p,g.width-d-v)}var fn={name:"text",checkEventOn:function(t,e,i){return hn(t,e,i)},draw:function(t,e,i){pn(t,e,i)}},vn=fn;function gn(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}function mn(t,e){if(Math.abs(gn(t,e)-e.r)<si){var i=e.r,n=e.startAngle,r=e.endAngle,a=i*Math.cos(n)+e.x,o=i*Math.sin(n)+e.y,s=i*Math.cos(r)+e.x,l=i*Math.sin(r)+e.y;return t.x<=Math.max(a,s)+si&&t.x>=Math.min(a,s)-si&&t.y<=Math.max(o,l)+si&&t.y>=Math.min(o,l)-si}return!1}function yn(t,e,i){var n=e.x,r=e.y,a=e.r,o=e.startAngle,s=e.endAngle,l=i.style,c=void 0===l?N.Solid:l,u=i.size,d=void 0===u?1:u,h=i.color,p=void 0===h?"currentColor":h,f=i.dashedValue,v=void 0===f?[2,2]:f;t.lineWidth=d,t.strokeStyle=p,c===N.Dashed?t.setLineDash(v):t.setLineDash([]),t.beginPath(),t.arc(n,r,a,o,s),t.stroke(),t.closePath()}var bn={name:"arc",checkEventOn:mn,draw:function(t,e,i){yn(t,e,i)}},xn={},_n=[rn,gi,sn,un,fn,vn,bn];function wn(t){var e;return null!==(e=xn[t])&&void 0!==e?e:null}_n.forEach(function(t){xn[t.name]=li.extend(t)});var Cn=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return B(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var i=wn(t.name);if(null!==i){var n=new i(t);if(Mt(e)){for(var r in e)e.hasOwnProperty(r)&&n.registerEvent(r,e[r]);this.addChild(n)}return n}return null},e.prototype.draw=function(t){this.clear(),this.drawImp(t)},e}(oi),Sn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=this.getWidget().getPane(),r=n.getChart(),a=i.getBounding(),o=r.getStyles().grid,s=o.show;if(s){t.save(),t.globalCompositeOperation="destination-over";var l=o.horizontal,c=l.show;if(c){var u=n.getAxisComponent();u.getTicks().forEach(function(i){var n;null===(n=e.createFigure({name:"line",attrs:{coordinates:[{x:0,y:i.coord},{x:a.width,y:i.coord}]},styles:l}))||void 0===n||n.draw(t)})}var d=o.vertical,h=d.show;if(h){var p=r.getXAxisPane().getAxisComponent();p.getTicks().forEach(function(i){var n;null===(n=e.createFigure({name:"line",attrs:{coordinates:[{x:i.coord,y:0},{x:i.coord,y:a.height}]},styles:d}))||void 0===n||n.draw(t)})}t.restore()}},e}(Cn),kn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.eachChildren=function(t){var e=this.getWidget().getPane(),i=e.getChart().getChartStore(),n=i.getVisibleDataList(),r=i.getTimeScaleStore().getBarSpace();n.forEach(function(e,i){t(e,r,i)})},e}(Cn),An=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundCandleBarClickEvent=function(t){return function(){return e.getWidget().getPane().getChart().getChartStore().getActionStore().execute(Pt.OnCandleBarClick,t),!1}},e}return B(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget().getPane(),n=i.getId()===Bi.CANDLE,r=i.getChart().getChartStore(),a=this.getCandleBarOptions(r);if(null!==a){var o=i.getAxisComponent();this.eachChildren(function(i,r){var s=i.data,l=i.x;if(Mt(s)){var c=s.open,u=s.high,d=s.low,h=s.close,p=a.type,f=a.styles,v=[];h>c?(v[0]=f.upColor,v[1]=f.upBorderColor,v[2]=f.upWickColor):h<c?(v[0]=f.downColor,v[1]=f.downBorderColor,v[2]=f.downWickColor):(v[0]=f.noChangeColor,v[1]=f.noChangeBorderColor,v[2]=f.noChangeWickColor);var g=o.convertToPixel(c),m=o.convertToPixel(h),y=[g,m,o.convertToPixel(u),o.convertToPixel(d)];y.sort(function(t,e){return t-e});var b=[];switch(p){case V.CandleSolid:b=e._createSolidBar(l,y,r,v);break;case V.CandleStroke:b=e._createStrokeBar(l,y,r,v);break;case V.CandleUpStroke:b=h>c?e._createStrokeBar(l,y,r,v):e._createSolidBar(l,y,r,v);break;case V.CandleDownStroke:b=c>h?e._createStrokeBar(l,y,r,v):e._createSolidBar(l,y,r,v);break;case V.Ohlc:var x=Math.min(Math.max(Math.round(.2*r.gapBar),1),7);b=[{name:"rect",attrs:{x:l-x/2,y:y[0],width:x,height:y[3]-y[0]},styles:{color:v[0]}},{name:"rect",attrs:{x:l-r.halfGapBar,y:g+x>y[3]?y[3]-x:g,width:r.halfGapBar-x/2,height:x},styles:{color:v[0]}},{name:"rect",attrs:{x:l+x/2,y:m+x>y[3]?y[3]-x:m,width:r.halfGapBar-x/2,height:x},styles:{color:v[0]}}];break}b.forEach(function(r){var a,o;n&&(o={mouseClickEvent:e._boundCandleBarClickEvent(i)}),null===(a=e.createFigure(r,o))||void 0===a||a.draw(t)})}})}},e.prototype.getCandleBarOptions=function(t){var e=t.getStyles().candle;return{type:e.type,styles:e.bar}},e.prototype._createSolidBar=function(t,e,i,n){return[{name:"rect",attrs:{x:t-.5,y:e[0],width:1,height:e[3]-e[0]},styles:{color:n[2]}},{name:"rect",attrs:{x:t-i.halfGapBar+.5,y:e[1],width:i.gapBar-1,height:Math.max(1,e[2]-e[1])},styles:{style:O.StrokeFill,color:n[0],borderColor:n[1]}}]},e.prototype._createStrokeBar=function(t,e,i,n){return[{name:"rect",attrs:{x:t-.5,y:e[0],width:1,height:e[1]-e[0]},styles:{color:n[2]}},{name:"rect",attrs:{x:t-i.halfGapBar+.5,y:e[1],width:i.gapBar-1,height:Math.max(1,e[2]-e[1])},styles:{style:O.Stroke,borderColor:n[1]}},{name:"rect",attrs:{x:t-.5,y:e[2],width:1,height:e[3]-e[2]},styles:{color:n[2]}}]},e}(kn),Tn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.getCandleBarOptions=function(t){var e,i,n=this.getWidget().getPane(),r=n.getAxisComponent();if(!r.isInCandle()){var a=t.getIndicatorStore().getInstances(n.getId());try{for(var o=j(a),s=o.next();!s.done;s=o.next()){var l=s.value;if(l.shouldOhlc&&l.visible){var c=l.styles,u=t.getStyles().indicator,d=Ft(c,"ohlc.upColor",u.ohlc.upColor),h=Ft(c,"ohlc.downColor",u.ohlc.downColor),p=Ft(c,"ohlc.noChangeColor",u.ohlc.noChangeColor);return{type:V.Ohlc,styles:{upColor:d,downColor:h,noChangeColor:p,upBorderColor:d,downBorderColor:h,noChangeBorderColor:p,upWickColor:d,downWickColor:h,noChangeWickColor:p}}}}}catch(f){e={error:f}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}}return null},e.prototype.drawImp=function(e){var i=this;t.prototype.drawImp.call(this,e);var n=this.getWidget(),r=n.getPane(),a=r.getChart(),o=n.getBounding(),s=a.getXAxisPane().getAxisComponent(),l=r.getAxisComponent(),c=a.getChartStore(),u=c.getDataList(),d=c.getTimeScaleStore(),h=d.getVisibleRange(),p=c.getIndicatorStore().getInstances(r.getId()),f=c.getStyles().indicator;e.save(),p.forEach(function(t){var n;if(t.visible){t.zLevel<0?e.globalCompositeOperation="destination-over":e.globalCompositeOperation="source-over";var r=!1;if(null!==t.draw&&(e.save(),r=null!==(n=t.draw({ctx:e,kLineDataList:u,indicator:t,visibleRange:h,bounding:o,barSpace:d.getBarSpace(),defaultStyles:f,xAxis:s,yAxis:l}))&&void 0!==n&&n,e.restore()),!r){var a=t.result;i.eachChildren(function(n,r){var c,d,h,p=r.halfGapBar,v=r.gapBar,g=n.dataIndex,m=n.x,y=s.convertToPixel(g-1),b=s.convertToPixel(g+1),x=null!==(c=a[g-1])&&void 0!==c?c:{},_=null!==(d=a[g])&&void 0!==d?d:{},w=null!==(h=a[g+1])&&void 0!==h?h:{},C={x:y},S={x:m},k={x:b};t.figures.forEach(function(t){var e=t.key,i=x[e];Tt(i)&&(C[e]=l.convertToPixel(i));var n=_[e];Tt(n)&&(S[e]=l.convertToPixel(n));var r=w[e];Tt(r)&&(k[e]=l.convertToPixel(r))}),Xt(u,t,g,f,function(t,n){var a,c,u;if(Mt(_[t.key])){var d=S[t.key],h=null===(a=t.attrs)||void 0===a?void 0:a.call(t,{coordinate:{prev:C,current:S,next:k},bounding:o,barSpace:r,xAxis:s,yAxis:l});if(!Mt(h))switch(t.type){case"circle":h={x:m,y:d,r:p};break;case"rect":case"bar":var f=null!==(c=t.baseValue)&&void 0!==c?c:l.getRange().from,g=l.convertToPixel(f),y=Math.abs(g-d);f!==_[t.key]&&(y=Math.max(1,y));var b=void 0;b=d>g?g:d,h={x:m-p,y:b,width:v,height:y};break;case"line":Tt(S[t.key])&&Tt(k[t.key])&&(h={coordinates:[{x:S.x,y:S[t.key]},{x:k.x,y:k[t.key]}]});break}if(Mt(h)){var x=t.type;null===(u=i.createFigure({name:"bar"===x?"rect":x,attrs:h,styles:n}))||void 0===u||u.draw(e)}}})})}}}),e.restore()},e}(An),Mn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=e.getBounding(),r=e.getPane().getChart().getChartStore(),a=r.getTooltipStore().getCrosshair(),o=r.getStyles().crosshair;if(Et(a.paneId)&&o.show){if(a.paneId===i.getId()){var s=a.y;this._drawLine(t,[{x:0,y:s},{x:n.width,y:s}],o.horizontal)}var l=a.realX;this._drawLine(t,[{x:l,y:0},{x:l,y:n.height}],o.vertical)}},e.prototype._drawLine=function(t,e,i){var n;if(i.show){var r=i.line;r.show&&(null===(n=this.createFigure({name:"line",attrs:{coordinates:e},styles:r}))||void 0===n||n.draw(t))}},e}(Cn),In=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundIconClickEvent=function(t,i){return function(){var n=e.getWidget().getPane();return n.getChart().getChartStore().getActionStore().execute(Pt.OnTooltipIconClick,X(X({},t),{iconId:i})),!0}},e._boundIconMouseMoveEvent=function(t,i){return function(){var n=e.getWidget().getPane(),r=n.getChart().getChartStore().getTooltipStore();return r.setActiveIcon(X(X({},t),{iconId:i})),!0}},e}return B(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=i.getChart().getChartStore(),r=n.getTooltipStore().getCrosshair();if(Mt(r.kLineData)){var a=e.getBounding(),o=n.getCustomApi(),s=n.getThousandsSeparator(),l=n.getDecimalFoldThreshold(),c=n.getIndicatorStore().getInstances(i.getId()),u=n.getTooltipStore().getActiveIcon(),d=n.getStyles().indicator;this.drawIndicatorTooltip(t,i.getId(),n.getDataList(),r,u,c,o,s,l,a,d)}},e.prototype.drawIndicatorTooltip=function(t,e,i,n,r,a,o,s,l,c,u,d){var h=this,p=u.tooltip,f=0;if(this.isDrawTooltip(n,p)){var v=p.text,g=0,m=null!==d&&void 0!==d?d:0,y=0;a.forEach(function(a){var d=h.getIndicatorTooltipData(i,n,a,o,s,l,u),p=d.name,b=d.calcParamsText,x=d.values,_=d.icons,w=p.length>0,C=x.length>0;if(w||C){var S=q(h.classifyTooltipIcons(_),3),k=S[0],A=S[1],T=S[2],M=q(h.drawStandardTooltipIcons(t,c,{paneId:e,indicatorName:a.name,iconId:""},r,k,g,m,y),4),I=M[0],E=M[1],D=M[2],P=M[3];if(g=I,m=E,f+=P,y=D,w){var L=p;b.length>0&&(L="".concat(L).concat(b));var R=q(h.drawStandardTooltipLabels(t,c,[{title:{text:"",color:v.color},value:{text:L,color:v.color}}],g,m,y,v),4),F=R[0],B=R[1],N=R[2],O=R[3];g=F,m=B,f+=O,y=N}var z=q(h.drawStandardTooltipIcons(t,c,{paneId:e,indicatorName:a.name,iconId:""},r,A,g,m,y),4),W=z[0],$=z[1],H=z[2],V=z[3];if(g=W,m=$,f+=V,y=H,C){var K=q(h.drawStandardTooltipLabels(t,c,x,g,m,y,v),4),Y=K[0],X=K[1],U=K[2],G=K[3];g=Y,m=X,f+=G,y=U}var j=q(h.drawStandardTooltipIcons(t,c,{paneId:e,indicatorName:a.name,iconId:""},r,T,g,m,y),4),Z=j[1],J=j[2],Q=j[3];g=0,f+=Q,m=Z+J,y=0}})}return f},e.prototype.drawStandardTooltipIcons=function(t,e,i,n,r,a,o,s){var l=this,c=a,u=o,d=0,h=0,p=0;return r.length>0&&(r.forEach(function(e){var i=e.marginLeft,n=e.marginTop,r=e.marginRight,a=e.marginBottom,o=e.paddingLeft,s=e.paddingTop,l=e.paddingRight,c=e.paddingBottom,u=e.size,p=e.fontFamily,f=e.icon;t.font=Ht(u,"normal",p),d+=i+o+t.measureText(f).width+l+r,h=Math.max(h,n+s+u+c+a)}),c+d>e.width?(c=r[0].marginLeft,u+=s,p=h):p=Math.max(0,h-s),r.forEach(function(e){var r,a=e.marginLeft,o=e.marginTop,s=e.marginRight,d=e.paddingLeft,h=e.paddingTop,p=e.paddingRight,f=e.paddingBottom,v=e.color,g=e.activeColor,m=e.size,y=e.fontFamily,b=e.icon,x=e.backgroundColor,_=e.activeBackgroundColor;c+=a;var w=(null===n||void 0===n?void 0:n.paneId)===i.paneId&&(null===n||void 0===n?void 0:n.indicatorName)===i.indicatorName&&(null===n||void 0===n?void 0:n.iconId)===e.id;null===(r=l.createFigure({name:"text",attrs:{text:b,x:c,y:u+o},styles:{paddingLeft:d,paddingTop:h,paddingRight:p,paddingBottom:f,color:w?g:v,size:m,family:y,backgroundColor:w?_:x}},{mouseClickEvent:l._boundIconClickEvent(i,e.id),mouseMoveEvent:l._boundIconMouseMoveEvent(i,e.id)}))||void 0===r||r.draw(t),c+=d+t.measureText(b).width+p+s})),[c,u,Math.max(s,h),p]},e.prototype.drawStandardTooltipLabels=function(t,e,i,n,r,a,o){var s=this,l=n,c=r,u=0,d=0,h=a;if(i.length>0){var p=o.marginLeft,f=o.marginTop,v=o.marginRight,g=o.marginBottom,m=o.size,y=o.family,b=o.weight;t.font=Ht(m,b,y),i.forEach(function(i){var n,r,a=i.title,o=i.value,x=t.measureText(a.text).width,_=t.measureText(o.text).width,w=x+_,C=m+f+g;l+p+w+v>e.width?(l=p,c+=C,d+=C):(l+=p,d+=Math.max(0,C-h)),u=Math.max(h,C),h=u,a.text.length>0&&(null===(n=s.createFigure({name:"text",attrs:{x:l,y:c+f,text:a.text},styles:{color:a.color,size:m,family:y,weight:b}}))||void 0===n||n.draw(t),l+=x),null===(r=s.createFigure({name:"text",attrs:{x:l,y:c+f,text:o.text},styles:{color:o.color,size:m,family:y,weight:b}}))||void 0===r||r.draw(t),l+=_+v})}return[l,c,u,d]},e.prototype.isDrawTooltip=function(t,e){var i=e.showRule;return i===z.Always||i===z.FollowCross&&Et(t.paneId)},e.prototype.getIndicatorTooltipData=function(t,e,i,n,r,a,o){var s,l,c=o.tooltip,u=c.showName?i.shortName:"",d="",h=i.calcParams;h.length>0&&c.showParams&&(d="(".concat(h.join(","),")"));var p={name:u,calcParamsText:d,values:[],icons:c.icons},f=e.dataIndex,v=null!==(s=i.result)&&void 0!==s?s:[],g=[];if(i.visible){var m=null!==(l=v[f])&&void 0!==l?l:{};Xt(t,i,f,o,function(t,e){if(Et(t.title)){var o=e.color,s=m[t.key];Tt(s)&&(s=Nt(s,i.precision),i.shouldFormatBigNumber&&(s=n.formatBigNumber(s))),g.push({title:{text:t.title,color:o},value:{text:Wt(zt(null!==s&&void 0!==s?s:c.defaultValue,r),a),color:o}})}}),p.values=g}if(null!==i.createTooltipDataSource){var y=this.getWidget(),b=y.getPane(),x=b.getChart().getChartStore(),_=i.createTooltipDataSource({kLineDataList:t,indicator:i,visibleRange:x.getTimeScaleStore().getVisibleRange(),bounding:y.getBounding(),crosshair:e,defaultStyles:o,xAxis:b.getChart().getXAxisPane().getAxisComponent(),yAxis:b.getAxisComponent()}),w=_.name,C=_.calcParamsText,S=_.values,k=_.icons;if(Et(w)&&c.showName&&(p.name=w),Et(C)&&c.showParams&&(p.calcParamsText=C),Mt(k)&&(p.icons=k),Mt(S)&&i.visible){var A=[],T=o.tooltip.text.color;S.forEach(function(t){var e={text:"",color:T};At(t.title)?e=t.title:e.text=t.title;var i={text:"",color:T};At(t.value)?i=t.value:i.text=t.value,i.text=Wt(zt(i.text,r),a),A.push({title:e,value:i})}),p.values=A}}return p},e.prototype.classifyTooltipIcons=function(t){var e=[],i=[],n=[];return t.forEach(function(t){switch(t.position){case $.Left:e.push(t);break;case $.Middle:i.push(t);break;case $.Right:n.push(t);break}}),[e,i,n]},e}(Cn),En=function(t){function e(e){var i=t.call(this,e)||this;return i._initEvent(),i}return B(e,t),e.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),i=e.getId(),n=e.getChart().getChartStore().getOverlayStore();this.registerEvent("mouseMoveEvent",function(e){var r,a=n.getProgressInstanceInfo();if(null!==a){var o=a.instance,s=a.paneId;o.isStart()&&(n.updateProgressInstanceInfo(i),s=i);var l=o.points.length-1,c="".concat(te,"point_").concat(l);return o.isDrawing()&&s===i&&(o.eventMoveForDrawing(t._coordinateToPoint(a.instance,e)),null===(r=o.onDrawing)||void 0===r||r.call(o,X({overlay:o,figureKey:c,figureIndex:l},e))),t._figureMouseMoveEvent(o,1,c,l,0)(e)}return n.setHoverInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1}).registerEvent("mouseClickEvent",function(e){var r,a,o=n.getProgressInstanceInfo();if(null!==o){var s=o.instance,l=o.paneId;s.isStart()&&(n.updateProgressInstanceInfo(i,!0),l=i);var c=s.points.length-1,u="".concat(te,"point_").concat(c);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(r=s.onDrawing)||void 0===r||r.call(s,X({overlay:s,figureKey:u,figureIndex:c},e)),s.nextStep(),s.isDrawing()||(n.progressInstanceComplete(),null===(a=s.onDrawEnd)||void 0===a||a.call(s,X({overlay:s,figureKey:u,figureIndex:c},e)))),t._figureMouseClickEvent(s,1,u,c,0)(e)}return n.setClickInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1}).registerEvent("mouseDoubleClickEvent",function(e){var r,a=n.getProgressInstanceInfo();if(null!==a){var o=a.instance,s=a.paneId;if(o.isDrawing()&&s===i&&(o.forceComplete(),!o.isDrawing())){n.progressInstanceComplete();var l=o.points.length-1,c="".concat(te,"point_").concat(l);null===(r=o.onDrawEnd)||void 0===r||r.call(o,X({overlay:o,figureKey:c,figureIndex:l},e))}var u=o.points.length-1;return t._figureMouseClickEvent(o,1,"".concat(te,"point_").concat(u),u,0)(e)}return!1}).registerEvent("mouseRightClickEvent",function(e){var i=n.getProgressInstanceInfo();if(null!==i){var r=i.instance;if(r.isDrawing()){var a=r.points.length-1;return t._figureMouseRightClickEvent(r,1,"".concat(te,"point_").concat(a),a,0)(e)}}return!1}).registerEvent("mouseUpEvent",function(t){var e,r=n.getPressedInstanceInfo(),a=r.instance,o=r.figureIndex,s=r.figureKey;return null!==a&&(null===(e=a.onPressedMoveEnd)||void 0===e||e.call(a,X({overlay:a,figureKey:s,figureIndex:o},t))),n.setPressedInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1}).registerEvent("pressedMouseMoveEvent",function(e){var i,r,a=n.getPressedInstanceInfo(),o=a.instance,s=a.figureType,l=a.figureIndex,c=a.figureKey;if(null!==o){if(!o.lock&&(null===(r=null===(i=o.onPressedMoving)||void 0===i?void 0:i.call(o,X({overlay:o,figureIndex:l,figureKey:c},e)))||void 0===r||!r)){var u=t._coordinateToPoint(o,e);1===s?o.eventPressedPointMove(u,l):o.eventPressedOtherMove(u,t.getWidget().getPane().getChart().getChartStore().getTimeScaleStore())}return!0}return!1})},e.prototype._createFigureEvents=function(t,e,i,n,r,a){var o;if(!t.isDrawing()){var s=[];if(Mt(a)&&(It(a)?a&&(s=jt()):s=a),0===s.length)return{mouseMoveEvent:this._figureMouseMoveEvent(t,e,i,n,r),mouseDownEvent:this._figureMouseDownEvent(t,e,i,n,r),mouseClickEvent:this._figureMouseClickEvent(t,e,i,n,r),mouseRightClickEvent:this._figureMouseRightClickEvent(t,e,i,n,r),mouseDoubleClickEvent:this._figureMouseDoubleClickEvent(t,e,i,n,r)};o={},s.includes("mouseMoveEvent")||s.includes("touchMoveEvent")||(o.mouseMoveEvent=this._figureMouseMoveEvent(t,e,i,n,r)),s.includes("mouseDownEvent")||s.includes("touchStartEvent")||(o.mouseDownEvent=this._figureMouseDownEvent(t,e,i,n,r)),s.includes("mouseClickEvent")||s.includes("tapEvent")||(o.mouseClickEvent=this._figureMouseClickEvent(t,e,i,n,r)),s.includes("mouseDoubleClickEvent")||s.includes("doubleTapEvent")||(o.mouseDoubleClickEvent=this._figureMouseDoubleClickEvent(t,e,i,n,r)),s.includes("mouseRightClickEvent")||(o.mouseRightClickEvent=this._figureMouseRightClickEvent(t,e,i,n,r))}return o},e.prototype._figureMouseMoveEvent=function(t,e,i,n,r){var a=this;return function(o){var s=a.getWidget().getPane(),l=s.getChart().getChartStore().getOverlayStore();return l.setHoverInstanceInfo({paneId:s.getId(),instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:r},o),!0}},e.prototype._figureMouseDownEvent=function(t,e,i,n,r){var a=this;return function(o){var s,l=a.getWidget().getPane(),c=l.getId(),u=l.getChart().getChartStore().getOverlayStore();return t.startPressedMove(a._coordinateToPoint(t,o)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,X({overlay:t,figureIndex:n,figureKey:i},o)),u.setPressedInstanceInfo({paneId:c,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:r}),!0}},e.prototype._figureMouseClickEvent=function(t,e,i,n,r){var a=this;return function(o){var s=a.getWidget().getPane(),l=s.getId(),c=s.getChart().getChartStore().getOverlayStore();return c.setClickInstanceInfo({paneId:l,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:r},o),!0}},e.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,r){return function(e){var r;return null===(r=t.onDoubleClick)||void 0===r||r.call(t,X(X({},e),{figureIndex:n,figureKey:i,overlay:t})),!0}},e.prototype._figureMouseRightClickEvent=function(t,e,i,n,r){var a=this;return function(e){var r,o;if(null===(o=null===(r=t.onRightClick)||void 0===r?void 0:r.call(t,X({overlay:t,figureIndex:n,figureKey:i},e)))||void 0===o||!o){var s=a.getWidget().getPane(),l=s.getChart().getChartStore().getOverlayStore();l.removeInstance(t)}return!0}},e.prototype._coordinateToPoint=function(t,e){var i,n={},r=this.getWidget().getPane(),a=r.getChart(),o=r.getId(),s=a.getChartStore().getTimeScaleStore();if(this.coordinateToPointTimestampDataIndexFlag()){var l=a.getXAxisPane().getAxisComponent(),c=l.convertFromPixel(e.x),u=null!==(i=s.dataIndexToTimestamp(c))&&void 0!==i?i:void 0;n.dataIndex=c,n.timestamp=u}if(this.coordinateToPointValueFlag()){var d=r.getAxisComponent(),h=d.convertFromPixel(e.y);if(t.mode!==Ut.Normal&&o===Bi.CANDLE&&Tt(n.dataIndex)){var p=s.getDataByDataIndex(n.dataIndex);if(null!==p){var f=t.modeSensitivity;if(h>p.high)if(t.mode===Ut.WeakMagnet){var v=d.convertToPixel(p.high),g=d.convertFromPixel(v-f);h<g&&(h=p.high)}else h=p.high;else if(h<p.low)if(t.mode===Ut.WeakMagnet){var m=d.convertToPixel(p.low);g=d.convertFromPixel(m-f);h>g&&(h=p.low)}else h=p.low;else{var y=Math.max(p.open,p.close),b=Math.min(p.open,p.close);h=h>y?h-y<p.high-h?y:p.high:h<b?h-p.low<b-h?p.low:b:y-h<h-b?y:b}}}n.value=h}return n},e.prototype.coordinateToPointValueFlag=function(){return!0},e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},e.prototype.dispatchEvent=function(e,i,n){return this.getWidget().getPane().getChart().getChartStore().getOverlayStore().isDrawing()?this.onEvent(e,i,n):t.prototype.dispatchEvent.call(this,e,i,n)},e.prototype.checkEventOn=function(){return!0},e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=i.getPane(),r=n.getId(),a=n.getChart(),o=n.getAxisComponent(),s=a.getXAxisPane().getAxisComponent(),l=i.getBounding(),c=a.getChartStore(),u=c.getCustomApi(),d=c.getThousandsSeparator(),h=c.getDecimalFoldThreshold(),p=c.getTimeScaleStore(),f=p.getDateTimeFormat(),v=p.getBarSpace(),g=c.getPrecision(),m=c.getStyles().overlay,y=c.getOverlayStore(),b=y.getHoverInstanceInfo(),x=y.getClickInstanceInfo(),_=this.getCompleteOverlays(y,r);_.forEach(function(i){i.visible&&e._drawOverlay(t,i,l,v,g,f,u,d,h,m,s,o,b,x,p)});var w=y.getProgressInstanceInfo();if(null!==w){var C=this.getProgressOverlay(w,r);null!==C&&C.visible&&this._drawOverlay(t,C,l,v,g,f,u,d,h,m,s,o,b,x,p)}},e.prototype._drawOverlay=function(t,e,i,n,r,a,o,s,l,c,u,d,h,p,f){var v=e.points,g=v.map(function(t){var e,i,n=t.dataIndex;Tt(t.timestamp)&&(n=f.timestampToDataIndex(t.timestamp));var r={x:0,y:0};return Tt(n)&&(r.x=null!==(e=null===u||void 0===u?void 0:u.convertToPixel(n))&&void 0!==e?e:0),Tt(t.value)&&(r.y=null!==(i=null===d||void 0===d?void 0:d.convertToPixel(t.value))&&void 0!==i?i:0),r});if(g.length>0){var m=(new Array).concat(this.getFigures(e,g,i,n,r,s,l,a,c,u,d));this.drawFigures(t,e,m,c)}this.drawDefaultFigures(t,e,g,i,r,a,o,s,l,c,u,d,h,p)},e.prototype.drawFigures=function(t,e,i,n){var r=this;i.forEach(function(i,a){var o=i.type,s=i.styles,l=i.attrs,c=i.ignoreEvent,u=[].concat(l);u.forEach(function(l,u){var d,h,p,f=r._createFigureEvents(e,2,null!==(d=i.key)&&void 0!==d?d:"",a,u,c),v=X(X(X({},n[o]),null===(h=e.styles)||void 0===h?void 0:h[o]),s);null===(p=r.createFigure({name:o,attrs:l,styles:v},f))||void 0===p||p.draw(t)})})},e.prototype.getCompleteOverlays=function(t,e){return t.getInstances(e)},e.prototype.getProgressOverlay=function(t,e){return t.paneId===e?t.instance:null},e.prototype.getFigures=function(t,e,i,n,r,a,o,s,l,c,u){var d,h;return null!==(h=null===(d=t.createPointFigures)||void 0===d?void 0:d.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:r,thousandsSeparator:a,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e.prototype.drawDefaultFigures=function(t,e,i,n,r,a,o,s,l,c,u,d,h,p){var f,v,g=this;if(e.needDefaultPointFigure&&((null===(f=h.instance)||void 0===f?void 0:f.id)===e.id&&0!==h.figureType||(null===(v=p.instance)||void 0===v?void 0:v.id)===e.id&&0!==p.figureType)){var m=e.styles,y=X(X({},c.point),null===m||void 0===m?void 0:m.point);i.forEach(function(i,n){var r,a,o,s=i.x,l=i.y,c=y.radius,u=y.color,d=y.borderColor,p=y.borderSize;(null===(r=h.instance)||void 0===r?void 0:r.id)===e.id&&1===h.figureType&&h.figureIndex===n&&(c=y.activeRadius,u=y.activeColor,d=y.activeBorderColor,p=y.activeBorderSize),null===(a=g.createFigure({name:"circle",attrs:{x:s,y:l,r:c+p},styles:{color:d}},g._createFigureEvents(e,1,"".concat(te,"point_").concat(n),n,0)))||void 0===a||a.draw(t),null===(o=g.createFigure({name:"circle",attrs:{x:s,y:l,r:c},styles:{color:u}}))||void 0===o||o.draw(t)})}},e}(Cn),Dn=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new Sn(n),n._indicatorView=new Tn(n),n._crosshairLineView=new Mn(n),n._tooltipView=n.createTooltipView(),n._overlayView=new En(n),n.addChild(n._tooltipView),n.addChild(n._overlayView),n.getContainer().style.cursor="crosshair",n.registerEvent("mouseMoveEvent",function(){return i.getChart().getChartStore().getTooltipStore().setActiveIcon(),!1}),n}return B(e,t),e.prototype.getName=function(){return Ki.MAIN},e.prototype.updateMain=function(t){this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t)},e.prototype.createTooltipView=function(){return new In(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){this._overlayView.draw(t),this._crosshairLineView.draw(t),this._tooltipView.draw(t)},e}(Qi),Pn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),r=n.getPane(),a=r.getChart(),o=n.getBounding(),s=r.getAxisComponent(),l=a.getStyles().candle.area,c=[],u=[],d=Number.MAX_SAFE_INTEGER;this.eachChildren(function(t,e,i){var n=t.data,r=t.x,a=e.halfGapBar,h=null===n||void 0===n?void 0:n[l.value];if(Tt(h)){var p=s.convertToPixel(h);if(0===i){var f=r-a;u.push({x:f,y:o.height}),u.push({x:f,y:p}),c.push({x:f,y:p})}c.push({x:r,y:p}),u.push({x:r,y:p}),d=Math.min(d,p)}});var h=u.length;if(h>0){var p=u[h-1],f=p.x;c.push({x:f,y:p.y}),u.push({x:f,y:p.y}),u.push({x:f,y:o.height})}if(c.length>0&&(null===(e=this.createFigure({name:"line",attrs:{coordinates:c},styles:{color:l.lineColor,size:l.lineSize}}))||void 0===e||e.draw(t)),u.length>0){var v=l.backgroundColor,g=void 0;if(St(v)){var m=t.createLinearGradient(0,o.height,0,d);try{v.forEach(function(t){var e=t.offset,i=t.color;m.addColorStop(e,i)})}catch(y){}g=m}else g=v;null===(i=this.createFigure({name:"polygon",attrs:{coordinates:u},styles:{color:g}}))||void 0===i||i.draw(t)}},e}(kn),Ln=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=i.getChart().getChartStore(),r=n.getStyles().candle.priceMark,a=r.high,o=r.low;if(r.show&&(a.show||o.show)){var s=n.getThousandsSeparator(),l=n.getDecimalFoldThreshold(),c=n.getPrecision(),u=i.getAxisComponent(),d=Number.MIN_SAFE_INTEGER,h=0,p=Number.MAX_SAFE_INTEGER,f=0;this.eachChildren(function(t){var e=t.data,i=t.x;Mt(e)&&(d<e.high&&(d=e.high,h=i),p>e.low&&(p=e.low,f=i))});var v=u.convertToPixel(d),g=u.convertToPixel(p);a.show&&d!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,Wt(zt(Nt(d,c.price),s),l),{x:h,y:v},v<g?[-2,-5]:[2,5],a),o.show&&p!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,Wt(zt(Nt(p,c.price),s),l),{x:f,y:g},v<g?[2,5]:[-2,-5],o)}},e.prototype._drawMark=function(t,e,i,n,r){var a,o,s,l,c,u,d=i.x,h=i.y+n[0];null===(a=this.createFigure({name:"line",attrs:{coordinates:[{x:d-2,y:h+n[0]},{x:d,y:h},{x:d+2,y:h+n[0]}]},styles:{color:r.color}}))||void 0===a||a.draw(t);var p=this.getWidget().getBounding().width;d>p/2?(l=d-5,c=l-r.textOffset,u="right"):(l=d+5,u="left",c=l+r.textOffset);var f=h+n[1];null===(o=this.createFigure({name:"line",attrs:{coordinates:[{x:d,y:h},{x:d,y:f},{x:l,y:f}]},styles:{color:r.color}}))||void 0===o||o.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:c,y:f,text:e,align:u,baseline:"middle"},styles:{color:r.color,size:r.textSize,family:r.textFamily,weight:r.textWeight}}))||void 0===s||s.draw(t)},e}(kn),Rn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=n.getChart().getChartStore(),o=a.getStyles().candle.priceMark,s=o.last,l=s.line;if(o.show&&s.show&&l.show){var c=n.getAxisComponent(),u=a.getDataList(),d=u[u.length-1];if(null!=d){var h=d.close,p=d.open,f=c.convertToNicePixel(h),v=void 0;v=h>p?s.upColor:h<p?s.downColor:s.noChangeColor,null===(e=this.createFigure({name:"line",attrs:{coordinates:[{x:0,y:f},{x:r.width,y:f}]},styles:{style:l.style,color:v,size:l.size,dashedValue:l.dashedValue}}))||void 0===e||e.draw(t)}}},e}(Cn),Fn={time:"时间:",open:"开:",high:"高:",low:"低:",close:"收:",volume:"成交量:",turnover:"成交额:",change:"涨幅:"},Bn={time:"Time: ",open:"Open: ",high:"High: ",low:"Low: ",close:"Close: ",volume:"Volume: ",turnover:"Turnover: ",change:"Change: "},Nn={"zh-CN":Fn,"en-US":Bn};function On(t,e){var i,n;return null!==(n=null===(i=Nn[e])||void 0===i?void 0:i[t])&&void 0!==n?n:t}var zn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=i.getId(),r=i.getChart().getChartStore(),a=r.getTooltipStore().getCrosshair();if(Mt(a.kLineData)){var o=e.getBounding(),s=i.getYAxisWidget().getBounding(),l=r.getDataList(),c=r.getPrecision(),u=r.getLocale(),d=r.getCustomApi(),h=r.getThousandsSeparator(),p=r.getDecimalFoldThreshold(),f=r.getTooltipStore().getActiveIcon(),v=r.getIndicatorStore().getInstances(i.getId()),g=r.getTimeScaleStore().getDateTimeFormat(),m=r.getStyles(),y=m.candle,b=m.indicator;if(y.tooltip.showType===W.Rect&&b.tooltip.showType===W.Rect){var x=this.isDrawTooltip(a,y.tooltip),_=this.isDrawTooltip(a,b.tooltip);this._drawRectTooltip(t,l,v,o,s,a,c,g,u,d,h,p,x,_,m,0)}else if(y.tooltip.showType===W.Standard&&b.tooltip.showType===W.Standard){var w=this._drawCandleStandardTooltip(t,l,n,o,a,f,c,g,u,d,h,p,y);this.drawIndicatorTooltip(t,n,l,a,f,v,d,h,p,o,b,w)}else if(y.tooltip.showType===W.Rect&&b.tooltip.showType===W.Standard){var C=this.drawIndicatorTooltip(t,n,l,a,f,v,d,h,p,o,b,0);x=this.isDrawTooltip(a,y.tooltip);this._drawRectTooltip(t,l,v,o,s,a,c,g,u,d,h,p,x,!1,m,C)}else{var S=this._drawCandleStandardTooltip(t,l,n,o,a,f,c,g,u,d,h,p,y);_=this.isDrawTooltip(a,b.tooltip);this._drawRectTooltip(t,l,v,o,s,a,c,g,u,d,h,p,!1,_,m,S)}}},e.prototype._drawCandleStandardTooltip=function(t,e,i,n,r,a,o,s,l,c,u,d,h){var p,f,v,g=h.tooltip,m=g.text,y=0;if(this.isDrawTooltip(r,g)){var b=null!==(p=r.dataIndex)&&void 0!==p?p:0,x=this._getCandleTooltipData({prev:null!==(f=e[b-1])&&void 0!==f?f:null,current:r.kLineData,next:null!==(v=e[b+1])&&void 0!==v?v:null},o,s,l,c,u,d,h),_=0,w=0,C=0,S=q(this.classifyTooltipIcons(g.icons),3),k=S[0],A=S[1],T=S[2],M=q(this.drawStandardTooltipIcons(t,n,{paneId:i,indicatorName:"",iconId:""},a,k,_,w,0),4),I=M[0],E=M[1],D=M[2],P=M[3];_=I,w=E,y+=P,C=D;var L=q(this.drawStandardTooltipIcons(t,n,{paneId:i,indicatorName:"",iconId:""},a,A,_,w,C),4),R=L[0],F=L[1],B=L[2],N=L[3];if(_=R,w=F,y+=N,C=B,x.length>0){var O=q(this.drawStandardTooltipLabels(t,n,x,_,w,C,m),4),z=O[0],W=O[1],$=O[2],H=O[3];_=z,w=W,y+=H,C=$}var V=q(this.drawStandardTooltipIcons(t,n,{paneId:i,indicatorName:"",iconId:""},a,T,_,w,C),4),K=V[0],Y=V[1],X=V[2],U=V[3];_=K,w=Y,y+=U,C=X}return y},e.prototype._drawRectTooltip=function(t,e,i,n,r,a,o,s,l,c,u,d,h,p,f,v){var g,m,y,b,x,_=this,w=f.candle,C=f.indicator,S=w.tooltip,k=C.tooltip;if(h||p){var A=null!==(g=a.dataIndex)&&void 0!==g?g:0,T=this._getCandleTooltipData({prev:null!==(m=e[A-1])&&void 0!==m?m:null,current:a.kLineData,next:null!==(y=e[A+1])&&void 0!==y?y:null},o,s,l,c,u,d,w),M=S.text,I=M.marginLeft,E=M.marginRight,D=M.marginTop,P=M.marginBottom,L=M.size,R=M.weight,F=M.family,B=S.rect,N=B.position,z=B.paddingLeft,W=B.paddingRight,$=B.paddingTop,V=B.paddingBottom,Y=B.offsetLeft,X=B.offsetRight,U=B.offsetTop,G=B.offsetBottom,j=B.borderSize,q=B.borderRadius,Z=B.borderColor,J=B.color,Q=0,tt=0,et=0;h&&(t.font=Ht(L,R,F),T.forEach(function(e){var i=e.title,n=e.value,r="".concat(i.text).concat(n.text),a=t.measureText(r).width+I+E;Q=Math.max(Q,a)}),et+=(P+D+L)*T.length);var it=k.text,nt=it.marginLeft,rt=it.marginRight,at=it.marginTop,ot=it.marginBottom,st=it.size,lt=it.weight,ct=it.family,ut=[];if(p&&(t.font=Ht(st,lt,ct),i.forEach(function(i){var n,r=null!==(n=_.getIndicatorTooltipData(e,a,i,c,u,d,C).values)&&void 0!==n?n:[];ut.push(r),r.forEach(function(e){var i=e.title,n=e.value,r="".concat(i.text).concat(n.text),a=t.measureText(r).width+nt+rt;Q=Math.max(Q,a),et+=at+ot+st})})),tt+=Q,0!==tt&&0!==et){tt+=2*j+z+W,et+=2*j+$+V;var dt=n.width/2,ht=N===H.Pointer&&a.paneId===Bi.CANDLE,pt=(null!==(b=a.realX)&&void 0!==b?b:0)>dt,ft=0;if(ht){var vt=a.realX;ft=pt?vt-X-tt:vt+Y}else pt?(ft=Y,f.yAxis.inside&&f.yAxis.position===K.Left&&(ft+=r.width)):(ft=n.width-X-tt,f.yAxis.inside&&f.yAxis.position===K.Right&&(ft-=r.width));var gt=v+U;if(ht){var mt=a.y;gt=mt-et/2,gt+et>n.height-G&&(gt=n.height-G-et),gt<v+U&&(gt=v+U)}null===(x=this.createFigure({name:"rect",attrs:{x:ft,y:gt,width:tt,height:et},styles:{style:O.StrokeFill,color:J,borderColor:Z,borderSize:j,borderRadius:q}}))||void 0===x||x.draw(t);var yt=ft+j+z+I,bt=gt+j+$;if(h&&T.forEach(function(e){var i,n;bt+=D;var r=e.title;null===(i=_.createFigure({name:"text",attrs:{x:yt,y:bt,text:r.text},styles:{color:r.color,size:L,family:F,weight:R}}))||void 0===i||i.draw(t);var a=e.value;null===(n=_.createFigure({name:"text",attrs:{x:ft+tt-j-E-W,y:bt,text:a.text,align:"right"},styles:{color:a.color,size:L,family:F,weight:R}}))||void 0===n||n.draw(t),bt+=L+P}),p){var xt=ft+j+z+nt;ut.forEach(function(e){e.forEach(function(e){var i,n;bt+=at;var r=e.title,a=e.value;null===(i=_.createFigure({name:"text",attrs:{x:xt,y:bt,text:r.text},styles:{color:r.color,size:st,family:ct,weight:lt}}))||void 0===i||i.draw(t),null===(n=_.createFigure({name:"text",attrs:{x:ft+tt-j-rt-W,y:bt,text:a.text,align:"right"},styles:{color:a.color,size:st,family:ct,weight:lt}}))||void 0===n||n.draw(t),bt+=st+ot})})}}}},e.prototype._getCandleTooltipData=function(t,e,i,n,r,a,o,s){var l,c,u,d,h,p,f=s.tooltip,v=f.text.color,g=t.current,m=null!==(c=null===(l=t.prev)||void 0===l?void 0:l.close)&&void 0!==c?c:g.close,y=g.close-m,b=e.price,x=e.volume,_={"{time}":r.formatDate(i,g.timestamp,"YYYY-MM-DD HH:mm",qt.Tooltip),"{open}":Wt(zt(Nt(g.open,b),a),o),"{high}":Wt(zt(Nt(g.high,b),a),o),"{low}":Wt(zt(Nt(g.low,b),a),o),"{close}":Wt(zt(Nt(g.close,b),a),o),"{volume}":Wt(zt(r.formatBigNumber(Nt(null!==(u=g.volume)&&void 0!==u?u:f.defaultValue,x)),a),o),"{turnover}":Wt(zt(Nt(null!==(d=g.turnover)&&void 0!==d?d:f.defaultValue,b),a),o),"{change}":0===m?f.defaultValue:"".concat(zt(Nt(y/m*100),a),"%")},w=null!==(p=kt(f.custom)?null===(h=f.custom)||void 0===h?void 0:h.call(f,t,s):f.custom)&&void 0!==p?p:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}];return w.map(function(t){var e,i=t.title,r=t.value,a={text:"",color:""};At(i)?a=X({},i):(a.text=i,a.color=v),a.text=On(a.text,n);var o={text:f.defaultValue,color:""};At(r)?o=X({},r):(o.text=r,o.color=v);var l=o.text.match(/{(\S*)}/);if(null!==l&&l.length>1){var c="{".concat(l[1],"}");o.text=o.text.replace(c,null!==(e=_[c])&&void 0!==e?e:f.defaultValue),"{change}"===c&&(o.color=0===y?s.priceMark.last.noChangeColor:y>0?s.priceMark.last.upColor:s.priceMark.last.downColor)}return{title:a,value:o}})},e}(In),Wn=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._candleBarView=new An(n),n._candleAreaView=new Pn(n),n._candleHighLowPriceView=new Ln(n),n._candleLastPriceLineView=new Rn(n),n.addChild(n._candleBarView),n}return B(e,t),e.prototype.updateMainContent=function(t){var e=this.getPane().getChart().getStyles().candle;e.type!==V.Area?(this._candleBarView.draw(t),this._candleHighLowPriceView.draw(t)):this._candleAreaView.draw(t),this._candleLastPriceLineView.draw(t)},e.prototype.createTooltipView=function(){return new zn(this)},e}(Dn),$n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this,n=this.getWidget(),r=n.getPane(),a=n.getBounding(),o=r.getAxisComponent(),s=this.getAxisStyles(r.getChart().getStyles());if(s.show){s.axisLine.show&&(null===(e=this.createFigure({name:"line",attrs:this.createAxisLine(a,s),styles:s.axisLine}))||void 0===e||e.draw(t));var l=o.getTicks();if(s.tickLine.show){var c=this.createTickLines(l,a,s);c.forEach(function(e){var n;null===(n=i.createFigure({name:"line",attrs:e,styles:s.tickLine}))||void 0===n||n.draw(t)})}if(s.tickText.show){var u=this.createTickTexts(l,a,s);u.forEach(function(e){var n;null===(n=i.createFigure({name:"text",attrs:e,styles:s.tickText}))||void 0===n||n.draw(t)})}}},e}(Cn),Hn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var i,n=this.getWidget().getPane().getAxisComponent(),r=e.axisLine.size;return i=n.isFromZero()?r/2:t.width-r,{coordinates:[{x:i,y:0},{x:i,y:t.height}]}},e.prototype.createTickLines=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),r=i.axisLine,a=i.tickLine,o=0,s=0;return n.isFromZero()?(o=0,r.show&&(o+=r.size),s=o+a.length):(o=e.width,r.show&&(o-=r.size),s=o-a.length),t.map(function(t){return{coordinates:[{x:o,y:t.coord},{x:s,y:t.coord}]}})},e.prototype.createTickTexts=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),r=i.axisLine,a=i.tickLine,o=i.tickText,s=0;n.isFromZero()?(s=o.marginStart,r.show&&(s+=r.size),a.show&&(s+=a.length)):(s=e.width-o.marginEnd,r.show&&(s-=r.size),a.show&&(s-=a.length));var l=this.getWidget().getPane().getAxisComponent().isFromZero()?"left":"right";return t.map(function(t){return{x:s,y:t.coord,text:t.text,align:l,baseline:"middle"}})},e}($n),Vn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=n.getChart().getChartStore(),o=a.getStyles().candle.priceMark,s=o.last,l=s.text;if(o.show&&s.show&&l.show){var c=a.getPrecision(),u=n.getAxisComponent(),d=a.getDataList(),h=a.getVisibleDataList(),p=d[d.length-1];if(Mt(p)){var f=p.close,v=p.open,g=u.convertToNicePixel(f),m=void 0;m=f>v?s.upColor:f<v?s.downColor:s.noChangeColor;var y=void 0;if(u.getType()===Y.Percentage){var b=h[0].data,x=b.close;y="".concat(((f-x)/x*100).toFixed(2),"%")}else y=Nt(f,c.price);y=Wt(zt(y,a.getThousandsSeparator()),a.getDecimalFoldThreshold());var _=void 0,w=void 0;u.isFromZero()?(_=0,w="left"):(_=r.width,w="right"),null===(e=this.createFigure({name:"text",attrs:{x:_,y:g,text:y,align:w,baseline:"middle"},styles:X(X({},l),{backgroundColor:m})}))||void 0===e||e.draw(t)}}},e}(Cn),Kn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=n.getChart().getChartStore(),o=a.getCustomApi(),s=a.getStyles().indicator,l=s.lastValueMark,c=l.text;if(l.show){var u=n.getAxisComponent(),d=a.getDataList(),h=d.length-1,p=a.getIndicatorStore().getInstances(n.getId()),f=a.getThousandsSeparator(),v=a.getDecimalFoldThreshold();p.forEach(function(i){var n=i.result,a=n[h];if(Mt(a)&&i.visible){var l=i.precision;Xt(d,i,h,s,function(n,s){var d,h=a[n.key];if(Tt(h)){var p=u.convertToNicePixel(h),g=Nt(h,l);i.shouldFormatBigNumber&&(g=o.formatBigNumber(g)),g=Wt(zt(g,f),v);var m=void 0,y=void 0;u.isFromZero()?(m=0,y="left"):(m=r.width,y="right"),null===(d=e.createFigure({name:"text",attrs:{x:m,y:p,text:g,align:y,baseline:"middle"},styles:X(X({},c),{backgroundColor:s.color})}))||void 0===d||d.draw(t)}})}})}},e}(Cn),Yn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,i,n,r,a,o,s,l,c,u,d,h,p){this.drawFigures(t,e,this.getDefaultFigures(e,i,n,r,a,o,s,l,u,d,p),c)},e.prototype.getDefaultFigures=function(t,e,i,n,r,a,o,s,l,c,u){var d,h,p=[];if(t.needDefaultYAxisFigure&&t.id===(null===(d=u.instance)||void 0===d?void 0:d.id)&&u.paneId===this.getWidget().getPane().getId()){var f,v,g=Number.MAX_SAFE_INTEGER,m=Number.MIN_SAFE_INTEGER,y=null!==(h=null===c||void 0===c?void 0:c.isFromZero())&&void 0!==h&&h;y?(f="left",v=0):(f="right",v=i.width),e.forEach(function(e,i){var r=t.points[i];if(Tt(r.value)){g=Math.min(g,e.y),m=Math.max(m,e.y);var a=Wt(zt(Nt(r.value,n.price),o),s);p.push({type:"text",attrs:{x:v,y:e.y,text:a,align:f,baseline:"middle"},ignoreEvent:!0})}}),e.length>1&&p.unshift({type:"rect",attrs:{x:0,y:g,width:i.width,height:m-g},ignoreEvent:!0})}return p},e.prototype.getFigures=function(t,e,i,n,r,a,o,s,l,c,u){var d,h;return null!==(h=null===(d=t.createYAxisFigures)||void 0===d?void 0:d.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:r,thousandsSeparator:a,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e}(En),Xn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=i.getPane().getChart().getChartStore(),o=a.getTooltipStore().getCrosshair(),s=a.getStyles().crosshair;if(Et(o.paneId)&&this.compare(o,n.getId())&&s.show){var l=this.getDirectionStyles(s),c=l.text;if(l.show&&c.show){var u=n.getAxisComponent(),d=this.getText(o,a,u);t.font=Ht(c.size,c.weight,c.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(d,t.measureText(d).width,o,r,u,c),styles:c}))||void 0===e||e.draw(t)}}},e.prototype.compare=function(t,e){return t.paneId===e},e.prototype.getDirectionStyles=function(t){return t.horizontal},e.prototype.getText=function(t,e,i){var n,r,a=i,o=i.convertFromPixel(t.y);if(a.getType()===Y.Percentage){var s=e.getVisibleDataList(),l=null===(n=s[0])||void 0===n?void 0:n.data;r="".concat(((o-l.close)/l.close*100).toFixed(2),"%")}else{var c=e.getIndicatorStore().getInstances(t.paneId),u=0,d=!1;a.isInCandle()?u=e.getPrecision().price:c.forEach(function(t){u=Math.max(t.precision,u),d||(d=t.shouldFormatBigNumber)}),r=Nt(o,u),d&&(r=e.getCustomApi().formatBigNumber(r))}return Wt(zt(r,e.getThousandsSeparator()),e.getDecimalFoldThreshold())},e.prototype.getTextAttrs=function(t,e,i,n,r,a){var o,s,l=r;return l.isFromZero()?(o=0,s="left"):(o=n.width,s="right"),{x:o,y:i.y,text:t,align:s,baseline:"middle"}},e}(Cn),Un=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new Hn(n),n._candleLastPriceLabelView=new Vn(n),n._indicatorLastValueView=new Kn(n),n._overlayYAxisView=new Yn(n),n._crosshairHorizontalLabelView=new Xn(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return B(e,t),e.prototype.getName=function(){return Ki.Y_AXIS},e.prototype.updateMain=function(t){this._yAxisView.draw(t),this.getPane().getAxisComponent().isInCandle()&&this._candleLastPriceLabelView.draw(t),this._indicatorLastValueView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayYAxisView.draw(t),this._crosshairHorizontalLabelView.draw(t)},e}(Qi),Gn=function(){function t(t){this._range={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0},this._prevRange={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0},this._ticks=[],this._autoCalcTickFlag=!0,this._parent=t}return t.prototype.getParent=function(){return this._parent},t.prototype.buildTicks=function(t){if(this._autoCalcTickFlag&&(this._range=this.calcRange()),this._prevRange.from!==this._range.from||this._prevRange.to!==this._range.to||t){this._prevRange=this._range;var e=this.optimalTicks(this._calcTicks());return this._ticks=this.createTicks({range:this._range,bounding:this.getSelfBounding(),defaultTicks:e}),!0}return!1},t.prototype.getTicks=function(){return this._ticks},t.prototype.getScrollZoomEnabled=function(){var t;return null===(t=this.getParent().getOptions().axisOptions.scrollZoomEnabled)||void 0===t||t},t.prototype.setRange=function(t){this._autoCalcTickFlag=!1,this._range=t},t.prototype.getRange=function(){return this._range},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t.prototype._calcTicks=function(){var t=this._range,e=t.realFrom,i=t.realTo,n=t.realRange,r=[];if(n>=0){var a=q(this._calcTickInterval(n),2),o=a[0],s=a[1],l=he(Math.ceil(e/o)*o,s),c=he(Math.floor(i/o)*o,s),u=0,d=l;if(0!==o)while(d<=c){var h=d.toFixed(s);r[u]={text:h,coord:0,value:h},++u,d+=o}}return r},t.prototype._calcTickInterval=function(t){var e=de(t/8),i=pe(e);return[e,i]},t}(),jn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.calcRange=function(){var t,e,i,n,r,a=this.getParent(),o=a.getChart(),s=o.getChartStore(),l=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER,u=[],d=!1,h=Number.MAX_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER,f=Number.MAX_SAFE_INTEGER,v=s.getIndicatorStore().getInstances(a.getId());v.forEach(function(t){var e,i,n;d||(d=null!==(e=t.shouldOhlc)&&void 0!==e&&e),f=Math.min(f,t.precision),Tt(t.minValue)&&(h=Math.min(h,t.minValue)),Tt(t.maxValue)&&(p=Math.max(p,t.maxValue)),u.push({figures:null!==(i=t.figures)&&void 0!==i?i:[],result:null!==(n=t.result)&&void 0!==n?n:[]})});var g=4,m=this.isInCandle();if(m){var y=s.getPrecision().price;g=f!==Number.MAX_SAFE_INTEGER?Math.min(f,y):y}else f!==Number.MAX_SAFE_INTEGER&&(g=f);var b=s.getVisibleDataList(),x=o.getStyles().candle,_=x.type===V.Area,w=x.area.value,C=m&&!_||!m&&d;b.forEach(function(t){var e=t.dataIndex,i=t.data;if(Mt(i)&&(C&&(l=Math.min(l,i.low),c=Math.max(c,i.high)),m&&_)){var n=i[w];Tt(n)&&(l=Math.min(l,n),c=Math.max(c,n))}u.forEach(function(t){var i,n=t.figures,r=t.result,a=null!==(i=r[e])&&void 0!==i?i:{};n.forEach(function(t){var e=a[t.key];Tt(e)&&(l=Math.min(l,e),c=Math.max(c,e))})})}),l!==Number.MAX_SAFE_INTEGER&&c!==Number.MIN_SAFE_INTEGER?(l=Math.min(h,l),c=Math.max(p,c)):(l=0,c=10);var S,k=this.getType();switch(k){case Y.Percentage:var A=null===(t=b[0])||void 0===t?void 0:t.data;Mt(A)&&Tt(A.close)&&(l=(l-A.close)/A.close*100,c=(c-A.close)/A.close*100),S=Math.pow(10,-2);break;case Y.Log:l=ve(l),c=ve(c),S=.05*ge(-g);break;default:S=ge(-g)}if(l===c||Math.abs(l-c)<S){var T=h===l,M=p===c;l=T?l:M?l-8*S:l-4*S,c=M?c:T?c+8*S:c+4*S}var I=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,E=a.getOptions().gap,D=null!==(n=null===E||void 0===E?void 0:E.top)&&void 0!==n?n:.2;D>=1&&(D/=I);var P=null!==(r=null===E||void 0===E?void 0:E.bottom)&&void 0!==r?r:.1;P>=1&&(P/=I);var L,R,F,B=Math.abs(c-l);return l-=B*P,c+=B*D,B=Math.abs(c-l),k===Y.Log?(L=ge(l),R=ge(c),F=Math.abs(R-L)):(L=l,R=c,F=B),{from:l,to:c,range:B,realFrom:L,realTo:R,realRange:F}},e.prototype._innerConvertToPixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,r=this.getRange(),a=r.from,o=r.range,s=(t-a)/o;return this.isReverse()?Math.round(s*n):Math.round((1-s)*n)},e.prototype.isInCandle=function(){return this.getParent().getId()===Bi.CANDLE},e.prototype.getType=function(){return this.isInCandle()?this.getParent().getChart().getStyles().yAxis.type:Y.Normal},e.prototype.getPosition=function(){return this.getParent().getChart().getStyles().yAxis.position},e.prototype.isReverse=function(){return!!this.isInCandle()&&this.getParent().getChart().getStyles().yAxis.reverse},e.prototype.isFromZero=function(){var t=this.getParent().getChart().getStyles().yAxis,e=t.inside;return t.position===K.Left&&e||t.position===K.Right&&!e},e.prototype.optimalTicks=function(t){var e,i,n=this,r=this.getParent(),a=null!==(i=null===(e=r.getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,o=r.getChart().getChartStore(),s=o.getCustomApi(),l=[],c=this.getType(),u=o.getIndicatorStore().getInstances(r.getId()),d=o.getThousandsSeparator(),h=o.getDecimalFoldThreshold(),p=0,f=!1;this.isInCandle()?p=o.getPrecision().price:u.forEach(function(t){p=Math.max(p,t.precision),f||(f=t.shouldFormatBigNumber)});var v,g=o.getStyles().xAxis.tickText.size;return t.forEach(function(t){var e,i=t.value,r=n._innerConvertToPixel(+i);switch(c){case Y.Percentage:e="".concat(Nt(i,2),"%");break;case Y.Log:r=n._innerConvertToPixel(ve(+i)),e=Nt(i,p);break;default:e=Nt(i,p),f&&(e=s.formatBigNumber(i));break}e=Wt(zt(e,d),h);var o=Tt(v);r>g&&r<a-g&&(o&&Math.abs(v-r)>2*g||!o)&&(l.push({text:e,coord:r,value:i}),v=r)}),l},e.prototype.getAutoSize=function(){var t=this.getParent(),e=t.getChart(),i=e.getStyles(),n=i.yAxis,r=n.size;if("auto"!==r)return r;var a=e.getChartStore(),o=a.getCustomApi(),s=0;if(n.show&&(n.axisLine.show&&(s+=n.axisLine.size),n.tickLine.show&&(s+=n.tickLine.length),n.tickText.show)){var l=0;this.getTicks().forEach(function(t){l=Math.max(l,Vt(t.text,n.tickText.size,n.tickText.weight,n.tickText.family))}),s+=n.tickText.marginStart+n.tickText.marginEnd+l}var c=i.crosshair,u=0;if(c.show&&c.horizontal.show&&c.horizontal.text.show){var d=a.getIndicatorStore().getInstances(t.getId()),h=0,p=!1;d.forEach(function(t){h=Math.max(t.precision,h),p||(p=t.shouldFormatBigNumber)});var f=2;if(this.getType()!==Y.Percentage)if(this.isInCandle()){var v=a.getPrecision().price,g=i.indicator.lastValueMark;f=g.show&&g.text.show?Math.max(h,v):v}else f=h;var m=Nt(this.getRange().to,f);p&&(m=o.formatBigNumber(m)),u+=c.horizontal.text.paddingLeft+c.horizontal.text.paddingRight+2*c.horizontal.text.borderSize+Vt(m,c.horizontal.text.size,c.horizontal.text.weight,c.horizontal.text.family)}return Math.max(s,u)},e.prototype.getSelfBounding=function(){return this.getParent().getYAxisWidget().getBounding()},e.prototype.convertFromPixel=function(t){var e,i,n,r=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,a=this.getRange(),o=a.from,s=a.range,l=this.isReverse()?t/r:1-t/r,c=l*s+o;switch(this.getType()){case Y.Percentage:var u=this.getParent().getChart().getChartStore(),d=u.getVisibleDataList(),h=null===(n=d[0])||void 0===n?void 0:n.data;return Mt(h)&&Tt(h.close)?h.close*c/100+h.close:0;case Y.Log:return ge(c);default:return c}},e.prototype.convertToRealValue=function(t){var e=t;return this.getType()===Y.Log&&(e=ge(t)),e},e.prototype.convertToPixel=function(t){var e,i=t;switch(this.getType()){case Y.Percentage:var n=this.getParent().getChart().getChartStore(),r=n.getVisibleDataList(),a=null===(e=r[0])||void 0===e?void 0:e.data;Mt(a)&&Tt(a.close)&&(i=(t-a.close)/a.close*100);break;case Y.Log:i=ve(t);break;default:i=t}return this._innerConvertToPixel(i)},e.prototype.convertToNicePixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,r=this.convertToPixel(t);return Math.round(Math.max(.05*n,Math.min(r,.98*n)))},e.extend=function(t){var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return B(i,e),i.prototype.createTicks=function(e){return t.createTicks(e)},i}(e);return i},e}(Gn),qn={name:"default",createTicks:function(t){var e=t.defaultTicks;return e}},Zn={default:jn.extend(qn)};function Jn(t){var e;return null!==(e=Zn[t])&&void 0!==e?e:Zn.default}var Qn=function(){function t(t,e,i,n){this._bounding=Zi(),this._chart=i,this._id=n,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=ce("div",{width:"100%",margin:"0",padding:"0",position:"relative",overflow:"hidden",boxSizing:"border-box"}),null!==e?t.insertBefore(this._container,e):t.appendChild(this._container)},t.prototype.getContainer=function(){return this._container},t.prototype.getId=function(){return this._id},t.prototype.getChart=function(){return this._chart},t.prototype.getBounding=function(){return this._bounding},t.prototype.update=function(t){this._bounding.height!==this._container.clientHeight&&(this._container.style.height="".concat(this._bounding.height,"px")),this.updateImp(null!==t&&void 0!==t?t:3,this._container,this._bounding)},t.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},t}(),tr=function(t){function e(e,i,n,r,a){var o=t.call(this,e,i,n,r)||this;o._yAxisWidget=null,o._options={minHeight:Ri,dragEnabled:!0,gap:{top:.2,bottom:.1},axisOptions:{name:"default",scrollZoomEnabled:!0}};var s=o.getContainer();return o._mainWidget=o.createMainWidget(s),o._yAxisWidget=o.createYAxisWidget(s),o.setOptions(a),o}return B(e,t),e.prototype.setOptions=function(t){var e,i,n,r,a,o=null===(e=t.axisOptions)||void 0===e?void 0:e.name;return(this._options.axisOptions.name!==o&&Et(o)||!Mt(this._axis))&&(this._axis=this.createAxisComponent(null!==o&&void 0!==o?o:"default")),wt(this._options,t),this.getId()===Bi.X_AXIS?(r=this.getMainWidget().getContainer(),a="ew-resize"):(r=this.getYAxisWidget().getContainer(),a="ns-resize"),null===(n=null===(i=t.axisOptions)||void 0===i?void 0:i.scrollZoomEnabled)||void 0===n||n?r.style.cursor=a:r.style.cursor="default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,i){var n,r;wt(this.getBounding(),t);var a={};return Mt(t.height)&&(a.height=t.height),Mt(t.top)&&(a.top=t.top),this._mainWidget.setBounding(a),null===(n=this._yAxisWidget)||void 0===n||n.setBounding(a),Mt(e)&&this._mainWidget.setBounding(e),Mt(i)&&(null===(r=this._yAxisWidget)||void 0===r||r.setBounding(i)),this},e.prototype.getMainWidget=function(){return this._mainWidget},e.prototype.getYAxisWidget=function(){return this._yAxisWidget},e.prototype.updateImp=function(t){var e;this._mainWidget.update(t),null===(e=this._yAxisWidget)||void 0===e||e.update(t)},e.prototype.destroy=function(){var e;t.prototype.destroy.call(this),this._mainWidget.destroy(),null===(e=this._yAxisWidget)||void 0===e||e.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,r=ce("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),o=$t(r);r.width=i*o,r.height=n*o,a.scale(o,o);var s=this._mainWidget.getBounding();if(a.drawImage(this._mainWidget.getImage(t),s.left,0,s.width,s.height),null!==this._yAxisWidget){var l=this._yAxisWidget.getBounding();a.drawImage(this._yAxisWidget.getImage(t),l.left,0,l.width,l.height)}return r},e.prototype.createYAxisWidget=function(t){return null},e}(Qn),er=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.createAxisComponent=function(t){var e=Jn(null!==t&&void 0!==t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new Dn(t,this)},e.prototype.createYAxisWidget=function(t){return new Un(t,this)},e}(tr),ir=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.createMainWidget=function(t){return new Wn(t,this)},e}(er),nr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.getAxisStyles=function(t){return t.xAxis},e.prototype.createAxisLine=function(t,e){var i=e.axisLine.size/2;return{coordinates:[{x:0,y:i},{x:t.width,y:i}]}},e.prototype.createTickLines=function(t,e,i){var n=i.tickLine,r=i.axisLine.size;return t.map(function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:r+n.length}]}})},e.prototype.createTickTexts=function(t,e,i){var n=i.tickText,r=i.axisLine.size,a=i.tickLine.length;return t.map(function(t){return{x:t.coord,y:r+a+n.marginStart,text:t.text,align:"center",baseline:"top"}})},e}($n),rr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},e.prototype.coordinateToPointValueFlag=function(){return!1},e.prototype.getCompleteOverlays=function(t){return t.getInstances()},e.prototype.getProgressOverlay=function(t){return t.instance},e.prototype.getDefaultFigures=function(t,e,i,n,r,a,o,s,l,c,u){var d,h=[];if(t.needDefaultXAxisFigure&&t.id===(null===(d=u.instance)||void 0===d?void 0:d.id)){var p=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;e.forEach(function(e,i){p=Math.min(p,e.x),f=Math.max(f,e.x);var n=t.points[i];if(Tt(n.timestamp)){var o=a.formatDate(r,n.timestamp,"YYYY-MM-DD HH:mm",qt.Crosshair);h.push({type:"text",attrs:{x:e.x,y:0,text:o,align:"center"},ignoreEvent:!0})}}),e.length>1&&h.unshift({type:"rect",attrs:{x:p,y:0,width:f-p,height:i.height},ignoreEvent:!0})}return h},e.prototype.getFigures=function(t,e,i,n,r,a,o,s,l,c,u){var d,h;return null!==(h=null===(d=t.createXAxisFigures)||void 0===d?void 0:d.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:r,thousandsSeparator:a,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e}(Yn),ar=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.compare=function(t){return Mt(t.kLineData)&&t.dataIndex===t.realDataIndex},e.prototype.getDirectionStyles=function(t){return t.vertical},e.prototype.getText=function(t,e){var i,n=null===(i=t.kLineData)||void 0===i?void 0:i.timestamp;return e.getCustomApi().formatDate(e.getTimeScaleStore().getDateTimeFormat(),n,"YYYY-MM-DD HH:mm",qt.Crosshair)},e.prototype.getTextAttrs=function(t,e,i,n,r,a){var o,s=i.realX,l="center";return s-e/2-a.paddingLeft<0?(o=0,l="left"):s+e/2+a.paddingRight>n.width?(o=n.width,l="right"):o=s,{x:o,y:0,text:t,align:l,baseline:"top"}},e}(Xn),or=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new nr(n),n._overlayXAxisView=new rr(n),n._crosshairVerticalLabelView=new ar(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return B(e,t),e.prototype.getName=function(){return Ki.X_AXIS},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(Qi),sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.calcRange=function(){var t=this.getParent().getChart().getChartStore(),e=t.getTimeScaleStore().getVisibleRange(),i=e.from,n=e.to,r=i,a=n-1,o=n-i;return{from:r,to:a,range:o,realFrom:r,realTo:a,realRange:o}},e.prototype.optimalTicks=function(t){var e,i,n=this.getParent().getChart(),r=n.getChartStore(),a=r.getCustomApi().formatDate,o=[],s=t.length,l=r.getDataList();if(s>0){var c=r.getTimeScaleStore().getDateTimeFormat(),u=n.getStyles().xAxis.tickText,d=Vt("00-00 00:00",u.size,u.weight,u.family),h=parseInt(t[0].value,10),p=this.convertToPixel(h),f=1;if(s>1){var v=parseInt(t[1].value,10),g=this.convertToPixel(v),m=Math.abs(g-p);m<d&&(f=Math.ceil(d/m))}for(var y=0;y<s;y+=f){var b=parseInt(t[y].value,10),x=l[b],_=x.timestamp,w=a(c,_,"HH:mm",qt.XAxis);if(0!==y){var C=parseInt(t[y-f].value,10),S=l[C],k=S.timestamp;w=null!==(e=this._optimalTickLabel(a,c,_,k))&&void 0!==e?e:w}var A=this.convertToPixel(b);o.push({text:w,coord:A,value:_})}var T=o.length;if(1===T)o[0].text=a(c,o[0].value,"YYYY-MM-DD HH:mm",qt.XAxis);else{var M=o[0].value,I=o[1].value;if(Mt(o[2])){var E=o[2].text;/^[0-9]{2}-[0-9]{2}$/.test(E)?o[0].text=a(c,M,"MM-DD",qt.XAxis):/^[0-9]{4}-[0-9]{2}$/.test(E)?o[0].text=a(c,M,"YYYY-MM",qt.XAxis):/^[0-9]{4}$/.test(E)&&(o[0].text=a(c,M,"YYYY",qt.XAxis))}else o[0].text=null!==(i=this._optimalTickLabel(a,c,M,I))&&void 0!==i?i:o[0].text}}return o},e.prototype._optimalTickLabel=function(t,e,i,n){var r=t(e,i,"YYYY",qt.XAxis),a=t(e,i,"YYYY-MM",qt.XAxis),o=t(e,i,"MM-DD",qt.XAxis);return r!==t(e,n,"YYYY",qt.XAxis)?r:a!==t(e,n,"YYYY-MM",qt.XAxis)?a:o!==t(e,n,"MM-DD",qt.XAxis)?o:null},e.prototype.getAutoSize=function(){var t=this.getParent().getChart().getStyles(),e=t.xAxis,i=e.size;if("auto"!==i)return i;var n=t.crosshair,r=0;e.show&&(e.axisLine.show&&(r+=e.axisLine.size),e.tickLine.show&&(r+=e.tickLine.length),e.tickText.show&&(r+=e.tickText.marginStart+e.tickText.marginEnd+e.tickText.size));var a=0;return n.show&&n.vertical.show&&n.vertical.text.show&&(a+=n.vertical.text.paddingTop+n.vertical.text.paddingBottom+2*n.vertical.text.borderSize+n.vertical.text.size),Math.max(r,a)},e.prototype.getSelfBounding=function(){return this.getParent().getMainWidget().getBounding()},e.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),i=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(i)},e.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),i=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(i)},e.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().coordinateToDataIndex(t)},e.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().dataIndexToCoordinate(t)},e.extend=function(t){var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return B(i,e),i.prototype.createTicks=function(e){return t.createTicks(e)},i}(e);return i},e}(Gn),lr={name:"default",createTicks:function(t){var e=t.defaultTicks;return e}},cr={default:sr.extend(lr)};function ur(t){var e;return null!==(e=cr[t])&&void 0!==e?e:cr.default}var dr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.createAxisComponent=function(t){var e=ur(t);return new e(this)},e.prototype.createMainWidget=function(t){return new or(t,this)},e}(tr);function hr(t,e){var i=0;return function(){var n=Date.now();n-i>(null!==e&&void 0!==e?e:20)&&(t.apply(this,arguments),i=n)}}var pr=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._dragFlag=!1,n._dragStartY=0,n._topPaneHeight=0,n._bottomPaneHeight=0,n._pressedMouseMoveEvent=hr(n._pressedTouchMouseMoveEvent,20),n.registerEvent("touchStartEvent",n._mouseDownEvent.bind(n)).registerEvent("touchMoveEvent",n._pressedMouseMoveEvent.bind(n)).registerEvent("touchEndEvent",n._mouseUpEvent.bind(n)).registerEvent("mouseDownEvent",n._mouseDownEvent.bind(n)).registerEvent("mouseUpEvent",n._mouseUpEvent.bind(n)).registerEvent("pressedMouseMoveEvent",n._pressedMouseMoveEvent.bind(n)).registerEvent("mouseEnterEvent",n._mouseEnterEvent.bind(n)).registerEvent("mouseLeaveEvent",n._mouseLeaveEvent.bind(n)),n}return B(e,t),e.prototype.getName=function(){return Ki.SEPARATOR},e.prototype.checkEventOn=function(){return!0},e.prototype._mouseDownEvent=function(t){this._dragFlag=!0,this._dragStartY=t.pageY;var e=this.getPane();return this._topPaneHeight=e.getTopPane().getBounding().height,this._bottomPaneHeight=e.getBottomPane().getBounding().height,!0},e.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._mouseLeaveEvent()},e.prototype._pressedTouchMouseMoveEvent=function(t){var e=t.pageY-this._dragStartY,i=this.getPane(),n=i.getTopPane(),r=i.getBottomPane(),a=e<0;if(null!==n&&null!==r&&r.getOptions().dragEnabled){var o=void 0,s=void 0,l=void 0,c=void 0;a?(o=n,s=r,l=this._topPaneHeight,c=this._bottomPaneHeight):(o=r,s=n,l=this._bottomPaneHeight,c=this._topPaneHeight);var u=o.getOptions().minHeight;if(l>u){var d=Math.max(l-Math.abs(e),u),h=l-d;o.setBounding({height:d}),s.setBounding({height:c+h});var p=i.getChart();p.getChartStore().getActionStore().execute(Pt.OnPaneDrag,{paneId:i.getId()}),p.adjustPaneViewport(!0,!0,!0,!0,!0)}}return!0},e.prototype._mouseEnterEvent=function(){var t,e=this.getPane(),i=e.getBottomPane();if(null!==(t=null===i||void 0===i?void 0:i.getOptions().dragEnabled)&&void 0!==t&&t){var n=e.getChart(),r=n.getStyles().separator;return this.getContainer().style.background=r.activeBackgroundColor,!0}return!1},e.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="",!0)},e.prototype.createContainer=function(){return ce("div",{width:"100%",height:"".concat(Yi,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},e.prototype.updateImp=function(t,e,i){if(4===i||2===i){var n=this.getPane().getChart().getStyles().separator;t.style.top="".concat(-Math.floor((Yi-n.size)/2),"px"),t.style.height="".concat(Yi,"px")}},e}(Ji),fr=function(t){function e(e,i,n,r,a,o){var s=t.call(this,e,i,n,r)||this;return s.getContainer().style.overflow="",s._topPane=a,s._bottomPane=o,s._separatorWidget=new pr(s.getContainer(),s),s}return B(e,t),e.prototype.setBounding=function(t){return wt(this.getBounding(),t),this},e.prototype.getTopPane=function(){return this._topPane},e.prototype.setTopPane=function(t){return this._topPane=t,this},e.prototype.getBottomPane=function(){return this._bottomPane},e.prototype.setBottomPane=function(t){return this._bottomPane=t,this},e.prototype.getWidget=function(){return this._separatorWidget},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,r=this.getChart().getStyles().separator,a=ce("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),o=a.getContext("2d"),s=$t(a);return a.width=i*s,a.height=n*s,o.scale(s,s),o.fillStyle=r.color,o.fillRect(0,0,i,n),a},e.prototype.updateImp=function(t,e,i){if(4===t||2===t){var n=this.getChart().getStyles().separator;e.style.backgroundColor=n.color,e.style.height="".concat(i.height,"px"),e.style.marginLeft="".concat(i.left,"px"),e.style.width="".concat(i.width,"px"),this._separatorWidget.update(t)}},e}(Qn);function vr(){var t;return"undefined"!==typeof window&&(null!==(t=window.navigator.userAgent.toLowerCase().indexOf("firefox"))&&void 0!==t?t:-1)>-1}function gr(){return"undefined"!==typeof window&&/iPhone|iPad|iPod/.test(window.navigator.platform)}var mr,yr=10,br=function(){function t(t,e,i){var n=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartCoordinate=null,this._touchMoveStartCoordinate=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeMouseWheel=null,this._unsubscribeContextMenu=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._startPinchMiddleCoordinate=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!gr(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){if(n._firesTouchEvents(t)){if(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1){var e=n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance;e<30&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout()}}else if(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1){e=n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance;e<5&&!n._cancelClick&&n._processEvent(n._makeCompatEvent(t),n._handler.mouseDoubleClickEvent),n._resetClickTimeout()}},this._target=t,this._handler=e,this._options=i,this._init()}return t.prototype.destroy=function(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeMouseWheel&&(this._unsubscribeMouseWheel(),this._unsubscribeMouseWheel=null),null!==this._unsubscribeContextMenu&&(this._unsubscribeContextMenu(),this._unsubscribeContextMenu=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()},t.prototype._mouseEnterHandler=function(t){var e,i,n,r=this;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this);var a=this._mouseMoveHandler.bind(this);this._unsubscribeMousemove=function(){r._target.removeEventListener("mousemove",a)},this._target.addEventListener("mousemove",a);var o=this._mouseWheelHandler.bind(this);this._unsubscribeMouseWheel=function(){r._target.removeEventListener("wheel",o)},this._target.addEventListener("wheel",o,{passive:!1});var s=this._contextMenuHandler.bind(this);this._unsubscribeContextMenu=function(){r._target.removeEventListener("contextmenu",s)},this._target.addEventListener("contextmenu",s,{passive:!1}),this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseEnterEvent),this._acceptMouseLeave=!0)},t.prototype._resetClickTimeout=function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._mouseMoveHandler=function(t){this._mousePressed||null!==this._touchMoveStartCoordinate||this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseMoveEvent),this._acceptMouseLeave=!0)},t.prototype._mouseWheelHandler=function(t){if(Math.abs(t.deltaX)>Math.abs(t.deltaY)){if(!Mt(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!Mt(this._handler.mouseWheelVertEvent))return;var e=-t.deltaY/100;if(0===e)return;switch(this._preventDefault(t),t.deltaMode){case t.DOM_DELTA_PAGE:e*=120;break;case t.DOM_DELTA_LINE:e*=32;break}if(0!==e){var i=Math.sign(e)*Math.min(1,Math.abs(e));this._handler.mouseWheelVertEvent(this._makeCompatEvent(t),i)}}},t.prototype._contextMenuHandler=function(t){this._preventDefault(t)},t.prototype._touchMoveHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null!==e&&(this._lastTouchEventTimeStamp=this._eventTimeStamp(t),null===this._startPinchMiddleCoordinate&&!this._preventTouchDragProcess)){this._pinchPrevented=!0;var i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._touchMoveStartCoordinate),n=i.xOffset,r=i.yOffset,a=i.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){var o=.5*n,s=r>=o&&!this._options.treatVertDragAsPageScroll(),l=o>r&&!this._options.treatHorzDragAsPageScroll();s||l||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}this._preventTouchDragProcess||this._processEvent(this._makeCompatEvent(t,e),this._handler.touchMoveEvent)}}},t.prototype._mouseMoveWithDownHandler=function(t){if(0===t.button){var e=this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate),i=e.manhattanDistance;i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick&&this._processEvent(this._makeCompatEvent(t),this._handler.pressedMouseMoveEvent)}},t.prototype._mouseTouchMoveWithDownInfo=function(t,e){var i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),r=i+n;return{xOffset:i,yOffset:n,manhattanDistance:r}},t.prototype._touchEndHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null!==e){this._activeTouchId=null,this._lastTouchEventTimeStamp=this._eventTimeStamp(t),this._clearLongTapTimeout(),this._touchMoveStartCoordinate=null,null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var i=this._makeCompatEvent(t,e);if(this._processEvent(i,this._handler.touchEndEvent),++this._tapCount,null!==this._tapTimeoutId&&this._tapCount>1){var n=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance;n<30&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),Mt(this._handler.tapEvent)&&this._preventDefault(t));0===this._tapCount&&this._preventDefault(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,this._preventDefault(t))}},t.prototype._mouseUpHandler=function(t){if(0===t.button){var e=this._makeCompatEvent(t);if(this._mouseMoveStartCoordinate=null,this._mousePressed=!1,null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),vr()){var i=this._target.ownerDocument.documentElement;i.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(t))if(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,null!==this._clickTimeoutId&&this._clickCount>1){var n=this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance;n<5&&!this._cancelClick&&this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent)}},t.prototype._clearLongTapTimeout=function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)},t.prototype._touchStartHandler=function(t){if(null===this._activeTouchId){var e=t.changedTouches[0];this._activeTouchId=e.identifier,this._lastTouchEventTimeStamp=this._eventTimeStamp(t);var i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartCoordinate=this._getCoordinate(e),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var n=this._touchMoveHandler.bind(this),r=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=function(){i.removeEventListener("touchmove",n),i.removeEventListener("touchend",r)},i.addEventListener("touchmove",n,{passive:!1}),i.addEventListener("touchend",r,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),500),this._processEvent(this._makeCompatEvent(t,e),this._handler.touchStartEvent),null===this._tapTimeoutId&&(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapCoordinate=this._getCoordinate(e))}},t.prototype._mouseDownHandler=function(t){if(2===t.button)return this._preventDefault(t),void this._processEvent(this._makeCompatEvent(t),this._handler.mouseRightClickEvent);if(0===t.button){var e=this._target.ownerDocument.documentElement;vr()&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartCoordinate=this._getCoordinate(t),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);var i=this._mouseMoveWithDownHandler.bind(this),n=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=function(){e.removeEventListener("mousemove",i),e.removeEventListener("mouseup",n)},e.addEventListener("mousemove",i),e.addEventListener("mouseup",n),this._mousePressed=!0,this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseDownEvent),null===this._clickTimeoutId&&(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickCoordinate=this._getCoordinate(t)))}},t.prototype._init=function(){var t=this;this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));var e=this._target.ownerDocument,i=function(e){null!=t._handler.mouseDownOutsideEvent&&(e.composed&&t._target.contains(e.composedPath()[0])||null!==e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent({x:0,y:0,pageX:0,pageY:0}))};this._unsubscribeOutsideTouchEvents=function(){e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=function(){e.removeEventListener("mousedown",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),gr()&&(this._unsubscribeMobileSafariEvents=function(){t._target.removeEventListener("dblclick",t._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),this._target.addEventListener("mousedown",function(t){if(1===t.button)return t.preventDefault(),!1}),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",function(){},{passive:!1})},t.prototype._initPinch=function(){var t=this;(Mt(this._handler.pinchStartEvent)||Mt(this._handler.pinchEvent)||Mt(this._handler.pinchEndEvent))&&(this._target.addEventListener("touchstart",function(e){t._checkPinchState(e.touches)},{passive:!0}),this._target.addEventListener("touchmove",function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&Mt(t._handler.pinchEvent)){var i=t._getTouchDistance(e.touches[0],e.touches[1]),n=i/t._startPinchDistance;t._handler.pinchEvent(X(X({},t._startPinchMiddleCoordinate),{pageX:0,pageY:0}),n),t._preventDefault(e)}},{passive:!1}),this._target.addEventListener("touchend",function(e){t._checkPinchState(e.touches)}))},t.prototype._checkPinchState=function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)},t.prototype._startPinch=function(t){var e,i=null!==(e=this._target.getBoundingClientRect())&&void 0!==e?e:{left:0,top:0};this._startPinchMiddleCoordinate={x:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,y:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this._startPinchDistance=this._getTouchDistance(t[0],t[1]),Mt(this._handler.pinchStartEvent)&&this._handler.pinchStartEvent({x:0,y:0,pageX:0,pageY:0}),this._clearLongTapTimeout()},t.prototype._stopPinch=function(){null!==this._startPinchMiddleCoordinate&&(this._startPinchMiddleCoordinate=null,Mt(this._handler.pinchEndEvent)&&this._handler.pinchEndEvent({x:0,y:0,pageX:0,pageY:0}))},t.prototype._mouseLeaveHandler=function(t){var e,i,n;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this),this._firesTouchEvents(t)||this._acceptMouseLeave&&(this._processEvent(this._makeCompatEvent(t),this._handler.mouseLeaveEvent),this._acceptMouseLeave=!gr())},t.prototype._longTapHandler=function(t){var e=this._touchWithId(t.touches,this._activeTouchId);null!==e&&(this._processEvent(this._makeCompatEvent(t,e),this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0)},t.prototype._firesTouchEvents=function(t){var e;return Mt(null===(e=t.sourceCapabilities)||void 0===e?void 0:e.firesTouchEvents)?t.sourceCapabilities.firesTouchEvents:this._eventTimeStamp(t)<this._lastTouchEventTimeStamp+500},t.prototype._processEvent=function(t,e){null===e||void 0===e||e.call(this._handler,t)},t.prototype._makeCompatEvent=function(t,e){var i,n=this,r=null!==e&&void 0!==e?e:t,a=null!==(i=this._target.getBoundingClientRect())&&void 0!==i?i:{left:0,top:0};return{x:r.clientX-a.left,y:r.clientY-a.top,pageX:r.pageX,pageY:r.pageY,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,preventDefault:function(){"touchstart"!==t.type&&n._preventDefault(t)}}},t.prototype._getTouchDistance=function(t,e){var i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.sqrt(i*i+n*n)},t.prototype._preventDefault=function(t){t.cancelable&&t.preventDefault()},t.prototype._getCoordinate=function(t){return{x:t.pageX,y:t.pageY}},t.prototype._eventTimeStamp=function(t){var e;return null!==(e=t.timeStamp)&&void 0!==e?e:performance.now()},t.prototype._touchWithId=function(t,e){for(var i=0;i<t.length;++i)if(t[i].identifier===e)return t[i];return null},t}(),xr=function(){function t(t,e){var i=this;this._flingStartTime=(new Date).getTime(),this._flingScrollRequestId=null,this._startScrollCoordinate=null,this._touchCoordinate=null,this._touchCancelCrosshair=!1,this._touchZoomed=!1,this._pinchScale=1,this._mouseDownWidget=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,this._mouseMoveTriggerWidgetInfo={pane:null,widget:null},this._boundKeyBoardDownEvent=function(t){if(t.shiftKey)switch(t.code){case"Equal":i._chart.getChartStore().getTimeScaleStore().zoom(.5);break;case"Minus":i._chart.getChartStore().getTimeScaleStore().zoom(-.5);break;case"ArrowLeft":var e=i._chart.getChartStore().getTimeScaleStore();e.startScroll(),e.scroll(-3*e.getBarSpace().bar);break;case"ArrowRight":e=i._chart.getChartStore().getTimeScaleStore();e.startScroll(),e.scroll(3*e.getBarSpace().bar);break}},this._container=t,this._chart=e,this._event=new br(t,this,{treatVertDragAsPageScroll:function(){return!1},treatHorzDragAsPageScroll:function(){return!1}}),t.addEventListener("keydown",this._boundKeyBoardDownEvent)}return t.prototype.pinchStartEvent=function(){return this._touchZoomed=!0,this._pinchScale=1,!0},t.prototype.pinchEvent=function(t,e){var i=this._findWidgetByEvent(t),n=i.pane,r=i.widget;if((null===n||void 0===n?void 0:n.getId())!==Bi.X_AXIS&&(null===r||void 0===r?void 0:r.getName())===Ki.MAIN){var a=this._makeWidgetEvent(t,r),o=5*(e-this._pinchScale);return this._pinchScale=e,this._chart.getChartStore().getTimeScaleStore().zoom(o,{x:a.x,y:a.y}),!0}return!1},t.prototype.mouseWheelHortEvent=function(t,e){var i=this._chart.getChartStore().getTimeScaleStore();return i.startScroll(),i.scroll(e),!0},t.prototype.mouseWheelVertEvent=function(t,e){var i,n=this._findWidgetByEvent(t).widget,r=null!==(i=t.isTouch)&&void 0!==i&&i,a=this._makeWidgetEvent(t,n),o=null,s=null===n||void 0===n?void 0:n.getName();if(r)if(s===Ki.MAIN||s===Ki.X_AXIS)o={x:a.x,y:a.y};else{var l=this._chart.getCandlePane().getBounding();o={x:l.width/2,y:l.height/2}}else s===Ki.MAIN&&(o={x:a.x,y:a.y});return null!==o&&(this._chart.getChartStore().getTimeScaleStore().zoom(e,{x:a.x,y:a.y}),!0)},t.prototype.mouseDownEvent=function(t){var e,i,n=this._findWidgetByEvent(t),r=n.pane,a=n.widget;if(this._mouseDownWidget=a,null!==a){var o=this._makeWidgetEvent(t,a),s=a.getName();switch(s){case Ki.SEPARATOR:return a.dispatchEvent("mouseDownEvent",o);case Ki.MAIN:var l=null!==(e=r.getAxisComponent().getRange())&&void 0!==e?e:null;return this._prevYAxisRange=null===l?l:X({},l),this._startScrollCoordinate={x:o.x,y:o.y},this._chart.getChartStore().getTimeScaleStore().startScroll(),a.dispatchEvent("mouseDownEvent",o);case Ki.X_AXIS:var c=a.dispatchEvent("mouseDownEvent",o);return c&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:o.x,y:o.y},this._xAxisStartScaleDistance=o.pageX,c;case Ki.Y_AXIS:c=a.dispatchEvent("mouseDownEvent",o);c&&this._chart.updatePane(1);l=null!==(i=r.getAxisComponent().getRange())&&void 0!==i?i:null;return this._prevYAxisRange=null===l?l:X({},l),this._yAxisStartScaleDistance=o.pageY,c}}return!1},t.prototype.mouseMoveEvent=function(t){var e,i,n,r=this._findWidgetByEvent(t),a=r.pane,o=r.widget,s=this._makeWidgetEvent(t,o);if((null===(e=this._mouseMoveTriggerWidgetInfo.pane)||void 0===e?void 0:e.getId())===(null===a||void 0===a?void 0:a.getId())&&(null===(i=this._mouseMoveTriggerWidgetInfo.widget)||void 0===i?void 0:i.getName())===(null===o||void 0===o?void 0:o.getName())||(null===o||void 0===o||o.dispatchEvent("mouseEnterEvent",s),null===(n=this._mouseMoveTriggerWidgetInfo.widget)||void 0===n||n.dispatchEvent("mouseLeaveEvent",s),this._mouseMoveTriggerWidgetInfo={pane:a,widget:o}),null!==o){var l=o.getName();switch(l){case Ki.MAIN:var c=o.dispatchEvent("mouseMoveEvent",s),u=this._chart.getChartStore(),d={x:s.x,y:s.y,paneId:null===a||void 0===a?void 0:a.getId()};return c&&null!==u.getTooltipStore().getActiveIcon()&&(d=void 0,null!==o&&(o.getContainer().style.cursor="pointer")),this._chart.getChartStore().getTooltipStore().setCrosshair(d),c;case Ki.SEPARATOR:case Ki.X_AXIS:case Ki.Y_AXIS:c=o.dispatchEvent("mouseMoveEvent",s);return this._chart.getChartStore().getTooltipStore().setCrosshair(),c}}return!1},t.prototype.pressedMouseMoveEvent=function(t){var e,i,n,r,a;if(null!==this._mouseDownWidget&&this._mouseDownWidget.getName()===Ki.SEPARATOR)return this._mouseDownWidget.dispatchEvent("pressedMouseMoveEvent",t);var o=this._findWidgetByEvent(t),s=o.pane,l=o.widget;if(null!==l&&(null===(e=this._mouseDownWidget)||void 0===e?void 0:e.getPane().getId())===(null===s||void 0===s?void 0:s.getId())&&(null===(i=this._mouseDownWidget)||void 0===i?void 0:i.getName())===l.getName()){var c=this._makeWidgetEvent(t,l),u=l.getName();switch(u){case Ki.MAIN:var d=l.getBounding(),h=l.dispatchEvent("pressedMouseMoveEvent",c);if(!h&&null!==this._startScrollCoordinate){var p=s.getAxisComponent();if(null!==this._prevYAxisRange&&!p.getAutoCalcTickFlag()&&p.getScrollZoomEnabled()){var f,v=this._prevYAxisRange,g=v.from,m=v.to,y=v.range;f=null!==(n=null===p||void 0===p?void 0:p.isReverse())&&void 0!==n&&n?this._startScrollCoordinate.y-c.y:c.y-this._startScrollCoordinate.y;var b=f/d.height,x=y*b,_=g+x,w=m+x,C=p.convertToRealValue(_),S=p.convertToRealValue(w);p.setRange({from:_,to:w,range:w-_,realFrom:C,realTo:S,realRange:S-C})}var k=c.x-this._startScrollCoordinate.x;this._chart.getChartStore().getTimeScaleStore().scroll(k)}return this._chart.getChartStore().getTooltipStore().setCrosshair({x:c.x,y:c.y,paneId:null===s||void 0===s?void 0:s.getId()}),h;case Ki.X_AXIS:h=l.dispatchEvent("pressedMouseMoveEvent",c);if(h)this._chart.updatePane(1);else{var A=s.getAxisComponent();if(null===(r=null===A||void 0===A?void 0:A.getScrollZoomEnabled())||void 0===r||r){b=this._xAxisStartScaleDistance/c.pageX;var T=10*(b-this._xAxisScale);this._xAxisScale=b,this._chart.getChartStore().getTimeScaleStore().zoom(T,null!==(a=this._xAxisStartScaleCoordinate)&&void 0!==a?a:void 0)}}return h;case Ki.Y_AXIS:h=l.dispatchEvent("pressedMouseMoveEvent",c);if(h)this._chart.updatePane(1);else{p=s.getAxisComponent();if(null!==this._prevYAxisRange&&p.getScrollZoomEnabled()){var M=this._prevYAxisRange,I=(g=M.from,m=M.to,y=M.range,b=c.pageY/this._yAxisStartScaleDistance,y*b);x=(I-y)/2,_=g-x,w=m+x,C=p.convertToRealValue(_),S=p.convertToRealValue(w);p.setRange({from:_,to:w,range:I,realFrom:C,realTo:S,realRange:S-C}),this._chart.adjustPaneViewport(!1,!0,!0,!0)}}return h}}return!1},t.prototype.mouseUpEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e),r=e.getName();switch(r){case Ki.MAIN:case Ki.SEPARATOR:case Ki.X_AXIS:case Ki.Y_AXIS:i=e.dispatchEvent("mouseUpEvent",n);break}i&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,i},t.prototype.mouseClickEvent=function(t){var e=this._findWidgetByEvent(t).widget;if(null!==e){var i=this._makeWidgetEvent(t,e);return e.dispatchEvent("mouseClickEvent",i)}return!1},t.prototype.mouseRightClickEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e),r=e.getName();switch(r){case Ki.MAIN:case Ki.X_AXIS:case Ki.Y_AXIS:i=e.dispatchEvent("mouseRightClickEvent",n);break}i&&this._chart.updatePane(1)}return!1},t.prototype.mouseDoubleClickEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n){var r=n.getName();switch(r){case Ki.MAIN:var a=this._makeWidgetEvent(t,n);return n.dispatchEvent("mouseDoubleClickEvent",a);case Ki.Y_AXIS:var o=i.getAxisComponent();if(!o.getAutoCalcTickFlag())return o.setAutoCalcTickFlag(!0),this._chart.adjustPaneViewport(!1,!0,!0,!0),!0;break}}return!1},t.prototype.mouseLeaveEvent=function(){return this._chart.getChartStore().getTooltipStore().setCrosshair(),!0},t.prototype.touchStartEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n){var r=this._makeWidgetEvent(t,n),a=n.getName();switch(a){case Ki.MAIN:var o=this._chart.getChartStore(),s=o.getTooltipStore();if(n.dispatchEvent("mouseDownEvent",r))return this._touchCancelCrosshair=!0,this._touchCoordinate=null,s.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._flingScrollRequestId&&(Gi(this._flingScrollRequestId),this._flingScrollRequestId=null),this._flingStartTime=(new Date).getTime(),this._startScrollCoordinate={x:r.x,y:r.y},o.getTimeScaleStore().startScroll(),this._touchZoomed=!1,null!==this._touchCoordinate){var l=r.x-this._touchCoordinate.x,c=r.y-this._touchCoordinate.y,u=Math.sqrt(l*l+c*c);u<yr?(this._touchCoordinate={x:r.x,y:r.y},s.setCrosshair({x:r.x,y:r.y,paneId:null===i||void 0===i?void 0:i.getId()})):(this._touchCoordinate=null,this._touchCancelCrosshair=!0,s.setCrosshair())}return!0;case Ki.X_AXIS:case Ki.Y_AXIS:var d=n.dispatchEvent("mouseDownEvent",r);return d&&this._chart.updatePane(1),d}}return!1},t.prototype.touchMoveEvent=function(t){var e,i,n,r=this._findWidgetByEvent(t),a=r.pane,o=r.widget;if(null!==o){var s=this._makeWidgetEvent(t,o),l=o.getName(),c=this._chart.getChartStore(),u=c.getTooltipStore();switch(l){case Ki.MAIN:if(o.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),u.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(i=s.preventDefault)||void 0===i||i.call(s),u.setCrosshair({x:s.x,y:s.y,paneId:null===a||void 0===a?void 0:a.getId()});else if(null!==this._startScrollCoordinate&&Math.abs(this._startScrollCoordinate.x-s.x)>this._startScrollCoordinate.y-s.y){var d=s.x-this._startScrollCoordinate.x;c.getTimeScaleStore().scroll(d)}return!0;case Ki.X_AXIS:case Ki.Y_AXIS:var h=o.dispatchEvent("pressedMouseMoveEvent",s);return h&&(null===(n=s.preventDefault)||void 0===n||n.call(s),this._chart.updatePane(1)),h}}return!1},t.prototype.touchEndEvent=function(t){var e=this,i=this._findWidgetByEvent(t).widget;if(null!==i){var n=this._makeWidgetEvent(t,i),r=i.getName();switch(r){case Ki.MAIN:if(i.dispatchEvent("mouseUpEvent",n),null!==this._startScrollCoordinate){var a=(new Date).getTime()-this._flingStartTime,o=n.x-this._startScrollCoordinate.x,s=o/(a>0?a:1)*20;if(a<200&&Math.abs(s)>0){var l=this._chart.getChartStore().getTimeScaleStore(),c=function(){e._flingScrollRequestId=Ui(function(){l.startScroll(),l.scroll(s),s*=.975,Math.abs(s)<1?null!==e._flingScrollRequestId&&(Gi(e._flingScrollRequestId),e._flingScrollRequestId=null):c()})};c()}}return!0;case Ki.X_AXIS:case Ki.Y_AXIS:var u=i.dispatchEvent("mouseUpEvent",n);u&&this._chart.updatePane(1)}}return!1},t.prototype.tapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget,r=!1;if(null!==n){var a=this._makeWidgetEvent(t,n),o=n.dispatchEvent("mouseClickEvent",a);if(n.getName()===Ki.MAIN){var s=this._makeWidgetEvent(t,n),l=this._chart.getChartStore(),c=l.getTooltipStore();o?(this._touchCancelCrosshair=!0,this._touchCoordinate=null,c.setCrosshair(void 0,!0),r=!0):(this._touchCancelCrosshair||this._touchZoomed||(this._touchCoordinate={x:s.x,y:s.y},c.setCrosshair({x:s.x,y:s.y,paneId:null===i||void 0===i?void 0:i.getId()},!0),r=!0),this._touchCancelCrosshair=!1)}(r||o)&&this._chart.updatePane(1)}return r},t.prototype.doubleTapEvent=function(t){return this.mouseDoubleClickEvent(t)},t.prototype.longTapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n&&n.getName()===Ki.MAIN){var r=this._makeWidgetEvent(t,n);return this._touchCoordinate={x:r.x,y:r.y},this._chart.getChartStore().getTooltipStore().setCrosshair({x:r.x,y:r.y,paneId:null===i||void 0===i?void 0:i.getId()}),!0}return!1},t.prototype._findWidgetByEvent=function(t){var e,i,n,r,a=t.x,o=t.y,s=this._chart.getAllSeparatorPanes(),l=this._chart.getChartStore().getStyles().separator.size;try{for(var c=j(s),u=c.next();!u.done;u=c.next()){var d=q(u.value,2),h=d[1],p=h.getBounding(),f=p.top-Math.round((Yi-l)/2);if(a>=p.left&&a<=p.left+p.width&&o>=f&&o<=f+Yi)return{pane:h,widget:h.getWidget()}}}catch(k){e={error:k}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}var v=this._chart.getAllDrawPanes(),g=null;try{for(var m=j(v),y=m.next();!y.done;y=m.next()){var b=y.value;p=b.getBounding();if(a>=p.left&&a<=p.left+p.width&&o>=p.top&&o<=p.top+p.height){g=b;break}}}catch(A){n={error:A}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}var x=null;if(null!==g){if(null===x){var _=g.getMainWidget(),w=_.getBounding();a>=w.left&&a<=w.left+w.width&&o>=w.top&&o<=w.top+w.height&&(x=_)}if(null===x){var C=g.getYAxisWidget();if(null!==C){var S=C.getBounding();a>=S.left&&a<=S.left+S.width&&o>=S.top&&o<=S.top+S.height&&(x=C)}}}return{pane:g,widget:x}},t.prototype._makeWidgetEvent=function(t,e){var i,n,r,a=null!==(i=null===e||void 0===e?void 0:e.getBounding())&&void 0!==i?i:null;return X(X({},t),{x:t.x-(null!==(n=null===a||void 0===a?void 0:a.left)&&void 0!==n?n:0),y:t.y-(null!==(r=null===a||void 0===a?void 0:a.top)&&void 0!==r?r:0)})},t.prototype.destroy=function(){this._container.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._event.destroy()},t}();(function(t){t["Root"]="root",t["Main"]="main",t["YAxis"]="yAxis"})(mr||(mr={}));var _r=function(){function t(t,e){this._drawPanes=[],this._separatorPanes=new Map,this._initContainer(t),this._chartEvent=new xr(this._chartContainer,this),this._chartStore=new Vi(this,e),this._initPanes(e),this.adjustPaneViewport(!0,!0,!0)}return t.prototype._initContainer=function(t){this._container=t,this._chartContainer=ce("div",{position:"relative",width:"100%",outline:"none",borderStyle:"none",cursor:"crosshair",boxSizing:"border-box",userSelect:"none",webkitUserSelect:"none",msUserSelect:"none",MozUserSelect:"none",webkitTapHighlightColor:"transparent"}),this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer)},t.prototype._initPanes=function(t){var e,i=this,n=null!==(e=null===t||void 0===t?void 0:t.layout)&&void 0!==e?e:[{type:"candle"}],r=!1,a=!1,o=function(t){if(!a){var e=i._createPane(dr,Bi.X_AXIS,null!==t&&void 0!==t?t:{});i._xAxisPane=e,a=!0}};n.forEach(function(t){var e,n,a;switch(t.type){case"candle":if(!r){var s=null!==(e=t.options)&&void 0!==e?e:{};wt(s,{id:Bi.CANDLE});var l=i._createPane(ir,Bi.CANDLE,s);i._candlePane=l;var c=null!==(n=t.content)&&void 0!==n?n:[];c.forEach(function(t){i.createIndicator(t,!0,s)}),r=!0}break;case"indicator":var u;c=null!==(a=t.content)&&void 0!==a?a:[];if(c.length>0)c.forEach(function(e){Mt(u)?i.createIndicator(e,!0,{id:u}):u=i.createIndicator(e,!0,t.options)});break;case"xAxis":o(t.options)}}),o({position:"bottom"})},t.prototype._createPane=function(t,e,i){var n,r=null,a=null,o=null===i||void 0===i?void 0:i.position;switch(o){case"top":var s=this._drawPanes[0];Mt(s)&&(a=new t(this._chartContainer,s.getContainer(),this,e,null!==i&&void 0!==i?i:{}),r=0);break;case"bottom":break;default:for(var l=this._drawPanes.length-1;l>-1;l--){var c=this._drawPanes[l],u=this._drawPanes[l-1];"bottom"===(null===c||void 0===c?void 0:c.getOptions().position)&&"bottom"!==(null===u||void 0===u?void 0:u.getOptions().position)&&(a=new t(this._chartContainer,c.getContainer(),this,e,null!==i&&void 0!==i?i:{}),r=l)}}if(Mt(a)||(a=new t(this._chartContainer,null,this,e,null!==i&&void 0!==i?i:{})),Mt(r)?(this._drawPanes.splice(r,0,a),n=r):(this._drawPanes.push(a),n=this._drawPanes.length-1),a.getId()!==Bi.X_AXIS){var d=this._drawPanes[n+1];if(Mt(d)&&d.getId()===Bi.X_AXIS&&(d=this._drawPanes[n+2]),Mt(d)){var h=this._separatorPanes.get(d);Mt(h)?h.setTopPane(a):(h=new fr(this._chartContainer,d.getContainer(),this,"",a,d),this._separatorPanes.set(d,h))}var p=this._drawPanes[n-1];if(Mt(p)&&p.getId()===Bi.X_AXIS&&(p=this._drawPanes[n-2]),Mt(p)){h=new fr(this._chartContainer,a.getContainer(),this,"",p,a);this._separatorPanes.set(a,h)}}return a},t.prototype._measurePaneHeight=function(){var t,e=this,i=Math.floor(this._container.clientHeight),n=this._chartStore.getStyles().separator.size,r=this._xAxisPane.getAxisComponent().getAutoSize(),a=i-r-this._separatorPanes.size*n;a<0&&(a=0);var o=0;this._drawPanes.forEach(function(t){if(t.getId()!==Bi.CANDLE&&t.getId()!==Bi.X_AXIS){var e=t.getBounding().height,i=t.getOptions().minHeight;e<i&&(e=i),o+e>a?(o=a,e=Math.max(a-o,0)):o+=e,t.setBounding({height:e})}});var s=a-o;null===(t=this._candlePane)||void 0===t||t.setBounding({height:s}),this._xAxisPane.setBounding({height:r});var l=0;this._drawPanes.forEach(function(t){var i=e._separatorPanes.get(t);Mt(i)&&(i.setBounding({height:n,top:l}),l+=n),t.setBounding({top:l}),l+=t.getBounding().height})},t.prototype._measurePaneWidth=function(){var t=this,e=Math.floor(this._container.clientWidth),i=this._chartStore.getStyles(),n=i.yAxis,r=n.position===K.Left,a=!n.inside,o=0,s=Number.MIN_SAFE_INTEGER,l=0,c=0;this._drawPanes.forEach(function(t){t.getId()!==Bi.X_AXIS&&(s=Math.max(s,t.getAxisComponent().getAutoSize()))}),s>e&&(s=e),a?(o=e-s,r?(l=0,c=s):(l=e-s,c=0)):(o=e,c=0,l=r?0:e-s),this._chartStore.getTimeScaleStore().setTotalBarSpace(o);var u,d={width:e},h={width:o,left:c},p={width:s,left:l},f=i.separator.fill;u=a&&!f?h:d,this._drawPanes.forEach(function(e){var i;null===(i=t._separatorPanes.get(e))||void 0===i||i.setBounding(u),e.setBounding(d,h,p)})},t.prototype._setPaneOptions=function(t,e){var i,n;if(Et(t.id)){var r=this.getDrawPaneById(t.id),a=!1;if(null!==r){var o=e;if(t.id!==Bi.CANDLE&&Tt(t.height)&&t.height>0){var s=Math.max(null!==(i=t.minHeight)&&void 0!==i?i:r.getOptions().minHeight,0),l=Math.max(s,t.height);r.setBounding({height:l}),o=!0,a=!0}(Et(null===(n=t.axisOptions)||void 0===n?void 0:n.name)||Mt(t.gap))&&(o=!0),r.setOptions(t),o&&this.adjustPaneViewport(a,!0,!0,!0,!0)}}},t.prototype.getDrawPaneById=function(t){if(t===Bi.CANDLE)return this._candlePane;if(t===Bi.X_AXIS)return this._xAxisPane;var e=this._drawPanes.find(function(e){return e.getId()===t});return null!==e&&void 0!==e?e:null},t.prototype.getContainer=function(){return this._container},t.prototype.getChartStore=function(){return this._chartStore},t.prototype.getCandlePane=function(){return this._candlePane},t.prototype.getXAxisPane=function(){return this._xAxisPane},t.prototype.getAllDrawPanes=function(){return this._drawPanes},t.prototype.getAllSeparatorPanes=function(){return this._separatorPanes},t.prototype.adjustPaneViewport=function(t,e,i,n,r){t&&this._measurePaneHeight();var a=e,o=null!==n&&void 0!==n&&n,s=null!==r&&void 0!==r&&r;(o||s)&&this._drawPanes.forEach(function(t){var e=t.getAxisComponent().buildTicks(s);a||(a=e)}),a&&this._measurePaneWidth(),null!==i&&void 0!==i&&i&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4))},t.prototype.updatePane=function(t,e){if(Mt(e)){var i=this.getDrawPaneById(e);null===i||void 0===i||i.update(t)}else this._separatorPanes.forEach(function(e){e.update(t)}),this._drawPanes.forEach(function(e){e.update(t)})},t.prototype.crosshairChange=function(t){var e=this,i=this._chartStore.getActionStore();if(i.has(Pt.OnCrosshairChange)){var n={};this._drawPanes.forEach(function(i){var r=i.getId(),a={},o=e._chartStore.getIndicatorStore().getInstances(r);o.forEach(function(e){var i,n=e.result;a[e.name]=n[null!==(i=t.dataIndex)&&void 0!==i?i:n.length-1]}),n[r]=a}),Et(t.paneId)&&i.execute(Pt.OnCrosshairChange,X(X({},t),{indicatorData:n}))}},t.prototype.getDom=function(t,e){var i,n;if(!Et(t))return this._chartContainer;var r=this.getDrawPaneById(t);if(null!==r){var a=null!==e&&void 0!==e?e:mr.Root;switch(a){case mr.Root:return r.getContainer();case mr.Main:return r.getMainWidget().getContainer();case mr.YAxis:return null!==(n=null===(i=r.getYAxisWidget())||void 0===i?void 0:i.getContainer())&&void 0!==n?n:null}}return null},t.prototype.getSize=function(t,e){var i,n;if(!Mt(t))return{width:Math.floor(this._chartContainer.clientWidth),height:Math.floor(this._chartContainer.clientHeight),left:0,top:0,right:0,bottom:0};var r=this.getDrawPaneById(t);if(null!==r){var a=null!==e&&void 0!==e?e:mr.Root;switch(a){case mr.Root:return r.getBounding();case mr.Main:return r.getMainWidget().getBounding();case mr.YAxis:return null!==(n=null===(i=r.getYAxisWidget())||void 0===i?void 0:i.getBounding())&&void 0!==n?n:null}}return null},t.prototype.setStyles=function(t){var e,i,n;this._chartStore.setOptions({styles:t}),n=Et(t)?Hi(t):t,Mt(null===(e=null===n||void 0===n?void 0:n.yAxis)||void 0===e?void 0:e.type)&&(null===(i=this._candlePane)||void 0===i||i.getAxisComponent().setAutoCalcTickFlag(!0)),this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.getStyles=function(){return this._chartStore.getStyles()},t.prototype.setLocale=function(t){this._chartStore.setOptions({locale:t}),this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.getLocale=function(){return this._chartStore.getLocale()},t.prototype.setCustomApi=function(t){this._chartStore.setOptions({customApi:t}),this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.setPriceVolumePrecision=function(t,e){this._chartStore.setPrecision({price:t,volume:e})},t.prototype.getPriceVolumePrecision=function(){return this._chartStore.getPrecision()},t.prototype.setTimezone=function(t){this._chartStore.setOptions({timezone:t}),this._xAxisPane.getAxisComponent().buildTicks(!0),this._xAxisPane.update(3)},t.prototype.getTimezone=function(){return this._chartStore.getTimeScaleStore().getTimezone()},t.prototype.setOffsetRightDistance=function(t){this._chartStore.getTimeScaleStore().setOffsetRightDistance(t,!0)},t.prototype.getOffsetRightDistance=function(){return this._chartStore.getTimeScaleStore().getOffsetRightDistance()},t.prototype.setMaxOffsetLeftDistance=function(t){t<0?bt("setMaxOffsetLeftDistance","distance","distance must greater than zero!!!"):this._chartStore.getTimeScaleStore().setMaxOffsetLeftDistance(t)},t.prototype.setMaxOffsetRightDistance=function(t){t<0?bt("setMaxOffsetRightDistance","distance","distance must greater than zero!!!"):this._chartStore.getTimeScaleStore().setMaxOffsetRightDistance(t)},t.prototype.setLeftMinVisibleBarCount=function(t){t<0?bt("setLeftMinVisibleBarCount","barCount","barCount must greater than zero!!!"):this._chartStore.getTimeScaleStore().setLeftMinVisibleBarCount(Math.ceil(t))},t.prototype.setRightMinVisibleBarCount=function(t){t<0?bt("setRightMinVisibleBarCount","barCount","barCount must greater than zero!!!"):this._chartStore.getTimeScaleStore().setRightMinVisibleBarCount(Math.ceil(t))},t.prototype.setBarSpace=function(t){this._chartStore.getTimeScaleStore().setBarSpace(t)},t.prototype.getBarSpace=function(){return this._chartStore.getTimeScaleStore().getBarSpace().bar},t.prototype.getVisibleRange=function(){return this._chartStore.getTimeScaleStore().getVisibleRange()},t.prototype.clearData=function(){this._chartStore.clear()},t.prototype.getDataList=function(){return this._chartStore.getDataList()},t.prototype.applyNewData=function(t,e,i){Mt(i)&&bt("applyNewData","","param `callback` has been deprecated since version 9.8.0, use `subscribeAction('onDataReady')` instead."),this._chartStore.addData(t,!0,e).then(function(){}).catch(function(){}).finally(function(){null===i||void 0===i||i()})},t.prototype.applyMoreData=function(t,e,i){bt("","","Api `applyMoreData` has been deprecated since version 9.8.0.");var n=t.concat(this._chartStore.getDataList());this._chartStore.addData(n,!1,null===e||void 0===e||e).then(function(){}).catch(function(){}).finally(function(){null===i||void 0===i||i()})},t.prototype.updateData=function(t,e){Mt(e)&&bt("updateData","","param `callback` has been deprecated since version 9.8.0, use `subscribeAction('onDataReady')` instead."),this._chartStore.addData(t,!1).then(function(){}).catch(function(){}).finally(function(){null===e||void 0===e||e()})},t.prototype.loadMore=function(t){bt("","","Api `loadMore` has been deprecated since version 9.8.0, use `setLoadDataCallback` instead."),this._chartStore.setLoadMoreCallback(t)},t.prototype.setLoadDataCallback=function(t){this._chartStore.setLoadDataCallback(t)},t.prototype.createIndicator=function(t,e,i,n){var r,a=this,o=Et(t)?{name:t}:t;if(null===Qe(o.name))return bt("createIndicator","value","indicator not supported, you may need to use registerIndicator to add one!!!"),null;var s=null===i||void 0===i?void 0:i.id,l=this.getDrawPaneById(null!==s&&void 0!==s?s:"");if(null!==l)this._chartStore.getIndicatorStore().addInstance(o,null!==s&&void 0!==s?s:"",null!==e&&void 0!==e&&e).then(function(t){var e;a._setPaneOptions(null!==i&&void 0!==i?i:{},null!==(e=l.getAxisComponent().buildTicks(!0))&&void 0!==e&&e)}).catch(function(t){});else{null!==s&&void 0!==s||(s=le(Bi.INDICATOR));var c=this._createPane(er,s,null!==i&&void 0!==i?i:{}),u=null!==(r=null===i||void 0===i?void 0:i.height)&&void 0!==r?r:Fi;c.setBounding({height:u}),this._chartStore.getIndicatorStore().addInstance(o,s,null!==e&&void 0!==e&&e).finally(function(){a.adjustPaneViewport(!0,!0,!0,!0,!0),null===n||void 0===n||n()})}return null!==s&&void 0!==s?s:null},t.prototype.overrideIndicator=function(t,e,i){var n=this;this._chartStore.getIndicatorStore().override(t,null!==e&&void 0!==e?e:null).then(function(t){var e=q(t,2),r=e[0],a=e[1];(r||a)&&(n.adjustPaneViewport(!1,a,!0,a),null===i||void 0===i||i())}).catch(function(){})},t.prototype.getIndicatorByPaneId=function(t,e){return this._chartStore.getIndicatorStore().getInstanceByPaneId(t,e)},t.prototype.removeIndicator=function(t,e){var i,n,r,a=this._chartStore.getIndicatorStore(),o=a.removeInstance(t,e);if(o){var s=!1;if(t!==Bi.CANDLE&&!a.hasInstances(t)){var l=this.getDrawPaneById(t),c=this._drawPanes.findIndex(function(e){return e.getId()===t});if(null!==l){s=!0;var u=this._separatorPanes.get(l);if(Mt(u)){var d=null===u||void 0===u?void 0:u.getTopPane();try{for(var h=j(this._separatorPanes),p=h.next();!p.done;p=h.next()){var f=p.value;if(f[1].getTopPane().getId()===l.getId()){f[1].setTopPane(d);break}}}catch(g){i={error:g}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}u.destroy(),this._separatorPanes.delete(l)}this._drawPanes.splice(c,1),l.destroy();var v=this._drawPanes[0];Mt(v)&&v.getId()===Bi.X_AXIS&&(v=this._drawPanes[1]),null===(r=this._separatorPanes.get(v))||void 0===r||r.destroy(),this._separatorPanes.delete(v)}}this.adjustPaneViewport(s,!0,!0,!0,!0)}},t.prototype.createOverlay=function(t,e){var i=[];if(Et(t))i=[{name:t}];else if(St(t))i=t.map(function(t){return Et(t)?{name:t}:t});else{var n=t;i=[n]}var r=!0;Mt(e)&&null!==this.getDrawPaneById(e)||(e=Bi.CANDLE,r=!1);var a=this._chartStore.getOverlayStore().addInstances(i,e,r);return St(t)?a:a[0]},t.prototype.getOverlayById=function(t){return this._chartStore.getOverlayStore().getInstanceById(t)},t.prototype.overrideOverlay=function(t){this._chartStore.getOverlayStore().override(t)},t.prototype.removeOverlay=function(t){var e;Mt(t)&&(e=Et(t)?{id:t}:t),this._chartStore.getOverlayStore().removeInstance(e)},t.prototype.setPaneOptions=function(t){this._setPaneOptions(t,!1)},t.prototype.setZoomEnabled=function(t){this._chartStore.getTimeScaleStore().setZoomEnabled(t)},t.prototype.isZoomEnabled=function(){return this._chartStore.getTimeScaleStore().getZoomEnabled()},t.prototype.setScrollEnabled=function(t){this._chartStore.getTimeScaleStore().setScrollEnabled(t)},t.prototype.isScrollEnabled=function(){return this._chartStore.getTimeScaleStore().getScrollEnabled()},t.prototype.scrollByDistance=function(t,e){var i=Tt(e)&&e>0?e:0,n=this._chartStore.getTimeScaleStore();if(i>0){n.startScroll();var r=(new Date).getTime(),a=function(){var e=((new Date).getTime()-r)/i,o=e>=1,s=o?t:t*e;n.scroll(s),o||requestAnimationFrame(a)};a()}else n.startScroll(),n.scroll(t)},t.prototype.scrollToRealTime=function(t){var e=this._chartStore.getTimeScaleStore(),i=e.getBarSpace().bar,n=e.getLastBarRightSideDiffBarCount()-e.getInitialOffsetRightDistance()/i,r=n*i;this.scrollByDistance(r,t)},t.prototype.scrollToDataIndex=function(t,e){var i=this._chartStore.getTimeScaleStore(),n=(i.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*i.getBarSpace().bar;this.scrollByDistance(n,e)},t.prototype.scrollToTimestamp=function(t,e){var i=ue(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},t.prototype.zoomAtCoordinate=function(t,e,i){var n=Tt(i)&&i>0?i:0,r=this._chartStore.getTimeScaleStore();if(n>0){var a=r.getBarSpace().bar,o=a*t,s=o-a,l=(new Date).getTime(),c=function(){var t=((new Date).getTime()-l)/n,i=t>=1,o=i?s:s*t;r.zoom(o/a,e),i||requestAnimationFrame(c)};c()}else r.zoom(t,e)},t.prototype.zoomAtDataIndex=function(t,e,i){var n=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:n,y:0},i)},t.prototype.zoomAtTimestamp=function(t,e,i){var n=ue(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},t.prototype.convertToPixel=function(t,e){var i,n=e.paneId,r=void 0===n?Bi.CANDLE:n,a=e.absolute,o=void 0!==a&&a,s=[];if(r!==Bi.X_AXIS){var l=this.getDrawPaneById(r);if(null!==l){var c=this._chartStore.getTimeScaleStore(),u=l.getBounding(),d=(new Array).concat(t),h=this._xAxisPane.getAxisComponent(),p=l.getAxisComponent();s=d.map(function(t){var e={},i=t.dataIndex;if(Tt(t.timestamp)&&(i=c.timestampToDataIndex(t.timestamp)),Tt(i)&&(e.x=null===h||void 0===h?void 0:h.convertToPixel(i)),Tt(t.value)){var n=null===p||void 0===p?void 0:p.convertToPixel(t.value);e.y=o?u.top+n:n}return e})}}return St(t)?s:null!==(i=s[0])&&void 0!==i?i:{}},t.prototype.convertFromPixel=function(t,e){var i,n=e.paneId,r=void 0===n?Bi.CANDLE:n,a=e.absolute,o=void 0!==a&&a,s=[];if(r!==Bi.X_AXIS){var l=this.getDrawPaneById(r);if(null!==l){var c=this._chartStore.getTimeScaleStore(),u=l.getBounding(),d=(new Array).concat(t),h=this._xAxisPane.getAxisComponent(),p=l.getAxisComponent();s=d.map(function(t){var e,i,n={};if(Tt(t.x)){var r=null!==(e=null===h||void 0===h?void 0:h.convertFromPixel(t.x))&&void 0!==e?e:-1;n.dataIndex=r,n.timestamp=null!==(i=c.dataIndexToTimestamp(r))&&void 0!==i?i:void 0}if(Tt(t.y)){var a=o?t.y-u.top:t.y;n.value=p.convertFromPixel(a)}return n})}}return St(t)?s:null!==(i=s[0])&&void 0!==i?i:{}},t.prototype.executeAction=function(t,e){var i;switch(t){case Pt.OnCrosshairChange:var n=X({},e);n.paneId=null!==(i=n.paneId)&&void 0!==i?i:Bi.CANDLE,this._chartStore.getTooltipStore().setCrosshair(n);break}},t.prototype.subscribeAction=function(t,e){this._chartStore.getActionStore().subscribe(t,e)},t.prototype.unsubscribeAction=function(t,e){this._chartStore.getActionStore().unsubscribe(t,e)},t.prototype.getConvertPictureUrl=function(t,e,i){var n=this,r=this._chartContainer.clientWidth,a=this._chartContainer.clientHeight,o=ce("canvas",{width:"".concat(r,"px"),height:"".concat(a,"px"),boxSizing:"border-box"}),s=o.getContext("2d"),l=$t(o);o.width=r*l,o.height=a*l,s.scale(l,l),s.fillStyle=null!==i&&void 0!==i?i:"#FFFFFF",s.fillRect(0,0,r,a);var c=null!==t&&void 0!==t&&t;return this._drawPanes.forEach(function(t){var e=n._separatorPanes.get(t);if(Mt(e)){var i=e.getBounding();s.drawImage(e.getImage(c),i.left,i.top,i.width,i.height)}var a=t.getBounding();s.drawImage(t.getImage(c),0,a.top,r,a.height)}),o.toDataURL("image/".concat(null!==e&&void 0!==e?e:"jpeg"))},t.prototype.resize=function(){this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.destroy=function(){this._chartEvent.destroy(),this._drawPanes.forEach(function(t){t.destroy()}),this._drawPanes=[],this._separatorPanes.forEach(function(t){t.destroy()}),this._separatorPanes.clear(),this._container.removeChild(this._chartContainer)},t}(),wr=new Map,Cr=1;function Sr(t,e){var i;if(_t(),i=Et(t)?document.getElementById(t):t,null===i)return xt("","","The chart cannot be initialized correctly. Please check the parameters. The chart container cannot be null and child elements need to be added!!!"),null;var n=wr.get(i.id);if(Mt(n))return bt("","","The chart has been initialized on the dom!!!"),n;var r="k_line_chart_".concat(Cr++);return n=new _r(i,e),n.id=r,i.setAttribute("k-line-chart-id",r),wr.set(r,n),n}var kr=i(21396),Ar=i.n(kr);function Tr(t,e,i,n){if(!t||!e||!i||!n)return t;try{var r=Ar().enc.Base64.parse(t),a=Ar().lib.WordArray.create(r.words.slice(0,4)),o=Ar().lib.WordArray.create(r.words.slice(4)),s=Ar().enc.Base64.parse(n),l=Ar().AES.decrypt({ciphertext:o},s,{iv:a,mode:Ar().mode.CBC,padding:Ar().pad.Pkcs7}),c=l.toString(Ar().enc.Utf8);return c||t}catch(u){return t}}function Mr(t,e){return Ir.apply(this,arguments)}function Ir(){return Ir=(0,c.A)((0,l.A)().m(function t(e,i){var n,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e&&i){t.n=1;break}throw new Error("用户ID和指标ID不能为空");case 1:return t.p=1,t.n=2,(0,f.Ay)({url:"/api/indicator/getDecryptKey",method:"post",data:{userid:e,indicatorId:i}});case 2:if(n=t.v,1!==n.code||!n.data||!n.data.key){t.n=3;break}return t.a(2,n.data.key);case 3:throw new Error(n.msg||"获取解密密钥失败");case 4:t.n=6;break;case 5:throw t.p=5,r=t.v,new Error("无法获取解密密钥,请检查网络连接或联系管理员: "+(r.message||"未知错误"));case 6:return t.a(2)}},t,null,[[1,5]])})),Ir.apply(this,arguments)}function Er(t,e,i){return Dr.apply(this,arguments)}function Dr(){return Dr=(0,c.A)((0,l.A)().m(function t(e,i,n){var r;return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:return t.n=1,Mr(i,n);case 1:return r=t.v,t.a(2,Tr(e,i,n,r))}},t)})),Dr.apply(this,arguments)}function Pr(t,e){if(1===e||!0===e)return!0;if(t&&t.length>100)try{var i=atob(t);if(i.length>50)return!0}catch(n){}return!1}var Lr={name:"KlineChart",props:{symbol:{type:String,default:""},market:{type:String,default:""},timeframe:{type:String,default:"1H"},theme:{type:String,default:"light"},activeIndicators:{type:Array,default:function(){return[]}},realtimeEnabled:{type:Boolean,default:!1},userId:{type:Number,default:null}},emits:["retry","price-change","load","indicator-toggle"],setup:function(t,e){var i=e.emit,n=(0,h.IJ)([]),r=(0,h.KR)(!1),a=(0,h.KR)(null),s=(0,h.KR)(!1),u=(0,h.KR)(!0),p=null,v=(0,h.KR)(!1),g=(0,h.IJ)(null),m=(0,h.KR)(t.theme||"light"),y=(0,h.KR)(null),x=(0,h.KR)(5e3),_=(0,h.KR)(!1),w=(0,h.KR)(1e4),C=(0,h.KR)(0),S=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(g.value){var e=Date.now(),i=Number(w.value||1e4);(t||!C.value||e-C.value>=i)&&(C.value=e,_t())}},k=(0,h.KR)([]),A=(0,h.KR)([]),T=(0,h.KR)([]),M=(0,h.KR)(null),I=(0,h.nI)(),E=I.proxy,D=(0,h.EW)(function(){return[{name:"line",title:E.$t("dashboard.indicator.drawing.line"),icon:"line"},{name:"horizontalLine",title:E.$t("dashboard.indicator.drawing.horizontalLine"),icon:"minus"},{name:"verticalLine",title:E.$t("dashboard.indicator.drawing.verticalLine"),icon:"column-width"},{name:"ray",title:E.$t("dashboard.indicator.drawing.ray"),icon:"arrow-right"},{name:"straightLine",title:E.$t("dashboard.indicator.drawing.straightLine"),icon:"menu"},{name:"parallelStraightLine",title:E.$t("dashboard.indicator.drawing.parallelLine"),icon:"menu"},{name:"priceLine",title:E.$t("dashboard.indicator.drawing.priceLine"),icon:"dollar"},{name:"priceChannelLine",title:E.$t("dashboard.indicator.drawing.priceChannel"),icon:"border"},{name:"fibonacciLine",title:E.$t("dashboard.indicator.drawing.fibonacciLine"),icon:"rise"},{name:"measure",title:E.$t("dashboard.indicator.drawing.measure"),icon:"drag"}]}),F=(0,h.KR)([{id:"sma",name:"SMA (简单移动平均)",shortName:"SMA",type:"line",defaultParams:{length:20}},{id:"ema",name:"EMA (指数移动平均)",shortName:"EMA",type:"line",defaultParams:{length:20}},{id:"rsi",name:"RSI (相对强弱)",shortName:"RSI",type:"line",defaultParams:{length:14}},{id:"macd",name:"MACD",shortName:"MACD",type:"macd",defaultParams:{fast:12,slow:26,signal:9}},{id:"bb",name:"布林带 (Bollinger Bands)",shortName:"BB",type:"band",defaultParams:{length:20,mult:2}},{id:"atr",name:"ATR (平均真实波幅)",shortName:"ATR",type:"line",defaultParams:{period:14}},{id:"cci",name:"CCI (商品通道指数)",shortName:"CCI",type:"line",defaultParams:{length:20}},{id:"williams",name:"Williams %R (威廉指标)",shortName:"W%R",type:"line",defaultParams:{length:14}},{id:"mfi",name:"MFI (资金流量指标)",shortName:"MFI",type:"line",defaultParams:{length:14}},{id:"adx",name:"ADX (平均趋向指数)",shortName:"ADX",type:"adx",defaultParams:{length:14}},{id:"obv",name:"OBV (能量潮)",shortName:"OBV",type:"line",defaultParams:{}},{id:"adosc",name:"ADOSC (积累/派发振荡器)",shortName:"ADOSC",type:"line",defaultParams:{fast:3,slow:10}},{id:"ad",name:"AD (积累/派发线)",shortName:"AD",type:"line",defaultParams:{}},{id:"kdj",name:"KDJ (随机指标)",shortName:"KDJ",type:"line",defaultParams:{period:9,k:3,d:3}}]),B=function(e){return t.activeIndicators.some(function(t){return t.id===e})},N=function(t){if(g.value){var e={line:"segment",horizontalLine:"horizontalStraightLine",verticalLine:"verticalStraightLine",ray:"rayLine",straightLine:"straightLine",parallelStraightLine:"parallelStraightLine",priceLine:"priceLine",priceChannelLine:"priceChannelLine",fibonacciLine:"fibonacciLine",measure:"priceRangeMeasure"},i=e[t]||t;if(M.value!==t){M.value=t;try{var n=["priceRangeMeasure"];if(n.includes(i)){if("function"!==typeof g.value.overrideOverlay)return void(M.value=null);g.value.overrideOverlay({name:i,lock:!1})}else{var r={name:i,lock:!1,extendData:{isDrawing:!0}},a=g.value.createOverlay(r);a?T.value.push(a):M.value=null}}catch(o){M.value=null}}else{M.value=null;try{"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(s){}}}},O=function(){if(g.value)try{T.value.forEach(function(t){try{"function"===typeof g.value.removeOverlay?g.value.removeOverlay(t):"function"===typeof g.value.removeOverlayById&&g.value.removeOverlayById(t)}catch(e){}}),T.value=[],M.value=null,"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(t){}},z=function(t){var e=B(t.id);if(e)i("indicator-toggle",{action:"remove",indicator:{id:t.id}});else{var n=(0,d.A)((0,d.A)({},t),{},{params:(0,d.A)({},t.defaultParams),calculate:null});i("indicator-toggle",{action:"add",indicator:n})}},W=(0,h.KR)(null),$=(0,h.KR)(!1),H=(0,h.KR)(!1),V=(0,h.KR)(!1),K=(0,h.EW)(function(){return"dark"===m.value?{backgroundColor:"#131722",textColor:"#d1d4dc",textColorSecondary:"#787b86",borderColor:"#2a2e39",gridLineColor:"#1f2943",gridLineColorDashed:"#363c4e",tooltipBg:"rgba(25, 27, 32, 0.95)",tooltipBorder:"#333",tooltipText:"#ccc",tooltipTextSecondary:"#888",axisLabelColor:"#787b86",splitAreaColor:["rgba(250,250,250,0.05)","rgba(200,200,200,0.02)"],dataZoomBorder:"#2a2e39",dataZoomFiller:"rgba(41, 98, 255, 0.15)",dataZoomHandle:"#13c2c2",dataZoomText:"transparent",dataZoomBg:"#1f2943"}:{backgroundColor:"#fff",textColor:"#333",textColorSecondary:"#666",borderColor:"#e8e8e8",gridLineColor:"#e8e8e8",gridLineColorDashed:"#e8e8e8",tooltipBg:"rgba(255, 255, 255, 0.95)",tooltipBorder:"#e8e8e8",tooltipText:"#333",tooltipTextSecondary:"#666",axisLabelColor:"#666",splitAreaColor:["rgba(250,250,250,0.05)","rgba(200,200,200,0.02)"],dataZoomBorder:"#e8e8e8",dataZoomFiller:"rgba(24, 144, 255, 0.15)",dataZoomHandle:"#1890ff",dataZoomText:"#999",dataZoomBg:"#f0f2f5"}}),Y=function(t){return"dark"===m.value?["#13c2c2","#e040fb","#ffeb3b","#00e676","#ff6d00","#9c27b0"][t%6]:["#13c2c2","#9c27b0","#f57c00","#1976d2","#c2185b","#7b1fa2"][t%6]},X=function(){return new Promise(function(t,e){if(window.pyodide)return W.value=window.pyodide,H.value=!0,void t(window.pyodide);$.value=!0;var i="0.25.0",n=function(t){return t&&t.endsWith("/")?t:t?t+"/":t},r="/assets/pyodide/v".concat(i,"/full/"),a="https://cdn.jsdelivr.net/pyodide/v".concat(i,"/full/"),o=n({NODE_ENV:"production",VUE_APP_API_BASE_URL:"/api",VUE_APP_PREVIEW:"false",BASE_URL:"/"}.VUE_APP_PYODIDE_LOCAL_BASE||r),s=n({NODE_ENV:"production",VUE_APP_API_BASE_URL:"/api",VUE_APP_PREVIEW:"false",BASE_URL:"/"}.VUE_APP_PYODIDE_CDN_BASE||a),u=({NODE_ENV:"production",VUE_APP_API_BASE_URL:"/api",VUE_APP_PREVIEW:"false",BASE_URL:"/"}.VUE_APP_PYODIDE_PREFER_CDN||"").toString().toLowerCase(),d=!u||("true"===u||"1"===u||"yes"===u),h=function(t){return new Promise(function(e,i){var n=document.querySelector('script[data-pyodide-src="'.concat(t,'"]'));if(n)return"function"===typeof window.loadPyodide?e():(n.addEventListener("load",function(){return e()},{once:!0}),void n.addEventListener("error",function(){return i(new Error("Pyodide 脚本加载失败"))},{once:!0}));var r=document.createElement("script");r.dataset.pyodideSrc=t,r.src=t,r.onload=function(){return e()},r.onerror=function(){return i(new Error("Pyodide 脚本加载失败"))},document.head.appendChild(r)})},p=function(){var e=(0,c.A)((0,l.A)().m(function e(i){return(0,l.A)().w(function(e){while(1)switch(e.n){case 0:if("function"===typeof window.loadPyodide){e.n=1;break}throw new Error("loadPyodide 函数未找到");case 1:return e.n=2,window.loadPyodide({indexURL:i});case 2:return window.pyodide=e.v,e.n=3,window.pyodide.loadPackage(["pandas","numpy"]);case 3:W.value=window.pyodide,H.value=!0,$.value=!1,t(window.pyodide);case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}();(0,c.A)((0,l.A)().m(function t(){var e,i,n;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e=function(){var t=(0,c.A)((0,l.A)().m(function t(e){return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:return t.n=1,h(e+"pyodide.js");case 1:return t.n=2,p(e);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),t.p=1,!d){t.n=3;break}return t.n=2,e(s);case 2:t.n=4;break;case 3:return t.n=4,e(o);case 4:t.n=9;break;case 5:return t.p=5,i=t.v,t.p=6,t.n=7,e(d?o:s);case 7:t.n=9;break;case 8:throw t.p=8,n=t.v,n||i;case 9:return t.a(2)}},t,null,[[6,8],[1,5]])}))().catch(function(t){$.value=!1,V.value=!0,e(t)})})},U=function(t){if(!t||"string"!==typeof t)return null;try{var e={},i=t.match(/(\w+)\s*=\s*(\d+\.?\d*)/g);return i&&i.forEach(function(t){var i=t.split("=");if(2===i.length){var n=i[0].trim(),r=parseFloat(i[1].trim());isNaN(r)||(e[n]=r)}}),{params:e,plots:[],success:!0}}catch(n){return{params:{},plots:[],success:!1}}},G=function(){var e=(0,c.A)((0,l.A)().m(function e(i,n){var r,a,s,c,u,d,h,p,f,v,g,m,y,b,x,_,w,C,S=arguments;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(r=S.length>2&&void 0!==S[2]?S[2]:{},a=S.length>3&&void 0!==S[3]?S[3]:{},H.value&&W.value){e.n=5;break}if(!$.value){e.n=4;break}s=0;case 1:if(!($.value&&s<30)){e.n=4;break}return e.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:if(s++,!H.value||!W.value){e.n=3;break}return e.a(3,4);case 3:e.n=1;break;case 4:if(H.value&&W.value){e.n=5;break}throw $.value?($.value=!1,V.value=!0):V.value=!0,new Error("Python 引擎未就绪,请等待加载完成");case 5:if(e.p=5,c=i,u=a.is_encrypted||a.isEncrypted||0,!u&&!Pr(i,u)){e.n=11;break}if(d=a.user_id||a.userId||t.userId||r.userId,h=a.originalId||a.id||r.indicatorId,!d||!h){e.n=10;break}return e.p=6,e.n=7,Er(c,d,h);case 7:c=e.v,e.n=9;break;case 8:throw e.p=8,_=e.v,new Error("代码解密失败,无法执行指标: "+(_.message||"未知错误"));case 9:e.n=11;break;case 10:throw new Error("缺少必要的解密参数(用户ID或指标ID),无法执行加密指标");case 11:return p=n.map(function(t){var e=t.timestamp||t.time;return e<1e10&&(e*=1e3),{time:Math.floor(e/1e3),open:parseFloat(t.open)||0,high:parseFloat(t.high)||0,low:parseFloat(t.low)||0,close:parseFloat(t.close)||0,volume:parseFloat(t.volume)||0}}),f=JSON.stringify(p),v=JSON.stringify(r||{}),g=f.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),m=v.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),y="\nimport json\nimport pandas as pd\nimport numpy as np\n\n# 递归清理 NaN 值的函数\ndef clean_nan(obj):\n if isinstance(obj, dict):\n return {k: clean_nan(v) for k, v in obj.items()}\n elif isinstance(obj, list):\n return [clean_nan(item) for item in obj]\n elif isinstance(obj, (pd.Series, np.ndarray)):\n return [None if (isinstance(x, float) and (np.isnan(x) or np.isinf(x))) else x for x in obj]\n elif isinstance(obj, (float, np.floating)):\n if np.isnan(obj) or np.isinf(obj):\n return None\n return float(obj)\n elif pd.isna(obj):\n return None\n else:\n return obj\n\n# 接收 JSON 数据\nraw_data = json.loads('".concat(g,"')\nparams = json.loads('").concat(m,"')\n\n# 将前端参数注入为指标代码可直接使用的变量(对齐回测/实盘执行环境)\n# 兼容多种命名(snake_case / camelCase\ndef _get_param(key, default=None):\n if key in params:\n return params.get(key, default)\n # camelCase fallback\n camel = ''.join([key.split('_')[0]] + [p.capitalize() for p in key.split('_')[1:]])\n return params.get(camel, default)\n\ntry:\n leverage = float(_get_param('leverage', 1) or 1)\nexcept Exception:\n leverage = 1\n\ntrade_direction = _get_param('trade_direction', _get_param('tradeDirection', 'both')) or 'both'\n\ntry:\n initial_position = int(_get_param('initial_position', 0) or 0)\nexcept Exception:\n initial_position = 0\n\ntry:\n initial_avg_entry_price = float(_get_param('initial_avg_entry_price', 0.0) or 0.0)\nexcept Exception:\n initial_avg_entry_price = 0.0\n\ntry:\n initial_position_count = int(_get_param('initial_position_count', 0) or 0)\nexcept Exception:\n initial_position_count = 0\n\ntry:\n initial_last_add_price = float(_get_param('initial_last_add_price', 0.0) or 0.0)\nexcept Exception:\n initial_last_add_price = 0.0\n\ntry:\n initial_highest_price = float(_get_param('initial_highest_price', 0.0) or 0.0)\nexcept Exception:\n initial_highest_price = 0.0\n\n# 转换为 DataFrame\ndf = pd.DataFrame(raw_data)\n\n# 转换数据类型\ndf['open'] = df['open'].astype(float)\ndf['high'] = df['high'].astype(float)\ndf['low'] = df['low'].astype(float)\ndf['close'] = df['close'].astype(float)\ndf['volume'] = df['volume'].astype(float)\n\n# 用户代码(已解密)\n").concat(c,"\n\n# 构造输出(如果用户没有定义 output,则尝试从 result_json 获取)\nif 'output' not in locals():\n if 'result_json' in locals():\n output = json.loads(result_json)\n else:\n output = {\"plots\": []}\nelse:\n # 确保 output 是字典格式\n if isinstance(output, str):\n output = json.loads(output)\n\n# 清理 output 中的所有 NaN 值\noutput = clean_nan(output)\n\n# 返回 JSON 字符串\njson.dumps(output)\n"),e.n=12,W.value.runPythonAsync(y);case 12:if(b=e.v,b&&"string"===typeof b){e.n=13;break}throw new Error("Python 代码执行后未返回有效的 JSON 字符串,返回类型: ".concat((0,o.A)(b)));case 13:e.p=13,x=JSON.parse(b),e.n=15;break;case 14:throw e.p=14,w=e.v,new Error("JSON 解析失败: ".concat(w.message,"。可能是数据中包含 NaN 或其他无效值。"));case 15:if(x){e.n=16;break}return e.a(2,{plots:[],signals:[],calculatedVars:{}});case 16:return x.plots&&Array.isArray(x.plots)||(x.plots=[]),x.plots=x.plots.map(function(t){return t.data&&Array.isArray(t.data)&&(t.data=t.data.map(function(t){return null===t||void 0===t||"number"===typeof t&&isNaN(t)?null:t})),t}),x.signals&&Array.isArray(x.signals)&&(x.signals=x.signals.map(function(t){return t.data&&Array.isArray(t.data)&&(t.data=t.data.map(function(t){return null===t||void 0===t||"number"===typeof t&&isNaN(t)?null:t})),t})),x.calculatedVars||(x.calculatedVars={}),e.a(2,x);case 17:throw e.p=17,C=e.v,new Error("Python 执行失败: ".concat(C.message));case 18:return e.a(2)}},e,null,[[13,14],[6,8],[5,17]])}));return function(t,i){return e.apply(this,arguments)}}();function j(t,e){for(var i=[],n=0;n<t.length;n++)if(n<e-1)i.push(null);else{for(var r=0,a=n-e+1;a<=n;a++)r+=t[a].close;i.push(r/e)}return i}function q(t,e){for(var i=[],n=2/(e+1),r=null,a=0;a<t.length;a++)r=0===a?t[a].close:(t[a].close-r)*n+r,i.push(r);return i}function Z(t,e,i){for(var n=[],r=0;r<t.length;r++)if(r<e-1)n.push(null);else{for(var a=0,o=r-e+1;o<=r;o++)a+=t[o].close;n.push(a/e)}for(var s=[],l=0;l<t.length;l++)if(l<e-1)s.push({upper:null,middle:null,lower:null});else{for(var c=0,u=l-e+1;u<=l;u++)c+=Math.pow(t[u].close-n[l],2);var d=Math.sqrt(c/e);s.push({upper:n[l]+i*d,middle:n[l],lower:n[l]-i*d})}return s}function J(t,e){for(var i=[],n=0;n<t.length;n++)if(0===n)i.push(t[n].high-t[n].low);else{var r=t[n].high-t[n].low,a=Math.abs(t[n].high-t[n-1].close),o=Math.abs(t[n].low-t[n-1].close);i.push(Math.max(r,a,o))}for(var s=[],l=0;l<t.length;l++)if(l<e-1)s.push(null);else{for(var c=0,u=l-e+1;u<=l;u++)c+=i[u];s.push(c/e)}return s}function Q(t,e){for(var i=[],n=function(){if(r<e-1)i.push(null);else{for(var n=[],a=r-e+1;a<=r;a++)n.push((t[a].high+t[a].low+t[a].close)/3);var o=n.reduce(function(t,e){return t+e},0)/e,s=n.reduce(function(t,e){return t+Math.abs(e-o)},0)/e,l=(t[r].high+t[r].low+t[r].close)/3,c=0===s?0:(l-o)/(.015*s);i.push(c)}},r=0;r<t.length;r++)n();return i}function tt(t,e){for(var i=[],n=0;n<t.length;n++)if(n<e-1)i.push(null);else{for(var r=-1/0,a=1/0,o=n-e+1;o<=n;o++)r=Math.max(r,t[o].high),a=Math.min(a,t[o].low);var s=r-a===0?-50:(r-t[n].close)/(r-a)*-100;i.push(s)}return i}function et(t,e){for(var i=[],n=0;n<t.length;n++)if(n<e)i.push(null);else{for(var r=0,a=0,o=n-e+1;o<=n;o++){var s=(t[o].high+t[o].low+t[o].close)/3,l=s*t[o].volume;if(o>n-e+1){var c=(t[o-1].high+t[o-1].low+t[o-1].close)/3;s>c?r+=l:s<c&&(a+=l)}}var u=0===a?100:r/a,d=100-100/(1+u);i.push(d)}return i}function it(t,e){for(var i=[],n=[],r=[],a=[],o=[],s=[],l=0;l<t.length;l++)if(0===l)a.push(t[l].high-t[l].low),o.push(0),s.push(0);else{var c=t[l].high-t[l].low,u=Math.abs(t[l].high-t[l-1].close),d=Math.abs(t[l].low-t[l-1].close);a.push(Math.max(c,u,d));var h=t[l].high-t[l-1].high,p=t[l-1].low-t[l].low;h>p&&h>0?o.push(h):o.push(0),p>h&&p>0?s.push(p):s.push(0)}for(var f=[],v=[],g=[],m=0;m<t.length;m++){if(m<e-1)f.push(null),v.push(null),g.push(null),i.push(null),n.push(null),r.push(null);else if(m===e-1){for(var y=0,b=0,x=0,_=0;_<=m;_++)y+=a[_],b+=o[_],x+=s[_];f.push(y),v.push(b),g.push(x)}else f.push(f[m-1]-f[m-1]/e+a[m]),v.push(v[m-1]-v[m-1]/e+o[m]),g.push(g[m-1]-g[m-1]/e+s[m]);if(m>=e-1){var w=f[m],C=v[m],S=g[m];if(0===w?(i.push(0),n.push(0)):(i.push(C/w*100),n.push(S/w*100)),m>=e-1){var k=i[m]+n[m],A=0===k?0:Math.abs(i[m]-n[m])/k*100;if(m===e-1)r.push(A);else if(m===e){var T=Math.abs(i[m-1]-n[m-1])/(i[m-1]+n[m-1])*100;r.push((T+A)/2)}else r.push((r[m-1]*(e-1)+A)/e)}}}return{adx:r,plusDI:i,minusDI:n}}function nt(t){for(var e=[],i=0,n=0;n<t.length;n++)0===n?i=t[n].volume:t[n].close>t[n-1].close?i+=t[n].volume:t[n].close<t[n-1].close&&(i-=t[n].volume),e.push(i);return e}function rt(t){for(var e=[],i=0,n=0;n<t.length;n++){var r=t[n].high,a=t[n].low,o=t[n].close,s=t[n].volume;if(r!==a){var l=(o-a-(r-o))/(r-a);i+=l*s}e.push(i)}return e}function at(t,e,i){for(var n=rt(t),r=[],a=[],o=[],s=2/(e+1),l=2/(i+1),c=n[0],u=n[0],d=0;d<n.length;d++)0===d?(r.push(n[0]),a.push(n[0]),o.push(0)):(c=(n[d]-c)*s+c,u=(n[d]-u)*l+u,r.push(c),a.push(u),o.push(c-u));return o}function ot(t,e,i,n){for(var r=[],a=[],o=[],s=0;s<t.length;s++)if(s<e-1)r.push(null),a.push(null),o.push(null);else{for(var l=-1/0,c=1/0,u=s-e+1;u<=s;u++)l=Math.max(l,t[u].high),c=Math.min(c,t[u].low);var d=l-c===0?50:(t[s].close-c)/(l-c)*100;null===r[s-1]?r.push(d):r.push((2*d+r[s-1]*(i-2))/i),null===a[s-1]?a.push(r[s]):a.push((2*r[s]+a[s-1]*(n-2))/n),o.push(3*r[s]-2*a[s])}return{k:r,d:a,j:o}}Pi({name:"signalTag",totalStep:1,lock:!0,needDefaultPointFigure:!1,needDefaultXAxisFigure:!1,needDefaultYAxisFigure:!1,checkEventOn:function(){return!1},createPointFigures:function(t){var e,i,n,r=t.coordinates,a=t.overlay,o=a.extendData||{},s=o.text,l=(null===(e=a.extendData)||void 0===e?void 0:e.color)||"#555555";if(!r[0])return[];var c=r[0].x,u=r[0].y,d=r[1]?r[1].y:u,h=8,p=4,f=12,v=String(s||""),g=v.split("").reduce(function(t,e){return t+(e.charCodeAt(0)>255?12:7)},0),m=g+2*h,y=f+2*p,b=(null===(i=a.extendData)||void 0===i?void 0:i.side)||(null===(n=a.extendData)||void 0===n?void 0:n.type)||"buy",x="buy"===b,_=x?u:u-y,w=d,C=w,S=x?_:_+y;return[{type:"line",attrs:{coordinates:[{x:c,y:C},{x:c,y:S}]},styles:{style:"stroke",color:l,dashedValue:[2,2]},ignoreEvent:!0},{type:"circle",attrs:{x:c,y:w,r:4},styles:{style:"fill",color:l},ignoreEvent:!0},{type:"rect",attrs:{x:c-m/2,y:_,width:m,height:y,r:4},styles:{style:"fill",color:l,borderSize:0},ignoreEvent:!0},{type:"text",attrs:{x:c,y:_+y/2,text:v,align:"center",baseline:"middle"},styles:{color:"#ffffff",size:f,weight:"bold",backgroundColor:l,borderRadius:5},ignoreEvent:!0}]}}),Pi({name:"priceRangeMeasure",totalStep:2,lock:!1,needDefaultPointFigure:!1,needDefaultXAxisFigure:!1,needDefaultYAxisFigure:!1,createPointFigures:function(t){var e=t.coordinates,i=t.overlay,n=t.ctx;if(!e[0]||!e[1])return[];var r=i.points[0],a=i.points[1];if(!r||!a)return[];var o=r.value,s=a.value,l=s-o,c=l/o*100,u=r.timestamp,d=a.timestamp,h=Math.abs(d-u),p="",f=Math.floor(h/864e5),v=Math.floor(h%864e5/36e5),g=Math.floor(h%36e5/6e4),m=Math.floor(h%6e4/1e3);p=f>0?"".concat(f,"天").concat(v>0?v+"小时":""):v>0?"".concat(v,"小时").concat(g>0?g+"分钟":""):g>0?"".concat(g,"分钟"):"".concat(m,"秒");var y=0;try{if(n&&n.chart){var b=n.chart.getData();if(b&&Array.isArray(b)&&b.length>0){var x=b.findIndex(function(t){return Math.abs(t.timestamp-u)<1e3}),_=b.findIndex(function(t){return Math.abs(t.timestamp-d)<1e3});x>=0&&_>=0&&(y=Math.abs(_-x))}}}catch(z){}var w=c>=0?"+".concat(c.toFixed(2),"%"):"".concat(c.toFixed(2),"%"),C=l>=0?"+".concat(l.toFixed(2)):"".concat(l.toFixed(2)),S="".concat(w," ").concat(C);y>0?(S+=" (".concat(y,"根"),p&&(S+=" / ".concat(p)),S+=")"):p&&(S+=" (".concat(p,")"));var k=l>=0,A=k?"#0ecb81":"#f6465d",T=k?"#0ecb81":"#f6465d",M=k?"rgba(14, 203, 129, 0.1)":"rgba(246, 70, 93, 0.1)",I=e[0].x,E=e[0].y,D=e[1].x,P=e[1].y,L=(I+D)/2,R=(E+P)/2,F=-20,B=12,N=7*S.length+16,O=B+8;return[{type:"line",attrs:{coordinates:[{x:I,y:E},{x:D,y:P}]},styles:{style:"stroke",color:A,size:2,dashedValue:[4,4]},ignoreEvent:!1},{type:"circle",attrs:{x:I,y:E,r:4},styles:{style:"fill",color:A},ignoreEvent:!1},{type:"circle",attrs:{x:D,y:P,r:4},styles:{style:"fill",color:A},ignoreEvent:!1},{type:"rect",attrs:{x:L-N/2,y:R+F-O/2,width:N,height:O,r:4},styles:{style:"fill",color:M,borderSize:1,borderColor:A},ignoreEvent:!1},{type:"text",attrs:{x:L,y:R+F,text:S,align:"center",baseline:"middle"},styles:{color:T,size:B,weight:"bold"},ignoreEvent:!1}]}});var st=function(t){return t.map(function(t){var e=t.time||t.timestamp;return"string"===typeof e&&(e=parseInt(e)),e<1e10&&(e*=1e3),{timestamp:e,open:parseFloat(t.open),high:parseFloat(t.high),low:parseFloat(t.low),close:parseFloat(t.close),volume:parseFloat(t.volume||0)}}).filter(function(t){return t.timestamp&&!isNaN(t.open)&&!isNaN(t.high)&&!isNaN(t.low)&&!isNaN(t.close)}).sort(function(t,e){return t.timestamp-e.timestamp})},lt=function(t){if(t.length>0){var e=t[t.length-1];if(t.length>1){var n=t[t.length-2],r=e.close.toFixed(2),a=(e.close-n.close)/n.close*100;i("price-change",{price:r,change:a})}else{var o=e.close.toFixed(2);i("price-change",{price:o,change:0})}}},ct=function(t){return t.map(function(t){return{time:Math.floor(t.timestamp/1e3),open:t.open,high:t.high,low:t.low,close:t.close,volume:t.volume}})},ut=function(t,e,i){var n=new Date(1e3*t),r=new Date(1e3*e);switch(i){case"1m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes();case"5m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&Math.floor(n.getMinutes()/5)===Math.floor(r.getMinutes()/5);case"15m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&Math.floor(n.getMinutes()/15)===Math.floor(r.getMinutes()/15);case"30m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&Math.floor(n.getMinutes()/30)===Math.floor(r.getMinutes()/30);case"1H":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours();case"4H":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&Math.floor(n.getHours()/4)===Math.floor(r.getHours()/4);case"1D":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate();case"1W":var a=Math.floor((n.getTime()-new Date(n.getFullYear(),0,1).getTime())/6048e5),o=Math.floor((r.getTime()-new Date(r.getFullYear(),0,1).getTime())/6048e5);return n.getFullYear()===r.getFullYear()&&a===o;default:return t===e}},dt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var i,o,s,c,d,p,v,m=arguments;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(i=m.length>0&&void 0!==m[0]&&m[0],t.symbol){e.n=1;break}return e.a(2);case 1:if(!r.value||i){e.n=2;break}return e.a(2);case 2:return r.value=!0,a.value=null,e.p=3,o=[],e.p=4,e.n=5,(0,f.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500}});case 5:if(s=e.v,1!==s.code||!s.data||!Array.isArray(s.data)){e.n=6;break}o=st(s.data),e.n=7;break;case 6:throw c=s.msg||"获取K线数据失败","tiingo_subscription"===s.hint&&(c=E.$t("dashboard.indicator.error.tiingoSubscription")||"Forex 1-minute data requires Tiingo paid subscription"),new Error(c);case 7:e.n=9;break;case 8:throw e.p=8,p=e.v,p;case 9:if(o&&0!==o.length){e.n=10;break}throw new Error("未获取到K线数据");case 10:n.value=o,u.value=!0,d=ct(o),lt(d),(0,h.dY)(function(){if(g.value){var e=n.value.filter(function(t){return t.timestamp&&!isNaN(t.open)&&!isNaN(t.high)&&!isNaN(t.low)&&!isNaN(t.close)});if(e.length>0&&g.value){try{g.value.applyNewData(e)}catch(i){g.value.applyNewData(e)}setTimeout(function(){g.value&&_t()},100)}}else mt();t.realtimeEnabled&&(gt(),vt())}),e.n=12;break;case 11:if(e.p=11,v=e.v,a.value=E.$t("dashboard.indicator.error.loadDataFailed")+": "+(v.message||E.$t("dashboard.indicator.error.loadDataFailedDesc")),n.value=[],g.value)try{g.value.applyNewData([])}catch(l){}case 12:return e.p=12,r.value=!1,e.f(12);case 13:return e.a(2)}},e,null,[[4,8],[3,11,12,13]])}));return function(){return e.apply(this,arguments)}}(),ht=function(){var e=(0,c.A)((0,l.A)().m(function e(i){return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&n.value&&0!==n.value.length){e.n=1;break}return e.a(2);case 1:if(!s.value&&!p){e.n=6;break}if(!p){e.n=5;break}return e.p=2,e.n=3,p;case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2);case 6:if(u.value){e.n=7;break}return g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData(),e.a(2);case 7:return s.value=!0,p=(0,c.A)((0,l.A)().m(function e(){var r,a,o,c,d,v;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,h.dY)();case 1:return e.p=1,r=Math.floor(i/1e3),e.n=2,(0,f.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500,before_time:r}});case 2:if(a=e.v,1!==a.code||!a.data||!Array.isArray(a.data)){e.n=5;break}if(o=st(a.data),0!==o.length){e.n=3;break}return u.value=!1,g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData(),e.a(2);case 3:if(c=o.filter(function(t){return t.timestamp<i}),0!==c.length){e.n=4;break}return u.value=!1,g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData(),e.a(2);case 4:d=null;try{g.value&&"function"===typeof g.value.getVisibleRange&&(d=g.value.getVisibleRange())}catch(l){}v=c.length,n.value=[].concat((0,R.A)(c),(0,R.A)(n.value)),(0,h.dY)(function(){if(g.value){if(g.value.applyNewData(n.value),d&&"number"===typeof d.from){var t=d.from+v,e=d.to+v;setTimeout(function(){try{g.value&&("function"===typeof g.value.scrollToDataIndex?g.value.scrollToDataIndex(t):"function"===typeof g.value.setVisibleRange&&g.value.setVisibleRange(t,e))}catch(l){}},50)}_t()}}),e.n=6;break;case 5:g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData();case 6:e.n=8;break;case 7:e.p=7,e.v,g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData();case 8:return e.p=8,s.value=!1,p=null,e.f(8);case 9:return e.a(2)}},e,null,[[1,7,8,9]])}))(),e.p=8,e.n=9,p;case 9:e.n=11;break;case 10:e.p=10,e.v;case 11:return e.a(2)}},e,null,[[8,10],[2,4]])}));return function(t){return e.apply(this,arguments)}}(),pt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var i,r,a,o,c;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&n.value&&0!==n.value.length){e.n=1;break}return e.a(2);case 1:if(!s.value&&u.value){e.n=2;break}return e.a(2);case 2:return s.value=!0,e.p=3,i=n.value[0].timestamp,r=Math.floor(i/1e3),e.n=4,(0,f.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500,before_time:r}});case 4:if(a=e.v,1!==a.code||!a.data||!Array.isArray(a.data)){e.n=7;break}if(o=st(a.data),0!==o.length){e.n=5;break}return u.value=!1,s.value=!1,e.a(2);case 5:if(c=o.filter(function(t){return t.timestamp<i}),0!==c.length){e.n=6;break}return u.value=!1,s.value=!1,e.a(2);case 6:n.value=[].concat((0,R.A)(c),(0,R.A)(n.value)),(0,h.dY)(function(){g.value&&(g.value.applyNewData(n.value),_t())}),e.n=7;break;case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:return e.p=9,s.value=!1,e.f(9);case 10:return e.a(2)}},e,null,[[3,8,9,10]])}));return function(){return e.apply(this,arguments)}}(),ft=function(){var e=(0,c.A)((0,l.A)().m(function e(){var i,r,a,o,s,c,u,d,h,p,v;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&n.value&&0!==n.value.length){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,(0,f.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:5}});case 2:i=e.v,1===i.code&&i.data&&Array.isArray(i.data)&&i.data.length>0&&(r=st(i.data),a=(0,R.A)(n.value),r.length>0&&(o=Math.floor(r[r.length-1].timestamp/1e3),s=Math.floor(a[a.length-1].timestamp/1e3),ut(o,s,t.timeframe)?(c=a[a.length-1],u=r[r.length-1],a[a.length-1]={timestamp:c.timestamp,open:c.open,high:Math.max(c.high,u.high),low:Math.min(c.low,u.low),close:u.close,volume:u.volume},n.value=a,d=ct(n.value),lt(d),g.value&&"function"===typeof g.value.updateData?(h=n.value.length-1,g.value.updateData(a[h]),S(!1)):g.value&&(g.value.applyNewData(n.value),S(!1))):o>s&&(p=r.filter(function(e){var i=Math.floor(e.timestamp/1e3);return!a.some(function(e){var n=Math.floor(e.timestamp/1e3);return ut(i,n,t.timeframe)})}),p.length>0&&(n.value=[].concat((0,R.A)(a),(0,R.A)(p)),n.value.length>500&&(n.value=n.value.slice(-500)),v=ct(n.value),lt(v),g.value&&"function"===typeof g.value.applyMoreData?(g.value.applyMoreData(p),S(!0)):g.value&&(g.value.applyNewData(n.value),S(!0)))))),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),vt=function(){y.value&&clearInterval(y.value);var e={"1m":5e3,"5m":1e4,"15m":15e3,"30m":3e4,"1H":6e4,"4H":3e5,"1D":6e5,"1W":18e5},i=e[t.timeframe]||1e4;x.value=Math.min(i,1e3),t.realtimeEnabled&&t.symbol&&n.value.length>0&&(y.value=setInterval(function(){!r.value&&t.symbol&&n.value&&n.value.length>0&&ft()},x.value))},gt=function(){y.value&&(clearInterval(y.value),y.value=null)},mt=function(){var t=document.getElementById("kline-chart-container");if(t)if(0!==t.clientWidth&&0!==t.clientHeight){if(g.value){try{g.value.destroy()}catch(y){}g.value=null}try{var e=document.getElementById("kline-chart-container");if(!e)throw new Error("容器元素不存在");try{g.value=Sr(e,{drawingBarVisible:!0,overlay:{visible:!0}})}catch(y){g.value=Sr(e)}if(g.value&&"function"===typeof g.value.setDrawingBarVisible?g.value.setDrawingBarVisible(!0):g.value&&"function"===typeof g.value.setDrawingBar?g.value.setDrawingBar(!0):g.value&&"function"===typeof g.value.enableDrawing&&g.value.enableDrawing(!0),!g.value)throw new Error("图表初始化失败:无法创建图表实例");if(g.value&&("function"===typeof g.value.setDrawingBarVisible&&g.value.setDrawingBarVisible(!0),"function"===typeof g.value.setDrawingBar&&g.value.setDrawingBar(!0),"function"===typeof g.value.enableDrawing&&g.value.enableDrawing(!0)),bt(),g.value&&"function"===typeof g.value.subscribeAction){if(g.value.subscribeAction("onOverlayCreated",function(t){if(M.value&&t&&t.id){var e={line:"segment",horizontalLine:"horizontalStraightLine",verticalLine:"verticalStraightLine",ray:"rayLine",straightLine:"straightLine",parallelStraightLine:"parallelStraightLine",priceLine:"priceLine",priceChannelLine:"priceChannelLine",fibonacciLine:"fibonacciLine",measure:"priceRangeMeasure"},i=e[M.value];if(!t.name||t.name===i||"priceRangeMeasure"===i){T.value.push(t.id),M.value=null;try{"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(y){}}}}),"function"===typeof g.value.subscribeAction)try{g.value.subscribeAction("onOverlayComplete",function(t){M.value&&t&&t.id&&(T.value.push(t.id),M.value=null)})}catch(y){}g.value.subscribeAction("onOverlayRemoved",function(t){var e=T.value.indexOf(t);e>-1&&T.value.splice(e,1)})}if(g.value&&"function"===typeof g.value.subscribeAction){var i=null,r=!1;g.value.subscribeAction("onVisibleRangeChange",function(){var t=(0,c.A)((0,l.A)().m(function t(e){var a,o,c,d,h,f;return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:if(!e||"number"!==typeof e.from){t.n=5;break}if(r){t.n=1;break}return i=e.from,r=!0,setTimeout(function(){v.value=!0},1e3),t.a(2);case 1:if(v.value){t.n=2;break}return i=e.from,t.a(2);case 2:if(!(s.value&&e.from<=0)){t.n=3;break}try{g.value&&"function"===typeof g.value.setVisibleRange&&(a=n.value.length,a>0&&(o=g.value.getVisibleRange(),o&&(c=Math.ceil((o.to-o.from)*a/100),d=.1,h=Math.min(100,d+c/a*100),g.value.setVisibleRange(d,h))))}catch(y){}return t.a(2);case 3:if(!(e.from<=5&&!s.value&&!p&&u.value&&v.value)){t.n=4;break}if(!(null!==i&&i>e.from)){t.n=4;break}if(!(n.value.length>0)){t.n=4;break}return f=n.value[0].timestamp,t.n=4,ht(f);case 4:i=e.from;case 5:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}if(n.value&&n.value.length>0){var o=n.value.filter(function(t){return t.timestamp&&!isNaN(t.open)&&!isNaN(t.high)&&!isNaN(t.low)&&!isNaN(t.close)});if(o.length>0){try{g.value.applyNewData(o)}catch(y){try{g.value.applyNewData(o)}catch(b){}}try{g.value.createIndicator("VOL",!1,{height:100,dragEnabled:!0})}catch(y){}(0,h.dY)(function(){_t()})}}window.addEventListener("resize",yt)}catch(a){a.value=E.$t("dashboard.indicator.error.chartInitFailed")+": "+(a.message||"未知错误")}}else{var d=0,f=10,m=function(){var t=document.getElementById("kline-chart-container");t&&t.clientWidth>0&&t.clientHeight>0?mt():d<f?(d++,setTimeout(m,200)):mt()};setTimeout(m,200)}},yt=function(){if(g.value)setTimeout(function(){g.value&&g.value.resize()},100);else{var t=document.getElementById("kline-chart-container");t&&t.clientWidth>0&&t.clientHeight>0&&mt()}},bt=function(){if(g.value){var t=K.value,e="dark"===m.value;g.value.setStyles({grid:{show:!0,horizontal:{show:!0,color:t.gridLineColor,style:"dashed",size:1},vertical:{show:!1}},candle:{priceMark:{show:!0,high:{show:!0,color:t.axisLabelColor},low:{show:!0,color:t.axisLabelColor}},tooltip:{showRule:"always",showType:"standard",labels:[E.$t("dashboard.indicator.tooltip.time"),E.$t("dashboard.indicator.tooltip.open"),E.$t("dashboard.indicator.tooltip.high"),E.$t("dashboard.indicator.tooltip.low"),E.$t("dashboard.indicator.tooltip.close"),E.$t("dashboard.indicator.tooltip.volume")],values:function(t){var e=new Date(t.timestamp);return["".concat(e.getFullYear(),"-").concat(e.getMonth()+1,"-").concat(e.getDate()," ").concat(e.getHours(),":").concat(e.getMinutes()),t.open.toFixed(2),t.high.toFixed(2),t.low.toFixed(2),t.close.toFixed(2),t.volume.toFixed(0)]}},bar:{upColor:e?"#0ecb81":"#13c2c2",downColor:e?"#f6465d":"#fa541c",noChangeColor:t.borderColor}},indicator:{tooltip:{showRule:"always",showType:"standard"}},xAxis:{show:!0,axisLine:{show:!0,color:t.borderColor}},yAxis:{show:!0,axisLine:{show:!1}},crosshair:{show:!0,horizontal:{show:!0,line:{show:!0,style:"dashed",color:t.gridLineColor,size:1}},vertical:{show:!0,line:{show:!0,style:"dashed",color:t.gridLineColor,size:1}}},watermark:{show:!1}})}},xt=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];try{var o={name:t,shortName:t,calc:e,figures:i,calcParams:n,precision:r,series:a?"price":"normal"};return Je(o),!0}catch(s){return!(!s.message||!s.message.includes("already registered"))}},_t=function(){var e=(0,c.A)((0,l.A)().m(function e(){var i,r,a,o;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!_.value){e.n=1;break}return e.a(2);case 1:if(g.value&&0!==n.value.length){e.n=2;break}return e.a(2);case 2:_.value=!0,e.p=3;try{A.value.length>0&&g.value&&(A.value.forEach(function(t){try{"function"===typeof g.value.removeOverlay?g.value.removeOverlay(t):"function"===typeof g.value.removeOverlayById&&g.value.removeOverlayById(t)}catch(e){}}),A.value=[])}catch(s){}try{k.value.length>0&&(k.value.forEach(function(t){var e="string"===typeof t?t:t.name,i="string"===typeof t?void 0:t.paneId;i?g.value.removeIndicator(i,e):(g.value.removeIndicator("candle_pane",e),g.value.removeIndicator(e))}),k.value=[])}catch(s){}i=ct(n.value),r=(0,l.A)().m(function e(){var n,r,a,s,c,u,d,h,p,f,v,m,y,x,_,w,C,S,T,M,I,E,D,P,F,B,N,O,z,W,H,K,X,U,st,lt,ct,ut,dt,ht,pt,ft,vt,gt,mt,yt,bt,_t,wt,Ct,St,kt,At,Tt,Mt,It,Et,Dt,Pt,Lt,Rt,Ft,Bt,Nt,Ot,zt,Wt,$t,Ht,Vt,Kt,Yt,Xt,Ut,Gt,jt,qt,Zt,Jt,Qt,te,ee,ie,ne,re,ae,oe,se,le,ce,ue,de,he,pe,fe,ve,ge,me,ye,be,xe,_e,we,Ce,Se,ke,Ae,Te,Me,Ie,Ee,De,Pe,Le,Re,Fe,Be,Ne,Oe,ze,We,$e,He,Ve,Ke,Ye,Xe,Ue,Ge,je,qe,Ze,Je,Qe,ti,ei,ii,ni,ri,ai,oi,si,li,ci,ui,di,hi,pi,fi,vi,gi,mi,yi,bi;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(n=t.activeIndicators[o],e.p=1,"python"!==n.type){e.n=31;break}if(n.code){e.n=2;break}return e.a(2,0);case 2:if(e.p=2,!n.calculate||"function"!==typeof n.calculate){e.n=15;break}return e.n=3,n.calculate(i,n.params||{});case 3:if(r=e.v,a=[],r&&r.plots&&Array.isArray(r.plots)&&(a=(0,R.A)(r.plots)),!(r&&r.signals&&Array.isArray(r.signals))){e.n=14;break}s=(0,b.A)(r.signals),e.p=4,s.s();case 5:if((c=s.n()).done){e.n=11;break}if(u=c.value,!(u.data&&Array.isArray(u.data)&&u.data.length>0)){e.n=10;break}for(d=[],h=0;h<Math.min(u.data.length,20);h++)p=u.data[h],null===p||void 0===p||isNaN(p)||d.length<5&&d.push({index:h,value:p});f=[],v=0;case 6:if(!(v<u.data.length&&v<i.length)){e.n=9;break}if(m=u.data[v],null===m||void 0===m||isNaN(m)){e.n=8;break}if(y=i[v],x=y.timestamp||y.time,_=y.high,w=y.low,C=u.type||"buy",S=String(C).toLowerCase(),T=["buy","sell"],T.includes(S)){e.n=7;break}return e.a(3,8);case 7:M="buy"===S,I=u.text||(M?"B":"S"),u.textData&&null!=u.textData[v]&&(I=u.textData[v]),f.push({timestamp:x,price:m,anchorPrice:M?w:_,side:M?"buy":"sell",action:S,color:u.color||(M?"#00E676":"#FF5252"),text:I});case 8:v++,e.n=6;break;case 9:if(f.length>0&&g.value){E=(0,b.A)(f);try{for(E.s();!(D=E.n()).done;){P=D.value;try{F=P.timestamp,F<1e10&&(F*=1e3),B=P.text,"function"===typeof g.value.createOverlay&&(N=g.value.createOverlay({name:"signalTag",points:[{timestamp:F,value:P.price},{timestamp:F,value:P.anchorPrice}],extendData:{text:B,color:P.color,side:P.side,action:P.action,price:P.price},lock:!0},"candle_pane"),N&&A.value.push(N))}catch(l){}}}catch(xi){E.e(xi)}finally{E.f()}}case 10:e.n=5;break;case 11:e.n=13;break;case 12:e.p=12,mi=e.v,s.e(mi);case 13:return e.p=13,s.f(),e.f(13);case 14:if(a.length>0&&(O=a.filter(function(t){return t.data&&Array.isArray(t.data)&&t.data.length>0}),O.length>0)){for(z=[],W={},H=0;H<O.length;H++)K=O[H],X=K.name||"PLOT_".concat(H,"_").concat(o),U=X.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"_"),st=K.color||Y(H),lt=K.type||"line",z.push({key:U,title:K.name||X,type:lt,color:st}),W[U]=K.data;ct=O.every(function(t){return!1!==t.overlay}),ut="".concat(n.id,"_combined"),r&&r.name&&(ut=r.name);try{dt=xt(ut,function(t){for(var e=[],i=0;i<t.length;i++){var n={};for(var r in W){var a=W[r];n[r]=i<a.length?a[i]:null}e.push(n)}return e},z,[],2,ct),dt&&(ct?(ht=g.value.createIndicator(ut,!1,{id:"candle_pane"}),ht?k.value.push({paneId:ht,name:ut}):k.value.push({paneId:"candle_pane",name:ut})):(pt=g.value.createIndicator(ut,!1,{height:100,dragEnabled:!0}),pt&&k.value.push({paneId:pt,name:ut})))}catch(_i){}}e.n=28;break;case 15:return ft={id:n.originalId||n.id,user_id:n.user_id||n.userId,is_encrypted:n.is_encrypted||n.isEncrypted||0},e.n=16,G(n.code,i,n.params||{},ft);case 16:if(vt=e.v,gt=[],vt&&vt.plots&&Array.isArray(vt.plots)&&(gt=(0,R.A)(vt.plots)),!(vt&&vt.signals&&Array.isArray(vt.signals))){e.n=27;break}mt=(0,b.A)(vt.signals),e.p=17,mt.s();case 18:if((yt=mt.n()).done){e.n=24;break}if(bt=yt.value,!(bt.data&&Array.isArray(bt.data)&&bt.data.length>0)){e.n=23;break}for(_t=[],wt=0;wt<Math.min(bt.data.length,20);wt++)Ct=bt.data[wt],null===Ct||void 0===Ct||isNaN(Ct)||_t.length<5&&_t.push({index:wt,value:Ct});St=[],kt=0;case 19:if(!(kt<bt.data.length&&kt<i.length)){e.n=22;break}if(At=bt.data[kt],null===At||void 0===At||isNaN(At)){e.n=21;break}if(Tt=i[kt],Mt=Tt.timestamp||Tt.time,It=Tt.high,Et=Tt.low,Dt=bt.type||"buy",Pt=String(Dt).toLowerCase(),Lt=["buy","sell"],Lt.includes(Pt)){e.n=20;break}return e.a(3,21);case 20:Rt="buy"===Pt,Ft=bt.text||(Rt?"B":"S"),bt.textData&&null!=bt.textData[kt]&&(Ft=bt.textData[kt]),St.push({timestamp:Mt,price:At,anchorPrice:Rt?Et:It,side:Rt?"buy":"sell",action:Pt,color:bt.color||(Rt?"#00E676":"#FF5252"),text:Ft});case 21:kt++,e.n=19;break;case 22:if(St.length>0&&g.value){Bt=(0,b.A)(St);try{for(Bt.s();!(Nt=Bt.n()).done;){Ot=Nt.value;try{zt=Ot.timestamp,zt<1e10&&(zt*=1e3),Wt=Ot.text,"function"===typeof g.value.createOverlay&&($t=g.value.createOverlay({name:"signalTag",points:[{timestamp:zt,value:Ot.price},{timestamp:zt,value:Ot.anchorPrice}],extendData:{text:Wt,color:Ot.color,side:Ot.side,action:Ot.action,price:Ot.price},lock:!0},"candle_pane"),$t&&A.value.push($t))}catch(l){}}}catch(xi){Bt.e(xi)}finally{Bt.f()}}case 23:e.n=18;break;case 24:e.n=26;break;case 25:e.p=25,yi=e.v,mt.e(yi);case 26:return e.p=26,mt.f(),e.f(26);case 27:if(gt.length>0&&(Ht=gt.filter(function(t){return t.data&&Array.isArray(t.data)&&t.data.length>0}),Ht.length>0)){for(Vt=[],Kt={},Yt=0;Yt<Ht.length;Yt++)Xt=Ht[Yt],Ut=Xt.name||"PLOT_".concat(Yt),Gt=Ut.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"_"),jt=Xt.color||Y(Yt),qt=Xt.type||"line",Vt.push({key:Gt,title:Xt.name||Ut,type:qt,color:jt}),Kt[Gt]=Xt.data;Zt=Ht.every(function(t){return!1!==t.overlay}),Jt="".concat(n.id,"_combined"),vt&&vt.name&&(Jt=vt.name);try{Qt=xt(Jt,function(t){for(var e=[],i=0;i<t.length;i++){var n={};for(var r in Kt){var a=Kt[r];n[r]=i<a.length?a[i]:null}e.push(n)}return e},Vt,[],2,Zt),Qt&&(Zt?(te=g.value.createIndicator(Jt,!1,{id:"candle_pane"}),te?k.value.push({paneId:te,name:Jt}):k.value.push({paneId:"candle_pane",name:Jt})):(ee=g.value.createIndicator(Jt,!1,{height:100,dragEnabled:!0}),ee&&k.value.push({paneId:ee,name:Jt})))}catch(_i){}}case 28:e.n=30;break;case 29:e.p=29,bi=e.v,bi.message&&bi.message.includes("Python 引擎未就绪")&&($.value||(V.value=!0));case 30:return e.a(2,0);case 31:if(ie=Y(o),"sma"===n.id||"ema"===n.id){ae="sma"===n.id?"SMA":"EMA",oe=(null===(ne=n.params)||void 0===ne?void 0:ne.length)||(null===(re=n.params)||void 0===re?void 0:re.period)||20,se="".concat(ae,"_").concat(oe),le=ae.toLowerCase(),ce=oe;try{ue=xt(se,function(t,e){var i=e.calcParams[0]||ce,n="SMA"===ae?j(t,i):q(t,i);return n.map(function(t){return(0,L.A)({},le,t)})},[{key:le,title:"".concat(ae,"(").concat(oe,")"),type:"line"}],[oe],2,!0),ue&&(de=g.value.createIndicator(se,!1,{id:"candle_pane"}),de?k.value.push({paneId:de,name:se}):k.value.push({paneId:"candle_pane",name:se}))}catch(xi){}}else if("macd"===n.id)he=g.value.createIndicator("MACD",!1,{height:100,dragEnabled:!0}),he&&k.value.push({paneId:he,name:"MACD"});else if("rsi"===n.id)pe=g.value.createIndicator("RSI",!1,{height:100,dragEnabled:!0}),pe&&k.value.push({paneId:pe,name:"RSI"});else if("bollinger_bands"===n.id||"bb"===n.id){ge=(null===(fe=n.params)||void 0===fe?void 0:fe.length)||20,me=(null===(ve=n.params)||void 0===ve?void 0:ve.mult)||2,ye="BOLL_".concat(ge,"_").concat(me);try{be=xt(ye,function(t,e){for(var i=e.calcParams[0]||20,n=e.calcParams[1]||2,r=Z(t,i,n),a=[],o=0;o<r.length;o++){var s,l,c,u,d,h;a.push({upper:null!==(s=null===(l=r[o])||void 0===l?void 0:l.upper)&&void 0!==s?s:null,middle:null!==(c=null===(u=r[o])||void 0===u?void 0:u.middle)&&void 0!==c?c:null,lower:null!==(d=null===(h=r[o])||void 0===h?void 0:h.lower)&&void 0!==d?d:null})}return a},[{key:"upper",title:"上轨(".concat(ge,",").concat(me,")"),type:"line"},{key:"middle",title:"中轨(".concat(ge,")"),type:"line"},{key:"lower",title:"下轨(".concat(ge,",").concat(me,")"),type:"line"}],[ge,me],2,!0),be&&(xe=g.value.createIndicator(ye,!1,{id:"candle_pane"}),xe?k.value.push({paneId:xe,name:ye}):k.value.push({paneId:"candle_pane",name:ye}))}catch(xi){}}else if("atr"===n.id){Ce=(null===(_e=n.params)||void 0===_e?void 0:_e.period)||(null===(we=n.params)||void 0===we?void 0:we.length)||14,Se="ATR_".concat(Ce);try{ke=xt(Se,function(t,e){var i=e.calcParams[0]||14,n=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),r=J(n,i);return r.map(function(t){return{atr:t}})},[{key:"atr",title:"ATR(".concat(Ce,")"),type:"line",color:ie}],[Ce]),ke&&(Ae=g.value.createIndicator(Se,!1,{height:100,dragEnabled:!0}),Ae&&k.value.push({paneId:Ae,name:Se}))}catch(xi){}}else if("williams"===n.id||"williams_r"===n.id){Me=(null===(Te=n.params)||void 0===Te?void 0:Te.length)||14,Ie="WPR_".concat(Me);try{Ee=xt(Ie,function(t,e){var i=e.calcParams[0]||14,n=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),r=tt(n,i);return r.map(function(t){return{wr:t}})},[{key:"wr",title:"W%R(".concat(Me,")"),type:"line",color:ie}],[Me]),Ee&&(De=g.value.createIndicator(Ie,!1,{height:100,dragEnabled:!0}),De&&k.value.push({paneId:De,name:Ie}))}catch(xi){}}else if("mfi"===n.id){Le=(null===(Pe=n.params)||void 0===Pe?void 0:Pe.length)||14,Re="MFI_".concat(Le);try{Fe=xt(Re,function(t,e){var i=e.calcParams[0]||14,n=t.map(function(t){return{high:t.high,low:t.low,close:t.close,volume:t.volume}}),r=et(n,i);return r.map(function(t){return{mfi:t}})},[{key:"mfi",title:"MFI(".concat(Le,")"),type:"line",color:ie}],[Le]),Fe&&(Be=g.value.createIndicator(Re,!1,{height:100,dragEnabled:!0}),Be&&k.value.push({paneId:Be,name:Re}))}catch(xi){}}else if("cci"===n.id){Oe=(null===(Ne=n.params)||void 0===Ne?void 0:Ne.length)||20,ze="CCI_".concat(Oe);try{We=xt(ze,function(t,e){var i=e.calcParams[0]||20,n=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),r=Q(n,i);return r.map(function(t){return{cci:t}})},[{key:"cci",title:"CCI(".concat(Oe,")"),type:"line",color:ie}],[Oe]),We&&($e=g.value.createIndicator(ze,!1,{height:100,dragEnabled:!0}),$e&&k.value.push({paneId:$e,name:ze}))}catch(xi){}}else if("adx"===n.id){Ve=(null===(He=n.params)||void 0===He?void 0:He.length)||14,Ke="ADX_".concat(Ve);try{Ye=xt(Ke,function(t,e){var i=e.calcParams[0]||14,n=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),r=it(n,i);return r.adx.map(function(t){return{adx:t}})},[{key:"adx",title:"ADX(".concat(Ve,")"),type:"line",color:ie}],[Ve]),Ye&&(Xe=g.value.createIndicator(Ke,!1,{height:100,dragEnabled:!0}),Xe&&k.value.push({paneId:Xe,name:Ke}))}catch(xi){}}else if("obv"===n.id){Ue="OBV";try{Ge=xt(Ue,function(t,e){var i=t.map(function(t){return{close:t.close,volume:t.volume||0}}),n=nt(i);return n.map(function(t){return{obv:t}})},[{key:"obv",title:"OBV",type:"line",color:ie}],[]),Ge&&(je=g.value.createIndicator(Ue,!1,{height:100,dragEnabled:!0}),je&&k.value.push({paneId:je,name:Ue}))}catch(xi){}}else if("adosc"===n.id){Je=(null===(qe=n.params)||void 0===qe?void 0:qe.fast)||3,Qe=(null===(Ze=n.params)||void 0===Ze?void 0:Ze.slow)||10,ti="ADOSC_".concat(Je,"_").concat(Qe);try{ei=xt(ti,function(t,e){var i=e.calcParams[0]||3,n=e.calcParams[1]||10,r=t.map(function(t){return{high:t.high,low:t.low,close:t.close,volume:t.volume||0}}),a=at(r,i,n);return a.map(function(t){return{adosc:t}})},[{key:"adosc",title:"ADOSC(".concat(Je,",").concat(Qe,")"),type:"line",color:ie}],[Je,Qe]),ei&&(ii=g.value.createIndicator(ti,!1,{height:100,dragEnabled:!0}),ii&&k.value.push({paneId:ii,name:ti}))}catch(xi){}}else if("ad"===n.id){ni="AD";try{ri=xt(ni,function(t,e){var i=t.map(function(t){return{high:t.high,low:t.low,close:t.close,volume:t.volume||0}}),n=rt(i);return n.map(function(t){return{ad:t}})},[{key:"ad",title:"AD",type:"line",color:ie}],[]),ri&&(ai=g.value.createIndicator(ni,!1,{height:100,dragEnabled:!0}),ai&&k.value.push({paneId:ai,name:ni}))}catch(xi){}}else if("kdj"===n.id){ci=(null===(oi=n.params)||void 0===oi?void 0:oi.period)||9,ui=(null===(si=n.params)||void 0===si?void 0:si.k)||3,di=(null===(li=n.params)||void 0===li?void 0:li.d)||3,hi="KDJ_".concat(ci,"_").concat(ui,"_").concat(di);try{pi=xt(hi,function(t,e){var i=e.calcParams[0]||9,n=e.calcParams[1]||3,r=e.calcParams[2]||3,a=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),o=ot(a,i,n,r);return o.k.map(function(t,e){return{k:t,d:o.d[e],j:o.j[e]}})},[{key:"k",title:"K(".concat(ci,",").concat(ui,")"),type:"line",color:"#FF6B6B"},{key:"d",title:"D(".concat(di,")"),type:"line",color:"#4ECDC4"},{key:"j",title:"J",type:"line",color:"#95E1D3"}],[ci,ui,di]),pi&&(fi=g.value.createIndicator(hi,!1,{height:100,dragEnabled:!0}),fi&&k.value.push({paneId:fi,name:hi}))}catch(xi){}}else try{vi=n.id.toUpperCase(),gi=g.value.createIndicator(vi,!1,{height:100,dragEnabled:!0}),gi&&k.value.push({paneId:gi,name:vi})}catch(xi){}e.n=33;break;case 32:e.p=32,e.v;case 33:return e.a(2)}},e,null,[[17,25,26,27],[4,12,13,14],[2,29],[1,32]])}),o=0;case 4:if(!(o<t.activeIndicators.length)){e.n=7;break}return e.d(P(r()),5);case 5:if(a=e.v,0!==a){e.n=6;break}return e.a(3,6);case 6:o++,e.n=4;break;case 7:return e.p=7,_.value=!1,e.f(7);case 8:return e.a(2)}},e,null,[[3,,7,8]])}));return function(){return e.apply(this,arguments)}}(),wt=function(){dt()};return(0,h.wB)(function(){return t.symbol},function(){t.symbol&&dt()}),(0,h.wB)(function(){return t.theme},function(t){m.value=t,g.value&&(bt(),_t())}),(0,h.wB)(function(){return t.symbol},function(){t.symbol&&dt()}),(0,h.wB)(function(){return t.market},function(){t.symbol&&dt()}),(0,h.wB)(function(){return t.timeframe},function(){t.symbol&&dt(),t.realtimeEnabled&&(gt(),vt())}),(0,h.wB)(function(){return t.activeIndicators},function(t,e){g.value&&n.value.length>0&&(0,h.dY)(function(){g.value&&_t()})},{deep:!0}),(0,h.wB)(function(){return t.realtimeEnabled},function(t){t?vt():gt()}),(0,h.sV)((0,c.A)((0,l.A)().m(function e(){return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,h.dY)();case 1:return!t.theme||"dark"!==t.theme&&"light"!==t.theme||(m.value=t.theme),e.p=2,e.n=3,X();case 3:e.n=5;break;case 4:e.p=4,e.v,V.value=!0;case 5:(0,h.dY)(function(){setTimeout(function(){!g.value&&t.symbol&&mt()},300)});case 6:return e.a(2)}},e,null,[[2,4]])}))),(0,h.xo)(function(){gt(),g.value&&(g.value.destroy(),g.value=null),window.removeEventListener("resize",yt)}),{klineData:n,loading:r,error:a,loadingHistory:s,chartRef:g,chartTheme:m,themeConfig:K,getIndicatorColor:Y,handleRetry:wt,loadingPython:$,pythonReady:H,pyodideLoadFailed:V,formatKlineData:st,updatePricePanel:lt,isSameTimeframe:ut,loadKlineData:dt,loadMoreHistoryData:pt,updateKlineRealtime:ft,startRealtime:vt,stopRealtime:gt,initChart:mt,handleResize:yt,updateChartTheme:bt,updateIndicators:_t,executePythonStrategy:G,parsePythonStrategy:U,indicatorButtons:F,isIndicatorActive:B,toggleIndicator:z,drawingTools:D,activeDrawingTool:M,selectDrawingTool:N,clearAllDrawings:O}}},Rr=Lr,Fr=(0,T.A)(Rr,E,D,!1,null,"5f0b12e1",null),Br=Fr.exports,Nr=function(){var t=this,e=t._self._c;return e("a-modal",{staticClass:"backtest-modal",attrs:{title:t.$t("dashboard.indicator.backtest.title"),visible:t.visible,width:1100,maskClosable:!1},on:{cancel:t.handleCancel}},[e("div",{staticClass:"backtest-content"},[e("a-steps",{staticStyle:{"margin-bottom":"16px"},attrs:{current:t.currentStep,size:"small"}},[e("a-step",{attrs:{title:t.$t("dashboard.indicator.backtest.steps.strategy.title"),description:t.$t("dashboard.indicator.backtest.steps.strategy.desc")}}),e("a-step",{attrs:{title:t.$t("dashboard.indicator.backtest.steps.trading.title"),description:t.$t("dashboard.indicator.backtest.steps.trading.desc")}}),e("a-step",{attrs:{title:t.$t("dashboard.indicator.backtest.steps.results.title"),description:t.$t("dashboard.indicator.backtest.steps.results.desc")}})],1),e("div",{directives:[{name:"show",rawName:"v-show",value:2!==t.currentStep,expression:"currentStep !== 2"}],staticClass:"config-section"},[e("a-form",{attrs:{form:t.form,"label-col":t.labelCol,"wrapper-col":t.wrapperCol}},[e("div",{directives:[{name:"show",rawName:"v-show",value:0===t.currentStep,expression:"currentStep === 0"}]},[e("a-collapse",{staticStyle:{background:"#fafafa"},attrs:{bordered:!1},model:{value:t.step1CollapseKeys,callback:function(e){t.step1CollapseKeys=e},expression:"step1CollapseKeys"}},[e("a-collapse-panel",{key:"risk",attrs:{header:t.$t("dashboard.indicator.backtest.panel.risk")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.stopLossPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["stopLossPct",{initialValue:0}],expression:"['stopLossPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.takeProfitPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["takeProfitPct",{initialValue:0}],expression:"['takeProfitPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trailingEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["trailingEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['trailingEnabled', { valuePropName: 'checked', initialValue: false }]"}],on:{change:t.onTrailingToggle}})],1)],1),e("a-col",{attrs:{span:12}})],1),t.trailingEnabledUi?[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trailingStopPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trailingStopPct",{initialValue:0}],expression:"['trailingStopPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trailingActivationPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trailingActivationPct",{initialValue:0}],expression:"['trailingActivationPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1)],1)]:t._e()],2),e("a-collapse-panel",{key:"scale",attrs:{header:t.$t("dashboard.indicator.backtest.panel.scale")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['trendAddEnabled', { valuePropName: 'checked', initialValue: false }]"}],on:{change:t.onTrendAddToggle}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['dcaAddEnabled', { valuePropName: 'checked', initialValue: false }]"}],on:{change:t.onDcaAddToggle}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddStepPct",{initialValue:0}],expression:"['trendAddStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4},on:{change:t.onScaleParamsChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddStepPct",{initialValue:0}],expression:"['dcaAddStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4},on:{change:t.onScaleParamsChange}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddSizePct",{initialValue:0}],expression:"['trendAddSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4},on:{change:t.onScaleParamsChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddSizePct",{initialValue:0}],expression:"['dcaAddSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4},on:{change:t.onScaleParamsChange}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddMaxTimes",{initialValue:0}],expression:"['trendAddMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:50,step:1,precision:0},on:{change:t.onScaleParamsChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddMaxTimes",{initialValue:0}],expression:"['dcaAddMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:50,step:1,precision:0},on:{change:t.onScaleParamsChange}})],1)],1)],1)],1),e("a-collapse-panel",{key:"reduce",attrs:{header:t.$t("dashboard.indicator.backtest.panel.reduce")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['trendReduceEnabled', { valuePropName: 'checked', initialValue: false }]"}]})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['adverseReduceEnabled', { valuePropName: 'checked', initialValue: false }]"}]})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceStepPct",{initialValue:0}],expression:"['trendReduceStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceStepPct",{initialValue:0}],expression:"['adverseReduceStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceSizePct",{initialValue:0}],expression:"['trendReduceSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceSizePct",{initialValue:0}],expression:"['adverseReduceSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceMaxTimes",{initialValue:0}],expression:"['trendReduceMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:50,step:1,precision:0}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceMaxTimes",{initialValue:0}],expression:"['adverseReduceMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:50,step:1,precision:0}})],1)],1)],1)],1),e("a-collapse-panel",{key:"position",attrs:{header:t.$t("dashboard.indicator.backtest.panel.position")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.entryPct"),help:t.$t("dashboard.indicator.backtest.hint.entryPctMax",{maxPct:Number(t.entryPctMaxUi||0).toFixed(0)})}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["entryPct",{initialValue:100}],expression:"['entryPct', { initialValue: 100 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:t.entryPctMaxUi,step:.1,precision:4},on:{change:t.onEntryPctChange}})],1)],1),e("a-col",{attrs:{span:12}})],1)],1)],1)],1),e("div",{directives:[{name:"show",rawName:"v-show",value:1===t.currentStep,expression:"currentStep === 1"}]},[e("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:t.combinedAlertType,"show-icon":""}},[e("template",{slot:"message"},[e("div",{staticStyle:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"8px"}},[e("span",[e("strong",[t._v("Symbol:")]),t._v(" "+t._s(t.symbol||"-")+" "),e("span",{staticStyle:{color:"#999",margin:"0 6px"}},[t._v("|")]),e("strong",[t._v("Market:")]),t._v(" "+t._s(t.market||"-")+" "),e("span",{staticStyle:{color:"#999",margin:"0 6px"}},[t._v("|")]),e("strong",[t._v("Timeframe:")]),t._v(" "+t._s(t.selectedTimeframe||t.timeframe||"-")+" ")]),t.precisionInfo&&t.precisionInfo.enabled?e("span",{staticStyle:{"margin-left":"12px","border-left":"1px solid #d9d9d9","padding-left":"12px"}},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"high"===t.precisionInfo.precision?"thunderbolt":"clock-circle"}}),t._v(" "+t._s(t.$t("dashboard.indicator.backtest.precisionMode"))+": "),e("a-tag",{staticStyle:{"margin-left":"4px"},attrs:{color:"high"===t.precisionInfo.precision?"green":"blue",size:"small"}},[t._v(" "+t._s(t.precisionInfo.timeframe)+" ")]),e("span",{staticStyle:{color:"#666","margin-left":"6px"}},[t._v(" ("+t._s(t.$t("dashboard.indicator.backtest.estimatedCandles",{count:t.precisionInfo.estimated_candles?t.precisionInfo.estimated_candles.toLocaleString():"-"}))+") ")])],1):t.precisionInfo&&!t.precisionInfo.enabled&&t.market&&"crypto"===t.market.toLowerCase()?e("span",{staticStyle:{"margin-left":"12px","border-left":"1px solid #d9d9d9","padding-left":"12px",color:"#faad14"}},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"warning"}}),t._v(" "+t._s(t.$t("dashboard.indicator.backtest.standardModeWarning"))+" ")],1):t._e()])]),e("template",{slot:"description"},[t.precisionInfo&&t.precisionInfo.enabled?e("span",{staticStyle:{"font-size":"12px",color:"#888"}},[t._v(" "+t._s("high"===t.precisionInfo.precision?t.$t("dashboard.indicator.backtest.highPrecisionDesc"):t.$t("dashboard.indicator.backtest.mediumPrecisionDesc"))+" ")]):t.precisionInfo&&!t.precisionInfo.enabled&&t.market&&"crypto"===t.market.toLowerCase()?e("span",{staticStyle:{"font-size":"12px",color:"#888"}},[t._v(" "+t._s(t.precisionInfo.message||t.$t("dashboard.indicator.backtest.standardModeDesc"))+" ")]):t._e()])],2),e("div",{staticClass:"date-quick-select",staticStyle:{"margin-bottom":"12px"}},[e("span",{staticStyle:{"margin-right":"8px",color:"#666","font-size":"13px"}},[t._v(t._s(t.$t("dashboard.indicator.backtest.quickSelect")||"快速选择")+":")]),e("a-button-group",{attrs:{size:"small"}},t._l(t.datePresets,function(i){return e("a-button",{key:i.key,attrs:{type:t.selectedDatePreset===i.key?"primary":"default"},on:{click:function(e){return t.applyDatePreset(i)}}},[t._v(t._s(i.label))])}),1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.startDate")}},[e("a-date-picker",{directives:[{name:"decorator",rawName:"v-decorator",value:["startDate",{rules:[{required:!0,message:t.$t("dashboard.indicator.backtest.startDateRequired")}],initialValue:t.defaultStartDate}],expression:"['startDate', { rules: [{ required: true, message: $t('dashboard.indicator.backtest.startDateRequired') }], initialValue: defaultStartDate }]"}],staticStyle:{width:"100%"},attrs:{"disabled-date":t.disabledStartDate,placeholder:t.$t("dashboard.indicator.backtest.selectStartDate")},on:{change:t.onDateChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.endDate")}},[e("a-date-picker",{directives:[{name:"decorator",rawName:"v-decorator",value:["endDate",{rules:[{required:!0,message:t.$t("dashboard.indicator.backtest.endDateRequired")}],initialValue:t.defaultEndDate}],expression:"['endDate', { rules: [{ required: true, message: $t('dashboard.indicator.backtest.endDateRequired') }], initialValue: defaultEndDate }]"}],staticStyle:{width:"100%"},attrs:{"disabled-date":t.disabledEndDate,placeholder:t.$t("dashboard.indicator.backtest.selectEndDate")},on:{change:t.onDateChange}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.initialCapital")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["initialCapital",{rules:[{required:!0,message:t.$t("dashboard.indicator.backtest.initialCapitalRequired")}],initialValue:1e4}],expression:"['initialCapital', { rules: [{ required: true, message: $t('dashboard.indicator.backtest.initialCapitalRequired') }], initialValue: 10000 }]"}],staticStyle:{width:"100%"},attrs:{min:1e3,step:1e4,precision:2,formatter:function(t){return"$ ".concat(t).replace(/\B(?=(\d{3})+(?!\d))/g,",")},parser:function(t){return t.replace(/\$\s?|(,*)/g,"")}}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.commission")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["commission",{initialValue:.02}],expression:"['commission', { initialValue: 0.02 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:10,step:.01,precision:4}}),e("div",{staticClass:"field-hint"},[t._v(t._s(t.$t("dashboard.indicator.backtest.commissionHint")))])],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.slippage")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["slippage",{initialValue:0}],expression:"['slippage', { initialValue: 0 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:10,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.leverage")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["leverage",{initialValue:1}],expression:"['leverage', { initialValue: 1 }]"}],staticStyle:{width:"100%"},attrs:{min:1,max:125,step:1,precision:0,formatter:function(t){return"".concat(t,"x")},parser:function(t){return t.replace("x","")}}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.tradeDirection")}},[e("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["tradeDirection",{initialValue:"long"}],expression:"['tradeDirection', { initialValue: 'long' }]"}],staticStyle:{width:"100%"}},[e("a-select-option",{attrs:{value:"long"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.longOnly"))+" ")]),e("a-select-option",{attrs:{value:"short"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.shortOnly"))+" ")]),e("a-select-option",{attrs:{value:"both"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.both"))+" ")])],1)],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.timeframe")}},[e("a-select",{staticStyle:{width:"100%"},on:{change:t.onTimeframeChange},model:{value:t.selectedTimeframe,callback:function(e){t.selectedTimeframe=e},expression:"selectedTimeframe"}},[e("a-select-option",{attrs:{value:"1m"}},[t._v("1m")]),e("a-select-option",{attrs:{value:"5m"}},[t._v("5m")]),e("a-select-option",{attrs:{value:"15m"}},[t._v("15m")]),e("a-select-option",{attrs:{value:"30m"}},[t._v("30m")]),e("a-select-option",{attrs:{value:"1H"}},[t._v("1H")]),e("a-select-option",{attrs:{value:"4H"}},[t._v("4H")]),e("a-select-option",{attrs:{value:"1D"}},[t._v("1D")]),e("a-select-option",{attrs:{value:"1W"}},[t._v("1W")])],1)],1)],1)],1)],1)])],1),e("div",{directives:[{name:"show",rawName:"v-show",value:2===t.currentStep&&t.hasResult,expression:"currentStep === 2 && hasResult"}],staticClass:"result-section"},[t.backtestRunId?e("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"success","show-icon":"",message:t.$t("dashboard.indicator.backtest.savedRunId",{id:t.backtestRunId})}}):t._e(),e("div",{staticClass:"metrics-cards"},[e("div",{staticClass:"metric-card",class:{positive:t.result.totalReturn>0,negative:t.result.totalReturn<0}},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.totalReturn")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.totalReturn)))]),e("div",{staticClass:"metric-amount"},[t._v(t._s(t.formatMoney(t.result.totalProfit)))])]),e("div",{staticClass:"metric-card",class:{positive:t.result.annualReturn>0,negative:t.result.annualReturn<0}},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.annualReturn")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.annualReturn)))])]),e("div",{staticClass:"metric-card negative"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.maxDrawdown")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.maxDrawdown)))])]),e("div",{staticClass:"metric-card"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.sharpeRatio")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.result.sharpeRatio.toFixed(2)))])]),e("div",{staticClass:"metric-card"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.winRate")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.winRate)))])]),e("div",{staticClass:"metric-card",class:{positive:t.result.profitFactor>=1.5,negative:t.result.profitFactor<1}},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.profitFactor")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.result.profitFactor.toFixed(2)))])]),e("div",{staticClass:"metric-card"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.totalTrades")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.result.totalTrades))])]),e("div",{staticClass:"metric-card negative"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.totalCommission")))]),e("div",{staticClass:"metric-value"},[t._v("-$"+t._s(t.result.totalCommission?t.result.totalCommission.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"))])])]),e("div",{staticClass:"chart-section"},[e("div",{staticClass:"chart-title"},[t._v(t._s(t.$t("dashboard.indicator.backtest.equityCurve")))]),e("div",{ref:"equityChartRef",staticClass:"equity-chart"})]),e("div",{staticClass:"trades-section"},[e("div",{staticClass:"chart-title"},[t._v(t._s(t.$t("dashboard.indicator.backtest.tradeHistory")))]),e("a-table",{attrs:{columns:t.tradeColumns,"data-source":t.result.trades,pagination:{pageSize:5,size:"small"},size:"small",scroll:{x:600}},scopedSlots:t._u([{key:"type",fn:function(i){return[e("a-tag",{attrs:{color:t.getTradeTypeColor(i)}},[t._v(" "+t._s(t.getTradeTypeText(i))+" ")])]}},{key:"balance",fn:function(i){return[e("span",{staticStyle:{color:"#1890ff","font-weight":"500"}},[t._v(" $"+t._s(i?i.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"--")+" ")])]}},{key:"profit",fn:function(i){return[e("span",{style:{color:i>0?"#52c41a":i<0?"#f5222d":"#666"}},[t._v(" "+t._s(t.formatMoney(i))+" ")])]}}])})],1)],1),t.loading?e("div",{staticClass:"loading-overlay"},[e("div",{staticClass:"loading-content"},[e("div",{staticClass:"loading-animation"},[e("div",{staticClass:"chart-bars"},[e("div",{staticClass:"bar bar1"}),e("div",{staticClass:"bar bar2"}),e("div",{staticClass:"bar bar3"}),e("div",{staticClass:"bar bar4"}),e("div",{staticClass:"bar bar5"})])]),e("div",{staticClass:"loading-text"},[t._v(t._s(t.$t("dashboard.indicator.backtest.running")))]),e("div",{staticClass:"loading-subtext"},[t._v(t._s(t.loadingTip))])])]):t._e()],1),e("template",{slot:"footer"},[e("div",{staticStyle:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},[e("div",[t.currentStep>0?e("a-button",{attrs:{disabled:t.loading},on:{click:t.handlePrev}},[t._v(t._s(t.$t("dashboard.indicator.backtest.prev")))]):t._e()],1),e("div",[e("a-button",{attrs:{disabled:t.loading},on:{click:t.handleCancel}},[t._v(t._s(t.$t("dashboard.indicator.backtest.close")))]),t.currentStep<1?e("a-button",{staticStyle:{"margin-left":"8px"},attrs:{type:"primary",disabled:t.loading},on:{click:t.handleNext}},[t._v(t._s(t.$t("dashboard.indicator.backtest.next")))]):1===t.currentStep?e("a-button",{staticStyle:{"margin-left":"8px"},attrs:{type:"primary",loading:t.loading},on:{click:t.handleRunBacktest}},[t._v(t._s(t.$t("dashboard.indicator.backtest.run")))]):e("a-button",{staticStyle:{"margin-left":"8px"},attrs:{type:"primary",disabled:t.loading},on:{click:t.handleRerun}},[t._v(t._s(t.$t("dashboard.indicator.backtest.rerun")))])],1)])])],2)},Or=[],zr=i(95093),Wr=i.n(zr),$r=i(86529),Hr={name:"BacktestModal",props:{visible:{type:Boolean,default:!1},userId:{type:[Number,String],default:1},indicator:{type:Object,default:null},symbol:{type:String,default:""},market:{type:String,default:""},timeframe:{type:String,default:"1D"}},data:function(){return{form:this.$form.createForm(this),loading:!1,loadingTip:"",loadingTimer:null,currentStep:0,hasResult:!1,backtestRunId:null,step1CollapseKeys:["risk"],trailingEnabledUi:!1,entryPctMaxUi:100,precisionInfo:null,selectedDatePreset:null,selectedTimeframe:"1D",result:{totalReturn:0,annualReturn:0,maxDrawdown:0,sharpeRatio:0,winRate:0,profitFactor:0,totalTrades:0,totalProfit:0,totalCommission:0,trades:[],equityCurve:[]},equityChart:null,tradeColumns:[]}},computed:{maxBacktestRange:function(){var t=this.selectedTimeframe||this.timeframe||"1D";return"1m"===t?{days:30,label:"1个月"}:"5m"===t?{days:180,label:"6个月"}:["15m","30m"].includes(t)?{days:365,label:"1年"}:{days:1095,label:"3年"}},recommendedRange:function(){return{days:30,label:"30天",key:"30d"}},combinedAlertType:function(){return this.precisionInfo&&this.precisionInfo.enabled?"high"===this.precisionInfo.precision?"success":"info":this.precisionInfo&&!this.precisionInfo.enabled&&this.market&&"crypto"===this.market.toLowerCase()?"warning":"info"},datePresets:function(){var t=[],e=this.selectedTimeframe||this.timeframe||"1D";return"1m"===e?(t.push({key:"7d",days:7,label:"7D"}),t.push({key:"14d",days:14,label:"14D"}),t.push({key:"30d",days:30,label:"30D"})):"5m"===e?(t.push({key:"14d",days:14,label:"14D"}),t.push({key:"30d",days:30,label:"30D"}),t.push({key:"90d",days:90,label:"3M"}),t.push({key:"180d",days:180,label:"6M"})):(["15m","30m"].includes(e),t.push({key:"30d",days:30,label:"30D"}),t.push({key:"90d",days:90,label:"3M"}),t.push({key:"180d",days:180,label:"6M"}),t.push({key:"365d",days:365,label:"1Y"})),t},defaultStartDate:function(){return Wr()().subtract(this.recommendedRange.days,"days")},defaultEndDate:function(){return Wr()()},earliestDate:function(){return Wr()().subtract(this.maxBacktestRange.days,"days")},labelCol:function(){return 0===this.currentStep?{span:9}:{span:6}},wrapperCol:function(){return 0===this.currentStep?{span:15}:{span:18}}},watch:{visible:function(t){var e=this;t?(this.currentStep=0,this.hasResult=!1,this.backtestRunId=null,this.step1CollapseKeys=["risk"],this.trailingEnabledUi=!1,this.entryPctMaxUi=100,this.precisionInfo=null,this.selectedDatePreset=null,this.selectedTimeframe=this.timeframe||"1D",this.result={totalReturn:0,annualReturn:0,maxDrawdown:0,sharpeRatio:0,winRate:0,profitFactor:0,totalTrades:0,totalProfit:0,totalCommission:0,trades:[],equityCurve:[]},this.$nextTick(function(){e.form&&(e.form.resetFields(),e.trailingEnabledUi=!!e.form.getFieldValue("trailingEnabled"),e.recalcEntryPctMaxUi(),e.selectedDatePreset="30d",e.fetchPrecisionInfo())})):this.equityChart&&(this.equityChart.dispose(),this.equityChart=null)}},created:function(){this.tradeColumns=[{title:this.$t("dashboard.indicator.backtest.tradeTime"),dataIndex:"time",key:"time",width:160},{title:this.$t("dashboard.indicator.backtest.tradeType"),dataIndex:"type",key:"type",width:120,scopedSlots:{customRender:"type"}},{title:this.$t("dashboard.indicator.backtest.price"),dataIndex:"price",key:"price",width:110},{title:this.$t("dashboard.indicator.backtest.amount"),dataIndex:"amount",key:"amount",width:100,customRender:function(t){return t?t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:4}):"--"}},{title:this.$t("dashboard.indicator.backtest.profit"),dataIndex:"profit",key:"profit",width:110,scopedSlots:{customRender:"profit"}},{title:this.$t("dashboard.indicator.backtest.balance"),dataIndex:"balance",key:"balance",width:130,scopedSlots:{customRender:"balance"}}]},methods:{recalcEntryPctMaxUi:function(){if(this.form){var t=!!this.form.getFieldValue("trendAddEnabled"),e=!!this.form.getFieldValue("dcaAddEnabled"),i=Number(this.form.getFieldValue("trendAddMaxTimes")||0),n=Number(this.form.getFieldValue("dcaAddMaxTimes")||0),r=Number(this.form.getFieldValue("trendAddSizePct")||0),a=Number(this.form.getFieldValue("dcaAddSizePct")||0),o=(t?i*r:0)+(e?n*a:0),s=Math.max(0,Math.min(100,100-o));this.entryPctMaxUi=s}else this.entryPctMaxUi=100},normalizeEntryPct:function(){if(this.form){var t=Number(this.form.getFieldValue("entryPct")||0),e=Number(this.entryPctMaxUi||100);t>e&&this.form.setFieldsValue({entryPct:e})}},onTrendAddToggle:function(t){var e=this;this.form&&(t&&this.form.setFieldsValue({dcaAddEnabled:!1}),this.$nextTick(function(){e.recalcEntryPctMaxUi(),e.normalizeEntryPct()}))},onDcaAddToggle:function(t){var e=this;this.form&&(t&&this.form.setFieldsValue({trendAddEnabled:!1}),this.$nextTick(function(){e.recalcEntryPctMaxUi(),e.normalizeEntryPct()}))},onScaleParamsChange:function(){var t=this;this.$nextTick(function(){t.recalcEntryPctMaxUi(),t.normalizeEntryPct()})},onEntryPctChange:function(){var t=this;this.$nextTick(function(){return t.normalizeEntryPct()})},onTrailingToggle:function(t){this.form&&(this.trailingEnabledUi=!!t,t||this.form.setFieldsValue({trailingStopPct:0,trailingActivationPct:0}))},getTradeTypeColor:function(t){var e={buy:"green",sell:"red",liquidation:"orange",open_long:"green",add_long:"cyan",close_long:"orange",close_long_stop:"red",close_long_profit:"lime",close_long_trailing:"gold",reduce_long:"volcano",open_short:"red",add_short:"magenta",close_short:"blue",close_short_stop:"red",close_short_profit:"cyan",close_short_trailing:"gold",reduce_short:"volcano"};return e[t]||"default"},getTradeTypeText:function(t){var e={buy:this.$t("dashboard.indicator.backtest.buy"),sell:this.$t("dashboard.indicator.backtest.sell"),liquidation:this.$t("dashboard.indicator.backtest.liquidation"),open_long:this.$t("dashboard.indicator.backtest.openLong"),add_long:this.$t("dashboard.indicator.backtest.addLong"),close_long:this.$t("dashboard.indicator.backtest.closeLong"),close_long_stop:this.$t("dashboard.indicator.backtest.closeLongStop"),close_long_profit:this.$t("dashboard.indicator.backtest.closeLongProfit"),close_long_trailing:this.$t("dashboard.indicator.backtest.closeLongTrailing"),reduce_long:this.$t("dashboard.indicator.backtest.reduceLong"),open_short:this.$t("dashboard.indicator.backtest.openShort"),add_short:this.$t("dashboard.indicator.backtest.addShort"),close_short:this.$t("dashboard.indicator.backtest.closeShort"),close_short_stop:this.$t("dashboard.indicator.backtest.closeShortStop"),close_short_profit:this.$t("dashboard.indicator.backtest.closeShortProfit"),close_short_trailing:this.$t("dashboard.indicator.backtest.closeShortTrailing"),reduce_short:this.$t("dashboard.indicator.backtest.reduceShort")};return e[t]||t},disabledStartDate:function(t){return!!t&&(t>Wr()().endOf("day")||t<this.earliestDate.startOf("day"))},disabledEndDate:function(t){if(!t)return!1;if(t>Wr()().endOf("day"))return!0;if(t<this.earliestDate.startOf("day"))return!0;var e=this.form.getFieldValue("startDate");if(e){var i=this.maxBacktestRange.days||365,n=Wr()(e).add(i,"days");if(t>n.endOf("day"))return!0}return!1},applyDatePreset:function(t){this.selectedDatePreset=t.key;var e=Wr()(),i=Wr()().subtract(t.days,"days");this.form.setFieldsValue({startDate:i,endDate:e}),this.fetchPrecisionInfo(i,e)},fetchPrecisionInfo:function(t,e){var i=this;return(0,c.A)((0,l.A)().m(function n(){var r;return(0,l.A)().w(function(n){while(1)switch(n.p=n.n){case 0:if(t&&e||(t=i.form?i.form.getFieldValue("startDate"):null,e=i.form?i.form.getFieldValue("endDate"):null),t||(t=i.defaultStartDate),e||(e=i.defaultEndDate),i.market&&"crypto"===i.market.toLowerCase()){n.n=1;break}return i.precisionInfo={enabled:!1,reason:"only_crypto",message:i.$t("dashboard.indicator.backtest.onlyCryptoSupported")},n.a(2);case 1:return n.p=1,n.n=2,(0,f.Ay)({url:"/api/indicator/backtest/precision-info",method:"get",params:{market:i.market,startDate:t.format("YYYY-MM-DD"),endDate:e.format("YYYY-MM-DD")},timeout:3e4});case 2:r=n.v,1===r.code&&r.data&&(i.precisionInfo=r.data),n.n=4;break;case 3:n.p=3,n.v,i.precisionInfo=null;case 4:return n.a(2)}},n,null,[[1,3]])}))()},onTimeframeChange:function(){this.selectedDatePreset="30d";var t=Wr()(),e=Wr()().subtract(30,"days");this.form.setFieldsValue({startDate:e,endDate:t}),this.fetchPrecisionInfo(e,t)},onDateChange:function(){var t=this;this.selectedDatePreset=null,this.$nextTick(function(){t.fetchPrecisionInfo()})},validateDateRange:function(t,e){if(!t||!e)return!0;var i=e.diff(t,"days"),n=this.maxBacktestRange.days||365;return!(i>n)||(this.$message.error(this.$t("dashboard.indicator.backtest.dateRangeExceededDays",{timeframe:this.selectedTimeframe||this.timeframe,maxRange:this.maxBacktestRange.label,maxDays:n})),!1)},formatPercent:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"";return"".concat(e).concat(t.toFixed(2),"%")},formatMoney:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"-";return"".concat(e,"$").concat(Math.abs(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))},handleCancel:function(){this.$emit("cancel")},handlePrev:function(){this.loading||this.currentStep>0&&(this.currentStep-=1)},handleNext:function(){this.loading||(0!==this.currentStep?1===this.currentStep&&this.handleRunBacktest():this.currentStep=1)},handleRerun:function(){this.loading||(this.currentStep=1,this.hasResult=!1,this.backtestRunId=null)},startLoadingAnimation:function(){var t=this,e=[this.$t("dashboard.indicator.backtest.loadingTip1")||"正在获取历史K线数据...",this.$t("dashboard.indicator.backtest.loadingTip2")||"正在执行策略信号计算...",this.$t("dashboard.indicator.backtest.loadingTip3")||"正在模拟交易执行...",this.$t("dashboard.indicator.backtest.loadingTip4")||"正在计算回测指标...",this.$t("dashboard.indicator.backtest.loadingTip5")||"即将完成,请稍候..."],i=0;this.loadingTip=e[0],this.loadingTimer=setInterval(function(){i=(i+1)%e.length,t.loadingTip=e[i]},2e3)},stopLoadingAnimation:function(){this.loadingTimer&&(clearInterval(this.loadingTimer),this.loadingTimer=null),this.loadingTip=""},handleRunBacktest:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var i;return(0,l.A)().w(function(e){while(1)switch(e.n){case 0:i=["startDate","endDate","initialCapital","commission","leverage","tradeDirection","slippage"],t.form.validateFields(i,function(){var e=(0,c.A)((0,l.A)().m(function e(i,n){var r,a,o,s,c,u,h,p,v;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!i){e.n=1;break}return e.a(2);case 1:if(r=(0,d.A)((0,d.A)({},t.form.getFieldsValue()||{}),n||{}),a=Date.now(),t.indicator&&t.indicator.id){e.n=2;break}return t.$message.error(t.$t("dashboard.indicator.backtest.noIndicatorCode")),e.a(2);case 2:if(t.symbol){e.n=3;break}return t.$message.error(t.$t("dashboard.indicator.backtest.noSymbol")),e.a(2);case 3:if(t.validateDateRange(n.startDate,n.endDate)){e.n=4;break}return e.a(2);case 4:return t.loading=!0,t.hasResult=!1,t.startLoadingAnimation(),e.p=5,o=function(t){return Number(t||0)/100},s={risk:{stopLossPct:o(r.stopLossPct),takeProfitPct:o(r.takeProfitPct),trailing:{enabled:!!r.trailingEnabled,pct:o(r.trailingStopPct),activationPct:o(r.trailingActivationPct)}},position:{entryPct:o(r.entryPct||0)},scale:{trendAdd:{enabled:!!r.trendAddEnabled,stepPct:o(r.trendAddStepPct),sizePct:o(r.trendAddSizePct),maxTimes:r.trendAddMaxTimes||0},dcaAdd:{enabled:!!r.dcaAddEnabled,stepPct:o(r.dcaAddStepPct),sizePct:o(r.dcaAddSizePct),maxTimes:r.dcaAddMaxTimes||0},trendReduce:{enabled:!!r.trendReduceEnabled,stepPct:o(r.trendReduceStepPct),sizePct:o(r.trendReduceSizePct),maxTimes:r.trendReduceMaxTimes||0},adverseReduce:{enabled:!!r.adverseReduceEnabled,stepPct:o(r.adverseReduceStepPct),sizePct:o(r.adverseReduceSizePct),maxTimes:r.adverseReduceMaxTimes||0}}},c={userid:t.userId||1,indicatorId:t.indicator.id,symbol:t.symbol,market:t.market,timeframe:t.selectedTimeframe||t.timeframe,startDate:n.startDate.format("YYYY-MM-DD"),endDate:n.endDate.format("YYYY-MM-DD"),initialCapital:n.initialCapital,commission:o(n.commission||0),slippage:o(n.slippage||0),leverage:n.leverage||1,tradeDirection:n.tradeDirection||"long",strategyConfig:s,enableMtf:t.market&&"crypto"===t.market.toLowerCase()},e.n=6,(0,f.Ay)({url:"/api/indicator/backtest",method:"post",data:c,timeout:6e5});case 6:u=e.v,((Date.now()-a)/1e3).toFixed(1),1===u.code&&u.data?(u.data.runId&&(t.backtestRunId=u.data.runId),t.result=u.data.result||u.data,t.hasResult=!0,t.currentStep=2,t.$nextTick(function(){t.renderEquityChart()}),t.$message.success(t.$t("dashboard.indicator.backtest.success"))):t.$message.error(u.msg||t.$t("dashboard.indicator.backtest.failed")),e.n=8;break;case 7:e.p=7,v=e.v,h=t.$t("dashboard.indicator.backtest.failed"),"ECONNABORTED"===v.code||v.message&&v.message.includes("timeout")?h="回测超时,请减少回测时间范围或使用更大的时间周期":v.response?h=(null===(p=v.response.data)||void 0===p?void 0:p.msg)||v.response.statusText||h:v.message&&(h=v.message),t.$message.error(h);case 8:return e.p=8,t.stopLoadingAnimation(),t.loading=!1,e.f(8);case 9:return e.a(2)}},e,null,[[5,7,8,9]])}));return function(t,i){return e.apply(this,arguments)}}());case 1:return e.a(2)}},e)}))()},renderEquityChart:function(){var t=this;if(this.$refs.equityChartRef){this.equityChart&&this.equityChart.dispose(),this.equityChart=$r.Ts(this.$refs.equityChartRef);var e=this.result.equityCurve||[],i=e.map(function(t){return t.time||t.date}),n=e.map(function(t){return void 0!==t.value?t.value:t.equity}),r=n[0]||1e5,a=n[n.length-1]||r,o=a>=r,s=o?"#52c41a":"#f5222d",l=o?[{offset:0,color:"rgba(82, 196, 26, 0.35)"},{offset:1,color:"rgba(82, 196, 26, 0.02)"}]:[{offset:0,color:"rgba(245, 34, 45, 0.35)"},{offset:1,color:"rgba(245, 34, 45, 0.02)"}],c={tooltip:{trigger:"axis",backgroundColor:"rgba(255, 255, 255, 0.96)",borderColor:"#e8e8e8",borderWidth:1,textStyle:{color:"#333"},formatter:function(t){var e='<div style="font-weight: 600; margin-bottom: 8px; color: #262626;">'.concat(t[0].axisValue,"</div>");return t.forEach(function(t){if(void 0!==t.value&&null!==t.value){var i=t.value.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});e+='<div style="display: flex; justify-content: space-between; gap: 24px; margin: 4px 0;">\n <span>'.concat(t.marker," ").concat(t.seriesName,'</span>\n <span style="font-weight: 600; color: ').concat(s,';">$').concat(i,"</span>\n </div>")}}),e}},legend:{show:!1},grid:{left:"3%",right:"4%",bottom:"12%",top:"8%",containLabel:!0},xAxis:{type:"category",data:i,boundaryGap:!1,axisLine:{lineStyle:{color:"#e8e8e8"}},axisTick:{show:!1},axisLabel:{color:"#8c8c8c",fontSize:11,rotate:0,interval:Math.floor(i.length/6)}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#f5f5f5",type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#8c8c8c",fontSize:11,formatter:function(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(0)+"K":t}}},series:[{name:this.$t("dashboard.indicator.backtest.strategy"),type:"line",data:n,smooth:.4,symbol:"none",sampling:"lttb",lineStyle:{width:2.5,color:s,cap:"round",join:"round"},areaStyle:{color:new $r.fA.W4(0,0,0,1,l)},emphasis:{lineStyle:{width:3}}}],animation:!0,animationDuration:800,animationEasing:"cubicOut"};this.equityChart.setOption(c),window.addEventListener("resize",function(){t.equityChart&&t.equityChart.resize()})}}},beforeDestroy:function(){this.equityChart&&(this.equityChart.dispose(),this.equityChart=null)}},Vr=Hr,Kr=(0,T.A)(Vr,Nr,Or,!1,null,"473e449c",null),Yr=Kr.exports,Xr=function(){var t=this,e=t._self._c;return e("a-drawer",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle"),visible:t.visible,width:t.isMobile?"100%":980,maskClosable:!0},on:{close:function(e){return t.$emit("cancel")}}},[e("div",{staticStyle:{display:"flex",gap:"12px","margin-bottom":"12px","align-items":"center","flex-wrap":"wrap"}},[e("a-switch",{model:{value:t.useCurrentFilters,callback:function(e){t.useCurrentFilters=e},expression:"useCurrentFilters"}}),e("span",{staticStyle:{color:"#8c8c8c"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyUseCurrent"))+" ")]),e("a-button",{attrs:{type:"primary",loading:t.loading},on:{click:t.loadRuns}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyRefresh"))+" ")]),e("a-button",{attrs:{type:"primary",disabled:0===t.selectedRowKeys.length,loading:t.analyzing},on:{click:t.handleAIAnalyze}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyAIAnalyze"))+" ")])],1),t.useCurrentFilters?t._e():e("div",{staticStyle:{display:"flex",gap:"12px","margin-bottom":"12px","align-items":"center","flex-wrap":"wrap"}},[e("a-input",{staticStyle:{width:"220px"},attrs:{placeholder:t.$t("dashboard.indicator.backtest.historyFilterSymbol")},model:{value:t.filterSymbol,callback:function(e){t.filterSymbol=e},expression:"filterSymbol"}}),e("a-select",{staticStyle:{width:"140px"},attrs:{placeholder:t.$t("dashboard.indicator.backtest.historyFilterTimeframe"),allowClear:""},model:{value:t.filterTimeframe,callback:function(e){t.filterTimeframe=e},expression:"filterTimeframe"}},t._l(t.timeframes,function(i){return e("a-select-option",{key:i,attrs:{value:i}},[t._v(t._s(i))])}),1),e("a-button",{attrs:{loading:t.loading},on:{click:t.loadRuns}},[t._v(t._s(t.$t("dashboard.indicator.backtest.historyApply")))]),e("span",{staticStyle:{color:"#8c8c8c"}},[t._v(t._s(t.filterLabel))])],1),e("a-table",{attrs:{columns:t.columns,"data-source":t.runs,loading:t.loading,size:"small",pagination:{pageSize:10,size:"small"},rowKey:"id",scroll:{x:900},rowSelection:{selectedRowKeys:t.selectedRowKeys,onChange:t.onRowSelectionChange}},scopedSlots:t._u([{key:"range",fn:function(i,n){return[e("span",[t._v(t._s(n.start_date||"")+" ~ "+t._s(n.end_date||""))])]}},{key:"status",fn:function(i){return[e("a-tag",{attrs:{color:"success"===i?"green":"failed"===i?"red":"blue"}},[t._v(" "+t._s("success"===i?t.$t("dashboard.indicator.backtest.historyStatusSuccess"):"failed"===i?t.$t("dashboard.indicator.backtest.historyStatusFailed"):i)+" ")])]}},{key:"actions",fn:function(i,n){return[e("a-button",{attrs:{type:"link",size:"small",loading:t.detailLoadingId===n.id},on:{click:function(e){return t.viewRun(n)}}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyView"))+" ")])]}}])}),t.loading||0!==t.runs.length?t._e():e("a-empty",{attrs:{description:t.$t("dashboard.indicator.backtest.historyNoData")}}),e("a-modal",{attrs:{title:t.$t("dashboard.indicator.backtest.historyAIAnalyzeTitle"),visible:t.showAIResult,footer:null,width:t.isMobile?"100%":900},on:{cancel:function(e){t.showAIResult=!1}}},[t.analyzing?e("div",{staticStyle:{padding:"12px 0"}},[e("a-spin")],1):e("div",{staticStyle:{"white-space":"pre-wrap","font-family":"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"}},[t._v(" "+t._s(t.aiResult||t.$t("dashboard.indicator.backtest.historyNoAIResult"))+" ")])])],1)},Ur=[],Gr={name:"BacktestHistoryDrawer",props:{visible:{type:Boolean,default:!1},userId:{type:[Number,String],default:1},indicatorId:{type:[Number,String],default:null},symbol:{type:String,default:""},market:{type:String,default:""},timeframe:{type:String,default:""},isMobile:{type:Boolean,default:!1}},data:function(){return{loading:!1,detailLoadingId:null,analyzing:!1,showAIResult:!1,aiResult:"",useCurrentFilters:!0,filterSymbol:"",filterTimeframe:"",timeframes:["1m","5m","15m","30m","1H","4H","1D","1W"],runs:[],columns:[],selectedRowKeys:[]}},computed:{filterLabel:function(){var t=[];this.indicatorId&&t.push("indicatorId=".concat(this.indicatorId));var e=this.useCurrentFilters?this.market:this.market||"",i=this.useCurrentFilters?this.symbol:this.filterSymbol||"",n=this.useCurrentFilters?this.timeframe:this.filterTimeframe||"";return e&&t.push("market=".concat(e)),i&&t.push("symbol=".concat(i)),n&&t.push("timeframe=".concat(n)),t.length?t.join(" | "):""}},watch:{visible:function(t){t&&(this.initColumns(),this.useCurrentFilters=!0,this.filterSymbol=this.symbol||"",this.filterTimeframe=this.timeframe||"",this.selectedRowKeys=[],this.aiResult="",this.showAIResult=!1,this.loadRuns())}},methods:{onRowSelectionChange:function(t){this.selectedRowKeys=t||[]},initColumns:function(){this.columns.length||(this.columns=[{title:this.$t("dashboard.indicator.backtest.historyRunId"),dataIndex:"id",key:"id",width:90},{title:this.$t("dashboard.indicator.backtest.historyCreatedAt"),dataIndex:"created_at",key:"created_at",width:140},{title:this.$t("dashboard.indicator.backtest.tradeDirection"),dataIndex:"trade_direction",key:"trade_direction",width:90},{title:this.$t("dashboard.indicator.backtest.leverage"),dataIndex:"leverage",key:"leverage",width:90},{title:this.$t("dashboard.indicator.backtest.historyRange"),key:"range",width:220,scopedSlots:{customRender:"range"}},{title:this.$t("dashboard.indicator.backtest.historyStatus"),dataIndex:"status",key:"status",width:90,scopedSlots:{customRender:"status"}},{title:this.$t("dashboard.indicator.backtest.historyActions"),key:"actions",width:90,scopedSlots:{customRender:"actions"}}])},loadRuns:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var i,n,r,a;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.userId){e.n=1;break}return e.a(2);case 1:return t.loading=!0,e.p=2,i=t.useCurrentFilters?t.symbol:t.filterSymbol||"",n=t.useCurrentFilters?t.timeframe:t.filterTimeframe||"",r=t.market||"",e.n=3,(0,f.Ay)({url:"/api/indicator/backtest/history",method:"get",params:{userid:t.userId,limit:100,offset:0,indicatorId:t.indicatorId,symbol:i,market:r,timeframe:n}});case 3:a=e.v,a&&1===a.code&&Array.isArray(a.data)?t.runs=a.data:t.runs=[];case 4:return e.p=4,t.loading=!1,e.f(4);case 5:return e.a(2)}},e,null,[[2,,4,5]])}))()},viewRun:function(t){var e=this;return(0,c.A)((0,l.A)().m(function i(){var n;return(0,l.A)().w(function(i){while(1)switch(i.p=i.n){case 0:if(t&&t.id){i.n=1;break}return i.a(2);case 1:return e.detailLoadingId=t.id,i.p=2,i.n=3,(0,f.Ay)({url:"/api/indicator/backtest/get",method:"get",params:{userid:e.userId,runId:t.id}});case 3:n=i.v,n&&1===n.code&&n.data&&e.$emit("view",n.data);case 4:return i.p=4,e.detailLoadingId=null,i.f(4);case 5:return i.a(2)}},i,null,[[2,,4,5]])}))()},handleAIAnalyze:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var i,n;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.userId&&t.selectedRowKeys.length){e.n=1;break}return e.a(2);case 1:return t.analyzing=!0,t.showAIResult=!0,t.aiResult="",e.p=2,i=t.$i18n&&t.$i18n.locale?t.$i18n.locale:"zh-CN",e.n=3,(0,f.Ay)({url:"/api/indicator/backtest/aiAnalyze",method:"post",data:{userid:t.userId,runIds:t.selectedRowKeys,lang:i}});case 3:n=e.v,n&&1===n.code&&n.data&&n.data.analysis?t.aiResult=n.data.analysis:t.aiResult=n.msg||t.$t("dashboard.indicator.backtest.historyNoAIResult");case 4:return e.p=4,t.analyzing=!1,e.f(4);case 5:return e.a(2)}},e,null,[[2,,4,5]])}))()}}},jr=Gr,qr=(0,T.A)(jr,Xr,Ur,!1,null,null,null),Zr=qr.exports,Jr=function(){var t,e,i,n=this,r=n._self._c;return r("a-modal",{staticClass:"backtest-run-viewer",attrs:{title:n.modalTitle,visible:n.visible,width:1100,maskClosable:!1},on:{cancel:function(t){return n.$emit("cancel")}}},[n.run&&n.run.result?r("div",[n.run.id?r("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"info","show-icon":"",message:n.$t("dashboard.indicator.backtest.savedRunId",{id:n.run.id})}}):n._e(),r("div",{staticClass:"metrics-cards"},[r("div",{staticClass:"metric-card",class:{positive:n.result.totalReturn>0,negative:n.result.totalReturn<0}},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.totalReturn")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.totalReturn)))]),r("div",{staticClass:"metric-amount"},[n._v(n._s(n.formatMoney(n.result.totalProfit)))])]),r("div",{staticClass:"metric-card",class:{positive:n.result.annualReturn>0,negative:n.result.annualReturn<0}},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.annualReturn")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.annualReturn)))])]),r("div",{staticClass:"metric-card negative"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.maxDrawdown")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.maxDrawdown)))])]),r("div",{staticClass:"metric-card"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.sharpeRatio")))]),r("div",{staticClass:"metric-value"},[n._v(n._s((null!==(t=n.result.sharpeRatio)&&void 0!==t?t:0).toFixed(2)))])]),r("div",{staticClass:"metric-card"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.winRate")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.winRate)))])]),r("div",{staticClass:"metric-card",class:{positive:n.result.profitFactor>=1.5,negative:n.result.profitFactor<1}},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.profitFactor")))]),r("div",{staticClass:"metric-value"},[n._v(n._s((null!==(e=n.result.profitFactor)&&void 0!==e?e:0).toFixed(2)))])]),r("div",{staticClass:"metric-card"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.totalTrades")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(null!==(i=n.result.totalTrades)&&void 0!==i?i:0))])]),r("div",{staticClass:"metric-card negative"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.totalCommission")))]),r("div",{staticClass:"metric-value"},[n._v("-$"+n._s(n.result.totalCommission?n.result.totalCommission.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"))])])]),r("div",{staticClass:"chart-section"},[r("div",{staticClass:"chart-title"},[n._v(n._s(n.$t("dashboard.indicator.backtest.equityCurve")))]),r("div",{ref:"equityChartRef",staticClass:"equity-chart"})]),r("div",{staticClass:"trades-section"},[r("div",{staticClass:"chart-title"},[n._v(n._s(n.$t("dashboard.indicator.backtest.tradeHistory")))]),r("a-table",{attrs:{columns:n.tradeColumns,"data-source":n.result.trades||[],pagination:{pageSize:10,size:"small"},size:"small",scroll:{x:800},rowKey:n.rowKey},scopedSlots:n._u([{key:"type",fn:function(t){return[r("a-tag",{attrs:{color:n.getTradeTypeColor(t)}},[n._v(" "+n._s(n.getTradeTypeText(t))+" ")])]}},{key:"balance",fn:function(t){return[r("span",{staticStyle:{color:"#1890ff","font-weight":"500"}},[n._v(" $"+n._s(t?t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"--")+" ")])]}},{key:"profit",fn:function(t){return[r("span",{style:{color:t>0?"#52c41a":t<0?"#f5222d":"#666"}},[n._v(" "+n._s(n.formatMoney(t))+" ")])]}}])})],1)],1):r("div",{staticStyle:{padding:"12px 0"}},[r("a-empty",{attrs:{description:n.$t("dashboard.indicator.backtest.historyNoData")}})],1),r("template",{slot:"footer"},[r("a-button",{on:{click:function(t){return n.$emit("cancel")}}},[n._v(n._s(n.$t("dashboard.indicator.backtest.close")))])],1)],2)},Qr=[],ta={name:"BacktestRunViewer",props:{visible:{type:Boolean,default:!1},run:{type:Object,default:null}},data:function(){return{equityChart:null,tradeColumns:[]}},computed:{result:function(){return this.run&&this.run.result?this.run.result:{}},modalTitle:function(){var t=this.run&&this.run.id?"#".concat(this.run.id):"";return"".concat(this.$t("dashboard.indicator.backtest.historyTitle")," ").concat(t).trim()}},watch:{visible:function(t){var e=this;t?this.$nextTick(function(){e.initColumns(),e.renderEquityChart()}):this.equityChart&&(this.equityChart.dispose(),this.equityChart=null)}},methods:{rowKey:function(t,e){return e},initColumns:function(){this.tradeColumns.length||(this.tradeColumns=[{title:this.$t("dashboard.indicator.backtest.tradeTime"),dataIndex:"time",key:"time",width:160},{title:this.$t("dashboard.indicator.backtest.tradeType"),dataIndex:"type",key:"type",width:150,scopedSlots:{customRender:"type"}},{title:this.$t("dashboard.indicator.backtest.price"),dataIndex:"price",key:"price",width:110},{title:this.$t("dashboard.indicator.backtest.amount"),dataIndex:"amount",key:"amount",width:100},{title:this.$t("dashboard.indicator.backtest.profit"),dataIndex:"profit",key:"profit",width:110,scopedSlots:{customRender:"profit"}},{title:this.$t("dashboard.indicator.backtest.balance"),dataIndex:"balance",key:"balance",width:120,scopedSlots:{customRender:"balance"}}])},getTradeTypeColor:function(t){var e={buy:"green",sell:"red",liquidation:"orange",open_long:"green",add_long:"cyan",close_long:"orange",close_long_stop:"red",close_long_profit:"lime",close_long_trailing:"gold",reduce_long:"volcano",open_short:"red",add_short:"magenta",close_short:"blue",close_short_stop:"red",close_short_profit:"cyan",close_short_trailing:"gold",reduce_short:"volcano"};return e[t]||"default"},getTradeTypeText:function(t){var e={open_long:this.$t("dashboard.indicator.backtest.openLong"),add_long:this.$t("dashboard.indicator.backtest.addLong"),close_long:this.$t("dashboard.indicator.backtest.closeLong"),close_long_stop:this.$t("dashboard.indicator.backtest.closeLongStop"),close_long_profit:this.$t("dashboard.indicator.backtest.closeLongProfit"),close_long_trailing:this.$t("dashboard.indicator.backtest.closeLongTrailing"),reduce_long:this.$t("dashboard.indicator.backtest.reduceLong"),open_short:this.$t("dashboard.indicator.backtest.openShort"),add_short:this.$t("dashboard.indicator.backtest.addShort"),close_short:this.$t("dashboard.indicator.backtest.closeShort"),close_short_stop:this.$t("dashboard.indicator.backtest.closeShortStop"),close_short_profit:this.$t("dashboard.indicator.backtest.closeShortProfit"),close_short_trailing:this.$t("dashboard.indicator.backtest.closeShortTrailing"),reduce_short:this.$t("dashboard.indicator.backtest.reduceShort"),liquidation:this.$t("dashboard.indicator.backtest.liquidation")};return e[t]||t},formatPercent:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"";return"".concat(e).concat(Number(t).toFixed(2),"%")},formatMoney:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"-";return"".concat(e,"$").concat(Math.abs(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))},renderEquityChart:function(){var t=this;if(this.$refs.equityChartRef){this.equityChart&&this.equityChart.dispose(),this.equityChart=$r.Ts(this.$refs.equityChartRef);var e=this.result.equityCurve||[],i=e.map(function(t){return t.time||t.date}),n=e.map(function(t){return void 0!==t.value?t.value:t.equity}),r=n[0]||1e5,a=n[n.length-1]||r,o=a>=r,s=o?"#52c41a":"#f5222d",l=o?[{offset:0,color:"rgba(82, 196, 26, 0.35)"},{offset:1,color:"rgba(82, 196, 26, 0.02)"}]:[{offset:0,color:"rgba(245, 34, 45, 0.35)"},{offset:1,color:"rgba(245, 34, 45, 0.02)"}],c={tooltip:{trigger:"axis"},grid:{left:"3%",right:"4%",bottom:"12%",top:"8%",containLabel:!0},xAxis:{type:"category",data:i,boundaryGap:!1},yAxis:{type:"value"},series:[{name:this.$t("dashboard.indicator.backtest.strategy"),type:"line",data:n,smooth:.4,symbol:"none",sampling:"lttb",lineStyle:{width:2.5,color:s},areaStyle:{color:new $r.fA.W4(0,0,0,1,l)}}]};this.equityChart.setOption(c),window.addEventListener("resize",function(){return t.equityChart&&t.equityChart.resize()})}}}},ea=ta,ia=(0,T.A)(ea,Jr,Qr,!1,null,"a484239a",null),na=ia.exports,ra=i(38362),aa={name:"DashboardIndicator",components:{IndicatorEditor:I,KlineChart:Br,BacktestModal:Yr,BacktestHistoryDrawer:Zr,BacktestRunViewer:na,QuickTradePanel:ra.A},computed:(0,d.A)((0,d.A)({},(0,p.aH)({navTheme:function(t){return t.app.theme}})),{},{chartTheme:function(){return"dark"===this.navTheme||"realdark"===this.navTheme?"dark":"light"},isDarkTheme:function(){return"dark"===this.navTheme||"realdark"===this.navTheme}}),setup:function(){var t=(0,h.nI)(),e=t||{},i=e.proxy,n=(0,h.KR)(1),r=(0,h.KR)(!1),p=(0,h.KR)(void 0),m=(0,h.KR)([]),y=(0,h.KR)([]),b=(0,h.KR)(!1),x=(0,h.KR)(""),_=(0,h.KR)(!1),w=(0,h.KR)(!1),C=(0,h.KR)(!1),S=(0,h.KR)(""),k=(0,h.KR)(""),A=(0,h.KR)([]),T=(0,h.KR)(!1),M=(0,h.KR)([]),I=(0,h.KR)(!1),E=(0,h.KR)(null),D=(0,h.KR)(null),P=(0,h.KR)([]),L=(0,h.KR)(!1),R=(0,h.KR)(!1),F=(0,h.KR)(""),B=(0,h.KR)(""),N=(0,h.KR)(0),O=(0,h.EW)(function(){return"crypto"===(K.value||"").toLowerCase()}),z=function(){O.value?(F.value=V.value||"",N.value=parseFloat(Y.value)||0,B.value="",R.value=!0):u.A.warning(i.$t("quickTrade.cryptoOnly"))},W=function(){u.A.success(i.$t("quickTrade.orderSuccess"))},$=function(t){t&&O.value&&(F.value=t)},H=function(){i&&i.$router&&i.$router.push("/indicator-community")},V=(0,h.KR)(""),K=(0,h.KR)(""),Y=(0,h.KR)("--"),X=(0,h.KR)(0),U=(0,h.EW)(function(){return X.value>0?"color-up":X.value<0?"color-down":""}),G=(0,h.KR)("1D"),j=(0,h.KR)([]),q=(0,h.KR)(!1),Z=[{id:"sma5",name:"SMA5 (5日均线)",shortName:"SMA5",type:"line",defaultParams:{length:5}},{id:"sma10",name:"SMA10 (10日均线)",shortName:"SMA10",type:"line",defaultParams:{length:10}},{id:"sma20",name:"SMA20 (20日均线)",shortName:"SMA20",type:"line",defaultParams:{length:20}},{id:"sma30",name:"SMA30 (30日均线)",shortName:"SMA30",type:"line",defaultParams:{length:30}}],J=[{id:"ema5",name:"EMA5 (5日指数均线)",shortName:"EMA5",type:"line",defaultParams:{length:5}},{id:"ema10",name:"EMA10 (10日指数均线)",shortName:"EMA10",type:"line",defaultParams:{length:10}},{id:"ema20",name:"EMA20 (20日指数均线)",shortName:"EMA20",type:"line",defaultParams:{length:20}},{id:"ema30",name:"EMA30 (30日指数均线)",shortName:"EMA30",type:"line",defaultParams:{length:30}}],Q=(0,h.KR)([]),tt=(0,h.KR)([]),et=(0,h.KR)(!1),it=(0,h.KR)(!1),nt=(0,h.KR)(null),rt=(0,h.KR)(""),at=(0,h.KR)([]),ot=(0,h.KR)({}),st=(0,h.KR)(!1),lt=(0,h.KR)({}),ct=(0,h.KR)(!1),ut=(0,h.KR)(!1),dt=(0,h.KR)(!1),ht=(0,h.KR)(null),pt=(0,h.KR)(!1),ft=(0,h.KR)(null),vt=(0,h.KR)(!1),gt=(0,h.KR)(null),mt=(0,h.KR)(!1),yt=(0,h.KR)(null),bt=(0,h.KR)(!1),xt=(0,h.KR)(null),_t=(0,h.KR)(!1),wt=(0,h.KR)(!1),Ct=(0,h.KR)("free"),St=(0,h.KR)(10),kt=(0,h.KR)(""),At=(0,h.KR)(!1),Tt={price:[{required:!0,message:"请输入价格",trigger:"blur",type:"number"}]},Mt=(0,h.KR)(!1),It=function(t){var e=t.price,i=t.change;Y.value=e,X.value=i},Et=function(){},Dt=(0,h.KR)([]),Pt=(0,h.KR)([]),Lt=function(t){G.value=t},Rt=function(t){return t?Object.values(t).join(", "):""},Ft=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,i,a,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(r.value=!0,t.p=1,a=(0,h.nI)(),o=null===a||void 0===a||null===(e=a.proxy)||void 0===e?void 0:e.$store,s=(null===o||void 0===o||null===(i=o.getters)||void 0===i?void 0:i.userInfo)||{},!s||!s.email){t.n=2;break}return n.value=s.id,r.value=!1,Bt(),re(),t.a(2);case 2:return t.n=3,(0,g.ug)();case 3:c=t.v,c&&1===c.code&&c.data&&(n.value=c.data.id,o&&o.commit("SET_INFO",c.data),Bt(),re()),t.n=5;break;case 4:t.p=4,t.v;case 5:return t.p=5,r.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[1,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),Bt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return t.a(2);case 1:return b.value=!0,t.p=2,t.n=3,(0,v.Qo)({userid:n.value});case 3:e=t.v,e&&1===e.code&&e.data&&(y.value=e.data.map(function(t){return(0,d.A)((0,d.A)({},t),{},{label:t.symbol+(t.name?" (".concat(t.name,")"):""),value:"".concat(t.market,":").concat(t.symbol)})}),Nt(),y.value.length>0&&!V.value&&(r=y.value[0],K.value=r.market,V.value=r.symbol,p.value=r.value)),t.n=5;break;case 4:t.p=4,t.v,u.A.error(i.$t("dashboard.indicator.error.loadWatchlistFailed"));case 5:return t.p=5,b.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),Nt=function(){x.value?m.value=y.value.filter(function(t){return t.symbol.toLowerCase().includes(x.value.toLowerCase())||t.name&&t.name.toLowerCase().includes(x.value.toLowerCase())}):m.value=y.value},Ot=function(t){x.value=t,0===y.value.length&&t&&(_.value=!0),Nt()},zt=function(t){_.value=t,t||(x.value="")},Wt=function(t){if("__empty_watchlist_hint__"!==t){if("__add_stock_option__"===t)return w.value=!0,void setTimeout(function(){p.value=void 0},0);var e=y.value.find(function(e){return e.value===t});if(e||(e=m.value.find(function(e){return e.value===t})),!e&&t.includes(":")){var i=t.split(":"),n=(0,s.A)(i,2),r=n[0],a=n[1];e={market:r,symbol:a,value:t}}e&&(K.value=e.market,V.value=e.symbol,p.value=e.value)}},$t=function(t,e){var i,n=(null===(i=e.componentOptions)||void 0===i||null===(i=i.propsData)||void 0===i?void 0:i.value)||"";return"__empty_watchlist_hint__"===n||"__add_stock_option__"===n||n.toLowerCase().includes(t.toLowerCase())},Ht=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:return t.p=0,t.n=1,(0,v.iO)();case 1:e=t.v,e&&1===e.code&&e.data&&Array.isArray(e.data)?P.value=e.data.map(function(t){return{value:t.value,i18nKey:t.i18nKey||"dashboard.analysis.market.".concat(t.value)}}):e&&1===e.code&&e.data&&"object"===(0,o.A)(e.data)?P.value=Object.keys(e.data).map(function(t){return{value:t,i18nKey:"dashboard.analysis.market.".concat(t)}}):P.value=[{value:"USStock",i18nKey:"dashboard.analysis.market.USStock"},{value:"Crypto",i18nKey:"dashboard.analysis.market.Crypto"},{value:"Forex",i18nKey:"dashboard.analysis.market.Forex"},{value:"Futures",i18nKey:"dashboard.analysis.market.Futures"}],P.value.length>0&&!S.value&&(S.value=P.value[0].value),t.n=3;break;case 2:t.p=2,t.v,P.value=[{value:"USStock",i18nKey:"dashboard.analysis.market.USStock"},{value:"Crypto",i18nKey:"dashboard.analysis.market.Crypto"},{value:"Forex",i18nKey:"dashboard.analysis.market.Forex"},{value:"Futures",i18nKey:"dashboard.analysis.market.Futures"}];case 3:return t.a(2)}},t,null,[[0,2]])}));return function(){return t.apply(this,arguments)}}(),Vt=function(){w.value=!1,E.value=null,k.value="",A.value=[],L.value=!1,S.value=P.value.length>0?P.value[0].value:""},Kt=function(t){S.value=t,k.value="",A.value=[],E.value=null,L.value=!1,qt(t)},Yt=function(t){var e=t.target.value;if(k.value=e,D.value&&clearTimeout(D.value),!e||""===e.trim())return A.value=[],L.value=!1,void(E.value=null);D.value=setTimeout(function(){Ut(e)},500)},Xt=function(t){t&&t.trim()&&(S.value?A.value.length>0||(L.value&&0===A.value.length?Gt():Ut(t)):u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")))},Ut=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var n;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e&&""!==e.trim()){t.n=1;break}return A.value=[],L.value=!1,t.a(2);case 1:if(S.value){t.n=2;break}return u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")),t.a(2);case 2:return T.value=!0,L.value=!0,t.p=3,t.n=4,(0,v._3)({market:S.value,keyword:e.trim(),limit:20});case 4:n=t.v,n&&1===n.code&&n.data&&n.data.length>0?A.value=n.data:(A.value=[],E.value={market:S.value,symbol:e.trim().toUpperCase(),name:""}),t.n=6;break;case 5:t.p=5,t.v,A.value=[],E.value={market:S.value,symbol:e.trim().toUpperCase(),name:""};case 6:return t.p=6,T.value=!1,t.f(6);case 7:return t.a(2)}},t,null,[[3,5,6,7]])}));return function(e){return t.apply(this,arguments)}}(),Gt=function(){k.value&&k.value.trim()?S.value?E.value={market:S.value,symbol:k.value.trim().toUpperCase(),name:""}:u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")):u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseEnterSymbol"))},jt=function(t){E.value={market:t.market,symbol:t.symbol,name:t.name||t.symbol}},qt=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var i;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e||(e=S.value||(P.value.length>0?P.value[0].value:"")),e){t.n=1;break}return t.a(2);case 1:return I.value=!0,t.p=2,t.n=3,(0,v.z6)({market:e,limit:10});case 3:i=t.v,i&&1===i.code&&i.data?M.value=i.data:M.value=[],t.n=5;break;case 4:t.p=4,t.v,M.value=[];case 5:return t.p=5,I.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}}(),Zt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,r,a,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e="",r="",!E.value){t.n=1;break}e=E.value.market,r=E.value.symbol.toUpperCase(),t.n=4;break;case 1:if(!k.value||!k.value.trim()){t.n=3;break}if(S.value){t.n=2;break}return u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")),t.a(2);case 2:e=S.value,r=k.value.trim().toUpperCase(),t.n=4;break;case 3:return u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectOrEnterSymbol")),t.a(2);case 4:return C.value=!0,t.p=5,t.n=6,(0,v.dp)({userid:n.value,market:e,symbol:r});case 6:if(a=t.v,!a||1!==a.code){t.n=8;break}return u.A.success(i.$t("dashboard.analysis.message.addStockSuccess")),Vt(),t.n=7,Bt();case 7:t.n=9;break;case 8:u.A.error((null===a||void 0===a?void 0:a.msg)||i.$t("dashboard.analysis.message.addStockFailed"));case 9:t.n=11;break;case 10:t.p=10,c=t.v,s=(null===c||void 0===c||null===(o=c.response)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.msg)||(null===c||void 0===c?void 0:c.message)||i.$t("dashboard.analysis.message.addStockFailed"),u.A.error(s);case 11:return t.p=11,C.value=!1,t.f(11);case 12:return t.a(2)}},t,null,[[5,10,11,12]])}));return function(){return t.apply(this,arguments)}}(),Jt=function(t){if(!ie(t.id)){var e=t.params||t.defaultParams||{};j.value.push((0,d.A)((0,d.A)({},t),{},{id:t.id,params:(0,d.A)({},e)}))}},Qt=function(t){j.value=j.value.filter(function(e){return e.id!==t})},te=function(t){var e=t.action,i=t.indicator;if("add"===e){var n=(0,d.A)((0,d.A)({},i),{},{calculate:ee(i.id)});Jt(n)}else"remove"===e&&Qt(i.id)},ee=function(t){return null},ie=function(t){return"sma"===t?Z.some(function(t){return j.value.some(function(e){return e.id===t.id})}):"ema"===t?J.some(function(t){return j.value.some(function(e){return e.id===t.id})}):j.value.some(function(e){return e.id===t})},ne=function(){var t=new Set;return Z.forEach(function(e){return t.add(e.id)}),J.forEach(function(e){return t.add(e.id)}),j.value.filter(function(e){return!t.has(e.id)})},re=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,i,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return t.a(2);case 1:return et.value=!0,t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/getIndicators",method:"get",params:{userid:n.value}});case 3:e=t.v,1===e.code&&e.data&&(i=e.data.filter(function(t){return!t.is_buy||0===t.is_buy||"0"===t.is_buy}),r=e.data.filter(function(t){return 1===t.is_buy||"1"===t.is_buy}),Q.value=i.map(function(t){return(0,d.A)((0,d.A)({},t),{},{type:"python",source:"custom"})}),tt.value=r.map(function(t){return(0,d.A)((0,d.A)({},t),{},{type:"python",source:"purchased"})})),t.n=5;break;case 4:t.p=4,t.v;case 5:return t.p=5,et.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),ae=(0,h.KR)(null),oe=function(){var t=(0,c.A)((0,l.A)().m(function t(e,n){var r,a,o,s,c,h,p,f,v;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(r="".concat(n,"-").concat(e.id),!ie(r)){t.n=1;break}return Qt(r),t.a(2);case 1:if(t.p=1,a=e.code||"",ae.value){t.n=2;break}return u.A.error(i.$t("dashboard.indicator.error.chartNotReady")),t.a(2);case 2:if("function"===typeof ae.value.parsePythonStrategy){t.n=3;break}return u.A.error(i.$t("dashboard.indicator.error.chartMethodNotReady")),t.a(2);case 3:if("function"===typeof ae.value.executePythonStrategy){t.n=4;break}return u.A.error(i.$t("dashboard.indicator.error.chartExecuteNotReady")),t.a(2);case 4:if(o=ae.value.parsePythonStrategy(a),o){t.n=5;break}return u.A.error(i.$t("dashboard.indicator.error.parseFailed")),t.a(2);case 5:s=e.userParams||{},c=a,h=(0,d.A)({},s),p={id:r,name:e.name,type:"python",code:c,description:e.description,parsed:o,userParams:h,originalId:e.id,user_id:e.user_id||e.userId,is_encrypted:e.is_encrypted||e.isEncrypted||0,calculate:function(t,i){return ae.value.executePythonStrategy(c,t,(0,d.A)((0,d.A)({},i),h),{id:e.id,user_id:e.user_id||e.userId,is_encrypted:e.is_encrypted||e.isEncrypted||0})}},f=(0,d.A)((0,d.A)({},o.params),s),j.value.push((0,d.A)((0,d.A)({},p),{},{params:f})),t.n=7;break;case 6:t.p=6,v=t.v,u.A.error(i.$t("dashboard.indicator.error.addIndicatorFailed")+": "+(v.message||"未知错误"));case 7:return t.a(2)}},t,null,[[1,6]])}));return function(e,i){return t.apply(this,arguments)}}(),se=function(){var t=(0,c.A)((0,l.A)().m(function t(e,n){var r,a,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(r="".concat(n,"-").concat(e.id),!ie(r)){t.n=1;break}Qt(r),t.n=5;break;case 1:return t.p=1,st.value=!0,t.n=2,i.$http.get("/api/indicator/getIndicatorParams",{params:{indicator_id:e.id}});case 2:a=t.v,a&&1===a.code&&Array.isArray(a.data)&&a.data.length>0?(at.value=a.data,o="".concat(n,"-").concat(e.id),s=lt.value[o],c={},a.data.forEach(function(t){var e=s&&void 0!==s[t.name]?s[t.name]:t.default;e="int"===t.type?parseInt(e)||0:"float"===t.type?parseFloat(e)||0:"bool"===t.type?!0===e||"true"===e||1===e||"1"===e:e||"",c[t.name]=e}),ot.value=c,nt.value=e,rt.value=n,it.value=!0):oe(e,n),t.n=4;break;case 3:t.p=3,t.v,oe(e,n);case 4:return t.p=4,st.value=!1,t.f(4);case 5:return t.a(2)}},t,null,[[1,3,4,5]])}));return function(e,i){return t.apply(this,arguments)}}(),le=function(){if(nt.value){var t="".concat(rt.value,"-").concat(nt.value.id);lt.value[t]=(0,d.A)({},ot.value);var e=(0,d.A)((0,d.A)({},nt.value),{},{userParams:(0,d.A)({},ot.value)});oe(e,rt.value)}it.value=!1,nt.value=null,rt.value=""},ce=function(){ue(),it.value=!1,setTimeout(function(){nt.value=null,rt.value=""},100)},ue=function(){if(nt.value&&rt.value){var t="".concat(rt.value,"-").concat(nt.value.id);lt.value[t]=JSON.parse(JSON.stringify(ot.value))}},de=function(){ue()},he=function(t){var e=t.code,n=t.name;if(e&&e.trim())try{if(!ae.value)return void u.A.error(i.$t("dashboard.indicator.error.chartNotReady"));if("function"!==typeof ae.value.parsePythonStrategy)return void u.A.error(i.$t("dashboard.indicator.error.chartMethodNotReady"));if("function"!==typeof ae.value.executePythonStrategy)return void u.A.error(i.$t("dashboard.indicator.error.chartExecuteNotReady"));var r=ae.value.parsePythonStrategy(e);if(!r)return void u.A.error(i.$t("dashboard.indicator.error.parseFailedCheck"));var a={id:"temp-editor-indicator",name:n||"临时指标",type:"python",code:e,description:"",parsed:r,calculate:function(t,i){var n=e;return ae.value.executePythonStrategy(n,t,i)}},o=j.value.findIndex(function(t){return"temp-editor-indicator"===t.id});o>=0&&j.value.splice(o,1),j.value.push((0,d.A)((0,d.A)({},a),{},{params:(0,d.A)({},r.params)})),u.A.success(i.$t("dashboard.indicator.success.runIndicator"))}catch(s){u.A.error(i.$t("dashboard.indicator.error.runIndicatorFailed")+": "+(s.message||"未知错误"))}else u.A.warning(i.$t("dashboard.indicator.warning.enterCode"))},pe=function(){ht.value=null,dt.value=!0},fe=function(t){ht.value=t,dt.value=!0},ve=function(){ct.value=!ct.value},ge=function(t){a.A.confirm({title:i.$t("dashboard.indicator.delete.confirmTitle"),content:i.$t("dashboard.indicator.delete.confirmContent",{name:t.name}),okText:i.$t("dashboard.indicator.delete.confirmOk"),okType:"danger",cancelText:i.$t("dashboard.indicator.delete.confirmCancel"),onOk:function(){var e=(0,c.A)((0,l.A)().m(function e(){var r,a,o;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,f.Ay)({url:"/api/indicator/deleteIndicator",method:"post",data:{id:t.id,userid:n.value}});case 1:if(r=e.v,1!==r.code){e.n=3;break}return u.A.success(i.$t("dashboard.indicator.delete.success")),a="custom-"+t.id,ie(a)&&Qt(a),e.n=2,re();case 2:e.n=4;break;case 3:u.A.error(r.msg||i.$t("dashboard.indicator.delete.failed"));case 4:e.n=6;break;case 5:e.p=5,o=e.v,u.A.error(i.$t("dashboard.indicator.delete.failed")+": "+(o.message||"未知错误"));case 6:return e.a(2)}},e,null,[[0,5]])}));function r(){return e.apply(this,arguments)}return r}()})},me=function(t){ft.value=(0,d.A)({},t),pt.value=!0},ye=function(t){gt.value=(0,d.A)({},t),vt.value=!0},be=function(t){yt.value=t,mt.value=!0},xe=function(t){xt.value=(0,d.A)({},t),Ct.value=t.pricing_type||"free",St.value=t.price||10,kt.value=t.description||"",At.value=!!t.vip_free,bt.value=!0},_e=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return u.A.error(i.$t("dashboard.indicator.error.pleaseLogin")),t.a(2);case 1:return _t.value=!0,t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:n.value,id:xt.value.id,code:xt.value.code,name:xt.value.name,description:kt.value,publishToCommunity:!0,pricingType:Ct.value,price:"paid"===Ct.value?St.value:0,vipFree:"paid"===Ct.value&&At.value}});case 3:if(e=t.v,1!==e.code){t.n=5;break}return u.A.success(i.$t("dashboard.indicator.publish.success")),bt.value=!1,xt.value=null,t.n=4,re();case 4:t.n=6;break;case 5:u.A.error(e.msg||i.$t("dashboard.indicator.publish.failed"));case 6:t.n=8;break;case 7:t.p=7,r=t.v,u.A.error(i.$t("dashboard.indicator.publish.failed")+": "+(r.message||""));case 8:return t.p=8,_t.value=!1,t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(){return t.apply(this,arguments)}}(),we=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value&&xt.value){t.n=1;break}return t.a(2);case 1:return wt.value=!0,t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:n.value,id:xt.value.id,code:xt.value.code,name:xt.value.name,description:xt.value.description,publishToCommunity:!1,pricingType:"free",price:0,vipFree:!1}});case 3:if(e=t.v,1!==e.code){t.n=5;break}return u.A.success(i.$t("dashboard.indicator.publish.unpublishSuccess")),bt.value=!1,xt.value=null,t.n=4,re();case 4:t.n=6;break;case 5:u.A.error(e.msg||i.$t("dashboard.indicator.publish.unpublishFailed"));case 6:t.n=8;break;case 7:t.p=7,t.v,u.A.error(i.$t("dashboard.indicator.publish.unpublishFailed"));case 8:return t.p=8,wt.value=!1,t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(){return t.apply(this,arguments)}}(),Ce=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var r,a,o;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return u.A.error(i.$t("dashboard.indicator.error.pleaseLogin")),t.a(2);case 1:return r=i.$refs.indicatorEditor,r&&(r.saving=!0),t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:n.value,id:e.id||0,code:e.code}});case 3:if(a=t.v,1!==a.code){t.n=5;break}return u.A.success(i.$t("dashboard.indicator.save.success")),dt.value=!1,ht.value=null,t.n=4,re();case 4:t.n=6;break;case 5:u.A.error(a.msg||i.$t("dashboard.indicator.save.failed"));case 6:t.n=8;break;case 7:t.p=7,o=t.v,u.A.error(i.$t("dashboard.indicator.save.failed")+": "+(o.message||"未知错误"));case 8:return t.p=8,r&&(r.saving=!1),t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(e){return t.apply(this,arguments)}}(),Se=function(t){var e=t.end_time;if(1===e||"1"===e)return i.$t("dashboard.indicator.status.normalPermanent");if(!e||0===e)return i.$t("dashboard.indicator.status.normal");var n=Math.floor(Date.now()/1e3);return e<n?i.$t("dashboard.indicator.status.expired"):i.$t("dashboard.indicator.status.normal")},ke=function(t){var e=t.end_time;if(1===e||"1"===e)return"check-circle";if(!e||0===e)return"check-circle";var i=Math.floor(Date.now()/1e3);return e<i?"close-circle":"check-circle"},Ae=function(t){var e=t.end_time;if(1===e||"1"===e)return"status-normal";if(!e||0===e)return"status-normal";var i=Math.floor(Date.now()/1e3);return e<i?"status-expired":"status-normal"},Te=function(t){var e=t.end_time;if(1===e||"1"===e)return i.$t("dashboard.indicator.expiry.permanent");if(!e||0===e)return i.$t("dashboard.indicator.expiry.noExpiry");var n=Math.floor(Date.now()/1e3),r=new Date(1e3*e).toLocaleString("zh-CN"===i.$i18n.locale?"zh-CN":"zh-TW"===i.$i18n.locale?"zh-TW":"en-US");return e<n?i.$t("dashboard.indicator.expiry.expired",{date:r}):i.$t("dashboard.indicator.expiry.expiresOn",{date:r})},Me=function(t){var e={USStock:"dashboard.indicator.market.USStock",Crypto:"dashboard.indicator.market.Crypto",Forex:"dashboard.indicator.market.Forex",Futures:"dashboard.indicator.market.Futures"},n=e[t];return n&&null!==i&&void 0!==i&&i.$t?i.$t(n):t},Ie=function(t){var e={USStock:"green",Crypto:"purple",Forex:"gold",Futures:"cyan"};return e[t]||"default"},Ee=function(){Mt.value=!Mt.value,localStorage.setItem("realtimeEnabled",Mt.value.toString())},De=function(){q.value=window.innerWidth<=768};return(0,h.sV)(function(){var t=localStorage.getItem("realtimeEnabled");null!==t&&(Mt.value="true"===t),De(),window.addEventListener("resize",De),Ht(),Ft(),Bt(),re()}),(0,h.xo)(function(){window.removeEventListener("resize",De),D.value&&clearTimeout(D.value)}),(0,h.wB)(w,function(t){t?(P.value.length>0&&!S.value&&(S.value=P.value[0].value),S.value&&qt(S.value)):(E.value=null,k.value="",A.value=[],L.value=!1,D.value&&(clearTimeout(D.value),D.value=null))}),(0,h.wB)(function(){return ot.value},function(t){if(it.value&&nt.value&&rt.value){var e="".concat(rt.value,"-").concat(nt.value.id);lt.value[e]=JSON.parse(JSON.stringify(t))}},{deep:!0,immediate:!1}),(0,h.wB)(it,function(t){t||ue()}),{userId:n,klineChart:ae,searchSymbol:p,symbolSuggestions:m,watchlist:y,symbolSearchValue:x,symbolSearchOpen:_,currentSymbol:V,currentMarket:K,currentPrice:Y,priceChange:X,priceChangeClass:U,timeframe:G,loadingWatchlist:b,activeIndicators:j,trendIndicators:Dt,oscillatorIndicators:Pt,customIndicators:Q,purchasedIndicators:tt,loadingIndicators:et,realtimeEnabled:Mt,toggleRealtime:Ee,handleSymbolSearch:Ot,handleSymbolSelect:Wt,handleDropdownVisibleChange:zt,filterSymbolOption:$t,getMarketName:Me,getMarketColor:Ie,setTimeframe:Lt,addIndicator:Jt,removeIndicator:Qt,isIndicatorActive:ie,loadIndicators:re,addPythonIndicator:oe,toggleIndicator:se,getIndicatorStatus:Se,getIndicatorStatusIcon:ke,getIndicatorStatusClass:Ae,getExpiryTimeText:Te,formatParams:Rt,loadWatchlist:Bt,getCustomActiveIndicators:ne,showIndicatorEditor:dt,editingIndicator:ht,handleCreateIndicator:pe,handleRunIndicator:he,handleSaveIndicator:Ce,handleEditIndicator:fe,handleDeleteIndicator:ge,toggleCustomSection:ve,customSectionCollapsed:ct,purchasedSectionCollapsed:ut,handlePriceChange:It,handleChartRetry:Et,handleIndicatorToggle:te,showParamsModal:it,pendingIndicator:nt,indicatorParams:at,indicatorParamValues:ot,loadingParams:st,confirmIndicatorParams:le,cancelIndicatorParams:ce,handleParamsModalAfterClose:de,showBacktestModal:pt,backtestIndicator:ft,handleOpenBacktest:me,showBacktestHistoryDrawer:vt,backtestHistoryIndicator:gt,handleOpenBacktestHistory:ye,showBacktestRunViewer:mt,selectedBacktestRun:yt,handleViewBacktestRun:be,showPublishModal:bt,publishIndicator:xt,publishing:_t,unpublishing:wt,publishPricingType:Ct,publishPrice:St,publishDescription:kt,publishVipFree:At,publishRules:Tt,handlePublishIndicator:xe,handleConfirmPublish:_e,handleUnpublish:we,selectedSymbol:V,selectedMarket:K,selectedTimeframe:G,isMobile:q,showAddStockModal:w,addingStock:C,selectedMarketTab:S,symbolSearchKeyword:k,symbolSearchResults:A,searchingSymbols:T,hotSymbols:M,loadingHotSymbols:I,selectedSymbolForAdd:E,marketTypes:P,hasSearched:L,handleCloseAddStockModal:Vt,handleMarketTabChange:Kt,handleSymbolSearchInput:Yt,handleSearchOrInput:Xt,searchSymbolsInModal:Ut,selectSymbol:jt,loadHotSymbols:qt,handleAddStock:Zt,handleDirectAdd:Gt,loadMarketTypes:Ht,showQuickTrade:R,qtSymbol:F,qtSide:B,qtPrice:N,isCryptoMarket:O,openQuickTrade:z,onQuickTradeSuccess:W,handleQuickTradeSymbolChange:$,goToIndicatorMarket:H}}},oa=aa,sa=(0,T.A)(oa,n,r,!1,null,"b17e86c2",null),la=sa.exports},84636:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.WordArray,a=n.Hasher,o=i.algo,s=[];(function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0})();var l=o.MD5=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var i=0;i<16;i++){var n=e+i,r=t[n];t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a=this._hash.words,o=t[e+0],l=t[e+1],p=t[e+2],f=t[e+3],v=t[e+4],g=t[e+5],m=t[e+6],y=t[e+7],b=t[e+8],x=t[e+9],_=t[e+10],w=t[e+11],C=t[e+12],S=t[e+13],k=t[e+14],A=t[e+15],T=a[0],M=a[1],I=a[2],E=a[3];T=c(T,M,I,E,o,7,s[0]),E=c(E,T,M,I,l,12,s[1]),I=c(I,E,T,M,p,17,s[2]),M=c(M,I,E,T,f,22,s[3]),T=c(T,M,I,E,v,7,s[4]),E=c(E,T,M,I,g,12,s[5]),I=c(I,E,T,M,m,17,s[6]),M=c(M,I,E,T,y,22,s[7]),T=c(T,M,I,E,b,7,s[8]),E=c(E,T,M,I,x,12,s[9]),I=c(I,E,T,M,_,17,s[10]),M=c(M,I,E,T,w,22,s[11]),T=c(T,M,I,E,C,7,s[12]),E=c(E,T,M,I,S,12,s[13]),I=c(I,E,T,M,k,17,s[14]),M=c(M,I,E,T,A,22,s[15]),T=u(T,M,I,E,l,5,s[16]),E=u(E,T,M,I,m,9,s[17]),I=u(I,E,T,M,w,14,s[18]),M=u(M,I,E,T,o,20,s[19]),T=u(T,M,I,E,g,5,s[20]),E=u(E,T,M,I,_,9,s[21]),I=u(I,E,T,M,A,14,s[22]),M=u(M,I,E,T,v,20,s[23]),T=u(T,M,I,E,x,5,s[24]),E=u(E,T,M,I,k,9,s[25]),I=u(I,E,T,M,f,14,s[26]),M=u(M,I,E,T,b,20,s[27]),T=u(T,M,I,E,S,5,s[28]),E=u(E,T,M,I,p,9,s[29]),I=u(I,E,T,M,y,14,s[30]),M=u(M,I,E,T,C,20,s[31]),T=d(T,M,I,E,g,4,s[32]),E=d(E,T,M,I,b,11,s[33]),I=d(I,E,T,M,w,16,s[34]),M=d(M,I,E,T,k,23,s[35]),T=d(T,M,I,E,l,4,s[36]),E=d(E,T,M,I,v,11,s[37]),I=d(I,E,T,M,y,16,s[38]),M=d(M,I,E,T,_,23,s[39]),T=d(T,M,I,E,S,4,s[40]),E=d(E,T,M,I,o,11,s[41]),I=d(I,E,T,M,f,16,s[42]),M=d(M,I,E,T,m,23,s[43]),T=d(T,M,I,E,x,4,s[44]),E=d(E,T,M,I,C,11,s[45]),I=d(I,E,T,M,A,16,s[46]),M=d(M,I,E,T,p,23,s[47]),T=h(T,M,I,E,o,6,s[48]),E=h(E,T,M,I,y,10,s[49]),I=h(I,E,T,M,k,15,s[50]),M=h(M,I,E,T,g,21,s[51]),T=h(T,M,I,E,C,6,s[52]),E=h(E,T,M,I,f,10,s[53]),I=h(I,E,T,M,_,15,s[54]),M=h(M,I,E,T,l,21,s[55]),T=h(T,M,I,E,b,6,s[56]),E=h(E,T,M,I,A,10,s[57]),I=h(I,E,T,M,m,15,s[58]),M=h(M,I,E,T,S,21,s[59]),T=h(T,M,I,E,v,6,s[60]),E=h(E,T,M,I,w,10,s[61]),I=h(I,E,T,M,p,15,s[62]),M=h(M,I,E,T,x,21,s[63]),a[0]=a[0]+T|0,a[1]=a[1]+M|0,a[2]=a[2]+I|0,a[3]=a[3]+E|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var a=e.floor(n/4294967296),o=n;i[15+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(i.length+1),this._process();for(var s=this._hash,l=s.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,i,n,r,a,o){var s=t+(e&i|~e&n)+r+o;return(s<<a|s>>>32-a)+e}function u(t,e,i,n,r,a,o){var s=t+(e&n|i&~n)+r+o;return(s<<a|s>>>32-a)+e}function d(t,e,i,n,r,a,o){var s=t+(e^i^n)+r+o;return(s<<a|s>>>32-a)+e}function h(t,e,i,n,r,a,o){var s=t+(i^(e|~n))+r+o;return(s<<a|s>>>32-a)+e}i.MD5=a._createHelper(l),i.HmacMD5=a._createHmacHelper(l)}(Math),t.MD5})},89557:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(43240),i(81380))})(0,function(t){return function(){var e=t,i=e.x64,n=i.Word,r=i.WordArray,a=e.algo,o=a.SHA512,s=a.SHA384=o.extend({_doReset:function(){this._hash=new r.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=o._createHelper(s),e.HmacSHA384=o._createHmacHelper(s)}(),t.SHA384})},96298:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.StreamCipher,r=e.algo,a=[],o=[],s=[],l=r.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,i=0;i<4;i++)t[i]=16711935&(t[i]<<8|t[i]>>>24)|4278255360&(t[i]<<24|t[i]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],r=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)r[i]^=n[i+4&7];if(e){var a=e.words,o=a[0],s=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;r[0]^=l,r[1]^=d,r[2]^=u,r[3]^=h,r[4]^=l,r[5]^=d,r[6]^=u,r[7]^=h;for(i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(t,e){var i=this._X;c.call(this),a[0]=i[0]^i[5]>>>16^i[3]<<16,a[1]=i[2]^i[7]>>>16^i[5]<<16,a[2]=i[4]^i[1]>>>16^i[7]<<16,a[3]=i[6]^i[3]>>>16^i[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),t[e+n]^=a[n]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,i=0;i<8;i++)o[i]=e[i];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0;for(i=0;i<8;i++){var n=t[i]+e[i],r=65535&n,a=n>>>16,l=((r*r>>>17)+r*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[i]=l^c}t[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,t[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,t[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,t[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,t[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,t[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,t[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,t[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(l)}(),t.Rabbit})},96939:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),i=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,r=this._iv,a=this._counter;r&&(a=this._counter=r.slice(0),this._iv=void 0);var o=a.slice(0);i.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return e.Decryptor=i,e}(),t.mode.CTR})},97923:function(t,e,i){(function(t){t(i(15237))})(function(t){var e=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),i=t.Pos,n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function r(t){return t&&t.bracketRegex||/[(){}[\]]/}function a(t,e,a){var s=t.getLineHandle(e.line),l=e.ch-1,c=a&&a.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var u=r(a),d=!c&&l>=0&&u.test(s.text.charAt(l))&&n[s.text.charAt(l)]||u.test(s.text.charAt(l+1))&&n[s.text.charAt(++l)];if(!d)return null;var h=">"==d.charAt(1)?1:-1;if(a&&a.strict&&h>0!=(l==e.ch))return null;var p=t.getTokenTypeAt(i(e.line,l+1)),f=o(t,i(e.line,l+(h>0?1:0)),h,p,a);return null==f?null:{from:i(e.line,l),to:f&&f.pos,match:f&&f.ch==d.charAt(0),forward:h>0}}function o(t,e,a,o,s){for(var l=s&&s.maxScanLineLength||1e4,c=s&&s.maxScanLines||1e3,u=[],d=r(s),h=a>0?Math.min(e.line+c,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-c),p=e.line;p!=h;p+=a){var f=t.getLine(p);if(f){var v=a>0?0:f.length-1,g=a>0?f.length:-1;if(!(f.length>l))for(p==e.line&&(v=e.ch-(a<0?1:0));v!=g;v+=a){var m=f.charAt(v);if(d.test(m)&&(void 0===o||(t.getTokenTypeAt(i(p,v+1))||"")==(o||""))){var y=n[m];if(y&&">"==y.charAt(1)==a>0)u.push(m);else{if(!u.length)return{pos:i(p,v),ch:m};u.pop()}}}}}return p-a!=(a>0?t.lastLine():t.firstLine())&&null}function s(t,n,r){for(var o=t.state.matchBrackets.maxHighlightLineLength||1e3,s=r&&r.highlightNonMatching,l=[],c=t.listSelections(),u=0;u<c.length;u++){var d=c[u].empty()&&a(t,c[u].head,r);if(d&&(d.match||!1!==s)&&t.getLine(d.from.line).length<=o){var h=d.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(t.markText(d.from,i(d.from.line,d.from.ch+1),{className:h})),d.to&&t.getLine(d.to.line).length<=o&&l.push(t.markText(d.to,i(d.to.line,d.to.ch+1),{className:h}))}}if(l.length){e&&t.state.focused&&t.focus();var p=function(){t.operation(function(){for(var t=0;t<l.length;t++)l[t].clear()})};if(!n)return p;setTimeout(p,800)}}function l(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=s(t,!1,t.state.matchBrackets)})}function c(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}t.defineOption("matchBrackets",!1,function(e,i,n){n&&n!=t.Init&&(e.off("cursorActivity",l),e.off("focus",l),e.off("blur",c),c(e)),i&&(e.state.matchBrackets="object"==typeof i?i:{},e.on("cursorActivity",l),e.on("focus",l),e.on("blur",c))}),t.defineExtension("matchBrackets",function(){s(this,!0)}),t.defineExtension("findMatchingBracket",function(t,e,i){return(i||"boolean"==typeof e)&&(i?(i.strict=e,e=i):e=e?{strict:!0}:null),a(this,t,e)}),t.defineExtension("scanForBracket",function(t,e,i,n){return o(this,t,e,i,n)})})}}]);