Files
ai/charting_library/static/tv-chart.min.js
2014-08-13 12:01:41 +04:00

4374 lines
2.0 MiB

(function(){var a=function(){};"undefined"===typeof window.console&&(window.console={});for(var b=window.console,c="dir log time info warn count clear debug error group trace assert dirxml profile timeEnd groupEnd profileEnd timeStamp exception table notifyFirebug groupCollapsed getFirebugElement firebug userObjects".split(" "),d=0,e=c.length;d<e;d++){var f=c[d];if("undefined"===typeof b[f])try{b[f]=a}catch(g){}}var h=window.onerror;window.__tv_js_errors=[];window.onerror=function(a,b,c){window.__tv_js_errors.push(a+
" (found at "+b+", line "+c+")");if(h)try{h.apply(window,arguments)}catch(d){}}})();(function(a,b){function c(a){var b=S[a]={},c,d;a=a.split(/\s+/);c=0;for(d=a.length;c<d;c++)b[a[c]]=!0;return b}function d(a,c,d){if(d===b&&1===a.nodeType)if(d="data-"+c.replace(R,"-$1").toLowerCase(),d=a.getAttribute(d),"string"===typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:r.isNumeric(d)?+d:K.test(d)?r.parseJSON(d):d}catch(e){}r.data(a,c,d)}else d=b;return d}function e(a){for(var b in a)if(("data"!==b||!r.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function f(a,b,c){var d=
b+"defer",e=b+"queue",f=b+"mark",g=r._data(a,d);!g||"queue"!==c&&r._data(a,e)||"mark"!==c&&r._data(a,f)||setTimeout(function(){r._data(a,e)||r._data(a,f)||(r.removeData(a,d,!0),g.fire())},0)}function g(){return!1}function h(){return!0}function k(a,b,c){b=b||0;if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)===c});if(b.nodeType)return r.grep(a,function(a,d){return a===b===c});if("string"===typeof b){var d=r.grep(a,function(a){return 1===a.nodeType});if(Xa.test(b))return r.filter(b,
d,!c);b=r.filter(b,d)}return r.grep(a,function(a,d){return 0<=r.inArray(a,b)===c})}function m(a){var b=pa.split("|");a=a.createDocumentFragment();if(a.createElement)for(;b.length;)a.createElement(b.pop());return a}function n(a,b){if(1===b.nodeType&&r.hasData(a)){var c,d,e;d=r._data(a);var f=r._data(b,d),g=d.events;if(g)for(c in delete f.handle,f.events={},g)for(d=0,e=g[c].length;d<e;d++)r.event.add(b,c,g[c][d]);f.data&&(f.data=r.extend({},f.data))}}function q(a,b){var c;1===b.nodeType&&(b.clearAttributes&&
b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),"object"===c?b.outerHTML=a.outerHTML:"input"!==c||"checkbox"!==a.type&&"radio"!==a.type?"option"===c?b.selected=a.defaultSelected:"input"===c||"textarea"===c?b.defaultValue=a.defaultValue:"script"===c&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(r.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}
function l(a){return"undefined"!==typeof a.getElementsByTagName?a.getElementsByTagName("*"):"undefined"!==typeof a.querySelectorAll?a.querySelectorAll("*"):[]}function s(a){if("checkbox"===a.type||"radio"===a.type)a.defaultChecked=a.checked}function u(a){var b=(a.nodeName||"").toLowerCase();"input"===b?s(a):"script"!==b&&"undefined"!==typeof a.getElementsByTagName&&r.grep(a.getElementsByTagName("input"),s)}function z(a,b,c){var d="width"===b?a.offsetWidth:a.offsetHeight,e="width"===b?1:0;if(0<d){if("border"!==
c)for(;4>e;e+=2)c||(d-=parseFloat(r.css(a,"padding"+la[e]))||0),d="margin"===c?d+(parseFloat(r.css(a,c+la[e]))||0):d-(parseFloat(r.css(a,"border"+la[e]+"Width"))||0);return d+"px"}d=ia(a,b);if(0>d||null==d)d=a.style[b];if(va.test(d))return d;d=parseFloat(d)||0;if(c)for(;4>e;e+=2)d+=parseFloat(r.css(a,"padding"+la[e]))||0,"padding"!==c&&(d+=parseFloat(r.css(a,"border"+la[e]+"Width"))||0),"margin"===c&&(d+=parseFloat(r.css(a,c+la[e]))||0);return d+"px"}function t(a){return function(b,c){"string"!==
typeof b&&(c=b,b="*");if(r.isFunction(c))for(var d=b.toLowerCase().split(hb),e=0,f=d.length,g,h;e<f;e++)g=d[e],(h=/^\+/.test(g))&&(g=g.substr(1)||"*"),g=a[g]=a[g]||[],g[h?"unshift":"push"](c)}}function B(a,c,d,e,f,g){f=f||c.dataTypes[0];g=g||{};g[f]=!0;f=a[f];for(var h=0,l=f?f.length:0,k=a===Ya,m;h<l&&(k||!m);h++)m=f[h](c,d,e),"string"===typeof m&&(!k||g[m]?m=b:(c.dataTypes.unshift(m),m=B(a,c,d,e,m,g)));!k&&m||g["*"]||(m=B(a,c,d,e,"*",g));return m}function A(a,c){var d,e,f=r.ajaxSettings.flatOptions||
{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&r.extend(!0,a,e)}function w(a,b,c,d){if(r.isArray(b))r.each(b,function(b,e){c||Ja.test(a)?d(a,e):w(a+"["+("object"===typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(var e in b)w(a+"["+e+"]",b[e],c,d)}function v(){try{return new a.XMLHttpRequest}catch(b){}}function C(){setTimeout(H,0);return Ka=r.now()}function H(){Ka=b}function D(a,b){var c={};r.each(La.concat.apply([],La.slice(0,b)),function(){c[this]=a});return c}
function F(a){if(!Za[a]){var b=E.body,c=r("<"+a+">").appendTo(b),d=c.css("display");c.remove();if("none"===d||""===d)ja||(ja=E.createElement("iframe"),ja.frameBorder=ja.width=ja.height=0),b.appendChild(ja),ta&&ja.createElement||(ta=(ja.contentWindow||ja.contentDocument).document,ta.write((r.support.boxModel?"<!doctype html>":"")+"<html><body>"),ta.close()),c=ta.createElement(a),ta.body.appendChild(c),d=r.css(c,"display"),b.removeChild(ja);Za[a]=d}return Za[a]}function I(a){return r.isWindow(a)?a:
9===a.nodeType?a.defaultView||a.parentWindow:!1}var E=a.document,P=a.navigator,O=a.location,r=function(){function c(){if(!d.isReady){try{E.documentElement.doScroll("left")}catch(a){setTimeout(c,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,l=/\S/,k=/^\s+/,m=/\s+$/,r=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,q=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,s=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
A=/(?:^|:|,)(?:\s*\[)+/g,w=/(webkit)[ \/]([\w.]+)/,v=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,B=/-([a-z]|[0-9])/ig,z=/^-ms-/,C=function(a,b){return(b+"").toUpperCase()},M=P.userAgent,H,D,S=Object.prototype.toString,F=Object.prototype.hasOwnProperty,J=Array.prototype.push,W=Array.prototype.slice,K=String.prototype.trim,O=Array.prototype.indexOf,I={};d.fn=d.prototype={constructor:d,init:function(a,c,e){var f;if(!a)return this;if(a.nodeType)return this.context=
this[0]=a,this.length=1,this;if("body"===a&&!c&&E.body)return this.context=E,this[0]=E.body,this.selector=a,this.length=1,this;if("string"===typeof a){f="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&3<=a.length?[null,a,null]:h.exec(a);if(!f||!f[1]&&c)return!c||c.jquery?(c||e).find(a):this.constructor(c).find(a);if(f[1])return e=(c=c instanceof d?c[0]:c)?c.ownerDocument||c:E,(a=r.exec(a))?d.isPlainObject(c)?(a=[E.createElement(a[1])],d.fn.attr.call(a,c,!0)):a=[e.createElement(a[1])]:(a=d.buildFragment([f[1]],
[e]),a=(a.cacheable?d.clone(a.fragment):a.fragment).childNodes),d.merge(this,a);if((c=E.getElementById(f[2]))&&c.parentNode){if(c.id!==f[2])return e.find(a);this.length=1;this[0]=c}this.context=E;this.selector=a;return this}if(d.isFunction(a))return e.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return W.call(this,0)},get:function(a){return null==a?this.toArray():
0>a?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?J.apply(e,a):d.merge(e,a);e.prevObject=this;e.context=this.context;"find"===b?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady();H.add(a);return this},eq:function(a){a=+a;return-1===a?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},
slice:function(){return this.pushStack(W.apply(this,arguments),"slice",W.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:J,sort:[].sort,splice:[].splice};d.fn.init.prototype=d.fn;d.extend=d.fn.extend=function(){var a,c,e,f,g,h=arguments[0]||{},l=1,k=arguments.length,m=!1;"boolean"===typeof h&&(m=h,h=arguments[1]||{},l=2);"object"===typeof h||d.isFunction(h)||(h={});
k===l&&(h=this,--l);for(;l<k;l++)if(null!=(a=arguments[l]))for(c in a)e=h[c],f=a[c],h!==f&&(m&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,e=e&&d.isArray(e)?e:[]):e=e&&d.isPlainObject(e)?e:{},h[c]=d.extend(m,e,f)):f!==b&&(h[c]=f));return h};d.extend({noConflict:function(b){a.$===d&&(a.$=f);b&&a.jQuery===d&&(a.jQuery=e);return d},isReady:!1,readyWait:1,holdReady:function(a){a?d.readyWait++:d.ready(!0)},ready:function(a){if(!0===a&&!--d.readyWait||!0!==a&&!d.isReady){if(!E.body)return setTimeout(d.ready,
1);d.isReady=!0;!0!==a&&0<--d.readyWait||(H.fireWith(E,[d]),d.fn.trigger&&d(E).trigger("ready").off("ready"))}},bindReady:function(){if(!H){H=d.Callbacks("once memory");if("complete"===E.readyState)return setTimeout(d.ready,1);if(E.addEventListener)E.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",d.ready,!1);else if(E.attachEvent){E.attachEvent("onreadystatechange",D);a.attachEvent("onload",d.ready);var b=!1;try{b=null==a.frameElement}catch(e){}E.documentElement.doScroll&&b&&
c()}}},isFunction:function(a){return"function"===d.type(a)},isArray:Array.isArray||function(a){return"array"===d.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):I[S.call(a)]||"object"},isPlainObject:function(a){if(!a||"object"!==d.type(a)||a.nodeType||d.isWindow(a))return!1;try{if(a.constructor&&!F.call(a,"constructor")&&!F.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}for(var e in a);
return e===b||F.call(a,e)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw Error(a);},parseJSON:function(b){if("string"!==typeof b||!b)return null;b=d.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(q,"@").replace(s,"]").replace(A,"")))return(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(c){if("string"!==typeof c||!c)return null;var e,f;try{a.DOMParser?(f=new DOMParser,e=f.parseFromString(c,"text/xml")):(e=
new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(c))}catch(g){e=b}e&&e.documentElement&&!e.getElementsByTagName("parsererror").length||d.error("Invalid XML: "+c);return e},noop:function(){},globalEval:function(b){b&&l.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(z,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,l=h===b||d.isFunction(a);
if(e)if(l)for(f in a){if(!1===c.apply(a[f],e))break}else for(;g<h&&!1!==c.apply(a[g++],e););else if(l)for(f in a){if(!1===c.call(a[f],f,a[f]))break}else for(;g<h&&!1!==c.call(a[g],g,a[g++]););return a},trim:K?function(a){return null==a?"":K.call(a)}:function(a){return null==a?"":a.toString().replace(k,"").replace(m,"")},makeArray:function(a,b){var c=b||[];if(null!=a){var e=d.type(a);null==a.length||"string"===e||"function"===e||"regexp"===e||d.isWindow(a)?J.call(c,a):d.merge(c,a)}return c},inArray:function(a,
b,c){var d;if(b){if(O)return O.call(b,a,c);d=b.length;for(c=c?0>c?Math.max(0,d+c):c:0;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if("number"===typeof c.length)for(var f=c.length;e<f;e++)a[d++]=c[e];else for(;c[e]!==b;)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,e){var f,g,h=[],l=0,k=a.length;if(a instanceof d||k!==b&&"number"===typeof k&&
(0<k&&a[0]&&a[k-1]||0===k||d.isArray(a)))for(;l<k;l++)f=c(a[l],l,e),null!=f&&(h[h.length]=f);else for(g in a)f=c(a[g],g,e),null!=f&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if("string"===typeof c){var e=a[c];c=a;a=e}if(!d.isFunction(a))return b;var f=W.call(arguments,2),e=function(){return a.apply(c,f.concat(W.call(arguments)))};e.guid=a.guid=a.guid||e.guid||d.guid++;return e},access:function(a,c,e,f,g,h,l){var k,m=null==e,r=0,n=a.length;if(e&&"object"===typeof e){for(r in e)d.access(a,
c,r,e[r],1,h,f);g=1}else if(f!==b){k=l===b&&d.isFunction(f);m&&(k?(k=c,c=function(a,b,c){return k.call(d(a),c)}):(c.call(a,f),c=null));if(c)for(;r<n;r++)c(a[r],e,k?f.call(a[r],r,c(a[r],e)):f,l);g=1}return g?a:m?c.call(a):n?c(a[0],e):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();a=w.exec(a)||v.exec(a)||t.exec(a)||0>a.indexOf("compatible")&&u.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,
a,this);a.superclass=this;a.fn=a.prototype=this();a.fn.constructor=a;a.sub=this.sub;a.fn.init=function(c,e){e&&e instanceof d&&!(e instanceof a)&&(e=a(e));return d.fn.init.call(this,c,e,b)};a.fn.init.prototype=a.fn;var b=a(E);return a},browser:{}});d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()});M=d.uaMatch(M);M.browser&&(d.browser[M.browser]=!0,d.browser.version=M.version);d.browser.webkit&&(d.browser.safari=!0);l.test("\u00a0")&&
(k=/^[\s\xA0]+/,m=/[\s\xA0]+$/);g=d(E);E.addEventListener?D=function(){E.removeEventListener("DOMContentLoaded",D,!1);d.ready()}:E.attachEvent&&(D=function(){"complete"===E.readyState&&(E.detachEvent("onreadystatechange",D),d.ready())});return d}(),S={};r.Callbacks=function(a){a=a?S[a]||c(a):{};var d=[],e=[],f,g,h,l,k,m,n=function(b){var c,e,f,g;c=0;for(e=b.length;c<e;c++)f=b[c],g=r.type(f),"array"===g?n(f):"function"===g&&(a.unique&&s.has(f)||d.push(f))},q=function(b,c){c=c||[];f=!a.memory||[b,c];
h=g=!0;m=l||0;l=0;for(k=d.length;d&&m<k;m++)if(!1===d[m].apply(b,c)&&a.stopOnFalse){f=!0;break}h=!1;d&&(a.once?!0===f?s.disable():d=[]:e&&e.length&&(f=e.shift(),s.fireWith(f[0],f[1])))},s={add:function(){if(d){var a=d.length;n(arguments);h?k=d.length:f&&!0!==f&&(l=a,q(f[0],f[1]))}return this},remove:function(){if(d)for(var b=arguments,c=0,e=b.length;c<e;c++)for(var f=0;f<d.length&&(b[c]!==d[f]||(h&&f<=k&&(k--,f<=m&&m--),d.splice(f--,1),!a.unique));f++);return this},has:function(a){if(d)for(var b=
0,c=d.length;b<c;b++)if(a===d[b])return!0;return!1},empty:function(){d=[];return this},disable:function(){d=e=f=b;return this},disabled:function(){return!d},lock:function(){e=b;f&&!0!==f||s.disable();return this},locked:function(){return!e},fireWith:function(b,c){e&&(h?a.once||e.push([b,c]):a.once&&f||q(b,c));return this},fire:function(){s.fireWith(this,arguments);return this},fired:function(){return!!g}};return s};var J=[].slice;r.extend({Deferred:function(a){var b=r.Callbacks("once memory"),c=r.Callbacks("once memory"),
d=r.Callbacks("memory"),e="pending",f={resolve:b,reject:c,notify:d},g={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){h.done(a).fail(b).progress(c);return this},always:function(){h.done.apply(h,arguments).fail.apply(h,arguments);return this},pipe:function(a,b,c){return r.Deferred(function(d){r.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],f;if(r.isFunction(c))h[a](function(){if((f=
c.apply(this,arguments))&&r.isFunction(f.promise))f.promise().then(d.resolve,d.reject,d.notify);else d[e+"With"](this===h?d:this,[f])});else h[a](d[e])})}).promise()},promise:function(a){if(null==a)a=g;else for(var b in g)a[b]=g[b];return a}},h=g.promise({}),l;for(l in f)h[l]=f[l].fire,h[l+"With"]=f[l].fireWith;h.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock);a&&a.call(h,h);return h},when:function(a){function b(a){return function(b){d[a]=1<arguments.length?
J.call(arguments,0):b;--h||l.resolveWith(l,d)}}function c(a){return function(b){g[a]=1<arguments.length?J.call(arguments,0):b;l.notifyWith(k,g)}}var d=J.call(arguments,0),e=0,f=d.length,g=Array(f),h=f,l=1>=f&&a&&r.isFunction(a.promise)?a:r.Deferred(),k=l.promise();if(1<f){for(;e<f;e++)d[e]&&d[e].promise&&r.isFunction(d[e].promise)?d[e].promise().then(b(e),l.reject,c(e)):--h;h||l.resolveWith(l,d)}else l!==a&&l.resolveWith(l,f?[a]:[]);return k}});r.support=function(){var b,c,d,e,f,g,h,l,k=E.createElement("div");
k.setAttribute("className","t");k.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";c=k.getElementsByTagName("*");d=k.getElementsByTagName("a")[0];if(!c||!c.length||!d)return{};e=E.createElement("select");f=e.appendChild(E.createElement("option"));c=k.getElementsByTagName("input")[0];b={leadingWhitespace:3===k.firstChild.nodeType,tbody:!k.getElementsByTagName("tbody").length,htmlSerialize:!!k.getElementsByTagName("link").length,
style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),opacity:/^0.55/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:"on"===c.value,optSelected:f.selected,getSetAttribute:"t"!==k.className,enctype:!!E.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==E.createElement("nav").cloneNode(!0).outerHTML,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,
pixelMargin:!0};r.boxModel=b.boxModel="CSS1Compat"===E.compatMode;c.checked=!0;b.noCloneChecked=c.cloneNode(!0).checked;e.disabled=!0;b.optDisabled=!f.disabled;try{delete k.test}catch(m){b.deleteExpando=!1}!k.addEventListener&&k.attachEvent&&k.fireEvent&&(k.attachEvent("onclick",function(){b.noCloneEvent=!1}),k.cloneNode(!0).fireEvent("onclick"));c=E.createElement("input");c.value="t";c.setAttribute("type","radio");b.radioValue="t"===c.value;c.setAttribute("checked","checked");c.setAttribute("name",
"t");k.appendChild(c);d=E.createDocumentFragment();d.appendChild(k.lastChild);b.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked;b.appendChecked=c.checked;d.removeChild(c);d.appendChild(k);if(k.attachEvent)for(h in{submit:1,change:1,focusin:1})c="on"+h,l=c in k,l||(k.setAttribute(c,"return;"),l="function"===typeof k[c]),b[h+"Bubbles"]=l;d.removeChild(k);d=e=f=k=c=null;r(function(){var c,d,e,f,h=E.getElementsByTagName("body")[0];h&&(c=E.createElement("div"),c.style.cssText="padding:0;margin:0;border:0;visibility:hidden;width:0;height:0;position:static;top:0;margin-top:1px",
h.insertBefore(c,h.firstChild),k=E.createElement("div"),c.appendChild(k),k.innerHTML="<table><tr><td style='padding:0;margin:0;border:0;display:none'></td><td>t</td></tr></table>",g=k.getElementsByTagName("td"),l=0===g[0].offsetHeight,g[0].style.display="",g[1].style.display="none",b.reliableHiddenOffsets=l&&0===g[0].offsetHeight,a.getComputedStyle&&(k.innerHTML="",d=E.createElement("div"),d.style.width="0",d.style.marginRight="0",k.style.width="2px",k.appendChild(d),b.reliableMarginRight=0===(parseInt((a.getComputedStyle(d,
null)||{marginRight:0}).marginRight,10)||0)),"undefined"!==typeof k.style.zoom&&(k.innerHTML="",k.style.width=k.style.padding="1px",k.style.border=0,k.style.overflow="hidden",k.style.display="inline",k.style.zoom=1,b.inlineBlockNeedsLayout=3===k.offsetWidth,k.style.display="block",k.style.overflow="visible",k.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=3!==k.offsetWidth),k.style.cssText="position:absolute;top:0;left:0;width:1px;height:1px;padding:0;margin:0;border:0;visibility:hidden;",
k.innerHTML="<div style='position:absolute;top:0;left:0;width:1px;height:1px;padding:0;margin:0;border:5px solid #000;display:block;'><div style='padding:0;margin:0;border:0;display:block;overflow:hidden;'></div></div><table style='position:absolute;top:0;left:0;width:1px;height:1px;padding:0;margin:0;border:5px solid #000;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>",d=k.firstChild,e=d.firstChild,f=d.nextSibling.firstChild.firstChild,f={doesNotAddBorder:5!==e.offsetTop,doesAddBorderForTableAndCells:5===
f.offsetTop},e.style.position="fixed",e.style.top="20px",f.fixedPosition=20===e.offsetTop||15===e.offsetTop,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",f.subtractsBorderForOverflowNotVisible=-5===e.offsetTop,f.doesNotIncludeMarginInBodyOffset=1!==h.offsetTop,a.getComputedStyle&&(k.style.marginTop="1%",b.pixelMargin="1%"!==(a.getComputedStyle(k,null)||{marginTop:0}).marginTop),"undefined"!==typeof c.style.zoom&&(c.style.zoom=1),h.removeChild(c),k=null,r.extend(b,
f))});return b}();var K=/^(?:\{.*\}|\[.*\])$/,R=/([A-Z])/g;r.extend({cache:{},uuid:0,expando:"jQuery"+(r.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?r.cache[a[r.expando]]:a[r.expando];return!!a&&!e(a)},data:function(a,c,d,e){if(r.acceptData(a)){var f;f=r.expando;var g="string"===typeof c,h=a.nodeType,l=h?r.cache:a,k=h?a[f]:a[f]&&f,m="events"===c;if(k&&l[k]&&(m||e||l[k].data)||!g||d!==b){k||
(h?a[f]=k=++r.uuid:k=f);l[k]||(l[k]={},h||(l[k].toJSON=r.noop));if("object"===typeof c||"function"===typeof c)e?l[k]=r.extend(l[k],c):l[k].data=r.extend(l[k].data,c);f=a=l[k];e||(a.data||(a.data={}),a=a.data);d!==b&&(a[r.camelCase(c)]=d);if(m&&!a[c])return f.events;g?(d=a[c],null==d&&(d=a[r.camelCase(c)])):d=a;return d}}},removeData:function(a,b,c){if(r.acceptData(a)){var d,f,g,h=r.expando,l=a.nodeType,k=l?r.cache:a,m=l?a[h]:h;if(k[m]){if(b&&(d=c?k[m]:k[m].data)){r.isArray(b)||(b in d?b=[b]:(b=r.camelCase(b),
b=b in d?[b]:b.split(" ")));f=0;for(g=b.length;f<g;f++)delete d[b[f]];if(!(c?e:r.isEmptyObject)(d))return}if(!c&&(delete k[m].data,!e(k[m])))return;r.support.deleteExpando||!k.setInterval?delete k[m]:k[m]=null;l&&(r.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}}},_data:function(a,b,c){return r.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=r.noData[a.nodeName.toLowerCase()];if(b)return!(!0===b||a.getAttribute("classid")!==b)}return!0}});r.fn.extend({data:function(a,
c){var e,f,g,h,l,k=this[0],m=0,n=null;if(a===b){if(this.length&&(n=r.data(k),1===k.nodeType&&!r._data(k,"parsedAttrs"))){g=k.attributes;for(l=g.length;m<l;m++)h=g[m].name,0===h.indexOf("data-")&&(h=r.camelCase(h.substring(5)),d(k,h,n[h]));r._data(k,"parsedAttrs",!0)}return n}if("object"===typeof a)return this.each(function(){r.data(this,a)});e=a.split(".",2);e[1]=e[1]?"."+e[1]:"";f=e[1]+"!";return r.access(this,function(c){if(c===b)return n=this.triggerHandler("getData"+f,[e[0]]),n===b&&k&&(n=r.data(k,
a),n=d(k,a,n)),n===b&&e[1]?this.data(e[0]):n;e[1]=c;this.each(function(){var b=r(this);b.triggerHandler("setData"+f,e);r.data(this,a,c);b.triggerHandler("changeData"+f,e)})},null,c,1<arguments.length,null,!1)},removeData:function(a){return this.each(function(){r.removeData(this,a)})}});r.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",r._data(a,b,(r._data(a,b)||0)+1))},_unmark:function(a,b,c){!0!==a&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark";(a=a?0:(r._data(b,d)||1)-1)?r._data(b,d,a):(r.removeData(b,
d,!0),f(b,c,"mark"))}},queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=r._data(a,b),c&&(!d||r.isArray(c)?d=r._data(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.shift(),e={};"inprogress"===d&&(d=c.shift());d&&("fx"===b&&c.unshift("inprogress"),r._data(a,b+".run",e),d.call(a,function(){r.dequeue(a,b)},e));c.length||(r.removeData(a,b+"queue "+b+".run",!0),f(a,b,"queue"))}});r.fn.extend({queue:function(a,c){var d=2;"string"!==typeof a&&(c=
a,a="fx",d--);return arguments.length<d?r.queue(this[0],a):c===b?this:this.each(function(){var b=r.queue(this,a,c);"fx"===a&&"inprogress"!==b[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},delay:function(a,b){a=r.fx?r.fx.speeds[a]||a:a;return this.queue(b||"fx",function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function d(){--h||e.resolveWith(f,[f])}"string"!==
typeof a&&(c=a,a=b);a=a||"fx";for(var e=r.Deferred(),f=this,g=f.length,h=1,l=a+"defer",k=a+"queue",m=a+"mark",n;g--;)if(n=r.data(f[g],l,b,!0)||(r.data(f[g],k,b,!0)||r.data(f[g],m,b,!0))&&r.data(f[g],l,r.Callbacks("once memory"),!0))h++,n.add(d);d();return e.promise(c)}});var N=/[\n\t\r]/g,T=/\s+/,L=/\r/g,Z=/^(?:button|input)$/i,X=/^(?:button|input|object|select|textarea)$/i,ba=/^a(?:rea)?$/i,aa=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
U=r.support.getSetAttribute,Y,G,Q;r.fn.extend({attr:function(a,b){return r.access(this,r.attr,a,b,1<arguments.length)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})},prop:function(a,b){return r.access(this,r.prop,a,b,1<arguments.length)},removeProp:function(a){a=r.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,this.className))});
if(a&&"string"===typeof a)for(b=a.split(T),c=0,d=this.length;c<d;c++)if(e=this[c],1===e.nodeType)if(e.className||1!==b.length){f=" "+e.className+" ";g=0;for(h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=r.trim(f)}else e.className=a;return this},removeClass:function(a){var c,d,e,f,g,h,l;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,this.className))});if(a&&"string"===typeof a||a===b)for(c=(a||"").split(T),d=0,e=this.length;d<e;d++)if(f=this[d],
1===f.nodeType&&f.className)if(a){g=(" "+f.className+" ").replace(N," ");h=0;for(l=c.length;h<l;h++)g=g.replace(" "+c[h]+" "," ");f.className=r.trim(g)}else f.className="";return this},toggleClass:function(a,b){var c=typeof a,d="boolean"===typeof b;return r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===c)for(var e,f=0,g=r(this),h=b,l=a.split(T);e=l[f++];)h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e);else if("undefined"===
c||"boolean"===c)this.className&&r._data(this,"__className__",this.className),this.className=this.className||!1===a?"":r._data(this,"__className__")||""})},hasClass:function(a){a=" "+a+" ";for(var b=0,c=this.length;b<c;b++)if(1===this[b].nodeType&&-1<(" "+this[b].className+" ").replace(N," ").indexOf(a))return!0;return!1},val:function(a){var c,d,e,f=this[0];if(arguments.length)return e=r.isFunction(a),this.each(function(d){var f=r(this);1===this.nodeType&&(d=e?a.call(this,d,f.val()):a,null==d?d="":
"number"===typeof d?d+="":r.isArray(d)&&(d=r.map(d,function(a){return null==a?"":a+""})),c=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],c&&"set"in c&&c.set(this,d,"value")!==b||(this.value=d))});if(f){if((c=r.valHooks[f.type]||r.valHooks[f.nodeName.toLowerCase()])&&"get"in c&&(d=c.get(f,"value"))!==b)return d;d=f.value;return"string"===typeof d?d.replace(L,""):null==d?"":d}}});r.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},
select:{get:function(a){var b,c,d=a.selectedIndex,e=[],f=a.options,g="select-one"===a.type;if(0>d)return null;a=g?d:0;for(c=g?d+1:f.length;a<c;a++)if(b=f[a],b.selected&&!((r.support.optDisabled?b.disabled:null!==b.getAttribute("disabled"))||b.parentNode.disabled&&r.nodeName(b.parentNode,"optgroup"))){b=r(b).val();if(g)return b;e.push(b)}return g&&!e.length&&f.length?r(f[d]).val():e},set:function(a,b){var c=r.makeArray(b);r(a).find("option").each(function(){this.selected=0<=r.inArray(r(this).val(),
c)});c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h){if(e&&c in r.attrFn)return r(a)[c](d);if("undefined"===typeof a.getAttribute)return r.prop(a,c,d);if(e=1!==h||!r.isXMLDoc(a))c=c.toLowerCase(),g=r.attrHooks[c]||(aa.test(c)?G:Y);if(d!==b)if(null===d)r.removeAttr(a,c);else{if(g&&"set"in g&&e&&(f=g.set(a,d,c))!==b)return f;a.setAttribute(c,""+d);return d}else{if(g&&
"get"in g&&e&&null!==(f=g.get(a,c)))return f;f=a.getAttribute(c);return null===f?b:f}}},removeAttr:function(a,b){var c,d,e,f,g,h=0;if(b&&1===a.nodeType)for(d=b.toLowerCase().split(T),f=d.length;h<f;h++)if(e=d[h])c=r.propFix[e]||e,(g=aa.test(e))||r.attr(a,e,""),a.removeAttribute(U?e:c),g&&c in a&&(a[c]=!1)},attrHooks:{type:{set:function(a,b){if(Z.test(a.nodeName)&&a.parentNode)r.error("type property can't be changed");else if(!r.support.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;
a.setAttribute("type",b);c&&(a.value=c);return b}}},value:{get:function(a,b){return Y&&r.nodeName(a,"button")?Y.get(a,b):b in a?a.value:null},set:function(a,b,c){if(Y&&r.nodeName(a,"button"))return Y.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,
c,d){var e,f,g;g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g){if(g=1!==g||!r.isXMLDoc(a))c=r.propFix[c]||c,f=r.propHooks[c];return d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&null!==(e=f.get(a,c))?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):X.test(a.nodeName)||ba.test(a.nodeName)&&a.href?0:b}}}});r.attrHooks.tabindex=r.propHooks.tabIndex;G={get:function(a,c){var d,e=r.prop(a,c);return!0===e||"boolean"!==
typeof e&&(d=a.getAttributeNode(c))&&!1!==d.nodeValue?c.toLowerCase():b},set:function(a,b,c){!1===b?r.removeAttr(a,c):(b=r.propFix[c]||c,b in a&&(a[b]=!0),a.setAttribute(c,c.toLowerCase()));return c}};U||(Q={name:!0,id:!0,coords:!0},Y=r.valHooks.button={get:function(a,c){var d;return(d=a.getAttributeNode(c))&&(Q[c]?""!==d.nodeValue:d.specified)?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);d||(d=E.createAttribute(c),a.setAttributeNode(d));return d.nodeValue=b+""}},r.attrHooks.tabindex.set=
Y.set,r.each(["width","height"],function(a,b){r.attrHooks[b]=r.extend(r.attrHooks[b],{set:function(a,c){if(""===c)return a.setAttribute(b,"auto"),c}})}),r.attrHooks.contenteditable={get:Y.get,set:function(a,b,c){""===b&&(b="false");Y.set(a,b,c)}});r.support.hrefNormalized||r.each(["href","src","width","height"],function(a,c){r.attrHooks[c]=r.extend(r.attrHooks[c],{get:function(a){a=a.getAttribute(c,2);return null===a?b:a}})});r.support.style||(r.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||
b},set:function(a,b){return a.style.cssText=""+b}});r.support.optSelected||(r.propHooks.selected=r.extend(r.propHooks.selected,{get:function(a){if(a=a.parentNode)a.selectedIndex,a.parentNode&&a.parentNode.selectedIndex;return null}}));r.support.enctype||(r.propFix.enctype="encoding");r.support.checkOn||r.each(["radio","checkbox"],function(){r.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}});r.each(["radio","checkbox"],function(){r.valHooks[this]=r.extend(r.valHooks[this],
{set:function(a,b){if(r.isArray(b))return a.checked=0<=r.inArray(r(a).val(),b)}})});var V=/^(?:textarea|input|select)$/i,ea=/^([^\.]*)?(?:\.(.+))?$/,fa=/(?:^|\s)hover(\.\S+)?\b/,ka=/^key/,ga=/^(?:mouse|contextmenu)|click/,ca=/^(?:focusinfocus|focusoutblur)$/,ma=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,qa=function(a){if(a=ma.exec(a))a[1]=(a[1]||"").toLowerCase(),a[3]=a[3]&&RegExp("(?:^|\\s)"+a[3]+"(?:\\s|$)");return a},oa=function(a){return r.event.special.hover?a:a.replace(fa,"mouseenter$1 mouseleave$1")};
r.event={add:function(a,c,d,e,f){var g,h,l,k,m,n,q,s,A;if(3!==a.nodeType&&8!==a.nodeType&&c&&d&&(g=r._data(a))){d.handler&&(q=d,d=q.handler,f=q.selector);d.guid||(d.guid=r.guid++);l=g.events;l||(g.events=l={});h=g.handle;h||(g.handle=h=function(a){return"undefined"===typeof r||a&&r.event.triggered===a.type?b:r.event.dispatch.apply(h.elem,arguments)},h.elem=a);c=r.trim(oa(c)).split(" ");for(g=0;g<c.length;g++)k=ea.exec(c[g])||[],m=k[1],n=(k[2]||"").split(".").sort(),A=r.event.special[m]||{},m=(f?A.delegateType:
A.bindType)||m,A=r.event.special[m]||{},k=r.extend({type:m,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,quick:f&&qa(f),namespace:n.join(".")},q),s=l[m],s||(s=l[m]=[],s.delegateCount=0,A.setup&&!1!==A.setup.call(a,e,n,h)||(a.addEventListener?a.addEventListener(m,h,!1):a.attachEvent&&a.attachEvent("on"+m,h))),A.add&&(A.add.call(a,k),k.handler.guid||(k.handler.guid=d.guid)),f?s.splice(s.delegateCount++,0,k):s.push(k),r.event.global[m]=!0;a=null}},global:{},remove:function(a,b,c,d,e){var f=r.hasData(a)&&
r._data(a),g,h,l,k,m,n,q,s,A,w;if(f&&(q=f.events)){b=r.trim(oa(b||"")).split(" ");for(g=0;g<b.length;g++)if(h=ea.exec(b[g])||[],l=k=h[1],h=h[2],l){s=r.event.special[l]||{};l=(d?s.delegateType:s.bindType)||l;A=q[l]||[];m=A.length;h=h?RegExp("(^|\\.)"+h.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<A.length;n++)w=A[n],!e&&k!==w.origType||c&&c.guid!==w.guid||h&&!h.test(w.namespace)||d&&!(d===w.selector||"**"===d&&w.selector)||(A.splice(n--,1),w.selector&&A.delegateCount--,s.remove&&
s.remove.call(a,w));0===A.length&&m!==A.length&&(s.teardown&&!1!==s.teardown.call(a,h)||r.removeEvent(a,l,f.handle),delete q[l])}else for(l in q)r.event.remove(a,l+b[g],c,d,!0);if(r.isEmptyObject(q)){if(b=f.handle)b.elem=null;r.removeData(a,["events","handle"],!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,f){if(!e||3!==e.nodeType&&8!==e.nodeType){var g=c.type||c,h=[],l,k,m,n,q;if(!ca.test(g+r.event.triggered)&&(0<=g.indexOf("!")&&(g=g.slice(0,-1),l=!0),0<=g.indexOf(".")&&
(h=g.split("."),g=h.shift(),h.sort()),e&&!r.event.customEvent[g]||r.event.global[g]))if(c="object"===typeof c?c[r.expando]?c:new r.Event(g,c):new r.Event(g),c.type=g,c.isTrigger=!0,c.exclusive=l,c.namespace=h.join("."),c.namespace_re=c.namespace?RegExp("(^|\\.)"+h.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,l=0>g.indexOf(":")?"on"+g:"",e){if(c.result=b,c.target||(c.target=e),d=null!=d?r.makeArray(d):[],d.unshift(c),m=r.event.special[g]||{},!m.trigger||!1!==m.trigger.apply(e,d)){q=[[e,m.bindType||g]];if(!f&&
!m.noBubble&&!r.isWindow(e)){n=m.delegateType||g;h=ca.test(n+g)?e:e.parentNode;for(k=null;h;h=h.parentNode)q.push([h,n]),k=h;k&&k===e.ownerDocument&&q.push([k.defaultView||k.parentWindow||a,n])}for(k=0;k<q.length&&!c.isPropagationStopped();k++)h=q[k][0],c.type=q[k][1],(n=(r._data(h,"events")||{})[c.type]&&r._data(h,"handle"))&&n.apply(h,d),(n=l&&h[l])&&r.acceptData(h)&&!1===n.apply(h,d)&&c.preventDefault();c.type=g;f||c.isDefaultPrevented()||m._default&&!1!==m._default.apply(e.ownerDocument,d)||"click"===
g&&r.nodeName(e,"a")||!r.acceptData(e)||!l||!e[g]||("focus"===g||"blur"===g)&&0===c.target.offsetWidth||r.isWindow(e)||((k=e[l])&&(e[l]=null),r.event.triggered=g,e[g](),r.event.triggered=b,k&&(e[l]=k));return c.result}}else for(k in e=r.cache,e)e[k].events&&e[k].events[g]&&r.event.trigger(c,d,e[k].handle.elem,!0)}},dispatch:function(c){c=r.event.fix(c||a.event);var d=(r._data(this,"events")||{})[c.type]||[],e=d.delegateCount,f=[].slice.call(arguments,0),g=!c.exclusive&&!c.namespace,h=r.event.special[c.type]||
{},l=[],k,m,n,q,s,A,w;f[0]=c;c.delegateTarget=this;if(!h.preDispatch||!1!==h.preDispatch.call(this,c)){if(e&&(!c.button||"click"!==c.type))for(n=r(this),n.context=this.ownerDocument||this,m=c.target;m!=this;m=m.parentNode||this)if(!0!==m.disabled){s={};A=[];n[0]=m;for(k=0;k<e;k++){q=d[k];w=q.selector;if(s[w]===b){var v=s,t=w,u;if(q.quick){u=q.quick;var B=m.attributes||{};u=(!u[1]||m.nodeName.toLowerCase()===u[1])&&(!u[2]||(B.id||{}).value===u[2])&&(!u[3]||u[3].test((B["class"]||{}).value))}else u=
n.is(w);v[t]=u}s[w]&&A.push(q)}A.length&&l.push({elem:m,matches:A})}d.length>e&&l.push({elem:this,matches:d.slice(e)});for(k=0;k<l.length&&!c.isPropagationStopped();k++)for(e=l[k],c.currentTarget=e.elem,d=0;d<e.matches.length&&!c.isImmediatePropagationStopped();d++)if(q=e.matches[d],g||!c.namespace&&!q.namespace||c.namespace_re&&c.namespace_re.test(q.namespace))c.data=q.data,c.handleObj=q,q=((r.event.special[q.origType]||{}).handle||q.handler).apply(e.elem,f),q!==b&&(c.result=q,!1===q&&(c.preventDefault(),
c.stopPropagation()));h.postDispatch&&h.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(a,b){null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter:function(a,c){var d,e,f=c.button,g=c.fromElement;null==a.pageX&&null!=c.clientX&&(d=a.target.ownerDocument||E,e=d.documentElement,d=d.body,a.pageX=c.clientX+(e&&e.scrollLeft||d&&d.scrollLeft||0)-(e&&e.clientLeft||d&&d.clientLeft||0),a.pageY=c.clientY+(e&&e.scrollTop||d&&d.scrollTop||0)-(e&&e.clientTop||d&&d.clientTop||0));!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?c.toElement:g);a.which||f===b||(a.which=f&1?1:f&2?3:f&4?2:0);return a}},fix:function(a){if(a[r.expando])return a;var c,
d,e=a,f=r.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=r.Event(e);for(c=g.length;c;)d=g[--c],a[d]=e[d];a.target||(a.target=e.srcElement||E);3===a.target.nodeType&&(a.target=a.target.parentNode);a.metaKey===b&&(a.metaKey=a.ctrlKey);return f.filter?f.filter(a,e):a},special:{ready:{setup:r.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){r.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,
b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){a=r.extend(new r.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?r.event.trigger(a,null,b):r.event.dispatch.call(b,a);a.isDefaultPrevented()&&c.preventDefault()}};r.event.handle=r.event.dispatch;r.removeEvent=E.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)};r.Event=function(a,b){if(!(this instanceof r.Event))return new r.Event(a,
b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||!1===a.returnValue||a.getPreventDefault&&a.getPreventDefault()?h:g):this.type=a;b&&r.extend(this,b);this.timeStamp=a&&a.timeStamp||r.now();this[r.expando]=!0};r.Event.prototype={preventDefault:function(){this.isDefaultPrevented=h;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=h;var a=this.originalEvent;a&&(a.stopPropagation&&
a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=h;this.stopPropagation()},isDefaultPrevented:g,isPropagationStopped:g,isImmediatePropagationStopped:g};r.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=a.relatedTarget,d=a.handleObj,e;if(!c||c!==this&&!r.contains(this,c))a.type=d.origType,e=d.handler.apply(this,arguments),a.type=b;return e}}});r.support.submitBubbles||
(r.event.special.submit={setup:function(){if(r.nodeName(this,"form"))return!1;r.event.add(this,"click._submit keypress._submit",function(a){a=a.target;(a=r.nodeName(a,"input")||r.nodeName(a,"button")?a.form:b)&&!a._submit_attached&&(r.event.add(a,"submit._submit",function(a){a._submit_bubble=!0}),a._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&r.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(r.nodeName(this,
"form"))return!1;r.event.remove(this,"._submit")}});r.support.changeBubbles||(r.event.special.change={setup:function(){if(V.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type)r.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),r.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,r.event.simulate("change",this,a,!0))});return!1}r.event.add(this,"beforeactivate._change",
function(a){a=a.target;V.test(a.nodeName)&&!a._change_attached&&(r.event.add(a,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||r.event.simulate("change",this.parentNode,a,!0)}),a._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){r.event.remove(this,"._change");return V.test(this.nodeName)}});r.support.focusinBubbles||
r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){r.event.simulate(b,a.target,r.event.fix(a),!0)};r.event.special[b]={setup:function(){0===c++&&E.addEventListener(a,d,!0)},teardown:function(){0===--c&&E.removeEventListener(a,d,!0)}}});r.fn.extend({on:function(a,c,d,e,f){var h,l;if("object"===typeof a){"string"!==typeof c&&(d=d||c,c=b);for(l in a)this.on(l,c,d,a[l],f);return this}null==d&&null==e?(e=c,d=c=b):null==e&&("string"===typeof c?(e=d,d=b):(e=d,d=c,c=b));if(!1===
e)e=g;else if(!e)return this;1===f&&(h=e,e=function(a){r().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=r.guid++));return this.each(function(){r.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;r(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if("object"===typeof a){for(e in a)this.off(e,c,a[e]);return this}if(!1===c||"function"===
typeof c)d=c,c=b;!1===d&&(d=g);return this.each(function(){r.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){r(this.context).on(a,this.selector,b,c);return this},die:function(a,b){r(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1==arguments.length?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){r.event.trigger(a,
b,this)})},triggerHandler:function(a,b){if(this[0])return r.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||r.guid++,d=0,e=function(c){var e=(r._data(this,"lastToggle"+a.guid)||0)%d;r._data(this,"lastToggle"+a.guid,e+1);c.preventDefault();return b[e].apply(this,arguments)||!1};for(e.guid=c;d<b.length;)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});r.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),
function(a,b){r.fn[b]=function(a,c){null==c&&(c=a,a=null);return 0<arguments.length?this.on(b,null,a,c):this.trigger(b)};r.attrFn&&(r.attrFn[b]=!0);ka.test(b)&&(r.event.fixHooks[b]=r.event.keyHooks);ga.test(b)&&(r.event.fixHooks[b]=r.event.mouseHooks)});(function(){function a(b,c,d,f,g,h){g=0;for(var l=f.length;g<l;g++){var k=f[g];if(k){for(var m=!1,k=k[b];k;){if(k[e]===d){m=f[k.sizset];break}1!==k.nodeType||h||(k[e]=d,k.sizset=g);if(k.nodeName.toLowerCase()===c){m=k;break}k=k[b]}f[g]=m}}}function c(a,
b,d,f,g,h){g=0;for(var l=f.length;g<l;g++){var k=f[g];if(k){for(var m=!1,k=k[a];k;){if(k[e]===d){m=f[k.sizset];break}if(1===k.nodeType)if(h||(k[e]=d,k.sizset=g),"string"!==typeof b){if(k===b){m=!0;break}}else if(0<q.filter(b,[k]).length){m=k;break}k=k[a]}f[g]=m}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e="sizcache"+(Math.random()+"").replace(".",""),f=0,g=Object.prototype.toString,h=!1,l=!0,k=/\\/g,
m=/\r\n/g,n=/\W/;[0,0].sort(function(){l=!1;return 0});var q=function(a,b,c,e){c=c||[];var f=b=b||E;if(1!==b.nodeType&&9!==b.nodeType)return[];if(!a||"string"!==typeof a)return c;var h,l,k,m,r,n=!0,s=q.isXML(b),v=[],t=a;do if(d.exec(""),h=d.exec(t))if(t=h[3],v.push(h[1]),h[2]){m=h[3];break}while(h);if(1<v.length&&w.exec(a))if(2===v.length&&A.relative[v[0]])l=M(v[0]+v[1],b,e);else for(l=A.relative[v[0]]?[b]:q(v.shift(),b);v.length;)a=v.shift(),A.relative[a]&&(a+=v.shift()),l=M(a,l,e);else if(!e&&1<
v.length&&9===b.nodeType&&!s&&A.match.ID.test(v[0])&&!A.match.ID.test(v[v.length-1])&&(h=q.find(v.shift(),b,s),b=h.expr?q.filter(h.expr,h.set)[0]:h.set[0]),b)for(h=e?{expr:v.pop(),set:u(e)}:q.find(v.pop(),1!==v.length||"~"!==v[0]&&"+"!==v[0]||!b.parentNode?b:b.parentNode,s),l=h.expr?q.filter(h.expr,h.set):h.set,0<v.length?k=u(l):n=!1;v.length;)h=r=v.pop(),A.relative[r]?h=v.pop():r="",null==h&&(h=b),A.relative[r](k,h,s);else k=[];k||(k=l);k||q.error(r||a);if("[object Array]"===g.call(k))if(n)if(b&&
1===b.nodeType)for(a=0;null!=k[a];a++)k[a]&&(!0===k[a]||1===k[a].nodeType&&q.contains(b,k[a]))&&c.push(l[a]);else for(a=0;null!=k[a];a++)k[a]&&1===k[a].nodeType&&c.push(l[a]);else c.push.apply(c,k);else u(k,c);m&&(q(m,f,c,e),q.uniqueSort(c));return c};q.uniqueSort=function(a){if(z&&(h=l,a.sort(z),h))for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1);return a};q.matches=function(a,b){return q(a,null,null,b)};q.matchesSelector=function(a,b){return 0<q(b,null,null,[a]).length};q.find=function(a,
b,c){var d,e,f,g,h,l;if(!a)return[];e=0;for(f=A.order.length;e<f;e++)if(h=A.order[e],g=A.leftMatch[h].exec(a))if(l=g[1],g.splice(1,1),"\\"!==l.substr(l.length-1)&&(g[1]=(g[1]||"").replace(k,""),d=A.find[h](g,b,c),null!=d)){a=a.replace(A.match[h],"");break}d||(d="undefined"!==typeof b.getElementsByTagName?b.getElementsByTagName("*"):[]);return{set:d,expr:a}};q.filter=function(a,c,d,e){for(var f,g,h,l,k,m,r,n,s=a,w=[],v=c,t=c&&c[0]&&q.isXML(c[0]);a&&c.length;){for(h in A.filter)if(null!=(f=A.leftMatch[h].exec(a))&&
f[2]&&(m=A.filter[h],k=f[1],g=!1,f.splice(1,1),"\\"!==k.substr(k.length-1))){v===w&&(w=[]);if(A.preFilter[h])if(f=A.preFilter[h](f,v,d,w,e,t),!f)g=l=!0;else if(!0===f)continue;if(f)for(r=0;null!=(k=v[r]);r++)k&&(l=m(k,f,r,v),n=e^l,d&&null!=l?n?g=!0:v[r]=!1:n&&(w.push(k),g=!0));if(l!==b){d||(v=w);a=a.replace(A.match[h],"");if(!g)return[];break}}if(a===s)if(null==g)q.error(a);else break;s=a}return v};q.error=function(a){throw Error("Syntax error, unrecognized expression: "+a);};var s=q.getText=function(a){var b,
c;b=a.nodeType;var d="";if(b)if(1===b||9===b||11===b){if("string"===typeof a.textContent)return a.textContent;if("string"===typeof a.innerText)return a.innerText.replace(m,"");for(a=a.firstChild;a;a=a.nextSibling)d+=s(a)}else{if(3===b||4===b)return a.nodeValue}else for(b=0;c=a[b];b++)8!==c.nodeType&&(d+=s(c));return d},A=q.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},
type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c="string"===typeof b,d=c&&!n.test(b),c=c&&!d;d&&(b=b.toLowerCase());for(var d=0,e=a.length,f;d<e;d++)if(f=a[d]){for(;(f=f.previousSibling)&&1!==f.nodeType;);a[d]=c||f&&f.nodeName.toLowerCase()===b?f||!1:f===b}c&&q.filter(b,a,!0)},">":function(a,b){var c,d="string"===typeof b,e=0,f=a.length;if(d&&!n.test(b))for(b=b.toLowerCase();e<f;e++){if(c=a[e])c=c.parentNode,a[e]=c.nodeName.toLowerCase()===b?c:!1}else{for(;e<f;e++)(c=
a[e])&&(a[e]=d?c.parentNode:c.parentNode===b);d&&q.filter(b,a,!0)}},"":function(b,d,e){var g,h=f++,l=c;"string"!==typeof d||n.test(d)||(g=d=d.toLowerCase(),l=a);l("parentNode",d,h,b,g,e)},"~":function(b,d,e){var g,h=f++,l=c;"string"!==typeof d||n.test(d)||(g=d=d.toLowerCase(),l=a);l("previousSibling",d,h,b,g,e)}},find:{ID:function(a,b,c){if("undefined"!==typeof b.getElementById&&!c)return(a=b.getElementById(a[1]))&&a.parentNode?[a]:[]},NAME:function(a,b){if("undefined"!==typeof b.getElementsByName){for(var c=
[],d=b.getElementsByName(a[1]),e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return 0===c.length?null:c}},TAG:function(a,b){if("undefined"!==typeof b.getElementsByTagName)return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(k,"")+" ";if(f)return a;f=0;for(var g;null!=(g=b[f]);f++)g&&(e^(g.className&&0<=(" "+g.className+" ").replace(/[\t\n\r]/g," ").indexOf(a))?c||d.push(g):c&&(b[f]=!1));return!1},ID:function(a){return a[1].replace(k,
"")},TAG:function(a,b){return a[1].replace(k,"").toLowerCase()},CHILD:function(a){if("nth"===a[1]){a[2]||q.error(a[0]);a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even"===a[2]&&"2n"||"odd"===a[2]&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0;a[3]=b[3]-0}else a[2]&&q.error(a[0]);a[0]=f++;return a},ATTR:function(a,b,c,d,e,f){b=a[1]=a[1].replace(k,"");!f&&A.attrMap[b]&&(a[1]=A.attrMap[b]);a[4]=(a[4]||a[5]||"").replace(k,"");"~="===a[2]&&(a[4]=" "+a[4]+
" ");return a},PSEUDO:function(a,b,c,e,f){if("not"===a[1])if(1<(d.exec(a[3])||"").length||/^\w/.test(a[3]))a[3]=q(a[3],null,null,b);else return a=q.filter(a[3],b,c,1^f),c||e.push.apply(e,a),!1;else if(A.match.POS.test(a[0])||A.match.CHILD.test(a[0]))return!0;return a},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return!1===a.disabled&&"hidden"!==a.type},disabled:function(a){return!0===a.disabled},checked:function(a){return!0===a.checked},selected:function(a){a.parentNode&&
a.parentNode.selectedIndex;return!0===a.selected},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!q(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"input"===a.nodeName.toLowerCase()&&"text"===c&&(b===c||null===b)},radio:function(a){return"input"===a.nodeName.toLowerCase()&&"radio"===a.type},checkbox:function(a){return"input"===a.nodeName.toLowerCase()&&"checkbox"===
a.type},file:function(a){return"input"===a.nodeName.toLowerCase()&&"file"===a.type},password:function(a){return"input"===a.nodeName.toLowerCase()&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return("input"===b||"button"===b)&&"submit"===a.type},image:function(a){return"input"===a.nodeName.toLowerCase()&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return("input"===b||"button"===b)&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();
return"input"===b&&"button"===a.type||"button"===b},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return 0===b},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return 0===b%2},odd:function(a,b){return 1===b%2},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,
b,c,d){var e=b[1],f=A.filters[e];if(f)return f(a,c,b,d);if("contains"===e)return 0<=(a.textContent||a.innerText||s([a])||"").indexOf(b[3]);if("not"===e){b=b[3];c=0;for(d=b.length;c<d;c++)if(b[c]===a)return!1;return!0}q.error(e)},CHILD:function(a,b){var c,d,f,g,h,l;c=b[1];l=a;switch(c){case "only":case "first":for(;l=l.previousSibling;)if(1===l.nodeType)return!1;if("first"===c)return!0;l=a;case "last":for(;l=l.nextSibling;)if(1===l.nodeType)return!1;return!0;case "nth":c=b[2];d=b[3];if(1===c&&0===
d)return!0;f=b[0];if((g=a.parentNode)&&(g[e]!==f||!a.nodeIndex)){h=0;for(l=g.firstChild;l;l=l.nextSibling)1===l.nodeType&&(l.nodeIndex=++h);g[e]=f}l=a.nodeIndex-d;return 0===c?0===l:0===l%c&&0<=l/c}},ID:function(a,b){return 1===a.nodeType&&a.getAttribute("id")===b},TAG:function(a,b){return"*"===b&&1===a.nodeType||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return-1<(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)},ATTR:function(a,b){var c=b[1],c=q.attr?q.attr(a,c):A.attrHandle[c]?
A.attrHandle[c](a):null!=a[c]?a[c]:a.getAttribute(c),d=c+"",e=b[2],f=b[4];return null==c?"!="===e:!e&&q.attr?null!=c:"="===e?d===f:"*="===e?0<=d.indexOf(f):"~="===e?0<=(" "+d+" ").indexOf(f):f?"!="===e?d!==f:"^="===e?0===d.indexOf(f):"$="===e?d.substr(d.length-f.length)===f:"|="===e?d===f||d.substr(0,f.length+1)===f+"-":!1:d&&!1!==c},POS:function(a,b,c,d){var e=A.setFilters[b[2]];if(e)return e(a,c,b,d)}}},w=A.match.POS,v=function(a,b){return"\\"+(b-0+1)},t;for(t in A.match)A.match[t]=RegExp(A.match[t].source+
/(?![^\[]*\])(?![^\(]*\))/.source),A.leftMatch[t]=RegExp(/(^(?:.|\r|\n)*?)/.source+A.match[t].source.replace(/\\(\d+)/g,v));A.match.globalPOS=w;var u=function(a,b){a=Array.prototype.slice.call(a,0);return b?(b.push.apply(b,a),b):a};try{Array.prototype.slice.call(E.documentElement.childNodes,0)[0].nodeType}catch(B){u=function(a,b){var c=0,d=b||[];if("[object Array]"===g.call(a))Array.prototype.push.apply(d,a);else if("number"===typeof a.length)for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);
return d}}var z,C;E.documentElement.compareDocumentPosition?z=function(a,b){return a===b?(h=!0,0):a.compareDocumentPosition&&b.compareDocumentPosition?a.compareDocumentPosition(b)&4?-1:1:a.compareDocumentPosition?-1:1}:(z=function(a,b){if(a===b)return h=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[];c=a.parentNode;d=b.parentNode;var g=c;if(c===d)return C(a,b);if(!c)return-1;if(!d)return 1;for(;g;)e.unshift(g),g=g.parentNode;for(g=d;g;)f.unshift(g),g=g.parentNode;
c=e.length;d=f.length;for(g=0;g<c&&g<d;g++)if(e[g]!==f[g])return C(e[g],f[g]);return g===c?C(a,f[g],-1):C(e[g],b,1)},C=function(a,b,c){if(a===b)return c;for(a=a.nextSibling;a;){if(a===b)return-1;a=a.nextSibling}return 1});(function(){var a=E.createElement("div"),c="script"+(new Date).getTime(),d=E.documentElement;a.innerHTML="<a name='"+c+"'/>";d.insertBefore(a,d.firstChild);E.getElementById(c)&&(A.find.ID=function(a,c,d){if("undefined"!==typeof c.getElementById&&!d)return(c=c.getElementById(a[1]))?
c.id===a[1]||"undefined"!==typeof c.getAttributeNode&&c.getAttributeNode("id").nodeValue===a[1]?[c]:b:[]},A.filter.ID=function(a,b){var c="undefined"!==typeof a.getAttributeNode&&a.getAttributeNode("id");return 1===a.nodeType&&c&&c.nodeValue===b});d.removeChild(a);d=a=null})();(function(){var a=E.createElement("div");a.appendChild(E.createComment(""));0<a.getElementsByTagName("*").length&&(A.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if("*"===a[1]){for(var d=[],e=0;c[e];e++)1===c[e].nodeType&&
d.push(c[e]);c=d}return c});a.innerHTML="<a href='#'></a>";a.firstChild&&"undefined"!==typeof a.firstChild.getAttribute&&"#"!==a.firstChild.getAttribute("href")&&(A.attrHandle.href=function(a){return a.getAttribute("href",2)});a=null})();E.querySelectorAll&&function(){var a=q,b=E.createElement("div");b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||0!==b.querySelectorAll(".TEST").length){q=function(b,c,d,e){c=c||E;if(!e&&!q.isXML(c)){var f=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(f&&
(1===c.nodeType||9===c.nodeType)){if(f[1])return u(c.getElementsByTagName(b),d);if(f[2]&&A.find.CLASS&&c.getElementsByClassName)return u(c.getElementsByClassName(f[2]),d)}if(9===c.nodeType){if("body"===b&&c.body)return u([c.body],d);if(f&&f[3]){var g=c.getElementById(f[3]);if(g&&g.parentNode){if(g.id===f[3])return u([g],d)}else return u([],d)}try{return u(c.querySelectorAll(b),d)}catch(h){}}else if(1===c.nodeType&&"object"!==c.nodeName.toLowerCase()){var f=c,l=(g=c.getAttribute("id"))||"__sizzle__",
k=c.parentNode,m=/^\s*[+~]/.test(b);g?l=l.replace(/'/g,"\\$&"):c.setAttribute("id",l);m&&k&&(c=c.parentNode);try{if(!m||k)return u(c.querySelectorAll("[id='"+l+"'] "+b),d)}catch(r){}finally{g||f.removeAttribute("id")}}}return a(b,c,d,e)};for(var c in a)q[c]=a[c];b=null}}();(function(){var a=E.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(E.createElement("div"),"div"),d=!1;try{b.call(E.documentElement,"[test!='']:sizzle")}catch(e){d=
!0}q.matchesSelector=function(a,e){e=e.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!q.isXML(a))try{if(d||!A.match.PSEUDO.test(e)&&!/!=/.test(e)){var f=b.call(a,e);if(f||!c||a.document&&11!==a.document.nodeType)return f}}catch(g){}return 0<q(e,null,null,[a]).length}}})();(function(){var a=E.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";a.getElementsByClassName&&0!==a.getElementsByClassName("e").length&&(a.lastChild.className="e",1!==a.getElementsByClassName("e").length&&
(A.order.splice(1,0,"CLASS"),A.find.CLASS=function(a,b,c){if("undefined"!==typeof b.getElementsByClassName&&!c)return b.getElementsByClassName(a[1])},a=null))})();q.contains=E.documentElement.contains?function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:E.documentElement.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:function(){return!1};q.isXML=function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?"HTML"!==a.nodeName:!1};var M=function(a,b,c){var d,
e=[],f="";for(b=b.nodeType?[b]:b;d=A.match.PSEUDO.exec(a);)f+=d[0],a=a.replace(A.match.PSEUDO,"");a=A.relative[a]?a+"*":a;d=0;for(var g=b.length;d<g;d++)q(a,b[d],e,c);return q.filter(f,e)};q.attr=r.attr;q.selectors.attrMap={};r.find=q;r.expr=q.selectors;r.expr[":"]=r.expr.filters;r.unique=q.uniqueSort;r.text=q.getText;r.isXMLDoc=q.isXML;r.contains=q.contains})();var na=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,Ma=/,/,Xa=/^.[^:#\[\.,]*$/,ab=Array.prototype.slice,Na=r.expr.match.globalPOS,Oa={children:!0,
contents:!0,next:!0,prev:!0};r.fn.extend({find:function(a){var b=this,c,d;if("string"!==typeof a)return r(a).filter(function(){c=0;for(d=b.length;c<d;c++)if(r.contains(b[c],this))return!0});var e=this.pushStack("","find",a),f,g,h;c=0;for(d=this.length;c<d;c++)if(f=e.length,r.find(a,this[c],e),0<c)for(g=f;g<e.length;g++)for(h=0;h<f;h++)if(e[h]===e[g]){e.splice(g--,1);break}return e},has:function(a){var b=r(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(r.contains(this,b[a]))return!0})},
not:function(a){return this.pushStack(k(this,a,!1),"not",a)},filter:function(a){return this.pushStack(k(this,a,!0),"filter",a)},is:function(a){return!!a&&("string"===typeof a?Na.test(a)?0<=r(a,this.context).index(this[0]):0<r.filter(a,this).length:0<this.filter(a).length)},closest:function(a,b){var c=[],d,e,f=this[0];if(r.isArray(a)){for(e=1;f&&f.ownerDocument&&f!==b;){for(d=0;d<a.length;d++)r(f).is(a[d])&&c.push({selector:a[d],elem:f,level:e});f=f.parentNode;e++}return c}var g=Na.test(a)||"string"!==
typeof a?r(a,b||this.context):0;d=0;for(e=this.length;d<e;d++)for(f=this[d];f;)if(g?-1<g.index(f):r.find.matchesSelector(f,a)){c.push(f);break}else if(f=f.parentNode,!f||!f.ownerDocument||f===b||11===f.nodeType)break;c=1<c.length?r.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){return a?"string"===typeof a?r.inArray(this[0],r(a)):r.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c="string"===typeof a?r(a,b):r.makeArray(a&&
a.nodeType?[a]:a),d=r.merge(this.get(),c);return this.pushStack(c[0]&&c[0].parentNode&&11!==c[0].parentNode.nodeType&&d[0]&&d[0].parentNode&&11!==d[0].parentNode.nodeType?r.unique(d):d)},andSelf:function(){return this.add(this.prevObject)}});r.each({parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},parents:function(a){return r.dir(a,"parentNode")},parentsUntil:function(a,b,c){return r.dir(a,"parentNode",c)},next:function(a){return r.nth(a,2,"nextSibling")},prev:function(a){return r.nth(a,
2,"previousSibling")},nextAll:function(a){return r.dir(a,"nextSibling")},prevAll:function(a){return r.dir(a,"previousSibling")},nextUntil:function(a,b,c){return r.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return r.dir(a,"previousSibling",c)},siblings:function(a){return r.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return r.sibling(a.firstChild)},contents:function(a){return r.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:r.makeArray(a.childNodes)}},function(a,
b){r.fn[a]=function(c,d){var e=r.map(this,b,c);na.test(a)||(d=c);d&&"string"===typeof d&&(e=r.filter(d,e));e=1<this.length&&!Oa[a]?r.unique(e):e;(1<this.length||Ma.test(d))&&$a.test(a)&&(e=e.reverse());return this.pushStack(e,a,ab.call(arguments).join(","))}});r.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return 1===b.length?r.find.matchesSelector(b[0],a)?[b[0]]:[]:r.find.matches(a,b)},dir:function(a,c,d){var e=[];for(a=a[c];a&&9!==a.nodeType&&(d===b||1!==a.nodeType||!r(a).is(d));)1===a.nodeType&&
e.push(a),a=a[c];return e},nth:function(a,b,c,d){b=b||1;for(d=0;a&&(1!==a.nodeType||++d!==b);a=a[c]);return a},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var pa="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Pa=/ jQuery\d+="(?:\d+|null)"/g,wa=/^\s+/,Qa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ra=/<([\w:]+)/,
bb=/<tbody/i,cb=/<|&#?\w+;/,xa=/<(?:script|style)/i,db=/<(?:script|object|embed|option|style)/i,Sa=RegExp("<(?:"+pa+")[\\s/>]","i"),Ta=/checked\s*(?:[^=]|=\s*.checked.)/i,ya=/\/(java|ecma)script/i,Ua=/^\s*<!(?:\[CDATA\[|\-\-)/,da={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],
area:[1,"<map>","</map>"],_default:[0,"",""]},za=m(E);da.optgroup=da.option;da.tbody=da.tfoot=da.colgroup=da.caption=da.thead;da.th=da.td;r.support.htmlSerialize||(da._default=[1,"div<div>","</div>"]);r.fn.extend({text:function(a){return r.access(this,function(a){return a===b?r.text(this):this.empty().append((this[0]&&this[0].ownerDocument||E).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(r.isFunction(a))return this.each(function(b){r(this).wrapAll(a.call(this,b))});if(this[0]){var b=
r(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):
a)})},unwrap:function(){return this.parent().each(function(){r.nodeName(this,"body")||r(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1===this.nodeType&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1===this.nodeType&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=
r.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,r.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;null!=(d=this[c]);c++)if(!a||r.filter(a,[d]).length)b||1!==d.nodeType||(r.cleanData(d.getElementsByTagName("*")),
r.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;null!=(b=this[a]);a++)for(1===b.nodeType&&r.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a,b){a=null==a?!1:a;b=null==b?a:b;return this.map(function(){return r.clone(this,a,b)})},html:function(a){return r.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(Pa,""):null;if("string"===
typeof a&&!(xa.test(a)||!r.support.leadingWhitespace&&wa.test(a)||da[(Ra.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(Qa,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},1===c.nodeType&&(r.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(r.isFunction(a))return this.each(function(b){var c=r(this),d=c.html();c.replaceWith(a.call(this,b,d))});"string"!==typeof a&&(a=r(a).detach());
return this.each(function(){var b=this.nextSibling,c=this.parentNode;r(this).remove();b?r(b).before(a):r(c).append(a)})}return this.length?this.pushStack(r(r.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,f,g,h=a[0],l=[];if(!r.support.checkClone&&3===arguments.length&&"string"===typeof h&&Ta.test(h))return this.each(function(){r(this).domManip(a,c,d,!0)});if(r.isFunction(h))return this.each(function(e){var f=r(this);a[0]=h.call(this,
e,c?f.html():b);f.domManip(a,c,d)});if(this[0]){e=h&&h.parentNode;e=r.support.parentNode&&e&&11===e.nodeType&&e.childNodes.length===this.length?{fragment:e}:r.buildFragment(a,this,l);g=e.fragment;if(f=1===g.childNodes.length?g=g.firstChild:g.firstChild){c=c&&r.nodeName(f,"tr");f=0;for(var k=this.length,m=k-1;f<k;f++)d.call(c?r.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):this[f]:this[f],e.cacheable||1<k&&f<m?
r.clone(g,!0,!0):g)}l.length&&r.each(l,function(a,b){b.src?r.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):r.globalEval((b.text||b.textContent||b.innerHTML||"").replace(Ua,"/*$0*/"));b.parentNode&&b.parentNode.removeChild(b)})}return this}});r.buildFragment=function(a,b,c){var d,e,f,g,h=a[0];b&&b[0]&&(g=b[0].ownerDocument||b[0]);g.createDocumentFragment||(g=E);1===a.length&&"string"===typeof h&&512>h.length&&g===E&&"<"===h.charAt(0)&&!(db.test(h)||!r.support.checkClone&&Ta.test(h)||
!r.support.html5Clone&&Sa.test(h))&&(e=!0,(f=r.fragments[h])&&1!==f&&(d=f));d||(d=g.createDocumentFragment(),r.clean(a,g,d,c));e&&(r.fragments[h]=f?d:1);return{fragment:d,cacheable:e}};r.fragments={};r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(c){var d=[];c=r(c);var e=1===this.length&&this[0].parentNode;if(e&&11===e.nodeType&&1===e.childNodes.length&&1===c.length)return c[b](this[0]),this;for(var e=
0,f=c.length;e<f;e++){var g=(0<e?this.clone(!0):this).get();r(c[e])[b](g);d=d.concat(g)}return this.pushStack(d,a,c.selector)}});r.extend({clone:function(a,b,c){var d,e,f;r.support.html5Clone||r.isXMLDoc(a)||!Sa.test("<"+a.nodeName+">")?d=a.cloneNode(!0):(d=E.createElement("div"),za.appendChild(d),d.innerHTML=a.outerHTML,d=d.firstChild);var g=d;if(!(r.support.noCloneEvent&&r.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(q(a,g),d=l(a),e=l(g),f=0;d[f];++f)e[f]&&q(d[f],
e[f]);if(b&&(n(a,g),c))for(d=l(a),e=l(g),f=0;d[f];++f)n(d[f],e[f]);return g},clean:function(a,b,c,d){var e,f=[];b=b||E;"undefined"===typeof b.createElement&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||E);for(var g=0,h;null!=(h=a[g]);g++)if("number"===typeof h&&(h+=""),h){if("string"===typeof h)if(cb.test(h)){h=h.replace(Qa,"<$1></$2>");e=(Ra.exec(h)||["",""])[1].toLowerCase();var l=da[e]||da._default,k=l[0],n=b.createElement("div"),q=za.childNodes;b===E?za.appendChild(n):m(b).appendChild(n);for(n.innerHTML=
l[1]+h+l[2];k--;)n=n.lastChild;if(!r.support.tbody)for(k=bb.test(h),l="table"!==e||k?"<table>"!==l[1]||k?[]:n.childNodes:n.firstChild&&n.firstChild.childNodes,e=l.length-1;0<=e;--e)r.nodeName(l[e],"tbody")&&!l[e].childNodes.length&&l[e].parentNode.removeChild(l[e]);!r.support.leadingWhitespace&&wa.test(h)&&n.insertBefore(b.createTextNode(wa.exec(h)[0]),n.firstChild);h=n.childNodes;n&&(n.parentNode.removeChild(n),0<q.length&&(n=q[q.length-1])&&n.parentNode&&n.parentNode.removeChild(n))}else h=b.createTextNode(h);
var s;if(!r.support.appendChecked)if(h[0]&&"number"===typeof(s=h.length))for(e=0;e<s;e++)u(h[e]);else u(h);h.nodeType?f.push(h):f=r.merge(f,h)}if(c)for(a=function(a){return!a.type||ya.test(a.type)},g=0;f[g];g++)b=f[g],d&&r.nodeName(b,"script")&&(!b.type||ya.test(b.type))?d.push(b.parentNode?b.parentNode.removeChild(b):b):(1===b.nodeType&&(h=r.grep(b.getElementsByTagName("script"),a),f.splice.apply(f,[g+1,0].concat(h))),c.appendChild(b));return f},cleanData:function(a){for(var b,c,d=r.cache,e=r.event.special,
f=r.support.deleteExpando,g=0,h;null!=(h=a[g]);g++)if(!h.nodeName||!r.noData[h.nodeName.toLowerCase()])if(c=h[r.expando]){if((b=d[c])&&b.events){for(var l in b.events)e[l]?r.event.remove(h,l):r.removeEvent(h,l,b.handle);b.handle&&(b.handle.elem=null)}f?delete h[r.expando]:h.removeAttribute&&h.removeAttribute(r.expando);delete d[c]}}});var Aa=/alpha\([^)]*\)/i,eb=/opacity=([^)]*)/,Ba=/([A-Z]|^ms)/g,Ca=/^[\-+]?(?:\d*\.)?\d+$/i,va=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,Da=/^([\-+])=([\-+.\de]+)/,Ea=/^margin/,
fb={position:"absolute",visibility:"hidden",display:"block"},la=["Top","Right","Bottom","Left"],ia,Fa,Ga;r.fn.css=function(a,c){return r.access(this,function(a,c,d){return d!==b?r.style(a,c,d):r.css(a,c)},a,c,1<arguments.length)};r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=ia(a,"opacity");return""===c?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":r.support.cssFloat?"cssFloat":
"styleFloat"},style:function(a,c,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g=r.camelCase(c),h=a.style,l=r.cssHooks[g];c=r.cssProps[g]||g;if(d!==b){if(e=typeof d,"string"===e&&(f=Da.exec(d))&&(d=+(f[1]+1)*+f[2]+parseFloat(r.css(a,c)),e="number"),!(null==d||"number"===e&&isNaN(d)||("number"!==e||r.cssNumber[g]||(d+="px"),l&&"set"in l&&(d=l.set(a,d))===b)))try{h[c]=d}catch(k){}}else return l&&"get"in l&&(f=l.get(a,!1,e))!==b?f:h[c]}},css:function(a,c,d){var e,f;c=r.camelCase(c);f=r.cssHooks[c];
c=r.cssProps[c]||c;"cssFloat"===c&&(c="float");if(f&&"get"in f&&(e=f.get(a,!0,d))!==b)return e;if(ia)return ia(a,c)},swap:function(a,b,c){var d={},e;for(e in b)d[e]=a.style[e],a.style[e]=b[e];c=c.call(a);for(e in b)a.style[e]=d[e];return c}});r.curCSS=r.css;E.defaultView&&E.defaultView.getComputedStyle&&(Fa=function(a,b){var c,d,e,f=a.style;b=b.replace(Ba,"-$1").toLowerCase();(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),""!==c||r.contains(a.ownerDocument.documentElement,
a)||(c=r.style(a,b)));!r.support.pixelMargin&&e&&Ea.test(b)&&va.test(c)&&(d=f.width,f.width=c,c=e.width,f.width=d);return c});E.documentElement.currentStyle&&(Ga=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;null==e&&f&&(c=f[b])&&(e=c);if(va.test(e)){c=f.left;if(d=a.runtimeStyle&&a.runtimeStyle.left)a.runtimeStyle.left=a.currentStyle.left;f.left="fontSize"===b?"1em":e;e=f.pixelLeft+"px";f.left=c;d&&(a.runtimeStyle.left=d)}return""===e?"auto":e});ia=Fa||Ga;r.each(["height","width"],
function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return 0!==a.offsetWidth?z(a,b,d):r.swap(a,fb,function(){return z(a,b,d)})},set:function(a,b){return Ca.test(b)?b+"px":b}}});r.support.opacity||(r.cssHooks.opacity={get:function(a,b){return eb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=r.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(1<=b&&""===r.trim(f.replace(Aa,
""))&&(c.removeAttribute("filter"),d&&!d.filter))return;c.filter=Aa.test(f)?f.replace(Aa,e):f+" "+e}});r(function(){r.support.reliableMarginRight||(r.cssHooks.marginRight={get:function(a,b){return r.swap(a,{display:"inline-block"},function(){return b?ia(a,"margin-right"):a.style.marginRight})}})});r.expr&&r.expr.filters&&(r.expr.filters.hidden=function(a){var b=a.offsetHeight;return 0===a.offsetWidth&&0===b||!r.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||r.css(a,"display"))},
r.expr.filters.visible=function(a){return!r.expr.filters.hidden(a)});r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){var d="string"===typeof c?c.split(" "):[c],e={};for(c=0;4>c;c++)e[a+la[c]+b]=d[c]||d[c-2]||d[0];return e}}});var ha=/%20/g,Ja=/\[\]$/,M=/\r?\n/g,W=/#.*$/,Ha=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,qb=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,rb=/^(?:GET|HEAD)$/,sb=/^\/\//,
ib=/\?/,tb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,ub=/^(?:select|textarea)/i,hb=/\s+/,vb=/([?&])_=[^&]*/,jb=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,kb=r.fn.load,Ya={},lb={},ra,sa,mb=["*/"]+["*"];try{ra=O.href}catch(Bb){ra=E.createElement("a"),ra.href="",ra=ra.href}sa=jb.exec(ra.toLowerCase())||[];r.fn.extend({load:function(a,c,d){if("string"!==typeof a&&kb)return kb.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(0<=e){var f=a.slice(e,a.length);a=
a.slice(0,e)}e="GET";c&&(r.isFunction(c)?(d=c,c=b):"object"===typeof c&&(c=r.param(c,r.ajaxSettings.traditional),e="POST"));var g=this;r.ajax({url:a,type:e,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText;a.isResolved()&&(a.done(function(a){c=a}),g.html(f?r("<div>").append(c.replace(tb,"")).find(f):c));d&&g.each(d,[c,b,a])}});return this},serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?r.makeArray(this.elements):
this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||qb.test(this.type))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a,c){return{name:b.name,value:a.replace(M,"\r\n")}}):{name:b.name,value:c.replace(M,"\r\n")}}).get()}});r.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){r.fn[b]=function(a){return this.on(b,a)}});r.each(["get","post"],function(a,c){r[c]=function(a,
d,e,f){r.isFunction(d)&&(f=f||e,e=d,d=b);return r.ajax({type:c,url:a,data:d,success:e,dataType:f})}});r.extend({getScript:function(a,c){return r.get(a,b,c,"script")},getJSON:function(a,b,c){return r.get(a,b,c,"json")},ajaxSetup:function(a,b){b?A(a,r.ajaxSettings):(b=a,a=r.ajaxSettings);A(a,b);return a},ajaxSettings:{url:ra,isLocal:/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/.test(sa[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,
async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":mb},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":r.parseJSON,"text xml":r.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:t(Ya),ajaxTransport:t(lb),ajax:function(a,c){function d(a,c,n,q){if(2!==u){u=2;v&&clearTimeout(v);w=b;s=q||"";M.readyState=0<a?4:
0;var A,t,B;q=c;if(n){var C=e,H=M,D=C.contents,S=C.dataTypes,F=C.responseFields,W,J,P,K;for(J in F)J in n&&(H[F[J]]=n[J]);for(;"*"===S[0];)S.shift(),W===b&&(W=C.mimeType||H.getResponseHeader("content-type"));if(W)for(J in D)if(D[J]&&D[J].test(W)){S.unshift(J);break}if(S[0]in n)P=S[0];else{for(J in n){if(!S[0]||C.converters[J+" "+S[0]]){P=J;break}K||(K=J)}P=P||K}P?(P!==S[0]&&S.unshift(P),n=n[P]):n=void 0}else n=b;if(200<=a&&300>a||304===a){if(e.ifModified){if(W=M.getResponseHeader("Last-Modified"))r.lastModified[m]=
W;if(W=M.getResponseHeader("Etag"))r.etag[m]=W}if(304===a)q="notmodified",A=!0;else try{W=e;W.dataFilter&&(n=W.dataFilter(n,W.dataType));var O=W.dataTypes;J={};var I,Ia,R=O.length,E,T=O[0],N,Ha,Z,X,L;for(I=1;I<R;I++){if(1===I)for(Ia in W.converters)"string"===typeof Ia&&(J[Ia.toLowerCase()]=W.converters[Ia]);N=T;T=O[I];if("*"===T)T=N;else if("*"!==N&&N!==T){Ha=N+" "+T;Z=J[Ha]||J["* "+T];if(!Z)for(X in L=b,J)if(E=X.split(" "),E[0]===N||"*"===E[0])if(L=J[E[1]+" "+T]){X=J[X];!0===X?Z=L:!0===L&&(Z=X);
break}Z||L||r.error("No conversion from "+Ha.replace(" "," to "));!0!==Z&&(n=Z?Z(n):L(X(n)))}}t=n;q="success";A=!0}catch(pb){q="parsererror",B=pb}}else if(B=q,!q||a)q="error",0>a&&(a=0);M.status=a;M.statusText=""+(c||q);A?h.resolveWith(f,[t,q,M]):h.rejectWith(f,[M,q,B]);M.statusCode(k);k=b;z&&g.trigger("ajax"+(A?"Success":"Error"),[M,e,A?t:B]);l.fireWith(f,[M,q]);z&&(g.trigger("ajaxComplete",[M,e]),--r.active||r.event.trigger("ajaxStop"))}}"object"===typeof a&&(c=a,a=b);c=c||{};var e=r.ajaxSetup({},
c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof r)?r(f):r.event,h=r.Deferred(),l=r.Callbacks("once memory"),k=e.statusCode||{},m,n={},q={},s,A,w,v,t,u=0,z,C,M={readyState:0,setRequestHeader:function(a,b){if(!u){var c=a.toLowerCase();a=q[c]=q[c]||a;n[a]=b}return this},getAllResponseHeaders:function(){return 2===u?s:null},getResponseHeader:function(a){var c;if(2===u){if(!A)for(A={};c=Ha.exec(s);)A[c[1].toLowerCase()]=c[2];c=A[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){u||
(e.mimeType=a);return this},abort:function(a){a=a||"abort";w&&w.abort(a);d(0,a);return this}};h.promise(M);M.success=M.done;M.error=M.fail;M.complete=l.add;M.statusCode=function(a){if(a){var b;if(2>u)for(b in a)k[b]=[k[b],a[b]];else b=a[M.status],M.then(b,b)}return this};e.url=((a||e.url)+"").replace(W,"").replace(sb,sa[1]+"//");e.dataTypes=r.trim(e.dataType||"*").toLowerCase().split(hb);null==e.crossDomain&&(t=jb.exec(e.url.toLowerCase()),e.crossDomain=!(!t||t[1]==sa[1]&&t[2]==sa[2]&&(t[3]||("http:"===
t[1]?80:443))==(sa[3]||("http:"===sa[1]?80:443))));e.data&&e.processData&&"string"!==typeof e.data&&(e.data=r.param(e.data,e.traditional));B(Ya,e,c,M);if(2===u)return!1;z=e.global;e.type=e.type.toUpperCase();e.hasContent=!rb.test(e.type);z&&0===r.active++&&r.event.trigger("ajaxStart");if(!e.hasContent&&(e.data&&(e.url+=(ib.test(e.url)?"&":"?")+e.data,delete e.data),m=e.url,!1===e.cache)){t=r.now();var H=e.url.replace(vb,"$1_="+t);e.url=H+(H===e.url?(ib.test(e.url)?"&":"?")+"_="+t:"")}(e.data&&e.hasContent&&
!1!==e.contentType||c.contentType)&&M.setRequestHeader("Content-Type",e.contentType);e.ifModified&&(m=m||e.url,r.lastModified[m]&&M.setRequestHeader("If-Modified-Since",r.lastModified[m]),r.etag[m]&&M.setRequestHeader("If-None-Match",r.etag[m]));M.setRequestHeader("Accept",e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+("*"!==e.dataTypes[0]?", "+mb+"; q=0.01":""):e.accepts["*"]);for(C in e.headers)M.setRequestHeader(C,e.headers[C]);if(e.beforeSend&&(!1===e.beforeSend.call(f,M,
e)||2===u))return M.abort(),!1;for(C in{success:1,error:1,complete:1})M[C](e[C]);if(w=B(lb,e,c,M)){M.readyState=1;z&&g.trigger("ajaxSend",[M,e]);e.async&&0<e.timeout&&(v=setTimeout(function(){M.abort("timeout")},e.timeout));try{u=1,w.send(n,d)}catch(D){if(2>u)d(-1,D);else throw D;}}else d(-1,"No Transport");return M},param:function(a,c){var d=[],e=function(a,b){b=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=r.ajaxSettings.traditional);if(r.isArray(a)||
a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(var f in a)w(f,a[f],c,e);return d.join("&").replace(ha,"+")}});r.extend({active:0,lastModified:{},etag:{}});var wb=r.now(),Va=/(\=)\?(&|$)|\?\?/i;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return r.expando+"_"+wb++}});r.ajaxPrefilter("json jsonp",function(b,c,d){c="string"===typeof b.data&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if("jsonp"===b.dataTypes[0]||!1!==b.jsonp&&(Va.test(b.url)||
c&&Va.test(b.data))){var e,f=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,g=a[f],h=b.url,l=b.data,k="$1"+f+"$2";!1!==b.jsonp&&(h=h.replace(Va,k),b.url===h&&(c&&(l=l.replace(Va,k)),b.data===l&&(h+=(/\?/.test(h)?"&":"?")+b.jsonp+"="+f)));b.url=h;b.data=l;a[f]=function(a){e=[a]};d.always(function(){a[f]=g;if(e&&r.isFunction(g))a[f](e[0])});b.converters["script json"]=function(){e||r.error(f+" was not called");return e[0]};b.dataTypes[0]="json";return"script"}});r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},
contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){r.globalEval(a);return a}}});r.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1);a.crossDomain&&(a.type="GET",a.global=!1)});r.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=E.head||E.getElementsByTagName("head")[0]||E.documentElement;return{send:function(e,f){c=E.createElement("script");c.async="async";a.scriptCharset&&(c.charset=a.scriptCharset);c.src=a.url;c.onload=c.onreadystatechange=function(a,
e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||f(200,"success")};d.insertBefore(c,d.firstChild)},abort:function(){if(c)c.onload(0,1)}}}});var gb=a.ActiveXObject?function(){for(var a in ua)ua[a](0,1)}:!1,xb=0,ua;r.ajaxSettings.xhr=a.ActiveXObject?function(){var b;if(!(b=!this.isLocal&&v()))a:{try{b=new a.ActiveXObject("Microsoft.XMLHTTP");break a}catch(c){}b=void 0}return b}:v;(function(a){r.extend(r.support,
{ajax:!!a,cors:!!a&&"withCredentials"in a})})(r.ajaxSettings.xhr());r.support.ajax&&r.ajaxTransport(function(c){if(!c.crossDomain||r.support.cors){var d;return{send:function(e,f){var g=c.xhr(),h,l;c.username?g.open(c.type,c.url,c.async,c.username,c.password):g.open(c.type,c.url,c.async);if(c.xhrFields)for(l in c.xhrFields)g[l]=c.xhrFields[l];c.mimeType&&g.overrideMimeType&&g.overrideMimeType(c.mimeType);c.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");try{for(l in e)g.setRequestHeader(l,
e[l])}catch(k){}g.send(c.hasContent&&c.data||null);d=function(a,e){var l,k,m,n,q;try{if(d&&(e||4===g.readyState))if(d=b,h&&(g.onreadystatechange=r.noop,gb&&delete ua[h]),e)4!==g.readyState&&g.abort();else{l=g.status;m=g.getAllResponseHeaders();n={};(q=g.responseXML)&&q.documentElement&&(n.xml=q);try{n.text=g.responseText}catch(s){}try{k=g.statusText}catch(A){k=""}l||!c.isLocal||c.crossDomain?1223===l&&(l=204):l=n.text?200:404}}catch(w){e||f(-1,w)}n&&f(l,k,n,m)};c.async&&4!==g.readyState?(h=++xb,gb&&
(ua||(ua={},r(a).unload(gb)),ua[h]=d),g.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var Za={},ja,ta,yb=/^(?:toggle|show|hide)$/,zb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,Wa,La=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],Ka;r.fn.extend({show:function(a,b,c){if(a||0===a)return this.animate(D("show",3),a,b,c);c=0;for(var d=this.length;c<d;c++)a=this[c],a.style&&(b=a.style.display,r._data(a,
"olddisplay")||"none"!==b||(b=a.style.display=""),(""===b&&"none"===r.css(a,"display")||!r.contains(a.ownerDocument.documentElement,a))&&r._data(a,"olddisplay",F(a.nodeName)));for(c=0;c<d;c++)if(a=this[c],a.style&&(b=a.style.display,""===b||"none"===b))a.style.display=r._data(a,"olddisplay")||"";return this},hide:function(a,b,c){if(a||0===a)return this.animate(D("hide",3),a,b,c);c=0;for(var d=this.length;c<d;c++)a=this[c],a.style&&(b=r.css(a,"display"),"none"===b||r._data(a,"olddisplay")||r._data(a,
"olddisplay",b));for(c=0;c<d;c++)this[c].style&&(this[c].style.display="none");return this},_toggle:r.fn.toggle,toggle:function(a,b,c){var d="boolean"===typeof a;r.isFunction(a)&&r.isFunction(b)?this._toggle.apply(this,arguments):null==a||d?this.each(function(){var b=d?a:r(this).is(":hidden");r(this)[b?"show":"hide"]()}):this.animate(D("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,
b,c,d){function e(){!1===f.queue&&r._mark(this);var b=r.extend({},f),c=1===this.nodeType,d=c&&r(this).is(":hidden"),g,h,l,k,m;b.animatedProperties={};for(l in a)if(g=r.camelCase(l),l!==g&&(a[g]=a[l],delete a[l]),(h=r.cssHooks[g])&&"expand"in h)for(l in k=h.expand(a[g]),delete a[g],k)l in a||(a[l]=k[l]);for(g in a){h=a[g];r.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if("hide"===h&&d||"show"===h&&!d)return b.complete.call(this);
!c||"height"!==g&&"width"!==g||(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],"inline"===r.css(this,"display")&&"none"===r.css(this,"float")&&(r.support.inlineBlockNeedsLayout&&"inline"!==F(this.nodeName)?this.style.zoom=1:this.style.display="inline-block"))}null!=b.overflow&&(this.style.overflow="hidden");for(l in a)if(c=new r.fx(this,b,l),h=a[l],yb.test(h))if(g=r._data(this,"toggle"+l)||("toggle"===h?d?"show":"hide":0))r._data(this,"toggle"+l,"show"===g?"hide":"show"),
c[g]();else c[h]();else g=zb.exec(h),k=c.cur(),g?(h=parseFloat(g[2]),m=g[3]||(r.cssNumber[l]?"":"px"),"px"!==m&&(r.style(this,l,(h||1)+m),k*=(h||1)/c.cur(),r.style(this,l,k+m)),g[1]&&(h=("-="===g[1]?-1:1)*h+k),c.custom(k,h,m)):c.custom(k,h,"");return!0}var f=r.speed(b,c,d);if(r.isEmptyObject(a))return this.each(f.complete,[!1]);a=r.extend({},a);return!1===f.queue?this.each(e):this.queue(f.queue,e)},stop:function(a,c,d){"string"!==typeof a&&(d=c,c=a,a=b);c&&!1!==a&&this.queue(a||"fx",[]);return this.each(function(){var b,
c=!1,e=r.timers,f=r._data(this);d||r._unmark(!0,this);if(null==a)for(b in f){if(f[b]&&f[b].stop&&b.indexOf(".run")===b.length-4){var g=f[b];r.removeData(this,b,!0);g.stop(d)}}else f[b=a+".run"]&&f[b].stop&&(f=f[b],r.removeData(this,b,!0),f.stop(d));for(b=e.length;b--;)if(e[b].elem===this&&(null==a||e[b].queue===a)){if(d)e[b](!0);else e[b].saveState();c=!0;e.splice(b,1)}d&&c||r.dequeue(this,a)})}});r.each({slideDown:D("show",1),slideUp:D("hide",1),slideToggle:D("toggle",1),fadeIn:{opacity:"show"},
fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}});r.extend({speed:function(a,b,c){var d=a&&"object"===typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};d.duration=r.fx.off?0:"number"===typeof d.duration?d.duration:d.duration in r.fx.speeds?r.fx.speeds[d.duration]:r.fx.speeds._default;if(null==d.queue||!0===d.queue)d.queue="fx";d.old=d.complete;d.complete=function(a){r.isFunction(d.old)&&
d.old.call(this);d.queue?r.dequeue(this,d.queue):!1!==a&&r._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+0.5}},timers:[],fx:function(a,b,c){this.options=b;this.elem=a;this.prop=c;b.orig=b.orig||{}}});r.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(r.fx.step[this.prop]||r.fx.step._default)(this)},cur:function(){if(null!=this.elem[this.prop]&&(!this.elem.style||null==this.elem.style[this.prop]))return this.elem[this.prop];
var a,b=r.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?b&&"auto"!==b?b:0:a},custom:function(a,c,d){function e(a){return f.step(a)}var f=this,g=r.fx;this.startTime=Ka||C();this.end=c;this.now=this.start=a;this.pos=this.state=0;this.unit=d||this.unit||(r.cssNumber[this.prop]?"":"px");e.queue=this.options.queue;e.elem=this.elem;e.saveState=function(){r._data(f.elem,"fxshow"+f.prop)===b&&(f.options.hide?r._data(f.elem,"fxshow"+f.prop,f.start):f.options.show&&r._data(f.elem,"fxshow"+f.prop,f.end))};
e()&&r.timers.push(e)&&!Wa&&(Wa=setInterval(g.tick,g.interval))},show:function(){var a=r._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||r.style(this.elem,this.prop);this.options.show=!0;a!==b?this.custom(this.cur(),a):this.custom("width"===this.prop||"height"===this.prop?1:0,this.cur());r(this.elem).show()},hide:function(){this.options.orig[this.prop]=r._data(this.elem,"fxshow"+this.prop)||r.style(this.elem,this.prop);this.options.hide=!0;this.custom(this.cur(),0)},step:function(a){var b,
c=Ka||C(),d=!0,e=this.elem,f=this.options;if(a||c>=f.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();f.animatedProperties[this.prop]=!0;for(b in f.animatedProperties)!0!==f.animatedProperties[b]&&(d=!1);if(d){null==f.overflow||r.support.shrinkWrapBlocks||r.each(["","X","Y"],function(a,b){e.style["overflow"+b]=f.overflow[a]});f.hide&&r(e).hide();if(f.hide||f.show)for(b in f.animatedProperties)r.style(e,b,f.orig[b]),r.removeData(e,"fxshow"+b,!0),r.removeData(e,"toggle"+
b,!0);if(a=f.complete)f.complete=!1,a.call(e)}return!1}Infinity==f.duration?this.now=c:(a=c-this.startTime,this.state=a/f.duration,this.pos=r.easing[f.animatedProperties[this.prop]](this.state,a,0,1,f.duration),this.now=this.start+(this.end-this.start)*this.pos);this.update();return!0}};r.extend(r.fx,{tick:function(){for(var a,b=r.timers,c=0;c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||r.fx.stop()},interval:13,stop:function(){clearInterval(Wa);Wa=null},speeds:{slow:600,fast:200,
_default:400},step:{opacity:function(a){r.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&null!=a.elem.style[a.prop]?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}});r.each(La.concat.apply([],La),function(a,b){b.indexOf("margin")&&(r.fx.step[b]=function(a){r.style(a.elem,b,Math.max(0,a.now)+a.unit)})});r.expr&&r.expr.filters&&(r.expr.filters.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length});var nb,Ab=/^t(?:able|d|h)$/i,ob=/^(?:body|html)$/i;
nb="getBoundingClientRect"in E.documentElement?function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!r.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};a=b.body;b=I(b);return{top:d.top+(b.pageYOffset||r.support.boxModel&&c.scrollTop||a.scrollTop)-(c.clientTop||a.clientTop||0),left:d.left+(b.pageXOffset||r.support.boxModel&&c.scrollLeft||a.scrollLeft)-(c.clientLeft||a.clientLeft||0)}}:function(a,b,c){var d,e=a.offsetParent,f=b.body;d=(b=b.defaultView)?b.getComputedStyle(a,
null):a.currentStyle;for(var g=a.offsetTop,h=a.offsetLeft;(a=a.parentNode)&&a!==f&&a!==c&&(!r.support.fixedPosition||"fixed"!==d.position);)d=b?b.getComputedStyle(a,null):a.currentStyle,g-=a.scrollTop,h-=a.scrollLeft,a===e&&(g+=a.offsetTop,h+=a.offsetLeft,!r.support.doesNotAddBorder||r.support.doesAddBorderForTableAndCells&&Ab.test(a.nodeName)||(g+=parseFloat(d.borderTopWidth)||0,h+=parseFloat(d.borderLeftWidth)||0),e=a.offsetParent),r.support.subtractsBorderForOverflowNotVisible&&"visible"!==d.overflow&&
(g+=parseFloat(d.borderTopWidth)||0,h+=parseFloat(d.borderLeftWidth)||0);if("relative"===d.position||"static"===d.position)g+=f.offsetTop,h+=f.offsetLeft;r.support.fixedPosition&&"fixed"===d.position&&(g+=Math.max(c.scrollTop,f.scrollTop),h+=Math.max(c.scrollLeft,f.scrollLeft));return{top:g,left:h}};r.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){r.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;return d?c===d.body?r.offset.bodyOffset(c):nb(c,d,
d.documentElement):null};r.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;r.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(r.css(a,"marginTop"))||0,c+=parseFloat(r.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=r.css(a,"position");"static"===d&&(a.style.position="relative");var e=r(a),f=e.offset(),g=r.css(a,"top"),h=r.css(a,"left"),l={},k={};("absolute"===d||"fixed"===d)&&-1<r.inArray("auto",[g,h])?(k=e.position(),d=k.top,h=k.left):(d=parseFloat(g)||
0,h=parseFloat(h)||0);r.isFunction(b)&&(b=b.call(a,c,f));null!=b.top&&(l.top=b.top-f.top+d);null!=b.left&&(l.left=b.left-f.left+h);"using"in b?b.using.call(a,l):e.css(l)}};r.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ob.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(r.css(a,"marginTop"))||0;c.left-=parseFloat(r.css(a,"marginLeft"))||0;d.top+=parseFloat(r.css(b[0],"borderTopWidth"))||0;d.left+=parseFloat(r.css(b[0],
"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||E.body;a&&!ob.test(a.nodeName)&&"static"===r.css(a,"position");)a=a.offsetParent;return a})}});r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);r.fn[a]=function(e){return r.access(this,function(a,e,f){var g=I(a);if(f===b)return g?c in g?g[c]:r.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:a[e];
g?g.scrollTo(d?r(g).scrollLeft():f,d?f:r(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}});r.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,f="offset"+a;r.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(r.css(a,c,"padding")):this[c]():null};r.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(r.css(b,c,a?"margin":"border")):this[c]():null};r.fn[c]=function(a){return r.access(this,function(a,c,g){if(r.isWindow(a))return c=a.document,
a=c.documentElement[d],r.support.boxModel&&a||c.body&&c.body[d]||a;if(9===a.nodeType)return c=a.documentElement,c[d]>=c[e]?c[d]:Math.max(a.body[e],c[e],a.body[f],c[f]);if(g===b)return a=r.css(a,c),c=parseFloat(a),r.isNumeric(c)?c:a;r(a).css(c,g)},c,a,arguments.length,null)}});a.jQuery=a.$=r;"function"===typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return r})})(window);jQuery.cookie=function(a,b,c){if(1<arguments.length&&"[object Object]"!==String(b)){c=jQuery.extend({},c);if(null===b||void 0===b)c.expires=-1;if("number"===typeof c.expires){var d=c.expires,e=c.expires=new Date;e.setDate(e.getDate()+d)}b=String(b);return document.cookie=[encodeURIComponent(a),"=",c.raw?b:encodeURIComponent(b),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}c=b||{};e=c.raw?function(a){return a}:
decodeURIComponent;return(d=RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)").exec(document.cookie))?e(d[1]):null};(function(a){function b(b){var c=b||window.event,d=[].slice.call(arguments,1),h=0,k=0,m=0;b=a.event.fix(c);b.type="mousewheel";c.wheelDelta&&(h=c.wheelDelta/120);c.detail&&(h=-c.detail/3);m=h;void 0!==c.axis&&c.axis===c.HORIZONTAL_AXIS&&(m=0,k=-1*h);void 0!==c.wheelDeltaY&&(m=c.wheelDeltaY/120);void 0!==c.wheelDeltaX&&(k=-1*c.wheelDeltaX/120);d.unshift(b,h,k,m);return(a.event.dispatch||a.event.handle).apply(this,d)}var c=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var d=c.length;d;)a.event.fixHooks[c[--d]]=
a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],b,!1);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],b,!1);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);(function(a,b){function c(){this._state=[];this._defaults={classHolder:"sbHolder",classHolderDisabled:"sbHolderDisabled",classHolderOpen:"sbHolderOpen",classSelector:"sbSelector",classOptions:"sbOptions",classGroup:"sbGroup",classSub:"sbSub",classDisabled:"sbDisabled",classToggleOpen:"sbToggleOpen",classToggle:"sbToggle",speed:200,slidesUp:!1,effect:"slide",onChange:null,onOpen:null,onClose:null}}var d=!0;a.extend(c.prototype,{_isOpenSelectbox:function(a){return a?this._getInst(a).isOpen:!1},_isDisabledSelectbox:function(a){return a?
this._getInst(a).isDisabled:!1},_attachSelectbox:function(c,f){function g(){var b,c=this.attr("id").split("_")[1];for(b in n._state)b!==c&&n._state.hasOwnProperty(b)&&a(":input[sb='"+b+"']")[0]&&n._closeSelectbox(a(":input[sb='"+b+"']")[0])}function h(b){m.children().each(function(d){if(a(this).is(":selected")){if(38==b&&0<d)return d=a(m.children()[d-1]),n._changeSelectbox(c,d.val(),d.text()),!1;if(40==b&&d<m.children().length-1)return d=a(m.children()[d+1]),n._changeSelectbox(c,d.val(),d.text()),
!1}})}function k(f,g){var h=g&&g.sub?!0:!1,l=g&&g.disabled?!0:!1;f.each(function(f){var g=a(this),k=a("<li>"),m;g.is(":selected")&&(s.text(g.text()),t=d);f===A-1&&k.addClass("last");(function(){var d=g.text(),f=g.data("custom-option-text"),f=f!=b?f:d;g.is(":disabled")||l?m=a("<span>",{text:f}).addClass(q.settings.classDisabled):(m=a("<a>",{href:"#"+g.val(),rel:g.val(),text:f,click:function(b){b.preventDefault();b=u;b.attr("id").split("_");n._closeSelectbox(c);n._changeSelectbox(c,a(this).attr("rel"),
d);b.focus()}}),g.is(":selected")&&m.addClass("active"));h&&m.addClass(q.settings.classSub);m.appendTo(k)})();k.appendTo(z)})}if(this._getInst(c))return!1;var m=a(c),n=this,q=n._newInst(m),l,s,u,z,t=!1;m.find("optgroup");var B=m.find("option"),A=B.length;m.attr("sb",q.uid);a.extend(q.settings,n._defaults,f);n._state[q.uid]=!1;m.hide();l=a("<div>",{id:"sbHolder_"+q.uid,"class":q.settings.classHolder});var w=m.data("selectbox-css");w&&l.css(w);s=a("<a>",{id:"sbSelector_"+q.uid,href:"#","class":q.settings.classSelector,
click:function(b){b.preventDefault();b.stopPropagation();g.apply(a(this),[]);b=a(this).attr("id").split("_")[1];n._state[b]?n._closeSelectbox(c):(n._openSelectbox(c),u.focus())},keyup:function(a){h(a.keyCode)}});u=a("<a>",{id:"sbToggle_"+q.uid,href:"#","class":q.settings.classToggle,click:function(b){b.preventDefault();b.stopPropagation();g.apply(a(this),[]);b=a(this).attr("id").split("_")[1];n._state[b]?n._closeSelectbox(c):(n._openSelectbox(c),u.focus())},keyup:function(a){h(a.keyCode)}});u.appendTo(l);
z=a("<ul>",{id:"sbOptions_"+q.uid,"class":q.settings.classOptions,css:{display:"none"}});m.children().each(function(b){b=a(this);var c,d={};b.is("option")?k(b):b.is("optgroup")&&(c=a("<li>"),a("<span>",{text:b.attr("label")}).addClass(q.settings.classGroup).appendTo(c),c.appendTo(z),b.is(":disabled")&&(d.disabled=!0),d.sub=!0,k(b.find("option"),d))});t||s.text(B.first().text());a.data(c,"selectbox",q);s.appendTo(l);z.appendTo(l);l.insertAfter(m)},_detachSelectbox:function(b){var c=this._getInst(b);
if(!c)return!1;a("#sbHolder_"+c.uid).remove();a.data(b,"selectbox",null);a(b).show()},_changeSelectbox:function(b,c,g){var h=this._getInst(b),k=this._get(h,"onChange");a("#sbSelector_"+h.uid).text(g);a("#sbOptions_"+h.uid).find(".active").removeClass("active");a("#sbOptions_"+h.uid).find('a[rel="'+c+'"]').addClass("active");a(b).find("option").attr("selected",!1);a(b).find("option[value='"+c+"']").attr("selected",d);k?k.apply(h.input?h.input[0]:null,[c,h]):h.input&&h.input.trigger("change")},_enableSelectbox:function(b){var c=
this._getInst(b);if(!c||!c.isDisabled)return!1;a("#sbHolder_"+c.uid).removeClass(c.settings.classHolderDisabled);c.isDisabled=!1;a.data(b,"selectbox",c)},_disableSelectbox:function(b){var c=this._getInst(b);if(!c||c.isDisabled)return!1;a("#sbHolder_"+c.uid).addClass(c.settings.classHolderDisabled);c.isDisabled=d;a.data(b,"selectbox",c)},_optionSelectbox:function(b,c,d){var h=this._getInst(b);if(!h)return!1;h[c]=d;a.data(b,"selectbox",h)},_openSelectbox:function(b){var c=this._getInst(b),g=this;if(c&&
!c.isOpen&&!c.isDisabled){var h=a("#sbOptions_"+c.uid),k=parseInt(a(window).height(),10),m=parseInt(a(window).width(),10),n=a("#sbHolder_"+c.uid).offset(),q=a(window).scrollTop(),l=h.prev().height(),k=k-(n.top-q)-l/2,s=this._get(c,"onOpen");50<k&&!c.settings.slidesUp?h.css({bottom:"auto",top:l+2+"px",maxHeight:k-l+"px"}):h.css({top:"auto",bottom:l+2+"px",maxHeight:n.top-q-l/2+"px"});n.left+h.width()>m?h.css("left","-"+(h.width()-h.parent().width()+3)+"px"):h.css("left","-1px");"fade"===c.settings.effect?
h.fadeIn(c.settings.speed):h.slideDown(c.settings.speed);a("#sbToggle_"+c.uid).addClass(c.settings.classToggleOpen);a("#sbHolder_"+c.uid).addClass(c.settings.classHolderOpen);this._state[c.uid]=d;c.isOpen=d;s&&s.apply(c.input?c.input[0]:null,[c]);a.data(b,"selectbox",c);a("html").unbind("click.sbClose").one("click.sbClose",function(){g._closeSelectbox(b)})}},_closeSelectbox:function(b){var c=this._getInst(b);if(c&&c.isOpen){var d=this._get(c,"onClose");a("#sbOptions_"+c.uid).hide();a("#sbToggle_"+
c.uid).removeClass(c.settings.classToggleOpen);a("#sbHolder_"+c.uid).removeClass(c.settings.classHolderOpen);this._state[c.uid]=!1;c.isOpen=!1;d&&d.apply(c.input?c.input[0]:null,[c]);a.data(b,"selectbox",c);a("html").unbind("click.sbClose")}},_newInst:function(a){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,uid:Math.floor(99999999*Math.random()),isOpen:!1,isDisabled:!1,settings:{}}},_getInst:function(b){try{return a.data(b,"selectbox")}catch(c){throw"Missing instance data for this selectbox";
}},_get:function(a,c){return a.settings[c]!==b?a.settings[c]:this._defaults[c]}});a.fn.selectbox=function(b){var c=Array.prototype.slice.call(arguments,1);return"string"==typeof b&&"isDisabled"==b||"option"==b&&2==arguments.length&&"string"==typeof arguments[1]?a.selectbox["_"+b+"Selectbox"].apply(a.selectbox,[this[0]].concat(c)):this.each(function(){"string"==typeof b?a.selectbox["_"+b+"Selectbox"].apply(a.selectbox,[this].concat(c)):a.selectbox._attachSelectbox(this,b)})};a.selectbox=new c;a.selectbox.version=
"0.1.3"})(jQuery);(function(a,b){var c="hidden",d="fontFamily fontSize fontWeight fontStyle letterSpacing textTransform wordSpacing".split(" "),e=a('<textarea style="position:absolute; top:-9999px; left:-9999px; right:auto; bottom:auto; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden">')[0];e.setAttribute("oninput","return");a.isFunction(e.oninput)||"onpropertychange"in e?a.fn.autosize=function(b){return this.each(function(){function e(){var a,b;l||(l=!0,
m.value=h.value,m.style.overflowY=h.style.overflowY,m.style.width=k.css("width"),m.style.textIndent=k.css("text-indent"),m.scrollTop=0,m.scrollTop=9E4,a=m.scrollTop,b=c,a>q?(a=q,b="scroll"):a<n&&(a=n),h.style.overflowY=b,h.style.height=h.style.minHeight=h.style.maxHeight=a+u+"px",setTimeout(function(){l=!1},1));k.trigger("autosizeComplete")}for(var h=this,k=a(h).css({overflow:c,overflowY:c,wordWrap:"break-word"}),m=a('<textarea style="position:absolute; top:-9999px; left:-9999px; right:auto; bottom:auto; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden">').addClass(b||
"autosizejs")[0],n=k.height(),q=parseInt(k.css("maxHeight"),10),l,s=d.length,u="border-box"===k.css("box-sizing")?k.outerHeight()-k.height():0,q=q&&0<q?q:9E4;s--;)m.style[d[s]]=k.css(d[s]);a("body").append(m);"onpropertychange"in h?"oninput"in h?h.oninput=h.onkeyup=e:h.onpropertychange=e:h.oninput=e;a(window).resize(e);k.bind("autosize",e);e()})}:a.fn.autosize=function(){return this}})(jQuery);(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;a.fn.extend({actual:function(b,c){if(!this[b])throw'$.actual => The jQuery method "'+b+'" you called does not exist';var d=a.extend({absolute:!1,clone:!1,includeMargin:!1},c),e=this.eq(0),f,g;if(!0===d.clone)f=function(){e=e.clone().attr("style","position: absolute !important; top: -1000 !important; ").appendTo("body")},g=function(){e.remove()};else{var h=[],k="",m;f=function(){m=e.parents().addBack().filter(":hidden");k+="visibility: hidden !important; display: block !important; ";
!0===d.absolute&&(k+="position: absolute !important; ");m.each(function(){var b=a(this),c=b.attr("style");h.push(c);b.attr("style",c?c+";"+k:k)})};g=function(){m.each(function(b){var c=a(this);b=h[b];void 0===b?c.removeAttr("style"):c.attr("style",b)})}}f();f=/(outer)/.test(b)?e[b](d.includeMargin):e[b]();g();return f}})})(jQuery);window.Modernizr=function(a,b,c){function d(a,b){return typeof a===b}function e(a,b){for(var d in a){var e=a[d];if(!~(""+e).indexOf("-")&&m[e]!==c)return"pfx"==b?e:!0}return!1}function f(a,b,f){var g=a.charAt(0).toUpperCase()+a.slice(1),h=(a+" "+q.join(g+" ")+g).split(" ");if(d(b,"string")||d(b,"undefined"))b=e(h,b);else a:{h=(a+" "+l.join(g+" ")+g).split(" "),a=h;for(var k in a)if(g=b[a[k]],g!==c){b=!1===f?a[k]:d(g,"function")?g.bind(f||b):g;break a}b=!1}return b}var g={},h=b.documentElement,k=b.createElement("modernizr"),
m=k.style,n=" -webkit- -moz- -o- -ms- ".split(" "),q=["Webkit","Moz","O","ms"],l=["webkit","moz","o","ms"],k={},s=[],u=s.slice,z,t=function(a,c,d,e){var f,g,l,k,m=b.createElement("div"),n=b.body,q=n||b.createElement("body");if(parseInt(d,10))for(;d--;)l=b.createElement("div"),l.id=e?e[d]:"modernizr"+(d+1),m.appendChild(l);return f=['&#173;<style id="smodernizr">',a,"</style>"].join(""),m.id="modernizr",(n?m:q).innerHTML+=f,q.appendChild(m),n||(q.style.background="",q.style.overflow="hidden",k=h.style.overflow,
h.style.overflow="hidden",h.appendChild(q)),g=c(m,a),n?m.parentNode.removeChild(m):(q.parentNode.removeChild(q),h.style.overflow=k),!!g},B=function(){var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return function(e,f){f=f||b.createElement(a[e]||"div");e="on"+e;var g=e in f;return g||(f.setAttribute||(f=b.createElement("div")),f.setAttribute&&f.removeAttribute&&(f.setAttribute(e,""),g=d(f[e],"function"),d(f[e],"undefined")||(f[e]=c),f.removeAttribute(e))),
g}}(),A={}.hasOwnProperty,w;d(A,"undefined")||d(A.call,"undefined")?w=function(a,b){return b in a&&d(a.constructor.prototype[b],"undefined")}:w=function(a,b){return A.call(a,b)};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=u.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var e=new e,f=b.apply(e,c.concat(u.call(arguments)));return Object(f)===f?f:e}return b.apply(a,c.concat(u.call(arguments)))};
return d});k.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")};k.canvastext=function(){return!!g.canvas&&!!d(b.createElement("canvas").getContext("2d").fillText,"function")};k.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:t(["@media (",n.join("touch-enabled),("),"modernizr){#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=9===a.offsetTop}),c};k.history=function(){return!!a.history&&!!history.pushState};
k.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a};k.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a};k.multiplebgs=function(){m.cssText="background:url(https://),url(https://),red url(https://)";return/(url\s*\(.*?){3}/.test(m.background)};k.csscolumns=function(){return f("columnCount")};k.csstransitions=function(){return f("transition")};k.localstorage=function(){try{return localStorage.setItem("modernizr","modernizr"),localStorage.removeItem("modernizr"),
!0}catch(a){return!1}};for(var v in k)w(k,v)&&(z=v.toLowerCase(),g[z]=k[v](),s.push((g[z]?"":"no-")+z));g.addTest=function(a,b){if("object"==typeof a)for(var d in a)w(a,d)&&g.addTest(d,a[d]);else{a=a.toLowerCase();if(g[a]!==c)return g;b="function"==typeof b?b():b;h.className+=" feature-"+(b?"":"no-")+a;g[a]=b}return g};m.cssText="";return k=null,g._version="2.7.1",g._prefixes=n,g._domPrefixes=l,g._cssomPrefixes=q,g.hasEvent=B,g.testProp=function(a){return e([a])},g.testAllProps=f,g.testStyles=t,h.className=
h.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(" feature-js feature-"+s.join(" feature-")),g}(this,this.document);Modernizr.touch=Modernizr.touch&&"onorientationchange"in window;Modernizr.addTest("pointerevents",function(){var a=document.createElement("x"),b=document.documentElement,c=window.getComputedStyle;if(!("pointerEvents"in a.style))return!1;a.style.pointerEvents="auto";a.style.pointerEvents="x";b.appendChild(a);c=c&&"auto"===c(a,"").pointerEvents;b.removeChild(a);return!!c});(function(a){function b(a,b,c){a/=255;b/=255;c/=255;var d=Math.max(a,b,c),e=Math.min(a,b,c),f,g=d-e;if(d==e)f=0;else{switch(d){case a:f=(b-c)/g+(b<c?6:0);break;case b:f=(c-a)/g+2;break;case c:f=(a-b)/g+4}f/=6}return[f,0==d?0:g/d,d]}function c(a,b,c){var d,e,f,g=Math.floor(6*a),h=6*a-g;a=c*(1-b);var k=c*(1-h*b);b=c*(1-(1-h)*b);switch(g%6){case 0:d=c;e=b;f=a;break;case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c,e=a,f=k}return[255*d,255*
e,255*f]}function d(a){a=a.replace(/^(?:[\da-f]{3}){1,2}$/i,"#$&");a=a.replace(/^#([\da-f])([\da-f])([\da-f])$/i,"#$1$1$2$2$3$3");return a=a.replace(/^\s*RGB\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/,function(a,b,c,d){return f(b,c,d)})}function e(a){a.replace(/^#([\da-f])([\da-f])([\da-f])$/i,"#$1$1$2$2$3$3");a=/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(a)||[null,0,0,0];return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}function f(a,b,c){2 in arguments||(c=a[2],b=a[1],a=a[0]);
return("#@0"+(~~a).toString(16)+"@0"+(~~b).toString(16)+"@0"+(~~c).toString(16)).replace(/@0?([\da-f]{2})/gi,"$1")}function g(a){a&&(a.join||(a=a?(""+a).split(","):[]),m=a)}function h(n){function q(b){var c=!1;b=b.toLowerCase();a.each(m,function(a,d){if(d.toLowerCase()==b)return c=!0,!1});if(c)return!1;m=[b].concat(m.slice(0,k-1));return!0}function l(b){s.call(this,b);a(this).removeData("tvcolorpicker").removeData("tvcolorpicker-custom-color");A()}function s(b){var c=a(this);c.val(b);c.change();b?
c.trigger("pick-color",b):c.trigger("pick-transparent");u.call(this,b)}function u(b){a(this).css({backgroundColor:b,color:b})}function z(c,d){var f=this,g=a(f).val().toLowerCase(),h=document.createElement("table"),m=document.createElement("tbody");h.appendChild(m);var n,q=0;a.each(c,function(c,h){q++;0==c%k&&(n=a("<tr></tr>").appendTo(m));var s=a('<td class="tvcolorpicker-cell"></td>').appendTo(n),s=a('<div class="tvcolorpicker-swatch"></div>').appendTo(s);d&&d.addClass&&s.addClass(d.addClass);if(h){h=
h.toLowerCase();g==h&&s.addClass("active");s.css({backgroundColor:h}).data("color",h);s.bind("click",function(){l.call(f,h)});var A=b.apply(this,e(h));0.9<(1-A[1])*A[2]&&s.addClass("low-contrast")}});a(h).addClass("tvcolorpicker-table");return q?h:a()}function t(b,c,d){var e=a(b).offset();a(document).scrollLeft();var f=a(document).scrollTop(),g=a(b).outerWidth(),h=a(b).outerHeight();b=a(window).width();var l=a(window).height(),k=a(c).outerWidth(),m=a(c).outerHeight();switch(d.direction){default:case "down":d=
{top:e.top+h+d.offset,left:e.left+d.drift};break;case "right":d={top:e.top+d.drift,left:e.left+g+d.offset}}d.top+m>l+f&&(d.top=l-m+f);e.left+k>b&&(d.left=b-k);d.left+="px";d.top+="px";c.css(d)}function B(d){function g(a){var b=a.originalEvent,d=a.offsetX||a.layerX||b&&(b.offsetX||b.layerX)||0;a=a.offsetY||a.layerY||b&&(b.offsetY||b.layerY)||0;K.css({left:d+"px",top:a+"px"});U[0]=d/Z;U[1]=1-a/L;N.css({backgroundColor:f(c(U[0],U[1],1))});n()}function h(b){1==b.which&&(X=!1,A.is(".opened")&&a(q).get(0).focus(),
a(document).unbind("mouseup",h))}function l(a){var b=a.originalEvent;a=a.offsetY||a.layerY||b&&(b.offsetY||b.layerY)||0;T.css({top:a+"px"});U[2]=1-a/L;n()}function k(b){1==b.which&&(ba=!1,a(document).unbind("mouseup",k),A.is(".opened")&&a(q).get(0).focus())}function n(){aa&&(aa=!1,A.find(".tvcolorpicker-swatch.active").removeClass("active"));var a=f(c(U[0],U[1],U[2]));q.val().toUpperCase()!=a.toUpperCase()&&(q.data("tvcolorpicker-custom-color",a),s.call(q,a))}var q=a(this),A=a('<div class="tvcolorpicker-popup opened">'),
w=a('<div class="tvcolorpicker-swatches-area"></div>').appendTo(A);w.append(z.call(this,"#000000 #424242 #656565 #989898 #b6b6b6 #cbcbcb #d8d8d8 #eeeeee #f2f2f2 #ffffff".split(" ")));w.append(z.call(this,"#970000 #ff0000 #ff9800 #ffff00 #00ff00 #00ffff #4985e7 #0000ff #9800ff #ff00ff".split(" ")));w.append(z.call(this,"#e6b8af #f4cccc #fce5cd #fff2cc #d9ead3 #d0e0e3 #c9daf8 #cfe2f3 #d9d2e9 #ead1dc #dd7e6b #ea9999 #f9cb9c #ffe599 #b6d7a8 #a2c4c9 #a4c2f4 #9fc5e8 #b4a7d6 #d5a6bd #cc4125 #e06666 #f6b26b #ffd966 #93c47d #76a5af #6d9eeb #6fa8dc #8e7cc3 #c27ba0 #a61c00 #cc0000 #e69138 #f1c232 #6aa84f #45818e #3c78d8 #3d85c6 #674ea7 #a64d79 #85200c #990000 #b45f06 #bf9000 #38761d #134f5c #1155cc #0b5394 #351c75 #741b47 #5b0f00 #660000 #783f04 #7f6000 #274e13 #0c343d #1c4587 #073763 #20124d #4c1130".split(" ")));
var r=a('<div class="tvcolorpicker-custom-area"></div>').css({display:"none"}).appendTo(A),u=a('<div class="tvcolorpicker-hsv"></div>').appendTo(r),B=a('<div class="tvcolorpicker-hs"></div>').appendTo(u),K=a('<div class="tvcolorpicker-hs-handle"></div>').appendTo(B),R=a('<div class="tvcolorpicker-hs-area"></div>').appendTo(B),N=a('<div class="tvcolorpicker-v"></div>').appendTo(u),T=a('<div class="tvcolorpicker-v-handle"></div>').appendTo(N),u=a('<div class="tvcolorpicker-v-area"></div>').appendTo(N),
L=B.height(),Z=B.width(),X=!1,ba=!1,aa=!0,U=[0,0,0.5];R.bind("mousedown",function(b){1==b.which&&(X=!0,a(document).bind("mouseup",h),g(b),b.preventDefault())});R.bind("mousemove",function(a){X&&(g(a),a.preventDefault())});u.bind("mousedown",function(b){1==b.which&&(ba=!0,a(document).bind("mouseup",k),l(b),b.preventDefault())});u.bind("mousemove",function(a){ba&&(l(a),a.preventDefault())});a('<a class="tvcolorpicker-custom-button tv-button">'+a.t("Custom color...")+"</a>").appendTo(A).bind("click",
function(){var d=a(this).is(".active");d||r.css({minWidth:w.width()+"px",minHeight:w.height()+"px"});a(this)[d?"removeClass":"addClass"]("active");r.css({display:d?"none":"block"});w.css({display:d?"block":"none"});d?q.removeData("tvcolorpicker-custom-color"):(L=B.height(),Z=B.width(),d=e(q.val()),U=b.apply(this,d),K.css({left:~~(U[0]*Z)+"px",top:~~((1-U[1])*L)+"px"}),T.css({top:~~((1-U[2])*L)+"px"}),N.css({backgroundColor:f(c(U[0],U[1],1))}))});A.append(a(z.call(this,m,{addClass:"tvcolorpicker-user"})).addClass("tvcolorpicker-user-swatches"));
a(document.body).append(A);t(q,A,d);return A}function A(){a(".tvcolorpicker-popup").removeClass("opened").remove();a(w).data("tvcolorpicker",null);a(w).each(function(){var b=a(this).data("tvcolorpicker-custom-color");b&&(q(b)&&a(this).trigger("customcolorchange",[m]),a(this).data("tvcolorpicker-custom-color",null));(b=a(this).data("tvcolorpicker-previous-color"))&&b!=a(this).val()&&a(this).trigger("change");a(this).removeData("tvcolorpicker-previous-color")})}n=a.extend({},h.options,n||{});var w=
this;n&&"customColors"in n&&g(n.customColors);return this.each(function(){function b(){var a=d(c.val());u.call(c,a)}var c=a(this);c.val(d(c.val()));var e=null,f=!1;c.addClass("tvcolorpicker-widget").attr("autocomplete","off").attr("readonly",!0);var g=function(){c.data("tvcolorpicker")||(e=B.call(c,n),c.data("tvcolorpicker-custom-color",null),c.data("tvcolorpicker",e),c.data("tvcolorpicker-previous-color",c.val()),e.bind("mousedown click",function(b){a(b.target).parents().andSelf().is(e)&&(c.focus(),
f=!0,setTimeout(function(){f=!1},0))}))};c.on("touchstart",g);c.focus(g);c.blur(function(a){f?a.stopPropagation():A.call(c)});c.change(function(a){b()});b()})}if(!a)throw Error("This program cannot be run in DOS mode");h.setCustomColors=g;a.fn.tvcolorpicker=h;var k=10,m=[];h.options={direction:"down",offset:0,drift:0}})(window.jQuery);var Mustache="undefined"!==typeof module&&module.exports||{};
(function(a){function b(a){return String(a).replace(/&(?!\w+;)|[<>"']/g,function(a){return w[a]||a})}function c(a,b,c,d){d=d||"<template>";for(var e=b.split("\n"),f=Math.max(c-3,0),g=Math.min(e.length,c+3),e=e.slice(f,g),h=0,l=e.length;h<l;++h)g=h+f+1,e[h]=(g===c?" >> ":" ")+e[h];a.template=b;a.line=c;a.file=d;a.message=[d+":"+c,e.join("\n"),"",a.message].join("\n");return a}function d(a,b,c){if("."===a)return b[b.length-1];a=a.split(".");for(var d=a.length-1,e=a[d],f,g,h=b.length,l,k;h;){k=b.slice(0);
g=b[--h];for(l=0;l<d;){g=g[a[l++]];if(null==g)break;k.push(g)}if(g&&e in g){f=g[e];break}}"function"===typeof f&&(f=f.call(k[k.length-1]));return null==f?c:f}function e(a,b,c,e){var f="";a=d(a,b);if(e){if(null==a||!1===a||s(a)&&0===a.length)f+=c()}else if(s(a))u(a,function(a){b.push(a);f+=c();b.pop()});else if("object"===typeof a)b.push(a),f+=c(),b.pop();else if("function"===typeof a)var g=b[b.length-1],f=f+(a.call(g,c(),function(a){return k(a,g)})||"");else a&&(f+=c());return f}function f(b,d){d=
d||{};for(var e=d.tags||a.tags,f=e[0],g=e[e.length-1],h=['var buffer = "";',"\nvar line = 1;","\ntry {",'\nbuffer += "'],l=[],k=!1,m=!1,n=function(){if(!k||m||d.space)l=[];else for(;l.length;)h.splice(l.pop(),1);m=k=!1},q=[],s,A,w,v=function(a){e=t(a).split(/\s+/);A=e[0];w=e[e.length-1]},u=function(a){h.push('";',s,'\nvar partial = partials["'+t(a)+'"];',"\nif (partial) {","\n buffer += render(partial,stack[stack.length - 1],partials);","\n}",'\nbuffer += "')},B=function(a,e){var f=t(a);if(""===
f)throw c(Error("Section name may not be empty"),b,Y,d.file);q.push({name:f,inverted:e});h.push('";',s,'\nvar name = "'+f+'";',"\nvar callback = (function () {","\n return function () {",'\n var buffer = "";','\nbuffer += "')},X=function(a){B(a,!0)},ba=function(a){a=t(a);var e=0!=q.length&&q[q.length-1].name;if(!e||a!=e)throw c(Error('Section named "'+a+'" was never opened'),b,Y,d.file);a=q.pop();h.push('";',"\n return buffer;","\n };","\n})();");a.inverted?h.push("\nbuffer += renderSection(name,stack,callback,true);"):
h.push("\nbuffer += renderSection(name,stack,callback);");h.push('\nbuffer += "')},aa=function(a){h.push('";',s,'\nbuffer += lookup("'+t(a)+'",stack,"");','\nbuffer += "')},U=function(a){h.push('";',s,'\nbuffer += escapeHTML(lookup("'+t(a)+'",stack,""));','\nbuffer += "')},Y=1,G,Q,V=0,ea=b.length;V<ea;++V)if(b.slice(V,V+f.length)===f){V+=f.length;G=b.substr(V,1);s="\nline = "+Y+";";A=f;w=g;k=!0;switch(G){case "!":V++;Q=null;break;case "=":V++;g="="+g;Q=v;break;case ">":V++;Q=u;break;case "#":V++;
Q=B;break;case "^":V++;Q=X;break;case "/":V++;Q=ba;break;case "{":g="}"+g;case "&":V++;m=!0;Q=aa;break;default:m=!0,Q=U}G=b.indexOf(g,V);if(-1===G)throw c(Error('Tag "'+f+'" was not closed properly'),b,Y,d.file);f=b.substring(V,G);Q&&Q(f);for(Q=0;~(Q=f.indexOf("\n",Q));)Y++,Q++;V=G+g.length-1;f=A;g=w}else switch(G=b.substr(V,1),G){case '"':case "\\":m=!0;h.push("\\"+G);break;case "\r":break;case "\n":l.push(h.length);h.push("\\n");n();Y++;break;default:z.test(G)?l.push(h.length):m=!0,h.push(G)}if(0!=
q.length)throw c(Error('Section "'+q[q.length-1].name+'" was not closed properly'),b,Y,d.file);n();h.push('";',"\nreturn buffer;","\n} catch (e) { throw {error: e, line: line}; }");g=h.join("").replace(/buffer \+= "";\n/g,"");d.debug&&("undefined"!=typeof console&&console.log?console.log(g):"function"===typeof print&&print(g));return g}function g(a,g){var h=f(a,g),l=new Function("view,partials,stack,lookup,escapeHTML,renderSection,render",h);return function(f,h){h=h||{};var m=[f];try{return l(f,h,
m,d,b,e,k)}catch(q){throw c(q.error,a,q.line,g.file);}}}function h(a,b){b=b||{};return!1!==b.cache?(v[a]||(v[a]=g(a,b)),v[a]):g(a,b)}function k(a,b,c){return h(a)(b,c)}a.name="mustache.js";a.version="0.5.0-dev";a.tags=["{{","}}"];a.parse=f;a.compile=h;a.render=k;a.clearCache=function(){v={}};a.to_html=function(a,b,c,d){a=k(a,b,c);if("function"===typeof d)d(a);else return a};var m=Object.prototype.toString,n=Array.isArray,q=Array.prototype.forEach,l=String.prototype.trim,s;s=n?n:function(a){return"[object Array]"===
m.call(a)};var u;u=q?function(a,b,c){return q.call(a,b,c)}:function(a,b,c){for(var d=0,e=a.length;d<e;++d)b.call(c,a[d],d,a)};var z=/^\s*$/,t;if(l)t=function(a){return null==a?"":l.call(a)};else{var B,A;z.test("\u00a0")?(B=/^\s+/,A=/\s+$/):(B=/^[\s\xA0]+/,A=/[\s\xA0]+$/);t=function(a){return null==a?"":String(a).replace(B,"").replace(A,"")}}var w={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},v={}})(Mustache);Array.isArray||(Array.isArray=function(a){return"[object Array]"==Object.prototype.toString.call(a)});Array.prototype.forEach||(Array.prototype.forEach=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!==typeof a)throw new TypeError;for(var d=2<=arguments.length?arguments[1]:void 0,e=0;e<c;e++)e in b&&a.call(d,b[e],e,b)});
Array.prototype.map||(Array.prototype.map=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!==typeof a)throw new TypeError;for(var d=Array(c),e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)f in b&&(d[f]=a.call(e,b[f],f,b));return d});Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),d=c.length;return function(e){if("object"!==typeof e&&"function"!==typeof e||null===e)throw new TypeError("Object.keys called on non-object");var f=[],g;for(g in e)a.call(e,g)&&f.push(g);if(b)for(g=0;g<d;g++)a.call(e,c[g])&&f.push(c[g]);return f}}());(function(a){var b=["","webkit","moz","o","ms"],c=0;(function(c,e){var f;a:{var g;for(f in b)if(g=b[f]+(c[0].toUpperCase()+c.slice(1)),g=g[0].toLowerCase()+g.slice(1),a[g]){f=g;break a}f=!1}a[c]=f?a[f]:e})("requestAnimationFrame",function(a){setTimeout(a,16);return c++})})(this);(function(){var a,b,c,d,e,f;window.parent!==window&&window.CanvasRenderingContext2D&&window.TextMetrics&&(b=window.CanvasRenderingContext2D.prototype)&&b.hasOwnProperty("font")&&b.hasOwnProperty("mozTextStyle")&&"function"===typeof b.__lookupSetter__&&(c=b.__lookupSetter__("font"))&&(b.__defineSetter__("font",function(a){try{return c.call(this,a)}catch(b){if("NS_ERROR_FAILURE"!==b.name)throw b;}}),d=b.measureText,a=function(){this.width=0;this.isFake=!0;this.__proto__=window.TextMetrics.prototype},
b.measureText=function(b){try{return d.apply(this,arguments)}catch(c){if("NS_ERROR_FAILURE"!==c.name)throw c;return new a}},e=b.fillText,b.fillText=function(a,b,c,d){try{e.apply(this,arguments)}catch(f){if("NS_ERROR_FAILURE"!==f.name)throw f;}},f=b.strokeText,b.strokeText=function(a,b,c,d){try{f.apply(this,arguments)}catch(e){if("NS_ERROR_FAILURE"!==e.name)throw e;}})})();eval(function(a,b,c,d,e,f){e=function(a){return(a<b?"":e(parseInt(a/b)))+(35<(a%=b)?String.fromCharCode(a+29):a.toString(36))};if(!"".replace(/^/,String)){for(;c--;)f[e(c)]=d[c]||e(c);d=[function(a){return f[a]}];e=function(){return"\\w+"};c=1}for(;c--;)d[c]&&(a=a.replace(RegExp("\\b"+e(c)+"\\b","g"),d[c]));return a}("h.i['1a']=h.i['z'];h.O(h.i,{y:'D',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});",
62,74," return Math function if var PI jQuery easing pow 75 70158 else sin sqrt 5625 asin undefined easeOutBounce abs def swing easeInBounce 525 cos easeOutQuad easeOutBack easeInBack easeInSine easeOutElastic easeInOutQuint easeOutQuint easeInQuint easeInOutQuart easeOutQuart easeInQuart extend easeInElastic easeInOutCirc easeInOutCubic easeOutCirc easeInOutElastic easeOutCubic easeInCirc easeInOutExpo easeInCubic easeOutExpo easeInExpo 9375 easeInOutSine easeInOutQuad 25 easeOutSine easeInOutBack easeInQuad 625 984375 jswing easeInOutBounce".split(" "),
0,{}));(function(a){var b=a(window),c=a(document),d=function(d){d=jQuery.data(d.target);b.scrollTop()>c.height()-b.innerHeight()-(d.tolerance||190)&&a(this).trigger("scrolltoend")};a.event.special.scrolltoend={setup:function(b,c){a(this).bind("scroll.scrolltoend",d)},teardown:function(b){a(this).unbind("scroll.scrolltoend",d)}};jQuery.event.special.scrollto={bindType:"scroll",handle:function(a){var d=a.handleObj;a.scrollData||(a.scrollData={scrollTop:b.scrollTop()});var g=null;if("number"===typeof a.data.to)g=
a.scrollData.scrollTop>a.data.to-(a.data.tolerance||0)?!0:!1;else if("bottom"===a.data.to)a.scrollData.bottomOffset||(a.scrollData.bottomOffset=c.height()-b.innerHeight()),g=a.scrollData.scrollTop>a.scrollData.bottomOffset-(a.data.tolerance||0)?!0:!1;else throw Error('Special event scrollto: property "to" has unexpected value');var h=Array.prototype.slice.apply(arguments);if(g)return h.push(!0),d.handler.apply(this,h);if(a.data.twoway)return h.push(!1),d.handler.apply(this,h)}}})(jQuery);jQuery.fn.timeUpdate=function(){return this.each(function(){var a=jQuery(this).data("timestamp"),a=a?1E3*a:1E3*jQuery(this).text();TradingView.agoDateFormatter(jQuery(this),new Date(a));jQuery(this).removeClass("time-upd")})};(function(a){function b(a,b,c){for(var d=0;d<n.length;d++)n[d]||(b=b.toLowerCase()),a.addEventListener(n[d]+b,c,!1)}function c(a){a.stop(!0);a.css("background-color","");a.removeData(q);a.removeData(l)}function d(b){var d=b.data(q);d&&(!0!==d?(d--,d?(e(b),b.data(q,d)):(d=b.data(l).complete,c(b),d&&a.isFunction(d)&&d())):e(b))}function e(a){var b=a.css("background-color"),c=a.data(l),e=c.duration||u,f=c.easing||z;a.animate({"background-color":c.highlightColor||s},e,f).animate({"background-color":b},
e,f,d.bind(a,a))}var f=!1,g=document.body||document.documentElement,h="animation",k=["Webkit","Moz","O","ms","Khtml"],m="";void 0!==g.style.animationName&&(f=!0);if(!1===f)for(m=0;m<k.length;m++)if(void 0!==g.style[k[m]+"AnimationName"]){m=k[m];h=m+"Animation";m.toLowerCase();f=!0;break}var n=["webkit","moz","MS","o",""],q="flicker-enable",l="flicker-options",s="#FFE868",u=400,z="swing";a.fn.highlight=function(d,g){switch(d){default:d=void 0===d?!0:d;this.each(function(){if(f)d=!0===d?"infinite":
d,b(this,"AnimationEnd",function(){this.style[h]=""}),this.style[h]="highlight-animation 0.4s ease-in-out "+d+" alternate";else{var c=a(this);c.data(q,d);c.data(l,a.extend({},g||{}));c.is(":animated")||e(c)}});break;case !1:this.each(function(){f?this.style[h]="":c(a(this))})}}})(jQuery);(function(a){var b,c;"undefined"!==typeof document.hidden?(b="hidden",c="visibilitychange"):"undefined"!==typeof document.mozHidden?(b="mozHidden",c="mozvisibilitychange"):"undefined"!==typeof document.msHidden?(b="msHidden",c="msvisibilitychange"):"undefined"!==typeof document.webkitHidden&&(b="webkitHidden",c="webkitvisibilitychange");a.tabvisible=!0;c&&(a(document).on(c,function(c){a.tabvisible=!document[b];a(window).trigger("visibilitychange",!document[b])}),a(document).trigger(c));a.whenTabVisible=
function(b){if(!c||a.tabvisible)b();else a(window).one("visibilitychange",b)}})(jQuery);!function(a){function b(d,e,f,g,h){var k=d.contents(),m=!1;d.empty();for(var q=0,n=k.length;n>q&&!m;q++){var C=k[q],H=a(C);"undefined"!=typeof C&&(d.append(H),h&&d[d.is("table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style")?"after":"append"](h),3==C.nodeType?f.innerHeight()>g.maxHeight&&(m=c(H,e,f,g,h)):m=b(H,e,f,g,h),m||h&&h.detach())}return m}function c(a,b,e,h,k){var m=!1,q=a[0];if("undefined"==typeof q)return!1;
for(var n=g(q),v=-1!==n.indexOf(" ")?" ":"\u3000",v="letter"==h.wrap?"":v,n=n.split(v),C=-1,H=-1,D=0,F=n.length-1;F>=D;){var I=Math.floor((D+F)/2);if(I==H)break;H=I;f(q,n.slice(0,H+1).join(v)+h.ellipsis);e.innerHeight()>h.maxHeight?F=H:(C=H,D=H);F==D&&0==F&&h.fallbackToLetter&&(v="",n=n[0].split(v),C=-1,H=-1,D=0,F=n.length-1)}-1==C||1==n.length&&0==n[0].length?(v=a.parent(),a.remove(),q=k?k.length:0,v.contents().size()>q?(m=v.contents().eq(-1-q),m=c(m,b,e,h,k)):(b=v.prev(),q=b.contents().eq(-1)[0],
"undefined"!=typeof q&&(n=d(g(q),h),f(q,n),k&&b.append(k),v.remove(),m=!0))):(n=d(n.slice(0,C+1).join(v),h),m=!0,f(q,n));return m}function d(b,c){for(;-1<a.inArray(b.slice(-1),c.lastCharacter.remove);)b=b.slice(0,-1);return 0>a.inArray(b.slice(-1),c.lastCharacter.noEllipsis)&&(b+=c.ellipsis),b}function e(a){return{width:a.innerWidth(),height:a.innerHeight()}}function f(a,b){a.innerText?a.innerText=b:a.nodeValue?a.nodeValue=b:a.textContent&&(a.textContent=b)}function g(a){return a.innerText?a.innerText:
a.nodeValue?a.nodeValue:a.textContent?a.textContent:""}function h(b,c){return"undefined"==typeof b?!1:b?"string"==typeof b?(b=a(b,c),b.length?b:!1):"object"==typeof b?"undefined"==typeof b.jquery?!1:b:!1:!1}function k(a,b){return a?(b="string"==typeof b?"dotdotdot: "+b:["dotdotdot:",b],"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&window.console.log(b),!1):!1}if(!a.fn.dotdotdot){a.fn.dotdotdot=function(c){if(0==this.length)return c&&!1===c.debug||k(!0,'No element found for "'+
this.selector+'".'),this;if(1<this.length)return this.each(function(){a(this).dotdotdot(c)});var d=this;d.data("dotdotdot")&&d.trigger("destroy.dot");d.data("dotdotdot-style",d.attr("style"));d.css("word-wrap","break-word");d.bind_events=function(){return d.bind("update.dot",function(c,e){c.preventDefault();c.stopPropagation();var h=g,k;if("number"==typeof g.height)k=g.height;else{k=d.innerHeight();for(var l=["paddingTop","paddingBottom"],m=0,n=l.length;n>m;m++){var A=parseInt(d.css(l[m]),10);isNaN(A)&&
(A=0);k-=A}}h.maxHeight=k;g.maxHeight+=g.tolerance;"undefined"!=typeof e&&(("string"==typeof e||e instanceof HTMLElement)&&(e=a("<div />").append(e).contents()),e instanceof a&&(f=e));w=d.wrapInner('<div class="dotdotdot" />').children();w.empty().append(f.clone(!0)).css({height:"auto",width:"auto",border:"none",padding:0,margin:0});h=l=!1;q.afterElement&&(l=q.afterElement.clone(!0),q.afterElement.remove());if(w.innerHeight()>g.maxHeight)if("children"==g.wrap){h=w;k=g;m=h.children();n=!1;h.empty();
for(var A=0,B=m.length;B>A;A++){var r=m.eq(A);if(h.append(r),l&&h.append(l),h.innerHeight()>k.maxHeight){r.remove();n=!0;break}l&&l.detach()}h=n}else h=b(w,d,w,g,l);return w.replaceWith(w.contents()),w=null,a.isFunction(g.callback)&&g.callback.call(d[0],h,f),q.isTruncated=h,h}).bind("isTruncated.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(d[0],q.isTruncated),q.isTruncated}).bind("originalContent.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),
"function"==typeof b&&b.call(d[0],f),f}).bind("destroy.dot",function(a){a.preventDefault();a.stopPropagation();d.unwatch().unbind_events().empty().append(f).attr("style",d.data("dotdotdot-style")).data("dotdotdot",!1)}),d};d.unbind_events=function(){return d.unbind(".dot"),d};d.watch=function(){if(d.unwatch(),"window"==g.watch){var b=a(window),c=b.width(),f=b.height();b.bind("resize.dot"+q.dotId,function(){c==b.width()&&f==b.height()&&g.windowResizeFix||(c=b.width(),f=b.height(),A&&clearInterval(A),
A=setTimeout(function(){d.trigger("update.dot")},10))})}else n=e(d),A=setInterval(function(){var a=e(d);(n.width!=a.width||n.height!=a.height)&&(d.trigger("update.dot"),n=e(d))},100);return d};d.unwatch=function(){return a(window).unbind("resize.dot"+q.dotId),A&&clearInterval(A),d};var f=d.contents(),g=a.extend(!0,{},a.fn.dotdotdot.defaults,c),q={},n={},A=null,w=null;return g.lastCharacter.remove instanceof Array||(g.lastCharacter.remove=a.fn.dotdotdot.defaultArrays.lastCharacter.remove),g.lastCharacter.noEllipsis instanceof
Array||(g.lastCharacter.noEllipsis=a.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),q.afterElement=h(g.after,d),q.isTruncated=!1,q.dotId=m++,d.data("dotdotdot",!0).bind_events().trigger("update.dot"),g.watch&&d.watch(),d};a.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0,debug:!1};a.fn.dotdotdot.defaultArrays={lastCharacter:{remove:" \u3000,;.!?".split(""),noEllipsis:[]}};var m=
1,n=a.fn.html;a.fn.html=function(a){return"undefined"!=typeof a?this.data("dotdotdot")&&"function"!=typeof a?this.trigger("update",[a]):n.call(this,a):n.call(this)};var q=a.fn.text;a.fn.text=function(b){if("undefined"!=typeof b){if(this.data("dotdotdot")){var c=a("<div />");return c.text(b),b=c.html(),c.remove(),this.trigger("update",[b])}return q.call(this,b)}return q.call(this)}}}(jQuery);/*
2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
@license New BSD License <http://creativecommons.org/licenses/BSD/>
2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
@license New BSD License <http://creativecommons.org/licenses/BSD/>
Public Domain
@author Benjamin Arthur Lupton <contact@balupton.com>
@author James Padolsey <https://gist.github.com/527683>
Public Domain
@author Benjamin Arthur Lupton <contact@balupton.com>
2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
@license New BSD License <http://creativecommons.org/licenses/BSD/>
*/
"object"!==typeof JSON&&(JSON={});
(function(){function a(a){return 10>a?"0"+a:a}function b(a){e.lastIndex=0;return e.test(a)?'"'+a.replace(e,function(a){var b=h[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function c(a,d){var e,h,s,u,z=f,t,B=d[a];B&&"object"===typeof B&&"function"===typeof B.toJSON&&(B=B.toJSON(a));"function"===typeof k&&(B=k.call(d,a,B));switch(typeof B){case "string":return b(B);case "number":return isFinite(B)?String(B):"null";case "boolean":case "null":return String(B);
case "object":if(!B)return"null";f+=g;t=[];if("[object Array]"===Object.prototype.toString.apply(B)){u=B.length;for(e=0;e<u;e+=1)t[e]=c(e,B)||"null";s=0===t.length?"[]":f?"[\n"+f+t.join(",\n"+f)+"\n"+z+"]":"["+t.join(",")+"]";f=z;return s}if(k&&"object"===typeof k)for(u=k.length,e=0;e<u;e+=1)"string"===typeof k[e]&&(h=k[e],(s=c(h,B))&&t.push(b(h)+(f?": ":":")+s));else for(h in B)Object.prototype.hasOwnProperty.call(B,h)&&(s=c(h,B))&&t.push(b(h)+(f?": ":":")+s);s=0===t.length?"{}":f?"{\n"+f+t.join(",\n"+
f)+"\n"+z+"}":"{"+t.join(",")+"}";f=z;return s}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(b){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=String(a);d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();
(function(a,b){var c=a.History=a.History||{},d=a.jQuery;if("undefined"!==typeof c.Adapter)throw Error("History.js Adapter has already been loaded...");c.Adapter={bind:function(a,b,c){d(a).bind(b,c)},trigger:function(a,b,c){d(a).trigger(b,c)},extractEventData:function(a,c,d){return c&&c.originalEvent&&c.originalEvent[a]||d&&d[a]||b},onDomLoad:function(a){d(a)}};"undefined"!==typeof c.init&&c.init()})(window);
(function(a,b){var c=a.document,d=a.setInterval||d,e=a.History=a.History||{};if("undefined"!==typeof e.initHtml4)throw Error("History.js HTML4 Support has already been loaded...");e.initHtml4=function(){if("undefined"!==typeof e.initHtml4.initialized)return!1;e.initHtml4.initialized=!0;e.enabled=!0;e.savedHashes=[];e.isLastHash=function(a){var b=e.getHashByIndex();return a===b};e.isHashEqual=function(a,b){a=encodeURIComponent(a).replace(/%25/g,"%");b=encodeURIComponent(b).replace(/%25/g,"%");return a===
b};e.saveHash=function(a){if(e.isLastHash(a))return!1;e.savedHashes.push(a);return!0};e.getHashByIndex=function(a){var b=null;return b="undefined"===typeof a?e.savedHashes[e.savedHashes.length-1]:0>a?e.savedHashes[e.savedHashes.length+a]:e.savedHashes[a]};e.discardedHashes={};e.discardedStates={};e.discardState=function(a,b,c){var d=e.getHashByState(a);e.discardedStates[d]={discardedState:a,backState:c,forwardState:b};return!0};e.discardHash=function(a,b,c){e.discardedHashes[a]={discardedHash:a,backState:c,
forwardState:b};return!0};e.discardedState=function(a){a=e.getHashByState(a);return e.discardedStates[a]||!1};e.discardedHash=function(a){return e.discardedHashes[a]||!1};e.recycleState=function(a){var b=e.getHashByState(a);e.discardedState(a)&&delete e.discardedStates[b];return!0};e.emulated.hashChange&&(e.hashChangeInit=function(){e.checkerFunction=null;var b="",g,h,k,m=Boolean(e.getHash());e.isInternetExplorer()?(g=c.createElement("iframe"),g.setAttribute("id","historyjs-iframe"),g.setAttribute("src",
"#"),g.style.display="none",c.body.appendChild(g),g.contentWindow.document.open(),g.contentWindow.document.close(),h="",k=!1,e.checkerFunction=function(){if(k)return!1;k=!0;var c=e.getHash(),d=e.getHash(g.contentWindow.document);c!==b?(b=c,d!==c&&(h=c,g.contentWindow.document.open(),g.contentWindow.document.close(),g.contentWindow.document.location.hash=e.escapeHash(c)),e.Adapter.trigger(a,"hashchange")):d!==h&&(h=d,m&&""===d?e.back():e.setHash(d,!1));k=!1;return!0}):e.checkerFunction=function(){var c=
e.getHash()||"";c!==b&&(b=c,e.Adapter.trigger(a,"hashchange"));return!0};e.intervalList.push(d(e.checkerFunction,e.options.hashChangeInterval));return!0},e.Adapter.onDomLoad(e.hashChangeInit));e.emulated.pushState&&(e.onHashChange=function(b){b=b&&b.newURL||e.getLocationHref();var c=e.getHashByUrl(b);b=null;if(e.isLastHash(c))return e.busy(!1),!1;e.doubleCheckComplete();e.saveHash(c);if(c&&e.isTraditionalAnchor(c))return e.Adapter.trigger(a,"anchorchange"),e.busy(!1),!1;b=e.extractState(e.getFullUrl(c||
e.getLocationHref()),!0);if(e.isLastSavedState(b))return e.busy(!1),!1;e.getHashByState(b);if(c=e.discardedState(b))return e.getHashByIndex(-2)===e.getHashByState(c.forwardState)?e.back(!1):e.forward(!1),!1;e.pushState(b.data,b.title,encodeURI(b.url),!1);return!0},e.Adapter.bind(a,"hashchange",e.onHashChange),e.pushState=function(b,c,d,k){d=encodeURI(d).replace(/%25/g,"%");if(e.getHashByUrl(d))throw Error("History.js does not support states with fragment-identifiers (hashes/anchors).");if(!1!==k&&
e.busy())return e.pushQueue({scope:e,callback:e.pushState,args:arguments,queue:k}),!1;e.busy(!0);var m=e.createStateObject(b,c,d),n=e.getHashByState(m),q=e.getState(!1),q=e.getHashByState(q),l=e.getHash(),s=e.expectedStateId==m.id;e.storeState(m);e.expectedStateId=m.id;e.recycleState(m);e.setTitle(m);if(n===q)return e.busy(!1),!1;e.saveState(m);s||e.Adapter.trigger(a,"statechange");e.isHashEqual(n,l)||e.isHashEqual(n,e.getShortUrl(e.getLocationHref()))||e.setHash(n,!1);e.busy(!1);return!0},e.replaceState=
function(b,c,d,k){d=encodeURI(d).replace(/%25/g,"%");if(e.getHashByUrl(d))throw Error("History.js does not support states with fragment-identifiers (hashes/anchors).");if(!1!==k&&e.busy())return e.pushQueue({scope:e,callback:e.replaceState,args:arguments,queue:k}),!1;e.busy(!0);var m=e.createStateObject(b,c,d),n=e.getHashByState(m),q=e.getState(!1),l=e.getHashByState(q),s=e.getStateByIndex(-2);e.discardState(q,m,s);n===l?(e.storeState(m),e.expectedStateId=m.id,e.recycleState(m),e.setTitle(m),e.saveState(m),
e.Adapter.trigger(a,"statechange"),e.busy(!1)):e.pushState(m.data,m.title,m.url,!1);return!0});if(e.emulated.pushState&&e.getHash()&&!e.emulated.hashChange)e.Adapter.onDomLoad(function(){e.Adapter.trigger(a,"hashchange")})};"undefined"!==typeof e.init&&e.init()})(window);
(function(a,b){var c=a.console||b,d=a.document,e=a.navigator,f=a.sessionStorage||!1,g=a.setTimeout,h=a.clearTimeout,k=a.setInterval,m=a.clearInterval,n=a.JSON,q=a.alert,l=a.History=a.History||{},s=a.history;try{f.setItem("TEST","1"),f.removeItem("TEST")}catch(u){f=!1}n.stringify=n.stringify||n.encode;n.parse=n.parse||n.decode;if("undefined"!==typeof l.init)throw Error("History.js Core has already been loaded...");l.init=function(a){if("undefined"===typeof l.Adapter)return!1;"undefined"!==typeof l.initCore&&
l.initCore();"undefined"!==typeof l.initHtml4&&l.initHtml4();return!0};l.initCore=function(u){if("undefined"!==typeof l.initCore.initialized)return!1;l.initCore.initialized=!0;l.options=l.options||{};l.options.hashChangeInterval=l.options.hashChangeInterval||100;l.options.safariPollInterval=l.options.safariPollInterval||500;l.options.doubleCheckInterval=l.options.doubleCheckInterval||500;l.options.disableSuid=l.options.disableSuid||!1;l.options.storeInterval=l.options.storeInterval||1E3;l.options.busyDelay=
l.options.busyDelay||250;l.options.debug=l.options.debug||!1;l.options.initialTitle=l.options.initialTitle||d.title;l.options.html4Mode=l.options.html4Mode||!1;l.options.delayInit=l.options.delayInit||!1;l.intervalList=[];l.clearAllIntervals=function(){var a,b=l.intervalList;if("undefined"!==typeof b&&null!==b){for(a=0;a<b.length;a++)m(b[a]);l.intervalList=null}};l.debug=function(){l.options.debug&&l.log.apply(l,arguments)};l.log=function(){var a=!("undefined"===typeof c||"undefined"===typeof c.log||
"undefined"===typeof c.log.apply),b=d.getElementById("log"),e,f,g,h;a?(f=Array.prototype.slice.call(arguments),e=f.shift(),"undefined"!==typeof c.debug?c.debug.apply(c,[e,f]):c.log.apply(c,[e,f])):e="\n"+arguments[0]+"\n";f=1;for(g=arguments.length;f<g;++f){h=arguments[f];if("object"===typeof h&&"undefined"!==typeof n)try{h=n.stringify(h)}catch(k){}e+="\n"+h+"\n"}b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||q(e);return!0};l.getInternetExplorerMajorVersion=function(){var a=
l.getInternetExplorerMajorVersion,b;if("undefined"!==typeof l.getInternetExplorerMajorVersion.cached)b=l.getInternetExplorerMajorVersion.cached;else{b=3;for(var c=d.createElement("div"),e=c.getElementsByTagName("i");(c.innerHTML="\x3c!--[if gt IE "+ ++b+"]><i></i><![endif]--\x3e")&&e[0];);b=4<b?b:!1}return a.cached=b};l.isInternetExplorer=function(){return l.isInternetExplorer.cached="undefined"!==typeof l.isInternetExplorer.cached?l.isInternetExplorer.cached:Boolean(l.getInternetExplorerMajorVersion())};
l.emulated=l.options.html4Mode?{pushState:!0,hashChange:!0}:{pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)||/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent))),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||l.isInternetExplorer()&&8>l.getInternetExplorerMajorVersion())};l.enabled=!l.emulated.pushState;l.bugs={setHash:Boolean(!l.emulated.pushState&&"Apple Computer, Inc."===e.vendor&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),
safariPoll:Boolean(!l.emulated.pushState&&"Apple Computer, Inc."===e.vendor&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(l.isInternetExplorer()&&8>l.getInternetExplorerMajorVersion()),hashEscape:Boolean(l.isInternetExplorer()&&7>l.getInternetExplorerMajorVersion())};l.isEmptyObject=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};l.cloneObject=function(a){a?(a=n.stringify(a),a=n.parse(a)):a={};return a};l.getRootUrl=function(){var a=d.location.protocol+
"//"+(d.location.hostname||d.location.host);d.location.port&&(a+=":"+d.location.port);return a+"/"};l.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,b="";1===a.length&&(b=a[0],b=b.href.replace(/[^\/]+$/,""));(b=b.replace(/\/+$/,""))&&(b+="/");return b};l.getBaseUrl=function(){return l.getBaseHref()||l.getBasePageUrl()||l.getRootUrl()};l.getPageUrl=function(){return((l.getState(!1,!1)||{}).url||l.getLocationHref()).replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?
a:a+"/"})};l.getBasePageUrl=function(){return l.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/"};l.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);b="undefined"===typeof b?!0:b;/[a-z]+\:\/\//.test(a)||(c="/"===d?l.getRootUrl()+a.replace(/^\/+/,""):"#"===d?l.getPageUrl().replace(/#.*/,"")+a:"?"===d?l.getPageUrl().replace(/[\?#].*/,"")+a:b?l.getBaseUrl()+a.replace(/^(\.\/)+/,""):l.getBasePageUrl()+a.replace(/^(\.\/)+/,
""));return c.replace(/\#$/,"")};l.getShortUrl=function(a){var b=l.getBaseUrl(),c=l.getRootUrl();l.emulated.pushState&&(a=a.replace(b,""));a=a.replace(c,"/");l.isTraditionalAnchor(a)&&(a="./"+a);return a=a.replace(/^(\.\/)+/g,"./").replace(/\#$/,"")};l.getLocationHref=function(a){a=a||d;return a.URL===a.location.href?a.location.href:a.location.href===decodeURIComponent(a.URL)?a.URL:a.location.hash&&decodeURIComponent(a.location.href.replace(/^[^#]+/,""))===a.location.hash||-1==a.URL.indexOf("#")&&
-1!=a.location.href.indexOf("#")?a.location.href:a.URL||a.location.href};l.store={};l.idToState=l.idToState||{};l.stateToId=l.stateToId||{};l.urlToId=l.urlToId||{};l.storedStates=l.storedStates||[];l.savedStates=l.savedStates||[];l.normalizeStore=function(){l.store.idToState=l.store.idToState||{};l.store.urlToId=l.store.urlToId||{};l.store.stateToId=l.store.stateToId||{}};l.getState=function(a,b){"undefined"===typeof a&&(a=!0);"undefined"===typeof b&&(b=!0);var c=l.getLastSavedState();!c&&b&&(c=l.createStateObject());
a&&(c=l.cloneObject(c),c.url=c.cleanUrl||c.url);return c};l.getIdByState=function(a){var b=l.extractId(a.url),c;if(!b)if(c=l.getStateString(a),"undefined"!==typeof l.stateToId[c])b=l.stateToId[c];else if("undefined"!==typeof l.store.stateToId[c])b=l.store.stateToId[c];else{for(;b=(new Date).getTime()+String(Math.random()).replace(/\D/g,""),"undefined"!==typeof l.idToState[b]||"undefined"!==typeof l.store.idToState[b];);l.stateToId[c]=b;l.idToState[b]=a}return b};l.normalizeState=function(a){var b;
a&&"object"===typeof a||(a={});if("undefined"!==typeof a.normalized)return a;a.data&&"object"===typeof a.data||(a.data={});b={normalized:!0};b.title=a.title||"";b.url=l.getFullUrl(a.url?a.url:l.getLocationHref());b.hash=l.getShortUrl(b.url);b.data=l.cloneObject(a.data);b.id=l.getIdByState(b);b.cleanUrl=b.url.replace(/\??\&_suid.*/,"");b.url=b.cleanUrl;a=!l.isEmptyObject(b.data);(b.title||a)&&!0!==l.options.disableSuid&&(b.hash=l.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+=
"?"),b.hash+="&_suid="+b.id);b.hashedUrl=l.getFullUrl(b.hash);(l.emulated.pushState||l.bugs.safariPoll)&&l.hasUrlDuplicate(b)&&(b.url=b.hashedUrl);return b};l.createStateObject=function(a,b,c){a={data:a,title:b,url:c};return a=l.normalizeState(a)};l.getStateById=function(a){a=String(a);return l.idToState[a]||l.store.idToState[a]||b};l.getStateString=function(a){a={data:l.normalizeState(a).data,title:a.title,url:a.url};return n.stringify(a)};l.getStateId=function(a){return l.normalizeState(a).id};
l.getHashByState=function(a){return l.normalizeState(a).hash};l.extractId=function(a){a=-1!=a.indexOf("#")?a.split("#")[0]:a;return((a=/(.*)\&_suid=([0-9]+)$/.exec(a))?String(a[2]||""):"")||!1};l.isTraditionalAnchor=function(a){return!/[\/\?\.]/.test(a)};l.extractState=function(a,b){var c=null,d,e;b=b||!1;(d=l.extractId(a))&&(c=l.getStateById(d));c||(e=l.getFullUrl(a),(d=l.getIdByUrl(e)||!1)&&(c=l.getStateById(d)),c||!b||l.isTraditionalAnchor(a)||(c=l.createStateObject(null,null,e)));return c};l.getIdByUrl=
function(a){return l.urlToId[a]||l.store.urlToId[a]||b};l.getLastSavedState=function(){return l.savedStates[l.savedStates.length-1]||b};l.getLastStoredState=function(){return l.storedStates[l.storedStates.length-1]||b};l.hasUrlDuplicate=function(a){var b=!1;return b=(b=l.extractState(a.url))&&b.id!==a.id};l.storeState=function(a){l.urlToId[a.url]=a.id;l.storedStates.push(l.cloneObject(a));return a};l.isLastSavedState=function(a){var b=!1;l.savedStates.length&&(a=a.id,b=l.getLastSavedState(),b=b.id,
b=a===b);return b};l.saveState=function(a){if(l.isLastSavedState(a))return!1;l.savedStates.push(l.cloneObject(a));return!0};l.getStateByIndex=function(a){var b=null;return b="undefined"===typeof a?l.savedStates[l.savedStates.length-1]:0>a?l.savedStates[l.savedStates.length+a]:l.savedStates[a]};l.getCurrentIndex=function(){var a=null;return a=1>l.savedStates.length?0:l.savedStates.length-1};l.getHash=function(a){a=l.getLocationHref(a);return l.getHashByUrl(a)};l.unescapeHash=function(a){a=l.normalizeHash(a);
return a=decodeURIComponent(a)};l.normalizeHash=function(a){return a.replace(/[^#]*#/,"").replace(/#.*/,"")};l.setHash=function(a,b){var c;if(!1!==b&&l.busy())return l.pushQueue({scope:l,callback:l.setHash,args:arguments,queue:b}),!1;l.busy(!0);(c=l.extractState(a,!0))&&!l.emulated.pushState?l.pushState(c.data,c.title,c.url,!1):l.getHash()!==a&&(l.bugs.setHash?(c=l.getPageUrl(),l.pushState(null,null,c+"#"+a,!1)):d.location.hash=a);return l};l.escapeHash=function(b){b=l.normalizeHash(b);b=a.encodeURIComponent(b);
l.bugs.hashEscape||(b=b.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?"));return b};l.getHashByUrl=function(a){a=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return a=l.unescapeHash(a)};l.setTitle=function(a){var b=a.title,c;b||(c=l.getStateByIndex(0))&&c.url===a.url&&(b=c.title||l.options.initialTitle);try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(e){}d.title=b;return l};l.queues=[];
l.busy=function(a){"undefined"!==typeof a?l.busy.flag=a:"undefined"===typeof l.busy.flag&&(l.busy.flag=!1);if(!l.busy.flag){h(l.busy.timeout);var b=function(){var a,c;if(!l.busy.flag)for(a=l.queues.length-1;0<=a;--a)c=l.queues[a],0!==c.length&&(c=c.shift(),l.fireQueueItem(c),l.busy.timeout=g(b,l.options.busyDelay))};l.busy.timeout=g(b,l.options.busyDelay)}return l.busy.flag};l.busy.flag=!1;l.fireQueueItem=function(a){return a.callback.apply(a.scope||l,a.args||[])};l.pushQueue=function(a){l.queues[a.queue||
0]=l.queues[a.queue||0]||[];l.queues[a.queue||0].push(a);return l};l.queue=function(a,b){"function"===typeof a&&(a={callback:a});"undefined"!==typeof b&&(a.queue=b);l.busy()?l.pushQueue(a):l.fireQueueItem(a);return l};l.clearQueue=function(){l.busy.flag=!1;l.queues=[];return l};l.stateChanged=!1;l.doubleChecker=!1;l.doubleCheckComplete=function(){l.stateChanged=!0;l.doubleCheckClear();return l};l.doubleCheckClear=function(){l.doubleChecker&&(h(l.doubleChecker),l.doubleChecker=!1);return l};l.doubleCheck=
function(a){l.stateChanged=!1;l.doubleCheckClear();l.bugs.ieDoubleCheck&&(l.doubleChecker=g(function(){l.doubleCheckClear();l.stateChanged||a();return!0},l.options.doubleCheckInterval));return l};l.safariStatePoll=function(){var b=l.extractState(l.getLocationHref());if(!l.isLastSavedState(b))return b||l.createStateObject(),l.Adapter.trigger(a,"popstate"),l};l.back=function(a){if(!1!==a&&l.busy())return l.pushQueue({scope:l,callback:l.back,args:arguments,queue:a}),!1;l.busy(!0);l.doubleCheck(function(){l.back(!1)});
s.go(-1);return!0};l.forward=function(a){if(!1!==a&&l.busy())return l.pushQueue({scope:l,callback:l.forward,args:arguments,queue:a}),!1;l.busy(!0);l.doubleCheck(function(){l.forward(!1)});s.go(1);return!0};l.go=function(a,b){var c;if(0<a)for(c=1;c<=a;++c)l.forward(b);else if(0>a)for(c=-1;c>=a;--c)l.back(b);else throw Error("History.go: History.go requires a positive or negative integer passed.");return l};l.emulated.pushState?(u=function(){},l.pushState=l.pushState||u,l.replaceState=l.replaceState||
u):(l.onPopState=function(b,c){var d=!1,d=!1;l.doubleCheckComplete();if(d=l.getHash())return(d=l.extractState(d||l.getLocationHref(),!0))?l.replaceState(d.data,d.title,d.url,!1):(l.Adapter.trigger(a,"anchorchange"),l.busy(!1)),l.expectedStateId=!1;(d=(d=l.Adapter.extractEventData("state",b,c)||!1)?l.getStateById(d):l.expectedStateId?l.getStateById(l.expectedStateId):l.extractState(l.getLocationHref()))||(d=l.createStateObject(null,null,l.getLocationHref()));l.expectedStateId=!1;if(l.isLastSavedState(d))return l.busy(!1),
!1;l.storeState(d);l.saveState(d);l.setTitle(d);l.Adapter.trigger(a,"statechange");l.busy(!1);return!0},l.Adapter.bind(a,"popstate",l.onPopState),l.pushState=function(b,c,d,e){if(l.getHashByUrl(d)&&l.emulated.pushState)throw Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(!1!==e&&l.busy())return l.pushQueue({scope:l,callback:l.pushState,args:arguments,queue:e}),!1;l.busy(!0);var f=l.createStateObject(b,c,d);l.isLastSavedState(f)?l.busy(!1):(l.storeState(f),
l.expectedStateId=f.id,s.pushState(f.id,f.title,f.url),l.Adapter.trigger(a,"popstate"));return!0},l.replaceState=function(b,c,d,e){if(l.getHashByUrl(d)&&l.emulated.pushState)throw Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(!1!==e&&l.busy())return l.pushQueue({scope:l,callback:l.replaceState,args:arguments,queue:e}),!1;l.busy(!0);var f=l.createStateObject(b,c,d);l.isLastSavedState(f)?l.busy(!1):(l.storeState(f),l.expectedStateId=f.id,s.replaceState(f.id,
f.title,f.url),l.Adapter.trigger(a,"popstate"));return!0});if(f)try{l.store=n.parse(f.getItem("History.store"))||{}}catch(t){l.store={}}else l.store={};l.normalizeStore();l.Adapter.bind(a,"unload",l.clearAllIntervals);l.saveState(l.storeState(l.extractState(l.getLocationHref(),!0)));f&&(l.onUnload=function(){var a,b;try{a=n.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{};a.urlToId=a.urlToId||{};a.stateToId=a.stateToId||{};for(b in l.idToState)l.idToState.hasOwnProperty(b)&&
(a.idToState[b]=l.idToState[b]);for(b in l.urlToId)l.urlToId.hasOwnProperty(b)&&(a.urlToId[b]=l.urlToId[b]);for(b in l.stateToId)l.stateToId.hasOwnProperty(b)&&(a.stateToId[b]=l.stateToId[b]);l.store=a;l.normalizeStore();a=n.stringify(a);try{f.setItem("History.store",a)}catch(d){if(d.code===DOMException.QUOTA_EXCEEDED_ERR)f.length&&(f.removeItem("History.store"),f.setItem("History.store",a));else throw d;}},l.intervalList.push(k(l.onUnload,l.options.storeInterval)),l.Adapter.bind(a,"beforeunload",
l.onUnload),l.Adapter.bind(a,"unload",l.onUnload));if(!l.emulated.pushState&&(l.bugs.safariPoll&&l.intervalList.push(k(l.safariStatePoll,l.options.safariPollInterval)),"Apple Computer, Inc."===e.vendor||"Mozilla"===(e.appCodeName||""))&&(l.Adapter.bind(a,"hashchange",function(){l.Adapter.trigger(a,"popstate")}),l.getHash()))l.Adapter.onDomLoad(function(){l.Adapter.trigger(a,"hashchange")})};l.options&&l.options.delayInit||l.init()})(window);(function(a){if(!a.support.cors&&a.ajaxTransport&&window.XDomainRequest){var b=/^https?:\/\//i,c=/^get|post$/i,d=RegExp("^"+location.protocol,"i"),e=/text\/html/i,f=/\/json/i,g=/\/xml/i;a.ajaxTransport("* text html xml json",function(h,k,m){if(h.crossDomain&&h.async&&c.test(h.type)&&b.test(h.url)&&d.test(h.url)){var n=null,q=(k.dataType||"").toLowerCase();return{send:function(b,c){n=new XDomainRequest;/^\d+$/.test(k.timeout)&&(n.timeout=k.timeout);n.ontimeout=function(){c(500,"timeout")};n.onload=
function(){var b="Content-Length: "+n.responseText.length+"\r\nContent-Type: "+n.contentType,d=200,h="success",k={text:n.responseText};try{if("html"===q||e.test(n.contentType))k.html=n.responseText;else if("json"===q||"text"!==q&&f.test(n.contentType))try{k.json=a.parseJSON(n.responseText)}catch(l){d=500,h="parseerror"}else if("xml"===q||"text"!==q&&g.test(n.contentType)){var m=new ActiveXObject("Microsoft.XMLDOM");m.async=!1;try{m.loadXML(n.responseText)}catch(u){m=void 0}if(!m||!m.documentElement||
m.getElementsByTagName("parsererror").length)throw"Invalid XML: "+n.responseText;k.xml=m}}catch(H){throw H;}finally{c(d,h,k,b)}};n.onprogress=function(){};n.onerror=function(){c(500,"error",{text:n.responseText})};var d="";k.data&&(d="string"===a.type(k.data)?k.data:a.param(k.data));n.open(h.type,h.url);n.send(d)},abort:function(){n&&n.abort()}}}})}})(jQuery);(function(a){a.fn.inputselectable=function(b){var c=a(this);b=a.extend({},b);if(!c.is('input[type="text"]'))throw Error(c+' should be input[type="text"]');if(b.list&&b.list.length&&!c.hasClass("ISinput")){c.addClass("ISinput");var d=a('<div class="ISwraper"></div>'),e=a('<div class="IStoggle"></div>'),f=function(d,f,k){function m(d,f){f||(f=n);f.remove();c.off("click");b.closeHandle instanceof a&&b.closeHandle.off("click");e.removeClass("active");c.focus()}d.stopPropagation();if(e.is(":active")||
e.is(".active"))if(m(null,a(".ISdropdown")),k)return;if(f&&f.length){d='<ul class="ISdropdown">';for(k=0;k<f.length;k++)d+='<li><div><span class="IStext">'+f[k]+"</span></div></li>";var n=a(d+"</ul>");n.find("li").each(function(){a(this).click(function(){c.val(a(this).find(".IStext").text());m()})});c.on("click","",m);if(b.closeHandle instanceof a)b.closeHandle.on("click","",m);n.insertAfter(c);n.css({top:c.outerHeight(),width:c.outerWidth(),"max-height":a(window).height()-n.offset().top-35});e.toggleClass("active")}};
c.wrap(d);"static"==c.css("position")?d.css("position","relative"):d.css({top:c.css("top"),left:c.css("left"),position:c.css("position")});d.css({width:c.outerHeight(),height:c.outerWidth()});e.insertAfter(c);e.click(function(a){f(a,b.list,!0)});c.keyup(function(d){var e=RegExp(c.val(),"i"),k=a.grep(b.list,function(a){return e.test(a)});f(d,k)});return c.focus()}}})(jQuery);(function(a){function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function c(a,b){return function(c){return m(a.call(this,c),b)}}function d(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function e(){}function f(a){A(a);h(this,a)}function g(a){a=u(a);var b=a.year||0,c=a.month||0,d=a.week||0,e=a.day||0;this._milliseconds=+(a.millisecond||0)+1E3*(a.second||0)+6E4*(a.minute||
0)+36E5*(a.hour||0);this._days=+e+7*d;this._months=+c+12*b;this._data={};this._bubble()}function h(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function k(a){return 0>a?Math.ceil(a):Math.floor(a)}function m(a,b,c){for(var d=""+Math.abs(a);d.length<b;)d="0"+d;return(0<=a?c?"+":"":"-")+d}function n(a,b,c,d){var e,f,g=b._milliseconds,h=b._days;b=b._months;g&&a._d.setTime(+a._d+g*
c);(h||b)&&(e=a.minute(),f=a.hour());h&&a.date(a.date()+h*c);b&&a.month(a.month()+b*c);g&&!d&&G.updateOffset(a);(h||b)&&(a.minute(e),a.hour(f))}function q(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&t(a[d])!==t(b[d]))&&g++;return g+f}function s(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=fb[a]||la[b]||b}return a}function u(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&
(b=s(c),b&&(d[b]=a[c]));return d}function z(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12;d="month"}G[b]=function(e,f){var g,h,k=G.fn._lang[b],l=[];if("number"==typeof e&&(f=e,e=a),h=function(a){a=G().utc().set(d,a);return k.call(G.fn._lang,a,e||"")},null!=f)return h(f);for(g=0;c>g;g++)l.push(h(g));return l}}function t(a){a=+a;var b=0;return 0!==a&&isFinite(a)&&(b=0<=a?Math.floor(a):Math.ceil(a)),b}function B(a){return 0===a%4&&0!==a%100||0===a%400}function A(a){var b;
a._a&&-2===a._pf.overflow&&(b=0>a._a[ka]||11<a._a[ka]?ka:1>a._a[ga]||a._a[ga]>(new Date(Date.UTC(a._a[fa],a._a[ka]+1,0))).getUTCDate()?ga:0>a._a[ca]||23<a._a[ca]?ca:0>a._a[ma]||59<a._a[ma]?ma:0>a._a[qa]||59<a._a[qa]?qa:0>a._a[oa]||999<a._a[oa]?oa:-1,a._pf._overflowDayOfYear&&(fa>b||b>ga)&&(b=ga),a._pf.overflow=b)}function w(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&0>a._pf.overflow&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,
a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function v(a){return a?a.toLowerCase().replace("_","-"):a}function C(a,b){return b._isUTC?G(a).zone(b._offset||0):G(a).local()}function H(a){var b,c,d,e,f=0,g=function(a){if(!na[a]&&Ma)try{require("./lang/"+a)}catch(b){}return na[a]};if(!a)return G.fn._lang;if(!q(a)){if(c=g(a))return c;a=[a]}for(;f<a.length;){e=v(a[f]).split("-");b=e.length;for(d=(d=v(a[f+1]))?d.split("-"):null;0<b;){if(c=g(e.slice(0,
b).join("-")))return c;if(d&&d.length>=b&&l(e,d,!0)>=b-1)break;b--}f++}return G.fn._lang}function D(a){var b,c,d=a.match(Oa);b=0;for(c=d.length;c>b;b++)d[b]=ha[d[b]]?ha[d[b]]:d[b].match(/\[[\s\S]/)?d[b].replace(/^\[|\]$/g,""):d[b].replace(/\\/g,"");return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function F(a,b){return a.isValid()?(b=I(b,a.lang()),ia[b]||(ia[b]=D(b)),ia[b](a)):a.lang().invalidDate()}function I(a,b){function c(a){return b.longDateFormat(a)||
a}var d=5;for(pa.lastIndex=0;0<=d&&pa.test(a);)a=a.replace(pa,c),pa.lastIndex=0,d-=1;return a}function E(a,b){var c=b._strict;switch(a){case "DDDD":return Ua;case "YYYY":case "GGGG":case "gggg":return c?da:Qa;case "Y":case "G":case "g":return Aa;case "YYYYYY":case "YYYYY":case "GGGGG":case "ggggg":return c?za:Ra;case "S":if(c)return Ta;case "SS":if(c)return ya;case "SSS":if(c)return Ua;case "DDD":return wa;case "MMM":case "MMMM":case "dd":case "ddd":case "dddd":return cb;case "a":case "A":return H(b._l)._meridiemParse;
case "X":return Sa;case "Z":case "ZZ":return xa;case "T":return db;case "SSSS":return bb;case "MM":case "DD":case "YY":case "GG":case "gg":case "HH":case "hh":case "mm":case "ss":case "ww":case "WW":return c?ya:Pa;case "M":case "D":case "d":case "H":case "h":case "m":case "s":case "w":case "W":case "e":case "E":return Pa;default:var c=RegExp,d;d=J(a.replace("\\","")).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");return new c(d)}}function P(a){a=(a||"").match(xa)||[];a=((a[a.length-1]||[])+"").match(va)||
["-",0,0];var b=+(60*a[1])+t(a[2]);return"+"===a[0]?-b:b}function O(a){var b,c,d,e,f,g,h,k,l,m=[];if(!a._d){c=r(a);a._w&&null==a._a[ga]&&null==a._a[ka]&&(e=function(b){var c=parseInt(b,10);return b?3>b.length?68<c?1900+c:2E3+c:c:null==a._a[fa]?G().weekYear():a._a[fa]},f=a._w,null!=f.GG||null!=f.W||null!=f.E?g=Z(e(f.GG),f.W||1,f.E,4,1):(h=H(a._l),k=null!=f.d?N(f.d,h):null!=f.e?parseInt(f.e,10)+h._week.dow:0,l=parseInt(f.w,10)||1,null!=f.d&&k<h._week.dow&&l++,g=Z(e(f.gg),l,k,h._week.doy,h._week.dow)),
a._a[fa]=g.year,a._dayOfYear=g.dayOfYear);a._dayOfYear&&(d=null==a._a[fa]?c[fa]:a._a[fa],a._dayOfYear>(B(d)?366:365)&&(a._pf._overflowDayOfYear=!0),b=R(d,0,a._dayOfYear),a._a[ka]=b.getUTCMonth(),a._a[ga]=b.getUTCDate());for(b=0;3>b&&null==a._a[b];++b)a._a[b]=m[b]=c[b];for(;7>b;b++)a._a[b]=m[b]=null==a._a[b]?2===b?1:0:a._a[b];m[ca]+=t((a._tzm||0)/60);m[ma]+=t((a._tzm||0)%60);a._d=(a._useUTC?R:K).apply(null,m)}}function r(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:
[b.getFullYear(),b.getMonth(),b.getDate()]}function S(a){a._a=[];a._pf.empty=!0;var b,c,d,e,f;b=H(a._l);var g=""+a._i,h=g.length,k=0;d=I(a._f,b).match(Oa)||[];for(b=0;b<d.length;b++)if(e=d[b],(c=(g.match(E(e,a))||[])[0])&&(f=g.substr(0,g.indexOf(c)),0<f.length&&a._pf.unusedInput.push(f),g=g.slice(g.indexOf(c)+c.length),k+=c.length),ha[e]){c?a._pf.empty=!1:a._pf.unusedTokens.push(e);var l=a,m=void 0,r=l._a;switch(e){case "M":case "MM":null!=c&&(r[ka]=t(c)-1);break;case "MMM":case "MMMM":m=H(l._l).monthsParse(c);
null!=m?r[ka]=m:l._pf.invalidMonth=c;break;case "D":case "DD":null!=c&&(r[ga]=t(c));break;case "DDD":case "DDDD":null!=c&&(l._dayOfYear=t(c));break;case "YY":r[fa]=t(c)+(68<t(c)?1900:2E3);break;case "YYYY":case "YYYYY":case "YYYYYY":r[fa]=t(c);break;case "a":case "A":l._isPm=H(l._l).isPM(c);break;case "H":case "HH":case "h":case "hh":r[ca]=t(c);break;case "m":case "mm":r[ma]=t(c);break;case "s":case "ss":r[qa]=t(c);break;case "S":case "SS":case "SSS":case "SSSS":r[oa]=t(1E3*("0."+c));break;case "X":l._d=
new Date(1E3*parseFloat(c));break;case "Z":case "ZZ":l._useUTC=!0;l._tzm=P(c);break;case "w":case "ww":case "W":case "WW":case "d":case "dd":case "ddd":case "dddd":case "e":case "E":e=e.substr(0,1);case "gg":case "gggg":case "GG":case "GGGG":case "GGGGG":e=e.substr(0,2),c&&(l._w=l._w||{},l._w[e]=c)}}else a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=h-k;0<g.length&&a._pf.unusedInput.push(g);a._isPm&&12>a._a[ca]&&(a._a[ca]+=12);!1===a._isPm&&12===a._a[ca]&&(a._a[ca]=0);O(a);A(a)}function J(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
function(a,b,c,d,e){return b||c||d||e})}function K(a,b,c,d,e,f,g){b=new Date(a,b,c,d,e,f,g);return 1970>a&&b.setFullYear(a),b}function R(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function N(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function T(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function L(a,b,c){var d;b=c-b;c-=a.day();return c>b&&(c-=7),b-7>c&&(c+=7),d=G(a).add("d",
c),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function Z(a,b,c,d,e){var f,g,h=R(a,0,1).getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:0<g?a:a-1,dayOfYear:0<g?g:(B(a-1)?366:365)+g}}function X(c){var d=c._i,e=c._f;if(null===d)c=G.invalid({nullInput:!0});else{"string"==typeof d&&(c._i=d=H().preparse(d));if(G.isMoment(d)){c=d;var g,k={};for(g in c)c.hasOwnProperty(g)&&$a.hasOwnProperty(g)&&(k[g]=c[g]);c=k;c._d=new Date(+d._d)}else if(e)if(q(e)){var l=c,m,r;if(0===
l._f.length)l._pf.invalidFormat=!0,l._d=new Date(0/0);else{for(d=0;d<l._f.length;d++)g=0,k=h({},l),k._pf=b(),k._f=l._f[d],S(k),w(k)&&(g+=k._pf.charsLeftOver,g+=10*k._pf.unusedTokens.length,k._pf.score=g,(null==r||r>g)&&(r=g,m=k));h(l,m||k)}}else S(c);else if(k=c,m=k._i,r=Xa.exec(m),m===a)k._d=new Date;else if(r)k._d=new Date(+r[1]);else if("string"==typeof m)if(l=k._i,d=eb.exec(l)){k._pf.iso=!0;m=0;for(r=Ba.length;r>m;m++)if(Ba[m][1].exec(l)){k._f=Ba[m][0]+(d[6]||" ");break}m=0;for(r=Ca.length;r>
m;m++)if(Ca[m][1].exec(l)){k._f+=Ca[m][0];break}l.match(xa)&&(k._f+="Z");S(k)}else k._d=new Date(l);else q(m)?(k._a=m.slice(0),O(k)):"[object Date]"===Object.prototype.toString.call(m)||m instanceof Date?k._d=new Date(+m):"object"==typeof m?k._d||(l=u(k._i),k._a=[l.year,l.month,l.day,l.hour,l.minute,l.second,l.millisecond],O(k)):k._d=new Date(m);c=new f(c)}return c}function ba(a,b){G.fn[a]=G.fn[a+"s"]=function(a){var c=this._isUTC?"UTC":"";return null!=a?(this._d["set"+c+b](a),G.updateOffset(this),
this):this._d["get"+c+b]()}}function aa(a){G.duration.fn[a]=function(){return this._data[a]}}function U(a,b){G.duration.fn["as"+a]=function(){return+this/b}}function Y(a){var b=!1,c=G;"undefined"==typeof ender&&(a?(V.moment=function(){return!b&&console&&console.warn&&(b=!0,console.warn("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.")),c.apply(null,arguments)},h(V.moment,c)):V.moment=G)}for(var G,Q,V=this,ea=Math.round,fa=0,ka=1,ga=2,ca=3,ma=4,
qa=5,oa=6,na={},$a={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},Ma="undefined"!=typeof module&&module.exports&&"undefined"!=typeof require,Xa=/^\/?Date\((\-?\d+)/i,ab=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Na=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Oa=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
pa=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Pa=/\d\d?/,wa=/\d{1,3}/,Qa=/\d{1,4}/,Ra=/[+\-]?\d{1,6}/,bb=/\d+/,cb=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,xa=/Z|[\+\-]\d\d:?\d\d/gi,db=/T/i,Sa=/[\+\-]?\d+(\.\d{1,3})?/,Ta=/\d/,ya=/\d\d/,Ua=/\d{3}/,da=/\d{4}/,za=/[+-]?\d{6}/,Aa=/[+-]?\d+/,eb=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
Ba=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],Ca=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],va=/([\+\-]|\d\d)/gi,Da=["Date","Hours","Minutes","Seconds","Milliseconds"],Ea={Milliseconds:1,Seconds:1E3,Minutes:6E4,Hours:36E5,Days:864E5,Months:2592E6,Years:31536E6},fb={ms:"millisecond",s:"second",
m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},la={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},ia={},Fa="DDD w W M D d".split(" "),Ga="MDHhmswW".split(""),ha={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},
DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return m(this.year()%100,2)},YYYY:function(){return m(this.year(),4)},YYYYY:function(){return m(this.year(),5)},YYYYYY:function(){var a=this.year();return(0<=a?"+":"-")+m(Math.abs(a),
6)},gg:function(){return m(this.weekYear()%100,2)},gggg:function(){return m(this.weekYear(),4)},ggggg:function(){return m(this.weekYear(),5)},GG:function(){return m(this.isoWeekYear()%100,2)},GGGG:function(){return m(this.isoWeekYear(),4)},GGGGG:function(){return m(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),
!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return t(this.milliseconds()/100)},SS:function(){return m(t(this.milliseconds()/10),2)},SSS:function(){return m(this.milliseconds(),3)},SSSS:function(){return m(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+m(t(a/60),2)+":"+m(t(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,
b="-"),b+m(t(a/60),2)+m(t(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},Ja=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Fa.length;)Q=Fa.pop(),ha[Q+"o"]=d(ha[Q],Q);for(;Ga.length;)Q=Ga.pop(),ha[Q+Q]=c(ha[Q],2);ha.DDDD=c(ha.DDD,3);h(e.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January February March April May June July August September October November December".split(" "),
months:function(a){return this._months[a.month()]},_monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;this._monthsParse||(this._monthsParse=[]);for(b=0;12>b;b++)if(this._monthsParse[b]||(c=G.utc([2E3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su Mo Tu We Th Fr Sa".split(" "),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;this._weekdaysParse||(this._weekdaysParse=[]);for(b=0;7>b;b++)if(this._weekdaysParse[b]||(c=G([2E3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,
""),this._weekdaysParse[b]=RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},
_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return 11<a?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",
y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[0<a?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return L(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",
invalidDate:function(){return this._invalidDate}});G=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=c,g._f=d,g._l=e,g._strict=f,g._isUTC=!1,g._pf=b(),X(g)};G.utc=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=c,g._f=d,g._strict=f,g._pf=b(),X(g).utc()};G.unix=function(a){return G(1E3*a)};G.duration=function(a,b){var c,d,e,f=a,h=null;return G.isDuration(a)?f={ms:a._milliseconds,
d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(h=ab.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:t(h[ga])*c,h:t(h[ca])*c,m:t(h[ma])*c,s:t(h[qa])*c,ms:t(h[oa])*c}):(h=Na.exec(a))&&(c="-"===h[1]?-1:1,e=function(a){a=a&&parseFloat(a.replace(",","."));return(isNaN(a)?0:a)*c},f={y:e(h[2]),M:e(h[3]),d:e(h[4]),h:e(h[5]),m:e(h[6]),s:e(h[7]),w:e(h[8])}),d=new g(f),G.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d};G.version="2.5.1";G.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";
G.updateOffset=function(){};G.lang=function(a,b){var c,d;a?(b?(d=v(a),b.abbr=d,na[d]||(na[d]=new e),na[d].set(b)):null===b?(delete na[a],a="en"):na[a]||H(a),d=(c=G.duration.fn._lang=G.fn._lang=H(a),c._abbr)):d=G.fn._lang._abbr;return d};G.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),H(a)};G.isMoment=function(a){return a instanceof f||null!=a&&a.hasOwnProperty("_isAMomentObject")};G.isDuration=function(a){return a instanceof g};for(Q=Ja.length-1;0<=Q;--Q)z(Ja[Q]);G.normalizeUnits=
function(a){return s(a)};G.invalid=function(a){var b=G.utc(0/0);return null!=a?h(b._pf,a):b._pf.userInvalidated=!0,b};G.parseZone=function(a){return G(a).parseZone()};h(G.fn=f.prototype,{clone:function(){return G(this)},valueOf:function(){return+this._d+6E4*(this._offset||0)},unix:function(){return Math.floor(+this/1E3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=
G(this).utc();return 0<a.year()&&9999>=a.year()?F(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):F(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){return[this.year(),this.month(),this.date(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()]},isValid:function(){return w(this)},isDSTShifted:function(){return this._a?this.isValid()&&0<l(this._a,(this._isUTC?G.utc(this._a):G(this._a)).toArray()):!1},parsingFlags:function(){return h({},this._pf)},invalidAt:function(){return this._pf.overflow},
utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){a=F(this,a||G.defaultFormat);return this.lang().postformat(a)},add:function(a,b){var c;return c="string"==typeof a?G.duration(+b,a):G.duration(a,b),n(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?G.duration(+b,a):G.duration(a,b),n(this,c,-1),this},diff:function(a,b,c){var d,e;a=C(a,this);var f=6E4*(this.zone()-a.zone());return b=s(b),"year"===b||"month"===b?(d=
432E5*(this.daysInMonth()+a.daysInMonth()),e=12*(this.year()-a.year())+(this.month()-a.month()),e+=(this-G(this).startOf("month")-(a-G(a).startOf("month")))/d,e-=6E4*(this.zone()-G(this).startOf("month").zone()-(a.zone()-G(a).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-a,e="second"===b?d/1E3:"minute"===b?d/6E4:"hour"===b?d/36E5:"day"===b?(d-f)/864E5:"week"===b?(d-f)/6048E5:d),c?e:k(e)},from:function(a,b){return G.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(G(),
a)},calendar:function(){var a=C(G(),this).startOf("day"),a=this.diff(a,"days",!0),a=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(a,this))},isLeapYear:function(){return B(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=N(a,this.lang()),this.add({d:a-
b})):b},month:function(a){var b,c=this._isUTC?"UTC":"";return null!=a?"string"==typeof a&&(a=this.lang().monthsParse(a),"number"!=typeof a)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),G.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=s(a)){case "year":this.month(0);case "month":this.date(1);case "week":case "isoWeek":case "day":this.hours(0);case "hour":this.minutes(0);case "minute":this.seconds(0);case "second":this.milliseconds(0)}return"week"===
a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),this},endOf:function(a){return a=s(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+G(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+G(a).startOf(b)},isSame:function(a,b){return b=b||"ms",+this.clone().startOf(b)===+C(a,this).startOf(b)},min:function(a){return a=G.apply(null,
arguments),this>a?this:a},max:function(a){return a=G.apply(null,arguments),a>this?this:a},zone:function(a){var b=this._offset||0;return null==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeof a&&(a=P(a)),16>Math.abs(a)&&(a*=60),this._offset=a,this._isUTC=!0,b!==a&&n(this,G.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==
typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?G(a).zone():0,0===(this.zone()-a)%60},daysInMonth:function(){var a=this.year(),b=this.month();return(new Date(Date.UTC(a,b+1,0))).getUTCDate()},dayOfYear:function(a){var b=ea((G(this).startOf("day")-G(this).startOf("year"))/864E5)+1;return null==a?b:this.add("d",a-b)},quarter:function(){return Math.ceil((this.month()+1)/3)},weekYear:function(a){var b=L(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==
a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=L(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=L(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){return a=s(a),this[a]()},set:function(a,
b){return a=s(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=H(b),this)}});for(Q=0;Q<Da.length;Q++)ba(Da[Q].toLowerCase().replace(/s$/,""),Da[Q]);ba("year","FullYear");G.fn.days=G.fn.day;G.fn.months=G.fn.month;G.fn.weeks=G.fn.week;G.fn.isoWeeks=G.fn.isoWeek;G.fn.toJSON=G.fn.toISOString;h(G.duration.fn=g.prototype,{_bubble:function(){var a,b;a=this._milliseconds;b=this._days;var c=this._months,d=this._data;d.milliseconds=a%1E3;a=k(a/1E3);d.seconds=
a%60;a=k(a/60);d.minutes=a%60;a=k(a/60);d.hours=a%24;b+=k(a/24);d.days=b%30;c+=k(b/30);d.months=c%12;b=k(c/12);d.years=b},weeks:function(){return k(this.days()/7)},valueOf:function(){return this._milliseconds+864E5*this._days+2592E6*(this._months%12)+31536E6*t(this._months/12)},humanize:function(a){var b=+this,c;c=!a;var d=this.lang(),e=ea(Math.abs(b)/1E3),f=ea(e/60),g=ea(f/60),h=ea(g/24),k=ea(h/365),e=45>e&&["s",e]||1===f&&["m"]||45>f&&["mm",f]||1===g&&["h"]||22>g&&["hh",g]||1===h&&["d"]||25>=h&&
["dd",h]||45>=h&&["M"]||345>h&&["MM",ea(h/30)]||1===k&&["y"]||["yy",k];c=(e[2]=c,e[3]=0<b,e[4]=d,T.apply({},e));return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=G.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=G.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=
s(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=s(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:G.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1E3);return this.asSeconds()?(0>this.asSeconds()?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(Q in Ea)Ea.hasOwnProperty(Q)&&
(U(Q,Ea[Q]),aa(Q.toLowerCase()));U("Weeks",6048E5);G.duration.fn.asMonths=function(){return(+this-31536E6*this.years())/2592E6+12*this.years()};G.lang("en",{ordinal:function(a){var b=a%10,b=1===t(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+b}});Ma?(module.exports=G,Y(!0)):"function"==typeof define&&define.amd?define("moment",function(b,c,d){return d.config&&d.config()&&!0!==d.config().noGlobal&&Y(d.config().noGlobal===a),G}):Y()}).call(this);(function(){function a(a,b){if(!b||"function"===typeof b)return a;for(var c in b)a[c]=b[c];return a}function b(a,b,c){var d,e=0,f=a.length,g=void 0===f||"[object Array]"!==Object.prototype.toString.apply(a)||"function"===typeof a;if(c)if(g)for(d in a){if(!1===b.apply(a[d],c))break}else for(;e<f&&!1!==b.apply(a[e++],c););else if(g)for(d in a){if(!1===b.call(a[d],d,a[d]))break}else for(;e<f&&!1!==b.call(a[e],e,a[e++]););return a}function c(a){var b=function(a){if(window.XMLHttpRequest)return a(null,
new XMLHttpRequest);if(window.ActiveXObject)try{return a(null,new ActiveXObject("Msxml2.XMLHTTP"))}catch(b){return a(null,new ActiveXObject("Microsoft.XMLHTTP"))}return a(Error())},c=function(a){if("string"===typeof a)return a;var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")},d=function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=arguments[b],d;for(d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a},e=function(a,
f,g,h){"function"===typeof g&&(h=g,g={});g.cache=g.cache||!1;g.data=g.data||{};g.headers=g.headers||{};g.jsonp=g.jsonp||!1;g.async=void 0===g.async?!0:g.async;var k=d({accept:"*/*","content-type":"application/x-www-form-urlencoded;charset=UTF-8"},e.headers,g.headers),l;l="application/json"===k["content-type"]?JSON.stringify(g.data):c(g.data);if("GET"===a){var m=[];l&&(m.push(l),l=null);g.cache||m.push("_="+(new Date).getTime());g.jsonp&&(m.push("callback="+g.jsonp),m.push("jsonp="+g.jsonp));m=m.join("&");
1<m.length&&(f=-1<f.indexOf("?")?f+("&"+m):f+("?"+m));if(g.jsonp){var m=document.getElementsByTagName("head")[0],r=document.createElement("script");r.type="text/javascript";r.src=f;m.appendChild(r);return}}b(function(b,c){if(b)return h(b);c.open(a,f,g.async);for(var d in k)k.hasOwnProperty(d)&&c.setRequestHeader(d,k[d]);c.onreadystatechange=function(){if(4===c.readyState){var a=c.responseText||"";h&&h(c.status,{text:function(){return a},json:function(){return JSON.parse(a)}})}};c.send(l)})};({authBasic:function(a,
b){var c=e.headers,d;d=a+":"+b;d=d.replace(/\r\n/g,"\n");for(var f="",g=0;g<d.length;g++){var h=d.charCodeAt(g);128>h?f+=String.fromCharCode(h):(127<h&&2048>h?f+=String.fromCharCode(h>>6|192):(f+=String.fromCharCode(h>>12|224),f+=String.fromCharCode(h>>6&63|128)),f+=String.fromCharCode(h&63|128))}d=f;var f="",k,l,m,r,q=0;do k=d.charCodeAt(q++),g=d.charCodeAt(q++),h=d.charCodeAt(q++),l=k>>2,k=(k&3)<<4|g>>4,m=(g&15)<<2|h>>6,r=h&63,isNaN(g)?m=r=64:isNaN(h)&&(r=64),f+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r);while(q<d.length);c.Authorization="Basic "+f},connect:function(a,b,c){return e("CONNECT",a,b,c)},del:function(a,b,c){return e("DELETE",a,b,c)},get:function(a,b,c){return e("GET",a,b,c)},head:function(a,b,c){return e("HEAD",a,b,c)},headers:function(a){e.headers=a||{}},
isAllowed:function(a,b,c){this.options(a,function(a,d){c(-1!==d.text().indexOf(b))})},options:function(a,b,c){return e("OPTIONS",a,b,c)},patch:function(a,b,c){return e("PATCH",a,b,c)},post:function(a,b,c){return e("POST",a,b,c)},put:function(a,b,c){return e("PUT",a,b,c)},trace:function(a,b,c){return e("TRACE",a,b,c)}})[a.type?a.type.toLowerCase():"get"](a.url,a,function(b,c){200===b?a.success(c.json(),b,null):a.error(c.text(),b,null)})}function d(a,b){"function"===typeof a&&(b=a,a={});a=a||{};F.extend(v,
a);delete v.fixLng;"string"==typeof v.ns&&(v.ns={namespaces:[v.ns],defaultNs:v.ns});"string"==typeof v.fallbackNS&&(v.fallbackNS=[v.fallbackNS]);if("string"==typeof v.fallbackLng||"boolean"==typeof v.fallbackLng)v.fallbackLng=[v.fallbackLng];v.interpolationPrefixEscaped=F.regexEscape(v.interpolationPrefix);v.interpolationSuffixEscaped=F.regexEscape(v.interpolationSuffix);v.lng||(v.lng=F.detectLanguage());v.lng?v.useCookie&&F.cookie.create(v.cookieName,v.lng,v.cookieExpirationTime,v.cookieDomain):
(v.lng=v.fallbackLng[0],v.useCookie&&F.cookie.remove(v.cookieName));A=F.toLanguages(v.lng);t=A[0];F.log("currentLng set to: "+t);var c=m;a.fixLng&&(c=function(a,b){b=b||{};b.lng=b.lng||c.lng;return m(a,b)},c.lng=t);E.setCurrentLng(t);s&&v.setJqueryExt&&f();var d;s&&s.Deferred&&(d=s.Deferred());if(v.resStore)z=v.resStore,w=!0,b&&b(c),d&&d.resolve(c);else{var e=F.toLanguages(v.lng);"string"===typeof v.preload&&(v.preload=[v.preload]);for(var g=0,h=v.preload.length;g<h;g++)for(var k=F.toLanguages(v.preload[g]),
l=0,q=k.length;l<q;l++)0>e.indexOf(k[l])&&e.push(k[l]);u.sync.load(e,v,function(a,e){z=e;w=!0;b&&b(c);d&&d.resolve(c)})}if(d)return d.promise()}function e(a,b){var c={dynamicLoad:v.dynamicLoad,resGetPath:v.resGetPath,getAsync:v.getAsync,customLoad:v.customLoad,ns:{namespaces:a,defaultNs:""}},d=F.toLanguages(v.lng);"string"===typeof v.preload&&(v.preload=[v.preload]);for(var e=0,f=v.preload.length;e<f;e++)for(var g=F.toLanguages(v.preload[e]),h=0,k=g.length;h<k;h++)0>d.indexOf(g[h])&&d.push(g[h]);
for(var l=[],e=0,f=d.length;e<f;e++){g=!1;if(h=z[d[e]])for(var k=0,m=a.length;k<m;k++)h[a[k]]||(g=!0);else g=!0;g&&l.push(d[e])}l.length?u.sync._fetch(l,c,function(c,d){var e=a.length*l.length;F.each(a,function(a,c){0>v.ns.namespaces.indexOf(c)&&v.ns.namespaces.push(c);F.each(l,function(a,f){z[f]=z[f]||{};z[f][c]=d[f][c];e--;0===e&&b&&(v.useLocalStorage&&u.sync._storeLocal(z),b())})})}):b&&b()}function f(){function a(b,c,d){if(0!==c.length){var e="text";0===c.indexOf("[")&&(e=c.split("]"),c=e[1],
e=e[0].substr(1,e[0].length-1));c.indexOf(";")===c.length-1&&(c=c.substr(0,c.length-2));if("html"===e)d=v.defaultValueFromContent?s.extend({defaultValue:b.html()},d):d,b.html(s.t(c,d));else if("text"===e)d=v.defaultValueFromContent?s.extend({defaultValue:b.text()},d):d,b.text(s.t(c,d));else if("prepend"===e)d=v.defaultValueFromContent?s.extend({defaultValue:b.html()},d):d,b.prepend(s.t(c,d));else if("append"===e)d=v.defaultValueFromContent?s.extend({defaultValue:b.html()},d):d,b.append(s.t(c,d));
else if(0===e.indexOf("data-")){var f=e.substr(5);d=v.defaultValueFromContent?s.extend({defaultValue:b.data(f)},d):d;c=s.t(c,d);b.data(f,c);b.attr(e,c)}else d=v.defaultValueFromContent?s.extend({defaultValue:b.attr(e)},d):d,b.attr(e,s.t(c,d))}}function b(c,d){var e=c.attr(v.selectorAttr);e||"undefined"===typeof e||!1===e||(e=c.text()||c.val());if(e){var f=c,g=c.data("i18n-target");g&&(f=c.find(g)||c);d||!0!==v.useDataAttrOptions||(d=c.data("i18n-options"));d=d||{};0<=e.indexOf(";")?(e=e.split(";"),
s.each(e,function(b,c){""!==c&&a(f,c,d)})):a(f,e,d);!0===v.useDataAttrOptions&&c.data("i18n-options",d)}}s.t=s.t||m;s.fn.i18n=function(a){return this.each(function(){b(s(this),a);s(this).find("["+v.selectorAttr+"]").each(function(){b(s(this),a)})})}}function g(a,b,c,d){if(!a)return a;d=d||b;if(0>a.indexOf(d.interpolationPrefix||v.interpolationPrefix))return a;var e=d.interpolationPrefix?F.regexEscape(d.interpolationPrefix):v.interpolationPrefixEscaped,f=d.interpolationSuffix?F.regexEscape(d.interpolationSuffix):
v.interpolationSuffixEscaped,h="HTML"+f;F.each(b,function(b,k){var l=c?c+v.keyseparator+b:b;"object"===typeof k&&null!==k?a=g(a,k,l,d):d.escapeInterpolation||v.escapeInterpolation?(a=a.replace(RegExp([e,l,h].join(""),"g"),k),a=a.replace(RegExp([e,l,f].join(""),"g"),F.escape(k))):a=a.replace(RegExp([e,l,f].join(""),"g"),k)});return a}function h(a,b){var c=F.extend({},b);for(delete c.postProcess;-1!=a.indexOf(v.reusePrefix);){B++;if(B>v.maxRecursion)break;var d=a.lastIndexOf(v.reusePrefix),e=a.indexOf(v.reuseSuffix,
d)+v.reuseSuffix.length,d=a.substring(d,e),e=d.replace(v.reusePrefix,"").replace(v.reuseSuffix,"");if(-1!=e.indexOf(",")){var f=e.indexOf(",");if(-1!=e.indexOf("{",f)&&-1!=e.indexOf("}",f)){var g=e.indexOf("{",f),h=e.indexOf("}",g)+1;try{c=F.extend(c,JSON.parse(e.substring(g,h))),e=e.substring(0,f)}catch(k){}}}e=q(e,c);a=a.replace(d,e)}return a}function k(a,b){b=b||{};var c=void 0!==b.defaultValue?b.defaultValue:a,d=l(a,b);return void 0!==d||d===c}function m(a,b){b=b||{};if(!w)return a||"";B=0;return q.apply(null,
arguments)}function n(){for(var a=[],b=1;b<arguments.length;b++)a.push(arguments[b]);return{postProcess:"sprintf",sprintf:a}}function q(a,b){b&&"object"!==typeof b?"sprintf"===v.shortcutFunction?b=n.apply(null,arguments):"defaultValue"===v.shortcutFunction&&(b={defaultValue:b}):b=b||{};if(void 0===a||null===a)return"";"string"==typeof a&&(a=[a]);var c=a[0];if(1<a.length)for(var d=0;d<a.length&&(c=a[d],!k(c,b));d++);var d=void 0!==b.defaultValue?b.defaultValue:c,e=l(c,b),f=b.lng?F.toLanguages(b.lng):
A,m=b.ns||v.ns.defaultNs,q;-1<c.indexOf(v.nsseparator)&&(q=c.split(v.nsseparator),m=q[0],c=q[1]);void 0===e&&v.sendMissing&&(b.lng?I.postMissing(f[0],m,c,d,f):I.postMissing(v.lng,m,c,d,f));f=b.postProcess||v.postProcess;void 0!==e&&f&&P[f]&&(e=P[f](e,c,b));q=d;-1<d.indexOf(v.nsseparator)&&(q=d.split(v.nsseparator),q=q[1]);q===c&&v.parseMissingKey&&(d=v.parseMissingKey(d));void 0===e&&(d=g(d,b),d=h(d,b),f&&P[f]&&(e=P[f](void 0!==b.defaultValue?b.defaultValue:c,c,b)));return void 0!==e?e:d}function l(a,
b){b=b||{};var c,d=void 0!==b.defaultValue?b.defaultValue:a,e=A;if(!z||"cimode"===e[0].toLowerCase())return d;if(b.lng&&(e=F.toLanguages(b.lng),!z[e[0]])){var f=v.getAsync;v.getAsync=!1;u.sync.load(e,v,function(a,b){F.extend(z,b);v.getAsync=f})}var k=b.ns||v.ns.defaultNs;-1<a.indexOf(v.nsseparator)&&(c=a.split(v.nsseparator),k=c[0],a=c[1]);if(b.context&&("string"==typeof b.context||"number"==typeof b.context)&&(c=F.extend({},b),delete c.context,c.defaultValue=v.contextNotFound,c=m(k+v.nsseparator+
a+"_"+b.context,c),c!=v.contextNotFound))return g(c,{context:b.context});if(void 0!==b.count&&"string"!=typeof b.count&&1!==b.count){c=F.extend({},b);delete c.count;c.defaultValue=v.pluralNotFound;var n=k+v.nsseparator+a+v.pluralSuffix,s=E.get(e[0],b.count);0<=s?n=n+"_"+s:1===s&&(n=k+v.nsseparator+a);c=m(n,c);if(c!=v.pluralNotFound)return g(c,{count:b.count,interpolationPrefix:b.interpolationPrefix,interpolationSuffix:b.interpolationSuffix})}var w;c=a.split(v.keyseparator);n=0;for(s=e.length;n<s&&
void 0===w;n++){for(var t=e[n],B=0,C=z[t]&&z[t][k];c[B];)C=C&&C[c[B]],B++;if(void 0!==C){w=Object.prototype.toString.apply(C);if("string"===typeof C)C=g(C,b),C=h(C,b);else if("[object Array]"===w&&!v.returnObjectTrees&&!b.returnObjectTrees)C=C.join("\n"),C=g(C,b),C=h(C,b);else if(null===C&&!0===v.fallbackOnNull)C=void 0;else if(null!==C)if(!v.returnObjectTrees&&!b.returnObjectTrees)v.objectTreeKeyHandler&&"function"==typeof v.objectTreeKeyHandler?C=v.objectTreeKeyHandler(a,C,t,k,b):(C="key '"+k+":"+
a+" ("+t+")' returned an object instead of string.",F.log(C));else if("[object Number]"!==w&&"[object Function]"!==w&&"[object RegExp]"!==w){var D="[object Array]"===w?[]:{};F.each(C,function(c){D[c]=q(k+v.nsseparator+a+v.keyseparator+c,b)});C=D}"string"===typeof C&&""===C.trim()&&!0===v.fallbackOnEmpty&&(C=void 0);w=C}}if(void 0===w&&!b.isFallbackLookup&&(!0===v.fallbackToDefaultNS||v.fallbackNS&&0<v.fallbackNS.length))if(b.isFallbackLookup=!0,v.fallbackNS.length)for(e=0,c=v.fallbackNS.length;e<
c;e++){if(w=l(v.fallbackNS[e]+v.nsseparator+a,b))if(n=-1<w.indexOf(v.nsseparator)?w.split(v.nsseparator)[1]:w,s=-1<d.indexOf(v.nsseparator)?d.split(v.nsseparator)[1]:d,n!==s)break}else w=l(a,b);return w}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;0<arguments.length&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&Infinity!=d&&-Infinity!=d&&(d=(0<d||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;
for(d=0<=d?d:Math.max(c-Math.abs(d),0);d<c;d++)if(d in b&&b[d]===a)return d;return-1});Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;1<arguments.length&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(0<d||-1)*Math.floor(Math.abs(d))));for(c=0<=d?Math.min(d,c-1):c-Math.abs(d);0<=c;c--)if(c in b&&b[c]===a)return c;return-1});"function"!==typeof String.prototype.trim&&
(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var s=this.jQuery||this.Zepto,u={},z={},t,B=0,A=[],w=!1;"undefined"!==typeof module&&module.exports?module.exports=u:(s&&(s.i18n=s.i18n||u),this.i18n=this.i18n||u);var v={lng:void 0,load:"all",preload:[],lowerCaseLng:!1,returnObjectTrees:!1,fallbackLng:["dev"],fallbackNS:[],detectLngQS:"setLng",ns:"translation",fallbackOnNull:!0,fallbackOnEmpty:!1,fallbackToDefaultNS:!1,nsseparator:":",keyseparator:".",selectorAttr:"data-i18n",
debug:!1,resGetPath:"locales/__lng__/__ns__.json",resPostPath:"locales/add/__lng__/__ns__",getAsync:!0,postAsync:!0,resStore:void 0,useLocalStorage:!1,localStorageExpirationTime:6048E5,dynamicLoad:!1,sendMissing:!1,sendMissingTo:"fallback",sendType:"POST",interpolationPrefix:"__",interpolationSuffix:"__",reusePrefix:"$t(",reuseSuffix:")",pluralSuffix:"_plural",pluralNotFound:["plural_not_found",Math.random()].join(""),contextNotFound:["context_not_found",Math.random()].join(""),escapeInterpolation:!1,
setJqueryExt:!0,defaultValueFromContent:!0,useDataAttrOptions:!1,cookieExpirationTime:void 0,useCookie:!0,cookieName:"i18next",cookieDomain:void 0,objectTreeKeyHandler:void 0,postProcess:void 0,parseMissingKey:void 0,shortcutFunction:"sprintf"},C={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},H={create:function(a,b,c,d){if(c){var e=new Date;e.setTime(e.getTime()+6E4*c);c="; expires="+e.toGMTString()}else c="";document.cookie=a+"="+b+c+";"+(d?"domain="+d+";":"")+"path=/"},
read:function(a){a+="=";for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];" "==d.charAt(0);)d=d.substring(1,d.length);if(0===d.indexOf(a))return d.substring(a.length,d.length)}return null},remove:function(a){this.create(a,"",-1)}},D={create:function(a,b,c,d){},read:function(a){return null},remove:function(a){}},F={extend:s?s.extend:a,each:s?s.each:b,ajax:s?s.ajax:"undefined"!==typeof document?c:function(){},cookie:"undefined"!==typeof document?H:D,detectLanguage:function(){var a,
b=[];if("undefined"!==typeof window){for(var c=window.location.search.substring(1).split("&"),d=0;d<c.length;d++){var e=c[d].indexOf("=");if(0<e){var f=c[d].substring(0,e),e=c[d].substring(e+1);b[f]=e}}b[v.detectLngQS]&&(a=b[v.detectLngQS])}!a&&"undefined"!==typeof document&&v.useCookie&&(b=F.cookie.read(v.cookieName))&&(a=b);a||"undefined"===typeof navigator||(a=navigator.language?navigator.language:navigator.userLanguage);return a},escape:function(a){return"string"===typeof a?a.replace(/[&<>"'\/]/g,
function(a){return C[a]}):a},log:function(a){v.debug&&"undefined"!==typeof console&&console.log(a)},toLanguages:function(a){var b=[];if("string"===typeof a&&-1<a.indexOf("-")){var c=a.split("-");a=v.lowerCaseLng?c[0].toLowerCase()+"-"+c[1].toLowerCase():c[0].toLowerCase()+"-"+c[1].toUpperCase();"unspecific"!==v.load&&b.push(a);"current"!==v.load&&b.push(c[0])}else b.push(a);for(a=0;a<v.fallbackLng.length;a++)-1===b.indexOf(v.fallbackLng[a])&&v.fallbackLng[a]&&b.push(v.fallbackLng[a]);return b},regexEscape:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
"\\$&")}};F.applyReplacement=g;var I={load:function(a,b,c){b.useLocalStorage?I._loadLocal(a,b,function(d,e){for(var f=[],g=0,h=a.length;g<h;g++)e[a[g]]||f.push(a[g]);0<f.length?I._fetch(f,b,function(a,b){F.extend(e,b);I._storeLocal(b);c(null,e)}):c(null,e)}):I._fetch(a,b,function(a,b){c(null,b)})},_loadLocal:function(a,b,c){var d={},e=(new Date).getTime();if(window.localStorage){var f=a.length;F.each(a,function(a,g){var h=window.localStorage.getItem("res_"+g);h&&(h=JSON.parse(h),h.i18nStamp&&h.i18nStamp+
b.localStorageExpirationTime>e&&(d[g]=h));f--;0===f&&c(null,d)})}},_storeLocal:function(a){if(window.localStorage)for(var b in a)a[b].i18nStamp=(new Date).getTime(),window.localStorage.setItem("res_"+b,JSON.stringify(a[b]))},_fetch:function(a,b,c){var d=b.ns,e={};if(b.dynamicLoad){var f=function(a,b){c(null,b)};if("function"==typeof b.customLoad)b.customLoad(a,d.namespaces,b,f);else{var h=g(b.resGetPath,{lng:a.join("+"),ns:d.namespaces.join("+")});F.ajax({url:h,success:function(a,b,d){F.log("loaded: "+
h);c(null,a)},error:function(a,b,d){F.log("failed loading: "+h);c(null,void 0)},dataType:"json",async:b.getAsync})}}else{var k=d.namespaces.length*a.length,l;F.each(d.namespaces,function(d,f){F.each(a,function(a,d){var g=function(a,b){a&&(l=l||[],l.push(a));e[d]=e[d]||{};e[d][f]=b;k--;0===k&&c(l,e)};"function"==typeof b.customLoad?b.customLoad(d,f,b,g):I._fetchOne(d,f,b,g)})})}},_fetchOne:function(a,b,c,d){var e=g(c.resGetPath,{lng:a,ns:b});F.ajax({url:e,success:function(a,b,c){F.log("loaded: "+e);
d(null,a)},error:function(a,b,c){b&&200==b||a&&a.status&&200==a.status?F.log("There is a typo in: "+e):b&&404==b||a&&a.status&&404==a.status?F.log("Does not exist: "+e):F.log((b?b:a&&a.status?a.status:null)+" when loading "+e);d(c,{})},dataType:"json",async:c.getAsync})},postMissing:function(a,b,c,d,e){var f={};f[c]=d;var h=[];if("fallback"===v.sendMissingTo&&!1!==v.fallbackLng[0])for(a=0;a<v.fallbackLng.length;a++)h.push({lng:v.fallbackLng[a],url:g(v.resPostPath,{lng:v.fallbackLng[a],ns:b})});else if("current"===
v.sendMissingTo||"fallback"===v.sendMissingTo&&!1===v.fallbackLng[0])h.push({lng:a,url:g(v.resPostPath,{lng:a,ns:b})});else if("all"===v.sendMissingTo){a=0;for(var k=e.length;a<k;a++)h.push({lng:e[a],url:g(v.resPostPath,{lng:e[a],ns:b})})}e=0;for(a=h.length;e<a;e++){var l=h[e];F.ajax({url:l.url,type:v.sendType,data:f,success:function(a,e,f){F.log("posted missing key '"+c+"' to: "+l.url);a=c.split(".");e=0;for(f=z[l.lng][b];a[e];)f=e===a.length-1?f[a[e]]=d:f[a[e]]=f[a[e]]||{},e++},error:function(a,
b,d){F.log("failed posting missing key '"+c+"' to: "+l.url)},dataType:"json",async:v.postAsync})}}},E={rules:{ach:{name:"Acholi",numbers:[1,2],plurals:function(a){return Number(1<a)}},af:{name:"Afrikaans",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ak:{name:"Akan",numbers:[1,2],plurals:function(a){return Number(1<a)}},am:{name:"Amharic",numbers:[1,2],plurals:function(a){return Number(1<a)}},an:{name:"Aragonese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ar:{name:"Arabic",
numbers:[0,1,2,3,11,100],plurals:function(a){return Number(0===a?0:1==a?1:2==a?2:3<=a%100&&10>=a%100?3:11<=a%100?4:5)}},arn:{name:"Mapudungun",numbers:[1,2],plurals:function(a){return Number(1<a)}},ast:{name:"Asturian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ay:{name:"Aymar\u00e1",numbers:[1],plurals:function(a){return 0}},az:{name:"Azerbaijani",numbers:[1,2],plurals:function(a){return Number(1!=a)}},be:{name:"Belarusian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&
11!=a%100?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:2)}},bg:{name:"Bulgarian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},bn:{name:"Bengali",numbers:[1,2],plurals:function(a){return Number(1!=a)}},bo:{name:"Tibetan",numbers:[1],plurals:function(a){return 0}},br:{name:"Breton",numbers:[1,2],plurals:function(a){return Number(1<a)}},bs:{name:"Bosnian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:2)}},ca:{name:"Catalan",
numbers:[1,2],plurals:function(a){return Number(1!=a)}},cgg:{name:"Chiga",numbers:[1],plurals:function(a){return 0}},cs:{name:"Czech",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:2<=a&&4>=a?1:2)}},csb:{name:"Kashubian",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:2)}},cy:{name:"Welsh",numbers:[1,2,3,8],plurals:function(a){return Number(1==a?0:2==a?1:8!=a&&11!=a?2:3)}},da:{name:"Danish",numbers:[1,2],plurals:function(a){return Number(1!=
a)}},de:{name:"German",numbers:[1,2],plurals:function(a){return Number(1!=a)}},dz:{name:"Dzongkha",numbers:[1],plurals:function(a){return 0}},el:{name:"Greek",numbers:[1,2],plurals:function(a){return Number(1!=a)}},en:{name:"English",numbers:[1,2],plurals:function(a){return Number(1!=a)}},eo:{name:"Esperanto",numbers:[1,2],plurals:function(a){return Number(1!=a)}},es:{name:"Spanish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},es_ar:{name:"Argentinean Spanish",numbers:[1,2],plurals:function(a){return Number(1!=
a)}},et:{name:"Estonian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},eu:{name:"Basque",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fa:{name:"Persian",numbers:[1],plurals:function(a){return 0}},fi:{name:"Finnish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fil:{name:"Filipino",numbers:[1,2],plurals:function(a){return Number(1<a)}},fo:{name:"Faroese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fr:{name:"French",numbers:[1,2],plurals:function(a){return Number(1<
a)}},fur:{name:"Friulian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fy:{name:"Frisian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ga:{name:"Irish",numbers:[1,2,3,7,11],plurals:function(a){return Number(1==a?0:2==a?1:7>a?2:11>a?3:4)}},gd:{name:"Scottish Gaelic",numbers:[1,2,3,20],plurals:function(a){return Number(1==a||11==a?0:2==a||12==a?1:2<a&&20>a?2:3)}},gl:{name:"Galician",numbers:[1,2],plurals:function(a){return Number(1!=a)}},gu:{name:"Gujarati",numbers:[1,2],plurals:function(a){return Number(1!=
a)}},gun:{name:"Gun",numbers:[1,2],plurals:function(a){return Number(1<a)}},ha:{name:"Hausa",numbers:[1,2],plurals:function(a){return Number(1!=a)}},he:{name:"Hebrew",numbers:[1,2],plurals:function(a){return Number(1!=a)}},hi:{name:"Hindi",numbers:[1,2],plurals:function(a){return Number(1!=a)}},hr:{name:"Croatian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:2)}},hu:{name:"Hungarian",numbers:[1,2],plurals:function(a){return Number(1!=
a)}},hy:{name:"Armenian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ia:{name:"Interlingua",numbers:[1,2],plurals:function(a){return Number(1!=a)}},id:{name:"Indonesian",numbers:[1],plurals:function(a){return 0}},is:{name:"Icelandic",numbers:[1,2],plurals:function(a){return Number(1!=a%10||11==a%100)}},it:{name:"Italian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ja:{name:"Japanese",numbers:[1],plurals:function(a){return 0}},jbo:{name:"Lojban",numbers:[1],plurals:function(a){return 0}},
jv:{name:"Javanese",numbers:[0,1],plurals:function(a){return Number(0!==a)}},ka:{name:"Georgian",numbers:[1],plurals:function(a){return 0}},kk:{name:"Kazakh",numbers:[1],plurals:function(a){return 0}},km:{name:"Khmer",numbers:[1],plurals:function(a){return 0}},kn:{name:"Kannada",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ko:{name:"Korean",numbers:[1],plurals:function(a){return 0}},ku:{name:"Kurdish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},kw:{name:"Cornish",numbers:[1,
2,3,4],plurals:function(a){return Number(1==a?0:2==a?1:3==a?2:3)}},ky:{name:"Kyrgyz",numbers:[1],plurals:function(a){return 0}},lb:{name:"Letzeburgesch",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ln:{name:"Lingala",numbers:[1,2],plurals:function(a){return Number(1<a)}},lo:{name:"Lao",numbers:[1],plurals:function(a){return 0}},lt:{name:"Lithuanian",numbers:[1,2,10],plurals:function(a){return Number(1==a%10&&11!=a%100?0:2<=a%10&&(10>a%100||20<=a%100)?1:2)}},lv:{name:"Latvian",numbers:[1,
2,0],plurals:function(a){return Number(1==a%10&&11!=a%100?0:0!==a?1:2)}},mai:{name:"Maithili",numbers:[1,2],plurals:function(a){return Number(1!=a)}},mfe:{name:"Mauritian Creole",numbers:[1,2],plurals:function(a){return Number(1<a)}},mg:{name:"Malagasy",numbers:[1,2],plurals:function(a){return Number(1<a)}},mi:{name:"Maori",numbers:[1,2],plurals:function(a){return Number(1<a)}},mk:{name:"Macedonian",numbers:[1,2],plurals:function(a){return Number(1==a||1==a%10?0:1)}},ml:{name:"Malayalam",numbers:[1,
2],plurals:function(a){return Number(1!=a)}},mn:{name:"Mongolian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},mnk:{name:"Mandinka",numbers:[0,1,2],plurals:function(a){return Number(1==a?1:2)}},mr:{name:"Marathi",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ms:{name:"Malay",numbers:[1],plurals:function(a){return 0}},mt:{name:"Maltese",numbers:[1,2,11,20],plurals:function(a){return Number(1==a?0:0===a||1<a%100&&11>a%100?1:10<a%100&&20>a%100?2:3)}},nah:{name:"Nahuatl",numbers:[1,
2],plurals:function(a){return Number(1!=a)}},nap:{name:"Neapolitan",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nb:{name:"Norwegian Bokmal",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ne:{name:"Nepali",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nl:{name:"Dutch",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nn:{name:"Norwegian Nynorsk",numbers:[1,2],plurals:function(a){return Number(1!=a)}},no:{name:"Norwegian",numbers:[1,2],plurals:function(a){return Number(1!=
a)}},nso:{name:"Northern Sotho",numbers:[1,2],plurals:function(a){return Number(1!=a)}},oc:{name:"Occitan",numbers:[1,2],plurals:function(a){return Number(1<a)}},or:{name:"Oriya",numbers:[2,1],plurals:function(a){return Number(1!=a)}},pa:{name:"Punjabi",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pap:{name:"Papiamento",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pl:{name:"Polish",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?
1:2)}},pms:{name:"Piemontese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ps:{name:"Pashto",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pt:{name:"Portuguese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pt_br:{name:"Brazilian Portuguese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},rm:{name:"Romansh",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ro:{name:"Romanian",numbers:[1,2,20],plurals:function(a){return Number(1==a?0:0===a||0<a%100&&20>
a%100?1:2)}},ru:{name:"Russian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:2)}},sah:{name:"Yakut",numbers:[1],plurals:function(a){return 0}},sco:{name:"Scots",numbers:[1,2],plurals:function(a){return Number(1!=a)}},se:{name:"Northern Sami",numbers:[1,2],plurals:function(a){return Number(1!=a)}},si:{name:"Sinhala",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sk:{name:"Slovak",numbers:[1,2,5],plurals:function(a){return Number(1==
a?0:2<=a&&4>=a?1:2)}},sl:{name:"Slovenian",numbers:[5,1,2,3],plurals:function(a){return Number(1==a%100?1:2==a%100?2:3==a%100||4==a%100?3:0)}},so:{name:"Somali",numbers:[1,2],plurals:function(a){return Number(1!=a)}},son:{name:"Songhay",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sq:{name:"Albanian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sr:{name:"Serbian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:
2)}},su:{name:"Sundanese",numbers:[1],plurals:function(a){return 0}},sv:{name:"Swedish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sw:{name:"Swahili",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ta:{name:"Tamil",numbers:[1,2],plurals:function(a){return Number(1!=a)}},te:{name:"Telugu",numbers:[1,2],plurals:function(a){return Number(1!=a)}},tg:{name:"Tajik",numbers:[1,2],plurals:function(a){return Number(1<a)}},th:{name:"Thai",numbers:[1],plurals:function(a){return 0}},ti:{name:"Tigrinya",
numbers:[1,2],plurals:function(a){return Number(1<a)}},tk:{name:"Turkmen",numbers:[1,2],plurals:function(a){return Number(1!=a)}},tr:{name:"Turkish",numbers:[1,2],plurals:function(a){return Number(1<a)}},tt:{name:"Tatar",numbers:[1],plurals:function(a){return 0}},ug:{name:"Uyghur",numbers:[1],plurals:function(a){return 0}},uk:{name:"Ukrainian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:2<=a%10&&4>=a%10&&(10>a%100||20<=a%100)?1:2)}},ur:{name:"Urdu",numbers:[1,2],plurals:function(a){return Number(1!=
a)}},uz:{name:"Uzbek",numbers:[1,2],plurals:function(a){return Number(1<a)}},vi:{name:"Vietnamese",numbers:[1],plurals:function(a){return 0}},wa:{name:"Walloon",numbers:[1,2],plurals:function(a){return Number(1<a)}},wo:{name:"Wolof",numbers:[1],plurals:function(a){return 0}},yo:{name:"Yoruba",numbers:[1,2],plurals:function(a){return Number(1!=a)}},zh:{name:"Chinese",numbers:[1],plurals:function(a){return 0}}},addRule:function(a,b){E.rules[a]=b},setCurrentLng:function(a){if(!E.currentRule||E.currentRule.lng!==
a){var b=a.split("-");E.currentRule={lng:a,rule:E.rules[b[0]]}}},get:function(a,b){var c=a.split("-");if(c=E.currentRule&&E.currentRule.lng===a?E.currentRule.rule:E.rules[c[0]]){var d=c.plurals(b),d=c.numbers[d];2===c.numbers.length&&1===c.numbers[0]&&(2===d?d=-1:1===d&&(d=1));c=d}else c=1===b?"1":"-1";return c}},P={},H=function(a,b){P[a]=b},O=function(){function a(b){return Object.prototype.toString.call(b).slice(8,-1).toLowerCase()}var b=function(){b.cache.hasOwnProperty(arguments[0])||(b.cache[arguments[0]]=
b.parse(arguments[0]));return b.format.call(null,b.cache[arguments[0]],arguments)};b.format=function(b,c){var d=1,e=b.length,f="",g=[],h,k,l,m;for(h=0;h<e;h++)if(f=a(b[h]),"string"===f)g.push(b[h]);else if("array"===f){l=b[h];if(l[2])for(f=c[d],k=0;k<l[2].length;k++){if(!f.hasOwnProperty(l[2][k]))throw O('[sprintf] property "%s" does not exist',l[2][k]);f=f[l[2][k]]}else f=l[1]?c[l[1]]:c[d++];if(/[^s]/.test(l[8])&&"number"!=a(f))throw O("[sprintf] expecting number but found %s",a(f));switch(l[8]){case "b":f=
f.toString(2);break;case "c":f=String.fromCharCode(f);break;case "d":f=parseInt(f,10);break;case "e":f=l[7]?f.toExponential(l[7]):f.toExponential();break;case "f":f=l[7]?parseFloat(f).toFixed(l[7]):parseFloat(f);break;case "o":f=f.toString(8);break;case "s":f=(f=String(f))&&l[7]?f.substring(0,l[7]):f;break;case "u":f=Math.abs(f);break;case "x":f=f.toString(16);break;case "X":f=f.toString(16).toUpperCase()}f=/[def]/.test(l[8])&&l[3]&&0<=f?"+"+f:f;k=l[4]?"0"==l[4]?"0":l[4].charAt(1):" ";m=l[6]-String(f).length;
if(l[6]){for(var q=[];0<m;q[--m]=k);k=q.join("")}else k="";g.push(l[5]?f+k:k+f)}return g.join("")};b.cache={};b.parse=function(a){for(var b=[],c=[],d=0;a;){if(null!==(b=/^[^\x25]+/.exec(a)))c.push(b[0]);else if(null!==(b=/^\x25{2}/.exec(a)))c.push("%");else if(null!==(b=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a))){if(b[2]){var d=d|1,e=[],f=b[2],g=[];if(null!==(g=/^([a-z_][a-z_\d]*)/i.exec(f)))for(e.push(g[1]);""!==(f=f.substring(g[0].length));)if(null!==
(g=/^\.([a-z_][a-z_\d]*)/i.exec(f)))e.push(g[1]);else if(null!==(g=/^\[(\d+)\]/.exec(f)))e.push(g[1]);else throw"[sprintf] huh?";else throw"[sprintf] huh?";b[2]=e}else d|=2;if(3===d)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";c.push(b)}else throw"[sprintf] huh?";a=a.substring(b[0].length)}return c};return b}();H("sprintf",function(a,b,c){return c.sprintf?"[object Array]"===Object.prototype.toString.apply(c.sprintf)?(b=c.sprintf,b.unshift(a),O.apply(null,b)):"object"===
typeof c.sprintf?O(a,c.sprintf):a:a});u.init=d;u.setLng=function(a,b,c){"function"===typeof b?(c=b,b={}):b||(b={});b.lng=a;return d(b,c)};u.preload=function(a,b){"string"===typeof a&&(a=[a]);for(var c=0,e=a.length;c<e;c++)0>v.preload.indexOf(a[c])&&v.preload.push(a[c]);return d(b)};u.addResourceBundle=function(a,b,c){"string"!==typeof b?(c=b,b=v.ns.defaultNs):0>v.ns.namespaces.indexOf(b)&&v.ns.namespaces.push(b);z[a]=z[a]||{};z[a][b]=z[a][b]||{};F.extend(z[a][b],c)};u.removeResourceBundle=function(a,
b){"string"!==typeof b&&(b=v.ns.defaultNs);z[a]=z[a]||{};z[a][b]={}};u.loadNamespace=function(a,b){e([a],b)};u.loadNamespaces=e;u.setDefaultNamespace=function(a){v.ns.defaultNs=a};u.t=m;u.translate=m;u.exists=k;u.detectLanguage=F.detectLanguage;u.pluralExtensions=E;u.sync=I;u.functions=F;u.lng=function(){return t};u.addPostProcessor=H;u.options=v})();(function(a,b){function c(b){return!a(b).parents().andSelf().filter(function(){return"hidden"===a.curCSS(this,"visibility")||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.11",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,
PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({_focus:a.fn.focus,focus:function(b,c){return"number"===typeof b?this.each(function(){var f=this;setTimeout(function(){a(f).focus();c&&c.call(f)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;b=a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,
"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){c=a(this[0]);for(var e;c.length&&c[0]!==document;){e=c.css("position");
if("absolute"===e||"relative"===e||"fixed"===e)if(e=parseInt(c.css("zIndex"),10),!isNaN(e)&&0!==e)return e;c=c.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,e){function f(b,c,d,e){a.each(g,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0;d&&(c-=parseFloat(a.curCSS(b,
"border"+this+"Width",!0))||0);e&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var g="Width"===e?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+e]=function(c){return c===b?k["inner"+e].call(this):this.each(function(){a(this).css(h,f(this,c)+"px")})};a.fn["outer"+e]=function(b,c){return"number"!==typeof b?k["outer"+e].call(this,b):this.each(function(){a(this).css(h,
f(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,f){return!!a.data(b,f[3])},focusable:function(b){var e=b.nodeName.toLowerCase(),f=a.attr(b,"tabindex");if("area"===e){e=b.parentNode;f=e.name;if(!b.href||!f||"map"!==e.nodeName.toLowerCase())return!1;b=a("img[usemap=#"+f+"]")[0];return!!b&&c(b)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||!isNaN(f):!isNaN(f))&&c(b)},tabbable:function(b){var c=a.attr(b,"tabindex");return(isNaN(c)||0<=c)&&a(b).is(":focusable")}}),
a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=100===c.offsetHeight;a.support.selectstart="onselectstart"in c;b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,f){b=a.ui[b].prototype;for(var g in f)b.plugins[g]=b.plugins[g]||[],b.plugins[g].push([c,f[g]])},call:function(a,b,c){if((b=a.plugins[b])&&a.element[0].parentNode)for(var g=0;g<b.length;g++)a.options[b[g][0]]&&
b[g][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if("hidden"===a(b).css("overflow"))return!1;c=c&&"left"===c?"scrollLeft":"scrollTop";var f=!1;if(0<b[c])return!0;b[c]=1;f=0<b[c];b[c]=0;return f},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,f,g,h,k){return a.ui.isOverAxis(b,f,h)&&a.ui.isOverAxis(c,g,k)}}))})(jQuery);
(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,g;null!=(g=b[d]);d++)a(g).triggerHandler("remove");c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){c||b&&!a.filter(b,[this]).length||a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return d.call(a(this),b,c)})}}a.widget=function(b,c,d){var h=b.split(".")[0],k;b=b.split(".")[1];k=h+"-"+b;d||(d=c,c=a.Widget);a.expr[":"][k]=function(c){return!!a.data(c,b)};
a[h]=a[h]||{};a[h][b]=function(a,b){arguments.length&&this._createWidget(a,b)};c=new c;c.options=a.extend(!0,{},c.options);a[h][b].prototype=a.extend(!0,c,{namespace:h,widgetName:b,widgetEventPrefix:a[h][b].prototype.widgetEventPrefix||b,widgetBaseClass:k},d);a.widget.bridge(b,a[h][b])};a.widget.bridge=function(c,d){a.fn[c]=function(g){var h="string"===typeof g,k=Array.prototype.slice.call(arguments,1),m=this;g=!h&&k.length?a.extend.apply(null,[!0,g].concat(k)):g;if(h&&"_"===g.charAt(0))return m;
h?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[g])?d[g].apply(d,k):d;if(f!==d&&f!==b)return m=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(g||{})._init():a.data(this,c,new d(g,this))});return m}};a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this);this.element=a(c);this.options=a.extend(!0,{},this.options,this._getCreateOptions(),
b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},
option:function(c,d){var g=c;if(0===arguments.length)return a.extend({},this.options);if("string"===typeof c){if(d===b)return this.options[c];g={};g[c]=d}this._setOptions(g);return this},_setOptions:function(b){var c=this;a.each(b,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b;"disabled"===a&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",b);return this},enable:function(){return this._setOption("disabled",
!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var h=this.options[b];c=a.Event(c);c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();d=d||{};if(c.originalEvent){b=a.event.props.length;for(var k;b;)k=a.event.props[--b],c[k]=c.originalEvent[k]}this.element.trigger(c,d);return!(a.isFunction(h)&&!1===h.call(this.element[0],c,d)||c.isDefaultPrevented())}}})(jQuery);
(function(a){a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(b){b.originalEvent=
b.originalEvent||{};if(!b.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(b);this._mouseDownEvent=b;var c=this,d=1==b.which,e="string"==typeof this.options.cancel?a(b.target).parents().add(b.target).filter(this.options.cancel).length:!1;if(!d||e||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay;this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=
!1!==this._mouseStart(b),!this._mouseStarted))return b.preventDefault(),!0;!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(a){return c._mouseMove(a)};this._mouseUpDelegate=function(a){return c._mouseUp(a)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);b.preventDefault();return b.originalEvent.mouseHandled=!0}},_mouseMove:function(b){if(a.browser.msie&&
!(9<=document.documentMode||b.button))return this._mouseUp(b);if(this._mouseStarted)return this._mouseDrag(b),b.preventDefault();this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&((this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,b))?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);this._mouseStarted&&(this._mouseStarted=
!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);
(function(a){a.ui=a.ui||{};var b=/left|center|right/,c=/top|center|bottom/,d=a.fn.position,e=a.fn.offset;a.fn.position=function(e){if(!e||!e.of)return d.apply(this,arguments);e=a.extend({},e);var g=a(e.of),h=g[0],k=(e.collision||"flip").split(" "),m=e.offset?e.offset.split(" "):[0,0],n,q,l;9===h.nodeType?(n=g.width(),q=g.height(),l={top:0,left:0}):h.setTimeout?(n=g.width(),q=g.height(),l={top:g.scrollTop(),left:g.scrollLeft()}):h.preventDefault?(e.at="left top",n=q=0,l={top:e.of.pageY,left:e.of.pageX}):
(n=g.outerWidth(),q=g.outerHeight(),l=g.offset());a.each(["my","at"],function(){var a=(e[this]||"").split(" ");1===a.length&&(a=b.test(a[0])?a.concat(["center"]):c.test(a[0])?["center"].concat(a):["center","center"]);a[0]=b.test(a[0])?a[0]:"center";a[1]=c.test(a[1])?a[1]:"center";e[this]=a});1===k.length&&(k[1]=k[0]);m[0]=parseInt(m[0],10)||0;1===m.length&&(m[1]=m[0]);m[1]=parseInt(m[1],10)||0;"right"===e.at[0]?l.left+=n:"center"===e.at[0]&&(l.left+=n/2);"bottom"===e.at[1]?l.top+=q:"center"===e.at[1]&&
(l.top+=q/2);l.left+=m[0];l.top+=m[1];return this.each(function(){var b=a(this),c=b.outerWidth(),d=b.outerHeight(),g=parseInt(a.curCSS(this,"marginLeft",!0))||0,h=parseInt(a.curCSS(this,"marginTop",!0))||0,A=c+g+(parseInt(a.curCSS(this,"marginRight",!0))||0),w=d+h+(parseInt(a.curCSS(this,"marginBottom",!0))||0),v=a.extend({},l),C;"right"===e.my[0]?v.left-=c:"center"===e.my[0]&&(v.left-=c/2);"bottom"===e.my[1]?v.top-=d:"center"===e.my[1]&&(v.top-=d/2);v.left=Math.round(v.left);v.top=Math.round(v.top);
C={left:v.left-g,top:v.top-h};a.each(["left","top"],function(b,g){a.ui.position[k[b]]&&a.ui.position[k[b]][g](v,{targetWidth:n,targetHeight:q,elemWidth:c,elemHeight:d,collisionPosition:C,collisionWidth:A,collisionHeight:w,offset:m,my:e.my,at:e.at})});a.fn.bgiframe&&b.bgiframe();b.offset(a.extend(v,{using:e.using}))})};a.ui.position={fit:{left:function(b,c){var d=a(window),d=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=0<d?b.left-d:Math.max(b.left-c.collisionPosition.left,
b.left)},top:function(b,c){var d=a(window),d=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=0<d?b.top-d:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if("center"!==c.at[0]){var d=a(window),d=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),e="left"===c.my[0]?-c.elemWidth:"right"===c.my[0]?c.elemWidth:0,m="left"===c.at[0]?c.targetWidth:-c.targetWidth,n=-2*c.offset[0];b.left+=0>c.collisionPosition.left?e+m+n:0<d?e+m+n:0}},top:function(b,
c){if("center"!==c.at[1]){var d=a(window),d=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),e="top"===c.my[1]?-c.elemHeight:"bottom"===c.my[1]?c.elemHeight:0,m="top"===c.at[1]?c.targetHeight:-c.targetHeight,n=-2*c.offset[1];b.top+=0>c.collisionPosition.top?e+m+n:0<d?e+m+n:0}}}};a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),m=parseInt(a.curCSS(b,"top",!0),10)||0,n=parseInt(a.curCSS(b,
"left",!0),10)||0,e={top:c.top-e.top+m,left:c.left-e.left+n};"using"in c?c.using.call(b,e):d.css(e)},a.fn.offset=function(b){var c=this[0];return c&&c.ownerDocument?b?this.each(function(){a.offset.setOffset(this,b)}):e.call(this):null})})(jQuery);
(function(a){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){"original"!=this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||
(this.element[0].style.position="relative");this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable"))return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?
!1:(this.handle=this._getHandle(b))?!0:!1},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();a.ui.ddmanager&&(a.ui.ddmanager.current=this);this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,
top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt);c.containment&&this._setContainment();if(!1===this._trigger("start",b))return this._clear(),!1;this._cacheHelperProportions();a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b);this.helper.addClass("ui-draggable-dragging");
this._mouseDrag(b,!0);return!0},_mouseDrag:function(b,c){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!c){c=this._uiHash();if(!1===this._trigger("drag",b,c))return this._mouseUp({}),!1;this.position=c.position}this.options.axis&&"y"==this.options.axis||(this.helper[0].style.left=this.position.left+"px");this.options.axis&&"x"==this.options.axis||(this.helper[0].style.top=this.position.top+"px");a.ui.ddmanager&&a.ui.ddmanager.drag(this,b);return!1},
_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b));this.dropped&&(c=this.dropped,this.dropped=!1);if(!(this.element[0]&&this.element[0].parentNode||"original"!=this.options.helper))return!1;if("invalid"==this.options.revert&&!c||"valid"==this.options.revert&&c||!0===this.options.revert||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var d=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,
10),function(){!1!==d._trigger("stop",b)&&d._clear()})}else!1!==this._trigger("stop",b)&&this._clear();return!1},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(b){var c=this.options.handle&&a(this.options.handle,this.element).length?!1:!0;a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)});return c},_createHelper:function(b){var c=this.options;b=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],
[b])):"clone"==c.helper?this.element.clone():this.element;b.parents("body").length||b.appendTo("parent"==c.appendTo?this.element[0].parentNode:c.appendTo);b[0]!=this.element[0]&&!/(fixed|absolute)/.test(b.css("position"))&&b.css("position","absolute");return b},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" "));a.isArray(b)&&(b={left:+b[0],top:+b[1]||0});"left"in b&&(this.offset.click.left=b.left+this.margins.left);"right"in b&&(this.offset.click.left=this.helperProportions.width-
b.right+this.margins.left);"top"in b&&(this.offset.click.top=b.top+this.margins.top);"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();"absolute"==this.cssPosition&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==
document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),
10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;"parent"==b.containment&&
(b.containment=this.helper[0].parentNode);if("document"==b.containment||"window"==b.containment)this.containment=[("document"==b.containment?0:a(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,("document"==b.containment?0:a(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,("document"==b.containment?0:a(window).scrollLeft())+a("document"==b.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"==b.containment?0:a(window).scrollTop())+
(a("document"==b.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(/^(document|window|parent)$/.test(b.containment)||b.containment.constructor==Array)b.containment.constructor==Array&&(this.containment=b.containment);else{var c=a(b.containment)[0];if(c){var b=a(b.containment).offset(),d="hidden"!=a(c).css("overflow");this.containment=[b.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),
10)||0),b.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0),b.left+(d?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,b.top+(d?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-
this.margins.top-this.margins.bottom]}}},_convertPositionTo:function(b,c){c||(c=this.position);b="absolute"==b?1:-1;var d="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,e=/(html|body)/i.test(d[0].tagName);return{top:c.top+this.offset.relative.top*b+this.offset.parent.top*b-(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():
e?0:d.scrollTop())*b),left:c.left+this.offset.relative.left*b+this.offset.parent.left*b-(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())*b)}},_generatePosition:function(b){var c=this.options,d="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;
this.originalPosition&&(this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top)),c.grid&&(g=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*
c.grid[1],g=this.containment?g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3]?g-this.offset.click.top<this.containment[1]?g+c.grid[1]:g-c.grid[1]:g:g,f=this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0],f=this.containment?f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2]?f-this.offset.click.left<this.containment[0]?f+c.grid[0]:f-c.grid[0]:f:f));return{top:g-this.offset.click.top-this.offset.relative.top-
this.offset.parent.top+(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&526>a.browser.version&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&
this.helper.remove();this.helper=null;this.cancelHelperRemoval=!1},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);"drag"==b&&(this.positionAbs=this._convertPositionTo("absolute"));return a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});a.extend(a.ui.draggable,{version:"1.8.11"});a.ui.plugin.add("draggable","connectToSortable",{start:function(b,
c){var d=a(this).data("draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[];a(e.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=
!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,"original"==d.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("draggable"),e=this;a.each(d.sortables,function(){this.instance.positionAbs=d.positionAbs;this.instance.helperProportions=d.helperProportions;this.instance.offset.click=
d.offset.click;this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=
d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",
b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}});a.ui.plugin.add("draggable","cursor",{start:function(){var b=a("body"),c=a(this).data("draggable").options;b.css("cursor")&&(c._cursor=b.css("cursor"));b.css("cursor",c.cursor)},stop:function(){var b=a(this).data("draggable").options;
b._cursor&&a("body").css("cursor",b._cursor)}});a.ui.plugin.add("draggable","iframeFix",{start:function(){var b=a(this).data("draggable").options;a(!0===b.iframeFix?"iframe":b.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(a(this).offset()).appendTo("body")})},stop:function(){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});
a.ui.plugin.add("draggable","opacity",{start:function(b,c){b=a(c.helper);c=a(this).data("draggable").options;b.css("opacity")&&(c._opacity=b.css("opacity"));b.css("opacity",c.opacity)},stop:function(b,c){b=a(this).data("draggable").options;b._opacity&&a(c.helper).css("opacity",b._opacity)}});a.ui.plugin.add("draggable","scroll",{start:function(){var b=a(this).data("draggable");b.scrollParent[0]!=document&&"HTML"!=b.scrollParent[0].tagName&&(b.overflowOffset=b.scrollParent.offset())},drag:function(b){var c=
a(this).data("draggable"),d=c.options,e=!1;c.scrollParent[0]!=document&&"HTML"!=c.scrollParent[0].tagName?(d.axis&&"x"==d.axis||(c.overflowOffset.top+c.scrollParent[0].offsetHeight-b.pageY<d.scrollSensitivity?c.scrollParent[0].scrollTop=e=c.scrollParent[0].scrollTop+d.scrollSpeed:b.pageY-c.overflowOffset.top<d.scrollSensitivity&&(c.scrollParent[0].scrollTop=e=c.scrollParent[0].scrollTop-d.scrollSpeed)),d.axis&&"y"==d.axis||(c.overflowOffset.left+c.scrollParent[0].offsetWidth-b.pageX<d.scrollSensitivity?
c.scrollParent[0].scrollLeft=e=c.scrollParent[0].scrollLeft+d.scrollSpeed:b.pageX-c.overflowOffset.left<d.scrollSensitivity&&(c.scrollParent[0].scrollLeft=e=c.scrollParent[0].scrollLeft-d.scrollSpeed))):(d.axis&&"x"==d.axis||(b.pageY-a(document).scrollTop()<d.scrollSensitivity?e=a(document).scrollTop(a(document).scrollTop()-d.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<d.scrollSensitivity&&(e=a(document).scrollTop(a(document).scrollTop()+d.scrollSpeed))),d.axis&&"y"==d.axis||
(b.pageX-a(document).scrollLeft()<d.scrollSensitivity?e=a(document).scrollLeft(a(document).scrollLeft()-d.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<d.scrollSensitivity&&(e=a(document).scrollLeft(a(document).scrollLeft()+d.scrollSpeed))));!1!==e&&a.ui.ddmanager&&!d.dropBehaviour&&a.ui.ddmanager.prepareOffsets(c,b)}});a.ui.plugin.add("draggable","snap",{start:function(){var b=a(this).data("draggable"),c=b.options;b.snapElements=[];a(c.snap.constructor!=String?c.snap.items||":data(draggable)":
c.snap).each(function(){var c=a(this),e=c.offset();this!=b.element[0]&&b.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:e.top,left:e.left})})},drag:function(b,c){for(var d=a(this).data("draggable"),e=d.options,f=e.snapTolerance,g=c.offset.left,h=g+d.helperProportions.width,k=c.offset.top,m=k+d.helperProportions.height,n=d.snapElements.length-1;0<=n;n--){var q=d.snapElements[n].left,l=q+d.snapElements[n].width,s=d.snapElements[n].top,u=s+d.snapElements[n].height;if(q-
f<g&&g<l+f&&s-f<k&&k<u+f||q-f<g&&g<l+f&&s-f<m&&m<u+f||q-f<h&&h<l+f&&s-f<k&&k<u+f||q-f<h&&h<l+f&&s-f<m&&m<u+f){if("inner"!=e.snapMode){var z=Math.abs(s-m)<=f,t=Math.abs(u-k)<=f,B=Math.abs(q-h)<=f,A=Math.abs(l-g)<=f;z&&(c.position.top=d._convertPositionTo("relative",{top:s-d.helperProportions.height,left:0}).top-d.margins.top);t&&(c.position.top=d._convertPositionTo("relative",{top:u,left:0}).top-d.margins.top);B&&(c.position.left=d._convertPositionTo("relative",{top:0,left:q-d.helperProportions.width}).left-
d.margins.left);A&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left)}var w=z||t||B||A;"outer"!=e.snapMode&&(z=Math.abs(s-k)<=f,t=Math.abs(u-m)<=f,B=Math.abs(q-g)<=f,A=Math.abs(l-h)<=f,z&&(c.position.top=d._convertPositionTo("relative",{top:s,left:0}).top-d.margins.top),t&&(c.position.top=d._convertPositionTo("relative",{top:u-d.helperProportions.height,left:0}).top-d.margins.top),B&&(c.position.left=d._convertPositionTo("relative",{top:0,left:q}).left-d.margins.left),
A&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left));!d.snapElements[n].snapping&&(z||t||B||A||w)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[n].item}));d.snapElements[n].snapping=z||t||B||A||w}else d.snapElements[n].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[n].item})),d.snapElements[n].snapping=!1}}});
a.ui.plugin.add("draggable","stack",{start:function(){var b=a(this).data("draggable").options,b=a.makeArray(a(b.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(b.length){var c=parseInt(b[0].style.zIndex)||0;a(b).each(function(a){this.style.zIndex=c+a});this[0].style.zIndex=c+b.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(b,c){b=a(c.helper);c=a(this).data("draggable").options;b.css("zIndex")&&(c._zIndex=b.css("zIndex"));
b.css("zIndex",c.zIndex)},stop:function(b,c){b=a(this).data("draggable").options;b._zIndex&&a(c.helper).css("zIndex",b._zIndex)}})})(jQuery);
(function(a){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable");a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],
_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null});this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(/relative/.test(this.element.css("position"))&&a.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"}),this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),
this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize",
"none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize());this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){"all"==
this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw");var f=this.handles.split(",");this.handles={};for(var g=0;g<f.length;g++){var h=a.trim(f[g]),k=a('<div class="ui-resizable-handle ui-resizable-'+h+'"></div>');/sw|se|ne|nw/.test(h)&&k.css({zIndex:++c.zIndex});"se"==h&&k.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[h]=".ui-resizable-"+h;this.element.append(k)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=
a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0,e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth(),d=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(d,e);this._proportionallyResize()}a(this.handles[c])}};this._renderAxis(this.element);this._handles=a(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}});c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){a(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())}));this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var c=!1,f;for(f in this.handles)a(this.handles[f])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(c){var e=this.options,f=this.element.position(),
g=this.element;this.resizing=!0;this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()};(g.is(".ui-draggable")||/absolute/.test(g.css("position")))&&g.css({position:"absolute",top:f.top,left:f.left});a.browser.opera&&/relative/.test(g.css("position"))&&g.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();var f=b(this.helper.css("left")),h=b(this.helper.css("top"));e.containment&&(f+=a(e.containment).scrollLeft()||0,h+=a(e.containment).scrollTop()||0);this.offset=
this.helper.offset();this.position={left:f,top:h};this.size=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()};this.originalSize=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()};this.originalPosition={left:f,top:h};this.sizeDiff={width:g.outerWidth()-g.width(),height:g.outerHeight()-g.height()};this.originalMousePosition={left:c.pageX,top:c.pageY};this.aspectRatio="number"==typeof e.aspectRatio?e.aspectRatio:
this.originalSize.width/this.originalSize.height||1;e=a(".ui-resizable-"+this.axis).css("cursor");a("body").css("cursor","auto"==e?this.axis+"-resize":e);g.addClass("ui-resizable-resizing");this._propagate("start",c);return!0},_mouseDrag:function(a){var b=this.helper,c=this.originalMousePosition,g=this._change[this.axis];if(!g)return!1;c=g.apply(this,[a,a.pageX-c.left||0,a.pageY-c.top||0]);if(this._aspectRatio||a.shiftKey)c=this._updateRatio(c,a);c=this._respectSize(c,a);this._propagate("resize",
a);b.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",a,this.ui());return!1},_mouseStop:function(b){this.resizing=!1;var c=this.options;if(this._helper){var f=this._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),f=g&&a.ui.hasScroll(f[0],"left")?0:this.sizeDiff.height,g=g?0:
this.sizeDiff.width,g={width:this.helper.width()-g,height:this.helper.height()-f},f=parseInt(this.element.css("left"),10)+(this.position.left-this.originalPosition.left)||null,h=parseInt(this.element.css("top"),10)+(this.position.top-this.originalPosition.top)||null;c.animate||this.element.css(a.extend(g,{top:h,left:f}));this.helper.height(this.size.height);this.helper.width(this.size.width);this._helper&&!c.animate&&this._proportionallyResize()}a("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");
this._propagate("stop",b);this._helper&&this.helper.remove();return!1},_updateCache:function(a){this.offset=this.helper.offset();c(a.left)&&(this.position.left=a.left);c(a.top)&&(this.position.top=a.top);c(a.height)&&(this.size.height=a.height);c(a.width)&&(this.size.width=a.width)},_updateRatio:function(a){var b=this.position,c=this.size,g=this.axis;a.height?a.width=c.height*this.aspectRatio:a.width&&(a.height=c.width/this.aspectRatio);"sw"==g&&(a.left=b.left+(c.width-a.width),a.top=null);"nw"==
g&&(a.top=b.top+(c.height-a.height),a.left=b.left+(c.width-a.width));return a},_respectSize:function(a){var b=this.options,f=this.axis,g=c(a.width)&&b.maxWidth&&b.maxWidth<a.width,h=c(a.height)&&b.maxHeight&&b.maxHeight<a.height,k=c(a.width)&&b.minWidth&&b.minWidth>a.width,m=c(a.height)&&b.minHeight&&b.minHeight>a.height;k&&(a.width=b.minWidth);m&&(a.height=b.minHeight);g&&(a.width=b.maxWidth);h&&(a.height=b.maxHeight);var n=this.originalPosition.left+this.originalSize.width,q=this.position.top+this.size.height,
l=/sw|nw|w/.test(f),f=/nw|ne|n/.test(f);k&&l&&(a.left=n-b.minWidth);g&&l&&(a.left=n-b.maxWidth);m&&f&&(a.top=q-b.minHeight);h&&f&&(a.top=q-b.maxHeight);(b=!a.width&&!a.height)&&!a.left&&a.top?a.top=null:b&&!a.top&&a.left&&(a.left=null);return a},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,c=0;c<this._proportionallyResizeElements.length;c++){var f=this._proportionallyResizeElements[c];if(!this.borderDif){var g=[f.css("borderTopWidth"),
f.css("borderRightWidth"),f.css("borderBottomWidth"),f.css("borderLeftWidth")],h=[f.css("paddingTop"),f.css("paddingRight"),f.css("paddingBottom"),f.css("paddingLeft")];this.borderDif=a.map(g,function(a,b){a=parseInt(a,10)||0;b=parseInt(h[b],10)||0;return a+b})}a.browser.msie&&(a(b).is(":hidden")||a(b).parents(":hidden").length)||f.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=
this.element.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var c=a.browser.msie&&7>a.browser.version,f=c?1:0,c=c?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+c,height:this.element.outerHeight()+c,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b){return{width:this.originalSize.width+
b}},w:function(a,b){return{left:this.originalPosition.left+b,width:this.originalSize.width-b}},n:function(a,b,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,f){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,f]))},sw:function(b,c,f){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,f]))},ne:function(b,c,f){return a.extend(this._change.n.apply(this,
arguments),this._change.e.apply(this,[b,c,f]))},nw:function(b,c,f){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,f]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]);"resize"!=b&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});a.extend(a.ui.resizable,
{version:"1.8.11"});a.ui.plugin.add("resizable","alsoResize",{start:function(){var b=a(this).data("resizable").options,c=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10),position:b.css("position")})})};"object"!=typeof b.alsoResize||b.alsoResize.parentNode?c(b.alsoResize):b.alsoResize.length?(b.alsoResize=b.alsoResize[0],c(b.alsoResize)):a.each(b.alsoResize,
function(a){c(a)})},resize:function(b,c){var f=a(this).data("resizable");b=f.options;var g=f.originalSize,h=f.originalPosition,k={height:f.size.height-g.height||0,width:f.size.width-g.width||0,top:f.position.top-h.top||0,left:f.position.left-h.left||0},m=function(b,d){a(b).each(function(){var b=a(this),g=a(this).data("resizable-alsoresize"),h={},m=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(m,function(a,b){(a=(g[b]||0)+(k[b]||0))&&
0<=a&&(h[b]=a||null)});a.browser.opera&&/relative/.test(b.css("position"))&&(f._revertToRelativePosition=!0,b.css({position:"absolute",top:"auto",left:"auto"}));b.css(h)})};"object"!=typeof b.alsoResize||b.alsoResize.nodeType?m(b.alsoResize):a.each(b.alsoResize,function(a,b){m(a,b)})},stop:function(){var b=a(this).data("resizable"),c=b.options,f=function(b){a(b).each(function(){var b=a(this);b.css({position:b.data("resizable-alsoresize").position})})};b._revertToRelativePosition&&(b._revertToRelativePosition=
!1,"object"!=typeof c.alsoResize||c.alsoResize.nodeType?f(c.alsoResize):a.each(c.alsoResize,function(a){f(a)}));a(this).removeData("resizable-alsoresize")}});a.ui.plugin.add("resizable","animate",{stop:function(b){var c=a(this).data("resizable"),f=c.options,g=c._proportionallyResizeElements,h=g.length&&/textarea/i.test(g[0].nodeName),k=h&&a.ui.hasScroll(g[0],"left")?0:c.sizeDiff.height,h={width:c.size.width-(h?0:c.sizeDiff.width),height:c.size.height-k},k=parseInt(c.element.css("left"),10)+(c.position.left-
c.originalPosition.left)||null,m=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;c.element.animate(a.extend(h,m&&k?{top:m,left:k}:{}),{duration:f.animateDuration,easing:f.animateEasing,step:function(){var f={width:parseInt(c.element.css("width"),10),height:parseInt(c.element.css("height"),10),top:parseInt(c.element.css("top"),10),left:parseInt(c.element.css("left"),10)};g&&g.length&&a(g[0]).css({width:f.width,height:f.height});c._updateCache(f);c._propagate("resize",
b)}})}});a.ui.plugin.add("resizable","containment",{start:function(){var c=a(this).data("resizable"),e=c.element,f=c.options.containment;if(e=f instanceof a?f.get(0):/parent/.test(f)?e.parent().get(0):f)if(c.containerElement=a(e),/document/.test(f)||f==document)c.containerOffset={left:0,top:0},c.containerPosition={left:0,top:0},c.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var g=a(e),h=[];a(["Top",
"Right","Left","Bottom"]).each(function(a,c){h[a]=b(g.css("padding"+c))});c.containerOffset=g.offset();c.containerPosition=g.position();c.containerSize={height:g.innerHeight()-h[3],width:g.innerWidth()-h[1]};var f=c.containerOffset,k=c.containerSize.height,m=c.containerSize.width,m=a.ui.hasScroll(e,"left")?e.scrollWidth:m,k=a.ui.hasScroll(e)?e.scrollHeight:k;c.parentData={element:e,left:f.left,top:f.top,width:m,height:k}}},resize:function(b){var c=a(this).data("resizable"),f=c.options,g=c.containerOffset,
h=c.position;b=c._aspectRatio||b.shiftKey;var k={top:0,left:0},m=c.containerElement;m[0]!=document&&/static/.test(m.css("position"))&&(k=g);h.left<(c._helper?g.left:0)&&(c.size.width+=c._helper?c.position.left-g.left:c.position.left-k.left,b&&(c.size.height=c.size.width/f.aspectRatio),c.position.left=f.helper?g.left:0);h.top<(c._helper?g.top:0)&&(c.size.height+=c._helper?c.position.top-g.top:c.position.top,b&&(c.size.width=c.size.height*f.aspectRatio),c.position.top=c._helper?g.top:0);c.offset.left=
c.parentData.left+c.position.left;c.offset.top=c.parentData.top+c.position.top;f=Math.abs(c.offset.left-k.left+c.sizeDiff.width);g=Math.abs((c._helper?c.offset.top-k.top:c.offset.top-g.top)+c.sizeDiff.height);h=c.containerElement.get(0)==c.element.parent().get(0);k=/relative|absolute/.test(c.containerElement.css("position"));h&&k&&(f-=c.parentData.left);f+c.size.width>=c.parentData.width&&(c.size.width=c.parentData.width-f,b&&(c.size.height=c.size.width/c.aspectRatio));g+c.size.height>=c.parentData.height&&
(c.size.height=c.parentData.height-g,b&&(c.size.width=c.size.height*c.aspectRatio))},stop:function(){var b=a(this).data("resizable"),c=b.options,f=b.containerOffset,g=b.containerPosition,h=b.containerElement,k=a(b.helper),m=k.offset(),n=k.outerWidth()-b.sizeDiff.width,k=k.outerHeight()-b.sizeDiff.height;b._helper&&!c.animate&&/relative/.test(h.css("position"))&&a(this).css({left:m.left-g.left-f.left,width:n,height:k});b._helper&&!c.animate&&/static/.test(h.css("position"))&&a(this).css({left:m.left-
g.left-f.left,width:n,height:k})}});a.ui.plugin.add("resizable","ghost",{start:function(){var b=a(this).data("resizable"),c=b.options,f=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof c.ghost?c.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=a(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,
width:b.size.width})},stop:function(){var b=a(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});a.ui.plugin.add("resizable","grid",{resize:function(){var b=a(this).data("resizable"),c=b.options,f=b.size,g=b.originalSize,h=b.originalPosition,k=b.axis;c.grid="number"==typeof c.grid?[c.grid,c.grid]:c.grid;var m=Math.round((f.width-g.width)/(c.grid[0]||1))*(c.grid[0]||1),c=Math.round((f.height-g.height)/(c.grid[1]||1))*(c.grid[1]||1);/^(se|s|e)$/.test(k)?(b.size.width=
g.width+m,b.size.height=g.height+c):/^(ne)$/.test(k)?(b.size.width=g.width+m,b.size.height=g.height+c,b.position.top=h.top-c):(/^(sw)$/.test(k)?(b.size.width=g.width+m,b.size.height=g.height+c):(b.size.width=g.width+m,b.size.height=g.height+c,b.position.top=h.top-c),b.position.left=h.left-m)}});var b=function(a){return parseInt(a,10)||0},c=function(a){return!isNaN(parseInt(a,10))}})(jQuery);
(function(a){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=
this.items.length?/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;0<=a;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(b,c){"disabled"===b?(this.options[b]=c,this.widget()[c?
"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){if(this.reverting||this.options.disabled||"static"==this.options.type)return!1;this._refreshItems(b);var d=null,e=this;a(b.target).parents().each(function(){if(a.data(this,"sortable-item")==e)return d=a(this),!1});a.data(b.target,"sortable-item")==e&&(d=a(b.target));if(!d)return!1;if(this.options.handle&&!c){var f=!1;a(this.options.handle,d).find("*").andSelf().each(function(){this==
b.target&&(f=!0)});if(!f)return!1}this.currentItem=d;this._removeCurrentsFromItems();return!0},_mouseStart:function(b,c,d){c=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(b);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=
this.helper.css("position");a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();
c.containment&&this._setContainment();c.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",c.cursor));c.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",c.opacity));c.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",c.zIndex));this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());
this._trigger("start",b,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(d=this.containers.length-1;0<=d;d--)this.containers[d]._trigger("activate",b,this._uiHash(this));a.ui.ddmanager&&(a.ui.ddmanager.current=this);a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(b);return!0},_mouseDrag:function(b){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");
this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+
this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(d=a(document).scrollTop(a(document).scrollTop()+
c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(d=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed)));!1!==d&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");this.options.axis&&"y"==this.options.axis||(this.helper[0].style.left=this.position.left+"px");
this.options.axis&&"x"==this.options.axis||(this.helper[0].style.top=this.position.top+"px");for(c=this.items.length-1;0<=c;c--){var d=this.items[c],e=d.item[0],f=this._intersectsWithPointer(d);if(f&&e!=this.currentItem[0]&&this.placeholder[1==f?"next":"prev"]()[0]!=e&&!a.ui.contains(this.placeholder[0],e)&&("semi-dynamic"==this.options.type?!a.ui.contains(this.element[0],e):1)){this.direction=1==f?"down":"up";if("pointer"==this.options.tolerance||this._intersectsWithSides(d))this._rearrange(b,d);
else break;this._trigger("change",b,this._uiHash());break}}this._contactContainers(b);a.ui.ddmanager&&a.ui.ddmanager.drag(this,b);this._trigger("sort",b,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(b,c){if(b){a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this;c=d.placeholder.offset();d.reverting=!0;a(this.helper).animate({left:c.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?
0:this.offsetParent[0].scrollLeft),top:c.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});"original"==this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;0<=b;b--)this.containers[b]._trigger("deactivate",
null,this._uiHash(this)),this.containers[b].containerCache.over&&(this.containers[b]._trigger("out",null,this._uiHash(this)),this.containers[b].containerCache.over=0)}this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!=this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):
a(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{};a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))});!d.length&&b.key&&d.push(b.key+"=");return d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{};c.each(function(){d.push(a(b.item||this).attr(b.attribute||
"id")||"")});return d},_intersectsWith:function(a){var c=this.positionAbs.left,d=c+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,k=a.top,m=k+a.height,n=this.offset.click.top,q=this.offset.click.left;return"pointer"==this.options.tolerance||this.options.forcePointerForContainers||"pointer"!=this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?e+n>k&&e+n<m&&c+q>g&&c+q<h:g<c+this.helperProportions.width/
2&&d-this.helperProportions.width/2<h&&k<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<m},_intersectsWithPointer:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height);b=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width);c=c&&b;b=this._getDragVerticalDirection();var d=this._getDragHorizontalDirection();return c?this.floating?d&&"right"==d||"down"==b?2:1:b&&("down"==b?2:1):!1},_intersectsWithSides:function(b){var c=
a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height);b=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width);var d=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?"right"==e&&b||"left"==e&&!b:d&&("down"==d&&c||"up"==d&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return 0!=a&&(0<a?"down":"up")},_getDragHorizontalDirection:function(){var a=
this.positionAbs.left-this.lastPositionAbs.left;return 0!=a&&(0<a?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=[],d=[],e=this._connectWith();if(e&&b)for(b=e.length-1;0<=b;b--)for(var f=a(e[b]),g=f.length-1;0<=g;g--){var h=a.data(f[g],"sortable");h&&h!=this&&!h.options.disabled&&d.push([a.isFunction(h.options.items)?
h.options.items.call(h.element):a(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}d.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(b=d.length-1;0<=b;b--)d[b][0].each(function(){c.push(this)});return a(c)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),
c=0;c<this.items.length;c++)for(var d=0;d<a.length;d++)a[d]==this.items[c].item[0]&&this.items.splice(c,1)},_refreshItems:function(b){this.items=[];this.containers=[this];var c=this.items,d=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],e=this._connectWith();if(e)for(var f=e.length-1;0<=f;f--)for(var g=a(e[f]),h=g.length-1;0<=h;h--){var k=a.data(g[h],"sortable");k&&k!=this&&!k.options.disabled&&(d.push([a.isFunction(k.options.items)?
k.options.items.call(k.element[0],b,{item:this.currentItem}):a(k.options.items,k.element),k]),this.containers.push(k))}for(f=d.length-1;0<=f;f--)for(b=d[f][1],e=d[f][0],h=0,g=e.length;h<g;h++)k=a(e[h]),k.data("sortable-item",b),c.push({item:k,instance:b,width:0,height:0,left:0,top:0})},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;0<=c;c--){var d=this.items[c],e=this.options.toleranceElement?a(this.options.toleranceElement,
d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());e=e.offset();d.left=e.left;d.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(c=this.containers.length-1;0<=c;c--)e=this.containers[c].element.offset(),this.containers[c].containerCache.left=e.left,this.containers[c].containerCache.top=e.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=
this.containers[c].element.outerHeight();return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];e||(b.style.visibility="hidden");return b},update:function(a,b){if(!e||d.forcePlaceholderSize)b.height()||b.height(c.currentItem.innerHeight()-
parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem));c.currentItem.after(c.placeholder);d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){for(var c=null,d=null,e=this.containers.length-1;0<=e;e--)a.ui.contains(this.currentItem[0],
this.containers[e].element[0])||(this._intersectsWith(this.containers[e].containerCache)?c&&a.ui.contains(this.containers[e].element[0],c.element[0])||(c=this.containers[e],d=e):this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){for(var c=
1E4,e=null,f=this.positionAbs[this.containers[d].floating?"left":"top"],g=this.items.length-1;0<=g;g--)if(a.ui.contains(this.containers[d].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[d].floating?"left":"top"];Math.abs(h-f)<c&&(c=Math.abs(h-f),e=this.items[g])}if(e||this.options.dropOnEmpty)this.currentContainer=this.containers[d],e?this._rearrange(b,e,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",
b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options;b=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):"clone"==c.helper?this.currentItem.clone():this.currentItem;b.parents("body").length||a("parent"!=c.appendTo?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0]);b[0]==this.currentItem[0]&&
(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")});(""==b[0].style.width||c.forceHelperSize)&&b.width(this.currentItem.width());(""==b[0].style.height||c.forceHelperSize)&&b.height(this.currentItem.height());return b},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" "));a.isArray(b)&&(b={left:+b[0],top:+b[1]||0});"left"in b&&
(this.offset.click.left=b.left+this.margins.left);"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left);"top"in b&&(this.offset.click.top=b.top+this.margins.top);"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();"absolute"==this.cssPosition&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&
(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),
10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;"parent"==b.containment&&(b.containment=
this.helper[0].parentNode);if("document"==b.containment||"window"==b.containment)this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a("document"==b.containment?document:window).width()-this.helperProportions.width-this.margins.left,(a("document"==b.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=
a(b.containment)[0],b=a(b.containment).offset(),d="hidden"!=a(c).css("overflow");this.containment=[b.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,b.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,b.left+(d?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-
this.margins.left,b.top+(d?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);b="absolute"==b?1:-1;var d="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,e=/(html|body)/i.test(d[0].tagName);return{top:c.top+
this.offset.relative.top*b+this.offset.parent.top*b-(a.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():e?0:d.scrollTop())*b),left:c.left+this.offset.relative.left*b+this.offset.parent.left*b-(a.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())*b)}},_generatePosition:function(b){var c=this.options,d="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],
this.offsetParent[0])?this.scrollParent:this.offsetParent,e=/(html|body)/i.test(d[0].tagName);"relative"!=this.cssPosition||this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;this.originalPosition&&(this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),
b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top)),c.grid&&(g=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1],g=this.containment?g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3]?g-this.offset.click.top<this.containment[1]?g+c.grid[1]:g-c.grid[1]:g:g,f=this.originalPageX+Math.round((f-this.originalPageX)/
c.grid[0])*c.grid[0],f=this.containment?f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2]?f-this.offset.click.left<this.containment[0]?f+c.grid[0]:f-c.grid[0]:f:f));return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&
"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(a,c,d,e){d?d[0].appendChild(this.placeholder[0]):c.item[0].parentNode.insertBefore(this.placeholder[0],"down"==this.direction?c.item[0]:c.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(b,c){this.reverting=!1;var d=[];!this._noFinalSort&&this.currentItem[0].parentNode&&
this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if("auto"==this._storedCSS[e]||"static"==this._storedCSS[e])this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!c&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))});!this.fromOutside&&this.domPosition.prev==this.currentItem.prev().not(".ui-sortable-helper")[0]&&
this.domPosition.parent==this.currentItem.parent()[0]||c||d.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0]))for(c||d.push(function(a){this._trigger("remove",a,this._uiHash())}),e=this.containers.length-1;0<=e;e--)a.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[e])),d.push(function(a){return function(b){a._trigger("update",
b,this._uiHash(this))}}.call(this,this.containers[e])));for(e=this.containers.length-1;0<=e;e--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[e])),this.containers[e].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[e])),this.containers[e].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",
this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"==this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(e=0;e<d.length;e++)d[e].call(this,b);this._trigger("stop",b,this._uiHash())}return!1}c||this._trigger("beforeStop",b,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!c){for(e=
0;e<d.length;e++)d[e].call(this,b);this._trigger("stop",b,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){!1===a.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}});a.extend(a.ui.sortable,{version:"1.8.11"})})(jQuery);
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,c=this.options;this._mouseSliding=this._keySliding=!1;this._animateOff=!0;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");c.disabled&&this.element.addClass("ui-slider-disabled ui-disabled");
this.range=a([]);c.range&&(!0===c.range?(this.range=a("<div></div>"),c.values||(c.values=[this._valueMin(),this._valueMin()]),c.values.length&&2!==c.values.length&&(c.values=[c.values[0],c.values[0]])):this.range=a("<div></div>"),this.range.appendTo(this.element).addClass("ui-slider-range"),"min"!==c.range&&"max"!==c.range||this.range.addClass("ui-slider-range-"+c.range),this.range.addClass("ui-widget-header"));0===a(".ui-slider-handle",this.element).length&&a("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");
if(c.values&&c.values.length)for(;a(".ui-slider-handle",this.element).length<c.values.length;)a("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){c.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){c.disabled?
a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)});this.handles.keydown(function(c){var e=!0,f=a(this).data("index.ui-slider-handle"),g,h,k;if(!b.options.disabled){switch(c.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(e=
!1,!b._keySliding&&(b._keySliding=!0,a(this).addClass("ui-state-active"),g=b._start(c,f),!1===g))return}k=b.options.step;g=b.options.values&&b.options.values.length?h=b.values(f):h=b.value();switch(c.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/5);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/5);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===
b._valueMax())return;h=b._trimAlignValue(g+k);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-k)}b._slide(c,f,h);return e}}).keyup(function(c){var e=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,e),b._change(c,e),a(this).removeClass("ui-state-active"))});this._refreshValue();this._animateOff=!1},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy();return this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h;if(c.disabled)return!1;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();d=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;g=this;this.handles.each(function(b){var c=Math.abs(d-g.values(b));e>c&&(e=c,f=a(this),h=b)});!0===c.range&&this.values(1)===c.min&&(h+=1,f=a(this.handles[h]));if(!1===this._start(b,
h))return!1;this._mouseSliding=!0;g._handleIndex=h;f.addClass("ui-state-active").focus();c=f.offset();this._clickOffset=a(b.target).parents().andSelf().is(".ui-slider-handle")?{left:b.pageX-c.left-f.width()/2,top:b.pageY-c.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)}:{left:0,top:0};this.handles.hasClass("ui-state-hover")||this._slide(b,h,d);return this._animateOff=!0},_mouseStart:function(){return!0},
_mouseDrag:function(a){var c=this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,c);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=!1;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(a){var c;"horizontal"===
this.orientation?(c=this.elementSize.width,a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(c=this.elementSize.height,a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0));c=a/c;1<c&&(c=1);0>c&&(c=0);"vertical"===this.orientation&&(c=1-c);a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+c*a)},_start:function(a,c){var d={handle:this.handles[c],value:this.value()};this.options.values&&this.options.values.length&&(d.value=
this.values(c),d.values=this.values());return this._trigger("start",a,d)},_slide:function(a,c,d){var e;this.options.values&&this.options.values.length?(e=this.values(c?0:1),2===this.options.values.length&&!0===this.options.range&&(0===c&&d>e||1===c&&d<e)&&(d=e),d!==this.values(c)&&(e=this.values(),e[c]=d,a=this._trigger("slide",a,{handle:this.handles[c],value:d,values:e}),this.values(c?0:1),!1!==a&&this.values(c,d,!0))):d!==this.value()&&(a=this._trigger("slide",a,{handle:this.handles[c],value:d}),
!1!==a&&this.value(d))},_stop:function(a,c){var d={handle:this.handles[c],value:this.value()};this.options.values&&this.options.values.length&&(d.value=this.values(c),d.values=this.values());this._trigger("stop",a,d)},_change:function(a,c){if(!this._keySliding&&!this._mouseSliding){var d={handle:this.handles[c],value:this.value()};this.options.values&&this.options.values.length&&(d.value=this.values(c),d.values=this.values());this._trigger("change",a,d)}},value:function(a){arguments.length&&(this.options.value=
this._trimAlignValue(a),this._refreshValue(),this._change(null,0));return this._value()},values:function(b,c){var d,e,f;1<arguments.length&&(this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b));if(arguments.length)if(a.isArray(arguments[0])){d=this.options.values;e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(b):this.value();
else return this._values()},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length);a.Widget.prototype._setOption.apply(this,arguments);switch(b){case "disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.attr("disabled","disabled"),this.element.addClass("ui-disabled")):(this.handles.removeAttr("disabled"),this.element.removeClass("ui-disabled"));break;case "orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=!0;this._refreshValue();this._change(null,0);this._animateOff=!1;break;case "values":this._animateOff=!0;this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){return this._trimAlignValue(this.options.value)},_values:function(a){var c,d;if(arguments.length)return c=this.options.values[a],this._trimAlignValue(c);
c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var c=0<this.options.step?this.options.step:1,d=(a-this._valueMin())%c;alignValue=a-d;2*Math.abs(d)>=c&&(alignValue+=0<d?c:-c);return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=
this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,k,m,n;if(this.options.values&&this.options.values.length)this.handles.each(function(b){f=100*((d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin()));g["horizontal"===d.orientation?"left":"bottom"]=f+"%";a(this).stop(1,1)[e?"animate":"css"](g,c.animate);if(!0===d.options.range)if("horizontal"===d.orientation){if(0===b)d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate);if(1===b)d.range[e?"animate":"css"]({width:f-
h+"%"},{queue:!1,duration:c.animate})}else{if(0===b)d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate);if(1===b)d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate})}h=f});else{k=this.value();m=this._valueMin();n=this._valueMax();f=n!==m?100*((k-m)/(n-m)):0;g["horizontal"===d.orientation?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](g,c.animate);if("min"===b&&"horizontal"===this.orientation)this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate);
if("max"===b&&"horizontal"===this.orientation)this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate});if("min"===b&&"vertical"===this.orientation)this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate);if("max"===b&&"vertical"===this.orientation)this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate})}}});a.extend(a.ui.slider,{version:"1.8.11"})})(jQuery);
(function(a,b){function c(){this.debug=!1;this._curInst=null;this._keyEvent=!1;this._disabledInputs=[];this._inDialog=this._datepickerShowing=!1;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:"January February March April May June July August September October November December".split(" "),monthNamesShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dayNames:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),dayNamesShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dayNamesMin:"Su Mo Tu We Th Fr Sa".split(" "),
weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,
beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1};a.extend(this._defaults,this.regional[""]);this.dpDiv=a('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}function d(c,d){a.extend(c,d);for(var e in d)if(null==d[e]||d[e]==b)c[e]=d[e];return c}a.extend(a.ui,{datepicker:{version:"1.8.11"}});
var e=(new Date).getTime();a.extend(c.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){d(this._defaults,a||{});return this},_attachDatepicker:function(b,c){var d=null,e;for(e in this._defaults){var m=b.getAttribute("date:"+e);if(m){d=d||{};try{d[e]=eval(m)}catch(n){d[e]=m}}}e=b.nodeName.toLowerCase();m="div"==e||"span"==e;b.id||(this.uuid+=1,b.id="dp"+this.uuid);var q=this._newInst(a(b),
m);q.settings=a.extend({},c||{},d||{});"input"==e?this._connectDatepicker(b,q):m&&this._inlineDatepicker(b,q)},_newInst:function(b,c){return{id:b[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:b,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:c,dpDiv:c?a('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'):this.dpDiv}},_connectDatepicker:function(b,c){var d=a(b);c.append=a([]);c.trigger=a([]);d.hasClass(this.markerClassName)||
(this._attachments(d,c),d.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,b,d){c.settings[b]=d}).bind("getData.datepicker",function(a,b){return this._get(c,b)}),this._autoSize(c),a.data(b,"datepicker",c))},_attachments:function(b,c){var d=this._get(c,"appendText"),e=this._get(c,"isRTL");c.append&&c.append.remove();d&&(c.append=a('<span class="'+this._appendClass+'">'+d+"</span>"),b[e?"before":"after"](c.append));
b.unbind("focus",this._showDatepicker);c.trigger&&c.trigger.remove();d=this._get(c,"showOn");"focus"!=d&&"both"!=d||b.focus(this._showDatepicker);if("button"==d||"both"==d){var d=this._get(c,"buttonText"),m=this._get(c,"buttonImage");c.trigger=a(this._get(c,"buttonImageOnly")?a("<img/>").addClass(this._triggerClass).attr({src:m,alt:d,title:d}):a('<button type="button"></button>').addClass(this._triggerClass).html(""==m?d:a("<img/>").attr({src:m,alt:d,title:d})));b[e?"before":"after"](c.trigger);c.trigger.click(function(){a.datepicker._datepickerShowing&&
a.datepicker._lastInput==b[0]?a.datepicker._hideDatepicker():a.datepicker._showDatepicker(b[0]);return!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){for(var b=0,c=0,d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",
this._formatDate(a,b).length)}},_inlineDatepicker:function(b,c){var d=a(b);d.hasClass(this.markerClassName)||(d.addClass(this.markerClassName).append(c.dpDiv).bind("setData.datepicker",function(a,b,d){c.settings[b]=d}).bind("getData.datepicker",function(a,b){return this._get(c,b)}),a.data(b,"datepicker",c),this._setDate(c,this._getDefaultDate(c),!0),this._updateDatepicker(c),this._updateAlternate(c),c.dpDiv.show())},_dialogDatepicker:function(b,c,e,k,m){b=this._dialogInst;b||(this.uuid+=1,this._dialogInput=
a('<input type="text" id="dp'+this.uuid+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),this._dialogInput.keydown(this._doKeyDown),a("body").append(this._dialogInput),b=this._dialogInst=this._newInst(this._dialogInput,!1),b.settings={},a.data(this._dialogInput[0],"datepicker",b));d(b.settings,k||{});c=c&&c.constructor==Date?this._formatDate(b,c):c;this._dialogInput.val(c);this._pos=m?m.length?m:[m.pageX,m.pageY]:null;this._pos||(this._pos=[document.documentElement.clientWidth/
2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)]);this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");b.settings.onSelect=e;this._inDialog=!0;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);a.blockUI&&a.blockUI(this.dpDiv);a.data(this._dialogInput[0],"datepicker",b);return this},_destroyDatepicker:function(b){var c=
a(b),d=a.data(b,"datepicker");if(c.hasClass(this.markerClassName)){var e=b.nodeName.toLowerCase();a.removeData(b,"datepicker");"input"==e?(d.append.remove(),d.trigger.remove(),c.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):"div"!=e&&"span"!=e||c.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(b){var c=a(b),d=a.data(b,"datepicker");if(c.hasClass(this.markerClassName)){var e=
b.nodeName.toLowerCase();"input"==e?(b.disabled=!1,d.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!=e&&"span"!=e||c.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=a.map(this._disabledInputs,function(a){return a==b?null:a})}},_disableDatepicker:function(b){var c=a(b),d=a.data(b,"datepicker");if(c.hasClass(this.markerClassName)){var e=b.nodeName.toLowerCase();"input"==e?(b.disabled=
!0,d.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!=e&&"span"!=e||c.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=a.map(this._disabledInputs,function(a){return a==b?null:a});this._disabledInputs[this._disabledInputs.length]=b}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(b){try{return a.data(b,
"datepicker")}catch(c){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(c,e,h){var k=this._getInst(c);if(2==arguments.length&&"string"==typeof e)return"defaults"==e?a.extend({},a.datepicker._defaults):k?"all"==e?a.extend({},k.settings):this._get(k,e):null;var m=e||{};"string"==typeof e&&(m={},m[e]=h);if(k){this._curInst==k&&this._hideDatepicker();var n=this._getDateDatepicker(c,!0),q=this._getMinMaxDate(k,"min"),l=this._getMinMaxDate(k,"max");d(k.settings,m);null!==q&&
m.dateFormat!==b&&m.minDate===b&&(k.settings.minDate=this._formatDate(k,q));null!==l&&m.dateFormat!==b&&m.maxDate===b&&(k.settings.maxDate=this._formatDate(k,l));this._attachments(a(c),k);this._autoSize(k);this._setDateDatepicker(c,n);this._updateDatepicker(k)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a))this._setDate(a,b),this._updateDatepicker(a),
this._updateAlternate(a)},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(b){var c=a.datepicker._getInst(b.target),d=!0,e=c.dpDiv.is(".ui-datepicker-rtl");c._keyEvent=!0;if(a.datepicker._datepickerShowing)switch(b.keyCode){case 9:a.datepicker._hideDatepicker();d=!1;break;case 13:return d=a("td."+a.datepicker._dayOverClass+":not(."+a.datepicker._currentClass+")",c.dpDiv),d[0]?a.datepicker._selectDay(b.target,
c.selectedMonth,c.selectedYear,d[0]):a.datepicker._hideDatepicker(),!1;case 27:a.datepicker._hideDatepicker();break;case 33:a.datepicker._adjustDate(b.target,b.ctrlKey?-a.datepicker._get(c,"stepBigMonths"):-a.datepicker._get(c,"stepMonths"),"M");break;case 34:a.datepicker._adjustDate(b.target,b.ctrlKey?+a.datepicker._get(c,"stepBigMonths"):+a.datepicker._get(c,"stepMonths"),"M");break;case 35:(b.ctrlKey||b.metaKey)&&a.datepicker._clearDate(b.target);d=b.ctrlKey||b.metaKey;break;case 36:(b.ctrlKey||
b.metaKey)&&a.datepicker._gotoToday(b.target);d=b.ctrlKey||b.metaKey;break;case 37:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,e?1:-1,"D");d=b.ctrlKey||b.metaKey;b.originalEvent.altKey&&a.datepicker._adjustDate(b.target,b.ctrlKey?-a.datepicker._get(c,"stepBigMonths"):-a.datepicker._get(c,"stepMonths"),"M");break;case 38:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,-7,"D");d=b.ctrlKey||b.metaKey;break;case 39:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,e?-1:
1,"D");d=b.ctrlKey||b.metaKey;b.originalEvent.altKey&&a.datepicker._adjustDate(b.target,b.ctrlKey?+a.datepicker._get(c,"stepBigMonths"):+a.datepicker._get(c,"stepMonths"),"M");break;case 40:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,7,"D");d=b.ctrlKey||b.metaKey;break;default:d=!1}else 36==b.keyCode&&b.ctrlKey?a.datepicker._showDatepicker(this):d=!1;d&&(b.preventDefault(),b.stopPropagation())},_doKeyPress:function(c){var d=a.datepicker._getInst(c.target);if(a.datepicker._get(d,"constrainInput")){var d=
a.datepicker._possibleChars(a.datepicker._get(d,"dateFormat")),e=String.fromCharCode(c.charCode==b?c.keyCode:c.charCode);return c.ctrlKey||c.metaKey||" ">e||!d||-1<d.indexOf(e)}},_doKeyUp:function(b){b=a.datepicker._getInst(b.target);if(b.input.val()!=b.lastVal)try{a.datepicker.parseDate(a.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,a.datepicker._getFormatConfig(b))&&(a.datepicker._setDateFromField(b),a.datepicker._updateAlternate(b),a.datepicker._updateDatepicker(b))}catch(c){a.datepicker.log(c)}return!0},
_showDatepicker:function(b){b=b.target||b;"input"!=b.nodeName.toLowerCase()&&(b=a("input",b.parentNode)[0]);if(!a.datepicker._isDisabledDatepicker(b)&&a.datepicker._lastInput!=b){var c=a.datepicker._getInst(b);a.datepicker._curInst&&a.datepicker._curInst!=c&&a.datepicker._curInst.dpDiv.stop(!0,!0);var e=a.datepicker._get(c,"beforeShow");d(c.settings,e?e.apply(b,[b,c]):{});c.lastVal=null;a.datepicker._lastInput=b;a.datepicker._setDateFromField(c);a.datepicker._inDialog&&(b.value="");a.datepicker._pos||
(a.datepicker._pos=a.datepicker._findPos(b),a.datepicker._pos[1]+=b.offsetHeight);var k=!1;a(b).parents().each(function(){k|="fixed"==a(this).css("position");return!k});k&&a.browser.opera&&(a.datepicker._pos[0]-=document.documentElement.scrollLeft,a.datepicker._pos[1]-=document.documentElement.scrollTop);e={left:a.datepicker._pos[0],top:a.datepicker._pos[1]};a.datepicker._pos=null;c.dpDiv.empty();c.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});a.datepicker._updateDatepicker(c);e=
a.datepicker._checkOffset(c,e,k);c.dpDiv.css({position:a.datepicker._inDialog&&a.blockUI?"static":k?"fixed":"absolute",display:"none",left:e.left+"px",top:e.top+"px"});if(!c.inline){var e=a.datepicker._get(c,"showAnim"),m=a.datepicker._get(c,"duration"),n=function(){a.datepicker._datepickerShowing=!0;var b=c.dpDiv.find("iframe.ui-datepicker-cover");if(b.length){var d=a.datepicker._getBorders(c.dpDiv);b.css({left:-d[0],top:-d[1],width:c.dpDiv.outerWidth(),height:c.dpDiv.outerHeight()})}};c.dpDiv.zIndex(a(b).zIndex()+
1);a.effects&&a.effects[e]?c.dpDiv.show(e,a.datepicker._get(c,"showOptions"),m,n):c.dpDiv[e||"show"](e?m:null,n);e&&m||n();c.input.is(":visible")&&!c.input.is(":disabled")&&c.input.focus();a.datepicker._curInst=c}}},_updateDatepicker:function(b){var c=this,d=a.datepicker._getBorders(b.dpDiv);b.dpDiv.empty().append(this._generateHTML(b));var e=b.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-d[0],top:-d[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()});b.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",
function(){a(this).removeClass("ui-state-hover");-1!=this.className.indexOf("ui-datepicker-prev")&&a(this).removeClass("ui-datepicker-prev-hover");-1!=this.className.indexOf("ui-datepicker-next")&&a(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){c._isDisabledDatepicker(b.inline?b.dpDiv.parent()[0]:b.input[0])||(a(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),a(this).addClass("ui-state-hover"),-1!=this.className.indexOf("ui-datepicker-prev")&&
a(this).addClass("ui-datepicker-prev-hover"),-1!=this.className.indexOf("ui-datepicker-next")&&a(this).addClass("ui-datepicker-next-hover"))}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();d=this._getNumberOfMonths(b);e=d[1];1<e?b.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):b.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");b.dpDiv[(1!=d[0]||1!=d[1]?"add":"remove")+"Class"]("ui-datepicker-multi");b.dpDiv[(this._get(b,
"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");b==a.datepicker._curInst&&a.datepicker._datepickerShowing&&b.input&&b.input.is(":visible")&&!b.input.is(":disabled")&&b.input[0]!=document.activeElement&&b.input.focus();if(b.yearshtml){var m=b.yearshtml;setTimeout(function(){m===b.yearshtml&&b.dpDiv.find("select.ui-datepicker-year:first").replaceWith(b.yearshtml);m=b.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),
parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(b,c,d){var e=b.dpDiv.outerWidth(),m=b.dpDiv.outerHeight(),n=b.input?b.input.outerWidth():0,q=b.input?b.input.outerHeight():0,l=document.documentElement.clientWidth+a(document).scrollLeft(),s=document.documentElement.clientHeight+a(document).scrollTop();c.left-=this._get(b,"isRTL")?e-n:0;c.left-=d&&c.left==b.input.offset().left?a(document).scrollLeft():0;c.top-=d&&c.top==b.input.offset().top+q?a(document).scrollTop():0;c.left-=Math.min(c.left,
c.left+e>l&&l>e?Math.abs(c.left+e-l):0);c.top-=Math.min(c.top,c.top+m>s&&s>m?Math.abs(m+q):0);return c},_findPos:function(b){for(var c=this._get(this._getInst(b),"isRTL");b&&("hidden"==b.type||1!=b.nodeType||a.expr.filters.hidden(b));)b=b[c?"previousSibling":"nextSibling"];b=a(b).offset();return[b.left,b.top]},_hideDatepicker:function(b){var c=this._curInst;if(c&&(!b||c==a.data(b,"datepicker"))&&this._datepickerShowing){b=this._get(c,"showAnim");var d=this._get(c,"duration"),e=function(){a.datepicker._tidyDialog(c);
this._curInst=null};a.effects&&a.effects[b]?c.dpDiv.hide(b,a.datepicker._get(c,"showOptions"),d,e):c.dpDiv["slideDown"==b?"slideUp":"fadeIn"==b?"fadeOut":"hide"](b?d:null,e);b||e();(b=this._get(c,"onClose"))&&b.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._datepickerShowing=!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),a.blockUI&&(a.unblockUI(),a("body").append(this.dpDiv)));this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
_checkExternalClick:function(b){a.datepicker._curInst&&(b=a(b.target),b[0].id==a.datepicker._mainDivId||0!=b.parents("#"+a.datepicker._mainDivId).length||b.hasClass(a.datepicker.markerClassName)||b.hasClass(a.datepicker._triggerClass)||!a.datepicker._datepickerShowing||a.datepicker._inDialog&&a.blockUI||a.datepicker._hideDatepicker())},_adjustDate:function(b,c,d){b=a(b);var e=this._getInst(b[0]);this._isDisabledDatepicker(b[0])||(this._adjustInstDate(e,c+("M"==d?this._get(e,"showCurrentAtPos"):0),
d),this._updateDatepicker(e))},_gotoToday:function(b){b=a(b);var c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate();c.drawMonth=c.selectedMonth=d.getMonth();c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c);this._adjustDate(b)},_selectMonthYear:function(b,c,d){b=a(b);var e=this._getInst(b[0]);e._selectingMonthYear=
!1;e["selected"+("M"==d?"Month":"Year")]=e["draw"+("M"==d?"Month":"Year")]=parseInt(c.options[c.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(b)},_clickMonthYear:function(b){var c=this._getInst(a(b)[0]);c.input&&c._selectingMonthYear&&setTimeout(function(){c.input.focus()},0);c._selectingMonthYear=!c._selectingMonthYear},_selectDay:function(b,c,d,e){var m=a(b);a(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(m[0])||(m=this._getInst(m[0]),m.selectedDay=m.currentDay=
a("a",e).html(),m.selectedMonth=m.currentMonth=c,m.selectedYear=m.currentYear=d,this._selectDate(b,this._formatDate(m,m.currentDay,m.currentMonth,m.currentYear)))},_clearDate:function(b){b=a(b);this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(b,c){b=this._getInst(a(b)[0]);c=null!=c?c:this._formatDate(b);b.input&&b.input.val(c);this._updateAlternate(b);var d=this._get(b,"onSelect");d?d.apply(b.input?b.input[0]:null,[c,b]):b.input&&b.input.trigger("change");b.inline?this._updateDatepicker(b):
(this._hideDatepicker(),this._lastInput=b.input[0],"object"!=typeof b.input[0]&&b.input.focus(),this._lastInput=null)},_updateAlternate:function(b){var c=this._get(b,"altField");if(c){var d=this._get(b,"altFormat")||this._get(b,"dateFormat"),e=this._getDate(b),m=this.formatDate(d,e,this._getFormatConfig(b));a(c).each(function(){a(this).val(m)})}},noWeekends:function(a){a=a.getDay();return[0<a&&6>a,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=
a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(null==a||null==b)throw"Invalid arguments";b="object"==typeof b?b.toString():b+"";if(""==b)return null;for(var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,d="string"!=typeof d?d:(new Date).getFullYear()%100+parseInt(d,10),e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,n=(c?c.dayNames:null)||this._defaults.dayNames,q=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,
l=(c?c.monthNames:null)||this._defaults.monthNames,s=c=-1,u=-1,z=-1,t=!1,B=function(b){(b=H+1<a.length&&a.charAt(H+1)==b)&&H++;return b},A=function(a){var c=B(a);a=RegExp("^\\d{1,"+("@"==a?14:"!"==a?20:"y"==a&&c?4:"o"==a?3:2)+"}");a=b.substring(C).match(a);if(!a)throw"Missing number at position "+C;C+=a[0].length;return parseInt(a[0],10)},w=function(a,c,d){a=B(a)?d:c;for(c=0;c<a.length;c++)if(b.substr(C,a[c].length).toLowerCase()==a[c].toLowerCase())return C+=a[c].length,c+1;throw"Unknown name at position "+
C;},v=function(){if(b.charAt(C)!=a.charAt(H))throw"Unexpected literal at position "+C;C++},C=0,H=0;H<a.length;H++)if(t)"'"!=a.charAt(H)||B("'")?v():t=!1;else switch(a.charAt(H)){case "d":u=A("d");break;case "D":w("D",e,n);break;case "o":z=A("o");break;case "m":s=A("m");break;case "M":s=w("M",q,l);break;case "y":c=A("y");break;case "@":var D=new Date(A("@"));c=D.getFullYear();s=D.getMonth()+1;u=D.getDate();break;case "!":D=new Date((A("!")-this._ticksTo1970)/1E4);c=D.getFullYear();s=D.getMonth()+1;
u=D.getDate();break;case "'":B("'")?v():t=!0;break;default:v()}-1==c?c=(new Date).getFullYear():100>c&&(c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=d?0:-100));if(-1<z){s=1;u=z;do{d=this._getDaysInMonth(c,s-1);if(u<=d)break;s++;u-=d}while(1)}D=this._daylightSavingAdjust(new Date(c,s-1,u));if(D.getFullYear()!=c||D.getMonth()+1!=s||D.getDate()!=u)throw"Invalid date";return D},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",
RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864E9*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,n=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var q=function(b){(b=t+1<a.length&&a.charAt(t+1)==b)&&t++;return b},
l=function(a,b,c){b=""+b;if(q(a))for(;b.length<c;)b="0"+b;return b},s=function(a,b,c,d){return q(a)?d[b]:c[b]},u="",z=!1;if(b)for(var t=0;t<a.length;t++)if(z)"'"!=a.charAt(t)||q("'")?u+=a.charAt(t):z=!1;else switch(a.charAt(t)){case "d":u+=l("d",b.getDate(),2);break;case "D":u+=s("D",b.getDay(),d,e);break;case "o":u+=l("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":u+=l("m",b.getMonth()+1,2);break;case "M":u+=s("M",b.getMonth(),n,c);break;case "y":u+=q("y")?b.getFullYear():
(10>b.getYear()%100?"0":"")+b.getYear()%100;break;case "@":u+=b.getTime();break;case "!":u+=1E4*b.getTime()+this._ticksTo1970;break;case "'":q("'")?u+="'":z=!0;break;default:u+=a.charAt(t)}return u},_possibleChars:function(a){for(var b="",c=!1,d=function(b){(b=e+1<a.length&&a.charAt(e+1)==b)&&e++;return b},e=0;e<a.length;e++)if(c)"'"!=a.charAt(e)||d("'")?b+=a.charAt(e):c=!1;else switch(a.charAt(e)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":d("'")?
b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,c){return a.settings[c]!==b?a.settings[c]:this._defaults[c]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,n;e=n=this._getDefaultDate(a);var q=this._getFormatConfig(a);try{e=this.parseDate(c,d,q)||n}catch(l){this.log(l),d=b?"":d}a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();a.currentDay=
d?e.getDate():0;a.currentMonth=d?e.getMonth():0;a.currentYear=d?e.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(b,c,d){var e=function(a){var b=new Date;b.setDate(b.getDate()+a);return b},m=function(c){try{return a.datepicker.parseDate(a.datepicker._get(b,"dateFormat"),c,a.datepicker._getFormatConfig(b))}catch(d){}for(var e=(c.toLowerCase().match(/^c/)?a.datepicker._getDate(b):
null)||new Date,g=e.getFullYear(),h=e.getMonth(),e=e.getDate(),k=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,m=k.exec(c);m;){switch(m[2]||"d"){case "d":case "D":e+=parseInt(m[1],10);break;case "w":case "W":e+=7*parseInt(m[1],10);break;case "m":case "M":h+=parseInt(m[1],10);e=Math.min(e,a.datepicker._getDaysInMonth(g,h));break;case "y":case "Y":g+=parseInt(m[1],10),e=Math.min(e,a.datepicker._getDaysInMonth(g,h))}m=k.exec(c)}return new Date(g,h,e)};if(c=(c=null==c||""===c?d:"string"==typeof c?m(c):"number"==
typeof c?isNaN(c)?d:e(c):new Date(c.getTime()))&&"Invalid Date"==c.toString()?d:c)c.setHours(0),c.setMinutes(0),c.setSeconds(0),c.setMilliseconds(0);return this._daylightSavingAdjust(c)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(12<a.getHours()?a.getHours()+2:0);return a},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,n=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=
b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();e==a.selectedMonth&&n==a.selectedYear||c||this._notifyChange(a);this._adjustInstDate(a);a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&""==a.input.val()?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(b){var c=new Date,c=this._daylightSavingAdjust(new Date(c.getFullYear(),c.getMonth(),c.getDate())),d=this._get(b,"isRTL"),
k=this._get(b,"showButtonPanel"),m=this._get(b,"hideIfNoPrevNext"),n=this._get(b,"navigationAsDateFormat"),q=this._getNumberOfMonths(b),l=this._get(b,"showCurrentAtPos"),s=this._get(b,"stepMonths"),u=1!=q[0]||1!=q[1],z=this._daylightSavingAdjust(b.currentDay?new Date(b.currentYear,b.currentMonth,b.currentDay):new Date(9999,9,9)),t=this._getMinMaxDate(b,"min"),B=this._getMinMaxDate(b,"max"),l=b.drawMonth-l,A=b.drawYear;0>l&&(l+=12,A--);if(B)for(var w=this._daylightSavingAdjust(new Date(B.getFullYear(),
B.getMonth()-q[0]*q[1]+1,B.getDate())),w=t&&w<t?t:w;this._daylightSavingAdjust(new Date(A,l,1))>w;)l--,0>l&&(l=11,A--);b.drawMonth=l;b.drawYear=A;var w=this._get(b,"prevText"),w=n?this.formatDate(w,this._daylightSavingAdjust(new Date(A,l-s,1)),this._getFormatConfig(b)):w,w=this._canAdjustMonth(b,-1,A,l)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+e+".datepicker._adjustDate('#"+b.id+"', -"+s+", 'M');\" title=\""+w+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"e":"w")+
'">'+w+"</span></a>":m?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+w+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"e":"w")+'">'+w+"</span></a>",v=this._get(b,"nextText"),v=n?this.formatDate(v,this._daylightSavingAdjust(new Date(A,l+s,1)),this._getFormatConfig(b)):v,m=this._canAdjustMonth(b,1,A,l)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+e+".datepicker._adjustDate('#"+b.id+"', +"+s+", 'M');\" title=\""+v+'"><span class="ui-icon ui-icon-circle-triangle-'+
(d?"w":"e")+'">'+v+"</span></a>":m?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+v+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"w":"e")+'">'+v+"</span></a>",s=this._get(b,"currentText"),v=this._get(b,"gotoCurrent")&&b.currentDay?z:c,s=n?this.formatDate(s,v,this._getFormatConfig(b)):s,n=b.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+e+'.datepicker._hideDatepicker();">'+this._get(b,
"closeText")+"</button>",k=k?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(d?n:"")+(this._isInRange(b,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+e+".datepicker._gotoToday('#"+b.id+"');\">"+s+"</button>":"")+(d?"":n)+"</div>":"",n=parseInt(this._get(b,"firstDay"),10),n=isNaN(n)?0:n,s=this._get(b,"showWeek"),v=this._get(b,"dayNames");this._get(b,"dayNamesShort");var C=this._get(b,"dayNamesMin"),H=this._get(b,
"monthNames"),D=this._get(b,"monthNamesShort"),F=this._get(b,"beforeShowDay"),I=this._get(b,"showOtherMonths"),E=this._get(b,"selectOtherMonths");this._get(b,"calculateWeek");for(var P=this._getDefaultDate(b),O="",r=0;r<q[0];r++){for(var S="",J=0;J<q[1];J++){var K=this._daylightSavingAdjust(new Date(A,l,b.selectedDay)),R=" ui-corner-all",N="";if(u){N+='<div class="ui-datepicker-group';if(1<q[1])switch(J){case 0:N+=" ui-datepicker-group-first";R=" ui-corner-"+(d?"right":"left");break;case q[1]-1:N+=
" ui-datepicker-group-last";R=" ui-corner-"+(d?"left":"right");break;default:N+=" ui-datepicker-group-middle",R=""}N+='">'}for(var N=N+('<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+R+'">'+(/all|left/.test(R)&&0==r?d?m:w:"")+(/all|right/.test(R)&&0==r?d?w:m:"")+this._generateMonthYearHeader(b,l,A,t,B,0<r||0<J,H,D)+'</div><table class="ui-datepicker-calendar"><thead><tr>'),T=s?'<th class="ui-datepicker-week-col">'+this._get(b,"weekHeader")+"</th>":"",R=0;7>R;R++)var L=(R+n)%
7,T=T+("<th"+(5<=(R+n+6)%7?' class="ui-datepicker-week-end"':"")+'><span title="'+v[L]+'">'+C[L]+"</span></th>");N+=T+"</tr></thead><tbody>";T=this._getDaysInMonth(A,l);A==b.selectedYear&&l==b.selectedMonth&&(b.selectedDay=Math.min(b.selectedDay,T));for(var R=(this._getFirstDayOfMonth(A,l)-n+7)%7,T=u?6:Math.ceil((R+T)/7),L=this._daylightSavingAdjust(new Date(A,l,1-R)),Z=0;Z<T;Z++){for(var N=N+"<tr>",X=s?'<td class="ui-datepicker-week-col">'+this._get(b,"calculateWeek")(L)+"</td>":"",R=0;7>R;R++){var ba=
F?F.apply(b.input?b.input[0]:null,[L]):[!0,""],aa=L.getMonth()!=l,U=aa&&!E||!ba[0]||t&&L<t||B&&L>B,X=X+('<td class="'+(5<=(R+n+6)%7?" ui-datepicker-week-end":"")+(aa?" ui-datepicker-other-month":"")+(L.getTime()==K.getTime()&&l==b.selectedMonth&&b._keyEvent||P.getTime()==L.getTime()&&P.getTime()==K.getTime()?" "+this._dayOverClass:"")+(U?" "+this._unselectableClass+" ui-state-disabled":"")+(aa&&!I?"":" "+ba[1]+(L.getTime()==z.getTime()?" "+this._currentClass:"")+(L.getTime()==c.getTime()?" ui-datepicker-today":
""))+'"'+(aa&&!I||!ba[2]?"":' title="'+ba[2]+'"')+(U?"":' onclick="DP_jQuery_'+e+".datepicker._selectDay('#"+b.id+"',"+L.getMonth()+","+L.getFullYear()+', this);return false;"')+">"+(aa&&!I?"&#xa0;":U?'<span class="ui-state-default">'+L.getDate()+"</span>":'<a class="ui-state-default'+(L.getTime()==c.getTime()?" ui-state-highlight":"")+(L.getTime()==z.getTime()?" ui-state-active":"")+(aa?" ui-priority-secondary":"")+'" href="#">'+L.getDate()+"</a>")+"</td>");L.setDate(L.getDate()+1);L=this._daylightSavingAdjust(L)}N+=
X+"</tr>"}l++;11<l&&(l=0,A++);N+="</tbody></table>"+(u?"</div>"+(0<q[0]&&J==q[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");S+=N}O+=S}O+=k+(a.browser.msie&&7>parseInt(a.browser.version,10)&&!b.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");b._keyEvent=!1;return O},_generateMonthYearHeader:function(b,c,d,k,m,n,q,l){var s=this._get(b,"changeMonth"),u=this._get(b,"changeYear"),z=this._get(b,"showMonthAfterYear"),t='<div class="ui-datepicker-title">',
B="";if(n||!s)B+='<span class="ui-datepicker-month">'+q[c]+"</span>";else{q=k&&k.getFullYear()==d;for(var A=m&&m.getFullYear()==d,B=B+('<select class="ui-datepicker-month" onchange="DP_jQuery_'+e+".datepicker._selectMonthYear('#"+b.id+"', this, 'M');\" onclick=\"DP_jQuery_"+e+".datepicker._clickMonthYear('#"+b.id+"');\">"),w=0;12>w;w++)(!q||w>=k.getMonth())&&(!A||w<=m.getMonth())&&(B+='<option value="'+w+'"'+(w==c?' selected="selected"':"")+">"+l[w]+"</option>");B+="</select>"}z||(t+=B+(!n&&s&&u?
"":"&#xa0;"));b.yearshtml="";if(n||!u)t+='<span class="ui-datepicker-year">'+d+"</span>";else{l=this._get(b,"yearRange").split(":");var v=(new Date).getFullYear();q=function(a){a=a.match(/c[+-].*/)?d+parseInt(a.substring(1),10):a.match(/[+-].*/)?v+parseInt(a,10):parseInt(a,10);return isNaN(a)?v:a};c=q(l[0]);l=Math.max(c,q(l[1]||""));c=k?Math.max(c,k.getFullYear()):c;l=m?Math.min(l,m.getFullYear()):l;for(b.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+e+".datepicker._selectMonthYear('#"+
b.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+e+".datepicker._clickMonthYear('#"+b.id+"');\">";c<=l;c++)b.yearshtml+='<option value="'+c+'"'+(c==d?' selected="selected"':"")+">"+c+"</option>";b.yearshtml+="</select>";a.browser.mozilla?t+='<select class="ui-datepicker-year"><option value="'+d+'" selected="selected">'+d+"</option></select>":(t+=b.yearshtml,b.yearshtml=null)}t+=this._get(b,"yearSuffix");z&&(t+=(!n&&s&&u?"":"&#xa0;")+B);return t+"</div>"},_adjustInstDate:function(a,b,c){var d=a.drawYear+
("Y"==c?b:0),e=a.drawMonth+("M"==c?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+("D"==c?b:0);d=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,b)));a.selectedDay=d.getDate();a.drawMonth=a.selectedMonth=d.getMonth();a.drawYear=a.selectedYear=d.getFullYear();"M"!=c&&"Y"!=c||this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");
b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return null==a?[1,1]:"number"==typeof a?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a);
c=this._daylightSavingAdjust(new Date(c,d+(0>b?b:e[0]*e[1]),1));0>b&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff"),b="string"!=typeof b?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);b=b?"object"==typeof b?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});a.fn.datepicker=
function(b){if(!this.length)return this;a.datepicker.initialized||(a(document).mousedown(a.datepicker._checkExternalClick).find("body").append(a.datepicker.dpDiv),a.datepicker.initialized=!0);var c=Array.prototype.slice.call(arguments,1);return"string"==typeof b&&("isDisabled"==b||"getDate"==b||"widget"==b)||"option"==b&&2==arguments.length&&"string"==typeof arguments[1]?a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this[0]].concat(c)):this.each(function(){"string"==typeof b?a.datepicker["_"+
b+"Datepicker"].apply(a.datepicker,[this].concat(c)):a.datepicker._attachDatepicker(this,b)})};a.datepicker=new c;a.datepicker.initialized=!1;a.datepicker.uuid=(new Date).getTime();a.datepicker.version="1.8.11";window["DP_jQuery_"+e]=a})(jQuery);
jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&3==b.length?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[2.55*parseFloat(c[1]),2.55*parseFloat(c[2]),2.55*parseFloat(c[3])]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],
16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:/rgba\(0, 0, 0, 0\)/.exec(b)?k.transparent:k[a.trim(b).toLowerCase()]}function d(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]])for(var e=a.length;e--;)c=a[e],"string"==typeof a[c]&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c]);else for(c in a)"string"===
typeof a[c]&&(b[c]=a[c]);return b}function e(b){var c,d;for(c in b)d=b[c],(null==d||a.isFunction(d)||c in n||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function f(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function g(b,c,d,e){"object"==typeof b&&(e=c,d=null,c=b,b=c.effect);a.isFunction(c)&&(e=c,d=null,c={});if("number"==typeof c||a.fx.speeds[c])e=d,d=c,c={};a.isFunction(d)&&(e=d,d=null);c=c||{};d=d||c.duration;d=a.fx.off?0:"number"==typeof d?
d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default;e=e||c.complete;return[b,c,d,e]}function h(b){return!b||"number"===typeof b||a.fx.speeds[b]||"string"===typeof b&&!a.effects[b]?!0:!1}a.effects={};a.each("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor borderColor color outlineColor".split(" "),function(b,d){a.fx.step[d]=function(b){if(!b.colorInit){var e;e=b.elem;var f=d,g;do{g=a.curCSS(e,f);if(""!=g&&"transparent"!=g||a.nodeName(e,"body"))break;f="backgroundColor"}while(e=
e.parentNode);e=c(g);b.start=e;b.end=c(b.end);b.colorInit=!0}b.elem.style[d]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var k={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],
darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],
maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},m=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,g,h){a.isFunction(g)&&(h=g,g=null);return this.queue("fx",function(){var k=a(this),n=k.attr("style")||
" ",B=e(d.call(this)),A,w=k.attr("className");a.each(m,function(a,c){b[c]&&k[c+"Class"](b[c])});A=e(d.call(this));k.attr("className",w);k.animate(f(B,A),c,g,function(){a.each(m,function(a,c){b[c]&&k[c+"Class"](b[c])});"object"==typeof k.attr("style")?(k.attr("style").cssText="",k.attr("style").cssText=n):k.attr("style",n);h&&h.apply(this,arguments)});B=a.queue(this);A=B.splice(B.length-1,1)[0];B.splice(1,0,A);a.dequeue(this)})};a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?
a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return"boolean"==typeof d||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,
[{add:c,remove:b},d,e,f])}});a.extend(a.effects,{version:"1.8.11",save:function(a,b){for(var c=0;c<b.length;c++)null!==b[c]&&a.data("ec.storage."+b[c],a[0].style[b[c]])},restore:function(a,b){for(var c=0;c<b.length;c++)null!==b[c]&&a.css(b[c],a.data("ec.storage."+b[c]))},setMode:function(a,b){"toggle"==b&&(b=a.is(":hidden")?"show":"hide");return b},getBaseline:function(a,b){var c;switch(a[0]){case "top":c=0;break;case "middle":c=0.5;break;case "bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case "left":a=
0;break;case "center":a=0.5;break;case "right":a=1;break;default:a=a[1]/b.width}return{x:a,y:c}},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),"float":b.css("float")},d=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});b.wrap(d);d=b.parent();"static"==b.css("position")?(d.css({position:"relative"}),b.css({position:"relative"})):
(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d);isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return d.css(c).show()},removeWrapper:function(a){return a.parent().is(".ui-effects-wrapper")?a.parent().replaceWith(a):a},setTransition:function(b,c,d,e){e=e||{};a.each(c,function(a,c){unit=b.cssUnit(c);0<unit[0]&&(e[c]=unit[0]*d+unit[1])});return e}});a.fn.extend({effect:function(b){var c=
g.apply(this,arguments),d={options:c[1],duration:c[2],callback:c[3]},c=d.options.mode,e=a.effects[b];return a.fx.off||!e?c?this[c](d.duration,d.callback):this.each(function(){d.callback&&d.callback.call(this)}):e.call(this,d)},_show:a.fn.show,show:function(a){if(h(a))return this._show.apply(this,arguments);var b=g.apply(this,arguments);b[1].mode="show";return this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(h(a))return this._hide.apply(this,arguments);var b=g.apply(this,arguments);b[1].mode=
"hide";return this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(h(b)||"boolean"===typeof b||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=g.apply(this,arguments);c[1].mode="toggle";return this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];a.each(["em","px","%","pt"],function(a,b){0<c.indexOf(b)&&(d=[parseFloat(c),b])});return d}});a.easing.jswing=a.easing.swing;a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,
c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*
((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,
b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return 0==b?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return 0==b?c:b==e?c+d:1>(b/=e/2)?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return 1>
(b/=e/2)?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=0,g=d;if(0==b)return c;if(1==(b/=e))return c+d;f||(f=0.3*e);g<Math.abs(d)?(g=d,a=f/4):a=f/(2*Math.PI)*Math.asin(d/g);return-(g*Math.pow(2,10*(b-=1))*Math.sin(2*(b*e-a)*Math.PI/f))+c},easeOutElastic:function(a,b,c,d,e){var f=0,g=d;if(0==b)return c;if(1==(b/=e))return c+d;f||(f=0.3*e);g<Math.abs(d)?(g=d,a=f/4):a=f/(2*Math.PI)*Math.asin(d/g);return g*Math.pow(2,-10*b)*Math.sin(2*(b*e-a)*Math.PI/
f)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=0,g=d;if(0==b)return c;if(2==(b/=e/2))return c+d;f||(f=1.5*0.3*e);g<Math.abs(d)?(g=d,a=f/4):a=f/(2*Math.PI)*Math.asin(d/g);return 1>b?-0.5*g*Math.pow(2,10*(b-=1))*Math.sin(2*(b*e-a)*Math.PI/f)+c:0.5*g*Math.pow(2,-10*(b-=1))*Math.sin(2*(b*e-a)*Math.PI/f)+d+c},easeInBack:function(a,c,d,e,f,g){g==b&&(g=1.70158);return e*(c/=f)*c*((g+1)*c-g)+d},easeOutBack:function(a,c,d,e,f,g){g==b&&(g=1.70158);return e*((c=c/f-1)*c*((g+1)*c+g)+1)+d},easeInOutBack:function(a,
c,d,e,f,g){g==b&&(g=1.70158);return 1>(c/=f/2)?e/2*c*c*(((g*=1.525)+1)*c-g)+d:e/2*((c-=2)*c*(((g*=1.525)+1)*c+g)+2)+d},easeInBounce:function(b,c,d,e,f){return e-a.easing.easeOutBounce(b,f-c,0,e,f)+d},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?7.5625*d*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+0.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+0.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+0.984375)+c},easeInOutBounce:function(b,c,d,e,f){return c<f/2?0.5*a.easing.easeInBounce(b,2*c,0,e,f)+d:0.5*a.easing.easeOutBounce(b,
2*c-f,0,e,f)+0.5*e+d}})}(jQuery);function cursorCss(a,b,c){c||(c="light");a=TradingView.wrapUrl("url("+TradingView.resourceFullPath(c+"/"+a+".cur")+")");return $.browser.msie?a+", default":a+" "+b+", default"};(function(a){a.fn.contextMenu=function(b){a(this).bind("contextmenu",function(a){b(a);return!1})}})(jQuery);(function(a){function b(b){if("string"===typeof b.data){var d=b.handler,e=b.data.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!/textarea|select/i.test(b.target.nodeName)&&"text"!==b.target.type){var c="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],h=String.fromCharCode(b.which).toLowerCase(),k="",m={};b.ctrlKey&&"ctrl"!==c&&(k+="ctrl+");b.altKey&&"alt"!==c&&(k+="alt+");b.metaKey&&!b.ctrlKey&&"meta"!==c&&(k+="meta+");b.shiftKey&&"shift"!==c&&(k+="shift+");c?m[k+c]=!0:(m[k+
h]=!0,m[k+a.hotkeys.shiftNums[h]]=!0,"shift+"===k&&(m[a.hotkeys.shiftNums[h]]=!0));c=0;for(h=e.length;c<h;c++)if(m[e[c]])return d.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:/mac/i.test(navigator.platform)?"del":"backspace",9:"tab",13:"return",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",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",
104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})})(jQuery);(function(a){a.fn.selectable=function(b){return this.each(function(){var c=a(this);c.css("user-select",b?"text":"none");c.css("-moz-user-select",b?"text":"-moz-none");c.css("-webkit-user-select",b?"auto":"none");(a.browser.msie||a.browser.opera)&&c.attr("unselectable",b?"off":"on")})}})(jQuery);this.JSON||(this.JSON={});
(function(){function a(a){return 10>a?"0"+a:a}function b(a){e.lastIndex=0;return e.test(a)?'"'+a.replace(e,function(a){var b=h[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function c(a,d){var e,h,s,u,z=f,t,B=d[a];B&&"object"===typeof B&&"function"===typeof B.toJSON&&(B=B.toJSON(a));"function"===typeof k&&(B=k.call(d,a,B));switch(typeof B){case "string":return b(B);case "number":return isFinite(B)?String(B):"null";case "boolean":case "null":return String(B);case "object":if(!B)return"null";
f+=g;t=[];if("[object Array]"===Object.prototype.toString.apply(B)){u=B.length;for(e=0;e<u;e+=1)t[e]=c(e,B)||"null";s=0===t.length?"[]":f?"[\n"+f+t.join(",\n"+f)+"\n"+z+"]":"["+t.join(",")+"]";f=z;return s}if(k&&"object"===typeof k)for(u=k.length,e=0;e<u;e+=1)h=k[e],"string"===typeof h&&(s=c(h,B))&&t.push(b(h)+(f?": ":":")+s);else for(h in B)Object.hasOwnProperty.call(B,h)&&(s=c(h,B))&&t.push(b(h)+(f?": ":":")+s);s=0===t.length?"{}":f?"{\n"+f+t.join(",\n"+f)+"\n"+z+"}":"{"+t.join(",")+"}";f=z;return s}}
"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(b){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e=
/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=String(a);d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();(function(a){a.extend(a.fn,{swapClass:function(a,b){var e=this.filter("."+a);this.filter("."+b).removeClass(b).addClass(a);e.removeClass(a).addClass(b);return this},replaceClass:function(a,b){return this.filter("."+a).removeClass(a).addClass(b).end()},hoverClass:function(b){b=b||"hover";return this.hover(function(){a(this).addClass(b)},function(){a(this).removeClass(b)})},heightToggle:function(a,b){a?this.animate({height:"toggle"},a,b):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?
"show":"hide"]();b&&b.apply(this,arguments)})},heightHide:function(a,b){a?this.animate({height:"hide"},a,b):(this.hide(),b&&this.each(b))},prepareBranches:function(a){a.prerendered||(this.filter(":last-child:not(ul)").addClass(b.last),this.filter((a.collapsed?"":"."+b.closed)+":not(."+b.open+")").find(">ul").hide());return this.filter(":has(>ul)")},applyClasses:function(c,d){this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview",function(b){this==b.target&&
d.apply(a(this).next())}).add(a("a",this)).hoverClass();if(!c.prerendered){this.filter(":has(>ul:hidden)").addClass(b.expandable).replaceClass(b.last,b.lastExpandable);this.not(":has(>ul:hidden)").addClass(b.collapsable).replaceClass(b.last,b.lastCollapsable);var e=this.find("div."+b.hitarea);e.length||(e=this.prepend('<div class="'+b.hitarea+'"/>').find("div."+b.hitarea));e.removeClass().addClass(b.hitarea).each(function(){var b="";a.each(a(this).parent().attr("class").split(" "),function(){b+=this+
"-hitarea "});a(this).addClass(b)})}this.find("div."+b.hitarea).click(d)},treeview:function(c){function d(c,d){function f(d){return function(){e.apply(a("div."+b.hitarea,c).filter(function(){return d?a(this).parent("."+d).length:!0}));return!1}}a("a:eq(0)",d).click(f(b.collapsable));a("a:eq(1)",d).click(f(b.expandable));a("a:eq(2)",d).click(f())}function e(){a(this).parent().find(">.hitarea").swapClass(b.collapsableHitarea,b.expandableHitarea).swapClass(b.lastCollapsableHitarea,b.lastExpandableHitarea).end().swapClass(b.collapsable,
b.expandable).swapClass(b.lastCollapsable,b.lastExpandable).find(">ul").heightToggle(c.animated,c.toggle);c.unique&&a(this).parent().siblings().find(">.hitarea").replaceClass(b.collapsableHitarea,b.expandableHitarea).replaceClass(b.lastCollapsableHitarea,b.lastExpandableHitarea).end().replaceClass(b.collapsable,b.expandable).replaceClass(b.lastCollapsable,b.lastExpandable).find(">ul").heightHide(c.animated,c.toggle)}function f(){var b=[];k.each(function(c,d){b[c]=a(d).is(":has(>ul:visible)")?1:0});
a.cookie(c.cookieId,b.join(""),c.cookieOptions)}function g(){var b=a.cookie(c.cookieId);if(b){var d=b.split("");k.each(function(b,c){a(c).find(">ul")[parseInt(d[b])?"show":"hide"]()})}}c=a.extend({cookieId:"treeview"},c);if(c.toggle){var h=c.toggle;c.toggle=function(){return h.apply(a(this).parent()[0],arguments)}}this.data("toggler",e);this.addClass("treeview");var k=this.find("li").prepareBranches(c);switch(c.persist){case "cookie":var m=c.toggle;c.toggle=function(){f();m&&m.apply(this,arguments)};
g();break;case "location":var n=this.find("a").filter(function(){return this.href.toLowerCase()==location.href.toLowerCase()});n.length&&(n=n.addClass("selected").parents("ul, li").add(n.next()).show(),c.prerendered&&n.filter("li").swapClass(b.collapsable,b.expandable).swapClass(b.lastCollapsable,b.lastExpandable).find(">.hitarea").swapClass(b.collapsableHitarea,b.expandableHitarea).swapClass(b.lastCollapsableHitarea,b.lastExpandableHitarea))}k.applyClasses(c,e);c.control&&(d(this,c.control),a(c.control).show());
return this}});a.treeview={};var b=a.treeview.classes={open:"open",closed:"closed",expandable:"expandable",expandableHitarea:"expandable-hitarea",lastExpandableHitarea:"lastExpandable-hitarea",collapsable:"collapsable",collapsableHitarea:"collapsable-hitarea",lastCollapsableHitarea:"lastCollapsable-hitarea",lastCollapsable:"lastCollapsable",lastExpandable:"lastExpandable",last:"last",hitarea:"hitarea"}})(jQuery);(function(a){function b(a){for(var b=0;b<arguments.length;b++)if(!isNaN(parseFloat(arguments[b])))return Number(parseFloat(arguments[b]))}function c(b,c){var f=a(c||this).attr("class"),f=RegExp("(\\b"+b+")(\\S*)").exec(f),g={"true":!0,True:!0,"false":!1,False:!1};f&&3<=f.length&&void 0!==g[f[3]]&&(f[3]=g[f[3]]);return f?3<=f.length?f[2]:null:void 0}a.fn.spinbox=function(d){if(d&&"String"===typeof d&&"destroy"===d)return this.unbind(".spinbox").removeClass(d.spinboxClass).removeClass(d.upClass).removeClass(d.downClass).removeClass(d.upHoverClass).removeClass(d.downHoverClass).removeData("spinboxMin").removeData("spinboxMax").removeData("spinboxReset").removeData("spinboxStep").removeData("spinboxBigStep");
d=a.extend({},a.fn.spinbox.defaults,d);this.each(function(){var e=a(this),f=c("spinboxMin",this),g=c("spinboxMax",this),h=c("spinboxStep",this),k=c("spinboxBigStep",this),m=c("spinboxReset",this),n=c("spinboxScale",this);void 0===f&&(f=b(e.attr("min"),d.min));void 0===g&&(g=b(e.attr("max"),d.max));h||(h=b(e.attr("step"),d.step));k||(k=b(e.attr("bigStep"),d.bigStep));void 0===m&&(m=b(d.reset,e.val(),f,g));void 0===n&&(n=e.data("spinboxScale"));n=n||!isNaN(parseFloat(n))?n:d.scale;!0===n&&(n=(h.toString().split(".")[1]||
"").length);e.data("spinboxMin",f);e.data("spinboxMax",g);e.data("spinboxStep",h);e.data("spinboxBigStep",k);e.data("spinboxReset",m);e.data("spinboxScale",n)});return this.each(function(){function c(e,f,g){e=a(this);if(!d.ignore||!e.is(d.ignore)){f=b(f,e.data("spinboxStep"),1);g=g||(k?-1:1);var h=e.val(),m=b(h,e.data("spinboxReset"),0),n=b(e.data("spinboxMin")),q=b(e.data("spinboxMax")),w=[m,f,n,q,g,h,d];0<g?m=d.increment.apply(this,w):0>g&&(m=d.decrement.apply(this,w));w=e.data("spinboxScale");
!isNaN(parseFloat(w))&&d.round&&(m=d.round(m,e.data("spinboxScale")));isNaN(parseFloat(n))||(m=Math.max(m,n));isNaN(parseFloat(q))||(m=Math.min(m,q));w=[m,f,n,q,g,h,d];m!=h&&!1!==e.triggerHandler("beforeSpin",w)&&(e.val(m),d.change&&e.trigger("change",w),e.triggerHandler("spin",w))}}function f(a,b){g();m=window.setTimeout(function(){c.apply(a,[b]);n=window.setInterval(function(){c.apply(a,[b])},d.repeat)},d.delay)}function g(){window.clearTimeout(m);window.clearInterval(n)}var h,k,m,n,q=a(this);q.bind("mousemove.spinbox",
function(b){var c=a(this),e=c.offset(),f=c.height()/2,g=b.pageX>e.left+c.width()-d.buttonWidth;h=g&&b.pageY<=e.top+f;k=g&&b.pageY>e.top+f;c.toggleClass(d.upHoverClass,h).toggleClass(d.downHoverClass,k)});q.bind("mouseout.spinbox",function(){g();a(this).removeClass([d.upClass,d.downClass,d.upHoverClass,d.downHoverClass].join(" "));h=k=null});q.bind("mousedown.spinbox",function(b){if(h||k)a(this).toggleClass(d.upClass,h).toggleClass(d.downClass,k),c.apply(this,[b]),f(this,b)});q.bind("mouseup.spinbox",
function(b){g();a(this).removeClass(d.upClass).removeClass(d.downClass)});q.bind("keydown.spinbox",function(b){if(!d.keys||a.grep(d.keys,function(a){return a===b.keyCode||a instanceof RegExp&&a.test(String.fromCharCode(b.keyCode))}).length){var f=a(this),g=f.data("spinboxBigStep"),f=b.shiftKey?g:f.data("spinboxStep");switch(b.keyCode){case 38:c.apply(this,[b,f,1]);break;case 40:c.apply(this,[b,f,-1]);break;case 33:c.apply(this,[b,g,1]);break;case 34:c.apply(this,[b,g,-1])}}else return!d.keys});q.bind("change.spinbox",
function(a){c.apply(this,[a,0])});q.addClass(d.spinboxClass);d.mousewheel&&a(this).bind("mousewheel.spinbox DOMMouseScroll.spinbox",function(b){var d=b.shiftKey?a(this).data("spinboxBigStep"):a(this).data("spinboxStep");0>b.detail||120<=b.wheelDelta?c.apply(this,[b,d,1]):(0<b.detail||-120>=b.wheelDelta)&&c.apply(this,[b,d,-1]);return!1});c.apply(this,[a.Event(),0])})};a.fn.spinbox.defaults={min:0,max:null,step:1,bigStep:10,keys:[/[0-9]/,9,13,8,46,33,34,37,38,39,40,109,188,190],ignore:"[readonly],[disabled]",
spinboxClass:"spinbox-active",upClass:"spinbox-up",downClass:"spinbox-down",upHoverClass:"spinbox-up-hover",downHoverClass:"spinbox-down-hover",mousewheel:!0,change:!0,increment:function(a,b,c,g,h){return a+b},decrement:function(a,b,c,g,h){return a-b},reset:null,delay:500,repeat:100,buttonWidth:20,scale:!0,round:function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)}}})(jQuery);(function(a){a.fn.popup=function(){return a(this).each(function(a,c){HTMLHelper.createPopup(c)})}})(jQuery);(function(a,b,c){function d(d,f){function g(b){a(h).each(function(){var c=a(this);this===b.target||c.has(b.target).length||c.triggerHandler(f,[b.target])})}f=f||d+c;var h=a(),k=d+"."+f+"-special-event";a.event.special[f]={setup:function(){h=h.add(this);delete h.prevObject;1===h.length&&a(b).bind(k,g)},teardown:function(){h=h.not(this);delete h.prevObject;0===h.length&&a(b).unbind(k)},add:function(a){var b=a.handler;a.handler=function(a,c){a.target=c;b.apply(this,arguments)}}}}"$:nomunge";a.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "),
function(a){d(a)});d("focusin","focus"+c);d("focusout","blur"+c);Modernizr.touch&&(d("touchstart","mousedown"+c),d("touchmove","mousemove"+c),d("touchend","mouseup"+c));a.addOutsideEvent=d})(jQuery,document,"outside");(function(a){a.fn.mousecapture=function(b){var c=a(document);this.each(function(){var d=a(this),e={};d.mousedown(function(a){var g;b.move&&(g=function(a){b.move.call(d,a,e)},c.mousemove(g));var h,k=function(){b.move&&c.unbind("mousemove",g);c.unbind("mouseup",h)};h=b.up?function(a){k();return b.up.call(d,a,e)}:k;c.mouseup(h);return b.down.call(d,a,e)})});return this}})(jQuery);(function(a){function b(a,b){if(!(1<a.originalEvent.touches.length)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null);a.target.dispatchEvent(d)}}a.support.touch="ontouchend"in document;if(a.support.touch){var c=a.ui.mouse.prototype,d=c._mouseInit,e=c._mouseDestroy,f;c._touchStart=function(a){!f&&this._mouseCapture(a.originalEvent.changedTouches[0])&&(f=!0,this._touchMoved=
!1,b(a,"mouseover"),b(a,"mousemove"),b(a,"mousedown"))};c._touchMove=function(a){f&&(this._touchMoved=!0,b(a,"mousemove"))};c._touchEnd=function(a){f&&(b(a,"mouseup"),b(a,"mouseout"),this._touchMoved||b(a,"click"),f=!1)};c._mouseInit=function(){this.element.bind({touchstart:a.proxy(this,"_touchStart"),touchmove:a.proxy(this,"_touchMove"),touchend:a.proxy(this,"_touchEnd")});d.call(this)};c._mouseDestroy=function(){this.element.unbind({touchstart:a.proxy(this,"_touchStart"),touchmove:a.proxy(this,
"_touchMove"),touchend:a.proxy(this,"_touchEnd")});e.call(this)}}})(jQuery);(function(){function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b=this._getEvents(),c,d;if(a instanceof RegExp)for(d in c={},b)b.hasOwnProperty(d)&&a.test(d)&&(c[d]=b[d]);else c=b[a]||(b[a]=[]);return c};d.flattenListeners=function(a){var b=[],c;for(c=0;c<a.length;c+=1)b.push(a[c].listener);return b};d.getListenersAsObject=
function(a){var b=this.getListeners(a),c;b instanceof Array&&(c={},c[a]=b);return c||b};d.addListener=function(a,c){var d=this.getListenersAsObject(a),e="object"===typeof c,f;for(f in d)d.hasOwnProperty(f)&&-1===b(d[f],c)&&d[f].push(e?c:{listener:c,once:!1});return this};d.on=c("addListener");d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})};d.once=c("addOnceListener");d.defineEvent=function(a){this.getListeners(a);return this};d.defineEvents=function(a){for(var b=0;b<
a.length;b+=1)this.defineEvent(a[b]);return this};d.removeListener=function(a,c){var d=this.getListenersAsObject(a),e,f;for(f in d)d.hasOwnProperty(f)&&(e=b(d[f],c),-1!==e&&d[f].splice(e,1));return this};d.off=c("removeListener");d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)};d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)};d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener;a=a?this.removeListeners:this.addListeners;
if("object"!==typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"===typeof e?f.call(this,d,e):a.call(this,d,e));return this};d.removeEvent=function(a){var b=typeof a,c=this._getEvents(),d;if("string"===b)delete c[a];else if(a instanceof RegExp)for(d in c)c.hasOwnProperty(d)&&a.test(d)&&delete c[d];else delete this._events;return this};d.removeAllListeners=c("removeEvent");d.emitEvent=function(a,b){var c=this.getListenersAsObject(a),
d,e,f,l;for(f in c)if(c.hasOwnProperty(f))for(e=c[f].length;e--;)d=c[f][e],!0===d.once&&this.removeListener(a,d.listener),l=d.listener.apply(this,b||[]),l===this._getOnceReturnValue()&&this.removeListener(a,d.listener);return this};d.trigger=c("emitEvent");d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)};d.setOnceReturnValue=function(a){this._onceReturnValue=a;return this};d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:
!0};d._getEvents=function(){return this._events||(this._events={})};a.noConflict=function(){e.EventEmitter=f;return a};"function"===typeof define&&define.amd?define(function(){return a}):"object"===typeof module&&module.exports?module.exports=a:this.EventEmitter=a}).call(this);var TradingView={className:function(a){for(var b in this)if(TradingView[b]===a)return b;return null}};TradingView.isRunningChartingLibrary=/localserver=1/i.test(window.location.search);TradingView.isMobileView=/mobile=1/i.test(window.location.search);TradingView.wrapUrl=function(a){TradingView.isRunningChartingLibrary&&(a=a.replace("/static/",""));return a};TradingView.RESOURCES_ROOT=TradingView.wrapUrl("/static/chart-client/css/");TradingView.THEME_RESOURCES_ROOT=TradingView.wrapUrl("/static/chart-client/css/images/");
TradingView.resourceFullPath=function(a){return TradingView.RESOURCES_ROOT+a};TradingView.themeResourceFullPath=function(a){return TradingView.THEME_RESOURCES_ROOT+a};
TradingView.isMobile=function(){var a=/Android/i.test(navigator.userAgent),b=/BlackBerry/i.test(navigator.userAgent),c=/iPhone|iPad|iPod/i.test(navigator.userAgent),d=/Opera Mini/i.test(navigator.userAgent),e=TradingView.winMobileMode,f=TradingView.isMobileView||a||b||c||d||e;return{Android:function(){return a},BlackBerry:function(){return b},iOS:function(){return c},Opera:function(){return d},Windows:function(){return e},any:function(){return f}}}();
TradingView.supportTouch=function(){return Modernizr.touch||TradingView.isMobile.any()};TradingView.onWidget=function(){return/widgetembed|widgetpopup/.test(window.location.pathname)};TradingView.availableTimezones=TradingView.availableTimezones||[{id:"UTC",title:"UTC"},{id:"EST",title:"EST"},{id:"CST",title:"CST"},{id:"PST",title:"PST"},{id:"exchange",title:"Exchange"}];TradingView.Base64={};TradingView.Base64._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";TradingView.Base64.decode=function(a){for(var b=[],c=0;c<a.length;){var d=this._keyStr.indexOf(a.charAt(c++)),e=this._keyStr.indexOf(a.charAt(c++)),f=this._keyStr.indexOf(a.charAt(c++)),g=this._keyStr.indexOf(a.charAt(c++)),h=(e&15)<<4|f>>2,k=(f&3)<<6|g;b.push(d<<2|e>>4);64!==f&&b.push(h);64!==g&&b.push(k)}return b};TradingView.guid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)})};TradingView.randomHash=function(){for(var a="",b=0;12>b;b++)var c=Math.round(60*Math.random()),a=a+"0123456789abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[c];return a};isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};function isInteger(a){return"number"===typeof a&&0===a%1}function isNumber(a){return"number"===typeof a&&isFinite(a)}function parseBool(a){return!0===a||"true"===a}function isBoolean(a){return!0===a||!1===a}function isString(a){return null===a||void 0===a?!1:a.constructor==String}function isFunction(a){return null===a||void 0===a?!1:a.constructor==Function}
function inherit(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.prototype.superclass=b}function declareClassAsPureInterface(a,b){for(var c in a.prototype)"function"===typeof a.prototype[c]&&a.prototype.hasOwnProperty(c)&&(a.prototype[c]=function(){throw b+"::"+c+" is an interface member declaration and must be overloaded in order to be called";})}
function requireFullInterfaceImplementation(a,b,c,d){for(var e in c.prototype)if("function"===typeof c.prototype[e]&&!a.prototype[e])throw"Interface implementation assertion failed: "+b+" does not implement "+d+"::"+e+" function";}function isInherited(a,b){if(a===b)return!0;if(a&&a.prototype)return void 0===a.prototype.superclass||null===a.prototype.superclass?!1:a.prototype.superclass===b?!0:isInherited(a.prototype.superclass,b);debugger;return!1}function TypeValidator(a){this.m_type=a}
TypeValidator.prototype.check=function(a){return a.constructor===this.m_type||isInherited(a.constructor,this.m_type)};function PredicateValidator(a){this.m_predicate=a}PredicateValidator.prototype.check=function(a){return this.m_predicate(a)};TradingView.clone=function(a){if(!a||"object"!==typeof a)return a;var b;b="function"===typeof a.pop?[]:{};var c,d;for(c in a)a.hasOwnProperty(c)&&(d=a[c],b[c]=d&&"object"===typeof d?TradingView.clone(d):d);return b};
TradingView.deepEquals=function(a,b,c){c||(c="");if(a===b)return[!0,c];isFunction(a)&&(a=void 0);isFunction(b)&&(b=void 0);if(void 0===a&&void 0!==b||void 0===b&&void 0!==a||null===a&&null!==b||null===b&&null!==a)return[!1,c];if(isString(a)&&isString(b))return[a===b,c];if(isArray(a)&&isArray(b)){var d=a.length;if(d!==b.length)return[!1,c];for(var e=0;e<d;e++)if(res=TradingView.deepEquals(a[e],b[e],c+"["+e+"]"),!res[0])return res}else{if(isArray(a)||isArray(b))return[!1,c];for(d in a)if(res=TradingView.deepEquals(a[d],
b[d],c+"["+d+"]"),!res[0])return res}return[!0,c]};TradingView.merge=function(a,b){for(var c in b)"object"===typeof b[c]&&a.hasOwnProperty(c)?TradingView.merge(a[c],b[c]):a[c]=b[c];return a};TradingView.mergeWithRules=function(a,b,c,d){for(var e in b){var f=d?d+"."+e:e;c&&f in c?a[e]=c[f](a[e],b[e]):"object"===typeof b[e]&&a.hasOwnProperty(e)?TradingView.merge(a[e],b[e],c,f):a[e]=b[e]}};
TradingView.sortMultipleFunction=function(){var a=[].slice.call(arguments),b=a.length;return function(c,d){var e,f,g,h,k;for(k=0;k<b&&(h=0,g=a[k],f="string"===typeof g?g:g.name,e=c[f],f=d[f],"function"===typeof g.fn&&(e=g.fn(e),f=g.fn(f)),g=g.reverse?-1:1,e<f&&(h=-1*g),e>f&&(h=1*g),0===h);k++);return h}};"undefined"!=typeof module&&module&&module.exports&&(module.exports={inherit:inherit,merge:TradingView.merge,isNumber:isNumber,isBoolean:isBoolean,isString:isString});function OrderedHash(a,b){this.array=[];for(var c in a)a[c].key=c,this.array.push(a[c]);this.rearrange(b)}OrderedHash.prototype.rearrange=function(a){if("function"!==typeof a)throw Error("sort param is not a function");return this.array.sort(a)};OrderedHash.byValue=function(a){return function(a,c){return a-c}};OrderedHash.byField=function(a){return function(b,c){if(b[a]>c[a])return 1;if(b[a]<c[a])return-1;if(b[a]==c[a])return 0}};
OrderedHash.byOrder=function(a){return function(b,c){var d=a.indexOf(b.key),e=a.indexOf(c.key);return d-e}};var HTMLHelper={};
(function(a){HTMLHelper.createLabel=function(b,c,d){return HTMLHelper.Element.create("label",a.extend(d,{html:c,"for":b}))};HTMLHelper.unbindContextMenu=function(a){a.contextMenu(function(a){return!1})};HTMLHelper.offsetX=function(a,c){return a.width()+c.pageX};HTMLHelper.offsetY=function(a,c){return a.height()+c.pageY};HTMLHelper.checkObjIsOutOfWindowX=function(b,c){var d=a(window).width()-HTMLHelper.offsetX(b,c);return 0>d?(d=c.pageX+d,0<d?d:0):c.pageX};HTMLHelper.checkObjIsOutOfWindowY=function(b,
c){var d=a(window).height()-HTMLHelper.offsetY(b,c);return 0>d?(d=c.pageY+d,0<d?d:0):c.pageY};HTMLHelper.checkObjIsOutOfWindow=function(a,c){return{left:HTMLHelper.checkObjIsOutOfWindowX(a,c),top:HTMLHelper.checkObjIsOutOfWindowY(a,c)}};HTMLHelper.setAttr=function(a,c,d){a.attr?a.attr(c,d):a[c]=d;return a};HTMLHelper.removeAttr=function(a,c){a.removeAttr?a.removeAttr(c):a.removeAttribute(c);return a};HTMLHelper.notNull=function(b){return-1==a.inArray(b,[null,void 0,"false","null","undefined",0])};
HTMLHelper.hideControl=function(a){return a.css({position:"absolute",top:-1E3,left:-1E3})};HTMLHelper.createPopup=function(a,c,d){return(new HTMLHelper.Popup(a,c,d)).render()};HTMLHelper.Popup=function(b,c,d){this.jqDiv=void 0!==b.selector?b:b.nodeType?a(b):HTMLHelper.Element.create("div",b);if(d){var e=this;a.each(d,function(a,b){e[a]=b})}TradingView.setMouseEventHandler(this.jqDiv,this);this._callback=c};HTMLHelper.Popup.prototype.render=function(){return this.jqDiv};HTMLHelper.Popup.prototype.show=
function(){this.jqDiv.show()};HTMLHelper.Popup.prototype.hide=function(){this.jqDiv.hide()};HTMLHelper.Popup.prototype.setVisible=function(a){a?this.show():this.hide()};HTMLHelper.Popup.prototype.isVisible=function(){return this.jqDiv.is(":visible")};HTMLHelper.Popup.prototype.contextMenuEvent=function(a){return!1};HTMLHelper.Popup.prototype.mouseDownOutsideEvent=function(a){!this.isVisible()||this._callback&&!this._callback()||this.hide()}})(jQuery);HTMLHelper.Element={};HTMLHelper.Element.renderAttributes=function(a){var b="";for(attr in a)a[attr]&&(b+=" "+attr+'="'+a[attr]+'"');return b};HTMLHelper.Element.create=function(a,b){var c=$(document.createElement(a));b&&(b.html&&(c.html(b.html),delete b.html),c.attr(b));return c};HTMLHelper.Element.validAttributes="abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear code codebase codetype color cols colspan compact content coords data datetime declare defer dir disabled enctype face for frame frameborder headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginheight marginwidth maxlength media method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseout onmouseover onmouseup onreset onselect onsubmit onunload profile prompt readonly rel rev rows rowspan rules scheme scope scrolling selected shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width".split(" ");
HTMLHelper.Element.validAttribute=function(a){return-1!=jQuery.inArray(a,HTMLHelper.Element.validAttributes)};HTMLHelper.Element.cleanAttributes=function(a){jQuery.each(a,function(b,c){HTMLHelper.Element.validAttribute(b)||delete a[b]});return a};HTMLHelper.CUSTOM_SELECT_MINIMAL_WIDTH=100;HTMLHelper.Input=function(a){this.jqObj=null;this.data=a;this.init();this._prepareValue();this._prepareCallback();this._prepareChildren();this._applyAttributes();return this.jqObj};HTMLHelper.Input.selectOptions={type:"option",value:null,html:null};HTMLHelper.Input.optionsData={radiogroup:{type:"radio",name:null,value:null,label:null},select:HTMLHelper.Input.selectOptions,"select-one":HTMLHelper.Input.selectOptions,"select-multiple":HTMLHelper.Input.selectOptions};
HTMLHelper.Input.customTypes=["radiogroup","fontpicker","colorpicker","combobox"];HTMLHelper.Input.prototype._tagIsInput=function(a){return-1!=jQuery.inArray(this.data.type,"text radio checkbox hidden reset image file".split(" "))};HTMLHelper.Input.prototype.init=function(){this._tagIsInput()?this.jqObj=HTMLHelper.Element.create("input",{name:this.data.name,type:this.data.type}):this.jqObj=HTMLHelper.Element.create(this.data.type,{name:this.data.name})};
HTMLHelper.Input.prototype._eventIsKeyUp=function(){return-1!=jQuery.inArray(this.data.type,["text","textarea"])};HTMLHelper.Input.prototype._eventIsClick=function(){return-1!=jQuery.inArray(this.data.type,["checkbox","radio","option"])};HTMLHelper.Input.prototype._eventIsChange=function(){return-1!=jQuery.inArray(this.data.type,["select","select-one","select-multiple","radiogroup"])};
HTMLHelper.Input.prototype._prepareCallback=function(){this.data.callback&&(this._eventIsKeyUp()?this.jqObj.keyup(this.data.callback):this._eventIsClick()?this.jqObj.click(this.data.callback):this._eventIsChange()&&this.jqObj.bind("change",this.data.callback),delete this.data.callback)};HTMLHelper.Input.prototype._childTag=function(){return{select:"option","select-one":"option","select-multiple":"option",radiogroup:"radio"}[this.data.type]};
HTMLHelper.Input.prototype._inheritedProperties=function(){var a={type:this._childTag()};"radiogroup"==this.data.type&&(a.name=this.data.name);return a};HTMLHelper.Input.prototype._extendChildProps=function(a){var b=jQuery.extend(this._inheritedProperties(),a);this.data.value==a.value&&(b.selected=!0);return b};HTMLHelper.Input.prototype._prepareChildren=function(){if(this.data.options){var a=this;jQuery.each(this.data.options,function(b,c){a.jqObj.append(new HTMLHelper.Input(a._extendChildProps(c)))})}};
HTMLHelper.Input.prototype.isCustom=function(){return-1!=jQuery.inArray(this.data.type,this.customTypes)};HTMLHelper.Input.prototype._isStoringValue=function(){return-1!=jQuery.inArray(this.data.type,["text","textarea","option","radio","checkbox"])};HTMLHelper.Input.prototype._htmlAsValue=function(){return"textarea"==this.data.type};HTMLHelper.Input.prototype._valAsValue=function(){return jQuery.inArray(this.data.type,"text checkbox radio option select select-one select-multiple".split(" "))};
HTMLHelper.Input.prototype._getControlValue=function(){return{checkbox:1}[this.data.type]||this.data.value};HTMLHelper.Input.prototype._setControlValue=function(){this._valAsValue()?this.jqObj.val(this._getControlValue()):this._htmlAsValue()&&this.jqObj.html(this.data.value)};HTMLHelper.Input.prototype._getCheckedAttr=function(){return{option:"selected",radio:"checked",checkbox:"checked"}[this.data.type]};
HTMLHelper.Input.prototype._setChecked=function(){this.data.selected&&this.jqObj.attr(this._getCheckedAttr(),!0)};HTMLHelper.Input.prototype._setValue=function(){this._setControlValue();HTMLHelper.Input.isCheckable(this.data.type)&&this._setChecked()};HTMLHelper.Input.prototype._prepareValue=function(){this._isStoringValue()&&this._setValue()};HTMLHelper.Input.prototype._applyAttributes=function(){this.jqObj.attr(HTMLHelper.Element.cleanAttributes(this.data))};
HTMLHelper.Input.value=function(a){return HTMLHelper.Input.controlCheckable(a)?a.checked:a.value};HTMLHelper.Input.isCheckable=function(a){return-1!=jQuery.inArray(a,["checkbox","radio","option"])};HTMLHelper.Input.controlType=function(a){if("string"==typeof a)return a;a=jQuery(a);var b=null;return a.attr("type")&&(b=a.attr("type"),jQuery.inArray(b,"textarea text select select-one select-multiple submit".split(" ")))?b:a.attr("tagName")};HTMLHelper.Input.controlCheckable=function(a){return HTMLHelper.Input.isCheckable(HTMLHelper.Input.controlType(a))};
HTMLHelper.Input.controlToggleChecked=function(a,b){return HTMLHelper.setAttr(a,"checked",b)};HTMLHelper.Input.controlSetValue=function(a,b){return HTMLHelper.Input.controlCheckable(a)?HTMLHelper.Input.controlToggleChecked(a,b):HTMLHelper.setAttr(a,"value",b)};HTMLHelper.Input.currentOption=function(a){return a.options[a.selectedIndex]};HTMLHelper.Input.currentOptionInnerHTML=function(a){return HTMLHelper.Input.currentOption(a).innerHTML};
HTMLHelper.ComboboxItem=function(a,b){this.value=a;this.html=b||"";this.jqItem=this._render()};HTMLHelper.ComboboxItem.prototype.eq=function(a){return this.value===a};HTMLHelper.ComboboxItem.prototype.width=function(a){return this.jqItem.width()};HTMLHelper.ComboboxItem.prototype._render=function(a){a=$("<span/>").append(this.html);return $('<div class="item"></div>').append(a)};HTMLHelper.ComboboxItem.prototype.render=function(a){return this.jqItem};
HTMLHelper.ComboboxItem.prototype.select=function(a){a?this.jqItem.addClass("selected"):this.jqItem.removeClass("selected")};HTMLHelper.ComboboxItem.prototype.selectAndReturnIfValueMatch=function(a){if(this.eq(a))return this.select(!0),this;this.select(!1);return null};HTMLHelper.Combobox=function(a){this._value=null;this.items=[];this.width=0;this.callback=this.jqItems=this.jqIcon=this.jqTitle=this.jqSwitcher=this.jqWrapper=null;this._init();this.addItems(a);this.joinParts()};
HTMLHelper.Combobox.prototype._init=function(){this._initWrapper();this._initSwitcher();this._initOptions()};HTMLHelper.Combobox.prototype._initTitle=function(){this.jqTitle=$('<span class="title" />')};HTMLHelper.Combobox.prototype._initIcon=function(){this.jqIcon=$('<span class="icon" />')};HTMLHelper.Combobox.prototype._initOptions=function(){this.jqItems=HTMLHelper.createPopup({"class":"items"})};
HTMLHelper.Combobox.prototype._initWrapper=function(){this.jqWrapper=$('<div class="custom-select" />');this.jqWrapper.data({disable:this.disable.bind(this),enable:this.enable.bind(this)})};HTMLHelper.Combobox.prototype._initSwitcher=function(){var a=this;this._initTitle();this._initIcon();this.jqSwitcher=$('<div class="switcher" />');this.jqSwitcher.append(this.jqTitle);this.jqSwitcher.append(this.jqIcon);this.jqSwitcher.click(function(b){a.toggleItems()})};
HTMLHelper.Combobox.prototype.toggleItems=function(){this.disabled()||this.jqItems.toggle()};HTMLHelper.Combobox.prototype.setWidth=function(){this.jqWrapper.width(this.width)};HTMLHelper.Combobox.prototype.joinParts=function(){this.jqWrapper.append(this.jqSwitcher);this.jqWrapper.append(this.jqItems);this.jqWrapper.selectable(!1)};HTMLHelper.Combobox.prototype.render=function(){return this.jqWrapper};
HTMLHelper.Combobox.prototype.selectItemByValue=function(a){var b=null;$(this.items).each(function(c,d){var e=d.selectAndReturnIfValueMatch(a);e&&(b=e)});return b};HTMLHelper.Combobox.prototype.setValue=function(a){if(this._value!=a){var b=this.selectItemByValue(a);this._value=a;this.jqTitle.html(b.html);this.change()}};HTMLHelper.Combobox.prototype.change=function(a){a?this.callback=a:this.callback&&this.callback.call(this)};HTMLHelper.Combobox.prototype.value=function(){return this._value};
HTMLHelper.Combobox.prototype.val=function(a){if(void 0!==a)this.setValue(a);else return this.value()};HTMLHelper.Combobox.prototype.addItems=function(a){var b=this;$(a).each(function(a,d){b.addItem(d.value,d.html)})};HTMLHelper.Combobox.prototype.addItem=function(a,b){var c=this,d=new HTMLHelper.ComboboxItem(a,b);this.items.push(d);d=d.render();d.click(function(){c.setValue(a);c.toggleItems()});this.jqItems.append(d);null===this.value()&&this.setValue(a)};
HTMLHelper.Combobox.prototype.disable=function(){this._disabled=!0};HTMLHelper.Combobox.prototype.enable=function(){this._disabled=!1};HTMLHelper.Combobox.prototype.disabled=function(){return this._disabled};function List(a){if(void 0==a)this.m_values=[];else if(isArray(a))this.m_values=a;else throw new TypeError("invalid values");this.m_validator=null}List.prototype.validator=function(){return this.m_validator};List.prototype.setValidator=function(a){this.m_validator=a};List.prototype.item=function(a){return this.m_values[a]};
List.prototype.setItem=function(a,b){if(!isInteger(a))throw new RangeError("incorrect index");if(0>a||a>=this.m_values.length)throw new RangeError("incorrect index");if(null!==this.m_validator&&!this.m_validator.check(b))throw new TypeError("value is of unexpected type");this.m_values[a]=b};List.prototype.first=function(){return this.item(0)};List.prototype.last=function(){return this.item(this.size()-1)};
List.prototype.append=function(a){if(null!==this.m_validator&&!this.m_validator.check(a))throw new TypeError("value is of unexpected type");this.m_values.push(a);return this};List.prototype.insert=function(a,b){if(!isInteger(b))throw new RangeError("invalid index:"+b);if(0>b||b>this.size())throw new RangeError("invalid index:"+b);this.m_values.splice(b,0,a)};
List.prototype.appendAll=function(a){if(!(new TypeValidator(List)).check(a))throw new TypeError("parameter must be of type List");for(var b=0;b<a.size();++b)this.m_values.push(a.item(b));return this};List.prototype.removeAt=function(a){if(!isInteger(a))throw new RangeError("incorrect index");if(0>a||a>=this.m_values.length)throw new RangeError("incorrect index");this.m_values.splice(a,1)};List.prototype.size=function(){return this.m_values.length};List.prototype.isEmpty=function(){return 0===this.size()};
List.prototype.indexOf=function(a){if(null!==this.m_validator&&!this.m_validator.check(a))throw new TypeError("value is of unexpected type");return this.m_values.indexOf(a)};List.prototype.contains=function(a){return-1!=this.indexOf(a)};List.prototype.remove=function(a){if(null!==this.m_validator&&!this.m_validator.check(a))throw new TypeError("value is of unexpected type");a=this.indexOf(a);-1!==a&&this.removeAt(a)};List.prototype.removeAll=function(a){this.m_values=this.m_values.filter(function(b){return!a(b)})};
List.prototype.clear=function(){this.m_values=[]};List.prototype.clone=function(){var a=new List;a.setValidator(this.validator());a.m_values=this.m_values.slice();return a};List.prototype.toArray=function(){return this.m_values};List.prototype.sort=function(a){this.m_values.sort(a)};List.prototype.find=function(a){for(var b=0;b<this.m_values.length;b++)if(a(this.m_values[b],b,this.m_values))return this.m_values[b]};
List.prototype.count=function(a){for(var b=0,c=0;c<this.m_values.length;c++)a(this.m_values[c],c,this.m_values)&&b++;return b};var MathEx={lessThan:function(a,b){return a<=b},greaterThan:function(a,b){return a>=b},clamp:function(a,b,c){return Math.min(Math.max(a,b),c)},sign:function(a){return 0>a?-1:0<a?1:0},isBaseDecimal:function(a){if(0>a)return TradingView.logDebug("MathEx.isBaseDecimal: argument less zero"),!1;for(;1<a;a/=10)if(0!==a%10)return!1;return!0},greaterOrEqual:function(a,b,c){return b-a<=c},equal:function(a,b,c){return Math.abs(a-b)<c},log10:function(a){if(0>=a)TradingView.logDebug("MathEx.log10: argument less or equal zero");
else return Math.log(a)/Math.log(10)},defComparator:function(a,b){return a<b?-1:a>b?1:0},min:function(a,b){if(!isArray(a))throw"argument is not array";if(1>a.length)throw"array is empty";b||(b=MathEx.defComparator);for(var c=a[0],d=0;d<a.length;++d)0>b(a[d],c)&&(c=a[d]);return c},max:function(a,b){if(!isArray(a))throw"argument is not array";if(1>a.length)throw"array is empty";b||(b=MathEx.defComparator);for(var c=a[0],d=0;d<a.length;++d)0<b(a[d],c)&&(c=a[d]);return c},Point:function(a,b){this.x=a;
this.y=b}};MathEx.Point.prototype.add=function(a){return new MathEx.Point(this.x+a.x,this.y+a.y)};MathEx.Point.prototype.addScaled=function(a,b){return new MathEx.Point(this.x+b*a.x,this.y+b*a.y)};MathEx.Point.prototype.substract=function(a){return new MathEx.Point(this.x-a.x,this.y-a.y)};MathEx.Point.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};MathEx.Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};
MathEx.Point.prototype.scaled=function(a){return new MathEx.Point(this.x*a,this.y*a)};MathEx.Point.prototype.normalized=function(){return this.scaled(1/this.length())};MathEx.Point.prototype.transponed=function(){return new MathEx.Point(-this.y,this.x)};MathEx.Point.prototype.clone=function(){return new MathEx.Point(this.x,this.y)};MathEx.Matrix=function(){this._rows=[[1,0,0],[0,1,0],[0,0,1]]};
MathEx.Matrix.prototype.mult=function(a){if(a instanceof MathEx.Matrix){for(var b=new MathEx.Matrix,c=0;3>c;c++)for(var d=0;3>d;d++)for(var e=b._rows[c][d]=0;3>e;e++)b._rows[c][d]+=this._rows[c][e]*a._rows[e][d];return b}if(a instanceof MathEx.Point){a=[a.x,a.y,1];b=[0,0,0];for(c=0;3>c;c++)for(d=0;3>d;d++)b[c]+=a[d]*this._rows[c][d];return new MathEx.Point(b[0],b[1])}throw"unsupported type";};
MathEx.Matrix.rotate=function(a){var b=new MathEx.Matrix;b._rows[0][0]=Math.cos(a);b._rows[1][1]=Math.cos(a);b._rows[0][1]=-Math.sin(a);b._rows[1][0]=Math.sin(a);return b};MathEx.Matrix.scale=function(a,b){var c=new MathEx.Matrix;c._rows[0][0]=a;c._rows[1][1]=b;return c};MathEx.Matrix.translate=function(a,b){var c=new MathEx.Matrix;c._rows[0][2]=a;c._rows[1][2]=b;return c};
MathEx.distanceToLine=function(a,b,c){b=b.substract(a);var d=c.substract(a).dotProduct(b)/b.dotProduct(b);return{distance:a.addScaled(b,d).substract(c).length(),coeff:d}};MathEx.distanceToSegment=function(a,b,c){var d=MathEx.distanceToLine(a,b,c);if(0<=d.coeff&&1>=d.coeff)return d;a=a.substract(c).length();b=b.substract(c).length();return a<b?{distance:a,coeff:0}:{distance:b,coeff:1}};
MathEx.intersectLines=function(a,b,c,d){b=b.substract(a);d=d.substract(c);b=b.x*d.y-b.y*d.x;if(1E-6>Math.abs(b))return null;a=a.substract(c);return(a.y*d.x-a.x*d.y)/b};MathEx.intersectSegment=function(a,b,c,d){var e=MathEx.intersectLines(a,b,c,d);if(null===e)return null;a=b.substract(a).scaled(e).add(a);c=MathEx.distanceToSegment(c,d,a);return 1E-6>Math.abs(c.distance)?e:null};MathEx.pointInRect=function(a,b,c){return a.x>=b.x&&a.x<=c.x&&a.y>=b.y&&a.y<=c.y};
MathEx.pointInTriangle=function(a,b,c,d){var e=a.add(b).scaled(0.5).add(c).scaled(0.5),f=MathEx.intersectSegment(a,b,e,d);if(null!==f)return!1;f=MathEx.intersectSegment(b,c,e,d);if(null!==f)return!1;f=MathEx.intersectSegment(c,a,e,d);return null!==f?!1:!0};
MathEx.intersectRayWithRect=function(a,b,c,d){var e=MathEx.intersectLines(a,b,c,new MathEx.Point(d.x,c.y)),f=MathEx.intersectLines(a,b,new MathEx.Point(d.x,c.y),d),g=MathEx.intersectLines(a,b,d,new MathEx.Point(c.x,d.y)),h=MathEx.intersectLines(a,b,new MathEx.Point(c.x,d.y),c),k=[];e&&0<=e&&k.push(e);f&&0<=f&&k.push(f);g&&0<=g&&k.push(g);h&&0<=h&&k.push(h);if(0===k.length)return null;k.sort(function(a,b){return a-b});c=MathEx.pointInRect(a,c,d)?k[0]:k[k.length-1];return a.addScaled(b.substract(a),
c)};MathEx.isInPolygon=function(a,b){for(var c=0,d=a.size()-1,e=!1,f=b.x,g=b.y,c=0;c<a.size();c++){var h=a.item(c),d=a.item(d);(h.y<g&&d.y>=g||d.y<g&&h.y>=g)&&h.x+(g-h.y)/(d.y-h.y)*(d.x-h.x)<f&&(e=!e);d=c}return e};MathEx.isInCircle=function(a,b,c){a=(c.x-a.x)*(c.x-a.x)+(c.y-a.y)*(c.y-a.y);radiusQ=b*b;return a<=radiusQ};
MathEx.optionalCorner=function(a,b,c,d){return a.x!=b.x?0==Math.round(a.x)||0==Math.round(b.x)?0==Math.round(a.y)||0==Math.round(b.y)?new MathEx.Point(0,0):new MathEx.Point(0,d):0==Math.round(a.y)||0==Math.round(b.y)?new MathEx.Point(c,0):new MathEx.Point(c,d):null};CanvasEx={LINESTYLE_SOLID:0,LINESTYLE_DOTTED:1,LINESTYLE_DASHED:2,LINESTYLE_LARGE_DASHED:3,TEXTPOS_TOPLEFT:0,TEXTPOS_TOPCENTER:1,TEXTPOS_TOPRIGHT:2,TEXTPOS_MIDDLELEFT:3,TEXTPOS_MIDDLECENTER:4,TEXTPOS_MIDDLERIGHT:5,TEXTPOS_BOTTOMLEFT:6,TEXTPOS_BOTTOMCENTER:7,TEXTPOS_BOTTOMRIGHT:8,MARKLOC_ABOVEBAR:"AboveBar",MARKLOC_BELOWBAR:"BelowBar",MARKLOC_TOP:"Top",MARKLOC_BOTTOM:"Bottom",MARKLOC_ABSOLUTE:"Absolute",MARKLOC_ABSOLUTEUP:"AbsoluteUp",MARKLOC_ABSOLUTEDOWN:"AbsoluteDown",HHISTLOC_RELATIVE:"relative",
HHISTLOC_ABSOLUTE:"absolute",HHISTDIR_LEFTTORIGHT:"left_to_right",HHISTDIR_RIGHTTOLEFT:"right_to_left"};function generateColor(a,b){if(0<=b&&100>=b){var c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(3,2),16),e=parseInt(a.substr(5,2),16);return"rgba("+c+", "+d+", "+e+", "+(1-b/100).toFixed(2)+")"}throw"invalid transparency";}CanvasEx.computeDashPattern=function(a){return[[a.lineWidth,2*a.lineWidth],[3*a.lineWidth,2*a.lineWidth],[6*a.lineWidth,6*a.lineWidth]][a.lineStyle-1]};
CanvasEx.drawLine=function(a,b,c,d,e){isFinite(b)&&isFinite(d)&&isFinite(c)&&isFinite(e)&&(a.lineStyle===CanvasEx.LINESTYLE_DASHED||a.lineStyle===CanvasEx.LINESTYLE_DOTTED?a.drawDashedLine(a,b,c,d,e):CanvasEx.drawSolidLine(a,b,c,d,e))};CanvasEx.drawSolidLine=function(a,b,c,d,e){a.beginPath();a.moveTo(b,c);a.lineTo(d,e);a.stroke()};
CanvasEx.setLineStyle=function(a,b){a.lineStyle=b;if(b!=CanvasEx.LINESTYLE_SOLID){var c=CanvasEx.computeDashPattern(a);"function"==typeof a.setLineDash?a.setLineDash(c):void 0!==a.mozDash?a.mozDash=c:void 0!==a.webkitLineDash&&(a.webkitLineDash=c)}};CanvasEx.drawPoly=function(a,b,c){a.beginPath();a.moveTo(b[0].x,b[0].y);for(var d=0;d<b.length;d++){var e=b[d];a.lineTo(e.x,e.y)}a.closePath();a.stroke();c&&a.fill()};CanvasEx.lineStyles=[];
"undefined"!==typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.lineStyle=CanvasEx.LINESTYLE_SOLID,CanvasEx.originalSave=CanvasRenderingContext2D.prototype.save,CanvasEx.originalRestore=CanvasRenderingContext2D.prototype.restore,CanvasRenderingContext2D.prototype.save=function(){CanvasEx.lineStyles.push(this.lineStyle);CanvasEx.originalSave.call(this)},CanvasRenderingContext2D.prototype.restore=function(){0<CanvasEx.lineStyles.length&&(this.lineStyle=CanvasEx.lineStyles.pop(),CanvasEx.originalRestore.call(this))},
CanvasRenderingContext2D.prototype.drawDashedLine=function(a,b,c,d,e){a.save();var f=CanvasEx.computeDashPattern(a);a.beginPath();if("function"==typeof a.setLineDash)a.setLineDash(f);else if(void 0!==a.mozDash)a.mozDash=f;else if(void 0!==a.webkitLineDash)a.webkitLineDash=f;else{a.dashedLineTo(b,c,d,e,f);a.stroke();a.restore();return}a.moveTo(b,c);a.lineTo(d,e);a.stroke();a.restore()},CanvasRenderingContext2D.prototype.dashedLineTo=function(a,b,c,d,e){var f={thereYet:MathEx.greaterThan,cap:Math.min},
g={thereYet:MathEx.greaterThan,cap:Math.min};0<b-d&&(g.thereYet=MathEx.lessThan,g.cap=Math.max);0<a-c&&(f.thereYet=MathEx.lessThan,f.cap=Math.max);this.moveTo(a,b);for(var h=a,k=b,m=0,n=!0;!f.thereYet(h,c)||!g.thereYet(k,d);){var q=Math.atan2(d-b,c-a),l=e[m],h=f.cap(c,h+Math.cos(q)*l),k=g.cap(d,k+Math.sin(q)*l);n?this.lineTo(h,k):this.moveTo(h,k);m=(m+1)%e.length;n=!n}},CanvasRenderingContext2D.prototype.roundRect=function(a,b,c,d,e){this.beginPath();this.moveTo(a+e,b);this.lineTo(a+c-e,b);this.arcTo(a+
c,b,a+c,b+e,e);this.lineTo(a+c,b+d-e);this.arcTo(a+c,b+d,a+c-e,b+d,e);this.lineTo(a+e,b+d);this.arcTo(a,b+d,a,b+d-e,e);this.lineTo(a,b+e);this.arcTo(a,b,a+e,b,e)});function makeFont(a,b,c){return c+" "+a+"px "+b};String.prototype.left=function(a){if(!isInteger(a))throw"invalid length";if(a>this.length)throw"invalid length";return this.substring(0,a)};String.prototype.right=function(a){if(!isInteger(a))throw"invalid length";if(a>this.length)throw"invalid length";return this.substring(this.length-a,this.length)};String.prototype.trimmed=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")};String.prototype.startsWith=function(a){return a.length>this.length?!1:this.left(a.length)===a};function Delegate(){this._listeners=new List}Delegate.prototype.subscribe=function(a,b,c){this._listeners.append({object:a,member:b,singleshot:!!c})};Delegate.prototype.unsubscribe=function(a,b){for(var c=0;c<this._listeners.size();++c){var d=this._listeners.item(c);if(d.object===a&&d.member.prototype===b.prototype){this._listeners.removeAt(c);break}}};
Delegate.prototype.fire=function(a){for(var b=$.extend(!0,{},this._listeners),c=0;c<b.size();++c){var d=b.item(c);d.object?d.member.call(d.object,a):d.member(a)}this._listeners.removeAll(function(a){return a.singleshot})};/*
Use it if you like it
*/
function RGBColor(a){this.ok=!1;"#"==a.charAt(0)&&(a=a.substr(1,6));a=a.replace(/ /g,"");a=a.toLowerCase();var b={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",
darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",
gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",
lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",
oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",
slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},c;for(c in b)a==c&&(a=b[c]);b=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,
example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}];for(c=0;c<b.length;c++){var d=b[c].process,e=b[c].re.exec(a);e&&(channels=d(e),this.r=channels[0],this.g=channels[1],this.b=channels[2],this.ok=!0)}this.cleanupRGB=function(){this.r=0>this.r||isNaN(this.r)?0:255<this.r?255:this.r;this.g=
0>this.g||isNaN(this.g)?0:255<this.g?255:this.g;this.b=0>this.b||isNaN(this.b)?0:255<this.b?255:this.b};this.cleanupRGB();this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var a=this.r.toString(16),b=this.g.toString(16),c=this.b.toString(16);1==a.length&&(a="0"+a);1==b.length&&(b="0"+b);1==c.length&&(c="0"+c);return"#"+a+b+c};this.grayChannel=function(){var a=[0.199,0.687,0.114];return a[0]*this.r+a[1]*this.g+a[2]*this.b};this.blackWhiteContrast=function(){return 150>
this.grayChannel()?"white":"black"};this.darken=function(a){var b=TradingView.rgbToHsl(this.r,this.g,this.b);a=TradingView.hslToRgb(b[0],b[1],b[2]-a/100);this.r=a[0];this.g=a[1];this.b=a[2];this.cleanupRGB();return this}}TradingView.rgbToHsl=function(a,b,c){a/=255;b/=255;c/=255;var d=Math.max(a,b,c),e=Math.min(a,b,c),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=0.5<g?h/(2-d-e):h/(d+e);switch(d){case a:f=(b-c)/h+(b<c?6:0);break;case b:f=(c-a)/h+2;break;case c:f=(a-b)/h+4}f/=6}return[f,e,g]};
TradingView.hslToRgb=function(a,b,c){if(0===b)c=b=a=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*c:0.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a},e=0.5>c?c*(1+b):c+b-c*b,f=2*c-e;c=d(f,e,a+1/3);b=d(f,e,a);a=d(f,e,a-1/3)}return[Math.round(255*c),Math.round(255*b),Math.round(255*a)]};function PixelSet(a,b,c){this._rawData=a?a:Array(4*b*c);this._width=b;this._height=c}PixelSet.prototype.rawData=function(){return this._rawData};PixelSet.prototype.width=function(){return this._width};PixelSet.prototype.height=function(){return this._height};PixelSet.prototype.pixel=function(a,b){var c=[],d=4*b*this._width+4*a;c.push(this._rawData[d]);c.push(this._rawData[d+1]);c.push(this._rawData[d+2]);c.push(this._rawData[d+3]);return c};
PixelSet.prototype.setPixel=function(a,b,c){a=4*b*this._width+4*a;this._rawData[a]=c[0];this._rawData[a+1]=c[1];this._rawData[a+2]=c[2];this._rawData[a+3]=c[3]};
PixelSet.prototype.blend=function(a,b,c,d,e,f,g){d||(d=this.width());e||(e=this.height());f||(f=0);g||(g=0);for(var h=a.getImageData(b,c,d,e),k=0;k<d;k++)for(var m=0;m<e;m++){var n=4*m*d+4*k,q=this.pixel(f+k,g+m),l=q[1],s=q[2],u=1-q[3]/255;h.data[n]=h.data[n]*u+q[0]*(1-u);h.data[n+1]=h.data[n+1]*u+l*(1-u);h.data[n+2]=h.data[n+2]*u+s*(1-u);h.data[n+3]=Math.max(q[3],h.data[n+3])}a.putImageData(h,b,c)};TradingView.getImage=function(a,b){var c=document.body,d=c[a];d||(d=document.createElement("img"),d.src=b,c[a]=d);return d};TradingView.SymbolParser=function(){function a(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;return a}function b(){}function c(a){this.value=a}function d(){}function e(){}function f(){}function g(){}function h(){}function k(){}function m(){}function n(a){this.value=a}function q(a){this.value=a}function l(a){this.value=a}function s(){n.apply(this,arguments)}function u(){q.apply(this,arguments)}function z(a,b){var d=[],e;a:for(;e=H.exec(a);){for(var f=w.length;f--;)if(void 0!==e[f+
1]){w[f].ctor&&(f=new w[f].ctor(e[f+1]),f._offset=e.index,d.push(f));continue a}f=new l(e[0]);f._offset=e.index;d.push(f)}if(b&&b.recover)for(var g,f=d.length;f--;)e=d[f],e instanceof q||e instanceof n?(void 0!==g&&(e=new n(""),g=d.splice(f,g-f+1,e),e.value=g.map(function(a){return a.value}).join("")),g=f):e instanceof c||(g=void 0);return d}function t(a){for(var b=[],d=0;d<a.length;d++)a[d]instanceof c||b.push(a[d]);return b}function B(a){a=t(a);for(var b=[],c=[],g=0;g<a.length;g++){var h=a[g];if(h instanceof
f)c.length&&c[c.length-1].minPrecedence>h.precedence&&(c[c.length-1].minPrecedence=h.precedence);else if(h instanceof d)c.push({minPrecedence:Infinity,openBraceIndex:g});else if(h instanceof e){var h=c.pop(),k=a[h.openBraceIndex-1],l=a[g+1];l instanceof f&&!(l.precedence<=h.minPrecedence)||k instanceof f&&!(k.precedence<h.minPrecedence||k.precedence===h.minPrecedence&&k.commutative)||(b.unshift(h.openBraceIndex),b.push(g),c.length&&c[c.length-1].minPrecedence>h.minPrecedence&&(c[c.length-1].minPrecedence=
h.minPrecedence))}}for(g=b.length;g--;)a.splice(b[g],1);return a}function A(a){for(var b=0,g=0,h,k=0;k<a.length;k++){var l=a[k];if(!(l instanceof c))switch(b){case 0:if(l instanceof q&&1===+l.value)b=1;else return!1;break;case 1:if(1===b&&l instanceof m)b=2,h=k+1;else return!1;break;case 2:if(l instanceof d)b=3,g=1;else if(l instanceof f)return!1;break;case 3:l instanceof d?g++:l instanceof e&&(g--,0>=g&&(b=2))}}return a.slice(h)}var w=[{pattern:"(",ctor:d},{pattern:")",ctor:e},{pattern:"+",ctor:g},
{pattern:"-",ctor:h},{pattern:"*",ctor:k},{pattern:"/",ctor:m},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:\.&]))|\.\d+/,ctor:q},{pattern:/\./,ctor:u},{pattern:TradingView.isRunningChartingLibrary?/[a-zA-Z0-9_\u4e00-\u9fa5^][a-zA-Z0-9_\u4e00-\u9fa5_!:\.&]*|'.+?'/:/[a-zA-Z0-9][a-zA-Z0-9_!|:\.&]*|'.+?'/,ctor:n},{pattern:/'[^']*/,ctor:s},{pattern:/[\0-\x20\s,]+/,ctor:c}];b.prototype.toString=function(){return this.value};a(c,b);a(d,b);d.prototype.value="(";a(e,b);e.prototype.value=")";a(f,b);a(g,f);g.prototype.value=
"+";g.prototype.precedence=0;g.prototype.commutative=!0;a(h,f);h.prototype.value="-";h.prototype.precedence=0;h.prototype.commutative=!1;a(k,f);k.prototype.value="*";k.prototype.precedence=1;k.prototype.commutative=!0;a(m,f);m.prototype.value="/";m.prototype.precedence=1;m.prototype.commutative=!1;var v=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,C=/[\+\-\/\*]/;a(n,b);n.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var a=C.test(this._ticker)?"'":"";return a+(this._exchange?this._exchange+
":":"")+this._ticker+a}return this.value};n.prototype.parse=function(){var a=v.exec(this.value);a[1]&&(this._exchange=a[1]);this._ticker=a[2]};n.prototype.exchange=function(a){this.hasOwnProperty("_ticker")||this.parse();if(0<arguments.length)null===a||void 0===a?delete this._exchange:this._exchange=a+"";else return this._exchange};n.prototype.ticker=function(a){this.hasOwnProperty("_ticker")||this.parse();if(0<arguments.length)null===a||void 0===a?delete this._ticker:this._ticker=a+"";else return this._ticker};
a(q,b);q.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value};q.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")};l.prototype.toString=function(){return this.value};a(s,n);s.prototype.isIncomplete=!0;s.prototype.incompleteSuggest=function(){if("'"!==this.value)return new String("'")};a(u,q);u.prototype.isIncomplete=!0;var H=RegExp(w.map(function(a){return"("+
("string"===typeof a.pattern?a.pattern.replace(/[\^\$\(\)\[\]\{\}\*\+\?\|\\]/g,"\\$&"):a.pattern.source)+")"}).concat(".").join("|"),"g");return{tokenize:z,validate:function(a){if(TradingView.isRunningChartingLibrary)return{currentState:"var"};for(var b="init",g={warnings:[],errors:[],isEmpty:!0},h=[],k=0;k<a.length;k++){var m=a[k];if(!(m instanceof c)){delete g.isEmpty;if(m.isIncomplete){var A={status:"incomplete",reason:"incomplete_token",offset:m._offset,token:m};m.incompleteSuggest&&(A.recover=
{append:m.incompleteSuggest()});g.warnings.push(A);if(k!==a.length-1){A.status="error";continue}}m instanceof n||m instanceof q?"var"==b?g.errors.push({status:"error",reason:"unexpected_token",offset:m._offset,token:m}):b="var":m instanceof f?"var"!=b?g.errors.push({status:"error",reason:"unexpected_token",offset:m._offset,token:m}):b="operator":m instanceof d?"var"==b?g.errors.push({status:"error",reason:"unexpected_token",offset:m._offset,token:m}):(h.push(m),b="init"):m instanceof e?"var"!=b?g.errors.push({status:"error",
reason:"unexpected_token",offset:m._offset,token:m}):(h.pop()||g.errors.push({status:"error",reason:"unbalanced_brace",offset:m._offset,token:m,recover:{prepend:new d}}),b="var"):m instanceof l&&g.errors.push({status:"error",reason:"unparsed_entity",offset:m._offset,token:m})}}g.braceBalance=h.length;for("var"!==b&&g.warnings.push({status:"incomplete"});h.length;)m=h.pop(),A={status:"incomplete",reason:"unbalanced_brace",offset:m._offset,token:m},"var"==b&&(A.recover={append:new e}),g.warnings.push(A);
g.currentState=b;0===g.warnings.length&&delete g.warnings;0===g.errors.length&&delete g.errors;return g},factorOutBraces:B,normalizeTokens:function(a){for(var b=0;b<a.length;b++)a[b].parse&&a[b].parse();return a},flip:function(a){var b=A(a);return b?B(b):B([new q("1"),new m,new d].concat(a).concat(new e))},hasBatsSymbols:function(a){if("string"===typeof a)a=z(a);else if(!Array.isArray(a))throw new TypeError("expression must be a string or token array");return a.some(function(a){return a instanceof
n&&"BATS"===(a.exchange()||"").toUpperCase()?!0:!1})},hasEodSymbols:function(a){if("string"===typeof a)a=z(a);else if(!Array.isArray(a))throw new TypeError("expression must be a string or token array");return a.some(function(a){return a instanceof n&&-1!==(a.exchange()||"").toUpperCase().indexOf("_EOD")?!0:!1})},SymbolToken:n,IncompleteSymbolToken:s,NumberToken:q,BinaryOperatorToken:f,OpenBraceToken:d,CloseBraceToken:e,ticker:function(a){return(new n(a)).ticker()},shortName:function(a){if("string"!==
typeof a)throw new TypeError("expression must be a string");a=B(t(z(a)));a.forEach(function(a){a instanceof n&&a.exchange(null)});return a.join("")},normalize:function(a){if("string"!==typeof a)throw new TypeError("expression must be a string");return B(t(z(a))).join("")}}}();function ReadonlyWatchedValue(){}function WatchedValue(a){if(!(this instanceof WatchedValue))return new WatchedValue(a);0<arguments.length&&(this._value=a);this._listeners=[]}WatchedValue.prototype.value=function(){return this._owner?this._owner._value:this._value};
WatchedValue.prototype.setValue=function(a){var b=this._owner?this._owner:this;"function"===typeof b.hook&&(a=b.hook(a));if(b.writeLock)return b._value;if(b._value===a&&b.hasOwnProperty("_value"))return a;b._value=a;for(var c=b._listeners.slice(),d=0,e=0;e<c.length;e++)c[e].once&&(b._listeners.splice(e-d,1),d++),c[e].cb(a);return a};
WatchedValue.prototype.deleteValue=function(){var a=this._owner?this._owner:this;if(a.hasOwnProperty("_value")){if(a.writeLock)return a._value;delete a._value;for(var b=a._listeners.slice(),c=0;c<b.length;c++)b[c].once&&a._listeners.splice(c-deletedEntries,1);for(c=0;c<b.length;c++)b[c].cb()}};
WatchedValue.prototype.subscribe=function(a,b){if("function"!==typeof a)throw new TypeError("callback must be a function");var c=!!b&&!!b.once,d=this._owner?this._owner:this;if(b&&b.callWithLast&&d.hasOwnProperty("_value")&&(a(d._value),c))return;d._listeners.push({cb:a,owner:this,once:!!b&&!!b.once})};
WatchedValue.prototype.unsubscribe=function(a){var b=this._owner?this._owner:this;void 0===a&&(a=null);for(var c=b._listeners,d=c.length;d--;)c[d].owner!==this&&b!==this||c[d].cb!==a&&null!==a||c.splice(d,1)};WatchedValue.prototype.readonly=function(){if(this._readonlyInstance)return this._readonlyInstance;var a=this._readonlyInstance=new ReadonlyWatchedValue;a.subscribe=this.subscribe.bind(this);a.unsubscribe=this.unsubscribe.bind(this);a.value=this.value.bind(this);a.when=this.when.bind(this);return a};
WatchedValue.prototype.spawn=function(){var a=new WatchedValue;delete a._listeners;a._owner=this._owner||this;a.destroy=function(){this.unsubscribe();delete this._owner};return a};WatchedValue.prototype.when=function(a){var b=this;if(this.value())a();else{var c=function(d){d&&(b.unsubscribe(c),a())};b.subscribe(c)}};WEB_SOCKET_SWF_LOCATION=TradingView.resourceFullPath("web_socket_main.swf");WEB_SOCKET_WAS_CONNECTED=WEB_SOCKET_DEBUG=!1;STUDY_COUNT_LIMIT=100;function HandlerInfo(a,b){this.handler=a;this.customId=b;this.requestHook=null}function ChartApiInterface(){}ChartApiInterface.prototype.availableTimeFrames=function(a,b){};ChartApiInterface.prototype.defaultResolutions=function(){};ChartApiInterface.prototype.supportedSymbolsTypes=function(){};ChartApiInterface.prototype.supportedExchangesList=function(){};
ChartApiInterface.prototype.setAuthToken=function(a,b){};ChartApiInterface.prototype.authTokenRequired=function(a){};ChartApiInterface.prototype.quoteCreateSession=function(a){};ChartApiInterface.prototype.quoteDeleteSession=function(a){};ChartApiInterface.prototype.quoteAddSymbols=function(a,b){};ChartApiInterface.prototype.quoteRemoveSymbols=function(a,b){};ChartApiInterface.prototype.quoteListFields=function(a){};ChartApiInterface.prototype.quoteFireTick=function(a,b){};
ChartApiInterface.prototype.quoteFastSymbols=function(a,b){};ChartApiInterface.prototype.depthCreateSession=function(a,b,c){};ChartApiInterface.prototype.depthDeleteSession=function(a){};ChartApiInterface.prototype.depthSetSymbol=function(a,b){};ChartApiInterface.prototype.depthClearSymbol=function(a){};ChartApiInterface.prototype.depthSetScale=function(a,b){};ChartApiInterface.prototype.chartCreateSession=function(a,b){};ChartApiInterface.prototype.chartDeleteSession=function(a){};
ChartApiInterface.prototype.createSession=function(a,b){};ChartApiInterface.prototype.removeSession=function(a){};ChartApiInterface.prototype.connected=function(){};ChartApiInterface.prototype._getHost=function(a){};ChartApiInterface.prototype.connect=function(){};ChartApiInterface.prototype.setFields=function(a,b){};ChartApiInterface.prototype.disconnect=function(){};ChartApiInterface.prototype.switchTimezone=function(a,b){};ChartApiInterface.prototype.resolveSymbol=function(a,b,c,d,e){};
ChartApiInterface.prototype.createSeries=function(a,b,c,d,e,f,g){};ChartApiInterface.prototype.removeSeries=function(a,b,c){};ChartApiInterface.prototype.modifySeries=function(a,b,c,d,e,f){};ChartApiInterface.prototype.requestMoreData=function(a,b,c,d){};ChartApiInterface.prototype.requestMetadata=function(a,b,c){};ChartApiInterface.prototype.isCanCreateStudy=function(){};ChartApiInterface.prototype.createStudy=function(a,b,c,d,e,f,g){};ChartApiInterface.prototype.removeStudy=function(a,b,c){};
ChartApiInterface.prototype.modifyStudy=function(a,b,c,d,e){};ChartApiInterface.prototype.createPointset=function(a,b,c,d,e,f,g){};ChartApiInterface.prototype.modifyPointset=function(a,b,c,d,e){};ChartApiInterface.prototype.removePointset=function(a,b,c){};ChartApiInterface.prototype.requestMoreTickmarks=function(a,b,c,d){};ChartApiInterface.prototype.requestFirstBarTime=function(a,b,c,d){};ChartApiInterface.prototype._invokeHandler=function(a,b){};
ChartApiInterface.prototype._sendRequest=function(a,b){};ChartApiInterface.prototype._onMessage=function(a){};ChartApiInterface.prototype._convertTimescaleResponse=function(a){};ChartApiInterface.prototype._dispathNotification=function(a){};ChartApiInterface.prototype._invokeNotificationHandler=function(a,b,c){};ChartApiInterface.prototype._notifySessions=function(a){};ChartApiInterface.prototype.unpack=function(a){};ChartApiInterface.prototype.reconnectTimeout=function(a){};
ChartApiInterface.prototype.searchSymbolsByName=function(a){};ChartApiInterface.prototype._isSafari5=function(){};ChartApiInterface.prototype._isIE9=function(){};ChartApiInterface.prototype._isIOS5=function(){};ChartApiInterface.prototype._getPort=function(a){};ChartApiInterface.prototype.getMarks=function(a,b,c,d,e){};declareClassAsPureInterface(ChartApiInterface,"ChartApiInterface");function ChartSession(a,b){this._chartApi=a;this._sessionid="cs_"+TradingView.randomHash();this._sessionDisabled=!1;this._disableStatistics=!!b}ChartSession.prototype.connected=function(){return this._chartApi.connected()&&!this._sessionDisabled};ChartSession.prototype.disconnected=function(){var a=this;Object.keys(this).forEach(function(b){/^(s|st|symbol_)\d+$/.test(b)&&delete a[b]})};ChartSession.prototype.initSession=function(){this._chartApi.createSession(this._sessionid,this)};
ChartSession.prototype.stopSession=function(){this._chartApi.removeSession(this._sessionid)};ChartSession.prototype.setHandler=function(a){this._globalHandler=a};ChartSession.prototype.connect=function(a){this._globalHandler=a;this.initSession();this._chartApi.connect()};ChartSession.prototype.disconnect=function(){this._chartApi.disconnect()};ChartSession.prototype.switchTimezone=function(a){this._chartApi.switchTimezone(this._sessionid,a)};
ChartSession.prototype.resolveSymbol=function(a,b,c){this._chartApi.resolveSymbol(this._sessionid,a,b,c)};ChartSession.prototype.createSeries=function(a,b,c,d,e,f){this._chartApi.createSeries(this._sessionid,a,b,c,d,e,f)};ChartSession.prototype.removeSeries=function(a,b){this._chartApi.removeSeries(this._sessionid,a,b)};ChartSession.prototype.modifySeries=function(a,b,c,d,e){this._chartApi.modifySeries(this._sessionid,a,b,c,d,e)};
ChartSession.prototype.requestMoreData=function(a,b,c){this._chartApi.requestMoreData(this._sessionid,a,b,c)};ChartSession.prototype.requestMetadata=function(a,b){this._chartApi.requestMetadata(this._sessionid,a,b)};ChartSession.prototype.createStudy=function(a,b,c,d,e,f){this._chartApi.createStudy(this._sessionid,a,b,c,d,e,f)};ChartSession.prototype.removeStudy=function(a,b){this._chartApi.removeStudy(this._sessionid,a,b)};
ChartSession.prototype.modifyStudy=function(a,b,c,d){this._chartApi.modifyStudy(this._sessionid,a,b,c,d)};ChartSession.prototype.createPointset=function(a,b,c,d,e,f){this._chartApi.createPointset(this._sessionid,a,b,c,d,e,f)};ChartSession.prototype.modifyPointset=function(a,b,c,d){this._chartApi.modifyPointset(this._sessionid,a,b,c,d)};ChartSession.prototype.removePointset=function(a,b){this._chartApi.removePointset(this._sessionid,a,b)};
ChartSession.prototype.requestMoreTickmarks=function(a,b,c){this._chartApi.requestMoreTickmarks(this._sessionid,a,b,c)};ChartSession.prototype.requestFirstBarTime=function(a,b,c){this._chartApi.requestFirstBarTime(this._sessionid,a,b,c)};ChartSession.prototype.onMessage=function(a){switch(a.method){case "connected":this._chartApi.chartCreateSession(this._sessionid,this._disableStatistics);break;case "disconnected":this.disconnected()}this._globalHandler&&this._globalHandler(a)};
ChartSession.prototype.disable=function(){this._sessionDisabled=!0};function TimeIndexes(){this._zoffset=0;this._items=[];this._lastTimePointIndex=null}TimeIndexes.prototype.clear=function(){this._zoffset=0;this._items=[];this._lastTimePointIndex=null};TimeIndexes.prototype.items=function(){return this._items};TimeIndexes.prototype.size=function(){return this._items.length};TimeIndexes.prototype.firstTimePointIndex=function(){return this.offsetToIndex(0)};
TimeIndexes.prototype.lastTimePointIndex=function(){return null!==this._lastTimePointIndex&&void 0!==this._lastTimePointIndex?this._lastTimePointIndex:this._lastTimePointIndex=this.offsetToIndex(this.size()-1)};
TimeIndexes.prototype.merge=function(a,b,c){if(0===this._items.length)return this._items=c,this._zoffset=b,[{change:"rebuild",index:0}];var d=a+this._zoffset;if(0>d){d=Math.abs(d);this._items=Array(d).concat(this._items);this._zoffset=b;for(var e=0;e<c.length;++e)this._items[a+e+b]=c[e];return[{change:"rebuild",index:0}]}a=[];for(e=d;e<this._items.length&&e-d<c.length;++e)this._items[e]=c[e-d],a.push({change:"update",index:e-this._zoffset,value:c[e-d]});d+=c.length;if(d>this._items.length)for(d-=
this._items.length,e=0;e<d;++e){var f=this._items.length;this._items.push(c[e]);a.push({change:"append",index:f-this._zoffset,value:c[e]})}this._zoffset=b;this._lastTimePointIndex=null;return a};TimeIndexes.prototype.addTail=function(a,b){for(var c=b?1:0;c<a.length;c++)this._items.push(a[c]),this._lastTimePointIndex++};TimeIndexes.prototype.valueAt=function(a){a=this.indexToOffset(a);if(void 0!==a)return this._items[a]};
TimeIndexes.prototype.indexOf=function(a,b){for(var c=0;c<this._items.length&&!(a<this._items[c]);++c)if(!(a>this._items[c]))return this.offsetToIndex(c);return b?this.offsetToIndex(c):void 0};TimeIndexes.prototype.offsetToIndex=function(a){if(0<=a&&a<this.size())return a-this._zoffset};TimeIndexes.prototype.indexToOffset=function(a){a+=this._zoffset;if(0<=a&&a<this.size())return a};TimeIndexes.prototype.state=function(){var a={};a.zoffset=this._zoffset;a.items=this._items;return a};
TimeIndexes.prototype.restoreState=function(a){a&&(this._zoffset=a.zoffset,this._items=a.items,this._lastTimePointIndex=null)};TimeIndexes.prototype.closestIndexLeft=function(a){var b=this._items;if(b.length&&a===a){var c=b.length-1;if(a>=b[c])return c-this._zoffset;var d=0,e=b[d];if(!(a<e)){if(a==e)return d-this._zoffset;for(;c>d+1;){var e=d+c>>1,f=b[e];if(f>a)c=e;else if(f<a)d=e;else{if(f===a)return e-this._zoffset;return}}return d-this._zoffset}}};function PlotList(a){this._items=[];this._columns=a?a:[];this._end=this._start=0;this._shareread=!1}PlotList.prototype.clear=function(){this._items=[];this._columns=[];this._end=this._start=0;this._shareread=!1};PlotList.prototype.columns=function(){return this._columns};PlotList.prototype.last=function(){return this._items[this._end-this._start-1]};PlotList.prototype.first=function(){return this._items[0]};PlotList.prototype.firstIndex=function(){return this._start};
PlotList.prototype.lastIndex=function(){return this._end-this._start-1};PlotList.prototype.size=function(){return this._end-this._start};PlotList.prototype.isEmpty=function(){return 0===this.size()};PlotList.prototype.contains=function(a){return-1!=this._search(a)};PlotList.prototype.valueAt=function(a){if(a=this.search(a))return a.value};
PlotList.prototype.add=function(a,b){if(this._shareread)return TradingView.logDebug("PlotList.add: readonly collection modification attempt"),!1;var c=this._createPair(a,b),d=this._search(a);if(0>d)return d=this._lowerbound(a,-1),this._items.splice(d,0,c),this._start=0,this._end=this._items.length,!0;this._items[d]=c;return!1};var SEARCH_NEAREST_LEFT=-1,SEARCH_EXACT=0,SEARCH_NEAREST_RIGHT=1;PlotList.prototype.search=function(a,b){var c=this._search(a,b);return 0>c?void 0:{index:this._indexAt(c),value:this._valueAt(c)}};
PlotList.prototype.fold=function(a,b){for(var c=b,d=this._start;d<this._end;++d)c=a(this._indexAt(d),this._valueAt(d),c);return c};PlotList.prototype.each=function(a){for(var b=this._start;b<this._end&&!a(this._indexAt(b),this._valueAt(b));++b);};PlotList.prototype.range=function(a,b){var c=new PlotList;c._items=this._items;c._start=this._lowerbound(a);c._end=Math.min(this._lowerbound(b)+1,c._items.length);c._items[c._end-1]>b&&(c._end=c._start);c._shareread=!0;return c};
PlotList.prototype.merge=function(a){if(this._shareread)return TradingView.logDebug("PlotList.merge: shared collection modification attempt"),[];for(var b=[],c=0;c<a.length;++c){var d=a[c];this.add(d.index,d.value)?b.push({insert:d}):b.push({update:d})}return b};PlotList.prototype.addTail=function(a,b){var c=0;b&&0<this._end-this._start&&(c=1,this._items[this._end-this._start-1].value=a[0].value);for(;c<a.length;++c){var d=a[c];this.add(parseInt(this.last(),10)+1,d.value)}};
PlotList.prototype._createPair=function(a,b){var c=new Number(a);c.value=b;return c};PlotList.prototype._valueAt=function(a){return this._items[a].value};PlotList.prototype._length=function(a){return this._items.length};PlotList.prototype._indexAt=function(a){return this._items[a].valueOf()};
PlotList.prototype._search=function(a,b){var c=this._bsearch(a);if(-1!=c||!b)return c;if(0>b)return c=this._lowerbound(a),c>this._start&&(c-=1),c!=this._end&&this._indexAt(c)<a?c:-1;c=this._upperbound(a);return c!=this._end&&a<this._indexAt(c)?c:-1};PlotList.prototype._bsearch=function(a){var b=this._lowerbound(a);return b==this._end||a<this._items[b]?-1:b};PlotList.prototype._lowerbound=function(a){for(var b=this._start,c=this._end-b;0<c;){var d=c>>1,e=b+d;this._items[e]<a?(b=e+1,c-=d+1):c=d}return b};
PlotList.prototype._upperbound=function(a){for(var b=this._start,c=this._end-b;0<c;){var d=c>>1,e=b+d;a<this._items[e]?c=d:(b=e+1,c-=d+1)}return b};PlotList.prototype.state=function(){var a={};a.columns=this._columns;a.start=this._start;a.end=this._end;a.shareread=this._shareread;a.data=[];for(var b in this._items)a.data.push({index:new Number(this._items[b]),value:this._items[b].value});return a};
PlotList.prototype.restoreState=function(a){if(a){this._columns=a.columns;this._start=a.start;this._end=a.end;this._shareread=a.shareread;this._items=[];for(var b=0;b<a.data.length;b++){var c=new Number(a.data[b].index);c.value=a.data[b].value;this._items.push(c)}}else this.clear()};PlotList.prototype.firstTimeIndex=function(){return this._indexAt(this._start)};PlotList.prototype.lastTimeIndex=function(){return this._indexAt(this._end-1)};function StudyMetaInfo(a){TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}});TradingView.merge(this,a);TradingView.merge(this,StudyMetaInfo.parseIdString(a.id));this.name=this.id}StudyMetaInfo.CURRENT_METAINFO_FORMAT_VERSION=23;StudyMetaInfo.FilledArea={};StudyMetaInfo.FilledArea.TYPE_PLOTS="plot_plot";StudyMetaInfo.FilledArea.TYPE_HLINES="hline_hline";
StudyMetaInfo.versionOf=function(a){a="_metainfoVersion"in a&&isNumber(a._metainfoVersion)?a._metainfoVersion:0;(0>a||a>StudyMetaInfo.CURRENT_METAINFO_FORMAT_VERSION)&&console.warn("Client doesn't support this version of metainfo format: "+a);return a};
StudyMetaInfo.parseIdString=function(a){var b={};if(-1==a.indexOf("@"))b.shortId=a,b.id=a+"@tv-basicstudies",b.version=1;else{var c=a.split("@");b.shortId=c[0];c=c[1].split("-");if(3===c.length)b.id=b.shortId+"@"+c.slice(0,2).join("-"),b.version=c[2];else if(1===c.length&&"decisionbar"===c[0])b.id=b.shortId+"@les-"+c[0],b.version=1;else if(1===c.length)b.id=b.shortId+"@tv-"+c[0],b.version=1;else throw Error("unexpected study id:"+a);}b.fullId=b.id+"-"+b.version;return b};
StudyMetaInfo.cutDollarHash=function(a){var b=a.indexOf("$"),c=a.indexOf("@");if(-1==b)return a;b=a.substr(0,b);a=0<=c?a.substr(c):"";return b+a};StudyMetaInfo.prototype.parseValue=function(a,b){return"bool"===a?parseBool(b):b};StudyMetaInfo.prototype.defaultInputs=function(){for(var a=new List,b=0;b<this.inputs.length;b++)a.append(this.inputs[b].defval);return a};
StudyMetaInfo.prototype.state=function(){var a={},b;for(b in this)this.hasOwnProperty(b)&&(a[b]=this[b],"id"===b&&(a[b]+="-"+this.version));return a};StudyMetaInfo.findStudyMetaInfoByDescription=function(a,b){if(a){for(var c=0;c<a.size();++c)if(a.item(c).description===b)return a.item(c);throw Error("unexpected study id:"+b);}throw Error("There is no studies metainfo");};
StudyMetaInfo.findStudyMetaInfo=function(a,b){if(a){for(var c=0;c<a.size();++c)if(a.item(c).id===b)return a.item(c);throw Error("unexpected study id:"+b);}throw Error("There is no studies metainfo");};StudyMetaInfo.removeStudyMetaInfo=function(a,b){if(a){for(var c=0;c<a.size();++c)if(a.item(c).id===b)return a.removeAt(c),defaults.remove("study_"+b),!0;return!1}throw Error("There is no studies metainfo");};
StudyMetaInfo.addStudyMetaInfo=function(a,b){var c=new StudyMetaInfo(b);assert(!1===StudyMetaInfo.removeStudyMetaInfo(a,c.id),"Study with id="+b.id+" already exists in the model");a.append(c);if(b.defaults){var d=TradingView.clone(b.defaults);d.precision="default";defaults.create("study_"+b.id,d)}return c};
StudyMetaInfo.addOrReplaceStudyMetaInfo=function(a,b){var c=new StudyMetaInfo(b);StudyMetaInfo.removeStudyMetaInfo(a,c.id);a.append(c);if(b.defaults){var d=TradingView.clone(b.defaults);d.precision="default";defaults.createOrReplace("study_"+b.id,d)}return c};StudyMetaInfo.sortStudiesMetainfo=function(a){a.sort(function(a,c){var d=defaults("study_"+a.id).description,e=defaults("study_"+c.id).description;return d<e?-1:d>e?1:0})};
StudyMetaInfo.setStudyHidden=function(a,b){if(!a)throw Error("There is no studies metainfo");for(var c=0;c<a.size();++c)if(a.item(c).id===b)return a.is_hidden_study=!0;return!1};
StudyMetaInfo.createMetaInfoStub=function(a,b){var c=a.scriptIdPart||TVScript.MetainfoGenerator.createScriptIdPart();return{id:TVScript.MetainfoGenerator.createScriptStudyId(a.scriptIdPart,b),scriptIdPart:a.scriptIdPart,description:a.scriptName,TVScriptSourceCode:a.scriptSource,version:b,_buildFullMetaInfo:function(){return(new TVScript.TvsTranslator).translate(a.scriptSource,!0,null,c,b).metaInfo}}};
StudyMetaInfo.replaceWithFullStudyMetaInfo=function(a,b){if(b._buildFullMetaInfo){try{var c=b._buildFullMetaInfo()}catch(d){c=TradingView.ScriptLib.createScriptStub(b.TVScriptSourceCode,b.scriptIdPart,b.version)}return StudyMetaInfo.addOrReplaceStudyMetaInfo(a,c)}return b};"undefined"!=typeof module&&module&&module.exports&&(module.exports=StudyMetaInfo);TradingView.drawingState=function(){function a(a){return"cursor"===a||"arrow"===a||"dot"===a}var b=null,c=null,d=null,e=new WatchedValue,f=new WatchedValue,g=!1;return{tool:e,cursorTool:f,toolIsCursor:a,resetToCursor:function(a){!a&&b&&b.stayInDrawingMode.value()||this.tool.setValue(this.cursorTool.value())},init:function(){g||(e.setValue(TVSettings.getValue("chart.cursorPreference","cursor")),e.subscribe(function(b){a(b)&&f.setValue(b)},{callWithLast:!0}),f.subscribe(function(a){a&&TVSettings.setValue("chart.cursorPreference",
a)}),b=new DefaultProperty("drawings"),c=new Property,d=new Property,c.setValue(!1),d.setValue(!1),g=!0)},properties:function(){return b},hideAllDrawings:function(){return c},lockDrawings:function(){return d}}}();function HitTestResult(a,b,c){this._result=a;this._data=b;this._eraseMarker=c}HitTestResult.REGULAR=1;HitTestResult.MOVEPOINT=2;HitTestResult.CHANGEPOINT=3;HitTestResult.prototype.result=function(){return this._result};HitTestResult.prototype.data=function(){return this._data};HitTestResult.prototype.eraseMarker=function(){return this._eraseMarker};function DataSource(){this._zorder=0;this.m_priceScale=null;this._id=TradingView.guid();this._ownerSource=null;this._userEditEnabled=!0}DataSource.prototype.id=function(){return this._id};DataSource.prototype.setId=function(a){this._id=a};DataSource.prototype.zorder=function(){return this._zorder};DataSource.prototype.setZorder=function(a){this._zorder=a};DataSource.prototype.priceScale=function(){return this.m_priceScale};DataSource.prototype.setPriceScale=function(a){this.m_priceScale=a};
DataSource.prototype.ownerSource=function(){return this._ownerSource};DataSource.prototype.setOwnerSource=function(a){(this._ownerSource=a)&&this.setPriceScale(a.priceScale())};DataSource.prototype.isSavedInStudyTemplates=function(){return!0};DataSource.prototype.isRemovedByStudyTemplates=function(){return!0};DataSource.prototype.hasContextMenu=function(){return!0};DataSource.prototype.showInObjectTree=function(){return!0};
DataSource.prototype.setUserEditEnabled=function(a){this._userEditEnabled=a};DataSource.prototype.userEditEnabled=function(){return this._userEditEnabled};DataSource.prototype.isUserDeletable=function(){return this.userEditEnabled()};function PriceDataSource(){DataSource.call(this);this._isOverlay=null}inherit(PriceDataSource,DataSource);PriceDataSource.prototype.isNoScale=function(){return!!this._isOverlay};function Property(a){this._listeners=new Delegate;this._childs=[];if(void 0!==a&&null!==a)if(this.isPrimitiveType(a))this._value=a;else for(var b in a)this.addProperty(b,a[b])}Property.prototype.merge=function(a){if(null!=a)if(this.isPrimitiveType(a))this._value=a;else if(isArray(a))for(var b=0;b<a.length;b++)this[b]?this[b].merge(a[b]):this.addProperty(b,a[b]);else for(b in a)this[b]?this[b].merge(a[b]):this.addProperty(b,a[b])};
Property.prototype.state=function(a){var b=this._value;void 0===b&&(b={});for(var c=0;c<this._childs.length;c++){var d=this._childs[c];if(!a||-1===a.indexOf(d))if(a){for(var e=[],f=0;f<a.length;f++){var g=a[f];g.startsWith(d+".")&&e.push(g.substr(d.length+1))}b[d]=this[d].state(e)}else b[d]=this[d].state()}return b};Property.prototype.isPrimitiveType=function(a){return isNumber(a)||(new TypeValidator(String)).check(a)||isBoolean(a)?!0:!1};Property.prototype.value=function(){return this._value};
Property.prototype.listeners=function(){return this._listeners};Property.prototype.childCount=function(){return this._childs.length};Property.prototype.setValue=function(a){this._value!==a&&(this._value=a,this._listeners.fire(this))};Property.prototype.addProperty=function(a,b){var c=new Property(b);this[a]=c;this._childs.push(a);c.listeners().subscribe(this,Property.prototype.childChanged)};
Property.prototype.addChild=function(a,b){this[a]=b;-1==$.inArray(a,this._childs)&&this._childs.push(a);b.listeners().subscribe(this,Property.prototype.childChanged)};Property.prototype.childChanged=function(a,b){this.listeners().fire(this)};Property.prototype.subscribe=function(a,b){this.listeners().subscribe(a,b)};Property.prototype.unsubscribe=function(a,b){this.listeners().unsubscribe(a,b)};
function DefaultProperty(a,b,c){this._defaultName=a;c?c=b:(c=TradingView.clone(defaults(a)),b&&TradingView.merge(c,b));Property.call(this,c);this._defaultName=a;this.listeners().subscribe(this,DefaultProperty.prototype.onPropertyChanged);this._exclusions=[]}inherit(DefaultProperty,Property);DefaultProperty._saveDefaults=!1;TradingView.saveDefaultProperties=function(a){DefaultProperty._saveDefaults=a};DefaultProperty.prototype.addExclusion=function(a){this._exclusions.push(a)};
DefaultProperty.prototype.restoreFactoryDefaults=function(){var a={};this._defaultName.startsWith("study_")&&(a=TradingView.clone(factoryDefaults("study")));var b=TradingView.clone(factoryDefaults(this._defaultName));this._defaultName.startsWith("study_")&&b.inputs&&delete b.inputs.symbol;"linetoolicon"===this._defaultName&&(b.icon=defaults(this._defaultName).icon);TradingView.merge(a,b);this.merge(a);saveDefaults(this._defaultName,this.state(this._exclusions));this.listeners().fire(this)};
DefaultProperty.prototype.cleanupFactoryDefaults=function(){saveDefaults(this._defaultName,{});this.listeners().fire(this)};DefaultProperty.prototype.onPropertyChanged=function(){DefaultProperty._saveDefaults&&this.saveDefaults()};DefaultProperty.prototype.saveDefaults=function(){saveDefaults(this._defaultName,this.state(this._exclusions))};function factoryDefaults(a){if("undefined"==typeof defaultProperties){defaultProperties={chartproperties:{timezone:"UTC",timeScale:{barSpacing:DEFAULT_BAR_SPACING,rightOffset:DEFAULT_RIGHT_OFFSET},dataWindowProperties:{background:"#FFFECE",border:"#606090",font:"Verdana",fontBold:!1,fontItalic:!1,fontSize:10,transparency:80,visible:!0},paneProperties:{background:"#ffffff",gridProperties:{color:"#E6E6E6",style:CanvasEx.LINESTYLE_SOLID},crossHairProperties:{color:"#B7B7B7",style:CanvasEx.LINESTYLE_DASHED,
transparency:0,width:1},topMargin:5,bottomMargin:5,leftAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,showSymbolLabels:!1},rightAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,showSymbolLabels:!1},overlayPropreties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,showSymbolLabels:!1}},scalesProperties:{showLeftScale:!1,showRightScale:!0,
backgroundColor:"#ffffff",lineColor:"#555",textColor:"#555",scaleSeriesOnly:!1},mainSeriesProperties:{style:TradingView.Series.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdBreaksStyle:{color:"#E2745B",style:CanvasEx.LINESTYLE_DASHED,width:1},esdFlagSize:2,showCountdown:!0,showInDataWindow:!0,showLastValue:!0,visible:!0,silentIntervalChange:!1,showPriceLine:!0,priceLineWidth:1,lockScale:!1,minTick:"default",extendedHours:!1,sessVis:!1,candleStyle:{upColor:"#6ba583",
downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375"},haStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",
barColorsOnPrevClose:!1},barStyle:{upColor:"#6ba583",downColor:"#d75442",barColorsOnPrevClose:!1,dontDrawOpen:!1},lineStyle:{color:"#3C78D8",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:TradingView.Series.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"#606090",color2:"#01F6F5",linecolor:"#0094FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,
log:!1,logDisabled:!1},renkoStyle:{upColor:"#6ba583",downColor:"#d75442",borderUpColor:"#225437",borderDownColor:"#5b1a13",upColorProjection:"#4ad6be",downColorProjection:"#d649cf",borderUpColorProjection:"#225437",borderDownColorProjection:"#5b1a13",inputs:{source:"close",boxSize:3,style:"ATR",atrLength:14},inputInfo:{source:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR Length"}}},pbStyle:{upColor:"#6ba583",downColor:"#d75442",borderUpColor:"#225437",borderDownColor:"#5b1a13",
upColorProjection:"#4ad6be",downColorProjection:"#d649cf",borderUpColorProjection:"#225437",borderDownColorProjection:"#5b1a13",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:"#6ba583",downColor:"#d75442",upColorProjection:"#4ad6be",downColorProjection:"#d649cf",inputs:{source:"close",reversalAmount:1},inputInfo:{source:{name:"Source"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:"#6ba583",downColor:"#d75442",upColorProjection:"#4ad6be",
downColorProjection:"#d649cf",inputs:{sources:"HL",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR Length"}}}},symbolWatermarkProperties:{color:"#555",transparency:85}},drawings:{magnet:!1,stayInDrawingMode:!1,crossHairColor:"#B7B7B7",crossHairStyle:CanvasEx.LINESTYLE_DASHED,crossHairWidth:1},linetoolicon:{clonable:!0,color:"#3D85C6",snapTo45Degrees:!0,
size:40,icon:9786,angle:0.5*Math.PI,scale:1},linetooltrendline:{clonable:!0,linecolor:"#159980",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:LineDataSource.LINEEND_NORMAL,rightEnd:LineDataSource.LINEEND_NORMAL,font:"Verdana",textcolor:"#157760",fontsize:12,bold:!1,italic:!1,snapTo45Degrees:!0,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1},linetooltrendangle:{clonable:!0,linecolor:"#159980",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
snapTo45Degrees:!0,font:"Verdana",textcolor:"#157760",fontsize:12,bold:!0,italic:!1,showPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1},linetooldisjointangle:{clonable:!0,linecolor:"#129f5c",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"#6AA84F",transparency:50,extendLeft:!1,extendRight:!1,leftEnd:LineDataSource.LINEEND_NORMAL,rightEnd:LineDataSource.LINEEND_NORMAL,font:"Verdana",textcolor:"#129f5c",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,
showDateTimeRange:!1,showBarsRange:!1},linetoolflatbottom:{clonable:!0,linecolor:"#4985e7",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"#153899",transparency:50,extendLeft:!1,extendRight:!1,leftEnd:LineDataSource.LINEEND_NORMAL,rightEnd:LineDataSource.LINEEND_NORMAL,font:"Verdana",textcolor:"#4985e7",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolfibspiral:{clonable:!0,linecolor:"#159980",linewidth:1,
linestyle:CanvasEx.LINESTYLE_SOLID},linetooldaterange:{clonable:!0,linecolor:"#585858",linewidth:1,font:"Verdana",textcolor:"#FFFFFF",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",labelBackgroundTransparency:0,fillBackground:!0,backgroundColor:"#BADAFF",backgroundTransparency:60,drawBorder:!1,borderColor:"#667B8B"},linetoolpricerange:{clonable:!0,linecolor:"#585858",linewidth:1,font:"Verdana",textcolor:"#FFFFFF",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",
labelBackgroundTransparency:0,fillBackground:!0,backgroundColor:"#BADAFF",backgroundTransparency:60,drawBorder:!1,borderColor:"#667B8B"},linetoolriskrewardshort:{isShort:!0,clonable:!0,linecolor:"#585858",linewidth:1,font:"Verdana",textcolor:"white",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",labelBackgroundTransparency:0,fillBackground:!0,stopBackground:"#FF0000",profitBackground:"#00A000",stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667B8B"},
linetoolriskrewardlong:{isShort:!1,clonable:!0,linecolor:"#585858",linewidth:1,font:"Verdana",textcolor:"white",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",labelBackgroundTransparency:0,fillBackground:!0,stopBackground:"#FF0000",profitBackground:"#00A000",stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667B8B"},linetoolarrow:{clonable:!0,linecolor:"#6F88C6",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:LineDataSource.LINEEND_NORMAL,
rightEnd:LineDataSource.LINEEND_ARROW,font:"Verdana",textcolor:"#157760",fontsize:12,bold:!1,italic:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1},linetoolray:{clonable:!0,linecolor:"#159980",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!0,leftEnd:LineDataSource.LINEEND_NORMAL,rightEnd:LineDataSource.LINEEND_NORMAL,font:"Verdana",textcolor:"#157760",fontsize:12,bold:!1,italic:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1},
linetoolextended:{clonable:!0,linecolor:"#159980",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!0,extendRight:!0,leftEnd:LineDataSource.LINEEND_NORMAL,rightEnd:LineDataSource.LINEEND_NORMAL,font:"Verdana",textcolor:"#157760",fontsize:12,bold:!1,italic:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1},linetoolhorzline:{clonable:!0,linecolor:"#80CCDB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,text:"",font:"Verdana",textcolor:"#157760",
fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolhorzray:{clonable:!0,linecolor:"#80CCDB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,text:"",font:"Verdana",textcolor:"#157760",fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{clonable:!0,linecolor:"#80CCDB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showTime:!0},linetoolcirclelines:{clonable:!0,trendline:{visible:!0,color:"#808080",
linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},linecolor:"#80CCDB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",clonable:!0,baselinecolor:"#808080",linecolor:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showLabels:!0,font:"Verdana",fillBackground:!1,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:0},level2:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level3:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2},level4:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:3},level5:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:5},level6:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:8},level7:{visible:!0,color:"#0055DB",linewidth:1,
linestyle:CanvasEx.LINESTYLE_SOLID,coeff:13},level8:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:21},level9:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:34},level10:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:55},level11:{visible:!0,color:"#0055DB",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:89}},linetooltext:{clonable:!0,color:"#667B8B",text:$.t("Text"),font:"Verdana",fontsize:20,
fillBackground:!1,backgroundColor:"#9BBED5",backgroundTransparency:70,drawBorder:!1,borderColor:"#667B8B",bold:!1,italic:!1,locked:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:400},linetooltextabsolute:{clonable:!0,color:"#667B8B",text:$.t("Text"),font:"Verdana",fontsize:20,fillBackground:!1,backgroundColor:"#9BBED5",backgroundTransparency:70,drawBorder:!1,borderColor:"#667B8B",bold:!1,italic:!1,locked:!0,wordWrap:!1,wordWrapWidth:400},linetoolballoon:{clonable:!0,color:"#667b8b",backgroundColor:"#fffece",
borderColor:"#8c8c8c",fontWeight:"bold",fontsize:12,font:"Arial",transparency:30,text:$.t("Comment")},linetoolbrush:{clonable:!0,linecolor:"#353535",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,smooth:5,fillBackground:!1,backgroundColor:"#153899",transparency:50},linetoolpolyline:{clonable:!0,linecolor:"#353535",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"#153899",transparency:50,filled:!1},linetoolarrowmark:{clonable:!0,color:"#787878",text:"",fontsize:20,
font:"Verdana"},linetoolarrowmarkleft:{clonable:!0,color:"#787878",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkup:{clonable:!0,color:"#787878",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkright:{clonable:!0,color:"#787878",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkdown:{clonable:!0,color:"#787878",text:"",fontsize:20,font:"Verdana"},linetoolflagmark:{clonable:!0,color:"#ff0000"},linetoolthumbup:{clonable:!0,color:"#008000"},linetoolthumbdown:{clonable:!0,color:"#FF0000"},
linetoolpricelabel:{clonable:!0,color:"#667b8b",backgroundColor:"#ffffff",borderColor:"#8c8c8c",fontWeight:"bold",fontsize:11,font:"Arial",transparency:30},linetoolrectangle:{clonable:!0,color:"#153899",fillBackground:!0,backgroundColor:"#153899",transparency:50,linewidth:1,snapTo45Degrees:!0},linetoolrotatedrectangle:{clonable:!0,color:"#9800ff",fillBackground:!0,backgroundColor:"#8e7cc3",transparency:50,linewidth:1,snapTo45Degrees:!0},linetoolellipse:{clonable:!0,color:"#999915",fillBackground:!0,
backgroundColor:"#999915",transparency:50,linewidth:1},linetoolarc:{clonable:!0,color:"#999915",fillBackground:!0,backgroundColor:"#999915",transparency:50,linewidth:1},linetoolprediction:{linecolor:"#1c73db",linewidth:2,sourceBackColor:"#f1f1f1",sourceTextColor:"#6e6e6e",sourceStrokeColor:"#6e6e6e",targetStrokeColor:"#2fa8ff",targetBackColor:"#0b6fde",targetTextColor:"#ffffff",successBackground:"#36a02a",successTextColor:"#ffffff",failureBackground:"#e74545",failureTextColor:"#ffffff",intermediateBackColor:"#ead289",
intermediateTextColor:"#6d4d22",transparency:10,centersColor:"#202020"},linetooltriangle:{clonable:!0,color:"#991515",fillBackground:!0,backgroundColor:"#991515",transparency:50,linewidth:1},linetoolcallout:{clonable:!0,color:"#FFFFFF",backgroundColor:"#991515",transparency:50,linewidth:2,fontsize:12,font:"Verdana",text:$.t("Text"),bordercolor:"#991515",bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:400},linetoolparallelchannel:{clonable:!0,linecolor:"#773499",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:"#b4a7d6",transparency:50,showMidline:!1,midlinecolor:"#773499",midlinewidth:1,midlinestyle:CanvasEx.LINESTYLE_DASHED},linetoolelliottsubminuette:{clonable:!0,showWave:!0,color:"#3d85c6",wavesize:0,showBackground:!0},linetoolelliottminor:{clonable:!0,showWave:!0,color:"#ff9800",wavesize:3,showBackground:!0},linetoolelliottcircle:{clonable:!0,showWave:!0,color:"#6aa84f",wavesize:6,showBackground:!0},linetoolelliottminorretr:{clonable:!0,
showWave:!0,color:"#a64d79",wavesize:0,showBackground:!0},linetoolelliottmajorretr:{clonable:!0,showWave:!0,color:"#bf9000",wavesize:1,showBackground:!0},linetoolbarspattern:{color:"#5091CC",clonable:!0,mode:TradingView.LineToolBarsPattern.BARS_MODE,mirrored:!1,flipped:!1},study:{inputs:{},styles:{},palettes:{},bands:{},area:{},graphics:{},showInDataWindow:!0,showLastValue:!0,visible:!0,showStudyArguments:!0,precision:"default"},linetoolpitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:TradingView.LineToolPitchfork.STYLE_ORIGINAL,
median:{visible:!0,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:{visible:!1,color:"#A06B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.25},level1:{visible:!1,color:"#699E00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level2:{visible:!0,color:"#009B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level3:{visible:!1,color:"#009965",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level4:{visible:!1,color:"#006599",linewidth:1,
linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.75},level5:{visible:!0,color:"#000099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level6:{visible:!1,color:"#660099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.5},level7:{visible:!1,color:"#990066",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.75},level8:{visible:!1,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2}},linetoolpitchfan:{clonable:!0,fillBackground:!0,transparency:80,median:{visible:!0,color:"#A50000",
linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:{visible:!1,color:"#A06B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.25},level1:{visible:!1,color:"#699E00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level2:{visible:!0,color:"#009B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level3:{visible:!1,color:"#009965",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level4:{visible:!1,color:"#006599",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:0.75},level5:{visible:!0,color:"#000099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level6:{visible:!1,color:"#660099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.5},level7:{visible:!1,color:"#990066",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.75},level8:{visible:!1,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2}},linetoolgannfan:{clonable:!0,showLabels:!0,font:"Verdana",fillBackground:!0,transparency:80,level1:{visible:!0,color:"#A06B00",
linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:1,coeff2:8},level2:{visible:!0,color:"#699E00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:1,coeff2:4},level3:{visible:!0,color:"#009B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:1,coeff2:3},level4:{visible:!0,color:"#009965",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:1,coeff2:2},level5:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:1,coeff2:1},level6:{visible:!0,color:"#006599",
linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:2,coeff2:1},level7:{visible:!0,color:"#000099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:3,coeff2:1},level8:{visible:!0,color:"#660099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:4,coeff2:1},level9:{visible:!0,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff1:8,coeff2:1}},linetoolganncomplex:{clonable:!0,fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:50},levels:[{width:1,color:"#808080",
visible:!0},{width:1,color:"#A06B00",visible:!0},{width:1,color:"#699E00",visible:!0},{width:1,color:"#009B00",visible:!0},{width:1,color:"#009965",visible:!0},{width:1,color:"#808080",visible:!0}],fanlines:[{width:1,color:"#A500FF",visible:!1,x:8,y:1},{width:1,color:"#A50000",visible:!1,x:5,y:1},{width:1,color:"#808080",visible:!1,x:4,y:1},{width:1,color:"#A06B00",visible:!1,x:3,y:1},{width:1,color:"#699E00",visible:!0,x:2,y:1},{width:1,color:"#009B00",visible:!0,x:1,y:1},{width:1,color:"#009965",
visible:!0,x:1,y:2},{width:1,color:"#009965",visible:!1,x:1,y:3},{width:1,color:"#000099",visible:!1,x:1,y:4},{width:1,color:"#660099",visible:!1,x:1,y:5},{width:1,color:"#A500FF",visible:!1,x:1,y:8}],arcs:[{width:1,color:"#A06B00",visible:!0,x:1,y:0},{width:1,color:"#A06B00",visible:!0,x:1,y:1},{width:1,color:"#A06B00",visible:!0,x:1.5,y:0},{width:1,color:"#699E00",visible:!0,x:2,y:0},{width:1,color:"#699E00",visible:!0,x:2,y:1},{width:1,color:"#009B00",visible:!0,x:3,y:0},{width:1,color:"#009B00",
visible:!0,x:3,y:1},{width:1,color:"#009965",visible:!0,x:4,y:0},{width:1,color:"#009965",visible:!0,x:4,y:1},{width:1,color:"#000099",visible:!0,x:5,y:0},{width:1,color:"#000099",visible:!0,x:5,y:1}]},linetoolgannsquare:{clonable:!0,color:"#153899",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,font:"Verdana",showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,hlevel1:{color:"#808080",coeff:0,
visible:!0},hlevel2:{color:"#A06B00",coeff:0.25,visible:!0},hlevel3:{color:"#699E00",coeff:0.382,visible:!0},hlevel4:{color:"#009B00",coeff:0.5,visible:!0},hlevel5:{color:"#009965",coeff:0.618,visible:!0},hlevel6:{color:"#006599",coeff:0.75,visible:!0},hlevel7:{color:"#808080",coeff:1,visible:!0},vlevel1:{color:"#808080",coeff:0,visible:!0},vlevel2:{color:"#A06B00",coeff:0.25,visible:!0},vlevel3:{color:"#699E00",coeff:0.382,visible:!0},vlevel4:{color:"#009B00",coeff:0.5,visible:!0},vlevel5:{color:"#009965",
coeff:0.618,visible:!0},vlevel6:{color:"#006599",coeff:0.75,visible:!0},vlevel7:{color:"#808080",coeff:1,visible:!0}},linetoolfibspeedresistancefan:{clonable:!0,fillBackground:!0,transparency:80,grid:{color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,visible:!0},linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,font:"Verdana",showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,snapTo45Degrees:!0,hlevel1:{color:"#808080",coeff:0,visible:!0},hlevel2:{color:"#A06B00",
coeff:0.25,visible:!0},hlevel3:{color:"#699E00",coeff:0.382,visible:!0},hlevel4:{color:"#009B00",coeff:0.5,visible:!0},hlevel5:{color:"#009965",coeff:0.618,visible:!0},hlevel6:{color:"#006599",coeff:0.75,visible:!0},hlevel7:{color:"#808080",coeff:1,visible:!0},vlevel1:{color:"#808080",coeff:0,visible:!0},vlevel2:{color:"#A06B00",coeff:0.25,visible:!0},vlevel3:{color:"#699E00",coeff:0.382,visible:!0},vlevel4:{color:"#009B00",coeff:0.5,visible:!0},vlevel5:{color:"#009965",coeff:0.618,visible:!0},vlevel6:{color:"#006599",
coeff:0.75,visible:!0},vlevel7:{color:"#808080",coeff:1,visible:!0}},linetoolfibretracement:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLines:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0},level2:{visible:!0,color:"#CC2828",linewidth:1,
linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.236},level3:{visible:!0,color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level4:{visible:!0,color:"#28CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level5:{visible:!0,color:"#28CC95",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level6:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.764},level7:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:1},level8:{visible:!0,color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.618},level9:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.618},level10:{visible:!0,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:3.618},level11:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.236}},linetoolfibchannel:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,
extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,level1:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0},level2:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.236},level3:{visible:!0,color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level4:{visible:!0,color:"#28CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level5:{visible:!0,
color:"#28CC95",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level6:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.764},level7:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level8:{visible:!0,color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.618},level9:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.618},level10:{visible:!0,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:3.618},level11:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.236}},linetoolprojection:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,color1:"#008000",color2:"#FF0000",linewidth:1,trendline:{visible:!0,color:"#808080",linestyle:CanvasEx.LINESTYLE_SOLID},level1:{color:"#808080",visible:!0,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1}},linetool5pointspattern:{clonable:!0,color:"#CC2895",textcolor:"#FFFFFF",fillBackground:!0,
backgroundColor:"#CC2895",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetooltrianglepattern:{clonable:!0,color:"#9528FF",textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:"#9528CC",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetoolabcd:{clonable:!0,color:"#009B00",textcolor:"#FFFFFF",font:"Verdana",fontsize:12,bold:!1,italic:!1,linewidth:2},linetoolthreedrivers:{clonable:!0,color:"#9528FF",textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:"#9528CC",
font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolheadandshoulders:{clonable:!0,color:"#45682F",textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:"#45A82F",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolfibwedge:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:0.236},level2:{visible:!0,color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level3:{visible:!0,color:"#28CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level4:{visible:!0,color:"#28CC95",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level5:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.764},level6:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level7:{visible:!1,
color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.618},level8:{visible:!1,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.618},level9:{visible:!1,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:3.618},level10:{visible:!1,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.236},level11:{visible:!1,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.618}},linetoolfibcircles:{clonable:!0,showCoeffs:!0,
font:"Verdana",fillBackground:!0,transparency:80,snapTo45Degrees:!0,coeffsAsPercents:!1,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.236},level2:{visible:!0,color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level3:{visible:!0,color:"#28CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level4:{visible:!0,color:"#28CC95",linewidth:1,
linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level5:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.764},level6:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level7:{visible:!0,color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.618},level8:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.618},level9:{visible:!0,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:3.618},level10:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.236},level11:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.618}},linetoolfibspeedresistancearcs:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.236},level2:{visible:!0,
color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level3:{visible:!0,color:"#28CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level4:{visible:!0,color:"#28CC95",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level5:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.764},level6:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level7:{visible:!0,color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:1.618},level8:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.618},level9:{visible:!0,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:3.618},level10:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.236},level11:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.618}},linetooltrendbasedfibextension:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,
transparency:80,extendLines:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0},level2:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.236},level3:{visible:!0,color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level4:{visible:!0,color:"#28CC28",
linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level5:{visible:!0,color:"#28CC95",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level6:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.764},level7:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level8:{visible:!0,color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.618},level9:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:2.618},level10:{visible:!0,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:3.618},level11:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:4.236}},linetooltrendbasedfibtime:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:{visible:!0,color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:0},level2:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level3:{visible:!1,color:"#95CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level4:{visible:!0,color:"#28CC28",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},level5:{visible:!0,color:"#28CC95",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level6:{visible:!0,color:"#2895CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.382},level7:{visible:!0,color:"#808080",
linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.618},level8:{visible:!0,color:"#2828CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2},level9:{visible:!0,color:"#CC2828",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.382},level10:{visible:!0,color:"#9528CC",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2.618},level11:{visible:!0,color:"#CC2895",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:3}},linetoolschiffpitchfork:{clonable:!0,fillBackground:!0,transparency:80,
style:TradingView.LineToolPitchfork.STYLE_SCHIFF,median:{visible:!0,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:{visible:!1,color:"#A06B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.25},level1:{visible:!1,color:"#699E00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level2:{visible:!0,color:"#009B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level3:{visible:!1,color:"#009965",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.618},
level4:{visible:!1,color:"#006599",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.75},level5:{visible:!0,color:"#000099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level6:{visible:!1,color:"#660099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.5},level7:{visible:!1,color:"#990066",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.75},level8:{visible:!1,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2}},linetoolschiffpitchfork2:{clonable:!0,
fillBackground:!0,transparency:80,style:TradingView.LineToolPitchfork.STYLE_SCHIFF2,median:{visible:!0,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:{visible:!1,color:"#A06B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.25},level1:{visible:!1,color:"#699E00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level2:{visible:!0,color:"#009B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level3:{visible:!1,color:"#009965",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:0.618},level4:{visible:!1,color:"#006599",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.75},level5:{visible:!0,color:"#000099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level6:{visible:!1,color:"#660099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.5},level7:{visible:!1,color:"#990066",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.75},level8:{visible:!1,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2}},linetoolinsidepitchfork:{clonable:!0,
fillBackground:!0,transparency:80,style:TradingView.LineToolPitchfork.STYLE_INSIDE,median:{visible:!0,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:{visible:!1,color:"#A06B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.25},level1:{visible:!1,color:"#699E00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.382},level2:{visible:!0,color:"#009B00",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.5},level3:{visible:!1,color:"#009965",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
coeff:0.618},level4:{visible:!1,color:"#006599",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:0.75},level5:{visible:!0,color:"#000099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1},level6:{visible:!1,color:"#660099",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.5},level7:{visible:!1,color:"#990066",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:1.75},level8:{visible:!1,color:"#A50000",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,coeff:2}},linetool:{frozen:!1,visible:!0}};
var b=function(a,c,d){var e=c.split(".");c=e[0];if(!a.hasOwnProperty(c))throw"illegal path";1<e.length?(e=e.splice(1).join("."),b(a[c],e,d)):a[c]=d};if("undefined"!=typeof __defaultsOverrides&&__defaultsOverrides)for(var c in __defaultsOverrides)try{b(defaultProperties.chartproperties,c,__defaultsOverrides[c])}catch(d){throw"Path `"+c+"` does not exist.";}}"undefined"==typeof defaultProperties["study_MA@tv-basicstudies"]&&(defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",
shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{visible:!0,color:"#0496FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,histogramBase:0,title:"MA"}}});"undefined"==typeof defaultProperties["study_ErrorOnUpdate@tv-basicstudies"]&&(defaultProperties["study_ErrorOnUpdate@tv-basicstudies"]={description:"Error On Update",styles:{ErrorOnUpdate:{visible:!0,color:"#ff0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,
histogramBase:0}}});"undefined"==typeof defaultProperties["study_ErrorOnCreate@tv-basicstudies"]&&(defaultProperties["study_ErrorOnCreate@tv-basicstudies"]={description:"Error On Create",styles:{ErrorOnUpdate:{visible:!0,color:"#00ff00",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,histogramBase:0}}});"undefined"==typeof defaultProperties["study_ErrorOnNewBar@tv-basicstudies"]&&(defaultProperties["study_ErrorOnNewBar@tv-basicstudies"]={description:"Error On New Bar",
styles:{ErrorOnUpdate:{visible:!0,color:"#0000ff",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,histogramBase:0}}});"undefined"==typeof defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={font:"Arial",fontsize:10,borderColor:"#538F1F",backColor:"#F0FFCC",textColor:"#000000"});"undefined"==typeof defaultProperties["study_PivotPointsStandard@tv-basicstudies"]&&(defaultProperties["study_PivotPointsStandard@tv-basicstudies"]=
{_hardCodedDefaultsVersion:1,font:"Arial",fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:!0,"S1/R1":!0,"S2/R2":!0,"S3/R3":!0,"S4/R4":!0,"S5/R5":!0},colors:{P:"#D47928","S1/R1":"#D47928","S2/R2":"#D47928","S3/R3":"#D47928","S4/R4":"#D47928","S5/R5":"#D47928"},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}});"undefined"==typeof defaultProperties["study_ZigZag@tv-basicstudies"]&&(defaultProperties["study_ZigZag@tv-basicstudies"]={color:"#56871D",linewidth:2});"undefined"==typeof defaultProperties["study_ElliottWave@tv-basicstudies"]&&
(defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:{visible:!1,color:"#ff0000"},level1:{visible:!1,color:"#008000"},level2:{visible:!1,color:"#0000ff"},level3:{visible:!1,color:"#ff00ff"},level4:{visible:!0,color:"#0080ff"},level5:{visible:!0,color:"#ff0000"},level6:{visible:!0,color:"#008000"},level7:{visible:!0,color:"#0000ff"},level8:{visible:!0,color:"#ff00ff"}});"undefined"==typeof defaultProperties["study_LinearRegression@tv-basicstudies"]&&(defaultProperties["study_LinearRegression@tv-basicstudies"]=
{styles:{upLine:{visible:!0,color:"#0000ff",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:"#0000ff",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:"#ff0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"#991515",transparency:70}});"undefined"==typeof defaultProperties["study_RegressionTrend@tv-basicstudies"]&&(defaultProperties["study_RegressionTrend@tv-basicstudies"]={linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,
styles:{upLine:{visible:!0,color:"#0000FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:"#0000FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:"#FF0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}});"undefined"==typeof defaultProperties["study_Compare@tv-basicstudies"]&&(defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"});"undefined"==typeof defaultProperties["study_Overlay@tv-basicstudies"]&&
(defaultProperties["study_Overlay@tv-basicstudies"]={style:TradingView.Series.STYLE_BARS,showPriceLine:!1,minTick:"default",candleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",barColorsOnPrevClose:!1},
barStyle:{upColor:"#6ba583",downColor:"#d75442",barColorsOnPrevClose:!1,dontDrawOpen:!1},lineStyle:{color:"#0303F7",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:TradingView.Series.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"#606090",color2:"#01F6F5",linecolor:"#0094FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},styles:{open:{visible:!0,color:"#ff0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,
histogramBase:0,title:"open"},high:{visible:!0,color:"#ff0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,histogramBase:0,title:"high"},low:{visible:!0,color:"#ff0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,histogramBase:0,title:"low"},close:{visible:!0,color:"#ff0000",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.Study.PLOT_LINE,histogramBase:0,title:"close"}}});a=a.split(".");c=defaultProperties;
for(var e=0;e<a.length;e++)c=c[a[e]];return c?TradingView.clone(c):{}}function defaults(a,b){return b?_defaultsUpdated(a,b):_defaultsAsIs(a)}function _defaultsAsIs(a){var b=factoryDefaults(a);window._UNIT_TESTS||(a=TradingView.clone(TVSettings.getJSON(a,null)),TradingView.merge(b,a));return b}
function _defaultsUpdated(a,b){var c=factoryDefaults(a);if(!window._UNIT_TESTS){var d=TradingView.clone(TVSettings.getJSON(a,null));a.startsWith("study_")&&d&&TradingView.StudyVersioning.isVersionHead(d.version)&&(d=b.updateStudyState(d,d));TradingView.merge(c,d)}return c}function saveDefaults(a,b){TVSettings.setJSON(a,b)}defaults.create=function(a,b){if(b){var c=StudyMetaInfo.parseIdString(a),d=factoryDefaults(c.id);defaultProperties[c.id]=$.extend(b,d)}};
defaults.createOrReplace=function(a,b){if(b){var c=StudyMetaInfo.parseIdString(a);defaultProperties[c.id]=b}};defaults.remove=function(a){defaultProperties[a]=void 0};function PriceFormatter(a,b,c,d){b||(b=1);isInteger(a)||(a=100);if(0>a)throw new TypeError("invalid base");this._priceScale=a;this._minMove=b;this._minMove2=d;0<d&&2!==d&&4!==d?TradingView.logDebug("invalid minmove2"):(this._fractional=c,this.calculateDecimal())}PriceFormatter.prototype.isFractional=function(){return this._fractional};PriceFormatter.prototype.decimalSign=".";PriceFormatter.prototype.decimalSignFractional="'";PriceFormatter.prototype.southandDelimeter="`";
PriceFormatter.prototype.fullPrecision=!1;PriceFormatter.prototype.calculateDecimal=function(){this._fractionalLength=0;if(0<this._priceScale&&0<this._minMove){var a=this._priceScale;for(this._minMove2&&(a/=this._minMove2);1<a;)a/=10,this._fractionalLength++}};
function numberToStringWithLeadingZero(a,b){if(!isNumber(a))return"n/a";if(!isInteger(b))throw new TypeError("invalid length");if(0>b||16<b)throw new TypeError("invalid length");return 0===b?a.toString():("0000000000000000"+a.toString()).right(b)}PriceFormatter.prototype.format=function(a){var b="";0>a&&(b="-",a=-a);return this._fractional?b+this.formatAsFractional(a):b+this.formatAsDecimal(a)};
PriceFormatter.prototype.formatAsDecimal=function(a){var b=this._priceScale/this._minMove,c=Math.floor(a);a=Math.round(a*b)-c*b;a===b&&(a=0,c+=1);b=1===b?"":this.decimalSign+numberToStringWithLeadingZero(a*this._minMove,this._fractionalLength);return c.toString()+b};
PriceFormatter.prototype.formatAsFractional=function(a){var b=this._priceScale/this._minMove,c=Math.floor(a);a=Math.round(a*b)-c*b;a===b&&(a=0,c+=1);if(this._minMove2){var b=["0","5"],d=["0","2","5","7"],e=a%this._minMove2;a=(a-e)/this._minMove2;a=numberToStringWithLeadingZero(a,this._fractionalLength)+this.decimalSignFractional+(2===this._minMove2?b[e]:d[e])}else a=numberToStringWithLeadingZero(a*this._minMove,this._fractionalLength);return c.toString()+this.decimalSignFractional+a};
function PercentageFormatter(){PriceFormatter.call(this,100)}inherit(PercentageFormatter,PriceFormatter);PercentageFormatter.prototype.format=function(a){return PriceFormatter.prototype.format.call(this,a)+"%"};function DateFormatter(){}DateFormatter.prototype.format=function(a){return numberToStringWithLeadingZero(a.getUTCFullYear(),4)+"-"+numberToStringWithLeadingZero(a.getUTCMonth()+1,2)+"-"+numberToStringWithLeadingZero(a.getUTCDate(),2)};
function TimeFormatter(a){this._format_str=a||"%h:%m:%s"}TimeFormatter.prototype.format=function(a){return this._format_str.replace("%h",numberToStringWithLeadingZero(a.getUTCHours(),2)).replace("%m",numberToStringWithLeadingZero(a.getUTCMinutes(),2)).replace("%s",numberToStringWithLeadingZero(a.getUTCSeconds(),2))};function DateTimeFormatter(a){this._dwm=a}DateTimeFormatter.prototype.format=function(a){var b=(new DateFormatter).format(a);this._dwm||(b+=" "+(new TimeFormatter).format(a));return b};
function VolumeFormatter(a){this._fractionalValues=a}VolumeFormatter.prototype.format=function(a){if(!isNumber(a))return"---";var b="";0>a&&(b="-",a=-a);if(1E100<=a)return"N/A";if(!this._fractionalValues||995<=a)a=Math.round(a);if(995>a)return b+a.toString();if(999995>a)return b+(a/1E3).toString()+"K";if(999999995>a)return a=1E3*Math.round(a/1E3),b+(a/1E6).toString()+"M";a=1E6*Math.round(a/1E6);return b+(a/1E9).toString()+"B"};function TimeSpanFormatter(){}
TimeSpanFormatter.prototype.format=function(a){var b=0>a;a=Math.abs(a);var c=Math.floor(a/86400);a-=86400*c;var d=Math.floor(a/3600);a-=3600*d;var e=Math.floor(a/60);a-=60*e;var f="";c&&(f+=c+" "+$.t("d",{context:"dates"})+" ");d&&(f+=d+" "+$.t("h",{context:"dates"})+" ");e&&(f+=e+" "+$.t("m",{context:"dates"})+" ");a&&(f+=a+" "+$.t("s",{context:"dates"})+" ");b&&(f="-"+f);return f.trimmed()};function PriceColorer(){this._prev=null}
PriceColorer.formatSign=function(a){return 0==a?"#5A5D66":0<a?"#27AC66":"#DA563E"};PriceColorer.formatDiff=function(a,b){PriceColorer.signFormat(b-a)};PriceColorer.prototype.format=function(a){try{return null===this._prev?PriceColorer.formatSign(a):PriceColorer.formatDiff(this._prev,a)}finally{this._prev=a}};function AbstractBarColorer(){this.backColorers=[]}AbstractBarColorer.prototype.barStyle=function(a,b,c){for(var d={},e=this.backColorers.length-1;0<=e;e--)this.backColorers[e].applyBarStyle(a,b,d,c);this.applyBarStyle(a,b,d,c);return d};AbstractBarColorer.prototype.pushBackBarColorer=function(a){this.backColorers.push(a)};AbstractBarColorer.prototype.applyBarStyle=function(a,b,c){throw Error("This function is supposed to be reimplemented in a subclass");};
function SeriesBarColorer(a){AbstractBarColorer.call(this);this._series=a}inherit(SeriesBarColorer,AbstractBarColorer);
SeriesBarColorer.prototype.applyBarStyle=function(a,b,c,d){c||(c={});c.barColor=null;c.barBorderColor=null;c.isBarHollow=null;c.isBarUp=null;c.upColor=null;c.downColor=null;c.isTwoColorBar=null;var e=this._series.properties();switch(e.style.value()){case TradingView.Series.STYLE_LINE:c.barColor=e.lineStyle.color.value();break;case TradingView.Series.STYLE_AREA:c.barColor=e.areaStyle.linecolor.value();break;case TradingView.Series.STYLE_BARS:var f=e.barStyle.upColor.value(),g=e.barStyle.downColor.value(),
h=f,k=g,m=this.findBar(a,!1,d);e.barStyle.barColorsOnPrevClose.value()?(b=this.findPrevBar(a,!1,d),c.barColor=b[CLOSE_PLOT]<=m[CLOSE_PLOT]?f:g,c.barBorderColor=b[CLOSE_PLOT]<=m[CLOSE_PLOT]?h:k):(c.barColor=m[OPEN_PLOT]<=m[CLOSE_PLOT]?f:g,c.barBorderColor=m[OPEN_PLOT]<=m[CLOSE_PLOT]?h:k);break;case TradingView.Series.STYLE_CANDLES:f=e.candleStyle.upColor.value();g=e.candleStyle.downColor.value();h=e.candleStyle.borderUpColor?e.candleStyle.borderUpColor.value():e.candleStyle.borderColor.value();k=e.candleStyle.borderDownColor?
e.candleStyle.borderDownColor.value():e.candleStyle.borderColor.value();m=this.findBar(a,!1,d);e.candleStyle.barColorsOnPrevClose.value()?(b=this.findPrevBar(a,!1,d),c.barColor=b[CLOSE_PLOT]<=m[CLOSE_PLOT]?f:g,c.barBorderColor=b[CLOSE_PLOT]<=m[CLOSE_PLOT]?h:k):(c.barColor=m[OPEN_PLOT]<=m[CLOSE_PLOT]?f:g,c.barBorderColor=m[OPEN_PLOT]<=m[CLOSE_PLOT]?h:k);break;case TradingView.Series.STYLE_HOLLOW_CANDLES:f=e.hollowCandleStyle.upColor.value();g=e.hollowCandleStyle.downColor.value();h=e.hollowCandleStyle.borderUpColor?
e.hollowCandleStyle.borderUpColor.value():e.hollowCandleStyle.borderColor.value();k=e.hollowCandleStyle.borderDownColor?e.hollowCandleStyle.borderDownColor.value():e.hollowCandleStyle.borderColor.value();m=this.findBar(a,!1,d);b=this.findPrevBar(a,!1,d);b[CLOSE_PLOT]<=m[CLOSE_PLOT]?(c.barColor=f,c.barBorderColor=h):(c.barColor=g,c.barBorderColor=k);c.isBarHollow=m[OPEN_PLOT]<=m[CLOSE_PLOT]?!0:!1;break;case TradingView.Series.STYLE_HEIKEN_ASHI:f=e.haStyle.upColor.value();g=e.haStyle.downColor.value();
h=e.haStyle.borderUpColor.value();k=e.haStyle.borderDownColor.value();m=this.findBar(a,b,d);e.haStyle.barColorsOnPrevClose.value()?(b=this.findPrevBar(a,b,d),c.barColor=b[CLOSE_PLOT]<=m[CLOSE_PLOT]?f:g,c.barBorderColor=b[CLOSE_PLOT]<=m[CLOSE_PLOT]?h:k):(c.barColor=m[OPEN_PLOT]<=m[CLOSE_PLOT]?f:g,c.barBorderColor=m[OPEN_PLOT]<=m[CLOSE_PLOT]?h:k);break;case TradingView.Series.STYLE_RENKO:m=this.findBar(a,b,d);m=m[OPEN_PLOT]<=m[CLOSE_PLOT];f=b?e.renkoStyle.upColorProjection.value():e.renkoStyle.upColor.value();
g=b?e.renkoStyle.downColorProjection.value():e.renkoStyle.downColor.value();h=b?e.renkoStyle.borderUpColorProjection.value():e.renkoStyle.borderUpColor.value();k=b?e.renkoStyle.borderDownColorProjection.value():e.renkoStyle.borderDownColor.value();c.barColor=m?f:g;c.barBorderColor=m?h:k;c.isBarUp=m;break;case TradingView.Series.STYLE_PB:m=this.findBar(a,b,d);m=m[OPEN_PLOT]<=m[CLOSE_PLOT];f=b?e.pbStyle.upColorProjection.value():e.pbStyle.upColor.value();g=b?e.pbStyle.downColorProjection.value():e.pbStyle.downColor.value();
h=b?e.pbStyle.borderUpColorProjection.value():e.pbStyle.borderUpColor.value();k=b?e.pbStyle.borderDownColorProjection.value():e.pbStyle.borderDownColor.value();c.barColor=m?f:g;c.barBorderColor=m?h:k;c.isBarUp=m;break;case TradingView.Series.STYLE_KAGI:c.upColor=b?e.kagiStyle.upColorProjection.value():e.kagiStyle.upColor.value();c.downColor=b?e.kagiStyle.downColorProjection.value():e.kagiStyle.downColor.value();f=null;m=this.findBar(a,b,d);m[LOW_PLOT]<m[ADT_PLOT]&&m[ADT_PLOT]<m[HIGH_PLOT]?(f=m[OPEN_PLOT]<=
m[CLOSE_PLOT],c.isTwoColorBar=!0):(f=m[OPEN_PLOT]<=m[CLOSE_PLOT]?m[OPEN_PLOT]==m[ADT_PLOT]?!0:!1:m[OPEN_PLOT]==m[ADT_PLOT]?!1:!0,c.isTwoColorBar=!1);c.barColor=f?c.upColor:c.downColor;c.isBarUp=m[OPEN_PLOT]<=m[CLOSE_PLOT];break;case TradingView.Series.STYLE_PNF:m=this.findBar(a,b,d),m=0<m[ADT_PLOT],f=b?e.pnfStyle.upColorProjection.value():e.pnfStyle.upColor.value(),g=b?e.pnfStyle.downColorProjection.value():e.pnfStyle.downColor.value(),c.isBarUp=m,c.barColor=m?f:g}return c};
SeriesBarColorer.prototype.getSeriesBars=function(a){return a?this._series.nsBars():this._series.bars()};SeriesBarColorer.prototype._findBarFieldValue=function(a,b,c){a=this.getSeriesBars(c).valueAt(a);if(void 0!==a)return a[b]};SeriesBarColorer.prototype.findBar=function(a,b,c){return c?c.value:this.getSeriesBars(b).valueAt(a)||[]};
SeriesBarColorer.prototype.findPrevBar=function(a,b,c){if(c)return c.previousValue||[];a=this._series.bars()._search(a,SEARCH_EXACT);return 0<a?this._series.bars()._valueAt(a-1):[]};function StudyBarColorer(a,b){AbstractBarColorer.call(this);this._study=a;this._plotIndex=b}inherit(StudyBarColorer,AbstractBarColorer);
StudyBarColorer.prototype.applyBarStyle=function(a,b,c){c||(c={});if(b)return c;b=this._study.properties();if(!b.visible.value())return c;var d=this._study.metaInfo(),e=this._study.data();if(!e||0==e.size())return c;var f=this._study.offset(d.plots[this._plotIndex].id);a=e.valueAt(a-f);if(!a)return c;a=a[this._plotIndex+1];if(null==a)return c;a=Math.round(a);b=b.palettes[d.plots[this._plotIndex].palette].colors[a].color.value();c.barColor=b;c.upColor=b.color;c.downColor=b.color;return c};function BarItem(){this.close=this.low=this.high=this.open=this.time=0}BarItem.prototype.setTime=function(a){isNumber(a)?this.time=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect time")};BarItem.prototype.setOpen=function(a){isNumber(a)?this.open=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect open")};BarItem.prototype.setHigh=function(a){isNumber(a)?this.high=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect high")};
BarItem.prototype.setLow=function(a){isNumber(a)?this.low=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect low")};BarItem.prototype.setClose=function(a){isNumber(a)?this.close=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect close")};BarItem.prototype.setAdditionalPrice=function(a){isNumber(a)?this.additionalPrice=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect additionalPrice")};BarItem.prototype.setAdditionalNum=function(a){isNumber(a)?this.additionalNum=a:TradingView.logDebug("BarItem.setAdditionalNum: incorrect additionalNum")};function BarsRange(a,b){null===a||isInteger(a)?null===b||isInteger(b)?(this.m_firstBar=a,this.m_lastBar=b):TradingView.logDebug("BarsRange: incorrect lastBar"):TradingView.logDebug("BarsRange: incorrect firstBar")}BarsRange.prototype.isEmpty=function(){return null===this.m_firstBar||null===this.m_lastBar};BarsRange.prototype.clone=function(){return new BarsRange(this.m_firstBar,this.m_lastBar)};BarsRange.prototype.firstBar=function(){return this.m_firstBar};BarsRange.prototype.lastBar=function(){return this.m_lastBar};
BarsRange.prototype.count=function(){return this.m_lastBar-this.m_firstBar+1};BarsRange.prototype.resizeRight=function(a){!isInteger(a)||0>a?TradingView.logDebug("BarsRange: incorrect newWidth"):this.m_firstBar=this.m_lastBar-a+1};BarsRange.prototype.shift=function(a){isNumber(a)?(this.m_firstBar=Math.round(this.m_firstBar+a),this.m_lastBar=Math.round(this.m_lastBar+a)):TradingView.logDebug("BarsRange.shift: incorrect coeff")};
BarsRange.prototype.contains=function(a){return this.m_firstBar<=a&&this.m_lastBar>=a};TradingView.Magnet=function(a,b,c){this._magnetProperty=a;this._timeScale=b};
TradingView.Magnet.prototype.align=function(a,b,c){var d=c.defaultPriceScale(),e=d.priceToCoordinate(a);if(!this._magnetProperty.value())return a;d=d.dataSources();c=null;for(var f=0;f<d.size();f++)if(d.item(f)instanceof TradingView.Series){c=d.item(f);break}if(c&&(d=c.bars(),d.contains(b)&&(b=d.valueAt(b),b=[b[OPEN_PLOT],b[HIGH_PLOT],b[LOW_PLOT],b[CLOSE_PLOT]],d=c.priceScale(),!d.isEmpty()))){var g=[];if(d.isPercent())for(c=c.firstValue(),f=0;f<b.length;f++)b[f]=d.priceRange().convertToPercent(b[f],
c);for(f=0;f<b.length;f++)g.push({y:d.priceToCoordinate(b[f]),price:b[f]});g.sort(function(a,b){var c=Math.abs(a.y-e),d=Math.abs(b.y-e);return c-d});c=g[0];50>Math.abs(c.y-e)&&(a=c.price)}return a};TradingView.UndoHistory=function(){function a(){if(c){var a=c;c=null;a.isEmpty()||b(a)}}function b(a){c?c.addCommand(a):(e.clear(),d.push(a))}var c=null,d=new UndoStack,e=new UndoStack;return{beginUndoMacro:function(b){c&&a();c=new UndoMacroCommand(b)},endUndoMacro:a,undo:function(){if(d.isEmpty())return!1;var a=d.pop();a.undo();e.push(a);return!0},redo:function(){if(e.isEmpty())return!1;var a=e.pop();a.redo();d.push(a);return!0},pushUndoCommand:b,createUndoCheckpoint:function(){return{lastActualCommand:d.isEmpty()?
null:d.head()}},undoToCheckpoint:function(a){for(;!d.isEmpty()&&a.lastActualCommand!==d.head();)d.pop().undo();e.clear()},undoStack:function(){return d},redoStack:function(){return e},clearStack:function(){d.clear();e.clear()}}}();TradingView.UndoHistory.setChartLayout=function(a,b){if(a.layout.value()===b)return!1;var c=new SetChartLayoutCommand(a,b);c.redo();this.pushUndoCommand(c)};
function SetChartLayoutCommand(a,b){UndoCommand.call(this,"Change Chart Layout to "+TradingView.ChartWidgetCollection.LayoutTemplates[b].title);this._chartWidgetCollection=a;this._newLayoutId=b;this._oldLayoutId=a.layout.value()}inherit(SetChartLayoutCommand,UndoCommand);SetChartLayoutCommand.prototype.redo=function(){this._chartWidgetCollection.layout.setValue(this._newLayoutId)};SetChartLayoutCommand.prototype.undo=function(){this._chartWidgetCollection.layout.setValue(this._oldLayoutId)};
function ChartUndoModel(a,b,c,d,e,f,g,h){this._chartWidget=h;this.m_model=new ChartModel(a,b,c,d,e,f,g,this);this.m_undoStack=new UndoStack;this.m_redoStack=new UndoStack;this.m_zoomStack=new UndoStack;this._onSimpleZoomIn=new Delegate;this._onSimpleZoomOut=new Delegate}inherit(ChartUndoModel,EventEmitter);ChartUndoModel.prototype.version=function(){return this.m_model._version};
ChartUndoModel.prototype.onData=function(a){switch(a.method){case "timescale_update":a=a.params,this.m_model.updateTimeScale(a.index,a.zoffset,a.changes,a.marks,a.clear)}};ChartUndoModel.prototype.paneForSource=function(a){return this.m_model.paneForSource(a)};ChartUndoModel.prototype.createPane=function(a){return this.m_model.createPane(a)};ChartUndoModel.prototype.dumpViews=function(){return this.m_model.dumpViews()};ChartUndoModel.prototype.readOnly=function(){return this.m_model.readOnly()};
ChartUndoModel.prototype.restart=function(){this.m_model.restart()};ChartUndoModel.prototype.disconnect=function(){this.m_model.disconnect()};ChartUndoModel.prototype.studiesMetaData=function(){return this.m_model.studiesMetaData()};ChartUndoModel.prototype.studyVersioning=function(){return this.m_model.studyVersioning()};ChartUndoModel.prototype.chartModel=function(){return this.m_model};ChartUndoModel.prototype.undoStack=TradingView.UndoHistory.undoStack;ChartUndoModel.prototype.redoStack=TradingView.UndoHistory.redoStack;
ChartUndoModel.prototype.undo=TradingView.UndoHistory.undo;ChartUndoModel.prototype.redo=TradingView.UndoHistory.redo;ChartUndoModel.prototype.pushUndoCommand=TradingView.UndoHistory.pushUndoCommand;ChartUndoModel.prototype.startScalePrice=function(a,b,c){this.pushUndoCommand(new PriceScaleChangeUndoCommand(this.m_model,a,b,b.state()));this.chartModel().startScalePrice(a,b,c)};ChartUndoModel.prototype.scalePriceTo=function(a,b,c){this.chartModel().scalePriceTo(a,b,c)};
ChartUndoModel.prototype.endScalePrice=function(a,b){this.chartModel().endScalePrice(a,b)};ChartUndoModel.prototype.startScrollPrice=function(a,b,c){b.isAutoScale()||(this._initialPriceScrollState=b.state(),this._initialPriceScrollPos=c,this.chartModel().startScrollPrice(a,b,c))};
ChartUndoModel.prototype.scrollPriceTo=function(a,b,c){b.isAutoScale()||(this._initialPriceScrollPos&&20<Math.abs(this._initialPriceScrollPos-c)&&(this.pushUndoCommand(new PriceScaleChangeUndoCommand(this.m_model,a,b,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(a,b,c))};
ChartUndoModel.prototype.endScrollPrice=function(a,b){b.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(a,b))};ChartUndoModel.prototype.setPriceAutoScale=function(a,b,c){this.pushUndoCommand(new PriceScaleChangeUndoCommand(this.m_model,a,b,b.state()));this.chartModel().setPriceAutoScale(a,b,c)};
ChartUndoModel.prototype.resetPriceScale=function(a,b){this.pushUndoCommand(new PriceScaleChangeUndoCommand(this.m_model,a,b,b.state()));this.chartModel().resetPriceScale(a,b)};ChartUndoModel.prototype.startScaleTime=function(a){this.pushUndoCommand(new TimeScaleChangeUndoCommand(this.m_model,this.m_model.timeScale().state(),"scale time"));this.chartModel().startScaleTime(a)};ChartUndoModel.prototype.scaleTimeTo=function(a){this.chartModel().scaleTimeTo(a)};ChartUndoModel.prototype.endScaleTime=function(){this.chartModel().endScaleTime()};
ChartUndoModel.prototype.startScrollTime=function(a){this._initialTimeScrollState=this.m_model.timeScale().state();this._initialTimeScrollPos=a;this.chartModel().startScrollTime(a)};ChartUndoModel.prototype.scrollTimeTo=function(a){this._initialTimeScrollPos&&20<Math.abs(a-this._initialTimeScrollPos)&&(this.pushUndoCommand(new TimeScaleChangeUndoCommand(this.m_model,this._initialTimeScrollState,"scroll time")),delete this._initialTimeScrollPos,delete this._initialTimeScrollState);this.chartModel().scrollTimeTo(a)};
ChartUndoModel.prototype.endScrollTime=function(){this.chartModel().endScrollTime();delete this._initialTimeScrollPos;delete this._initialTimeScrollState};ChartUndoModel.prototype.resetTimeScale=function(){this.pushUndoCommand(new TimeScaleChangeUndoCommand(this.m_model,this.m_model.timeScale().state()));this.chartModel().resetTimeScale()};ChartUndoModel.prototype.canZoomIn=function(){return this.chartModel().canZoomIn()};ChartUndoModel.prototype.canZoomOut=function(){return this.chartModel().canZoomOut()};
ChartUndoModel.prototype.setWidth=function(a){this.m_model.setWidth(a)};ChartUndoModel.prototype.setPaneHeight=function(a,b){this.m_model.setPaneHeight(a,b)};ChartUndoModel.prototype.gridSource=function(){return this.m_model.gridSource()};ChartUndoModel.prototype.watermarkSource=function(){return this.m_model.watermarkSource()};ChartUndoModel.prototype.publishedChartsTimelineSource=function(){return this.m_model.publishedChartsTimelineSource()};ChartUndoModel.prototype.barsMarksSources=function(){return this.m_model.barsMarksSources()};
ChartUndoModel.prototype.crossHairSource=function(){return this.m_model.crossHairSource()};ChartUndoModel.prototype.model=function(){return this.m_model};ChartUndoModel.prototype.mainSeries=function(){return this.m_model.m_mainSeries};ChartUndoModel.prototype.panes=function(){return this.m_model.m_panes};ChartUndoModel.prototype.timeScale=function(){return this.m_model.timeScale()};ChartUndoModel.prototype.setSelectedSource=function(a,b){this.m_model.setSelectedSource(a,b)};
ChartUndoModel.prototype.setHoveredSource=function(a,b){this.m_model.setHoveredSource(a,b)};ChartUndoModel.prototype.selectedSource=function(){return this.m_model.selectedSource()};ChartUndoModel.prototype.onSelectedSourceChanged=function(){return this.m_model.onSelectedSourceChanged()};ChartUndoModel.prototype.hoveredSource=function(){return this.m_model.hoveredSource()};ChartUndoModel.prototype.invalidate=function(a){this.m_model.invalidate(a)};
ChartUndoModel.prototype.setCurrentPosition=function(a,b,c,d){this.m_model.setCurrentPosition(a,b,c,d)};ChartUndoModel.prototype.modifySeries=function(a,b,c){a=new ModifySeriesUndoCommand(this.m_model,a,b,c);this.pushUndoCommand(a);a.redo()};ChartUndoModel.prototype.insertStudy=function(a,b,c){if(this.model()._chartApi._chartApi.isCanCreateStudy())return a=new InsertStudyCommand(this.m_model,a,b,c),this.pushUndoCommand(a),a.redo();TVDialogs.showNotice("Error","Exceeded the limit of studies")};
ChartUndoModel.prototype.setProperty=function(a,b,c){a&&a.value()!==b&&(a=new SetPropertyCommand(a,b,c,this.m_model),this.pushUndoCommand(a),a.redo(),this.emitEvent("setProperty"))};ChartUndoModel.prototype.setPercentProperty=function(a,b,c,d){a.value()!==b&&(a=new SetPercentagePropertyCommand(a,b,c,d,this.m_model),this.pushUndoCommand(a),a.redo())};ChartUndoModel.prototype.setLogProperty=function(a,b,c,d){a.value()!==b&&(a=new SetLogPropertyCommand(a,b,c,d,this.m_model),this.pushUndoCommand(a),a.redo())};
ChartUndoModel.prototype.setAutoScaleProperty=function(a,b,c,d){a.value()!==b&&(a=new SetAutoScalePropertyCommand(a,b,c,d,this.m_model),this.pushUndoCommand(a),a.redo())};ChartUndoModel.prototype.setChartStyleProperty=function(a,b,c){a.value()!==b&&(a=new SetChartStyleCommand(a,b,this.mainSeries(),c,this.m_model,this._chartWidget),this.pushUndoCommand(a),a.redo(),this.emitEvent("setChartStyleProperty"))};
ChartUndoModel.prototype.setLockScaleProperty=function(a,b,c,d){a.value()!==b&&(a=new SetLockScaleCommand(a,b,c,d,this.m_model),this.pushUndoCommand(a),a.redo())};ChartUndoModel.prototype.setScreenChartProperty=function(a,b,c,d){a.value()!==b&&(a=new SetScreenChartPropertyUndoCommand(d,a,b,c),this.pushUndoCommand(a),a.redo())};ChartUndoModel.prototype.beginUndoMacro=TradingView.UndoHistory.beginUndoMacro;ChartUndoModel.prototype.endUndoMacro=TradingView.UndoHistory.endUndoMacro;
ChartUndoModel.prototype.createUndoCheckpoint=TradingView.UndoHistory.createUndoCheckpoint;ChartUndoModel.prototype.undoToCheckpoint=TradingView.UndoHistory.undoToCheckpoint;ChartUndoModel.prototype.removeSource=function(a){if(a.isUserDeletable()){var b=new RemoveSourceCommand(this.m_model,a);this.pushUndoCommand(b);b.redo();this.emitEvent("removeSource",[a])}};
ChartUndoModel.prototype.removeSelectedSource=function(){var a=this.m_model.selectedSource();if(a&&a.isUserDeletable()){this.setSelectedSource(null);var b=new RemoveSourceCommand(this.m_model,a);this.pushUndoCommand(b);b.redo();this.emitEvent("removeSource",[a])}};ChartUndoModel.prototype.move=function(a,b,c){var d=this.m_model.paneForSource(a);b=new MoveUndoCommand(this.m_model,a,d,b,c);this.pushUndoCommand(b);b.redo();this.emitEvent("moveSource",[a])};
ChartUndoModel.prototype.createLineTool=function(a,b,c,d){if("LineToolRegressionTrend"!=c||this.model()._chartApi._chartApi.isCanCreateStudy())return c=this.m_model.createLineTool(a,b,c,d),this._createLineCommand=new CreateLineUndoCommand(this.m_model,c,a,b),this.m_model.lineBeingCreated()||(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),c;TVDialogs.showNotice("Error","Exceeded the limit of studies")};ChartUndoModel.prototype.lineBeingCreated=function(){return this.m_model.lineBeingCreated()};
ChartUndoModel.prototype.paneBeingCreatedLineOn=function(){return this.m_model.paneBeingCreatedLineOn()};ChartUndoModel.prototype.coninueCreatingLine=function(a,b){this.m_model.lineBeingCreated();this.m_model.paneBeingCreatedLineOn();var c=this.m_model.coninueCreatingLine(a,b);this._createLineCommand.coninueCreatingLine(a,b);c&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand);return c};ChartUndoModel.prototype.cancelCreatingLine=function(){this.m_model.cancelCreatingLine()};
ChartUndoModel.prototype.lineCancelled=function(){return this.m_model.lineCancelled()};ChartUndoModel.prototype.startChangingLinetool=function(a,b,c,d){this._currentLineChangeCommand=new ChangeLineUndoCommand(this.m_model,a,c,d);this.m_model.startChangingLinetool(a,b,c,d)};ChartUndoModel.prototype.lineBeingEdited=function(){return this.m_model.lineBeingEdited()};ChartUndoModel.prototype.changeLinePoint=function(a,b){this._currentLineChangeCommand.setPoint(a,b);this.m_model.changeLinePoint(a,b)};
ChartUndoModel.prototype.endChangingLinetool=function(){this.m_model.endChangingLinetool();this._currentLineChangeCommand.endChanging();this.pushUndoCommand(this._currentLineChangeCommand);this._currentLineChangeCommand=null};ChartUndoModel.prototype.startMovingSource=function(a,b){this._currentLineMoveCommand=new MoveLineUndoCommand(this.m_model,a,b);this.m_model.startMovingSource(a,b)};ChartUndoModel.prototype.sourceBeingMoved=function(){return this.m_model.sourceBeingMoved()};
ChartUndoModel.prototype.moveSource=function(a){this._currentLineMoveCommand.setPoint(a);this.m_model.moveSource(a)};ChartUndoModel.prototype.endMovingSource=function(){this.m_model.endMovingSource();this.pushUndoCommand(this._currentLineMoveCommand);this._currentLineChangeCommand=null};ChartUndoModel.prototype.dataSources=function(){return this.m_model.dataSources()};ChartUndoModel.prototype.state=function(a){return this.m_model.state(a)};
ChartUndoModel.prototype.restoreState=function(a,b){this.m_model.restoreState(a,b)};ChartUndoModel.prototype.calculateDefaultTags=function(){return this.m_model.calculateDefaultTags()};ChartUndoModel.prototype.onTagsChanged=function(){return this.m_model.onTagsChanged()};ChartUndoModel.prototype.changeZOrder=function(a,b){var c=new ChangeZOrderCommand(this.m_model,a,b);this.pushUndoCommand(c);c.redo();this.emitEvent("changeZOrder",[a])};
ChartUndoModel.prototype.sendToBack=function(a){var b=new SendToBackCommand(this.m_model,a);this.pushUndoCommand(b);b.redo();this.emitEvent("changeZOrder",[a])};ChartUndoModel.prototype.bringToFront=function(a){var b=new BringToFrontCommand(this.m_model,a);this.pushUndoCommand(b);b.redo();this.emitEvent("changeZOrder",[a])};
ChartUndoModel.prototype.removeAllStudies=function(){this.beginUndoMacro("remove all studies");for(var a=this.m_model.dataSources(),b=0;b<a.size();b++){var c=a.item(b);isInherited(c.constructor,TradingView.Study)&&c.removeByRemoveAllStudies()&&this.removeSource(c)}this.endUndoMacro()};
ChartUndoModel.prototype.removeAllDrawingTools=function(a){this.beginUndoMacro("remove all drawing tools");for(var b=this.m_model.dataSources(),c=0;c<b.size();c++){var d=b.item(c);isInherited(d.constructor,LineDataSource)&&d.isActualSymbol()&&d.userEditEnabled()&&(a&&a!=d._constructor||this.removeSource(d))}this.endUndoMacro()};
ChartUndoModel.prototype.moveDown=function(){try{this.beginUndoMacro("Move Down")}catch(a){return}var b=this,c=this.m_model.mainSeries(),d=this.m_model.paneForSource(c),e=d.priceScaleForSource(c);e.setAutoScale(!1);c=e.height();TradingView.animate(c/5,function(a){b.startScrollPrice(d,e,0);b.scrollPriceTo(d,e,a);b.endScrollPrice(d,e)},function(){b.endUndoMacro()})};
ChartUndoModel.prototype.moveUp=function(){try{this.beginUndoMacro("Move Up")}catch(a){return}var b=this,c=this.m_model.mainSeries();pane=this.m_model.paneForSource(c);scale=pane.priceScaleForSource(c);scale.setAutoScale(!1);c=scale.height();TradingView.animate(c/5,function(a){b.startScrollPrice(pane,scale,a);b.scrollPriceTo(pane,scale,0);b.endScrollPrice(pane,scale)},function(){b.endUndoMacro()})};
ChartUndoModel.prototype.moveLeft=function(){try{this.beginUndoMacro("Move Left")}catch(a){return}var b=this.m_model.timeScale().width(),c=this;TradingView.animate(b/5,function(a){c.startScrollTime(a);c.scrollTimeTo(0);c.endScrollTime()},function(){c.endUndoMacro()})};
ChartUndoModel.prototype.moveRight=function(){try{this.beginUndoMacro("Move Right")}catch(a){return}var b=this.m_model.timeScale().width(),c=this;TradingView.animate(b/5,function(a){c.startScrollTime(0);c.scrollTimeTo(a);c.endScrollTime()},function(){c.endUndoMacro()})};ChartUndoModel.prototype.scrollChart=function(a){this.startScrollTime(0);this.scrollTimeTo(a);this.endScrollTime()};
ChartUndoModel.prototype.zoomIn=function(a,b){var c=this.m_model.timeScale().width(),d=this;b=b||1;if(this.canZoomIn())if(a){var c=b*c/10,e=c*((a+1)/2);this.startScaleTime(c);this.scaleTimeTo(0);this.endScaleTime();this.startScrollTime(0);this.scrollTimeTo(c-e);this.endScrollTime();this._onSimpleZoomIn.fire()}else{try{this.beginUndoMacro("Zoom In")}catch(f){return}TradingView.animate(c/5,function(a){d.startScaleTime(a);d.scaleTimeTo(0);d.endScaleTime();d.startScrollTime(0);d.scrollTimeTo(a/2);d.endScrollTime()},
function(){d.endUndoMacro();d._onSimpleZoomIn.fire()})}};
ChartUndoModel.prototype.zoomOut=function(a,b){var c=this.m_model.timeScale().width(),d=this;b=b||1;if(this.canZoomOut())if(a)this.startScaleTime(0),this.scaleTimeTo(b*c/10),this.endScaleTime(),this.startScrollTime(b*(c/20-c/20*a)),this.scrollTimeTo(0),this.endScrollTime(),this._onSimpleZoomOut.fire();else{try{this.beginUndoMacro("Zoom Out")}catch(e){return}TradingView.animate(c/5,function(a){d.startScaleTime(0);d.scaleTimeTo(a);d.endScaleTime();d.startScrollTime(a/2);d.scrollTimeTo(0);d.endScrollTime()},
function(){d.endUndoMacro();d._onSimpleZoomOut.fire()})}};ChartUndoModel.prototype.resetScales=function(){this.beginUndoMacro("Reset scales");this.resetTimeScale();for(var a=0;a<this.panes().size();a++){var b=this.panes().item(a);this.resetPriceScale(b,b.leftPriceScale());this.resetPriceScale(b,b.rightPriceScale())}this.endUndoMacro();this.m_model.recalculateAllPanes()};
ChartUndoModel.prototype.zoomToViewport=function(a,b,c,d,e){a=new ZoomCommand(this.m_model,a,b,c,d,e);a=new ZoomWrapperUndoCommand(a,this.m_zoomStack,!0);a.redo();this.pushUndoCommand(a)};ChartUndoModel.prototype.zoomFromViewport=function(){var a=new ZoomWrapperUndoCommand(this.m_zoomStack.head(),this.m_zoomStack,!1);a.redo();this.pushUndoCommand(a)};ChartUndoModel.prototype.zoomStack=function(){return this.m_zoomStack};
ChartUndoModel.prototype.addPaneStretchFactorUndoCommand=function(a,b,c,d){a=new SetPaneStretchFactorUndoCommand(this.m_model,a,b,c,d);this.pushUndoCommand(a)};ChartUndoModel.prototype.restoreFactoryDefaults=function(a){a=new RestoreDefaultsUndoCommand(this.m_model,a);a.redo();this.pushUndoCommand(a)};ChartUndoModel.prototype.chartLoadTheme=function(a,b){var c=new ChartLoadThemeUndoCommand(a,b);c.redo();this.pushUndoCommand(c)};
ChartUndoModel.prototype.drawingLoadTemplate=function(a,b){var c=new DrawingLoadTemplateUndoCommand(a,b);c.redo();this.pushUndoCommand(c)};ChartUndoModel.prototype.studyLoadTemplate=function(a,b,c,d){a=new StudyLoadTemplateUndoCommand(a,b,c,d);a.redo();this.pushUndoCommand(a)};ChartUndoModel.prototype.onSimpleZoomIn=function(){return this._onSimpleZoomIn};ChartUndoModel.prototype.onSimpleZoomOut=function(){return this._onSimpleZoomOut};
ChartUndoModel.prototype.loadRange=function(a){a.res!==this.m_model.mainSeries().properties().interval.value()?(this.m_model.mainSeries()._pendingInterval=a.val,this.setProperty(this.m_model.mainSeries().properties().interval,a.res,"Change date range")):this.m_model.mainSeries().loadDataTo(a.val)};ChartUndoModel.prototype.cloneLineTool=function(a){a=new CloneLineToolUndoCommand(this.m_model,a);a.redo();this.pushUndoCommand(a);this.emitEvent("cloneLineTool")};
ChartUndoModel.prototype._preparePriceAxisProperties=function(a,b){var c=a.lockScale.value(),d=a.style.value()==TradingView.Series.STYLE_PNF;if(d||c)b.log.setValue(!1),b.percentage.setValue(!1);b.logDisabled.setValue(!(!d&&!c));b.percentageDisabled.setValue(!(!d&&!c))};function UndoCommand(a){this._text=a}UndoCommand.prototype.text=function(){return this._text};UndoCommand.prototype.undo=function(){throw"pure virtual call ;)";};UndoCommand.prototype.redo=function(){throw"pure virtual call ;)";};
function UndoStack(){this.m_commands=new List;this.m_commands.setValidator(new TypeValidator(UndoCommand));this._onChange=new Delegate}UndoStack.prototype.onChange=function(){return this._onChange};UndoStack.prototype.isEmpty=function(){return this.m_commands.isEmpty()};UndoStack.prototype.clear=function(){this.m_commands.clear();this._onChange.fire()};UndoStack.prototype.push=function(a){this.m_commands.append(a);this._onChange.fire()};
UndoStack.prototype.pop=function(){if(this.m_commands.isEmpty())TradingView.logDebug("UndoStack.pop: undo stack is empty");else{var a=this.m_commands.item(this.m_commands.size()-1);this.m_commands.removeAt(this.m_commands.size()-1);this._onChange.fire();return a}};UndoStack.prototype.head=function(){if(this.m_commands.isEmpty())TradingView.logDebug("UndoStack.head: undo stack is empty");else return this.m_commands.item(this.m_commands.size()-1)};
function UndoMacroCommand(a){UndoCommand.call(this,a);this._subcommands=new List}inherit(UndoMacroCommand,UndoCommand);UndoMacroCommand.prototype.addCommand=function(a){this._subcommands.append(a)};UndoMacroCommand.prototype.isEmpty=function(){return this._subcommands.isEmpty()};UndoMacroCommand.prototype.redo=function(){for(var a=0;a<this._subcommands.size();a++)this._subcommands.item(a).redo()};UndoMacroCommand.prototype.undo=function(){for(var a=this._subcommands.size()-1;0<=a;a--)this._subcommands.item(a).undo()};
function SetPropertyCommand(a,b,c,d){UndoCommand.call(this,c);this._targetObj=a;this._newValue=b;this._model=d}inherit(SetPropertyCommand,UndoCommand);SetPropertyCommand.prototype.redo=function(){this._oldValue=this._targetObj.value();TradingView.saveDefaultProperties(!0);this._targetObj.setValue(this._newValue);TradingView.saveDefaultProperties(!1);this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};
SetPropertyCommand.prototype.undo=function(){TradingView.saveDefaultProperties(!0);this._targetObj.setValue(this._oldValue);TradingView.saveDefaultProperties(!1);this._oldValue=null;this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};function SetAutoScalePropertyCommand(a,b,c,d,e){UndoCommand.call(this,d);this._property=a;this._priceScale=c;this._newValue=b;this._model=e}
inherit(SetAutoScalePropertyCommand,UndoCommand);
SetAutoScalePropertyCommand.prototype.redo=function(){this._oldValue=this._property.value();this._oldLockScaleValue=this._priceScale.mainSource()instanceof TradingView.Series?this._priceScale.mainSource().properties().lockScale.value():void 0;TradingView.saveDefaultProperties(!0);this._property.setValue(this._newValue);this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(!1);TradingView.saveDefaultProperties(!1);this._model&&(this._model.recalculateAllPanes(),
this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};SetAutoScalePropertyCommand.prototype.undo=function(){TradingView.saveDefaultProperties(!0);this._property.setValue(this._oldValue);this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(this._oldLockScaleValue);TradingView.saveDefaultProperties(!1);this._oldValue=null;this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};
function SetPercentagePropertyCommand(a,b,c,d,e){UndoCommand.call(this,d);this._percentage=a;this._priceScale=c;this._newValue=b;this._model=e}inherit(SetPercentagePropertyCommand,UndoCommand);
SetPercentagePropertyCommand.prototype.redo=function(){this._oldValue=this._percentage.value();this._oldAutoScaleValue=this._priceScale.properties().autoScale.value();this._oldLogValue=this._priceScale.properties().log.value();this._oldLogDisabled=this._priceScale.properties().logDisabled.value();TradingView.saveDefaultProperties(!0);this._percentage.setValue(this._newValue);this._priceScale.properties().autoScaleDisabled.setValue(this._newValue);this._priceScale.properties().log.setValue(!1);TradingView.saveDefaultProperties(!1);
this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};
SetPercentagePropertyCommand.prototype.undo=function(){TradingView.saveDefaultProperties(!0);this._percentage.setValue(this._oldValue);this._priceScale.properties().autoScale.setValue(this._oldAutoScaleValue);this._priceScale.properties().autoScaleDisabled.setValue(this._oldValue);this._priceScale.properties().log.setValue(this._oldLogValue);if(!(this._oldAutoScaleValue||this._priceScale.mainSource()instanceof TradingView.Series&&this._priceScale.mainSource().isLockScale())){var a=this._model.timeScale().visibleBars();
this._priceScale.setPriceRange(this._priceScale.priceRange().convertFromPercents(this._priceScale.mainSource().close(a.firstBar())))}TradingView.saveDefaultProperties(!1);this._oldValue=null;this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};function SetLogPropertyCommand(a,b,c,d,e){UndoCommand.call(this,d);this._log=a;this._priceScale=c;this._newValue=b;this._model=e}inherit(SetLogPropertyCommand,UndoCommand);
SetLogPropertyCommand.prototype.redo=function(){this._oldValue=this._log.value();this._oldPercValue=this._priceScale.properties().percentage.value();this._oldPercDisabled=this._priceScale.properties().percentageDisabled.value();TradingView.saveDefaultProperties(!0);this._log.setValue(this._newValue);this._priceScale.properties().percentage.setValue(!1);this._priceScale.properties().autoScaleDisabled.setValue(this._priceScale.properties().percentage.value());TradingView.saveDefaultProperties(!1);this._model&&
(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};SetLogPropertyCommand.prototype.undo=function(){TradingView.saveDefaultProperties(!0);this._log.setValue(this._oldValue);this._priceScale.properties().percentage.setValue(this._oldPercValue);TradingView.saveDefaultProperties(!1);this._oldValue=null;this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};
function SetChartStyleCommand(a,b,c,d,e,f){UndoCommand.call(this,d);this._style=a;this._mainSeries=c;this._priceAxisProperties=c.properties().priceAxisProperties;this._newValue=b;this._model=e;this._chartWidget=f}inherit(SetChartStyleCommand,UndoCommand);
SetChartStyleCommand.prototype.redo=function(){var a=$.Deferred().resolve();this._mainSeries._properties.style===this._style&&this._model.mainSeries().isNeedRestart(this._newValue)&&(a=this._chartWidget.screen.show());a.done(function(){this._oldValue=this._style.value();this._oldAutoScale=this._priceAxisProperties.autoScale.value();this._oldLogValue=this._priceAxisProperties.log.value();this._oldLogDisabled=this._priceAxisProperties.logDisabled.value();this._oldPercentageValue=this._priceAxisProperties.percentage.value();
this._oldPercentageDisabled=this._priceAxisProperties.percentageDisabled.value();TradingView.saveDefaultProperties(!0);this._style.setValue(this._newValue);this._chartWidget.model()._preparePriceAxisProperties(this._mainSeries.properties(),this._priceAxisProperties);TradingView.saveDefaultProperties(!1);this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))}.bind(this))};
SetChartStyleCommand.prototype.undo=function(){var a=$.Deferred().resolve();this._mainSeries._properties.style===this._style&&this._model.mainSeries().isNeedRestart(this._newValue)&&(a=this._chartWidget.screen.show());a.done(function(){TradingView.saveDefaultProperties(!0);this._style.setValue(this._oldValue);this._priceAxisProperties.log.setValue(this._oldLogValue);this._priceAxisProperties.logDisabled.setValue(this._oldLogDisabled);this._priceAxisProperties.percentage.setValue(this._oldPercentageValue);
this._priceAxisProperties.percentageDisabled.setValue(this._oldPercentageDisabled);this._priceAxisProperties.autoScale.setValue(this._oldAutoScale);TradingView.saveDefaultProperties(!1);this._oldValue=null;this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))}.bind(this))};
function SetLockScaleCommand(a,b,c,d,e){UndoCommand.call(this,d);this._property=a;this._mainSeries=c;this._priceAxisProperties=c.properties().priceAxisProperties;this._newValue=b;this._model=e}inherit(SetLockScaleCommand,UndoCommand);
SetLockScaleCommand.prototype.redo=function(){this._oldValue=this._property.value();this._oldAutoScale=this._priceAxisProperties.autoScale.value();this._oldPercentage=this._priceAxisProperties.percentage.value();this._oldLog=this._priceAxisProperties.log.value();TradingView.saveDefaultProperties(!0);this._newValue&&(this._priceAxisProperties.percentage.setValue(!1),this._priceAxisProperties.log.setValue(!1),this._priceAxisProperties.autoScale.setValue(!1));var a=this._mainSeries.properties().style.value();
a!==TradingView.Series.STYLE_RENKO&&a!==TradingView.Series.STYLE_KAGI&&a!==TradingView.Series.STYLE_PNF&&a!==TradingView.Series.STYLE_PB&&this._mainSeries.fixBoxSize();this._property.setValue(this._newValue);TradingView.saveDefaultProperties(!1);this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};
SetLockScaleCommand.prototype.undo=function(){TradingView.saveDefaultProperties(!0);this._priceAxisProperties.percentage.setValue(this._oldPercentage);this._priceAxisProperties.log.setValue(this._oldLog);this._priceAxisProperties.autoScale.setValue(this._oldAutoScale);this._property.setValue(this._oldValue);TradingView.saveDefaultProperties(!1);this._oldValue=null;this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)))};
PriceScaleChangeUndoCommand=function(a,b,c,d){this.m_model=a;this.m_pane=b;this.m_priceScale=c;this.m_state=d;this.m_newPriceScaleState=null};inherit(PriceScaleChangeUndoCommand,UndoCommand);PriceScaleChangeUndoCommand.prototype.undo=function(){null!==this.m_newPriceScaleState?TradingView.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newPriceScaleState=this.m_priceScale.state(),this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_state),this.m_priceScale.recalcLockedScale(null))};
PriceScaleChangeUndoCommand.prototype.redo=function(){null===this.m_newPriceScaleState?TradingView.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_newPriceScaleState),this.m_newPriceScaleState=null)};TimeScaleChangeUndoCommand=function(a,b,c){UndoCommand.call(this,c);this.m_model=a;this.m_state=b;this.m_newTimeScaleState=null};inherit(TimeScaleChangeUndoCommand,UndoCommand);
TimeScaleChangeUndoCommand.prototype.undo=function(){null!==this.m_newTimeScaleState?TradingView.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newTimeScaleState=this.m_model.timeScale().state(),this.m_model.restoreTimeScaleState(this.m_state),this.m_model.timeScale().recalcLockedScale())};
TimeScaleChangeUndoCommand.prototype.redo=function(){null===this.m_newTimeScaleState?TradingView.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restoreTimeScaleState(this.m_newTimeScaleState),this.m_newTimeScaleState=null)};ModifySeriesUndoCommand=function(a,b,c,d){this._model=a;this._series=b;this._oldSymbol=b.symbol();this._oldInterval=b.interval();this._symbol=c;this._interval=d};inherit(ModifySeriesUndoCommand,UndoCommand);
ModifySeriesUndoCommand.prototype.redo=function(){this._model.modifySeries(this._series,this._symbol,this._interval)};ModifySeriesUndoCommand.prototype.undo=function(){this._model.modifySeries(this._series,this._oldSymbol,this._oldInterval)};InsertStudyCommand=function(a,b,c,d){UndoCommand.call(this,"Insert "+b.id);this._model=a;this._studyMetaInfo=b;this._props=c;this._isOverlay=d};inherit(InsertStudyCommand,UndoCommand);
InsertStudyCommand.prototype.redo=function(){return this._study=this._model.insertStudy(this._studyMetaInfo,this._props,this._isOverlay)};InsertStudyCommand.prototype.undo=function(){this._model.removeSource(this._study)};function RemoveSourceCommand(a,b){this._model=a;this._source=b}inherit(RemoveSourceCommand,UndoCommand);
RemoveSourceCommand.prototype.redo=function(){var a=this._model.paneForSource(this._source);this._paneIndex=this._model.panes().indexOf(a);this._priceScaleName=a.priceScaleName(this._source.priceScale());var b=this._model.children(this._source);this._removeChildUndoCommands=new List;for(var c=0;c<b.size();c++){var d=b.item(c),d=new RemoveSourceCommand(this._model,d);this._removeChildUndoCommands.append(d);d.redo()}this._paneState=a.state();this._restorePane=this._model.removeSource(this._source);
this._model.recalculateAllPanes();this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE,!0))};
RemoveSourceCommand.prototype.undo=function(){var a;a=this._restorePane?this._model.createPane(this._paneIndex):this._model.panes().item(this._paneIndex);var b=this._source.ownerSource()?this._source.ownerSource().priceScale():a.priceScaleByName(this._priceScaleName);a.addDataSource(this._source,b);this._source.start();this._source.restore&&this._source.restore();this._restorePane&&a.restoreState(this._paneState);for(a=this._removeChildUndoCommands.size()-1;0<=a;a--)this._removeChildUndoCommands.item(a).undo();
this._removeChildUndoCommands.clear();this._model.recalculateAllPanes();this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE,!0))};
function MoveUndoCommand(a,b,c,d,e){this._model=a;this._source=b;this._scale=e;this._sources=new List;this._sources.append(b);this._sources.appendAll(this._model.children(b));this._oldPane=c;this._oldPaneIndex=a.panes().indexOf(c);this._oldPaneState=this._oldPane.state();this._oldScaleName=c.priceScaleName(b.priceScale());this._pane=d;this._samePane=this._pane===this._oldPane}inherit(MoveUndoCommand,UndoCommand);MoveUndoCommand.prototype.redo=function(){this._model.move(this._source,this._pane,this._scale)};
MoveUndoCommand.prototype.undo=function(){var a=!1;if(this._samePane)this._oldPane.restoreState(this._oldPaneState);else{for(var b=0;b<this._sources.size();b++)this._model.detachSource(this._sources.item(b));if(this._model.panes().contains(this._oldPane)){for(var c=this._oldPane.priceScaleByName(this._oldScaleName),b=0;b<this._sources.size();b++)this._oldPane.addDataSource(this._sources.item(b),c);this._oldPane.restoreState(this._oldPaneState)}else{this._oldPane=this._model.createPane(this._oldPaneIndex);
c=this._oldPane.priceScaleByName(this._oldScaleName);for(b=0;b<this._sources.size();b++)this._oldPane.addDataSource(this._sources.item(b),c);a=!0}}this._model.recalculateAllPanes();a&&this._model.invalidate(new TradingView.InvalidateMask(TradingView.ChartWidget.FULL_UPDATE))};function CreateLineUndoCommand(a,b,c,d){UndoCommand.call(this,"Create line "+b.toolname);this._model=a;this._line=b;this._paneIndex=a.panes().indexOf(c);this._points=new List;this._points.append({point:d})}
inherit(CreateLineUndoCommand,UndoCommand);CreateLineUndoCommand.prototype.coninueCreatingLine=function(a,b){this._points.append({point:a,envState:b})};CreateLineUndoCommand.prototype.undo=function(){this._model.removeSource(this._line)};
CreateLineUndoCommand.prototype.redo=function(){var a=this._model.panes().item(this._paneIndex);this._line=this._model.createLineTool(a,this._points.item(0).point,this._line.toolname);for(a=1;a<this._points.size();a++)this._model.coninueCreatingLine(this._points.item(a).point,this._points.item(a).envState)};function ChangeLineUndoCommand(a,b,c,d){this._model=a;this._source=b;this._nextState=this._prevState=b.state(!0)}inherit(ChangeLineUndoCommand,UndoCommand);
ChangeLineUndoCommand.prototype.setPoint=function(a){this._nextState=this._source.state(!0)};ChangeLineUndoCommand.prototype.endChanging=function(){this._nextState=this._source.state(!0)};ChangeLineUndoCommand.prototype.undo=function(){var a=this._source,b=this._prevState;a.restorePoints(b.points,b.indexes||[]);a.properties().merge(b.state);a.restoreData&&a.restoreData(b);a.createServerPoints();this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};
ChangeLineUndoCommand.prototype.redo=function(){var a=this._source,b=this._nextState;a.restorePoints(b.points,b.indexes||[]);a.properties().merge(b.state);a.restoreData&&a.restoreData(b);a.createServerPoints();this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};function MoveLineUndoCommand(a,b,c){this._model=a;this._source=b;this._origPoint=c instanceof MathEx.Point?c.clone():TradingView.clone(c)}inherit(MoveLineUndoCommand,UndoCommand);
MoveLineUndoCommand.prototype.setPoint=function(a){this._point=a instanceof MathEx.Point?a.clone():TradingView.clone(a)};MoveLineUndoCommand.prototype.undo=function(){this._model.startMovingSource(this._source,this._point);this._model.moveSource(this._origPoint);this._model.endMovingSource()};MoveLineUndoCommand.prototype.redo=function(){this._model.startMovingSource(this._source,this._origPoint);this._model.moveSource(this._point);this._model.endMovingSource()};
function ChangeZOrderCommand(a,b,c){UndoCommand.call(this,"Change "+b.title()+" Z order");this._model=a;this._source=b;this._shift=c}inherit(ChangeZOrderCommand,UndoCommand);ChangeZOrderCommand.prototype.undo=function(){this._model.changeZOrder(this._source,-this._shift)};ChangeZOrderCommand.prototype.redo=function(){this._model.changeZOrder(this._source,this._shift)};function SendToBackCommand(a,b){UndoCommand.call(this,"Change "+b.title()+" Z order");this._model=a;this._source=b}
inherit(SendToBackCommand,UndoCommand);SendToBackCommand.prototype.undo=function(){this._model.bringToFront(this._source)};SendToBackCommand.prototype.redo=function(){this._model.sendToBack(this._source)};function BringToFrontCommand(a,b){UndoCommand.call(this,"Change "+b.title()+" Z order");this._model=a;this._source=b}inherit(BringToFrontCommand,UndoCommand);BringToFrontCommand.prototype.undo=function(){this._model.sendToBack(this._source)};BringToFrontCommand.prototype.redo=function(){this._model.bringToFront(this._source)};
ChartUndoModel.prototype.removePane=function(a,b){var c=new RemovePaneCommand(this,b,a);this.pushUndoCommand(c);c.redo()};function RemovePaneCommand(a,b,c){UndoCommand.call(this,"Remove pane");this._model=a;this._index=b;this._pane=this._model.panes().item(b);this._chart=c}inherit(RemovePaneCommand,UndoCommand);RemovePaneCommand.prototype.redo=function(){this._model.panes().removeAt(this._index);this._chart._updateGui()};
RemovePaneCommand.prototype.undo=function(){this._model.panes().insert(this._pane,this._index);this._chart._updateGui()};ChartUndoModel.prototype.rearrangePanes=function(a,b,c){a=new RearrangePanesCommand(this,b,c,a);this.pushUndoCommand(a);a.redo()};function RearrangePanesCommand(a,b,c,d){UndoCommand.call(this,"Rearrange panes");this._model=a;this._index=b;this._direction=c;this._chart=d}inherit(RearrangePanesCommand,UndoCommand);
RearrangePanesCommand.prototype.redo=function(){var a=this._model.panes().item(this._index);"up"===this._direction&&0<this._index&&(this._model.panes().removeAt(this._index),this._model.panes().insert(a,this._index-1));"down"===this._direction&&this._index<this._model.panes().size()-1&&(this._model.panes().removeAt(this._index),this._model.panes().insert(a,this._index+1));this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};
RearrangePanesCommand.prototype.undo=function(){if("up"===this._direction){var a=this._model.panes().item(this._index-1);this._model.panes().removeAt(this._index-1);this._model.panes().insert(a,this._index)}"down"===this._direction&&(a=this._model.panes().item(this._index+1),this._model.panes().removeAt(this._index+1),this._model.panes().insert(a,this._index));this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};
function ZoomCommand(a,b,c,d,e,f){this._model=a;this._startBar=b;this._endBar=c;this._startPrice=d;this._endPrice=e;this._pane=f}inherit(ZoomCommand,UndoCommand);ZoomCommand.prototype.redo=function(){this._timeScaleState=this._model.timeScale().state();this._priceScaleState=this._pane.defaultPriceScale().state();this._model.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)};
ZoomCommand.prototype.undo=function(){this._model.timeScale().restoreState(this._timeScaleState);this._pane.defaultPriceScale().restoreState(this._priceScaleState);this._model.recalculateAllPanes();this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};function ZoomWrapperUndoCommand(a,b,c){this._baseCmd=a;this._zoomStack=b;this._inOut=c}inherit(ZoomWrapperUndoCommand,UndoCommand);
ZoomWrapperUndoCommand.prototype.undo=function(){this._inOut?this._baseCmd!==this._zoomStack.head()?TradingView.logDebug("zoom stack inconsistency"):(this._baseCmd.undo(),this._zoomStack.pop()):(this._baseCmd.redo(),this._zoomStack.push(this._baseCmd))};ZoomWrapperUndoCommand.prototype.redo=function(){this._inOut?(this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)):this._baseCmd!==this._zoomStack.head()?TradingView.logDebug("zoom stack inconsistency"):(this._baseCmd.undo(),this._zoomStack.pop())};
function SetPaneStretchFactorUndoCommand(a,b,c,d,e){this._model=a;this._paneA=b;this._paneB=c;this._prevStretchA=d;this._currStretchA=e}inherit(SetPaneStretchFactorUndoCommand,UndoCommand);SetPaneStretchFactorUndoCommand.prototype.redo=function(){var a=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._currStretchA;this._paneB._stretchFactor=a-this._currStretchA;this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};
SetPaneStretchFactorUndoCommand.prototype.undo=function(){var a=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._prevStretchA;this._paneB._stretchFactor=a-this._prevStretchA;this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};function RestoreDefaultsUndoCommand(a,b){UndoCommand.call(this,"Restore Defaults");this._model=a;this._defaultProperty=b;this._state=b.state(b._exclusions)}inherit(RestoreDefaultsUndoCommand,UndoCommand);
RestoreDefaultsUndoCommand.prototype.redo=function(){this._model.restoreFactoryDefaults(this._defaultProperty)};RestoreDefaultsUndoCommand.prototype.undo=function(){this._defaultProperty.merge(this._state);this._defaultProperty.listeners().fire(this._defaultProperty);this._model.mainSeries().onChartStyleChanged()};
function ChartLoadThemeUndoCommand(a,b){UndoCommand.call(this,"Apply Chart Theme");this._model=a;this._newChartProps=b.chartProperties;this._newSeriesProps=b.mainSourceProperties;this._newChartProps.symbolWatermarkProperties||(this._newChartProps.symbolWatermarkProperties=defaults("chartproperties.symbolWatermarkProperties"),this._newChartProps.symbolWatermarkProperties.color=this._newChartProps.scalesProperties.textColor);this._oldChartProps=a.properties().state();delete this._oldChartProps.paneProperties.topMargin;
delete this._oldChartProps.paneProperties.bottomMargin;this._oldSeriesProps=a.properties().state().mainSeriesProperties}inherit(ChartLoadThemeUndoCommand,UndoCommand);
ChartLoadThemeUndoCommand.prototype._merge=function(a,b){var c=this._model;TradingView.saveDefaultProperties(!0);a&&(c.properties().paneProperties.merge(a.paneProperties),c.properties().scalesProperties.merge(a.scalesProperties),c.properties().symbolWatermarkProperties.merge(a.symbolWatermarkProperties));c.mainSeries().properties().merge(b);c.mainSeries().properties().saveDefaults();c.mainSeries().createPaneView();c._version=b.version;c.recalculateAllPanes();c.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));
c.properties().saveDefaults();c.properties().listeners().fire(this._properties);TradingView.saveDefaultProperties(!1)};ChartLoadThemeUndoCommand.prototype.undo=function(){this._merge(this._oldChartProps,this._oldSeriesProps);this._model.mainSeries().onChartStyleChanged()};ChartLoadThemeUndoCommand.prototype.redo=function(){this._merge(this._newChartProps,this._newSeriesProps);this._model.mainSeries().onChartStyleChanged()};
function DrawingLoadTemplateUndoCommand(a,b){UndoCommand.call(this,"Apply Drawing Template");this._source=a;this._oldProps=a.properties().state();this._newProps=b}inherit(DrawingLoadTemplateUndoCommand,UndoCommand);DrawingLoadTemplateUndoCommand.prototype._merge=function(a){var b=this._source;b.properties().merge(a);b.properties().saveDefaults();b.updateAllViews();b._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
DrawingLoadTemplateUndoCommand.prototype.undo=function(){this._merge(this._oldProps)};DrawingLoadTemplateUndoCommand.prototype.redo=function(){this._merge(this._newProps)};function StudyLoadTemplateUndoCommand(a,b,c,d){UndoCommand.call(this,(" "+d||"")+" Study template");this._model=a;this._oldProps=b;this._newProps=c}inherit(StudyLoadTemplateUndoCommand,UndoCommand);
StudyLoadTemplateUndoCommand.prototype._merge=function(a){var b=this._model.model(),c=b.mainSeries();c.properties().lockScale.setValue(!1);a.interval&&c.properties().interval.setValue(a.interval);for(var d=[],e=b.panes(),f=e.size();f--;)for(var g=e.item(f),h=g.containsMainSeries(),k=g.dataSources(),g=k.size();g--;){var m=k.item(g);if(!h||m instanceof TradingView.Study)m.isRemovedByStudyTemplates()||d.push(m),b.removeSource(m)}h=a.panes;for(f=0;f<h.length;f++){for(var k=!1,n=h[f],g=0;g<n.sources.length;g++)m=
n.sources[g],"MainSeries"===m.type&&(delete m.state,k=!0);g=k?e.item(f):b.createPane(f);g.restoreState(h[f],!1,a.version);if(k)for(m=0;m<d.length;m++)d[m].restore&&d[m].restore(),g.dataSources().append(d[m])}c.priceScale().setAutoScale(!0);b._version=a.version;b.startNotStartedStudies();b.recalculateAllPanes();b.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};StudyLoadTemplateUndoCommand.prototype.undo=function(){this._merge(this._oldProps);this._model.model().mainSeries().onChartStyleChanged()};
StudyLoadTemplateUndoCommand.prototype.redo=function(){this._merge(this._newProps);this._model.model().mainSeries().onChartStyleChanged();var a=this._model.model().mainSeries().properties(),b=this._model.model().mainSeries().properties().priceAxisProperties;this._model._preparePriceAxisProperties(a,b)};
function SetPriceScaleMarginsCommand(a,b,c,d,e){this._model=a;this._pane=b;this._priceScale=c;this._topMargin=d;this._bottomMargin=e;this._oldTopMargin=c.topMargin();this._oldBottomMargin=c.bottomMargin()}inherit(SetPriceScaleMarginsCommand,UndoCommand);SetPriceScaleMarginsCommand.prototype.redo=function(){this._priceScale.setTopMargin(this._topMargin);this._priceScale.setBottomMargin(this._bottomMargin);this._model.recalculatePane(this._pane,!1)};
SetPriceScaleMarginsCommand.prototype.undo=function(){this._priceScale.setTopMargin(this._oldTopMargin);this._priceScale.setBottomMargin(this._oldBottomMargin);this._model.recalculatePane(this._pane,!1)};function LoadRangeUndoCommand(a,b){this._model=a;this._range=b}inherit(LoadRangeUndoCommand,UndoCommand);LoadRangeUndoCommand.prototype.redo=function(){this._model.mainSeries().loadDataTo(this._range)};
function SetScreenChartPropertyUndoCommand(a,b,c,d){UndoCommand.call(this,a);this._property=b;this._value=c;this._prevValue=b.value();this._cw=d}inherit(SetScreenChartPropertyUndoCommand,UndoCommand);SetScreenChartPropertyUndoCommand.prototype.redo=function(){this._cw.screen.show().done(function(){this._property.setValue(this._value)}.bind(this))};SetScreenChartPropertyUndoCommand.prototype.undo=function(){this._cw.screen.show().done(function(){this._property.setValue(this._prevValue)}.bind(this))};
function CloneLineToolUndoCommand(a,b){UndoCommand.call(this,"clone "+b.title());this._model=a;this._source=b;this._points=new List}inherit(CloneLineToolUndoCommand,UndoCommand);
CloneLineToolUndoCommand.prototype.redo=function(){if(this._source){var a=this._source,b=a.priceScale(),c=this._model.paneForSource(a),d=TradingView.className(a.constructor);this._line=new TradingView[d](this._model,new DefaultProperty(d.toLowerCase(),a.properties().state()));this._line.setOwnerSource(a.ownerSource());this._line.properties().visible._value=!0;this._line._fixedPoints.appendAll(a._fixedPoints);for(var e=0;e<this._line._fixedPoints.size();e++)this._line._fixedPoints.setItem(e,this._line._fixedPoints.item(e).add(new MathEx.Point(20,
20)));var f=a._timePoint.toArray(),d=[];if(b.isPercent())var g=a.ownerSource().firstValue();this._line.cloneData&&this._line.cloneData(a);for(e=0;e<f.length;e++){var h={offset:f[e].offset,time_t:f[e].time_t},k=f[e].price;b.isPercent()&&(k=b.priceRange().convertToPercent(k,g));k=b.priceToCoordinate(k);k-=40;k=b.coordinateToPrice(k);b.isPercent()&&(k=b.priceRange().convertFromPercent(k,g));h.price=k;d.push(h)}g=a._points.toArray();this._line.restorePoints(d,g);c.addDataSource(this._line,b);this._model.updateSource(this._line);
this._line.checkAlert&&this._line.checkAlert();this._points=this._line.points();this._paneIndex=this._model.panes().indexOf(c);this._toolname=a._constructor;delete this._source}else for(c=this._model.panes().item(this._paneIndex),this._line=this._model.createLineTool(c,this._points.item(0),this._toolname),e=1;e<this._points.size();e++)this._model.coninueCreatingLine(this._points.item(e))};
CloneLineToolUndoCommand.prototype.undo=function(){this._model.removeSource(this._line);this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE,!0))};TradingView.UndoHistory.setWatchedValue=function(a,b,c){a.value()!==b&&(a=new SetWatchedValueCommand(a,b,c),this.pushUndoCommand(a),a.redo())};function SetWatchedValueCommand(a,b,c){UndoCommand.call(this,c);this._wv=a;this._newValue=b;this._oldValue=a.value()}inherit(SetWatchedValueCommand,UndoCommand);
SetWatchedValueCommand.prototype.redo=function(){this._wv.setValue(this._newValue)};SetWatchedValueCommand.prototype.undo=function(){this._wv.setValue(this._oldValue)};function ChartModel(a,b,c,d,e,f,g,h){this._version=ChartModel.version;this._readOnly=d;this._undoModel=h;this._studiesMetaData=f;this._studyVersioning=new TradingView.StudyVersioning(this._studiesMetaData,g);this.m_timeScale=new TimeScale(this,c.timeScale);this.m_panes=new List;this.m_gridSource=new Grid;this.m_crossHairSource=new CrossHair(this,TradingView.drawingState.properties());this.m_width=0;this._tagsChanged=new Delegate;this._properties=c;this._lineCancelled=new Delegate;this._magnet=new TradingView.Magnet(TradingView.drawingState.properties().magnet,
this.m_timeScale,c.paneProperties.magnetSensivity);var k=new DefaultProperty("chartproperties.mainSeriesProperties");k.addExclusion("lockScale");k.addExclusion("minTick");k.addExclusion("priceAxisProperties.percentage");k.addExclusion("priceAxisProperties.log");this.createPane(void 0,!1,{rightAxisProperties:k.priceAxisProperties.state(["autoScale"])});this.m_panes.item(0)._stretchFactor=2*Pane.DEFAULT_STRETCH_FACTOR;this.m_selectedSource=null;this._selectedSourceChanged=new Delegate;this._chartApi=
a;this._invalidateHandler=b;this.m_hoveredSource=null;this._properties.listeners().subscribe(this,ChartModel.prototype.propertyChangeHandler);var m=this;this._properties.timezone.listeners().subscribe(null,function(){m._chartApi&&m._chartApi.connected()&&m._chartApi.switchTimezone(m.timezone())});this._properties.timeScale.rightOffset.listeners().subscribe(null,function(){m.m_timeScale.setOffset(m._properties.timeScale.rightOffset.value());m.recalculateAllPanes()});k.merge(c.mainSeriesProperties.state());
this.m_mainSeries=new TradingView.Series(this,k,e);this.panes().item(0).addDataSource(this.m_mainSeries,this.panes().item(0).rightPriceScale());d||(k.addChild("priceAxisProperties",this.m_mainSeries.m_priceScale.properties()),k.lockScale.listeners().subscribe(this,function(a){if(a=a.value())k.priceAxisProperties.percentage.setValue(!1),k.priceAxisProperties.logDisabled.setValue(!1);k.priceAxisProperties.percentageDisabled.setValue(a);k.priceAxisProperties.logDisabled.setValue(a)}));this._barsMarksSources=
[];a=TradingView.isRunningChartingLibrary?new UserDefinedBarsMarks(this):new PublishedChartsTimeline(this);a.setOwnerSource(this.m_mainSeries);this._barsMarksSources.push(a);this.m_watermarkSource=new Watermark(this.m_mainSeries);this._oldEndVisibleIndex=this._oldStartVisibleIndex=-1;this._currentTool="";TradingView.drawingState.hideAllDrawings().subscribe(this,ChartModel.prototype.visibilityChangeHandler)}ChartModel.prototype.currentTool=function(){return this._currentTool};
ChartModel.prototype.setCurrentTool=function(a){this._currentTool=a};ChartModel.prototype.timezone=function(){return this._properties.timezone.value()};ChartModel.prototype.version=function(){return this._version};ChartModel.prototype.initConnection=function(){this._chartApi.switchTimezone(this.timezone())};
ChartModel.prototype.dumpViews=function(){for(var a={panes:[]},b=0;b<this.m_panes.size();b++)a.panes.push(this.m_panes.item(b).dumpViews());a.dataWindow=[];for(var c=this.dataSources(),b=0;b<c.size();b++){var d=c.item(b).dataWindowView();d&&a.dataWindow.push(d.dump())}return a};ChartModel.prototype._paneInvalidationMask=function(a,b){var c=new TradingView.InvalidateMask,d=this.m_panes.indexOf(a);void 0===b&&(b=TradingView.InvalidateMask.LIGHT_UPDATE);c.invalidatePane(d,b);return c};
ChartModel.prototype.updatePane=function(a){a=this._paneInvalidationMask(a);this.invalidate(a)};ChartModel.prototype.fullUpdate=function(a){this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};ChartModel.prototype.updateSource=function(a){a=this.paneForSource(a);a=this._paneInvalidationMask(a);this.invalidate(a)};ChartModel.prototype.studiesMetaData=function(){return this._studiesMetaData};ChartModel.prototype.studyVersioning=function(){return this._studyVersioning};
ChartModel.prototype.disconnect=function(){for(var a=this.dataSources(),b=0;b<a.size();b++)a.item(b).disconnect&&a.item(b).disconnect()};ChartModel.prototype.restart=function(){this.initConnection();this.m_timeScale.reset();this.m_mainSeries.restart();for(var a=this.dataSources(),b=0;b<a.size();b++)a.item(b).restart&&a.item(b)!==this.m_mainSeries&&a.item(b).restart()};
ChartModel.prototype.startNotStartedStudies=function(){if(!this.m_mainSeries.isStarted())throw Error("Cannot start studies: main series is not started");for(var a=this.dataSources(),b=0;b<a.size();b++)a.item(b)instanceof TradingView.Study&&!a.item(b).isStarted()&&a.item(b).restart&&a.item(b)!==this.m_mainSeries&&a.item(b).restart()};
ChartModel.prototype.updateLineTools=function(){for(var a=this.dataSources(),b=0;b<a.size();b++)if(isInherited(a.item(b).constructor,LineDataSource)){var c=a.item(b);c.tryCreateServerPoints();c.checkAlert&&c.checkAlert()}};ChartModel.prototype.realignLineTools=function(){for(var a=this.dataSources(),b=0;b<a.size();b++)isInherited(a.item(b).constructor,LineDataSource)&&a.item(b).calcIsActualSymbol();for(b=0;b<this.panes().size();b++)this.panes().item(b).invalidateSourcesCache()};
ChartModel.prototype.readOnly=function(){return this._readOnly};ChartModel.prototype.properties=function(){return this._properties};ChartModel.prototype.lineCancelled=function(){return this._lineCancelled};ChartModel.prototype.chartApi=function(){return this._chartApi};ChartModel.prototype.propertyChangeHandler=function(){this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.visibilityChangeHandler=function(){this.setSelectedSource();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.updateAllPaneViews=function(){for(var a=0;a<this.panes().size();a++)this.panes().item(a).updateAllViews()};ChartModel.prototype.mainSeries=function(){return this.m_mainSeries};ChartModel.prototype.timeScale=function(){return this.m_timeScale};ChartModel.prototype.panes=function(){return this.m_panes};ChartModel.prototype.gridSource=function(){return this.m_gridSource};ChartModel.prototype.watermarkSource=function(){return this.m_watermarkSource};
ChartModel.prototype.crossHairSource=function(){return this.m_crossHairSource};ChartModel.prototype.publishedChartsTimelineSource=function(){for(var a=0;a<this._barsMarksSources.length;++a)if(this._barsMarksSources[a]instanceof PublishedChartsTimeline)return this._barsMarksSources[a]};ChartModel.prototype.barsMarksSources=function(){return this._barsMarksSources};ChartModel.prototype.width=function(){return this.m_width};ChartModel.prototype.setPaneHeight=function(a,b){a.setHeight(b)};
ChartModel.prototype.setWidth=function(a){this.m_width=a;this.m_timeScale.setWidth(this.m_width);for(var b=0;b<this.m_panes.size();++b)this.m_panes.item(b).setWidth(a);this.recalculateAllPanes()};
ChartModel.prototype.createPane=function(a,b,c){var d=this._properties.paneProperties;c&&d.merge(c);b=new Pane(this.m_timeScale,d,this,b);if(void 0!==a){if(0>a||a>this.m_panes.size()){TradingView.logDebug("ChartModel.createPane: invalid index: "+a);return}this.m_panes.insert(b,a)}else this.m_panes.append(b);b.onTagsChanged().subscribe(this,ChartModel.prototype.onPaneTagsChanged);return b};ChartModel.prototype.removePane=function(a){this.m_panes.remove(a);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};
ChartModel.prototype.startScalePrice=function(a,b,c){a.startScalePrice(b,c)};ChartModel.prototype.scalePriceTo=function(a,b,c){a.scalePriceTo(b,c);this.mainSeries().properties().lockScale.value()?this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)):this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.endScalePrice=function(a,b){a.endScalePrice(b);this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.startScrollPrice=function(a,b,c){a.startScrollPrice(b,c)};ChartModel.prototype.scrollPriceTo=function(a,b,c){a.scrollPriceTo(b,c);this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.endScrollPrice=function(a,b){a.endScrollPrice(b);this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.setPriceAutoScale=function(a,b,c){a.setPriceAutoScale(b,c);this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.restorePriceScaleState=function(a,b,c){a.restorePriceScaleState(b,c);this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.resetPriceScale=function(a,b){a.resetPriceScale(b);this.invalidate(this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.startScaleTime=function(a){this.m_timeScale.startScale(a)};ChartModel.prototype.scaleTimeTo=function(a){this.m_timeScale.scaleTo(a);this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.endScaleTime=function(){this.m_timeScale.endScale();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE));this.mainSeries().requestMoreData();this.recalcVisibleRangeStudy(this.dataSources())};
ChartModel.prototype.startScrollTime=function(a){this.m_timeScale.startScroll(a)};ChartModel.prototype.scrollTimeTo=function(a){this.m_timeScale.scrollTo(a);this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.endScrollTime=function(){this.m_timeScale.endScroll();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE));this.mainSeries().requestMoreData();this.recalcVisibleRangeStudy(this.dataSources())};
ChartModel.prototype.recalcVisibleRangeStudy=function(a,b){if(!this.timeScale().isEmpty()){var c=this.timeScale().visibleBars(),d=this.mainSeries().nearestData(c.firstBar(),SEARCH_NEAREST_RIGHT),c=this.mainSeries().nearestData(c.lastBar(),SEARCH_NEAREST_LEFT),e=d?d.index:void 0,f=c?c.index:void 0;if(e!=this._oldStartVisibleIndex||f!=this._oldEndVisibleIndex||b)for(this._oldStartVisibleIndex=e,this._oldEndVisibleIndex=f,e=0;e<a.size();e++)if(a.item(e)instanceof TradingView.Study)for(var f=a.item(e),
g=f.metaInfo().inputs,h=0;h<g.length;h++){if("first_visible_bar_time"==g[h].id){var k=d&&d.value?d.value[TIME_PLOT]:0;f.properties().inputs.first_visible_bar_time.setValue(1E3*Math.floor(k))}"last_visible_bar_time"==g[h].id&&(k=c&&c.value?c.value[TIME_PLOT]:0,f.properties().inputs.last_visible_bar_time.setValue(1E3*Math.floor(k)))}}};
ChartModel.prototype.resetTimeScale=function(){this.m_timeScale.restoreDefault();this.recalculateAllPanes();this.mainSeries().requestMoreData();this.recalcVisibleRangeStudy(this.dataSources());this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.restoreTimeScaleState=function(a){this.m_timeScale.restoreState(a);this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.restoreFactoryDefaults=function(a){a.restoreFactoryDefaults();this.recalcVisibleRangeStudy(this.dataSources(),!0);this.mainSeries().onChartStyleChanged()};
ChartModel.prototype.setSelectedSource=function(a,b){if(this.m_selectedSource!==a||this._lastHittestData!==b){this._lastHittestData=b;var c=new TradingView.InvalidateMask;this.m_selectedSource&&(this.m_selectedSource.updateAllViews(),this.paneForSource(this.m_selectedSource));this.m_selectedSource=a;this._selectedSourceChanged.fire(a);a&&(a.updateAllViews(),this.paneForSource(a));c.force=!0;this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE));this.setHoveredSource(a,
b)}};ChartModel.prototype.checkLineToolSelection=function(){this.m_selectedSource&&this.m_selectedSource instanceof LineDataSource&&(this.m_selectedSource.calcIsActualSymbol(),this.m_selectedSource.isActualSymbol()||this.setSelectedSource(null))};ChartModel.prototype.onSelectedSourceChanged=function(){return this._selectedSourceChanged};
ChartModel.prototype.setHoveredSource=function(a,b){if(this.m_hoveredSource!==a||this._lastHittestData!==b){this._lastHittestData=b;var c=null;this.m_hoveredSource&&(this.m_hoveredSource.updateAllViews(),c||(c=new TradingView.InvalidateMask),c.merge(this._paneInvalidationMask(this.paneForSource(this.m_hoveredSource),TradingView.InvalidateMask.LIGHT_UPDATE)));if(this.m_hoveredSource=a)a.updateAllViews(),c||(c=new TradingView.InvalidateMask),c.merge(this._paneInvalidationMask(this.paneForSource(a),
TradingView.InvalidateMask.LIGHT_UPDATE));c&&this.invalidate(c)}};ChartModel.prototype.selectedSource=function(){return this.m_selectedSource};ChartModel.prototype.hoveredSource=function(){return this.m_hoveredSource};ChartModel.prototype.lastHittestData=function(){return this._lastHittestData};ChartModel.prototype.invalidate=function(a){this._invalidateHandler&&this._invalidateHandler(a)};
ChartModel.prototype.dataSources=function(){var a=[];a.push(this.m_crossHairSource);for(var b=0;b<this.m_panes.size();++b)a=a.concat(this.m_panes.item(b).dataSources().toArray());return new List(a)};ChartModel.prototype.children=function(a){for(var b=this.dataSources(),c=new List,d=0;d<b.size();d++){var e=b.item(d);e.ownerSource()===a&&c.append(e)}return c};
ChartModel.prototype.setCurrentPosition=function(a,b,c,d){var e=NaN;a=Math.round(this.m_timeScale.coordinateToIndex(a));if(c){var f=c.defaultPriceScale();f.isEmpty()||(e=f.coordinateToPrice(b))}if(this._lineBeingCreated||LineDataSource.isLineTool(this.currentTool()))e=this._magnet.align(e,a,c);this.m_crossHairSource.setPosition(a,e,c);this.m_crossHairSource.dataWindowView().update();b=this.m_panes.toArray();for(c=b.length;c--;)for(var f=b[c].dataSources().toArray(),g=f.length;g--;){var h=f[g].dataWindowView();
h&&h.update()}this._lineBeingCreated?(this._lineBeingCreated.setLastPoint({index:a,price:e},d),this._lineBeingCreated.updateAllViews(),this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))):this.crossHairSource().startMeasurePoint()?this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE)):this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.UPDATE_CURSOR_ONLY));d=this._undoModel._chartWidget;d._chartWidgetCollection&&
(e=this.m_timeScale.points().valueAt(a),isNaN(e)&&0<a&&(e=Infinity),d._chartWidgetCollection.syncCrosshair(e,d))};ChartModel.prototype.clearCurrentPosition=function(){this.crossHairSource().visible=!1;this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.UPDATE_CURSOR_ONLY));var a=this._undoModel._chartWidget;a._chartWidgetCollection&&a._chartWidgetCollection.syncCrosshair(NaN,a)};
ChartModel.prototype.setExternalPosition=function(a){a=this.m_timeScale.points().closestIndexLeft(a);if(isFinite(a)){this.crossHairSource().setPosition(a,NaN,null);a=this.dataSources();for(var b=a.size();b--;){var c=a.item(b).dataWindowView();c&&c.update()}}else this.crossHairSource().visible=!1;this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.UPDATE_CURSOR_ONLY))};
ChartModel.prototype.updateTimeScale=function(a,b,c,d,e){if(e){this.m_timeScale.reset();e=this.dataSources();for(var f=0;f<e.size();f++)e.item(f).clearData&&e.item(f).clearData()}this.m_timeScale.update(a,b,c,d);this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.recalculatePane=function(a,b){a&&a.recalculate(b)};
ChartModel.prototype.paneForSource=function(a){for(var b=this.m_panes.size()-1;0<=b;b--)if(this.m_panes.item(b).dataSources().contains(a))return this.m_panes.item(b);return a instanceof BarsMarksContainer?this.paneForSource(this.m_mainSeries):null};ChartModel.prototype.recalculateAllPanes=function(){for(var a=0;a<this.m_panes.size();++a)this.m_panes.item(a).recalculate();this.timeScale().recalcLockedScale();this.updateAllPaneViews()};
ChartModel.prototype._invalidateBarColorerCaches=function(){for(var a=this.dataSources(),b=0;b<a.size();++b){var c=a.item(b);c instanceof TradingView.Series&&c.invalidateBarColorerCache()}};
ChartModel.prototype.insertStudy=function(a,b,c){var d=null;TradingView.trackEvent("studies","Study_"+a.id);d=c||a.is_price_study||"Volume@tv-basicstudies"==a.id?this.paneForSource(this.m_mainSeries):this.createPane(void 0,!0);"Compare@tv-basicstudies"==a.id&&(TradingView.trackEvent("compare","symbol:"+b.inputs.symbol),this.m_mainSeries.priceScale().properties().log.setValue(!1),this.m_mainSeries.priceScale().properties().percentage.setValue(!0));b=TradingView.prepareStudyProperties(a,b,d,this.studyVersioning());
b=TradingView.createStudy(this,b,this.mainSeries(),a);b.start();var e=b.metaInfo().priceScale||TradingView.Study.SCALE_RIGHT;e===TradingView.Study.SCALE_RIGHT?e=d.rightPriceScale():e===TradingView.Study.SCALE_LEFT?e=d.leftPriceScale():a.is_price_study?e=null:(console.warn("Cannot add study "+b.metaInfo().id+" with 'No Scale' setting, because study is not a price study. Using right price scale."),e=d.rightPriceScale());c?d.addDataSource(b,null):"Volume@tv-basicstudies"==a.id?(d.addDataSource(b,null),
a=b.priceScale(),a.setTopMargin(0.75),a.setBottomMargin(0)):d.addDataSource(b,e);b.properties().linkedToSeries&&b.properties().linkedToSeries.value()&&b.setOwnerSource(this.mainSeries());this.recalculatePane(d);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));this._invalidateBarColorerCaches();this.recalcVisibleRangeStudy(this.dataSources(),!0);return b};
ChartModel.prototype.detachSource=function(a,b){var c=this.paneForSource(a);if(c){c.removeDataSource(a);if(c.isEmpty())return this.removePane(c,b),!0;this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));return!1}};
ChartModel.prototype.removeSource=function(a,b){a===this.m_selectedSource&&this.setSelectedSource(null);a.stop&&a.stop();var c=this.detachSource(a,b);if(a.metaInfo&&a.metaInfo()&&"Compare@tv-basicstudies"===a.metaInfo().id){for(var d=this.paneForSource(this.m_mainSeries),e=0;e<d.dataSources().size();e++)if(d.dataSources().item(e).metaInfo&&"Compare@tv-basicstudies"===d.dataSources().item(e).metaInfo().id)return;this.m_mainSeries.priceScale().properties().percentage.setValue(!1)}this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));
this._invalidateBarColorerCaches();return c};
ChartModel.prototype.move=function(a,b,c){var d=new List,e=this.children(a);d.append(a);d.appendAll(e);var f=this.paneForSource(a);this.panes().indexOf(f);f.state();f.priceScaleName(a.priceScale());this.panes().indexOf(b);b&&b.state();c=b?b.priceScaleName(c):"right";if(f===b)for(b.move(a,b.priceScaleByName(c)),d=a.priceScale(),a=0;a<e.size();a++)b.move(e.item(a),d);else{for(a=0;a<d.size();a++)this.detachSource(d.item(a));b=b?b:this.createPane();for(a=0;a<d.size();a++)b.addDataSource(d.item(a),b.priceScaleByName(c));
this.invalidate(new TradingView.InvalidateMask(TradingView.ChartWidget.FULL_UPDATE))}this.recalculateAllPanes()};ChartModel.prototype.isSingleInstanceLineTool=function(a){return"LineStudyMtpRiskReward"==a||"LineStudyMtpAnalysis"==a?!0:!1};
ChartModel.prototype.createLineTool=function(a,b,c,d){TradingView.trackEvent("GUI","Add Line Tool");var e=TradingView[c];if(!e)return null;this.isSingleInstanceLineTool(c)&&this._undoModel.removeAllDrawingTools(c);TradingView.trackEvent("drawings","Study_Drawing_"+c);d=new e(this,d);d.toolname=c;d.setOwnerSource(a.mainDataSource());e=a.defaultPriceScale();a.addDataSource(d,e);c=this.m_timeScale.indexToCoordinate(b.index);e=e.priceToCoordinate(b.price);d.isFixed()?b=d.addFixedPoint(new MathEx.Point(c,
e)):(b.price=this._magnet.align(b.price,b.index,a),b=d.addPoint(b));b||(this._lineBeingCreated=d,this._paneBeingCreatedLineOn=a);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));return d};ChartModel.prototype.lineBeingCreated=function(){return this._lineBeingCreated};ChartModel.prototype.paneBeingCreatedLineOn=function(){return this._paneBeingCreatedLineOn};
ChartModel.prototype.coninueCreatingLine=function(a,b){var c=this.paneForSource(this._lineBeingCreated);c.defaultPriceScale();a.price=this._magnet.align(a.price,a.index,c);c=this._lineBeingCreated.addPoint(a,b);this._lineBeingCreated.updateAllViews();var d=new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE);c&&(this._lineBeingCreated=this._paneBeingCreatedLineOn=null,d.force=!0);this.invalidate(d);return c};
ChartModel.prototype.cancelCreatingLine=function(){this._lineBeingCreated&&(this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire())};
ChartModel.prototype.startChangingLinetool=function(a,b,c,d){this._lineBeingEdited=a;this._linePointBeingEdited=c;this._lineBeingEdited.startChanging(c,b);a=this.paneForSource(a);b.price=this._magnet.align(b.price,b.index,a);this._lineBeingEdited.startDragPoint&&this._lineBeingEdited.startDragPoint(c,b);this._lineBeingEdited.setPoint(c,b,d);this._lineBeingEdited.updateAllViews();b=this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE);b.force=!0;this.invalidate(b)};
ChartModel.prototype.lineBeingEdited=function(){return this._lineBeingEdited};ChartModel.prototype.linePointBeingEdited=function(){return this._linePointBeingEdited};
ChartModel.prototype.changeLinePoint=function(a,b){var c=this.paneForSource(this._lineBeingEdited);if(void 0!==a.x&&void 0!==a.y){var d=this._lineBeingEdited.priceScale().coordinateToPrice(a.y),e=Math.round(this.timeScale().coordinateToIndex(a.x)),d=this._magnet.align(d,e,c);this._lineBeingEdited.setPoint(this._linePointBeingEdited,{price:d,index:e},b)}else this._lineBeingEdited.setPoint(this._linePointBeingEdited,a,b);this._lineBeingEdited.updateAllViews();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.endChangingLinetool=function(){this.paneForSource(this._lineBeingEdited);this._lineBeingEdited.endChanging();this._linePointBeingEdited=this._lineBeingEdited=null;var a=new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE);a.force=!0;this.invalidate(a)};
ChartModel.prototype.startMovingSource=function(a,b){this._sourceBeingMoved=a;this._sourceBeingMoved.startMoving(b);var c=this.paneForSource(this._sourceBeingMoved),c=this._paneInvalidationMask(c,TradingView.InvalidateMask.LIGHT_UPDATE);c.force=!0;this.invalidate(c)};ChartModel.prototype.sourceBeingMoved=function(){return this._sourceBeingMoved};ChartModel.prototype.moveSource=function(a){this._sourceBeingMoved.move(a);this.paneForSource(this._sourceBeingMoved);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.endMovingSource=function(){var a=this.paneForSource(this._sourceBeingMoved);this._sourceBeingMoved.endMoving();this._sourceBeingMoved=null;a=this._paneInvalidationMask(a,TradingView.InvalidateMask.LIGHT_UPDATE);a.invalidateAll(TradingView.InvalidateMask.LIGHT_UPDATE);a.force=!0;this.invalidate(a)};ChartModel.prototype.calculateDefaultTags=function(){for(var a=[],b=this.dataSources(),c=0;c<b.size();c++){var d=b.item(c);d.tags&&(a=a.concat(d.tags()))}return a};
ChartModel.prototype.changeZOrder=function(a,b){this.paneForSource(a).changeZOrder(a,b);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};ChartModel.prototype.sendToBack=function(a){this.paneForSource(a).sendToBack(a);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};ChartModel.prototype.bringToFront=function(a){this.paneForSource(a).bringToFront(a);this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))};
ChartModel.prototype.onTagsChanged=function(){return this._tagsChanged};ChartModel.prototype.onPaneTagsChanged=function(){this._tagsChanged.fire()};ChartModel.prototype.setTimeViewport=function(a,b){this.timeScale().zoomToBarsRange(a,b);this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
ChartModel.prototype.zoomToViewport=function(a,b,c,d,e){this.setTimeViewport(a,b);a=Math.min(c,d);c=Math.max(c,d);d=e.defaultPriceScale();d.setAutoScale(!1);d.isLog()&&(a=d.priceToLogical(a),c=d.priceToLogical(c));d.setPriceRange(new PriceRange(a,c));this.recalculateAllPanes();this.invalidate(this._paneInvalidationMask(e,TradingView.InvalidateMask.LIGHT_UPDATE))};ChartModel.prototype.clearAllStudies=function(){for(var a=this.dataSources(),b=0;b<a.size();b++)a.item(b).clearData&&a.item(b).clearData()};
ChartModel.prototype.allLineTools=function(){for(var a=new List,b=this.m_panes,c=b.size(),d=0;d<c;++d)for(var e=b.item(d).dataSources(),f=e.size(),g=0;g<f;++g){var h=e.item(g);isInherited(h.constructor,LineDataSource)&&a.append(h)}return a};ChartModel.prototype.backgroundColor=function(){return this._properties.paneProperties.background._value};ChartModel.prototype.backgroundCounterColor=function(){return(new RGBColor(this.backgroundColor())).blackWhiteContrast()};
ChartModel.prototype.isDark=function(){return"white"===this.backgroundCounterColor()};ChartModel.prototype.canZoomIn=function(){return this.m_timeScale.canZoomIn()};ChartModel.prototype.canZoomOut=function(){return this.m_timeScale.canZoomOut()};
ChartModel.prototype.updateAllVolumeStudies=function(){for(var a=this.m_panes.toArray(),b=a.length;b--;)for(var c=!1,d=a[b],e=d.dataSources().toArray(),f=e.length;f--;){var g=e[f];g instanceof TradingView.Study&&"Volume"===g.metaInfo().shortId&&(g.updateAllViews(),c||(this.updatePane(d),c=!0))}};function DataWindowItem(a,b){this.m_title=a;this.m_value=b;this._visible=!0;this._color=void 0}DataWindowItem.prototype.title=function(){return this.m_title};DataWindowItem.prototype.text=function(){return this.m_value};DataWindowItem.prototype.visible=function(){return this._visible};DataWindowItem.prototype.color=function(){return this._color};DataWindowItem.prototype.setVisible=function(a){this._visible=a};DataWindowItem.prototype.setValue=function(a){this.m_value=a};
DataWindowItem.prototype.setColor=function(a){this._color=a};DataWindowItem.prototype.value=function(){return this.m_value};function DataWindowView(){this._title=this._header="";this._items=new List}DataWindowView.prototype.header=function(){return this._header};DataWindowView.prototype.title=function(){return this._title};DataWindowView.prototype.items=function(){return this._items};function StatusView(a){this._props=a;this._text="";this._size="12px";this._bold=!1}StatusView.prototype.text=function(){return this._text};StatusView.prototype.color=function(){return this._props?this._props.scalesProperties.textColor.value():"#444"};StatusView.prototype.bold=function(){return this._bold};StatusView.prototype.size=function(){return this._size};function PriceAxisView(){this._text="";this._background="#585858";this._coordinate=0}PriceAxisView.prototype.text=function(){return this._text};PriceAxisView.prototype.background=function(){return this._background};PriceAxisView.prototype.color=function(){return(new RGBColor(this._background)).blackWhiteContrast()};PriceAxisView.prototype.coordinate=function(){return this._coordinate};function PriceAxisViewRenderer(a){this._data=a;this._data.borderColor||(this._data.borderColor=this._data.background)}
PriceAxisViewRenderer.prototype.draw=function(a,b,c,d){function e(a,b,c,d){$.browser.webkit?d-=1:$.browser.mozilla&&(d+=1);a.fillText(b,c,d)}if(this._data.visible){if(this._data.font){var f=a.font;a.font=this._data.font}var g=a.measureText(this._data.text||this._data.secondLine).width;a.strokeStyle=this._data.borderColor;a.fillStyle=this._data.background;a.lineWidth=1;d=Math.round(1.1*this._data.textHeight);var h=this._data.coordinate,k=Math.round(h-0.5*d)-0.5,m=k,n=m+d+1,q=n;if(this._data.text){if(b){var l=
c-1.5,s=l-g-9-2,u=s,z=c=l,t=z-3;a.beginPath();a.moveTo(l,k);a.lineTo(s,m);a.lineTo(u,n);a.lineTo(c,q);a.fill();a.beginPath();a.strokeStyle=this._data.color;a.moveTo(z,h);a.lineTo(t,h);a.stroke();a.textBaseline="middle";a.textAlign="left";a.fillStyle=this._data.color;z=l-g-0.4*d}else l=0.5,u=s=l+g+9+2,z=c=l,t=z+3,a.beginPath(),a.moveTo(l,k),a.lineTo(s,m),a.lineTo(u,n),a.lineTo(c,q),a.fill(),a.beginPath(),a.strokeStyle=this._data.color,a.moveTo(z,h),a.lineTo(t,h),a.stroke(),a.textBaseline="middle",
a.textAlign="left",a.fillStyle=this._data.color,z=l+0.4*d;e(a,this._data.text,z,h+1);this._data.font&&(a.font=f)}this._data.secondLine&&(f=a.measureText(this._data.secondLine).width,a.fillStyle=this._data.background,this._data.text&&(k=n+1,m=q+1,n=k+d,q=m+d),b?(c=l=l-g-9-2,s=l+f+4+3):(c=l=0.5+g-f+4,s=g+9+2+0.5),u=s,z=l+2,a.beginPath(),a.moveTo(l,k),a.lineTo(s,m),a.lineTo(u,n),a.lineTo(c,q),a.fill(),a.textBaseline="middle",a.textAlign="left",a.fillStyle=this._data.color,b=this._data.coordinate,this._data.text&&
(b+=d+2),e(a,this._data.secondLine,z,b))}};function TimeAxisView(){this._text="";this._background="#585858";this._coordinate=0}TimeAxisView.prototype.text=function(){return this._text};TimeAxisView.prototype.background=function(){return this._background};TimeAxisView.prototype.color=function(){return(new RGBColor(this._background)).blackWhiteContrast()};TimeAxisView.prototype.coordinate=function(){return this._coordinate};function TimeAxisViewRenderer(a){this._data=a}
TimeAxisViewRenderer.prototype.draw=function(a,b,c){if(!1!==this._data.visible&&(b=a.measureText(this._data.text).width,!(0>=b))){c=b+6;b=Math.round(this._data.coordinate-0.5*c-1.5)+1.5;c=b+c+3;var d=Math.round(this._data.coordinate+1),e=this._data.textHeight+6+0.5;a.fillStyle=this._data.background;a.lineWidth=1;a.beginPath();a.moveTo(b,0.5);a.lineTo(b,e);a.lineTo(c,e);a.lineTo(c,0.5);a.fill();a.strokeStyle=this._data.color;a.beginPath();a.moveTo(d,0.5);a.lineTo(d,3.5);a.stroke();a.textBaseline="middle";
a.textAlign="left";a.fillStyle=this._data.color;$.browser.webkit?a.fillText(this._data.text,b+3+1,0.5*(0.5+e)+1):a.fillText(this._data.text,b+3+1,0.5*(0.5+e)+2)}};function CrossHair(a,b){var c=this;DataSource.call(this);this._properties=b;this._model=a;this._dataWindowView=new CrossHairDataWindowView(this,a);this._priceAxisView=new CrossHairPriceAxisView(this,a);this._startMeasurePriceAxisView=new CrossHairPriceAxisView(this,a,"measureStartY");this._endMeasurePriceAxisView=new CrossHairPriceAxisView(this,a,"measureEndY");this._timeAxisView=new CrossHairTimeAxisView(this,a);this._startMeasureTimeAxisView=new CrossHairTimeAxisView(this,a,"measureStartX");this._endMeasureTimeAxisView=
new CrossHairTimeAxisView(this,a,"measureEndX");this.visible=!0;a.readOnly()?this.areLinesVisible=!0:TradingView.drawingState.cursorTool.subscribe(function(a){c.areLinesVisible="arrow"!==a},{callWithLast:!0});this._subscribed=!1}inherit(CrossHair,DataSource);CrossHair.prototype.index=0;CrossHair.prototype.price=NaN;CrossHair.prototype.pane=null;CrossHair.prototype.color="white";CrossHair.prototype.style="";CrossHair.prototype.properties=function(){return this._properties};
CrossHair.prototype.setPosition=function(a,b,c){this._subscribed||(this._model.mainSeries().onRestarted().subscribe(this,CrossHair.prototype.clearMeasure),this._subscribed=!0);this.index=a;this.x=this._model.timeScale().indexToCoordinate(a);c&&!c.defaultPriceScale().isEmpty()?(this.price=b,this.y=c.defaultPriceScale().priceToCoordinate(b),this.pane=c):(this.y=this.price=NaN,this.pane=null);this.visible=!0;this.updateAllViews()};
CrossHair.prototype.measureStartY=function(){var a=this._startMeasurePoint.price,b=this._measurePane;if(b.defaultPriceScale().isPercent())var c=b.mainDataSource().firstValue(),a=b.defaultPriceScale().priceRange().convertToPercent(a,c);return b.defaultPriceScale().priceToCoordinate(a)};CrossHair.prototype.measureStartX=function(){return this._model.timeScale().indexToCoordinate(this._startMeasurePoint.index)};
CrossHair.prototype.measureEndY=function(){var a=this._endMeasurePoint.price,b=this._measurePane;if(b.defaultPriceScale().isPercent())var c=b.mainDataSource().firstValue(),a=b.defaultPriceScale().priceRange().convertToPercent(a,c);return b.defaultPriceScale().priceToCoordinate(a)};CrossHair.prototype.measureEndX=function(){return this._model.timeScale().indexToCoordinate(this._endMeasurePoint.index)};
CrossHair.prototype.paneViews=function(a){var b=(new List).append(new CrossHairPaneView(this,a,a===this.pane));a===this._measurePane&&(this._measurePaneView||(this._measurePaneView=new CrossHairMeasureToolPaneView(this,a)),this._measurePaneView.update(),b.append(this._measurePaneView));return b};CrossHair.prototype.dataWindowView=function(){return this._dataWindowView};
CrossHair.prototype.priceAxisViews=function(a,b){if(this.visible&&this.pane===a&&b===a.defaultPriceScale()){var c=new List;c.append(this._priceAxisView);this._startMeasurePoint&&c.append(this._startMeasurePriceAxisView);this._endMeasurePoint&&c.append(this._endMeasurePriceAxisView);return c}return null};
CrossHair.prototype.timeAxisView=function(){if(!this.visible)return null;var a=new List;a.append(this._timeAxisView);this._startMeasurePoint&&a.append(this._startMeasureTimeAxisView);this._endMeasurePoint&&a.append(this._endMeasureTimeAxisView);return a};
CrossHair.prototype.updateAllViews=function(){this._priceAxisView.update();this._startMeasurePoint&&(this._startMeasurePriceAxisView.update(),this._startMeasureTimeAxisView.update());this._endMeasurePoint&&(this._endMeasurePriceAxisView.update(),this._endMeasureTimeAxisView.update());this._timeAxisView.update()};CrossHair.prototype.startMeasurePoint=function(){return this._startMeasurePoint};
CrossHair.prototype.startMeasuring=function(a,b){if(b.defaultPriceScale().isPercent()){var c=b.mainDataSource().firstValue();a.price=b.defaultPriceScale().priceRange().convertFromPercent(a.price,c)}this._startMeasurePoint=a;this._measurePane=b};CrossHair.prototype.finishMeasure=function(a){var b=this._measurePane;if(b.defaultPriceScale().isPercent()){var c=b.mainDataSource().firstValue();a.price=b.defaultPriceScale().priceRange().convertFromPercent(a.price,c)}this._endMeasurePoint=a};
CrossHair.prototype.endMeasurePoint=function(){return this._endMeasurePoint};CrossHair.prototype.clearMeasure=function(a){delete this._measurePane;delete this._startMeasurePoint;delete this._endMeasurePoint;delete this._lastValidMeasurePoint;this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
CrossHair.prototype.measurePoints=function(){this.updateAllViews();var a=new List;a.append(this._startMeasurePoint);if(this._endMeasurePoint)a.append(this._endMeasurePoint);else{this._measurePane===this.pane&&(this._lastValidMeasurePoint={x:this.x,y:this.y,rawPrice:this.price,price:this.price,index:this.index});var b=this._lastValidMeasurePoint.rawPrice,c=this._measurePane,d=c.defaultPriceScale();d.isPercent()&&!d.isEmpty()&&(c=c.mainDataSource().firstValue(),this._lastValidMeasurePoint.price=d.priceRange().convertFromPercent(b,
c));a.append(this._lastValidMeasurePoint)}return a};CrossHair.prototype.currentPoint=function(){return new MathEx.Point(this.x,this.y)};function CrossHairMeasureToolPaneView(a,b){this._source=a;this._pane=b;this._rendererCache={}}
CrossHairMeasureToolPaneView.prototype.update=function(){if(this._source._endMeasurePoint)var a=this._source._endMeasurePoint.price,b=this._source._endMeasurePoint.index;else if(this._source._measurePane===this._source.pane)a=this._source.price,b=this._source.index;else if(this._source._lastValidMeasurePoint)a=this._source._lastValidMeasurePoint.rawPrice,b=this._source._lastValidMeasurePoint.index;else return;var c=a-this._source._startMeasurePoint.price,d=b-this._source._startMeasurePoint.index,
e=this._source._startMeasurePoint.price,f=this._source._measurePane;if(f.defaultPriceScale().isPercent()){var g=f.mainDataSource().firstValue();this._source._endMeasurePoint&&(a=f.defaultPriceScale().priceRange().convertToPercent(a,g));e=f.defaultPriceScale().priceRange().convertToPercent(e,g)}this._horzLabel=$.t("{0} bars").format(d);d=this._source._measurePane.defaultPriceScale().formatter().format(c);this._source._startMeasurePoint.price&&(f=c/this._source._startMeasurePoint.price,d+=" ("+(new PercentageFormatter).format(100*
f)+")");this._vertLabel=""+d;e=this._source._model._magnet.align(e,this._source._startMeasurePoint.index,this._source._measurePane);a=this._source._model._magnet.align(a,b,this._source._measurePane);d=this._source._model.timeScale().indexToCoordinate(this._source._startMeasurePoint.index);f=this._source._model.timeScale().indexToCoordinate(b);e=this._source._measurePane.defaultPriceScale().priceToCoordinate(e);a=this._source._measurePane.defaultPriceScale().priceToCoordinate(a);this._p1=new MathEx.Point(d,
e);this._p2=new MathEx.Point(f,a);a=this._source._model.timeScale().indexToUserTime(this._source._startMeasurePoint.index);b=this._source._model.timeScale().indexToUserTime(b);a&&b&&(b=(b.valueOf()-a.valueOf())/1E3,this._horzLabel+=", "+(new TimeSpanFormatter).format(b));if(b=this._source._measurePane.mainDataSource().base())c=Math.round(c*b),this._vertLabel+=" , "+c};
CrossHairMeasureToolPaneView.prototype.renderer=function(){var a=new CompositeRenderer,b={};b.points=(new List).append(this._p1).append(this._p2);b.width=this._source._model.timeScale().width();b.height=this._source._measurePane.defaultPriceScale().height();b.color="#D3E7FF";b.linewidth=0;b.fillBackground=!0;b.transparency=60;b.backcolor="#BADAFF";a.append(new RectangleRenderer(b));var c=this._p1.add(this._p2).scaled(0.5),d=new MathEx.Point(this._p1.x,c.y),e=new MathEx.Point(this._p2.x,c.y),d={points:(new List).append(d).append(e),
width:b.width,height:b.height,color:"#646668",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_ARROW};a.append(new TrendLineRenderer(d));d=new MathEx.Point(c.x,this._p1.y);e=new MathEx.Point(c.x,this._p2.y);d={points:(new List).append(d).append(e),width:b.width,height:b.height,color:"#646668",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_ARROW};a.append(new TrendLineRenderer(d));b=function(a,b){return{points:(new List).append(b),text:a,color:"#FFFFFF",horzAlign:"center",vertAlign:"middle",font:"Arial",offsetX:5,offsetY:0,bold:!1,italic:!1,fontsize:12,highlightBorder:!1,backgroundColor:"#646668",backgroundTransparency:20,backgroundVertInflate:5,backgroundHorzInflate:5}};c=c.add(new MathEx.Point(0,-10));c=b(this._horzLabel,c);a.append(new TextRenderer(c,this._rendererCache));c=this._p2.y;this._p1.y>this._p2.y&&
(c-=27);c=new MathEx.Point(0.5*(this._p1.x+this._p2.x),c);c=b(this._vertLabel,c);a.append(new TextRenderer(c,this._rendererCache));return a};function CrossHairPaneView(a,b,c){this.source=a;this.pane=b;this._horzVisible=c}CrossHairPaneView.prototype.update=function(){};
CrossHairPaneView.prototype.renderer=function(){var a={},b=this.source.visible&&this.source.areLinesVisible;a.horzLinesVisible=b&&this._horzVisible;a.vertLinesVisible=b;var c=(b=this.pane._model.readOnly())?defaults("chartproperties.paneProperties.crossHairProperties"):null,d=TradingView.isMobile.any()&&LineDataSource.isLineTool(this.source._model.currentTool()),e=d?"#a000a0":b?c.color:this.pane._model.properties().paneProperties.crossHairProperties.color.value(),f=b?c.transparency:this.pane._model.properties().paneProperties.crossHairProperties.transparency.value();
!d&&0<f&&(e=generateColor(e,f));a.color=e;a.lineWidth=b?c.width:this.pane._model.properties().paneProperties.crossHairProperties.width.value();a.lineStyle=b?c.style:this.pane._model.properties().paneProperties.crossHairProperties.style.value();a.drawCenter=d&&this.pane==this.source.pane;a.w=this.pane.width();a.h=this.pane.height();a.x=this.source.x;a.y=this.source.y;return new PaneRendererCrossHair(a)};function PaneRendererCrossHair(a){this.data=a}
PaneRendererCrossHair.prototype.draw=function(a){var b=this.data.vertLinesVisible,c=this.data.horzLinesVisible;if((b||c)&&this.data){a.lineStyle=this.data.lineStyle;a.lineWidth=this.data.lineWidth;a.strokeStyle=this.data.color;var d=0==this.data.lineWidth%2?0.5:0,e=this.data.x+1+d,d=this.data.y+d,f=this.data.w,g=this.data.h;b&&0<=e&&CanvasEx.drawLine(a,e,0,e,g);c&&0<=d&&CanvasEx.drawLine(a,0,d,f,d);this.data.drawCenter&&(a.beginPath(),a.arc(e,d,3,0,2*Math.PI,!0),a.fillStyle=this.data.color,a.fill())}};function CrossHairPriceAxisView(a,b){this._crossHair=a;this._model=b;this._rendererData={background:"#585858",color:"white",textHeight:14,visible:!0};this._defaultFormatter=new PriceFormatter(100)}inherit(CrossHairPriceAxisView,PriceAxisView);
CrossHairPriceAxisView.prototype.update=function(){var a=this._rendererData,b=this._crossHair.pane;a.coordinate=this._crossHair.y;this.text="";if(b&&this._crossHair.visible&&(b=b.defaultPriceScale(),!b.isEmpty())){var c;c=(c=b.mainSource())?c.formatter():this._defaultFormatter;a.text=c.format(this._crossHair.price);a.textHeight=b.m_markBuilder.fontHeight()}};CrossHairPriceAxisView.prototype.renderer=function(){this._renderer||(this._renderer=new PriceAxisViewRenderer(this._rendererData));return this._renderer};function CrossHairTimeAxisView(a,b){TimeAxisView.call(this);this._crosshair=a;this._model=b;this._rendererData={visible:!1,background:"#585858",color:"white",textHeight:14,text:""}}inherit(CrossHairTimeAxisView,TimeAxisView);
CrossHairTimeAxisView.prototype.update=function(){var a=this._rendererData;this._model.timeScale();a.coordinate=this._crosshair.x;var b=this._model.timeScale().indexToUserTime(this._crosshair.index);b?(a.visible=!0,a.text=(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(b)):(a.visible=!1,a.text="")};CrossHairTimeAxisView.prototype.renderer=function(){var a=this._rendererData;this._renderer||(this._renderer=new TimeAxisViewRenderer(a));return this._renderer};function CrossHairDataWindowView(a,b){DataWindowView.call(this);this._header=null;this._crossHair=a;this._model=b;this._items.append(new DataWindowItem("Date",""));this._items.append(new DataWindowItem("Time",""));this._items.append(new DataWindowItem("Price",""));this._defaultFormatter=new PriceFormatter(100)}inherit(CrossHairDataWindowView,DataWindowView);
CrossHairDataWindowView.prototype.update=function(){var a=this._model.mainSeries().isDWM();this._items.item(1).setVisible(!a);this._items.item(0).setValue("n/a");this._items.item(1).setValue("n/a");this._items.item(2).setValue("n/a");if(!this._model.timeScale().isEmpty()){var b=this._crossHair.index,b=this._model.timeScale().indexToUserTime(b);null===b?(this._items.item(0).setValue("n/a"),a||this._items.item(1).setValue("n/a")):(this._items.item(0).setValue((new DateFormatter).format(b)),a||this._items.item(1).setValue((new TimeFormatter).format(b)));
if(a=this._crossHair.pane)a=a.defaultPriceScale(),a.isEmpty()||(a=(a=a.mainSource())?a.formatter():this._defaultFormatter,this._items.item(2).setValue(a.format(this._crossHair.price)))}};function MAMetaInfo(){return new StudyMetaInfo({id:"MASimple",inputs:[{id:"length",type:"integer",defval:10},{id:"source",type:"text",defval:"close"}],plots:[{id:"MovAvg",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"true"}],palettes:{}})}
function VolumeMetaInfo(){return new StudyMetaInfo({id:"Volume",inputs:[],plots:[{id:"Volume",type:"histogram"},{id:"Color",type:"colorer",palette:"volumePalette",target:"Volume"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{volumePalette:{colors:{0:{color:"#007F0E",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Up Volume"},1:{color:"#872323",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Down Volume"}}}}})}
function DMMetaInfo(){return new StudyMetaInfo({id:"DM",inputs:[{id:"ADX smoothing",max:50,min:1,type:"integer",defval:14},{id:"DI Length",max:500,min:1,type:"integer",defval:14}],plots:[{id:"ADX",type:"line"},{id:"DI_P",type:"line"},{id:"DI_N",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}})}
function RSIMetaInfo(){return new StudyMetaInfo({id:"RSI",inputs:[{id:"length",type:"integer",defval:14}],plots:[{id:"RelativeStrengthIndex",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}})}function makeDefaultChartModel(a,b,c,d,e,f,g,h){a=new ChartUndoModel(a,b,c,d,e,f,g,h);a.model().invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));return a};function Grid(){this.horzLinesVisible=this.visible=!0;this.horzLinesColor="white";this.horzLinesStyle="";this.vertLinesVisible=!0;this.vertLinesColor="white";this.vertLinesStyle=""}Grid.prototype.paneViews=function(a){return(new List).append(new GridPaneView(this,a))};function GridPaneView(a,b){this.source=a;this.pane=b}GridPaneView.prototype.update=function(){};
GridPaneView.prototype.renderer=function(){var a={};if(this.pane.defaultPriceScale().isEmpty()||this.pane.timeScale().isEmpty())return null;a.horzLinesVisible=!0;a.vertLinesVisible=!0;a.horzLinesColor=this.pane._model.properties().paneProperties.gridProperties.color.value();a.vertLinesColor=a.horzLinesColor;a.lineStyle=this.pane._model.properties().paneProperties.gridProperties.style.value();a.priceMarks=this.pane.defaultPriceScale().marks();a.timeMarks=this.pane.timeScale().marks();a.w=this.pane.width();
a.h=this.pane.height();return new PaneRendererGrid(a)};function PaneRendererGrid(a){this.data=a}
PaneRendererGrid.prototype.draw=function(a){CanvasEx.setLineStyle(a,this.data.lineStyle);var b=a.lineStyle!=CanvasEx.LINESTYLE_SOLID&&!("setLineDash"in a||"mozDash"in a||"webkitLineDash"in a),c=b?CanvasEx.computeDashPattern(a):null,d;a.translate(1,0);if(this.data.vertLinesVisible){a.strokeStyle=this.data.vertLinesColor;a.beginPath();for(d=0;d<this.data.timeMarks.length;d++)b?a.dashedLineTo(this.data.timeMarks[d].coord,0,this.data.timeMarks[d].coord,this.data.h,c):(a.moveTo(this.data.timeMarks[d].coord,
0),a.lineTo(this.data.timeMarks[d].coord,this.data.h));a.closePath();a.stroke()}if(this.data.horzLinesVisible){a.strokeStyle=this.data.horzLinesColor;a.beginPath();for(d=0;d<this.data.priceMarks.length;d++)b?a.dashedLineTo(0,this.data.priceMarks[d].coord,this.data.w,this.data.priceMarks[d].coord,c):(a.moveTo(0,this.data.priceMarks[d].coord),a.lineTo(this.data.w,this.data.priceMarks[d].coord));a.closePath();a.stroke()}};function Watermark(a){function b(){var b=c.width(),d=c.height();return{draw:function(c){var m=a.symbolInfo();if(m){c.fillStyle=f.color.value();var n=(100-f.transparency.value())/100;if(0!==n){c.globalAlpha=n;for(var m=[{text:m.name?m.name+", "+translatedIntervalString(a.interval()):"",font:"96px Verdana, Arial, sans-serif",lineHeight:114,baselineOffset:87},{text:m.description||"",font:"48px Verdana, Arial, sans-serif",lineHeight:57,baselineOffset:43.5}],q=n=0;q<m.length;q++){var l=m[q];if(l.text){c.font=
l.font;var s=c,u=l.text,z=s.font;e.hasOwnProperty(z)||(e[z]={});textWidth=e[z].hasOwnProperty(u)?e[z][u]:e[z][u]=s.measureText(u).width;textWidth>b?(l.zoom=b/textWidth,textWidth=b):l.zoom=1;l.offsetLeft=(b-textWidth)/2;n+=l.lineHeight*l.zoom}}n=Math.max((d-n)/2,0);for(q=0;q<m.length;q++)l=m[q],l.text&&(c.save(),c.font=l.font,c.translate(l.offsetLeft,n),c.scale(l.zoom,l.zoom),c.fillText(l.text,0,l.baselineOffset),c.restore(),n+=l.lineHeight*l.zoom)}}}}}var c=null,d=new Function,e={},f=a.model().properties().symbolWatermarkProperties;
this.paneViews=function(a){if(!a.containsMainSeries())return new List;c=a;return(new List).append({renderer:b,update:d})}};function Legend(){this.m_items=new List}Legend.prototype.items=function(){return this.m_items};function LegendItem(a,b){this.m_title=b;this.m_color="white";this.m_dataSource=a}LegendItem.prototype.title=function(){return this.m_title};LegendItem.prototype.color=function(){return this.m_color};LegendItem.prototype.dataSource=function(){return this.m_dataSource};function Pane(a,b,c){var d=this;this.m_timeScale=a;a=b.rightAxisProperties.state();a.autoScale=!0;this.m_rightPriceScale=new PriceScale(new Property(a));this.m_rightPriceScale.properties().percentage.listeners().subscribe(null,function(){d._needRecalc=!0;d._recalculateImpl();c.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))});this.m_rightPriceScale.properties().log.listeners().subscribe(null,function(){d._needRecalc=!0;d._recalculateImpl();c.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))});
a=b.leftAxisProperties.state();a.autoScale=!0;this.m_leftPriceScale=new PriceScale(new Property(a));this.m_leftPriceScale.properties().log.listeners().subscribe(null,function(){d._needRecalc=!0;d._recalculateImpl();c.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))});this.m_leftPriceScale.properties().percentage.listeners().subscribe(null,function(){d._needRecalc=!0;d._recalculateImpl();c.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))});
this.m_dataSources=new List;this.m_legend=new Legend;this.m_width=this.m_height=0;this.m_mainDataSource=null;this._properties=b;this._model=c;this._tagsChanged=new Delegate;b.topMargin.listeners().subscribe(this,Pane.prototype._updateMargins);b.bottomMargin.listeners().subscribe(this,Pane.prototype._updateMargins);this._updateMargins();this._stretchFactor=Pane.DEFAULT_STRETCH_FACTOR}Pane.DEFAULT_STRETCH_FACTOR=1E3;Pane.PANE_ANIMATION_DURATION=500;
Pane.sortSourcesPreOrdered={"Volume@tv-basicstudies":0,"Script$TV_DIVIDENDS@tv-scripting":1,"Script$TV_SPLITS@tv-scripting":2,"Script$TV_EARNINGS@tv-scripting":3};
Pane.sortSources=function(a){a.sort(function(a,b){return a.zorder()>b.zorder()?1:-1});var b=[],c=[],d;for(d in Pane.sortSourcesPreOrdered)c.push(null);d=0;for(var e=a.length;d<e;d++){var f=a[d];if(isFunction(f.metaInfo)){var g=f.metaInfo().id,g=Pane.sortSourcesPreOrdered[g];0<g?c[g]=f:b.push(f)}else b.push(f)}d=0;for(e=c.length;d<e;d++)(f=c[d])&&b.push(f);return b};
Pane.prototype._updateMargins=function(){var a=0.01*this._properties.topMargin.value(),b=0.01*this._properties.bottomMargin.value();this.m_leftPriceScale.setTopMargin(a);this.m_leftPriceScale.setBottomMargin(b);this.m_rightPriceScale.setTopMargin(a);this.m_rightPriceScale.setBottomMargin(b);for(var c=0;c<this.m_dataSources.size();c++){var d=this.m_dataSources.item(c);d instanceof TradingView.Study&&this.isOverlay(d)&&"Volume"!==d.metaInfo().shortId&&d.priceScale()&&d.priceScale()!==this.m_leftPriceScale&&
d.priceScale()==this.m_rightPriceScale&&(d.priceScale().setTopMargin(a),d.priceScale().setBottomMargin(b),this.recalculatePriceScale(d.priceScale()))}this.recalculatePriceScale(this.m_leftPriceScale);this.recalculatePriceScale(this.m_rightPriceScale);this.updateAllViews()};Pane.prototype.model=function(){return this._model};Pane.prototype.width=function(){return this.m_width};Pane.prototype.height=function(){return this.m_height};Pane.prototype.setWidth=function(a){this.m_width=a;this.updateAllViews()};
Pane.prototype.setHeight=function(a){this.m_height=a;this.m_leftPriceScale.setHeight(a);this.m_rightPriceScale.setHeight(a);for(var b=0;b<this.m_dataSources.size();b++){var c=this.m_dataSources.item(b);this.isOverlay(c)&&c.priceScale()&&c.priceScale().setHeight(a)}this.updateAllViews()};Pane.prototype.leftPriceScale=function(){return this.m_leftPriceScale};Pane.prototype.rightPriceScale=function(){return this.m_rightPriceScale};Pane.prototype.timeScale=function(){return this.m_timeScale};
Pane.prototype.dataSources=function(){return this.m_dataSources};Pane.prototype.isOverlay=function(a){return a._isOverlay};Pane.prototype.legend=function(){return this.m_legend};
Pane.prototype._processMainSourceChange=function(){var a;if(null===this.m_mainDataSource)for(var b=0;b<this.m_dataSources.size();b++){var c=this.m_dataSources.item(b);if(isInherited(c.constructor,PriceDataSource)&&!(this.isOverlay(c)||c.properties().linkedToSeries&&c.properties().linkedToSeries.value())){this.m_mainDataSource=c;a=!0;break}}if(this.m_mainDataSource&&a){a=[];for(b=0;b<this.m_dataSources.size();b++)c=this.m_dataSources.item(b),isInherited(c.constructor,LineDataSource)&&a.push(c);a=Pane.sortSources(a);
for(b=0;b<a.length;b++)this.move(a[b],this.m_mainDataSource.priceScale())}else if(!this.m_mainDataSource)for(b=0;b<this.m_dataSources.size();b++)if(c=this.m_dataSources.item(b),isInherited(c.constructor,PriceDataSource)&&this.isOverlay(c)&&c.showInObjectTree()){this.m_mainDataSource=c;this.m_rightPriceScale.addDataSource(c);c.setPriceScale(this.m_rightPriceScale);for(var b=this._model.children(c),d=0;d<b.size();d++)a=b.item(d),this.m_rightPriceScale.addDataSource(a),a.setPriceScale(this.m_rightPriceScale);
this.recalculatePriceScale(this.m_rightPriceScale);c._isOverlay=!1;break}};
Pane.prototype.addDataSource=function(a,b){this.m_dataSources.append(a);var c=!1;null===this.m_mainDataSource&&(this.m_mainDataSource=a,c=!0);a._isOverlay=!1;null===b&&(b=new PriceScale(new Property(this._properties.overlayPropreties.state())),b.setHeight(this.m_height),b.setTopMargin(this.m_rightPriceScale.topMargin()),b.setBottomMargin(this.m_rightPriceScale.bottomMargin()),a._isOverlay=!0);b.addDataSource(a);a.setPriceScale(b);a.onTagsChanged&&a.onTagsChanged().subscribe(this,Pane.prototype.onSourceTagsChanged);
a.setZorder(this.getZOrderMinMax().minZOrder-1);c&&this._processMainSourceChange();this._tagsChanged.fire();isInherited(a.constructor,PriceDataSource)&&this.recalculatePriceScale(b);this.invalidateSourcesCache()};
Pane.prototype.removeDataSource=function(a,b){if(this.m_dataSources.contains(a)){a._isOverlay=!1;this.m_dataSources.remove(a);a!==this.m_mainDataSource||b||(this.m_mainDataSource=null);var c=null;this.m_leftPriceScale.dataSources().contains(a)?(this.m_leftPriceScale.removeDataSource(a),c=this.m_leftPriceScale):this.m_rightPriceScale.dataSources().contains(a)&&(this.m_rightPriceScale.removeDataSource(a),c=this.m_rightPriceScale);a.onTagsChanged&&a.onTagsChanged().unsubscribe(this,Pane.prototype.onSourceTagsChanged);
isInherited(a.constructor,PriceDataSource)&&this._processMainSourceChange();this._tagsChanged.fire();c&&isInherited(a.constructor,PriceDataSource)&&this.recalculatePriceScale(c);this.invalidateSourcesCache()}else TradingView.logDebug("removeDataSource: invalid data source")};Pane.prototype.startScalePrice=function(a,b){a.startScale(b)};Pane.prototype.scalePriceTo=function(a,b){a.scaleTo(b);this.updateAllViews()};Pane.prototype.endScalePrice=function(a){a.endScale()};
Pane.prototype.startScrollPrice=function(a,b){a.startScroll(b)};Pane.prototype.scrollPriceTo=function(a,b){a.scrollTo(b);this.updateAllViews()};Pane.prototype.endScrollPrice=function(a){a.endScroll()};Pane.prototype.setPriceAutoScale=function(a,b){a.setAutoScale(b);this.timeScale().isEmpty()?a.setPriceRange(null):this.recalculatePriceScale(a)};Pane.prototype.restorePriceScaleState=function(a,b){a.restoreState(b);this.updateAllViews()};Pane.prototype.updateAllViews=function(){for(var a=0;a<this.dataSources().size();a++)this.dataSources().item(a).updateAllViews()};
Pane.prototype.defaultPriceScale=function(){if(!this.m_mainDataSource)var a=this.rightPriceScale();this.m_mainDataSource&&(a=this.m_mainDataSource.priceScale());void 0==a&&(props=new Property(this._properties.overlayPropreties.state()),a=new PriceScale(props));return a};Pane.prototype._priceScaleIsPrice=function(a){return(a=a.mainSource())?isInherited(a.constructor,TradingView.Series)?!0:isInherited(a.constructor,TradingView.Study)?a.metaInfo().is_price_study:!1:!1};
Pane.prototype.findSuitableScale=function(a){var b=!1;isInherited(a.constructor,TradingView.Study)?b=a.metaInfo().is_price_study:isInherited(a.constructor,TradingView.Series)&&(b=!0);if(b){if(this._priceScaleIsPrice(this.m_rightPriceScale))return this.m_rightPriceScale;if(this._priceScaleIsPrice(this.m_leftPriceScale))return this.m_leftPriceScale}return this.m_rightPriceScale.mainSource()?this.m_leftPriceScale.mainSource()?null:this.m_leftPriceScale:this.m_rightPriceScale};
Pane.prototype.mainDataSource=function(){return this.m_mainDataSource};Pane.prototype.recalculatePriceScale=function(a){if(a){if(a.isAutoScale()&&!this.timeScale().isEmpty()){var b=this.timeScale().visibleBars();a.recalculatePriceRange(b)}a.updatePaneViews()}};Pane.prototype.resetPriceScale=function(a){var b=this.timeScale().visibleBars();a.mainSource()instanceof TradingView.Series&&a.mainSource().isLockScale()||a.setAutoScale(!0);a.recalculatePriceRange(b);this.updateAllViews()};
Pane.prototype._recalculateImpl=function(){if(this._needRecalc){this.recalculatePriceScale(this.m_rightPriceScale);this.recalculatePriceScale(this.m_leftPriceScale);for(var a=0;a<this.m_dataSources.size();a++){var b=this.m_dataSources.item(a);this.isOverlay(b)&&this.recalculatePriceScale(b.priceScale())}this.updateAllViews();this._model.updatePane(this);this._needRecalc=!1}};Pane.prototype.recalculate=function(a){this._needRecalc=!0;a&&this._recalculateImpl()};
Pane.prototype.isEmpty=function(){return null===this.m_mainDataSource};Pane.prototype.move=function(a,b){var c=this.m_dataSources.clone();this.removeDataSource(a,null!==b);this.addDataSource(a,b);this.m_dataSources=c;this.invalidateSourcesCache()};Pane.prototype.dataSourceForId=function(a){for(var b=0;b<this.m_dataSources.size();b++)if(this.m_dataSources.item(b).id()===a)return this.m_dataSources.item(b);return null};
Pane.prototype.priceScaleForSource=function(a){return this.rightPriceScale().dataSources().contains(a)?this.rightPriceScale():this.leftPriceScale().dataSources().contains(a)?this.leftPriceScale():null};Pane.prototype.sourceById=function(a){for(var b=0;b<this.m_dataSources.size();b++)if(this.m_dataSources.item(b).id()===a)return this.m_dataSources.item(b);return null};Pane.prototype.containsMainSeries=function(){return this.m_dataSources.contains(this._model.mainSeries())};
Pane.prototype.priceScaleByName=function(a){return"left"===a?this.m_leftPriceScale:"right"===a?this.m_rightPriceScale:null};Pane.prototype.priceScaleName=function(a){return a===this.m_leftPriceScale?"left":a===this.m_rightPriceScale?"right":""};
Pane.prototype.hitTestSources=function(){if(this._cachedHitTestSources)return this._cachedHitTestSources;for(var a=this.orderedSources(),b=[],c=[],d=0;d<a.length;d++){var e=a[d];isInherited(e.constructor,LineDataSource)?b.push(e):c.push(e)}return this._cachedHitTestSources=c.concat(b)};
Pane.prototype.orderedSources=function(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;for(var a=[],b=0,c=this.dataSources().size();b<c;b++){var d=this.dataSources().item(b);if(!isInherited(d.constructor,LineDataSource)||d.isActualSymbol())null==d.zorder()&&d.setZorder(b+1),a.push(d)}return this._cachedOrderedSoruces=a=Pane.sortSources(a)};
Pane.prototype.invalidateSourcesCache=function(){this._cachedHitTestSources=this._cachedOrderedSoruces=null;this.m_leftPriceScale.invalidateSourcesCache();this.m_rightPriceScale.invalidateSourcesCache()};Pane.prototype.getZOrderMinMax=function(){for(var a=this.orderedSources(),b=Number.MAX_VALUE,c=-Number.MAX_VALUE,d=0;d<a.length;d++){var e=a[d];e.showInObjectTree()&&(e.zorder()<b&&(b=e.zorder()),e.zorder()>c&&(c=e.zorder()))}return{minZOrder:b,maxZOrder:c}};
Pane.prototype.sendToBack=function(a){for(var b=this.getZOrderMinMax().minZOrder,b=Math.abs(a.zorder()-b),c=0;c<b;c++)this.changeZOrder(a,-1)};Pane.prototype.bringToFront=function(a){for(var b=this.getZOrderMinMax().maxZOrder,b=Math.abs(a.zorder()-b),c=0;c<b;c++)this.changeZOrder(a,1)};
Pane.prototype.changeZOrder=function(a,b){for(var c=this.orderedSources().filter(function(a){return a.showInObjectTree()}),d=0,e=0,f=c.length;e<f;e++)if(c[e]===a){d=e;break}0<d&&0>b?(f=c[d-1].zorder(),e=a.zorder(),c[d-1].setZorder(e),a.setZorder(f)):d<c.length-1&&0<b&&(f=c[d+1].zorder(),e=a.zorder(),c[d+1].setZorder(e),a.setZorder(f));this.invalidateSourcesCache()};Pane.prototype.onSourceTagsChanged=function(){this._tagsChanged.fire()};Pane.prototype.onTagsChanged=function(){return this._tagsChanged};
Pane.prototype.dumpPriceScale=function(a){for(var b=new List,c=a.dataSources().clone(),d=0;d<c.size();++d){var e=c.item(d).priceAxisViews(this,a);e&&b.appendAll(e)}a=[];for(d=0;d<b.size();d++)a.push(b.item(d).dump());return a};
Pane.prototype.dumpViews=function(){for(var a={paneViews:{}},b=this.orderedSources(),c=0;c<b.length;c++){var d=b[c];a.paneViews[c]=[];if(d=d.paneViews())for(var e=0;e<d.size();e++)a.paneViews[c].push(d.item(c).dump())}a.leftAxis=this.dumpPriceScale(this.m_leftPriceScale);a.rightAxis=this.dumpPriceScale(this.m_rightPriceScale);return a};Pane.prototype.clearSeries=function(){for(var a=this.m_dataSources.size()-1;0<=a;a--)isInherited(this.m_dataSources.item(a).constructor,TradingView.Series)&&this.m_dataSources.removeAt(a)};
Pane.prototype.actionNoScaleIsEnabled=function(a){return this.isOverlay(a)||!isInherited(a.constructor,PriceDataSource)?!0:1<this.dataSources().count(function(a){return a.properties().linkedToSeries&&a.properties().linkedToSeries.value()?!1:isInherited(a.constructor,PriceDataSource)&&a.showInObjectTree()&&!a.isNoScale()})};function optimalBarWidth(a){return 0.3*a}function selectionTolerance(a){return 2+0.5*a}function paneRendererCoordinateIsValid(a){return null!==a&&void 0!==a&&!isNaN(a)}function PaneRendererBars(a){this.bars=a.bars;this.barSpacing=a.barSpacing;this.barWidth=optimalBarWidth(a.barSpacing);this.barLineWidth=Math.max(1,Math.round(this.barWidth));this.dontDrawOpen=a.dontDrawOpen}
PaneRendererBars.prototype.draw=function(a){a.save();a.translate(0.5,0.5);for(var b,c=0;c<this.bars.size();++c){var d=this.bars.item(c);b!==d.color&&(b=a.fillStyle=d.color);a.fillRect(Math.round(d.time-this.barLineWidth/2),Math.round(d.high-this.barWidth/2),Math.round(this.barLineWidth),Math.round(d.low-d.high+this.barWidth));this.barLineWidth<this.barSpacing-1&&(this.dontDrawOpen||a.fillRect(Math.round(d.time-1.5*this.barWidth),Math.round(d.open-this.barWidth/2),Math.round(1.5*this.barWidth),Math.round(this.barWidth)),
a.fillRect(Math.round(d.time),Math.round(d.close-this.barWidth/2),Math.round(1.5*this.barWidth),Math.round(this.barWidth)))}a.restore()};PaneRendererBars.prototype.hitTest=function(a){var b=this.bars,c=0.5*this.barSpacing;if(b.isEmpty()||a.x<b.first().time-c||a.x>b.last().time+c)return null;for(var d=null,e=0;e<b.size();++e){var f=b.item(e);if(a.x<=f.time+c){d=f;break}}b=selectionTolerance(this.barLineWidth);return d&&d.high-b<=a.y&&a.y<=d.low+b?new HitTestResult(HitTestResult.REGULAR):null};
function PaneRendererRenkoPB(a){this.bars=a.bars;this.barWidth=a.barWidth;this.barLineWidth=1}
PaneRendererRenkoPB.prototype.draw=function(a){a.save();a.lineCap="butt";a.translate(0.5,0.5);a.lineWidth=this.barLineWidth;for(var b=this.barWidth/2,c=0,d;c<this.bars.size();++c){d=this.bars.item(c);var e=d.exactTime-b,f=d.exactTime+b-e,g=Math.round(d.high),h=0==d.low-d.high?1:Math.round(d.low-d.high);a.fillStyle=d.borderColor;a.fillRect(e,g,f,h);a.fillStyle=d.color;a.fillRect(e+this.barLineWidth,g+this.barLineWidth,f-2*this.barLineWidth,h-2*this.barLineWidth)}a.restore()};
PaneRendererRenkoPB.prototype.hitTest=function(a){var b=this.bars,c=0.5*this.barWidth;if(b.isEmpty()||a.x<b.first().time-c||a.x>b.last().time+c)return null;for(var d=null,e=0;e<b.size();++e){var f=b.item(e);if(a.x<=f.time+c){d=f;break}}b=selectionTolerance(this.barLineWidth);return d&&d.high-b<=a.y&&a.y<=d.low+b?new HitTestResult(HitTestResult.REGULAR):null};function PaneRendererKagi(a){this.bars=a.bars;this.barSpacing=a.barSpacing;this.barLineWidth=Math.max(1,optimalBarWidth(a.barSpacing))}
PaneRendererKagi.prototype.draw=function(a){a.save();a.lineCap="square";a.translate(0.5,0.5);for(var b=0;b<this.bars.size();++b){var c=this.bars.item(b),d=Math.round(0.5*this.barLineWidth);c.isTwoColorBar?(a.fillStyle=c.upColor,a.fillRect(Math.round(c.exactTime-d),Math.round(c.high-d),Math.round(2*d),Math.round(c.additionalPrice-c.high+d)),a.fillStyle=c.downColor,a.fillRect(Math.round(c.exactTime-d),Math.round(c.additionalPrice),Math.round(2*d),Math.round(c.low-c.additionalPrice+d))):(a.fillStyle=
c.color,a.fillRect(Math.round(c.exactTime-d),Math.round(c.high-d),Math.round(2*d),Math.round(c.low-c.high)+2*d));c.combinedWithProjection||(a.fillStyle=c.isTwoColorBar?c.isUp?c.downColor:c.upColor:c.color,a.fillRect(Math.round(c.exactTime-this.barSpacing+d),Math.round(c.open-d),Math.round(this.barSpacing-2*d+1),Math.round(2*d)))}a.restore()};
PaneRendererKagi.prototype.hitTest=function(a){var b=this.bars,c=0.5*this.barLineWidth;if(b.isEmpty()||a.x<b.first().time-c||a.x>b.last().time+c)return null;for(var d=null,e=0;e<b.size();++e){var f=b.item(e);if(a.x<=f.time+c){d=f;break}}b=selectionTolerance(0.5*this.barLineWidth);return d&&d.high-b<=a.y&&a.y<=d.low+b?new HitTestResult(HitTestResult.REGULAR):null};function PaneRendererPnF(a){this.bars=a.bars;this.barSpacing=a.barSpacing;this.blockSize=a.blockSize;this.barWidth=a.barSpacing}
PaneRendererPnF.prototype.draw=function(a){a.save();a.lineCap="butt";a.translate(0.5,0.5);for(var b=0;b<this.bars.size();++b){bar=this.bars.item(b);var c=(bar.low-bar.high)/bar.additionalNum;a.beginPath();for(var d=0;d<bar.additionalNum;d++)bar.isUp?(a.moveTo(Math.round(bar.time-0.5*this.barWidth)+0.5,bar.high+d*c),a.lineTo(Math.round(bar.time+0.5*this.barWidth)-0.5,bar.high+(d+1)*c),a.moveTo(Math.round(bar.time+0.5*this.barWidth)-0.5,bar.high+d*c),a.lineTo(Math.round(bar.time-0.5*this.barWidth)+
0.5,bar.high+(d+1)*c)):this.drawEllipse(a,bar.time-0.45*this.barWidth+0.5,bar.high+d*c,Math.round(0.9*this.barWidth),Math.round(c));a.strokeStyle=bar.color;a.lineWidth=1;a.stroke()}a.restore()};PaneRendererPnF.prototype.drawEllipse=function(a,b,c,d,e){a.save();a.translate(b+d/2,c+e/2);a.scale(d/2,e/2);a.moveTo(1,0);a.arc(0,0,0.95,0,2*Math.PI,!1);a.restore()};
PaneRendererPnF.prototype.hitTest=function(a){var b=this.bars,c=0.5*this.barSpacing;if(b.isEmpty()||a.x<b.first().time-c||a.x>b.last().time+c)return null;for(var d=null,e=0;e<b.size();++e){var f=b.item(e);if(a.x<=f.time+c){d=f;break}}b=selectionTolerance(this.barWidth);return d&&d.high-b<=a.y&&a.y<=d.low+b?new HitTestResult(HitTestResult.REGULAR):null};
function PaneRendererHistogram(a){this.items=a.items;this.barSpacing=a.barSpacing;this.histogramBase=a.histogramBase;this.lineColor=a.lineColor;this.lineWidth=a.lineWidth}PaneRendererHistogram.prototype.draw=function(a){a.translate(0.5,0.5);a.fillStyle=this.lineColor;for(var b=this.lineWidth,c=0;c<this.items.size();++c){var d=this.items.item(c),e=d.x,f=d.y;d.style&&(a.fillStyle=d.style.color,b=d.style.width);a.fillRect(Math.round(e-0.5*b),f,b,this.histogramBase-f)}};
PaneRendererHistogram.prototype.hitTest=function(a){for(var b=selectionTolerance(this.lineWidth),c,d,e=0;e<this.items.size();++e)if(c=this.items.item(e),d=c.x,c=c.y,d=MathEx.distanceToSegment(new MathEx.Point(d,c),new MathEx.Point(d,this.histogramBase),new MathEx.Point(a.x,a.y)),d.distance<=b)return new HitTestResult(HitTestResult.REGULAR);return null};
function PaneRendererColumns(a){this.items=a.items;this.barSpacing=a.barSpacing;this.histogramBase=a.histogramBase;this.lineColor=a.lineColor;this.lineWidth=a.lineWidth}
PaneRendererColumns.prototype.draw=function(a){if(0!==this.items.size()){a.translate(0.5,0.5);for(var b=Math.round(this.items.item(0).x-0.5*this.barSpacing),c="",d=0;d<this.items.size();++d){var e=this.items.item(d),b=Math.ceil(e.x-0.5*this.barSpacing),f=Math.ceil(b+this.barSpacing),g=e.y;if(1>this.barSpacing){if(e.style)c!==e.style.color&&(c=a.fillStyle=e.style.color);else{a.fillStyle=this.lineColor;continue}a.fillRect(b,g,f-b,this.histogramBase-g)}e.style?c!==e.style.color&&(c=a.fillStyle=e.style.color):
a.fillStyle=this.lineColor;a.fillRect(b,g,f-b,this.histogramBase-g);e.style?c!==e.style.color&&(c=a.fillStyle=e.style.color):c!==this.lineColor&&(c=this.lineColor,a.fillStyle=this.lineColor);0<d&&(e=this.items.item(d-1),g<e.y&&a.fillRect(b,g,1,e.y-g));a.fillRect(f-1,g,1,this.histogramBase-g);a.fillRect(b,g,f-b,1)}}};
PaneRendererColumns.prototype.hitTest=function(a){for(var b=0.5*this.barSpacing+this.lineWidth,c=a.x-b,b=a.x+b,d=this.items.toArray(),e=d.length;e--;){var f=d[e].x;if(f>=c&&f<=b&&(f=d[e].y,a.y>=Math.min(f,this.histogramBase)&&a.y<=Math.max(f,this.histogramBase)))return new HitTestResult(HitTestResult.REGULAR)}return null};
function PaneRendererLine(a){this.items=a.items;this._simpleMode=a.simpleMode;this.barSpacing=a.barSpacing;this.lineColor=a.lineColor;this.lineWidth=a.lineWidth;this.lineStyle=a.lineStyle;this.withMarkers=a.withMarkers;this.withSteps=a.withSteps;this.hittest=a.hittest;this.ignorePaletteLineWidth=a.ignorePaletteLineWidth;this.forceLineColor=!!a.forceLineColor}
PaneRendererLine.prototype.draw=function(a){a.lineCap="square";a.lineJoin=this.withMarkers?"round":"miter";a.strokeStyle=this.lineColor;a.fillStyle=this.lineColor;a.lineWidth=this.lineWidth;a.lineStyle=this.lineStyle;this._simpleMode?this._drawSimpleMode(a):this._drawLines(a)};
PaneRendererLine.prototype._drawSimpleMode=function(a){a.beginPath();this.walkLine(a,this.items.toArray());a.stroke();if(this.withMarkers){i=this.items.size();var b=this.lineWidth+2,c=2*Math.PI,d;for(a.beginPath();i--;)if(d=this.items.item(i))a.moveTo(d.x,d.y),a.arc(d.x,d.y,b,0,c);a.fill()}};
PaneRendererLine.prototype.walkLine=function(a,b,c,d){if(b){for(var e=0.25*this.barSpacing,f,g,h,k,m=paneRendererCoordinateIsValid,n=0,q=b.length;n<q;n++)if(k=b[n],m(k.y)){g=k;f=n;break}if("undefined"!==typeof f&&g)for(var l=this.withSteps&&this.lineWidth&&0==this.lineWidth%2?0.5:0,n=f,q=b.length;n<q;n++){g=b[n];k=b[n+1]||{};if(m(g.y))if(h&&m(h.y))this.withSteps&&a.lineTo(h.x+l,g.y+l),a.lineTo(g.x+l,g.y+l),c&&!m(k.y)&&a.lineTo(g.x+l,d);else if(k&&m(k.y))c?(n!=f&&a.lineTo(g.x+l,d),a.lineTo(g.x+l,g.y+
l)):a.moveTo(g.x+l,g.y+l);else if(c){if(0===n)continue;n!=f&&a.lineTo(g.x-e+l,d);a.lineTo(g.x-e+l,g.y+l);a.lineTo(g.x+e+l,g.y+l);a.lineTo(g.x+e+l,d)}else a.moveTo(g.x-e+l,g.y+l),a.lineTo(g.x+e+l,g.y+l);h=g}}};
PaneRendererLine.prototype._drawLines=function(a){function b(b,c,d){g(c.y)&&(g(b.y)?a.lineTo(c.x,c.y):d&&g(d.y)?a.moveTo(c.x,c.y):(a.moveTo(c.x-f,c.y),a.lineTo(c.x+f,c.y)))}if(this.items.size()){var c,d,e,f=0.25*this.barSpacing,g=paneRendererCoordinateIsValid;a.beginPath();(c=this.items.item(0))&&a.moveTo(c.x,c.y);for(var h=1;h<this.items.size();++h){c=this.items.item(h-1);d=this.items.item(h);e=this.items.item(h+1);var k,m,n;d.style&&!this.forceLineColor?(k=d.style.color,m=d.style.width,n=d.style.style):
(k=this.lineColor,m=this.lineWidth,n=this.lineStyle);this.ignorePaletteLineWidth&&(m=this.lineWidth);k.toLowerCase()!=a.strokeStyle.toLowerCase()||m!=a.lineWidth||n!=a.lineStyle?(a.stroke(),a.beginPath(),a.strokeStyle=k,a.lineWidth=m,a.lineStyle=n,n===CanvasEx.LINESTYLE_SOLID?(a.moveTo(c.x,c.y),b(c,d,e)):CanvasEx.drawLine(a,c.x,c.y,d.x,d.y)):b(c,d,e)}a.stroke()}};
PaneRendererLine.prototype.hitTest=function(a){for(var b=selectionTolerance(this.lineWidth),c,d,e,f,g=0,h=this.items.size()-1;2<h-g;)c=Math.round((h+g)/2),this.items.item(c).x<=a.x?g=c:h=c;g=Math.max(1,g-1);for(rigth=Math.min(this.items.size()-1,h+1);g<=h;++g)if(c=this.items.item(g-1),d=this.items.item(g),e=c.x,f=d.x,c=MathEx.distanceToSegment(new MathEx.Point(e,c.y),new MathEx.Point(f,d.y),new MathEx.Point(a.x,a.y)),c.distance<=b)return this.hittest?this.hittest:new HitTestResult(HitTestResult.REGULAR);
return null};function PaneRendererArea(a){a.forceLineColor=!0;PaneRendererLine.call(this,a);this.color1=a.color1;this.color2=a.color2;this.bottom=a.bottom;this._simpleMode=a.simpleMode}inherit(PaneRendererArea,PaneRendererLine);
PaneRendererArea.prototype.draw=function(a){if(0!==this.items.size()){a.lineCap="square";a.strokeStyle=this.lineColor;a.lineWidth=this.lineWidth;a.lineStyle=this.lineStyle;a.lineWidth=1;a.beginPath();for(var b,c=0,d=this.items.size();c<d;c++){var e=this.items.item(c);if(paneRendererCoordinateIsValid(e.y)){b=e;break}}if(b){a.moveTo(b.x,this.bottom);PaneRendererLine.prototype.walkLine.call(this,a,this.items.toArray(),!0,this.bottom);for(var f,c=this.items.size()-1;0<=c;c--)if(e=this.items.item(c),paneRendererCoordinateIsValid(e.y)){f=
e;break}a.moveTo(f.x,this.bottom);a.closePath();b=a.createLinearGradient(0,0,0,this.bottom);b.addColorStop(0,this.color1);b.addColorStop(1,this.color2);a.fillStyle=b;a.fill();a.lineWidth=this.lineWidth;PaneRendererLine.prototype.draw.call(this,a)}}};function PaneRendererCandles(a){this._data=a;this._barWidth=optimalBarWidth(a.barSpacing);this._barBorderWidth=1}
PaneRendererCandles.prototype.draw=function(a){var b=this._data.bars.clone(),c=this._data.barSpacing,d=this._data.drawWick,e=this._data.drawBorder,f=this._data.wickColor,g=this._barBorderWidth,h=this._barWidth,k=b.size(),m,n,q;a.lineCap="square";a.lineStyle=this._data.lineStyle;if(1>c){if(d){a.strokeStyle=f;a.lineWidth=1;a.beginPath();for(k=b.size();0<k--;)c=b.item(k),a.moveTo(c.time,c.low),a.lineTo(c.time,c.high);a.stroke()}a.lineWidth=1;e="";h=!1;a.beginPath();for(k=b.size();0<k--;)c=b.item(k),
d=c.time,e!==c.color&&(h&&(a.stroke(),a.beginPath(),h=!1),e=a.strokeStyle=c.color),a.moveTo(c.time,c.open),a.lineTo(c.time,c.close),h=!0;h&&a.stroke()}else{a.translate(0.5,0.5);a.lineWidth=g;b.sort(function(a,b){return a.color>b.color?1:-1});if(d)for(a.fillStyle=f;0<k--;)c=b.item(k),d=c.time,g=c.open,m=c.high,n=c.low,q=c.close,f=Math.min(g,q),g=Math.max(g,q),c.hollow?(a.fillRect(d,m,1,f-m),a.fillRect(d,g,1,n-g)):a.fillRect(d,m,1,n-m);if(e)for(k=b.size();0<k--;)c=b.item(k),b.item(k+1)&&c.borderColor==
b.item(k+1).borderColor||(a.fillStyle=c.borderColor),c.hollow||(d=c.time,g=c.open,q=c.close,m=Math.round(d-h),d=Math.round(d+h),f=Math.min(g,q),g=Math.max(g,q),a.fillRect(m,f,d-m+1,g-f+1));for(k=b.size();0<k--;)c=b.item(k),d=c.time,g=c.open,m=c.high,n=c.low,q=c.close,m=Math.round(d-h),d=Math.round(d+h),f=Math.min(g,q),g=Math.max(g,q),b.item(k+1)&&c.color==b.item(k+1).color||(a.fillStyle=c.color,a.strokeStyle=c.color),c.hollow?(a.translate(-0.5,-0.5),a.strokeRect(m+1,f+1,d-m,g-f),a.translate(0.5,0.5)):
(e&&(m+=1,f+=1,d-=1,g-=1),a.fillRect(m,f,d-m+1,g-f+1))}};PaneRendererCandles.prototype.hitTest=function(a){var b=this._data.bars,c=0.5*this._data.barSpacing;if(b.isEmpty()||a.x<b.first().time-c||a.x>b.last().time+c)return null;for(var d=null,e=0;e<b.size();++e){var f=b.item(e);if(a.x<=f.time+c){d=f;break}}b=selectionTolerance(this._barBorderWidth);return d&&d.high-b<=a.y&&a.y<=d.low+b?new HitTestResult(HitTestResult.REGULAR):null};
function PaneRendererCross(a){this.items=a.items;this.barSpacing=a.barSpacing;this.lineColor=a.lineColor;this.lineWidth=a.lineWidth;this.lineStyle=a.lineStyle}PaneRendererCross.prototype.draw=function(a){a.fillStyle=this.lineColor;this._drawLines(a)};PaneRendererCross.prototype.drawCross=function(a,b){a.fillRect(b.x-3*this.lineWidth/2,b.y-this.lineWidth/2,3*this.lineWidth,this.lineWidth);a.fillRect(b.x-this.lineWidth/2,b.y-3*this.lineWidth/2,this.lineWidth,3*this.lineWidth)};
PaneRendererCross.prototype._drawLines=function(a){for(var b=0;b<this.items.size();++b){var c=this.items.item(b),d=c.y;isNaN(c.x)||isNaN(d)||(a.fillStyle=void 0!=c.style?c.style.color:this.lineColor,this.drawCross(a,c))}};
PaneRendererCross.prototype.hitTest=function(a){for(var b=selectionTolerance(this.lineWidth),c,d,e,f,g=1;g<this.items.size();++g)if(c=this.items.item(g-1),d=this.items.item(g),e=c.x,f=d.x,c=MathEx.distanceToSegment(new MathEx.Point(e,c.y),new MathEx.Point(f,d.y),new MathEx.Point(a.x,a.y)),c.distance<=b)return new HitTestResult(HitTestResult.REGULAR);return null};
function PaneRendererCircles(a){this.items=a.items;this.barSpacing=a.barSpacing;this.lineColor=a.lineColor||a.color;this.radius=a.lineWidth||a.height/2;this.vertOffset=a.vertOffset||0}PaneRendererCircles.prototype.draw=function(a){a.fillStyle=this.lineColor;for(var b=0;b<this.items.size();++b){var c=this.items.item(b),d=c.x,e=c.y+this.vertOffset;isNaN(d)||isNaN(e)||(a.fillStyle=void 0!=c.style?c.style.color:this.lineColor,a.beginPath(),a.arc(d,e,this.radius,0,2*Math.PI,!1),a.fill())}};
PaneRendererCircles.prototype.hitTest=function(a){for(var b=this.vertOffset,c=selectionTolerance(2*this.radius),d=0;d<this.items.size();++d){var e=this.items.item(d);if(e&&(offsettedPoint=new MathEx.Point(e.x,e.y+b),offsettedPoint.substract(a).length()+this.radius<=c))return new HitTestResult(HitTestResult.REGULAR)}return null};PaneRendererArrowsUpDownItem=function(a,b,c,d){this.x=a;this.y=b;this.height=c;this.isUp=d};inherit(PaneRendererArrowsUpDownItem,MathEx.Point);
function PaneRendererArrowsUpDown(a){this.items=a.items;this.barSpacing=a.barSpacing;this.colorUp=a.colorup;this.colorDn=a.colordown;this.colorBorder=a.colorBorder;this.width=this._calculateWidth(a.barSpacing);this.minHeight=a.minHeight;this.vertOffset=this._calculateVerticalOffset(a.barSpacing)}PaneRendererArrowsUpDown.prototype._calculateVerticalOffset=function(a){return Math.round((a||0)/4)};PaneRendererArrowsUpDown.prototype._calculateMinHeight=function(a){return this.width||this._calculateWidth(a)};
PaneRendererArrowsUpDown.prototype._calculateWidth=function(a){a=a||this.barSpacing;return Math.round(a/2)};
PaneRendererArrowsUpDown.prototype.draw=function(a){var b=this.width,c=4>b,d=Math.max(parseInt(b/2),1),e=Math.round(this.width/2),f=Math.round(this.width);a.translate(1,1);for(var g=0,h=this.items.size();g<h;g++){var k=this.items.item(g),m=k.isUp?-1:1,n=Math.abs(k.height),q=k.y-m*this.vertOffset;a.beginPath();a.translate(k.x,q);c?(a.moveTo(0,0),a.lineTo(-e,-e*m),a.moveTo(0,0),a.lineTo(e,-e*m),a.moveTo(0,0),a.lineTo(0,-n*m),a.moveTo(-e,-n*m),a.lineTo(e,-n*m),a.lineWidth=d,a.strokeStyle=k.isUp?this.colorUp:
this.colorDn,a.stroke()):(a.moveTo(0,0),n<f?(a.lineTo(b,-n*m),a.lineTo(-b,-n*m)):(a.lineTo(b,-f*m),a.lineTo(e,-f*m),a.lineTo(e,-n*m),a.lineTo(-e,-n*m),a.lineTo(-e,-f*m),a.lineTo(-b,-f*m)),a.lineTo(0,0),a.strokeStyle=this.colorBorder,a.stroke(),a.fillStyle=k.isUp?this.colorUp:this.colorDn,a.fill());a.translate(-k.x,-q)}a.translate(-1,-1)};
PaneRendererArrowsUpDown.prototype.hitTest=function(a){for(var b=Math.round(this.width/2),c=Math.round(this.width),d=0;d<this.items.size();++d){var e=this.items.item(d);if(e&&void 0!==e.x&&null!==e.x&&!isNaN(e.x)&&void 0!==e.y&&null!==e.y&&!isNaN(e.y)){var f=Math.abs(e.height),g=e.isUp?-1:1,h=e.y-g*this.vertOffset,f=h-g*(f+c),g=e.x+b;if(e.x-b<a.x&&a.x<g&&(e.isUp?h<a.y&&a.y<f:f<a.y&&a.y<h))return new HitTestResult(HitTestResult.REGULAR)}}};
function PaneRendererUnicodeChar(a){this.items=a.items;this.ch=a["char"][0];this.color=a.color;this.vertOffset=a.vertOffset;this.height=Math.round(a.height)}
PaneRendererUnicodeChar.prototype.draw=function(a){a.font=this.height+"px Arial";var b=a.measureText(this.ch),c=this.height/2,b=b.width/2;a.translate(1,1);for(var d=0,e=this.items.size();d<e;d++){var f=this.items.item(d);newFillStyle=void 0!=f.style?f.style.color:this.color;a.fillStyle=newFillStyle;a.fillText(this.ch,f.x-b,f.y+this.vertOffset+c)}a.translate(-1,-1)};
PaneRendererUnicodeChar.prototype.hitTest=function(a){for(var b=this.vertOffset,c=selectionTolerance(this.height),d=0;d<this.items.size();++d){var e=this.items.item(d);if(e&&(offsettedPoint=new MathEx.Point(e.x,e.y+b),offsettedPoint.substract(a).length()<=c))return new HitTestResult(HitTestResult.REGULAR)}return null};function PaneRendererAbstractShape(a){this.items=a.items;this.height=a.height||a.width;this.width=a.width||a.height;this.color=a.color;this.vertOffset=a.vertOffset||0}
PaneRendererAbstractShape.prototype.draw=function(a){a.translate(1,1);for(var b=0,c=this.items.size();b<c;b++){var d=this.items.item(b);color=void 0!=d.style?d.style.color:this.color;this._drawShape(a,d,this.vertOffset,this.width,this.height,color)}a.translate(-1,-1)};PaneRendererAbstractShape.prototype._drawShape=function(a,b,c,d,e,f){throw Error("Method should be redefined in the child");};
PaneRendererAbstractShape.prototype.hitTest=function(a){for(var b=Math.max(this.height,this.width),c=this.vertOffset,d,e=0;e<this.items.size();++e)if(d=this.items.item(e))if(d=new MathEx.Point(d.x,d.y+c),d=d.substract(a).length(),d<=b)return new HitTestResult(HitTestResult.REGULAR);return null};function PaneRendererXCross(a){PaneRendererAbstractShape.call(this,a)}inherit(PaneRendererXCross,PaneRendererAbstractShape);
PaneRendererXCross.prototype._drawShape=function(a,b,c,d,e,f){a.lineWidth=2;a.strokeStyle=f;f=b.x-d/2;b=b.y-e/2+c;a.translate(f,b);a.beginPath();a.moveTo(0,0);a.lineTo(d,e);a.moveTo(0,e);a.lineTo(d,0);a.stroke();a.translate(-f,-b)};function PaneRendererTriangleApexUp(a){PaneRendererAbstractShape.call(this,a)}inherit(PaneRendererTriangleApexUp,PaneRendererAbstractShape);
PaneRendererTriangleApexUp.prototype._drawShape=function(a,b,c,d,e,f){var g=Math.round(e/3),h=b.x;b=b.y-2*g+c;a.fillStyle=f;a.translate(h,b);a.beginPath();a.moveTo(0,0);a.lineTo(d/2,e);a.lineTo(-d/2,e);a.lineTo(0,0);a.fill();a.translate(-h,-b)};function PaneRendererTriangleApexDown(a){PaneRendererAbstractShape.call(this,a)}inherit(PaneRendererTriangleApexDown,PaneRendererAbstractShape);
PaneRendererTriangleApexDown.prototype._drawShape=function(a,b,c,d,e,f){a.fillStyle=f;var g=Math.round(e/3);f=b.x-d/2;b=b.y-g+c;a.translate(f,b);a.beginPath();a.moveTo(0,0);a.lineTo(d,0);a.lineTo(d/2,e);a.lineTo(0,0);a.fill();a.translate(-f,-b)};function PaneRendererFlagShape(a){PaneRendererAbstractShape.call(this,a)}inherit(PaneRendererFlagShape,PaneRendererAbstractShape);
PaneRendererFlagShape.prototype._drawShape=function(a,b,c,d,e,f){a.fillStyle=f;f=b.x-d/2;b=b.y-e/2+c;c=(d-3)/3;a.translate(f,b);a.beginPath();a.moveTo(0,0);a.lineTo(3,0);a.bezierCurveTo(c,-c,2*c,c,d,0);a.lineTo(d,e/2);a.bezierCurveTo(d-c,e/2+c,d-2*c,e/2-c,3,e/2);a.lineTo(3,e);a.lineTo(0,e);a.closePath();a.fill();a.translate(-f,-b)};function PaneRendererCrossShape(a){PaneRendererAbstractShape.call(this,a)}inherit(PaneRendererCrossShape,PaneRendererAbstractShape);
PaneRendererCrossShape.prototype._drawShape=function(a,b,c,d,e,f){a.strokeStyle=f;a.lineWidth=2;f=b.x-d/2;b=b.y-e/2+c;a.translate(f,b);a.beginPath();a.moveTo(d/2,0);a.lineTo(d/2,e);a.moveTo(0,e/2);a.lineTo(d,e/2);a.stroke();a.translate(-f,-b)};function PaneRendererCircleShape(a){PaneRendererAbstractShape.call(this,a)}inherit(PaneRendererCircleShape,PaneRendererAbstractShape);
PaneRendererCircleShape.prototype._drawShape=function(a,b,c,d,e,f){a.fillStyle=f;d=Math.max(d,e)/2;a.beginPath();a.arc(b.x,b.y+c,d,0,2*Math.PI,!1);a.fill()};function PaneRendererBackground(a){this._items=a.items;this._y=a.y;this._h=a.h;this._w=a.w}PaneRendererBackground.prototype.draw=function(a){};
PaneRendererBackground.prototype.drawBackground=function(a){a.save();"undefined"==typeof FlashCanvas&&a.translate(-0.5,-0.5);for(var b=0;b<this._items.size();++b){var c=this._items.item(b);if(void 0!=c.color){a.fillStyle=c.color;var d=b==this._items.size()-1?this._w:this._items.item(b+1).x-c.x;a.fillRect(c.x,this._y,d,this._h)}}a.restore()};PaneRendererBackground.prototype.hitTest=function(a){return null};function PriceRange(a,b){this.m_minValue=a;this.m_maxValue=b}PriceRange.prototype.clone=function(){return new PriceRange(this.m_minValue,this.m_maxValue)};PriceRange.prototype.minValue=function(){return this.m_minValue};PriceRange.prototype.maxValue=function(){return this.m_maxValue};PriceRange.prototype.length=function(){return this.m_maxValue-this.m_minValue};PriceRange.prototype.isEmpty=function(){return this.m_maxValue===this.m_minValue||this.m_maxValue!=this.m_maxValue||this.m_minValue!=this.m_minValue};
PriceRange.prototype.merge=function(a){return new PriceRange(Math.min(this.minValue(),a.minValue()),Math.max(this.maxValue(),a.maxValue()))};PriceRange.prototype.apply=function(a,b){this.m_minValue=Math.min(this.m_minValue,a);this.m_maxValue=Math.max(this.m_maxValue,b)};
PriceRange.prototype.scaleAroundCenter=function(a){if(!isNumber(a))TradingView.logDebug("PriceRange.scaleAroundCenter: invalid coeff");else if(0!==this.m_maxValue-this.m_minValue){var b=0.5*(this.m_maxValue+this.m_minValue),c=this.m_maxValue-b,d=this.m_minValue-b;this.m_maxValue=b+c*a;this.m_minValue=b+d*a}};PriceRange.prototype.shift=function(a){isNumber(a)?(this.m_maxValue+=a,this.m_minValue+=a):TradingView.logDebug("PriceRange.shift: invalid coeff")};
PriceRange.prototype.convertToPercent=function(a,b){return 100*(a-b)/b};PriceRange.prototype.convertFromPercent=function(a,b){return a/100*b+b};PriceRange.prototype.convertToPercents=function(a){return new PriceRange(100*(this.m_minValue-a)/a,100*(this.m_maxValue-a)/a)};PriceRange.prototype.convertFromPercents=function(a){return new PriceRange(this.m_minValue/100*a+a,this.m_maxValue/100*a+a)};function TickMark(a,b,c){this.coord=a;this.label=b;this.major=c}
function PriceTickSpanCalculator(a,b){this.m_base=a;this.m_integralDividers=b;this.m_fractionalDividers=[];if(MathEx.isBaseDecimal(this.m_base))this.m_fractionalDividers=[2,2.5,2];else for(var c=this.m_base;1!==c;){if(0===c%2)this.m_fractionalDividers.push(2),c/=2;else if(0===c%5)this.m_fractionalDividers.push(2),this.m_fractionalDividers.push(2.5),c/=5;else throw new RangeError("unexpected base");if(100<this.m_fractionalDividers.length)throw Error("something wrong with base");}}
PriceTickSpanCalculator.prototype.TICK_SPAN_EPSILON=1E-9;
PriceTickSpanCalculator.prototype.tickSpan=function(a,b,c){var d=0===this.m_base?0:1/this.m_base,e=this.TICK_SPAN_EPSILON;a=Math.pow(10,Math.max(0,Math.ceil(MathEx.log10(a-b))));b=0;var f;b=0;for(f=this.m_integralDividers[0];MathEx.greaterOrEqual(a,d,e)&&MathEx.greaterOrEqual(a,c*f,e)&&MathEx.greaterOrEqual(a,1,e);++b,f=this.m_integralDividers[b%this.m_integralDividers.length])a/=f;a=Math.max(1,a);if(0<this.m_fractionalDividers.length&&MathEx.equal(a,1,e))for(b=0,f=this.m_fractionalDividers[0];a>
d+e&&MathEx.greaterOrEqual(a,c*f,e);++b,f=this.m_fractionalDividers[b%this.m_fractionalDividers.length])a/=f;return a};function PriceTickMarkBuilder(a,b,c){this.m_marks=[];this.m_base=b;this.m_priceScale=a;this.m_fontHeight=14;this._formatter=c}PriceTickMarkBuilder.prototype.TICK_DENSITY=2;PriceTickMarkBuilder.prototype.base=function(){return this.m_base};PriceTickMarkBuilder.prototype.setBase=function(a){if(0>a)throw new RangeError("base < 0");this.m_base=a};
PriceTickMarkBuilder.prototype.fontHeight=function(){return this.m_fontHeight};PriceTickMarkBuilder.prototype.setFontHeight=function(a){this.m_fontHeight!==a&&(this.m_fontHeight=a)};
PriceTickMarkBuilder.prototype.tickSpan=function(a,b){if(a<b)throw new RangeError("high < low");var c=this.m_priceScale.height(),d=this.tickMarkHeight(),c=(a-b)*d/c,d=new PriceTickSpanCalculator(this.m_base,[2,2.5,2]),e=new PriceTickSpanCalculator(this.m_base,[2,2,2.5]),f=new PriceTickSpanCalculator(this.m_base,[2.5,2,2]),g=[];g.push(d.tickSpan(a,b,c));g.push(e.tickSpan(a,b,c));g.push(f.tickSpan(a,b,c));return MathEx.min(g)};
PriceTickMarkBuilder.prototype.tickMarkHeight=function(){return this.m_fontHeight*this.TICK_DENSITY};function calculateBaseForTickSpan(a){for(var b=1;a*b!==Math.round(a*b);)b*=10;return b}
PriceTickMarkBuilder.prototype.rebuildTickMarks=function(){if(null===this.m_priceScale)throw new TypeError("scale is null");if(this.m_priceScale.isEmpty())this.m_marks=[];else{var a=this._formatter,b=this.m_priceScale.height(),c=this.m_priceScale.coordinateToPrice(b-1),d=this.m_priceScale.coordinateToPrice(0),b=d>=c?1:-1,e=Math.max(d,c),c=Math.min(d,c),d=e;if(d!=c){var e=this.tickSpan(d,c),f=d%e,f=f+(0>f?e:0);this.m_marks=[];a||(a=new PriceFormatter(calculateBaseForTickSpan(e)));for(var g=null,d=
d-f;d>c;d-=e)f=this.m_priceScale.priceToCoordinate(d),null!==g&&Math.abs(f-g)<this.tickMarkHeight()||(g=new TickMark(f,a.format(d),0),this.m_marks.push(g),g=f,this.m_priceScale.isLog()&&(e=this.tickSpan(d*b,c)))}}};PriceTickMarkBuilder.prototype.marks=function(){return this.m_marks};
function PriceScale(a){function b(){for(var a=c.m_dataSources,b=0;b<a.size();b++){var f=a.item(b);f.priceScaleChanged&&f.priceScaleChanged.fire(c)}}this._properties=a;this.m_height=0;this.m_priceRange=null;this.m_dataSources=new List;this._studyBottomMargin=this._studyTopMargin=this.m_bottomMargin=this.m_topMargin=0;this.m_priceRangeSnapshot=this.m_scaleStartPoint=this.m_scrollStartPoint=null;this.m_markBuilder=new PriceTickMarkBuilder(this,100,new PriceFormatter(100));this._properties.percentage.listeners().subscribe(this,
PriceScale.prototype.updateFormatter);this._properties.showSymbolLabels.listeners().subscribe(this,PriceScale.prototype.updateShowSymbolLabels);var c=this;this._properties.log.listeners().subscribe(null,function(a){if(c.m_priceRange){var b=c.m_priceRange;a.value()?c.m_priceRange=new PriceRange(c._toLog(b.minValue()),c._toLog(b.maxValue())):c.m_priceRange=new PriceRange(c._fromLog(b.minValue()),c._fromLog(b.maxValue()))}});this._properties.percentage.listeners().subscribe(null,function(){c._properties.autoScale.setValue(!0)});
this._properties.percentage.listeners().subscribe(null,function(){c._properties.autoScaleDisabled.setValue(c._properties.percentage.value());var a=c.priceRange();if(c.mainSource()&&!(c.mainSource().model().timeScale().isEmpty()||c.mainSource().data().isEmpty()||c.mainSource()instanceof TradingView.Series&&!c.mainSource().properties().lockScale.value())&&a){var b=c.mainSource().model().timeScale().visibleBars(),b=c.mainSource().data().search(b.firstBar(),SEARCH_NEAREST_RIGHT).value[CLOSE_PLOT];null!=
a&&void 0!==b&&(c._properties.percentage.value()?c.setPriceRange(a.convertToPercents(b)):c.setPriceRange(a.convertFromPercents(b)))}});this._sourcesToUpdateViews=this._sourcesForAutoscale=null;this._hasSeries=!1;this._properties.percentage.listeners().subscribe(null,b);this._properties.log.listeners().subscribe(null,b)}PriceScale.prototype.isLog=function(){return this._properties.log.value()};PriceScale.prototype.isPercent=function(){return this._properties.percentage.value()};
PriceScale.prototype.properties=function(){return this._properties};PriceScale.prototype.height=function(){return this.m_height};PriceScale.prototype.setHeight=function(a){var b=this.m_height;this.m_height=a;this._internalHeightCache=void 0;this._marksCache=null;b!=a&&this.mainSource()instanceof TradingView.Series&&this.mainSource().isLockScale()&&this.mainSource().model().timeScale().recalcLockedScale()};PriceScale.prototype.topMargin=function(){return Math.max(this.m_topMargin,this._studyTopMargin)};
PriceScale.prototype.setTopMargin=function(a){if(!isNumber(a))throw new TypeError("invalid margin");if(0>a||30<a)throw new RangeError("invalid margin");this.m_topMargin=a;this._internalHeightCache=void 0;this._marksCache=null};PriceScale.prototype.bottomMargin=function(){return Math.max(this.m_bottomMargin,this._studyBottomMargin)};
PriceScale.prototype.setBottomMargin=function(a){if(!isNumber(a))throw new TypeError("invalid margin");if(0>a||30<a)throw new RangeError("invalid margin");this.m_bottomMargin=a;this._internalHeightCache=void 0;this._marksCache=null};PriceScale.prototype.internalHeight=function(){if(this._internalHeightCache)return this._internalHeightCache;var a=this.height()*(1-this.topMargin()-this.bottomMargin());return this._internalHeightCache=a};PriceScale.prototype.priceRange=function(){return this.m_priceRange};
PriceScale.prototype.setPriceRange=function(a){if(!a instanceof PriceRange)throw new TypeError("incorrect price range");this.m_priceRange=a;this._marksCache=null};PriceScale.prototype.isEmpty=function(){return 0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()};PriceScale.prototype.invertedCoordinate=function(a){return this.height()-1-a};PriceScale._logicalOffset=4;PriceScale._coordOffset=1E-4;PriceScale.prototype.log10=function(a){return Math.log(a)/Math.log(10)};
PriceScale.prototype._toLog=function(a){var b=Math.abs(a);if(1E-6>b)return 0;b=this.log10(b+PriceScale._coordOffset)+PriceScale._logicalOffset;return 0>a?-b:b};PriceScale.prototype.priceToLogical=function(a){return this.isLog()&&a?this._toLog(a):a};PriceScale.prototype._fromLog=function(a){var b=Math.abs(a);if(1E-6>b)return 0;b=Math.pow(10,b-PriceScale._logicalOffset)-PriceScale._coordOffset;return 0>a?-b:b};PriceScale.prototype.logicalToPrice=function(a){return this.isLog()?this._fromLog(a):a};
PriceScale.prototype.priceToCoordinate=function(a,b){if(this.isEmpty())return 0;a=this.priceToLogical(a);var c=this.bottomMargin()*this.height()+(this.internalHeight()-1)*(a-this.priceRange().minValue())/(this.priceRange().maxValue()-this.priceRange().minValue()),c=this.invertedCoordinate(c);return b?c:Math.round(c)};PriceScale.prototype.pricesToCoordinates=function(a){this.pricesToCoordinatesEx(a.toArray(),function(a){return a.y},function(a,c){a.y=c})};
PriceScale.prototype.pricesToCoordinatesEx=function(a,b,c){var d=this.bottomMargin()*this.height(),e=this.priceRange().minValue(),f=this.priceRange().maxValue(),f=(this.internalHeight()-1)/(f-e);if(this.isLog())for(var g=0;g<a.length;g++){var h=b(a[g]);c(a[g],this.priceToLogical(h))}for(g=0;g<a.length;g++)h=b(a[g]),isNaN(h)||void 0===h||null===h||c(a[g],Math.round(this.m_height-1-(d+f*(h-e))))};
PriceScale.prototype.pricesArrayToCoordinates=function(a){var b=this.bottomMargin()*this.height(),c=this.priceRange().minValue(),d=this.priceRange().maxValue(),d=(this.internalHeight()-1)/(d-c);if(this.isLog())for(var e=0;e<a.length;e++)a[e]=this.priceToLogical(a[e]);for(e=0;e<a.length;e++){var f=a[e];f&&(a[e]=Math.round(this.m_height-1-(b+d*(f-c))))}};
PriceScale.prototype.barPricesToCoordinates=function(a){a=a.toArray();var b=this.bottomMargin()*this.height(),c=this.priceRange().minValue(),d=this.priceRange().maxValue(),d=(this.internalHeight()-1)/(d-c);if(this.isLog())for(var e=0;e<a.length;e++)a[e]&&(a[e].open=this.priceToLogical(a[e].open),a[e].high=this.priceToLogical(a[e].high),a[e].low=this.priceToLogical(a[e].low),a[e].close=this.priceToLogical(a[e].close),a[e].additionalPrice&&(a[e].additionalPrice=this.priceToLogical(a[e].additionalPrice)));
for(e=0;e<a.length;e++){var f=a[e];if(f){var g=f.open,g=b+d*(g-c),g=this.m_height-1-g;f.open=Math.round(g);g=f.high;g=b+d*(g-c);g=this.m_height-1-g;f.high=Math.round(g);g=f.low;g=b+d*(g-c);g=this.m_height-1-g;f.low=Math.round(g);g=f.close;g=b+d*(g-c);g=this.m_height-1-g;f.close=Math.round(g);f.additionalPrice&&(g=f.additionalPrice,g=b+d*(g-c),g=this.m_height-1-g,f.additionalPrice=Math.round(g))}}};
PriceScale.prototype.coordinateToPrice=function(a){if(this.isEmpty())return 0;a=this.invertedCoordinate(a);a=this.priceRange().minValue()+(this.priceRange().maxValue()-this.priceRange().minValue())*((a-this.bottomMargin()*this.height())/(this.internalHeight()-1));return this.logicalToPrice(a)};PriceScale.prototype.isAutoScale=function(){return this._properties.autoScale.value()&&!(this.mainSource()instanceof TradingView.Series&&this.mainSource().isLockScale())};PriceScale.prototype.isPercentage=function(){return this._properties.percentage.value()};
PriceScale.prototype.dataSources=function(){return this.m_dataSources};PriceScale.prototype.orderedSources=function(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;for(var a=[],b=0;b<this.dataSources().size();b++){var c=this.dataSources().item(b);null==c.zorder()&&c.setZorder(b+1);a.push(c)}a=Pane.sortSources(a);return this._cachedOrderedSoruces=new List(a)};PriceScale.prototype.invalidateSourcesCache=function(){this._cachedOrderedSoruces=null};
PriceScale.prototype.addDataSource=function(a){if(!this.m_dataSources.contains(a)){isInherited(a.constructor,TradingView.Series)&&(this._hasSeries=!0);var b=this;a.properties().visible.listeners().subscribe(null,function(){b._sourcesForAutoscale=null});this.m_dataSources.append(a);this._mainSource=void 0;this._sourcesToUpdateViews=this._sourcesForAutoscale=null;this.updateFormatter();this.initScaleProperties();this.invalidateSourcesCache()}};
PriceScale.prototype.initScaleProperties=function(){var a=this.mainSource()instanceof TradingView.Series&&this.mainSource().properties().lockScale.value();a&&(this.properties().percentage.setValue(!1),this.properties().log.setValue(!1),this.properties().autoScale.setValue(!1));this.properties().percentageDisabled.setValue(a);this.properties().logDisabled.setValue(a);this.properties().autoScaleDisabled.setValue(this.properties().percentage.value());this.properties().percentage.value()&&this.properties().log.setValue(!1)};
PriceScale.prototype.removeDataSource=function(a){if(!this.m_dataSources.contains(a))throw Error("source is not attached to scale");this.m_dataSources.remove(a);isInherited(a.constructor,TradingView.Series)&&(this._hasSeries=!1);this.mainSource()||this.setAutoScale(!0);this._mainSource=void 0;this._sourcesToUpdateViews=this._sourcesForAutoscale=null;this.updateFormatter();this.invalidateSourcesCache()};PriceScale.prototype.setAutoScale=function(a){this._properties.autoScale.setValue(a)};
PriceScale.prototype.startScale=function(a){this.isPercentage()||null!==this.m_scaleStartPoint||null!==this.m_priceRangeSnapshot||this.isEmpty()||(this.m_scaleStartPoint=this.m_height-a,this.m_priceRangeSnapshot=this.priceRange().clone())};PriceScale.prototype.marks=function(){if(this._marksCache)return this._marksCache;this.m_markBuilder.rebuildTickMarks();return this._marksCache=this.m_markBuilder.marks()};
PriceScale.prototype.scaleTo=function(a){if(!this.isPercentage()&&(this._marksCache=null,null!==this.m_scaleStartPoint)){this.setAutoScale(!1);var b=this.m_priceRange.clone();a=this.m_height-a;0>a&&(a=0);a=(this.m_scaleStartPoint+0.2*(this.m_height-1))/(a+0.2*(this.m_height-1));a=Math.max(a,0.1);this.m_priceRange=this.m_priceRangeSnapshot.clone();this.m_priceRange.scaleAroundCenter(a);this.recalcLockedScale(b)}};
PriceScale.prototype.recalcLockedScale=function(a){if(this.mainSource()instanceof TradingView.Series&&this.mainSource().properties().lockScale.value()){var b=this.mainSource().model().timeScale(),c=this.mainSource().data().boxSize;void 0===c&&this.mainSource().fixBoxSize();if(void 0!==c){if(this.properties().percentage.value())var d=this.mainSource().data().search(this.mainSource().getRealVisibleRange().m_firstBar).value[CLOSE_PLOT],c=PriceRange.prototype.convertToPercent.call(null,d+c,d)-PriceRange.prototype.convertToPercent.call(null,
d,d);c*=this.internalHeight()/this.priceRange().length();0.5>c||50<c?this.m_priceRange=a:(b.setBarSpacing(c),b._correctOffset());this.mainSource().model().mainSeries().requestMoreData()}}};PriceScale.prototype.endScale=function(){this.isPercentage()||null===this.m_scaleStartPoint||(this.m_priceRangeSnapshot=this.m_scaleStartPoint=null)};
PriceScale.prototype.startScroll=function(a){this.isAutoScale()||null!==this.m_scrollStartPoint||null!==this.m_priceRangeSnapshot||this.isEmpty()||(this.m_scrollStartPoint=a,this.m_priceRangeSnapshot=this.priceRange().clone())};PriceScale.prototype.scrollTo=function(a){this._marksCache=null;if(!this.isAutoScale()&&null!==this.m_scrollStartPoint){var b=this.priceRange().length()/(this.height()-1);a=(a-this.m_scrollStartPoint)*b;this.m_priceRange=this.m_priceRangeSnapshot.clone();this.m_priceRange.shift(a)}};
PriceScale.prototype.endScroll=function(){this.isAutoScale()||null===this.m_scrollStartPoint||(this.m_priceRangeSnapshot=this.m_scrollStartPoint=null)};
PriceScale.prototype.state=function(){var a={};a.m_priceRange=this.priceRange()?this.priceRange().clone():null;a.m_isAutoScale=this.isAutoScale();a.m_isPercentage=this._properties.percentage.value();a.m_isLog=this._properties.log.value();a.m_height=this.m_height;a.m_topMargin=this.m_topMargin;a.m_bottomMargin=this.m_bottomMargin;a.m_showSymbolLabels=this._properties.showSymbolLabels.value();return a};
PriceScale.prototype.restoreState=function(a){var b=a.m_priceRange;if(void 0===b)throw new TypeError("invalid state");if(void 0===a.m_isAutoScale)throw new TypeError("invalid state");void 0!==a.m_isPercentage&&this._properties.percentage.setValue(a.m_isPercentage);void 0!==a.m_isLog&&this._properties.log.setValue(a.m_isLog);this.m_priceRange=b?new PriceRange(b.m_minValue,b.m_maxValue):null;void 0!==a.m_height&&(this.m_height=a.m_height);this.setAutoScale(a.m_isAutoScale);void 0!==a.m_topMargin&&(this.m_topMargin=
a.m_topMargin);void 0!==a.m_bottomMargin&&(this.m_bottomMargin=a.m_bottomMargin);void 0!==a.m_showSymbolLabels&&this._properties.showSymbolLabels.setValue(a.m_showSymbolLabels);this._mainSource=void 0;this._scaleSeriesOnly=!1};
PriceScale.prototype.mainSource=function(){if(void 0!==this._mainSource)return this._mainSource;for(var a=0;a<this.m_dataSources.size();a++)if(isInherited(this.m_dataSources.item(a).constructor,PriceDataSource))return this._mainSource=a=this.m_dataSources.item(a);this._mainSource=void 0;return null};PriceScale.prototype.formatter=function(){this._formatter||this.updateFormatter();return this._formatter};
PriceScale.prototype.updateFormatter=function(){this._marksCache=null;var a=this.mainSource(),b=100;a&&(b=a.base());this._formatter=null;this.properties().percentage.value()?this._formatter=new PercentageFormatter:a&&(this._formatter=a.formatter());this.m_markBuilder=new PriceTickMarkBuilder(this,b,this._formatter);this.m_markBuilder.rebuildTickMarks()};
PriceScale.prototype._recalculateSourcesForAutoscale=function(){this._sourcesForAutoscale=new List;this._mainSource&&(this._scaleSeriesOnly=this._mainSource.model().properties().scalesProperties.scaleSeriesOnly.value());for(var a=this._scaleSeriesOnly&&this._hasSeries,b=0;b<this.dataSources().size();b++){var c=this.dataSources().item(b),d;d=c;d=d.properties().visible.value()||d instanceof TradingView.Series?a?isInherited(d.constructor,TradingView.Series):isInherited(d.constructor,PriceDataSource):
!1;d&&this._sourcesForAutoscale.append(c)}};PriceScale.prototype.sourcesForAutoscale=function(){if(this._mainSource){var a=this._mainSource.model().properties();this._scaleSeriesOnly!=a.scalesProperties.scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null)}this._sourcesForAutoscale||this._recalculateSourcesForAutoscale();return this._sourcesForAutoscale};
PriceScale.prototype.recalculatePriceRange=function(a){this._studyBottomMargin=this._studyTopMargin=0;var b=null,c=this.sourcesForAutoscale();this.mainSource();for(var d=0;d<c.size();d++){var e=c.item(d);if(e.properties().visible.value()){var f=a.firstBar(),g=a.lastBar(),f=e.priceRange(f,g);null===b&&f?b=f:f&&(b=b.merge(f));e.margins&&(e=e.margins(),this._studyTopMargin=Math.max(e[0],this._studyTopMargin),this._studyBottomMargin=Math.max(e[1],this._studyBottomMargin))}}b?(b.minValue()==b.maxValue()&&
(b=new PriceRange(b.minValue()-0.5,b.maxValue()+0.5)),this.setPriceRange(b)):this.m_priceRange||this.setPriceRange(new PriceRange(-0.5,0.5))};PriceScale.prototype.sourcesToUpdateViews=function(){if(!this._sourcesToUpdateViews){this._sourcesToUpdateViews=new List;for(var a=0;a<this.dataSources().size();a++){var b=this.dataSources().item(a);isInherited(b.constructor,LineDataSource)&&!b.isActualSymbol()||this._sourcesToUpdateViews.append(b)}}return this._sourcesToUpdateViews};
PriceScale.prototype.updatePaneViews=function(){for(var a=this.sourcesToUpdateViews(),b=0;b<a.size();b++)a.item(b).updateAllViews()};PriceScale.prototype.updateShowSymbolLabels=function(){for(var a=this.sourcesToUpdateViews(),b=0;b<a.size();b++)a.item(b).updateAllViews();this.mainSource()&&this.mainSource().model().invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};TradingView.SeriesData=function(a,b){this.m_bars=new PlotList(["time","open","high","low","close"]);this.m_nsBars=new PlotList(["time","open","high","low","close"]);this.m_series=a;this.m_model=b;this.boxSize=this.lastProjectionPrice=void 0};TradingView.SeriesData.prototype.bars=function(){return this.m_bars};TradingView.SeriesData.prototype.nsBars=function(){return this.m_nsBars};TradingView.SeriesData.prototype.size=function(){return this.m_nsBars._end-this.m_nsBars._start+(this.m_bars._end-this.m_bars._start)};
TradingView.SeriesData.prototype.each=function(a){for(var b=this.m_bars._start;b<this.m_bars._end&&!a(this.m_bars._indexAt(b),this.m_bars._valueAt(b));++b);for(b=this.m_nsBars._start;b<this.m_nsBars._end&&!a(this.m_nsBars._indexAt(b),this.m_nsBars._valueAt(b));++b);};TradingView.SeriesData.prototype.clear=function(){this.m_bars=new PlotList(["time","open","high","low","close"]);this.m_nsBars=new PlotList(["time","open","high","low","close"]);this.boxSize=this.lastProjectionPrice=void 0};
TradingView.SeriesData.prototype.first=function(){return this.m_bars.isEmpty()?this.m_nsBars._items[0]:this.m_bars._items[0]};TradingView.SeriesData.prototype.isEmpty=function(){return this.m_bars.isEmpty()&&this.m_nsBars.isEmpty()};TradingView.SeriesData.prototype.last=function(){return this.m_nsBars.isEmpty()?this.m_bars._items[this.m_bars._end-1]:this.m_nsBars._items[this.m_nsBars._end-1]};
TradingView.SeriesData.prototype.search=function(a,b){return this.nsBars().isEmpty()?this.bars().search(a,b):this.bars().isEmpty()?this.nsBars().search(a,b):this.nsBars().firstTimeIndex()<=a?this.nsBars().search(a,b):this.bars().search(a,b)};TradingView.SeriesData.prototype.valueAt=function(a){if(a=this.search(a))return a.value};
TradingView.SeriesData.prototype.firstBar=function(){if(this.m_model.timeScale().isEmpty())return null;var a=this.m_model.timeScale().visibleBars(),b=a.firstBar(),a=a.lastBar(),c=null,d=function(a,b){if(!c)return c=b,!0};this.bars().range(b,a).isEmpty()?this.nsBars().range(b,a).each(d):this.bars().range(b,a).each(d);return c};TradingView.SeriesData.prototype.firstValue=function(){var a=this.firstBar();return a?a[CLOSE_PLOT]:null};
TradingView.SeriesData.prototype.timeToBarIndex=function(a,b){if(null===a)return TradingView.logDebug("SeriesData.timeToBarIndex: time should be a number of seconds since 1970. But it is null"),0;if(b===SEARCH_FROM_RIGHT){for(var c=this.m_bars.lastIndex();c>=this.m_bars.firstIndex();c--){var d=this.m_bars._valueAt(c);if(a>=d[TIME_PLOT])return c}for(c=this.m_nsBars.lastIndex();c>=this.m_nsBars.firstIndex();c--)if(d=this.m_nsBars._valueAt(c),a>=d[TIME_PLOT])return c;return this.m_bars.firstIndex()}if(b===
SEARCH_FROM_LEFT){for(c=this.m_bars.firstIndex();c<=this.m_bars.lastIndex();c++)if(d=this.m_bars._valueAt(c),a<=d[TIME_PLOT])return c;for(c=this.m_nsBars.firstIndex();c<=this.m_nsBars.lastIndex();c++)if(d=this.m_nsBars._valueAt(c),a<=d[TIME_PLOT])return c;return this.m_bars.lastIndex()}TradingView.logDebug("SeriesData.timeToBarIndex: Incorrect options value");return 0};var DEFAULT_BAR_COUNT=300,TIME_PLOT=0,OPEN_PLOT=1,HIGH_PLOT=2,LOW_PLOT=3,CLOSE_PLOT=4,ADT_PLOT=6,SEARCH_FROM_LEFT=-1,SEARCH_FROM_RIGHT=1;function SeriesPriceLinePaneView(a){this._series=a;this._model=a.m_model;this._points=(new List).append(new MathEx.Point(0,0))}
SeriesPriceLinePaneView.prototype.update=function(){this._visible=!1;if(this._series.properties().showPriceLine.value()){var a=this._series.lastValueData(CLOSE_PLOT,!0);a&&(this._visible=!0,this._points=(new List).append(new MathEx.Point(0,a.coordinate)),this._color=a.color)}};
SeriesPriceLinePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._color;a.linewidth=this._series.properties().priceLineWidth.value();a.linestyle=CanvasEx.LINESTYLE_DOTTED;a.hitTestResult=HitTestResult.REGULAR;a.visible=this._visible;return new HorzLineRenderer(a)};TradingView.defaultRequestOption=function(){return{count:DEFAULT_BAR_COUNT}};
TradingView.Series=function(a,b,c){PriceDataSource.call(this);this._requestOptions=c?c:TradingView.defaultRequestOption();this.m_model=a;this._chartApi=a._chartApi;this.m_data=new TradingView.SeriesData(this,a);this.setProperties(b);this._prevChartStyle=b.style.value();this.createPaneView();this._dataWindowView=new SeriesDataWindowView(this,a);this._statusView=new SeriesStatusView(this,a.properties());this._priceAxisViews=new List;this._priceAxisViews.append(new SeriesPriceAxisView(this,a));this._priceAxisViews.append(new ProjectionSeriesPriceAxisView(this,
a));this._symbolInfo=null;this._status=TradingView.Series.STATUS_OFFLINE;var d=this;this._turnaroundCounter=1;this._turnaround="s"+this._turnaroundCounter;this._handler=function(a){d.onData(a)};this._properties.addExclusion&&this._properties.addExclusion("visible");this._base=100;this._formatter=new PriceFormatter(this._base);this._tagsChanged=new Delegate;this._symbolIntervalChanged=new Delegate;this._symbolResolved=new Delegate;this._symbolError=new Delegate;this._symbolNotPermitted=new Delegate;
this._extendedHoursChanged=new Delegate;this._extendedHoursNotPermitted=new Delegate;this.chartTypeNotPermitted=new Delegate;this.intradaySpreadNotPermitted=new Delegate;this.intradayExchangeNotPermitted=new Delegate;this.customIntervalNotPermitted=new Delegate;this.chartWidgetInitialized=new Delegate;this._startLoading=new Delegate;this._dataLoaded=new Delegate;this._tickmarksRangeChanged=new Delegate;this._barReceived=new Delegate;this._onChangedStyle=new Delegate;this._onStatusChanged=new Delegate;
this._onRestarted=new Delegate;this._onSessionsStudyCreated=new Delegate;this.requestingIntradayWhenNotSupported=new Delegate;this.requestingResolutionWhenNotSupported=new Delegate;this.priceScaleChanged=new Delegate;this._predictBars=0;this._futureBarsPaneView=null;this._properties.showInDataWindow.listeners().subscribe(a,ChartModel.prototype.fullUpdate);this.marketStatus=new WatchedValue;this._seriesLoaded=!1;this.properties().minTick.listeners().subscribe(this,TradingView.Series.prototype._recreateFormatter);
d=this;this.properties().minTick.listeners().subscribe(null,function(){d.m_model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))});this._priceLineView=new SeriesPriceLinePaneView(this);this.bindJapChartsInputs();this.createExtendedHoursProperty();this.extendedHours.listeners().subscribe(this,function(){this._extendedHoursChanged.fire()});this._extendedHoursNotPermitted.subscribe(this,function(){this._properties.extendedHours.setValue(!1);this.disableSessionBackground()});
this._extendedHoursChanged.subscribe(this,function(){this._status!==TradingView.Series.STATUS_SNAPSHOT&&this.restart()});this._symbolIntervalChanged.subscribe(this,this.checkInterval);this.properties().showCountdown.listeners().subscribe(this,TradingView.Series.prototype._onChangeShowCountdown);this._onChangeShowCountdown(this.properties().showCountdown);this._recreateFormatter();this._symbolResolved.subscribe(this,this.checkQuandlSymbol)};inherit(TradingView.Series,PriceDataSource);
TradingView.Series.prototype._onChangeShowCountdown=function(a){var b=this;a.value()?this._countdownUpdateTimer=setInterval(function(){b._priceAxisViews.item(0).update();b.m_model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))},500):(clearInterval(this._countdownUpdateTimer),delete this._countdownUpdateTimer)};
TradingView.Series.prototype.lastValueData=function(a,b){var c={};if(this.m_model.timeScale().isEmpty()||this.priceScale().isEmpty()||this.data().isEmpty())return null;var d=this.m_model.timeScale().visibleBars();if(d.isEmpty())return null;var e,f;if(b){f=this.data().bars().last();if(null==f)return null;e=f.value;f=parseInt(f)}else{f=this.data().bars().search(d.lastBar(),SEARCH_NEAREST_LEFT);if(void 0===f)return null;e=this.data().bars().valueAt(f.index);f=f.index}e=e[CLOSE_PLOT];this.priceScale().properties().percentage.value()&&
(d=this.nearestIndex(d.firstBar(),SEARCH_NEAREST_RIGHT),this.data().valueAt(d),d=this.firstValue(),e=this.priceScale().priceRange().convertToPercent(e,d));c.text=this.priceScale().formatter().format(e);d=this.barColorer().barStyle(f,!1);c.color=d.barColor;c.coordinate=this.priceScale().priceToCoordinate(e);return c};
TradingView.Series.prototype._prepareChartApiParams=function(){return this._requestOptions.startDate?!this._requestOptions.startDate||this._requestOptions.endDate||this._requestOptions.count?this._requestOptions.startDate&&this._requestOptions.endDate?["from_to",this._requestOptions.startDate,this._requestOptions.endDate]:["from_to",this._requestOptions.startDate,this._requestOptions.count]:["from_to",this._requestOptions.startDate]:this._requestOptions.count||DEFAULT_BAR_COUNT};
TradingView.Series.prototype._nextSymbolId=1;TradingView.Series.prototype._nextSeriesId=1;TradingView.Series.STYLE_BARS=0;TradingView.Series.STYLE_CANDLES=1;TradingView.Series.STYLE_LINE=2;TradingView.Series.STYLE_LINE_TYPE_MARKERS=0;TradingView.Series.STYLE_LINE_TYPE_STEP=1;TradingView.Series.STYLE_LINE_TYPE_SIMPLE=2;TradingView.Series.STYLE_AREA=3;TradingView.Series.STYLE_RENKO=4;TradingView.Series.STYLE_KAGI=5;TradingView.Series.STYLE_PNF=6;TradingView.Series.STYLE_PB=7;
TradingView.Series.STYLE_HEIKEN_ASHI=8;TradingView.Series.STYLE_HOLLOW_CANDLES=9;TradingView.Series.STATUS_OFFLINE=0;TradingView.Series.STATUS_RESOLVING=1;TradingView.Series.STATUS_LOADING=2;TradingView.Series.STATUS_READY=3;TradingView.Series.STATUS_INVALID_SYMBOL=4;TradingView.Series.STATUS_SNAPSHOT=5;TradingView.Series.STATUS_EOD=6;TradingView.Series.STATUS_PULSE=7;TradingView.Series.STATUS_DELAYED=8;TradingView.Series.STATUS_DELAYED_STREAMING=9;TradingView.Series.PERMISSION_DENIED="permission denied";
TradingView.Series.PD_REASON_SYMBOL="symbol";TradingView.Series.PD_REASON_EXTENDED_HOURS="extended_hours";TradingView.Series.STUDY_NOT_AUTH="study_not_auth";TradingView.Series.prototype.model=function(){return this.m_model};TradingView.Series.prototype.fixLastBar=function(){if(!this._futureBarsPaneView){var a=parseInt(this.data().last(),10)+1;this._futureBarsPaneView=new TradingView.FutureBarsPaneView(this,a)}};TradingView.Series.prototype.clearData=function(){this.data().clear()};
TradingView.Series.prototype.data=function(){return this.m_data};TradingView.Series.prototype.symbolId=function(){return this._symbolId};TradingView.Series.prototype.isPulse=function(){return this._symbolInfo&&0<this._symbolInfo.resolutions.length};TradingView.Series.prototype.onTagsChanged=function(){return this._tagsChanged};TradingView.Series.prototype.onSymbolIntervalChanged=function(){return this._symbolIntervalChanged};TradingView.Series.prototype.onSymbolResolved=function(){return this._symbolResolved};
TradingView.Series.prototype.onSymbolError=function(){return this._symbolError};TradingView.Series.prototype.onSymbolNotPermitted=function(){return this._symbolNotPermitted};TradingView.Series.prototype.onExtendedHoursNotPermitted=function(){return this._extendedHoursNotPermitted};TradingView.Series.prototype.onStartLoading=function(){return this._startLoading};TradingView.Series.prototype.onDataLoaded=function(){return this._dataLoaded};TradingView.Series.prototype.onStatusChanged=function(){return this._onStatusChanged};
TradingView.Series.prototype.onTickmarksRangeChanged=function(){return this._tickmarksRangeChanged};TradingView.Series.prototype.onBarReceived=function(){return this._barReceived};TradingView.Series.prototype.onChangedStyle=function(){return this._onChangedStyle};TradingView.Series.prototype.onRestarted=function(){return this._onRestarted};TradingView.Series.prototype.status=function(){return this._status};TradingView.Series.prototype.isDWM=function(){return!(3600>+this._properties.interval.value())};
TradingView.Series.prototype.createPaneView=function(){this._projectionBarsPaneView=this._paneView=null;this._symbolLabelView=new TradingView.SymbolLabelPaneView(this.m_model,this,CLOSE_PLOT,"firstShortName");switch(this._properties.style.value()){case TradingView.Series.STYLE_BARS:this._paneView=new SeriesBarsPaneView(this,this.m_model);break;case TradingView.Series.STYLE_CANDLES:this._paneView=new SeriesCandlesPaneView(this,this.m_model);break;case TradingView.Series.STYLE_LINE:this._paneView=new SeriesLinePaneView(this,
this._properties.lineStyle.priceSource.value(),this.m_model);break;case TradingView.Series.STYLE_AREA:this._paneView=new SeriesAreaPaneView(this,this._properties.areaStyle.priceSource.value(),this.m_model);break;case TradingView.Series.STYLE_RENKO:this._paneView=new SeriesRenkoPaneView(this,this.m_model);this._projectionBarsPaneView=new SeriesProjectionRenkoPaneView(this,this.m_model);break;case TradingView.Series.STYLE_PB:this._paneView=new SeriesPriceBreakPaneView(this,this.m_model);this._projectionBarsPaneView=
new SeriesProjectionPriceBreakPaneView(this,this.m_model);break;case TradingView.Series.STYLE_KAGI:this._paneView=new SeriesKagiPaneView(this,this.m_model);this._projectionBarsPaneView=new SeriesProjectionKagiPaneView(this,this.m_model);break;case TradingView.Series.STYLE_PNF:this._paneView=new SeriesPnFPaneView(this,this.m_model);this._projectionBarsPaneView=new SeriesProjectionPnFPaneView(this,this.m_model);break;case TradingView.Series.STYLE_HEIKEN_ASHI:this._paneView=new SeriesHeikenAshiPaneView(this,
this.m_model);break;case TradingView.Series.STYLE_HOLLOW_CANDLES:this._paneView=new SeriesHollowCandlesPaneView(this,this.m_model)}};TradingView.Series.prototype.invalidateBarColorerCache=function(){delete this._barColorerCache};
TradingView.Series.prototype.barColorer=function(){if(this._barColorerCache)return this._barColorerCache;for(var a=null,b=this.m_model.dataSources().size()-1;0<=b;b--){var c=this.m_model.dataSources().item(b);c.metaInfo&&isInherited(c.constructor,TradingView.Study)&&c.hasBarColorer()&&c.properties().visible.value()&&(c=c.barColorer(),null===a?a=c:a.pushBackBarColorer(c))}null===a?a=new SeriesBarColorer(this):a.pushBackBarColorer(new SeriesBarColorer(this));return this._barColorerCache=a};
TradingView.Series.prototype.properties=function(){return this._properties};TradingView.Series.prototype.state=function(a){var b={type:this===this.m_model.mainSeries()?"MainSeries":TradingView.className(this.constructor),id:this.id(),state:this.properties().state(),zorder:this.zorder()};a&&(b.bars=this.m_data.m_bars.state(),b.nsBars=this.m_data.m_nsBars.state(),b.symbolInfo=this._symbolInfo,b.rtPrice=this.data().lastProjectionPrice);b.boxSize=this.data().boxSize;return b};
TradingView.Series.prototype.restoreData=function(a,b,c,d,e){this._status=TradingView.Series.STATUS_SNAPSHOT;this.m_data.m_bars.restoreState(a);this.m_data.m_nsBars.restoreState(b);this.updateSymbolInfo(c);this.m_data.lastProjectionPrice=d;this.m_data.boxSize=e;e||(this.properties().style.value()==TradingView.Series.STYLE_PNF?this.m_data.boxSize=this.properties().pnfStyle.inputs.boxSize.value():this.properties().style.value()==TradingView.Series.STYLE_RENKO&&(this.m_data.boxSize=this.properties().renkoStyle.inputs.boxSize.value()))};
TradingView.Series.prototype.setProperties=function(a){a.timeframe||a.merge({timeframe:""});a.shortName||a.merge({shortName:""});this._properties=a;this._properties.symbol.listeners().subscribe(this,TradingView.Series.prototype.changeSymbol);this._properties.interval.listeners().subscribe(this,TradingView.Series.prototype.changeInterval);this._properties.timeframe.listeners().subscribe(this,TradingView.Series.prototype.changeTimeFrame);this._properties.listeners().subscribe(this,TradingView.Series.prototype.changeProperties)};
TradingView.Series.prototype.changeSymbol=function(){TradingView.trackEvent("GUI","Change symbol");this.setSymbolInterval(this.symbol(),this._properties.interval.value());this.m_model.checkLineToolSelection()};TradingView.Series.prototype.changeInterval=function(){TradingView.trackEvent("GUI","Change interval");this.setSymbolInterval(this._properties.symbol.value(),this._properties.interval.value())};
TradingView.Series.prototype.changeTimeFrame=function(){TradingView.trackEvent("GUI","Change timeframe");timeframe=this._properties.interval.value()};TradingView.Series.prototype.title=function(){return this.properties().symbol.value()+", "+translatedIntervalString(this.properties().interval.value())};
TradingView.Series.prototype.changeProperties=function(a){a!==this._properties.symbol&&a!==this._properties.interval&&a!==this._properties.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews(),this.m_model.updateSource(this))};TradingView.Series.prototype._makeNextSymbolId=function(){return"symbol_"+this._nextSymbolId++};TradingView.Series.prototype._makeNextSeriesId=function(){return"s"+this._nextSeriesId++};
TradingView.Series.prototype.onData=function(a){switch(a.method){case "symbol_resolved":if(a.params[0]!==this._symbolId){TradingView.logNormal("command for old symbol. Expected:"+this._symbolId+", actual"+a.params[0]);break}this.updateSymbolInfo(a.params[1]);this.m_model.updateSource(this);this._symbolResolved.fire(this._symbolInfo);this.m_model.realignLineTools();var b=this.symbolInfo().minmov/this.symbolInfo().pricescale,c=this.properties();c.style.value()==TradingView.Series.STYLE_RENKO&&c.renkoStyle.inputs.boxSize.value()<
b?c.renkoStyle.inputs.merge({boxSize:b}):c.style.value()==TradingView.Series.STYLE_PNF&&c.pnfStyle.inputs.boxSize.value()<b?c.pnfStyle.inputs.merge({boxSize:b}):c.style.value()==TradingView.Series.STYLE_KAGI&&c.kagiStyle.inputs.reversalAmount.value()<b&&c.kagiStyle.inputs.merge({reversalAmount:b});break;case "symbol_error":if(a.params[0]!==this._symbolId){TradingView.logNormal("command for old symbol. Expected:"+this._symbolId+", actual"+a.params[0]);break}this._setStatus(TradingView.Series.STATUS_INVALID_SYMBOL);
this._properties.shortName.setValue(this._properties.symbol.value());this.m_model.clearAllStudies();this.updateAllViews();this.m_model.updateSource(this);if(a.params[1]==TradingView.Series.PERMISSION_DENIED)switch(a.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:this._extendedHoursNotPermitted.fire();break;case TradingView.Series.PD_REASON_SYMBOL:this._symbolNotPermitted.fire(a.params[3]);break;default:this._symbolNotPermitted.fire(a.params[2])}else this.m_model.resetTimeScale(),this._symbolError.fire();
this.m_model.realignLineTools();break;case "series_timeframe":if(a.params[1]!==this._turnaround)break;this.m_model.setTimeViewport(a.params[2],a.params[3]+10);break;case "series_error":(b=a.params[2])&&b.startsWith("study_not_auth:")?(b=b.split(":",2)[1].split("@",2)[0],b in{BarSetRenko:!0,BarSetPriceBreak:!0,BarSetKagi:!0,BarSetPnF:!0}?this.chartTypeNotPermitted.fire(b):"BarSetSpread"===b&&this.intradaySpreadNotPermitted.fire()):"resolution_not_entitled"==b?this.intradayExchangeNotPermitted.fire():
"custom_resolution"==b&&this.customIntervalNotPermitted.fire();this._setStatus(TradingView.Series.STATUS_INVALID_SYMBOL);break;case "series_loading":if(a.params[1]!==this._turnaround)break;if(a.params[0]!==this._seriesId){TradingView.logNormal("command for old series. Expected:"+this._seriesId+", actual"+a.params.customId);break}this._setStatus(TradingView.Series.STATUS_LOADING);break;case "series_completed":if(a.params[2]!==this._turnaround)break;if(a.params[0]!==this._seriesId){TradingView.logNormal("command for old series. Expected:"+
this._seriesId+", actual"+a.params.customId);break}b=a.params[1];"pulsed"==b&&(b="delayed");switch(b){case "streaming":this._setStatus(TradingView.Series.STATUS_READY);break;case "endofday":this._setStatus(TradingView.Series.STATUS_EOD);break;case "delayed":this._setStatus(TradingView.Series.STATUS_DELAYED);break;case "pulsed":this._setStatus(TradingView.Series.STATUS_PULSE)}b.match(/delayed_streaming/)&&this._setStatus(TradingView.Series.STATUS_DELAYED_STREAMING);this.requestMoreData();b=this.m_model.paneForSource(this);
b.recalculatePriceScale(this.priceScale());this.m_model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));this.m_data.size()&&this._tickmarksRangeChanged.fire({start:this.data().first().value[TIME_PLOT],end:this.data().last().value[TIME_PLOT]});this.model().recalcVisibleRangeStudy(this.model().dataSources(),!0);!this.isLockScale()||this.model().timeScale().isEmpty()||this._seriesLoaded||(this.model().timeScale()._correctOffset(),this.model().timeScale().correctBarSpacing(),
b=this.model().timeScale().visibleBars(),this.priceScale().setPriceRange(this.priceRange(b.firstBar(),b.lastBar())));this._seriesLoaded=!0;break;case "data_update":if(a.params.customId!==this._seriesId){TradingView.logNormal("command for old series. Expected:"+this._seriesId+", actual"+a.params.customId);break}if(this.status()===TradingView.Series.STATUS_INVALID_SYMBOL)break;0<a.params.plots.length&&(this._endOfData=!1);a.params.plots.length?(b=this.m_data.m_bars.size(),this.m_data.m_bars.merge(a.params.plots),
b!=this.bars().size()&&this._barReceived.fire(this.m_data.m_bars.size()),this.model().recalcVisibleRangeStudy(this.model().dataSources(),!0)):(this.m_data.clear(),this._startLoading.fire());b=this.properties().style.value();!a.params.nonseries||b!==TradingView.Series.STYLE_RENKO&&b!==TradingView.Series.STYLE_KAGI&&b!==TradingView.Series.STYLE_PNF&&b!==TradingView.Series.STYLE_PB?a.params.nonseries||(this.m_data.m_nsBars.clear(),this.m_data.lastProjectionPrice=void 0):(b=this.parseJapProjBars(a.params.nonseries),
this.m_data.m_nsBars=b.nsBars,this.m_data.lastProjectionPrice=b.lastPrice,this.m_data.boxSize=b.boxSize);b=this.m_model.paneForSource(this);this.m_model.updateAllVolumeStudies();this.m_model.recalculatePane(b);this.m_model.updateSource(this);this.m_model.updateLineTools()}this._dataLoaded.fire(a)};TradingView.Series.prototype.fixBoxSize=function(){var a=this.model().timeScale(),b=this.priceScale();b.isEmpty()||a.isEmpty()||(this.m_data.boxSize=Math.abs(b.coordinateToPrice(a.barSpacing())-b.coordinateToPrice(0)))};
TradingView.Series.prototype.parseJapProjBars=function(a){var b=new PlotList(["time","open","high","low","close"]),c=this.model().timeScale(),d=this.properties().style.value();if(a.d&&""!==a.d)for(var e=JSON.parse(a.d).data,f=e.price,g=e.boxSize,e=e.bars,h=0;e&&h<e.length;h++){var k=[],m=a.indexes[e[h].time];k.push(c.points().valueAt(m));k.push(e[h].open);k.push(e[h].high);k.push(e[h].low);k.push(e[h].close);k.push(e[h].volume);d===TradingView.Series.STYLE_KAGI?k.push(e[h].additionalPrice):d===TradingView.Series.STYLE_PNF&&
k.push(e[h].factor);b.add(m,k)}return{nsBars:b,lastPrice:f,boxSize:g}};TradingView.Series.prototype.disconnect=function(){this._seriesId=this._symbolId=null;this._status=TradingView.Series.STATUS_OFFLINE};TradingView.Series.prototype.isStarted=function(){return!!this._symbolId};
TradingView.Series.prototype.restart=function(){this._onRestarted.fire();this._setStatus(TradingView.Series.STATUS_RESOLVING);this.m_data=new TradingView.SeriesData(this,this.model());this._symbolId=this._makeNextSymbolId();this._chartApi.resolveSymbol(this._symbolId,this.getSymbolString(),this._handler);this._seriesId?(this._turnaround="s"+ ++this._turnaroundCounter,this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,this._properties.interval.value(),this._handler)):(this._seriesId=
this._makeNextSeriesId(),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,this._properties.interval.value(),this._prepareChartApiParams(),this._handler));this._properties.showInDataWindow.listeners().subscribe(this.m_model,ChartModel.prototype.fullUpdate);this.m_symbol=this._properties.symbol.value();this.m_interval=this._properties.interval.value();this._seriesLoaded=!1};
TradingView.Series.prototype._generateTimeframe=function(a,b){var c=b.right(1),d=a;"ytd"===b?d+=",YTD":"d"===c?(c=b.left(b.length-1),d+=","+c,TradingView.isRunningChartingLibrary&&(d+="D")):"m"===c?(c=b.left(b.length-1),d+=","+c+"M"):"all"===b&&(d+=",ALL");return d};
TradingView.Series.prototype.setSymbolInterval=function(a,b){var c=b.split(","),d=0,e=b;2==c.length&&(e=c[0],d=c[1]);var c=!this.symbolSameAsCurrent(a),f=this.m_interval!==e;if(c||f)if(this.m_model.realignLineTools(),this.m_symbol=a,this.m_interval=e,this.m_timeframe=d,this._status!==TradingView.Series.STATUS_SNAPSHOT){this._symbolIntervalChanged.fire();this._onRestarted.fire();this._setStatus(TradingView.Series.STATUS_RESOLVING);this._symbolId&&!c||this.updateSymbolInfo(null);if(this._chartApi&&
this._chartApi.connected()){if(!this._symbolId||c)this._symbolId=this._makeNextSymbolId(),d=this.getSymbolString(),this._chartApi.resolveSymbol(this._symbolId,d,this._handler);if(this._seriesId){this._modifyTimer&&clearTimeout(this._modifyTimer);var g=this;g._turnaround="s"+ ++g._turnaroundCounter;this._pendingInterval&&(b=this._generateTimeframe(b,this._pendingInterval),delete this._pendingInterval);this._modifyTimer=setTimeout(function(){g._predictBars=0;g._chartApi.modifySeries(g._seriesId,g._turnaround,
g._symbolId,b,g._handler);g._modifyTimer=null},400)}else this._seriesId=this._makeNextSeriesId(),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,b,this._prepareChartApiParams(),this._handler)}this._seriesLoaded=!1;this._haveToScroll=!0}};TradingView.Series.prototype.symbol=function(){return this.properties().symbol.value()};TradingView.Series.prototype.interval=function(){return this.properties().interval.value()};
TradingView.Series.prototype.isIntradayInterval=function(){return!!/^\d*$/.test(this.interval())&&1440>=this.interval()};TradingView.Series.prototype.bars=function(){return this.m_data.m_bars};TradingView.Series.prototype.nsBars=function(){return this.m_data.m_nsBars};TradingView.Series.prototype.open=function(a){return this.m_data.valueAt(a)[OPEN_PLOT]};TradingView.Series.prototype.high=function(a){return this.m_data.valueAt(a)[HIGH_PLOT]};TradingView.Series.prototype.low=function(a){return this.m_data.valueAt(a)[LOW_PLOT]};
TradingView.Series.prototype.close=function(a){return this.m_data.valueAt(a)[CLOSE_PLOT]};TradingView.Series.prototype.hl2=function(a){return(this.high(a)+this.low(a))/2};TradingView.Series.prototype.hlc3=function(a){return(this.high(a)+this.low(a)+this.close(a))/3};TradingView.Series.prototype.ohlc4=function(a){return(this.open(a)+this.high(a)+this.low(a)+this.close(a))/4};
TradingView.Series.prototype.priceRange=function(a,b){if(!isInteger(a))return TradingView.logDebug("Series.priceRange: incorrect startBar"),null;if(!isInteger(b))return TradingView.logDebug("Series.priceRange: incorrect endBar"),null;if(this.data().isEmpty())return null;if(this.isLockScale()){var c=this.data().boxSize;void 0===c&&this.fixBoxSize();var c=this.priceScale().internalHeight()/(this.model().timeScale().barSpacing()/this.data().boxSize),d=this.data().search(b,SEARCH_NEAREST_LEFT),d=(d.value[HIGH_PLOT]+
d.value[LOW_PLOT])/2,e=new PriceRange(d-0.5*c,d+0.5*c),f=this.data().search(a,SEARCH_NEAREST_RIGHT);return this.priceScale().properties().percentage.value()&&e?e.convertToPercents(f.value[CLOSE_PLOT]):e}this.properties().style.value===TradingView.Series.STYLE_PNF&&(c=this.data().boxSize,e.apply(e.minValue()-0.5*c,e.maxValue()+0.5*c));f=e=null;c=function(a,b){f||(f=b);null===e?e=new PriceRange(b[LOW_PLOT],b[HIGH_PLOT]):e.apply(b[LOW_PLOT],b[HIGH_PLOT])};this.data().bars().range(a,b).each(c);this.data().nsBars().range(a,
b).each(c);e&&e.minValue()===e.maxValue()&&(e=new PriceRange(e.minValue()-0.5,e.maxValue()+0.5));return this.priceScale().properties().percentage.value()&&e?e.convertToPercents(f[CLOSE_PLOT]):this.priceScale().isLog()&&e?new PriceRange(this.priceScale().priceToLogical(e.minValue()),this.priceScale().priceToLogical(e.maxValue())):e};TradingView.Series.prototype.nearestData=function(a,b){if(isInteger(a)){var c=this.data().search(a,b);return c?c:void 0}TradingView.logDebug("Series.nearestData: incorrect logicalPoint")};
TradingView.Series.prototype.nearestIndex=function(a,b){var c=this.nearestData(a,b);return c?c.index:void 0};TradingView.Series.prototype.paneViews=function(a){if(!this.properties().visible.value())return null;a=(new List).append(this._paneView);this._futureBarsPaneView&&a.append(this._futureBarsPaneView);this._projectionBarsPaneView&&a.append(this._projectionBarsPaneView);a.append(this._priceLineView);a.append(this._symbolLabelView);return a};TradingView.Series.prototype.dataWindowView=function(){return this._dataWindowView};
TradingView.Series.prototype.statusView=function(){return this._statusView};TradingView.Series.prototype.priceAxisViews=function(a,b){return this.m_model.paneForSource(this)===a&&b===this.priceScale()&&(this.properties().showLastValue.value()||this.properties().showCountdown.value())?this._priceAxisViews:null};TradingView.Series.prototype.base=function(){return this._base};TradingView.Series.prototype.formatter=function(){return this._formatter};TradingView.Series.prototype.symbolInfo=function(){return this._symbolInfo};
TradingView.Series.prototype._recreateFormatter=function(){if("default"==this.properties().minTick.value())this._formatter=new PriceFormatter(this._symbolInfo?this._symbolInfo.pricescale:100,this._symbolInfo?this._symbolInfo.minmov:1,this._symbolInfo?this._symbolInfo.fractional:!1,this._symbolInfo?this._symbolInfo.minmove2:void 0);else{var a=this.properties().minTick.value().split(","),b=parseInt(a[0]),c=parseInt(a[1]);this._formatter=new PriceFormatter(b,c,"true"===a[2])}this.priceScale()&&this.priceScale().updateFormatter()};
TradingView.Series.prototype.updateSymbolInfo=function(a){var b=this,c=a&&(a.pro_name||a.full_name);if(this._symbolInfo=a)this._properties.shortName.setValue(a.name),c&&this._properties.symbol.value().toUpperCase()!==c.toUpperCase()&&this._properties.symbol.setValue(c);this._base=a?a.pricescale/a.minmov:100;this._recreateFormatter();this._statusView.update();this.priceScale().updateFormatter();"undefined"!==typeof quoteSessionMultiplexerInstance&&(this._quoteSessionClientId||(this._quoteSessionClientId=
"series-"+TradingView.guid()),this._quoteSessionSymbol&&(quoteSessionMultiplexerInstance.simple.unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=void 0),c&&(this._quoteSessionSymbol=c,quoteSessionMultiplexerInstance.simple.subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,function(a,c){b.quoteData=a&&a.values||null;c&&c.values&&c.values.current_session&&b.marketStatus.setValue(c.values.current_session)})));this.checkInterval()};
TradingView.Series.prototype.symbolSameAsCurrent=function(a){if(this.m_symbol===a)return!0;var b=this._symbolInfo;return!b||b.full_name!==a&&b.pro_name!==a?!1:!0};
TradingView.Series.prototype.updateAllViews=function(){this._paneView.update();this._dataWindowView.update();this._statusView.update();this._priceAxisViews.item(0).update();this._priceAxisViews.item(1).update();this._futureBarsPaneView&&this._futureBarsPaneView.update();this._projectionBarsPaneView&&this._projectionBarsPaneView.update();this._priceLineView.update();this._symbolLabelView.update()};
TradingView.Series.prototype.tags=function(){var a=[this._properties.symbol.value(),this._properties.interval.value()+"minutes"];if(this._symbolInfo&&this._symbolInfo.description){var b=this._symbolInfo.description.replace(",","").split(" ");a.push(b)}return a};TradingView.Series.prototype._setStatus=function(a){this._status=a;this._statusView.update();this.m_model.updateSource(this);this._onStatusChanged.fire()};
TradingView.Series.prototype.requestMoreData=function(){if((this._status===TradingView.Series.STATUS_READY||this._status===TradingView.Series.STATUS_PULSE||this._status===TradingView.Series.STATUS_DELAYED||this._status===TradingView.Series.STATUS_DELAYED_STREAMING||this._status===TradingView.Series.STATUS_EOD)&&!this.m_model.timeScale().isEmpty()){var a=this.m_model.timeScale().visibleBars();if(!a.isEmpty()&&0!==this.bars().size()){var b=a.lastBar()-this.data().last();this._predictBars<b&&(this._predictBars=
b,this._chartApi&&this._chartApi.connected()&&this._chartApi.requestMoreTickmarks(this._seriesId,b,this._handler));this._endOfData||(a=this.bars()._indexAt(0)-a.firstBar(),0>=a||(this._endOfData=!0,this._chartApi&&this._chartApi.connected()&&this._chartApi.requestMoreData(this._seriesId,a,this._handler),this._setStatus(TradingView.Series.STATUS_LOADING)))}}};
TradingView.Series.prototype.bindJapChartsInputs=function(){this._properties.style.listeners().subscribe(this,this.onChartStyleChanged);this._properties.renkoStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged);this._properties.renkoStyle.inputs.source.listeners().subscribe(this,this.onInputChanged);this._properties.renkoStyle.inputs.style.listeners().subscribe(this,this.onInputChanged);this._properties.renkoStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged);this._properties.pbStyle.inputs.lb.listeners().subscribe(this,
this.onInputChanged);this._properties.pbStyle.inputs.source.listeners().subscribe(this,this.onInputChanged);this._properties.kagiStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged);this._properties.kagiStyle.inputs.source.listeners().subscribe(this,this.onInputChanged);this._properties.pnfStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged);this._properties.pnfStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged);this._properties.pnfStyle.inputs.sources.listeners().subscribe(this,
this.onInputChanged);this._properties.pnfStyle.inputs.style.listeners().subscribe(this,this.onInputChanged);this._properties.pnfStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged);var a=this;this._properties.lockScale.listeners().subscribe(this,function(b){b.value()&&a.model().timeScale().recalcLockedScale()})};
TradingView.Series.prototype.createExtendedHoursProperty=function(){function a(){var a=b._properties.extendedHours.value();a&&(1440>=+b._properties.interval.value()||(a=!1));b.extendedHours.setValue(a)}var b=this;b.extendedHours=new Property;b._properties.extendedHours.listeners().subscribe(null,a);b._properties.interval.listeners().subscribe(null,a);b.chartWidgetInitialized.subscribe(null,a);a()};
TradingView.Series.prototype.isNeedRestart=function(a){void 0===a&&(a=this.properties().style.value());if(this._prevChartStyle!=a){var b=[TradingView.Series.STYLE_BARS,TradingView.Series.STYLE_CANDLES,TradingView.Series.STYLE_HOLLOW_CANDLES,TradingView.Series.STYLE_LINE,TradingView.Series.STYLE_AREA];if(!(-1<b.indexOf(this._prevChartStyle)&&-1<b.indexOf(a)))return!0}return!1};
TradingView.Series.prototype.onChartStyleChanged=function(){this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.restart());this._prevChartStyle=this.properties().style.value();this._onChangedStyle.fire(this.properties().style.value())};TradingView.Series.prototype.onInputChanged=function(){this.restart()};TradingView.Series.prototype.onExtendedHoursChanged=function(){return this._extendedHoursChanged};
TradingView.Series.prototype.getSymbolString=function(){var a;a=TradingView.isRunningChartingLibrary?this._symbolInfo?this._symbolInfo.ticker:this._properties.symbol.value():this._properties.symbol.value();this.extendedHours.value()&&(a={symbol:a,session:"extended"});switch(this._properties.style.value()){case TradingView.Series.STYLE_RENKO:var b=this._properties.renkoStyle.inputs;a={symbol:a,type:"BarSetRenko@tv-prostudies-1!",inputs:[b.source.value(),b.style.value(),b.boxSize.value(),b.atrLength.value()]};
break;case TradingView.Series.STYLE_PB:b=this._properties.pbStyle.inputs;a={symbol:a,type:"BarSetPriceBreak@tv-prostudies-1!",inputs:[b.source.value(),b.lb.value()]};break;case TradingView.Series.STYLE_KAGI:b=this._properties.kagiStyle.inputs;a={symbol:a,type:"BarSetKagi@tv-prostudies-1!",inputs:[b.source.value(),b.reversalAmount.value()]};break;case TradingView.Series.STYLE_PNF:b=this._properties.pnfStyle.inputs;a={symbol:a,type:"BarSetPnF@tv-prostudies-1!",inputs:[b.sources.value(),b.style.value(),
b.boxSize.value(),b.atrLength.value(),b.reversalAmount.value()]};break;case TradingView.Series.STYLE_HEIKEN_ASHI:a={symbol:a,type:"BarSetHeikenAshi@tv-basicstudies-1!",inputs:[]}}"string"!==typeof a&&(a="="+JSON.stringify(a));return a};
TradingView.Series.prototype.getStyleShortName=function(){switch(this._properties.style.value()){case TradingView.Series.STYLE_BARS:return"bar";case TradingView.Series.STYLE_CANDLES:return"candle";case TradingView.Series.STYLE_HOLLOW_CANDLES:return"hollowCandle";case TradingView.Series.STYLE_LINE:return"line";case TradingView.Series.STYLE_AREA:return"area";case TradingView.Series.STYLE_RENKO:return"renko";case TradingView.Series.STYLE_PB:return"pb";case TradingView.Series.STYLE_KAGI:return"kagi";
case TradingView.Series.STYLE_PNF:return"pnf";case TradingView.Series.STYLE_HEIKEN_ASHI:return"ha";default:throw Error("Missed short name for style "+this._properties.style.value());}};TradingView.Series.prototype.getInputsProperties=function(){var a=this._properties[this.getStyleShortName()+"Style"];a.inputs||a.addProperty("inputs");return a.inputs};
TradingView.Series.prototype.getRealVisibleRange=function(){var a=this.model().timeScale().visibleBars(),b;b=this.data().search(a.m_firstBar,SEARCH_NEAREST_RIGHT);a=this.data().search(a.m_lastBar,SEARCH_NEAREST_LEFT);return void 0===b||void 0===a?null:new BarsRange(b.index,a.index)};TradingView.Series.prototype.isLockScale=function(){return this.properties().lockScale.value()};TradingView.Series.prototype.firstValue=function(){return this.data().firstValue()};
TradingView.Series.prototype.firstBar=function(){return this.data().firstBar()};TradingView.Series.prototype.sessionsStudy=function(){if(this._sessionsStudy)return this._sessionsStudy;var a=this.model().paneForSource(this).dataSources();for(i=0;i<a.size();i++){var b=a.item(i);if(b instanceof TradingView.Study&&"Sessions"==b.metaInfo().shortId)return this._sessionsStudy=b}return!1};
TradingView.Series.prototype.createSessStudy=function(){if(!TradingView.isRunningChartingLibrary&&!this.sessionsStudy()){var a=StudyMetaInfo.findStudyMetaInfo(this.model().studiesMetaData(),"Sessions@tv-basicstudies");this.model().insertStudy(a,!1,!0);this.extendedHours.value()||this.disableSessionBackground();this._onSessionsStudyCreated.fire()}};TradingView.Series.prototype.checkSessStudy=function(){TradingView.isRunningChartingLibrary||(this.sessionsStudy()||this.createSessStudy(),this.sessionsStudy().start())};
TradingView.Series.prototype.disableSessionBackground=function(){this.sessionsStudy()&&(this.sessionsStudy().properties().graphics.backgrounds.inSession.visible.setValue(!1),this.sessionsStudy().properties().graphics.backgrounds.outOfSession.visible.setValue(!1))};TradingView.Series.prototype.isSpread=function(){return 1<this._symbolInfo.legs.length};TradingView.Series.prototype.firstSymbol=function(){return this._symbolInfo.legs[0]};TradingView.Series.prototype.firstShortName=function(){return TradingView.SymbolParser.ticker(this.firstSymbol())};
TradingView.Series.prototype.onSessionsStudyCreated=function(){return this._onSessionsStudyCreated};TradingView.Series.prototype.loadDataTo=function(a){a.right(1);this._turnaround="s"+ ++this._turnaroundCounter;var b=this._properties.interval.value(),b=this._generateTimeframe(b,a);this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,b,this._handler)};
TradingView.Series.prototype.checkInterval=function(){if(this._symbolInfo&&(this.isDWM()||this._symbolInfo.has_intraday||this.requestingIntradayWhenNotSupported.fire(),this._symbolInfo.hasOwnProperty("supported_resolutions"))){var a=this._properties.interval.value();-1==this._symbolInfo.supported_resolutions.indexOf(a)&&this.requestingResolutionWhenNotSupported.fire(this._symbolInfo.supported_resolutions[0])}};
TradingView.Series.prototype.setPriceScale=function(a){this.m_priceScale!=a&&(this.m_priceScale=a,this.priceScaleChanged.fire(a))};TradingView.Series.prototype.checkQuandlSymbol=function(a){a.exchange&&"QUANDL"===a.exchange.toUpperCase()&&(a=this._properties.style,a.value()!==TradingView.Series.STYLE_AREA&&this.m_model._undoModel.setChartStyleProperty(a,TradingView.Series.STYLE_AREA,"Change Chart Style to Area"))};function SeriesDataWindowView(a,b){DataWindowView.call(this);this._series=a;this._model=b;this._items.append(new DataWindowItem($.t("Open",{context:"in_legend"}),""));this._items.append(new DataWindowItem($.t("High",{context:"in_legend"}),""));this._items.append(new DataWindowItem($.t("Low",{context:"in_legend"}),""));this._items.append(new DataWindowItem($.t("Close",{context:"in_legend"}),""));this._invalidated=!0;this.update()}inherit(SeriesDataWindowView,DataWindowView);
SeriesDataWindowView.prototype.update=function(){this._invalidated=!0};
SeriesDataWindowView.prototype._updateImpl=function(){this._series.symbolInfo()?(this._header=[this._series.symbolInfo().name,translatedIntervalString(this._series.interval()),this._series.symbolInfo().exchange].join(", "),this._title=this._series.symbolInfo().description):this._header=this._series.symbol();this._items.item(0).setValue($.t("n/a"));this._items.item(1).setValue($.t("n/a"));this._items.item(2).setValue($.t("n/a"));this._items.item(3).setValue($.t("n/a"));if(!this._model.timeScale().isEmpty()&&
0!==this._series.bars().size()){var a=this._series.barColorer(),b=this._model.crossHairSource().index,b=this._series.nearestIndex(b,SEARCH_NEAREST_LEFT);if(void 0!==b){var c=this._series.data().valueAt(b),d=this._series.formatter();this._items.item(0).setValue(d.format(c[OPEN_PLOT]));this._items.item(1).setValue(d.format(c[HIGH_PLOT]));this._items.item(2).setValue(d.format(c[LOW_PLOT]));this._items.item(3).setValue(d.format(c[CLOSE_PLOT]));a=a.barStyle(b,!1);for(b=0;4>b;b++)this._items.item(b).setColor(a.barColor)}}};
SeriesDataWindowView.prototype.items=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return this._items};SeriesDataWindowView.prototype.dump=function(){return{header:this._header,items:this._items}};function SeriesBarCandlesPaneView(a,b){this.m_series=a;this.m_model=b;this.m_bars=new List;this._invalidated=!0}SeriesBarCandlesPaneView.prototype.update=function(){this._invalidated=!0};
SeriesBarCandlesPaneView.prototype._updateImpl=function(){var a=this;this.m_bars.clear();if(!this.m_model.timeScale().isEmpty()&&!this.m_series.priceScale().isEmpty()){var b=this.m_model.timeScale().visibleBars();if(!b.isEmpty()&&0!==this.m_series.bars().size()){for(var c=this.m_series.nearestIndex(b.firstBar(),SEARCH_NEAREST_RIGHT),d=this.m_series.nearestIndex(b.lastBar(),SEARCH_NEAREST_LEFT);c<=d&&void 0===this.m_series.bars().valueAt(c);c++);if(!(c>d)){var b=this.m_series.bars().range(c,d),e=void 0;
this.m_series.bars().first();var f=this.m_series.priceScale(),g=f.properties().percentage.value(),h=this.m_series.barColorer(),k={};b.each(function(b,c){if(void 0!=c[OPEN_PLOT]&&void 0!=c[HIGH_PLOT]&&void 0!=c[LOW_PLOT]&&void 0!=c[CLOSE_PLOT]){void 0===e&&(e=c[CLOSE_PLOT]);var d=new BarItem;d.setTime(Math.round(b));g?(d.setOpen(100*(c[OPEN_PLOT]-e)/e),d.setHigh(100*(c[HIGH_PLOT]-e)/e),d.setLow(100*(c[LOW_PLOT]-e)/e),d.setClose(100*(c[CLOSE_PLOT]-e)/e)):(d.setOpen(c[OPEN_PLOT]),d.setHigh(c[HIGH_PLOT]),
d.setLow(c[LOW_PLOT]),d.setClose(c[CLOSE_PLOT]));k.value=c;var f=h.barStyle(b,!1,k);k.previousValue=c;d.color=f.barColor;d.borderColor=f.barBorderColor;d.hollow=f.isBarHollow;a.m_bars.append(d)}},this);f.barPricesToCoordinates(this.m_bars);this.m_model.timeScale().barIndexesToCoordinates(this.m_bars);if(this.m_series===this.m_model.selectedSource())for(b=(new SelectionIndexes).calc(c,d),this._selectionData={points:new List},this._selectionData.hittestResult=HitTestResult.REGULAR,c=0;c<b.size();c++){var d=
b.item(c),m=this.m_series.bars().valueAt(d);m&&(m=0.5*(m[OPEN_PLOT]+m[CLOSE_PLOT]),f.properties().percentage.value()&&(m=100*(m-e)/e),d=this.m_model.timeScale().indexToCoordinate(d),m=this.m_series.priceScale().priceToCoordinate(m),this._selectionData.points.append(new MathEx.Point(d,m)))}}}}};SeriesBarCandlesPaneView.prototype.items=function(){return this.m_bars};SeriesBarCandlesPaneView.prototype.dump=function(){var a={};a.bars=this.m_bars;return a};
function SeriesBarsPaneView(a,b){SeriesBarCandlesPaneView.call(this,a,b)}inherit(SeriesBarsPaneView,SeriesBarCandlesPaneView);
SeriesBarsPaneView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={};a.bars=this.m_bars;a.barSpacing=this.m_model.timeScale().barSpacing();a.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value();var b=new CompositeRenderer;b.append(new PaneRendererBars(a));this.m_series===this.m_model.selectedSource()&&b.append(new SelectionRenderer(this._selectionData));return b};
function SeriesCandlesPaneView(a,b){SeriesBarCandlesPaneView.call(this,a,b)}inherit(SeriesCandlesPaneView,SeriesBarCandlesPaneView);
SeriesCandlesPaneView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={};a.bars=this.m_bars;a.barSpacing=this.m_model.timeScale().barSpacing();a.drawWick=this.m_series.properties().candleStyle.drawWick.value();a.drawBorder=this.m_series.properties().candleStyle.drawBorder.value();a.borderColor=this.m_series.properties().candleStyle.borderColor.value();a.wickColor=this.m_series.properties().candleStyle.wickColor.value();var b=new CompositeRenderer;b.append(new PaneRendererCandles(a));
this.m_series===this.m_model.selectedSource()&&b.append(new SelectionRenderer(this._selectionData));return b};function SeriesHeikenAshiPaneView(a,b){SeriesBarCandlesPaneView.call(this,a,b)}inherit(SeriesHeikenAshiPaneView,SeriesBarCandlesPaneView);
SeriesHeikenAshiPaneView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={};a.bars=this.m_bars;a.barSpacing=this.m_model.timeScale().barSpacing();a.drawWick=this.m_series.properties().haStyle.drawWick.value();a.drawBorder=this.m_series.properties().haStyle.drawBorder.value();a.borderColor=this.m_series.properties().haStyle.borderColor.value();a.wickColor=this.m_series.properties().haStyle.wickColor.value();var b=new CompositeRenderer;b.append(new PaneRendererCandles(a));
this.m_series===this.m_model.selectedSource()&&b.append(new SelectionRenderer(this._selectionData));return b};function SeriesHollowCandlesPaneView(a,b){SeriesBarCandlesPaneView.call(this,a,b)}inherit(SeriesHollowCandlesPaneView,SeriesBarCandlesPaneView);
SeriesHollowCandlesPaneView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={};a.bars=this.m_bars;a.barSpacing=this.m_model.timeScale().barSpacing();a.drawWick=this.m_series.properties().hollowCandleStyle.drawWick.value();a.drawBorder=this.m_series.properties().hollowCandleStyle.drawBorder.value();a.borderColor=this.m_series.properties().hollowCandleStyle.borderColor.value();a.wickColor=this.m_series.properties().hollowCandleStyle.wickColor.value();
var b=new CompositeRenderer;b.append(new PaneRendererCandles(a));this.m_series===this.m_model.selectedSource()&&b.append(new SelectionRenderer(this._selectionData));return b};function SeriesSingleLinePaneView(a,b,c){this.m_series=a;this.m_priceSource=b;this.m_model=c;this.m_items=new List}
SeriesSingleLinePaneView.prototype.update=function(){this.m_items.clear();if(!this.m_model.timeScale().isEmpty()&&this.m_series.priceScale()&&!this.m_series.priceScale().isEmpty()){var a=this.m_model.timeScale().visibleBars();if(!a.isEmpty()&&0!==this.m_series.bars().size()){var b=this.m_series.nearestIndex(a.firstBar(),SEARCH_NEAREST_RIGHT),a=this.m_series.nearestIndex(a.lastBar(),SEARCH_NEAREST_LEFT),c=this.m_series[this.m_priceSource],d=this.m_series.bars(),e=this,f,g=e.m_series.priceScale();this.m_series.barColorer();
var h={color:this.m_series.properties().lineStyle.color.value()};d.range(b,a).each(function(a){var b=c.call(e.m_series,a);null!==b&&void 0!==b&&(f||(f=b),g.properties().percentage.value()&&(b=100*(b-f)/f),b=g.priceToCoordinate(b),a=e.m_model.timeScale().indexToCoordinate(a),a=new MathEx.Point(a,b),a.style=h,e.m_items.append(a))});if(this.m_series===this.m_model.selectedSource())for(b=(new SelectionIndexes).calc(b,a),this._selectionData={points:new List},this._selectionData.hittestResult=HitTestResult.REGULAR,
a=0;a<b.size();a++){var k=b.item(a),d=c.call(this.m_series,k);g.properties().percentage.value()&&(d=100*(d-f)/f);k=this.m_model.timeScale().indexToCoordinate(k);d=this.m_series.priceScale().priceToCoordinate(d);this._selectionData.points.append(new MathEx.Point(k,d))}}}};function SeriesLinePaneView(a,b,c){SeriesSingleLinePaneView.call(this,a,b,c)}inherit(SeriesLinePaneView,SeriesSingleLinePaneView);
SeriesLinePaneView.prototype.renderer=function(){var a=this.m_series.properties().lineStyle,a={barSpacing:this.m_model.timeScale().barSpacing(),items:this.m_items,lineColor:a.color.value(),lineStyle:a.linestyle.value(),withMarkers:a.styleType.value()===TradingView.Series.STYLE_LINE_TYPE_MARKERS,withSteps:a.styleType.value()===TradingView.Series.STYLE_LINE_TYPE_STEP,lineWidth:a.linewidth.value(),simpleMode:!0},a=new PaneRendererLine(a),b;this.m_series===this.m_model.selectedSource()?(b=new CompositeRenderer,
b.append(a),b.append(new SelectionRenderer(this._selectionData))):b=a;return b};function SeriesAreaPaneView(a,b,c){SeriesSingleLinePaneView.call(this,a,b,c)}inherit(SeriesAreaPaneView,SeriesSingleLinePaneView);
SeriesAreaPaneView.prototype.renderer=function(){var a={simpleMode:!1};a.barSpacing=this.m_model.timeScale().barSpacing();a.items=this.m_items;a.lineColor=this.m_series.properties().areaStyle.linecolor.value();a.lineStyle=this.m_series.properties().areaStyle.linestyle.value();a.lineWidth=this.m_series.properties().areaStyle.linewidth.value();var b=this.m_series.properties().areaStyle.transparency.value();a.color1=generateColor(this.m_series.properties().areaStyle.color1.value(),b);a.color2=generateColor(this.m_series.properties().areaStyle.color2.value(),
b);a.bottom=this.m_series.priceScale().height();b=new CompositeRenderer;b.append(new PaneRendererArea(a));this.m_series===this.m_model.selectedSource()&&b.append(new SelectionRenderer(this._selectionData));return b};function SeriesStatusView(a,b){StatusView.call(this,b);this._series=a}inherit(SeriesStatusView,StatusView);SeriesStatusView.prototype.round=function(a,b){var c=Math.round(a*Math.pow(10,b))/Math.pow(10,b);return c?c:""};
SeriesStatusView.prototype.update=function(){this._series.symbolInfo()?this._text=this._series.symbolInfo().description:this._text=this._series.symbol();this._text+=", "+translatedIntervalString(this._series.interval());if(this._series.symbolInfo()&&this._series.symbolInfo().exchange){var a=this._series.symbolInfo().exchange;"forex"==this._series.symbolInfo().type&&(a="FX");this._text+=", "+a}a=this._series._properties;switch(a.style.value()){case TradingView.Series.STYLE_RENKO:var b=a.renkoStyle.inputs.style.value()+
("ATR"===a.renkoStyle.inputs.style.value()?"("+a.renkoStyle.inputs.atrLength.value()+")":"");this._text+=", Renko ["+a.renkoStyle.inputs.source.value()+", "+b+", "+this.round(this._series.data().boxSize,4)+"]";break;case TradingView.Series.STYLE_PB:this._text+=", Line Break ["+a.pbStyle.inputs.source.value()+", "+a.pbStyle.inputs.lb.value()+"]";break;case TradingView.Series.STYLE_KAGI:this._text+=", Kagi ["+a.kagiStyle.inputs.source.value()+", "+a.kagiStyle.inputs.reversalAmount.value()+"]";break;
case TradingView.Series.STYLE_PNF:b=a.pnfStyle.inputs.style.value()+("ATR"===a.pnfStyle.inputs.style.value()?"("+a.pnfStyle.inputs.atrLength.value()+")":"");this._text+=", PnF ["+a.pnfStyle.inputs.sources.value()+", "+b+", "+this.round(this._series.data().boxSize,4)+", "+a.pnfStyle.inputs.reversalAmount.value()+"]";break;case TradingView.Series.STYLE_HEIKEN_ASHI:this._text+=", "+$.t("Heiken Ashi")}this._bold=!1;this._size="17px"};function SeriesPriceAxisView(a,b){this._series=a;this._model=b;this._text="";this._coordinate=0;this._background="black";this._textHeight=14;this._invalidated=!0}inherit(SeriesPriceAxisView,PriceAxisView);SeriesPriceAxisView.prototype.update=function(){this._invalidated=!0};
SeriesPriceAxisView.prototype._updateImpl=function(a){this._text="";this._visible=!1;if(a=this._series.lastValueData())if(this._visible=!0,this._text=this._series.properties().showLastValue.value()?a.text:"",this._background=a.color,this._coordinate=a.coordinate,this._textHeight=this._series.priceScale().m_markBuilder.fontHeight(),this._countdown=null,!TradingView.isRunningChartingLibrary&&this._series.properties().showCountdown.value()&&(a=[TradingView.Series.STYLE_BARS,TradingView.Series.STYLE_CANDLES,
TradingView.Series.STYLE_LINE,TradingView.Series.STYLE_AREA,TradingView.Series.STYLE_HOLLOW_CANDLES,TradingView.Series.STYLE_HEIKEN_ASHI],!this._series.isDWM()&&-1!=a.indexOf(this._series.properties().style.value()))){a=1E3*this._series.data().bars().last().value[0];(new Date).getTimezoneOffset();var b=this._series.interval();a=Math.round((a.valueOf()+6E4*b-(new Date).valueOf())/1E3);if(0<a){a=Math.min(a,60*b);b="";3600<=a&&(b=""+Math.floor(a/3600)+":");a%=3600;var c=("0"+Math.floor(a/60)).right(2);
a=("0"+Math.floor(a%60)).right(2);this._countdown=b+c+":"+a}}};SeriesPriceAxisView.prototype.font=function(){return"11px Arial"};SeriesPriceAxisView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:this._visible,font:this.font(),secondLine:this._countdown};return new PriceAxisViewRenderer(a)};
SeriesPriceAxisView.prototype.dump=function(){return{text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:this._visible}};SeriesPriceAxisView.prototype.text=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return PriceAxisView.prototype.text.call(this)};function ProjectionSeriesPriceAxisView(a,b){SeriesPriceAxisView.call(this,a,b)}inherit(ProjectionSeriesPriceAxisView,SeriesPriceAxisView);ProjectionSeriesPriceAxisView.prototype.lastPrice=function(){return this._series.data().lastProjectionPrice};
ProjectionSeriesPriceAxisView.prototype._updateImpl=function(a){this._text="";this._visible=!1;if(!this._model.timeScale().isEmpty()&&!this._series.priceScale().isEmpty()&&this.lastPrice()&&(a=this._model.timeScale().visibleBars(),!a.isEmpty())){var b=this._series.data().search(a.lastBar(),SEARCH_NEAREST_LEFT);if(void 0!==b){a=this._series.nearestIndex(a.firstBar(),SEARCH_NEAREST_RIGHT);a=this._series.data().valueAt(a)[CLOSE_PLOT];this._visible=!0;this._series.data().last();var c=this.lastPrice();
this._series.priceScale().properties().percentage.value()&&(c=100*(c-a)/a);this._text=this._series.priceScale().formatter().format(c);this._background=this._series.barColorer().barStyle(b.index,!0).barColor;this._coordinate=this._series.priceScale().priceToCoordinate(c);this._textHeight=this._series.priceScale().m_markBuilder.fontHeight()}}};function StudyTrackPricePaneView(a,b,c,d){this._study=a;this.m_series=b;this.m_model=c;this._plotName=d;this._visible=!1;this._points=(new List).append(new MathEx.Point(0,0))}StudyTrackPricePaneView.prototype.update=function(){this._visible=!1;var a=this._study.lastValueData(this._plotName,!0);a&&(this._visible=!0,this._points=(new List).append(new MathEx.Point(0,a.coordinate)),this._color=a.color)};
StudyTrackPricePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._color;a.linewidth=this._study.properties().styles[this._plotName].linewidth.value();a.linestyle=CanvasEx.LINESTYLE_DOTTED;a.hitTestResult=HitTestResult.REGULAR;a.visible=this._visible;return new HorzLineRenderer(a)};
function defaultPlotOptions(){return{visible:!0,color:"#0496FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,plottype:TradingView.Study.PLOT_LINE,histogramBase:0,transparency:50,trackPrice:!1,joinPoints:!1}}TradingView.createStudy=function(a,b,c,d){var e="study_"+(d.classId||d.shortId);return TradingView[e]?new TradingView[e](a,b,c,d):new TradingView.Study(a,b,c,d)};TradingView.prepareStudyProperties=function(a,b,c,d){return TradingView.prepareStudyPropertiesWithRoot(a,b,c,d,"study_"+a.id)};
TradingView.prepareStudyPropertiesWithRoot=function(a,b,c,d,e){b=TradingView.prepareStudyPropsState(a,b,c,d);e=new DefaultProperty(e,b,!0);e.addExclusion("visible");e.addExclusion("precision");e.addExclusion("minTick");for(b=0;b<a.inputs.length;++b)c=a.inputs[b],c.isHidden&&(e.addExclusion("inputs."+b.toString()),e.addExclusion("inputs."+c.id));return e};
TradingView.prepareStudyPropertiesForLoadChart=function(a,b,c,d){return TradingView.prepareStudyPropertiesForLoadChartWithRoot(a,b,c,d,"study_"+a.id)};
TradingView.prepareStudyPropertiesForLoadChartWithRoot=function(a,b,c,d,e){b=TradingView.prepareStudyPropsStateForLoadChart(a,b,c,d);e=new DefaultProperty(e,b,!0);e.addExclusion("visible");e.addExclusion("precision");e.addExclusion("minTick");for(b=0;b<a.inputs.length;++b)c=a.inputs[b],c.isHidden&&(e.addExclusion("inputs."+b.toString()),e.addExclusion("inputs."+c.id));return e};
TradingView.prepareStudyPropsState=function(a,b,c,d){if(1>StudyMetaInfo.versionOf(a))throw Error("This function cannot work with metainfo of the old format version. Required format version >= 1");var e=TradingView.clone(defaults("study"));TradingView.preparePlotStyles(e,a);var f=TradingView.clone(defaults("study_"+a.id,d));a.isTVScript&&a.TVScriptSourceCode!==f.TVScriptSourceCode&&(f=TradingView.clone(factoryDefaults("study_"+a.id,d)));TradingView.merge(e,f);b&&(assert(!(b instanceof Property),"propsState should not be an instance of Property"),
TradingView.merge(e,b));b=TradingView.convertMetainfoInputsArrayToObject(a);d={};TradingView.StudyVersioning.mergeInputs(d,b.defaults.inputs);TradingView.StudyVersioning.mergeInputs(d,e.inputs);TradingView.StudyVersioning.mergeInputsArrPart(d,b.inputs);e.inputs=d;delete b.inputs;delete b.defaults.inputs;d={};TradingView.merge(d,b.defaults);TradingView.merge(d,factoryDefaults("study_"+b.id));TradingView.merge(d,e);TradingView.merge(d,b);delete d.defaults;e=d;a=TradingView.calcDefaultColorsOffset(c,
a);TradingView.merge(e,TradingView.shiftDefaultColors(e,a));return e};
TradingView.prepareStudyPropsStateForLoadChart=function(a,b,c,d){var e=StudyMetaInfo.versionOf(a);a.version&&b.version&&a.version!==b.version&&"undefined"!==typeof console&&console.warn("Serialized metaInfo version "+a.version+" is not equal to the saved state version "+b.version);var f=TradingView.clone(defaults("study"));if(0==e){TradingView.merge(f,TradingView.clone(a));var g=TradingView.convertMetainfoInputsArrayToObject(a);TradingView.merge(f.inputs,g.inputs)}else 1<=e&&TradingView.merge(f,TradingView.clone(a.defaults));
TradingView.merge(f,factoryDefaults("study_"+a.id));TradingView.preparePlotStyles(f,a);TradingView.merge(f,b);1<=e&&(TradingView.merge(f,TradingView.clone(a)),delete f.defaults);f=d.updateStudyState(f,a);(b=d.updateMetaInfo(a))&&1<=StudyMetaInfo.versionOf(b)&&(b=TradingView.convertMetainfoInputsArrayToObject(b),d={},TradingView.StudyVersioning.mergeInputs(d,b.defaults.inputs),TradingView.StudyVersioning.mergeInputs(d,f.inputs),TradingView.StudyVersioning.mergeInputsArrPart(d,b.inputs),f.inputs=d,
delete b.inputs,delete b.defaults.inputs,d={},TradingView.merge(d,b.defaults),TradingView.merge(d,factoryDefaults("study_"+b.id)),TradingView.merge(d,f),TradingView.merge(d,b),delete d.defaults,f=d);a=TradingView.calcDefaultColorsOffset(c,a);TradingView.merge(f,TradingView.shiftDefaultColors(f,a));return f};
TradingView.preparePlotStyles=function(a,b){if(b.plots)for(var c=0;c<b.plots.length;c++){var d=b.plots[c].id,e=b.plots[c].type;if(e!==TradingView.Study.PLOT_TYPE_COLORER){var f=defaultPlotOptions();f.plottype=e;f.title=d;a.styles&&d in a.styles&&TradingView.merge(f,a.styles[d]);a.styles[d]=f}}};
TradingView.convertMetainfoInputsArrayToObject=function(a){var b=TradingView.clone(a);b.inputs={};if(a.inputs)for(var c=0;c<a.inputs.length;c++)b.inputs[a.inputs[c].id]=a.inputs[c].defval,b.inputs[c]=a.inputs[c];return b};TradingView.calcDefaultColorsOffset=function(a,b){var c=0;if(a)for(var d=0;d<a.dataSources().size();d++){var e=a.dataSources().item(d);e.metaInfo&&e.metaInfo()&&e.metaInfo().id==b.id&&c++}return c};
TradingView.shiftDefaultColors=function(a,b){if(!b)return a;for(var c in a.styles)if(color=a.styles[c].color)a.styles[c].color=TradingView.shiftColor(color,b);return a};TradingView.shiftColor=function(a,b){a=new RGBColor(a);var c=TradingView.rgbToHsl(a.r,a.g,a.b),d=c[0]+0.05*b;c[0]=d-Math.floor(d);c=TradingView.hslToRgb(c[0],c[1],c[2]);a.r=c[0];a.g=c[1];a.b=c[2];return a.toHex()};
TradingView.Study=function(a,b,c,d){this._resolvedSymbols={};this._priceAxisViewsBase=new List;this._paneViews=new List;this._hlinesPriceAsisViews=new List;this._horizlinesPriceAsisViews=new List;PriceDataSource.call(this);this.m_data=new PlotList;this._graphics=new TradingView.StudyGraphics(d);this._plotOffsets={};this._plotOffsetsMetaInfoOverride={};this._model=a;this._chartApi=a._chartApi;this._series=c;this._metaInfo=d;this._properties=b;this._properties.listeners().subscribe(this,TradingView.Study.prototype.changeStyles);
void 0!=this._properties.inputs&&this._properties.inputs.listeners().subscribe(this,TradingView.Study.prototype.inputsChanged);this._turnaroundCounter=1;this._turnaround="st"+this._turnaroundCounter;this._status="";this._plotFields=[];if(b=this.metaInfo().plots)for(c=0,d=b.length;c<d;c++)this._plotFields.push(b[c].id);this.clearData();this._studyModified=!1;this._tagsChanged=new Delegate;this.createViews();var e=this;this._handler=function(a){e.onData(a)};this._createFormatter();e=this;this._properties.precision.listeners().subscribe(null,
function(){e._createFormatter()});this._properties.precision.listeners().subscribe(null,function(){e._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))});this._properties.showInDataWindow.listeners().subscribe(a,ChartModel.prototype.fullUpdate)};inherit(TradingView.Study,PriceDataSource);TradingView.Study.PLOT_TYPE_LINE="line";TradingView.Study.PLOT_TYPE_COLORER="colorer";TradingView.Study.PLOT_TYPE_BAR_COLORER="bar_colorer";
TradingView.Study.PLOT_TYPE_BG_COLORER="bg_colorer";TradingView.Study.PLOT_TYPE_SHAPES="shapes";TradingView.Study.PLOT_TYPE_CHARS="chars";TradingView.Study.PLOT_TYPE_ARROWS="arrows";TradingView.Study.PLOT_TYPE_DATAOFFSET="dataoffset";TradingView.Study.PLOT_LINE=0;TradingView.Study.PLOT_HISTOGRAM=1;TradingView.Study.PLOT_CROSS=3;TradingView.Study.PLOT_AREA=4;TradingView.Study.PLOT_COLUMNS=5;TradingView.Study.PLOT_CIRCLES=6;TradingView.Study.PLOT_LINE_WITH_BREAKS=7;
TradingView.Study.PLOT_AREA_WITH_BREAKS=8;TradingView.Study.PlotShapes={};TradingView.Study.registerPlotShape=function(a,b,c,d){if(a in TradingView.Study.PlotShapes)throw Error("Plot shape "+a+" already registered!");TradingView.Study.PlotShapes[a]={id:a,pineName:b,guiName:c,paneRendererClass:d}};TradingView.Study.SHAPE_CROSS="shape_cross";TradingView.Study.SHAPE_XCROSS="shape_xcross";TradingView.Study.SHAPE_CIRCLE="shape_circle";TradingView.Study.SHAPE_TRIANGLE_UP="shape_triangle_up";
TradingView.Study.SHAPE_TRIANGLE_DOWN="shape_triangle_down";TradingView.Study.SHAPE_FLAG="shape_flag";TradingView.Study.registerPlotShape(TradingView.Study.SHAPE_CROSS,"shape.cross","Cross","PaneRendererCrossShape");TradingView.Study.registerPlotShape(TradingView.Study.SHAPE_XCROSS,"shape.xcross","X Cross","PaneRendererXCross");TradingView.Study.registerPlotShape(TradingView.Study.SHAPE_CIRCLE,"shape.circle","Circle","PaneRendererCircleShape");
TradingView.Study.registerPlotShape(TradingView.Study.SHAPE_TRIANGLE_UP,"shape.triangleup","Triangle Up","PaneRendererTriangleApexUp");TradingView.Study.registerPlotShape(TradingView.Study.SHAPE_TRIANGLE_DOWN,"shape.triangledown","Triangle Down","PaneRendererTriangleApexDown");TradingView.Study.registerPlotShape(TradingView.Study.SHAPE_FLAG,"shape.flag","Flag","PaneRendererFlagShape");TradingView.Study.SCALE_RIGHT=0;TradingView.Study.SCALE_LEFT=1;TradingView.Study.SCALE_NONE=2;
TradingView.Study.prototype.lastValueData=function(a,b){var c={};if(this._model.timeScale().isEmpty()||null==this.priceScale()||this.priceScale().isEmpty()||this.data().isEmpty())return null;var d=this._model.timeScale().visibleBars();if(d.isEmpty())return null;var e;for(e=0;e<this.metaInfo().plots.length&&this.metaInfo().plots[e].id!==a;e++);if(!this.properties().visible.value()||!this.properties().styles[a].visible.value())return null;var f=this.offset(a),d=this.nearestIndex(d.lastBar()-f,SEARCH_NEAREST_LEFT);
if(void 0===d)return null;this.data();d=b?this.data().last().value:this.data().valueAt(d);if(!d||!isNumber(d[e+1]))return null;for(var g=this.metaInfo().plots,f=null,h=0;h<g.length;h++)this.isSelfColorerPlot(h)&&g[h].target===a&&(f=h,this.metaInfo(),paletterProps=this.properties().palettes[g[h].palette]);e=d[e+1];if(this.priceScale().properties().percentage.value()){g=this.firstValue(!0);if(!g)return null;e=this.priceScale().priceRange().convertToPercent(e,g)}c.text=this.priceScale().formatter().format(e);
g=this.properties().styles[a].color.value();f&&d.length>f+1?(f=d[f+1],c.color=void 0!=f?paletterProps.colors[f].color.value():g):c.color=g;c.coordinate=this.priceScale().priceToCoordinate(e);c.item=d;return c};TradingView.Study.prototype.series=function(){return this._series};TradingView.Study.prototype.model=function(){return this._model};
TradingView.Study.prototype.clearData=function(){this.m_data=new PlotList(this._plotFields);this._graphics=new TradingView.StudyGraphics(this._metaInfo);this._plotOffsets={}};TradingView.Study.prototype.onTagsChanged=function(){return this._tagsChanged};TradingView.Study.prototype.properties=function(){return this._properties};
TradingView.Study.prototype.state=function(a){res={type:TradingView.className(this.constructor),id:this.id(),state:this.properties().state(),zorder:this.zorder()};this.metaInfo()instanceof StudyMetaInfo?res.metaInfo=this.metaInfo().state():(res.metaInfo=$.extend({},this.metaInfo()),res.metaInfo.id=StudyMetaInfo.parseIdString(res.metaInfo.id+(res.metaInfo.version?"-"+res.metaInfo.version:"")).fullId);a&&(res.data=this.m_data.state(),res.data.symbols=this._resolvedSymbols,res.data.graphics=this._graphics.graphics(),
res.data.plotOffsets=this._plotOffsets);this.ownerSource()&&(res.ownerSource=this.ownerSource().id());for(a=0;a<this._metaInfo.inputs.length;a++)if("bar_time"==this._metaInfo.inputs[a].type){var b=this._metaInfo.inputs[a].id,c=res.state.inputs[b];0>c&&(c=this._rightOffsetToUnixTime(-c),res.state.inputs[b]=c&&0<=c?c:0)}return res};TradingView.Study.prototype.isSavedInStudyTemplates=function(){for(var a=0;a<this._metaInfo.inputs.length;a++)if("bar_time"==this._metaInfo.inputs[a].type)return!1;return!0};
TradingView.Study.prototype.restoreData=function(a){this.m_data.restoreState(a);this._resolvedSymbols=a.symbols;this._graphics.setGraphics(a.graphics);this._postProcessGraphics();this._plotOffsets=a.plotOffsets};TradingView.Study.prototype.restart=function(){this._restarting=!0;TradingView.isRunningChartingLibrary&&this.stop();this.start()};
TradingView.Study.prototype.stop=function(){this._chartApi&&this._chartApi.connected()&&this._studyId&&this._chartApi.removeStudy(this._studyId,this._handler);this._studyId=null;this.clearData();this._unsubscribeExtendedHours();this.recalculate()};
TradingView.Study.prototype._resolveSymbol=function(a,b){function c(b){d._chartApi.resolveSymbol(d._makeNextSymbolId(),b,function(b){switch(b.method){case "symbol_resolved":d._resolvedSymbols[a]=b.params[1];0!=d._studyId&&d.stop();d.start();break;case "symbol_error":if("permission denied"===b.params[1]&&b.params[2])switch(b.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:break;case TradingView.Series.PD_REASON_SYMBOL:if(b.params[3])return c(b.params[3]);break;default:return c(b.params[2])}d._status=
"Invalid Symbol";d.stop();d._model.updateSource(d)}})}var d=this;c(a)};TradingView.Study.prototype._allSymbolsAreResolved=function(){for(var a=!0,b=0;b<this._metaInfo.inputs.length;b++)if("symbol"==this._metaInfo.inputs[b].type){var c=this._metaInfo.inputs[b].id,d=this._properties.inputs[c].value();this._resolvedSymbols[d]||(a=!1,this._resolveSymbol(d,this._properties.inputs[c]))}return a};
TradingView.Study.prototype._allInputsAreValid=function(){for(var a=0;a<this._metaInfo.inputs.length;a++)if("bar_time"==this._metaInfo.inputs[a].type){var b=this._properties.inputs[this._metaInfo.inputs[a].id].value();if(void 0==b||null==b)return!1}return!0};TradingView.Study.prototype.sourceId=function(){return this._studyId};TradingView.Study.prototype.isStarted=function(){return!!this._studyId};
TradingView.Study.prototype.start=function(){if(this._chartApi&&this._chartApi.connected()&&this._allSymbolsAreResolved()&&(!this.isStarted()||this._restarting)&&(this._studyId=TradingView.Study.makeNextStudyId(),this._restarting=!1,this._allInputsAreValid())){this._inputs=this.inputs();var a=this._metaInfo.id;if("MA"===this._metaInfo.id){switch(this._inputs[2]){case "exp":a="MAExp@tv-basicstudies";break;case "simple":a="MASimple@tv-basicstudies";break;case "weighted":a="MAWeighted@tv-basicstudies";
break;case "volume weighted":a="MAVolumeWeighted@tv-basicstudies"}inputs=[inputs[0],inputs[1]]}a+="-"+(this._metaInfo.version||"1!");a=StudyMetaInfo.cutDollarHash(a);"Script@tv-scripting-1"===a&&(a+="!");this._chartApi.createStudy(this._studyId,this._turnaround,this._series._seriesId,a,this._inputs,this._handler);this._subscribeExtendedHours()}};TradingView.Study._nextSymbolId=0;TradingView.Study.prototype._makeNextSymbolId=function(){TradingView.Study._nextSymbolId++;return"ss_"+TradingView.Study._nextSymbolId};
TradingView.Study._nextStudyId=0;TradingView.Study.makeNextStudyId=function(){TradingView.Study._nextStudyId++;return"st"+TradingView.Study._nextStudyId};TradingView.Study.prototype._rightOffsetToUnixTime=function(a){var b=null;this._series.bars().size()>=a&&(b=this._series.bars()._valueAt(this._series.bars().lastIndex()-a)[TIME_PLOT]);return b};
TradingView.Study.prototype.getSymbolString=function(a){return this._series&&this._series.extendedHours.value()?"="+JSON.stringify({symbol:a,session:"extended"}):a};TradingView.Study.prototype.inputsForGUI=function(a){return this.inputs({symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,allowScriptCompile:!1})};
TradingView.Study.prototype.inputs=function(a){var b={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!0,allowScriptCompile:!0};TradingView.merge(b,a);return this._buildInputs(b)};
TradingView.Study.prototype._buildInputs=function(a){assert(!!a,"options not set");try{var b=this._prepareInputs(a)}catch(c){console.warn("Failed to prepare study inputs: "+c),b={}}if(!a.symbolsForDisplay&&this._metaInfo.isTVScript){if(0==Object.keys(b).length||this._metaInfo.isTVScriptStub)return[this._metaInfo.defaults.inputs.text];var d=null;a.allowScriptCompile&&window.scriptLib&&(d=scriptLib.processScriptInputsChanged(this._metaInfo.TVScriptSourceCode,this._metaInfo.version,b,this));return[TradingView.ScriptLib.patchILTemplate(d||
this._metaInfo.defaults.inputs.text,this._metaInfo,b)]}var e=[];Object.keys(b).forEach(function(a){null!=b[a]&&e.push(b[a])});return e};TradingView.Study.prototype._prepareInputs=function(a){assert(!!a,"options not set");for(var b={},c=0;c<this._metaInfo.inputs.length;c++){var d=this._metaInfo.inputs[c];if(!d.isFake||!a.skipFakeInputs||this._metaInfo.isTVScript)if(!d.isHidden||!a.skipHiddenInputs){var e=this._prepareInput(d,a);b[d.id]=e}}return b};
TradingView.Study.prototype._prepareInput=function(a,b){var c=a.id;if("symbol"==a.type)return c=this._properties.inputs[c].value(),b&&b.symbolsForDisplay?this._resolvedSymbols&&this._resolvedSymbols[c]&&(c=this._resolvedSymbols[c].name+", "+this._resolvedSymbols[c].exchange):(this._resolvedSymbols&&this._resolvedSymbols[c]&&(c=this._resolvedSymbols[c],c=c.ticker||c.full_name),b&&b.symbolsForChartApi&&(c=this.getSymbolString(c))),c;if("bar_time"==a.type){c=this._properties.inputs[c].value();if(0>c)var d=
this._rightOffsetToUnixTime(-c),c=d&&0<=d?d:c;return c}return this._properties.inputs[c].value()};TradingView.Study.prototype._changeInputs=function(a){this._studyId&&this._chartApi.connected()?(this._turnaround="st"+ ++this._turnaroundCounter,this._allInputsAreValid())?this._allSymbolsAreResolved()&&(this._studyModified=!0,this._chartApi.modifyStudy(this._studyId,this._turnaround,a,this._handler)):this.stop():(this.stop(),this.start());this._inputs=a;this._tagsChanged.fire()};
TradingView.Study.prototype.changeStyles=function(){if(this._inputs)for(var a=this.inputs({allowScriptCompile:!1}),b=0;b<a.length;b++){if(a[b]!==this._inputs[b]){this._changeInputs(a);break}}else this.restart();this.createViews();this.recalculate(!0);this.updateAllViews()};
TradingView.Study.prototype.inputsChanged=function(){if(this._metaInfo.isTVScript){var a=this._prepareInputs({symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!0,allowScriptCompile:!0});TVScript.TvsTranslator.patchProperties(this._properties,this._metaInfo,a);this.createViews();this.recalculate(!0);this.updateAllViews()}};
TradingView.Study.prototype.createViews=function(){this._priceAxisViewsBase=new List;this._paneViews=new List;if(this.metaInfo().plots)for(var a=0;a<this.metaInfo().plots.length;a++)if(!this.isSelfColorerPlot(a)&&!this.isBarColorerPlot(a)){var b=this.metaInfo().plots[a].id;this.isBgColorerPlot(a)?this._paneViews.append(new StudyBackgroundPaneView(this,this._series,this._model,b)):this.isPlotShapesPlot(a)?this._paneViews.append(new StudyPlotShapesPaneView(this,this._series,this._model,b)):this.isPlotCharsPlot(a)?
this._paneViews.append(new StudyPlotCharsPaneView(this,this._series,this._model,b)):this.isPlotArrowsPlot(a)?this._paneViews.append(new StudyPlotArrowsPaneView(this,this._series,this._model,b)):(this._priceAxisViewsBase.append(new StudyPriceAxisView(this,this._model,b)),this._paneViews.append(new StudyPaneView(this,this._series,this._model,b)),this.properties().styles[b].trackPrice.value()&&this._paneViews.append(new StudyTrackPricePaneView(this,this._series,this._model,b)))}if(this._properties.bands)for(a=
0;a<this._properties.bands.childCount();a++)this._properties.bands[a].visible.value()&&this._paneViews.append(new TradingView.BandPaneView(this._properties.bands[a],this));this._properties.bandsBackground&&this._paneViews.append(new TradingView.BandBackgroundPaneView(this));a=[];this.metaInfo().graphics&&(a=Object.keys(this.metaInfo().graphics),a.sort(function(a,b){return TradingView.Study.graphicsZOrderPriority(a)-TradingView.Study.graphicsZOrderPriority(b)}));for(var c in a){var b=a[c],d="_paneView"+
b,e="StudyPaneView_"+b;TradingView.Study[e]&&(this[d]=new TradingView.Study[e](this,this._model),this._paneViews.append(this[d]));this._dataWindowView||"hhists"!==b||(this._dataWindowView=new StudyHHistsDataWindowView(this,this._model))}this._properties.areaBackground&&this._paneViews.append(new TradingView.AreaBackgroundPaneView(this));if(this._properties.filledAreas&&this._metaInfo.filledAreas)for(a=0;a<this._metaInfo.filledAreas.length;++a)c=this._metaInfo.filledAreas[a],b=this._properties.filledAreasStyle[c.id],
c.type===StudyMetaInfo.FilledArea.TYPE_PLOTS?this._paneViews.append(new TradingView.PlotFillPaneView(this,c,b)):c.type===StudyMetaInfo.FilledArea.TYPE_HLINES?this._paneViews.append(new TradingView.HlineFillPaneView(this,c,b)):console.warn("Unsupported filledArea type: "+c.type);this._dataWindowView||(this._dataWindowView=new StudyDataWindowView(this,this._model));this._statusView||(this._statusView=new StudyStatusView(this,this._model.properties()));this._priceAxisViews=(new List).appendAll(this._priceAxisViewsBase).appendAll(this._hlinesPriceAsisViews).appendAll(this._horizlinesPriceAsisViews)};
TradingView.Study.prototype.recalculate=function(a){var b=this._model.paneForSource(this);this._model.recalculatePane(b,a);this._model.updateSource(this)};TradingView.Study.prototype.data=function(){return this.m_data};TradingView.Study.prototype.metaInfo=function(){return this._metaInfo};TradingView.Study.prototype.status=function(){return this._status};
TradingView.Study.prototype.title=function(a){a=a?this._metaInfo.shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this._metaInfo.description||this._properties.description&&this._properties.description.value()||"Study";var b=this.properties().showStudyArguments.value(),c=this.inputsForGUI()||[];b&&0<c.length&&(a+=" ("+c.join(", ")+")");return a};TradingView.Study.prototype.graphics=function(){return this._graphics.graphics()};
TradingView.Study.prototype._checkTurnaround=function(a){return a===this._turnaround||a===this._model.mainSeries()._turnaround||a===this._model.mainSeries()._turnaround+"_"+this._turnaround};
TradingView.Study.prototype.onData=function(a){switch(a.method){case "study_loading":this._status="loading...";this._failed=!1;this._statusView.update();this._model.updateSource(this);break;case "study_error":this._failed=!0;this.clearData();this._status=a.params[2]?a.params[2].split(":",2)[0]:"";this._statusView.update();this._model.updateSource(this);break;case "study_completed":if(!this._checkTurnaround(a.params[1]))break;this._status="";this._statusView.update();a=this._model.paneForSource(this);
this._model.recalculatePane(a,!0);this._updateSources();this._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));break;case "data_update":if(!this._checkTurnaround(a.params.turnaround))break;this._studyModified&&(this.clearData(),this._studyModified=!1);var b=0==this.m_data.size();assert(!!a.params.nonseries,"data.params.nonseries is missing");a.params.nonseries.d=""!==a.params.nonseries.d?JSON.parse(a.params.nonseries.d):"";this._processPlotOffsets(a.params);
this._mergeData(a.params.plots);this._graphics.process(a.params.nonseries);this._postProcessGraphics();a=this._model.paneForSource(this);this._model.recalculatePane(a,b);this._updateSources()}};TradingView.Study.prototype._updateSources=function(){this._model.updateSource(this);this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())};TradingView.Study.prototype._processPlotOffsets=function(a){a=a.nonseries.d;a&&a.indexes_replace||(this._plotOffsets=a&&a.offsets?a.offsets:{})};
TradingView.Study.prototype._mergeData=function(a){this.m_data.merge(a)};
TradingView.Study.prototype._postProcessGraphics=function(){var a=this,b=function(b){var d=a._graphics.graphics(),e=new List,f;if(d&&d[b])for(var g=d[b],d=0;d<g.length;d+=1)if(g[d].data)for(f=0;f<g[d].data.length;f+=1)e.append(new TradingView.Study.StudyPriceAxisView_hlines(a,a._model,g[d].data[f],g[d].styleId,b));return e};this._hlinesPriceAsisViews=b("hlines");this._horizlinesPriceAsisViews=b("horizlines");this._priceAxisViews=(new List).appendAll(this._priceAxisViewsBase).appendAll(this._hlinesPriceAsisViews).appendAll(this._horizlinesPriceAsisViews)};
TradingView.Study.prototype.firstValue=function(a){if(this._metaInfo.is_price_study&&"Compare@tv-basicstudies"!==this._metaInfo.id)return this._series.data().firstValue();var b=this._model.timeScale().visibleBars(),c=b.firstBar(),b=b.lastBar();if(0===this.m_data.size())return null;var d,e=this;this.m_data.range(c,b).each(function(b,c){for(var h=1;h<c.length;++h)if(!e.isSelfColorerPlot(h-1)){var k=e._metaInfo.plots[h-1].id;if(e.properties().styles[k].visible.value()&&!(a&&1E-10>Math.abs(c[h])||void 0===
c[h]||null===c[h]||d))return d=c[h],!0}});return d};TradingView.Study.prototype.offset=function(a){var b=0;this._plotOffsets&&void 0!=this._plotOffsets[a]&&(b+=this._plotOffsets[a]);void 0!=this._plotOffsetsMetaInfoOverride[a]?b+=this._plotOffsetsMetaInfoOverride[a]:this.properties().offsets&&void 0!=this.properties().offsets[a]&&(b+=this.properties().offsets[a].val.value());this.properties().offset&&(b+=this.properties().offset.val.value());return b};
TradingView.Study.prototype.priceRange=function(a,b){if(isInteger(a)){if(isInteger(b)){if(0===this.m_data.size())return null;var c=null;if(0==this._metaInfo.plots.length)return null;for(var d=0;d<this._metaInfo.plots.length;++d)if(this.isLinePlot(d)){var e=this._metaInfo.plots[d].id;if(this.properties().styles[e].visible.value())for(var e=this.offset(e),e=this.m_data.range(a-e,b-e),f=e._start;f<e._end;++f){var g=e._valueAt(f)[d+1];void 0!==g&&null!==g&&(null===c?c=new PriceRange(g,g):c.apply(g,g))}}for(d=
0;d<this._metaInfo.plots.length;++d)this.isSelfColorerPlot(d)||this.isBarColorerPlot(d)||this.isBgColorerPlot(d)||(e=this._metaInfo.plots[d].id,this.properties().styles[e].plottype.value()!=TradingView.Study.PLOT_HISTOGRAM&&this.properties().styles[e].plottype.value()!=TradingView.Study.PLOT_COLUMNS)||(g=this.properties().styles[e].histogramBase.value(),isNumber(g)&&(c?c.apply(g,g):c=PriceRange(g,g)));if(this._metaInfo.bands)for(d=0;d<this._metaInfo.bands.length;d++)this.properties().bands[d].visible.value()&&
(g=this.properties().bands[d].value.value(),isNumber(g)&&(c?c.apply(g,g):c=PriceRange(g,g)));c&&c.minValue()===c.maxValue()&&(d=0.005*c.minValue(),c=new PriceRange(c.minValue()-d,c.maxValue()+d));return this.priceScale().properties().percentage.value()&&c?(d=this.firstValue())?c.convertToPercents(d):null:this.priceScale().isLog()&&c?new PriceRange(this.priceScale().priceToLogical(c.minValue()),this.priceScale().priceToLogical(c.maxValue())):c}TradingView.logDebug("Study.priceRange: incorrect endBar")}else TradingView.logDebug("Study.priceRange: incorrect startBar")};
TradingView.Study.prototype.paneViews=function(a){return this.properties().visible.value()?this._paneViews:null};TradingView.Study.prototype.dataWindowView=function(){return this._dataWindowView};TradingView.Study.prototype.statusView=function(){return this._statusView};TradingView.Study.prototype.priceAxisViews=function(a,b){return this._model.paneForSource(this)===a&&b===this.priceScale()&&this.properties().showLastValue.value()?this._priceAxisViews:null};
TradingView.Study.prototype.isLinePlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_LINE};TradingView.Study.prototype.isSelfColorerPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_COLORER};TradingView.Study.prototype.isBarColorerPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_BAR_COLORER};TradingView.Study.prototype.isBgColorerPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_BG_COLORER};
TradingView.Study.prototype.isPlotShapesPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_SHAPES};TradingView.Study.prototype.isPlotCharsPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_CHARS};TradingView.Study.prototype.isPlotArrowsPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_ARROWS};TradingView.Study.prototype.isDataOffsetPlot=function(a){return this._metaInfo.plots[a].type==TradingView.Study.PLOT_TYPE_DATAOFFSET};
TradingView.Study.prototype.hasBarColorer=function(){for(var a=0;a<this._metaInfo.plots.length;++a)if(this.isBarColorerPlot(a))return!0;return!1};TradingView.Study.prototype.barColorer=function(){for(var a=null,b=0;b<this._metaInfo.plots.length;++b)if(this.isBarColorerPlot(b)){var c=new StudyBarColorer(this,b);null===a?a=c:a.pushBackBarColorer(c)}if(null===a)throw Error("Cannot create BarColorer: study doesn't have a bar_colorer plot!");return a};
TradingView.Study.prototype.base=function(){return"Volume"===this._metaInfo.id?1:0};
TradingView.Study.prototype._createFormatter=function(){var a;"default"==this.properties().precision.value()?this.metaInfo().defaults&&(a=parseInt(this.metaInfo().defaults.precision)):a=parseInt(this.properties().precision.value());isFinite(a)||(a=-1!==["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(this._metaInfo.id)?0:1E4);var b=this.series().symbolInfo();this._formatter=0==a?new VolumeFormatter(b.has_fractional_volume):new PriceFormatter(Math.pow(10,
a));this.priceScale()&&this.priceScale().updateFormatter()};TradingView.Study.prototype.formatter=function(){return this._formatter};TradingView.Study.prototype.nearestIndex=function(a,b){if(isInteger(a)){var c=this._series.data().bars().search(a,b);return c?c.index:void 0}TradingView.logDebug("Study.nearestIndex: incorrect logicalPoint")};
TradingView.Study.prototype.updateAllViews=function(){for(var a=0;a<this._paneViews.size();a++)this._paneViews.item(a).update();this._dataWindowView.update();this._statusView.update();for(a=0;a<this._priceAxisViews.size();a++)this._priceAxisViews.item(a).update()};TradingView.Study.prototype.tags=function(){var a=[];a.push(this._metaInfo.id);var b=this.inputsForGUI();if(0<b.length){for(var c=this._metaInfo.id,d=0;d<b.length;d++)c+="_"+b[d];a.push(c)}return a};
TradingView.Study.isPointsBasedStudy=function(a){switch(a){case "VbPFixed@tv-volumebyprice":case "mtp_tsanalysis@mtp-mtpredictor":case "mtp_riskreward@mtp-mtpredictor":case "mtp_decisionpoint@mtp-mtpredictor":case "mtp_ew_main@mtp-mtpredictor":case "mtp_ew_major@mtp-mtpredictor":case "mtp_ew_minor@mtp-mtpredictor":case "mtp_wpt_down1ora@mtp-mtpredictor":case "mtp_wpt_down2orb@mtp-mtpredictor":case "mtp_wpt_down3@mtp-mtpredictor":case "mtp_wpt_down4@mtp-mtpredictor":case "mtp_wpt_down5@mtp-mtpredictor":case "mtp_wpt_downc@mtp-mtpredictor":case "mtp_wpt_up1ora@mtp-mtpredictor":case "mtp_wpt_up2orb@mtp-mtpredictor":case "mtp_wpt_up3@mtp-mtpredictor":case "mtp_wpt_up4@mtp-mtpredictor":case "mtp_wpt_up5@mtp-mtpredictor":case "mtp_wpt_upc@mtp-mtpredictor":return!0;
default:return!1}};
TradingView.Study.lineToolNameForPointsBasedStudy=function(a){switch(a){case "VbPFixed@tv-volumebyprice":return"LineToolVbPFixed";case "RegressionTrend@tv-basicstudies":return"LineToolRegressionTrend";case "mtp_tsanalysis@mtp-mtpredictor":return"LineStudyMtpAnalysis";case "mtp_riskreward@mtp-mtpredictor":return"LineStudyMtpRiskReward";case "mtp_decisionpoint@mtp-mtpredictor":return"LineStudyMtpDecisionPoint";case "mtp_ew_main@mtp-mtpredictor":return"LineStudyMtpElliotWaveMain";case "mtp_ew_major@mtp-mtpredictor":return"LineStudyMtpElliotWaveMajor";
case "mtp_ew_minor@mtp-mtpredictor":return"LineStudyMtpElliotWaveMinor";case "mtp_wpt_down1ora@mtp-mtpredictor":return"LineStudyMtpDownWave1OrA";case "mtp_wpt_down2orb@mtp-mtpredictor":return"LineStudyMtpDownWave2OrB";case "mtp_wpt_down3@mtp-mtpredictor":return"LineStudyMtpDownWave3";case "mtp_wpt_down4@mtp-mtpredictor":return"LineStudyMtpDownWave4";case "mtp_wpt_down5@mtp-mtpredictor":return"LineStudyMtpDownWave5";case "mtp_wpt_downc@mtp-mtpredictor":return"LineStudyMtpDownWaveC";case "mtp_wpt_up1ora@mtp-mtpredictor":return"LineStudyMtpUpWave1OrA";
case "mtp_wpt_up2orb@mtp-mtpredictor":return"LineStudyMtpUpWave2OrB";case "mtp_wpt_up3@mtp-mtpredictor":return"LineStudyMtpUpWave3";case "mtp_wpt_up4@mtp-mtpredictor":return"LineStudyMtpUpWave4";case "mtp_wpt_up5@mtp-mtpredictor":return"LineStudyMtpUpWave5";case "mtp_wpt_upc@mtp-mtpredictor":return"LineStudyMtpUpWaveC";default:throw Error("There is no line tool name, associated with study id "+a);}};
TradingView.Study.isStudyLineTool=function(a){a=TradingView[a];return"function"===typeof a&&a.prototype instanceof TradingView.StudyLineDataSource};TradingView.Study.prototype.onExtendedHoursChanged=function(){this.restart()};TradingView.Study.prototype.hasSymbolInputs=function(){for(var a=this._metaInfo.inputs.length;a--;)if("symbol"===this._metaInfo.inputs[a].type)return!0;return!1};
TradingView.Study.prototype._subscribeExtendedHours=function(){!this._isSubscribedToExtendedHours&&this.hasSymbolInputs()&&(this._series.extendedHours.listeners().subscribe(this,this.onExtendedHoursChanged),this._isSubscribedToExtendedHours=!0)};TradingView.Study.prototype._unsubscribeExtendedHours=function(){this._isSubscribedToExtendedHours&&(this._series.extendedHours.listeners().unsubscribe(this,this.onExtendedHoursChanged),delete this._isSubscribedToExtendedHours)};
TradingView.Study.prototype.removeByRemoveAllStudies=function(){return!0};TradingView.StudyGraphics=function(a){this._graphics=TradingView.StudyGraphics.emptyGraphics();assert(!!a,"Study metaInfo is absent!");this._metaInfo=a};TradingView.StudyGraphics.emptyGraphics=function(){return{indexes:[]}};TradingView.StudyGraphics.prototype.isEmpty=function(){var a=1<Object.keys(this._graphics).length;return 0==this._graphics.indexes.length&&!a};TradingView.StudyGraphics.prototype.graphics=function(){return this._graphics};
TradingView.StudyGraphics.prototype.setGraphics=function(a){this._graphics=a;this._postProcessGraphicsData()};TradingView.StudyGraphics.prototype.process=function(a){""!==a.d&&(TradingView.logDebug("nonseries.d is "+JSON.stringify(a.d)),a.d.indexes_replace?this.replaceIndexes(a):a.d.graphicsCmds&&(this.processEraseCmds(a.d.graphicsCmds.erase),this.processCreateCmds(a.d.graphicsCmds.create,a.indexes)))};
TradingView.StudyGraphics.prototype.replaceIndexes=function(a){""!==a.d&&(assert(!!a.d.indexes_replace),this._graphics.indexes=a.indexes,TradingView.logDebug("timescale has been replaced with a new one (replaceIndexes)"))};
TradingView.StudyGraphics.prototype.processEraseCmds=function(a){if(a){assert(!!this._graphics,"_graphics object doesn't exist in the study!");assert(!!this._graphics.indexes,"_graphics.indexes array doesn't exist in the study!");for(var b=0;b<a.length;++b){var c=a[b];if("all"===c.action)this._graphics=TradingView.StudyGraphics.emptyGraphics(),TradingView.logDebug("erased ALL the graphics");else if("one"===c.action)for(var d in this._graphics[c.type]){var e=this._graphics[c.type][d],f=TradingView.StudyGraphics._findGraphicsObjIndexById(e.data,
c.id);0<=f?(e.data.splice(f,1),TradingView.logDebug("erased one the graphics obj with id="+c.id)):TradingView.logDebug("cannot erase obj with id="+c.id+" because it doesn't exist")}else Error("Unknown graphics command "+c.action)}}};TradingView.StudyGraphics._findGraphicsObjIndexById=function(a,b){for(var c=0;c<a.length;++c)if(a[c].id===b)return c;return-1};
TradingView.StudyGraphics.prototype.processCreateCmds=function(a,b){if(a){assert(!!b,"indexes are missing in the study nonseries response!");assert(!!this._graphics,"_graphics object doesn't exist in the study!");assert(!!this._graphics.indexes,"_graphics.indexes array doesn't exist in the study!");for(var c in a){assert(c in this._metaInfo.graphics,"There is a '"+c+"' in study response, but it doesn't present in metaInfo!");for(var d=0;d<a[c].length;++d){var e=a[c][d],f=e.styleId;assert(f in this._metaInfo.graphics[c]);
this._graphics[c]||(this._graphics[c]=[]);for(var g=null,h=0;h<this._graphics[c].length;++h)if(this._graphics[c][h].styleId===f){g=this._graphics[c][h];break}null===g&&(g={styleId:f,data:[]},this._graphics[c].push(g));g.data=g.data.concat(e.data);TradingView.logDebug("created "+e.data.length+" graphics objects")}}"nochange"===b?TradingView.logDebug("timescale hasn't changed"):(assert(isArray(b)),this._graphics.indexes=b,TradingView.logDebug("timescale has been replaced with a new one"));this._postProcessGraphicsData()}};
TradingView.StudyGraphics.prototype._postProcessGraphicsData=function(){if(this._graphics)for(var a in this._graphics.hhists){var b=this._graphics.hhists[a];TradingView.StudyGraphics._sortHHistItemsByPrice(b.data);b.dataObj=TradingView.StudyGraphics._splitHHistItemsBySession(b.data,this._graphics.indexes)}};TradingView.StudyGraphics._sortHHistItemsByPrice=function(a){a.sort(function(a,c){return a.priceLow-c.priceLow})};
TradingView.StudyGraphics._splitHHistItemsBySession=function(a,b){for(var c={},d=0;d<a.length;++d){var e=a[d],f=b[e.firstBarTime];void 0===f?console.error("Cannot find index "+e.firstBarTime+" in study timescale indexes"):(f in c||(c[f]=[]),c[f].push(e))}return c};TradingView.StudyMigration=function(a){this._studyId=a;this._maxFromVers=this._maxToVers="0";this._migrs=[]};TradingView.StudyMigration.prototype.addMigration=function(a,b,c){TradingView.StudyVersioning.isGreater(a,this._maxFromVers)&&(this._maxFromVers=a);TradingView.StudyVersioning.isGreater(b,this._maxToVers)&&(this._maxToVers=b);this._migrs.push({fromVers:a,toVers:b,rules:c})};
TradingView.StudyMigration.prototype.updateInputs=function(a,b){if(!b)return b;var c=TradingView.clone(b);TradingView.logDebug("Applying migrations to study: "+this._studyId+" from vers: "+a+" to vers: "+this._maxToVers);for(var d=a;TradingView.StudyVersioning.isLess(d,this._maxToVers);){var e=this._findMigration(d),c=this._applyMigration(c,e);if(!TradingView.StudyVersioning.isLess(d,e.toVers))throw Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");
d=e.toVers;TradingView.logDebug("Applied migration rule to study: "+this._studyId+" from vers: "+e.fromVers+" to vers: "+e.toVers)}return c};
TradingView.StudyMigration.prototype._findMigration=function(a){for(var b=-1,c=this._maxFromVers,d=0;d<this._migrs.length;d++){var e=this._migrs[d];!TradingView.StudyVersioning.isLess(e.fromVers,a)&&TradingView.StudyVersioning.isLessOrEqual(e.fromVers,c)&&(c=e.fromVers,b=d)}if(0>b)throw Error("Could not find matching migration for study: "+this._studyId+" vers: "+a);return this._migrs[b]};
TradingView.StudyMigration.prototype._applyMigration=function(a,b){for(var c=a,d=0;d<b.rules.length;d++)var e=b.rules[d],c=this._getApplyRuleFun(e.type)(c,e);return c};TradingView.StudyMigration.prototype._getApplyRuleFun=function(a){if("inputRemoved"==a)return TradingView.StudyMigration._applyInputRemovedRule;if("inputChangedType"==a)return TradingView.StudyMigration._applyInputChangedTypeRule;throw Error("Unknown migration rule type: "+mr.type);};
TradingView.StudyMigration._applyInputRemovedRule=function(a,b){if(!(b.inputId in a))return a;var c=TradingView.StudyVersioning.findInputKeyById(a,b.inputId);if(c){delete a[c];delete a[b.inputId];var c={},d=0,e;for(e in a)isNumber(parseInt(e,10))?(c[d]=a[e],d++):c[e]=a[e];return c}};
TradingView.StudyMigration._applyInputChangedTypeRule=function(a,b){var c=TradingView.StudyVersioning.getInputKeyById(a,b.inputId);if("resetToDefVal"==b.action)a[b.inputId]=b.defVal,a[c].defval=b.defVal,a[c].type=b.inputType;else throw Error("Unknown action "+b.action+" for rule with type "+b.type);return a};TradingView.StudyVersioning=function(a,b){if(!a)throw Error("No studies metainfo");this._studiesMetainfo=a;if(!b)throw Error("No studies migrations");this._studiesMigrations=b;this._migrations={};for(var c=0;c<this._studiesMigrations.size();c++)for(var d=this._studiesMigrations.item(c),e=0;e<d.length;e++)for(var f=d[e],g=f.versFrom,h=f.versTo,k=0;k<f.studyMigrations.length;k++){var m=f.studyMigrations[k],n=m.studyId;if(0==m.rules.length)throw Error("Study Migration should have at least one convertion rule");
var q=n in this._migrations?this._migrations[n]:new TradingView.StudyMigration(n);q.addMigration(g,h,m.rules);this._migrations[n]=q}this._clientMigrations=[function(a,b){if(this._studiesMetainfo.isEmpty()||!a.isTVScript||22<=a.version)return b;for(var c={},d=0,e=0;;){var f=b[e];if(void 0==f)break;var g=b[f.id];f.isFake&&(f.id="in_"+d++);c[e]=f;c[f.id]=g;e++}return c}]};
TradingView.StudyVersioning.prototype.updateMetaInfo=function(a){if(!a)return a;var b=null;if(a.isTVScript){var c=this._studiesMetainfo.isEmpty()?"1":TradingView.ScriptLib.tvScriptingPkgVersion(this._studiesMetainfo),d=a.scriptIdPart||TVScript.MetainfoGenerator.createScriptIdPart();try{b=TradingView.ScriptLib.translateScript(a.TVScriptSourceCode,null,d,c),TradingView.merge(b,StudyMetaInfo.parseIdString(b.id))}catch(e){console.warn("Could not compile Pine script (skipping): "+a.description)}}else for(c=
this._studiesMetainfo,d=0;d<c.size();d++)if(c.item(d).id===a.id){b=c.item(d);break}b&&(b=StudyMetaInfo.replaceWithFullStudyMetaInfo(this._studiesMetainfo,b));return TradingView.clone(b)};
TradingView.StudyVersioning.prototype.updateStudyState=function(a,b){if(a){a=TradingView.clone(a);var c=b.id;c in this._migrations&&(c=this._migrations[c].updateInputs(b.version,a.inputs),a.inputs=c);for(var d=0;d<this._clientMigrations.length;++d)c=this._clientMigrations[d].call(this,b,a.inputs),a.inputs=c}(c=this.updateMetaInfo(b))&&a&&(d={},TradingView.StudyVersioning.mergeInputs(d,c.inputs),TradingView.StudyVersioning.mergeInputs(d,c.defaults.inputs),TradingView.StudyVersioning.mergeInputs(d,
a.inputs),a.inputs=d);return a};TradingView.StudyVersioning.prototype.patchPointsBasedStudyState=function(a){"LineToolRegressionTrend"===a.type&&(a=TradingView.LineToolRegressionTrend.patchSourceState(a));return a};TradingView.StudyVersioning.prototype.patchPointsBasedStudyData=function(a,b){if(!a||!b)return b;var c=TradingView.clone(b);"VbPFixed@tv-volumebyprice"===a.id&&a.version&&4>=a.version&&TradingView.StudyVersioning._patchOldVolumeProfiles(0,c);return c};
TradingView.StudyVersioning.prototype.patchStudyData=function(a,b,c,d){b=TradingView.clone(b);c=TradingView.clone(c);d=TradingView.clone(d);"VbPVisible@tv-volumebyprice"===a.id&&a.version&&4>=a.version&&TradingView.StudyVersioning._patchOldVolumeProfiles(0,b.graphics);"VbPSessions@tv-volumebyprice"===a.id&&a.version&&4>=a.version&&TradingView.StudyVersioning._patchOldVolumeProfiles(0,b.graphics);return{data:b,nsData:c,indexes:d}};
TradingView.StudyVersioning._patchOldVolumeProfiles=function(a,b){var c=b.hhists[a].data,d=[],e;for(e in c)d=d.concat(c[e]);b.hhists[0].data=d};
TradingView.StudyVersioning.prototype.patchPropsStateAndMetaInfo=function(a,b){b.isTVScript&&(b.scriptIdPart=b.scriptIdPart||TVScript.MetainfoGenerator.createScriptIdPart());"Volume"!==b.id&&"Volume@tv-basicstudies"!==b.id||0!=b.inputs.length||(b.inputs=[{id:"length",type:"integer",defval:20,min:1,max:1E3}],b.plots.push({id:"vol_ma",type:"line"}));if("PivotPointsStandard@tv-basicstudies"===b.id&&(0===b.inputs.length?(a.inputs={kind:"Traditional",showHistoricalPivots:!0},b.inputs=[{defval:"Traditional",
id:"kind",type:"text",options:"Traditional Fibonacci Woodie Classic DeMark Camarilla".split(" ")},{id:"showHistoricalPivots",type:"bool",defval:!0}]):1===b.inputs.length&&(a.inputs={kind:"Traditional"},b.inputs=[{defval:"Traditional",id:"kind",type:"text",options:"Traditional Fibonacci Woodie Classic DeMark Camarilla".split(" ")},{id:"showHistoricalPivots",type:"bool",defval:!0}]),void 0==a._hardCodedDefaultsVersion)){a._hardCodedDefaultsVersion=1;var c=a.color;delete a.color;a.levelsStyle={colors:{P:c,
"S1/R1":c,"S2/R2":c,"S3/R3":c,"S4/R4":c,"S5/R5":c}}}"CMF"===b.shortId&&2===b.inputs.length&&(a.inputs={length:a.inputs["length fast"]},b.inputs=b.inputs.splice(0,1),b.inputs[0].id="length");b.defaults&&!b.defaults.precision&&(-1!=["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(b.id)?b.defaults.precision=0:b.defaults.precision=4);if("MA"===b.id){var c=new StudyMetaInfo({id:"MAExp",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",
type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgExp",type:"line"}],palettes:{}}),d=new StudyMetaInfo({id:"MASimple",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgSimple",type:"line"}],palettes:{}}),e=new StudyMetaInfo({id:"MAVolumeWeighted",
properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgVolumeWeighted",type:"line"}],palettes:{}}),f=new StudyMetaInfo({id:"MAWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],
plots:[{id:"MovAvgWeighted",type:"line"}],palettes:{}});switch(a.inputs.type){case "exp":result.metaInfo=c;break;case "simple":result.metaInfo=d;break;case "weighted":result.metaInfo=f;break;case "volume weighted":result.metaInfo=e}a.styles[b.plots[0].id]=a.styles.MovAvg;delete a.styles.MovAvg;delete a.inputs.type}return{propsState:a,metaInfo:b}};
TradingView.StudyVersioning.compareStudyVersions=function(a,b){a=a.toString();b=b.toString();var c=a.split("."),d=c[0],d=parseInt(d,10),c=1<c.length?c[1]:"0",c=parseInt(c,10),e=b.split("."),f=e[0],f=parseInt(f,10),e=1<e.length?e[1]:"0",e=parseInt(e,10);return d<f?-1:d>f?1:c<e?-1:c>e?1:0};TradingView.StudyVersioning.isLess=function(a,b){return 0>TradingView.StudyVersioning.compareStudyVersions(a,b)};
TradingView.StudyVersioning.isLessOrEqual=function(a,b){return 0>=TradingView.StudyVersioning.compareStudyVersions(a,b)};TradingView.StudyVersioning.isEqual=function(a,b){return 0==TradingView.StudyVersioning.compareStudyVersions(a,b)};TradingView.StudyVersioning.isGreater=function(a,b){return 0<TradingView.StudyVersioning.compareStudyVersions(a,b)};TradingView.StudyVersioning.isGreaterOrEqual=function(a,b){return 0<=TradingView.StudyVersioning.compareStudyVersions(a,b)};
TradingView.StudyVersioning.isVersionTesting=function(a){if(!a)return!1;a=a.toString();return/\d+.\d+/.exec(a)==a};TradingView.StudyVersioning.isVersionHead=function(a){if(!a)return!1;a=a.toString();return/\d+/.exec(a)==a};TradingView.StudyVersioning.mergeInputs=function(a,b){TradingView.StudyVersioning.mergeInputsArrPart(a,b);TradingView.StudyVersioning.mergeInputsObjPart(a,b)};
TradingView.StudyVersioning.mergeInputsArrPart=function(a,b){var c=TradingView.StudyVersioning.splitInputs(b),d;for(d in c.arr){var e=TradingView.StudyVersioning.findInputKeyById(a,c.arr[d].id);e?TradingView.merge(a[e],c.arr[d]):TradingView.StudyVersioning.appendInputInfoToArr(a,c.arr[d])}};TradingView.StudyVersioning.mergeInputsObjPart=function(a,b){var c=TradingView.StudyVersioning.splitInputs(b);TradingView.merge(a,c.obj)};
TradingView.StudyVersioning.appendInputInfoToArr=function(a,b){var c=-1,d;for(d in a){var e=parseInt(d,10);isNumber(e)&&e>c&&(c=e)}a[c+1]=b};TradingView.StudyVersioning.splitInputs=function(a){var b={},c={},d;for(d in a)isNumber(parseInt(d,10))?b[d]=a[d]:c[d]=a[d];return{arr:b,obj:c}};TradingView.StudyVersioning.findInputKeyById=function(a,b){var c=null,d;for(d in a)if(isNumber(parseInt(d,10))&&a[d].id==b){c=d;break}return c};
TradingView.StudyVersioning.getInputKeyById=function(a,b){var c=TradingView.StudyVersioning.findInputKeyById(a,b);if(!c)throw Error("Cannot find input with id: "+b);return c};TradingView.NonSeriesStudy=function(a,b,c,d,e){TradingView.Study.call(this,a,b,c,d);this._paneView=e};inherit(TradingView.NonSeriesStudy,TradingView.Study);
TradingView.NonSeriesStudy.prototype.onData=function(a){switch(a.method){case "data_update":var b=""!==a.params.nonseries.d?JSON.parse(a.params.nonseries.d):{};b.indexes_replace||(this._nonseriesdata=b.data);this._indexes=a.params.nonseries.indexes;a=this._model.paneForSource(this);this._model.recalculatePane(a,!0);this._model.updateSource(this);break;default:return TradingView.Study.prototype.onData.call(this,a)}};
TradingView.NonSeriesStudy.prototype.updateAllViews=function(){this._paneView.update();this._dataWindowView.update();this._statusView.update()};TradingView.NonSeriesStudy.prototype.paneViews=function(a){a=new List;a.append(this._paneView);return a};TradingView.NonSeriesStudy.prototype.state=function(a){var b=TradingView.Study.prototype.state.call(this,a);a&&(b.nonSeriesData=this._nonseriesdata,b.indexes=this._indexes);return b};
TradingView.NonSeriesStudy.prototype.restoreData=function(a,b,c){TradingView.Study.prototype.restoreData.call(this,a);this._nonseriesdata=b;this._indexes=c};TradingView.NonSeriesStudy.prototype.clearData=function(){this._indexes=this._nonseriesdata=null};function LocationToYMixin(){}
LocationToYMixin.prototype._locationToY=function(a,b,c){c||(c=0);var d=[],e=this._study.priceScale(),f;switch(a){case CanvasEx.MARKLOC_ABOVEBAR:f=HIGH_PLOT;break;case CanvasEx.MARKLOC_BELOWBAR:f=LOW_PLOT}var g=this._study.firstValue();1<=c&&(c-=1);for(var h=-c;h<=c;h++){var k=this._study.series().bars().valueAt(b+h);k&&(k=k[f],e.isPercent()&&(k=e.priceRange().convertToPercent(k,g)),d.push(e.priceToCoordinate(k)))}switch(a){case CanvasEx.MARKLOC_ABOVEBAR:return MathEx.min(d)-15;case CanvasEx.MARKLOC_BELOWBAR:return MathEx.max(d)+
15}};function StudyPaneView(a,b,c,d){this.m_study=a;this.m_series=b;this.m_model=c;this._plotName=d;this.m_items=new List;this._invalidated=!0;a=this.m_study.metaInfo().plots;this._paletterProps=this._palette=this._colorer=null;for(b=this._plotIndex=0;b<a.length;b++)a[b].id===this._plotName&&(this._plotIndex=b),this.m_study.isSelfColorerPlot(b)&&a[b].target===this._plotName&&(this._colorer=b,this._palette=this.m_study.metaInfo().palettes[a[b].palette],this._paletterProps=this.m_study.properties().palettes[a[b].palette])}
StudyPaneView.prototype.items=function(){return this.m_items};StudyPaneView.prototype.update=function(){this._invalidated=!0};
StudyPaneView.prototype._updateImpl=function(){this.m_items.clear();this._histogramBase=null;if(!this.m_model.timeScale().isEmpty()&&!this.m_study.priceScale().isEmpty()){var a=this.m_model.timeScale().visibleBars().clone();if(!a.isEmpty()){var b=this.m_series.nearestIndex(a.firstBar(),SEARCH_NEAREST_RIGHT),c=this.m_series.nearestIndex(a.lastBar(),SEARCH_NEAREST_LEFT),a=this.m_study.offset(this._plotName);0<a?(b-=a,c+=a):(b+=a,c-=a);var d=this.m_study.properties().styles[this._plotName].plottype.value(),
e=0<=[TradingView.Study.PLOT_LINE,TradingView.Study.PLOT_AREA,TradingView.Study.PLOT_CIRCLES,TradingView.Study.PLOT_CROSS].indexOf(d),f=this.m_study.data(),d=this.m_study.firstValue();if(e&&0<f._length()){for(var g=function(a){return isNaN(a)||void 0===a||null===a},h=f._bsearch(b);0<=h&&h<f._length()&&g(f._valueAt(h)[this._plotIndex+1]);)h-=1;b=0<=h&&h<f._length()?f._indexAt(h):b;for(h=f._bsearch(c);0<=h&&h<f._length()&&g(f._valueAt(h)[this._plotIndex+1]);)h+=1;c=0<=h&&h<f._length()?f._indexAt(h):
c}for(var h=f.range(b,c),f=this.m_study.priceScale(),k=f.properties().percentage.value(),m=this._getTranspValue(),g=h._start;g<h._end;++g){var n=h._indexAt(g),n=n+a,n=Math.floor(n),q=h._valueAt(g),l=q[this._plotIndex+1],l=null!==l&&void 0!==l?l:NaN;k&&!isNaN(l)&&(l=100*(l-d)/d);e&&isNaN(l)||(n=new MathEx.Point(n,l),l=void 0!==q[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&l&&(l=q[this._colorer+1],n.style={},void 0!=l?(q=this._paletterProps.colors[l].color.value(),
n.style.color=generateColor(q,m)):(q=this.m_study.properties().styles[this._plotName].color.value(),n.style.color=generateColor(q,100)),q=void 0!=l?this._paletterProps.colors[l].width.value():this.m_study.properties().styles[this._plotName].linewidth.value(),l=void 0!=l?this._paletterProps.colors[l].style.value():this.m_study.properties().styles[this._plotName].linestyle.value(),n.style.width=q,n.style.style=l),this.m_items.append(n))}f.pricesToCoordinates(this.m_items);this.m_model.timeScale().indexesToCoordinates(this.m_items);
this.m_study.properties().styles[this._plotName].histogramBase&&(this._histogramBase=this.m_study.priceScale().priceToCoordinate(this.m_study.properties().styles[this._plotName].histogramBase.value()));if(this.m_study===this.m_model.selectedSource())for(b=(new SelectionIndexes).calc(b,c),this._selectionData={points:new List},this._selectionData.hittestResult=HitTestResult.REGULAR,g=0;g<b.size();g++)n=b.item(g),q=this.m_study.data().valueAt(n),n+=a,void 0!==q&&(l=q[this._plotIndex+1],f.properties().percentage.value()&&
(l=100*(l-d)/d),c=this.m_model.timeScale().indexToCoordinate(Math.floor(n)),e=this.m_study.priceScale().priceToCoordinate(l),this._selectionData.points.append(new MathEx.Point(c,e)))}}};
StudyPaneView.prototype._getTranspValue=function(){var a=0;this.m_study.properties().transparency&&(a=this.m_study.properties().transparency.value(),a=isNumber(a)?a:50);var b=this.m_study.properties().styles[this._plotName],c=b.plottype.value();if("Volume@tv-basicstudies"===this.m_study.metaInfo().id&&c===TradingView.Study.PLOT_COLUMNS)return a;0<=[TradingView.Study.PLOT_AREA,TradingView.Study.PLOT_AREA_WITH_BREAKS,TradingView.Study.PLOT_COLUMNS].indexOf(c)&&b.transparency&&(a=b.transparency.value(),
a=isNumber(a)?a:50);return a};
StudyPaneView.prototype.renderer=function(){var a=this.m_study.properties().styles[this._plotName];if(a.visible.value()&&this.m_study.priceScale()){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var b={},c=this._getTranspValue(),d=a.color.value();b.barSpacing=this.m_model.timeScale().barSpacing();b.items=this.m_items;b.histogramBase=this._histogramBase?this._histogramBase:this.m_study.priceScale().height();b.lineIndex=0;b.lineColor=generateColor(a.color.value(),c);b.lineStyle=a.linestyle.value();
b.lineWidth=a.linewidth.value();this._colorer&&(d=this._paletterProps.colors[0].color.value(),b.lineWidth=this._paletterProps.colors[0].width.value(),b.lineColor=generateColor(this._paletterProps.colors[0].color.value(),c));b.lineWidth=isNumber(b.lineWidth)?b.lineWidth:1;b.color2=generateColor(d,c);var d=new RGBColor(d),e=TradingView.rgbToHsl(d.r,d.g,d.b),f=e[0]+0.05;e[0]=f-Math.floor(f);e=TradingView.hslToRgb(e[0],e[1],e[2]);d.r=e[0];d.g=e[1];d.b=e[2];d=d.toHex();b.color1=generateColor(d,c);b.bottom=
b.histogramBase;this._colorer||(b.simpleMode=!0);c=new CompositeRenderer;d=a.joinPoints?a.joinPoints.value():!1;switch(a.plottype.value()){case TradingView.Study.PLOT_LINE:case TradingView.Study.PLOT_LINE_WITH_BREAKS:c.append(new PaneRendererLine(b));break;case TradingView.Study.PLOT_AREA:case TradingView.Study.PLOT_AREA_WITH_BREAKS:c.append(new PaneRendererArea(b));break;case TradingView.Study.PLOT_HISTOGRAM:c.append(new PaneRendererHistogram(b));break;case TradingView.Study.PLOT_COLUMNS:c.append(new PaneRendererColumns(b));
break;case TradingView.Study.PLOT_CROSS:c.append(new PaneRendererCross(b));d&&(a=TradingView.merge({},b),a.lineWidth=1,a.forceLineWidth=!0,c.append(new PaneRendererLine(a)));break;case TradingView.Study.PLOT_CIRCLES:c.append(new PaneRendererCircles(b));d&&(a=TradingView.merge({},b),a.lineWidth=1,a.ignorePaletteLineWidth=!0,c.append(new PaneRendererLine(a)));break;default:c.append(new PaneRendererLine(b))}this.m_study===this.m_model.selectedSource()&&c.append(new SelectionRenderer(this._selectionData));
return c}};function StudyBackgroundPaneView(a,b,c,d){this._study=a;this._series=b;this._model=c;this._plotName=d;this._items=new List;this._invalidated=!0;a=this._study.metaInfo().plots;for(b=0;b<a.length;b++)a[b].id===this._plotName&&(this._plotIndex=b,assert(this._study.isBgColorerPlot(b),"Plot '"+this._plotName+"' is not a background colorer!"))}StudyBackgroundPaneView.prototype.items=function(){return this._items};StudyBackgroundPaneView.prototype.update=function(){this._invalidated=!0};
StudyBackgroundPaneView.prototype._scalesReady=function(){var a=this._model.timeScale(),b=this._study.priceScale();return a&&b&&!a.isEmpty()&&!b.isEmpty()};
StudyBackgroundPaneView.prototype._updateImpl=function(){this._items.clear();assert(this._scalesReady(),"Scales must be ready!");var a=this._model.timeScale().visibleBars().clone();if(!a.isEmpty()){var b=this._study.metaInfo().plots[this._plotIndex].palette,b=this._study.properties().palettes[b].colors,c=this._study.properties().styles[this._plotName].transparency.value(),d=this._series.nearestIndex(a.firstBar(),SEARCH_NEAREST_RIGHT),e=this._series.nearestIndex(a.lastBar(),SEARCH_NEAREST_LEFT),a=
this._study.offset(this._plotName);0<a?(d-=a,e+=a):(d+=a,e-=a);d=this._study.data().range(d,e);for(e=d._start;e<d._end;++e){var f=d._indexAt(e),f=f+a,g=d._valueAt(e)[this._plotIndex+1],f=new MathEx.Point(Math.floor(f)-0.5),h=isNumber(c)?c:50,h=Math.min(h,100),h=Math.max(h,0);f.color=void 0==g?null:generateColor(b[g].color.value(),h);this._items.append(f)}this._model.timeScale().indexesToCoordinates(this._items)}};
StudyBackgroundPaneView.prototype.renderer=function(){if(this._study.properties().styles[this._plotName].visible&&this._study.properties().styles[this._plotName].visible.value()&&this._scalesReady()){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={items:this._items,y:0,h:this._study.priceScale().height(),w:Math.ceil(this._model.timeScale().barSpacing())},b=new CompositeRenderer;b.append(new PaneRendererBackground(a));return b}};
function StudyPlotShapesPaneView(a,b,c,d){this.m_study=a;this.m_series=b;this.m_model=c;this.m_plotName=d;this.m_items=new List;this.m_invalidated=!0;this.m_plotIndex=null;a=this.m_study.metaInfo().plots;for(b=0;b<a.length;b++)if(a[b].id===this.m_plotName){this.m_plotIndex=b;break}a=this.m_study.metaInfo().plots;this._paletterProps=this._palette=this._colorer=null;for(b=this._plotIndex=0;b<a.length;b++)a[b].id===this.m_plotName&&(this._plotIndex=b),this.m_study.isSelfColorerPlot(b)&&a[b].target===
this.m_plotName&&(this._colorer=b,this._palette=this.m_study.metaInfo().palettes[a[b].palette],this._paletterProps=this.m_study.properties().palettes[a[b].palette])}StudyPlotShapesPaneView.prototype.items=function(){return this.m_items};StudyPlotShapesPaneView.prototype.update=function(){this.m_invalidated=!0};StudyPlotShapesPaneView.prototype._scalesReady=function(){var a=this.m_model.timeScale(),b=this.m_study.priceScale();return a&&b&&!a.isEmpty()&&!b.isEmpty()};
StudyPlotShapesPaneView.prototype._updateImpl=function(){this.m_items.clear();if(this._scalesReady()){var a=this.m_model.timeScale(),b=this.m_study.priceScale(),a=a.visibleBars().clone();if(!a.isEmpty()){var c=this.m_series.nearestIndex(a.firstBar(),SEARCH_NEAREST_RIGHT),d=this.m_series.nearestIndex(a.lastBar(),SEARCH_NEAREST_LEFT),a=this.m_study.offset(this.m_plotName);0<a?(c-=a,d+=a):(c+=a,d-=a);var e=this.m_study.data(),f=this.m_study.firstValue(),e=e.range(c,d),g=b.properties().percentage.value();
b.priceRange();b=this._getTranspValue();c=(new SelectionIndexes).calc(c,d).toArray();if(d=this.m_study===this.m_model.selectedSource())this.m_selectionData={points:new List,hittestResult:HitTestResult.REGULAR,vertOffset:0};var h=this.m_series.properties().style.value();if(h=h===TradingView.Series.STYLE_LINE?"lineStyle":h===TradingView.Series.STYLE_AREA?"areaStyle":null)var k=h=this.m_series.properties()[h].priceSource.value();else h="high",k="low";for(var m=e._start;m<e._end;++m){var n=e._indexAt(m),
q=Math.floor(n+a),l=function(a){try{var b=this.m_series[a||"close"](q)}catch(c){b=null}return b}.bind(this),s=l(h),u=l(k);if(void 0!=s&&void 0!=u){var l=e._valueAt(m),z=l[this.m_plotIndex+1];null!==z&&void 0!==z&&(g&&(z=100*(z-f)/f),s=this._createItem(q,z,s,u),void 0!=s&&(z=void 0!==l[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&z&&(z=l[this._colorer+1],s.style={},void 0!=z?(z=this._paletterProps.colors[z].color.value(),s.style.color=generateColor(z,b)):(z=this.m_study.properties().styles[this.m_plotName].color.value(),
s.style.color=generateColor(z,100))),this.m_model.timeScale().indexToCoordinate(Math.floor(q)),this.m_study.priceScale().priceToCoordinate(l),d&&-1!==$.inArray(n,c)&&this.m_selectionData.points.append(s),this.m_items.append(s)))}}this._convertItemsToCoordinates()}}};
StudyPlotShapesPaneView.prototype._getTranspValue=function(){var a=0;this.m_study.properties().transparency&&(a=this.m_study.properties().transparency.value(),a=isNumber(a)?a:50);var b=this.m_study.properties().styles[this.m_plotName];b.transparency&&(a=b.transparency.value(),a=isNumber(a)?a:50);return a};
StudyPlotShapesPaneView.prototype._createItem=function(a,b,c,d){var e=this.m_study.properties().styles[this.m_plotName].location.value(),f=this.m_study.priceScale(),g=f.coordinateToPrice(f.height()*f.topMargin()),f=f.coordinateToPrice(f.height()*(1-f.bottomMargin()));if(!b&&e!=CanvasEx.MARKLOC_ABSOLUTE)return null;switch(e){case CanvasEx.MARKLOC_ABOVEBAR:b=c;break;case CanvasEx.MARKLOC_BELOWBAR:b=d;break;case CanvasEx.MARKLOC_TOP:b=g;break;case CanvasEx.MARKLOC_BOTTOM:b=f;break;case CanvasEx.MARKLOC_ABSOLUTE:break;
default:throw Error("Bad value: "+e);}return new MathEx.Point(a,b)};StudyPlotShapesPaneView.prototype._convertItemsToCoordinates=function(){var a=this.m_model.timeScale(),b=this.m_study.priceScale();a.indexesToCoordinates(this.m_items);b.pricesToCoordinatesEx(this.m_items.toArray(),function(a){return a.y},function(a,b){a.y=b})};
StudyPlotShapesPaneView.prototype._calculateVerticalOffset=function(a,b){var c;switch(a){case CanvasEx.MARKLOC_ABOVEBAR:case CanvasEx.MARKLOC_BOTTOM:c=-b;break;case CanvasEx.MARKLOC_BELOWBAR:case CanvasEx.MARKLOC_TOP:c=b;break;default:c=0}return c};StudyPlotShapesPaneView.prototype._calculateShapeHeight=function(a){return Math.round(a/2)};
StudyPlotShapesPaneView.prototype.renderer=function(){if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady()){var a=this.m_model.timeScale();this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var b={},c=this._getTranspValue(),d=a.barSpacing(),e=this._calculateShapeHeight(d),a=this.m_study.properties().styles[this.m_plotName].location.value(),a=this._calculateVerticalOffset(a,e+e/2);b.barSpacing=
d;b.items=this.m_items;b.color=generateColor(this.m_study.properties().styles[this.m_plotName].color.value(),c);b.height=e;b.vertOffset=a;d=this.m_study.properties().styles[this.m_plotName].plottype.value();c=TradingView.Study.PlotShapes[d];void 0==c&&console.error("Unknown style "+d);d=new CompositeRenderer;d.append(new window[c.paneRendererClass](b));this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=a,d.append(new SelectionRenderer(this.m_selectionData)));return d}};
function StudyPlotCharsPaneView(a,b,c,d){StudyPlotShapesPaneView.call(this,a,b,c,d)}inherit(StudyPlotCharsPaneView,StudyPlotShapesPaneView);StudyPlotCharsPaneView.prototype._calculateShapeHeight=function(a){return Math.round(a)};
StudyPlotCharsPaneView.prototype.renderer=function(){if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady()){var a=this.m_model.timeScale();this.m_study.priceScale();this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var b={},c=0;this.m_study.properties().transparency&&(c=this.m_study.properties().transparency.value(),c=isNumber(c)?c:50);var d=this.m_study.properties().styles[this.m_plotName];
d.transparency&&(c=d.transparency.value(),c=isNumber(c)?c:50);a=a.barSpacing();a=this._calculateShapeHeight(a);d=this.m_study.properties().styles[this.m_plotName].location.value();d=this._calculateVerticalOffset(d,a);b.items=this.m_items;b["char"]=this.m_study.properties().styles[this.m_plotName]["char"].value();b.height=a;b.vertOffset=d;b.color=generateColor(this.m_study.properties().styles[this.m_plotName].color.value(),c);c=new CompositeRenderer;c.append(new PaneRendererUnicodeChar(b));this.m_study===
this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=d,c.append(new SelectionRenderer(this.m_selectionData)));return c}};function StudyPlotArrowsPaneView(a,b,c,d){StudyPlotShapesPaneView.call(this,a,b,c,d);this._maxAbsValue=0}inherit(StudyPlotArrowsPaneView,StudyPlotShapesPaneView);
StudyPlotArrowsPaneView.prototype.renderer=function(){if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady()){this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var a={},b=0;this.m_study.properties().transparency&&(b=this.m_study.properties().transparency.value(),b=isNumber(b)?b:50);var c=this.m_study.properties().styles[this.m_plotName];c.transparency&&(b=c.transparency.value(),b=isNumber(b)?
b:50);c=this.m_model.timeScale().barSpacing();a.items=this.m_items;a.barSpacing=c;a.colorup=generateColor(this.m_study.properties().styles[this.m_plotName].colorup.value(),b);a.colordown=generateColor(this.m_study.properties().styles[this.m_plotName].colordown.value(),b);a.colorBorder=generateColor("#000000",b);a.minHeight=this.m_study.properties().styles[this.m_plotName].minHeight.value();a.maxHeight=this.m_study.properties().styles[this.m_plotName].maxHeight.value();b=new CompositeRenderer;b.append(new PaneRendererArrowsUpDown(a));
this.m_study===this.m_model.selectedSource()&&(a=this.m_selectionData,a.barSpacing=c,b.append(new SelectionRendererArrowsUpDown(a)));return b}};StudyPlotArrowsPaneView.prototype._createItem=function(a,b,c,d){if(0!==b){Math.abs(b)>this._maxAbsValue&&(this._maxAbsValue=Math.abs(b));var e=0<b;return new PaneRendererArrowsUpDownItem(a,e?d:c,b,e)}};
StudyPlotArrowsPaneView.prototype._convertItemsToCoordinates=function(){var a=this.m_model.timeScale(),b=this.m_study.priceScale();a.indexesToCoordinates(this.m_items);b.pricesToCoordinatesEx(this.m_items.toArray(),function(a){return a.y},function(a,b){a.y=b});a=Math.abs(this.m_study.properties().styles[this.m_plotName].minHeight.value());b=Math.abs(this.m_study.properties().styles[this.m_plotName].maxHeight.value());if(a>b)var c=a,a=b,b=c;for(var b=(b-a)/this._maxAbsValue,c=this.m_items.toArray(),
d=0;d<c.length;d++){var e=c[d],f=Math.abs(e.height);e.height=f*b+a}};function StudyPriceAxisView(a,b,c){this._study=a;this._model=b;this._plotIndex=c;this._text="";this._coordinate=0;this._background="black";this._color="white";this._textHeight=14;this._invalidated=!0}inherit(StudyPriceAxisView,PriceAxisView);StudyPriceAxisView.prototype.update=function(){this._invalidated=!0};
StudyPriceAxisView.prototype._updateImpl=function(){this._visible=!1;this._text="";var a=this._study.lastValueData(this._plotIndex);a&&(this._visible=!0,this._text=a.text,this._coordinate=a.coordinate,this._background=a.color,this._textHeight=this._study.priceScale().m_markBuilder.fontHeight())};
StudyPriceAxisView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:this._visible};return new PriceAxisViewRenderer(a)};StudyPriceAxisView.prototype.text=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return PriceAxisView.prototype.text.call(this)};function StudyDataWindowView(a,b){DataWindowView.call(this);this._study=a;this._model=b;var c=a.metaInfo().plots;if(c){for(var d=0;d<c.length;++d)if(!(this._study.isSelfColorerPlot(d)||this._study.isBarColorerPlot(d)||this._study.isBgColorerPlot(d)||this._study.isDataOffsetPlot(d))){var e=c[d].id,f;if("Compare@tv-basicstudies"===this._study.metaInfo().id)f=new DataWindowItem(this._study.inputsForGUI()[1],"");else{f=this._study.title();try{f=this._study.properties().styles[e].title.value()}catch(g){}f=
new DataWindowItem(f,"")}f.plotId=e;f.plotIndex=d;this._items.append(f)}this.update();this._invalidated=!0}}inherit(StudyDataWindowView,DataWindowView);StudyDataWindowView.prototype.update=function(){this._invalidated=!0};
StudyDataWindowView.prototype._updateImpl=function(){this._header=this._study.title(!0);this._title=this._study.title();for(var a=$.t("n/a"),b=0;b<this._items.size();++b)this._items.item(b).setValue(a);if(!this._model.timeScale().isEmpty()){var c=this._study.metaInfo().plots,d=null,a={};if(c)for(b=0;b<c.length;b++)this._study.isSelfColorerPlot(b)&&(a[c[b].target]={index:b},a[c[b].target].palette=this._study.metaInfo().palettes[c[b].palette],a[c[b].target].paletterProps=this._study.properties().palettes[c[b].palette]);
for(var c=this._model.crossHairSource().index,e=this._study.formatter(),b=0;b<this._items.size();++b){var d=this._items.item(b).plotId,f=this._items.item(b).plotIndex,g=this._study.offset(d),g=this._study.nearestIndex(c-g,SEARCH_NEAREST_LEFT);void 0!==g&&(g=this._study.data().valueAt(g)||this._study.data().last())&&(f=g[f+1],isNumber(f)&&(this._items.item(b).setValue(e.format(f)),f=this._study.properties().styles[d].color.value(),a[d]&&g.length>a[d].index+1?(g=g[a[d].index+1],void 0!=g?(d=a[d].paletterProps,
this._items.item(b).setColor(d.colors[g].color.value())):this._items.item(b).setColor(f)):this._items.item(b).setColor(f)))}}};StudyDataWindowView.prototype.items=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return this._items};function StudyStatusView(a,b){StatusView.call(this,b);this._study=a}inherit(StudyStatusView,StatusView);StudyStatusView.prototype.color=function(){return this._study._failed?"#ff0000":StatusView.prototype.color.call(this)};StudyStatusView.prototype.update=function(){this._text=this._study._failed?this._study.title(!0)+": "+this._study.status():this._study.title(!0)+" "+this._study.status()};function LineSourcePaneView(a,b){this._source=a;this._model=b;this._points=new List;this._floatPoints=new List}LineSourcePaneView.prototype.addAnchors=function(a){if(this.isAnchorsRequired()){var b=this._points.clone();this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1);a.append(this.createLineAnchor({points:b}))}};
LineSourcePaneView.prototype.update=function(){var a=this._source.priceScale(),b=this._model.timeScale();if(a&&!a.isEmpty()&&!b.isEmpty())for(this._points=new List,this._floatPoints=new List,a=0;a<this._source.points().size();a++){var b=this._source.points().item(a),c=this._source.pointToScreenPoint(b);if(!c)break;b=c[0];b.data=a;c=c[1];c.data=a;this._floatPoints.append(b);this._points.append(c)}};
LineSourcePaneView.prototype.currentPoint=function(){var a=this._model.crossHairSource();return new MathEx.Point(a.x,a.y)};LineSourcePaneView.prototype.anchorColor=function(){return this._source.isBeingEdited()?"#D61AD3":this._model.isDark()?"#FFFFFF":"#606060"};LineSourcePaneView.prototype.isHoveredSource=function(){return this._source===this._model.hoveredSource()};LineSourcePaneView.prototype.isSelectedSource=function(){return this._source===this._model.selectedSource()};
LineSourcePaneView.prototype.isAnchorsRequired=function(){return this.isHoveredSource()||this.isSelectedSource()};
LineSourcePaneView.prototype.createLineAnchor=function(a){return new LineAnchor($.extend({color:this.anchorColor(),backgroundColor:this._model.backgroundColor(),currentPoint:this.currentPoint(),linePointBeingEdited:this._model.linePointBeingEdited(),hittestResult:HitTestResult.CHANGEPOINT,radius:(TradingView.isMobile.any()?15:7)+(this.isSelectedSource()?1:0),strokeWidth:(TradingView.isMobile.any()?3:1)+(this.isSelectedSource()?1:0)},a))};TradingView.study_Compare=function(a,b,c,d){this._symbolLabelView=new TradingView.SymbolLabelPaneView(a,this,"compare");TradingView.Study.call(this,a,b,c,d);var e=this;this._properties.minTick.listeners().subscribe(null,function(){e._createFormatter()});this.properties().minTick.listeners().subscribe(null,function(){e._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))})};inherit(TradingView.study_Compare,TradingView.Study);
TradingView.study_Compare.prototype.createViews=function(){TradingView.Study.prototype.createViews.call(this);this._paneViews.append(this._symbolLabelView)};
TradingView.study_Compare.prototype._createFormatter=function(){var a=this.properties().inputs.symbol.value(),a=this._resolvedSymbols?this._resolvedSymbols[a]:null;if("default"==this.properties().minTick.value())this._formatter=new PriceFormatter(a?a.pricescale:100,a?a.minmov:1,a?a.fractional:!1);else{var a=this.properties().minTick.value(),a=isNumber(a)?["100","1","false"]:a.split(","),b=parseInt(a[0]),c=parseInt(a[1]);this._formatter=new PriceFormatter(b,c,"true"===a[2])}this.priceScale()&&this.priceScale().updateFormatter()};
TradingView.study_Compare.prototype.symbol=function(){var a=this.properties().inputs.symbol.value(),b=this._resolvedSymbols?this._resolvedSymbols[a]:null;return(b?b.name:a).toUpperCase()};TradingView.study_Compare.prototype.title=function(a){a=this.properties().inputs.symbol.value();var b=this._resolvedSymbols?this._resolvedSymbols[a]:null;return(b?b.name+", "+b.exchange:a).toUpperCase()};function AreaBackgroundRenderer(a){this._data=a}AreaBackgroundRenderer.prototype.hitTest=function(a){selectionTolerance(this.lineWidth);for(var b=1;b<this._data.points1.length;++b)if(currY1=this._data.points1[b],currY2=this._data.points2[b],x=this._data.timePoints[b],x==a.x&&(a.y>=currY1&&a.y<=currY2||a.y<=currY1&&a.y>=currY2))return new HitTestResult(HitTestResult.REGULAR);return null};
AreaBackgroundRenderer.prototype.draw=function(a){function b(a){return null!==a&&void 0!==a&&!isNaN(a)}function c(a){for(var c=0,d=a.length;c<d;c++)if(b(a[c]))return c;return null}function d(a){for(var c=a.length-1;0<=c;c--)if(b(a[c]))return c;return null}if(0!==this._data.points1.length){var e,f,g;g=c(this._data.points1);f=d(this._data.points1);var h=this._data.timePoints[g];e=this._data.points1[g];if(null!==f&&null!==g){a.strokeStyle=this._data.backcolor;a.lineWidth=1;a.lineStyle=CanvasEx.LINESTYLE_SOLID;
a.beginPath();a.moveTo(h,e);for(h=g+1;h<=f;++h)e=this._data.points1[h],g=this._data.timePoints[h],b(e)&&a.lineTo(g,e);e=c(this._data.points2);for(h=d(this._data.points2);h>=e;--h)f=this._data.points2[h],g=this._data.timePoints[h],b(f)&&a.lineTo(g,f);a.closePath();0<this._data.points1.length&&(f=isNumber(this._data.transparency)?this._data.transparency:50,f=Math.min(f,100),f=Math.max(f,0),a.fillStyle=generateColor(this._data.backcolor,f),a.fill())}}};
TradingView.AbstractFilledAreaPaneView=function(a){this._source=a;this._points1=[];this._points2=[];this._timePoints=[];this._invalidated=!0};TradingView.AbstractFilledAreaPaneView.prototype.update=function(){this._invalidated=!0};
TradingView.AbstractFilledAreaPaneView.prototype._updateImpl=function(){this._points1=[];this._points2=[];this._timePoints=[];if(this._visible()){var a=this._source.priceScale(),b=this._source._model.timeScale();if(a&&!a.isEmpty()&&!this._source._model.timeScale().isEmpty()&&!this._source._series.bars().isEmpty()){var c=this._source.data()._columns.indexOf(this._plotAId())+1,d=this._source.data()._columns.indexOf(this._plotBId())+1,e=this._source._model.timeScale().visibleBars();if(!e.isEmpty()){var f=
this._source.offset(this._plotAId()),g=this._source._series.nearestIndex(e.firstBar(),SEARCH_NEAREST_RIGHT),e=this._source._series.nearestIndex(e.lastBar(),SEARCH_NEAREST_LEFT);0<f?(g-=f,e+=f):(g+=f,e-=f);g=this._source.data().range(g,e);if(0<this._source.data()._items.length){this._source.data();for(var e=this._source.firstValue(),h=g._start;h<g._end;++h){var k=g._indexAt(h),m=g._valueAt(h),k=k+f,n=m[c];a.properties().percentage.value()&&(n=100*(n-e)/e);this._points1.push(n);m=m[d];a.properties().percentage.value()&&
(m=100*(m-e)/e);this._points2.push(m);this._timePoints.push(b.indexToCoordinate(k))}}a.pricesArrayToCoordinates(this._points1);a.pricesArrayToCoordinates(this._points2)}}}};TradingView.AbstractFilledAreaPaneView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={};a.points1=this._points1;a.points2=this._points2;a.timePoints=this._timePoints;a.backcolor=this._color();a.transparency=this._transparency();return new AreaBackgroundRenderer(a)};
TradingView.AbstractFilledAreaPaneView.prototype._plotAId=function(){assert(!1,"Pure virtual call!")};TradingView.AbstractFilledAreaPaneView.prototype._plotBId=function(){assert(!1,"Pure virtual call!")};TradingView.AbstractFilledAreaPaneView.prototype._color=function(){assert(!1,"Pure virtual call!")};TradingView.AbstractFilledAreaPaneView.prototype._transparency=function(){assert(!1,"Pure virtual call!")};TradingView.AbstractFilledAreaPaneView.prototype._visible=function(){assert(!1,"Pure virtual call!")};
TradingView.AreaBackgroundPaneView=function(a){TradingView.AbstractFilledAreaPaneView.call(this,a)};inherit(TradingView.AreaBackgroundPaneView,TradingView.AbstractFilledAreaPaneView);TradingView.AreaBackgroundPaneView.prototype._plotAId=function(){return this._source.properties().area[0].name.value()};TradingView.AreaBackgroundPaneView.prototype._plotBId=function(){return this._source.properties().area[1].name.value()};TradingView.AreaBackgroundPaneView.prototype._color=function(){return this._source.properties().areaBackground.backgroundColor.value()};
TradingView.AreaBackgroundPaneView.prototype._transparency=function(){return this._source.properties().areaBackground.transparency.value()};TradingView.AreaBackgroundPaneView.prototype._visible=function(){return this._source.properties().areaBackground.fillBackground.value()};
TradingView.PlotFillPaneView=function(a,b,c){TradingView.AbstractFilledAreaPaneView.call(this,a);assert(b.type===StudyMetaInfo.FilledArea.TYPE_PLOTS,"Wrong filledArea type: "+b.type);this._fillMetaInfo=b;this._fillStyleProps=c};inherit(TradingView.PlotFillPaneView,TradingView.AbstractFilledAreaPaneView);TradingView.PlotFillPaneView.prototype._plotAId=function(){return this._fillMetaInfo.objAId};TradingView.PlotFillPaneView.prototype._plotBId=function(){return this._fillMetaInfo.objBId};
TradingView.PlotFillPaneView.prototype._color=function(){return this._fillStyleProps.color.value()};TradingView.PlotFillPaneView.prototype._transparency=function(){return this._fillStyleProps.transparency.value()};TradingView.PlotFillPaneView.prototype._visible=function(){return this._fillStyleProps.visible.value()};TradingView.BandPaneView=function(a,b){this._source=b;this._properties=a;this._points=new List;this._points.append(new MathEx.Point(-1,-1))};TradingView.BandPaneView.prototype.update=function(){var a=this._source.priceScale();if(!a||a.isEmpty())this._points.setItem(0,new MathEx.Point(-1,-1));else{var b=this._properties.value.value();isNumber(b)?this._points.setItem(0,new MathEx.Point(-1,a.priceToCoordinate(b))):this._points.setItem(0,new MathEx.Point(-1,NaN))}};
TradingView.BandPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._properties.color.value();a.linewidth=this._properties.linewidth.value();a.linestyle=this._properties.linestyle.value();a.hitTestResult=HitTestResult.REGULAR;return new HorzLineRenderer(a)};function BandBackgroundRenderer(a){this._data=a}
BandBackgroundRenderer.prototype.draw=function(a){if(0!==this._data.points.length){var b=a.canvas.width;a.fillStyle=generateColor(this._data.backcolor,this._data.transparency);var c=Math.min(this._data.points[0],this._data.points[1]),d=Math.max(this._data.points[0],this._data.points[1]);a.fillRect(0,c,b,d-c)}};BandBackgroundRenderer.prototype.hitTest=function(a){return null};TradingView.BandBackgroundPaneView=function(a){this._source=a;this._points=[]};
TradingView.BandBackgroundPaneView.prototype.update=function(){this._points=[];if(this._source.properties().bandsBackground.fillBackground.value()){var a=this._source.properties().bands[0],b=this._source.properties().bands[1],c=this._source.priceScale();c&&!c.isEmpty()&&(this._points.push(c.priceToCoordinate(a.value.value())),this._points.push(c.priceToCoordinate(b.value.value())))}};
TradingView.BandBackgroundPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.backcolor=this._source.properties().bandsBackground.backgroundColor.value();a.transparency=this._source.properties().bandsBackground.transparency.value();return new BandBackgroundRenderer(a)};
TradingView.HlineFillPaneView=function(a,b,c){this._source=a;this._points=[];assert(b.type===StudyMetaInfo.FilledArea.TYPE_HLINES,"Wrong filledArea type: "+b.type);this._initBandIndexes(b.objAId,b.objBId);this._fillStyleProps=c};
TradingView.HlineFillPaneView.prototype._initBandIndexes=function(a,b){this._bandBKey=this._bandAKey=null;for(var c=0;c<this._source.metaInfo().bands.length;++c){var d=this._source.metaInfo().bands[c];void 0==this._bandAKey&&d.id===a?this._bandAKey=c:void 0==this._bandBKey&&d.id===b&&(this._bandBKey=c)}};
TradingView.HlineFillPaneView.prototype.update=function(){this._points=[];if(this._fillStyleProps.visible.value()){var a=this._source.properties().bands[this._bandAKey],b=this._source.properties().bands[this._bandBKey],c=this._source.priceScale();c&&!c.isEmpty()&&(this._points.push(c.priceToCoordinate(a.value.value())),this._points.push(c.priceToCoordinate(b.value.value())))}};
TradingView.HlineFillPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.backcolor=this._fillStyleProps.color.value();a.transparency=this._fillStyleProps.transparency.value();return new BandBackgroundRenderer(a)};function Tickmarks(){this._marksByIndex={};this._marksBySpan=[]}Tickmarks.prototype.minIndex=void 0;Tickmarks.prototype.maxIndex=void 0;
Tickmarks.prototype.merge=function(a){for(var b=this._marksBySpan,c={},d=0;d<a.length;d++){var e=a[d],f=e.index,g=e.span,h=this._marksByIndex[e.index];if(h){if(h.index===e.index&&h.span===e.span){h.time=e.time;continue}this._removeTickmark(h)}this._marksByIndex[f]=e;this.minIndex<=f||(this.minIndex=f);this.maxIndex>=f||(this.maxIndex=f);b[g]||(b[g]=[]);b[g].push(e);c[g]=!0}for(g=b.length;g--;)b[g]&&(b[g].length||delete b[g],c[g]&&b[g].sort(this._sortByIndexAsc));delete this._cache};
Tickmarks.prototype._removeTickmark=function(a){var b=a.index;this._marksByIndex[b]===a&&(delete this._marksByIndex[b],b<=this.minIndex&&this.minIndex++,b>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(delete this.minIndex,delete this.maxIndex),b=this._marksBySpan[a.span],a=b.indexOf(a),-1!==a&&b.splice(a,1))};Tickmarks.prototype._sortByIndexAsc=function(a,b){return a.index-b.index};Tickmarks.prototype.removeTail=function(a){};Tickmarks.prototype.addTail=function(a){};
Tickmarks.prototype.indexToTime=function(a){return(a=this._marksByIndex[a])?new Date(1E3*a.time):null};
Tickmarks.prototype.build=function(a,b){var c=Math.ceil(b/a);if(this._maxbar===c&&this._cache)return this._cache;this._maxbar=c;for(var d=[],e=this._marksBySpan.length;e--;)if(this._marksBySpan[e]){for(var f=d,d=[],g=f.length,h=0,k=this._marksBySpan[e],m=k.length,n=Infinity,q=-Infinity,l=0;l<m;l++){for(var s=k[l],u=s.index;h<g;){var n=f[h],z=n.index;if(z<u)h++,d.push(n),q=z,n=Infinity;else{n=z;break}}n-u>=c&&u-q>=c&&(d.push(s),q=u)}for(;h<g;h++)d.push(f[h])}return this._cache=d};
Tickmarks.prototype.state=function(){for(var a=[],b=this._marksBySpan.length;b--;)this._marksBySpan[b]&&(a=a.concat(this._marksBySpan[b]));return{marks:a}};Tickmarks.prototype.restoreState=function(a){this._marksByIndex={};this._marksBySpan=[];delete this.maxIndex;delete this.minIndex;a&&a.marks&&a.marks.length&&this.merge(a.marks)};function TimePoint(a){this.m_date=a}TimePoint.prototype.date=function(){return this.m_date};TimePoint.prototype.setDate=function(a){this.m_date=a};var MONTH_NAMES=void 0,MINUTE_SPAN=20,HOUR_SPAN=30,DAY_SPAN=40,WEEK_SPAN=50,MONTH_SPAN=60,YEAR_SPAN=70,DEFAULT_BAR_SPACING=6,MAX_BAR_SPACING=50,MIN_BAR_SPACING=0.5,DEFAULT_RIGHT_OFFSET=5;function _createMonthNames(){return[$.t("Jan"),$.t("Feb"),$.t("Mar"),$.t("Apr"),$.t("May"),$.t("Jun"),$.t("Jul"),$.t("Aug"),$.t("Sep"),$.t("Oct"),$.t("Nov"),$.t("Dec")]}
function TimeScale(a,b){this._model=a;this._properties=b;this.m_width=0;this._defaultRightOffset=this._properties.rightOffset.value();this.m_rightOffset=this._properties.rightOffset.value();this.m_points=new TimeIndexes;this.m_barSpacing=this._properties.barSpacing.value();this.m_stateSnapshot=this.m_scaleStartPoint=this.m_scrollStartPoint=null;this.m_tickmarks=new Tickmarks;this._locked=!1}
TimeScale.prototype.reset=function(){this._visibleBarsCache=null;this.m_points=new TimeIndexes;this.m_stateSnapshot=this.m_scaleStartPoint=this.m_scrollStartPoint=null;this.m_tickmarks=new Tickmarks};TimeScale.prototype.restoreDefault=function(){this._visibleBarsCache=null;this.m_barSpacing=DEFAULT_BAR_SPACING;this.m_rightOffset=this._properties.rightOffset.value();this.saveDefault("barSpacing");this._correctOffset();this.recalcLockedScale()};TimeScale.prototype.rightOffset=function(){return this.m_rightOffset};
TimeScale.prototype.scrollToRealtime=function(a){var b=this._properties.rightOffset.value();if(a){var c=this;a=this.m_rightOffset;var d=this.m_width/this.m_barSpacing-10;0<d&&b>d&&(b=d);var e=this._model;$({offset:a}).animate({offset:b},{duration:1E3,easing:"easeInOutQuint",step:function(a){c._visibleBarsCache=null;c.m_rightOffset=a;e.recalculateAllPanes();e.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE));e.recalcVisibleRangeStudy(e.dataSources())}})}else this._visibleBarsCache=
null,this.m_rightOffset=b,this._correctOffset()};TimeScale.prototype.points=function(){return this.m_points};TimeScale.prototype.width=function(){return this.m_width};TimeScale.prototype.barSpacing=function(){return this.m_barSpacing};TimeScale.prototype.setWidth=function(a){this._visibleBarsCache=null;!isFinite(a)||0>=a||(this._locked&&this.m_width&&(this.m_barSpacing*=a/this.m_width),this.m_width=a,this._correctOffset())};
TimeScale.prototype.visibleBars=function(){if(this._visibleBarsCache)return this._visibleBarsCache;if(this.isEmpty())TradingView.logDebug("TimeScale.visibleBars: time scale is empty");else{var a=Math.ceil(this.m_width/this.m_barSpacing)-1,b=Math.round(this.m_rightOffset+this.m_points.lastTimePointIndex());return this._visibleBarsCache=a=new BarsRange(b-a,b)}};TimeScale.prototype.isEmpty=function(){return 0===this.m_width||0===this.m_points.size()};
TimeScale.prototype.indexToCoordinate=function(a,b){if(this.isEmpty())return TradingView.logDebug("TimeScale.indexToCoordinate: time scale is empty"),0;if(!isInteger(a))return TradingView.logDebug("TimeScale.indexToCoordinate: incorrect index"),0;var c=this.m_points.lastTimePointIndex()+this.m_rightOffset-a,c=this.m_width-(c+0.5)*this.m_barSpacing;return b?c:Math.round(c)};
TimeScale.prototype.barIndexesToCoordinates=function(a){a=a.toArray();for(var b=0;b<a.length;b++){var c=a[b].time,c=this.m_points.lastTimePointIndex()+this.m_rightOffset-c,c=this.m_width-(c+0.5)*this.m_barSpacing;a[b].time=Math.round(c);a[b].exactTime=c}};TimeScale.prototype.indexesToCoordinates=function(a){a=a.toArray();for(var b=0;b<a.length;b++){var c=a[b].x,c=this.m_points.lastTimePointIndex()+this.m_rightOffset-c;a[b].x=Math.round(this.m_width-(c+0.5)*this.m_barSpacing)}};
TimeScale.prototype.coordinateToIndex=function(a){a=(this.m_width+1-a)/this.m_barSpacing;a=this.m_points.lastTimePointIndex()+this.m_rightOffset-a;a=Math.round(1E6*a)/1E6;return Math.ceil(a)};TimeScale.prototype.alignCoordinate=function(a){if(this.isEmpty())return a;a=this.coordinateToIndex(a);return this.indexToCoordinate(a)};TimeScale.prototype.timePointToIndex=function(a){return this.m_points.indexOf(a,!0)};
TimeScale.prototype.indexToTimePoint=function(a){return(a=this.m_points.valueAt(a))?new Date(1E3*a):null};TimeScale.prototype.indexToUserTime=function(a){return this.m_tickmarks.indexToTime(a)};
TimeScale.prototype.marks=function(){if(this.isEmpty())return null;for(var a=this.m_barSpacing,b=Math.round(75/a),c=this.visibleBars(),d=Math.max(c.firstBar(),c.firstBar()-b),b=Math.max(c.lastBar(),c.lastBar()-b),a=this.m_tickmarks.build(a,75),c=[],e=0;e<a.length;++e){var f=a[e];if(d<=f.index&&f.index<=b){var g=this.m_tickmarks.indexToTime(f.index);null!==g&&c.push({coord:this.indexToCoordinate(f.index),label:this.formatLabel(g,f.span),span:f.span,major:f.label>=DAY_SPAN?1:0})}}return c};
TimeScale.prototype.state=function(a){var b={};b.m_barSpacing=this.barSpacing();b.m_rightOffset=this.m_rightOffset;a&&(0<this.m_points.size()&&(b.m_lastVisibleBar=this.m_points.valueAt(this.m_points.lastTimePointIndex())),b.points=this.m_points.state(),b.tickmarks=this.m_tickmarks.state(),b.width=this.m_width);return b};
TimeScale.prototype.restoreState=function(a,b,c){this._visibleBarsCache=null;void 0===a.m_barSpacing?TradingView.logDebug("TimeScale.restoreState: invalid state"):void 0===a.m_rightOffset?TradingView.logDebug("TimeScale.restoreState: invalid state"):(this.m_barSpacing=a.m_barSpacing,this.m_rightOffset=a.m_rightOffset,this.m_restoredLastTimePoint=a.m_lastVisibleBar,c&&this.m_restoredLastTimePoint&&(c=this.m_points.indexOf(this.m_restoredLastTimePoint),lastIndex=this.m_points.lastTimePointIndex(),offset=
lastIndex-c,this.m_rightOffset=-offset+a.m_rightOffset),b&&(this.m_points.restoreState(a.points),this.m_tickmarks.restoreState(a.tickmarks),a.width&&(this._locked=!0,0<this.m_width&&(this.m_barSpacing*=this.m_width/a.width))),this._correctOffset())};TimeScale.prototype.setOffset=function(a){this._visibleBarsCache=null;void 0===a?TradingView.logDebug("TimeScale.setOffset: invalid state"):(this.m_rightOffset=a,this._correctOffset())};
TimeScale.prototype.setBarSpacing=function(a){this._visibleBarsCache=null;void 0===a?TradingView.logDebug("TimeScale.setBarSpacing: invalid state"):this.m_barSpacing=a};TimeScale.prototype._correctOffset=function(){if(!this.isEmpty()){var a=this.m_width/this.m_barSpacing-10;0<a&&this.m_rightOffset>a&&(this.m_rightOffset=a,this._visibleBarsCache=null);a=this.m_points.size()-10;this.m_rightOffset<-a&&(this.m_rightOffset=-a,this._visibleBarsCache=null)}};
TimeScale.prototype.maxOffset=function(){return this.m_width/this.m_barSpacing-10};TimeScale.prototype.startScale=function(a){this.m_scrollStartPoint&&this.endScroll();null!==this.m_scaleStartPoint||null!==this.m_stateSnapshot||this.isEmpty()||(this.m_scaleStartPoint=a,this.m_stateSnapshot=this.state())};
TimeScale.prototype.scaleTo=function(a){this._visibleBarsCache=null;delete this.m_restoredLastTimePoint;if(null!==this.m_stateSnapshot){a=MathEx.clamp(this.m_width-a,0,this.m_width);var b=MathEx.clamp(this.m_width-this.m_scaleStartPoint,0,this.m_width);0!==a&&0!==b&&(this.m_barSpacing=this.m_stateSnapshot.m_barSpacing*a/b,this.m_barSpacing<MIN_BAR_SPACING?this.m_barSpacing=MIN_BAR_SPACING:this.m_barSpacing>MAX_BAR_SPACING&&(this.m_barSpacing=MAX_BAR_SPACING),this._correctOffset(),this.recalcLockedScale())}};
TimeScale.prototype.endScale=function(){null!==this.m_scaleStartPoint&&(this.m_stateSnapshot=this.m_scaleStartPoint=null,this.saveDefault("barSpacing"))};TimeScale.prototype.saveDefault=function(a){TradingView.saveDefaultProperties(!0);this._properties[a].setValue(this["m_"+a]);TradingView.saveDefaultProperties(!1)};TimeScale.prototype.startScroll=function(a){null!==this.m_scrollStartPoint||null!==this.m_stateSnapshot||this.isEmpty()||(this.m_scrollStartPoint=a,this.m_stateSnapshot=this.state())};
TimeScale.prototype.scrollTo=function(a){this._visibleBarsCache=null;delete this.m_restoredLastTimePoint;null!==this.m_scrollStartPoint&&(a=(this.m_scrollStartPoint-a)/this.barSpacing(),this.m_rightOffset=this.m_stateSnapshot.m_rightOffset+a,this._correctOffset(),this._model.mainSeries().priceScale().properties().percentage.value()&&this.recalcLockedScale())};
TimeScale.prototype.scrollToOffsetAnimated=function(a,b){if(!isFinite(a))throw new RangeError("offset is required and must be finite number");void 0===b&&(b=400);if(!isFinite(b)||0>=b)throw new RangeError("animationDuration (optional) must be finite positive number");var c=this,d=this.m_rightOffset,e=+new Date,f=this._model;(function h(){c._visibleBarsCache=null;var k=(new Date-e)/b;1<=k?(c.m_rightOffset=a,c._visibleBarsCache=null,f.recalculateAllPanes(),f.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))):
(c.m_rightOffset=d+(a-d)*k,f.recalculateAllPanes(),setTimeout(h,20))})()};TimeScale.prototype.endScroll=function(){null!==this.m_scrollStartPoint&&(this.m_stateSnapshot=this.m_scrollStartPoint=null)};TimeScale.prototype._currentSavedPosition=function(){if(!this.isEmpty()){var a=this.m_points.indexOf(this.m_restoredLastTimePoint,!0);isInteger(a)&&(a=this.m_points.lastTimePointIndex()-a,this.m_rightOffset-=a);delete this.m_restoredLastTimePoint}};
TimeScale.prototype.update=function(a,b,c,d){this._visibleBarsCache=null;this.m_tickmarks.merge(d);this.m_points.merge(a,b,c);this.m_restoredLastTimePoint&&this._currentSavedPosition()};TimeScale.prototype.addTail=function(a,b,c){a=a.params;b=this.m_tickmarks.maxIndex+(c?0:1);for(var d=0;d<a.marks.length;d++)a.marks[d].index=b+d;this.m_tickmarks.merge(a.marks);this.m_points.addTail(a.changes,c);this.m_rightOffset-=a.changes.length};
TimeScale.prototype.formatLabel=function(a,b){if(!(a&&a instanceof Date))return"incorrect time";var c=this._model.mainSeries().isDWM();return b<MINUTE_SPAN&&!c?numberToStringWithLeadingZero(a.getUTCHours(),2)+":"+numberToStringWithLeadingZero(a.getUTCMinutes(),2)+":"+numberToStringWithLeadingZero(a.getUTCSeconds(),2):b<DAY_SPAN&&!c?numberToStringWithLeadingZero(a.getUTCHours(),2)+":"+numberToStringWithLeadingZero(a.getUTCMinutes(),2):b<WEEK_SPAN||b<MONTH_SPAN?a.getUTCDate():b<YEAR_SPAN?(MONTH_NAMES||
(MONTH_NAMES=_createMonthNames()),MONTH_NAMES[a.getUTCMonth()]):a.getUTCFullYear()};TimeScale.prototype.normalizeBarIndex=function(a){var b=0,c=0;a<this.m_points.firstTimePointIndex()?(b=this.m_points.valueAt(this.m_points.firstTimePointIndex()),c=a-this.m_points.firstTimePointIndex()):a>this.m_points.lastTimePointIndex()?(b=this.m_points.valueAt(this.m_points.lastTimePointIndex()),c=a-this.m_points.lastTimePointIndex()):(b=this.m_points.valueAt(a),c=0);return{time_t:b,offset:c}};
TimeScale.prototype.denormalizeTimePoint=function(a){var b=this.m_points.indexOf(a.time_t);return void 0===b?void 0:b+a.offset};TimeScale.prototype.zoomToBarsRange=function(a,b){if(!(b<=a)){var c=this.m_points.lastTimePointIndex();c&&(this.m_rightOffset=b-c);this.m_barSpacing=this.width()/(b-a+1);this._visibleBarsCache=null}};
TimeScale.prototype.recalcLockedScale=function(){if(this._model.m_mainSeries.properties().lockScale.value()&&!this.isEmpty()){var a=this._model.m_mainSeries.priceScale(),b=this._model.m_mainSeries,c=b.data().boxSize;c||(b.fixBoxSize(),c=b.data().boxSize);if(c){if(a.properties().percentage.value())var d=b.data().search(b.getRealVisibleRange().m_firstBar).value[CLOSE_PLOT],c=PriceRange.prototype.convertToPercent.call(null,d+c,d)-PriceRange.prototype.convertToPercent.call(null,d,d);c=a.internalHeight()/
(this.barSpacing()/c);a=b.priceScale().priceRange();a&&c==a.length()||(!a||a.isEmpty()?(a=this.visibleBars(),a=b.priceRange(a.firstBar(),a.lastBar())):(c=(c-a.length())/2,a.m_minValue-=c,a.m_maxValue+=c),b.priceScale().setPriceRange(a))}}};TimeScale.prototype.correctBarSpacing=function(){!this.isEmpty()&&this.points().size()<this.width()/this.barSpacing()&&(this.setOffset(DEFAULT_RIGHT_OFFSET),this.setBarSpacing(Math.min(this.width()/(this.points().size()+this.rightOffset()),MAX_BAR_SPACING)))};
TimeScale.prototype.canZoomIn=function(){return this.m_barSpacing<MAX_BAR_SPACING};TimeScale.prototype.canZoomOut=function(){return this.m_barSpacing>MIN_BAR_SPACING};function SelectionRenderer(a){this._data=a}SelectionRenderer.RADIUS=3.5;SelectionRenderer.prototype.tolerance=2;SelectionRenderer.prototype.draw=function(a){if(this._data){a.strokeStyle="#6B6B6B";a.fillStyle="#D6D6D6";for(var b=this._data.vertOffset||0,c=0;c<this._data.points.size();c++){var d=this._data.points.item(c);void 0===d.x||isNaN(d.x)||null===d.x||void 0===d.y||isNaN(d.y)||null===d.y||this._drawMarker(a,d,b)}}};
SelectionRenderer.prototype._drawMarker=function(a,b,c){a.beginPath();a.arc(b.x+0.5,b.y+0.5+c,SelectionRenderer.RADIUS,0,2*Math.PI,!0);a.closePath();a.fill();a.stroke()};SelectionRenderer.prototype.hitTest=function(a){if(!this._data)return null;for(var b=0;b<this._data.points.size();b++){var c=this._data.points.item(b);if(c.substract(a).length()<=SelectionRenderer.RADIUS+this.tolerance)return new HitTestResult(this._data.hittestResult,c.data)}return null};
function LineAnchor(a,b){this._data=a;this._model=b;this.radius=this._data.radius||LineAnchor.OUTER_RADIUS}LineAnchor.OUTER_RADIUS=TradingView.isMobile.any()?16:8;LineAnchor.prototype.tolerance=2;
LineAnchor.prototype.draw=function(a){for(var b=this._data.currentPoint,c=this._data.outerStrokeWidth||1,d=0;d<this._data.points.size();d++){var e=this._data.points.item(d),f=e.substract(b).length(),g=isInteger(e.data)&&this._data.linePointBeingEdited===e.data,h=this.radius,k=this._data.strokeWidth||2,f=f<=h+this.tolerance?1:0,h=h+f,k=k+f;g||(e.square?(a.fillStyle=this._data.backgroundColor,a.fillRect(e.x-h,e.y-h,2*h,2*h),a.fillStyle=this._data.color,g=h-c,a.fillRect(e.x-g,e.y-g,2*g,2*g),g=h-c-k,
a.fillStyle=this._data.backgroundColor,a.fillRect(e.x-g,e.y-g,2*g,2*g)):(a.beginPath(),a.arc(e.x,e.y,h,0,2*Math.PI,!0),a.closePath(),a.fillStyle=this._data.backgroundColor,a.fill(),a.beginPath(),a.arc(e.x,e.y,h-c,0,2*Math.PI,!0),a.closePath(),a.fillStyle=this._data.color,a.fill(),a.beginPath(),a.arc(e.x,e.y,h-c-k,0,2*Math.PI,!0),a.closePath(),a.fillStyle=this._data.backgroundColor,a.fill()))}};
LineAnchor.prototype.hitTest=function(a){for(var b=0;b<this._data.points.size();b++){var c=this._data.points.item(b);if(c.substract(a).length()<=this.radius+this.tolerance)return new HitTestResult(this._data.hittestResult,c.data)}return null};SelectionRendererArrowsUpDown=function(a){SelectionRenderer.call(this,a)};inherit(SelectionRendererArrowsUpDown,SelectionRenderer);
SelectionRendererArrowsUpDown.prototype._drawMarker=function(a,b,c){var d=b.isUp?1:-1,e=PaneRendererArrowsUpDown.prototype._calculateVerticalOffset(this._data.barSpacing),f=PaneRendererArrowsUpDown.prototype._calculateMinHeight(this._data.barSpacing);c=c+d*e+d*f;a.beginPath();a.arc(b.x+0.5,b.y+0.5+c,SelectionRenderer.RADIUS,0,2*Math.PI,!0);a.closePath();a.fill();a.stroke()};function CompositeRenderer(){this._renderers=new List}CompositeRenderer.prototype.append=function(a){this._renderers.append(a)};CompositeRenderer.prototype.draw=function(a){for(var b=0;b<this._renderers.size();b++)a.save(),this._renderers.item(b).draw(a),a.restore()};CompositeRenderer.prototype.drawBackground=function(a){for(var b=0;b<this._renderers.size();b++)this._renderers.item(b).drawBackground&&this._renderers.item(b).drawBackground(a)};
CompositeRenderer.prototype.hitTest=function(a){for(var b=this._renderers.size()-1;0<=b;b--){var c=this._renderers.item(b).hitTest(a);if(c)return c}return!1};function SelectionIndexes(){}SelectionIndexes.DENSITY=10;SelectionIndexes.prototype.calc=function(a,b){for(var c=new List,d=a;d<=b;d++)0===d%SelectionIndexes.DENSITY&&c.append(d);return c};function LineToolPriceAxisView(a,b){PriceAxisView.call(this,a,b);this._linetool=a;this._pointIndex=b;this._text="";this._coordinate=0;this._background="#5592C9";this._activeBackground="#0F6DBF";this._borderColor="#2E84A6";this._color="white";this._textHeight=14;this._invalidated=!0;this._model=a._model}inherit(LineToolPriceAxisView,PriceAxisView);LineToolPriceAxisView.prototype.update=function(){this._invalidated=!0};LineToolPriceAxisView.prototype.setActive=function(a){this._active=a};
LineToolPriceAxisView.prototype._updateImpl=function(){this._visible=!1;this._text="";if(this._model.timeScale()&&!this._model.timeScale().isEmpty()&&this._linetool.priceScale()&&!this._linetool.priceScale().isEmpty()&&this._model.selectedSource()===this._linetool&&!(this._model.timeScale().visibleBars().isEmpty()||this._linetool.points().size()<=this._pointIndex)){var a=this._linetool.points().item(this._pointIndex);if(isFinite(a.price)){var b=this._linetool.priceScale();if(b.isPercent()){var c=
this._linetool.ownerSource().firstValue();if(!isNumber(c))return;a.price=b.priceRange().convertToPercent(a.price,c)}this._text=b.formatter().format(a.price);this._coordinate=b.priceToCoordinate(a.price);this._textHeight=b.m_markBuilder.fontHeight();this._visible=!0}}};
LineToolPriceAxisView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return new PriceAxisViewRenderer({text:this._text,coordinate:this._coordinate,color:this._color,borderColor:this._borderColor,background:this._active?this._activeBackground:this._background,textHeight:this._textHeight,visible:this._visible})};LineToolPriceAxisView.prototype.text=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return PriceAxisView.prototype.text.call(this)};
function LineToolTimeAxisView(a,b){TimeAxisView.call(this);this._linetool=a;this._pointindex=b;this._model=a._model;this._text="";this._coordinate=0;this._background="#5592C9";this._activeBackground="#0F6DBF";this._borderColor="#2E84A6";this._color="white";this._visible=!1;this._textHeight=14}inherit(LineToolTimeAxisView,TimeAxisView);LineToolTimeAxisView.prototype.setActive=function(a){this._active=a};
LineToolTimeAxisView.prototype.update=function(){this._visible=!1;if(!(this._model.timeScale().isEmpty()||this._linetool.points().size()<=this._pointindex||this._linetool!==this._model.selectedSource())){this._text="";var a=this._linetool.points().item(this._pointindex).index;this._coordinate=this._model.timeScale().indexToCoordinate(a);if(a=this._model.timeScale().indexToUserTime(a))this._text=(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(a);this._visible=!0}};
LineToolTimeAxisView.prototype.renderer=function(){return new TimeAxisViewRenderer({text:this._text,coordinate:this._coordinate,color:this._color,background:this._active?this._activeBackground:this._background,borderColor:this._borderColor,textHeight:this._textHeight,visible:this._visible})};
function LineDataSource(a,b,c){DataSource.call(this);this._model=a;this._properties=c;c.visible&&c.frozen||this._properties.merge(defaults("linetool"));$.isArray(b)?this._paneViews=b:this._paneViews=[b];this._points=new List;this._fixedPoints=new List;this._timePoint=new List;this._properties.symbol||(this._properties.merge({symbol:a.mainSeries().symbol()}),(b=a.mainSeries().symbolInfo())&&this._properties.merge({symbolInfo:{listed_exchange:b.listed_exchange,short_name:b.name}}));this._properties.interval||
this._properties.merge({interval:a.mainSeries().interval()});this._properties.addExclusion&&(this._properties.addExclusion("symbol"),this._properties.addExclusion("symbolInfo"),this._properties.addExclusion("points"),this._properties.addExclusion("interval"),this._properties.addExclusion("visible"));this.calcIsActualSymbol();this._properties.listeners().subscribe(this,LineDataSource.prototype.propertiesChanged);this._createPointsProperties();"_tooltipFieldsHash"in this&&!this.hasOwnProperty("_tooltipFieldsHash")&&
(this._tooltipFieldsHash=$.extend(!0,{},this._tooltipFieldsHash));this.m_priceAxisViews=new List;this.m_timeAxisViews=new List;if(0<this.pointsCount())for(a=0;a<this.pointsCount();a++)this.m_priceAxisViews.append(new LineToolPriceAxisView(this,a)),this.m_timeAxisViews.append(new LineToolTimeAxisView(this,a));this._properties.visible.listeners().subscribe(this,function(a){a.value()||this._model.selectedSource()!=this||this._model.setSelectedSource(null)})}inherit(LineDataSource,DataSource);
LineDataSource.LINEEND_NORMAL=0;LineDataSource.LINEEND_ARROW=1;LineDataSource.LINEEND_CIRCLE=2;LineDataSource.PointPriceProperty=function(a,b){Property.call(this);this._lineSource=a;this._pointIndex=b};inherit(LineDataSource.PointPriceProperty,Property);LineDataSource.prototype.getType=function(){return TradingView.className(this.constructor)};LineDataSource.prototype.getConstructor=function(){return this._constructor||null};LineDataSource.prototype.isActualSymbol=function(){return this._isActualSymbol};
LineDataSource.prototype.calcIsActualSymbol=function(){var a=this._properties,b=this._model.mainSeries(),c=b.symbolInfo();this._isActualSymbol=c&&a.symbolInfo?a.symbolInfo.listed_exchange.value()===c.listed_exchange&&a.symbolInfo.short_name.value()===c.name:a.symbol.value()===b.symbol()||a.symbol.value().split(":").slice(-1)[0]===b.symbol().split(":").slice(-1)[0]};LineDataSource.PointPriceProperty.prototype.value=function(){var a=this._lineSource.points().item(this._pointIndex).price;return parseFloat(this._lineSource.priceScale().formatter().format(a))};
LineDataSource.PointPriceProperty.prototype.setValue=function(a){var b=this._lineSource.points().item(this._pointIndex);b.price=parseFloat(a);this._lineSource.setPoint(this._pointIndex,b);this._lineSource._model.updateSource(this._lineSource);this._listeners.fire(this);this._lineSource.endChanging()};LineDataSource.PointIndexProperty=function(a,b){Property.call(this);this._lineSource=a;this._pointIndex=b};inherit(LineDataSource.PointIndexProperty,Property);
LineDataSource.PointIndexProperty.prototype.value=function(){return this._lineSource.points().item(this._pointIndex).index};
LineDataSource.PointIndexProperty.prototype.setValue=function(a){var b=this._lineSource.points().item(this._pointIndex);b.index=a;a=this._lineSource.priceScale();if(a.isPercent()){var c=this._lineSource.ownerSource().firstValue();b.price=a.priceRange().convertToPercent(b.price,c)}this._lineSource.setPoint(this._pointIndex,b);this._lineSource._model.updateSource(this._lineSource);this._listeners.fire(this);this._lineSource.endChanging()};
LineDataSource.prototype._createPointsProperties=function(){this._properties.addProperty("points");for(var a=this._properties.points,b=0;b<this.pointsCount();b++){a.addProperty(b);var c=a[b];c.addProperty("price");c.price=new LineDataSource.PointPriceProperty(this,b);c.addProperty("bar");c.bar=new LineDataSource.PointIndexProperty(this,b)}};LineDataSource.prototype.priceScale=function(){return this._ownerSource?this._ownerSource.m_priceScale:null};LineDataSource.prototype.symbol=function(){return this._properties.symbol.value()};
LineDataSource.prototype.properties=function(){return this._properties};LineDataSource.prototype.isSavedInStudyTemplates=function(){return!1};
LineDataSource.prototype.state=function(a){var b={type:TradingView.className(this.constructor),id:this.id(),state:this.properties().state(),points:this._timePoint.toArray(),zorder:this.zorder()};delete b.state.points;a&&(b.indexes=this._points.toArray());this.ownerSource()&&(b.ownerSource=this.ownerSource().id());this.isFixed()&&(b.positionPercents=this._positionPercents.toArray());"version"in this&&1!==this.version&&(b.version=this.version);return b};
LineDataSource.prototype.template=function(){var a=this.properties().state();delete a.points;delete a.symbol;delete a.symbolInfo;return a};LineDataSource.prototype.restoreTemplate=function(a){delete a.symbolInfo;this._model._undoModel.drawingLoadTemplate(this,a)};LineDataSource.prototype.clearData=function(){this._points=new List};LineDataSource.prototype.currentPointsetId=function(){return"pointset_"+this._currentPointsetId};
LineDataSource.prototype.stop=function(){this._currentPointsetId&&(this._model.chartApi().removePointset(this.currentPointsetId()),this._currentPointsetId=null)};LineDataSource.prototype.isStarted=function(){return!!this._currentPointsetId};LineDataSource.prototype.restart=function(){this.isFixed()||(this._currentPointsetId=0,this.createServerPoints())};LineDataSource.prototype.tryCreateServerPoints=function(){this.isFixed()||this._currentPointsetId||this.createServerPoints()};
LineDataSource.prototype.normalizePoint=function(a){var b=this._model.timeScale().normalizeBarIndex(a.index);b.price=a.price;return b};LineDataSource.prototype.normalizePoints=function(){this._timePoint.clear();for(var a=0;a<this._points.size();a++){var b=this._model.timeScale().normalizeBarIndex(this._points.item(a).index);if(!b.time_t){this._timePoint.clear();break}b.price=this._points.item(a).price;this._timePoint.append(b)}};
LineDataSource.prototype.denormalizeTimePoints=function(){for(var a=[],b=0;b<this._timePoint.size();b++){var c=this._model.timeScale().denormalizeTimePoint(this._timePoint.item(b));if(void 0===c){a=[];break}else a.push({index:c,price:this._timePoint.item(b).price})}0<a.length&&(this._points=new List(a))};LineDataSource.prototype.restorePoints=function(a,b,c){this._timePoint=new List(a);this._points=new List(b);c||this.denormalizeTimePoints()};
LineDataSource.prototype.restorePositionPercents=function(a){this._positionPercents=new List(a)};LineDataSource.prototype.propertiesChanged=function(){this.updateAllViews();this._model.updateSource(this)};
LineDataSource.prototype.points=function(){for(var a=[],b=0;b<this._points.size();b++){var c=this._points.item(b);a.push({index:c.index,price:c.price,time:c.time})}this._lastPoint&&a.push({index:this._lastPoint.index,price:this._lastPoint.price,time:this._lastPoint.time});a=new List(a);this._currentMovingPoint&&this._startMovingPoint&&this.correctPoints(a);return a};
LineDataSource.prototype.fixedPoints=function(){var a=new List;if(this._positionPercents&&!this.priceScale().isEmpty())for(var b=0;b<this._positionPercents.size();b++){var c=this._positionPercents.item(b),d=this._model.timeScale().width()*c.x,c=this.priceScale().height()*c.y;a.append(new MathEx.Point(d,c))}else for(b=0;b<this._fixedPoints.size();b++)a.append(this._fixedPoints.item(b).clone());this._lastPoint&&a.append(this._lastPoint.clone());this._currentMovingPoint&&this._startMovingPoint&&this.correctFixedPoints(a);
return a};LineDataSource.prototype.addPoint=function(a,b){b&&b.shift&&2<=this.points().size()&&this._properties.snapTo45Degrees&&this._snapPoint45Degree(a,this.points().item(this.points().size()-2));var c=this.priceScale();if(c.isPercent()){var d=this.ownerSource().firstValue();a.price=c.priceRange().convertFromPercent(a.price,d)}this._points.append(a);(c=this._points.size()==this.pointsCount())?(this._lastPoint=null,this.normalizePoints(),this.createServerPoints()):this._lastPoint=a;return c};
LineDataSource.prototype.addFixedPoint=function(a){this._fixedPoints.append(a);(a=this._fixedPoints.size()==this.pointsCount())&&this.calcPositionPercents();return a};LineDataSource.prototype.calcPositionPercents=function(){if(this.priceScale()&&!this.priceScale().isEmpty()){this._positionPercents=new List;for(var a=0;a<this._fixedPoints.size();a++){var b=this._fixedPoints.item(0),c=b.x/this._model.timeScale().width(),b=b.y/this.priceScale().height();this._positionPercents.append({x:c,y:b})}}};
LineDataSource.prototype.restoreFixedPoints=function(){this._fixedPoints=this.fixedPoints()};
LineDataSource.prototype.onData=function(a){if(a.params.customId===this.currentPointsetId()&&0!==a.params.plots.length){for(var b=0;b<a.params.plots.length;b++){var c=a.params.plots[b],d=this._timePoint.item(c.index),d={index:c.value[0],time:new Date(1E3*c.value[1]),price:d.price};this._points.size()<=c.index?this._points.append(d):this._points.setItem(c.index,d)}this.checkAlert&&this.checkAlert();this.updateAllViews();this._model.updateSource(this)}};
LineDataSource.prototype.correctPricesToPercents=function(){for(var a=this.priceScale(),b=this.ownerSource().firstValue(),c=0;c<this._points.size();c++){var d=this._points.item(c);d.price=a.priceRange().convertFromPercent(d.price,b)}};LineDataSource.prototype.startChanging=function(a,b){a<this.m_priceAxisViews.size()&&this.m_priceAxisViews.item(a).setActive(!0);a<this.m_timeAxisViews.size()&&this.m_timeAxisViews.item(a).setActive(!0)};
LineDataSource.prototype.setPoint=function(a,b,c){c&&c.shift&&this._properties.snapTo45Degrees&&(c=0===a?1:a-1,this._snapPoint45Degree(b,this.points().item(c)));c=this.priceScale();if(c.isPercent()){var d=this.ownerSource().firstValue();b.price=c.priceRange().convertFromPercent(b.price,d)}this._points.setItem(a,b);this.normalizePoints()};
LineDataSource.prototype.startMoving=function(a){var b=this.priceScale();if(b.isPercent()){var c=this.ownerSource().firstValue();a.price=b.priceRange().convertFromPercent(a.price,c)}this._startMovingPoint=a};LineDataSource.prototype.move=function(a){var b=this.priceScale();if(b.isPercent()){var c=this.ownerSource().firstValue();a.price=b.priceRange().convertFromPercent(a.price,c)}this._currentMovingPoint=a;this.updateAllViews()};
LineDataSource.prototype.correctPoints=function(a){for(var b=this._currentMovingPoint.index-this._startMovingPoint.index,c=this._currentMovingPoint.price-this._startMovingPoint.price,d=0;d<a.size();d++){var e=a.item(d);e.index+=b;e.price+=c;a.setItem(d,e)}};LineDataSource.prototype.correctFixedPoints=function(a){for(var b=this._currentMovingPoint.substract(this._startMovingPoint),c=0;c<a.size();c++)a.setItem(c,a.item(c).add(b))};
LineDataSource.prototype.endMoving=function(){this._properties.interval.setValue(this._model.mainSeries().interval());var a=!1;this._currentMovingPoint&&this._startMovingPoint&&(a=this._currentMovingPoint.index!=this._startMovingPoint.index,this.isFixed()?this.correctFixedPoints(this._fixedPoints):this.correctPoints(this._points),this._currentMovingPoint=this._startMovingPoint=null);this.isFixed()?(this.calcPositionPercents(),this.updateAllViews()):(this.normalizePoints(),this.updateAllViews(),a&&
this.createServerPoints())};LineDataSource.prototype.endChanging=function(){this._properties.interval.setValue(this._model.mainSeries().interval());this.normalizePoints();this.createServerPoints();for(var a=0;a<this.m_priceAxisViews.size();a++)this.m_priceAxisViews.item(a).setActive(!1);for(a=0;a<this.m_timeAxisViews.size();a++)this.m_timeAxisViews.item(a).setActive(!1)};
LineDataSource.prototype.paneViews=function(a){if(!this._isActualSymbol||!this._properties.visible.value()||TradingView.drawingState.hideAllDrawings().value()&&this.userEditEnabled())return null;a=new List;for(var b=this._paneViews.length-1;0<=b;--b)a.append(this._paneViews[b]);return a};LineDataSource.prototype.dataWindowView=function(){return null};LineDataSource.prototype.statusView=function(){return null};
LineDataSource.prototype.priceAxisViews=function(a,b){if(this._isActualSymbol&&a.dataSources().contains(this)&&b===this.priceScale()){var c=new List;if(this._model.lineBeingEdited()===this){var d=this._model.linePointBeingEdited();if(d<this.m_priceAxisViews.size()){var c=this.m_priceAxisViews.clone(),e=c.item(d);c.removeAt(d);c.append(e);return c}}return this.m_priceAxisViews}return null};
LineDataSource.prototype.timeAxisViews=function(){if(this._model.lineBeingEdited()===this){var a=this._model.linePointBeingEdited();if(a<this.m_timeAxisViews.size()){var b=this.m_timeAxisViews.clone(),c=b.item(a);b.removeAt(a);b.append(c);return b}}return this.m_timeAxisViews};
LineDataSource.prototype.updateAllViews=function(){var a=this.paneViews();if(null!==a)for(var b=0;b<a.size();b++)a.item(b).update();for(b=0;b<this.m_priceAxisViews.size();b++)this.m_priceAxisViews.item(b).update();for(b=0;b<this.m_timeAxisViews.size();b++)this.m_timeAxisViews.item(b).update()};
LineDataSource.prototype.setLastPoint=function(a,b){b&&b.shift&&2<=this.points().size()&&this._properties.snapTo45Degrees&&this._snapPoint45Degree(a,this.points().item(this.points().size()-2));var c=this.priceScale();if(c.isPercent()){var d=this.ownerSource().firstValue();a.price=c.priceRange().convertFromPercent(a.price,d)}this._lastPoint=a;this.updateAllViews()};LineDataSource.prototype.setLastFixedPoint=function(a){this._lastFixedPoint=a;this.updateAllViews()};LineDataSource.prototype.title=function(){return"Line Tool"};
LineDataSource._pointSetId=1;LineDataSource.prototype.start=function(){this.createServerPoints()};
LineDataSource.prototype.createServerPoints=function(){if(!this._recursiveGuard&&this._isActualSymbol&&this._model.chartApi().connected()&&(this._currentPointsetId&&this._model.chartApi().removePointset(this.currentPointsetId()),!this._model.timeScale().isEmpty()&&(0===this._timePoint.size()&&this.normalizePoints(),0!==this._timePoint.size()))){this._currentPointsetId=++LineDataSource._pointSetId;for(var a=this._model.mainSeries().symbolId(),b=this.properties().interval.value(),c=[],d=0;d<this._timePoint.size();d++){var e=
this._timePoint.item(d);c.push([e.time_t,e.offset])}var f=this;this._model.chartApi().createPointset(this.currentPointsetId(),"turnaround",a,b,c,function(a){f.onData(a)})}};LineDataSource.prototype.isBeingEdited=function(){return this===this._model.lineBeingEdited()||this===this._model.sourceBeingMoved};LineDataSource.prototype.isFixed=function(){return this.properties().locked&&this.properties().locked.value()};
LineDataSource.prototype.isLocked=LineDataSource.prototype.isFrozen=function(){return this.properties().frozen&&this.properties().frozen.value()};LineDataSource.prototype._tooltipFieldsHash={};LineDataSource.prototype._tooltipFieldsOrder="time price index time0 price0 time1 price1 time2 price2 time3 price3 time4 price4 distance term pointsPerBar".split(" ");LineDataSource.prototype._tooltipFieldsOrdered=null;
LineDataSource.prototype._formatTooltip=function(){null===this._tooltipFieldsOrdered&&(this._tooltipFieldsOrdered=new OrderedHash(this._tooltipFieldsHash,OrderedHash.byOrder(this._tooltipFieldsOrder)));return this._tooltipFieldsOrdered.array.filter(function(a){return null!==a.value&&""!==a.value}).map(function(a){return"<span>"+a.title+":</span> "+a.value}).join("<br />")};
LineDataSource.prototype.pointToScreenPoint=function(a){var b=this._model.timeScale(),c=this.priceScale();if(!c||c.isEmpty()||b.isEmpty())return new MathEx.Point(0,0);var d=null;if(c.isPercent()){if(!this.ownerSource())return;d=this.ownerSource().firstValue();if(null===d||!isFinite(d))return}var e=b.indexToCoordinate(a.index,!0),f=a.price;c.isPercent()&&(f=c.priceRange().convertToPercent(f,d));var g=c.priceToCoordinate(f,!0),d=new MathEx.Point(e,g),e=b.indexToCoordinate(a.index,!1),g=c.priceToCoordinate(f,
!1);a=new MathEx.Point(e,g);return[d,a]};LineDataSource.prototype.screenPointToPoint=function(a){var b=this._model.timeScale(),c=this.priceScale(),b=b.coordinateToIndex(a.x);a=c.coordinateToPrice(a.y);var d=null;if(c.isPercent()){if(!this.ownerSource())return;d=this.ownerSource().firstValue();if(null===d||!isFinite(d))return}c.isPercent()&&(a=c.priceRange().convertFromPercent(a,d));return{price:a,index:b}};LineDataSource.prototype.tags=function(){return[this._constructor]};
LineDataSource.prototype._snapPoint45Degree=function(a,b,c){var d=this._model.timeScale(),e=d.indexToCoordinate(b.index),f=d.indexToCoordinate(a.index)-e,g=this.m_priceScale,h=b.price,k=a.price;firstValue=this.ownerSource().firstValue();g.isPercent()&&(h=g.priceRange().convertToPercent(h,firstValue));var m=g.priceToCoordinate(h),k=g.priceToCoordinate(k)-m;switch(Math.round(4*(Math.atan2(f,k)/Math.PI))){case 2:case -2:if(!c){a.price=h;break}case 0:case 4:case -4:if(!c){a.index=b.index;break}default:h=
Math.sqrt(f*f+k*k),c=0>f?-1:1,b=0>k?-1:1,f=Math.max(Math.abs(k),Math.abs(f)),k=f*Math.sqrt(2)/h,f=Math.round(d.coordinateToIndex(e+f/k*c)),correctedDiff=Math.abs(d.indexToCoordinate(f)-e),d=g.coordinateToPrice(m+correctedDiff*b),a.index=f,a.price=d}};LineDataSource.prototype.version=1;LineDataSource.isLineTool=function(a){return(a=TradingView[a])?isInherited(a,LineDataSource):!1};TradingView.StudyLineDataSource=function(a,b,c,d){var e=new LineToolBeingCreatedPaneView(this,a);b.push(e);LineDataSource.call(this,a,b,c);this.properties().listeners().subscribe(this,TradingView.StudyLineDataSource.prototype.changeStyles);this._constructor=d;this._inputs=this._graphics=this._metaInfo=this._indexes=this._nonseriesdata=this._studyId=null};inherit(TradingView.StudyLineDataSource,LineDataSource);
TradingView.StudyLineDataSource.prototype.pointsCount=function(){throw Error("Reimplement this in a child class");};TradingView.StudyLineDataSource.prototype.title=function(){return this._metaInfo.description};TradingView.StudyLineDataSource.prototype.studyId=function(){return this._metaInfo.id};TradingView.StudyLineDataSource.prototype._requestStudy=function(){throw Error("Reimplement this in a child class");};
TradingView.StudyLineDataSource.prototype.changeStyles=function(){if(this._inputs){var a=TradingView.StudyVersioning.splitInputs(this.properties().inputs.state()),a=a.obj,b;for(b in a)if(a[b]!==this._inputs[b]){this._inputs=a;this._requestStudy();break}}else{var a=TradingView.StudyVersioning.splitInputs(this.properties().inputs.state());this._inputs=TradingView.clone(a.obj);this._requestStudy()}};
TradingView.StudyLineDataSource.prototype._checkTurnaround=function(a){return a===this._turnaround||a==this._model.mainSeries()._turnaround||a===this._model.mainSeries()._turnaround+"_"+this._turnaround};TradingView.StudyLineDataSource.prototype.stop=function(){LineDataSource.prototype.stop.call(this);this._studyId&&this._model.chartApi().removeStudy(this._studyId)};TradingView.StudyLineDataSource.prototype.onData=function(a){throw Error("Reimplement this in a child class");};
TradingView.StudyLineDataSource.prototype._correctedPoint=function(a){var b=parseInt(this._model.mainSeries().bars().first(),10),c=parseInt(this._model.mainSeries().bars().last(),10);a.index=Math.max(a.index,b);a.index=Math.min(a.index,c);return a};TradingView.StudyLineDataSource.prototype.addPoint=function(a){return LineDataSource.prototype.addPoint.call(this,this._correctedPoint(a))};
TradingView.StudyLineDataSource.prototype.setLastPoint=function(a){return LineDataSource.prototype.setLastPoint.call(this,this._correctedPoint(a))};TradingView.StudyLineDataSource.prototype.move=function(a){};TradingView.StudyLineDataSource.prototype.clearData=function(){this._indexes=this._nonseriesdata=null;this._graphics=new TradingView.StudyGraphics(this._metaInfo);this.updateAllViews()};
TradingView.StudyLineDataSource.prototype.state=function(a){var b=LineDataSource.prototype.state.call(this,a);a&&(b.nonseriesdata=this._nonseriesdata,b.nonseriesindexes=this._indexes,b.graphics=this._graphics.graphics());this.metaInfo()instanceof StudyMetaInfo?b.metaInfo=this.metaInfo().state():(b.metaInfo=$.extend({},this.metaInfo()),b.metaInfo.id=StudyMetaInfo.parseIdString(b.metaInfo.id+(b.metaInfo.version?"-"+b.metaInfo.version:"")).fullId);return b};
TradingView.StudyLineDataSource.prototype.restoreData=function(a){this._nonseriesdata=a.nonseriesdata?a.nonseriesdata:null;this._indexes=a.nonseriesindexes?a.nonseriesindexes:null;this._graphics.setGraphics(a.graphics?a.graphics:TradingView.StudyGraphics.emptyGraphics())};TradingView.StudyLineDataSource.prototype.setPoint=function(a,b){this._indexes=this._nonseriesdata=null;LineDataSource.prototype.setPoint.call(this,a,this._correctedPoint(b))};
TradingView.StudyLineDataSource.prototype.disconnect=function(){this._studyId=0};TradingView.StudyLineDataSource.prototype.graphics=function(){return this._graphics.graphics()};TradingView.StudyLineDataSource.prototype.firstValue=function(){return this._model.mainSeries().data().firstValue()};TradingView.StudyLineDataSource.prototype.formatter=function(){return this._model.mainSeries().data().formatter()};TradingView.StudyLineDataSource.prototype.metaInfo=function(){return this._metaInfo};
function LineToolBeingCreatedPaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(LineToolBeingCreatedPaneView,LineSourcePaneView);
LineToolBeingCreatedPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size()||this._source._nonseriesdata||this._source._graphics&&!this._source._graphics.isEmpty())return a;var b=this._points.item(0),c=this._points.item(1);Math.min(b.x,c.x);Math.max(b.x,c.x);var d={};d.points=(new List).append(b);d.color="#808080";d.linewidth=this._source._doNotNeedLine?0:1;d.linestyle=CanvasEx.LINESTYLE_SOLID;a.append(new VertLineRenderer(d));d={};d.points=(new List).append(c);
d.color="#808080";d.linewidth=this._source._doNotNeedLine?0:1;d.linestyle=CanvasEx.LINESTYLE_SOLID;a.append(new VertLineRenderer(d));b={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:"#808080",linewidth:this._source._doNotNeedLine?0:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));return a};
function StudyLineDataSourcePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(StudyLineDataSourcePaneView,LineSourcePaneView);StudyLineDataSourcePaneView.prototype.renderer=function(){var a=new CompositeRenderer;this.isAnchorsRequired()&&(a.append(new SelectionRenderer({points:this._points})),a.append(this.createLineAnchor({points:this._points})));return a};TradingView.SymbolLabelRenderer=function(a){this._data=a};TradingView.SymbolLabelRenderer.prototype.hitTest=function(a){return null};
TradingView.SymbolLabelRenderer.prototype.draw=function(a){a.font=this._data.textHeight+" Arial";a.fillStyle=this._data.backColor;var b=a.measureText(this._data.text).width,c=this._data.pos;"left"==this._data.align&&(c=b+4+2-1);a.save();a.translate(0.5,0.5);a.fillRect(c-4-2-b,this._data.coordinate-this._data.textHeight/2-1,b+4+2,this._data.textHeight+2);a.fillStyle=this._data.color;a.textBaseline="middle";a.fillText(this._data.text,c-2-b,this._data.coordinate);a.restore()};
TradingView.SymbolLabelPaneView=function(a,b,c,d){this._model=a;this._source=b;this._plotIndex=c;this._getterName=d?d:"symbol";this._cache={}};TradingView.SymbolLabelPaneView.prototype.update=function(){this._visible=!1;var a=this._source.lastValueData(this._plotIndex,!1);a&&this._source.priceScale().properties().showSymbolLabels.value()&&(this._visible=!0,this._coordinate=a.coordinate,this._color=a.color,this._text=this._source[this._getterName](),this._textHeight=this._source.priceScale().m_markBuilder.fontHeight())};
TradingView.SymbolLabelPaneView.prototype.renderer=function(){if(!this._visible)return new CompositeRenderer;var a=this._model.paneForSource(this._source),b="right";a.leftPriceScale()==this._source.priceScale()&&(b="left");var c=this._model.properties();(a=!a.leftPriceScale().mainSource()||!a.rightPriceScale().mainSource())&&c.scalesProperties.showLeftScale.value()&&!c.scalesProperties.showRightScale.value()&&(b="left");if(!a&&("left"==b&&!c.scalesProperties.showLeftScale.value()||"right"==b&&!c.scalesProperties.showRightScale.value()))return new CompositeRenderer;
b={coordinate:this._coordinate,backColor:this._color,color:(new RGBColor(this._color)).blackWhiteContrast(),text:this._text,pos:this._model.timeScale().width(),textHeight:this._textHeight,align:b};return new TradingView.SymbolLabelRenderer(b)};function PoligonRenderer(a,b){this._data=a;this._hittest=b?b:new HitTestResult(HitTestResult.MOVEPOINT)}
PoligonRenderer.prototype.draw=function(a){if(!this._data.points.isEmpty()){a.beginPath();a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;var b=this._data.points.item(0);a.moveTo(b.x,b.y);for(b=0;b<this._data.points.size();b++){var c=this._data.points.item(b);a.lineTo(c.x,c.y)}this._data.filled&&this._data.fillBackground&&(a.fillStyle=generateColor(this._data.backcolor,this._data.transparency),a.fill());this._data.filled&&!this._data.skipClosePath&&
a.closePath();0<this._data.linewidth&&a.stroke()}};PoligonRenderer.prototype.hitTest=function(a){if(void 0!==this._data.mouseTouchable&&!this._data.mouseTouchable)return null;for(var b=TradingView.isMobile.any()?24:3,c=1;c<this._data.points.size();c++){var d=this._data.points.item(c-1),e=this._data.points.item(c);if(MathEx.distanceToSegment(d,e,a).distance<=b)return this._hittest}return this._data.filled&&this._data.fillBackground&&MathEx.isInPolygon(this._data.points,a)?this._hittest:null};TradingView.BarsPatternPaneView=function(a,b){LineSourcePaneView.call(this,a,b)};inherit(TradingView.BarsPatternPaneView,LineSourcePaneView);
TradingView.BarsPatternPaneView.prototype.renderer=function(){if(this._pattern&&2==this._source.points().size()){var a=this._source.points().item(0).index,b=this._source.points().item(1).index,b=a<b?this._points.item(0):this._points.item(1);if(!b)return new CompositeRenderer;var c=Math.abs((this._points.item(0).x-this._points.item(1).x)/(this._pattern.length-1));if(this._source.properties().mode.value()==TradingView.LineToolBarsPattern.BARS_MODE){a=new CompositeRenderer;new List;for(var d=0;d<this._pattern.length;d++){var e=
Math.round(b.x+d*c+0.5),f=b.y+Math.round(this._pattern[d].high),g=b.y+Math.round(this._pattern[d].low),h={};h.points=(new List).append(new MathEx.Point(e-1,f)).append(new MathEx.Point(e+1,g));h.color=this._source.properties().color.value();h.linewidth=1;h.backcolor=this._source.properties().color.value();h.fillBackground=!0;h.transparency=10;a.append(new RectangleRenderer(h))}}else a=new CompositeRenderer,h={},h.barSpacing=c,h.items=this._pattern,h.histogramBase=0,h.lineIndex=0,h.lineColor=generateColor(this._source.properties().color.value(),
10),h.lineStyle=CanvasEx.LINESTYLE_SOLID,h.lineWidth=2,h.hittest=new HitTestResult(HitTestResult.MOVEPOINT),a.append(new PaneRendererLine(h));this.isAnchorsRequired()&&a.append(this.createLineAnchor({points:this._points}))}else{a=new CompositeRenderer;if(2>this._points.size())return a;b=this._points.item(0);c=this._points.item(1);Math.min(b.x,c.x);Math.max(b.x,c.x);d={};d.points=(new List).append(b);d.color="#808080";d.linewidth=1;d.linestyle=CanvasEx.LINESTYLE_SOLID;a.append(new VertLineRenderer(d));
d={};d.points=(new List).append(c);d.color="#808080";d.linewidth=1;d.linestyle=CanvasEx.LINESTYLE_SOLID;a.append(new VertLineRenderer(d));b={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b))}return a};
TradingView.BarsPatternPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(this._source.priceScale()&&!(this._source.priceScale().isEmpty()||2>this._points.size()))if(this._source._pattern&&0<this._source._pattern.length&&2==this._source.points().size()){var a=Math.abs((this._points.item(0).x-this._points.item(1).x)/(this._source._pattern.length-1)),b=this._source.priceScale(),c=this._source._pattern;if(this._source.properties().mode.value()==TradingView.LineToolBarsPattern.BARS_MODE){this._pattern=
[];if(b.isPercent()){for(var d=this._source.ownerSource().firstValue(),e=[],f=b.priceRange(),g=c.length;g--;)e[g]=[],e[g][HIGH_PLOT]=f.convertToPercent(c[g][HIGH_PLOT],d),e[g][LOW_PLOT]=f.convertToPercent(c[g][LOW_PLOT],d);c=e}d=b.priceToCoordinate(c[0][HIGH_PLOT]);for(g=0;g<c.length;g++)a=b.priceToCoordinate(c[g][HIGH_PLOT])-d,e=b.priceToCoordinate(c[g][LOW_PLOT])-d,this._pattern.push({high:a,low:e})}else{this._pattern=new List;if(b.isPercent()){d=this._source.ownerSource().firstValue();e=[];f=b.priceRange();
for(g=c.length;g--;)e[g]=[],e[g][CLOSE_PLOT]=f.convertToPercent(c[g][CLOSE_PLOT],d);c=e}d=b.priceToCoordinate(c[0][CLOSE_PLOT]);g=this._source.points().item(0).index;e=this._source.points().item(1).index;e=this._points.item(g>e?1:0);f=e.x;for(g=0;g<c.length;g++){var h=e.y+b.priceToCoordinate(c[g][CLOSE_PLOT])-d,h=new MathEx.Point(f+g*a,h);this._pattern.append(h)}}}else delete this._pattern};
TradingView.LineToolBarsPattern=function(a,b){this._constructor="LineToolBarsPattern";var c=b?b:new DefaultProperty("linetoolbarspattern");LineDataSource.call(this,a,new TradingView.BarsPatternPaneView(this,a),c);c.mirrored.listeners().subscribe(this,TradingView.LineToolBarsPattern.prototype.mirror);c.flipped.listeners().subscribe(this,TradingView.LineToolBarsPattern.prototype.flip);c.addExclusion("mirrored");c.addExclusion("flipped")};inherit(TradingView.LineToolBarsPattern,LineDataSource);
TradingView.LineToolBarsPattern.BARS_MODE=0;TradingView.LineToolBarsPattern.LINE_MODE=1;
TradingView.LineToolBarsPattern.prototype.additionalActions=function(a){var b=new Action({checked:this.properties().mirrored.value(),checkable:!0,text:"Mirrored",callbackContext:{target:this}}),c=new Action({checked:this.properties().flipped.value(),checkable:!0,text:"Flipped",callbackContext:{target:this}});b.callbacks().subscribe(null,function(b){b=b.callbackContext().target;a.setProperty(b.properties().mirrored,!b.properties().mirrored.value(),"Bats Pattern Mirroring");b.updateAllViews();b._model.updateSource(b)});
c.callbacks().subscribe(null,function(b){b=b.callbackContext().target;a.setProperty(b.properties().flipped,!b.properties().flipped.value(),"Bats Pattern Flipping");b.updateAllViews();b._model.updateSource(b)});return[b,c]};TradingView.LineToolBarsPattern.prototype.pointsCount=function(){return 2};TradingView.LineToolBarsPattern.prototype.state=function(a){a=LineDataSource.prototype.state.call(this,a);a.pattern=this._pattern;return a};
TradingView.LineToolBarsPattern.prototype.restoreData=function(a){a.pattern&&(this._pattern=a.pattern)};TradingView.LineToolBarsPattern.prototype.title=function(){return"Bars Pattern"};TradingView.LineToolBarsPattern.prototype.cloneData=function(a){this._pattern=TradingView.clone(a._pattern)};
TradingView.LineToolBarsPattern.prototype.mirror=function(){for(var a=this._pattern,b=a[0][HIGH_PLOT],c=Math.min(a[0][LOW_PLOT],a[0][HIGH_PLOT]),d=Math.max(a[0][LOW_PLOT],a[0][HIGH_PLOT]),e=1;e<a.length;e++)c=Math.min(c,a[e][LOW_PLOT]),d=Math.max(d,a[e][HIGH_PLOT]);if(c<d)for(c=(c+d)/2,e=0;e<a.length;e++)a[e][HIGH_PLOT]=c-(a[e][HIGH_PLOT]-c),a[e][LOW_PLOT]=c-(a[e][LOW_PLOT]-c),a[e][OPEN_PLOT]=c-(a[e][OPEN_PLOT]-c),a[e][CLOSE_PLOT]=c-(a[e][CLOSE_PLOT]-c);b=a[0][HIGH_PLOT]-b;a=a[a.length-1][LOW_PLOT]-
a[0][HIGH_PLOT];this._points.item(0).price+=b;this._points.item(1).price=this._points.item(0).price+a;this.updateAllViews()};
TradingView.LineToolBarsPattern.prototype.flip=function(){this._points.item(0).price=this._points.item(1).price;for(var a=0;a<this._pattern.length/2;a++){var b=this._pattern[a];this._pattern[a]=this._pattern[this._pattern.length-a-1];this._pattern[this._pattern.length-a-1]=b}a=this._pattern[this._pattern.length-1][LOW_PLOT]-this._pattern[0][HIGH_PLOT];this._points.item(1).price=this._points.item(0).price+a;this.updateAllViews()};
TradingView.LineToolBarsPattern.prototype.addPoint=function(a,b){var c=this._model.mainSeries(),d=c.nearestIndex(a.index,SEARCH_NEAREST_RIGHT);this.properties().mode.value()==TradingView.LineToolBarsPattern.BARS_MODE?a.price=c.bars().valueAt(d)[HIGH_PLOT]:a.price=c.bars().valueAt(d)[CLOSE_PLOT];d=this.priceScale().priceRange().length();a.price+=0.05*d;d=c.priceScale();d.isPercent()&&(c=c.firstValue(),a.price=d.priceRange().convertToPercent(a.price,c));if(c=LineDataSource.prototype.addPoint.call(this,
a,b)){var d=Math.min(this.points().item(0).index,this.points().item(1).index),e=Math.max(this.points().item(0).index,this.points().item(1).index),d=this._model.mainSeries().nearestIndex(d,SEARCH_NEAREST_RIGHT),e=this._model.mainSeries().nearestIndex(e,SEARCH_NEAREST_LEFT);this.points().item(0).index>this.points().item(1).index&&(this._points.item(0).price=this._points.item(1).price);for(this._pattern=[];d<=e;d++){var f=this._model.mainSeries().data().valueAt(d);this._pattern.push(TradingView.clone(f))}}return c};
TradingView.LineToolBarsPattern.prototype.setPoint=function(a,b,c){var d=this._points.item(0).price-this._points.item(1).price;1==a&&b.index<=this._points.item(0).index&&(b.index=this._points.item(0).index+1);0==a&&b.index>=this._points.item(1).index&&(b.index=this._points.item(1).index-1);LineDataSource.prototype.setPoint.call(this,a,b,c);1==a?this._points.item(0).price=this._points.item(1).price+d:this._points.item(1).price=this._points.item(0).price-d};function DateRangePaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(DateRangePaneView,LineSourcePaneView);
DateRangePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size()||2>this._source.points().size())return a;var b=this._source.properties();if(b.fillBackground&&b.fillBackground.value()){var c={};c.points=this._points;c.color="white";c.linewidth=0;c.backcolor=b.backgroundColor.value();c.fillBackground=!0;c.transparency=b.backgroundTransparency.value();a.append(new RectangleRenderer(c))}var d=this,e=function(b,c){var e={};e.points=(new List).append(b).append(c);e.width=
d._model.timeScale().width();e.height=d._source.priceScale().height();e.color=d._source.properties().linecolor.value();e.linewidth=d._source.properties().linewidth.value();e.linestyle=CanvasEx.LINESTYLE_SOLID;e.extendleft=!1;e.extendright=!1;e.leftend=LineDataSource.LINEEND_NORMAL;e.rightend=LineDataSource.LINEEND_NORMAL;a.append(new TrendLineRenderer(e))},f=this._points.item(0),g=this._points.item(1),g=new MathEx.Point(f.x,g.y);e(f,g);f=this._points.item(0);g=this._points.item(1);f=new MathEx.Point(g.x,
f.y);e(f,g);var f=this._points.item(0),g=this._points.item(1),c=(f.y+g.y)/2,e=new MathEx.Point(f.x,c),h=new MathEx.Point(g.x,c),c={};c.points=(new List).append(e).append(h);c.width=d._model.timeScale().width();c.height=d._source.priceScale().height();c.color=d._source.properties().linecolor.value();c.linewidth=d._source.properties().linewidth.value();c.linestyle=CanvasEx.LINESTYLE_DASHED;c.extendleft=!1;c.extendright=!1;c.leftend=LineDataSource.LINEEND_NORMAL;c.rightend=LineDataSource.LINEEND_ARROW;
a.append(new TrendLineRenderer(c));var c=this._source.points().item(0).index,h=this._source.points().item(1).index,e=h-c,c=this._model.timeScale().indexToUserTime(c),k=this._model.timeScale().indexToUserTime(h),h="";c&&k&&(c=(k.valueOf()-c.valueOf())/1E3,h=", "+(new TimeSpanFormatter).format(c));c={};c.points=(new List).append(f.add(g).scaled(0.5));c.text=$.t("{0} bars").format(e)+h;c.color=b.textcolor.value();c.font=b.font.value();c.offsetX=0;c.offsetY=0;c.vertAlign="top";c.horzAlign="center";c.backgroundRoundRect=
0;c.backgroundHorzInflate=0.4*b.fontsize.value();c.backgroundVertInflate=0.2*b.fontsize.value();c.fontsize=b.fontsize.value();b.fillLabelBackground&&b.fillLabelBackground.value()&&(c.backgroundColor=b.labelBackgroundColor.value(),c.backgroundTransparency=1-b.labelBackgroundTransparency.value()/100||0);b.drawBorder&&b.drawBorder.value()&&(c.borderColor=b.borderColor.value());a.append(new TextRenderer(c,this._rendererCache));this.isAnchorsRequired()&&a.append(this.createLineAnchor({points:this._points}));
return a};TradingView.LineToolDateRange=function(a,b){this._constructor="LineToolDateRange";var c=b?b:new DefaultProperty("linetooldaterange");LineDataSource.call(this,a,new DateRangePaneView(this,a),c)};inherit(TradingView.LineToolDateRange,LineDataSource);TradingView.LineToolDateRange.prototype.pointsCount=function(){return 2};TradingView.LineToolDateRange.prototype.title=function(){return"Date Range"};function PriceRangePaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(PriceRangePaneView,LineSourcePaneView);
PriceRangePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size()||2>this._source.points().size())return a;var b=this._source.properties();if(b.fillBackground&&b.fillBackground.value()){var c={};c.points=this._points;c.color="white";c.linewidth=0;c.backcolor=b.backgroundColor.value();c.fillBackground=!0;c.transparency=b.backgroundTransparency.value();a.append(new RectangleRenderer(c))}var d=this,c=function(b,c){var e={};e.points=(new List).append(b).append(c);e.width=
d._model.timeScale().width();e.height=d._source.priceScale().height();e.color=d._source.properties().linecolor.value();e.linewidth=d._source.properties().linewidth.value();e.linestyle=CanvasEx.LINESTYLE_SOLID;e.extendleft=!1;e.extendright=!1;e.leftend=LineDataSource.LINEEND_NORMAL;e.rightend=LineDataSource.LINEEND_NORMAL;a.append(new TrendLineRenderer(e))},e=this._points.item(0),f=this._points.item(1),f=new MathEx.Point(f.x,e.y);c(e,f);e=this._points.item(0);f=this._points.item(1);e=new MathEx.Point(e.x,
f.y);c(e,f);var e=this._points.item(0),f=this._points.item(1),c=(e.x+f.x)/2,g=new MathEx.Point(c,e.y),h=new MathEx.Point(c,f.y),c={};c.points=(new List).append(g).append(h);c.width=d._model.timeScale().width();c.height=d._source.priceScale().height();c.color=d._source.properties().linecolor.value();c.linewidth=d._source.properties().linewidth.value();c.linestyle=CanvasEx.LINESTYLE_DASHED;c.extendleft=!1;c.extendright=!1;c.leftend=LineDataSource.LINEEND_NORMAL;c.rightend=LineDataSource.LINEEND_ARROW;
a.append(new TrendLineRenderer(c));var g=this._source.points().item(0).price,h=this._source.points().item(1).price,c=h-g,k=100*c/g,k=this._source.priceScale().formatter().format(c)+" ("+Math.round(100*k)/100+"%)",c={};h>g?(g=f.clone(),g.y-=2*b.fontsize.value(),g.x=0.5*(e.x+f.x)):(g=f.clone(),g.x=0.5*(e.x+f.x),g.y+=0.7*b.fontsize.value());c.points=(new List).append(g);c.text=k;c.color=b.textcolor.value();c.font=b.font.value();c.offsetX=0;c.offsetY=0;c.vertAlign="middle";c.horzAlign="center";c.fontsize=
b.fontsize.value();c.backgroundRoundRect=0;c.backgroundHorzInflate=0.4*b.fontsize.value();c.backgroundVertInflate=0.2*b.fontsize.value();b.fillLabelBackground&&b.fillLabelBackground.value()&&(c.backgroundColor=b.labelBackgroundColor.value(),c.backgroundTransparency=1-b.labelBackgroundTransparency.value()/100||0);b.drawBorder&&b.drawBorder.value()&&(c.borderColor=b.borderColor.value());a.append(new TextRenderer(c,this._rendererCache));this.isAnchorsRequired()&&a.append(this.createLineAnchor({points:this._points}));
return a};TradingView.LineToolPriceRange=function(a,b){this._constructor="LineToolPriceRange";var c=b?b:new DefaultProperty("linetoolpricerange");LineDataSource.call(this,a,new PriceRangePaneView(this,a),c)};inherit(TradingView.LineToolPriceRange,LineDataSource);TradingView.LineToolPriceRange.prototype.pointsCount=function(){return 2};TradingView.LineToolPriceRange.prototype.title=function(){return"Price Range"};function ParallelChannelRenderer(a){this._data=a}
ParallelChannelRenderer.prototype.extendPoints=function(a,b,c,d){var e=new MathEx.Point(0,0);c=new MathEx.Point(c,d);this._data.extendleft&&(d=a.substract(b),(d=MathEx.intersectRayWithRect(a,a.add(d),e,c))&&(a=d));this._data.extendright&&(d=b.substract(a),(d=MathEx.intersectRayWithRect(b,b.add(d),e,c))&&(b=d));this._data.extendleft&&!MathEx.pointInRect(a,e,c)&&MathEx.pointInRect(b,e,c)&&(d=MathEx.intersectRayWithRect(b,a,e,c))&&(a=d);this._data.extendright&&!MathEx.pointInRect(b,e,c)&&MathEx.pointInRect(a,
e,c)&&(d=MathEx.intersectRayWithRect(a,b,e,c))&&(b=d);return[a,b]};
ParallelChannelRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;var b=this._data.points.item(0),c=this._data.points.item(1),b=this.extendPoints(b,c,this._data.width,this._data.height);this._data.skipLines||CanvasEx.drawLine(a,b[0].x,b[0].y,b[1].x,b[1].y);if(4==this._data.points.size()){var c=this._data.points.item(2),d=this._data.points.item(3);if(c&&d){c=this.extendPoints(c,
d,this._data.width,this._data.height);this._data.skipLines||this._data.skipTopLine||CanvasEx.drawLine(a,c[0].x,c[0].y,c[1].x,c[1].y);if(this._data.fillBackground){var d=Math.max(b[1].x,c[1].x),e=Math.max(b[1].y,c[1].y),f=Math.min(c[0].x,b[0].x),g=Math.min(c[0].y,b[0].y);if(!(isFinite(d)&&isFinite(e)&&isFinite(f)&&isFinite(g)))return;a.fillStyle=generateColor(this._data.backcolor,this._data.transparency);a.beginPath();a.moveTo(b[0].x,b[0].y);a.lineTo(b[1].x,b[1].y);this._data.extendright&&(d=MathEx.optionalCorner(b[1],
c[1],this._data.width,this._data.height))&&a.lineTo(d.x,d.y);a.lineTo(c[1].x,c[1].y);a.lineTo(c[0].x,c[0].y);this._data.extendleft&&(d=MathEx.optionalCorner(c[0],b[0],this._data.width,this._data.height))&&a.lineTo(d.x,d.y);a.lineTo(b[0].x,b[0].y);a.fill()}this._data.showMidline&&!this._data.skipLines&&(a.strokeStyle=this._data.midcolor,a.lineWidth=this._data.midlinewidth,a.lineStyle=this._data.midlinestyle,b=this._data.points.item(0).add(this._data.points.item(2)).scaled(0.5),c=this._data.points.item(1).add(this._data.points.item(3)).scaled(0.5),
c=this.extendPoints(b,c,this._data.width,this._data.height),(b=TrendLineRenderer.prototype.lineClipping(c[0],c[1],this._data.width,this._data.height))&&CanvasEx.drawLine(a,Math.round(b[0].x),Math.round(b[0].y),Math.round(b[1].x),Math.round(b[1].y)))}}}};
ParallelChannelRenderer.prototype.hitTest=function(a){if(2>this._data.points.size())return null;if(this._data.floatPoints)var b=this._data.floatPoints.item(0),c=this._data.floatPoints.item(1);else b=this._data.points.item(0),c=this._data.points.item(1);var d=this.extendPoints(b,c,this._data.width,this._data.height),d=MathEx.distanceToSegment(d[0],d[1],a);if(3>=d.distance)return new HitTestResult(HitTestResult.MOVEPOINT);if(this._data.floatPoints)var e=this._data.floatPoints.item(2),f=this._data.floatPoints.item(3);
else e=this._data.points.item(2),f=this._data.points.item(3);if(4==this._data.points.size()&&!this._data.skipTopLine){if(!e||!f)return null;d=this.extendPoints(e,f,this._data.width,this._data.height);d=MathEx.distanceToSegment(d[0],d[1],a);if(3>=d.distance)return new HitTestResult(HitTestResult.MOVEPOINT);if(this._data.showMidline&&!this._data.skipLines){var d=this._data.points.item(0).add(this._data.points.item(2)).scaled(0.5),g=this._data.points.item(1).add(this._data.points.item(3)).scaled(0.5),
d=this.extendPoints(d,g,this._data.width,this._data.height),d=MathEx.distanceToSegment(d[0],d[1],a);if(3>=d.distance)return new HitTestResult(HitTestResult.MOVEPOINT)}}return this._data.hittestOnBackground&&this._data.fillBackground&&4==this._data.points.size()&&(b=(new List).append(b).append(c).append(f).append(e),MathEx.isInPolygon(b,a))?new HitTestResult(HitTestResult.MOVEPOINT):null};function ParallelChannelPaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(ParallelChannelPaneView,LineSourcePaneView);
ParallelChannelPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(this._source.priceScale()&&!this._source.priceScale().isEmpty()&&0!=this._source.points().size()&&(this._source._priceOffset||this._source.calculatePriceDiff(),3===this._points.size()&&this._source._priceOffset)){var a=this._points.item(0),b=this._points.item(1),c=this._source._priceOffset+this._source.points().item(0).price,d=this._source._priceOffset+this._source.points().item(1).price;this._p3=
a.clone();this._p4=b.clone();a=this._source.priceScale();a.isLog()?(a=0.5*(c+d)-this._source._priceOffset,c=0.5*(c+d),d=this._source.priceScale().priceToCoordinate(a),c=this._source.priceScale().priceToCoordinate(c)-d,this._p3.y+=c,this._p4.y+=c):(a.isPercent()&&(b=this._source.ownerSource().firstValue(),c=a.priceRange().convertToPercent(c,b),d=a.priceRange().convertToPercent(d,b)),this._p3.y=this._source.priceScale().priceToCoordinate(c),this._p4.y=this._source.priceScale().priceToCoordinate(d))}};
ParallelChannelPaneView.prototype.renderer=function(){var a={};a.points=new List;1<this._points.size()&&(a.points.append(this._points.item(0)),a.points.append(this._points.item(1)));2<this._points.size()&&(a.points.append(this._p3),a.points.append(this._p4));a.color=this._source.properties().linecolor.value();a.width=this._model.timeScale().width();a.height=this._source.priceScale().height();var b=this._source.properties();a.linewidth=b.linewidth.value();a.linestyle=b.linestyle.value();a.extendleft=
b.extendLeft.value();a.extendright=b.extendRight.value();a.fillBackground=b.fillBackground.value();a.backcolor=b.backgroundColor.value();a.transparency=b.transparency.value();a.showMidline=b.showMidline.value();a.midlinewidth=b.midlinewidth.value();a.midlinestyle=b.midlinestyle.value();a.midcolor=b.midlinecolor.value();a.fillBackground=b.fillBackground.value();a.hittestOnBackground=TradingView.isMobile.any();if(this.isAnchorsRequired()){b=new CompositeRenderer;b.append(new ParallelChannelRenderer(a));
a=new List;a.append(this._points.item(0));this._points.item(1)&&a.append(this._points.item(1));this._p3&&(a.append(this._p3.add(this._p4).scaled(0.5)),a.item(2).data=2);var c=3==this._points.size()&&!this._p3;this._model.lineBeingCreated()!=this._source||c||a.removeAt(a.size()-1);b.append(this.createLineAnchor({points:a}));return b}return new ParallelChannelRenderer(a)};
TradingView.LineToolParallelChannel=function(a,b){this._constructor="LineToolParallelChannel";var c=b?b:new DefaultProperty("linetoolparallelchannel");LineDataSource.call(this,a,new ParallelChannelPaneView(this,a),c)};inherit(TradingView.LineToolParallelChannel,LineDataSource);TradingView.LineToolParallelChannel.prototype.addPoint=function(a){if(a=LineDataSource.prototype.addPoint.call(this,a)){var b=this.points().item(0);this._points.item(2).index=b.index;this._points.item(2).price=b.price+this._priceOffset}return a};
TradingView.LineToolParallelChannel.prototype.calculatePriceDiff=function(){if(3===this.points().size()){var a=this.points().item(0),b=this.points().item(1),c=this.points().item(2);if(a.index!==b.index){var d=this.priceScale();if(null!==d)if(d.isLog()){var e=this._model.timeScale();if(!e.isEmpty()){var f=e.indexToCoordinate(a.index),g=e.indexToCoordinate(b.index),a=d.priceToCoordinate(a.price),b=d.priceToCoordinate(b.price),e=e.indexToCoordinate(c.index);d.priceToCoordinate(c.price);f=a+(b-a)/(g-
f)*(e-f);c=d.priceToCoordinate(c.price)-f;a=0.5*(a+b);f=d.coordinateToPrice(a);this._priceOffset=d.coordinateToPrice(a+c)-f}}else d=(b.price-a.price)/(b.index-a.index),this._priceOffset=c.price-(a.price+d*(c.index-a.index))}}};TradingView.LineToolParallelChannel.prototype.setLastPoint=function(a,b){b&&b.shift&&2==this.points().size()&&this._snapPoint45Degree(a,this.points().item(0));LineDataSource.prototype.setLastPoint.call(this,a);this.calculatePriceDiff()};
TradingView.LineToolParallelChannel.prototype.restorePoints=function(a,b,c){LineDataSource.prototype.restorePoints.call(this,a,b,c);this.calculatePriceDiff()};TradingView.LineToolParallelChannel.prototype.setPoint=function(a,b,c){c&&c.shift&&2>a&&this._snapPoint45Degree(b,this.points().item(1-a));LineDataSource.prototype.setPoint.call(this,a,b,c);2===a&&this.calculatePriceDiff();a=this.points().item(0);this._points.item(2).index=a.index;this._points.item(2).price=a.price+this._priceOffset};
TradingView.LineToolParallelChannel.prototype.pointsCount=function(){return 3};TradingView.LineToolParallelChannel.prototype.title=function(){return"Parallel Channel"};TradingView.LineToolParallelChannel.prototype.addPoint=function(a,b){b&&b.shift&&2==this.points().size()&&this._snapPoint45Degree(a,this.points().item(0));return LineDataSource.prototype.addPoint.call(this,a,b)};function TrendLineRenderer(a,b){this._data=a;this._hittest=b?b:new HitTestResult(HitTestResult.MOVEPOINT)}TrendLineRenderer.prototype.drawArrow=function(a,b,c,d){if(!(1>b.substract(a).length())){var e=b.substract(a).normalized();a=e.scaled(5*d);a=b.substract(a);e=e.transponed().scaled(3*d);d=a.add(e);a=a.substract(e);CanvasEx.drawLine(c,Math.round(d.x),Math.round(d.y),b.x,b.y);CanvasEx.drawLine(c,Math.round(a.x),Math.round(a.y),b.x,b.y)}};
TrendLineRenderer.prototype.lineClipping=function(a,b,c,d){return(a=CohenSutherland(a.x,a.y,b.x,b.y,0,0,c,d))?[{x:a[0],y:a[1]},{x:a[2],y:a[3]}]:!1};TrendLineRenderer.prototype.expandPoints=function(a,b,c,d){var e=new MathEx.Point(0,0);c=new MathEx.Point(c,d);this._data.extendleft&&(d=a.substract(b),(d=MathEx.intersectRayWithRect(a,a.add(d),e,c))&&(a=d));this._data.extendright&&(d=b.substract(a),(d=MathEx.intersectRayWithRect(b,b.add(d),e,c))&&(b=d));return[a,b]};
TrendLineRenderer.prototype.drawCircle=function(a,b,c,d){d=$.extend({fillStyle:"#000000"},d);b.save();b.fillStyle=d.fillStyle;b.beginPath();b.arc(a.x,a.y,c,0,2*Math.PI,!1);b.fill();d.strokeWidth&&(b.lineWidth=d.strokeWidth,b.stroke());b.restore()};
TrendLineRenderer.prototype.draw=function(a){if(!(this._data.points&&2>this._data.points.size()||this._data.floatPoints&&2>this._data.floatPoints.size())){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;if(this._data.floatPoints)var b=this._data.floatPoints.item(0),c=this._data.floatPoints.item(1);else b=this._data.points.item(0),c=this._data.points.item(1);if(this._data.overlayLineEndings)var d=[$.extend(!0,{},b),$.extend(!0,{},c)];
else this.drawEnds(a,[b,c]);b=this.expandPoints(b,c,this._data.width,this._data.height);(b=this.lineClipping(b[0],b[1],this._data.width,this._data.height))&&0<this._data.linewidth&&CanvasEx.drawLine(a,Math.round(b[0].x),Math.round(b[0].y),Math.round(b[1].x),Math.round(b[1].y));this._data.overlayLineEndings&&this.drawEnds(a,d)}};
TrendLineRenderer.prototype.drawEnds=function(a,b){var c=b[0],d=b[1];switch(this._data.leftend){case LineDataSource.LINEEND_ARROW:this.drawArrow(d,c,a,a.lineWidth);break;case LineDataSource.LINEEND_CIRCLE:this.drawCircle(c,a,a.lineWidth,this._data.endstyle)}switch(this._data.rightend){case LineDataSource.LINEEND_ARROW:this.drawArrow(c,d,a,a.lineWidth);break;case LineDataSource.LINEEND_CIRCLE:this.drawCircle(d,a,a.lineWidth,this._data.endstyle)}};
TrendLineRenderer.prototype.hitTest=function(a){if(this._data.points&&2>this._data.points.size()||this._data.floatPoints&&2>this._data.floatPoints.size())return null;var b=TradingView.isMobile.any()?24:3;if(this._data.floatPoints)var c=this._data.floatPoints.item(0),d=this._data.floatPoints.item(1);else c=this._data.points.item(0),d=this._data.points.item(1);c=this.expandPoints(c,d,this._data.width,this._data.height);return MathEx.distanceToSegment(c[0],c[1],a).distance<=b?this._hittest:null};
function TrendLinePaneView(a,b){LineSourcePaneView.call(this,a,b);this._label=null;this._rendererCache={}}inherit(TrendLinePaneView,LineSourcePaneView);
TrendLinePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._label=null;if(!(2>this._source.points().size())){this._label="";var a=this._source.points().item(0),b=this._source.points().item(1);this._source.properties().showPriceRange.value()&&this._source.priceScale()&&(this._label+=this._source.priceScale().formatter().format(b.price-a.price)+"\n");if(this._source.properties().showBarsRange.value()){var c=b.index-a.index;this._label+=$.t("{0} bars").format(c)+
"\n"}if(this._source.properties().showDateTimeRange.value()){var c=this._model.timeScale().indexToUserTime(a.index),d=this._model.timeScale().indexToUserTime(b.index);c&&d&&(c=(d.valueOf()-c.valueOf())/1E3,this._label+=(new TimeSpanFormatter).format(c)+"\n")}this._source.properties().showDistance.value()&&(c=b.price-a.price,a=b.index-a.index,a=Math.sqrt(c*c+a*a),a=Math.round(1E5*a)/1E5,this._label+=$.t("distance: {0}").format(a));""===this._label&&(this._label=null)}};
TrendLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer,b={};b.points=this._points;b.floatPoints=this._floatPoints;b.width=this._model.timeScale().width();b.height=this._source.priceScale().height();b.color=this._source.properties().linecolor.value();b.linewidth=this._source.properties().linewidth.value();b.linestyle=this._source.properties().linestyle.value();b.extendleft=this._source.properties().extendLeft.value();b.extendright=this._source.properties().extendRight.value();
b.leftend=this._source.properties().leftEnd.value();b.rightend=this._source.properties().rightEnd.value();a.append(new TrendLineRenderer(b));if(null!==this._label&&2==this._points.size()){var c={points:(new List).append(this._points.item(1)),text:this._label,color:this._source.properties().textcolor.value(),horzAlign:"left",font:this._source.properties().font.value(),offsetX:5,offsetY:0,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()};
this._points.item(1).y>this._points.item(0).y?c.vertAlign="top":c.vertAlign="bottom";a.append(new TextRenderer(c,this._rendererCache))}this.isAnchorsRequired()&&(a.append(new TrendLineRenderer(b)),b=b.points.clone(),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));return a};
TradingView.LineToolTrendLine=function(a,b){this._constructor="LineToolTrendLine";var c=b?b:new DefaultProperty("linetooltrendline");LineDataSource.call(this,a,new TrendLinePaneView(this,a),c)};inherit(TradingView.LineToolTrendLine,LineDataSource);TradingView.LineToolTrendLine.prototype.pointsCount=function(){return 2};TradingView.LineToolTrendLine.prototype.title=function(){return"Trend Line"};
(function(){function a(a,h,k,m,n,q){var l=b;a<k?l|=c:a>n&&(l|=d);h<m?l|=e:h>q&&(l|=f);return l}var b=0,c=1,d=2,e=4,f=8;window.CohenSutherland=function(b,c,k,m,n,q,l,s){for(var u=a(b,c,n,q,l,s),z=a(k,m,n,q,l,s),t=!1,B,A,w,v=0;;){if(1E3<v)throw Error("Cohen - Sutherland algorithm: infinity loop");v++;if(u|z)if(u&z)break;else w=u?u:z,w&f?(B=b+(k-b)*(s-c)/(m-c),A=s):w&e?(B=b+(k-b)*(q-c)/(m-c),A=q):w&d?(A=c+(m-c)*(l-b)/(k-b),B=l):(A=c+(m-c)*(n-b)/(k-b),B=n),w==u?(b=B,c=A,u=a(b,c,n,q,l,s)):(k=B,m=A,z=a(k,
m,n,q,l,s));else{t=!0;break}}return t?[b,c,k,m]:!1}})();function RectangleRenderer(a){this._data=a}RectangleRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;var b=this._data.points.item(0),c=this._data.points.item(1).substract(b);a.beginPath();a.rect(b.x,b.y,c.x,c.y);0<this._data.linewidth&&a.stroke();this._data.fillBackground&&(a.fillStyle=generateColor(this._data.backcolor,this._data.transparency),a.fill())}};
RectangleRenderer.prototype.hitTest=function(a){if(2>this._data.points.size()||this._data.nohittest)return null;var b=this._data.points.item(0),c=this._data.points.item(1),d=new MathEx.Point(c.x,b.y),e=new MathEx.Point(b.x,d.y),f=MathEx.distanceToSegment(b,d,a);if(3>=f.distance)return new HitTestResult(HitTestResult.MOVEPOINT);f=MathEx.distanceToSegment(d,c,a);if(3>=f.distance)return new HitTestResult(HitTestResult.MOVEPOINT);f=MathEx.distanceToSegment(c,e,a);if(3>=f.distance)return new HitTestResult(HitTestResult.MOVEPOINT);
f=MathEx.distanceToSegment(e,b,a);return 3>=f.distance||this._data.fillBackground&&(d=Math.min(b.x,c.x),e=Math.max(b.x,c.x),f=Math.min(b.y,c.y),c=Math.max(b.y,c.y),b=new MathEx.Point(d,f),c=new MathEx.Point(e,c),MathEx.pointInRect(a,b,c))?new HitTestResult(HitTestResult.MOVEPOINT):null};function RectanglePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(RectanglePaneView,LineSourcePaneView);
RectanglePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().color.value();a.linewidth=this._source.properties().linewidth.value();a.backcolor=this._source.properties().backgroundColor.value();a.fillBackground=this._source.properties().fillBackground.value();a.transparency=this._source.properties().transparency.value();if(this.isAnchorsRequired()){var b=new CompositeRenderer;b.append(new RectangleRenderer(a));a=a.points.clone();this._model.lineBeingCreated()==
this._source&&a.removeAt(a.size()-1);b.append(this.createLineAnchor({points:a}));return b}return new RectangleRenderer(a)};TradingView.LineToolRectangle=function(a,b){this._constructor="LineToolRectangle";var c=b?b:new DefaultProperty("linetoolrectangle");LineDataSource.call(this,a,new RectanglePaneView(this,a),c)};inherit(TradingView.LineToolRectangle,LineDataSource);TradingView.LineToolRectangle.prototype.pointsCount=function(){return 2};TradingView.LineToolRectangle.prototype.title=function(){return"Rectangle"};function EllipseRenderer(a){this._data=a;this._data.angleFrom=0;this._data.angleTo=2*Math.PI;this._data.clockwise=!1}
EllipseRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){var b=this._data.points.item(0),c=this._data.points.item(1);if(3>this._data.points.size())a.strokeStyle=this._data.color,a.lineWidth=this._data.linewidth,a.beginPath(),a.moveTo(b.x,b.y),a.lineTo(c.x,c.y),a.stroke();else{var d=this._data.points.item(2),d=MathEx.distanceToLine(b,c,d).distance;if(1>d)a.strokeStyle=this._data.color,a.lineWidth=this._data.linewidth,a.beginPath(),a.moveTo(b.x,b.y),a.lineTo(c.x,c.y),a.stroke();
else{var e=c.substract(b),b=b.add(c).scaled(0.5),c=new MathEx.Point(-e.y,e.x),c=c.normalized();b.add(c.scaled(d));b.add(c.scaled(-d));a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;var c=e.length(),f=e.y/c,e=Math.acos(e.x/c);0>f&&(e=-e);var f=this._data.points.item(2),g=MathEx.Matrix.translate(-b.x,-b.y),f=g.mult(f),g=MathEx.Matrix.rotate(-e),f=g.mult(f),g=MathEx.Matrix.scale(1,c/(2*d)),f=g.mult(f);this._data.clockwise=0>f.y?!0:!1;a.save();a.beginPath();a.translate(b.x,b.y);a.rotate(e);
a.scale(1,2*d/c);a.arc(0,0,0.5*c,this._data.angleFrom,this._data.angleTo,this._data.clockwise);a.restore();a.stroke();this._data.fillBackground&&(a.fillStyle=generateColor(this._data.backcolor,this._data.transparency),a.fill())}}}};EllipseRenderer.prototype._additionalPointTest=function(a,b){return!0};
EllipseRenderer.prototype.hitTest=function(a){if(3>this._data.points.size())return null;var b=this._data.points.item(0),c=this._data.points.item(1),d=this._data.points.item(2),d=MathEx.distanceToLine(b,c,d).distance,e=c.substract(b),c=b.add(c).scaled(0.5),b=new MathEx.Point(-e.y,e.x),b=b.normalized();c.add(b.scaled(d));c.add(b.scaled(-d));var b=e.length(),f=e.y/b,e=Math.acos(e.x/b);0>f&&(e=-e);f=MathEx.Matrix.translate(-c.x,-c.y);a=f.mult(a);c=f.mult(this._data.points.item(2));f=MathEx.Matrix.rotate(-e);
a=f.mult(a);c=f.mult(c);f=MathEx.Matrix.scale(1,b/(2*d));a=f.mult(a);c=f.mult(c);d=a.length();if(!this._additionalPointTest(a,c))return null;if(this._data.fillBackground&&!this._data.noHitTestOnBackground){if(d<=0.5*b)return new HitTestResult(HitTestResult.MOVEPOINT)}else if(3>=Math.abs(d-0.5*b))return new HitTestResult(HitTestResult.MOVEPOINT);return null};function EllipsePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(EllipsePaneView,LineSourcePaneView);
EllipsePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b={};b.points=this._points;b.color=this._source.properties().color.value();b.linewidth=this._source.properties().linewidth.value();b.backcolor=this._source.properties().backgroundColor.value();b.fillBackground=this._source.properties().fillBackground.value();b.transparency=this._source.properties().transparency.value();a.append(new EllipseRenderer(b));if(this.isAnchorsRequired()){var c=
b.points.item(0),d=b.points.item(1);if(2==this._points.size())return this.addAnchors(a),a;var b=b.points.item(2),e=MathEx.distanceToLine(c,d,b).distance,b=d.substract(c),f=c.add(d).scaled(0.5),g=new MathEx.Point(-b.y,b.x),g=g.normalized(),b=f.add(g.scaled(e)),e=f.add(g.scaled(-e)),c=new MathEx.Point(c.x,c.y);c.data=0;d=new MathEx.Point(d.x,d.y);d.data=1;b=new MathEx.Point(b.x,b.y);b.data=2;e=new MathEx.Point(e.x,e.y);e.data=3;f=new List;f.append(c).append(d).append(b).append(e);a.append(this.createLineAnchor({points:f}))}return a};
TradingView.LineToolEllipse=function(a,b){this._constructor="LineToolEllipse";var c=b?b:new DefaultProperty("linetoolellipse");LineDataSource.call(this,a,new EllipsePaneView(this,a),c);this.version=TradingView.LineToolEllipse.version};inherit(TradingView.LineToolEllipse,LineDataSource);
TradingView.LineToolEllipse.prototype.startChanging=function(a,b){LineDataSource.prototype.startChanging.call(this,a,b);if(0==a||1==a){var c=this.pointToScreenPoint(this._points.item(0))[0],d=this.pointToScreenPoint(this._points.item(1))[0],e=this.pointToScreenPoint(this._points.item(2))[0];this._dist=MathEx.distanceToLine(c,d,e).distance}};
TradingView.LineToolEllipse.prototype.setPoint=function(a,b){var c=this.pointToScreenPoint(this._points.item(0))[0],d=this.pointToScreenPoint(this._points.item(1))[0],e=this.pointToScreenPoint(this._points.item(2))[0],f=this.priceScale();if(f.isPercent()){var g=this.ownerSource().firstValue();b.price=f.priceRange().convertFromPercent(b.price,g)}switch(a){case 0:c=this.pointToScreenPoint(b)[0];f=d.substract(c);c=c.add(d).scaled(0.5);d=new MathEx.Point(-f.y,f.x);d=d.normalized();e=c.add(d.scaled(this._dist));
e=this.screenPointToPoint(e);this._points.setItem(0,b);this._points.setItem(2,e);break;case 1:e=MathEx.distanceToLine(c,d,e).distance;d=this.pointToScreenPoint(b)[0];f=d.substract(c);c=c.add(d).scaled(0.5);d=new MathEx.Point(-f.y,f.x);d=d.normalized();e=c.add(d.scaled(this._dist));e=this.screenPointToPoint(e);this._points.setItem(1,b);this._points.setItem(2,e);break;case 2:b=this.pointToScreenPoint(b)[0];e=MathEx.distanceToLine(c,d,b).distance;f=d.substract(c);c=c.add(d).scaled(0.5);d=new MathEx.Point(-f.y,
f.x);d=d.normalized();e=c.add(d.scaled(e));e=this.screenPointToPoint(e);this._points.setItem(2,e);break;case 3:b=this.pointToScreenPoint(b)[0],e=MathEx.distanceToLine(c,d,b).distance,f=d.substract(c),c=c.add(d).scaled(0.5),d=new MathEx.Point(-f.y,f.x),d=d.normalized(),e=c.add(d.scaled(e)),e=this.screenPointToPoint(e),this._points.setItem(2,e)}this.normalizePoints()};TradingView.LineToolEllipse.prototype.pointsCount=function(){return 3};TradingView.LineToolEllipse.prototype.title=function(){return"Ellipse"};
TradingView.LineToolEllipse.version=2;
TradingView.LineToolEllipse.prototype.migrateVersion=function(a,b,c){1==a&&2==this._points.size()&&(b=this._points.item(0).price,c=0.5*(this._points.item(0).price+this._points.item(1).price),this._points.setItem(0,{price:c,index:this._points.item(0).index}),this._points.setItem(1,{price:c,index:this._points.item(1).index}),this._points.append({price:b,index:this._points.item(0).index}));1==a&&2==this._timePoint.size()&&(b=this._timePoint.item(0).price,c=0.5*(this._timePoint.item(0).price+this._timePoint.item(1).price),
this._timePoint.item(0).price=c,this._timePoint.item(1).price=c,a={price:b,offset:this._timePoint.item(0).offset,time_t:this._timePoint.item(0).time_t},this._timePoint.append(a))};function HorzLineRenderer(a){this._data=a}HorzLineRenderer.prototype.draw=function(a){if(0===this._data.points.size())return null;if(!1!==this._data.visible){var b=this._data.points.item(0).y,c=a.canvas.width;a.lineCap="square";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;CanvasEx.drawLine(a,0,b,c,b)}};
HorzLineRenderer.prototype.hitTest=function(a){return!1===this._data.visible||0===this._data.points.size()?null:3>=Math.abs(a.y-this._data.points.item(0).y)?new HitTestResult(this._data.hitTestResult):null};function HorzLinePaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(HorzLinePaneView,LineSourcePaneView);
HorzLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer,b={};b.points=this._points;b.color=this._source.properties().linecolor.value();b.linewidth=this._source.properties().linewidth.value();b.linestyle=this._source.properties().linestyle.value();b.hitTestResult=HitTestResult.MOVEPOINT;var c=this._source.properties();a.append(new HorzLineRenderer(b));if(this._source.properties().showLabel.value()&&1==this._points.size()){var d=c.vertLabelsAlign.value(),e=c.horzLabelsAlign.value(),
f=this._points.item(0),g=0,h=0;"left"==e?f.x=3:"right"==e?(f.x=this._model.timeScale().width(),h=-5):f.x=this._model.timeScale().width()/2;"middle"==d?g=-this._source.properties().fontsize.value()/6:"bottom"==d&&(g=-4);c={points:(new List).append(f),text:c.text.value(),color:c.textcolor.value(),vertAlign:d,horzAlign:e,font:c.font.value(),offsetX:h,offsetY:g,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()};
a.append(new TextRenderer(c,this._rendererCache))}this.isAnchorsRequired()&&(a.append(new HorzLineRenderer(b)),b=new List,b.append(new MathEx.Point(this._model.timeScale().width()/2,this._points.item(0).y)),a.append(this.createLineAnchor({points:b,hittestResult:HitTestResult.MOVEPOINT})));return a};function LineToolHorzLinePriceAxisView(a,b){this._source=a;this._model=b;this._text="";this._coordinate=0;this._background="black";this._textHeight=14}inherit(LineToolHorzLinePriceAxisView,PriceAxisView);
LineToolHorzLinePriceAxisView.prototype.update=function(){if(0!==this._source.points().size()&&this._source.priceScale()&&!this._source.priceScale().isEmpty()){this._background=this._source.properties().linecolor.value();var a=this._source.points().item(0).price;if(this._source.priceScale().isPercent()){var b=this._source.ownerSource().firstValue();if(null===b)return;a=this._source.priceScale().priceRange().convertToPercent(a,b)}this._coordinate=this._source.priceScale().priceToCoordinate(a);this._textHeight=
this._source.priceScale().m_markBuilder.fontHeight();this._source.priceScale().formatter()&&(this._text=this._source.priceScale().formatter().format(a))}};LineToolHorzLinePriceAxisView.prototype.renderer=function(){var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:!0};return new PriceAxisViewRenderer(a)};
TradingView.LineToolHorzLine=function(a,b){this._constructor="LineToolHorzLine";var c=b?b:new DefaultProperty("linetoolhorzline");LineDataSource.call(this,a,new HorzLinePaneView(this,a),c);this._priceAxisView=new LineToolHorzLinePriceAxisView(this,a)};inherit(TradingView.LineToolHorzLine,LineDataSource);TradingView.LineToolHorzLine.prototype.pointsCount=function(){return 1};TradingView.LineToolHorzLine.prototype.title=function(){return"Horizontal Line"};
TradingView.LineToolHorzLine.prototype.priceAxisViews=function(a,b){return this.isActualSymbol()?this._model.paneForSource(this)===a&&b===this.priceScale()&&this.properties().showPrice.value()?(new List).append(this._priceAxisView):null:null};TradingView.LineToolHorzLine.prototype.updateAllViews=function(){LineDataSource.prototype.updateAllViews.call(this);this._priceAxisView.update()};function HorzRayRenderer(a){this._data=a}HorzRayRenderer.prototype.draw=function(a){if(0===this._data.points.size())return null;var b=a.canvas.width,c=this._data.points.item(0).y,d=Math.max(0,this._data.points.item(0).x),b=Math.max(b,this._data.points.item(0).x);a.lineCap="square";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;CanvasEx.drawLine(a,d,c,b,c)};
HorzRayRenderer.prototype.hitTest=function(a){return 0===this._data.points.size()||a.x<this._data.points.item(0).x?null:3>=Math.abs(a.y-this._data.points.item(0).y)?new HitTestResult(this._data.hitTestResult):null};function HorzRayPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(HorzRayPaneView,LineSourcePaneView);
HorzRayPaneView.prototype.renderer=function(){var a=new CompositeRenderer,b={};b.points=this._points;b.color=this._source.properties().linecolor.value();b.linewidth=this._source.properties().linewidth.value();b.linestyle=this._source.properties().linestyle.value();b.hitTestResult=HitTestResult.MOVEPOINT;var c=this._source.properties();a.append(new HorzRayRenderer(b));if(this._source.properties().showLabel.value()&&1==this._points.size()){var b=c.vertLabelsAlign.value(),d=c.horzLabelsAlign.value(),
e=this._points.item(0).clone(),f=0,g=0;"right"==d?(e.x=this._model.timeScale().width(),g=-5):"center"==d&&(e.x=(e.x+this._model.timeScale().width())/2);"middle"==b?f=-this._source.properties().fontsize.value()/6:"bottom"==b&&(f=-4);c={points:(new List).append(e),text:c.text.value(),color:c.textcolor.value(),vertAlign:b,horzAlign:d,font:c.font.value(),offsetX:g,offsetY:f,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()};
a.append(new TextRenderer(c,this._rendererCache))}this.isAnchorsRequired()&&(c=new List,c.append(this._points.item(0)),a.append(this.createLineAnchor({points:c})));return a};function LineToolHorzRayPriceAxisView(a,b){this._source=a;this._model=b;this._text="";this._coordinate=0;this._background="black";this._textHeight=14}inherit(LineToolHorzRayPriceAxisView,PriceAxisView);
LineToolHorzRayPriceAxisView.prototype.update=function(){0!==this._source.points().size()&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&(this._background=this._source.properties().linecolor.value(),this._coordinate=this._source.priceScale().priceToCoordinate(this._source.points().item(0).price),this._textHeight=this._source.priceScale().m_markBuilder.fontHeight(),this._text=this._source.priceScale().formatter().format(this._source.points().item(0).price))};
LineToolHorzRayPriceAxisView.prototype.renderer=function(){var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:!0};return new PriceAxisViewRenderer(a)};TradingView.LineToolHorzRay=function(a,b){this._constructor="LineToolHorzRay";var c=b?b:new DefaultProperty("linetoolhorzray");LineDataSource.call(this,a,new HorzRayPaneView(this,a),c);this._priceAxisView=new LineToolHorzRayPriceAxisView(this,a)};
inherit(TradingView.LineToolHorzRay,LineDataSource);TradingView.LineToolHorzRay.prototype.pointsCount=function(){return 1};TradingView.LineToolHorzRay.prototype.title=function(){return"Horizontal Ray"};TradingView.LineToolHorzRay.prototype.priceAxisViews=function(a,b){return this.symbol()!==this._model.mainSeries().symbol()?null:this._model.paneForSource(this)===a&&b===this.priceScale()&&this.properties().showPrice.value()?(new List).append(this._priceAxisView):null};
TradingView.LineToolHorzRay.prototype.updateAllViews=function(){LineDataSource.prototype.updateAllViews.call(this);this._priceAxisView.update()};function VertLineRenderer(a,b){this._data=a;this._hittest=b}VertLineRenderer.prototype.draw=function(a){if(0!==this._data.points.size()&&!(0>=this._data.linewidth)){var b=this._data.points.item(0).x;a.translate(1,0);var c=a.canvas.width;a.lineCap="square";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;CanvasEx.drawLine(a,b,0,b,c)}};
VertLineRenderer.prototype.hitTest=function(a){if(0===this._data.points.size())return null;var b=this._hittest||new HitTestResult(HitTestResult.MOVEPOINT);return 3>=Math.abs(a.x-this._data.points.item(0).x)?b:null};function VertLinePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(VertLinePaneView,LineSourcePaneView);
VertLinePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().linecolor.value();a.linewidth=this._source.properties().linewidth.value();a.linestyle=this._source.properties().linestyle.value();if(this.isAnchorsRequired()){var b=new CompositeRenderer;b.append(new VertLineRenderer(a));a=new List;a.append(new MathEx.Point(this._points.item(0).x,this._source.priceScale().height()/2));b.append(this.createLineAnchor({points:a,hittestResult:HitTestResult.MOVEPOINT}));
return b}return new VertLineRenderer(a)};function LineToolVertLineTimeAxisView(a,b){TimeAxisView.call(this);this._source=a;this._model=b}inherit(LineToolVertLineTimeAxisView,TimeAxisView);
LineToolVertLineTimeAxisView.prototype.update=function(){if(!this._model.timeScale().isEmpty()&&0!==this._source.points().size()){this._text="";this._background=this._source.properties().linecolor.value();var a=this._source.points().item(0).index;this._coordinate=this._model.timeScale().indexToCoordinate(a);if(a=this._model.timeScale().indexToUserTime(a))this._text=(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(a)}};
LineToolVertLineTimeAxisView.prototype.renderer=function(){var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:18};return new TimeAxisViewRenderer(a)};TradingView.LineToolVertLine=function(a,b){this._constructor="LineToolVertLine";var c=b?b:new DefaultProperty("linetoolvertline");LineDataSource.call(this,a,new VertLinePaneView(this,a),c);this._timeAxisView=new LineToolVertLineTimeAxisView(this,a)};inherit(TradingView.LineToolVertLine,LineDataSource);
TradingView.LineToolVertLine.prototype.pointsCount=function(){return 1};TradingView.LineToolVertLine.prototype.title=function(){return"Vertical Line"};TradingView.LineToolVertLine.prototype.timeAxisViews=function(){return this.symbol()!==this._model.mainSeries().symbol()?null:this.properties().showTime.value()?(new List).append(this._timeAxisView):null};TradingView.LineToolVertLine.prototype.updateAllViews=function(){LineDataSource.prototype.updateAllViews.call(this);this._timeAxisView.update()};function ChannelRenderer(a){this._data=a}ChannelRenderer.prototype.extendPoints=function(a,b,c){var d=new MathEx.Point(0,-5E3);c=new MathEx.Point(c,5E3);var e=b.substract(a);(e=MathEx.intersectRayWithRect(b,b.add(e),d,c))&&(b=e);!MathEx.pointInRect(a,d,c)&&MathEx.pointInRect(b,d,c)&&(e=MathEx.intersectRayWithRect(b,a,d,c))&&(a=e);!MathEx.pointInRect(b,d,c)&&MathEx.pointInRect(a,d,c)&&(e=MathEx.intersectRayWithRect(a,b,d,c))&&(b=e);return[a,b]};
ChannelRenderer.prototype.draw=function(a){var b=a.canvas.width,c=this.extendPoints(this._data.p1,this._data.p2,b),b=this.extendPoints(this._data.p3,this._data.p4,b);a.beginPath();a.moveTo(c[0].x,c[0].y);a.lineTo(c[1].x,c[1].y);c[1].x<b[1].x&&a.lineTo(b[1].x,c[1].y);a.lineTo(b[1].x,b[1].y);a.lineTo(b[0].x,b[0].y);a.lineTo(c[0].x,c[0].y);a.fillStyle=generateColor(this._data.color,this._data.transparency);a.fill()};
ChannelRenderer.prototype.hitTest=function(a){if(!this._data.hittestOnBackground)return null;var b=this._data.width,c=this.extendPoints(this._data.p1,this._data.p2,b),b=this.extendPoints(this._data.p3,this._data.p4,b),d=[new MathEx.Point(c[0].x,c[0].y),new MathEx.Point(c[1].x,c[1].y)];c[1].x<b[1].x&&d.push(new MathEx.Point(b[1].x,c[1].y));d.push(new MathEx.Point(b[1].x,b[1].y));d.push(new MathEx.Point(b[0].x,b[0].y));d.push(new MathEx.Point(c[0].x,c[0].y));return MathEx.isInPolygon(new List(d),a)?
new HitTestResult(HitTestResult.MOVEPOINT):null};function PitchforkLinePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(PitchforkLinePaneView,LineSourcePaneView);
PitchforkLinePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);0!==this._points.size()&&(3===this._points.size()?this._medianPoint=this._points.item(1).add(this._points.item(2)).scaled(0.5):2===this._points.size()?this._medianPoint=this._points.item(1):this._medianPoint=this._points.item(0),this._medianPoint.data=3)};
PitchforkLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size()||!this._medianPoint)return a;var b={points:(new List).append(this._points.item(0)).append(this._medianPoint),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));if(3>this._points.size())return this.addAnchors(a),a;b={points:(new List).append(this._points.item(1)).append(this._points.item(2)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));for(var b=this._points.item(2).substract(this._points.item(1)).scaled(0.5),c=this._medianPoint.substract(this._points.item(0)),d=0,e=this._source.properties().fillBackground.value(),f=this._source.properties().transparency.value(),g=0;8>=g;g++){var h="level"+g,h=this._source.properties()[h];if(h.visible.value()){var k=this._medianPoint.addScaled(b,h.coeff.value()),m=k.add(c),n=this._medianPoint.addScaled(b,-h.coeff.value()),
q=n.add(c);if(e){var l={};l.width=this._model.timeScale().width();l.p1=k;l.p2=m;l.p3=this._medianPoint.addScaled(b,d);l.p4=l.p3.add(c);l.color=h.color.value();l.transparency=f;l.hittestOnBackground=TradingView.isMobile.any();a.append(new ChannelRenderer(l));l={};l.width=this._model.timeScale().width();l.p1=n;l.p2=q;l.p3=this._medianPoint.addScaled(b,-d);l.p4=l.p3.add(c);l.color=h.color.value();l.transparency=f;l.hittestOnBackground=TradingView.isMobile.any();a.append(new ChannelRenderer(l))}d=h.coeff.value();
m={points:(new List).append(k).append(m),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:h.color.value(),linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};k=new HitTestResult(HitTestResult.MOVEPOINT,null,g);a.append(new TrendLineRenderer(m,k));h={points:(new List).append(n).append(q),width:this._model.timeScale().width(),height:this._source.priceScale().height(),
color:h.color.value(),linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};k=new HitTestResult(HitTestResult.MOVEPOINT,null,g);a.append(new TrendLineRenderer(h,k))}}this.addAnchors(a);return a};function SchiffPitchforkLinePaneView(a,b){PitchforkLinePaneView.call(this,a,b)}inherit(SchiffPitchforkLinePaneView,PitchforkLinePaneView);
SchiffPitchforkLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b={points:(new List).append(this._points.item(0)).append(this._points.item(1)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));if(!this._medianPoint||!this._modifiedBase)return this.addAnchors(a),a;var c={points:(new List).append(this._modifiedBase).append(this._medianPoint),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,
leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(c));if(3>this._points.size())return this.addAnchors(a),a;c={points:(new List).append(this._points.item(1)).append(this._points.item(2)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,
extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(c));for(var c=this._points.item(2).substract(this._points.item(1)).scaled(0.5),d=this._medianPoint.substract(this._modifiedBase),e=0,f=this._source.properties().fillBackground.value(),g=this._source.properties().transparency.value(),h=0;8>=h;h++){var k="level"+h,k=this._source.properties()[k];if(k.visible.value()){var m=this._medianPoint.addScaled(c,k.coeff.value()),n=m.add(d),
q=this._medianPoint.addScaled(c,-k.coeff.value()),l=q.add(d);f&&(b={},b.p1=m,b.p2=n,b.p3=this._medianPoint.addScaled(c,e),b.p4=b.p3.add(d),b.color=k.color.value(),b.transparency=g,a.append(new ChannelRenderer(b)),b={},b.p1=q,b.p2=l,b.p3=this._medianPoint.addScaled(c,-e),b.p4=b.p3.add(d),b.color=k.color.value(),b.transparency=g,a.append(new ChannelRenderer(b)));e=k.coeff.value();m={points:(new List).append(m).append(n),width:this._model.timeScale().width(),height:this._source.priceScale().height(),
color:k.color.value(),linewidth:k.linewidth.value(),linestyle:k.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};b=new HitTestResult(HitTestResult.MOVEPOINT,null,h);a.append(new TrendLineRenderer(m,b));k={points:(new List).append(q).append(l),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:k.color.value(),linewidth:k.linewidth.value(),linestyle:k.linestyle.value(),extendleft:!1,extendright:!0,
leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};b=new HitTestResult(HitTestResult.MOVEPOINT,null,h);a.append(new TrendLineRenderer(k,b))}}this.addAnchors(a);return a};SchiffPitchforkLinePaneView.prototype.update=function(){PitchforkLinePaneView.prototype.update.call(this);1<this._points.size()&&(this._modifiedBase=this._points.item(0).add(this._points.item(1)).scaled(0.5))};function SchiffPitchfork2LinePaneView(a,b){SchiffPitchforkLinePaneView.call(this,a,b)}
inherit(SchiffPitchfork2LinePaneView,SchiffPitchforkLinePaneView);SchiffPitchfork2LinePaneView.prototype.update=function(){PitchforkLinePaneView.prototype.update.call(this);if(2<this._points.size()){var a=this._points.item(0).x,b=0.5*(this._points.item(0).y+this._points.item(1).y);this._modifiedBase=new MathEx.Point(a,b)}};function InsidePitchforkLinePaneView(a,b){PitchforkLinePaneView.call(this,a,b)}inherit(InsidePitchforkLinePaneView,PitchforkLinePaneView);
InsidePitchforkLinePaneView.prototype.update=function(){PitchforkLinePaneView.prototype.update.call(this);1<this._points.size()&&(this._modifiedBase=this._points.item(0).add(this._points.item(1)).scaled(0.5))};
InsidePitchforkLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;if(!this._medianPoint||!this._modifiedBase)return this.addAnchors(a),a;if(3==this._points.size()){var b={points:(new List).append(this._modifiedBase).append(this._points.item(2)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),
extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b))}var c={points:(new List).append(this._points.item(0)).append(this._points.item(1)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,
leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(c));if(3>this._points.size())return this.addAnchors(a),a;b={points:(new List).append(this._points.item(1)).append(this._points.item(2)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,
extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));var b=this._points.item(2).substract(this._points.item(1)).scaled(0.5),d=this._points.item(2).substract(this._modifiedBase),e=0,f=this._source.properties().fillBackground.value(),g=this._source.properties().transparency.value(),h={points:(new List).append(this._medianPoint).append(this._medianPoint.add(d)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),
color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(h));for(h=0;8>=h;h++){var k="level"+h,k=this._source.properties()[k];if(k.visible.value()){var m=this._medianPoint.addScaled(b,k.coeff.value()),n=m.add(d),q=this._medianPoint.addScaled(b,-k.coeff.value()),
l=q.add(d);f&&(c={},c.p1=m,c.p2=n,c.p3=this._medianPoint.addScaled(b,e),c.p4=c.p3.add(d),c.color=k.color.value(),c.transparency=g,a.append(new ChannelRenderer(c)),c={},c.p1=q,c.p2=l,c.p3=this._medianPoint.addScaled(b,-e),c.p4=c.p3.add(d),c.color=k.color.value(),c.transparency=g,a.append(new ChannelRenderer(c)));e=k.coeff.value();m={points:(new List).append(m).append(n),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:k.color.value(),linewidth:k.linewidth.value(),
linestyle:k.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};c=new HitTestResult(HitTestResult.MOVEPOINT,null,h);a.append(new TrendLineRenderer(m,c));k={points:(new List).append(q).append(l),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:k.color.value(),linewidth:k.linewidth.value(),linestyle:k.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};
c=new HitTestResult(HitTestResult.MOVEPOINT,null,h);a.append(new TrendLineRenderer(k,c))}}this.addAnchors(a);return a};TradingView.LineToolPitchfork=function(a,b){this._constructor="LineToolPitchfork";var c=b?b:new DefaultProperty("linetoolpitchfork");LineDataSource.call(this,a,new PitchforkLinePaneView(this,a),c);this._properties.style.listeners().subscribe(this,TradingView.LineToolPitchfork.prototype._recreatePaneView);this._recreatePaneView()};inherit(TradingView.LineToolPitchfork,LineDataSource);
TradingView.LineToolPitchfork.STYLE_ORIGINAL=0;TradingView.LineToolPitchfork.STYLE_SCHIFF=1;TradingView.LineToolPitchfork.STYLE_INSIDE=2;TradingView.LineToolPitchfork.STYLE_SCHIFF2=3;
TradingView.LineToolPitchfork.prototype.additionalActions=function(){for(var a=[],b=["Original","Modified Schiff","Inside","Schiff"],c=0;4>c;c++){var d=new Action({checked:this.properties().style.value()==c,checkable:!0,text:$.t(b[c]),callbackContext:{target:this,value:c}});d.callbacks().subscribe(null,function(a){var b=a.callbackContext();a=b.target;b=b.value;a.properties().style.setValue(b);a.updateAllViews();a._model.updateSource(a)});a.push(d)}return[a[0],a[3],a[1],a[2]]};
TradingView.LineToolPitchfork.prototype._recreatePaneView=function(){this._properties.style.value()==TradingView.LineToolPitchfork.STYLE_ORIGINAL?this._paneViews=[new PitchforkLinePaneView(this,this._model)]:this._properties.style.value()==TradingView.LineToolPitchfork.STYLE_SCHIFF?this._paneViews=[new SchiffPitchforkLinePaneView(this,this._model)]:this._properties.style.value()==TradingView.LineToolPitchfork.STYLE_SCHIFF2?this._paneViews=[new SchiffPitchfork2LinePaneView(this,this._model)]:this._properties.style.value()==
TradingView.LineToolPitchfork.STYLE_INSIDE&&(this._paneViews=[new InsidePitchforkLinePaneView(this,this._model)])};TradingView.LineToolPitchfork.prototype.pointsCount=function(){return 3};TradingView.LineToolPitchfork.prototype.title=function(){return $.t("Pitchfork")};TradingView.LineToolPitchfork.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function PitchfanLinePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(PitchfanLinePaneView,LineSourcePaneView);PitchfanLinePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);0!==this._points.size()&&(3===this._points.size()?this._medianPoint=this._points.item(1).add(this._points.item(2)).scaled(0.5):2===this._points.size()?this._medianPoint=this._points.item(1):this._medianPoint=this._points.item(0),this._medianPoint.data=3)};
PitchfanLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size()||!this._medianPoint)return a;var b={points:(new List).append(this._points.item(0)).append(this._medianPoint),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));if(3>this._points.size())return this.addAnchors(a),a;b={points:(new List).append(this._points.item(1)).append(this._points.item(2)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(b));for(var b=0,c=this._points.item(2).substract(this._points.item(1)).scaled(0.5),d=this._source.properties().fillBackground.value(),e=this._source.properties().transparency.value(),f=0;8>=f;f++){var g="level"+f,g=this._source.properties()[g];if(g.visible.value()){var h=this._medianPoint.addScaled(c,g.coeff.value()),k=this._medianPoint.addScaled(c,-g.coeff.value());if(d){var m={};m.width=this._model.timeScale().width();m.p1=this._points.item(0);
m.p2=h;m.p3=this._points.item(0);m.p4=this._medianPoint.addScaled(c,b);m.color=g.color.value();m.transparency=e;m.hittestOnBackground=TradingView.isMobile.any();a.append(new ChannelRenderer(m));m={};m.width=this._model.timeScale().width();m.p1=this._points.item(0);m.p2=k;m.p3=this._points.item(0);m.p4=this._medianPoint.addScaled(c,-b);m.color=g.color.value();m.transparency=e;m.hittestOnBackground=TradingView.isMobile.any();a.append(new ChannelRenderer(m))}b=g.coeff.value();m={points:(new List).append(this._points.item(0)).append(h),
width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:g.color.value(),linewidth:g.linewidth.value(),linestyle:g.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};h=new HitTestResult(HitTestResult.MOVEPOINT,null,f);a.append(new TrendLineRenderer(m,h));g={points:(new List).append(this._points.item(0)).append(k),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:g.color.value(),
linewidth:g.linewidth.value(),linestyle:g.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};h=new HitTestResult(HitTestResult.MOVEPOINT,null,f);a.append(new TrendLineRenderer(g,h))}}this.addAnchors(a);return a};TradingView.LineToolPitchfan=function(a,b){this._constructor="LineToolPitchfan";var c=b?b:new DefaultProperty("linetoolpitchfan");LineDataSource.call(this,a,new PitchfanLinePaneView(this,a),c)};
inherit(TradingView.LineToolPitchfan,LineDataSource);TradingView.LineToolPitchfan.prototype.pointsCount=function(){return 3};TradingView.LineToolPitchfan.prototype.title=function(){return"Pitchfan"};TradingView.LineToolPitchfan.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};TradingView.LineToolSchiffPitchfork=function(a,b){var c=b?b:new DefaultProperty("linetoolschiffpitchfork");TradingView.LineToolPitchfork.call(this,a,c);this._constructor="LineToolSchiffPitchfork"};inherit(TradingView.LineToolSchiffPitchfork,TradingView.LineToolPitchfork);TradingView.LineToolSchiffPitchfork.prototype.title=function(){return $.t("Modified Schiff Pitchfork")};TradingView.LineToolSchiffPitchfork2=function(a,b){var c=b?b:new DefaultProperty("linetoolschiffpitchfork2");TradingView.LineToolPitchfork.call(this,a,c);this._constructor="LineToolSchiffPitchfork2"};inherit(TradingView.LineToolSchiffPitchfork2,TradingView.LineToolPitchfork);TradingView.LineToolSchiffPitchfork2.prototype.title=function(){return $.t("Schiff Pitchfork")};TradingView.LineToolInsidePitchfork=function(a,b){var c=b?b:new DefaultProperty("linetoolinsidepitchfork");TradingView.LineToolPitchfork.call(this,a,c);this._constructor="LineToolInsidePitchfork"};inherit(TradingView.LineToolInsidePitchfork,TradingView.LineToolPitchfork);TradingView.LineToolInsidePitchfork.prototype.title=function(){return $.t("Inside Pitchfork")};function TextRenderer(a,b,c){this._textSizeCache=b;this._data=a;this._fontSize=a.fontsize?a.fontsize:20;a.lines=this._lines=this.wordWrap(a.text,a.wordWrapWidth);this._hittest=c?c:new HitTestResult(HitTestResult.MOVEPOINT)}
(function(){var a;TextRenderer.prototype.wordWrap=function(b,c){if(!a){var d=document.createElement("canvas");d.width=0;d.height=0;a=d.getContext("2d")}c=+c;d=(b+"").split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);d[d.length-1]||d.pop();if(!isFinite(c)||0>=c)return d;a.font=this.fontStyle();for(var e=[],f=0;f<d.length;f++){var g=d[f],h=a.measureText(g).width;if(h<=c)e.push(g);else for(g=g.split(/([-\)\]\},.!?:;])|(\s+)/);g.length;){h=~~(c/h*(g.length+2)/3);if(0>=h||a.measureText(g.slice(0,3*h-1).join("")).width<=
c)for(;a.measureText(g.slice(0,3*(h+1)-1).join("")).width<=c;)h++;else for(;0<h&&a.measureText(g.slice(0,3*--h-1).join("")).width>c;);if(0<h)e.push(g.slice(0,3*h-1).join("")),g.splice(0,3*h);else{var h=g[0]+(g[1]||""),k=1===k?1:~~(c/a.measureText(h)*h.length);if(a.measureText(h.substr(0,k)).width<=c)for(;a.measureText(h.substr(0,k+1)).width<=c;)k++;else for(;1<k&&a.measureText(h.substr(0,--k)).width>c;);1>k&&(k=1);e.push(h.substr(0,k));g[0]=h.substr(k);g[1]=""}h=a.measureText(g.join("")).width;if(h<=
c){e.push(g.join(""));break}}}return e}})();TextRenderer.prototype._x=function(){return this._data.points.item(0).x+this._data.offsetX};TextRenderer.prototype._y=function(){var a=this._fontSize*this._lines.length;this._data.scaleY&&(a*=this._data.scaleY);var b=this._data.points.item(0).y+this._data.offsetY+a;switch(this._data.vertAlign){case "bottom":b-=a;break;case "middle":b-=a/2}return b};
TextRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._fontSize+"px "+this._data.font};
TextRenderer.prototype.draw=function(a){if(0!==this._data.points.size()){var b=this._x(),c=this._y(),d=this._fontSize;this._data.scaleY&&(d*=this._data.scaleY);c-=d*(this._lines.length-1);a.textBaseline="alphabetic";a.font=this.fontStyle();switch(this._data.horzAlign){case "left":a.textAlign="start";break;case "right":a.textAlign="end";break;case "center":a.textAlign="center"}a.translate(b+0.5,c+0.5);c=b=0;d=this._fontSize;if(this._data.scaleX&&this._data.scaleY){var e=Math.min(this._data.scaleX,
this._data.scaleY);a.scale(e,e)}var e=[],f;if(this._data.wordWrapWidth){f=this._data.wordWrapWidth;for(var g=0;g<this._lines.length;g++)e.push(this._data.wordWrapWidth)}else for(g=f=0;g<this._lines.length;g++){var h=a.measureText(this._lines[g]).width;e.push(h);f=Math.max(f,h)}if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){g=b;switch(this._data.horzAlign){case "right":g-=f;break;case "center":g-=f/2}var k=d*this._lines.length,m=~~(d/6);
this._data.backgroundHorzInflate&&(f+=2*this._data.backgroundHorzInflate,g-=this._data.backgroundHorzInflate);this._data.backgroundVertInflate&&(k+=2*this._data.backgroundVertInflate,c+=this._data.backgroundVertInflate);g=Math.floor(g-m);h=Math.floor(c-d);f=Math.ceil(f+2*m);k=Math.ceil(k+2*m);0!=f%2&&f++;this._data.backgroundVertInflate&&(c+=this._data.backgroundVertInflate);if(this._data.backgroundRoundRect){if(a.roundRect(g,h,f,k,this._data.backgroundRoundRect),this._data.backgroundColor&&(a.fillStyle=
this._data.backgroundColor,a.globalAlpha=this._data.backgroundTransparency,a.fill(),a.globalAlpha=1),this._data.borderColor){var n=~~Math.max(d/12,1);a.strokeStyle=this._data.borderColor;a.lineWidth=n;a.stroke()}}else if(this._data.backgroundColor&&(a.fillStyle=this._data.backgroundColor,a.globalAlpha=this._data.backgroundTransparency,a.fillRect(g,h,f,k),a.globalAlpha=1),this._data.borderColor)n=~~Math.max(d/12,1),a.strokeStyle=this._data.borderColor,a.lineWidth=n,a.strokeRect(g-n/2,h-n/2,f+n,k+n);
else if(this._data.highlightBorder){a.strokeStyle=this._data.color;a.lineWidth=1;a.beginPath();var q=[3,1];a.dashedLineTo(g-0.5,n=h-0.5,m=g+f+0.5,n,q);a.dashedLineTo(m,n,m,n=h+k+0.5,q);a.dashedLineTo(m=g-0.5,n,g+f+0.5,n,q);a.dashedLineTo(m,h-0.5,m,n,q);a.globalAlpha=0.5;a.stroke();a.globalAlpha=1}}a.fillStyle=this._data.color;for(g=0;g<this._lines.length;g++)a.fillText(this._lines[g],b,c),c+=d;this._textSizeCache&&(this._textSizeCache.widths=e)}};
TextRenderer.prototype.hitTest=function(a){if(0===this._data.points.size())return null;var b=this._fontSize;this._data.scaleY&&(b*=this._data.scaleY);var c=this._textSizeCache.widths;if(!c)return null;for(var d=0,e=0;e<c.length;e++)d=Math.max(d,c[e]);this._data.scaleX&&(d*=this._data.scaleX);c=this._data.points.item(0).x+this._data.offsetX;e=this._data.points.item(0).y+this._data.offsetY;"bottom"==this._data.vertAlign&&(e-=this._lines.length*this._fontSize);"middle"==this._data.vertAlign&&(e-=this._lines.length*
this._fontSize/2);"right"==this._data.horzAlign?c-=d:"center"==this._data.horzAlign&&(c-=d/2);var f=this._data.backgroundColor||this._data.borderColor?~~(b/6):0,b=this._data.borderColor?~~Math.max(b/12,1):0;return a.x>=c-f-b&&a.x<=c+d+f+b&&a.y>=e-b&&a.y<=e+this._lines.length*this._fontSize+2*f+b?this._hittest:null};function TextPaneView(a,b,c,d,e,f){LineSourcePaneView.call(this,a,b);this._offsetX=c;this._offsetY=d;this._vertAlign=e;this._horzAlign=f;this._rendererCache={};this._renderer=null}
inherit(TextPaneView,LineSourcePaneView);TextPaneView.prototype.update=function(){this._renderer=null;LineSourcePaneView.prototype.update.call(this)};
TextPaneView.prototype.renderer=function(){if(this._renderer)return this._renderer;var a=this._source.priceScale();if(a.isEmpty())return this._renderer=new CompositeRenderer;var b={},c=this._source.properties(),d=c.locked&&c.locked.value();b.points=d?this._source.fixedPoints():this._points;b.text=c.text.value();b.color=c.color.value();b.font=c.font.value();b.offsetX=this._offsetX?this._offsetX:0;b.offsetY=this._offsetY?this._offsetY:0;b.vertAlign=this._vertAlign?this._vertAlign:"top";b.horzAlign=
this._horzAlign?this._horzAlign:"left";b.fontsize=c.fontsize.value();c.fillBackground&&c.fillBackground.value()&&(b.backgroundColor=c.backgroundColor.value(),b.backgroundTransparency=1-c.backgroundTransparency.value()/100||0);c.drawBorder&&c.drawBorder.value()&&(b.borderColor=c.borderColor.value());c.wordWrap&&c.wordWrap.value()&&(b.wordWrapWidth=c.wordWrapWidth.value());b.bold=c.bold&&c.bold.value();b.italic=c.italic&&c.italic.value();b.highlightBorder=this._model.selectedSource()===this._source;
d||!c.fixedSize||c.fixedSize.value()||(b.scaleX=this._source._model.timeScale().barSpacing()/this._source._barSpacing,c=a.height()/a.priceRange().length(),this._source._isPriceDencityLog&&!a.isLog()&&(c=a.priceRange().minValue(),d=a.priceRange().maxValue(),c=a._toLog(c),d=a._toLog(d),c=d-c,c=a.height()/c),!this._source._isPriceDencityLog&&a.isLog()&&(c=a.priceRange().minValue(),d=a.priceRange().maxValue(),c=a._fromLog(c),d=a._fromLog(d),c=d-c,c=a.height()/c),b.scaleY=c/this._source._priceDencity,
(!isFinite(b.scaleY)||0>=b.scaleY)&&delete b.scaleY);c=new TextRenderer(b,this._rendererCache);this.isAnchorsRequired()&&1===b.points.size()&&!this._noSelection?(d=b.points.item(0),a=new CompositeRenderer,a.append(c),b.wordWrapWidth&&(b=new MathEx.Point(d.x+b.wordWrapWidth+~~(b.fontsize/6),d.y+(b.lines?b.lines.length*b.fontsize/2+~~(b.fontsize/6):0)),b.data=0,a.append(this.createLineAnchor({points:(new List).append(b)}))),this._renderer=a):this._renderer=c;return this._renderer};
TradingView.LineToolText=function(a,b){this._constructor="LineToolText";var c=b?b:new DefaultProperty("linetooltext");LineDataSource.call(this,a,new TextPaneView(this,a),c);this._timeScale=a.timeScale();this._barSpacing=a.timeScale().barSpacing()};inherit(TradingView.LineToolText,LineDataSource);TradingView.LineToolText.MIN_WIDTH=100;
TradingView.LineToolText.prototype.setPoint=function(a,b){var c=this.properties();if(0===a&&c.wordWrapWidth&&c.wordWrapWidth.value()){var d=c.locked&&c.locked.value()?this.fixedPoints().item(0).x:this._timeScale.indexToCoordinate(this.points().item(0).index),d=this._timeScale.indexToCoordinate(b.index)-d-~~(c.fontsize.value()/6);isFinite(d)&&c.wordWrapWidth.setValue(Math.max(TradingView.LineToolText.MIN_WIDTH,d))}};TradingView.LineToolText.prototype.pointsCount=function(){return 1};
TradingView.LineToolText.prototype.title=function(){return $.t("Text")};TradingView.LineToolText.prototype.setPriceScale=function(a){DataSource.prototype.setPriceScale.call(this,a);a&&a.priceRange()&&(this._priceDencity=a.height()/a.priceRange().length(),this._isPriceDencityLog=a.isLog())};
TradingView.LineToolText.prototype.restoreSize=function(){this._barSpacing=this._model.timeScale().barSpacing();this._priceDencity=this.priceScale().height()/this.priceScale().priceRange().length();this.updateAllViews();this._model.updateSource(this)};TradingView.LineToolTextAbsolute=function(a,b){var c=b?b:new DefaultProperty("linetooltextabsolute");TradingView.LineToolText.call(this,a,c)};inherit(TradingView.LineToolTextAbsolute,TradingView.LineToolText);
TradingView.LineToolTextAbsolute.prototype.title=function(){return $.t("Anchored Text")};TradingView.LineToolText.prototype.state=function(a){var b=LineDataSource.prototype.state.call(this,a);a&&(b.state.fixedSize=!1);return b};TradingView.LineToolThumbUp=function(a,b){this._constructor="LineToolThumbUp";var c=b?b:new Property(defaults("linetoolthumbup"));LineDataSource.call(this,a,new MarkPaneView(this,a,this.image,20,20,-11,0),c);this._paneViews[0].setAnchors(new MathEx.Point(0,0))};inherit(TradingView.LineToolThumbUp,LineDataSource);TradingView.LineToolThumbUp.prototype.image=new Image;TradingView.LineToolThumbUp.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAACG0lEQVR4AWMgBajE205TTrD7D8R7VRJtQxgoBSDD9r++8n/68bX/leNt91NkmEKCg4BOhvv/7S/O/d/y9DTIlT8pMlAx3q4kqDv7/9KHB/8vfXAAZOAfsg0DhpeoerLT/zmXtv6ffXfn/6ZD8/4rxdqcJT/s4m168pa0/V/1+Mj/6Xe2/XdvTfovF2SWS57rEmxCjfP9/q95cOT//Pt7/k+6sem/SpLDfwZBQX4yYtXBA+TVicdW/l/+6ND/aXe2gl0YPa0MFIYQnGi3TjHB3hVFI0wSxoZhy5Lg/70Hlv5f//TE/zn3dv2feGvj/5l3d4D5e19dAieh3v1LgGptN+AzEKQQjPcANW16dvr/wgf7/k+5vfl//80N/6fd3gqO6Y3PTv7f8vzM/x0vzoP14jVw24uzQINO/V/75DjYsKlAQybc3AgyEORKsKGzgC6dC3T1ikeHCRu45OEBcPKYcWf7/8m3N8MMQ8cgcZChhA2cfW8nRBNhDFI7yA3sPb/6v3Kc7VOqGZi2rPm/fITFLKoY2Hxq8X+dTPf/km66xkQlbM101/+WFaH/XVoT/6esbPrfcmbJ/+6ra/4X75r0P3p+5X8toLxckEknUBsbvhzHCcRSoGzMKSNsJmKmFClup1EhG2C6QzHG+h2wYP0pH2p+RcbPaImgtpQ1UB0XEDMSzMdQRcxAzA7EvEAsCsSyQCwPtVAAiFnRDQMAkGceWYhDo88AAAAASUVORK5CYII=";
TradingView.LineToolThumbUp.prototype.pointsCount=function(){return 1};TradingView.LineToolThumbUp.prototype.title=function(){return"Thumb Up"};TradingView.LineToolThumbDown=function(a,b){this._constructor="LineToolThumbDown";var c=b?b:new DefaultProperty("linetoolthumbdown");LineDataSource.call(this,a,new MarkPaneView(this,a,this.image,20,20,-6,-18),c);this._paneViews[0].setAnchors(new MathEx.Point(0,0))};inherit(TradingView.LineToolThumbDown,LineDataSource);
TradingView.LineToolThumbDown.prototype.image=new Image;TradingView.LineToolThumbDown.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAB70lEQVR4AWNAB4dsVUT3WCrU7bOQP7zXQuH/Xgv523stFSbsNley2e+gzcNACgBqLNhvq/r/SkbQ/wcNWf9fT6n//7Sj6P+N/Ij/JwIs/4PkIJYgMFgfgo0Au8xlVA/Yq/9/3JL//3lrwf+nNan/H1ck/n9Slfz/WVPO/xddpf9fTaj+/2pSLRi/ntaI38Ad5goTrmUF/39am/7/IdBFD7KC/t9P9///IDPw/8Oc0P+PCqP+PyqJ/f+4NA6MnzVk4Tdwj4XCg0dVKf8f5oX/v5/mRwiDDMVtIFQQ5D2Qi6hn4OOyeJBiqhkIUjSSDNxsKrf3RoovKKlgMwAsfj3W9f8RJy3iEvZ8A5moVcayJ2CS5wIt/z/ICIAbdjPR8/8+K6X/TepiZUDlakAsBcSc+HIeGxCLArGCNh+r6V5Lxf8Pc0PBBt7LDPp/yEHj/1QdiWKgPBcQM5GUp7eYycWf9Lf4/6goGuzKixEO/xcbyC6AuoiRgVSw01z+2L3S+P+PCiL/30kP+L/fRuV/oZKgLumGIWL8z9PaNGA2DPt/OsDi/0I9mS6gMCvpJiHy9a9HZXHgQuKAnfr/UhUxZbDryAXbzOQv384KBpUusOTAwkAJWGokXbjRWO4WyLANJnILwa6jELADsTgQS4JjlgQAAD+B93SzAgQRAAAAAElFTkSuQmCC";
TradingView.LineToolThumbDown.prototype.pointsCount=function(){return 1};TradingView.LineToolThumbDown.prototype.title=function(){return"Thumb Down"};TradingView.LineToolThumbDown.prototype.version=TradingView.LineToolThumbUp.prototype.version=2;TradingView.LineToolThumbUp.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(12,0)))};
TradingView.LineToolThumbDown.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(7,18)))};function BalloonRenderer(a,b){this._measureCache=b;this._data=a}
BalloonRenderer.prototype.draw=function(a){if(0!==this._data.points.size()){a.font=[this._data.fontWeight,this._data.fontSize+"px",this._data.fontFamily].join(" ");var b=a.measureText(this._data.label);b.height=this._data.fontSize;var c={left:15,top:(30-b.height)/2},b=b.width+2*c.left,d=this._data.points.item(0).x-(c.left+20),e=this._data.points.item(0).y-39;this._measureCache&&$.extend(this._measureCache,{innerWidth:b,innerHeight:30,padding:c});a.translate(0.5+d,0.5+e);a.beginPath();a.moveTo(24,
30);a.lineTo(15,30);a.arcTo(-1E3,0,1E3,0,15);a.lineTo(b-15,0);a.arcTo(1E3,30,-1E3,30,15);a.lineTo(33,30);a.quadraticCurveTo(33,34,35,39);a.quadraticCurveTo(27,36,24,30);a.fillStyle=generateColor(this._data.backgroundColor,this._data.transparency);a.fill();a.strokeStyle=this._data.borderColor;a.lineWidth=2;a.stroke();a.closePath();a.textBaseline="top";a.fillStyle=this._data.color;a.fillText(this._data.label,c.left,c.top-1)}};
BalloonRenderer.prototype.hitTest=function(a){if(0===this._data.points.size()||!this._measureCache.padding)return null;var b=this._data.points.item(0).x-(this._measureCache.padding.left+20),c=this._data.points.item(0).y-(this._measureCache.innerHeight+9);return MathEx.pointInRect(a,new MathEx.Point(b,c),new MathEx.Point(b+this._measureCache.innerWidth,c+this._measureCache.innerHeight))?new HitTestResult(HitTestResult.MOVEPOINT):null};
function BalloonPaneView(a,b){LineSourcePaneView.call(this,a,b);this._image=TradingView.getImage("balloon",TradingView.wrapUrl("/static/images/balloon.png"));$(this._image).load(function(){b.updateSource(a)});this._rendererCache={}}inherit(BalloonPaneView,LineSourcePaneView);
BalloonPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().color.value();a.borderColor=this._source.properties().borderColor.value();a.backgroundColor=this._source.properties().backgroundColor.value();a.transparency=this._source.properties().transparency.value();a.fontWeight=this._source.properties().fontWeight.value();a.fontSize=this._source.properties().fontsize.value();a.fontFamily=this._source.properties().font.value();a.label=this._source.properties().text.value();
a.image=this._image;if(this.isAnchorsRequired()&&1==a.points.size()){var b=new CompositeRenderer;b.append(new BalloonRenderer(a,this._rendererCache));b.append(new SelectionRenderer({points:a.points}));return b}return new BalloonRenderer(a,this._rendererCache)};TradingView.LineToolBalloon=function(a,b){this._constructor="LineToolBalloon";var c=b?b:new DefaultProperty("linetoolballoon");LineDataSource.call(this,a,new BalloonPaneView(this,a),c)};inherit(TradingView.LineToolBalloon,LineDataSource);
TradingView.LineToolBalloon.prototype.pointsCount=function(){return 1};TradingView.LineToolBalloon.prototype.title=function(){return"Balloon"};function CalloutRenderer(a,b){this._data=a;a.lines=this.wordWrap(a.text,a.wordWrapWidth);this._textSizeCache=b}CalloutRenderer.ROUND_RADIUS=8;CalloutRenderer.TEXT_MARGINS=2;
(function(){var a;CalloutRenderer.prototype.wordWrap=function(b,c){if(!a){var d=document.createElement("canvas");d.width=0;d.height=0;a=d.getContext("2d")}c=+c;d=(b+"").split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);d[d.length-1]||d.pop();if(!isFinite(c)||0>=c)return d;a.font=this.fontStyle();for(var e=[],f=0;f<d.length;f++){var g=d[f],h=a.measureText(g).width;if(h<=c)e.push(g);else for(g=g.split(/([-\)\]\},.!?:;])|(\s+)/);g.length;){h=~~(c/h*(g.length+2)/3);if(0>=h||a.measureText(g.slice(0,3*h-1).join("")).width<=
c)for(;a.measureText(g.slice(0,3*(h+1)-1).join("")).width<=c;)h++;else for(;0<h&&a.measureText(g.slice(0,3*--h-1).join("")).width>c;);if(0<h)e.push(g.slice(0,3*h-1).join("")),g.splice(0,3*h);else{var h=g[0]+(g[1]||""),k=1===k?1:~~(c/a.measureText(h)*h.length);if(a.measureText(h.substr(0,k)).width<=c)for(;a.measureText(h.substr(0,k+1)).width<=c;)k++;else for(;1<k&&a.measureText(h.substr(0,--k)).width>c;);1>k&&(k=1);e.push(h.substr(0,k));g[0]=h.substr(k);g[1]=""}h=a.measureText(g.join("")).width;if(h<=
c){e.push(g.join(""));break}}}return e}})();CalloutRenderer.prototype.hitTest=function(a){if(2>this._data.points.size())return null;var b=this._data.points.item(0),c=this._data.points.item(1);if(3>b.substract(a).length())return new HitTestResult(HitTestResult.CHANGEPOINT,0);b=c.x-this._textSizeCache.totalWidth/2;c=c.y-this._textSizeCache.totalHeight/2;return a.x>=b&&a.x<=b+this._textSizeCache.totalWidth&&a.y>=c&&a.y<=c+this._textSizeCache.totalHeight?new HitTestResult(HitTestResult.MOVEPOINT):null};
CalloutRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font};
CalloutRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){var b=this._data.points.item(0).clone(),c=this._data.points.item(1).clone();a.lineCap="butt";a.strokeStyle=this._data.bordercolor;a.lineWidth=this._data.linewidth;a.textBaseline="bottom";a.font=this.fontStyle();var d=this._data.fontSize*this._data.lines.length,e=this._data.wordWrapWidth||this._data.lines.reduce(function(b,c){return Math.max(b,a.measureText(c).width)},0);this._textSizeCache.textHeight=d;this._textSizeCache.textHeight=
e;var f=CalloutRenderer.ROUND_RADIUS,g=CalloutRenderer.TEXT_MARGINS,h=e+2*g+2*f,k=d+2*g+2*f;this._textSizeCache.totalWidth=h;this._textSizeCache.totalHeight=k;var m=c.x-h/2,n=c.y-k/2,q=0,e=e+2*g>2*f,d=d+2*g>2*f;b.x>m+h?q=20:b.x>m&&(q=10);b.y>n+k?q+=2:b.y>n&&(q+=1);a.save();a.translate(m,n);b.x-=m;b.y-=n;c.x-=m;c.y-=n;a.beginPath();a.moveTo(f,0);10==q&&(e?(a.lineTo(c.x-f,0),a.lineTo(b.x,b.y),a.lineTo(c.x+f,0)):a.lineTo(b.x,b.y));a.lineTo(h-f,0);20==q?(a.lineTo(b.x,b.y),a.lineTo(h,f)):a.arcTo(h,0,h,
f,f);21==q&&(d?(a.lineTo(h,c.y-f),a.lineTo(b.x,b.y),a.lineTo(h,c.y+f)):a.lineTo(b.x,b.y));a.lineTo(h,k-f);22==q?(a.lineTo(b.x,b.y),a.lineTo(h-f,k)):a.arcTo(h,k,h-f,k,f);12==q&&(e?(a.lineTo(c.x+f,k),a.lineTo(b.x,b.y),a.lineTo(c.x-f,k)):a.lineTo(b.x,b.y));a.lineTo(f,k);2==q?(a.lineTo(b.x,b.y),a.lineTo(0,k-f)):a.arcTo(0,k,0,k-f,f);1==q&&(d?(a.lineTo(0,c.y+f),a.lineTo(b.x,b.y),a.lineTo(0,c.y-f)):a.lineTo(b.x,b.y));a.lineTo(0,f);0==q?(a.lineTo(b.x,b.y),a.lineTo(f,0)):a.arcTo(0,0,f,0,f);a.stroke();a.fillStyle=
generateColor(this._data.backcolor,this._data.transparency);a.fill();a.fillStyle=this._data.color;n=f+g+this._data.fontSize;m=f+g;for(b=0;b<this._data.lines.length;b++)a.fillText(this._data.lines[b],m,n),n+=this._data.fontSize;a.restore()}};function CalloutPaneView(a,b){LineSourcePaneView.call(this,a,b);this._textSizeCache={}}inherit(CalloutPaneView,LineSourcePaneView);CalloutPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._source._calculatePoint2()};
CalloutPaneView.prototype.renderer=function(){if(!this._points.item(0))return new CompositeRenderer;if(!(2>this._points.size(0))){var a=this._source.properties(),b={};b.points=new List;b.points.append(this._points.item(0));var c=this._points.item(1).clone();c.x=this._points.item(0).x+this._source._barOffset*this._model.timeScale().barSpacing();b.points.append(c);b.color=a.color.value();b.linewidth=a.linewidth.value();b.backcolor=a.backgroundColor.value();b.transparency=a.transparency.value();b.text=
a.text.value();b.font=a.font.value();b.fontSize=a.fontsize.value();b.bordercolor=a.bordercolor.value();a.wordWrap&&a.wordWrap.value()&&(b.wordWrapWidth=a.wordWrapWidth.value());b.bold=a.bold&&a.bold.value();b.italic=a.italic&&a.italic.value();c=new CalloutRenderer(b,this._textSizeCache);if(this.isAnchorsRequired()){a=new CompositeRenderer;a.append(c);var c=b.points.item(1),d=b.points.clone();d.removeAt(d.size()-1);a.append(this.createLineAnchor({points:d}));b.wordWrapWidth&&(b=new MathEx.Point(c.x+
(b.wordWrapWidth>>1)+CalloutRenderer.ROUND_RADIUS+CalloutRenderer.TEXT_MARGINS,c.y),b.data=1,a.append(this.createLineAnchor({points:(new List).append(b)})));return a}return c}};TradingView.LineToolCallout=function(a,b){this._constructor="LineToolCallout";var c=b?b:new DefaultProperty("linetoolcallout");LineDataSource.call(this,a,new CalloutPaneView(this,a),c);this._barOffset=0;this._timeScale=a.timeScale()};inherit(TradingView.LineToolCallout,LineDataSource);
TradingView.LineToolCallout.MIN_WIDTH=100;TradingView.LineToolCallout.prototype.pointsCount=function(){return 2};TradingView.LineToolCallout.prototype.title=function(){return"Callout"};TradingView.LineToolCallout.prototype.correctPoints=function(a){var b=this._currentMovingPoint.index-this._startMovingPoint.index,c=this._currentMovingPoint.price-this._startMovingPoint.price,d=a.item(1);d.index+=b;d.price+=c;a.setItem(1,d)};
TradingView.LineToolCallout.prototype.addPoint=function(a){(a=LineDataSource.prototype.addPoint.call(this,a))&&this._calculateBarOffset();return a};TradingView.LineToolCallout.prototype._calculateBarOffset=function(){1<this.points().size()&&(this._barOffset=this.points().item(1).index-this.points().item(0).index)};TradingView.LineToolCallout.prototype.setLastPoint=function(a){LineDataSource.prototype.setLastPoint.call(this,a);2==this.points().size()&&this._calculateBarOffset()};
TradingView.LineToolCallout.prototype.setPoint=function(a,b){switch(a){case 0:LineDataSource.prototype.setPoint.call(this,a,b);this._calculateBarOffset();break;case 1:var c=this.properties();if(!c.wordWrapWidth)break;var d=this._points,e=this._dragStartLeftEdgeIndex,f=Math.round((b.index-e)/2);if(isFinite(e)&&isFinite(f)){d.setItem(1,{index:e+f,price:d.item(1).price});this._calculateBarOffset();this.normalizePoints();d=this._timeScale.indexToCoordinate(e+2*f)-this._timeScale.indexToCoordinate(e)-
CalloutRenderer.ROUND_RADIUS-CalloutRenderer.TEXT_MARGINS;if(!isFinite(d))break;c.wordWrapWidth.setValue(Math.max(TradingView.LineToolCallout.MIN_WIDTH,d))}else d.setItem(1,b),this._calculateBarOffset(),this.normalizePoints()}};TradingView.LineToolCallout.prototype.startDragPoint=function(a,b){var c=this.properties();1===a&&c.wordWrap&&c.wordWrap.value()&&(this._dragStartLeftEdgeIndex=2*this.points().item(1).index-b.index)};
TradingView.LineToolCallout.prototype.move=function(a){LineDataSource.prototype.move.call(this,a);this._calculateBarOffset()};TradingView.LineToolCallout.prototype.state=function(a){a=LineDataSource.prototype.state.call(this,a);a.barOffset=this._barOffset;return a};TradingView.LineToolCallout.prototype.restoreData=function(a){a.barOffset?this._barOffset=a.barOffset:this._calculateBarOffset();this._calculatePoint2()};
TradingView.LineToolCallout.prototype.setPriceScale=function(a){DataSource.prototype.setPriceScale.call(this,a);a&&a.priceRange()&&this._calculatePoint2()};TradingView.LineToolCallout.prototype._calculatePoint2=function(){if(this._model.lineBeingEdited()!=this&&this._model.sourceBeingMoved()!=this&&!(2>this._points.size())){var a=this.points().item(0),b=this.points().item(1);this._points.setItem(1,{price:b.price,index:a.index+this._barOffset})}};function TriangleRenderer(a){this._data=a}
TriangleRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;var b=this._data.points.item(0),c=this._data.points.item(1),d;d=2==this._data.points.size()?c:this._data.points.item(2);a.beginPath();a.moveTo(b.x,b.y);a.lineTo(c.x,c.y);a.lineTo(d.x,d.y);a.lineTo(b.x,b.y);this._data.fillBackground&&(a.fillStyle=generateColor(this._data.backcolor,this._data.transparency),a.fill());
a.stroke()}};
TriangleRenderer.prototype.hitTest=function(a){if(2>this._data.points.size())return null;var b=this._data.points.item(0),c=this._data.points.item(1),d=this._data.points.item(2),e=MathEx.distanceToSegment(b,c,a);if(3>=e.distance)return new HitTestResult(HitTestResult.MOVEPOINT);e=MathEx.distanceToSegment(c,d,a);if(3>=e.distance)return new HitTestResult(HitTestResult.MOVEPOINT);e=MathEx.distanceToSegment(d,b,a);return 3>=e.distance||this._data.fillBackground&&MathEx.pointInTriangle(b,c,d,a)?new HitTestResult(HitTestResult.MOVEPOINT):
null};function TrianglePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(TrianglePaneView,LineSourcePaneView);
TrianglePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().color.value();a.linewidth=this._source.properties().linewidth.value();a.backcolor=this._source.properties().backgroundColor.value();a.fillBackground=this._source.properties().fillBackground.value();a.transparency=this._source.properties().transparency.value();if(this.isAnchorsRequired()){var b=new CompositeRenderer;b.append(new TriangleRenderer(a));a=a.points.clone();this._model.lineBeingCreated()==
this._source&&a.removeAt(a.size()-1);b.append(this.createLineAnchor({points:a}));return b}return new TriangleRenderer(a)};TradingView.LineToolTriangle=function(a,b){this._constructor="LineToolTriangle";var c=b?b:new DefaultProperty("linetooltriangle");LineDataSource.call(this,a,new TrianglePaneView(this,a),c)};inherit(TradingView.LineToolTriangle,LineDataSource);TradingView.LineToolTriangle.prototype.pointsCount=function(){return 3};TradingView.LineToolTriangle.prototype.title=function(){return"Triangle"};function ArcRenderer(a){this._data=a;this._data.angleFrom=0;this._data.angleTo=Math.PI;this._data.clockwise=!1}inherit(ArcRenderer,EllipseRenderer);ArcRenderer.prototype._additionalPointTest=function(a,b){return 0<=a.y*b.y};
ArcRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){var b=this._data.points.item(0),c=this._data.points.item(1);if(3>this._data.points.size())a.strokeStyle=this._data.color,a.lineWidth=this._data.linewidth,a.beginPath(),a.moveTo(b.x,b.y),a.lineTo(c.x,c.y),a.stroke();else{var d=this._data.points.item(2),d=MathEx.distanceToLine(b,c,d).distance;if(1>d)a.strokeStyle=this._data.color,a.lineWidth=this._data.linewidth,a.beginPath(),a.moveTo(b.x,b.y),a.lineTo(c.x,c.y),a.stroke();else{var e=
c.substract(b),f=b.add(c).scaled(0.5),c=new MathEx.Point(-e.y,e.x),c=c.normalized();f.add(c.scaled(d));f.add(c.scaled(-d));a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;var c=e.length(),g=e.y/c,e=Math.acos(e.x/c);0>g&&(e=-e);g=this._data.points.item(2);f=MathEx.Matrix.translate(-f.x,-f.y);g=f.mult(g);f=MathEx.Matrix.rotate(-e);g=f.mult(g);f=MathEx.Matrix.scale(1,c/(2*d));g=f.mult(g);this._data.clockwise=0>g.y?!0:!1;a.save();a.beginPath();a.translate(b.x,b.y);a.rotate(e);b=1-Math.sqrt(3)/
2;a.scale(1,d/(c*b));this._data.clockwise?a.arc(0.5*c,c*Math.sqrt(3)/2,c,-2*Math.PI/3,-Math.PI/3,!1):a.arc(0.5*c,-c*Math.sqrt(3)/2,c,Math.PI/3,2*Math.PI/3,!1);a.restore();a.stroke();this._data.fillBackground&&(a.fillStyle=generateColor(this._data.backcolor,this._data.transparency),a.fill())}}}};function ArcPaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(ArcPaneView,LineSourcePaneView);
ArcPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().color.value();a.linewidth=this._source.properties().linewidth.value();a.backcolor=this._source.properties().backgroundColor.value();a.fillBackground=this._source.properties().fillBackground.value();a.transparency=this._source.properties().transparency.value();if(this.isAnchorsRequired()){var b=new CompositeRenderer;b.append(new ArcRenderer(a));var c=new List,d=a.points.item(0),e=new MathEx.Point(d.x,
d.y);e.data=0;c.append(e);if(1==a.points.size())return b;var f=a.points.item(1),e=new MathEx.Point(f.x,f.y);e.data=1;if(2==a.points.size())return this.addAnchors(b),b;c.append(e);var e=a.points.item(2),g=MathEx.distanceToLine(d,f,e).distance,h=f.substract(d),d=d.add(f).scaled(0.5),f=new MathEx.Point(-h.y,h.x),f=f.normalized(),e=d.add(f.scaled(g)),f=d.add(f.scaled(-g)),k=h.length(),m=h.y/k,h=Math.acos(h.x/k);0>m&&(h=-h);a=a.points.item(2);d=MathEx.Matrix.translate(-d.x,-d.y);a=d.mult(a);d=MathEx.Matrix.rotate(-h);
a=d.mult(a);d=MathEx.Matrix.scale(1,k/(2*g));a=d.mult(a);a=0<=a.y?new MathEx.Point(e.x,e.y):new MathEx.Point(f.x,f.y);a.data=2;c.append(a);b.append(this.createLineAnchor({points:c}));return b}return new ArcRenderer(a)};TradingView.LineToolArc=function(a,b){this._constructor="LineToolArc";var c=b?b:new DefaultProperty("linetoolarc");LineDataSource.call(this,a,new ArcPaneView(this,a),c);this.version=TradingView.LineToolArc.version};inherit(TradingView.LineToolArc,LineDataSource);
TradingView.LineToolArc.prototype.startChanging=function(a,b){LineDataSource.prototype.startChanging.call(this,a,b);if(0==a||1==a){var c=this.pointToScreenPoint(this._points.item(0))[0],d=this.pointToScreenPoint(this._points.item(1))[0],e=this.pointToScreenPoint(this._points.item(2))[0];this._dist=MathEx.distanceToLine(c,d,e).distance}};TradingView.LineToolArc.prototype.pointsCount=function(){return 3};TradingView.LineToolArc.prototype.title=function(){return"Arc"};
TradingView.LineToolArc.prototype.setPoint=function(a,b){var c=this.pointToScreenPoint(this._points.item(0))[0],d=this.pointToScreenPoint(this._points.item(1))[0],e=this.pointToScreenPoint(this._points.item(2))[0],f=this.priceScale();if(f.isPercent()){var g=this.ownerSource().firstValue();b.price=f.priceRange().convertFromPercent(b.price,g)}switch(a){case 0:var c=this.pointToScreenPoint(b)[0],g=d.substract(c),h=c.add(d).scaled(0.5),c=new MathEx.Point(-g.y,g.x),c=c.normalized(),e=h.add(c.scaled(this._dist)),
e=this.screenPointToPoint(e);this._points.setItem(0,b);this._points.setItem(2,e);break;case 1:f=MathEx.distanceToLine(c,d,e).distance;d=this.pointToScreenPoint(b)[0];g=d.substract(c);h=c.add(d).scaled(0.5);c=new MathEx.Point(-g.y,g.x);c=c.normalized();e=h.add(c.scaled(this._dist));e=this.screenPointToPoint(e);this._points.setItem(1,b);this._points.setItem(2,e);break;case 2:b=this.pointToScreenPoint(b)[0];var f=MathEx.distanceToLine(c,d,b).distance,g=d.substract(c),h=c.add(d).scaled(0.5),c=new MathEx.Point(-g.y,
g.x),c=c.normalized(),e=h.add(c.scaled(f)),c=h.add(c.scaled(-f)),d=g.length(),k=g.y/d,g=Math.acos(g.x/d);0>k&&(g=-g);h=MathEx.Matrix.translate(-h.x,-h.y);b=h.mult(b);k=h.mult(e);h=MathEx.Matrix.rotate(-g);b=h.mult(b);k=h.mult(k);h=MathEx.Matrix.scale(1,d/(2*f));b=h.mult(b);k=h.mult(k);e=0<=b.y*k.y?new MathEx.Point(e.x,e.y):new MathEx.Point(c.x,c.y);e=this.screenPointToPoint(e);this._points.setItem(2,e)}this.normalizePoints()};TradingView.LineToolArc.version=2;
TradingView.LineToolArc.prototype.migrateVersion=function(a,b,c){1==a&&2==this._points.size()&&(b=(2*this._points.item(0).price+3*this._points.item(1).price)/5,this._points.append({price:b,index:this._points.item(1).index}));1==a&&2==this._timePoint.size()&&(b=(2*this._timePoint.item(0).price+3*this._timePoint.item(1).price)/5,a={price:b,offset:this._timePoint.item(1).offset,time_t:this._timePoint.item(1).time_t},this._timePoint.append(a))};TradingView.LineToolArrow=function(a,b){this._constructor="LineToolArrow";var c=b?b:new DefaultProperty("linetoolarrow");TradingView.LineToolTrendLine.call(this,a,c)};inherit(TradingView.LineToolArrow,TradingView.LineToolTrendLine);TradingView.LineToolArrow.prototype.title=function(){return"Arrow"};function BrushPaneView(a,b){LineSourcePaneView.call(this,a,b);this._invalidated=!0;this._model=b;this._source=a}inherit(BrushPaneView,LineSourcePaneView);BrushPaneView.prototype.update=function(){this._invalidated=!0};BrushPaneView.prototype._smoothArray=function(a,b){for(var c=Array(a.length),d=0;d<a.length;d++){for(var e=new MathEx.Point(0,0),f=0;f<b;f++)var g=Math.max(d-f,0),h=Math.min(d+f,a.length-1),e=e.add(a[g]),e=e.add(a[h]);c[d]=e.scaled(0.5/b)}c.push(a[a.length-1]);return c};
BrushPaneView.prototype._updateInternal=function(){LineSourcePaneView.prototype.update.call(this);var a=Math.max(1,this._source.properties().smooth.value()),b=this._points.toArray();if(0!=b.length){for(var c=[b[0]],d=1;d<b.length;d++){for(var e=b[d].substract(b[d-1]),f=e.length(),g=Math.floor(f/a),e=e.normalized().scaled(f/g),f=0;f<g-1;f++)c.push(b[d-1].add(e.scaled(f)));c.push(b[d])}a=this._smoothArray(c,a);this._points=new List(a)}};
BrushPaneView.prototype.renderer=function(){this._invalidated&&(this._updateInternal(),this._invalidated=!1);var a={},b=this._source.properties();a.points=this._points;a.color=b.linecolor.value();a.linewidth=b.linewidth.value();a.linestyle=b.linestyle.value();a.skipClosePath=!0;b.fillBackground.value()&&this._model.lineBeingCreated()!==this._source&&(a.filled=!0,a.fillBackground=!0,a.backcolor=b.backgroundColor.value(),a.transparency=b.transparency.value());if(this.isAnchorsRequired()&&this._source.finished()){b=
new CompositeRenderer;b.append(new PoligonRenderer(a));if(0<a.points.size()){var c=new List;c.append(a.points.item(0));c.append(a.points.item(a.points.size()-1));b.append(new SelectionRenderer({points:c}))}return b}return new PoligonRenderer(a)};TradingView.LineToolBrush=function(a,b){this._constructor="LineToolBrush";var c=b?b:new DefaultProperty("linetoolbrush");LineDataSource.call(this,a,new BrushPaneView(this,a),c);this._finished=!1};inherit(TradingView.LineToolBrush,LineDataSource);
TradingView.LineToolBrush.prototype.pointsCount=function(){return-1};TradingView.LineToolBrush.prototype.finished=function(){return this._finished};TradingView.LineToolBrush.prototype.finish=function(){this._finished=!0;this.normalizePoints();this.createServerPoints()};TradingView.LineToolBrush.prototype.title=function(){return"Brush"};TradingView.LineToolBrush.prototype.percentDistance=function(a,b){return Math.abs((b-a)/a)};
TradingView.LineToolBrush.prototype.addPoint=function(a){this._lastPoint=null;if(0<this._points.size()){var b=this._points.item(this._points.size()-1),b=this.pointToScreenPoint(b)[1];if(2>this.pointToScreenPoint(a)[1].substract(b).length())return this._finished}LineDataSource.prototype.addPoint.call(this,a);return this._finished};TradingView.LineToolBrush.prototype.restorePoints=function(a,b,c){LineDataSource.prototype.restorePoints.call(this,a,b,c);this._finished=!0};TradingView.LineToolRay=function(a,b){this._constructor="LineToolRay";var c=b?b:new DefaultProperty("linetoolray");TradingView.LineToolTrendLine.call(this,a,c)};inherit(TradingView.LineToolRay,TradingView.LineToolTrendLine);TradingView.LineToolRay.prototype.title=function(){return"Ray"};TradingView.LineToolExtended=function(a,b){this._constructor="LineToolExtended";var c=b?b:new DefaultProperty("linetoolextended");TradingView.LineToolTrendLine.call(this,a,c)};inherit(TradingView.LineToolExtended,TradingView.LineToolTrendLine);TradingView.LineToolExtended.prototype.title=function(){return"Extended Line"};TradingView.LineToolArrowMark=function(a,b){var c=b?b:new DefaultProperty("linetoolarrowmark");LineDataSource.call(this,a,new MarkPaneView(this,a,this.image,this.width,this.height,this.offsetX,this.offsetY),c)};inherit(TradingView.LineToolArrowMark,LineDataSource);TradingView.LineToolArrowMark.prototype.width=21;TradingView.LineToolArrowMark.prototype.height=21;TradingView.LineToolArrowMark.prototype.offsetX=0;TradingView.LineToolArrowMark.prototype.offsetY=0;
TradingView.LineToolArrowMark.prototype.paneViews=function(a){a=LineDataSource.prototype.paneViews.call(this,a);null!==a&&this._textPaneView&&a.append(this._textPaneView);return a};TradingView.LineToolArrowMark.prototype.pointsCount=function(){return 1};TradingView.LineToolArrowMark.prototype.title=function(){return"Arrow Mark"};
TradingView.LineToolArrowMarkLeft=function(a,b){this._constructor="LineToolArrowMarkLeft";TradingView.LineToolArrowMark.call(this,a,b);this._textPaneView=new TextPaneView(this,a,22,-3,"middle","left");this._textPaneView._noSelection=!0};inherit(TradingView.LineToolArrowMarkLeft,TradingView.LineToolArrowMark);TradingView.LineToolArrowMarkLeft.prototype.image=new Image;TradingView.LineToolArrowMarkLeft.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB50lEQVR4AWMgETAKKAgIAGkQ5mCgAmCWdtTWV4yxvgFkWwKxOKUGssr5Gccrx9t+Vk6w+w/kxwKxIrmGMTKIivIohFvONKsI+e/cl/ofamgGECuTYyCTqJ2mqlK01Vnr+uj/HjNy/1v1J8AMzSTHUBYZP6MgpTjb97bNsf9dpmf9N++J/W/UEQEztAiIbUEGo2EpIObE8C4oVuVDzLuBmv869aT8t5+c+t+0K/q/YXs4GGsWeIAMRscwy/yhBiO8K2ijJKcYZXXYuj7qv/u0nP/W/Yn/jTsjQYYRwliDhUXKy8BVKdbmuW1T7H+3Gdn/LXrjQN4FaSDLUBa5MItyoOAvp67k/45T0pC9S56hSrHWhY4tif9D5pUDXZjz36w7Blkx+S5VDLNoBUWMY3fKfwdExMAw+WEq7Wvkoxhn+waUhFwRSYhcQxGxL26jpqQYbX3CBpjY3aeDYj+BothHpFNxcW75cIvJpmXB/516Uv/bT0r5b9IVRUY6xQSssr6GkcAc9dGuNe6/y7RMMnMUJmCWcNTSBgbHZeuG6P+eM/P+W/VRlPcRwSGoJMgvH265yKIq/L9LfzqKoZSXp0Em6cDy9BvU0Dhyy1PM4PAwMFWKs7kFZFsBsQQDlQAjr4a0MJAWxFdHAQAcI3sGHsO1dgAAAABJRU5ErkJggg==";
TradingView.LineToolArrowMarkLeft.prototype.offsetX=1;TradingView.LineToolArrowMarkLeft.prototype.offsetY=-10;TradingView.LineToolArrowMarkLeft.prototype.title=function(){return"Arrow Mark Left"};TradingView.LineToolArrowMarkUp=function(a,b){this._constructor="LineToolArrowMarkUp";TradingView.LineToolArrowMark.call(this,a,b);this._textPaneView=new TextPaneView(this,a,0,18,"top","center");this._textPaneView._noSelection=!0};inherit(TradingView.LineToolArrowMarkUp,TradingView.LineToolArrowMark);
TradingView.LineToolArrowMarkUp.prototype.image=new Image;TradingView.LineToolArrowMarkUp.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAACBklEQVR4AWMgErAoxVoXgmgGKgEWxTCLVseWxP9yYRbl1DCYSdrXyEc5we5vyLzy/0D6l5SXgStInFwDGcVt1JQU42zfOHan/HebkfPfqSv5v1KszXNBGyU5kDzpRoqLcytGW5+wbY797zA59b9Zd8x/xylp/22bYv8rRlkdBqrgINVIVvlwi8k29dH/Xadn/Tftiv5v2B4Opt1mZP+3ro/6Lx9i3k1K+DLL+hpGmpYF/3efnvPfvCcWZCAcW/TG/XeflvMfFM4yfkZBxIQvo4SjlrZSnO1Hp57U/9b9Cf+NOiKQDQXxgeKJ/516Uv4D1b0XtdNUxRu+gkqC/MBwvGzXGvffflLKf+POSISBCAwWtweGMyi8laKtzjKIivLgCUfLRdYN0f9dpmX+N+mKghiCieHh6wIMb2tguCuEW84E6ccIR7kgk3SLqvD/njPzYOFICIPVeczI/W9WEfJfzs84HmQOIhw9DEyV422/ufSn/7fqg4cjIQxWZwUMd+e+1P9A/Z+lHbX1weHLqyEtrBRncwsYm/+RsWaBBz4DwfLoehRjrG8IKAgIgOMHiK2AOA6IM6G4CKgIr6EgeZA6qPoMII4FYksgFmCA5gwJIFYEYmUotiXSUFuYHqh+cXw5TZlIQ5WxaR4mhuLBZBkqBcT+oJjFg/3B6kgAnFANyniwFEQdJgAAOuN7Bp7MBuYAAAAASUVORK5CYII=";
TradingView.LineToolArrowMarkUp.prototype.offsetX=-9;TradingView.LineToolArrowMarkUp.prototype.offsetY=0;TradingView.LineToolArrowMarkUp.prototype.title=function(){return"Arrow Mark Up"};TradingView.LineToolArrowMarkRight=function(a,b){this._constructor="LineToolArrowMarkRight";TradingView.LineToolArrowMark.call(this,a,b);this._textPaneView=new TextPaneView(this,a,-22,-3,"middle","right");this._textPaneView._noSelection=!0};inherit(TradingView.LineToolArrowMarkRight,TradingView.LineToolArrowMark);
TradingView.LineToolArrowMarkRight.prototype.image=new Image;TradingView.LineToolArrowMarkRight.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB60lEQVR4AWPAAziAWJBXQ1oYSDMyUAlIALGVUpzNLQkPA1Mgm5kahioCcZxygt1/5Xjbb3JBJulAPiulhioDcSbIUJf+9P8WVeH/5cMtFwkqCfKDgoNiQ636Ev57zsz7b90Q/V8x2vqyhKOWNqHg4ARiKZAhaNgWiItAhhp1RPw374n97zIt879da9x/pTjbj7K+hpE4gwNqoD9IMzasWeDx37A9HIxNuqL+209K+e/Uk/rftCwYGBwWkxnExbkRwYHpTZBGgti4M/K/dX/Cf/fpOf9t6sHBcULcRk0JaAYT6YYiMDw4XKdn/bdtjv2vGGf7RtrXyAdoDguZhiKwaVf0f4fJqf8du1NAQfVXMcyiFWQwmYYisFl3zH+3GTn/Q+aV/3dsSfyvFGtdSLFLHaek/XfqSga59JdcmEU5yKVkh6lFbxzQhdn/bZtiga6zeS7lZeAKMpCC2E/87z4t5791fdR/xSirw4I2SnKg2CcxnSK8aw+MGKceSMTIh5h3Q0szRvJzFCQJgXLUexk/oyCQd8nP+8DE7jEjF+jd6P9K0VZnRe00VWHeJcfQDJChzn2p/80qQv4rhFvOZBAV5QF5l5LyNBZann6W8zOOp0Z5Kg7Eloox1jekHbX1qVLyQ2NVQEBBQIBU7wIAOFZ7BmG7RzYAAAAASUVORK5CYII=";
TradingView.LineToolArrowMarkRight.prototype.offsetX=-19;TradingView.LineToolArrowMarkRight.prototype.offsetY=-10;TradingView.LineToolArrowMarkRight.prototype.title=function(){return"Arrow Mark Right"};TradingView.LineToolArrowMarkDown=function(a,b){this._constructor="LineToolArrowMarkDown";TradingView.LineToolArrowMark.call(this,a,b);this._textPaneView=new TextPaneView(this,a,0,-23,"bottom","center");this._textPaneView._noSelection=!0};inherit(TradingView.LineToolArrowMarkDown,TradingView.LineToolArrowMark);
TradingView.LineToolArrowMarkDown.prototype.image=new Image;TradingView.LineToolArrowMarkDown.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB/UlEQVR4AWPAATj3Wij8J4RB6hhIAFIgTS9a8nBhmKFSpBiqDNJ0P80PF4YZqkyyobfD7HDh4WJolaKY+G5zhXvoMXva2xifoWB5dD07zeTvFKvxioDMFY6RFUgEGvzzQVk8OGafVib9v5fkhc9QkDxIHVj9vaKY/7vM5b+HS/JFA80TAhnKA8TGZSoiS057GYFiFqzhTpQTPkNB8iB1YPUnPQz+5ykKzQGaYwjE3CBDmUCuBWKHabqSZ0656oI0EY1B6idoSx4F6reDupIJFrTMQCwtxsYcvNZY5uU5T0OiDDwLdOFKI9knvMzM/kD9kmBz0AAbEKs6iHAX7zSX/3nF3xyvgZd8Tf9vM5P/ZiXAmQdNBazYEgIjEHOBwiVHXmjWcSctnAbeDLH5f8xR83+SjNBEoHo9sD4owGWwIBDb9mtJHMIVviDxDg3x3UB11kDMD9ZHADCDwkeAmdlvhZHMI2C4oRh4xl3//1IDmbvszAxeQHXiUPWEATR8lE0EubJB4QYMP7CBF31M/m82k/usy8uRCpRXAKsjEXCCwiteVqD/qIPG/+tBVv/3WCj8C5Pi7wCKawMxBwMZgBEaXlbtGuI7T7ro/G9QFdsI5JsDMR/+cCQcvuLsLAzubRoSa4FsJyAWBSdwsgEifKVBXoYmcBYGagCoQZzEGggAoyq6zKXuV5gAAAAASUVORK5CYII=";
TradingView.LineToolArrowMarkDown.prototype.offsetX=-9;TradingView.LineToolArrowMarkDown.prototype.offsetY=-18;TradingView.LineToolArrowMarkDown.prototype.title=function(){return"Arrow Mark Down"};TradingView.LineToolArrowMarkRight.prototype.version=TradingView.LineToolArrowMarkLeft.prototype.version=TradingView.LineToolArrowMarkDown.prototype.version=TradingView.LineToolArrowMarkUp.prototype.version=2;
TradingView.LineToolArrowMarkDown.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=-10,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,21)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=-4)};
TradingView.LineToolArrowMarkUp.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=-10,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,0)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=18)};
TradingView.LineToolArrowMarkRight.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,0)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=10)};
TradingView.LineToolArrowMarkLeft.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,0)),this._textPaneView._offsetX=21,this._textPaneView._offsetY=10)};TradingView.LineToolFlagMark=function(a,b){this._constructor="LineToolFlagMark";var c=b?b:new DefaultProperty("linetoolflagmark");LineDataSource.call(this,a,new MarkPaneView(this,a,this.image,25,25,-8,-21),c);this._paneViews[0].setAnchors(new MathEx.Point(0,0))};inherit(TradingView.LineToolFlagMark,LineDataSource);TradingView.LineToolFlagMark.prototype.image=new Image;TradingView.LineToolFlagMark.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAsElEQVR4AWMYWcDExOS/YUd4hWF7+H90bNAePpO2liDwJTxyi2htyVXLvlBOWlry2bAtVIumwWXQERFF4zgJ20iPiP8JDCpLeqSuJ6ZdoRJ0SMIRx7QbQtmItgSXnGFbRCzMEnIzK8ISWgL6WzJqibGxsYaFhYUC7SxBWMQPNMjazMxMjebBZWhoKAq00NHc3FyL5nFiaWkpDTTYz8jISI/mEW9qaqoExGFgS+gFRgEAaE0hWxrw50oAAAAASUVORK5CYII=";
TradingView.LineToolFlagMark.prototype.pointsCount=function(){return 1};TradingView.LineToolFlagMark.prototype.title=function(){return"Flag Mark"};TradingView.LineToolFlagMark.prototype.version=2;TradingView.LineToolFlagMark.prototype.migrateVersion=function(a){1==a&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(9,21)))};function PriceLabelRenderer(a,b,c){this._data=a;this._measureCache=b;this._chartModel=c}
PriceLabelRenderer.prototype.draw=function(a){if(0!==this._data.points.size()){a.font=[this._data.fontWeight,this._data.fontSize+"px",this._data.fontFamily].join(" ");var b=a.measureText(this._data.label);b.height=this._data.fontSize;var c=b.width+20,b=b.height+10,d=this._data.points.item(0).x- -9,e=this._data.points.item(0).y-(b+15);this._measureCache&&$.extend(this._measureCache,{innerWidth:c,innerHeight:b,tailLeft:-9,tailHeight:15});a.translate(0.5+d,0.5+e);a.beginPath();a.moveTo(12,b);a.lineTo(-9,
b+15);a.lineTo(-10,b+15-1);a.lineTo(5,b);a.lineTo(3,b);a.arcTo(0,b,0,0,3);a.lineTo(0,3);a.arcTo(0,0,c,0,3);a.lineTo(c-3,0);a.arcTo(c,0,c,b,3);a.lineTo(c,b-3);a.arcTo(c,b,0,b,3);a.lineTo(12,b);a.fillStyle=generateColor(this._data.backgroundColor,this._data.transparency);a.fill();a.strokeStyle=this._data.borderColor;a.lineWidth=2;a.stroke();a.closePath();a.textBaseline="top";a.fillStyle=this._data.color;a.fillText(this._data.label,10,4);a.translate(-0.5,-0.5);a.beginPath();a.arc(-9,b+15,2.5,0,2*Math.PI,
!1);a.fillStyle=generateColor(this._data.borderColor,this._data.transparency);a.fill();a.strokeStyle=this._chartModel.backgroundColor();a.lineWidth=1;a.stroke();a.closePath()}};
PriceLabelRenderer.prototype.hitTest=function(a){if(0===this._data.points.size())return null;var b=this._data.points.item(0).x-this._measureCache.tailLeft,c=this._data.points.item(0).y-(this._measureCache.innerHeight+this._measureCache.tailHeight);return MathEx.pointInRect(a,new MathEx.Point(b,c),new MathEx.Point(b+this._measureCache.innerWidth,c+this._measureCache.innerHeight))?new HitTestResult(HitTestResult.MOVEPOINT):null};
function PriceLabelPaneView(a,b,c){LineSourcePaneView.call(this,a,b);this._image=TradingView.getImage("price_label",TradingView.wrapUrl("/static/images/price_label.png"));this._rendererCache={}}inherit(PriceLabelPaneView,LineSourcePaneView);
PriceLabelPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(0<this._source.points().size()){var a=this._source.points().item(0).price,b=this._source.priceScale();if(b&&!b.isEmpty()){if(b.isPercent())var c=this._source.ownerSource().firstValue(),a=b.priceRange().convertToPercent(a,c);this._priceLabel=b.formatter().format(a)}}};
PriceLabelPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.borderColor=this._source.properties().borderColor.value();a.backgroundColor=this._source.properties().backgroundColor.value();a.color=this._source.properties().color.value();a.fontWeight=this._source.properties().fontWeight.value();a.fontSize=this._source.properties().fontsize.value();a.fontFamily=this._source.properties().font.value();a.transparency=this._source.properties().transparency.value();a.label=this._priceLabel;
a.image=this._image;if(this.isAnchorsRequired()&&1==a.points.size()){var b=new CompositeRenderer;b.append(new PriceLabelRenderer(a,this._rendererCache,this._model));b.append(new SelectionRenderer({points:a.points}));return b}return new PriceLabelRenderer(a,this._rendererCache,this._model)};TradingView.LineToolPriceLabel=function(a,b){this._constructor="LineToolPriceLabel";var c=b||new DefaultProperty("linetoolpricelabel");LineDataSource.call(this,a,new PriceLabelPaneView(this,a),c)};
inherit(TradingView.LineToolPriceLabel,LineDataSource);TradingView.LineToolPriceLabel.prototype.pointsCount=function(){return 1};TradingView.LineToolPriceLabel.prototype.title=function(){return"Price Label"};function PredictionRenderer(a){this._data=a;this._targetFontSize2=this._targetFontSize1=11;this._targetFontSize3=14;this._font="Arial";this._sourceFontSize1=12;this._sourceFontSize2=10}
PredictionRenderer.prototype.drawBalloon=function(a,b,c,d,e,f){f=f||20;a.beginPath();if("down"===e)return b=new MathEx.Point(b.x-f,b.y-6-5-d),a.moveTo(b.x+3,b.y),a.lineTo(b.x+c-3,b.y),a.arcTo(b.x+c,b.y,b.x+c,b.y+3,3),a.lineTo(b.x+c,b.y+d-3),a.arcTo(b.x+c,b.y+d,b.x+c-3,b.y+d,3),a.lineTo(b.x+f+5,b.y+d),a.lineTo(b.x+f,b.y+d+5),a.lineTo(b.x+f-5,b.y+d),a.lineTo(b.x+3,b.y+d),a.arcTo(b.x,b.y+d,b.x,b.y+d-3,3),a.lineTo(b.x,b.y+3),a.arcTo(b.x,b.y,b.x+3,b.y,3),b;b=new MathEx.Point(b.x-f,b.y+6+5+d);a.moveTo(b.x+
3,b.y);a.lineTo(b.x+c-3,b.y);a.arcTo(b.x+c,b.y,b.x+c,b.y-3,3);a.lineTo(b.x+c,b.y-d+3);a.arcTo(b.x+c,b.y-d,b.x+c-3,b.y-d,3);a.lineTo(b.x+f+5,b.y-d);a.lineTo(b.x+f,b.y-d-5);a.lineTo(b.x+f-5,b.y-d);a.lineTo(b.x+3,b.y-d);a.arcTo(b.x,b.y-d,b.x,b.y-d+3,3);a.lineTo(b.x,b.y-3);a.arcTo(b.x,b.y,b.x+3,b.y,3);return new MathEx.Point(b.x,b.y-d)};
PredictionRenderer.prototype.drawTargetLabel=function(a){var b=this._data.points.item(1);a.save();a.translate(0.5,0.5);a.font="normal "+this._targetFontSize3+"px "+this._font;var c=1.5*this._targetFontSize1+1.5*this._targetFontSize2+3,d=a.measureText(this._data.targetLine1).width,e=a.measureText(this._data.targetLine2).width;a.font="normal "+this._targetFontSize2+"px "+this._font;var f=a.measureText(this._data.targetLine3).width,g=a.measureText(this._data.targetLine4).width,e=Math.max(d+e,f+g+10)+
20,g="up"===this._data.direction?"down":"up",h=b.x+e-a.canvas.width+5,h=Math.max(20,Math.min(e-15,h)),g=this.drawBalloon(a,b,e,c,g,h);a.save();a.fillStyle=generateColor(this._data.targetBackColor,this._data.transparency);a.fill();a.restore();a.save();a.lineWidth=2;a.strokeStyle=generateColor(this._data.targetStrokeColor,this._data.transparency);a.stroke();a.restore();a.beginPath();a.arc(b.x,b.y,3,0,2*Math.PI,!1);a.fillStyle=this._data.centersColor;a.fill();a.textAlign="left";a.fillStyle=this._data.targetTextColor;
a.font="normal "+this._targetFontSize3+"px "+this._font;a.fillText(this._data.targetLine1,g.x+6,g.y+this._targetFontSize1+4);a.fillText(this._data.targetLine2,g.x+6+d+5,g.y+this._targetFontSize1+4);a.font="normal "+this._targetFontSize2+"px "+this._font;b=g.y+this._targetFontSize1+8+this._targetFontSize2;a.fillText(this._data.targetLine3,g.x+6,b);a.drawImage(this._data.clockWhite,g.x+6+f+6,b-this._targetFontSize2+3);a.fillText(this._data.targetLine4,g.x+6+f+13+5,b);if(this._data.status){f=this._targetFontSize1+
4;a.font="bold "+this._targetFontSize1+"px "+this._font;var k,m,n,q;switch(this._data.status){case TradingView.LineToolPrediction.ALERT_STATUS_SUCCESS:k=$.t("SUCCESS");m=generateColor(this._data.successBackground,this._data.transparency);n=this._data.successTextColor;q=this._data.successIcon;break;case TradingView.LineToolPrediction.ALERT_STATUS_FAILURE:k=$.t("FAILURE"),m=generateColor(this._data.failureBackground,this._data.transparency),n=this._data.failureTextColor,q=this._data.failureIcon}b=a.measureText(k).width;
b=Math.round((e-b)/2);a.fillStyle=m;"up"===this._data.direction?(a.roundRect(g.x-1,g.y-f-2,e+2,f,5),a.fill(),a.fillStyle=n,a.fillText(k,g.x+b,g.y-5),a.drawImage(q,g.x+b-13,g.y-14)):(a.roundRect(g.x-1,g.y+c+3,e+2,f,5),a.fill(),a.fillStyle=n,a.fillText(k,g.x+b,g.y+c+f-1),a.drawImage(q,g.x+b-13,g.y+c+5))}a.restore()};
PredictionRenderer.prototype.drawStartLabel=function(a){a.save();a.translate(0.5,0.5);a.font="normal "+this._sourceFontSize1+"px "+this._font;var b=1.5*this._sourceFontSize1+1.5*this._sourceFontSize2,c=a.measureText(this._data.sourceLine1).width;a.font="normal "+this._fontsize2+"px "+this._font;var d=a.measureText(this._data.sourceLine2).width,d=Math.max(c,d)-5,c=this._data.points.item(0),b=this.drawBalloon(a,c,d,b,this._data.direction);a.fillStyle=generateColor(this._data.sourceBackColor,this._data.transparency);
a.fill();a.lineWidth=2;a.strokeStyle=generateColor(this._data.sourceStrokeColor,this._data.transparency);a.stroke();a.beginPath();a.arc(c.x,c.y,3,0,2*Math.PI,!1);a.fillStyle=this._data.centersColor;a.fill();a.textAlign="left";a.fillStyle=this._data.sourceTextColor;a.font="normal "+this._sourceFontSize1+"px "+this._font;a.fillText(this._data.sourceLine1,b.x+3,b.y+this._sourceFontSize1+2);a.font="normal "+this._sourceFontSize2+"px "+this._font;a.fillText(this._data.sourceLine2,b.x+3,b.y+this._sourceFontSize1+
4+this._sourceFontSize2);a.restore()};
PredictionRenderer.prototype.draw=function(a){if(!(2>this._data.points.size())){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;var b=this._data.points.item(0),c=this._data.points.item(1);new MathEx.Point(b.y,c.x);var d=c.substract(b);1>Math.abs(d.x)||1>Math.abs(d.y)?(a.beginPath(),a.moveTo(b.x,b.y),a.lineTo(c.x,c.y)):(a.save(),a.beginPath(),a.translate(b.x,b.y),a.scale(1,d.y/d.x),a.moveTo(0,0),a.arcTo(d.x,0,d.x,d.x,Math.abs(d.x)),
a.lineTo(d.x,d.x),a.restore());a.stroke();this.drawTargetLabel(a);this.drawStartLabel(a);b=Math.max(8,4*this._data.linewidth);a.fillStyle=this._data.color;var e=0>d.y?1:-1;if(1>Math.abs(d.x)||1>Math.abs(d.y))var f=Math.atan(d.x/d.y);else{var g=Math.abs(d.x),h=Math.abs(d.y);Math.sqrt((3*g+h)*(3*h+g));var k=0,m=Math.PI/2,n=(k+m)/2;if(d.length()>b)for(;;){var f=g*Math.sin(n),q=h*(1-Math.cos(n)),l=Math.sqrt((f-g)*(f-g)+(q-h)*(q-h));if(1>Math.abs(l-b))break;l>b?k=n:m=n;n=(k+m)/2}f=Math.atan((g-f)/(h-q));
0>d.x*d.y&&(f=-f)}a.save();a.beginPath();a.translate(c.x,c.y);a.rotate(-f);a.moveTo(0,0);a.lineTo(-b/2,e*b);a.lineTo(b/2,e*b);a.lineTo(0,0);a.restore();a.fill()}};
PredictionRenderer.prototype.targetLabelHitTest=function(a){var b=this._data.points.item(1),c=1.5*this._targetFontSize1+1.5*this._targetFontSize2,d=this._targetFontSize1*this._data.targetLine1.length,e=this._targetFontSize1*this._data.targetLine2.length,f=this._targetFontSize2*this._data.targetLine3.length,g=this._targetFontSize2*this._data.targetLine4.length;this._data.status&&(c+=1.5*this._targetFontSize1);d=Math.max(d+e,f+g)-20;g="up"===this._data.direction?-1:1;e=b.x-20;f=b.y+5*g;c=b.y+(5+c)*
g;b=Math.min(f,c);c=Math.max(f,c);return a.x>=e&&a.x<=e+d&&a.y>=b&&a.y<=c?new HitTestResult(HitTestResult.MOVEPOINT):null};
PredictionRenderer.prototype.sourceLabelHitTest=function(a){var b=1.5*this._sourceFontSize1+1.5*this._sourceFontSize2,c=Math.max(this._sourceFontSize1*this._data.sourceLine1.length,this._sourceFontSize2*this._data.sourceLine2.length),d=this._data.points.item(0),e="up"===this._data.direction?1:-1,f=d.x-20,g=d.y+5*e,d=d.y+(5+b)*e,b=Math.min(g,d),g=Math.max(g,d);return a.x>=f&&a.x<=f+c&&a.y>=b&&a.y<=g?new HitTestResult(HitTestResult.MOVEPOINT):null};
PredictionRenderer.prototype.hitTest=function(a){if(2>this._data.points.size())return null;var b=this._data.points.item(0),c=this._data.points.item(1),d=c.substract(b);new MathEx.Point(b.y,c.x);var d=c.substract(b),b=a.substract(b),c=Math.abs(d.x),e=Math.abs(d.y),d=MathEx.sign(d.y)*(e-e*Math.sqrt(1-b.x*b.x/(c*c)));return 3>Math.abs(d-b.y)?new HitTestResult(HitTestResult.MOVEPOINT):(d=this.targetLabelHitTest(a))?d:this.sourceLabelHitTest(a)};
function PredictionPaneView(a,b){LineSourcePaneView.call(this,a,b);this._clockWhite=TradingView.getImage("prediction-clock-white",TradingView.wrapUrl("/static/images/prediction-clock-white.png"));this._clockBlack=TradingView.getImage("prediction-clock-black",TradingView.wrapUrl("/static/images/prediction-clock-black.png"));this._successIcon=TradingView.getImage("prediction-success-white",TradingView.wrapUrl("/static/images/prediction-success-white.png"));this._failureIcon=TradingView.getImage("prediction-failure-white",
TradingView.wrapUrl("/static/images/prediction-failure-white.png"))}inherit(PredictionPaneView,LineSourcePaneView);
PredictionPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().linecolor.value();a.linewidth=this._source.properties().linewidth.value();a.targetLine1=this._targetLine1;a.targetLine2=this._targetLine2;a.targetLine3=this._targetLine3;a.targetLine4=this._targetLine4;a.status=this._source.properties().status.value();a.transparency=this._source.properties().transparency.value();a.targetBackColor=this._source.properties().targetBackColor.value();a.targetStrokeColor=
this._source.properties().targetStrokeColor.value();a.targetTextColor=this._source.properties().targetTextColor.value();a.sourceBackColor=this._source.properties().sourceBackColor.value();a.sourceStrokeColor=this._source.properties().sourceStrokeColor.value();a.sourceTextColor=this._source.properties().sourceTextColor.value();a.successBackground=this._source.properties().successBackground.value();a.successTextColor=this._source.properties().successTextColor.value();a.failureBackground=this._source.properties().failureBackground.value();
a.failureTextColor=this._source.properties().failureTextColor.value();a.intermediateBackColor=this._source.properties().intermediateBackColor.value();a.intermediateTextColor=this._source.properties().intermediateTextColor.value();a.sourceLine1=this._sourceLine1;a.sourceLine2=this._sourceLine2;a.direction=this._direction;a.clockWhite=this._clockWhite;a.clockBlack=this._clockBlack;a.successIcon=this._successIcon;a.failureIcon=this._failureIcon;a.finished=this._finished;a.centersColor=(new RGBColor(this._model._properties.paneProperties.background._value)).blackWhiteContrast();
if(this.isAnchorsRequired()){var b=new CompositeRenderer;b.append(new PredictionRenderer(a));a=a.points.clone();this._model.lineBeingCreated()==this._source&&a.removeAt(a.size()-1);b.append(this.createLineAnchor({points:a}));return b}return new PredictionRenderer(a)};
PredictionPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._targetLine4=this._targetLine3=this._targetLine2=this._targetLine1="";if(!(2>this._source.points().size())&&this._source.priceScale()){var a=this._source.points().item(1),b=this._source.points().item(0);this._targetLine3=this._source.priceScale().formatter().format(a.price);var c=a.price-b.price,d=0>c?"-":"+";this._targetLine1=this._source.priceScale().formatter().format(Math.abs(c));c=Math.abs((Math.round(1E4*
(c/b.price))/100).toPrecision(3));this._targetLine1=d+this._targetLine1+" ("+d+c+"%)";d=this._model.timeScale().indexToUserTime(b.index);c=this._model.timeScale().indexToUserTime(a.index);b.time&&a.time&&(d=isString(b.time)?new Date(Date.parse(b.time)):b.time,c=isString(a.time)?new Date(Date.parse(a.time)):a.time);c&&d&&(this._targetLine4=(new DateFormatter).format(c),this._model.mainSeries().isDWM()||(this._targetLine4=this._targetLine4+" "+(new TimeFormatter("%h:%m")).format(c)),a=(c.valueOf()-
d.valueOf())/1E3,this._targetLine2=$.t("in",{context:"dates"})+" "+(new TimeSpanFormatter).format(a));this._sourceLine1=this._source.priceScale().formatter().format(b.price);this._sourceLine2="";if(b=this._model.timeScale().indexToUserTime(b.index))this._sourceLine2=(new DateFormatter).format(b),this._model.mainSeries().isDWM()||(this._sourceLine2=this._sourceLine2+" "+(new TimeFormatter("%h:%m")).format(b));this._direction=this._source.direction()===TradingView.LineToolPrediction.DIRECTION_UP?"up":
"down";this._finished=this._model.lineBeingCreated()!==this._source&&this._model.lineBeingEdited()!==this._source&&this._model.sourceBeingMoved()!==this._source}};TradingView.LineToolPrediction=function(a,b){this._constructor="LineToolPrediction";var c=b?b:new DefaultProperty("linetoolprediction");c.merge({status:TradingView.LineToolPrediction.ALERT_STATUS_WAITING});LineDataSource.call(this,a,new PredictionPaneView(this,a),c)};TradingView.LineToolPrediction.ALERT_STATUS_WAITING=0;
TradingView.LineToolPrediction.ALERT_STATUS_SUCCESS=1;TradingView.LineToolPrediction.ALERT_STATUS_FAILURE=2;TradingView.LineToolPrediction.DIRECTION_UP=1;TradingView.LineToolPrediction.DIRECTION_DOWN=2;inherit(TradingView.LineToolPrediction,LineDataSource);TradingView.LineToolPrediction.prototype.status=function(){return this._properties.status.value()};TradingView.LineToolPrediction.prototype.setStatus=function(a){return this._properties.status.setValue(a)};
TradingView.LineToolPrediction.prototype.pointsCount=function(){return 2};TradingView.LineToolPrediction.prototype.title=function(){return"Forecast"};TradingView.LineToolPrediction.prototype.restorePoints=function(a,b,c){LineDataSource.prototype.restorePoints.call(this,a,b,c);this.checkAlert()};
TradingView.LineToolPrediction.prototype.checkAlert=function(){if(!(2>this._points.size()||this._model.mainSeries().bars().isEmpty())){var a=this._points.item(1);if(this.status())a.index>this._model.timeScale().points().lastTimePointIndex()&&this.setStatus(TradingView.LineToolPrediction.ALERT_STATUS_WAITING);else if(this._model.mainSeries().bars().last(),this._model.timeScale().indexToTimePoint(a.index)){var b=this._model.mainSeries().bars().valueAt(a.index),c=this.direction();c===TradingView.LineToolPrediction.DIRECTION_UP&&
b[HIGH_PLOT]>=a.price?this.setStatus(TradingView.LineToolPrediction.ALERT_STATUS_SUCCESS):c===TradingView.LineToolPrediction.DIRECTION_DOWN&&b[LOW_PLOT]<=a.price?this.setStatus(TradingView.LineToolPrediction.ALERT_STATUS_SUCCESS):(a=this._model.mainSeries().bars().last().value,b[TIME_PLOT]!==a[TIME_PLOT]&&this.setStatus(TradingView.LineToolPrediction.ALERT_STATUS_FAILURE))}}};
TradingView.LineToolPrediction.prototype.addPoint=function(a){(a=LineDataSource.prototype.addPoint.call(this,a))&&this.checkAlert();return a};TradingView.LineToolPrediction.prototype.endChanging=function(){LineDataSource.prototype.endChanging.call(this);this.setStatus(TradingView.LineToolPrediction.ALERT_STATUS_WAITING);this.checkAlert()};TradingView.LineToolPrediction.prototype.onData=function(a){LineDataSource.prototype.onData.call(this,a);this.checkAlert()};
TradingView.LineToolPrediction.prototype.endMoving=function(){LineDataSource.prototype.endMoving.call(this);this.setStatus(TradingView.LineToolPrediction.ALERT_STATUS_WAITING);this.checkAlert()};TradingView.LineToolPrediction.prototype.direction=function(){if(2>this.points().size())return TradingView.LineToolPrediction.DIRECTION_UP;var a=this.points().item(0);return this.points().item(1).price>a.price?TradingView.LineToolPrediction.DIRECTION_UP:TradingView.LineToolPrediction.DIRECTION_DOWN};function PolylinePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(PolylinePaneView,LineSourcePaneView);
PolylinePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().linecolor.value();a.linewidth=this._source.properties().linewidth.value();a.linestyle=this._source.properties().linestyle.value();a.filled=this._source.properties().filled.value();a.backcolor=this._source.properties().backgroundColor.value();a.fillBackground=this._source.properties().fillBackground.value();a.transparency=this._source.properties().transparency.value();if(this.isAnchorsRequired()){var b=
new CompositeRenderer;b.append(new PoligonRenderer(a));a=a.points.clone();this._model.lineBeingCreated()==this._source&&a.removeAt(a.size()-1);b.append(this.createLineAnchor({points:a}));return b}return new PoligonRenderer(a)};TradingView.LineToolPolyline=function(a,b){this._constructor="LineToolPolyline";var c;b?c=b:(c=new DefaultProperty("linetoolpolyline"),c.filled.setValue(!1));LineDataSource.call(this,a,new PolylinePaneView(this,a),c)};inherit(TradingView.LineToolPolyline,LineDataSource);
TradingView.LineToolPolyline.prototype.pointsCount=function(){return-1};TradingView.LineToolPolyline.prototype.title=function(){return"Polyline"};
TradingView.LineToolPolyline.prototype.addPoint=function(a){var b=this._model.timeScale().indexToCoordinate(a.index),c=a.price,d=null;this.priceScale().isPercent()&&(d=this.ownerSource().firstValue());c=this.priceScale().priceToCoordinate(c);if(0<this._points.size()){var e=this._points.item(this._points.size()-1),f=this._model.timeScale().indexToCoordinate(e.index),e=e.price;this.priceScale().isPercent()&&(e=this.priceScale().priceRange().convertToPercent(e,d));e=this.priceScale().priceToCoordinate(e);
if(5>(new MathEx.Point(b,c)).substract(new MathEx.Point(f,e)).length())return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0;e=this._points.item(0);f=this._model.timeScale().indexToCoordinate(e.index);e=e.price;this.priceScale().isPercent()&&(e=this.priceScale().priceRange().convertToPercent(e,d));d=this.priceScale().priceToCoordinate(e);if(5>(new MathEx.Point(b,c)).substract(new MathEx.Point(f,d)).length())return this._properties.filled.setValue(!0),this._lastPoint=null,
this.normalizePoints(),this.createServerPoints(),!0}return LineDataSource.prototype.addPoint.call(this,a)};
TradingView.LineToolPolyline.prototype.setPoint=function(a,b){LineDataSource.prototype.setPoint.call(this,a,b);if(!(this._model.timeScale().isEmpty()||this.priceScale().isEmpty()||a!==this._points.size()-1&&0!==a)){var c=this._model.timeScale().indexToCoordinate(b.index),d=this.priceScale().priceToCoordinate(b.price),e=this._points.item(0),f=this._model.timeScale().indexToCoordinate(e.index),e=this.priceScale().priceToCoordinate(e.price);5>(new MathEx.Point(c,d)).substract(new MathEx.Point(f,e)).length()&&
this._properties.filled.setValue(!0)}};function GannSquarePaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(GannSquarePaneView,LineSourcePaneView);
GannSquarePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return console.log("GannSquarePaneView:1 point"),this.addAnchors(a),a;for(var b=this._points.item(0),c=this._points.item(1),d=Math.min(b.x,c.x),e=Math.min(b.y,c.y),f=Math.max(b.x,c.x),g=Math.max(b.y,c.y),h=this._source.properties(),k=this._source.properties().fillHorzBackground.value(),m=this._source.properties().horzTransparency.value(),n=this._source.properties().fillVertBackground.value(),q=this._source.properties().vertTransparency.value(),
l=0;l<this._hlevels.length;l++){if(0<l&&k){var s=this._hlevels[l-1],b=new MathEx.Point(d,this._hlevels[l].y),c=new MathEx.Point(f,s.y),s={nohittest:!0};s.points=(new List).append(b).append(c);s.color=this._hlevels[l].color;s.linewidth=0;s.backcolor=this._hlevels[l].color;s.fillBackground=!0;s.transparency=m;a.append(new RectangleRenderer(s))}b=new MathEx.Point(d,this._hlevels[l].y);c=new MathEx.Point(f,this._hlevels[l].y);s={points:(new List).append(b).append(c),width:this._model.timeScale().width(),
height:this._source.priceScale().height(),color:this._hlevels[l].color,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(s));h.showLeftLabels.value()&&(b={points:(new List).append(b),text:""+this._hlevels[l].coeff,color:this._hlevels[l].color,vertAlign:"middle",horzAlign:"right",font:h.font.value(),offsetX:-5,offsetY:0,fontsize:12},a.append(new TextRenderer(b,
this._rendererCache)));h.showRightLabels.value()&&(c={points:(new List).append(c),text:""+this._hlevels[l].coeff,color:this._hlevels[l].color,vertAlign:"middle",horzAlign:"left",font:h.font.value(),offsetX:5,offsetY:0,fontsize:12},a.append(new TextRenderer(c,this._rendererCache)))}for(l=0;l<this._vlevels.length;l++)b=new MathEx.Point(this._vlevels[l].x,e),c=new MathEx.Point(this._vlevels[l].x,g),0<l&&n&&(s=this._vlevels[l-1],d=new MathEx.Point(s.x,e),s={nohittest:!0},s.points=(new List).append(d).append(c),
s.color=this._vlevels[l].color,s.linewidth=0,s.backcolor=this._vlevels[l].color,s.fillBackground=!0,s.transparency=q,a.append(new RectangleRenderer(s))),s={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._vlevels[l].color,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},a.append(new TrendLineRenderer(s)),
h.showTopLabels.value()&&(d={points:(new List).append(b),text:""+this._vlevels[l].coeff,color:this._vlevels[l].color,vertAlign:"bottom",horzAlign:"center",font:h.font.value(),offsetX:0,offsetY:-5,fontsize:12},a.append(new TextRenderer(d,this._rendererCache))),h.showBottomLabels.value()&&(c={points:(new List).append(c),text:""+this._vlevels[l].coeff,color:this._vlevels[l].color,vertAlign:"top",horzAlign:"center",font:h.font.value(),offsetX:0,offsetY:5,fontsize:12},a.append(new TextRenderer(c,this._rendererCache)));
this.addAnchors(a);return a};
GannSquarePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._source.points().item(0),b=this._source.points().item(1);this._hlevels=[];var c=b.price-a.price,d;this._source.priceScale().isPercent()&&(d=this._source.ownerSource().firstValue());for(var e=1;7>=e;e++){var f="hlevel"+e,g=this._source.properties()[f];if(g.visible.value()){var f=
g.coeff.value(),g=g.color.value(),h=a.price+f*c;this._source.priceScale().isPercent()&&(h=this._source.priceScale().priceRange().convertToPercent(h,d));h=this._source.priceScale().priceToCoordinate(h);this._hlevels.push({coeff:f,color:g,y:h})}}this._vlevels=[];b=b.index-a.index;for(e=1;7>=e;e++)f="vlevel"+e,g=this._source.properties()[f],g.visible.value()&&(f=g.coeff.value(),g=g.color.value(),c=Math.round(a.index+f*b),c=this._model.timeScale().indexToCoordinate(c),this._vlevels.push({coeff:f,color:g,
x:c}))}};TradingView.LineToolGannSquare=function(a,b){this._constructor="LineToolGannSquare";var c=b?b:new DefaultProperty("linetoolgannsquare");LineDataSource.call(this,a,new GannSquarePaneView(this,a),c)};inherit(TradingView.LineToolGannSquare,LineDataSource);TradingView.LineToolGannSquare.prototype.pointsCount=function(){return 2};TradingView.LineToolGannSquare.prototype.title=function(){return"Gann Box"};function GannFanPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(GannFanPaneView,LineSourcePaneView);
GannFanPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._points.item(0),b=this._points.item(1);this._fans=[];for(var c=b.x-a.x,d=b.y-a.y,e=1;9>=e;e++){var f="level"+e,f=this._source.properties()[f];if(f.visible.value()){var g=f.coeff1.value(),h=f.coeff2.value(),k=g/h,m=f.color.value(),n=""+g+"/"+h;g>h?(g=b.x,k=a.y+d/
k):(g=a.x+c*k,k=b.y);this._fans.push({label:n,color:m,x:g,y:k,index:e,linewidth:f.linewidth.value(),linestyle:f.linestyle.value(),index:e})}}}};
GannFanPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0);this._points.item(1);for(var c=this._source.properties(),d=this._source.properties().fillBackground.value(),e=this._source.properties().transparency.value(),f=0;f<this._fans.length;f++){var g=new MathEx.Point(this._fans[f].x,this._fans[f].y);if(d)if(4>this._fans[f].index){var h=new MathEx.Point(this._fans[f+1].x,this._fans[f+1].y),k={};k.width=this._model.timeScale().width();
k.p1=b;k.p2=g;k.p3=b;k.p4=h;k.color=this._fans[f].color;k.transparency=e;k.hittestOnBackground=TradingView.isMobile.any();a.append(new ChannelRenderer(k))}else 4<this._fans[f].index&&0<f&&(h=new MathEx.Point(this._fans[f-1].x,this._fans[f-1].y),k={},k.width=this._model.timeScale().width(),k.p1=b,k.p2=g,k.p3=b,k.p4=h,k.color=this._fans[f].color,k.transparency=e,k.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(k)));h={points:(new List).append(b).append(g),width:this._model.timeScale().width(),
height:this._source.priceScale().height(),color:this._fans[f].color,linewidth:this._fans[f].linewidth,linestyle:this._fans[f].linestyle,extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};k=new HitTestResult(HitTestResult.MOVEPOINT,null,this._fans[f].index);a.append(new TrendLineRenderer(h,k));c.showLabels.value()&&(g={points:(new List).append(g),text:this._fans[f].label,color:this._fans[f].color,vertAlign:"middle",horzAlign:"left",font:c.font.value(),
offsetX:0,offsetY:-5,fontsize:12},a.append(new TextRenderer(g,this._rendererCache)))}this.isAnchorsRequired()&&(b=this._points.clone(),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));return a};TradingView.LineToolGannFan=function(a,b){this._constructor="LineToolGannFan";var c=b?b:new DefaultProperty("linetoolgannfan");LineDataSource.call(this,a,new GannFanPaneView(this,a),c)};inherit(TradingView.LineToolGannFan,LineDataSource);
TradingView.LineToolGannFan.prototype.pointsCount=function(){return 2};TradingView.LineToolGannFan.prototype.title=function(){return"Gann Fan"};TradingView.LineToolGannFan.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function FibRetracementPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(FibRetracementPaneView,LineSourcePaneView);
FibRetracementPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._source.points().item(0),b=this._source.points().item(1),c=!1,d=this._source.properties();d.reverse&&d.reverse.value()&&(c=d.reverse.value());this._levels=[];var e=c?b.price-a.price:a.price-b.price,a=c?a.price:b.price,f;if(this._source.priceScale().isPercent()&&
(f=this._source.ownerSource().firstValue(),null===f))return;for(b=1;11>=b;b++)if(c=d["level"+b],c.visible.value()){var g=c.coeff.value(),h=c.color.value(),k=a+g*e;this._source.priceScale().isPercent()&&(k=this._source.priceScale().priceRange().convertToPercent(k,f));var m=this._source.priceScale().priceToCoordinate(k),n,q=function(a){return d.coeffsAsPercents.value()?""+Math.round(1E4*a)/100+"%":""+a};d.showCoeffs.value()&&d.showPrices.value()?n=""+q(g)+"("+this._source.priceScale().formatter().format(k)+
")":d.showCoeffs.value()?n=""+q(g):d.showPrices.value()&&(n=""+this._source.priceScale().formatter().format(k));this._levels.push({coeff:g,color:h,y:m,label:n,linewidth:c.linewidth.value(),linestyle:c.linestyle.value(),index:b})}}};
FibRetracementPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0),c=this._points.item(1),d=Math.min(b.x,c.x);Math.min(b.y,c.y);var e=Math.max(b.x,c.x);Math.max(b.y,c.y);for(var f=this._source.properties(),g=f.fillBackground.value(),h=f.transparency.value(),k=f.extendLines.value()?this._model.timeScale().width():e,m=0;m<this._levels.length;m++){if(0<m&&g){var c=this._levels[m-1],b=new MathEx.Point(d,this._levels[m].y),c=new MathEx.Point(k,
c.y),n={};n.nohittest=!TradingView.isMobile.any();n.points=(new List).append(b).append(c);n.color=this._levels[m].color;n.linewidth=0;n.backcolor=this._levels[m].color;n.fillBackground=!0;n.transparency=h;a.append(new RectangleRenderer(n))}var b=new MathEx.Point(d,this._levels[m].y),c=new MathEx.Point(e,this._levels[m].y),n={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._levels[m].color,linewidth:this._levels[m].linewidth,
linestyle:this._levels[m].linestyle,extendleft:!1,extendright:f.extendLines.value(),leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},q=new HitTestResult(HitTestResult.MOVEPOINT,null,this._levels[m].index);a.append(new TrendLineRenderer(n,q));if(f.showCoeffs.value()||f.showPrices.value()){var l,s,n=f.vertLabelsAlign.value();switch(f.horzLabelsAlign.value()){case "left":l=b;s="right";break;case "center":l=b.add(c).scaled(0.5);s="center";break;case "right":f.extendLines.value()?
(l=new MathEx.Point(k-4,this._levels[m].y),s="right"):(l=new MathEx.Point(k+4,this._levels[m].y),s="left")}b={points:(new List).append(l),text:this._levels[m].label,color:this._levels[m].color,vertAlign:n,horzAlign:s,font:f.font.value(),offsetX:-5,offsetY:"top"==n?0:-5,fontsize:12};a.append(new TextRenderer(b,this._rendererCache))}}f.trendline.visible.value()&&(n={points:(new List).append(this._points.item(0)).append(this._points.item(1)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),
color:f.trendline.color.value(),linewidth:f.trendline.linewidth.value(),linestyle:f.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},a.append(new TrendLineRenderer(n)));this.isAnchorsRequired()&&(d=this._points.clone(),this._model.lineBeingCreated()==this._source&&d.removeAt(d.size()-1),a.append(this.createLineAnchor({points:d})));return a};
TradingView.LineToolFibRetracement=function(a,b){this._constructor="LineToolFibRetracement";var c=b?b:new DefaultProperty("linetoolfibretracement");LineDataSource.call(this,a,new FibRetracementPaneView(this,a),c);this.version=TradingView.LineToolFibRetracement.version};inherit(TradingView.LineToolFibRetracement,LineDataSource);TradingView.LineToolFibRetracement.version=2;TradingView.LineToolFibRetracement.prototype.pointsCount=function(){return 2};
TradingView.LineToolFibRetracement.prototype.title=function(){return"Fib Retracement"};TradingView.LineToolFibRetracement.prototype.migrateVersion=function(a,b,c){1==a&&this.properties().extendLines.setValue(!0)};TradingView.LineToolFibRetracement.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function TrendBasedFibExtensionPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(TrendBasedFibExtensionPaneView,LineSourcePaneView);
TrendBasedFibExtensionPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(3>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._source.points().item(0),b=this._source.points().item(1),c=this._source.points().item(2),d=!1,e=this._source.properties();e.reverse&&e.reverse.value()&&(d=e.reverse.value());this._levels=[];var a=d?a.price-b.price:b.price-a.price,f;this._source.priceScale().isPercent()&&
(f=this._source.ownerSource().firstValue());for(b=1;11>=b;b++)if(d=e["level"+b],d.visible.value()){var g=d.coeff.value(),h=d.color.value(),k=c.price+g*a;this._source.priceScale().isPercent()&&(k=this._source.priceScale().priceRange().convertToPercent(k,f));var m=function(a){return e.coeffsAsPercents.value()?""+Math.round(1E4*a)/100+"%":""+a},n=this._source.priceScale().priceToCoordinate(k),q;e.showCoeffs.value()&&e.showPrices.value()?q=""+m(g)+"("+this._source.priceScale().formatter().format(k)+")":
e.showCoeffs.value()?q=""+m(g):e.showPrices.value()&&(q=""+this._source.priceScale().formatter().format(k));this._levels.push({coeff:g,color:h,y:n,label:q,linewidth:d.linewidth.value(),linestyle:d.linestyle.value(),index:b})}}};
TrendBasedFibExtensionPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0),c=this._points.item(1),d=this._source.properties(),e={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:d.trendline.color.value(),linewidth:d.trendline.linewidth.value(),linestyle:d.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(e));if(3>this._points.size())return this.addAnchors(a),a;var f=this._points.item(2),e={points:(new List).append(c).append(f),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:d.trendline.color.value(),linewidth:d.trendline.linewidth.value(),linestyle:d.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(e));
var g=Math.min(f.x,c.x);Math.min(b.y,c.y);f=Math.max(f.x,c.x);Math.max(b.y,c.y);for(var h=d.fillBackground.value(),k=d.transparency.value(),m=d.extendLines.value()?this._model.timeScale().width():f,n=0;n<this._levels.length;n++){0<n&&h&&(c=this._levels[n-1],b=new MathEx.Point(g,this._levels[n].y),c=new MathEx.Point(m,c.y),e={},e.nohittest=!TradingView.isMobile.any(),e.points=(new List).append(b).append(c),e.color=this._levels[n].color,e.linewidth=0,e.backcolor=this._levels[n].color,e.fillBackground=
!0,e.transparency=k,a.append(new RectangleRenderer(e)));var b=new MathEx.Point(g,this._levels[n].y),c=new MathEx.Point(f,this._levels[n].y),e={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._levels[n].color,linewidth:this._levels[n].linewidth,linestyle:this._levels[n].linestyle,extendleft:!1,extendright:d.extendLines.value(),leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},q=new HitTestResult(HitTestResult.MOVEPOINT,
null,this._levels[n].index);a.append(new TrendLineRenderer(e,q));if(d.showCoeffs.value()||d.showPrices.value()){var l,s,e=d.vertLabelsAlign.value();switch(d.horzLabelsAlign.value()){case "left":l=b;s="right";break;case "center":l=b.add(c).scaled(0.5);s="center";break;case "right":d.extendLines.value()?(l=new MathEx.Point(m-4,this._levels[n].y),s="right"):(l=new MathEx.Point(m+4,this._levels[n].y),s="left")}b={points:(new List).append(l),text:this._levels[n].label,color:this._levels[n].color,vertAlign:e,
horzAlign:s,font:d.font.value(),offsetX:-5,offsetY:"top"==e?0:-5,fontsize:12};a.append(new TextRenderer(b,this._rendererCache))}}this.addAnchors(a);return a};TradingView.LineToolTrendBasedFibExtension=function(a,b){this._constructor="LineToolTrendBasedFibExtension";var c=b?b:new DefaultProperty("linetooltrendbasedfibextension");LineDataSource.call(this,a,new TrendBasedFibExtensionPaneView(this,a),c);this.version=TradingView.LineToolTrendBasedFibExtension.version};
inherit(TradingView.LineToolTrendBasedFibExtension,LineDataSource);TradingView.LineToolTrendBasedFibExtension.version=2;TradingView.LineToolTrendBasedFibExtension.prototype.pointsCount=function(){return 3};TradingView.LineToolTrendBasedFibExtension.prototype.title=function(){return"Trend-Based Fib Extension"};TradingView.LineToolTrendBasedFibExtension.prototype.migrateVersion=function(a,b,c){1==a&&this.properties().extendLines.setValue(!0)};
TradingView.LineToolTrendBasedFibExtension.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function FibSpeedResistanceFanPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(FibSpeedResistanceFanPaneView,LineSourcePaneView);
FibSpeedResistanceFanPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._source.points().item(0),b=this._source.points().item(1);this._hlevels=[];var c=b.price-a.price,d;this._source.priceScale().isPercent()&&(d=this._source.ownerSource().firstValue());for(var e=1;7>=e;e++){var f="hlevel"+e,g=this._source.properties()[f];
if(g.visible.value()){var f=g.coeff.value(),g=g.color.value(),h=a.price+f*c;this._source.priceScale().isPercent()&&(h=this._source.priceScale().priceRange().convertToPercent(h,d));h=this._source.priceScale().priceToCoordinate(h);this._hlevels.push({coeff:f,color:g,y:h,index:e})}}this._vlevels=[];b=b.index-a.index;for(e=1;7>=e;e++)f="vlevel"+e,g=this._source.properties()[f],g.visible.value()&&(f=g.coeff.value(),g=g.color.value(),c=Math.round(a.index+f*b),c=this._model.timeScale().indexToCoordinate(c),
this._vlevels.push({coeff:f,color:g,x:c,index:e}))}};
FibSpeedResistanceFanPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;for(var b=this._points.item(0),c=this._points.item(1),d=Math.min(b.x,c.x),e=Math.min(b.y,c.y),f=Math.max(b.x,c.x),g=Math.max(b.y,c.y),h=this._source.properties(),k=h.grid.color.value(),m=h.grid.linewidth.value(),n=h.grid.linestyle.value(),q=0;q<this._hlevels.length;q++){b=new MathEx.Point(d,this._hlevels[q].y);c=new MathEx.Point(f,this._hlevels[q].y);if(h.grid.visible.value()){var l=
{points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:k,linewidth:m,linestyle:n,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(l))}h.showLeftLabels.value()&&(b={points:(new List).append(b),text:""+this._hlevels[q].coeff,color:this._hlevels[q].color,vertAlign:"middle",horzAlign:"right",font:h.font.value(),offsetX:-5,offsetY:0,fontsize:12},
a.append(new TextRenderer(b,this._rendererCache)));h.showRightLabels.value()&&(c={points:(new List).append(c),text:""+this._hlevels[q].coeff,color:this._hlevels[q].color,vertAlign:"middle",horzAlign:"left",font:h.font.value(),offsetX:5,offsetY:0,fontsize:12},a.append(new TextRenderer(c,this._rendererCache)))}for(q=0;q<this._vlevels.length;q++)b=new MathEx.Point(this._vlevels[q].x,e),c=new MathEx.Point(this._vlevels[q].x,g),h.grid.visible.value()&&(l={points:(new List).append(b).append(c),width:this._model.timeScale().width(),
height:this._source.priceScale().height(),color:k,linewidth:m,linestyle:n,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},a.append(new TrendLineRenderer(l))),h.showTopLabels.value()&&(b={points:(new List).append(b),text:""+this._vlevels[q].coeff,color:this._vlevels[q].color,vertAlign:"bottom",horzAlign:"center",font:h.font.value(),offsetX:0,offsetY:-5,fontsize:12},a.append(new TextRenderer(b,this._rendererCache))),h.showBottomLabels.value()&&
(c={points:(new List).append(c),text:""+this._vlevels[q].coeff,color:this._vlevels[q].color,vertAlign:"top",horzAlign:"center",font:h.font.value(),offsetX:0,offsetY:5,fontsize:12},a.append(new TextRenderer(c,this._rendererCache)));e=h.fillBackground.value();g=h.transparency.value();b=this._points.item(0);c=this._points.item(1);for(q=0;q<this._hlevels.length;q++)n=new MathEx.Point(c.x,this._hlevels[q].y),0<q&&e&&(k=new MathEx.Point(c.x,this._hlevels[q-1].y),m={},m.width=this._model.timeScale().width(),
m.p1=b,m.p2=n,m.p3=b,m.p4=k,m.color=this._hlevels[q].color,m.transparency=g,m.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(m))),l={points:(new List).append(b).append(n),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._hlevels[q].color,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},k=new HitTestResult(HitTestResult.MOVEPOINT,
null,{type:"h",index:this._hlevels[q].index}),a.append(new TrendLineRenderer(l,k));for(q=0;q<this._vlevels.length;q++)n=new MathEx.Point(this._vlevels[q].x,c.y),0<q&&e&&(k=new MathEx.Point(this._vlevels[q-1].x,c.y),m={},m.width=this._model.timeScale().width(),m.p1=b,m.p2=n,m.p3=b,m.p4=k,m.color=this._vlevels[q].color,m.transparency=g,m.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(m))),l={points:(new List).append(b).append(n),width:this._model.timeScale().width(),height:this._source.priceScale().height(),
color:this._vlevels[q].color,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:!1,extendright:!0,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},k=new HitTestResult(HitTestResult.MOVEPOINT,null,{type:"v",index:this._vlevels[q].index}),a.append(new TrendLineRenderer(l,k));this.isAnchorsRequired()&&(h=this._points.clone(),this._model.lineBeingCreated()==this._source&&h.removeAt(h.size()-1),a.append(this.createLineAnchor({points:h})));return a};
TradingView.LineToolFibSpeedResistanceFan=function(a,b){this._constructor="LineToolFibSpeedResistanceFan";var c=b?b:new DefaultProperty("linetoolfibspeedresistancefan");LineDataSource.call(this,a,new FibSpeedResistanceFanPaneView(this,a),c)};inherit(TradingView.LineToolFibSpeedResistanceFan,LineDataSource);TradingView.LineToolFibSpeedResistanceFan.prototype.pointsCount=function(){return 2};TradingView.LineToolFibSpeedResistanceFan.prototype.title=function(){return"Fib Speed Resistance Fan"};
TradingView.LineToolFibSpeedResistanceFan.prototype.processErase=function(a,b){var c="h"==b.type?"hlevel"+b.index:"vlevel"+b.index,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function FibArcRenderer(a,b){this._data=a;this._hittest=b}
FibArcRenderer.prototype.draw=function(a){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.translate(this._data.center.x,this._data.center.y);a.beginPath();0<this._data.dir?a.arc(0,0,this._data.radius,0,Math.PI,!1):a.arc(0,0,this._data.radius,Math.PI,0,!1);a.stroke();this._data.fillBackground&&(this._data.radius2&&(0<this._data.dir?a.arc(0,0,this._data.radius2,Math.PI,0,!0):a.arc(0,0,this._data.radius2,0,Math.PI,!0)),a.fillStyle=generateColor(this._data.color,this._data.transparency),
a.fill())};FibArcRenderer.prototype.hitTest=function(a){if(MathEx.sign(a.y-this._data.center.y)!==this._data.dir)return null;a=a.substract(this._data.center).length();var b=this._hittest||new HitTestResult(HitTestResult.MOVEPOINT);if(this._data.hittestOnBackground){if(Math.abs(a)<=this._data.radius+3)return b}else if(3>Math.abs(a-this._data.radius))return b;return null};function FibSpeedResistanceArcsPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}
inherit(FibSpeedResistanceArcsPaneView,LineSourcePaneView);
FibSpeedResistanceArcsPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._points.size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._points.item(0),b=this._points.item(1),c=a.substract(b).length();this._levels=[];for(var d=this._source.properties(),e=1;11>=e;e++){var f=d["level"+e];if(f.visible.value()){var g=f.coeff.value(),h=f.color.value(),k=b.substract(a).length()*g,m;d.showCoeffs.value()&&
(m=""+g);var n=MathEx.sign(b.y-a.y),q=new MathEx.Point(a.x,a.y+n*c*g);this._levels.push({coeff:g,color:h,label:m,radius:k,dir:n,labelPoint:q,linewidth:f.linewidth.value(),linestyle:f.linestyle.value(),index:e})}}}};
FibSpeedResistanceArcsPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0);this._points.item(1);for(var c=this._source.properties(),d=c.fillBackground.value(),e=c.transparency.value(),f=0;f<this._levels.length;f++){var g=this._levels[f],h={};h.center=b;h.color=g.color;h.linewidth=g.linewidth;h.radius=g.radius;h.dir=g.dir;h.transparency=e;h.fillBackground=d;h.hittestOnBackground=TradingView.isMobile.any();0<f&&(h.radius2=this._levels[f-
1].radius);var k=new HitTestResult(HitTestResult.MOVEPOINT,null,g.index);a.append(new FibArcRenderer(h,k));c.showCoeffs.value()&&(g={points:(new List).append(g.labelPoint),text:this._levels[f].label,color:this._levels[f].color,vertAlign:"middle",horzAlign:"right",font:c.font.value(),offsetX:0,offsetY:0,fontsize:12},a.append(new TextRenderer(g,this._rendererCache)))}c.trendline.visible.value()&&(b={points:(new List).append(this._points.item(0)).append(this._points.item(1)),width:this._model.timeScale().width(),
height:this._source.priceScale().height(),color:c.trendline.color.value(),linewidth:c.trendline.linewidth.value(),linestyle:c.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},a.append(new TrendLineRenderer(b)));this.isAnchorsRequired()&&(b=this._points.clone(),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));return a};
TradingView.LineToolFibSpeedResistanceArcs=function(a,b){this._constructor="LineToolFibSpeedResistanceArcs";var c=b?b:new DefaultProperty("linetoolfibspeedresistancearcs");LineDataSource.call(this,a,new FibSpeedResistanceArcsPaneView(this,a),c)};inherit(TradingView.LineToolFibSpeedResistanceArcs,LineDataSource);TradingView.LineToolFibSpeedResistanceArcs.prototype.pointsCount=function(){return 2};TradingView.LineToolFibSpeedResistanceArcs.prototype.title=function(){return"Fib Speed Resistance Arcs"};
TradingView.LineToolFibSpeedResistanceArcs.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function FibTimeZonePaneView(a,b){LineSourcePaneView.call(this,a,b);this._levels=[];this._rendererCache={}}inherit(FibTimeZonePaneView,LineSourcePaneView);
FibTimeZonePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(1>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._source.points().item(0);if(2===this._source.points().size())var b=this._source.points().item(1);var c=this._source.properties(),d=this._source.points().item(0).index;if(!this._model.timeScale().visibleBars().isEmpty())for(this._levels=[],a=b?b.index-a.index:
1,b=1;11>=b;b++){var e=c["level"+b];if(e.visible.value()){var f=Math.round(d+e.coeff.value()*a),f=this._model.timeScale().indexToCoordinate(f),f={index:b,x:f,color:e.color.value(),width:e.linewidth.value(),style:e.linestyle.value()};c.showLabels.value()&&(f.text=e.coeff.value(),f.y=this._source.priceScale().height());this._levels.push(f)}}}};
FibTimeZonePaneView.prototype.renderer=function(){for(var a=new CompositeRenderer,b=this._source.properties(),c=0;c<this._levels.length;c++){var d={};d.points=(new List).append(new MathEx.Point(this._levels[c].x,0));d.color=this._levels[c].color;d.linewidth=this._levels[c].width;d.linestyle=this._levels[c].style;var e=new HitTestResult(HitTestResult.MOVEPOINT,null,this._levels[c].index);a.append(new VertLineRenderer(d,e));if(0<c&&b.fillBackground.value()){var f=this._levels[c-1],e=new MathEx.Point(this._levels[c].x,
0),f=new MathEx.Point(f.x,this._source.priceScale().height()),g={nohittest:!0};g.points=(new List).append(e).append(f);g.color=this._levels[c].color;g.linewidth=0;g.backcolor=this._levels[c].color;g.fillBackground=!0;g.transparency=b.transparency.value();a.append(new RectangleRenderer(g))}if(void 0!==this._levels[c].text){var h,k,m,e=b.horzLabelsAlign.value(),e="left"==e?"right":"right"==e?"left":"center";switch(e){case "left":k=3;break;case "center":k=0;break;case "right":k=-3}switch(b.vertLabelsAlign.value()){case "top":h=
new MathEx.Point(this._levels[c].x,0);m=5;break;case "middle":h=new MathEx.Point(this._levels[c].x,0.5*this._levels[c].y);m=0;break;case "bottom":h=new MathEx.Point(this._levels[c].x,this._levels[c].y),m=-10}d={points:(new List).append(h),text:""+this._levels[c].text,color:d.color,vertAlign:"middle",horzAlign:e,font:b.font.value(),offsetX:k,offsetY:m,fontsize:12};a.append(new TextRenderer(d,this._rendererCache))}}2===this._points.size()&&(b={points:(new List).append(this._points.item(0)).append(this._points.item(1)),
width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:b.trendline.color.value(),linewidth:b.trendline.linewidth.value(),linestyle:b.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},a.append(new TrendLineRenderer(b)));this.isAnchorsRequired()&&(2===this._source.points().size()?(b=this._points.clone(),a.append(this.createLineAnchor({points:b}))):0<this._points.size()&&(b=new List,b.append(new MathEx.Point(this._points.item(0).x,
this._source.priceScale().height()/2)),a.append(this.createLineAnchor({points:b,hittestResult:HitTestResult.MOVEPOINT}))));return a};TradingView.LineToolFibTimeZone=function(a,b){this._constructor="LineToolFibTimeZone";var c=b?b:new DefaultProperty("linetoolfibtimezone");LineDataSource.call(this,a,new FibTimeZonePaneView(this,a),c);this.version=TradingView.LineToolFibTimeZone.version};inherit(TradingView.LineToolFibTimeZone,LineDataSource);TradingView.LineToolFibTimeZone.version=2;
TradingView.LineToolFibTimeZone.prototype.migrateVersion=function(a,b,c){if(1===a){c.properties.level1.color.setValue(c.properties.baselinecolor.value());for(a=2;11>=a;a++)c.properties["level"+a].color.setValue(c.properties.linecolor.value());for(a=1;11>=a;a++)c.properties["level"+a].linewidth.setValue(c.properties.linewidth.value()),c.properties["level"+a].linestyle.setValue(c.properties.linestyle.value())}};TradingView.LineToolFibTimeZone.prototype.pointsCount=function(){return 2};
TradingView.LineToolFibTimeZone.prototype.title=function(){return"Fib Time Zone"};TradingView.LineToolFibTimeZone.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function EllipseRendererSimple(a,b){this._data=a;this._hittest=b}
EllipseRendererSimple.prototype.draw=function(a){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.lineStyle=this._data.linestyle;var b=this._data.points.item(0),c=this._data.points.item(1),d=Math.abs(b.x-c.x),e=Math.abs(b.y-c.y),b=b.add(c).scaled(0.5);if(!(1>d||1>e)){if(this._data.wholePoints){var c=this._data.wholePoints.item(0),f=this._data.wholePoints.item(1),g=Math.abs(c.x-f.x);Math.abs(c.y-f.y)}a.save();a.translate(b.x,b.y);a.scale(1,e/d);a.beginPath();a.arc(0,
0,d/2,0,2*Math.PI,!1);a.restore();a.stroke();this._data.fillBackground&&(this._data.wholePoints&&(a.translate(b.x,b.y),a.scale(1,e/d),a.arc(0,0,g/2,0,2*Math.PI,!0)),a.fillStyle=generateColor(this._data.backcolor,this._data.transparency),a.fill())}};
EllipseRendererSimple.prototype.hitTest=function(a){if(2>this._data.points.size())return null;var b=this._data.points.item(0),c=this._data.points.item(1),d=0.5*Math.abs(b.x-c.x);Math.abs(b.y-c.y);var e=Math.abs(b.x-c.x),f=Math.abs(b.y-c.y),g=b.add(c).scaled(0.5);a=a.substract(g);if(1>e||1>f)return null;a.y/=(c.y-b.y)/(c.x-b.x);b=a.x*a.x+a.y*a.y-d*d;b=MathEx.sign(b)*Math.sqrt(Math.abs(b/d));d=this._hittest||new HitTestResult(HitTestResult.MOVEPOINT);if(this._data.fillBackground&&!this._data.noHitTestOnBackground){if(3>
b)return d}else if(3>Math.abs(b))return d;return null};function FibCirclesPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(FibCirclesPaneView,LineSourcePaneView);
FibCirclesPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._points.item(0),b=this._points.item(1);this._center=a.add(b).scaled(0.5);var c=Math.abs(b.x-a.x),a=Math.abs(b.y-a.y);this._levels=[];for(var b=this._source.properties(),d=1;11>=d;d++){var e=b["level"+d];if(e.visible.value()){var f=e.coeff.value(),g=e.color.value(),
h=new List;h.append(new MathEx.Point(this._center.x-0.5*c*f,this._center.y-0.5*a*f));h.append(new MathEx.Point(this._center.x+0.5*c*f,this._center.y+0.5*a*f));var k;b.showCoeffs.value()&&(k=f,k=b.coeffsAsPercents.value()?""+Math.round(1E4*k)/100+"%":""+k);var m=new MathEx.Point(this._center.x,this._center.y+0.5*a*f);this._levels.push({coeff:f,color:g,label:k,points:h,labelPoint:m,linewidth:e.linewidth.value(),linestyle:e.linestyle.value(),index:d})}}}};
FibCirclesPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;this._points.item(0);this._points.item(1);for(var b=this._source.properties(),c=b.fillBackground.value(),d=b.transparency.value(),e=0;e<this._levels.length;e++){var f=this._levels[e],g={};g.points=f.points;g.color=f.color;g.linewidth=f.linewidth;g.backcolor=f.color;0<e&&(g.wholePoints=this._levels[e-1].points);g.fillBackground=c;g.transparency=d;g.noHitTestOnBackground=!TradingView.isMobile.any();
var h=new HitTestResult(HitTestResult.MOVEPOINT,null,f.index);a.append(new EllipseRendererSimple(g,h));b.showCoeffs.value()&&(f={points:(new List).append(f.labelPoint),text:this._levels[e].label,color:this._levels[e].color,vertAlign:"middle",horzAlign:"right",font:b.font.value(),offsetX:0,offsetY:0,fontsize:12},a.append(new TextRenderer(f,this._rendererCache)))}b.trendline.visible.value()&&(b={points:(new List).append(this._points.item(0)).append(this._points.item(1)),width:this._model.timeScale().width(),
height:this._source.priceScale().height(),color:b.trendline.color.value(),linewidth:b.trendline.linewidth.value(),linestyle:b.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},a.append(new TrendLineRenderer(b)));this.isAnchorsRequired()&&(b=this._points.clone(),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));return a};
TradingView.LineToolFibCircles=function(a,b){this._constructor="LineToolFibCircles";var c=b?b:new DefaultProperty("linetoolfibcircles");LineDataSource.call(this,a,new FibCirclesPaneView(this,a),c)};inherit(TradingView.LineToolFibCircles,LineDataSource);TradingView.LineToolFibCircles.prototype.pointsCount=function(){return 2};TradingView.LineToolFibCircles.prototype.title=function(){return"Fib Circles"};
TradingView.LineToolFibCircles.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function ArcWedgeRenderer(a,b){this._data=a;this._hittest=b;this._rendererCache={}}
ArcWedgeRenderer.prototype.draw=function(a){a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.beginPath();a.arc(this._data.center.x,this._data.center.y,this._data.radius,this._data.edge1,this._data.edge2,!0);a.stroke();if(this._data.fillBackground){a.arc(this._data.center.x,this._data.center.y,this._data.prevRadius,this._data.edge2,this._data.edge1,!1);if(this._data.gradient){var b=a.createRadialGradient(this._data.center.x,this._data.center.y,this._data.prevRadius,this._data.center.x,
this._data.center.y,this._data.radius);b.addColorStop(0,generateColor(this._data.color1,this._data.transparency));b.addColorStop(1,generateColor(this._data.color2,this._data.transparency));a.fillStyle=b}else a.fillStyle=generateColor(this._data.color,this._data.transparency);a.fill()}};
ArcWedgeRenderer.prototype.hitTest=function(a){var b=a.substract(this._data.center).length(),c=this._hittest||new HitTestResult(HitTestResult.MOVEPOINT);if(this._data.fillBackground){if(b<=this._data.radius){var d=this._data.p1.substract(this._data.center).normalized(),e=this._data.p2.substract(this._data.center).normalized(),b=a.substract(this._data.center).normalized();a=d.dotProduct(e);d=b.dotProduct(d);b=b.dotProduct(e);if(d>=a&&b>=a)return c}}else if(4>=Math.abs(b-this._data.radius)&&(b=a.substract(this._data.p1).length(),
e=a.substract(this._data.p2).length(),b=Math.max(b,e),e=this._data.p1.substract(this._data.p2).length(),b<=e))return c;return null};function FibWedgePaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={};this._levels=[]}inherit(FibWedgePaneView,LineSourcePaneView);FibWedgePaneView.prototype._levelsCount=function(){return 11};
FibWedgePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._levels=[];if(!(3>this._points.size())){var a=this._points,b=a.item(0),c=a.item(1),d=a.item(2),a=c.substract(b).normalized(),d=d.substract(b).normalized(),e=new MathEx.Point(1,0),f=new MathEx.Point(0,1),g=Math.acos(a.dotProduct(e));0>a.dotProduct(f)&&(g=2*Math.PI-g);this._edge1=g;e=Math.acos(d.dotProduct(e));0>d.dotProduct(f)&&(e=2*Math.PI-e);this._edge2=e;g<e&&(this._edge1=Math.max(g,e),this._edge2=Math.min(g,
e)+2*Math.PI);Math.abs(g-e)>Math.PI&&(this._edge1=Math.min(g,e),this._edge2=Math.max(g,e)-2*Math.PI);f=this._source.properties();for(g=1;g<=this._levelsCount();g++)if(e=f["level"+g],e.visible.value()){var h=e.coeff.value(),k=e.color.value(),m=c.substract(b).length()*h,n;f.showCoeffs.value()&&(n=""+h);var q=a.add(d).scaled(0.5).normalized().scaled(m),q=b.add(q);this._levels.push({coeff:h,color:k,label:n,radius:m,labelPoint:q,p1:b.add(a.scaled(m)),p2:b.add(d.scaled(m)),linewidth:e.linewidth.value(),
linestyle:e.linestyle.value(),index:g})}}};
FibWedgePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._source.properties(),c=this._points,d=c.item(0),e=c.item(1),f={points:(new List).append(d).append(e),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:b.trendline.color.value(),linewidth:b.trendline.linewidth.value(),linestyle:b.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};
a.append(new TrendLineRenderer(f));if(3>this._points.size())return this.addAnchors(a),a;var g=c.item(2),c=g.data,f=e.substract(d).length();e.substract(d).normalized();g=g.substract(d).normalized();g=d.add(g.scaled(f));g.data=c;f={points:(new List).append(d).append(g),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:b.trendline.color.value(),linewidth:b.trendline.linewidth.value(),linestyle:b.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(f));for(c=this._levels.length-1;0<=c;c--){var f=this._levels[c],h={};h.center=this._points.item(0);h.radius=f.radius;h.prevRadius=0<c?this._levels[c-1].radius:0;h.edge=this._edge;h.color=f.color;h.linewidth=1;h.edge1=this._edge1;h.edge2=this._edge2;h.p1=f.p1;h.p2=f.p2;h.fillBackground=b.fillBackground.value();h.transparency=b.transparency.value();var k=new HitTestResult(HitTestResult.MOVEPOINT,null,f.index);a.append(new ArcWedgeRenderer(h,
k));b.showCoeffs.value()&&(f={points:(new List).append(f.labelPoint),text:this._levels[c].label,color:this._levels[c].color,vertAlign:"middle",horzAlign:"center",font:b.font.value(),offsetX:0,offsetY:0,fontsize:12,bold:!0},a.append(new TextRenderer(f,this._rendererCache)))}this.isAnchorsRequired()&&(c=(new List).append(d).append(e),this._model.lineBeingCreated()!=this._source&&c.append(g),a.append(this.createLineAnchor({points:c})));return a};
TradingView.LineToolFibWedge=function(a,b){this._constructor="LineToolFibSpeedResistanceArcs";var c=b?b:new DefaultProperty("linetoolfibwedge");LineDataSource.call(this,a,new FibWedgePaneView(this,a),c)};inherit(TradingView.LineToolFibWedge,LineDataSource);TradingView.LineToolFibWedge.prototype.pointsCount=function(){return 3};TradingView.LineToolFibWedge.prototype.title=function(){return"Fib Wedge"};
TradingView.LineToolFibWedge.prototype.setPoint=function(a,b){LineDataSource.prototype.setPoint.call(this,a,b);if(!this._recursiveGuard){this._recursiveGuard=!0;if(2==a){var c=this.pointToScreenPoint(this._points.item(0))[0],d=this.pointToScreenPoint(this._points.item(1))[0],e=this.pointToScreenPoint(this._points.item(2))[0],e=e.substract(c).length(),d=d.substract(c).normalized(),d=c.add(d.scaled(e)),c=this.priceScale().coordinateToPrice(d.y);a=Math.round(this._model.timeScale().coordinateToIndex(d.x));
this._properties.points[1].price.setValue(c);this._properties.points[1].bar.setValue(a)}else{var c=this.pointToScreenPoint(this._points.item(0))[0],d=this.pointToScreenPoint(this._points.item(1))[0],e=this.pointToScreenPoint(this._points.item(2))[0],f=d.substract(c).length(),d=e.substract(c).normalized(),e=c.add(d.scaled(f)),c=this.priceScale().coordinateToPrice(e.y);a=Math.round(this._model.timeScale().coordinateToIndex(e.x));this._properties.points[2].price.setValue(c);this._properties.points[2].bar.setValue(a)}this._recursiveGuard=
!1}};
TradingView.LineToolFibWedge.prototype.addPoint=function(a){if(2==this._points.size()){var b=this.pointToScreenPoint(this._points.item(0))[0],c=this.pointToScreenPoint(this._points.item(1))[0];if(this.priceScale().isPercent()){var d=this.ownerSource().firstValue();a.price=this.priceScale().priceRange().convertFromPercent(a.price,d)}a=this.pointToScreenPoint(a)[0];c=c.substract(b).length();a=a.substract(b).normalized();a=b.add(a.scaled(c));b=this.priceScale().coordinateToPrice(a.y);a={index:Math.round(this._model.timeScale().coordinateToIndex(a.x)),price:b}}return LineDataSource.prototype.addPoint.call(this,
a)};TradingView.LineToolFibWedge.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function ProjectionLinePaneView(a,b){FibWedgePaneView.call(this,a,b)}inherit(ProjectionLinePaneView,FibWedgePaneView);ProjectionLinePaneView.prototype.update=function(){FibWedgePaneView.prototype.update.call(this)};ProjectionLinePaneView.prototype._levelsCount=function(){return 1};
ProjectionLinePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._source.properties(),c=this._points,d=c.item(0),e=c.item(1),f={points:(new List).append(d).append(e),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:b.trendline.color.value(),linewidth:b.linewidth.value(),linestyle:b.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};
a.append(new TrendLineRenderer(f));if(3>this._points.size())return this.addAnchors(a),a;var g=c.item(2),c=g.data,f=e.substract(d).length();e.substract(d).normalized();e=g.substract(d).normalized();g=d.add(e.scaled(f));g.data=c;f={points:(new List).append(d).append(g),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:b.trendline.color.value(),linewidth:b.linewidth.value(),linestyle:b.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,
rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(f));d=this._levels[0];e={};e.center=this._points.item(0);e.radius=d.radius;e.prevRadius=0;e.edge=this._edge;e.color=b.trendline.color.value();e.color1=b.color1.value();e.color2=b.color2.value();e.linewidth=b.linewidth.value();e.edge1=this._edge1;e.edge2=this._edge2;e.p1=d.p1;e.p2=d.p2;e.fillBackground=b.fillBackground.value();e.transparency=b.transparency.value();e.gradient=!0;a.append(new ArcWedgeRenderer(e));this.addAnchors(a);
return a};TradingView.LineToolProjection=function(a,b){this._constructor="LineToolProjection";var c=b?b:new DefaultProperty("linetoolprojection");LineDataSource.call(this,a,new ProjectionLinePaneView(this,a),c)};inherit(TradingView.LineToolProjection,TradingView.LineToolFibWedge);TradingView.LineToolProjection.prototype.title=function(){return"Projection"};function ElliottLabelsPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache=[{},{},{},{},{},{}]}inherit(ElliottLabelsPaneView,LineSourcePaneView);
ElliottLabelsPaneView.prototype.renderer=function(){if(!this._wave)return null;for(var a=new CompositeRenderer,b=this._source.properties(),c=b.wavesize.value(),d=this._source.labels(),e=0;e<this._wave.length;e++)a.append(new TrendLineRenderer(this._wave[e]));var f=1;if(2<this._points.size())var g=this._points.item(2),e=this._points.item(1),f=MathEx.sign(g.y-e.y);var g=[],h=0;this._model.lineBeingCreated()==this._source&&(h=1);for(var k=(new RGBColor(this._model.backgroundColor())).blackWhiteContrast(),
m=b.color.value(),e=0;e<this._points.size()-h;e++,f=-f){var n=d[c][e],q={points:(new List).append(this._points.item(e)),text:n,color:(new RGBColor(m)).darken("black"==k?15:-15).toHex(),vertAlign:1==f?"top":"bottom",horzAlign:"center",font:"Arial",offsetX:0,offsetY:1==f?5:-10,fontsize:12};g.push(q);b.showBackground.value()&&(q.borderColor=m,q.backgroundColor=generateColor(m,60));""!=n&&a.append(new TextRenderer(q,this._rendererCache[e],new HitTestResult(HitTestResult.CHANGEPOINT,e)))}if(this.isAnchorsRequired()){b=
new List;for(c=0;c<g.length;c++)d=this._points.item(c).clone(),d.y=g[c].points.item(0).y,d.data=c,b.append(d);this._model.lineBeingCreated()==this._source&&0<b.size()&&b.removeAt(b.size()-1);a.append(this.createLineAnchor({points:b}))}return a};
ElliottLabelsPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._wave=[];var a=this._source.properties(),b=this._source.priceScale(),c=this._model.timeScale();if(b&&!b.isEmpty()&&!c.isEmpty()){var d;this._source.priceScale().isPercent()&&(d=this._source.ownerSource().firstValue());var e=a.color.value();if(a.showWave.value())for(var a=this._source.points(),f=1;f<a.size();f++){var g=a.item(f-1),h=a.item(f);this._model.mainSeries().bars().valueAt(g.index);this._model.mainSeries().bars().valueAt(h.index);
var k=c.indexToCoordinate(g.index),m=c.indexToCoordinate(h.index),g=g.price,h=h.price;this._source.priceScale().isPercent()&&(g=this._source.priceScale().priceRange().convertToPercent(g,d),h=this._source.priceScale().priceRange().convertToPercent(h,d));g=b.priceToCoordinate(g);h=b.priceToCoordinate(h);k={points:(new List).append(new MathEx.Point(k,g)).append(new MathEx.Point(m,h)),width:c.width(),height:b.height(),color:generateColor(e,0),linewidth:3,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,
extendright:!1,leftend:LineDataSource.LINEEND_CIRCLE,rightend:LineDataSource.LINEEND_CIRCLE,endstyle:{strokeWidth:1,fillStyle:this._model.backgroundColor()},overlayLineEndings:!0};this._wave.push(k)}}};TradingView.LineToolElliott=function(a,b){var c=b?b:new DefaultProperty("linetoolelliott");LineDataSource.call(this,a,new ElliottLabelsPaneView(this,a),c)};inherit(TradingView.LineToolElliott,LineDataSource);TradingView.LineToolElliott.prototype.title=function(){return"Elliott Labels"};
TradingView.LineToolElliott5Points=function(a,b){var c=b?b:new DefaultProperty("linetoolelliott");LineDataSource.call(this,a,new ElliottLabelsPaneView(this,a),c);this.version=TradingView.LineToolElliott5Points.version};inherit(TradingView.LineToolElliott5Points,TradingView.LineToolElliott);TradingView.LineToolElliott5Points.version=2;TradingView.LineToolElliott5Points.prototype.pointsCount=function(){return 6};
TradingView.LineToolElliott5Points.prototype.labels=function(){return[" i ii iii iv v".split(" ")," (i) (ii) (iii) (iv) (v)".split(" ")," ((i)) ((ii)) ((iii)) ((iv)) ((v))".split(" ")," 1 2 3 4 5".split(" ")," (1) (2) (3) (4) (5)".split(" ")," ((1)) ((2)) ((3)) ((4)) ((5))".split(" ")," I II III IV V".split(" ")," (I) (II) (III) (IV) (V)".split(" ")," ((I)) ((II)) ((III)) ((IV)) ((V))".split(" ")]};
TradingView.LineToolElliott5Points.prototype.migrateVersion=function(a,b,c){1==a&&(a=$.extend({},this._timePoint.item(0)),this._timePoint.insert(a,0),0<this._points.size()&&(a=$.extend({},this._points.item(0)),this._points.insert(a,0)))};TradingView.LineToolElliottSubminuette=function(a,b){this._constructor="LineToolElliottSubminuette";var c=b?b:new DefaultProperty("linetoolelliottsubminuette");TradingView.LineToolElliott5Points.call(this,a,c)};inherit(TradingView.LineToolElliottSubminuette,TradingView.LineToolElliott5Points);
TradingView.LineToolElliottMinor=function(a,b){this._constructor="LineToolElliottMinor";var c=b?b:new DefaultProperty("linetoolelliottminor");TradingView.LineToolElliott5Points.call(this,a,c)};inherit(TradingView.LineToolElliottMinor,TradingView.LineToolElliott5Points);TradingView.LineToolElliottCircle=function(a,b){this._constructor="LineToolElliottCircle";var c=b?b:new DefaultProperty("linetoolelliottcircle");TradingView.LineToolElliott5Points.call(this,a,c)};
inherit(TradingView.LineToolElliottCircle,TradingView.LineToolElliott5Points);TradingView.LineToolElliott3Points=function(a,b){var c=b?b:new DefaultProperty("linetoolelliott");LineDataSource.call(this,a,new ElliottLabelsPaneView(this,a),c);this.version=TradingView.LineToolElliott3Points.version};inherit(TradingView.LineToolElliott3Points,TradingView.LineToolElliott);TradingView.LineToolElliott3Points.version=2;TradingView.LineToolElliott3Points.prototype.pointsCount=function(){return 4};
TradingView.LineToolElliott3Points.prototype.labels=function(){return[["","a","b","c"],["","A","B","C"]]};TradingView.LineToolElliott3Points.prototype.migrateVersion=function(a,b,c){1==a&&(a=$.extend({},this._timePoint.item(0)),this._timePoint.insert(a,0),0<this._points.size()&&(a=$.extend({},this._points.item(0)),this._points.insert(a,0)))};
TradingView.LineToolElliottMinorRetr=function(a,b){this._constructor="LineToolElliottMinorRetr";var c=b?b:new DefaultProperty("linetoolelliottminorretr");TradingView.LineToolElliott3Points.call(this,a,c)};inherit(TradingView.LineToolElliottMinorRetr,TradingView.LineToolElliott3Points);TradingView.LineToolElliottMajorRetr=function(a,b){this._constructor="LineToolElliottMajorRetr";var c=b?b:new DefaultProperty("linetoolelliottmajorretr");TradingView.LineToolElliott3Points.call(this,a,c)};
inherit(TradingView.LineToolElliottMajorRetr,TradingView.LineToolElliott3Points);function LineToolCircleLinesPaneView(a,b){LineSourcePaneView.call(this,a,b);this._lines=[]}inherit(LineToolCircleLinesPaneView,LineSourcePaneView);
LineToolCircleLinesPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(2>this._source.points().size())){var a=this._model.timeScale();if(this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!a.isEmpty()){var b=this._source.points().item(0),c=this._source.points().item(1),c=c?c.index-b.index:1;this._lines=[];if(0!==c){var d=a.visibleBars();if(0<c)for(b=b.index;b<=d.lastBar();b+=c)this._lines.push({x:a.indexToCoordinate(b)});else for(b=b.index;b>=d.firstBar();b+=
c)this._lines.push({x:a.indexToCoordinate(b)})}}}};
LineToolCircleLinesPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0),c=this._points.item(1),d=this._source.properties(),d={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:d.trendline.color.value(),linewidth:d.trendline.linewidth.value(),linestyle:d.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};
a.append(new TrendLineRenderer(d));d=this._source.properties();for(b=0;b<this._lines.length;b++)c={points:(new List).append(new MathEx.Point(this._lines[b].x,0)),color:d.linecolor.value(),linewidth:d.linewidth.value(),linestyle:d.linestyle.value()},a.append(new VertLineRenderer(c));this.isAnchorsRequired()&&(2===this._source.points().size()?(d=this._points.clone(),a.append(this.createLineAnchor({points:d}))):(d=new List,d.append(new MathEx.Point(this._points.item(0).x,this._source.priceScale().height()/
2)),a.append(this.createLineAnchor({points:d,hittestResult:HitTestResult.MOVEPOINT}))));return a};TradingView.LineToolCircleLines=function(a,b){this._constructor="LineToolCircleLines";var c=b?b:new DefaultProperty("linetoolcirclelines");LineDataSource.call(this,a,new LineToolCircleLinesPaneView(this,a),c)};inherit(TradingView.LineToolCircleLines,LineDataSource);TradingView.LineToolCircleLines.prototype.pointsCount=function(){return 2};TradingView.LineToolCircleLines.prototype.title=function(){return"Cyclic Lines"};TradingView.LineToolVbPFixed=function(a,b,c){var d=TradingView.Study.lineToolNameForPointsBasedStudy("VbPFixed@tv-volumebyprice");c=c?c:StudyMetaInfo.findStudyMetaInfo(a.studiesMetaData(),"VbPFixed@tv-volumebyprice");var e=a.studyVersioning();b=b?b:TradingView.prepareStudyProperties(c,null,null,e);var e=new StudyLineDataSourcePaneView(this,a),f=new TradingView.Study.StudyPaneView_hhists(this,a),g=new TradingView.Study.StudyPaneView_polygons(this,a);TradingView.StudyLineDataSource.call(this,a,[e,f,
g],b,d);this._turnaroundCounter=1;this._turnaround="vbpfixed_"+this._turnaroundCounter;this._metaInfo=c;this._graphics=new TradingView.StudyGraphics(c);this._formatter=new VolumeFormatter};inherit(TradingView.LineToolVbPFixed,TradingView.StudyLineDataSource);TradingView.LineToolVbPFixed.prototype.pointsCount=function(){return 2};
TradingView.LineToolVbPFixed.prototype._requestStudy=function(){var a=this.points().item(0),b=this.points().item(1),c=Math.min(a.index,b.index),a=Math.max(a.index,b.index);if(c===a)this.clearData();else if(c=this._model.mainSeries().bars().valueAt(c),a=this._model.mainSeries().bars().valueAt(a),c&&a){c=1E3*c[TIME_PLOT];a=1E3*a[TIME_PLOT];b=[];b.push(this.properties().inputs.rows.value());b.push(this.properties().inputs.volume.value());b.push(c);b.push(a);var d=this;this._studyId?(this._turnaround=
"vbpfixed_"+ ++this._turnaroundCounter,this._model.chartApi().modifyStudy(this._studyId,this._turnaround,b,function(a){d.onData(a)})):(this._studyId=TradingView.Study.makeNextStudyId(),this._model.chartApi().createStudy(this._studyId,this._turnaround,this._model.mainSeries()._seriesId,this._metaInfo.id+"-1!",b,function(a){d.onData(a)}))}};
TradingView.LineToolVbPFixed.prototype.onData=function(a){"data_update"===a.method&&a.params.customId==="pointset_"+this._currentPointsetId?(LineDataSource.prototype.onData.call(this,a),2==this._points.size()&&this._requestStudy()):"data_update"===a.method&&a.params.customId===this._studyId&&this._checkTurnaround(a.params.turnaround)&&(a.params.nonseries.d=""!==a.params.nonseries.d?JSON.parse(a.params.nonseries.d):"",""!==a.params.nonseries.d&&(this._graphics.process(a.params.nonseries),this._correctPoints(this._graphics.graphics())),
0<a.params.nonseries.indexes.length&&(this._indexes=a.params.nonseries.indexes),this.updateAllViews(),this._model.updateSource(this))};TradingView.LineToolVbPFixed.prototype._correctPoints=function(a){if(a&&(void 0==a.indexes||0!=a.indexes.length)){a=a.hhists["0"].data;for(var b=null,c=null,d=0;d<a.length;++d){var e=a[d].priceLow,f=a[d].priceHigh;if(!b||e<b)b=e;if(!c||f>c)c=f}this._points.item(0).price=c;this._points.item(1).price=b}};
TradingView.LineToolVbPFixed.prototype.calcIsActualSymbol=function(){this._isActualSymbol=!0};TradingView.LineToolVbPFixed.prototype.formatter=function(){return this._formatter};RiskRewardPaneView=function(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}};inherit(RiskRewardPaneView,LineSourcePaneView);RiskRewardPaneView.prototype._formatInTicks=function(a){var b=this._model.mainSeries().base();return Math.round(a*b)};RiskRewardPaneView.INDEX_ENTRY=0;RiskRewardPaneView.INDEX_CLOSE=1;RiskRewardPaneView.INDEX_ACTUALENTRY=2;RiskRewardPaneView.INDEX_ACTUALCLOSE=3;
RiskRewardPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._profitLevel=this._stopLevel=null;var a=this._model.timeScale(),b=this._source.priceScale();if(b&&!b.isEmpty()&&!a.isEmpty()&&0!=this._source.points().size()&&0!=this._points.size()&&this._model.mainSeries().bars().last()&&!(2>this._source.points().size())&&0!=this._model.mainSeries().bars().size()){if(this._isClosed=4==this._source.points().size()){a=this._source.points().item(RiskRewardPaneView.INDEX_ACTUALCLOSE).price;
if(this._source.points().item(RiskRewardPaneView.INDEX_ACTUALCLOSE).index<parseInt(this._source._model.mainSeries().bars().first()))return;var c=Math.min(parseInt(this._source._model.mainSeries().bars().last()),this._source.points().item(RiskRewardPaneView.INDEX_ACTUALCLOSE).index)}else{if(this._source.points().item(RiskRewardPaneView.INDEX_CLOSE).index<parseInt(this._source._model.mainSeries().bars().first()))return;c=Math.min(parseInt(this._source._model.mainSeries().bars().last()),this._source.points().item(RiskRewardPaneView.INDEX_CLOSE).index);
a=this._model.mainSeries().bars().valueAt(c)[CLOSE_PLOT]}this._closeBar=this._source._model.timeScale().indexToCoordinate(c);var d=this._source.priceScale(),e=this._source.stopPrice(),f=this._source.profitPrice();this._pl=1<this._source.points().size()?this._source.calculatePL(a):0;if(d.isPercent())var g=this._source.ownerSource().firstValue(),e=d.priceRange().convertToPercent(e,g),f=d.priceRange().convertToPercent(f,g),a=d.priceRange().convertToPercent(a,g);this._entryLevel=this._points.item(RiskRewardPaneView.INDEX_ENTRY).y;
this._stopLevel=b.priceToCoordinate(e);this._profitLevel=b.priceToCoordinate(f);this._closeLevel=b.priceToCoordinate(a);this._closeBar=this._source._model.timeScale().indexToCoordinate(c)}};
RiskRewardPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size()||2>this._source.points().size())return a;var b=this,c=this._source.properties();this._model.timeScale();var d=this._points.item(RiskRewardPaneView.INDEX_ENTRY).x,e=this._points.item(RiskRewardPaneView.INDEX_ACTUALENTRY)?this._points.item(RiskRewardPaneView.INDEX_ACTUALENTRY).x:this._points.item(RiskRewardPaneView.INDEX_CLOSE).x,f=this._points.item(RiskRewardPaneView.INDEX_ACTUALCLOSE)?this._points.item(RiskRewardPaneView.INDEX_ACTUALCLOSE).x:
this._points.item(RiskRewardPaneView.INDEX_CLOSE).x,g=this._points.item(RiskRewardPaneView.INDEX_CLOSE).x,h=new MathEx.Point(d,this._entryLevel),k=new MathEx.Point(g,this._stopLevel),m={};m.points=(new List).append(h).append(k);m.color="white";m.linewidth=0;m.backcolor=c.stopBackground.value();m.fillBackground=!0;m.transparency=c.stopBackgroundTransparency.value();a.append(new RectangleRenderer(m));if(0>this._pl){h=new MathEx.Point(e,this._entryLevel);k=new MathEx.Point(f,this._closeLevel);m={};m.points=
(new List).append(h).append(k);m.color="white";m.linewidth=0;m.backcolor=c.stopBackground.value();m.fillBackground=!0;var n=0.01*c.stopBackgroundTransparency.value();m.transparency=100-100*(1-n*n*n);a.append(new RectangleRenderer(m))}h=new MathEx.Point(d,this._entryLevel);k=new MathEx.Point(g,this._profitLevel);m={};m.points=(new List).append(h).append(k);m.color="white";m.linewidth=0;m.backcolor=c.profitBackground.value();m.fillBackground=!0;m.transparency=c.profitBackgroundTransparency.value();
a.append(new RectangleRenderer(m));0<this._pl&&(h=new MathEx.Point(e,this._entryLevel),k=new MathEx.Point(f,this._closeLevel),m={},m.points=(new List).append(h).append(k),m.color="white",m.linewidth=0,m.backcolor=c.profitBackground.value(),m.fillBackground=!0,n=0.01*c.profitBackgroundTransparency.value(),m.transparency=100-100*(1-n*n*n),a.append(new RectangleRenderer(m)));e=function(c,d,e){var f={};f.points=(new List).append(c).append(d);f.width=b._model.timeScale().width();f.height=b._source.priceScale().height();
f.color=e?e:b._source.properties().linecolor.value();f.linewidth=b._source.properties().linewidth.value();f.linestyle=CanvasEx.LINESTYLE_SOLID;f.extendleft=!1;f.extendright=!1;f.leftend=LineDataSource.LINEEND_NORMAL;f.rightend=LineDataSource.LINEEND_NORMAL;a.append(new TrendLineRenderer(f))};this._points.item(RiskRewardPaneView.INDEX_ACTUALENTRY)&&(h=this._points.item(RiskRewardPaneView.INDEX_ACTUALENTRY),k=this._isClosed?this._points.item(RiskRewardPaneView.INDEX_ACTUALCLOSE):new MathEx.Point(this._closeBar,
this._closeLevel),m={},m.points=(new List).append(h).append(k),m.width=b._model.timeScale().width(),m.height=b._source.priceScale().height(),m.color=b._source.properties().linecolor.value(),m.linewidth=1,m.linestyle=CanvasEx.LINESTYLE_DASHED,m.extendleft=!1,m.extendright=!1,m.leftend=LineDataSource.LINEEND_NORMAL,m.rightend=LineDataSource.LINEEND_ARROW,a.append(new TrendLineRenderer(m)));var b=this,m=function(d,e,f,g,h,k){if(b.isAnchorsRequired()||TradingView.printing){var l={};l.points=(new List).append(d);
l.text=e;l.color=c.textcolor.value();l.font=c.font.value();l.offsetX=3;l.offsetY=h;l.vertAlign=g;l.horzAlign="center";l.backgroundRoundRect=4;l.backgroundColor=f;l.fontsize=c.fontsize.value();l.backgroundHorzInflate=4;l.backgroundVertInflate=2;k&&(l.borderColor=k);a.append(new TextRenderer(l,b._rendererCache))}},f=this._source.entryPrice(),n=this._source.stopPrice(),h=this._source.profitPrice(),q=Math.abs(n-f),l=Math.round(1E4*q/f)/100,s=Math.abs(h-f),u=Math.round(1E4*s/f)/100,z=Math.abs(f-h)/Math.abs(f-
n),h=new MathEx.Point(d,this._points.item(RiskRewardPaneView.INDEX_ENTRY).y),k=new MathEx.Point(g,this._points.item(RiskRewardPaneView.INDEX_ENTRY).y);e(h,k);h=new MathEx.Point((d+g)/2,Math.round(this._points.item(0).y)+0.5);k="";this._points.item(1)&&void 0!==this._pl&&(k=this._isClosed?" "+$.t("Closed",{context:"line_tool_position"}):$.t("Open",{context:"line_tool_position"}),k=$.t("{0} P&L: {1}").format(k,this._source.priceScale().formatter().format(this._pl))+"\n");k+=$.t("Risk/Reward Ratio: {0}").format(Math.round(100*
z)/100)+" ";z=c.linecolor.value();0>this._pl?z=c.stopBackground.value():0<this._pl&&(z=c.profitBackground.value());m(h,k,z,"middle",0,"white");h=new MathEx.Point(d,this._stopLevel);k=new MathEx.Point(g,this._stopLevel);e(h,k,c.stopBackground.value());h=new MathEx.Point((d+g)/2,this._stopLevel);k=$.t("Stop: {0} ({1}%)").format(this._source.priceScale().formatter().format(q),l);m(h,k,c.stopBackground.value(),f<n?"bottom":"top",f<n?-12:-1);h=new MathEx.Point(d,this._profitLevel);k=new MathEx.Point(g,
this._profitLevel);e(h,k,c.profitBackground.value());h=new MathEx.Point((d+g)/2,this._profitLevel);k=$.t("Target: {0} ({1}%)").format(this._source.priceScale().formatter().format(s),u);m(h,k,c.profitBackground.value(),f<n?"top":"bottom",f<n?-1:-12);this.isAnchorsRequired()&&(e=new List,m=this._points.item(0).clone(),m.data=0,e.append(m),f=new MathEx.Point(d,this._stopLevel),f.data=1,e.append(f),d=new MathEx.Point(d,this._profitLevel),d.data=2,e.append(d),g=new MathEx.Point(g,m.y),g.data=3,e.append(g),
a.append(this.createLineAnchor({points:e})));return a};function LineToolRiskRewardPriceAxisView(a,b,c,d){this._source=a;this._model=b;this._text="";this._coordinate=0;this._background="black";this._textHeight=14;this._pricePropName=c;this._colorPropName=d}inherit(LineToolRiskRewardPriceAxisView,PriceAxisView);
LineToolRiskRewardPriceAxisView.prototype.update=function(){if(0!==this._source.points().size()&&this._source.priceScale()&&!this._source.priceScale().isEmpty()){var a=this._source.properties()[this._pricePropName].value();this._background=this._source.properties()[this._colorPropName].value();this._coordinate=this._source.priceScale().priceToCoordinate(a);this._textHeight=this._source.priceScale().m_markBuilder.fontHeight();this._text=this._source.priceScale().formatter().format(a)}};
LineToolRiskRewardPriceAxisView.prototype.renderer=function(){var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:!0};return new PriceAxisViewRenderer(a)};
TradingView.LineToolRiskReward=function(a,b){var c=b?b:new DefaultProperty("linetoolriskreward");LineDataSource.call(this,a,new RiskRewardPaneView(this,a),c);this._properties.addExclusion&&(this._properties.addExclusion("stopLevel"),this._properties.addExclusion("profitLevel"));if(!b.stopLevel&&!b.profitLevel){var d=a.timeScale().visibleBars(),e=d.firstBar(),d=d.lastBar(),f=a.mainSeries().priceRange(e,d),e=a.mainSeries().priceScale();e.isLog()&&(d=e.logicalToPrice(f.minValue()),f=e.logicalToPrice(f.maxValue()),
f=new PriceRange(d,f));if(e.isPercent())var g=a.mainSeries().firstValue(),d=e.priceRange().convertFromPercent(f.minValue(),g),f=e.priceRange().convertFromPercent(f.maxValue(),g),f=new PriceRange(d,f);f&&!f.isEmpty()&&(e=Math.round(0.2*f.length()*a.mainSeries().base()),c.merge({stopLevel:e,profitLevel:e}))}var h=this;c.stopLevel.listeners().subscribe(this,TradingView.LineToolRiskReward.prototype.recalculate);c.stopLevel.listeners().subscribe(null,function(){h.properties().stopPrice._listeners.fire(h.properties().stopPrice)});
c.profitLevel.listeners().subscribe(this,TradingView.LineToolRiskReward.prototype.recalculate);c.profitLevel.listeners().subscribe(null,function(){h.properties().targetPrice._listeners.fire(h.properties().targetPrice)});c.addProperty("entryPrice");c.entryPrice=new TradingView.LineToolRiskReward.PriceProperty(this,0);c.addProperty("stopPrice");c.stopPrice=new TradingView.LineToolRiskReward.StopPriceProperty(this);c.addProperty("targetPrice");c.targetPrice=new TradingView.LineToolRiskReward.TargetPriceProperty(this);
this._entryPriceAxisView=new LineToolRiskRewardPriceAxisView(this,a,"entryPrice","linecolor");this._stopPriceAxisView=new LineToolRiskRewardPriceAxisView(this,a,"stopPrice","stopBackground");this._profitPriceAxisView=new LineToolRiskRewardPriceAxisView(this,a,"targetPrice","profitBackground");this.version=TradingView.LineToolRiskReward.version};inherit(TradingView.LineToolRiskReward,LineDataSource);TradingView.LineToolRiskReward.version=2;
TradingView.LineToolRiskReward.prototype.migrateVersion=function(a,b,c){1==a&&1<=this._points.size()&&(a=new List,a.append(this._points.item(0)),b=this._points.item(0),b={price:b.price,index:b.index+50},a.append(b),this._points.item(1)&&a.append(this._points.item(1)),this._points.item(2)&&a.append(this._points.item(2)),this._points=a,1<=this._timePoint.size()&&(c=new List,b=this._timePoint.item(0),c.append(b),c.append({price:b.price,time_t:b.time_t,offset:b.offset+50}),this._timePoint.item(1)&&a.append(this._points.item(1)),
this._timePoint.item(2)&&a.append(this._points.item(2)),this._timePoint=c))};TradingView.LineToolRiskReward.prototype.checkAlert=function(){this.recalculate()};TradingView.LineToolRiskReward.prototype.priceAxisViews=function(a,b){return this._isActualSymbol?this._model.paneForSource(this)===a&&b===this.priceScale()?(new List).append(this._entryPriceAxisView).append(this._stopPriceAxisView).append(this._profitPriceAxisView):null:null};
TradingView.LineToolRiskReward.prototype.updateAllViews=function(){!this._isActualSymbol||!this._properties.visible.value()||TradingView.drawingState.hideAllDrawings().value()&&this.userEditEnabled()||(LineDataSource.prototype.updateAllViews.call(this),this._entryPriceAxisView.update(),this._stopPriceAxisView.update(),this._profitPriceAxisView.update())};
TradingView.LineToolRiskReward.prototype.setPoint=function(a,b){var c=this.priceScale();if(c.isPercent()){var d=this.ownerSource().firstValue();b.price=c.priceRange().convertFromPercent(b.price,d)}switch(a){case 0:b.price=this._roundPrice(b.price);c.isPercent()&&(b.price=c.priceRange().convertToPercent(b.price,d));LineDataSource.prototype.setPoint.call(this,a,b);this.recalculate();break;case 1:this.properties().stopPrice.setValue(this.preparseStopPrice(b.price));break;case 2:this.properties().targetPrice.setValue(this.preparseProfitPrice(b.price));
break;case 3:b.price=this._roundPrice(b.price),c.isPercent()&&(b.price=c.priceRange().convertToPercent(b.price,d)),LineDataSource.prototype.setPoint.call(this,1,b),this.recalculate()}};TradingView.LineToolRiskReward.PriceProperty=function(a,b){LineDataSource.PointPriceProperty.call(this,a,b)};inherit(TradingView.LineToolRiskReward.PriceProperty,LineDataSource.PointPriceProperty);
TradingView.LineToolRiskReward.PriceProperty.prototype.setValue=function(a){var b=this._lineSource.points().item(this._pointIndex);b.price=parseFloat(a);this._lineSource.setPoint(this._pointIndex,b);this._lineSource.recalculate();this._lineSource._model.updateSource(this._lineSource);this._listeners.fire(this);this._lineSource.endChanging()};TradingView.LineToolRiskReward.StopPriceProperty=function(a){TradingView.LineToolRiskReward.PriceProperty.call(this,a,1)};
inherit(TradingView.LineToolRiskReward.StopPriceProperty,TradingView.LineToolRiskReward.PriceProperty);TradingView.LineToolRiskReward.StopPriceProperty.prototype.value=function(){var a=this._lineSource.stopPrice();return parseFloat(this._lineSource.priceScale().formatter().format(a))};
TradingView.LineToolRiskReward.StopPriceProperty.prototype.setValue=function(a){a=Math.round(Math.abs(a-this._lineSource.entryPrice())*this._lineSource._model.mainSeries().base());this._lineSource.properties().stopLevel.setValue(a);this._lineSource.properties().stopLevel.listeners().fire(this._lineSource.properties().stopLevel)};TradingView.LineToolRiskReward.TargetPriceProperty=function(a){TradingView.LineToolRiskReward.PriceProperty.call(this,a,2)};
inherit(TradingView.LineToolRiskReward.TargetPriceProperty,TradingView.LineToolRiskReward.PriceProperty);TradingView.LineToolRiskReward.TargetPriceProperty.prototype.value=function(){var a=this._lineSource.profitPrice();return parseFloat(this._lineSource.priceScale().formatter().format(a))};
TradingView.LineToolRiskReward.TargetPriceProperty.prototype.setValue=function(a){a=Math.round(Math.abs(a-this._lineSource.entryPrice())*this._lineSource._model.mainSeries().base());this._lineSource.properties().profitLevel.setValue(a);this._lineSource.properties().profitLevel.listeners().fire(this._lineSource.properties().profitLevel)};TradingView.LineToolRiskReward.prototype.pointsCount=function(){return 1};TradingView.LineToolRiskReward.prototype.title=function(){return"Risk/Reward"};
TradingView.LineToolRiskReward.prototype.addPoint=function(a){var b=this.priceScale();if(b.isPercent()){var c=this.ownerSource().firstValue();a.price=b.priceRange().convertFromPercent(a.price,c)}a.price=this._roundPrice(a.price);this._points.append(a);b={price:a.price,index:a.index+50};this._points.append(b);if(a=this.calculateActualEntry(a,b))this._points.append(a),(b=this.findClosePoint(a,b))&&this._points.append(b);this._lastPoint=null;this.normalizePoints();this.createServerPoints();return!0};
TradingView.LineToolRiskReward.prototype._roundPrice=function(a){var b=this._model.mainSeries().base();return Math.round(a*b)/b};
TradingView.LineToolRiskReward.prototype.recalculate=function(){if(this.properties().interval.value()==this._model.mainSeries().interval()&&0!=this.points().size()){var a=this.properties().targetPrice.value(),b=this.properties().stopPrice.value(),c=new List;c.append(this._points.item(0));c.append(this._points.item(1));var d=this.calculateActualEntry(this.points().item(0),this.points().item(1));d&&(c.append(d),(d=this.findClosePoint(d,this.points().item(1)))&&c.append(d));this._points=c;a!==this.properties().targetPrice.value()&&
this.properties().targetPrice._listeners.fire(this.properties().targetPrice);b!==this.properties().stopPrice.value()&&this.properties().stopPrice._listeners.fire(this.properties().stopPrice)}};TradingView.LineToolRiskReward.prototype.startMoving=function(a){a.price=this._roundPrice(a.price);LineDataSource.prototype.startMoving.call(this,a)};TradingView.LineToolRiskReward.prototype.move=function(a){a.price=this._roundPrice(a.price);LineDataSource.prototype.move.call(this,a);this.recalculate();this._entryPriceAxisView.update()};
TradingView.LineToolRiskReward.prototype.correctPoints=function(a){LineDataSource.prototype.correctPoints.call(this,(new List).append(a.item(0)).append(a.item(1)))};TradingView.LineToolRiskReward.prototype.entryPrice=function(){return this.points().item(0).price};
TradingView.LineToolRiskReward.prototype.findClosePoint=function(a,b){for(var c=this._model.mainSeries().bars(),d=parseInt(c.first(),10),e=Math.max(a.index,d),d=parseInt(c.last(),10);e<=Math.min(d,b.index);e++){var f=c.valueAt(e),f=this.checkStopPrice(f);if(null!=f)return{index:e,price:f}}return null};
TradingView.LineToolRiskReward.prototype.calculateActualEntry=function(a,b){for(var c=this._model.mainSeries().bars(),d=parseInt(c.first(),10),e=Math.max(a.index,d),d=a.price,f=parseInt(c.last(),10);e<=Math.min(f,b.index);e++){var g=c.valueAt(e);if(g[HIGH_PLOT]>=d&&g[LOW_PLOT]<=d)return{index:e,price:d}}return null};
TradingView.LineToolRiskRewardShort=function(a,b){this._constructor="LineToolRiskRewardShort";var c=b?b:new DefaultProperty("linetoolriskrewardshort");TradingView.LineToolRiskReward.call(this,a,c)};inherit(TradingView.LineToolRiskRewardShort,TradingView.LineToolRiskReward);TradingView.LineToolRiskRewardShort.prototype.title=function(){return"Risk/Reward short"};TradingView.LineToolRiskRewardShort.prototype.stopPrice=function(){return this.entryPrice()+this.properties().stopLevel.value()/this._model.mainSeries().base()};
TradingView.LineToolRiskRewardShort.prototype.profitPrice=function(){return this.entryPrice()-this.properties().profitLevel.value()/this._model.mainSeries().base()};TradingView.LineToolRiskRewardShort.prototype.calculatePL=function(a){return this.entryPrice()-a};TradingView.LineToolRiskRewardShort.prototype.preparseStopPrice=function(a){a=this._roundPrice(a);var b=this.entryPrice()+1/this._model.mainSeries().base();return Math.max(a,b)};
TradingView.LineToolRiskRewardShort.prototype.preparseProfitPrice=function(a){a=this._roundPrice(a);var b=this.entryPrice()-1/this._model.mainSeries().base();return Math.min(a,b)};TradingView.LineToolRiskRewardShort.prototype.checkStopPrice=function(a){var b=this.stopPrice(),c=this.profitPrice();return a[HIGH_PLOT]>=b?this.stopPrice():a[LOW_PLOT]<=c?this.profitPrice():null};
TradingView.LineToolRiskRewardLong=function(a,b){this._constructor="LineToolRiskRewardLong";var c=b?b:new DefaultProperty("linetoolriskrewardlong");TradingView.LineToolRiskReward.call(this,a,c)};inherit(TradingView.LineToolRiskRewardLong,TradingView.LineToolRiskReward);TradingView.LineToolRiskRewardLong.prototype.stopPrice=function(){return this.entryPrice()-this.properties().stopLevel.value()/this._model.mainSeries().base()};
TradingView.LineToolRiskRewardLong.prototype.profitPrice=function(){return this.entryPrice()+this.properties().profitLevel.value()/this._model.mainSeries().base()};TradingView.LineToolRiskRewardLong.prototype.calculatePL=function(a){return a-this.entryPrice()};TradingView.LineToolRiskRewardLong.prototype.preparseStopPrice=function(a){a=this._roundPrice(a);var b=this.entryPrice()-1/this._model.mainSeries().base();return Math.min(a,b)};
TradingView.LineToolRiskRewardLong.prototype.preparseProfitPrice=function(a){a=this._roundPrice(a);var b=this.entryPrice()+1/this._model.mainSeries().base();return Math.max(a,b)};TradingView.LineToolRiskRewardLong.prototype.checkStopPrice=function(a){var b=this.stopPrice(),c=this.profitPrice();return a[LOW_PLOT]<=b?this.stopPrice():a[HIGH_PLOT]>=c?this.profitPrice():null};TradingView.LineToolRiskRewardLong.prototype.title=function(){return"Risk/Reward long"};function Pattern5PaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(Pattern5PaneView,LineSourcePaneView);
Pattern5PaneView.prototype.renderer=function(){if(2>this._points.size())return null;var a=this._source.properties(),b=new CompositeRenderer,c=new List;c.append(this._points.item(0));c.append(this._points.item(1));c.append(3>this._points.size()?this._points.item(1):this._points.item(2));var d=this,e=function(b,c){return{points:(new List).append(b),text:c,color:a.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:a.font.value(),offsetX:0,offsetY:0,bold:a.bold&&a.bold.value(),italic:a.italic&&
a.italic.value(),fontsize:a.fontsize.value(),backgroundColor:d._source.properties().color.value(),backgroundRoundRect:4}},f=function(a,b){return{points:(new List).append(a).append(b),width:d._model.timeScale().width(),height:d._source.priceScale().height(),color:d._source.properties().color.value(),linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL}},g={};g.points=c;g.color=a.color.value();g.linewidth=
a.linewidth.value();g.backcolor=a.backgroundColor.value();g.fillBackground=a.fillBackground.value();g.transparency=a.transparency.value();b.append(new TriangleRenderer(g));3<this._points.size()&&(c=new List,c.append(this._points.item(2)),c.append(this._points.item(3)),c.append(5==this._points.size()?this._points.item(4):this._points.item(3)),g={},g.points=c,g.color=a.color.value(),g.linewidth=a.linewidth.value(),g.backcolor=a.backgroundColor.value(),g.fillBackground=a.fillBackground.value(),g.transparency=
a.transparency.value(),b.append(new TriangleRenderer(g)));3<=this._points.size()&&(c=this._points.item(0).add(this._points.item(2)).scaled(0.5),c=e(c,this._ABRetracement),b.append(new TextRenderer(c,this._rendererCache)));4<=this._points.size()&&(c=this._points.item(1).add(this._points.item(3)).scaled(0.5),g=f(this._points.item(1),this._points.item(3)),b.append(new TrendLineRenderer(g)),c=e(c,this._BCRetracement),b.append(new TextRenderer(c,this._rendererCache)));5<=this._points.size()&&(c=this._points.item(2).add(this._points.item(4)).scaled(0.5),
c=e(c,this._CDRetracement),b.append(new TextRenderer(c,this._rendererCache)),g=f(this._points.item(0),this._points.item(4)),b.append(new TrendLineRenderer(g)),c=this._points.item(0).add(this._points.item(4)).scaled(0.5),c=e(c,this._XDRetracement),b.append(new TextRenderer(c,this._rendererCache)));c=e(this._points.item(0),"X");this._points.item(1).y>this._points.item(0).y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5);b.append(new TextRenderer(c,this._rendererCache));c=e(this._points.item(1),
"A");this._points.item(1).y<this._points.item(0).y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5);b.append(new TextRenderer(c,this._rendererCache));2<this._points.size()&&(c=e(this._points.item(2),"B"),this._points.item(2).y<this._points.item(1).y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),b.append(new TextRenderer(c,this._rendererCache)));3<this._points.size()&&(c=e(this._points.item(3),"C"),this._points.item(3).y<this._points.item(2).y?(c.vertAlign=
"bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),b.append(new TextRenderer(c,this._rendererCache)));4<this._points.size()&&(c=e(this._points.item(4),"D"),this._points.item(4).y<this._points.item(3).y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),b.append(new TextRenderer(c,this._rendererCache)));this.isAnchorsRequired()&&(c=this._points.clone(),this._model.lineBeingCreated()==this._source&&c.removeAt(c.size()-1),b.append(this.createLineAnchor({points:c})));return b};
Pattern5PaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(3<=this._source.points().size()){var a=this._source.points().item(0),b=this._source.points().item(1),c=this._source.points().item(2);this._ABRetracement=Math.round(1E3*Math.abs((c.price-b.price)/(b.price-a.price)))/1E3}if(4<=this._source.points().size()){var d=this._source.points().item(3);this._BCRetracement=Math.round(1E3*Math.abs((d.price-c.price)/(c.price-b.price)))/1E3}if(5<=this._source.points().size()){var e=
this._source.points().item(4);this._CDRetracement=Math.round(1E3*Math.abs((e.price-d.price)/(d.price-c.price)))/1E3;this._XDRetracement=Math.round(1E3*Math.abs((e.price-b.price)/(b.price-a.price)))/1E3}};TradingView.LineTool5PointsPattern=function(a,b){this._constructor="LineTool5PointsPattern";var c=b?b:new DefaultProperty("linetool5pointspattern");LineDataSource.call(this,a,new Pattern5PaneView(this,a),c)};inherit(TradingView.LineTool5PointsPattern,LineDataSource);
TradingView.LineTool5PointsPattern.prototype.pointsCount=function(){return 5};TradingView.LineTool5PointsPattern.prototype.title=function(){return"XABCD Pattern"};
TradingView.LineTool5PointsPattern.prototype._tooltipFieldsHash={time0:{title:"Date 1",value:null},price0:{title:"Price 1",value:null},time1:{title:"Date 2",value:null},price1:{title:"Price 2",value:null},time2:{title:"Date 3",value:null},price2:{title:"Price 3",value:null},time3:{title:"Date 4",value:null},price3:{title:"Price 4",value:null},time4:{title:"Date 5",value:null},price4:{title:"Price 5",value:null}};
TradingView.LineTool5PointsPattern.prototype._updateTooltip=function(){var a=this._tooltipFieldsHash,b=this.points().m_values;if(b[0]){var c=this._model.timeScale().indexToUserTime(b[0].index);a.time0.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0;a.price0.value=this._model.mainSeries()._formatter.format(b[0].price)}if(b[1]){var d=this._model.timeScale().indexToUserTime(b[1].index);a.time1.value=d?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(d):0;
a.price1.value=this._model.mainSeries()._formatter.format(b[1].price)}b[2]&&(c=this._model.timeScale().indexToUserTime(b[2].index),a.time2.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0,a.price2.value=this._model.mainSeries()._formatter.format(b[2].price));b[3]&&(c=this._model.timeScale().indexToUserTime(b[3].index),a.time3.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0,a.price3.value=this._model.mainSeries()._formatter.format(b[3].price));
b[4]&&(c=this._model.timeScale().indexToUserTime(b[4].index),a.time4.value=d?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0,a.price4.value=this._model.mainSeries()._formatter.format(b[4].price))};TradingView.LineTool5PointsPattern.prototype.tooltip=function(){this._updateTooltip();return this._formatTooltip()};function LineToolABCDPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(LineToolABCDPaneView,LineSourcePaneView);
LineToolABCDPaneView.prototype.renderer=function(){if(2>this._points.size())return null;var a=this._source.properties(),b=new CompositeRenderer,c=this._points,d=this,e=function(b,c){return{points:(new List).append(b),text:c,color:a.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:a.font.value(),offsetX:0,offsetY:0,bold:a.bold&&a.bold.value(),italic:a.italic&&a.italic.value(),fontsize:a.fontsize.value(),backgroundColor:d._source.properties().color.value(),backgroundRoundRect:4}},f=function(b,
c,e,f){return{points:(new List).append(b).append(c),width:d._model.timeScale().width(),height:d._source.priceScale().height(),color:generateColor(d._source.properties().color.value(),e),linewidth:f?f:a.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL}},g=f(c.item(0),c.item(1),0);b.append(new TrendLineRenderer(g));3<=c.size()&&(g=f(c.item(1),c.item(2),0),b.append(new TrendLineRenderer(g)));
4==c.size()&&(g=f(c.item(2),c.item(3),0),b.append(new TrendLineRenderer(g)));g=e(this._points.item(0),"A");this._points.item(1).y>this._points.item(0).y?(g.vertAlign="bottom",g.offsetY=-10):(g.vertAlign="top",g.offsetY=5);b.append(new TextRenderer(g,this._rendererCache));g=e(this._points.item(1),"B");this._points.item(1).y<this._points.item(0).y?(g.vertAlign="bottom",g.offsetY=-10):(g.vertAlign="top",g.offsetY=5);b.append(new TextRenderer(g,this._rendererCache));2<this._points.size()&&(g=e(this._points.item(2),
"C"),this._points.item(2).y<this._points.item(1).y?(g.vertAlign="bottom",g.offsetY=-10):(g.vertAlign="top",g.offsetY=5),b.append(new TextRenderer(g,this._rendererCache)));3<this._points.size()&&(g=e(this._points.item(3),"D"),this._points.item(3).y<this._points.item(2).y?(g.vertAlign="bottom",g.offsetY=-10):(g.vertAlign="top",g.offsetY=5),b.append(new TextRenderer(g,this._rendererCache)));3<=this._points.size()&&(c=this._points.item(0).add(this._points.item(2)).scaled(0.5),g=f(this._points.item(0),
this._points.item(2),70,1),b.append(new TrendLineRenderer(g)),g=e(c,this._ABRetracement),b.append(new TextRenderer(g,this._rendererCache)));4<=this._points.size()&&(c=this._points.item(1).add(this._points.item(3)).scaled(0.5),g=f(this._points.item(1),this._points.item(3),70,1),b.append(new TrendLineRenderer(g)),g=e(c,this._CDRetracement),b.append(new TextRenderer(g,this._rendererCache)));this.isAnchorsRequired()&&(c=this._points.clone(),this._model.lineBeingCreated()==this._source&&c.removeAt(c.size()-
1),b.append(this.createLineAnchor({points:c})));return b};
LineToolABCDPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(3<=this._source.points().size()){var a=this._source.points().item(0),b=this._source.points().item(1),c=this._source.points().item(2);this._ABRetracement=Math.round(1E3*Math.abs((c.price-b.price)/(b.price-a.price)))/1E3}4==this._source.points().size()&&(a=this._source.points().item(3),this._CDRetracement=Math.round(1E3*Math.abs((a.price-c.price)/(c.price-b.price)))/1E3)};
TradingView.LineToolABCD=function(a,b){this._constructor="LineToolABCD";var c=b?b:new DefaultProperty("linetoolabcd");LineDataSource.call(this,a,new LineToolABCDPaneView(this,a),c)};inherit(TradingView.LineToolABCD,LineDataSource);TradingView.LineToolABCD.prototype.pointsCount=function(){return 4};TradingView.LineToolABCD.prototype.title=function(){return"ABCD Pattern"};
TradingView.LineToolABCD.prototype._tooltipFieldsHash={time0:{title:"Date 1",value:null},price0:{title:"Price 1",value:null},time1:{title:"Date 2",value:null},price1:{title:"Price 2",value:null},time2:{title:"Date 3",value:null},price2:{title:"Price 3",value:null},time3:{title:"Date 4",value:null},price3:{title:"Price 4",value:null}};
TradingView.LineToolABCD.prototype._updateTooltip=function(){var a=this._tooltipFieldsHash,b=this.points().m_values;if(b[0]){var c=this._model.timeScale().indexToUserTime(b[0].index);a.time0.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0;a.price0.value=this._model.mainSeries()._formatter.format(b[0].price)}b[1]&&(c=this._model.timeScale().indexToUserTime(b[1].index),a.time1.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0,a.price1.value=
this._model.mainSeries()._formatter.format(b[1].price));b[2]&&(c=this._model.timeScale().indexToUserTime(b[2].index),a.time2.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0,a.price2.value=this._model.mainSeries()._formatter.format(b[2].price));b[3]&&(c=this._model.timeScale().indexToUserTime(b[3].index),a.time3.value=c?(new DateTimeFormatter(this._model.mainSeries().isDWM())).format(c):0,a.price3.value=this._model.mainSeries()._formatter.format(b[3].price))};
TradingView.LineToolABCD.prototype.tooltip=function(){this._updateTooltip();return this._formatTooltip()};function LineToolTrianglePatternPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(LineToolTrianglePatternPaneView,LineSourcePaneView);
LineToolTrianglePatternPaneView.prototype.renderer=function(){if(2>this._points.size())return null;var a=this._source.properties(),b=new CompositeRenderer,c=this,d=function(b,d){return{points:(new List).append(b),text:d,color:a.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:a.font.value(),offsetX:0,offsetY:0,bold:a.bold&&a.bold.value(),italic:a.italic&&a.italic.value(),fontsize:a.fontsize.value(),backgroundColor:c._source.properties().color.value(),backgroundRoundRect:4}},e=function(b,
d){return{points:(new List).append(b).append(d),width:c._model.timeScale().width(),height:c._source.priceScale().height(),color:c._source.properties().color.value(),linewidth:a.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL}},f=e(this._points.item(0),this._points.item(1));b.append(new TrendLineRenderer(f));3<=this._points.size()&&(f=e(this._points.item(1),this._points.item(2)),b.append(new TrendLineRenderer(f)));
4==this._points.size()&&(f=e(this._points.item(2),this._points.item(3)),b.append(new TrendLineRenderer(f)),this._intersectPoint?(e=new List,e.append(this._startPoint1),e.append(this._startPoint2),e.append(this._intersectPoint),f={},f.points=e,f.color=a.color.value(),f.linewidth=a.linewidth.value(),f.backcolor=a.backgroundColor.value(),f.fillBackground=a.fillBackground.value(),f.transparency=a.transparency.value(),b.append(new TriangleRenderer(f))):this._intersectPoint1&&this._intersectPoint2&&(e=
new List,e.append(this._startPoint1),e.append(this._startPoint2),e.append(this._intersectPoint2),e.append(this._intersectPoint1),f={filled:!0,fillBackground:!0},f.points=e,f.color=a.color.value(),f.linewidth=a.linewidth.value(),f.backcolor=a.backgroundColor.value(),f.transparency=a.transparency.value(),b.append(new PoligonRenderer(f))));e=d(this._points.item(0),"A");this._points.item(1).y>this._points.item(0).y?(e.vertAlign="bottom",e.offsetY=-10):(e.vertAlign="top",e.offsetY=5);b.append(new TextRenderer(e,
this._rendererCache));e=d(this._points.item(1),"B");this._points.item(1).y<this._points.item(0).y?(e.vertAlign="bottom",e.offsetY=-10):(e.vertAlign="top",e.offsetY=5);b.append(new TextRenderer(e,this._rendererCache));2<this._points.size()&&(e=d(this._points.item(2),"C"),this._points.item(2).y<this._points.item(1).y?(e.vertAlign="bottom",e.offsetY=-10):(e.vertAlign="top",e.offsetY=5),b.append(new TextRenderer(e,this._rendererCache)));3<this._points.size()&&(e=d(this._points.item(3),"D"),this._points.item(3).y<
this._points.item(2).y?(e.vertAlign="bottom",e.offsetY=-10):(e.vertAlign="top",e.offsetY=5),b.append(new TextRenderer(e,this._rendererCache)));this.isAnchorsRequired()&&(e=this._points.clone(),this._model.lineBeingCreated()==this._source&&e.removeAt(e.size()-1),b.append(this.createLineAnchor({points:e})));return b};
LineToolTrianglePatternPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._valid=!1;if(4==this._points.size()){var a=this._points.item(0),b=this._points.item(1),c=this._points.item(2),d=this._points.item(3);if(!(1>Math.abs(c.x-a.x)||1>Math.abs(d.x-b.x))){var e=Math.min(a.x,b.x),e=Math.min(e,c.x),e=Math.min(e,d.x),f=(c.y-a.y)/(c.x-a.x),g=a.y+(e-a.x)*f,h=(d.y-b.y)/(d.x-b.x),k=b.y+(e-b.x)*h;if(!(1E-6>Math.abs(f-h))){this._startPoint1=new MathEx.Point(e,g);this._startPoint2=
new MathEx.Point(e,k);var m=(b.y-a.y+(a.x*f-b.x*h))/(f-h);this._valid=!0;delete this._intersectPoint;delete this._intersectPoint1;delete this._intersectPoint2;m<e&&(e=Math.max(a.x,b.x),e=Math.max(e,c.x),e=Math.max(e,d.x),g=a.y+(e-a.x)*f,k=b.y+(e-b.x)*h,this._startPoint1=new MathEx.Point(e,g),this._startPoint2=new MathEx.Point(e,k));this._intersectPoint=new MathEx.Point(m,a.y+(m-a.x)*f)}}}};
TradingView.LineToolTrianglePattern=function(a,b){this._constructor="LineToolTrianglePattern";var c=b?b:new DefaultProperty("linetooltrianglepattern");LineDataSource.call(this,a,new LineToolTrianglePatternPaneView(this,a),c)};inherit(TradingView.LineToolTrianglePattern,LineDataSource);TradingView.LineToolTrianglePattern.prototype.pointsCount=function(){return 4};TradingView.LineToolTrianglePattern.prototype.title=function(){return"Triangle Pattern"};function LineToolThreeDriversPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(LineToolThreeDriversPaneView,LineSourcePaneView);
LineToolThreeDriversPaneView.prototype.renderer=function(){if(2>this._points.size())return null;for(var a=this._source.properties(),b=new CompositeRenderer,c=this,d=function(b,d){return{points:(new List).append(b),text:d,color:a.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:a.font.value(),offsetX:0,offsetY:0,bold:a.bold&&a.bold.value(),italic:a.italic&&a.italic.value(),fontsize:a.fontsize.value(),backgroundColor:c._source.properties().color.value(),backgroundRoundRect:4}},e=function(b,
d,e,f){return{points:(new List).append(b).append(d),width:c._model.timeScale().width(),height:c._source.priceScale().height(),color:generateColor(c._source.properties().color.value(),e),linewidth:f?f:a.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL}},f=1;f<this._points.size();f++){var g=e(this._points.item(f-1),this._points.item(f),0);b.append(new TrendLineRenderer(g))}this._retrace1&&(g=
e(this._points.item(1),this._points.item(3),70,1),b.append(new TrendLineRenderer(g)),f=this._points.item(1).add(this._points.item(3)).scaled(0.5),f=d(f,this._retrace1),b.append(new TextRenderer(f,this._rendererCache)));this._retrace2&&(g=e(this._points.item(3),this._points.item(5),70,1),b.append(new TrendLineRenderer(g)),f=this._points.item(5).add(this._points.item(3)).scaled(0.5),f=d(f,this._retrace2),b.append(new TextRenderer(f,this._rendererCache)));this.isAnchorsRequired()&&(d=this._points.clone(),
this._model.lineBeingCreated()==this._source&&d.removeAt(d.size()-1),b.append(this.createLineAnchor({points:d})));return b};
LineToolThreeDriversPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);delete this._retrace1;delete this._retrace2;if(4<=this._source.points().size()){var a=this._source.points().item(1),b=this._source.points().item(2),c=this._source.points().item(3);this._retrace1=Math.round(100*Math.abs((c.price-b.price)/(b.price-a.price)))/100}6<=this._source.points().size()&&(c=this._source.points().item(3),a=this._source.points().item(4),b=this._source.points().item(5),this._retrace2=
Math.round(100*Math.abs((b.price-a.price)/(a.price-c.price)))/100)};TradingView.LineToolThreeDrivers=function(a,b){this._constructor="LineToolThreeDrivers";var c=b?b:new DefaultProperty("linetoolthreedrivers");LineDataSource.call(this,a,new LineToolThreeDriversPaneView(this,a),c)};inherit(TradingView.LineToolThreeDrivers,LineDataSource);TradingView.LineToolThreeDrivers.prototype.pointsCount=function(){return 7};TradingView.LineToolThreeDrivers.prototype.title=function(){return"Three Drivers Pattern"};function LineToolHeadAndShouldersPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(LineToolHeadAndShouldersPaneView,LineSourcePaneView);
LineToolHeadAndShouldersPaneView.prototype.renderer=function(){if(2>this._points.size())return null;for(var a=this._source.properties(),b=new CompositeRenderer,c=this,d=function(b,d){return{points:(new List).append(b),text:$.t(d),color:a.textcolor.value(),horzAlign:"center",font:a.font.value(),offsetX:0,offsetY:0,bold:a.bold&&a.bold.value(),italic:a.italic&&a.italic.value(),fontsize:a.fontsize.value(),backgroundColor:c._source.properties().color.value(),backgroundRoundRect:4}},e=function(b,d,e,f){return{points:(new List).append(b).append(d),
width:c._model.timeScale().width(),height:c._source.priceScale().height(),color:generateColor(c._source.properties().color.value(),e),linewidth:f?f:a.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL}},f=function(b,c,d){var e=new List;e.append(b);e.append(c);e.append(d);b={};b.points=e;b.color=a.color.value();b.linewidth=0;b.backcolor=a.backgroundColor.value();b.fillBackground=a.fillBackground.value();
b.transparency=a.transparency.value();return b},g=1;g<this._points.size();g++){var h=e(this._points.item(g-1),this._points.item(g),0);b.append(new TrendLineRenderer(h))}if(5<=this._points.size()){var k,m=g=!1;this._intersect1?h=this._intersect1:(h=this._points.item(2),g=!0);this._intersect2?k=this._intersect2:(k=this._points.item(4),m=!0);h=e(h,k,0);h.extendleft=g;h.extendright=m;b.append(new TrendLineRenderer(h));e=f(this._points.item(2),this._points.item(3),this._points.item(4));b.append(new TriangleRenderer(e))}this._intersect1&&
(e=f(this._intersect1,this._points.item(1),this._points.item(2)),b.append(new TriangleRenderer(e)));this._intersect2&&(e=f(this._points.item(4),this._points.item(5),this._intersect2),b.append(new TriangleRenderer(e)));2<=this._points.size()&&(f=this._points.item(1),f=d(f,"Left Shoulder"),this._points.item(1).y<this._points.item(0).y?(f.vertAlign="bottom",f.offsetY=-10):(f.vertAlign="top",f.offsetY=5),b.append(new TextRenderer(f,this._rendererCache)));4<=this._points.size()&&(f=this._points.item(3),
f=d(f,"Head"),this._points.item(3).y<this._points.item(2).y?(f.vertAlign="bottom",f.offsetY=-10):(f.vertAlign="top",f.offsetY=5),b.append(new TextRenderer(f,this._rendererCache)));6<=this._points.size()&&(f=this._points.item(5),f=d(f,"Right Shoulder"),this._points.item(5).y<this._points.item(4).y?(f.vertAlign="bottom",f.offsetY=-10):(f.vertAlign="top",f.offsetY=5),b.append(new TextRenderer(f,this._rendererCache)));this.isAnchorsRequired()&&(d=this._points.clone(),this._model.lineBeingCreated()==this._source&&
d.removeAt(d.size()-1),b.append(this.createLineAnchor({points:d})));return b};
LineToolHeadAndShouldersPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);delete this._intersect1;delete this._intersect2;if(5<=this._points.size()){var a=this._points.item(0),b=this._points.item(1),c=this._points.item(2);this._points.item(3);var d=this._points.item(4),a=MathEx.intersectSegment(c,d,a,b);null!==a&&(b=d.substract(c),this._intersect1=c.add(b.scaled(a)))}7==this._points.size()&&(a=this._points.item(5),b=this._points.item(6),a=MathEx.intersectSegment(c,
d,a,b),null!==a&&(b=d.substract(c),this._intersect2=c.add(b.scaled(a))))};TradingView.LineToolHeadAndShoulders=function(a,b){this._constructor="LineToolHeadAndShoulders";var c=b?b:new DefaultProperty("linetoolheadandshoulders");LineDataSource.call(this,a,new LineToolHeadAndShouldersPaneView(this,a),c)};inherit(TradingView.LineToolHeadAndShoulders,LineDataSource);TradingView.LineToolHeadAndShoulders.prototype.pointsCount=function(){return 7};TradingView.LineToolHeadAndShoulders.prototype.title=function(){return"Head & Shoulders"};function TrendBasedFibTimePaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(TrendBasedFibTimePaneView,LineSourcePaneView);
TrendBasedFibTimePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(3>this._source.points().size()||!this._source.priceScale()||this._source.priceScale().isEmpty()||this._model.timeScale().isEmpty())){var a=this._source.points().item(0),b=this._source.points().item(1),c=this._source.points().item(2);this._levels=[];if(b.index!=a.index&&(a=b.index-a.index,b=this._source.properties(),c=c.index,!this._model.timeScale().visibleBars().isEmpty()))for(var d=1;11>=d;d++){var e=
b["level"+d];if(e.visible.value()){var f=e.coeff.value(),g=e.color.value(),h=Math.round(c+f*a),e={x:this._model.timeScale().indexToCoordinate(h),coeff:f,color:g,linewidth:e.linewidth.value(),linestyle:e.linestyle.value(),index:d};b.showCoeffs.value()&&(e.text=f,e.y=this._source.priceScale().height());this._levels.push(e)}}}};
TrendBasedFibTimePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0),c=this._points.item(1),d=this._source.properties(),e={points:(new List).append(b).append(c),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:d.trendline.color.value(),linewidth:d.trendline.linewidth.value(),linestyle:d.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};
a.append(new TrendLineRenderer(e));if(3>this._points.size())return this.addAnchors(a),a;e=this._points.item(2);e={points:(new List).append(c).append(e),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:d.trendline.color.value(),linewidth:d.trendline.linewidth.value(),linestyle:d.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};a.append(new TrendLineRenderer(e));for(var e=d.fillBackground.value(),
f=d.transparency.value(),g=0;g<this._levels.length;g++){if(0<g&&e){var b=new MathEx.Point(this._levels[g-1].x,0),c=new MathEx.Point(this._levels[g].x,this._source.priceScale().height()),h={nohittest:!0};h.points=(new List).append(b).append(c);h.color=this._levels[g].color;h.linewidth=0;h.backcolor=this._levels[g].color;h.fillBackground=!0;h.transparency=f;a.append(new RectangleRenderer(h))}if(void 0!==this._levels[g].text){var k,m,n,c=d.horzLabelsAlign.value(),c="left"==c?"right":"right"==c?"left":
"center";switch(c){case "left":m=3;break;case "center":m=0;break;case "right":m=-3}switch(d.vertLabelsAlign.value()){case "top":k=new MathEx.Point(this._levels[g].x,0);n=5;break;case "middle":k=new MathEx.Point(this._levels[g].x,0.5*this._levels[g].y);n=0;break;case "bottom":k=new MathEx.Point(this._levels[g].x,this._levels[g].y),n=-10}c={points:(new List).append(k),text:""+this._levels[g].text,color:this._levels[g].color,vertAlign:"middle",horzAlign:c,font:d.font.value(),offsetX:m,offsetY:n,fontsize:12};
a.append(new TextRenderer(c,this._rendererCache))}c={};c.points=(new List).append(new MathEx.Point(this._levels[g].x,0));c.color=this._levels[g].color;c.linewidth=this._levels[g].linewidth;c.linestyle=this._levels[g].linestyle;b=new HitTestResult(HitTestResult.MOVEPOINT,null,this._levels[g].index);a.append(new VertLineRenderer(c,b))}this.addAnchors(a);return a};
TradingView.LineToolTrendBasedFibTime=function(a,b){this._constructor="LineToolTrendBasedFibTime";var c=b?b:new DefaultProperty("linetooltrendbasedfibtime");LineDataSource.call(this,a,new TrendBasedFibTimePaneView(this,a),c);this.version=TradingView.LineToolTrendBasedFibTime.version};inherit(TradingView.LineToolTrendBasedFibTime,LineDataSource);TradingView.LineToolTrendBasedFibTime.version=1;TradingView.LineToolTrendBasedFibTime.prototype.pointsCount=function(){return 3};
TradingView.LineToolTrendBasedFibTime.prototype.title=function(){return"Trend-Based Fib Time"};TradingView.LineToolTrendBasedFibTime.prototype.migrateVersion=function(a,b,c){};TradingView.LineToolTrendBasedFibTime.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function GannArcRenderer(a){this._data=a}
GannArcRenderer.prototype.draw=function(a){a.lineCap="butt";a.strokeStyle=this._data.color;a.lineWidth=this._data.linewidth;a.translate(this._data.center.x,this._data.center.y);var b=this._data.edge.substract(this._data.center),b=b.y/b.x,c=this._data.point.substract(this._data.center);c.y/=b;var c=c.length(),d=this._data.prevPoint.substract(this._data.center);d.y/=b;d=d.length();a.scale(1,b);this._data.fillBack&&(this._data.point.x<this._data.center.x&&(c=-c,d=-d),a.beginPath(),a.moveTo(d,0),a.lineTo(c,
0),a.arcTo(c,c,0,c,Math.abs(c)),a.lineTo(0,d),a.arcTo(d,d,d,0,Math.abs(d)),a.fillStyle=generateColor(this._data.color,this._data.transparency),a.fill());a.beginPath();this._data.point.x>this._data.center.x?a.arc(0,0,Math.abs(c),0,Math.PI/2,!1):a.arc(0,0,Math.abs(c),-Math.PI/2,-Math.PI,!0);a.scale(1,1/b);a.stroke()};
GannArcRenderer.prototype.hitTest=function(a){a=a.substract(this._data.center);var b=this._data.edge.substract(this._data.center),c=b.y/b.x;a.y/=c;var d=this._data.point.substract(this._data.center);d.y/=c;var d=d.length(),e=a.length(),f=this._data.prevPoint.substract(this._data.center);f.y/=c;c=f.length();if(this._data.fillBack){if(e>=c&&e<=d&&0<=b.x*a.x&&0<=b.y*a.y)return new HitTestResult(HitTestResult.MOVEPOINT)}else if(5>Math.abs(e-d)&&0<=b.x*a.x&&0<=b.y*a.y)return new HitTestResult(HitTestResult.MOVEPOINT);
return null};function GannComplexPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(GannComplexPaneView,LineSourcePaneView);GannComplexPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._source._cornerPoint&&this._points.append(this._source.pointToScreenPoint(this._source._cornerPoint)[0])};
GannComplexPaneView.prototype.renderer=function(){var a=this._source.properties(),b=new CompositeRenderer;if(2>this._points.size())return this.addAnchors(b),b;for(var c=this._points.item(0),d=3==this._points.size()?this._points.item(2):this._points.item(1),e=this._points.item(1),f=0;6>f;f++){var g=a.levels[f];if(g.visible.value()){var h=f/5,k=c.x+h*(d.x-c.x),m=c.y,n=d.y,k={points:(new List).append(new MathEx.Point(k,m)).append(new MathEx.Point(k,n)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),
color:g.color.value(),linewidth:g.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};b.append(new TrendLineRenderer(k));m=c.y+h*(d.y-c.y);k=c.x;h=d.x;k={points:(new List).append(new MathEx.Point(k,m)).append(new MathEx.Point(h,m)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:g.color.value(),linewidth:g.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,
extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};b.append(new TrendLineRenderer(k))}}for(f in a.fanlines._childs)n=a.fanlines[f],n.visible.value()&&(g=n.x.value(),h=n.y.value(),g>h?(k=d.x,h/=g,m=c.y+h*(d.y-c.y)):(m=d.y,h=g/h,k=c.x+h*(d.x-c.x)),k={points:(new List).append(c).append(new MathEx.Point(k,m)),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:n.color.value(),linewidth:n.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,
extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},b.append(new TrendLineRenderer(k)));n=c;for(f in a.arcs._childs){var q=a.arcs[f];q.visible.value()&&(g=q.x.value()/5,h=q.y.value()/5,k=c.x+g*(d.x-c.x),m=c.y+h*(d.y-c.y),(new MathEx.Point(k,m)).substract(c).length(),k={center:c,point:new MathEx.Point(k,m),edge:d,color:q.color.value(),linewidth:q.width.value(),fillBack:a.arcsBackground.fillBackground.value(),transparency:a.arcsBackground.transparency.value(),
prevPoint:n},b.append(new GannArcRenderer(k)),n=k.point)}this.isAnchorsRequired()&&(a=(new List).append(c).append(e),this._model.lineBeingCreated()==this._source&&a.removeAt(a.size()-1),b.append(this.createLineAnchor({points:a})));return b};TradingView.LineToolGannComplex=function(a,b){this._constructor="LineToolGannComplex";var c=b?b:new DefaultProperty("linetoolganncomplex");LineDataSource.call(this,a,new GannComplexPaneView(this,a),c)};inherit(TradingView.LineToolGannComplex,LineDataSource);
TradingView.LineToolGannComplex.prototype._recalcSecondPoint=function(){var a=this._model.mainSeries().properties().style.value(),b=this._model.mainSeries().interval();if(a!==this._currentStyle||b!==this._currentInterval)a=this.pointToScreenPoint(this.points().item(0))[0],b=this.pointToScreenPoint(this.points().item(2))[0].substract(a),a=a.add(b.scaled(0.2/Math.sqrt(2))),a=this.screenPointToPoint(a),this._points.setItem(1,a)};TradingView.LineToolGannComplex.prototype.pointsCount=function(){return 2};
TradingView.LineToolGannComplex.prototype.title=function(){return"Gann Square"};TradingView.LineToolGannComplex.prototype._fixThirdPoint=function(a){if(!(2>this.points().size())){var b=this.pointToScreenPoint(this.points().item(0))[0],c=this.pointToScreenPoint(this.points().item(1))[0],d=c.substract(b);a?b=b.add(d.scaled(5*Math.sqrt(2))):(a=0>d.x?-1:1,d=0>d.y?-1:1,c=c.substract(b).length(),b=b.add(new MathEx.Point(5*c*a,5*c*d)));this._cornerPoint=this.screenPointToPoint(b)}};
TradingView.LineToolGannComplex.prototype.setPoint=function(a,b,c){a=LineDataSource.prototype.setPoint.call(this,a,b,c);this._fixThirdPoint(c&&c.shift);this._points.setItem(2,this._cornerPoint);delete this._cornerPoint;c=this._model.mainSeries().properties().style.value();b=this._model.mainSeries().interval();this._currentStyle=c;this._currentInterval=b;return a};
TradingView.LineToolGannComplex.prototype.setLastPoint=function(a,b){var c=LineDataSource.prototype.setLastPoint.call(this,a,b);this._fixThirdPoint(b&&b.shift);return c};
TradingView.LineToolGannComplex.prototype.addPoint=function(a,b){var c=this._model.mainSeries().properties().style.value(),d=this._model.mainSeries().interval();this._currentStyle=c;this._currentInterval=d;c=this.priceScale();c.isPercent()&&(d=this.ownerSource().firstValue(),a.price=c.priceRange().convertFromPercent(a.price,d));c=b&&b.shift;this._points.append(a);this._lastPoint=null;(d=this._points.size()==this.pointsCount())?(this._fixThirdPoint(c),this._points.append(this._cornerPoint),delete this._cornerPoint,
this.normalizePoints(),this.createServerPoints()):this._lastPoint=a;return d};TradingView.LineToolGannComplex.prototype.onData=function(a){LineDataSource.prototype.onData.call(this,a);this._recalcSecondPoint()};function FibChannelPaneView(a,b){LineSourcePaneView.call(this,a,b);this._rendererCache={}}inherit(FibChannelPaneView,LineSourcePaneView);
FibChannelPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(!(3>this._points.size()||3>this._source.points().size())){var a=this._points.item(0),b=this._points.item(1);this._points.item(2);this.norm=this._points.item(2).substract(this._points.item(0));this._labels=[];for(var c=this._source.properties(),a=this._source.points().item(0),b=this._source.points().item(1),a=a.price-b.price,b=b.price,d=function(a){return c.coeffsAsPercents.value()?""+Math.round(1E4*a)/
100+"%":""+a},e=1;11>=e;e++){var f=c["level"+e].coeff.value(),g=b+f*a;if(this._source.priceScale().isPercent())var h=this._source.ownerSource().firstValue(),g=this._source.priceScale().priceRange().convertToPercent(g,h);var k;c.showCoeffs.value()&&c.showPrices.value()?k=""+d(f)+"("+this._source.priceScale().formatter().format(g)+")":c.showCoeffs.value()?k=""+d(f):c.showPrices.value()&&(k=""+this._source.priceScale().formatter().format(g));this._labels.push(k)}}};
FibChannelPaneView.prototype.renderer=function(){function a(a,d,e){var g,k,l=c.vertLabelsAlign.value();switch(c.horzLabelsAlign.value()){case "left":g=a;k="right";break;case "center":g=a.add(d).scaled(0.5);k="center";break;case "right":g=d,k="left"}a={points:(new List).append(g),text:e,color:h.color,vertAlign:l,horzAlign:k,font:c.font.value(),offsetX:-5,offsetY:"top"==l?0:-5,fontsize:12};b.append(new TextRenderer(a,f._rendererCache))}var b=new CompositeRenderer;if(2>this._points.size())return this.addAnchors(b),
b;var c=this._source.properties(),d=this._points.item(0),e=this._points.item(1);if(3>this._points.size())return d={points:(new List).append(d).append(e),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:c.level1.color.value(),linewidth:c.level1.linewidth.value(),linestyle:c.level1.linestyle.value(),extendleft:c.extendLeft.value(),extendright:c.extendRight.value(),leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},b.append(new TrendLineRenderer(d)),
this.addAnchors(b),b;for(var f=this,g=1;11>g;g++){var h=c["level"+g];if(h.visible.value()){for(var k=g+1;11>=k;k++){var m=c["level"+k];if(m.visible.value())break}if(!m)break;var n=this.norm.scaled(h.coeff.value()),k=d.add(n),n=e.add(n),q=this.norm.scaled(m.coeff.value()),l=d.add(q),q=e.add(q),s={};s.points=new List;s.points.append(k);s.points.append(n);s.points.append(l);s.points.append(q);s.color=h.color.value();s.width=this._model.timeScale().width();s.height=this._source.priceScale().height();
s.linewidth=h.linewidth.value();s.linestyle=h.linestyle.value();s.extendleft=c.extendLeft.value();s.extendright=c.extendRight.value();s.backcolor=h.color.value();s.transparency=c.transparency.value();s.skipTopLine=!0;s.fillBackground=c.fillBackground.value();s.hittestOnBackground=TradingView.isMobile.any();b.append(new ParallelChannelRenderer(s));(c.showCoeffs.value()||c.showPrices.value())&&a(k,n,this._labels[g-1])}}h=c.level11;h.visible.value()&&(n=this.norm.scaled(h.coeff.value()),k=d.add(n),n=
e.add(n),d={points:(new List).append(k).append(n),width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:h.color.value(),linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),extendleft:c.extendLeft.value(),extendright:c.extendRight.value(),leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL},b.append(new TrendLineRenderer(d)),(c.showCoeffs.value()||c.showPrices.value())&&a(k,n,this._labels[10]));this.addAnchors(b);return b};
TradingView.LineToolFibChannel=function(a,b){this._constructor="LineToolFibChannel";var c=b?b:new DefaultProperty("linetoolfibchannel");LineDataSource.call(this,a,new FibChannelPaneView(this,a),c);this.version=TradingView.LineToolFibChannel.version};inherit(TradingView.LineToolFibChannel,LineDataSource);TradingView.LineToolFibChannel.version=1;TradingView.LineToolFibChannel.prototype.pointsCount=function(){return 3};TradingView.LineToolFibChannel.prototype.title=function(){return"Fib Channel"};
TradingView.LineToolFibChannel.prototype.processErase=function(a,b){var c="level"+b,c=this.properties()[c].visible;a.setProperty(c,!1,"Erase level line")};function FibSpiralRenderer(a){this._data=a}FibSpiralRenderer.prototype._fibNumbers=function(){return[0,1,2,3,5,8,13,21,34,55,89]};FibSpiralRenderer.prototype._continiusFib=function(a){var b=this._fibNumbers(),c=Math.floor(a),d=Math.ceil(a);if(d>=b.length)return null;a=Math.pow(a-c,1.15);return b[c]+(b[d]-b[c])*a};
FibSpiralRenderer.prototype.hitTest=function(a){var b=this._data.points.item(0),c=this._data.points.item(1).substract(b),b=a.substract(b);a=c.normalized();var d=a.transponed(),e=b.normalized();a=Math.acos(a.dotProduct(e));0>Math.asin(d.dotProduct(e))&&(a=2*Math.PI-a);b=b.length();for(d=0;4>d;d++)if(e=this._continiusFib(a/(0.5*Math.PI)+4*d),e=e*c.length()/5,null!==e&&5>Math.abs(e-b))return new HitTestResult(HitTestResult.MOVEPOINT);return null};
FibSpiralRenderer.prototype.draw=function(a){a.lineCap="round";a.strokeStyle=this._data.color;var b=this._data.points.item(0),c=this._data.points.item(1);a.translate(b.x,b.y);var d=c.substract(b),b=d.length(),d=d.normalized(),c=Math.acos(d.x);0>Math.asin(d.y)&&(c=2*Math.PI-c);a.rotate(c);a.scale(b/5,b/5);a.lineWidth=this._data.linewidth;CanvasEx.setLineStyle(a,this._data.linestyle);d=Math.PI/100;a.moveTo(0,0);for(var e=0;e<50*(this._fibNumbers().length-1);e++){var f=e*d,g=this._continiusFib(e/50),
h=Math.cos(f)*g,f=Math.sin(f)*g;a.lineTo(h,f)}a.scale(5/b,5/b);a.rotate(-c);a.stroke()};function FibSpiralPaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(FibSpiralPaneView,LineSourcePaneView);
FibSpiralPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b={};b.points=this._points;b.width=this._model.timeScale().width();b.height=this._source.priceScale().height();b.color=this._source.properties().linecolor.value();b.linewidth=this._source.properties().linewidth.value();b.linestyle=this._source.properties().linestyle.value();b.extendleft=!1;b.extendright=!0;b.leftend=LineDataSource.LINEEND_NORMAL;b.rightend=LineDataSource.LINEEND_NORMAL;
a.append(new TrendLineRenderer(b));b={};b.points=this._points;b.floatPoints=this._floatPoints;b.width=this._model.timeScale().width();b.height=this._source.priceScale().height();b.color=this._source.properties().linecolor.value();b.linewidth=this._source.properties().linewidth.value();b.linestyle=this._source.properties().linestyle.value();a.append(new FibSpiralRenderer(b));this.isAnchorsRequired()&&(a.append(new TrendLineRenderer(b)),b=b.points.clone(),this._model.lineBeingCreated()==this._source&&
b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));return a};TradingView.LineToolFibSpiral=function(a,b){this._constructor="LineToolFibSpiral";var c=b?b:new DefaultProperty("linetoolfibspiral");LineDataSource.call(this,a,new FibSpiralPaneView(this,a),c)};inherit(TradingView.LineToolFibSpiral,LineDataSource);TradingView.LineToolFibSpiral.prototype.pointsCount=function(){return 2};TradingView.LineToolFibSpiral.prototype.title=function(){return"Fib Spiral"};function DisjointAnglePaneView(a,b){LineSourcePaneView.call(this,a,b);this._label=null;this._rendererCache={}}inherit(DisjointAnglePaneView,LineSourcePaneView);
DisjointAnglePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._label=null;if(!(2>this._source.points().size())&&this._source.priceScale()){this._label="";var a=this._source.points().item(0),b=this._source.points().item(1);this._source.properties().showPriceRange.value()&&this._source.priceScale()&&(this._label+=this._source.priceScale().formatter().format(b.price-a.price)+"\n");if(this._source.properties().showBarsRange.value()){var c=b.index-a.index;this._label+=
$.t("{0} bars").format(c)+"\n"}if(this._source.properties().showDateTimeRange.value()){var c=this._model.timeScale().indexToUserTime(a.index),d=this._model.timeScale().indexToUserTime(b.index);c&&d&&(c=(d.valueOf()-c.valueOf())/1E3,this._label+=(new TimeSpanFormatter).format(c)+"\n")}""===this._label&&(this._label=null);this._price1=this._source.priceScale().formatter().format(a.price);this._price2=this._source.priceScale().formatter().format(b.price);3==this._source.points().size()&&(c=this._source.points().item(2),
this._price3=this._source.priceScale().formatter().format(c.price),a=b.price-a.price,this._price4=this._source.priceScale().formatter().format(c.price+a))}};
DisjointAnglePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0),c=this._points.item(1),d=this._source.properties(),e=this._model,f=this._source,d=f.properties();if(3<=this._points.size()){var g=this._points.item(2);g.x=c.x;var h=c.y-b.y,k=b.clone();k.y=g.y+h;k.data=3;if(d.fillBackground.value()){var m={},h=e.timeScale().width();f.priceScale().height();var n=d.extendLeft.value(),q=d.extendRight.value();n||q?!n&&q?(m={},m.width=
h,m.p1=b,m.p2=c,m.p3=k,m.p4=g,m.color=d.backgroundColor.value(),m.transparency=d.transparency.value(),m.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(m))):n&&!q?(m={},m.width=h,m.p1=c,m.p2=b,m.p3=g,m.p4=k,m.color=d.backgroundColor.value(),m.transparency=d.transparency.value(),m.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(m))):(m=b.add(c).scaled(0.5),n=k.add(g).scaled(0.5),q={},q.width=h,q.p1=m,q.p2=c,q.p3=n,q.p4=g,q.color=d.backgroundColor.value(),
q.transparency=d.transparency.value(),q.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(q)),q={},q.width=h,q.p1=m,q.p2=b,q.p3=n,q.p4=k,q.color=d.backgroundColor.value(),q.transparency=d.transparency.value(),q.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(q))):(m.points=new List([b,c,g,k]),m.color="rgba(0,0,0,0)",m.linewidth=0,m.linestyle=CanvasEx.LINESTYLE_SOLID,m.filled=!0,m.backcolor=d.backgroundColor.value(),m.fillBackground=!0,m.transparency=
d.transparency.value(),a.append(new PoligonRenderer(m)))}}h=function(a,b){return{points:(new List).append(a).append(b),width:e.timeScale().width(),height:f.priceScale().height(),color:d.linecolor.value(),linewidth:d.linewidth.value(),linestyle:d.linestyle.value(),extendleft:d.extendLeft.value(),extendright:d.extendRight.value(),leftend:d.leftEnd.value(),rightend:d.rightEnd.value()}};a.append(new TrendLineRenderer(h(b,c)));var l=this,m=function(b,c,d,e){l._source.properties().showPrices.value()&&(d=
{points:(new List).append(b),text:d,color:l._source.properties().textcolor.value(),horzAlign:b.x>c.x?"left":"right",vertAlign:"middle",font:l._source.properties().font.value(),offsetX:b.x>c.x?-5:5,offsetY:-5,bold:l._source.properties().bold.value(),italic:l._source.properties().italic.value(),fontsize:l._source.properties().fontsize.value()},a.append(new TextRenderer(d,l._rendererCache)),d={points:(new List).append(c),text:e,color:l._source.properties().textcolor.value(),horzAlign:b.x<c.x?"left":
"right",vertAlign:"middle",font:l._source.properties().font.value(),offsetX:b.x<c.x?-5:5,offsetY:-5,bold:l._source.properties().bold.value(),italic:l._source.properties().italic.value(),fontsize:l._source.properties().fontsize.value()},a.append(new TextRenderer(d,l._rendererCache)))};a.append(new TrendLineRenderer(h(b,c)));null!==this._label&&2<=this._points.size()&&(n={points:(new List).append(b.add(c).scaled(0.5)),text:this._label,color:this._source.properties().textcolor.value(),horzAlign:"left",
vertAlign:"middle",font:this._source.properties().font.value(),offsetX:5,offsetY:-5,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()},a.append(new TextRenderer(n,this._rendererCache)));m(b,c,this._price1,this._price2);if(2==this._points.size())return this.addAnchors(a),a;a.append(new TrendLineRenderer(h(k,g)));null!==this._label&&(n={points:(new List).append(g.add(k).scaled(0.5)),text:this._label,color:this._source.properties().textcolor.value(),
horzAlign:"left",font:this._source.properties().font.value(),offsetX:5,offsetY:-5,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value(),vertAlign:"middle"},a.append(new TextRenderer(n,this._rendererCache)));m(g,k,this._price3,this._price4);this.isAnchorsRequired()&&(b=(new List).append(b).append(c).append(g).append(k),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));
return a};TradingView.LineToolDisjointAngle=function(a,b){this._constructor="LineToolDisjointAngle";var c=b?b:new DefaultProperty("linetooldisjointangle");LineDataSource.call(this,a,new DisjointAnglePaneView(this,a),c);this.version=TradingView.LineToolDisjointAngle.version};inherit(TradingView.LineToolDisjointAngle,LineDataSource);TradingView.LineToolDisjointAngle.version=1;TradingView.LineToolDisjointAngle.prototype.pointsCount=function(){return 3};
TradingView.LineToolDisjointAngle.prototype.title=function(){return"Disjoint Angle"};TradingView.LineToolDisjointAngle.prototype.addPoint=function(a,b){b&&b.shift&&2==this.points().size()&&this._snapPoint45Degree(a,this.points().item(this.points().size()-2));return LineDataSource.prototype.addPoint.call(this,a)};
TradingView.LineToolDisjointAngle.prototype.setLastPoint=function(a,b){b&&b.shift&&2==this.points().size()&&this._snapPoint45Degree(a,this.points().item(this.points().size()-2));return LineDataSource.prototype.setLastPoint.call(this,a)};
TradingView.LineToolDisjointAngle.prototype.setPoint=function(a,b,c){var d=0.5*(this._points.item(1).price+this._points.item(2).price);c&&c.shift&&1==a&&this._snapPoint45Degree(b,this.points().item(0));3>a&&LineDataSource.prototype.setPoint.call(this,a,b);0!=a&&2!=a&&(1==a?(a=this._points.item(1).price-d,this._points.item(2).price=this._points.item(1).price-2*a):3==a&&(a=this.priceScale(),c=b.price,a.isPercent()&&(d=this.ownerSource().firstValue(),c=a.priceRange().convertFromPercent(c,d)),a=c-this._points.item(2).price,
this._points.item(0).price=this._points.item(1).price-a,this._points.item(0).index=b.index))};function FlatBottomPaneView(a,b){LineSourcePaneView.call(this,a,b);this._label2=this._label1=null;this._rendererCache={}}inherit(FlatBottomPaneView,LineSourcePaneView);
FlatBottomPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._label2=this._label1=null;if(!(2>this._source.points().size())&&this._source.priceScale()){this._label2=this._label1="";var a=this._source.points().item(0),b=this._source.points().item(1);this._source.properties().showPriceRange.value()&&this._source.priceScale()&&(this._label1+=this._source.priceScale().formatter().format(b.price-a.price)+"\n");if(this._source.properties().showBarsRange.value()){var c=
b.index-a.index;this._label1+=$.t("{0} bars").format(c)+"\n";this._label2+=$.t("{0} bars").format(c)+"\n"}if(this._source.properties().showDateTimeRange.value()){var c=this._model.timeScale().indexToUserTime(a.index),d=this._model.timeScale().indexToUserTime(b.index);c&&d&&(c=(d.valueOf()-c.valueOf())/1E3,this._label1+=(new TimeSpanFormatter).format(c)+"\n",this._label2+=(new TimeSpanFormatter).format(c)+"\n")}""===this._label1&&(this._label1=null);""===this._label2&&(this._label2=null);this._price1=
this._source.priceScale().formatter().format(a.price);this._price2=this._source.priceScale().formatter().format(b.price);3==this._source.points().size()&&(a=this._source.points().item(2),this._price3=this._source.priceScale().formatter().format(a.price))}};
FlatBottomPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(2>this._points.size())return a;var b=this._points.item(0),c=this._points.item(1),d=this._source.properties(),e=this._model,f=this._source;if(3==this._points.size()){var g=this._points.item(2);g.x=c.x;var h=b.clone();h.y=g.y;h.data=3;if(d.fillBackground.value()){var k={},m=e.timeScale().width();f.priceScale().height();var n=d.extendLeft.value(),q=d.extendRight.value();n||q?!n&&q?(k={},k.width=m,k.p1=b,k.p2=c,k.p3=h,k.p4=
g,k.color=d.backgroundColor.value(),k.transparency=d.transparency.value(),k.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(k))):n&&!q?(k={},k.width=m,k.p1=c,k.p2=b,k.p3=g,k.p4=h,k.color=d.backgroundColor.value(),k.transparency=d.transparency.value(),k.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(k))):(k=b.add(c).scaled(0.5),n=h.add(g).scaled(0.5),q={},q.width=m,q.p1=k,q.p2=c,q.p3=n,q.p4=g,q.color=d.backgroundColor.value(),q.transparency=
d.transparency.value(),q.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(q)),q={},q.width=m,q.p1=k,q.p2=b,q.p3=n,q.p4=h,q.color=d.backgroundColor.value(),q.transparency=d.transparency.value(),q.hittestOnBackground=TradingView.isMobile.any(),a.append(new ChannelRenderer(q))):(k.points=new List([b,c,g,h]),k.color="rgba(0,0,0,0)",k.linewidth=0,k.linestyle=CanvasEx.LINESTYLE_SOLID,k.filled=!0,k.backcolor=d.backgroundColor.value(),k.fillBackground=!0,k.transparency=d.transparency.value(),
a.append(new PoligonRenderer(k)))}}m=function(a,b){return{points:(new List).append(a).append(b),width:e.timeScale().width(),height:f.priceScale().height(),color:d.linecolor.value(),linewidth:d.linewidth.value(),linestyle:d.linestyle.value(),extendleft:d.extendLeft.value(),extendright:d.extendRight.value(),leftend:d.leftEnd.value(),rightend:d.rightEnd.value()}};a.append(new TrendLineRenderer(m(b,c)));if(2==this._points.size())return this.addAnchors(a),a;var l=this,k=function(b,c,d,e){l._source.properties().showPrices.value()&&
(d={points:(new List).append(b),text:d,color:l._source.properties().textcolor.value(),horzAlign:b.x>c.x?"left":"right",vertAlign:"middle",font:l._source.properties().font.value(),offsetX:b.x>c.x?-5:5,offsetY:-5,bold:l._source.properties().bold.value(),italic:l._source.properties().italic.value(),fontsize:l._source.properties().fontsize.value()},a.append(new TextRenderer(d,l._rendererCache)),d={points:(new List).append(c),text:e,color:l._source.properties().textcolor.value(),horzAlign:b.x<c.x?"left":
"right",vertAlign:"middle",font:l._source.properties().font.value(),offsetX:b.x<c.x?-5:5,offsetY:-5,bold:l._source.properties().bold.value(),italic:l._source.properties().italic.value(),fontsize:l._source.properties().fontsize.value()},a.append(new TextRenderer(d,l._rendererCache)))};a.append(new TrendLineRenderer(m(b,c)));null!==this._label1&&2<=this._points.size()&&(n={points:(new List).append(b.add(c).scaled(0.5)),text:this._label1,color:this._source.properties().textcolor.value(),horzAlign:"left",
vertAlign:"middle",font:this._source.properties().font.value(),offsetX:5,offsetY:0,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()},a.append(new TextRenderer(n,this._rendererCache)));k(b,c,this._price1,this._price2);if(2==this._points.size())return a;null!==this._label2&&(h=new MathEx.Point(b.x,g.y),n={points:(new List).append(g.add(h).scaled(0.5)),text:this._label2,color:this._source.properties().textcolor.value(),
horzAlign:"left",font:this._source.properties().font.value(),offsetX:5,offsetY:-2,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value(),vertAlign:"middle"},a.append(new TextRenderer(n,this._rendererCache)));a.append(new TrendLineRenderer(m(h,g)));k(g,h,this._price3,this._price3);this.isAnchorsRequired()&&(b=(new List).append(b).append(c).append(g).append(h),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-
1),a.append(this.createLineAnchor({points:b})));return a};TradingView.LineToolFlatBottom=function(a,b){this._constructor="LineToolFlatBottom";var c=b?b:new DefaultProperty("linetoolflatbottom");LineDataSource.call(this,a,new FlatBottomPaneView(this,a),c);this.version=TradingView.LineToolFlatBottom.version};inherit(TradingView.LineToolFlatBottom,LineDataSource);TradingView.LineToolFlatBottom.version=1;TradingView.LineToolFlatBottom.prototype.pointsCount=function(){return 3};
TradingView.LineToolFlatBottom.prototype.title=function(){return"Flat Bottom"};TradingView.LineToolFlatBottom.prototype.addPoint=function(a,b){b&&b.shift&&2==this.points().size()&&this._snapPoint45Degree(a,this.points().item(this.points().size()-2));return LineDataSource.prototype.addPoint.call(this,a)};
TradingView.LineToolFlatBottom.prototype.setLastPoint=function(a,b){b&&b.shift&&2==this.points().size()&&this._snapPoint45Degree(a,this.points().item(this.points().size()-2));return LineDataSource.prototype.setLastPoint.call(this,a)};TradingView.LineToolFlatBottom.prototype.setPoint=function(a,b,c){this._points.item(1);this._points.item(2);c&&c.shift&&1==a&&this._snapPoint45Degree(b,this.points().item(0));3>a?LineDataSource.prototype.setPoint.call(this,a,b):this._points.item(0).index=b.index};function IconRenderer(a,b){this._data=a;this._cache=b}
IconRenderer.prototype.draw=function(a){var b=String.fromCharCode(this._data.icon);a.font=this._data.size+"px FontAwesome";var c=a.measureText(b).width;a.textBaseline="middle";var d=this._data.point;a.translate(d.x,d.y);a.rotate(this._data.angle-Math.PI/2);a.scale(this._data.scale,1);d=65536*this._data.icon+this._data.size;this._cache[d]=c;this._data.selected&&(a.fillStyle="rgba(80, 80, 80, 0.2)",a.fillRect(-this._cache[d]/2,-this._data.size/2,this._cache[d],this._data.size));a.fillStyle=this._data.color;
a.fillText(b,-this._cache[d]/2,0)};IconRenderer.prototype.hitTest=function(a){var b=this._cache[65536*this._data.icon+this._data.size]*this._data.scale,c=MathEx.Matrix.rotate(-this._data.angle);a=a.substract(this._data.point);a=c.mult(a);return Math.abs(a.y)<=b/2&&Math.abs(a.x)<=this._data.size/2?new HitTestResult(HitTestResult.MOVEPOINT):null};function IconPaneView(a,b){LineSourcePaneView.call(this,a,b);this._cache={}}inherit(IconPaneView,LineSourcePaneView);IconPaneView.anchorLimit=80;
IconPaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(1>this._points.size())return a;var b=this._source.properties(),c={point:this._points.item(0),color:b.color.value(),size:b.size.value(),icon:b.icon.value(),angle:b.angle.value(),scale:b.scale.value(),selected:this.isAnchorsRequired()},d=this._model,e=this._source;a.append(new IconRenderer(c,this._cache));if(this.isAnchorsRequired()){var f=this._cache[65536*c.icon+c.size],g=c.size,c=this._points.item(0),h=b.scale.value(),g=new MathEx.Point(Math.max(IconPaneView.anchorLimit,
g)/2,0),f=new MathEx.Point(0,Math.max(IconPaneView.anchorLimit,h*f)/2),b=MathEx.Matrix.rotate(b.angle.value()),g=b.mult(g),f=b.mult(f),b=c.add(g);b.data=0;g=c.substract(g);g.data=1;h=c.add(f);h.data=2;h.square=!0;f=c.substract(f);f.data=3;f.square=!0;c={points:(new List).append(b).append(g),width:d.timeScale().width(),height:e.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:LineDataSource.LINEEND_NORMAL,rightend:LineDataSource.LINEEND_NORMAL};
d=new TrendLineRenderer(c);d._hittest=null;a.append(d);a.append(this.createLineAnchor({points:(new List).append(b).append(g).append(h).append(f)}))}return a};TradingView.LineToolIcon=function(a,b){this._constructor="LineToolIcon";var c=b?b:new DefaultProperty("linetoolicon");c.addExclusion("angle");c.addExclusion("scale");LineDataSource.call(this,a,new IconPaneView(this,a),c);this.version=TradingView.LineToolIcon.version};
TradingView.LineToolIcon._getAvailIcons=function(){for(var a=[],a=a.concat([61536,61537,61538,61539]),a=a.concat([61725,61726]),a=a.concat([61575,61576,61796,61797]),a=a.concat([61779,61780,61781,61782,61783,61784,61785,61786]),b=a.slice(0),c=61440;61846>=c;c++)-1!=$.inArray(c,a)||15==c%16&&61487!==c||61620<=c&&61630>=c||61718!=c&&61719!=c&&61472!=c&&61619!=c&&b.push(c);return b};TradingView.LineToolIcon.availIcons=TradingView.LineToolIcon._getAvailIcons();inherit(TradingView.LineToolIcon,LineDataSource);
TradingView.LineToolIcon.version=1;TradingView.LineToolIcon.prototype.pointsCount=function(){return 1};TradingView.LineToolIcon.prototype.title=function(){return"Icon"};
TradingView.LineToolIcon.prototype.startChanging=function(a,b){LineDataSource.prototype.startChanging.call(this,a,b);var c=this.properties(),d=65536*c.icon.value()+c.size.value();this._startChangeWidth=this._paneViews[0]._cache[d];c.size.value()<IconPaneView.anchorLimit?this._sizeScale=c.size.value()/IconPaneView.anchorLimit:this._sizeScale=1;this._origScale=c.scale.value();this._resizeRatio=this._startChangeWidth*this._origScale<IconPaneView.anchorLimit?this._startChangeWidth/IconPaneView.anchorLimit:
1};TradingView.LineToolIcon.prototype.endChanging=function(){LineDataSource.prototype.endChanging.call(this);delete this._startChangeWidth;delete this._sizeScale;delete this._resizeRatio};
TradingView.LineToolIcon.prototype.setPoint=function(a,b,c){var d=this.priceScale();if(d.isPercent()){var e=this.ownerSource().firstValue();b.price=d.priceRange().convertFromPercent(b.price,e)}c&&c.shift&&this._properties.snapTo45Degrees&&this._snapPoint45Degree(b,this.points().item(0));c=this.pointToScreenPoint(this.points().item(0))[1];d=this.pointToScreenPoint(b)[1];0==a||1==a?(b=d.substract(c).normalized(),c=2*d.substract(c).length(),c*=this._sizeScale,this._properties.size.setValue(c),c=Math.acos(-b.x),
0<Math.asin(b.y)&&(c=2*Math.PI-c),0==a&&(c+=Math.PI),this._properties.angle.setValue(c)):(a=this._startChangeWidth,b=d.substract(c).length(),this._origScale*a<IconPaneView.anchorLimit?(a=IconPaneView.anchorLimit/2,this._properties.scale.setValue(this._origScale*b/a)):this._properties.scale.setValue(b/(a/2)))};function RotatedRectanglePaneView(a,b){LineSourcePaneView.call(this,a,b)}inherit(RotatedRectanglePaneView,LineSourcePaneView);RotatedRectanglePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);this._distance=0;3==this._points.size()&&(this._distance=MathEx.distanceToLine(this._points.item(0),this._points.item(1),this._points.item(2)).distance)};
RotatedRectanglePaneView.prototype.renderer=function(){var a=new CompositeRenderer,b=this._source.properties(),c=this._points.item(0);if(2<=this._points.size())var d=this._points.item(1);if(2==this._points.size()){var e={};e.points=this._points;e.floatPoints=this._floatPoints;e.width=this._model.timeScale().width();e.height=this._source.priceScale().height();e.color=b.color.value();e.linewidth=1;e.linestyle=CanvasEx.LINESTYLE_SOLID;e.extendleft=!1;e.extendright=!1;e.leftend=LineDataSource.LINEEND_NORMAL;
e.rightend=LineDataSource.LINEEND_NORMAL;a.append(new TrendLineRenderer(e))}else if(3==this._points.size()){this._points.item(2);var f=d.substract(c),g=(new MathEx.Point(f.y,-f.x)).normalized().scaled(this._distance),h=g.scaled(-1),f=c.add(g),g=d.add(g),k=c.add(h),h=d.add(h),e={};e.points=(new List).append(f).append(g).append(h).append(k);e.color=b.color.value();e.linewidth=this._source.properties().linewidth.value();e.linestyle=CanvasEx.LINESTYLE_SOLID;e.filled=!0;e.backcolor=b.backgroundColor.value();
e.fillBackground=b.fillBackground.value();e.transparency=b.transparency.value();a.append(new PoligonRenderer(e))}this.isAnchorsRequired()&&(b=new List,b.append(c),2<=this._points.size()&&b.append(d),3==this._points.size()&&(f.data=2,k.data=2,g.data=2,h.data=2,b.append(f),b.append(k),b.append(g),b.append(h)),a.append(this.createLineAnchor({points:b})));return a};
TradingView.LineToolRotatedRectangle=function(a,b){this._constructor="LineToolRotatedRectangle";var c=b?b:new DefaultProperty("linetoolrotatedrectangle");LineDataSource.call(this,a,new RotatedRectanglePaneView(this,a),c)};inherit(TradingView.LineToolRotatedRectangle,LineDataSource);
TradingView.LineToolRotatedRectangle.prototype.startChanging=function(a,b){LineDataSource.prototype.startChanging.call(this,a,b);if(0==a||1==a){var c=this._paneViews[0],d=c._points.item(0),e=c._points.item(1),c=c._points.item(2);this._distance=MathEx.distanceToLine(d,e,c).distance}};
TradingView.LineToolRotatedRectangle.prototype.setPoint=function(a,b,c){LineDataSource.prototype.setPoint.call(this,a,b,c);if(0==a||1==a)b=this._paneViews[0],b.update(),a=b._points.item(0),b=b._points.item(1).substract(a),b=(new MathEx.Point(b.y,-b.x)).normalized().scaled(this._distance),a=a.add(b),a=this.screenPointToPoint(a),this._points.setItem(2,a)};TradingView.LineToolRotatedRectangle.prototype.endChanging=function(){delete this._distance};
TradingView.LineToolRotatedRectangle.prototype.pointsCount=function(){return 3};TradingView.LineToolRotatedRectangle.prototype.title=function(){return"Rotated Rectangle"};function AngleRenderer(a){this._data=a}AngleRenderer.prototype.hitTest=function(){return null};AngleRenderer.prototype.draw=function(a){a.save();a.translate(this._data.point.x,this._data.point.y);a.strokeStyle=this._data.color;var b=[1,2];"function"==typeof a.setLineDash?a.setLineDash(b):void 0!==a.mozDash?a.mozDash=b:void 0!==a.webkitLineDash&&(a.webkitLineDash=b);b=this._data.size;a.beginPath();a.moveTo(0,0);a.lineTo(b,0);a.arc(0,0,b,0,-this._data.angle,0<this._data.angle);a.stroke();a.restore()};
function TrendAnglePaneView(a,b){LineSourcePaneView.call(this,a,b);this._label=null;this._rendererCache={}}inherit(TrendAnglePaneView,LineSourcePaneView);
TrendAnglePaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this);if(0<this._points.size()&&void 0!==this._source._angle){var a=this._points.item(0),b=Math.cos(this._source._angle),c=-Math.sin(this._source._angle),b=new MathEx.Point(b,c);this._secondPoint=a.addScaled(b,this._source._distance);this._secondPoint.data=1}this._label=null;2>this._source.points().size()||(this._label="",a=this._source.points().item(0),b=this._source.points().item(1),this._source.properties().showPriceRange.value()&&
this._source.priceScale()&&(this._label+=this._source.priceScale().formatter().format(b.price-a.price)+"\n"),this._source.properties().showBarsRange.value()&&(a=b.index-a.index,this._label+=$.t("{0} bars").format(a)+"\n"),""===this._label&&(this._label=null))};
TrendAnglePaneView.prototype.renderer=function(){var a=new CompositeRenderer;if(this._secondPoint&&0<this._points.size()){var b={};b.points=(new List).append(this._points.item(0)).append(this._secondPoint);b.width=this._model.timeScale().width();b.height=this._source.priceScale().height();b.color=this._source.properties().linecolor.value();b.linewidth=this._source.properties().linewidth.value();b.linestyle=this._source.properties().linestyle.value();b.extendleft=this._source.properties().extendLeft.value();
b.extendright=this._source.properties().extendRight.value();b.leftend=LineDataSource.LINEEND_NORMAL;b.rightend=LineDataSource.LINEEND_NORMAL;a.append(new TrendLineRenderer(b));if(null!==this._label&&2==this._points.size()){var c={points:(new List).append(this._secondPoint),text:this._label,color:this._source.properties().textcolor.value(),horzAlign:"left",font:this._source.properties().font.value(),offsetX:5,offsetY:0,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),
fontsize:this._source.properties().fontsize.value()};this._points.item(1).y>this._points.item(0).y?c.vertAlign="top":c.vertAlign="bottom";a.append(new TextRenderer(c,this._rendererCache))}c={};c.point=this._points.item(0);c.angle=this._source._angle;c.color=this._source.properties().linecolor.value();c.size=50;a.append(new AngleRenderer(c));var c=Math.round(180*c.angle/Math.PI)+"\u00ba",d=this._points.item(0).clone();d.x+=50;c={points:(new List).append(d),text:c,color:this._source.properties().textcolor.value(),
horzAlign:"left",font:this._source.properties().font.value(),offsetX:5,offsetY:0,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value(),vertAlign:"middle"};a.append(new TextRenderer(c,this._rendererCache))}this.isAnchorsRequired()&&this._secondPoint&&(b=b.points.clone(),this._model.lineBeingCreated()==this._source&&b.removeAt(b.size()-1),a.append(this.createLineAnchor({points:b})));return a};
TradingView.LineToolTrendAngle=function(a,b){this._constructor="LineToolTrendAngleLine";var c=b?b:new DefaultProperty("linetooltrendangle");LineDataSource.call(this,a,new TrendAnglePaneView(this,a),c);this._properties.addProperty("angle");this._properties.angle=new TradingView.LineToolTrendAngle.AngleProperty(this)};inherit(TradingView.LineToolTrendAngle,LineDataSource);TradingView.LineToolTrendAngle.AngleProperty=function(a){Property.call(this);this._lineSource=a};
inherit(TradingView.LineToolTrendAngle.AngleProperty,Property);TradingView.LineToolTrendAngle.AngleProperty.prototype.value=function(){return Math.round(180*this._lineSource._angle/Math.PI)};
TradingView.LineToolTrendAngle.AngleProperty.prototype.setValue=function(a){this._lineSource._angle=a*Math.PI/180;a=this._lineSource.pointToScreenPoint(this._lineSource.points().item(0))[0];var b=Math.cos(this._lineSource._angle),c=-Math.sin(this._lineSource._angle),b=new MathEx.Point(b,c);a=a.addScaled(b,this._lineSource._distance);a=this._lineSource.screenPointToPoint(a);this._lineSource._points.setItem(1,a);this._lineSource._model.updateSource(this._lineSource);this._lineSource.updateAllViews();
this._lineSource._model.updateSource(this._lineSource)};TradingView.LineToolTrendAngle.prototype.pointsCount=function(){return 2};TradingView.LineToolTrendAngle.prototype.title=function(){return"Trend Angle"};
TradingView.LineToolTrendAngle.prototype._calculateAngle=function(){var a=this.pointToScreenPoint(this.points().item(0))[0],b=this.pointToScreenPoint(this.points().item(1))[0],c=b.substract(a);0<c.length()?(c=c.normalized(),this._angle=Math.acos(c.x),0<c.y&&(this._angle=-this._angle),this._distance=b.substract(a).length()):delete this._angle;this.properties().angle.listeners().fire(this.properties().angle)};
TradingView.LineToolTrendAngle.prototype.addPoint=function(a,b){var c=LineDataSource.prototype.addPoint.call(this,a,b);c&&this._calculateAngle();return c};TradingView.LineToolTrendAngle.prototype.setLastPoint=function(a,b){LineDataSource.prototype.setLastPoint.call(this,a,b);1<this.points().size()&&this._calculateAngle()};TradingView.LineToolTrendAngle.prototype.setPoint=function(a,b,c){LineDataSource.prototype.setPoint.call(this,a,b,c);1<this.points().size()&&this._calculateAngle()};
TradingView.LineToolTrendAngle.prototype.restoreData=function(a){this._angle=a.angle;this._distance=a.distance};TradingView.LineToolTrendAngle.prototype.state=function(a){a=LineDataSource.prototype.state.call(this,a);a.angle=this._angle;a.distance=this._distance;return a};TradingView.LineToolTrendAngle.prototype.cloneData=function(a){this._angle=a._angle;this._distance=a._distance};TradingView.LineStudyMtp=function(a,b,c){var d=this._mtpStudyId()+"@mtp-mtpredictor";c=c||StudyMetaInfo.findStudyMetaInfo(a.studiesMetaData(),d);b=b||TradingView.prepareStudyProperties(c,null,null,a.studyVersioning());d=TradingView.Study.lineToolNameForPointsBasedStudy(d);TradingView.StudyLineDataSource.call(this,a,this.createPaneViews(a),b,d);this._doNotNeedLine=!0;this._turnaroundCounter=0;this._nextTurnaround();this._metaInfo=c;this._graphics=new TradingView.StudyGraphics(c);this._formatter=new VolumeFormatter};
inherit(TradingView.LineStudyMtp,TradingView.StudyLineDataSource);TradingView.LineStudyMtp.prototype.series=function(){return this._ownerSource};TradingView.LineStudyMtp.prototype.calcIsActualSymbol=function(){return LineDataSource.prototype.calcIsActualSymbol.call(this)};TradingView.LineStudyMtp.prototype._nextTurnaround=function(){this._turnaround=this._mtpStudyId()+"_"+ ++this._turnaroundCounter};
TradingView.LineStudyMtp.prototype.createPaneViews=function(a){return[new StudyLineDataSourcePaneView(this,a),new TradingView.Study.StudyPaneView_textmarks(this,a),new TradingView.Study.StudyPaneView_polygons(this,a),new TradingView.Study.StudyPaneView_lines(this,a)]};
TradingView.LineStudyMtp.prototype.onData=function(a){"data_update"===a.method&&a.params.customId==="pointset_"+this._currentPointsetId?(LineDataSource.prototype.onData.call(this,a),this._points.size()==this.pointsCount()&&this._requestStudy()):"data_update"===a.method&&a.params.customId===this._studyId&&this._checkTurnaround(a.params.turnaround)&&(a.params.nonseries.d=""!==a.params.nonseries.d?JSON.parse(a.params.nonseries.d):"",""!==a.params.nonseries.d&&this._graphics.process(a.params.nonseries),
0<a.params.nonseries.indexes.length&&(this._indexes=a.params.nonseries.indexes),this.updateAllViews(),this._model.updateSource(this))};
TradingView.LineStudyMtp.prototype._requestStudy=function(){var a=this,b=function(b){a.onData(b)},c=this._studyInputs();c&&(this._studyId?(this._nextTurnaround(),this._model.chartApi().modifyStudy(this._studyId,this._turnaround,c,b)):(this._studyId=TradingView.Study.makeNextStudyId(),this._model.chartApi().createStudy(this._studyId,this._turnaround,this._model.mainSeries()._seriesId,this._metaInfo.id+"-1!",c,b)))};TradingView.LineStudyMtpRiskReward=function(a,b,c){TradingView.LineStudyMtp.call(this,a,b,c)};inherit(TradingView.LineStudyMtpRiskReward,TradingView.LineStudyMtp);TradingView.LineStudyMtpRiskReward.prototype._mtpStudyId=function(){return"mtp_riskreward"};TradingView.LineStudyMtpRiskReward.prototype.pointsCount=function(){return 3};
TradingView.LineStudyMtpRiskReward.getTooltipText=function(a){return a&&0!=a._points.size()?1==a._points.size()?"Select Stop Bar":2==a._points.size()?"Select Target Point":null:"Select Entry Setup Bar"};
TradingView.LineStudyMtpRiskReward.prototype._studyInputs=function(){var a=this.points().item(0).index,b=this.points().item(1).index,c=this.points().item(2).index,a=this._model.mainSeries().bars().valueAt(a),b=this._model.mainSeries().bars().valueAt(b),c=this._model.mainSeries().bars().valueAt(c);return a&&b&&c?[1E3*a[TIME_PLOT],1E3*b[TIME_PLOT],1E3*c[TIME_PLOT],this.points().item(2).price,this.properties().inputs.account_size.value(),this.properties().inputs.percent_risk.value(),this.properties().inputs.tickEntryOffset.value(),
this.properties().inputs.tickStopOffset.value()]:null};TradingView.LineStudyMtpDecisionPoint=function(a,b,c){TradingView.LineStudyMtp.call(this,a,b,c);this._symbolIntervalChanged=!1;this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,this.onSymbolIntervalChanged)};inherit(TradingView.LineStudyMtpDecisionPoint,TradingView.LineStudyMtp);TradingView.LineStudyMtpDecisionPoint.prototype._mtpStudyId=function(){return"mtp_decisionpoint"};
TradingView.LineStudyMtpDecisionPoint.prototype.onSymbolIntervalChanged=function(){this._symbolIntervalChanged=!0};TradingView.LineStudyMtpDecisionPoint.prototype.pointsCount=function(){return 1};TradingView.LineStudyMtpDecisionPoint.prototype._studyInputs=function(){var a=this.points().item(0).index;return(a=this._model.mainSeries().bars().valueAt(a))?[this.properties().inputs.displayZoneLabels.value(),this._symbolIntervalChanged,1E3*a[TIME_PLOT]]:null};
TradingView.LineStudyMtpDecisionPoint.prototype.onData=function(a){TradingView.LineStudyMtp.prototype.onData.call(this,a);this._symbolIntervalChanged=!1};TradingView.LineStudyMtpElliotWave=function(a,b,c){TradingView.LineStudyMtp.call(this,a,b,c)};inherit(TradingView.LineStudyMtpElliotWave,TradingView.LineStudyMtp);TradingView.LineStudyMtpElliotWave.prototype.pointsCount=function(){return 1};TradingView.LineStudyMtpElliotWave.prototype._studyInputs=function(){var a=this.points().item(0).index;return(a=this._model.mainSeries().bars().valueAt(a))?[this.properties().inputs.displayZoneLabels.value(),1E3*a[TIME_PLOT]]:null};
TradingView.LineStudyMtpElliotWaveMain=function(a,b,c){TradingView.LineStudyMtpElliotWave.call(this,a,b,c)};inherit(TradingView.LineStudyMtpElliotWaveMain,TradingView.LineStudyMtpElliotWave);TradingView.LineStudyMtpElliotWaveMain.prototype._mtpStudyId=function(){return"mtp_ew_main"};TradingView.LineStudyMtpElliotWaveMajor=function(a,b,c){TradingView.LineStudyMtpElliotWave.call(this,a,b,c)};inherit(TradingView.LineStudyMtpElliotWaveMajor,TradingView.LineStudyMtpElliotWave);
TradingView.LineStudyMtpElliotWaveMajor.prototype._mtpStudyId=function(){return"mtp_ew_major"};TradingView.LineStudyMtpElliotWaveMinor=function(a,b,c){TradingView.LineStudyMtpElliotWave.call(this,a,b,c)};inherit(TradingView.LineStudyMtpElliotWaveMinor,TradingView.LineStudyMtpElliotWave);TradingView.LineStudyMtpElliotWaveMinor.prototype._mtpStudyId=function(){return"mtp_ew_minor"};TradingView.LineStudyMtpAnalysis=function(a,b,c){TradingView.LineStudyMtp.call(this,a,b,c)};inherit(TradingView.LineStudyMtpAnalysis,TradingView.LineStudyMtp);TradingView.LineStudyMtpAnalysis.prototype._mtpStudyId=function(){return"mtp_tsanalysis"};TradingView.LineStudyMtpAnalysis.prototype.pointsCount=function(){return 1};
TradingView.LineStudyMtpAnalysis.prototype._studyInputs=function(){var a=this.points().item(0).index;return(a=this._model.mainSeries().bars().valueAt(a))?[this.properties().inputs.displayZoneLabels.value(),1E3*a[TIME_PLOT],this.properties().inputs.account_size.value(),this.properties().inputs.percent_risk.value(),this.properties().inputs.tickEntryOffset.value(),this.properties().inputs.tickStopOffset.value(),this.properties().inputs.minRRRatio.value(),this.properties().inputs.shouldFilterWPTZones.value(),
this.properties().inputs.shouldFilterSTFTrends.value()]:null};TradingView.LineStudyMtpWaveProjectionTargets=function(a,b,c,d,e){this._wptStudyId=d;this._pointsCount=e;TradingView.LineStudyMtp.call(this,a,b,c)};inherit(TradingView.LineStudyMtpWaveProjectionTargets,TradingView.LineStudyMtp);
TradingView.LineStudyMtpWaveProjectionTargets.prototype._studyInputs=function(){for(var a=[this.properties().inputs.displayZoneLabels.value()],b=0;b<this.pointsCount();++b){var c=this.points().item(b).index,c=this._model.mainSeries().bars().valueAt(c);if(!c)return null;a.push(1E3*c[TIME_PLOT])}return a};TradingView.LineStudyMtpWaveProjectionTargets.prototype._mtpStudyId=function(){return this._wptStudyId};TradingView.LineStudyMtpWaveProjectionTargets.prototype.pointsCount=function(){return this._pointsCount};
TradingView.LineStudyMtpDownWave1OrA=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_down1ora",2)};inherit(TradingView.LineStudyMtpDownWave1OrA,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpDownWave1OrA.getTooltipText=function(a){return"Down Wave 1 or A: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpDownWave2OrB=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_down2orb",2)};
inherit(TradingView.LineStudyMtpDownWave2OrB,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpDownWave2OrB.getTooltipText=function(a){return"Down Wave 2 or B: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpDownWave3=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_down3",3)};inherit(TradingView.LineStudyMtpDownWave3,TradingView.LineStudyMtpWaveProjectionTargets);
TradingView.LineStudyMtpDownWave3.getTooltipText=function(a){return"Down Wave 3: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpDownWave4=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_down4",2)};inherit(TradingView.LineStudyMtpDownWave4,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpDownWave4.getTooltipText=function(a){return"Down Wave 4: Select Point "+((a?a._points.size():0)+1)};
TradingView.LineStudyMtpDownWave5=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_down5",5)};inherit(TradingView.LineStudyMtpDownWave5,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpDownWave5.getTooltipText=function(a){return"Down Wave 5: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpDownWaveC=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_downc",3)};
inherit(TradingView.LineStudyMtpDownWaveC,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpDownWaveC.getTooltipText=function(a){return"Down Wave C: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpUpWave1OrA=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_up1ora",2)};inherit(TradingView.LineStudyMtpUpWave1OrA,TradingView.LineStudyMtpWaveProjectionTargets);
TradingView.LineStudyMtpUpWave1OrA.getTooltipText=function(a){return"Up Wave 1 or A: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpUpWave2OrB=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_up2orb",2)};inherit(TradingView.LineStudyMtpUpWave2OrB,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpUpWave2OrB.getTooltipText=function(a){return"Up Wave 2 or B: Select Point "+((a?a._points.size():0)+1)};
TradingView.LineStudyMtpUpWave3=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_up3",3)};inherit(TradingView.LineStudyMtpUpWave3,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpUpWave3.getTooltipText=function(a){return"Up Wave 3: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpUpWave4=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_up4",2)};
inherit(TradingView.LineStudyMtpUpWave4,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpUpWave4.getTooltipText=function(a){return"Up Wave 4: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpUpWave5=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_up5",5)};inherit(TradingView.LineStudyMtpUpWave5,TradingView.LineStudyMtpWaveProjectionTargets);
TradingView.LineStudyMtpUpWave5.getTooltipText=function(a){return"Up Wave 5: Select Point "+((a?a._points.size():0)+1)};TradingView.LineStudyMtpUpWaveC=function(a,b,c){TradingView.LineStudyMtpWaveProjectionTargets.call(this,a,b,c,"mtp_wpt_upc",3)};inherit(TradingView.LineStudyMtpUpWaveC,TradingView.LineStudyMtpWaveProjectionTargets);TradingView.LineStudyMtpUpWaveC.getTooltipText=function(a){return"Up Wave C: Select Point "+((a?a._points.size():0)+1)};function MarkRenderer(a){this._data=a}MarkRenderer.prototype.draw=function(a){if(0!==this._data.points.size()){var b=this._data.points.item(0).x+this._data.offsetX,c=this._data.points.item(0).y+this._data.offsetY;a.translate(-0.5,-0.5);a.drawImage(this._data.image,b,c,this._data.width,this._data.height)}};
MarkRenderer.prototype.hitTest=function(a){if(0===this._data.points.size())return null;var b=this._data.points.item(0).clone();this._data.offsetX&&(b.x+=this._data.offsetX);this._data.offsetY&&(b.y+=this._data.offsetY);return MathEx.pointInRect(a,b,b.add(new MathEx.Point(this._data.width,this._data.height)))?new HitTestResult(HitTestResult.MOVEPOINT):null};
function MarkPaneView(a,b,c,d,e,f,g){LineSourcePaneView.call(this,a,b);this._image=c;this._offsetX=f||0;this._offsetY=g||0;this._width=d;this._height=e}inherit(MarkPaneView,LineSourcePaneView);MarkPaneView.prototype.setAnchors=function(a){this._anchorsOffset=a};
MarkPaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._source.properties().color.value();a.image=this._image;a.offsetX=this._offsetX;a.offsetY=this._offsetY;a.width=this._width;a.height=this._height;if(this.isAnchorsRequired()&&1==a.points.size()){var b=new CompositeRenderer;b.append(new MarkRenderer(a));if(this._anchorsOffset){for(var c=new List,d=0;d<a.points.size();d++)c.append(a.points.item(d).clone().add(this._anchorsOffset));b.append(new SelectionRenderer({points:c}))}else b.append(new SelectionRenderer({points:a.points}));
return b}return new MarkRenderer(a)};MarkPaneView.prototype.update=function(){LineSourcePaneView.prototype.update.call(this)};ChartModel.version=2;ChartModel.prototype.state=function(a){for(var b={panes:[]},c=0;c<this.panes().size();c++)b.panes.push(this.panes().item(c).state(!0,a));b.timeScale=this.m_timeScale.state(a);b.chartProperties={paneProperties:this.properties().paneProperties.state(),scalesProperties:this.properties().scalesProperties.state()};b.version=ChartModel.version;b.timezone=this.timezone();return b};
ChartModel.prototype.restoreState=function(a,b){if(a.panes)if(isArray(a.panes))if(1>a.panes.length)TradingView.logDebug("ChartModel.restoreState: invalid state");else{a.chartProperties&&!a.chartProperties.timezone&&(a.chartProperties.timezone=a.timezone);a.chartProperties&&(this._properties.paneProperties.merge(a.chartProperties.paneProperties),this._properties.scalesProperties.merge(a.chartProperties.scalesProperties),a.chartProperties.timezone&&this._properties.timezone.setValue(a.chartProperties.timezone));
a.timeScale&&this.m_timeScale.restoreState(a.timeScale,b);var c=a.panes;this.panes().item(0).restoreState(c[0],b,a.version);for(c=1;c<a.panes.length;c++)(this.panes().item(c)||this.createPane()).restoreState(a.panes[c],b,a.version);this._invalidateBarColorerCaches();for(var d=this.dataSources(),c=0;c<d.size();c++){var e=d.item(c);isInherited(e.constructor,LineDataSource)&&e.calcIsActualSymbol()}this._version=a.version;this.timeScale().recalcLockedScale();this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))}else TradingView.logDebug("ChartModel.restoreState: invalid state");
else TradingView.logDebug("ChartModel.restoreState: invalid state")};
ChartModel.prototype.restoreAxisState=function(a){if(a.panes)if(isArray(a.panes))if(1>a.panes.length)TradingView.logDebug("ChartModel.restoreAxisState: invalid state");else{this.m_timeScale.restoreState(a.timeScale,!1,!0);for(var b=0;b<a.panes.length;b++){var c=this.panes().item(b);c.m_leftPriceScale.restoreState(a.panes[b].leftAxisState);c.m_rightPriceScale.restoreState(a.panes[b].rightAxisState)}this.recalculateAllPanes();this.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))}else TradingView.logDebug("ChartModel.restoreAxisState: invalid state");else TradingView.logDebug("ChartModel.restoreAxisState: invalid state")};
Pane.prototype.state=function(a,b,c){var d={};if(a)for(d.sources=[],a=0;a<this.m_dataSources.size();a++)c&&!this.m_dataSources.item(a).isSavedInStudyTemplates()||d.sources.push(this.m_dataSources.item(a).state(b));d.leftAxisState=this.m_leftPriceScale.state();d.leftAxisSources=[];for(a=0;a<this.m_leftPriceScale.dataSources().size();a++)c&&!this.m_leftPriceScale.dataSources().item(a).isSavedInStudyTemplates()||d.leftAxisSources.push(this.m_leftPriceScale.dataSources().item(a).id());d.rightAxisState=
this.m_rightPriceScale.state();d.rightAxisSources=[];for(a=0;a<this.m_rightPriceScale.dataSources().size();a++)c&&!this.m_rightPriceScale.dataSources().item(a).isSavedInStudyTemplates()||d.rightAxisSources.push(this.m_rightPriceScale.dataSources().item(a).id());d.overlayPriceScales={};for(a=0;a<this.m_dataSources.size();a++)b=this.m_dataSources.item(a),this.isOverlay(b)&&(d.overlayPriceScales[b.id()]=b.priceScale().state());d.stretchFactor=this._stretchFactor;this.m_mainDataSource&&(d.mainSourceId=
this.m_mainDataSource.id());return d};Pane.prototype.sourceById=function(a){for(var b=0;b<this.m_dataSources.size();b++)if(this.m_dataSources.item(b).id()===a)return this.m_dataSources.item(b);return null};
Pane.prototype.restoreState=function(a,b,c){if(!a.leftAxisState||!a.rightAxisState)throw Error("invalid state");if(!a.leftAxisSources||!a.rightAxisSources)throw Error("invalid state");a.stretchFactor&&(this._stretchFactor=a.stretchFactor);var d={};if(a.sources){var e=this.m_dataSources.contains(this._model.mainSeries());this.clearSeries();e&&this.m_dataSources.append(this._model.mainSeries());for(var f=0;f<a.sources.length;f++){var g=a.sources[f].type,h=a.sources[f].id;d[h]=a.sources[f].ownerSource;
var k=a.sources[f].state,m=a.sources[f].zorder;if("MainSeries"===g){e||(this._model.paneForSource(this._model.mainSeries()).removeDataSource(this._model.mainSeries()),this.m_dataSources.append(this._model.mainSeries()));var n=k&&k.style?k.style:void 0,g=n==TradingView.Series.STYLE_PNF&&k.pnfStyle.lockScale;k&&!k.lockScale&&(k.lockScale=g);n==TradingView.Series.STYLE_PNF&&"ATR"==this._model.mainSeries().properties().pnfStyle.inputs.style.value()?this._model.mainSeries().properties().pnfStyle.inputs.style._value=
"Traditional":n==TradingView.Series.STYLE_RENKO&&"ATR"==this._model.mainSeries().properties().renkoStyle.inputs.style.value()&&(this._model.mainSeries().properties().renkoStyle.inputs.style._value="Traditional");k&&!k.hasOwnProperty("showSessions")&&(k.showSessions=!1);k&&!k.extendedHours&&(k.extendedHours=!1);this._model.mainSeries().properties().merge(k);this._model.mainSeries()._prevChartStyle=this._model.mainSeries().properties().style.value();this._model.mainSeries().createPaneView();this._model.mainSeries().setId(h);
b&&this._model.mainSeries().restoreData(a.sources[f].bars,a.sources[f].nsBars,a.sources[f].symbolInfo,a.sources[f].rtPrice,a.sources[f].boxSize);void 0!==m&&this._model.mainSeries().setZorder(m);this._model.mainSeries().properties().extendedHours.listeners().fire(this._model.mainSeries().properties().extendedHours)}else{if(g.toLowerCase().startsWith("study")){var q=TradingView.clone(a.sources[f].metaInfo);$.extend(q,StudyMetaInfo.parseIdString(q.id));var l=k,n=this._model.studyVersioning(),k=n.patchPropsStateAndMetaInfo(l,
q),l=k.propsState,q=k.metaInfo,g=TradingView.prepareStudyPropertiesForLoadChart(q,l,null,n),q=(k=n.updateMetaInfo(q))?k:q,g=TradingView.createStudy(this._model,g,this._model.mainSeries(),q);g.setId(h);this.m_dataSources.append(g);b&&(k=n.patchStudyData(q,a.sources[f].data,a.sources[f].nonSeriesData,a.sources[f].indexes),g.restoreData(k.data,k.nsData,k.indexes))}else{q=TradingView[g];assert(isInherited(q,LineDataSource),"invalid data source type:"+g+" (expected to be a Line Tool)");for(var n=a.sources[f].points,
l=!1,s=0;s<n.length;s++)if(1E4<Math.abs(n[s].offset)){l=!0;break}if(l)continue;n=null;l=factoryDefaults("linetool");isInherited(q,TradingView.StudyLineDataSource)?(n=this._model.studyVersioning(),a.sources[f]=n.patchPointsBasedStudyState(a.sources[f]),k=a.sources[f].state,TradingView.merge(l,k),q=a.sources[f].metaInfo,$.extend(q,StudyMetaInfo.parseIdString(q.fullId)),l=TradingView.prepareStudyPropsStateForLoadChart(q,l,null,n),q=(k=n.updateMetaInfo(q))?k:q,b?TradingView.merge(l,{fixedSize:!1}):TradingView.merge(l,
{fixedSize:!0}),k=new DefaultProperty("study_"+q.id,l,!0),g=new TradingView[g](this._model,k,q)):(q=g.toLowerCase(),TradingView.merge(l,factoryDefaults(q)),TradingView.merge(l,k),b?TradingView.merge(l,{fixedSize:!1}):TradingView.merge(l,{fixedSize:!0}),k=new DefaultProperty(g.toLowerCase(),l),g=new TradingView[g](this._model,k));g.setId(h);l=a.sources[f].indexes?a.sources[f].indexes:[];l=l.slice(0,a.sources[f].points.length);g.isFixed()?g.restorePositionPercents(a.sources[f].positionPercents):g.restorePoints(a.sources[f].points,
l,b);g instanceof TradingView.LineToolBarsPattern||g instanceof TradingView.LineToolCallout||g instanceof TradingView.LineToolTrendAngle?g.restoreData(a.sources[f]):b&&g.restoreData&&(l=a.sources[f],n&&(l.graphics=n.patchPointsBasedStudyData(l.metaInfo,l.graphics)),g.restoreData(l));n=null==a.sources[f].version?1:a.sources[f].version;l=null==g.version?1:g.version;n!=l&&"function"===typeof g.migrateVersion&&g.migrateVersion(n,l,{pane:this,model:this._model,properties:k});this.m_dataSources.append(g)}void 0!==
m&&g.setZorder(m)}}}this.m_leftPriceScale.dataSources().clear();this.m_leftPriceScale._hasSeries=!1;l=defaults("chartproperties").paneProperties.leftAxisProperties;TradingView.merge(l,a.leftAxisState);this.m_leftPriceScale.restoreState(l);for(f=0;f<a.leftAxisSources.length;f++)if(g=this.dataSourceForId(a.leftAxisSources[f]))this.m_leftPriceScale.addDataSource(g),g.setPriceScale(this.m_leftPriceScale);this.m_rightPriceScale.dataSources().clear();this.m_rightPriceScale._hasSeries=!1;l=defaults("chartproperties").paneProperties.rightAxisProperties;
TradingView.merge(l,a.rightAxisState);this.m_rightPriceScale.restoreState(l);for(f=0;f<a.rightAxisSources.length;f++)if(g=this.dataSourceForId(a.rightAxisSources[f]))this.m_rightPriceScale.addDataSource(g),g.setPriceScale(this.m_rightPriceScale);for(f=0;f<this.m_dataSources.size();f++)g=this.m_dataSources.item(f),this.m_rightPriceScale.dataSources().contains(g)||this.m_leftPriceScale.dataSources().contains(g)?g._isOverlay=!1:(g._isOverlay=!0,b=new PriceScale(this._properties.overlayPropreties),b.setHeight(this.m_height),
b.setTopMargin(this.m_rightPriceScale.topMargin()),b.setBottomMargin(this.m_rightPriceScale.bottomMargin()),b.addDataSource(g),a.overlayPriceScales&&a.overlayPriceScales[g.id()]&&(l=a.overlayPriceScales[g.id()],l.m_isAutoScale=!0,l.m_isLog=!1,l.m_isPercentage=!1,b.restoreState(l)),g.setPriceScale(b));for(h in d)(f=d[h])&&(g=this.sourceById(h))&&this.sourceById(h).setOwnerSource(this.sourceById(f));for(f=0;f<this.m_dataSources.size();f++)if(g=this.m_dataSources.item(f),isInherited(g.constructor,PriceDataSource)){this.m_mainDataSource=
g;break}for(f=0;f<this.m_dataSources.size();f++)g=this.m_dataSources.item(f),isInherited(g.constructor,LineDataSource)&&(g.ownerSource()||g.setOwnerSource(this.mainDataSource()),g.isFixed()&&g.restoreFixedPoints(),1==c&&g.priceScale().isPercent()&&!g.isFixed()&&g.correctPricesToPercents());a.mainSourceId&&(this.m_mainDataSource=this.dataSourceForId(a.mainSourceId));this._updateMargins();this._cachedHitTestSources=this._cachedOrderedSoruces=null};
ChartModel.prototype.studyTemplate=function(a){for(var b={panes:[]},c=0;c<this.panes().size();c++)b.panes.push(this.panes().item(c).state(!0,!1,!0));a&&(b.interval=this.mainSeries().interval());b.version=ChartModel.version;return b};ChartModel.prototype.restoreStudyTemplate=function(a,b){this._undoModel.studyLoadTemplate(this._undoModel,this.studyTemplate(),a,b)};
ChartModel.prototype.theme=function(){var a={};a.chartProperties={paneProperties:this.properties().paneProperties.state(),scalesProperties:this.properties().scalesProperties.state(),symbolWatermarkProperties:this.properties().symbolWatermarkProperties.state()};a.mainSourceProperties=this.mainSeries().state().state;delete a.mainSourceProperties.symbol;delete a.mainSourceProperties.interval;delete a.chartProperties.paneProperties.topMargin;delete a.chartProperties.paneProperties.bottomMargin;a.version=
ChartModel.version;return a};ChartModel.prototype.restoreTheme=function(a){var b={hollowCandle:{related:"candle"}},c;for(c in b)if(!a.mainSourceProperties[c+"Style"]){var d=a.mainSourceProperties[c+"Style"]=factoryDefaults("chartproperties.mainSeriesProperties."+c+"Style"),e=a.mainSourceProperties[b[c].related+"Style"],f;for(f in e)f in d&&(d[f]=e[f])}this._undoModel.chartLoadTheme(this,a)};function fixLineToolsPositions(a,b,c){var d=a.allLineTools(),e=d.size();a=a.timeScale();a.points();for(var f=0;f<e;++f){for(var g=d.item(f),h=0,k=g.points(),m=k.size(),n=0;n<m;++n){var q=k.item(n);q.time>b&&q.time<=c&&(q.index=a.m_points.indexOf(q.time),++h)}0<h&&g.updateAllViews()}}
TradingView.requestChartSnapshotBars=function(a,b){function c(c){a._currentRequest.requestFirstBarTime(c,f,function(e){e.p[1]>g?(a._currentRequest.disconnect(),delete a._currentRequest,a._haveNoMoreData=!0,b()):d(c)})}function d(c){var d=1;a._haveNoMoreData=!0;var k=!1;a._currentRequest.createSeries("series_id","turnaround",c,f,["bar_count",g-1,-m],function(c){switch(c.method){case "data_update":if(!c.params.plots.length)break;var f=c.params.plots[0].value[TIME_PLOT],l=c.params.plots;a._haveNoMoreData=
l.length<m;k=0==l.length;n=f==g;e.mainSeries().fixLastBar();e.mainSeries().bars().addTail(l,n);c=e.mainSeries().parseJapProjBars(c.params.nonseries);e.mainSeries().m_data.m_nsBars=c.nsBars;e.mainSeries().m_data.lastProjectionPrice=c.lastPrice;e.model().recalculateAllPanes();e.model().updateSource(e.mainSeries());e.model().updateLineTools();e.timeScale().scrollToOffsetAnimated(h);break;case "series_completed":d--,0===d&&(a._currentRequest.disconnect(),delete a._currentRequest,b())}});c=e.dataSources();
for(var q={},t=0;t<c.size();t++){var B=c.item(t);if(isInherited(B.constructor,TradingView.Study)&&-1!==["Volume","Compare","Overlay","Sessions"].indexOf(B.metaInfo().shortId)){var A="study_"+t,w=B.metaInfo().id+"-1!";q[A]=B;d++;a._currentRequest.createStudy(A,"turnaround","series_id",w,B.inputs(),function(c){var f=c.method;"study_completed"===f||"study_error"===f?(d--,0===d&&(a._currentRequest.disconnect(),delete a._currentRequest,b())):"data_update"!==f||k||(q[c.params.customId].m_data.addTail(c.params.plots,
n),e.model().recalculateAllPanes(),e.model().updateSource(e.mainSeries()))})}}}var e=a.model(),f=e.mainSeries().interval(),g=e.mainSeries().bars().last().value[TIME_PLOT];"function"!==typeof b&&(b=new Function);if(null!=a._currentRequest)TradingView.logDebug("requestSnapshotBars: unexpected requestSnapshotBars");else{var h=e.timeScale().rightOffset();if(!(0>h||a._haveNoMoreData)){var k=e.mainSeries().getSymbolString(),m=Math.max(Math.ceil(h),100),n=!1,q=new TVChartApi;!window.user||"pro_realtime"!==
user.pro_plan&&"pro_realtime_trial"!==user.pro_plan||q.authTokenRequired(!0);a._currentRequest=new ChartSession(q);a._currentRequest.connect(function(b){if("connected"===b.method){b=e.model().timezone();b||(b=defaults("chartproperties").mainSeriesProperties.timezone);a._currentRequest.switchTimezone(b);var d="symbol_id",f=function(b){switch(b.method){case "symbol_error":if(b.params[1]==TradingView.Series.PERMISSION_DENIED){switch(b.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:e.mainSeries().properties().extendedHours.setValue(!1);
b=e.mainSeries().getSymbolString();break;case TradingView.Series.PD_REASON_SYMBOL:b=b.params[3];break;default:b=b.params[2]}b&&(d+="_re",a._currentRequest.resolveSymbol(d,b,f))}break;default:c(d)}};a._currentRequest.resolveSymbol(d,k,f)}else if("timescale_update"===b.method){var g=e.mainSeries().bars().last(),h=e.timeScale().indexToUserTime(g).valueOf()/1E3,g=e.timeScale().points(),m=g.lastTimePointIndex(),m=g.valueAt(m);if(0<b.params.changes.length){var n=b.params.changes[0]==m;n||(h+=1);e.timeScale().addTail(b,
h,n);b=g.lastTimePointIndex();b=g.valueAt(b);fixLineToolsPositions(e.model(),m,b)}}})}}};function FutureBarsRenderer(a){this._data=a}FutureBarsRenderer.prototype.hitTest=function(){return null};FutureBarsRenderer.prototype.draw=function(a){a.fillStyle="rgba(195,255,160, 0.3)";a.fillRect(Math.max(0,this._data.x),0,this._data.width,this._data.height);a.strokeStyle="#308020";a.beginPath();a.lineWidth=1;var b=Math.round(this._data.x);a.moveTo(b,0);a.lineTo(b,this._data.height);a.stroke()};
TradingView.FutureBarsPaneView=function(a,b){this._series=a;this._lastBar=b};TradingView.FutureBarsPaneView.prototype.update=function(){this._x=this._series.m_model.timeScale().indexToCoordinate(this._lastBar)-0.5*this._series.m_model.timeScale().barSpacing()+1};TradingView.FutureBarsPaneView.prototype.renderer=function(){var a={x:this._x,height:this._series.priceScale().height(),width:this._series.m_model.timeScale().width()};return new FutureBarsRenderer(a)};function BarsMarksContainer(a){var b=a._undoModel._chartWidget,c=b.onWidget(),d=!1,d=c?b._options&&!b._options.hideIdeas:TVSettings.getBool("BarsMarksContainer.visibile",!1),b=new Property({visible:d,frozen:!1});c||b.visible.listeners().subscribe(null,function(a){TVSettings.setValue("BarsMarksContainer.visibile",!!a.value())});LineDataSource.call(this,a,null,b);this.onNeedRepaint=new Delegate;this._requests=[];this._marks={};this._collectedRange=this._getDataTimeout=this._loadedRange=null;this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,
this.getNewData);this._model.mainSeries().onSymbolResolved().subscribe(this,this.getNewData);this._model.mainSeries().onTickmarksRangeChanged().subscribe(this,this.getData);this._initialize();this._tooltip=this._createTooltip()}inherit(BarsMarksContainer,LineDataSource);BarsMarksContainer.prototype._constructor="Child class must override this member";BarsMarksContainer.prototype._initialize=function(a){throw"Child class must override this member";};
BarsMarksContainer.prototype.onClicked=function(){throw"Child class must override this member";};BarsMarksContainer.prototype._getData=function(a){throw"Child class must override this member";};BarsMarksContainer.prototype._createTooltip=function(){throw"Child class must override this member";};BarsMarksContainer.prototype.updatePlateData=function(a,b){};BarsMarksContainer.prototype._plateViewData=function(a){return{}};BarsMarksContainer.prototype.timeScale=function(){return this._model.timeScale()};
BarsMarksContainer.prototype.getIntervalInTicks=function(){function a(a){a=parseInt(a);if(a!=a)throw new TypeError("Unexpected interval");return 60*a}var b=a(1440),c=7*b,d=31*b,e=this._model.mainSeries().properties().interval.value();switch(e){case "M":return d;case "W":return c;case "D":return b;default:return a(e)}};BarsMarksContainer.prototype._maxDate=new Date(2037,0,1);
BarsMarksContainer.prototype.getVisibleTickmarksRange=function(){if(this.timeScale().isEmpty())return{start:0,end:0};var a=this.timeScale().visibleBars();if(!(a.lastBar()>this.timeScale().points().firstTimePointIndex()&&a.firstBar()<this.timeScale().points().lastTimePointIndex()))return{start:0,end:0};end=a.lastBar()<this.timeScale().points().lastTimePointIndex()?this.timeScale().indexToTimePoint(a.lastBar()):this._maxDate;a={start:this.timeScale().indexToTimePoint(Math.max(a.firstBar(),this.timeScale().points().firstTimePointIndex())),
end:end};return a={start:a.start.getTime()/1E3,end:a.end.getTime()/1E3}};BarsMarksContainer.prototype.getVisibleRangePlates=function(){var a=[],b=this.getVisibleTickmarksRange(),c=this.getIntervalInTicks();$.each(this._marks,function(d,e){e.tickmark>=b.start&&e.tickmark<=b.end+c&&a.push(e)});return a};BarsMarksContainer.prototype._maxPlatesPerBar=10;
BarsMarksContainer.prototype.filterDisplayedPlates=function(a){a=a.reduce(function(a,c){var d=this._getIndex(c.tickmark);a[d]||(a[d]=[]);a[d].push(c);return a}.bind(this),{});return a=Object.keys(a).reduce(function(b,c){var d=a[c],d=d.sort(function(a,b){return b.views_count-a.views_count}),d=d.slice(0,this._maxPlatesPerBar);return b.concat(d)},[])};BarsMarksContainer.prototype._layout=function(a){switch(a){default:case 0:return"up";case 1:return"down";case 2:return"up";case 3:case 4:case 5:case 6:return"up"}};
BarsMarksContainer.prototype._theme=function(a){switch(a){default:case 0:return"neutral";case 1:return"green";case 2:return"red";case 3:return"yellow";case 4:return"blue";case 5:return"green";case 6:return"red"}};BarsMarksContainer.prototype._offset=function(a,b){var c;switch(a){default:case "up":c=b[HIGH_PLOT];break;case "down":c=b[LOW_PLOT]}this.priceScale().isPercent()&&(c=this.priceScale().priceRange().convertToPercent(c,this.ownerSource().firstValue()));return this.priceScale().priceToCoordinate(c)};
BarsMarksContainer.prototype._getIndex=function(a){for(var b=this.timeScale().points(),c=this.timeScale().points().items(),d,e=0;e<b.size();e++)if(a>=c[e]&&a<c[e+1]){d=b.offsetToIndex(e);break}return void 0==d?b.lastTimePointIndex():d};BarsMarksContainer.prototype.getViewData=function(){return{barWidth:this.barWidth(),plates:this.getPlatesViewData(),tooltip:this._tooltip}};BarsMarksContainer.prototype.barWidth=function(){return this.timeScale().barSpacing()};
BarsMarksContainer.prototype.getPlatesViewData=function(){if(this._model.mainSeries().data().isEmpty())return[];var a=this.filterDisplayedPlates(this.getVisibleRangePlates()),b={},c=this._model.lastHittestData(),a=a.map(function(a){var e=this._getIndex(a.tickmark),f=this._getBar(e);if(!f)return!1;var g=this._layout(a.direction),h=this._theme(a.direction),k=c&&c.id==a.id,m=this.timeScale().indexToCoordinate(e),f=this._offset(g,f),n=0;e in b||(b[e]={up:0,down:0});n=b[e][g]++;return TradingView.merge({id:a.id,
x:m,y:f,order:n,direction:g,theme:h,hovered:k},this._plateViewData(a))}.bind(this));return a=a.filter(function(a){return!!a})};BarsMarksContainer.prototype._getBar=function(a){return this._model.mainSeries().data().valueAt(a)};BarsMarksContainer.prototype.paneViews=function(a){var b=this;return this._properties.visible.value()?(new List).append(new BarsMarksContainerPaneView(this,a,function(a){return new BarsMarksContainerRenderer(a.getViewData(),b)})):new List};
BarsMarksContainer.prototype.dataWindowView=function(){return null};BarsMarksContainer.prototype.priceAxisViews=function(){return null};BarsMarksContainer.prototype.statusView=function(){return null};BarsMarksContainer.prototype.updateAllViews=function(){};BarsMarksContainer.prototype.pointsCount=function(){return 0};BarsMarksContainer.prototype.properties=function(){return this._properties};BarsMarksContainer.prototype.state=function(){return{type:"BarsMarksContainer",id:this.id(),zorder:this._zOrder}};
BarsMarksContainer.prototype._rangeDifference=function(a){a=$.extend({},a);this._loadedRange&&(a.start<this._loadedRange.start?a.end=this._loadedRange.start:a.end>this._loadedRange.end&&(a.start=this._loadedRange.end));return a};BarsMarksContainer.prototype._rangeUnion=function(a,b){a=$.extend({},a);b&&(a.start=Math.min(b.start,a.start),a.end=Math.max(b.end,a.end));return a};
BarsMarksContainer.prototype._pushGetDataStack=function(a){if(!a.end||!a.start)throw new TypeError("Wrong tickmark range");this._getDataTimeout&&clearTimeout(this._getDataTimeout);this._collectedRange=this._rangeUnion(a,this._collectedRange);this._getDataTimeout=setTimeout(function(){this._getData(this._collectedRange);this._getDataTimeout=this._collectedRange=null}.bind(this),300)};BarsMarksContainer.prototype.roundRange=function(a){return{start:Math.round(a.start),end:Math.round(a.end)}};
BarsMarksContainer.prototype.getData=function(a){if(!a.start||!a.end)throw new TypeError("Wrong range");a=$.extend({},a);a.end=this._maxDate/1E3;this._pushGetDataStack(a)};BarsMarksContainer.prototype._abortAllRequests=function(){this._requests.forEach(function(a){a.abort()});this._requests=[];this._getDataTimeout&&clearTimeout(this._getDataTimeout);this._getDataTimeout=this._collectedRange=null};
BarsMarksContainer.prototype.getNewData=function(){this._abortAllRequests();this._marks={};this._loadedRange=null};function BarsMarksContainerPaneView(a,b,c){this.source=a;this.pane=b;this._rendererFactory=c}BarsMarksContainerPaneView.prototype.update=function(){};BarsMarksContainerPaneView.prototype.renderer=function(){return this._rendererFactory(this.source)};function BarsMarksContainerRenderer(a,b){this._barWidth=a.barWidth;this._plates=a.plates;this._tooltip=a.tooltip;this._model=b}
BarsMarksContainerRenderer.prototype.draw=function(a){a.save();this._plates.forEach(this._drawItem.bind(this,a));var b=this._getHoveredItem(this._plates);b?this._drawHoveredItem(a,b):this._tooltip.hide();a.restore()};BarsMarksContainerRenderer.prototype._getHoveredItem=function(a){return a.filter(function(a){return a.hovered})[0]};BarsMarksContainerRenderer.prototype._drawItem=function(a,b){this._drawDot(a,this._dotTransform(b))};
BarsMarksContainerRenderer.prototype._drawHoveredItem=function(a,b){this._drawPlate(a,this._plateTransform(b))};BarsMarksContainerRenderer.prototype._commonTransform=function(a){var b=this._barWidth+4,b=a.y+{up:-1,down:1}[a.direction]*(b*(a.order+0.6)+0.25*b);return{id:a.id,theme:this.themes[a.theme+(a.hovered?"_hovered":"")],themeName:a.theme,x:Math.round(a.x+1),y:Math.round(b)}};
BarsMarksContainerRenderer.prototype._dotTransform=function(a){a=this._commonTransform(a);a.radius=0.4*this._barWidth;return a};BarsMarksContainerRenderer.prototype._plateTransform=function(a){var b=this._commonTransform(a);return this._model.updatePlateData(a,b)};BarsMarksContainerRenderer.THEMES=["green","red","neutral","yellow","blue"];
BarsMarksContainerRenderer.prototype.themes={green:{border:"#78C143",background:"#8DDD54",dotBorderWidth:2},red:{border:"#CC4545",background:"#ED5A5A ",dotBorderWidth:2},neutral:{border:"#EAC300",background:"#FFD400",dotBorderWidth:2},yellow:{border:"#EAC300",background:"#FFD400",dotBorderWidth:2},blue:{border:"#047ACE",background:"#0496FF",dotBorderWidth:2}};BarsMarksContainerRenderer.THEMES.forEach(function(a){var b=BarsMarksContainerRenderer.prototype.themes;b[a+"_hovered"]=$.extend({},b[a],{dotBorderWidth:4})});
BarsMarksContainerRenderer.prototype._drawDot=function(a,b){a.strokeStyle=b.theme.border;a.fillStyle=b.theme.background;a.lineWidth=b.theme.dotBorderWidth;a.beginPath();a.arc(b.x,b.y,b.radius,0,2*Math.PI,!0);a.closePath();a.stroke();a.fill()};BarsMarksContainerRenderer.prototype._drawPlate=function(a,b){this._tooltip.showPlate(b,a)};BarsMarksContainerRenderer.prototype.hitTest=function(a){for(var b,c=0;c<this._plates.length;c++)if(b=this._hitTestDot(this._plates[c],a))return b;return null};
BarsMarksContainerRenderer.prototype._hitTestDot=function(a,b){var c=this._dotTransform(a),d=new MathEx.Point(c.x,c.y);return MathEx.isInCircle(d,Math.max(c.radius,8),b)?new HitTestResult(HitTestResult.REGULAR,a):null};function BarMarkTooltip(){this._layout=[];this._currentId=void 0;this._createLayout()}BarMarkTooltip.prototype._createLayout=function(){throw"Child class must override this member";};BarMarkTooltip.prototype._updatePlate=function(a){throw"Child class must override this member";};
BarMarkTooltip.prototype._getContainer=function(a){this._container&&this._context===a||(this._context=a,this._container=$(a.canvas).parent());return this._container};
BarMarkTooltip.prototype.showPlate=function(a,b){this._currentId==a.id&&this._layout&&0!=this._layout.length&&null!=this._layout[0].parentNode||(this._updatePlate(a),this._getContainer(b).append(this._layout));var c=Math.round(a.barWidth/2);15<c&&(c=15);10>c&&(c=10);this._layout.css({top:a.y,right:b.canvas.width-a.x+Math.round(a.barWidth/2+c),fontSize:c+"px",display:"block"});this.isVisible=!0};
BarMarkTooltip.prototype.hide=function(){this.isVisible&&(this._layout.css({display:"none"}),this.isVisible=!1)};function UserDefinedBarsMarks(a){BarsMarksContainer.call(this,a)}inherit(UserDefinedBarsMarks,BarsMarksContainer);UserDefinedBarsMarks.prototype._initialize=function(a){this._properties.visible.setValue(!0)};UserDefinedBarsMarks.prototype._constructor="UserDefinedBarsMarks";UserDefinedBarsMarks.prototype._plateViewData=function(a){return{text:a.text}};UserDefinedBarsMarks.prototype.onClicked=function(){var a=this._model.lastHittestData().id;this._marks[a].onClicked()};
UserDefinedBarsMarks.prototype._getData=function(a){var b=this._model.mainSeries().symbolInfo();if(b){var c=this.roundRange(this._rangeDifference(a)),d=this,e=this._model.mainSeries().properties().interval.value();ChartApiInstance.getMarks(b,c.start,c.end,function(b){b.forEach(function(a){d._marks[a.id]=a},d);d._loadedRange=d._rangeUnion(a,d._loadedRange);d.onNeedRepaint.fire()},e)}};UserDefinedBarsMarks.prototype._createTooltip=function(){return new UserDefinedBarsMarksTooltip};
UserDefinedBarsMarks.prototype.updatePlateData=function(a,b){a.barWidth=this.barWidth();return a};function UserDefinedBarsMarksTooltip(a){BarMarkTooltip.call(this)}inherit(UserDefinedBarsMarksTooltip,BarMarkTooltip);UserDefinedBarsMarksTooltip.prototype._createLayout=function(){this._layout=$('<div class="bar-mark-tooltip"></div>');this._layout_text=$('<div class="text"></div>').appendTo(this._layout)};
UserDefinedBarsMarksTooltip.prototype._updatePlate=function(a){this._currentId=a.id;this._layout.removeClass(BarsMarksContainerRenderer.THEMES.join(" ")).addClass(a.themeName);this._layout_text.html(a.text);this._layout.append(this._layout_text)};function StudyOverlayTrackPricePaneView(a,b){this._source=a;this._model=b;this._points=(new List).append(new MathEx.Point(0,0))}StudyOverlayTrackPricePaneView.prototype.update=function(){this._visible=!1;if(this._source.properties().showPriceLine.value()){var a=this._source.lastValueData("close",!0);a&&(this._visible=!0,this._points=(new List).append(new MathEx.Point(0,a.coordinate)),this._color=a.color)}};
StudyOverlayTrackPricePaneView.prototype.renderer=function(){var a={};a.points=this._points;a.color=this._color;a.linewidth=1;a.linestyle=CanvasEx.LINESTYLE_DOTTED;a.hitTestResult=HitTestResult.REGULAR;a.visible=this._visible;return new HorzLineRenderer(a)};TradingView.OverlayPriceAxisView=function(a,b){this._source=a;this._model=b;this._invalidated=!0;this._text="";this._coordinate=0;this._background="black";this._color="white";this._textHeight=14};inherit(TradingView.OverlayPriceAxisView,PriceAxisView);
TradingView.OverlayPriceAxisView.prototype.update=function(){this._invalidated=!0};TradingView.OverlayPriceAxisView.prototype._updateImpl=function(){this._visible=!1;this._text="";var a=this._source.lastValueData("close",!1);a&&(this._text=a.text,this._coordinate=a.coordinate,this._textHeight=this._source.priceScale().m_markBuilder.fontHeight(),this._background=a.color,this._visible=!0)};
TradingView.OverlayPriceAxisView.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var a={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,textHeight:this._textHeight,visible:this._visible};return new PriceAxisViewRenderer(a)};
TradingView.OverlayDataWindowView=function(a,b){DataWindowView.call(this);this._study=a;this._model=b;this._items.append(new DataWindowItem("Open",""));this._items.append(new DataWindowItem("High",""));this._items.append(new DataWindowItem("Low",""));this._items.append(new DataWindowItem("Close",""));this._invalidated=!0;this.update()};inherit(TradingView.OverlayDataWindowView,DataWindowView);
TradingView.OverlayDataWindowView.prototype._updateImpl=function(){this._header=this._study.title();if(!this._model.timeScale().isEmpty()&&0!==this._study.data().size()){var a,b,c=!1;this._study.properties().style.value()===TradingView.Series.STYLE_BARS?(a=this._study.properties().barStyle.upColor.value(),b=this._study.properties().barStyle.downColor.value(),c=this._study.properties().barStyle.barColorsOnPrevClose.value()):this._study.properties().style.value()===TradingView.Series.STYLE_CANDLES?
(a=this._study.properties().candleStyle.upColor.value(),b=this._study.properties().candleStyle.downColor.value(),c=this._study.properties().candleStyle.barColorsOnPrevClose.value()):this._study.properties().style.value()===TradingView.Series.STYLE_HOLLOW_CANDLES?(a=this._study.properties().hollowCandleStyle.upColor.value(),b=this._study.properties().hollowCandleStyle.downColor.value(),c=!0):this._study.properties().style.value()===TradingView.Series.STYLE_LINE?a=b=this._study.properties().lineStyle.color.value():
this._study.properties().style.value()===TradingView.Series.STYLE_AREA&&(a=b=this._study.properties().areaStyle.linecolor.value());var d=this._study.series(),e=this._model.crossHairSource().index,d=d.nearestIndex(e,SEARCH_NEAREST_LEFT);if(void 0!==d&&(e=this._study.data().valueAt(d))&&e[OPEN_PLOT]&&e[HIGH_PLOT]&&e[LOW_PLOT]&&e[CLOSE_PLOT]){var f=this._study.formatter();this._items.item(0).setValue(f.format(e[OPEN_PLOT]));this._items.item(1).setValue(f.format(e[HIGH_PLOT]));this._items.item(2).setValue(f.format(e[LOW_PLOT]));
this._items.item(3).setValue(f.format(e[CLOSE_PLOT]));a=c&&1<=d?this._study.data().valueAt(d-1)[CLOSE_PLOT]<=e[CLOSE_PLOT]?a:b:e[OPEN_PLOT]<=e[CLOSE_PLOT]?a:b;for(b=0;4>b;b++)this._items.item(b).setColor(a)}}};TradingView.OverlayDataWindowView.prototype.items=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);return this._items};TradingView.OverlayDataWindowView.prototype.update=function(){this._invalidated=!0};
TradingView.study_Overlay=function(a,b,c,d){this._symbolLabelView=new TradingView.SymbolLabelPaneView(a,this,"close");TradingView.Study.call(this,a,b,c,d);this._paneView=this._formatter=null;var e=this;this.properties().minTick.listeners().subscribe(null,function(){e._createFormatter();e.updateAllViews();e._model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))})};inherit(TradingView.study_Overlay,TradingView.Study);
TradingView.study_Overlay.prototype.symbol=function(){var a=this.properties().inputs.symbol.value(),b=this._resolvedSymbols?this._resolvedSymbols[a]:null;return(b?b.name:a).toUpperCase()};
TradingView.study_Overlay.prototype.lastValueData=function(a,b){var c=TradingView.Study.prototype.lastValueData.call(this,"close",b);if(!c)return c;var d=this.properties(),e=c.item;switch(d.style.value()){case TradingView.Series.STYLE_BARS:c.color=e[OPEN_PLOT]<=e[CLOSE_PLOT]?d.barStyle.upColor.value():d.barStyle.downColor.value();break;case TradingView.Series.STYLE_CANDLES:c.color=e[OPEN_PLOT]<=e[CLOSE_PLOT]?d.candleStyle.upColor.value():d.candleStyle.downColor.value();break;case TradingView.Series.STYLE_HOLLOW_CANDLES:c.color=
e[OPEN_PLOT]<=e[CLOSE_PLOT]?d.candleStyle.upColor.value():d.candleStyle.downColor.value();break;case TradingView.Series.STYLE_LINE:c.color=d.lineStyle.color.value();break;case TradingView.Series.STYLE_AREA:c.color=d.areaStyle.color1.value()}return c};
TradingView.study_Overlay.prototype.createViews=function(){this._priceAxisViews=new List;this._priceAxisViewsBase=new List;this._priceAxisViewsBase.append(new TradingView.OverlayPriceAxisView(this,this._model));this._paneViews=new List;paneView=null;switch(this._properties.style.value()){case TradingView.Series.STYLE_BARS:paneView=new SeriesBarsPaneView(this,this._model);break;case TradingView.Series.STYLE_CANDLES:paneView=new SeriesCandlesPaneView(this,this._model);break;case TradingView.Series.STYLE_HOLLOW_CANDLES:paneView=
new SeriesHollowCandlesPaneView(this,this._model);break;case TradingView.Series.STYLE_LINE:paneView=new SeriesLinePaneView(this,this._properties.lineStyle.priceSource.value(),this._model);break;case TradingView.Series.STYLE_AREA:paneView=new SeriesAreaPaneView(this,this._properties.areaStyle.priceSource.value(),this._model)}this._paneViews.append(paneView);this._paneViews.append(new StudyOverlayTrackPricePaneView(this,this._model));this._paneViews.append(this._symbolLabelView);this._dataWindowView||
(this._dataWindowView=new TradingView.OverlayDataWindowView(this,this._model));this._statusView||(this._statusView=new StudyStatusView(this));this._priceAxisViews=(new List).appendAll(this._priceAxisViewsBase).appendAll(this._hlinesPriceAsisViews).appendAll(this._horizlinesPriceAsisViews)};TradingView.study_Overlay.prototype.barColorer=function(){return new SeriesBarColorer(this)};
TradingView.study_Overlay.prototype.start=function(){this._formatter=null;TradingView.Study.prototype.start.call(this);this.priceScale()&&this.priceScale().updateFormatter()};
TradingView.study_Overlay.prototype._createFormatter=function(){if("default"==this.properties().minTick.value()){var a=this.properties().inputs.symbol.value(),a=this._resolvedSymbols[a];this._formatter=new PriceFormatter(a?a.pricescale:100,a?a.minmov:1,a?a.fractional:!1)}else{var a=this.properties().minTick.value(),a=isNumber(a)?["100","1","false"]:a.split(","),b=parseInt(a[0]),c=parseInt(a[1]);this._formatter=new PriceFormatter(b,c,"true"===a[2])}this.priceScale()&&this.priceScale().updateFormatter()};
TradingView.study_Overlay.prototype.formatter=function(){this._formatter||this._createFormatter();return this._formatter};TradingView.study_Overlay.prototype._changeInputs=function(){TradingView.Study.prototype._changeInputs.call(this,this.inputs());this.m_formatter=null;this.priceScale().updateFormatter()};TradingView.study_Overlay.prototype.title=function(){var a=this.properties().inputs.symbol.value(),b=this._resolvedSymbols[a];return(b?b.name+", "+b.exchange:a).toUpperCase()};
TradingView.study_Overlay.prototype.bars=function(){return this.m_data};TradingView.study_Overlay.prototype.open=function(a){return this.bars().valueAt(a)[OPEN_PLOT]};TradingView.study_Overlay.prototype.high=function(a){return this.bars().valueAt(a)[HIGH_PLOT]};TradingView.study_Overlay.prototype.low=function(a){return this.bars().valueAt(a)[LOW_PLOT]};TradingView.study_Overlay.prototype.close=function(a){return this.bars().valueAt(a)[CLOSE_PLOT]};
TradingView.study_Overlay.prototype.hl2=function(a){return(this.high(a)+this.low(a))/2};TradingView.study_Overlay.prototype.hlc3=function(a){return(this.high(a)+this.low(a)+this.close(a))/3};TradingView.study_Overlay.prototype.ohlc4=function(a){return(this.open(a)+this.high(a)+this.low(a)+this.close(a))/4};TradingView.Study.graphicsZOrderPriority=function(a){switch(a){case "polygons":return-100;default:return 0}};TradingView.Study.StudyPaneView_horizlines=function(a,b){this._study=a;this._model=b;this._data=[]};TradingView.Study.StudyPaneView_horizlines.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_horizlines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new TrendLineRenderer(this._data[b],new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_horizlines.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().horizlines;if(a){var b=this._study.priceScale(),c=this._study._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.firstValue(),e=this._study.graphics().indexes,f=this._model.timeScale().visibleBars(),g=f.firstBar(),f=f.lastBar(),h=0;h<a.length;h++){var k=a[h];if(k.data){var m=this._study.properties().graphics.horizlines[k.styleId];if(m.visible.value())for(var n=
0;n<k.data.length;n++){var q=k.data[n],l=e[q.startIndex],s=e[q.endIndex];if(!(!q.extendRight&&Math.max(l,s)<g||!q.extendLeft&&Math.min(l,s)>f)){var u={},l=c.indexToCoordinate(l),s=c.indexToCoordinate(s),z=q.level;b.isPercent()&&(z=b.priceRange().convertToPercent(z,d));z=b.priceToCoordinate(z);l=new MathEx.Point(l,z);s=new MathEx.Point(s,z);u.points=(new List).append(l).append(s);u.extendleft=q.extendLeft;u.extendright=q.extendRight;u.width=c.width();u.height=b.height();u.color=m.color.value();u.linewidth=
m.width.value();u.linestyle=m.style.value();this._data.push(u)}}}}}};TradingView.Study.StudyPaneView_vertlines=function(a,b){this._study=a;this._model=b;this._data=[]};TradingView.Study.StudyPaneView_vertlines.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_vertlines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new TrendLineRenderer(this._data[b],new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_vertlines.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().vertlines;if(a){var b=this._study.priceScale(),c=this._study._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.firstValue(),e=this._study.graphics().indexes,f=this._model.timeScale().visibleBars(),g=f.firstBar(),f=f.lastBar(),h=0;h<a.length;h++){var k=a[h];if(k.data){var m=this._study.properties().graphics.vertlines[k.styleId];if(m.visible.value())for(var n=
0;n<k.data.length;n++){var q=k.data[n],l={};if(!(e[q.index]<g||e[q.index]>f)){var s=c.indexToCoordinate(e[q.index])+1,u=q.startPrice,z=q.endPrice,t=b.priceRange();q.extendBottom&&(u=t.minValue());q.extendTop&&(z=t.maxValue());b.isPercent()&&(u=b.priceRange().convertToPercent(u,d),z=b.priceRange().convertToPercent(z,d));u=b.priceToCoordinate(u);z=b.priceToCoordinate(z);u=new MathEx.Point(s,u);s=new MathEx.Point(s,z);l.points=(new List).append(u).append(s);l.extendleft=q.extendBottom;l.extendright=
q.extendTop;l.width=c.width();l.height=b.height();l.color=m.color.value();l.linewidth=m.width.value();l.linestyle=m.style.value();this._data.push(l)}}}}}};TradingView.Study.StudyPaneView_lines=function(a,b){this._study=a;this._model=b;this._data=[]};TradingView.Study.StudyPaneView_lines.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_lines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new TrendLineRenderer(this._data[b],new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_lines.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().lines;if(a){var b=this._study.priceScale(),c=this._study._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.firstValue(),e=this._study.graphics().indexes,f=this._model.timeScale().visibleBars(),g=f.firstBar(),f=f.lastBar(),h=0;h<a.length;h++){var k=a[h];if(k.data){var m=this._study.properties().graphics.lines[k.styleId];if(m.visible.value())for(var n=
0;n<k.data.length;n++){var q=k.data[n],l=e[q.startIndex]+(q.startOffset||0),s=e[q.endIndex]+(q.endOffset||0);if(!(!q.extendRight&&Math.max(l,s)<g||!q.extendLeft&&Math.min(l,s)>f)){var u={},l=c.indexToCoordinate(l),s=c.indexToCoordinate(s),z=q.startPrice,q=q.endPrice;b.isPercent()&&(z=b.priceRange().convertToPercent(z,d),q=b.priceRange().convertToPercent(q,d));z=b.priceToCoordinate(z);q=b.priceToCoordinate(q);l=new MathEx.Point(l,z);s=new MathEx.Point(s,q);u.points=(new List).append(l).append(s);u.color=
m.color.value();u.linewidth=m.width.value();u.linestyle=m.style.value();this._data.push(u)}}}}}};TradingView.Study.StudyPaneView_hlines=function(a,b){this._study=a;this._model=b;this._data=[];this._textData=[];this._textRendererCache={}};TradingView.Study.StudyPaneView_hlines.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_hlines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new HorzLineRenderer(this._data[b]));for(b=0;b<this._textData.length;b++)a.append(new TextRenderer(this._textData[b],this._textRendererCache,new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_hlines.prototype._updateViewInternal=function(){this._calcHorzLinesData();this._calcTextData()};
TradingView.Study.StudyPaneView_hlines.prototype._calcTextData=function(){this._textData=[];var a=this._study.graphics().hlines;if(a){var b=this._study.priceScale(),c=this._study._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.firstValue(),e=0;e<a.length;e++){var f=a[e];if(f.data){var g=this._study.properties().graphics.hlines[f.styleId];if(g.enableText.value()&&g.showText.value())for(var h=0;h<f.data.length;h++){var k=f.data[h],m={};m.text=void 0===k.text?"":k.text;m.color=
g.color.value();m.font="arial";m.fontsize=g.fontSize.value();k=k.level;b.isPercent()&&(k=b.priceRange().convertToPercent(k,d));k=b.priceToCoordinate(k);tp=g.textPos.value();var n;if(tp==CanvasEx.TEXTPOS_TOPLEFT||tp==CanvasEx.TEXTPOS_MIDDLELEFT||tp==CanvasEx.TEXTPOS_BOTTOMLEFT)n=4,m.horzAlign="left";else if(tp==CanvasEx.TEXTPOS_TOPCENTER||tp==CanvasEx.TEXTPOS_MIDDLECENTER||tp==CanvasEx.TEXTPOS_BOTTOMCENTER)n=c.width()/2,m.horzAlign="center";else if(tp==CanvasEx.TEXTPOS_TOPRIGHT||tp==CanvasEx.TEXTPOS_MIDDLERIGHT||
tp==CanvasEx.TEXTPOS_BOTTOMRIGHT)n=c.width(),m.horzAlign="right";if(tp==CanvasEx.TEXTPOS_TOPLEFT||tp==CanvasEx.TEXTPOS_TOPCENTER||tp==CanvasEx.TEXTPOS_TOPRIGHT)m.vertAlign="bottom",k-=4;else if(tp==CanvasEx.TEXTPOS_MIDDLELEFT||tp==CanvasEx.TEXTPOS_MIDDLECENTER||tp==CanvasEx.TEXTPOS_MIDDLERIGHT)m.vertAlign="middle",k-=2;else if(tp==CanvasEx.TEXTPOS_BOTTOMLEFT||tp==CanvasEx.TEXTPOS_BOTTOMCENTER||tp==CanvasEx.TEXTPOS_BOTTOMRIGHT)m.vertAlign="top";p1=new MathEx.Point(n,k);m.points=(new List).append(p1);
m.offsetX=0;m.offsetY=0;this._textData.push(m)}}}}};
TradingView.Study.StudyPaneView_hlines.prototype._calcHorzLinesData=function(){this._data=[];var a=this._study.graphics().hlines;if(a){var b=this._study.priceScale();if(b&&!b.isEmpty())for(var c=this._study.firstValue(),d=0;d<a.length;d++){var e=a[d];if(e.data){var f=this._study.properties().graphics.hlines[e.styleId];if(f.visible.value())for(var g=0;g<e.data.length;g++){var h={},k=e.data[g].level;b.isPercent()&&(k=b.priceRange().convertToPercent(k,c));k=b.priceToCoordinate(k);h.points=(new List).append(new MathEx.Point(0,
k));h.color=f.color.value();h.linewidth=f.width.value();h.linestyle=f.style.value();h.hitTestResult=HitTestResult.REGULAR;this._data.push(h)}}}}};TradingView.Study.StudyPriceAxisView_hlines=function(a,b,c,d,e){this._study=a;this._model=b;this._line=c;this._styleId=d;this._data={};this._lineType=e};inherit(TradingView.Study.StudyPriceAxisView_hlines,PriceAxisView);
TradingView.Study.StudyPriceAxisView_hlines.prototype.update=function(){this._data={};this._data.visible=!1;var a=this._study.priceScale();if(a&&!a.isEmpty()&&this._study.properties().visible.value()){var b=this._study.properties().graphics[this._lineType][this._styleId];if(b.visible&&b.visible.value()&&b.showPrice&&b.showPrice.value()){var c=this._study.firstValue();this._data.visible=!0;this._data.color="white";this._data.background=b.color.value();b=this._line.level;if(a.isPercent()){if(!isNumber(c))return;
b=a.priceRange().convertToPercent(b,c)}this._data.coordinate=a.priceToCoordinate(b);this._data.textHeight=a.m_markBuilder.fontHeight();this._data.text=a.formatter().format(b)}}};TradingView.Study.StudyPriceAxisView_hlines.prototype.renderer=function(){return new PriceAxisViewRenderer(this._data)};function TriangleTextMarkRenderer(a,b){this._data=a;this._textCache=b}
TriangleTextMarkRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font};
TriangleTextMarkRenderer.prototype.draw=function(a){if(this._data){var b="up"==this._data.direction?1:-1,c=this._data.point.x;"left"==this._data.halign?c-=this._data.size:"right"==this._data.halign&&(c+=this._data.size);var d=this._data.point.y;a.font=this.fontStyle();var e=a.measureText(this._data.text).width;this._textCache.textWidth=e;var f=this._data.fontSize,g=0.65*f,h=1*f;a.save();a.translate(c+0.5,d+0.5);a.beginPath();a.moveTo(0,0);switch(this._data.direction){case "up":case "down":a.lineTo(g,
h*b);a.lineTo(0.5*e+g,h*b);a.lineTo(0.5*e+g,(h+1.75*f)*b);a.lineTo(0.5*-e-g,(h+1.75*f)*b);a.lineTo(0.5*-e-g,h*b);a.lineTo(-g,h*b);a.lineTo(0,0);a.strokeStyle=this._data.borderColor;a.stroke();a.fillStyle=this._data.color;a.fill();a.fillStyle=this._data.fontColor;a.fillText(this._data.text,0.5*-e,0>b?b*h-0.5*f:h+1.25*f);break;default:throw this._data.direction+" doesn't supported by TriangleTextMarkRenderer";}a.restore()}};
TriangleTextMarkRenderer.prototype.hitTest=function(a){var b=this._textCache.textWidth,c=this._data.fontSize;switch(this._data.direction){case "up":case "down":var d="up"==this._data.direction?1:-1,e=0.65*c,f=1*c,g=this._data.point.x;"left"==this._data.halign?g-=this._data.size:"right"==this._data.halign&&(g+=this._data.size);var h=this._data.point.y,k=g+0.5*b+e,m=h+f*d,f=h+(f+1.75*c)*d;f<m&&(h=m,m=f,f=h);if(MathEx.pointInRect(a,new MathEx.Point(g-0.5*b-e,m),new MathEx.Point(k,f)))return new HitTestResult(HitTestResult.REGULAR);
b=[{}];b[0].x=this._data.point.x;b[0].y=this._data.point.y;b[1]={};b[1].x=this._data.point.x+0.65*c;b[1].y=this._data.point.y+c*d;b[2]={};b[2].x=this._data.point.x-0.65*c;b[2].y=this._data.point.y+c*d;c=(a.x-b[0].x)*(b[1].y-b[0].y)-(a.y-b[0].y)*(b[1].x-b[0].x);if(0<((a.x-b[1].x)*(b[2].y-b[1].y)-(a.y-b[1].y)*(b[2].x-b[1].x))*c&&0<((a.x-b[2].x)*(b[0].y-b[2].y)-(a.y-b[2].y)*(b[0].x-b[2].x))*c)return new HitTestResult(HitTestResult.REGULAR);break;default:throw this._data.direction+" doesn't supported by TriangleTextMarkRenderer";
}return null};function RectangleTextMarkRenderer(a,b){this._data=a;this._textCache=b}RectangleTextMarkRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font};
RectangleTextMarkRenderer.prototype.draw=function(a){if(this._data){var b=this._data.point.x,c=this._data.point.y;a.font=this.fontStyle();var d=a.measureText(this._data.text).width;this._textCache.textWidth=d;a.save();a.translate(b+0.5,c+0.5);a.beginPath();a.moveTo(0,0);b=this._data.valign;a.textAlign=this._data.halign;switch(b){case "middle":a.textBaseline="middle";break;case "top":a.textBaseline="bottom";break;case "bottom":a.textBaseline="hanging"}a.fillStyle=this._data.fontColor;a.fillText(this._data.text,
0,0);a.restore()}};RectangleTextMarkRenderer.prototype.hitTest=function(a){var b=this._data.point.x+0.5,c=this._data.point.y+0.5,d=this._textCache.textWidth,e=this._data.fontSize,f=this._data.halign;switch(this._data.valign){case "middle":c-=e/2;break;case "bottom":c-=e}switch(f){case "right":b-=d;break;case "center":b-=d/2}f=new MathEx.Point(b,c);b=new MathEx.Point(b+d,c+e);return MathEx.pointInRect(a,f,b)?new HitTestResult(HitTestResult.REGULAR):null};
function CircleShapeMarkRenderer(a,b){this._data=a;this._textCache=b}CircleShapeMarkRenderer.prototype.draw=function(a){if(this._data){var b="down"==this._data.direction?1:"up"==this._data.direction?-1:0,c=this._data.point.x,d=this._data.point.y;a.save();a.fillStyle=this._data.color;a.beginPath();a.arc(c+1,d+2*this._data.size*b+0.5,this._data.size,0,2*Math.PI);a.closePath();a.fill();a.stroke()}};
CircleShapeMarkRenderer.prototype.hitTest=function(a){var b="down"==this._data.direction?1:"up"==this._data.direction?-1:0;return Math.pow(this._data.point.x+0.5-a.x,2)+Math.pow(this._data.point.y+0.5+2*this._data.size*b-a.y,2)<=Math.pow(this._data.size,2)?new HitTestResult(HitTestResult.REGULAR):null};function SquareShapeMarkRenderer(a,b){this._data=a;this._textCache=b}
SquareShapeMarkRenderer.prototype.draw=function(a){if(this._data){var b="down"==this._data.direction?1:"up"==this._data.direction?-1:0,c=parseInt(this._data.size),d=new MathEx.Point(this._data.point.x-c/2,this._data.point.y-c/2+b*c),b=(new MathEx.Point(this._data.point.x+c/2,this._data.point.y+c/2+b*c)).substract(d);a.beginPath();a.fillStyle=this._data.color;a.rect(d.x,d.y,b.x,b.y);a.stroke();a.fill()}};
SquareShapeMarkRenderer.prototype.hitTest=function(a){var b="down"==this._data.direction?1:"up"==this._data.direction?-1:0,c=parseInt(this._data.size),d=new MathEx.Point(this._data.point.x-c/2,this._data.point.y-c/2+b*c),c=new MathEx.Point(this._data.point.x+c/2,this._data.point.y+c/2+b*c),b=new MathEx.Point(Math.min(d.x,c.x),Math.min(d.y,c.y)),d=new MathEx.Point(Math.max(d.x,c.x),Math.max(d.y,c.y));return MathEx.pointInRect(a,b,d)?new HitTestResult(HitTestResult.REGULAR):null};
function ArrowShapeMarkRenderer(a,b,c){this._data=a;this._textCache=b;this._arrowDirection=c}
ArrowShapeMarkRenderer.prototype.draw=function(a){if(this._data){var b=this._arrowDirection,c=1*this._data.size,d=this._data.color,e=this._data.point.x+1,f=this._data.point.y,g=1.1*c;switch(b){case "up":f-=g;break;case "down":f+=g}var g=c/6,h=c/4,k=c/3,m=c/2,n=0.6666666*c;a.save();a.fillStyle=d;a.beginPath();switch(b){case "up":a.moveTo(e,f);a.lineTo(e-m,f+n);a.lineTo(e-h,f+n);a.lineTo(e,f+k);a.lineTo(e+h,f+n);a.lineTo(e+m,f+n);a.lineTo(e,f);break;case "down":a.moveTo(e,f+c);a.lineTo(e-m,f+k);a.lineTo(e-
h,f+k);a.lineTo(e,f+n);a.lineTo(e+h,f+k);a.lineTo(e+m,f+k);a.lineTo(e,f+c);break;case "right":a.moveTo(e+g,f);a.lineTo(e-g,f-h);a.lineTo(e-g,f+h);a.lineTo(e+g,f);break;case "left":a.moveTo(e-g,f),a.lineTo(e+g,f-h),a.lineTo(e+g,f+h),a.lineTo(e-g,f)}a.closePath();a.fill();a.stroke()}};
ArrowShapeMarkRenderer.prototype.hitTest=function(a){var b=this._data.point.x,c=this._data.point.y,d=this._arrowDirection,e=1*this._data.size,f=e/2,f=1.1*e;switch(d){case "up":c-=f;break;case "down":c+=f}var g=e/6,h=e/4,k=e/3,f=e/2,m=0.6666666*e;switch(d){case "up":var n=new MathEx.Point(b,c),q=new MathEx.Point(b+f,c+m),l=new MathEx.Point(b-f,c+m);break;case "down":n=new MathEx.Point(b,c+e);q=new MathEx.Point(b+f,c+k);l=new MathEx.Point(b-f,c+k);break;case "right":n=new MathEx.Point(b+g,c);q=new MathEx.Point(b-
g,c-h);l=new MathEx.Point(b-g,c+h);break;case "left":n=new MathEx.Point(b-g,c),q=new MathEx.Point(b+g,c-h),l=new MathEx.Point(b+g,c+h)}return MathEx.pointInTriangle(n,q,l,a)?new HitTestResult(HitTestResult.REGULAR):null};TradingView.Study.StudyPaneView_textmarks=function(a,b){this._study=a;this._model=b;this._data=[];this._textCache=[]};inherit(TradingView.Study.StudyPaneView_textmarks,LocationToYMixin);TradingView.Study.StudyPaneView_textmarks.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_textmarks.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)switch(this._data[b].shape){case "triangle":a.append(new TriangleTextMarkRenderer(this._data[b],this._textCache[b]));break;case "rectangle":a.append(new RectangleTextMarkRenderer(this._data[b],this._textCache[b]))}return a};
TradingView.Study.StudyPaneView_textmarks.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().textmarks;if(a){var b=this._study.priceScale(),c=this._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.graphics().indexes,e=this._study.firstValue(),f=this._model.timeScale().visibleBars(),g=f.firstBar(),f=f.lastBar(),h=0;h<a.length;h++){var k=a[h];if(k.data){var m=this._study.properties().graphics.textmarks[k.styleId];if(m.visible.value())for(var k=
k.data,n=0;n<k.length;n++){var q=k[n],l={},s=m.location.value(),u=m.shape.value(),z=d[q.time];if(!(z<g||z>f)&&this._study.series().bars().valueAt(z)){z=d[q.time]+(q.offset||0);l.font=m.fontFamily.value();l.color=generateColor(m.color.value(),m.transparency.value());l.bold=m.fontBold.value();l.fontColor=generateColor(m.fontColor.value(),m.transparency.value());l.italic=m.fontItalic.value();l.fontSize=m.fontSize.value();l.text=q.text?q.text:"";l.halign=m.halign.value();l.valign=void 0!=m.valign?m.valign.value():
"middle";l.shape=m.shape.value();l.size=0.5*c.barSpacing();l.borderColor="rgb(0, 0, 0)";var t=Math.round(c.indexToCoordinate(z)),B;switch(u){case "triangle":B=this._calcXYForTriangleShape(s,z,50,q.price,e,b);l.direction=B.direction;break;case "rectangle":B=this._calcXYForRectangleShape(s,z,q.price,e,b)}l.point=new MathEx.Point(t,B.y);this._data.push(l);this._textCache.push({})}}}}}};
TradingView.Study.StudyPaneView_textmarks.prototype._calcXYForTriangleShape=function(a,b,c,d,e,f){switch(a){case CanvasEx.MARKLOC_TOP:a=f.height()-c;b="down";break;case CanvasEx.MARKLOC_BOTTOM:a=c;b="up";break;case CanvasEx.MARKLOC_ABSOLUTEDOWN:f.isPercent()&&(d=f.priceRange().convertToPercent(d,e));a=f.priceToCoordinate(d);b="down";break;case CanvasEx.MARKLOC_ABSOLUTEUP:f.isPercent()&&(d=f.priceRange().convertToPercent(d,e));a=f.priceToCoordinate(d);b="up";break;case CanvasEx.MARKLOC_ABOVEBAR:a=
this._locationToY(a,b);b="down";break;case CanvasEx.MARKLOC_BELOWBAR:a=this._locationToY(a,b);b="up";break;default:a=this._locationToY(a,b),b="up"}return{y:a,direction:b}};
TradingView.Study.StudyPaneView_textmarks.prototype._calcXYForRectangleShape=function(a,b,c,d,e){switch(a){case CanvasEx.MARKLOC_ABSOLUTEDOWN:case CanvasEx.MARKLOC_ABSOLUTEUP:case CanvasEx.MARKLOC_ABSOLUTE:e.isPercent()&&(c=e.priceRange().convertToPercent(c,d));a=e.priceToCoordinate(c);break;case CanvasEx.MARKLOC_ABOVEBAR:a=this._locationToY(a,b);break;case CanvasEx.MARKLOC_BELOWBAR:a=this._locationToY(a,b);break;default:a=this._locationToY(a,b)}return{y:a}};
TradingView.Study.StudyPaneView_shapemarks=function(a,b){this._study=a;this._model=b;this._data=[];this._textCache=[]};inherit(TradingView.Study.StudyPaneView_shapemarks,LocationToYMixin);TradingView.Study.StudyPaneView_shapemarks.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_shapemarks.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)switch(this._data[b].shape){case "circle":a.append(new CircleShapeMarkRenderer(this._data[b],this._textCache[b]));break;case "square":a.append(new SquareShapeMarkRenderer(this._data[b],this._textCache[b]));break;case "arrowUp":a.append(new ArrowShapeMarkRenderer(this._data[b],this._textCache[b],"up"));
break;case "arrowDown":a.append(new ArrowShapeMarkRenderer(this._data[b],this._textCache[b],"down"));break;case "arrowRight":a.append(new ArrowShapeMarkRenderer(this._data[b],this._textCache[b],"right"));break;case "arrowLeft":a.append(new ArrowShapeMarkRenderer(this._data[b],this._textCache[b],"left"))}return a};
TradingView.Study.StudyPaneView_shapemarks.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().shapemarks;if(a){var b=this._study.priceScale(),c=this._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.graphics().indexes,e=this._model.timeScale().visibleBars(),f=e.firstBar(),e=e.lastBar(),g=0;g<a.length;g++){var h=a[g];if(h.data){var k=this._study.properties().graphics.shapemarks[h.styleId];if(k.visible.value())for(var h=h.data,m=0;m<h.length;m++){var n=
h[m],q=d[n.time];if(!(q<f||q>e)){var l={};if(null!=n.time&&this._study.series().bars().valueAt(q)){l.color=generateColor(k.color.value(),k.transparency.value());var s=0;"left"==k.halign.value()?s-=c.barSpacing()/2+1:"right"==k.halign.value()&&(s+=c.barSpacing()/2+1);l.size=k.size.value();l.shape=k.shape.value();var s=Math.round(c.indexToCoordinate(q))+s,u=this._study.firstValue(),n=n.price;b.isPercent()&&(n=b.priceRange().convertToPercent(n,u));n=b.priceToCoordinate(n);u=k.location.value();switch(u){case CanvasEx.MARKLOC_ABSOLUTE:l.direction=
"";break;case CanvasEx.MARKLOC_ABSOLUTEDOWN:l.direction="down";break;case CanvasEx.MARKLOC_ABSOLUTEUP:l.direction="up";break;case CanvasEx.MARKLOC_ABOVEBAR:n=this._locationToY(u,q,Math.floor(2*l.size/c.barSpacing())+1);l.direction="up";break;case CanvasEx.MARKLOC_BELOWBAR:n=this._locationToY(u,q,Math.floor(2*l.size/c.barSpacing())+1);l.direction="down";break;default:console.warn("Bad location value: "+u),n=this._locationToY(CanvasEx.MARKLOC_ABSOLUTEUP,q),l.direction="up"}l.point=new MathEx.Point(s,
n);this._data.push(l);this._textCache.push({})}}}}}}};function BackgroundRenderer(a){this._data=a}BackgroundRenderer.prototype.draw=function(a){};BackgroundRenderer.prototype.drawBackground=function(a){var b=this._data;clearRect(a,b.x1,b.y1,b.x2-b.x1,b.y2-b.y1,generateColor(this._data.color,this._data.transparency))};BackgroundRenderer.prototype.hitTest=function(a){return null};TradingView.Study.StudyPaneView_backgrounds=function(a,b){this._study=a;this._model=b;this._data=[]};
TradingView.Study.StudyPaneView_backgrounds.prototype.update=function(){this._invalidated=!0};TradingView.Study.StudyPaneView_backgrounds.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new BackgroundRenderer(this._data[b]));return a};
TradingView.Study.StudyPaneView_backgrounds.prototype._hideExtendedHours=function(a){return"inSession"===a||"outOfSession"===a?!this._study._series.properties().extendedHours.value():!1};
TradingView.Study.StudyPaneView_backgrounds.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().backgrounds;if(a){var b=this._model.timeScale(),c=this._study.priceScale();if(c&&!c.isEmpty()&&b&&!b.isEmpty())for(var d=this._study.graphics().indexes,e=this._model.timeScale().visibleBars(),f=e.firstBar(),e=e.lastBar(),g=0;g<a.length;g++){var h=a[g],k=h.styleId,h=h.data,m=this._study.properties().graphics.backgrounds[k];if(!this._hideExtendedHours(k)&&m.visible.value())for(var n,
q,k=0;k<h.length;k++){var l=h[k],s={},u=d[l.start],z=d[l.stop];if(!(z<f||u>e)&&null!=l.start&&null!=l.stop){var l=Math.ceil(b.indexToCoordinate(u,!0)-0.5*b.barSpacing()),t=Math.ceil(b.indexToCoordinate(z,!0)+0.5*b.barSpacing());q==u-1&&(l=n);n=t;q=z;0>l&&0>t||l>b.width()&&t>b.width()||(s.x1=l,s.x2=t,s.y1=0,s.y2=c.height(),s.color=m.color.value(),s.transparency=m.transparency.value(),this._data.push(s))}}}}};
TradingView.Study.StudyPaneView_polygons=function(a,b){this._study=a;this._model=b;this._data=[]};TradingView.Study.StudyPaneView_polygons.prototype.update=function(){this._invalidated=!0};TradingView.Study.StudyPaneView_polygons.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new PoligonRenderer(this._data[b],new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_polygons.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().polygons;if(a){var b=this._study.priceScale(),c=this._study._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=this._study.firstValue(),e=this._study.graphics().indexes,f=this._model.timeScale().visibleBars(),g=f.firstBar(),f=f.lastBar(),h=0;h<a.length;h++){var k=a[h];if(k.data){var m=this._study.properties().graphics.polygons[k.styleId];if(100!=m.transparency.value())for(var n=
0;n<k.data.length;n++){for(var q=k.data[n],l=Infinity,s=-Infinity,u=0;u<q.points.length;u++)var z=e[q.points[u].index]+(q.points[u].offset||0),l=Math.min(l,z),s=Math.max(s,z);if(!(s<g||l>f)){l={};l.points=new List;for(u=0;u<q.points.length;u++)objPoint=q.points[u],x=c.indexToCoordinate(e[objPoint.index]+(objPoint.offset||0)),s=objPoint.level,b.isPercent()&&(s=b.priceRange().convertToPercent(s,d)),y=b.priceToCoordinate(s),s=new MathEx.Point(x,y),s.data=u,l.points.append(s);l.color=m.color.value();
l.backcolor=m.color.value();l.linewidth=0;l.linestyle=CanvasEx.LINESTYLE_SOLID;l.filled=!0;l.fillBackground=!0;l.transparency=m.transparency.value();l.mouseTouchable=m.mouseTouchable.value();this._data.push(l)}}}}}};TradingView.Study.StudyPaneView_trendchannels=function(a,b){this._study=a;this._model=b;this._data=[]};TradingView.Study.StudyPaneView_trendchannels.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_trendchannels.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var a=new CompositeRenderer,b=0;b<this._data.length;b++)a.append(new PoligonRenderer(this._data[b],new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_trendchannels.prototype._updateViewInternal=function(){this._data=[];var a=this._study.graphics().trendchannels;if(a){var b=this._study.priceScale(),c=this._study._model.timeScale();if(b&&!b.isEmpty()&&c&&!c.isEmpty())for(var d=function(a){b.isPercent()&&(a=b.priceRange().convertToPercent(a,f));return b.priceToCoordinate(a)},e=function(a,b,c,d,e,f){var g=new MathEx.Point(0,0);c=new MathEx.Point(c,d);e&&(e=a.substract(b),(e=MathEx.intersectRayWithRect(a,a.add(e),g,c))&&
(a=e));f&&(e=b.substract(a),(e=MathEx.intersectRayWithRect(b,b.add(e),g,c))&&(b=e));return[a,b]},f=this._study.firstValue(),g=this._study.graphics().indexes,h=this._model.timeScale().visibleBars(),k=h.firstBar(),h=h.lastBar(),m=0;m<a.length;m++){var n=a[m];if(n.data){var q=this._study.properties().graphics.trendchannels[n.styleId];if(100!=q.transparency.value())for(var l=0;l<n.data.length;l++){var s=n.data[l],u=g[s.startIndex],z=g[s.endIndex];if(!(Math.max(u,z)<k||Math.min(u,z)>h)){var t=d(s.startHighPrice,
b,f),B=d(s.startLowPrice,b,f),A=d(s.endHighPrice,b,f),w=A-(t-B),u=c.indexToCoordinate(u),z=c.indexToCoordinate(z),t=new MathEx.Point(u,t),B=new MathEx.Point(u,B),A=new MathEx.Point(z,A),w=new MathEx.Point(z,w),A=e(t,A,c.width(),b.height(),s.extendLeft,s.extendRight),s=e(B,w,c.width(),b.height(),s.extendLeft,s.extendRight),t=A[0],A=A[1],B=s[0],w=s[1],s={};s.points=new List;s.points.append(t);s.points.append(B);s.points.append(w);s.points.append(A);s.color=q.color.value();s.backcolor=q.color.value();
s.linewidth=0;s.linestyle=CanvasEx.LINESTYLE_SOLID;s.filled=!0;s.fillBackground=!0;s.transparency=q.transparency.value();s.mouseTouchable=!0;this._data.push(s)}}}}}};TradingView.Study.StudyPaneView_hhists=function(a,b){this._study=a;this._model=b;this._data=[];this._textData=[];this._textRendererCache={}};TradingView.Study.StudyPaneView_hhists.prototype.update=function(){this._invalidated=!0};
TradingView.Study.StudyPaneView_hhists.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);var a=new CompositeRenderer,b;for(b in this._data)a.append(new HorizHistogramRenderer(this._data[b]));for(b=0;b<this._textData.length;b++)a.append(new TextRenderer(this._textData[b],this._textRendererCache,new HitTestResult(HitTestResult.REGULAR)));return a};
TradingView.Study.StudyPaneView_hhists.prototype._updateViewInternal=function(){this._data=[];this._textData=[];var a=this._study.priceScale(),b=this._model.timeScale();if(a&&!a.isEmpty()&&b&&!b.isEmpty()){var c=this._study.graphics().hhists;if(c)for(var d=this._study.graphics().indexes,e=this._model.timeScale().visibleBars(),f=e.firstBar(),e=e.lastBar(),g=0;g<c.length;g++){var h=c[g],k=this._study.properties().graphics.hhists[h.styleId];if(k.visible.value()){var h=h.dataObj,m;for(m in h){for(var n=
h[m],q=Infinity,l=-Infinity,s=n.length;s--;)q=Math.min(q,d[n[s].firstBarTime]),l=Math.max(l,d[n[s].lastBarTime]);l<f||q>e||this._updateDataForRenderers(n,k,a,b,d)}}}}};
TradingView.Study.StudyPaneView_hhists.prototype._updateDataForRenderers=function(a,b,c,d,e){for(var f=[],g=this._findMaxRate(a),h=this._study.firstValue(),k=null,m=null,n=null,q={},l=0;l<a.length;l++){var s=a[l];null===m&&(m=this._findActualRateLength(s.rate));null===k&&(k=Math.abs(d.indexToCoordinate(e[s.firstBarTime])-d.indexToCoordinate(e[s.lastBarTime])),k=b.percentWidth.value()*k/100,k-=m,k=Math.max(k,0));for(var u=!1,z,t=0;t<m;t++)if(0!=s.rate[t]){q[t]=void 0==q[t]?s.rate[t]:q[t]+s.rate[t];
if(c.isPercent())var B=c.priceRange().convertToPercent(s.priceHigh,h),A=c.priceRange().convertToPercent(s.priceLow,h);else B=s.priceHigh,A=s.priceLow;var w={};w.y1=c.priceToCoordinate(B)+1;w.y2=c.priceToCoordinate(A)-1;0===l&&(z=w.y2,lastHistHeight=w.y2-w.y1);A=b.location.value();B=b.direction.value();if(A==CanvasEx.HHISTLOC_ABSOLUTE&&B==CanvasEx.HHISTDIR_LEFTTORIGHT)var v=d.indexToCoordinate(e[s.firstBarTime]),C=1,H="left";else if(A==CanvasEx.HHISTLOC_ABSOLUTE&&B==CanvasEx.HHISTDIR_RIGHTTOLEFT)v=
d.indexToCoordinate(e[s.lastBarTime]),C=-1,H="right";else if(A==CanvasEx.HHISTLOC_RELATIVE&&B==CanvasEx.HHISTDIR_LEFTTORIGHT)v=0,C=1,H="left";else if(A==CanvasEx.HHISTLOC_RELATIVE&&B==CanvasEx.HHISTDIR_RIGHTTOLEFT)v=d.width(),C=-1,H="right";else throw Error("Unknown location/direction values: "+A+"/"+B);w.x1=0==t?v:v+C*(k*s.rate[t-1]/g+m);w.x2=w.x1+C*(k*s.rate[t]/g);w.colorBg=b.colors[t].value();w.transparency=b.transparencies[t].value();w.x0=v;f.push(w);n||(n=0.6*(w.y2-w.y1));if(!u&&b.showValues.value()&&
7.5<=n){var u=!0,D={},A=this._study.formatter(),F=function(a,b,c){if(c==CanvasEx.HHISTDIR_LEFTTORIGHT)return a+b;if(c==CanvasEx.HHISTDIR_RIGHTTOLEFT)return b+a;throw Error("Unknown direction value: "+c);};D.text="";for(var I=0;I<m;I++)D.text=F(D.text,A.format(s.rate[I]),B),I!=m-1&&(D.text=F(D.text,"x",B));D.color=b.valuesColor.value();D.font="arial";D.fontsize=n;D.horzAlign=H;D.vertAlign="middle";p1=new MathEx.Point(v+3*C,w.y2-0.61*(w.y2-w.y1));D.points=(new List).append(p1);D.offsetX=0;D.offsetY=
0;this._textData.push(D);if(l===a.length-1){w=v+3*C;I=z+0.39*lastHistHeight;w={text:"",color:TradingView.shiftColor(b.valuesColor.value(),1.5),font:"arial",fontsize:n,horzAlign:H,vertAlign:"middle",points:(new List).append(new MathEx.Point(w,I)),offsetX:0,offsetY:0};for(I=0;I<m;I++)w.text=F(w.text,A.format(q[I]),B),I!=m-1&&(w.text=F(w.text,"x",B));this._textData.push(w)}}}}0<f.length&&this._data.push(f)};
TradingView.Study.StudyPaneView_hhists.prototype._findMaxRate=function(a){for(var b=0,c=0,d=0;d<a.length;d++){for(var e=c=0;e<a[d].rate.length;e++)c+=a[d].rate[e];b=Math.max(b,c)}return b};TradingView.Study.StudyPaneView_hhists.prototype._findActualRateLength=function(a){for(var b=0,c=0;c<a.length;++c){var d=a[c];if(null!==d&&void 0!==d)b++;else break}return b};function HorizHistogramRenderer(a){this._data=a}
function searchCoord(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>>1,f=a[e].y1,g=a[e].y2;if(f>b)c=e+1;else if(g<b)d=e-1;else return a[e+1]&&f==a[e+1].y1?e+1:e}return-1}HorizHistogramRenderer.prototype.hitTest=function(a){var b=searchCoord(this._data,a.y);if(0>b)return null;var c=Math.min(this._data[b].x0,this._data[b].x2),b=Math.max(this._data[b].x0,this._data[b].x2);return c<=a.x&&a.x<=b?new HitTestResult(HitTestResult.REGULAR):null};
HorizHistogramRenderer.prototype.draw=function(a){a.save();for(var b=0;b<this._data.length;b++){var c=this._data[b];a.fillStyle=generateColor(c.colorBg,c.transparency);a.fillRect(c.x1,c.y1,c.x2-c.x1,c.y2-c.y1);a.strokeStyle=generateColor(c.colorBg,0.8*c.transparency);a.beginPath();a.moveTo(c.x1,c.y1);a.lineTo(c.x2,c.y1);a.lineTo(c.x2,c.y2);a.lineTo(c.x1,c.y2);a.lineTo(c.x1,c.y1);a.stroke()}a.restore()};TradingView.study_ScriptWithDataOffset=function(a,b,c,d){TradingView.Study.call(this,a,b,c,d)};inherit(TradingView.study_ScriptWithDataOffset,TradingView.Study);TradingView.study_ScriptWithDataOffset.prototype.clearData=function(){TradingView.Study.prototype.clearData.call(this);this._underlyingData=new PlotList(this._plotFields)};
TradingView.study_ScriptWithDataOffset.prototype._mergeData=function(a){var b=0===this._underlyingData._length()?null:this._underlyingData._indexAt(0);this._underlyingData.merge(a);b!==this._underlyingData._indexAt(0)&&(this.m_data=new PlotList(this._underlyingData.columns()));this.m_data._start=this._underlyingData._start;this.m_data._end=this._underlyingData._end;var c=this.m_data._length();for(a=c;a<this._underlyingData._length();++a)b=TradingView.merge({},this._underlyingData._valueAt(a)),this.m_data.add(this._underlyingData._indexAt(a),
b);this._plotsForStrategyProcessing().forEach(function(a){this._createStrategy(a.strategy,a.strategyIndex,a.targetIndex,c).rebuildData(this.m_data)},this)};
TradingView.study_ScriptWithDataOffset.prototype._plotsForStrategyProcessing=function(){var a=["dataoffset"],b=[];this._metaInfo.plots.forEach(function(c,d){if(-1<a.indexOf(c.type)){var e=null;this._metaInfo.plots.forEach(function(a,b){a.id==c.target&&(e=b)});assert(0<=e,"target plot not found for strategy plot "+c.id);b.push({strategy:c.type,strategyIndex:d,targetIndex:e})}},this);return b};
TradingView.study_ScriptWithDataOffset.prototype._createStrategy=function(a,b,c,d){return new TradingView.study_ScriptWithDataOffset["Strategy_"+a](b,c,d)};TradingView.study_ScriptWithDataOffset.Strategy_dataoffset=function(a,b,c){this._strategyPlotIndex=a;this._targetPlotIndex=b;this._startIndex=c};
TradingView.study_ScriptWithDataOffset.Strategy_dataoffset.prototype.rebuildData=function(a){for(var b=this._targetPlotIndex+1,c=this._strategyPlotIndex+1,d=null,e=null,f=this._startIndex;f<a._length();++f){var g=a._valueAt(f),h=g[b],k=g[c]?Math.round(g[c]):null;g[b]=null;g[c]=null;!k||0<k||((k=f+k,g={pointIndex:k,value:h},e)?e.pointIndex!=g.pointIndex&&(0<=k&&(a._items[k].value[b]=h),k=!1,d&&(k=d.value<=e.value&&e.value<=h||d.value>=e.value&&e.value>=h),k?0<=e.pointIndex&&(a._items[e.pointIndex].value[b]=
null):d=e,e=g):e=g)}};TradingView.IntervalMenu=function(a,b,c){this._options=c||{};this._w=a;this._opener=b;this._addMetric=1;this._addOpened=!1};TradingView.IntervalMenu.prototype._interval=function(a){a=$(a.target);a.hasClass("disabled")||(this._w.setInterval(a.data("interval")),this.close())};TradingView.IntervalMenu.prototype._quickTitle=function(a){return a?$.t("Remove from favorites"):$.t("Add to favorites")};
TradingView.IntervalMenu.prototype._onQuick=function(a){var b=$(a.target.parentNode),b=this._w.toggleQuick(b.data("interval"));$(a.target.parentNode).toggleClass("quicked",b);$(a.target).attr("title",this._quickTitle(b));return!1};TradingView.IntervalMenu.prototype._onDelete=function(a){a=$(a.target.parentNode);this._w.removeInterval(a.data("interval"));this._reopen();return!1};TradingView.IntervalMenu.prototype._showControlButtons=function(){return!0};
TradingView.IntervalMenu.prototype._append=function(a,b){var c=$("<span>").addClass("item").toggleClass("active",b==this._w.getInterval()).toggleClass("quicked",this._w.inQuick(b)).toggleClass("disabled",!this._w.isAvailable(b)).text(this._w.fullLabel(b)).data("interval",b);this._showControlButtons()&&(this._w.isDefaultInterval(b)||c.prepend($("<span>").addClass("delete").attr("title","Remove custom interval").click(this._onDelete.bind(this))),this._w._options.notShowQuicks||c.prepend($("<span>").addClass("to-quick").attr("title",
this._quickTitle(this._w.inQuick(b))).click(this._onQuick.bind(this))));c.click(this._interval.bind(this));a.append(c)};
TradingView.IntervalMenu.prototype._appendAdd=function(a){function b(){var a=parseInt(e.val());1>a&&e.val(1);var b={1:1440,60:24,D:364,W:52,M:12}[this._addMetric];a>b&&e.val(b)}var c=$("<span>").addClass("item-add"),d=$('<span class="item-add-wrap">').appendTo(c),e=$('<input type="text">').addClass("tv-text-input inset minutes").val(1).appendTo(d).TVTicker(),f=$("<span>").addClass("tv-button mins").append($("<span>")).append($("<i>")).appendTo(d),d=$("<span>").addClass("tv-button add").text("add").appendTo(d),
g={1:"minutes",60:"hours",D:"days",W:"weeks",M:"months"};f.find("span").text(g[this._addMetric||1]);e.change(b.bind(this));var h=this;TradingView.bindPopupMenu(f,null,{direction:"up",event:"button-popup",addClass:"thin small-font metrics",popupSpacing:~~this._w._options.popupSpacing,onRemove:function(){h._addOpened=!1}});f.click(function(){h._addOpened=!0;f.trigger("button-popup",[$.map(g,function(a,c){return{title:a.toUpperCase(),active:c==h._addMetric,action:function(){h._addMetric=c;f.find("span").text(a);
b.call(h);return!1}}})])});d.click(function(){runOrGoPro(function(){var a=parseInt(e.val());if(a==a){var b=parseInt(h._addMetric);b==b?h._addInterval(""+a*h._addMetric):h._addInterval(""+a+h._addMetric)}},{feature:"customIntervals"})});a.append($("<div>").addClass("separator"));a.append(c)};TradingView.IntervalMenu.prototype._addInterval=function(a){};
TradingView.IntervalMenu.prototype._open=function(a,b){a.find(".item, .item-add, .separator").remove();var c=[],d=[],e=[],f=$("<span>").addClass("separator");$.each(b,function(a,b){/^\d*[DWM]$/.test(b)?e.push(b):this._w.isHour(b)?d.push(b):c.push(b)}.bind(this));c.length&&c.forEach(function(b){this._append(a,b)}.bind(this));d.length&&(a.append(f.clone()),d.forEach(function(b){this._append(a,b)}.bind(this)));e.length&&(a.append(f.clone()),e.forEach(function(b){this._append(a,b)}.bind(this)));this._options.onWidget||
TradingView.isRunningChartingLibrary||this._appendAdd(a)};TradingView.IntervalMenu.prototype._reopen=function(){this._open(this._menu,this._w._sorted(this._w._intervals))};
TradingView.IntervalMenu.prototype.open=function(a){var b=$("<div>").addClass("charts-popup-list intervals-list favored-list").toggleClass("touch",Modernizr.touch),c=this._w.mainButton().offset(),d=this._w.mainButton().outerHeight(),e=c.top+d+parseInt(this._options.popupSpacing||0);b.appendTo(document.body);b.css({top:e,left:c.left}).show();this._menu=b;this._opener.addClass("active");this._open(b,a);a=Math.min($("body").height(),$(window).height())-d-e-10;this._setMaxHeight(b,a);setTimeout(function(){b.on("mousedownoutside",
function(a){this.close(a)&&b.unbind("mousedownoutside")}.bind(this))}.bind(this),0)};TradingView.IntervalMenu.prototype._setMaxHeight=function(a,b){a.height()>=b&&(a.css("max-height",b+"px"),a.width(a.width()+18))};TradingView.IntervalMenu.prototype.close=function(a){if(a&&$(a.target).parents("span.item-add, .charts-popup-list.metrics").length)return!1;this._menu.remove();$(document.body).off(".interval-menu");delete this._menu;this._opener.removeClass("active");return!0};TradingView.IntervalWidget=function(a){this._options=$.extend({interval:1},a||{});this._e=$("<div>").addClass("intervals-container favored-list-container");this._quick=$("<div>").addClass("quick").appendTo(this._e);this._quicked={};this._main=$("<span>").text(this.shortLabel(this._options.interval)).appendTo(this._quick);this._main.data("interval",this._options.interval);this._mainSub=$("<span>").addClass("submenu").attr("title",$.t("Time Interval")).append($("<i>")).appendTo(this._e);a&&"string"==
typeof a.submenuBtnAddClass&&this._mainSub.addClass(a.submenuBtnAddClass);this._quick.on("click",this._selectInterval.bind(this));this._mainSub.on("click",this._selectMenu.bind(this));this._menu=new TradingView.IntervalMenu(this,this._mainSub,this._options);this.onResize=new Delegate;TradingView.Linking.intraday.subscribe(this._fullUpdate.bind(this));TradingView.Linking.interval.subscribe(this.activateInterval.bind(this));if(!$.browser.msie)TVXWindowEvents.on("intervalwidget-change",this._onChangeInAnotherTab.bind(this))};
TradingView.IntervalWidget.prototype.forceUpdate=function(){this._fullUpdate(!0)};TradingView.IntervalWidget.prototype._fullUpdate=function(a){this._setupIntervals(a);this._setupQuicks(a);this.reactivateInterval();this._resize()};TradingView.IntervalWidget.prototype._onChangeInAnotherTab=function(){this._fullUpdate(!0)};TradingView.IntervalWidget.DWMPattern=/^(\d*)([DWM])$/;TradingView.IntervalWidget.prototype.DWMPattern=TradingView.IntervalWidget.DWMPattern;
TradingView.IntervalWidget.isDWM=function(a){return(a=this.DWMPattern.exec(a+""))?{qty:a[1]||"1",unit:a[2]}:!1};TradingView.IntervalWidget.prototype.isDWM=TradingView.IntervalWidget.isDWM;TradingView.IntervalWidget.prototype.isDefaultInterval=function(a){return a in ChartApiInstance.defaultResolutions()};TradingView.IntervalWidget.prototype._setupIntervals=function(){this._intervals=$.extend({},ChartApiInstance.defaultResolutions())};
TradingView.IntervalWidget.prototype._sorted=function(a){if(!Array.isArray(a)){var b=[];$.each(a,function(a){b.push(a)});a=b}return a.sort(function(a,b){function e(a){var b=TradingView.IntervalWidget.isDWM(a);return b?{D:1440,W:10080,M:43200}[b.unit]*b.qty:parseInt(a)}return e(a)-e(b)})};
TradingView.IntervalWidget.prototype._setupQuicks=function(a){if(!this._options.notShowQuicks){var b={};TradingView.onWidget()&&(b={1:!0,30:!0,60:!0});this._quicked=TVSettings.getJSON("IntervalWidget.quicks",b,a);this._quicked=this._removeCustomIntervalQuicks(this._quicked)}this._addQuicked(this._quicked)};TradingView.IntervalWidget.prototype._removeCustomIntervalQuicks=function(a){var b={};$.each(a,function(a,d){this.isDefaultInterval(a)&&(b[a]=d)}.bind(this));return b};
TradingView.IntervalWidget.prototype.element=function(){return this._e};TradingView.IntervalWidget.prototype.mainButton=function(){return this._main};TradingView.IntervalWidget.prototype._quicks=function(){return this._quick.find("span").slice(0,-1)};
TradingView.IntervalWidget.prototype.postfix=function(a,b){if(b){var c=" ";switch(a){case "D":c+=$.t("day",{count:b});break;case "W":c+=$.t("week",{count:b});break;case "M":c+=$.t("month",{count:b});break;case "m":c+=$.t("minute",{count:b});break;case "h":c+=$.t("hour",{count:b})}return c}switch(a){case "m":return"";case "h":return $.t("h");default:return $.t(a.toUpperCase(),{count:0})}};TradingView.IntervalWidget.prototype.isHour=function(a){return 60<=a&&!(a%60)};
TradingView.IntervalWidget.prototype.readable=function(a,b){var c="m",d=this.isDWM(a);d&&(a=d.qty,c=d.unit);a=parseInt(a);if(!a)throw new TypeError("Wrong interval value: "+a);"m"===c&&this.isHour(a)&&(a=~~(a/60),c="h");return""+a+this.postfix(c,b?a:null)};TradingView.IntervalWidget.prototype.shortLabel=function(a){return translatedIntervalString(this.readable(a,!1))};TradingView.IntervalWidget.prototype.fullLabel=function(a){return this.readable(a,!0)};
TradingView.IntervalWidget.prototype._addQuicked=function(a){this._quicks().remove();a=this._sorted(a);$.each(a,function(a,c){var d=$("<span>").data("interval",c).text(this.shortLabel(c)).toggleClass("selected",c==this.getInterval()).toggleClass("disabled",!this.isAvailable(c));this._main.before(d)}.bind(this));this._resize()};TradingView.IntervalWidget.prototype._resize=function(){this.onResize.fire()};
TradingView.IntervalWidget.prototype.addQuick=function(a){this._quicked[a]=!0;this._addQuicked(this._quicked);this.saveSettings();this.reactivateInterval()};TradingView.IntervalWidget.prototype._quickWithInterval=function(a){var b=null;this._quicks().each(function(c,d){d=$(d);if(a==d.data("interval"))return b=d,!1});return b};TradingView.IntervalWidget.prototype.inQuick=function(a){return null!=this._quickWithInterval(a)};
TradingView.IntervalWidget.prototype.removeQuick=function(a){this._quickWithInterval(a)&&(this._quickWithInterval(a).remove(),this._resize(),delete this._quicked[a],this.saveSettings(),this.reactivateInterval())};TradingView.IntervalWidget.prototype.toggleQuick=function(a){var b=this.inQuick(a);b?this.removeQuick(a):this.addQuick(a);return!b};TradingView.IntervalWidget.prototype.hasQuicks=function(){return!!this._quicks().length};TradingView.IntervalWidget.prototype.deactivate=function(a){this._quick.find("span").removeClass("selected")};
TradingView.IntervalWidget.prototype.activateInterval=function(a){a.value&&(a=a.value());this.deactivate();this.inQuick(a)?this._quickWithInterval(a).addClass("selected"):(this.hasQuicks()&&this._main.addClass("selected"),this._main.text(this.shortLabel(a)),this._main.data("interval",a))};TradingView.IntervalWidget.prototype.reactivateInterval=function(){this.activateInterval(this.getInterval())};TradingView.IntervalWidget.prototype.getInterval=function(){return TradingView.Linking.interval.value()};
TradingView.IntervalWidget.prototype.setInterval=function(a){TradingView.Linking.interval.setValue(""+a)};TradingView.IntervalWidget.prototype._selectInterval=function(a){a=$(a.target);var b=a.data("interval");this.hasQuicks()||this.getInterval()!=b?a.hasClass("disabled")||this.setInterval(b):this._selectMenu()};TradingView.IntervalWidget.prototype._selectMenu=function(a){this._mainSub.hasClass("active")?this._menu.close(a):this._menu.open(this._sorted(this._intervals))};
TradingView.IntervalWidget.prototype.addInterval=function(a){};TradingView.IntervalWidget.prototype.removeInterval=function(a){};TradingView.IntervalWidget.prototype.saveIntervals=function(){};TradingView.IntervalWidget.prototype.saveQuicked=function(){TVSettings.setJSON("IntervalWidget.quicks",this._quicked)};TradingView.IntervalWidget.prototype.saveSettings=function(){this.saveQuicked();this.saveIntervals();TVXWindowEvents.emit("intervalwidget-change")};
TradingView.IntervalWidget.prototype.isMinute=function(a){a=parseInt(a);return 1<=a&&1440>=a};TradingView.IntervalWidget.prototype.isAvailable=function(a){var b=TradingView.Linking.supportedResolutions.value(),c=!1,c="undefined"!=typeof b?-1!=b.indexOf(a):!0;return TradingView.Linking.intraday.value()?c:this.isDWM(a)&&c};TradingView.InvalidateMask=function(a){this._fullInvalidation=a?a:TradingView.InvalidateMask.UPDATE_CURSOR_ONLY;this._invalidatedPanes={}};TradingView.InvalidateMask.UPDATE_CURSOR_ONLY=1;TradingView.InvalidateMask.LIGHT_UPDATE=2;TradingView.InvalidateMask.FULL_UPDATE=3;TradingView.InvalidateMask.prototype.invalidatePane=function(a,b){this._invalidatedPanes[a]=this._invalidatedPanes[a]?Math.max(this._invalidatedPanes[a],b):b};
TradingView.InvalidateMask.prototype.invalidateAll=function(a){this._fullInvalidation=Math.max(this._fullInvalidation,a)};TradingView.InvalidateMask.prototype.fullInvalidation=function(){return this._fullInvalidation};TradingView.InvalidateMask.prototype.invalidateForPane=function(a){return this._invalidatedPanes[a]?Math.max(this._invalidatedPanes[a],this._fullInvalidation):this._fullInvalidation};
TradingView.InvalidateMask.prototype.merge=function(a){this.force=this.force||a.force;this._fullInvalidation=Math.max(this._fullInvalidation,a._fullInvalidation);for(var b in a._invalidatedPanes)this._invalidatedPanes[b]=this._invalidatedPanes[b]?Math.max(this._invalidatedPanes[b],a._invalidatedPanes[b]):a._invalidatedPanes[b]};
TradingView.InvalidateMask.prototype.exclude=function(a){this._fullInvalidation<=a&&(this._fullInvalidation=0);for(var b in this._invalidatedPanes)this._invalidatedPanes[b]<=a&&(this._invalidatedPanes[b]=0)};var PropertyPagesFactory=function(){function a(a){return a instanceof LineDataSource?a instanceof TradingView.LineToolRiskReward?LineToolRiskRewardInputsPropertyPage:a instanceof TradingView.LineToolRegressionTrend?LineToolRegressionTrendInputsPropertyPage:a instanceof TradingView.LineToolEllipse||a instanceof TradingView.LineToolRotatedRectangle||a instanceof TradingView.LineToolArc?null:a instanceof TradingView.LineToolTrendAngle?LineToolTrendAngleInputsPropertyPage:a instanceof TradingView.LineToolParallelChannel||
a instanceof TradingView.LineToolPolyline||a instanceof TradingView.LineToolText||a instanceof TradingView.LineToolFibWedge||a instanceof TradingView.LineToolBrush?null:a instanceof TradingView.LineToolHorzLine?LineToolHorzLineInputsPropertyPage:a instanceof TradingView.LineToolBarsPattern||a instanceof TradingView.LineToolDisjointAngle||a instanceof TradingView.LineToolFlatBottom?null:a instanceof TradingView.LineToolVertLine?LineToolVertLineInputsPropertyPage:a instanceof TradingView.StudyLineDataSource?
StudyLineDataSourcePropertyPage:a instanceof TradingView.LineToolIcon?null:LineToolInputsPropertyPage:a instanceof TradingView.Study?a instanceof TradingView.study_ElliottWave?StudyElliottInputsPropertyPage:a instanceof TradingView.study_Compare?StudyCompareInputsPropertyPage:StudyInputsPropertyPage:null}function b(a,b){if(a instanceof TradingView.Series||a instanceof TradingView.ChartWidget||a instanceof TradingView.ESDStudyBase)return ChartStylesPropertyPage;if(a instanceof TradingView.Study)return a instanceof
TradingView.study_PivotPointsHighLow?StudyPivotPointsHighLowStylesPropertyPage:a instanceof TradingView.study_PivotPointsStandard?StudyPivotPointsStandardStylesPropertyPage:a instanceof TradingView.study_ZigZag?StudyZigZagStylesPropertyPage:a instanceof TradingView.study_Overlay?StudyOverlayStylesPropertyPage:a instanceof TradingView.study_LinearRegression?StudyLinearRegressionStylesPropertyPage:"Volume@tv-basicstudies"==a.metaInfo().id?VolumePropertyPage:StudyStylesPropertyPage;if(a instanceof LineDataSource){if(a instanceof
TradingView.LineToolRegressionTrend)return StudyLinearRegressionStylesPropertyPage;if(a instanceof TradingView.LineToolTrendLine)return LineToolTrendLineStylesPropertyPage;if(a instanceof TradingView.LineToolTrendAngle)return LineToolTrendAngleStylesPropertyPage;if(a instanceof TradingView.LineToolDateRange||a instanceof TradingView.LineToolPriceRange)return LineToolDateRangeStylesPropertyPage;if(a instanceof TradingView.LineToolHorzLine||a instanceof TradingView.LineToolHorzRay)return LineToolHorzLineStylesPropertyPage;
if(a instanceof TradingView.LineToolVertLine)return LineToolVertLineStylesPropertyPage;if(a instanceof TradingView.LineToolPitchfork)return LineToolPitchforkStylesPropertyPage;if(a instanceof TradingView.LineToolPitchfan)return LineToolPitchfanStylesPropertyPage;if(a instanceof TradingView.LineToolText)return LineToolTextStylesPropertyPage;if(a instanceof TradingView.LineToolCallout)return LineToolCalloutStylesPropertyPage;if(a instanceof TradingView.LineToolRectangle||a instanceof TradingView.LineToolRotatedRectangle)return LineToolRectangleStylesPropertyPage;
if(a instanceof TradingView.LineToolEllipse)return LineToolEllipseStylesPropertyPage;if(a instanceof TradingView.LineToolArc)return LineToolArcStylesPropertyPage;if(a instanceof TradingView.LineToolTriangle)return LineToolTriangleStylesPropertyPage;if(a instanceof TradingView.LineToolParallelChannel)return LineToolParallelChannelStylesPropertyPage;if(a instanceof TradingView.LineToolDisjointAngle)return LineToolDisjointAngleStylesPropertyPage;if(a instanceof TradingView.LineToolFlatBottom)return LineToolFlatBottomStylesPropertyPage;
if(a instanceof TradingView.LineToolArrowMark)return LineToolArrowMarkStylesPropertyPage;if(a instanceof TradingView.LineToolPriceLabel)return LineToolPriceLabelStylesPropertyPage;if(a instanceof TradingView.LineToolIcon)return LineToolIconStylesPropertyPage;if(a instanceof TradingView.LineToolBalloon)return LineToolBalloonStylesPropertyPage;if(a instanceof TradingView.LineToolBrush)return LineToolBrushStylesPropertyPage;if(a instanceof TradingView.LineToolPrediction)return LineToolPredictionStylesPropertyPage;
if(a instanceof TradingView.LineToolPolyline)return LineToolPolylineStylesPropertyPage;if(a instanceof TradingView.LineToolGannSquare)return LineToolGannSquareStylesPropertyPage;if(a instanceof TradingView.LineToolGannComplex)return LineToolGannComplexStylesPropertyPage;if(a instanceof TradingView.LineToolGannFan)return LineToolGannFanStylesPropertyPage;if(a instanceof TradingView.LineToolFibRetracement)return LineToolFibRetracementStylesPropertyPage;if(a instanceof TradingView.LineToolFibChannel)return LineToolFibChannelStylesPropertyPage;
if(a instanceof TradingView.LineToolFibCircles)return LineToolFibCirclesStylesPropertyPage;if(a instanceof TradingView.LineToolFibSpiral)return LineToolFibSpiralStylesPropertyPage;if(a instanceof TradingView.LineToolFibSpeedResistanceArcs)return LineToolFibSpeedResistanceArcsStylesPropertyPage;if(a instanceof TradingView.LineToolTrendBasedFibExtension)return LineToolTrendBasedFibExtensionStylesPropertyPage;if(a instanceof TradingView.LineToolTrendBasedFibTime)return LineToolTrendBasedFibTimeStylesPropertyPage;
if(a instanceof TradingView.LineToolFibSpeedResistanceFan)return LineToolFibSpeedResistanceFanStylesPropertyPage;if(a instanceof TradingView.LineToolFibTimeZone)return LineToolFibTimeZoneStylesPropertyPage;if(a instanceof TradingView.LineToolProjection)return LineToolProjectionStylesPropertyPage;if(a instanceof TradingView.LineToolFibWedge)return LineToolFibWedgeStylesPropertyPage;if(a instanceof TradingView.LineToolCircleLines)return LineToolCircleLinesStylesPropertyPage;if(a instanceof TradingView.LineToolElliott)return LineToolElliottStylesPropertyPage;
if(a instanceof TradingView.LineToolBarsPattern)return LineToolBarsPatternStylesPropertyPage;if(a instanceof TradingView.LineToolRiskReward)return LineToolRiskRewardStylesPropertyPage;if(a instanceof TradingView.LineTool5PointsPattern)return LineToolLineTool5PointsPatternStylesPropertyPage;if(a instanceof TradingView.LineToolABCD)return LineToolABCDPatternStylesPropertyPage;if(a instanceof TradingView.LineToolTrianglePattern)return LineToolTrianglePatternStylesPropertyPage;if(a instanceof TradingView.LineToolThreeDrivers)return LineToolABCDPatternStylesPropertyPage;
if(a instanceof TradingView.LineToolHeadAndShoulders)return LineToolLineTool5PointsPatternStylesPropertyPage;if(a instanceof TradingView.StudyLineDataSource)return StudyStylesPropertyPage}return null}function c(a){return a instanceof TradingView.ESDStudyBase?null:a instanceof TradingView.Study?StudyDisplayPropertyPage:null}return{createInputsPropertyPage:function(b,c){var f=a(b);return f?new f(b.properties(),c,b):null},createStylesPropertyPage:function(a,c){var f=b(a);return f?new f(a.properties(),
c,a):null},createDisplayPropertyPage:function(a,b){var f=c(a);return f?new f(a.properties(),b,a):null},hasInputsPropertyPage:function(b){return!!a(b)},hasStylesPropertyPage:function(a){return!!b(a)},hasDisplayPropertyPage:function(a){return!!c(a)}}}();function PropertyGroup(a,b,c,d){this._property=a;this._name=b;this._children=c;this._propertyPage=d}PropertyGroup.prototype.property=function(){return this._property};PropertyGroup.prototype.name=function(){return this._name};PropertyGroup.prototype.children=function(){return this._children};PropertyGroup.prototype.propertyPage=function(){return this._propertyPage};function PropertyPage(a,b){this._model=b;this._bindings=new List;this._property=a}PropertyPage.prototype.model=function(){return this._model};PropertyPage.prototype.bindControl=function(a){this._bindings.append(a)};PropertyPage.prototype.loadData=function(){for(var a=0;a<this._bindings.size();a++){var b=this._bindings.item(a);b.setValue(b.property().value())}};
PropertyPage.prototype.saveData=function(){this._model.beginUndoMacro();for(var a=0;a<this._bindings.size();a++){var b=this._bindings.item(a);this._model.setProperty(b.property(),b.value())}this._model.endUndoMacro()};PropertyPage.prototype.createColorPicker=function(){return $(document.createElement("input")).addClass("colorpicker-widget").bind("customcolorchange",function(a,b){TVSettings.setJSON("pickerCustomColors",b)}).tvcolorpicker({customColors:TVSettings.getJSON("pickerCustomColors",[])})};
PropertyPage.prototype.createTextEditor=function(a,b){var c={};a&&(c.width=a);b&&(c.height=b);return $(document.createElement("textarea")).css(c)};PropertyPage.prototype.createCombo=function(a){var b=$(document.createElement("select"));a=a.reduce(function(a,b){return a.add($(document.createElement("option")).prop({value:b,text:b}))},$());return b.append(a)};
PropertyPage.prototype.createKeyCombo=function(a){var b=$(document.createElement("select"));$.each(a||[],function(a,d){$(document.createElement("option")).prop({value:a,text:d}).appendTo(b)});return b};PropertyPage.prototype.createFontEditor=function(a){return this.createCombo(a||["Verdana","Courier New","Times New Roman","Arial"])};PropertyPage.prototype.createFontSizeEditor=function(a){return this.createCombo(a||[10,11,12,14,16,20,24,28,32,40]).addClass("tv-select-container-fontsize")};
PropertyPage.prototype.createSeriesMinTickEditor=function(){var a="<select><option value='default'>"+$.t("Default")+"</option>",b=[{priceScale:1,minMove:1,frac:!1},{priceScale:10,minMove:1,frac:!1},{priceScale:100,minMove:1,frac:!1},{priceScale:1E3,minMove:1,frac:!1},{priceScale:1E4,minMove:1,frac:!1},{priceScale:1E5,minMove:1,frac:!1},{priceScale:1E6,minMove:1,frac:!1},{priceScale:2,minMove:1,frac:!0},{priceScale:4,minMove:1,frac:!0},{priceScale:8,minMove:1,frac:!0},{priceScale:16,minMove:1,frac:!0},
{priceScale:32,minMove:1,frac:!0},{priceScale:64,minMove:1,frac:!0},{priceScale:128,minMove:1,frac:!0},{priceScale:320,minMove:1,frac:!0}],c;for(c in b)var d=b[c],a=a+("<option value='"+(d.priceScale+","+d.minMove+","+d.frac)+"'>"+(d.minMove+"/"+d.priceScale)+"</option>");return $(a+"</select>")};PropertyPage.prototype.createPrecisionEditor=function(){for(var a="<select><option value='default'>"+$.t("Default")+"</option>",b=0;6>=b;b++)a+="<option value='"+b+"'>"+b+"</option>";return $(a+"</select>")};
PropertyPage.prototype.createLabeledCell=function(a,b,c){var d=null;"number"===typeof a.valueOf()&&(d=a,a=b,b=c);a+="";c=this._labelToId(a);var e=$("<td>");$("<label>").html(0<a.length?$.t(a):"").attr("for",c).appendTo(e);d&&e.attr("colspan",d);b&&b.attr("id",c);return e};PropertyPage.prototype.createTableInTable=function(a){a=$("<tr>").appendTo(a);a=$("<td>").appendTo(a);return $('<table cellpadding="0" cellspacing="0">').appendTo(a)};
PropertyPage.prototype._labelToId=function(a){return"control"+a.replace(/(^| )\w/g,function(a){return"-"+a.trim().toLowerCase()})+Math.floor(1E3*Math.random())};PropertyPage.prototype.addRow=function(a){return $(document.createElement("tr")).appendTo(a)};
PropertyPage.prototype.addLabeledRow=function(a,b,c,d){var e=b&&0<b.length?$.t(b):"",f=$(document.createElement("tr")),g=$(document.createElement("td")).html(e);d&&g.attr("colspan",2);c&&(b=this._labelToId(b),c.attr("id",b),g.html('<label for="'+b+'">'+e+"</label>"));return f.append(g).appendTo(a)};PropertyPage.prototype.addEditorRow=function(a,b,c,d){var e=$(document.createElement("td"));c.row=this.addLabeledRow(a,b,c,d);c.appendTo(e.appendTo(c.row));return c};
PropertyPage.prototype.addColorPickerRow=function(a,b){return this.addEditorRow(a,b,this.createColorPicker())};PropertyPage.prototype.addOffsetEditorRow=function(a,b){var c=$("<input/>");c.attr("type","text");c.css("width","100px");c.addClass("ticker");return this.addEditorRow(a,b,c)};PropertyPage.prototype.addFontEditorRow=function(a,b){return this.addEditorRow(a,b,this.createFontEditor())};
PropertyPage.prototype.refreshStateControls=function(a,b,c){for(var d=0;d<b.length;d++){var e=b[d],f=a[e.id];f.toggle(this.parseRule(e.visible,b,c));f.attr("disabled",!this.parseRule(e.visible,b,c))}};PropertyPage.prototype.parseRule=function(a,b,c){if(!a)return!0;a=a.split("==");return 2>a.length?!1:c[a[0]].value()==a[1]};PropertyPage.prototype.destroy=function(){for(var a=this._bindings.size();a--;)this._bindings.item(a).destroy();this._bindings.clear()};
function Binding(a,b,c,d,e){a?(this._control=a,this._property=b,this._applyOnFly=c,this._undoModel=d,this._undoText=e,b&&(this.setValue(b.value()),b.listeners().subscribe(this,Binding.prototype.propertyChanged))):TradingView.logDebug("Binding: missing control")}
Binding.prototype._attachToControl=function(a,b){var c=this;if(b)a.on("keyup change",function(a){a=c.value();c.setValueToProperty(a);c.setValue(a)});else a.keypress(function(a){13==a.which&&(a=c.value(),c.setValueToProperty(a),c.setValue(a))}),a.focusout(function(a){a=c.value();c.setValueToProperty(a);c.setValue(a)}),a.change(function(a){a=c.value();c.setValueToProperty(a);c.setValue(a)})};Binding.prototype.control=function(){return this._control};
Binding.prototype.setValueToProperty=function(a){this._undoModel.setProperty(this._property,a,this._undoText)};Binding.prototype.property=function(){return this._property};Binding.prototype.propertyChanged=function(a){this.setValue(a.value())};Binding.prototype.destroy=function(){this._property&&this._property.listeners().unsubscribe(this,Binding.prototype.propertyChanged)};function UppercaseTransformer(a){return a.toUpperCase()}function GreateTransformer(a){return function(b){return b<a?a:b}}
function LessTransformer(a){return function(b){return b>a?a:b}}function ToIntTransformer(a){return function(b){b=parseInt(b,10);return isNaN(b)?a:b}}function ToFloatTransformer(a){return function(b){b=parseFloat(b);return isNaN(b)?a:b}}function ToAsciiTransformer(){return function(a){var b=a;for(a=a.replace(/[^\u0000-\u007F]/,"");a.length!==b.length;)b=a,a=b.replace(/[^\u0000-\u007F]/,"");return a}}function ReplaceEmptyTransformer(a){return function(b){return 0===b.length?a:b}}
function SimpleStringBinder(a,b,c,d,e,f){Binding.call(this,a,b,d,e,f);this._transformFunction=c;this._attachToControl(a,d)}inherit(SimpleStringBinder,Binding);SimpleStringBinder.prototype.value=function(){var a=this._control.val();if(this._transformFunction)if(isArray(this._transformFunction))for(var b=0;b<this._transformFunction.length;b++)a=this._transformFunction[b](a);else a=this._transformFunction(a);return a};SimpleStringBinder.prototype.setValue=function(a){this._control.val()!==a&&this._control.val(a)};
function SessionBinder(a,b,c,d,e,f){this._subControlIds=b;Binding.call(this,a,c,d,e,f);this._forEachSubControl(function(a){this._attachToControl(a,d)})}inherit(SessionBinder,Binding);SessionBinder.prototype._forEachSubControl=function(a){this._subControlIds.forEach(function(b){b="#"+b;b=this.control().find(b);a.call(this,b)},this)};
SessionBinder.prototype._parseSessions=function(a){var b=a.split("-",2);2!=b.length&&(b=["0","0"]);a=parseInt(b[0]);b=parseInt(b[1]);return[Math.floor(a/100),a%100,Math.floor(b/100),b%100]};
SessionBinder.prototype.value=function(){var a=[];this._forEachSubControl(function(b){a.push(b.val())});var b=function(a,b){b.forEach(function(b){a=b(a)});return("0"+a).slice(-2)},c=[ToIntTransformer(0),GreateTransformer(0),LessTransformer(23)],d=[ToIntTransformer(0),GreateTransformer(0),LessTransformer(59)];return b(a[0],c)+b(a[1],d)+"-"+b(a[2],c)+b(a[3],d)};
SessionBinder.prototype.setValue=function(a){var b=this._parseSessions(a);this._forEachSubControl(function(a){var d=a.val(),e=("0"+b[0]).slice(-2);b.shift();d!==e&&a.val(e)})};
function BarTimeBinder(a,b,c,d,e,f,g){this._model=d;this._mainSeries=f;this._toIntTransformer=ToIntTransformer(g);this._disabled=!1;Binding.call(this,a,b,c,d,e);var h=this;c&&a.change(function(){h.setValueToProperty(h.value())});this._mainSeries.onBarReceived().subscribe(this,function(a){h.setValue(this.property().value())})}inherit(BarTimeBinder,Binding);
BarTimeBinder.prototype.value=function(){if(this._disabled)return this._control.attr("disabled",!0),null;var a=this._control.val(),a=this._toIntTransformer(a);0>a&&(a=0);var b=this._mainSeries.bars().size();b<=a&&(a=b-1);return 1E3*this._mainSeries.bars()._valueAt(this._mainSeries.bars().lastIndex()-a)[TIME_PLOT]};
BarTimeBinder.prototype.setValue=function(a){this._disabled||null==a?this._control.attr("disabled",!0):0>a?(this._control.val(-a),this._property.setValue(this.value())):(a=this._mainSeries.data().timeToBarIndex(a/1E3,SEARCH_FROM_RIGHT),null===a?this._disabled=!0:(a=this._mainSeries.bars().lastIndex()-a,this._control.val()!==a.toString()&&this._control.val(a)))};
function SymbolBinder(a,b,c,d,e){Binding.call(this,a,b,c,d,e);if(c)a.on("accept-symbol",function(a,b){this.setValueToProperty(b)}.bind(this))}inherit(SymbolBinder,Binding);SymbolBinder.prototype.value=function(){return this._control.val()};SymbolBinder.prototype.setValue=function(a){var b=this.value();a&&b!==a&&this._control.val(a)};
function SimpleComboBinder(a,b,c,d,e,f,g){Binding.call(this,a,b,d,e,f);this._transformFunction=c;this._setter=g;var h=this;d&&a.change(function(){h._setter?h._setter.call(h,h.value()):h.setValueToProperty(h.value())})}inherit(SimpleComboBinder,Binding);SimpleComboBinder.prototype.value=function(){var a=this._control.val();this._transformFunction&&(a=this._transformFunction(a));return a};
SimpleComboBinder.prototype.setValue=function(a){this._control.val(a);if(this._control.selectbox)try{var b=this._control.find("[value='"+a+"']");if(0<b.length){var c=b[0];this._control.selectbox("change",c.value,c.text)}}catch(d){}};function StaticContentBinder(a,b){Binding.call(this,a,b)}inherit(StaticContentBinder,Binding);StaticContentBinder.prototype.value=function(){return this._property.value()};StaticContentBinder.prototype.setValue=function(a){return this._control.html(a)};
function BooleanBinder(a,b,c,d,e,f){if(!a.is(":checkbox, :radio"))return new BooleanBinder.PushButtonBinder(a,b,c,d,e);Binding.call(this,a,b,c,d,e);this._setter=f;var g=this;c&&a.change(function(){g._setter?g._setter.call(g,g.value()):g.setValueToProperty(g.value())})}inherit(BooleanBinder,Binding);BooleanBinder.prototype.value=function(){return this.control().is(":checked")};
BooleanBinder.prototype.setValue=function(a){if(this.control().is(".visibility-switch")){var b={opacity:a?1:0.5},c=a?"enable":"disable",d=this.control().data("hides");if(d)d.closest("td").css(b);else{var e=this.control();e.parent().parent().data("visible",a).find("td").filter(function(){var a=$(this);return!a.find("label").length&&a.find(":checkbox").attr("id")!==e.attr("id")}).each(function(){var d=$(this);d.children().each(function(){var e=$(this);e.is(".ui-slider")?e.slider(c):(e.is("select")?
e.selectbox(c):e.is(".custom-select")?e.data(c)():e.prop("disabled",!a),d.css(b))})})}}return this.control().attr("checked",!!a)};function DisabledBinder(a,b,c,d,e){Binding.call(this,a,b,c,d,e)}inherit(DisabledBinder,Binding);DisabledBinder.prototype.value=function(){return this.control().is(":disabled")};DisabledBinder.prototype.setValue=function(a){return this.control().attr("disabled",!!a)};
BooleanBinder.PushButtonBinder=function(a,b,c,d,e){Binding.call(this,a,b,c,d,e);var f=this;c&&a.click(function(){var a=$(this).toggleClass("active").hasClass("active");f.setValueToProperty(a)})};inherit(BooleanBinder.PushButtonBinder,Binding);BooleanBinder.PushButtonBinder.prototype.value=function(){return this.control().hasClass("active")};BooleanBinder.PushButtonBinder.prototype.setValue=function(a){return this.control().toggleClass("active",!!a)};
function ActionBinder(a,b,c,d,e){c?(Binding.call(this,a,b,!0,c,d),e?a.callbacks().subscribe(this,e):a.callbacks().subscribe(this,ActionBinder.prototype.onActionCallback)):TradingView.logDebug("ActionBinder: Missed undo model")}inherit(ActionBinder,Binding);ActionBinder.prototype.onActionCallback=function(a){this._undoModel.setProperty(this._property,this.value(),this._undoText)};ActionBinder.prototype.value=function(){return this.control().checked};
ActionBinder.prototype.setValue=function(a){return this.control().checked=!!a};function ColorBinding(a,b,c,d){Binding.call(this,a,b,c,d);var e=this;c&&a.change(function(){e.setValueToProperty(e.value())})}inherit(ColorBinding,Binding);ColorBinding.prototype.value=function(){return this._control.val()};ColorBinding.prototype.setValue=function(a){this._control.val(a);this._control.change();this._control.color&&this._control.color.fromString(a)};
TradingView.ToggleButtonBinding=function(a,b){b.toggle(a.checked);b.content().click(function(){a.setChecked(b.toggled());a.callbacks().fire(a)})};
function SliderBinder(a,b,c,d,e){isNumber(b.value())||(console.warn("Property cannot be binded to control, bad value (expect number): "+b.value()),b=new Property);Binding.call(this,a,b,c,d,e);var f=this;c&&(a.bind("slidechange",function(a,b){f.setValueToProperty(b.value)}),a.bind("slide",function(a,b){f.setValueToProperty(b.value)}));a.bind("slidestart",function(a,b){d.beginUndoMacro(e)});a.bind("slidestop",function(a,b){d.endUndoMacro()})}inherit(SliderBinder,Binding);
SliderBinder.prototype.value=function(){return this._control.slider("option","value")};SliderBinder.prototype.setValue=function(a){this._control.slider("option","value",a)};function ExtendedHoursBinder(a,b,c,d,e,f){BooleanBinder.call(this,a,b,d,e,f);this._intervalProperty=c;this._intervalProperty.listeners().subscribe(this,this.onIntervalChanged);this.onIntervalChanged()}inherit(ExtendedHoursBinder,BooleanBinder);
ExtendedHoursBinder.prototype.onIntervalChanged=function(){1440>+this._intervalProperty.value()?this._control.attr({disabled:!1,checked:!!this._property.value()}):this._control.attr({disabled:!0,checked:!1})};ExtendedHoursBinder.prototype.value=function(){return this._control.is(":disabled")?this._property.value():BooleanBinder.prototype.value.call(this)};ExtendedHoursBinder.prototype.setValue=function(a){if(!this._control.is(":disabled"))return BooleanBinder.prototype.setValue.call(this,a)};
ExtendedHoursBinder.prototype.destroy=function(){this._intervalProperty.listeners().unsubscribe(this,this.onIntervalChanged);delete this._intervalProperty;BooleanBinder.prototype.destroy.call(this,arguments)};function SeriesStylePropertyPageMixin(){}inherit(SeriesStylePropertyPageMixin,PropertyPage);SeriesStylePropertyPageMixin.prototype.getInputTitle=function(a,b){return b.inputInfo?b.inputInfo[a].name.value():a.toLowerCase().replace(/\b\w/g,function(a){return a.toUpperCase()})};
SeriesStylePropertyPageMixin.prototype.prepareLayoutImpl=function(a,b,c,d){d=d||{};for(var e={},f=this,g=0;g<a.inputs.length;g++){var h=a.inputs[g],k=h.id,m=this.getInputTitle(k,c),n=$("<tr/>");n.appendTo(b);var q=$("<td/>");q.appendTo(n);q.addClass("propertypage-name-label");q.text(m);var l=$("<td"+(d.valueColspan?' colspan = "'+d.valueColspan+'"':"")+"/>");l.appendTo(n);q=null;if(h.options)for(var q=$("<select/>"),s=0;s<h.options.length;s++){var u=h.options[s];$("<option value='"+u+"'>"+u+"</option>").appendTo(q)}else q=
$("<input/>"),"bool"===h.type?q.attr("type","checkbox"):q.attr("type","text");q.appendTo(l);q.css("width","100px");m="Change "+m;if(h.options)this.bindControl(new SimpleComboBinder(q,c.inputs[k],null,!0,this.model(),m));else if("integer"===h.type)transformers=[ToIntTransformer(h.defval)],h.min&&transformers.push(GreateTransformer(h.min)),h.max&&transformers.push(LessTransformer(h.max)),this.bindControl(new SimpleStringBinder(q,c.inputs[k],transformers,!1,this.model(),m)),q.addClass("ticker");else if("float"===
h.type){transformers=[ToFloatTransformer(h.defval)];if(h.min){l=void 0;if(("BarSetRenko@tv-prostudies"==a.id||"BarSetPnF@tv-prostudies"==a.id)&&"boxSize"==h.id||"BarSetKagi@tv-prostudies"==a.id&&"reversalAmount"==h.id)l=this._model.model().mainSeries().symbolInfo(),l=l.minmov/l.pricescale;transformers.push(GreateTransformer(l?l:h.min))}h.max&&transformers.push(LessTransformer(h.max));this.bindControl(new SimpleStringBinder(q,c.inputs[k],transformers,!1,this.model(),m));q.addClass("ticker")}else"text"===
h.type&&this.bindControl(new SimpleStringBinder(q,this._property.inputs[k],null,!1,this.model(),m));q.change(function(b){f.refreshStateControls(e,a.inputs,c.inputs)});e[h.id]=n}this.refreshStateControls(e,a.inputs,c.inputs)};SeriesStylePropertyPageMixin.prototype.getMetaInfo=function(a){for(var b=this._model.m_model._studiesMetaData,c=0;c<b.size();c++)if(b.item(c).id===a)return b.item(c);return null};
SeriesStylePropertyPageMixin.prototype._prepareSeriesStyleLayout=function(a,b,c,d){var e=$("<tbody>").appendTo(a),f=this._candlesColorerTbody=$("<tbody>").appendTo(b),g=this._barsColorerTbody=$("<tbody>").appendTo(b),h=this._haColorerTbody=$("<tbody>").appendTo(b),k=this._candlesTbody=$("<tbody>").appendTo(c),m=this._hollowCandlesTbody=$("<tbody>").appendTo(c),n=this._haTbody=$("<tbody>").appendTo(c),q=this._barsTbody=$("<tbody>").appendTo(c),l=this._lineTbody=$("<tbody>").appendTo(c);b=this._areaTbody=
$("<tbody>").appendTo(c);var s=this._renkoTbody=$("<tbody>").appendTo(c),u=this._pbTbody=$("<tbody>").appendTo(c);a=this._kagiTbody=$("<tbody>").appendTo(c);c=this._pnfTbody=$("<tbody>").appendTo(c);var e=this.addLabeledRow(e,"Style"),z=$(document.createElement("td")).appendTo(e);z.addClass("property-wide-select");e=$(document.createElement("select"));$("<option value="+TradingView.Series.STYLE_BARS+">"+$.t("Bars")+"</option>").appendTo(e);$("<option value="+TradingView.Series.STYLE_CANDLES+">"+$.t("Candles")+
"</option>").appendTo(e);$("<option value="+TradingView.Series.STYLE_HOLLOW_CANDLES+">"+$.t("Hollow Candles")+"</option>").appendTo(e);this instanceof StudyOverlayStylesPropertyPage||$("<option value="+TradingView.Series.STYLE_HEIKEN_ASHI+">"+$.t("Heiken Ashi")+"</option>").appendTo(e);$("<option value="+TradingView.Series.STYLE_LINE+">"+$.t("Line")+"</option>").appendTo(e);$("<option value="+TradingView.Series.STYLE_AREA+">"+$.t("Area")+"</option>").appendTo(e);e.css("width","100px").appendTo(z);
this.switchStyle();this.bindControl(new SimpleComboBinder(e,d.style,parseInt,!0,this.model(),"Change Series Style",function(a){this._undoModel.setChartStyleProperty(this._property,a,this._undoText)}));d.style.listeners().subscribe(this,this.switchStyle);var z=this.createColorPicker(),t=this.createColorPicker(),B=this.createColorPicker(),A=this.createColorPicker(),w=this.createColorPicker(),v=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(A).add(w)),C=$("<input type='checkbox' class='visibility-switch'/>").data("hides",
$(B)),H=$("<input type='checkbox'/>"),f=this.addLabeledRow(f,"Color bars based on previous close",H);$("<td>").append(H).prependTo(f);f=this.addLabeledRow(k,"Candles");$("<td>").prependTo(f);$("<td>").append(z).appendTo(f);$("<td>").append(t).appendTo(f);f=this.addLabeledRow(k,"Borders",v);$("<td>").append(v).prependTo(f);$("<td>").append(A).appendTo(f);$("<td>").append(w).appendTo(f);f=this.addLabeledRow(k,"Wick",C);$("<td>").append(C).prependTo(f);$("<td>").append(B).appendTo(f);this.bindControl(new ColorBinding(z,
d.candleStyle.upColor,!0,this.model(),"Change Candle Up Color"));this.bindControl(new ColorBinding(t,d.candleStyle.downColor,!0,this.model(),"Change Candle Down Color"));this.bindControl(new BooleanBinder(C,d.candleStyle.drawWick,!0,this.model(),"Change Candle Wick Visibility"));this.bindControl(new ColorBinding(B,d.candleStyle.wickColor,!0,this.model(),"Change Candle Wick Color"));this.bindControl(new BooleanBinder(v,d.candleStyle.drawBorder,!0,this.model(),"Change Candle Border Visibility"));this.bindControl(new ColorBinding(A,
d.candleStyle.borderUpColor,!0,this.model(),"Change Candle Up Border Color"));this.bindControl(new ColorBinding(w,d.candleStyle.borderDownColor,!0,this.model(),"Change Candle Down Border Color"));this.bindControl(new BooleanBinder(H,d.candleStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close"));k=this.createColorPicker();z=this.createColorPicker();t=this.createColorPicker();B=this.createColorPicker();A=this.createColorPicker();w=$("<input type='checkbox' class='visibility-switch'/>").data("hides",
$(B).add(A));v=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(t));f=this.addLabeledRow(m,"Candles");$("<td>").prependTo(f);$("<td>").append(k).appendTo(f);$("<td>").append(z).appendTo(f);f=this.addLabeledRow(m,"Borders",w);$("<td>").append(w).prependTo(f);$("<td>").append(B).appendTo(f);$("<td>").append(A).appendTo(f);f=this.addLabeledRow(m,"Wick",v);$("<td>").append(v).prependTo(f);$("<td>").append(t).appendTo(f);this.bindControl(new ColorBinding(k,d.hollowCandleStyle.upColor,
!0,this.model(),"Change Hollow Candle Up Color"));this.bindControl(new ColorBinding(z,d.hollowCandleStyle.downColor,!0,this.model(),"Change Hollow Candle Down Color"));this.bindControl(new BooleanBinder(v,d.hollowCandleStyle.drawWick,!0,this.model(),"Change Hollow Candle Wick Visibility"));this.bindControl(new ColorBinding(t,d.hollowCandleStyle.wickColor,!0,this.model(),"Change Hollow Candle Wick Color"));this.bindControl(new BooleanBinder(w,d.hollowCandleStyle.drawBorder,!0,this.model(),"Change Hollow Candle Border Visibility"));
this.bindControl(new ColorBinding(B,d.hollowCandleStyle.borderUpColor,!0,this.model(),"Change Hollow Candle Up Border Color"));this.bindControl(new ColorBinding(A,d.hollowCandleStyle.borderDownColor,!0,this.model(),"Change Hollow Candle Down Border Color"));m=$("<input type='checkbox'/>");f=this.addLabeledRow(g,"Color bars based on previous close",m);$("<td>").append(m).prependTo(f);k=$("<input type='checkbox'/>");f=this.addLabeledRow(g,"HLC Bars",k);$("<td>").append(k).prependTo(f);f=this.addColorPickerRow(q,
"Up Color");g=this.addColorPickerRow(q,"Down Color");this.bindControl(new ColorBinding(f,d.barStyle.upColor,!0,this.model(),"Change Bar Up Color"));this.bindControl(new ColorBinding(g,d.barStyle.downColor,!0,this.model(),"Change Bar Down Color"));this.bindControl(new BooleanBinder(m,d.barStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close"));this.bindControl(new BooleanBinder(k,d.barStyle.dontDrawOpen,!0,this.model(),"Change HLC Bars"));g=TradingView.createPriceSourceEditor();
f=this.addLabeledRow(l,"Price Source");$('<td colspan="3">').append(g).appendTo(f);f=this.addLabeledRow(l,"Type");f=$('<td colspan="3">').appendTo(f);f.addClass("property-wide-select");q=$(document.createElement("select"));$("<option value="+TradingView.Series.STYLE_LINE_TYPE_SIMPLE+">"+$.t("Simple")+"</option>").appendTo(q);$("<option value="+TradingView.Series.STYLE_LINE_TYPE_MARKERS+">"+$.t("With Markers")+"</option>").appendTo(q);$("<option value="+TradingView.Series.STYLE_LINE_TYPE_STEP+">"+
$.t("Step")+"</option>").appendTo(q);q.appendTo(f);f=this.addLabeledRow(l,"Line");l=this.createColorPicker();m=TradingView.createLineWidthEditor();$("<td>").append(l).appendTo(f);$("<td>").append(m).appendTo(f);this.bindControl(new SimpleComboBinder(g,d.lineStyle.priceSource,null,!0,this.model(),"Change Price Source"));this.bindControl(new SimpleComboBinder(q,d.lineStyle.styleType,parseInt,!0,this.model(),"Change Line Type"));this.bindControl(new ColorBinding(l,d.lineStyle.color,!0,this.model(),"Change Line Color"));
this.bindControl(new SliderBinder(m,d.lineStyle.linewidth,!0,this.model(),"Change Line Width"));this instanceof StudyOverlayStylesPropertyPage||TradingView.isRunningChartingLibrary||($("<option value="+TradingView.Series.STYLE_RENKO+">Renko</option>").appendTo(e),$("<option value="+TradingView.Series.STYLE_PB+">Line break</option>").appendTo(e),$("<option value="+TradingView.Series.STYLE_KAGI+">Kagi</option>").appendTo(e),$("<option value="+TradingView.Series.STYLE_PNF+">Point & Figure</option>").appendTo(e),
l=this.createColorPicker(),e=this.createColorPicker(),g=this.createColorPicker(),q=this.createColorPicker(),m=this.createColorPicker(),k=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(q).add(m)),z=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(g)),t=$("<input type='checkbox'/>"),f=this.addLabeledRow(h,"Color bars based on previous close",t),$("<td>").append(t).prependTo(f),f=this.addLabeledRow(n,"Candles"),$("<td>").prependTo(f),$("<td>").append(l).appendTo(f),
$("<td>").append(e).appendTo(f),f=this.addLabeledRow(n,"Borders",k),$("<td>").append(k).prependTo(f),$("<td>").append(q).appendTo(f),$("<td>").append(m).appendTo(f),f=this.addLabeledRow(n,"Wick",z),$("<td>").append(z).prependTo(f),$("<td>").append(g).appendTo(f),this.bindControl(new ColorBinding(l,d.haStyle.upColor,!0,this.model(),"Change Heiken Ashi Up Color")),this.bindControl(new ColorBinding(e,d.haStyle.downColor,!0,this.model(),"Change Heiken Ashi Down Color")),this.bindControl(new BooleanBinder(z,
d.haStyle.drawWick,!0,this.model(),"Change Heiken Ashi Wick Visibility")),this.bindControl(new ColorBinding(g,d.haStyle.wickColor,!0,this.model(),"Change Heiken Ashi Wick Color")),this.bindControl(new BooleanBinder(k,d.haStyle.drawBorder,!0,this.model(),"Change Heiken Ashi Border Visibility")),this.bindControl(new ColorBinding(q,d.haStyle.borderUpColor,!0,this.model(),"Change Heiken Ashi Up Border Color")),this.bindControl(new ColorBinding(m,d.haStyle.borderDownColor,!0,this.model(),"Change Heiken Ashi Down Border Color")),
this.bindControl(new BooleanBinder(t,d.haStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close")),h=this.createColorPicker(),n=this.createColorPicker(),f=this.addLabeledRow(s,"Up bars"),$('<td class="some-colorpicker">').append(h).append(n).appendTo(f),l=this.createColorPicker(),e=this.createColorPicker(),f=this.addLabeledRow(s,"Down bars"),$('<td class="some-colorpicker">').append(l).append(e).appendTo(f),g=this.createColorPicker(),q=this.createColorPicker(),f=this.addLabeledRow(s,
"Projection up bars"),$('<td class="some-colorpicker">').append(g).append(q).appendTo(f),m=this.createColorPicker(),k=this.createColorPicker(),f=this.addLabeledRow(s,"Projection down bars"),$('<td class="some-colorpicker">').append(m).append(k).appendTo(f),this.prepareLayoutImpl(this.getMetaInfo("BarSetRenko@tv-prostudies"),s,d.renkoStyle),this.bindControl(new ColorBinding(h,d.renkoStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new ColorBinding(l,d.renkoStyle.downColor,!0,
this.model(),"Change Bar Down Color")),this.bindControl(new ColorBinding(g,d.renkoStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new ColorBinding(m,d.renkoStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),this.bindControl(new ColorBinding(n,d.renkoStyle.borderUpColor,!0,this.model(),"Change Border Bar Up Color")),this.bindControl(new ColorBinding(e,d.renkoStyle.borderDownColor,!0,this.model(),"Change Border Bar Down Color")),
this.bindControl(new ColorBinding(q,d.renkoStyle.borderUpColorProjection,!0,this.model(),"Change Projection Border Bar Up Color")),this.bindControl(new ColorBinding(k,d.renkoStyle.borderDownColorProjection,!0,this.model(),"Change Projection Border Bar Down Color")),s=this.createColorPicker(),h=this.createColorPicker(),f=this.addLabeledRow(u,"Up bars"),$('<td class="some-colorpicker">').append(s).append(h).appendTo(f),n=this.createColorPicker(),l=this.createColorPicker(),f=this.addLabeledRow(u,"Down bars"),
$('<td class="some-colorpicker">').append(n).append(l).appendTo(f),e=this.createColorPicker(),g=this.createColorPicker(),f=this.addLabeledRow(u,"Projection up bars"),$('<td class="some-colorpicker">').append(e).append(g).appendTo(f),q=this.createColorPicker(),m=this.createColorPicker(),f=this.addLabeledRow(u,"Projection down bars"),$('<td class="some-colorpicker">').append(q).append(m).appendTo(f),this.prepareLayoutImpl(this.getMetaInfo("BarSetPriceBreak@tv-prostudies"),u,d.pbStyle,{valueColspan:2}),
this.bindControl(new ColorBinding(s,d.pbStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new ColorBinding(n,d.pbStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new ColorBinding(e,d.pbStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new ColorBinding(q,d.pbStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),this.bindControl(new ColorBinding(h,d.pbStyle.borderUpColor,!0,this.model(),
"Change Border Bar Up Color")),this.bindControl(new ColorBinding(l,d.pbStyle.borderDownColor,!0,this.model(),"Change Border Bar Down Color")),this.bindControl(new ColorBinding(g,d.pbStyle.borderUpColorProjection,!0,this.model(),"Change Projection Border Bar Up Color")),this.bindControl(new ColorBinding(m,d.pbStyle.borderDownColorProjection,!0,this.model(),"Change Projection Border Bar Down Color")),u=this.addColorPickerRow(a,"Up bars"),f=this.addColorPickerRow(a,"Down bars"),s=this.addColorPickerRow(a,
"Projection up bars"),h=this.addColorPickerRow(a,"Projection down bars"),this.prepareLayoutImpl(this.getMetaInfo("BarSetKagi@tv-prostudies"),a,d.kagiStyle),this.bindControl(new ColorBinding(u,d.kagiStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new ColorBinding(f,d.kagiStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new ColorBinding(s,d.kagiStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new ColorBinding(h,
d.kagiStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),a=this.addColorPickerRow(c,"Up bars"),u=this.addColorPickerRow(c,"Down bars"),f=this.addColorPickerRow(c,"Projection up bars"),s=this.addColorPickerRow(c,"Projection down bars"),this.prepareLayoutImpl(this.getMetaInfo("BarSetPnF@tv-prostudies"),c,d.pnfStyle),this.bindControl(new ColorBinding(a,d.pnfStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new ColorBinding(u,d.pnfStyle.downColor,!0,this.model(),
"Change Bar Down Color")),this.bindControl(new ColorBinding(f,d.pnfStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new ColorBinding(s,d.pnfStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")));c=TradingView.createPriceSourceEditor();f=this.addLabeledRow(b,"Price Source");$('<td colspan="3">').appendTo(f).append(c);a=this.createColorPicker();u=TradingView.createLineWidthEditor();f=this.addLabeledRow(b,"Line");$("<td>").appendTo(f).append(a);
$('<td colspan="2">').appendTo(f).append(u);s=this.createColorPicker();h=this.createColorPicker();n=TradingView.createTransparencyEditor(h);f=this.addLabeledRow(b,"Fill");$("<td>").appendTo(f).append(s);$("<td>").appendTo(f).append(h);$("<td>").appendTo(f).append(n);this.bindControl(new SimpleComboBinder(c,d.areaStyle.priceSource,null,!0,this.model(),"Change Price Source"));this.bindControl(new ColorBinding(a,d.areaStyle.linecolor,!0,this.model(),"Change Line Color"));this.bindControl(new SliderBinder(u,
d.areaStyle.linewidth,!0,this.model(),"Change Line Width"));this.bindControl(new ColorBinding(s,d.areaStyle.color1,!0,this.model(),"Change Line Color"));this.bindControl(new ColorBinding(h,d.areaStyle.color2,!0,this.model(),"Change Line Color"));this.bindControl(new SliderBinder(n,d.areaStyle.transparency,!0,this.model(),"Change Area Transparency"))};TradingView.LinetoolTemplatesList=function(a,b,c){this._toolName=a;this._applyTemplate=b;this._options=$.extend({saveAsText:"Save As...",applyDefaultText:"Apply Defaults"},c||{});this._list=[];if(!TradingView.isRunningChartingLibrary){var d=this;this.templatesDeferred=$.get("/drawing-templates/"+this._toolName+"/",function(a){d._list=a}).error(function(a){document.write(a.responseText)})}};TradingView.LinetoolTemplatesList.prototype.getData=function(){return this._list};
TradingView.LinetoolTemplatesList.prototype.templatesLoaded=function(){return this.templatesDeferred};
TradingView.LinetoolTemplatesList.prototype.createButton=function(a){var b=this;a=$.extend({},a,b._options);var c=$("<a></span></a>").addClass(a.buttonClass?a.buttonClass:"tv-button").html(a.buttonInner?a.buttonInner:'Template<span class="icon-dropdown">');TradingView.bindPopupMenu(c,null,{event:"button-popup"});c.bind("click",function(c){c.stopPropagation();if(!$(this).is("active")){c=[];"function"===typeof a.getDataForSaveAs&&c.push({title:a.saveAsText,action:function(){runOrSignIn(function(){var c=
function(c){var d=JSON.stringify(a.getDataForSaveAs());b.saveTemplate(c,d)}.bind(b);TradingView.showChartNameDialog(c,"Save template as...","Template name",64)})},addClass:"special"});"function"===typeof a.defaultsCallback&&c.push({title:a.applyDefaultText,action:a.defaultsCallback,addClass:"special"});var e=[];$.each(b._list,function(a,c){e.push({title:c,action:function(){b.loadTemplate.call(b,c)},deleteAction:function(){runOrSignIn(function(){TVDialogs.showConfirm("Template","Do you realy want to delete "+
(c?'"'+c+'"':"")+" template?",function(){b.removeTemplate.call(b,c)})})}})});e.length&&(e.sort(function(a,b){a=a.title.toUpperCase();b=b.title.toUpperCase();return a==b?0:a>b?1:-1}),c.push({separator:!0}),c=c.concat(e));$(this).trigger("button-popup",[c])}});return c};TradingView.LinetoolTemplatesList.prototype.loadTemplate=function(a){var b=this;return $.get("/drawing-template/"+this._toolName+"/?templateName="+encodeURIComponent(a),function(a){b._applyTemplate(JSON.parse(a.content))}).error(function(a){console.warn(a.responseText)})};
TradingView.LinetoolTemplatesList.prototype.removeTemplate=function(a){a&&($.post("/remove-drawing-template/",{name:a,tool:this._toolName}).error(function(a){console.warn(a.responseText)}),this._list=$.grep(this._list,function(b){return b!=a}))};
TradingView.LinetoolTemplatesList.prototype.saveTemplate=function(a,b){var c=this;if(a&&b){a=clean(a);var d=-1!=$.inArray(a,c._list),e=function(){$.post("/save-drawing-template/",{name:a,tool:c._toolName,content:b},function(){d||c._list.push(a)}).error(function(a){console.warn(a.responseText)})};d?TVDialogs.showConfirm("Confirm replacing",'Do you realy want to replace "'+a+'"?',e):e()}};
TradingView.LinetoolTemplatesList.prototype.deleteAction=function(a){var b=this;runOrSignIn(function(){TVDialogs.showConfirm("Template","Do you realy want to delete "+(a?'"'+a+'"':"")+" template?",function(){b.removeTemplate.call(b,a)})})};TradingView.LinetoolTemplatesList.prototype.showSaveDialog=function(a){var b=this;runOrSignIn(function(){TradingView.showChartNameDialog(function(c){var d=JSON.stringify(a.template());b.saveTemplate(c,d)},"Save template as...","Template name",64)})};function TemplatesLineToolPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._linetool=c;this._templateList=new TradingView.LinetoolTemplatesList(this._linetool._constructor,this.applyTemplate.bind(this))}inherit(TemplatesLineToolPropertyPage,PropertyPage);TemplatesLineToolPropertyPage.prototype.applyTemplate=function(a){this._linetool.restoreTemplate(a);this._model.model().updateSource(this._linetool);this.loadData()};
TemplatesLineToolPropertyPage.prototype.createTemplateButton=function(a){var b=this;a=$.extend({},a,{getDataForSaveAs:function(){return b._linetool.template()}.bind(b)});return this._templateList.createButton(a)};
TemplatesLineToolPropertyPage.prototype.appendTemplateRow=function(a){if(is_authenticated){var b=$(document.createElement("tr"));b.appendTo(a);var c=$(document.createElement("td"));c.attr("colspan",2);c.appendTo(b);b=$('<div class="dialog-theme-buttons"></div>').appendTo(c);this.templateButton=$(this.createTemplateButton());this.templateButton.appendTo(b);$('<tr><td class="property-page-separator-cell" colspan="6"><div class="property-page-separator"></div></td></tr>').appendTo(a)}};"undefined"!=typeof FlashCanvas&&FlashCanvas.setOptions({disableContextMenu:!0});TradingView.setCanvasSize=function(a,b){a.width=b.w;a.height=b.h;"undefined"==typeof FlashCanvas&&a.getContext("2d").translate(0.5,0.5)};function clearRect(a,b,c,d,e,f){a.save();"undefined"==typeof FlashCanvas&&a.translate(-0.5,-0.5);a.fillStyle=f;a.fillRect(b,c,d,e);a.restore()}
TradingView.addCanvasTo=function(a,b){var c=document.createElement("canvas");a.append(c);"undefined"!=typeof FlashCanvas&&FlashCanvas.initElement(c);TradingView.setCanvasSize(c,b);return c};TradingView.Rect=function(a,b,c,d){this.x=a;this.y=b;this.w=c;this.h=d};TradingView.Size=function(a,b){this.w=a;this.h=b};TradingView.Size.prototype.equals=function(a){return this.w===a.w&&this.h===a.h};TradingView.Point=function(a,b){this.x=a;this.y=b};
TradingView.setAbsoluteRect=function(a,b){a.css("position","absolute");a.css("left",b.x+"px");a.css("top",b.y+"px");a.width(b.w);a.height(b.h)};TradingView.setAbsolutePos=function(a,b){a.css("position","absolute");a.css("left",b.x+"px");a.css("top",b.y+"px")};TradingView.addLocalCoordsToMouseEvent=function(a,b){var c=a.offset();b.localX=b.pageX-c.left;b.localY=b.pageY-c.top};TradingView.processEvent=function(a,b,c,d){d&&(TradingView.addLocalCoordsToMouseEvent(b,a),d.call(c,a,b))};
TradingView.MOUSE_RIGHT_BUTTON=2;
TradingView.setMouseEventHandler=function(a,b,c){var d=function(d){a.off("mousemove.chartgui");var e=function(d){if(!TradingView.mousePressed||Modernizr.touch)TradingView.processEvent(d,a,b,b.mouseMoveEvent),c&&d.preventDefault()};a.on("mousemove.chartgui",e);Modernizr.touch&&e(d);TradingView.processEvent(d,a,b,b.mouseEnterEvent);c&&d.preventDefault()};a.mouseenter(d);var e=0,f=null,g=function(){window.clearTimeout(f);e=0;f=null},h=0,k=0,m=null,n=function(l){void 0===l.button&&(l.button=0);if(Modernizr.touch||
l.originalEvent.touches)l.pageX=l.originalEvent.touches[0].pageX,l.pageY=l.originalEvent.touches[0].pageY,l.localX=l.originalEvent.touches[0].pageX,l.localY=l.originalEvent.touches[0].pageY,d(l);var n=function(d){void 0===d.button&&(d.button=0);if(Modernizr.touch||d.originalEvent.touches)d.pageX=d.originalEvent.touches[0].pageX,d.pageY=d.originalEvent.touches[0].pageY,d.localX=d.originalEvent.touches[0].pageX,d.localY=d.originalEvent.touches[0].pageY,d.clientX=d.originalEvent.touches[0].pageX,d.clientY=
d.originalEvent.touches[0].pageY,h=d.pageX,k=d.pageY,clearTimeout(m);d.button!==TradingView.MOUSE_RIGHT_BUTTON&&TradingView.processEvent(d,a,b,b.pressedMouseMoveEvent);c&&d.preventDefault()},q=function(d){void 0===d.button&&(d.button=0);if(Modernizr.touch||d.originalEvent.touches)d.pageX=h,d.pageY=k,d.localX=h,d.localY=k,clearTimeout(m);TradingView.mousePressed=!1;$(document.body).off("mousemove.chartgui");$(document.body).off("mouseup.chartgui");Modernizr.touch||d.originalEvent.touches?($(document.body).off("touchmove.chartgui"),
$(document.body).off("touchend.chartgui"),u(d)):($(document.body).off("mousemove.chartgui touchmove.chartgui"),$(document.body).off("mouseup.chartgui touchend.chartgui"));d.button!==TradingView.MOUSE_RIGHT_BUTTON&&(TradingView.processEvent(d,a,b,b.mouseUpEvent),++e,f&&1<e?(TradingView.processEvent(d,a,b,b.mouseDoubleClickEvent),g()):TradingView.processEvent(d,a,b,b.mouseClickEvent));c&&d.preventDefault();Modernizr.touch&&u(d)};Modernizr.touch?($(document.body).off("touchmove.chartgui"),$(document.body).off("touchend.chartgui"),
$(document.body).on("touchmove.chartgui",n),$(document.body).on("touchend.chartgui",q),m=setTimeout(function(){z(l)},500)):($(document.body).off("mousemove.chartgui touchmove.chartgui"),$(document.body).off("mouseup.chartgui touchend.chartgui"),$(document.body).on("mousemove.chartgui touchmove.chartgui",n),$(document.body).on("mouseup.chartgui touchend.chartgui",q));TradingView.mousePressed=!0;l.button!==TradingView.MOUSE_RIGHT_BUTTON&&(TradingView.processEvent(l,a,b,b.mouseDownEvent),f||(e=0,f=window.setTimeout(g,
500)));if(c){l.preventDefault();try{window.focus()}catch(w){}}};a.on("touchcancel",function(){clearTimeout(m)});if(Modernizr.touch)a.on("touchstart.chartgui",n),a.on("touchstartoutside mousedownoutside",function(c){TradingView.processEvent(c,a,b,b.mouseDownOutsideEvent)}),a.on("gesturestart",function(c){TradingView.processEvent(c,a,b,b.gestureStartEvent);clearTimeout(m)}),a.on("gesturechange",function(c){c.scale=c.originalEvent.scale;TradingView.processEvent(c,a,b,b.gestureChangeEvent)}),a.on("gestureend",
function(c){TradingView.processEvent(c,a,b,b.gestureEndEvent)});else if(a.on("mousedown.chartgui touchstart.chartgui",n),a.on("touchstartoutside mousedownoutside",function(c){TradingView.processEvent(c,a,b,b.mouseDownOutsideEvent)}),navigator.msPointerEnabled&&window.MSGesture){var n=new MSGesture,q=!1,l=1,s=a.get(0);n.target=s;s.gesture=n;s.gesture.pointerType=null;s.pointers=[];n.pointerType=null;a.on("pointerdown",function(a){if(a.target===this)if(null===this.gesture.pointerType)this.gesture.target=
s,this.gesture.addPointer(a.originalEvent.pointerId),this.gesture.pointerType=a.originalEvent.pointerType;else if(a.originalEvent.pointerType===this.gesture.pointerType)this.gesture.addPointer(a.originalEvent.pointerId);else{var b=new MSGesture;b.target=a.originalEvent.target;a.originalEvent.target.gesture=b;a.originalEvent.target.gesture.pointerType=a.originalEvent.pointerType;a.originalEvent.target.gesture.addPointer(a.originalEvent.pointerId)}});a.on("MSGestureChange",function(c){c.scale=l*=1*
(c.originalEvent.scale-1)+1;q||1===c.originalEvent.scale||(q=!0,TradingView.processEvent(c,a,b,b.gestureStartEvent));q&&TradingView.processEvent(c,a,b,b.gestureChangeEvent)});a.on("MSGestureEnd",function(c){q=!1;l=1;TradingView.processEvent(c,a,b,b.gestureEndEvent)})}var u=function(d){a.off("mousemove.chartgui touchmove.chartgui");TradingView.processEvent(d,a,b,b.mouseLeaveEvent);c&&d.preventDefault()};a.mouseleave(u);var z=function(d){TradingView.processEvent(d,a,b,b.contextMenuEvent);c&&d.preventDefault()};
a.contextMenu(z)};TradingView.clientRect=function(a){var b=a.offset(),c=a.width();a=a.height();return new TradingView.Rect(b.left,b.top,c,a)};TradingView.offsetPosition=function(a){var b=0,c=0;do b+=a.offsetLeft,c+=a.offsetTop,a=a.offsetParent;while(a);return{left:b,top:c}};
TradingView.ImageButton=function(a,b,c,d,e){this._url=a;this._overUrl=b;this._pressedUrl=c;this._disabledUrl=d;this._enabled=!0;this._pressedUrl||(this._pressedUrl=this._overUrl);this._content=$(document.createElement("img"));this._content.attr("src",a);this._content.attr("alt",e);this._content.attr("title",e);this._content.css("display","block");TradingView.setMouseEventHandler(this.content(),this)};TradingView.ImageButton.prototype.content=function(){return this._content};
TradingView.ImageButton.prototype.enable=function(a){(this._enabled=a)?this._content.attr("src",this._url):this._content.attr("src",this._disabledUrl)};TradingView.ImageButton.prototype.isEnabled=function(){return this._enabled};TradingView.ImageButton.prototype.setUrls=function(a,b,c,d,e){this._url=a;this._overUrl=b;this._pressedUrl=c;this._disabledUrl=d;this._content.attr("alt",e);this._content.attr("src",a);this._content.attr("title",e);this._content.mousecapture({down:function(){}})};
TradingView.ImageButton.prototype.setTooltip=function(a){this._content.attr("title",a)};TradingView.ImageButton.prototype.mouseEnterEvent=function(){this.isEnabled()&&this._content.attr("src",this._overUrl)};TradingView.ImageButton.prototype.mouseLeaveEvent=function(){this.isEnabled()&&this._content.attr("src",this._url)};TradingView.ImageButton.prototype.mouseUpEvent=function(){this.isEnabled()&&this._content.attr("src",that._overUrl)};
TradingView.ImageButton.prototype.mouseDownEvent=function(){this.isEnabled()&&this._content.attr("src",this._pressedUrl)};TradingView.ToggleImageButton=function(a,b,c,d,e){TradingView.ImageButton.call(this,a,b,c,d,e);this._toggled=!1};inherit(TradingView.ToggleImageButton,TradingView.ImageButton);TradingView.ToggleImageButton.prototype.mouseDownEvent=function(){this._toggled=!this._toggled;this._content.attr("src",this._toggled?this._pressedUrl:this._overUrl)};
TradingView.ToggleImageButton.prototype.mouseEnterEvent=function(){this._mouseOver=!0;this._content.attr("src",this._toggled?this._pressedUrl:this._overUrl)};TradingView.ToggleImageButton.prototype.mouseLeaveEvent=function(){this._mouseOver=!1;this._content.attr("src",this._toggled?this._pressedUrl:this._url)};TradingView.ToggleImageButton.prototype.toggled=function(){return this._toggled};
TradingView.ToggleImageButton.prototype.toggle=function(a){this._toggled=a;this._content.attr("src",a?this._pressedUrl:this._url)};
TradingView.ToggleImageButtonWithBg=function(a,b,c,d){this._container=$("<div>").css("position","relative");this.is_sigle=c;this.is_wide=d;c?d?TradingView.ToggleImageButton.call(this,TradingView.themeResourceFullPath("buttonex_left_single_wide.png"),TradingView.themeResourceFullPath("buttonex_left_over_single_wide.png"),TradingView.themeResourceFullPath("buttonex_left_pressed_single_wide.png"),"",b):TradingView.ToggleImageButton.call(this,TradingView.themeResourceFullPath("buttonex_left_single.png"),
TradingView.themeResourceFullPath("buttonex_left_over_single.png"),TradingView.themeResourceFullPath("buttonex_left_pressed_single.png"),"",b):TradingView.ToggleImageButton.call(this,TradingView.themeResourceFullPath("buttonex_left.png"),TradingView.themeResourceFullPath("buttonex_left_over.png"),TradingView.themeResourceFullPath("buttonex_left_pressed.png"),"",b);this._content.appendTo(this._container);this._icon_size=32;this._icon_offset_x=d?-1:3;this._icon_offset_y=3;this._icon=$('<span class="toolbarbuttonicon'+
(d?" wide":"")+'">').css({"background-position":-this._icon_size*a[0]-this._icon_offset_x+"px "+(-this._icon_size*a[1]-this._icon_offset_y)+"px"}).appendTo(this._container)};inherit(TradingView.ToggleImageButtonWithBg,TradingView.ToggleImageButton);TradingView.ToggleImageButtonWithBg.prototype.content=function(){return this._container};
TradingView.ToggleImageButtonWithBg.prototype.setUrls=function(a,b){this._icon.css({"background-position":-this._icon_size*a[0]-this._icon_offset_x+"px "+(-this._icon_size*a[1]-this._icon_offset_y)+"px"});this._content.attr("title",b)};
TradingView.CssSpriteButton=function(a,b){this._coords=a;this._icon_size=32;this._content=$('<span class="toolbarpopupbutton">').css({display:"block","background-position":-this._icon_size*(a[0]+1)+"px "+-this._icon_size*a[1]+"px"}).attr("title",b);TradingView.setMouseEventHandler(this.content(),this);this._content.attr("title",b)};TradingView.CssSpriteButton.prototype.content=function(){return this._content};
TradingView.CssSpriteButton.prototype.setTooltip=function(a){this._content.attr("title",a)};TradingView.CssSpriteButton.prototype.mouseEnterEvent=function(){this._content.css({"background-position":-this._icon_size*(this._coords[0]+2)+"px "+-this._icon_size*this._coords[1]+"px"})};TradingView.CssSpriteButton.prototype.mouseLeaveEvent=function(){this._content.css({"background-position":-this._icon_size*(this._coords[0]+1)+"px "+-this._icon_size*this._coords[1]+"px"})};
TradingView.ToggleImageButtonEx=function(a){this._toggled=!1;this._options=a;this._currentIndex=0;this.loadUserPreferences();this.prepareLayout();this._optionChanged=new Delegate;this._optionChanged.subscribe(this,function(a){a&&this.saveUserPreferences(a)})};function ToggleImageButtonExMouseHandler(a,b){this._popupWidget=a;this._button=b}
ToggleImageButtonExMouseHandler.prototype.mouseDownOutsideEvent=function(a){"block"===this._popupWidget.css("display")&&(this._popupWidget.css("display","none"),this._button.toggle(!1))};TradingView.ToggleImageButtonEx.prototype.currentIndex=function(){return this._currentIndex};TradingView.ToggleImageButtonEx.prototype.optionChanged=function(){return this._optionChanged};TradingView.ToggleImageButtonEx.prototype.toggle=function(a){this._leftButton.toggle(a)};
TradingView.ToggleImageButtonEx.prototype.prepareLayout=function(){var a=2>this._options.length;this._table=$("<table>");this._table.attr("cellspacing",0);this._table.attr("cellpadding",0);var b=$("<tr>");b.appendTo(this._table);this._leftTd=$("<td>");this._leftTd.appendTo(b);this._rightTd=$("<td>");this._rightTd.appendTo(b);var c=this._options[this._currentIndex],d=this;this._leftButton=new TradingView.ToggleImageButtonWithBg(c.coords,c.name,a);this._leftButton.content().appendTo(this._leftTd);this._leftButton.content().click(function(){d._leftButton.toggled()?
d._optionChanged.fire(d._options[d._currentIndex]):d._optionChanged.fire(null)});this._popup=$("<table>");if(!a){this._rightButton=new TradingView.ToggleImageButton(TradingView.themeResourceFullPath("buttonex_right.png"),TradingView.themeResourceFullPath("buttonex_right_over.png"),TradingView.themeResourceFullPath("buttonex_right_pressed.png"));this._popup.addClass("buttonex-popup");for(a=0;a<this._options.length;a++){b=$("<tr>");b.appendTo(this._popup);b.mouseenter(function(){$(this).addClass("buttonex-popup-hover")});
b.mouseleave(function(){$(this).removeClass("buttonex-popup-hover")});var e=$("<td>");e.appendTo(b);var c=this._options[a],f=new TradingView.CssSpriteButton(c.coords);f.content().appendTo(e);b.click(c,function(a){d._popup.css("display","none");d._rightButton.toggle(!1);a=a.handleObj.data;d.selectOption(a);d._optionChanged.fire(a);d._leftButton.setUrls(a.coords,a.name);d._leftButton.toggle(!0)}).mouseenter({button:f},function(a){a.data.button.mouseEnterEvent()}).mouseleave({button:f},function(a){a.data.button.mouseLeaveEvent()});
e=$("<td>");e.appendTo(b);e.html(c.name)}this._rightButton.content().appendTo(this._rightTd);this._rightButton.content().click(function(){if(d._rightButton.toggled()){var a=d._leftButton.content().offset(),b=d._popup;TradingView.setAbsolutePos(b,{x:a.left,y:a.top+d._rightButton.content().height()+1});$(document.body).append(b);b.css("display","block");TradingView.setMouseEventHandler(b,new ToggleImageButtonExMouseHandler(b,d._rightButton),!1)}})}};
TradingView.ToggleImageButtonEx.prototype.setCurrentCommand=function(a){this._popup.find("tr").removeClass("active");for(var b=0;b<this._options.length;b++)if(this._options[b].commandId===a){a=this._options[b];this._leftButton.setUrls(a.coords,a.name);this._leftButton.toggle(!0);this._popup.find("tr").eq(b).addClass("active");return}this._leftButton.toggle(!1)};
TradingView.ToggleImageButtonEx.prototype.selectOption=function(a){for(var b=0;b<this._options.length;b++)if(this._options[b]===a){this._currentIndex=b;this._leftButton.setUrls(a.coords,a.name);break}};TradingView.ToggleImageButtonEx.prototype.content=function(){return this._table};
TradingView.ToggleImageButtonEx.prototype.loadUserPreferences=function(){for(var a=TVSettings.getJSON("chart.lineToolsPreferences",[]),b=0;b<this._options.length;b++)if(-1!==a.indexOf(this._options[b].commandId)){this._currentIndex=b;break}};
TradingView.ToggleImageButtonEx.prototype.saveUserPreferences=function(a){for(var b=TVSettings.getJSON("chart.lineToolsPreferences",[]),c=0;c<this._options.length;c++){var d=b.indexOf(this._options[c].commandId);-1!==d&&b.splice(d,1)}b.push(a.commandId);TVSettings.setJSON("chart.lineToolsPreferences",b)};
TradingView.addColorPicker=function(a){var b=$("<input>");b.appendTo(a);b.tvcolorpicker();TVSettings&&(b.tvcolorpicker.setCustomColors=TVSettings.setJSON("pickerCustomColors",[]),b.bind("customcolorchange",function(a,b){TVSettings.setJSON("pickerCustomColors",b)}));return b};
TradingView.createLineStyleEditor=function(){return new HTMLHelper.Combobox([{value:CanvasEx.LINESTYLE_SOLID,html:'<div class="linestyle solidline"/>'},{value:CanvasEx.LINESTYLE_DOTTED,html:'<div class="linestyle dottedline"/>'},{value:CanvasEx.LINESTYLE_DASHED,html:'<div class="linestyle dashedline"/>'}])};
TradingView.createShapeLocationEditor=function(){return $('<select><option value="'+CanvasEx.MARKLOC_ABOVEBAR+'">Above Bar</option><option value="'+CanvasEx.MARKLOC_BELOWBAR+'">Below Bar</option><option value="'+CanvasEx.MARKLOC_TOP+'">Top</option><option value="'+CanvasEx.MARKLOC_BOTTOM+'">Bottom</option><option value="'+CanvasEx.MARKLOC_ABSOLUTE+'">Absolute</option></select>')};
TradingView.createShapeStyleEditor=function(){for(var a="<select>",b=Object.keys(TradingView.Study.PlotShapes),c=0;c<b.length;++c)var d=TradingView.Study.PlotShapes[b[c]],a=a+('<option value="'+d.id+'">'+d.guiName+"</option>");return $(a+"</select>")};TradingView.createLineWidthEditor=function(){return $('<div class="linewidth-slider">').slider({min:1,max:4,step:1})};TradingView.createVisibilityEditor=function(){return $("<input type='checkbox' class='visibility-switch'/>")};
TradingView.createTextEditor=function(){var a=$("<input/>");a.attr("type","text");return a};
TradingView.createTextPosEditor=function(){return new HTMLHelper.Combobox([{value:CanvasEx.TEXTPOS_TOPLEFT,html:"Top Left"},{value:CanvasEx.TEXTPOS_TOPCENTER,html:"Top Center"},{value:CanvasEx.TEXTPOS_TOPRIGHT,html:"Top Right"},{value:CanvasEx.TEXTPOS_MIDDLELEFT,html:"Middle Left"},{value:CanvasEx.TEXTPOS_MIDDLECENTER,html:"Middle Center"},{value:CanvasEx.TEXTPOS_MIDDLERIGHT,html:"Middle Right"},{value:CanvasEx.TEXTPOS_BOTTOMLEFT,html:"Bottom Left"},{value:CanvasEx.TEXTPOS_BOTTOMCENTER,html:"Bottom Center"},
{value:CanvasEx.TEXTPOS_BOTTOMRIGHT,html:"Bottom Right"}])};TradingView.createHHistDirectionEditor=function(){var a=$("<select />");$("<option value='"+CanvasEx.HHISTDIR_LEFTTORIGHT+"'>Left</option>").appendTo(a);$("<option value='"+CanvasEx.HHISTDIR_RIGHTTOLEFT+"'>Right</option>").appendTo(a);return a};
TradingView.createTransparencyEditor=function(a){var b=$('<div class="transparency-slider"><div class="gradient"></div></div>').slider({min:0,max:100,step:1}),c=["-moz-linear-gradient(left, %COLOR 0%, transparent 100%)","-webkit-gradient(linear, left top, right top, color-stop(0%,%COLOR), color-stop(100%,transparent))","-webkit-linear-gradient(left, %COLOR 0%,transparent 100%)","-o-linear-gradient(left, %COLOR 0%,transparent 100%)","linear-gradient(to right, %COLOR 0%,transparent 100%)"];b.setColor=
function(a){var e=b.find(".gradient");$.browser.msie?e.css("filter","progid:DXImageTransform.Microsoft.gradient(startColorstr='"+a+"', EndColor=0, GradientType=1)"):c.forEach(function(b){e.css("background-image",b.replace(/%COLOR/,a))})};a?(b.setColor(a.val()||"black"),a.on("change",function(a){b.setColor(a.target.value)})):b.setColor("black");return b};
TradingView.createPlotEditor=function(){var a=$("<select />");$("<option value='"+TradingView.Study.PLOT_LINE+"'>"+$.t("Line")+"</option>").appendTo(a);$("<option value='"+TradingView.Study.PLOT_LINE_WITH_BREAKS+"'>"+$.t("Line With Breaks")+"</option>").appendTo(a);$("<option value='"+TradingView.Study.PLOT_HISTOGRAM+"'>"+$.t("Histogram")+"</option>").appendTo(a);$("<option value='"+TradingView.Study.PLOT_CROSS+"'>"+$.t("Cross",{context:"chart_type"})+"</option>").appendTo(a);$("<option value='"+
TradingView.Study.PLOT_AREA+"'>"+$.t("Area")+"</option>").appendTo(a);$("<option value='"+TradingView.Study.PLOT_AREA_WITH_BREAKS+"'>"+$.t("Area With Breaks")+"</option>").appendTo(a);$("<option value='"+TradingView.Study.PLOT_COLUMNS+"'>"+$.t("Columns")+"</option>").appendTo(a);$("<option value='"+TradingView.Study.PLOT_CIRCLES+"'>"+$.t("Circles")+"</option>").appendTo(a);return a};
TradingView.createPriceSourceEditor=function(){var a=$("<select>");$("<option value='open'>"+$.t("Open")+"</option>").appendTo(a);$("<option value='high'>"+$.t("High")+"</option>").appendTo(a);$("<option value='low'>"+$.t("Low")+"</option>").appendTo(a);$("<option value='close'>"+$.t("Close")+"</option>").appendTo(a);$("<option value='hl2'>"+$.t("(H + L)/2")+"</option>").appendTo(a);$("<option value='hlc3'>"+$.t("(H + L + C)/3")+"</option>").appendTo(a);$("<option value='ohlc4'>"+$.t("(O + H + L + C)/4")+
"</option>").appendTo(a);return a};TradingView.cacheUrl=function(a){$("<img>").attr("src",a)};TradingView.cacheUrl(TradingView.themeResourceFullPath("combo_icon.png"));TradingView.cacheUrl(TradingView.themeResourceFullPath("lines.png"));TradingView.themeImageHTML=function(a){return"<img src='"+TradingView.themeResourceFullPath(a)+"' style='display:block'/>"};
TradingView.animate=function(a,b,c,d,e){var f=d||250,g=$.easing[e]||$.easing.easeOutCubic,h=0,k=Date.now(),m=function(d){d=(d?1E12>d?Date.now():d:Date.now())-k;var e=Math.min(a,g(null,d,0,a,f)),l=e-h;h=e;b(l);d>=f?"function"==typeof c&&c():requestAnimationFrame(m)};requestAnimationFrame(m)};
TradingView.FavoredList=function(a,b,c){this._options=c=c||{};this._name=a;this._container=$('<div class="favored-list-container" />');c.addClass&&this._container.addClass(c.addClass);this._quick_container=$('<div class="quick" />').appendTo(this._container);this._submenu=$('<span class="submenu">'+(this._options.submenuHtml||"")+"<i></i></span>").appendTo(this._container);c.tooltip&&(this._submenu.attr("title",c.tooltip),c.addTooltipClass&&this._submenu.addClass(c.addTooltipClass));this._activeButton=
null;this._onChange=new Delegate;this._onSelect=new Delegate;this._onResize=new Delegate;this._load(b);TradingView.bindPopupMenu(this._container,null,{direction:"down",reverse:!0,addClass:"narrow favored-list"+(c.popupAddClass?" "+c.popupAddClass:""),event:"popup-menu",popupSpacing:c.popupSpacing});this._submenu.on("click",this._openMenu.bind(this));if(!$.browser.msie)TVXWindowEvents.on(a+"-change",$.proxy(this,"_onChangeInAnotherTab"));return this};
TradingView.FavoredList.prototype._openMenu=function(){this._submenu.trigger("popup-menu",[this._data])};TradingView.FavoredList.prototype._onChangeInAnotherTab=function(){this.reload(this._data)};TradingView.FavoredList.prototype.reload=function(a){this._quick_container.empty();this._load(a)};
TradingView.FavoredList.prototype._load=function(a){var b=this;this._quicks=this._options.notShowQuicks?[]:TVSettings.getJSON(this._name+".quicks",this._options.defaultFavorites||[],!0);this._list=[];$.grep(a,function(a,b){return!a.separator}).forEach(function(a,d){var e={index:d,data:a,toQuickButton:$('<span class="to-quick" title=""></span>'),toggleFavorite:function(a,c){var d=void 0!==a?a:!this.isFavorite();d?this.markFavorite():this.unmarkFavorite();b._toggleFavorite(e,d,c)},markFavorite:function(){this.toQuickButton&&
this.toQuickButton.attr("title","Remove from favorites").addClass("quicked")},unmarkFavorite:function(){this.toQuickButton&&this.toQuickButton.attr("title","Add to favorites").removeClass("quicked")},isFavorite:function(){return-1<b._quicks.indexOf(a.id)},active:function(){return this.data.active()},drop:function(){return this.data.drop()}};b._options.notShowQuicks&&$.extend(e,{toQuickButton:null});e.data.toQuickButtonStyle&&e.toQuickButton&&e.toQuickButton.css(e.data.toQuickButtonStyle);b._list.push(e);
var f={action:function(){b._change(e)},buttons:[],active:b._options.notShowActive?function(){return!1}:function(){return b._active&&e===b._active}};b._options.notShowQuicks||f.buttons.push({el:e.toQuickButton,handler:function(a){e.toggleFavorite();a.stopPropagation()}});"function"===typeof e.data.drop&&f.buttons.push({el:$('<span class="delete" title="Delete"></span>'),handler:function(a){e.drop();a.stopPropagation()}});$.extend(a,f);e.toggleFavorite(e.isFavorite(),!0)});this._data=a;this._options.notShowActive||
this._addActive(this._list[0]);this._onResize.fire()};
TradingView.FavoredList.prototype._toggleFavorite=function(a,b,c){if(!this._options.notShowQuicks){if(b){a.favorite_button=this._createButton(a,this._quick_container);var d=this._lastFavoriteButton(a);d?a.favorite_button.insertAfter(d.favorite_button):a.favorite_button.prependTo(this._quick_container)}else c||this._removeButton(a);c||(b?-1==this._quicks.indexOf(a.data.id)&&this._quicks.push(a.data.id):-1<this._quicks.indexOf(a.data.id)&&this._quicks.splice(this._quicks.indexOf(a.data.id),1),this._saveFavorite(),
this._markActive(),this._onResize.fire())}};TradingView.FavoredList.prototype._lastFavoriteButton=function(a){for(a=a.index-1;0<=a;a--)if(this._list[a]&&this._list[a].favorite_button)return this._list[a]};TradingView.FavoredList.prototype._saveFavorite=function(){this._options.notShowQuicks||(TVSettings.setJSON(this._name+".quicks",this._quicks),TVXWindowEvents.emit(this._name+"-change"))};
TradingView.FavoredList.prototype._createButton=function(a){var b=this,c=a.data.favoriteButton,d=$("<span></span>").data("item",a);c.addClass&&d.addClass(c.addClass);c.text&&d.text(a.text);c.title&&d.prop("title",c.title);if(c.icon){var e=$("<i></i>").appendTo(d);c.icon.image&&e.css("background-image",c.icon.image||"");c.icon.offset&&e.css("background-position","string"===typeof c.icon.quickOffset?c.icon.quickOffset:c.icon.quickOffset.x+"px "+c.icon.quickOffset.y+"px")}d.on("click",function(c){b._change(a);
0===b._quicks.length&&b._openMenu();c.preventDefault()});return d};TradingView.FavoredList.prototype._removeButton=function(a){a.favorite_button&&(a.favorite_button.remove(),a.favorite_button=null)};
TradingView.FavoredList.prototype._markActive=function(a){if(!this._options.notShowActive){var b=this,c;if(this._active)if(a=this._active,a.isFavorite()){var d=b._quick_container.find(".just_active");this._btnToggleActiveView(d,!1)}else c=this._addActive(a),0!==this._quicks.length&&this._btnToggleActiveView(c,!0);$.map(this._list,function(c){a!==c||0==b._quicks.length?b._btnToggleActiveView(c.favorite_button,!1):c.favorite_button&&b._btnToggleActiveView(a.favorite_button,!0)});c&&c.hasClass("selected")?
this._container.addClass("not-favored-active"):this._container.removeClass("not-favored-active")}};TradingView.FavoredList.prototype._btnToggleActiveView=function(a,b){if(a){var c,d=a.data("item");d&&d.data&&d.data.icon&&(c=d.data.icon);b?(a.addClass("selected"),c=c.offsetActive?c.offsetActive:null):(a.removeClass("selected"),c=c.offset?c.offset:null);c&&a.children("i").css("background-position","string"===typeof c?c:c.x+"px "+c.y+"px")}};
TradingView.FavoredList.prototype._addActive=function(a){this._quick_container.find(".just_active").remove();return this._createButton(a).appendTo(this._quick_container).addClass("just_active")};TradingView.FavoredList.prototype._clearActive=function(){this._quick_container.find(".just_active").remove()};TradingView.FavoredList.prototype._clearActive=function(){};TradingView.FavoredList.prototype._setActive=function(a){if(this._active===a)return!1;this._active=a;this._markActive();return!0};
TradingView.FavoredList.prototype._change=function(a){this._onSelect.fire(a.data.id);if(this._setActive(a))this._onChange.fire(a.data.id);else return!1};TradingView.FavoredList.prototype.element=function(){return this._container};TradingView.FavoredList.prototype._getItemByValue=function(a){for(var b in this._list)if(this._list[b].data.id==a)return this._list[b];throw Error("undefined value "+a+" in FavoredList");};TradingView.FavoredList.prototype.onChange=function(){return this._onChange};
TradingView.FavoredList.prototype.onSelect=function(){return this._onSelect};TradingView.FavoredList.prototype.onResize=function(){return this._onResize};TradingView.FavoredList.prototype.setValue=function(a){a=this._getItemByValue(a);this._setActive(a)};TradingView.FavoredList.prototype.value=function(a){return this._active?this._active.data.value:void 0};
TradingView.FavoredList.prototype.removeById=function(a,b){var c=$.grep(this._data,function(b){return b.id!=a});this.reload(c);"function"===typeof b&&b()};
TradingView.bindPopupMenu=function(a,b,c){var d,e,f;a=$(a);c=c||{};d=(c.event||"click")+".popup-menu";c.hideEvent&&(e=c.hideEvent+".popup-menu");var g=new Function,h=g,k={},m=function(d,e,l){function m(b){b=$(b.target).parents().andSelf();b.is(t)||b.is(a)||b.is(".charts-popup-tab-headers, .charts-popup-itemheader")||h()}function u(a){a=$(a.target).parents().andSelf();a.is(".charts-popup-tab-headers, .charts-popup-itemheader")||c.notCloseOnButtons&&a.is(".icon-save, .icon-delete")||h()}function z(b,
d,e){if(b instanceof TradingView.bindPopupMenu.TabGroup){if(b.tabs&&b.tabs.length)if(1!==b.tabs.length||b.tabs[0].title){var f=$('<div class="charts-popup-tab-group"></div>').appendTo(e),g=$('<div class="charts-popup-tab-headers"></div>').appendTo(f),h=null;$.each(b.tabs||[],function(a,c){if(c.items&&c.items.length){var d=$('<div class="charts-popup-tab"></div>').hide().appendTo(f);$.each(c.items,function(){z(this,void 0,d)});var e=$('<span class="charts-popup-tab-header">').append($('<a href="javascript://" class="charts-popup-tab-header-label">').text(c.name)).appendTo(g);
e.on("click",function(a){e.is(".active")||(g.find(".charts-popup-tab-header.active").removeClass("active"),e.addClass("active"),f.find(".charts-popup-tab").hide(),d.show(),a&&a.preventDefault(),"function"===typeof b.onChange&&b.onChange.call(b,c.name))});if(!h||c.active)h=e,g.find(".charts-popup-tab-header.active").removeClass("active"),e.addClass("active"),f.find(".charts-popup-tab").hide(),d.show()}})}else $.each(b.tabs[0].items,function(){z(this,void 0,e)})}else if(b instanceof TradingView.bindPopupMenu.Group){var k=
$('<div class="charts-popup-group"></div>').appendTo(e);b.title&&(d=$('<div class="charts-popup-itemheader"></div>').text(b.title).prepend($('<span class="charts-popup-itemheader-icon"></span>')),b.collapsible&&(k.addClass("charts-popup-group-collapsible"),k.toggleClass("collapsed",b.collapsed),d.on("click",function(){k.toggleClass("collapsed");if("function"==typeof b.onChange)b.onChange(k.hasClass("collapsed"))})),k.append(d));$.each(b.items,function(a){z(this,1,k)})}else if(b instanceof TradingView.bindPopupMenu.Header)e.append($('<div class="charts-popup-itemheader"></div>').text(b.title));
else if(b.separator){var l=$('<span class="separator"></span>');e.append(l)}else{l=$('<a class="item" href="#">');"function"==typeof b.deleteAction&&"function"==typeof b.saveAction&&l.addClass("item-twobuttons");b.url&&l.attr("href",b.url);b.target&&l.attr("target",b.target);d||l.addClass("first");"function"===typeof b.active?b.active(b)&&l.addClass("active"):b.active&&l.addClass("active");b.addClass&&l.addClass(b.addClass);b.disabled&&l.addClass("disabled");if("function"==typeof b.action){var m=
b.action;d=function(a){var c=$(a.target).parents().andSelf();c.is(q)||c.is(w)||(m.apply(l,arguments),!b.url&&a&&"function"==typeof a.preventDefault&&a.preventDefault())};c.upAction?l.bind("mouseup",d):l.bind("click",d)}b.date?(d=$('<span class="title"></span>').appendTo(l),$('<span class="date"></span>').text(b.date||"").appendTo(l)):b.icon?(d=$('<span class="icon"></span>').appendTo(l),d.css("background-image",b.icon.image||""),b.icon.offset&&d.css("background-position","string"===typeof b.icon.offset?
b.icon.offset:b.icon.offset.x+"px "+b.icon.offset.y+"px"),d=$('<span class="title"></span>').appendTo(l)):d=$('<span class="title-expanded"></span>').appendTo(l);b.html?d.html(b.html):d.text(b.title||"");if("function"==typeof b.deleteAction){var n=b.deleteAction;d=b.deleteAction.title||"Delete";var q=$('<span class="icon-delete">');q.attr("title",d);q.on("click",function(a){n.apply(l,arguments);a.preventDefault()});l.append(q)}if("function"==typeof b.saveAction){var A=b.saveAction;d=b.saveAction.title||
"Save";var w=$('<span class="icon-save">');w.attr("title",d);w.on("click",function(a){A.apply(l,arguments);a.preventDefault()});l.append(w)}b.buttons instanceof Array&&b.buttons.length&&b.buttons.forEach(function(a){a.el instanceof $||(a.el=$(a.el));a.el.appendTo(l);if(a.handler)a.el.on("click",function(b){a.handler.apply(l,arguments)})});"undefined"!==typeof b.counter&&(d=b.counterBlue?"blue":"",$('<span class="counter"></span>').text(b.counter+"").addClass(d).appendTo(l));e.append(l);a.data("popup-menu",
e)}}e=e||b;"function"===typeof e&&(e=e());if($(this).hasClass("open"))if(l)h(),l=k.scrollTop;else return;h=function(){k.scrollTop=t.scrollTop();t.remove();a.removeClass("active open");a.data("popup-menu",null);$(document).off("click",u);$(document).off("mousedown",m);Modernizr.touch&&$(document).off("touchstart.chartgui",m);$(document).off("selectstart.popup-menu");h=g;c.onRemove&&c.onRemove()};a.addClass("active open");var t=$('<div class="charts-popup-list">');c.addClass&&t.addClass(c.addClass);
$.each(e,function(a){z(this,a,t)});setTimeout(function(){$(document).on("click",u);$(document).on("mousedown",m);Modernizr.touch&&$(document).on("touchstart.chartgui",m)},0);if(c.upAction)$(document).on("selectstart.popup-menu",function(){return!1});t.appendTo(document.body);e=$(window).width();var B=Math.min($(window).height(),$("body").height()),A=a.outerWidth(),w=a.outerHeight(),v=a.offset();l=$(window).scrollTop()||0;v.top-=l;popupWidth=t.outerWidth();popupHeight=t.outerHeight();viewportSpacing=
void 0!=c.viewportSpacing?c.viewportSpacing:10;f=c.popupSpacing?~~c.popupSpacing:0;popupDrift=c.popupDrift?~~c.popupDrift:0;popupPadBrd=popupHeight-t.height();direction=c.direction?c.direction:"down";reverse=!!c.reverse;"down"==direction&&100>$(window).height()-v.top-w-f&&(direction="up");switch(direction){case "down":case "up":"down"==direction?t.css("top",v.top+w+f+"px"):t.css("bottom",B-v.top+f+"px").css("top","auto");reverse?t.css("left",Math.max(v.left+popupDrift+A-popupWidth,viewportSpacing)+
"px").css("right","auto"):t.css("left",v.left+popupDrift+"px").css("right","auto");break;case "right":case "left":f=Math.max(f,4),"right"==direction?t.css("left",Math.floor(v.left+A+f)+"px").css("right","auto"):t.css("left",Math.floor(Math.max(v.left-popupWidth-f,viewportSpacing))+"px").css("right","auto"),reverse?t.css("top",Math.floor(Math.max(v.top+popupDrift+w-popupHeight,viewportSpacing))+"px"):t.css("top",Math.floor(v.top+popupDrift)+"px")}t.show();"up"==direction||{left:1,right:1}[direction]&&
reverse?"up"==direction?t.css("max-height",v.top-f-viewportSpacing-popupPadBrd+"px"):t.css("max-height",v.top+w-f-viewportSpacing-popupPadBrd+"px"):t.css("max-height",B-v.top-w-f-viewportSpacing-popupPadBrd+"px");c.careRightBorder&&parseInt(t.css("left"))+t.width()+viewportSpacing>e&&t.css("left",e-t.width()-viewportSpacing+"px").css("right","auto");c.careBottomBorder&&parseInt(t.css("top"))+t.height()+viewportSpacing>B+l&&t.css("top",B-t.height()-viewportSpacing+l+"px");var C;l=a.parents().andSelf();
for(e=l.size();e--;)if("fixed"===l.eq(e).css("position")){C=l.eq(e);break}C&&(C=t.offset(),t.css({position:"fixed",left:C.left-$(document).scrollLeft(),right:"auto"}));d&&d.preventDefault()};d&&a.bind(d,m);e&&a.bind(e,function(){h()});c.runOpened&&m()};TradingView.bindPopupMenu.TabGroup=function TabGroup(b){if(!(this instanceof TabGroup))return new TabGroup(b);b=b||{};this.tabs=[];"function"===typeof b.onChange&&(this.onChange=b.onChange)};
TradingView.bindPopupMenu.TabGroup.prototype.appendTab=function(a,b,c){a=null==a?"":a+"";b||(b=[]);c||(c={});if(!Array.isArray(b))throw new TypeError("items must be an array");this.tabs.push({name:a,items:b,active:!!c.active});return b};TradingView.bindPopupMenu.Header=function Header(b){if(!(this instanceof Header))return new Header(b);this.title=b};
TradingView.bindPopupMenu.Group=function Group(b){if(!(this instanceof Group))return new Group(b);b=b||{};this.items=[];this.title=null==b.title?"":b.title+"";this.collapsible=!!b.collapsible;this.collapsed=!!b.collapsed;"function"===typeof b.onChange&&(this.onChange=b.onChange)};TradingView.bindPopupMenu.Group.prototype.push=function(){this.items.push.apply(this.items,arguments)};TradingView.unbindPopupMenu=function(a){a=$(a);a.unbind(".popup-menu");a.removeData("popup-menu")};
TradingView.showChartNameDialog=function(a,b,c,d,e,f){var g=b?b:"Save New Chart",h=TVDialogs.createDialog(g);b=function(){var b=h.find('input[name="name"]'),c=b.val(),d=[];if(e)for(var f=0;f<e.length;f++)if("bool"===e[f].type){var k=h.find('input[name="'+e[f].name+'"]');d.push(k[0].checked)}c?(a(c,d),TVDialogs.destroy(g)):(TVDialogs.showError("Please enter chart name",TVDialogs.get(g)),b.focus());return!1};d=d||"";h.css("width","400px");h.find(".tv-dialog-content").html('<div class="main"><form><p>'+
(c?c:"Chart name")+':</p><p class="tv-dialogs-name"><input type="text" name="name" maxlength="'+d+'"/></p><p class="tv-dialog-right"></p></form></div>');if(e)for(c=h.find(".tv-dialog-right"),d=0;d<e.length;d++)if("bool"===e[d].type){var k=$('<p class="tv-dialogs-name"></p>'),m=e[d].hint?$('<div class="tv-dialogs-label-hint"></div>').blueTooltip(e[d].hint,"bottom"):null,n=$('<label><input type="checkbox" style="vertical-align:top;margin-top:2px" name="'+e[d].name+'"/> '+e[d].title+"</label>");k.append(n,
m).insertBefore(c)}h.find("form").submit(b);$('<a class="tv-button wide ok">OK</a>').click(b).css({"margin-right":"5px"}).appendTo(h.find(".tv-dialog-right"));$('<a class="tv-button wide cancel">Cancel</a>').click(function(){TVDialogs.destroy(g)}).appendTo(h.find(".tv-dialog-right"));"function"===typeof f&&f(h);TVDialogs.positionDialog(h,{left:$(window).width()/2-h.width()/2,top:$(window).height()/2-h.height()/2});TVDialogs.applyHandlers(h);h.find('input[name="name"]').focus()};TradingView.StudyMarket=function(a,b,c){this.HIGHLIGHT_STUDY_NUM_FLICKS=2;this._BASIC_STUDIES_PACKAGE_NAME="tv-basicstudies";this._SCRIPTING_PACKAGE_NAME="tv-scripting";this._chartWidgetCollection=a;this._chart=a.activeChartWidget.value();this._options=$.extend({},this.DEFAULT_OPTIONS,c||{});this.concretizeOptions();this._studies=this._market=null;this._packagesWithTabNames={};this._user=null;this._favs=[];this._pages={};this._tabs={};this._headers={};this.favsChanged=new Delegate;this.layoutChanged=
new Delegate;this.visibilityChanged=new Delegate;this.setupMarketInfo();this.studiesReady=new $.Deferred;this.getStudyInfo();this.marketPagesReady=new $.Deferred;this.setUser(b);this.prepareLayout();this.attachHandlers();TradingView.PublishedScript&&TradingView.PublishedScript.onListChange.subscribe(this,this.onPublishedScriptModified)};
TradingView.StudyMarket.prototype.DEFAULT_OPTIONS={onWidget:!1,hideMarketPages:!1,selectBasicPage:!0,minimized:!1,searchKeywords:{earning:/EPS/,earnings:/EPS/,"trailing twelve months":/TTM/},popularFundamentals:[{name:"Income Statement",studies:"Script$EDGR_TOTAL_REVENUE@tv-scripting Script$EDGR_DILUTED_EPS_NET_INCOME@tv-scripting Script$EDGR_NET_INCOME@tv-scripting Script$EDGR_EBITDA@tv-scripting Script$EDGR_EBIT@tv-scripting Script$EDGR_EQUITY_EARNINGS@tv-scripting".split(" ")},{name:"Profitability",
studies:["Script$EDGR_GROSS_MARGIN@tv-scripting","Script$EDGR_AFTER_TAX_MARGIN@tv-scripting","Script$EDGR_GROSS_PROFIT@tv-scripting"]},{name:"Dividend",studies:["Script$EDGR_DIVIDEND_YIELD@tv-scripting","Script$EDGR_DIVIDENDS_PAID@tv-scripting"]},{name:"Current Valuation",studies:["Script$EDGR_MARKET_CAP@tv-scripting","Script$EDGR_PRICE_EARNINGS_TTM@tv-scripting","Script$EDGR_PRICE_EARNINGS_TO_GROWTH_TTM@tv-scripting","Script$EDGR_PRICE_BOOK_VALUE_PER_SHARE@tv-scripting"]},{name:"Other",studies:["Script$EDGR_DEBT_TO_EQUITY@tv-scripting",
"Script$EDGR_FREE_CASH_FLOW@tv-scripting","Script$EDGR_RETURN_ON_EQUITY@tv-scripting","Script$EDGR_ACCOUNTING_CHANGE@tv-scripting","Script$EDGR_ACCOUNTS_PAYABLE@tv-scripting"]}]};TradingView.StudyMarket.prototype._FAV_KEY="studyMarket.favorites";TradingView.StudyMarket.prototype._PAGE_KEY="studyMarket.page";TradingView.StudyMarket.prototype._MARKET_TAB_IS_OPEN_KEY="studyMarket.marketTabIsOpen";TradingView.StudyMarket.prototype._ECONOMY_TAB="Economy & Symbols";
TradingView.StudyMarket.prototype._FILTER_KEY="studyMarket.filter";TradingView.StudyMarket.prototype.onCustomScriptModified=function(){this.getStudyInfo();this.resetBasicPage();this.loadFavorites();this.updateSearchPage()};TradingView.StudyMarket.prototype.onPublishedScriptModified=function(){this.getStudyInfo();this.resetBasicPage();this.loadFavorites();this.updateSearchPage()};
TradingView.StudyMarket.prototype.setupMarketInfo=function(){this._market={products:pro.getStudies(),order:pro.getStudiesOrder()};this._market.order=$.grep(this._market.order,function(a){return"Script$EOTPRO"!=a})};TradingView.StudyMarket.prototype.concretizeOptions=function(){this._options.onWidget&&(this._options.hideMarketPages=!0,this._options.selectBasicPage=!0,this._options.minimized=!0)};
TradingView.StudyMarket.prototype.setupMarketInfo=function(){this._market={products:pro.getStudies(),order:pro.getStudiesOrder()};this._market.order=$.grep(this._market.order,function(a){return"Script$EOTPRO"!=a})};TradingView.StudyMarket.prototype.getStudyInfo=function(){this._chart.withModel(this,function(){this.setupStudyInfo()})};
TradingView.StudyMarket.prototype.setupStudyInfo=function(){var a=this._chart.model().studiesMetaData().toArray();this._studies={};a=a.filter(function(a){return!this.isHidedStudy(a)},this);a.forEach(function(a){var c=this.getStudyPackageName(a);"Script$EOTPRO"==c||this._options.minimized&&c!=this._BASIC_STUDIES_PACKAGE_NAME||(this._studies[c]||(this._studies[c]=[]),this._studies[c].push(a))},this);this.studiesReady.resolve()};
TradingView.StudyMarket.prototype.setUser=function(a){is_authenticated?this.setupUserData(a):this.setAnonymous()};TradingView.StudyMarket.prototype.setupUserData=function(a){this._user=a;this.loadFavorites();this.updateMarketPages()};TradingView.StudyMarket.prototype.setAnonymous=function(){this.setupUserData(null,[]);this.favsChanged.fire()};TradingView.StudyMarket.prototype.isHidedStudy=function(a){return!!a.is_hidden_study};
TradingView.StudyMarket.prototype.loadFavorites=function(){this._favs=[];this.studiesReady.done(function(){var a,b;TVSettings.getJSON(this._FAV_KEY,[]).forEach(function(c){a=this.getStudyPackageName({id:c});a in this._studies&&(b=null,this._studies[a].forEach(function(a){a.id==c&&(b=a)}),b&&this._favs.push(b))},this);this.favsChanged.fire()}.bind(this))};TradingView.StudyMarket.prototype.saveFavorites=function(){var a=this._favs.map(function(a){return a.id});TVSettings.setJSON(this._FAV_KEY,a)};
TradingView.StudyMarket.prototype.prepareLayout=function(){this._widget=$('<div class="insert-study-dialog"><div class="insert-study-row insert-study-title tv-dialog-title"><a class="tv-dialog-title-close"></a>'+$.t("Indicators")+'</div><div class="insert-study-row insert-study-body"><div class="insert-study-tabs"><div class="insert-study-tabs-list-container"><ul class="insert-study-tabs-list"></ul></div></div><div class="insert-study-main"><div class="insert-study-headers"></div><div class="insert-study-pages insert-study-row"></div></div></div></div>');
this._w_title=this._widget.find(".insert-study-title");this._w_tabs_container=this._widget.find(".insert-study-tabs-list-container");this._w_tabs=this._widget.find(".insert-study-tabs-list");this._w_pages=this._widget.find(".insert-study-pages");this._w_headers=this._widget.find(".insert-study-headers");this._widget.draggable(TVDialogs._constrainDraggableOptionsIfNeeded({handle:".insert-study-title"})).css({position:"absolute",zIndex:17});this.preparePages();this._options.minimized&&this._widget.addClass("minimized");
this._widget.appendTo("body");this.hide()};TradingView.StudyMarket.prototype.currentPage=function(){return this._pages[this._currentPageTitle]};
TradingView.StudyMarket.prototype.preparePages=function(){this.addSearchPage();this.addFavoritesPage();this.prepareBasicPage();this.prepareMarketPages();this._options.minimized||TradingView.isRunningChartingLibrary||(this.prepareFundamentalsPage(),this.studiesReady.done(function(){this.search("",!0,!0)}.bind(this)));this.addEconomyPage();this._scroll=new TradingView.SidebarCustomScroll(this._w_tabs_container,this._w_tabs,{showBottomShadow:!1})};
TradingView.StudyMarket.prototype.addEconomyPage=function(){var a=this.addPage(this._ECONOMY_TAB),a=$('<div class="economy-page">').appendTo(a);this.addSymbolWidget=new AddSymbolWidget(this._chartWidgetCollection);this.addSymbolWidget.show();a.append(this.addSymbolWidget._widget)};TradingView.StudyMarket.prototype.addFavoritesPage=function(){this.addPage("Favorites").addClass("page-padded")};
TradingView.StudyMarket.prototype.prepareBasicPage=function(){var a=this;a.addPage("Technical Analysis",{packageName:this._BASIC_STUDIES_PACKAGE_NAME}).addClass("page-padded");this._options.minimized||TradingView.isRunningChartingLibrary||this.prepareBasicPageHeader();a.studiesReady.done(function(){a.resetBasicPage()});a._options.selectBasicPage&&a.selectPage("Technical Analysis")};
TradingView.StudyMarket.prototype._openSearch=function(){var a=this;TVDialogs.showScriptSearchDialog({onTry:function(b){var c=a._chartWidgetCollection.activeChartWidget.value();c.studyScriptingPkgVers&&a.insertStudy(StudyMetaInfo.createMetaInfoStub(b,c.studyScriptingPkgVers))}})};
TradingView.StudyMarket.prototype.prepareBasicPageHeader=function(){function a(){for(var a=TVSettings.getValue(c,""),b=f.length;b--;)f[b].$element.toggleClass("active",f[b].value===a)}var b=this,c=this._FILTER_KEY,d=$('<div class="header-block"></div>'),e=$('<div class="header-block-right">').appendTo(d);$('<a class="header-block-button"><span class="text">Create Script</span></a>').appendTo(e).on("click",function(a){a.preventDefault();b.hide();scriptEditor.show()});$('<a class="header-block-button"><span class="text">Get Script</span></a>').appendTo(e).on("click",
function(a){a.preventDefault();b._openSearch()});var f=[{value:"",title:"All"},{value:"builtin",title:"Built-ins"},{value:"custom",title:"Custom"},{value:"published",title:"Added"}],g=$('<div class="header-block-tabs"></div>').appendTo(d);f.forEach(function(d){d.$element=$('<div class="header-block-tab"></div>').text(d.title).on("click",function(){TVSettings.setValue(c,d.value);a();b.resetBasicPage()}).appendTo(g)});a();this._headers["technical analysis"].empty().append(d)};
TradingView.StudyMarket.prototype.resetBasicPage=function(){var a=this.getPage("Technical Analysis");if(this._studies){var b,c=[],d=[],e=[],f="";if(this._options.minimized)c=this._studies[this._BASIC_STUDIES_PACKAGE_NAME]||[],b=$.Deferred().resolve();else{(f=TVSettings.getValue(this._FILTER_KEY,""))&&"builtin"!==f||(c=this._studies[this._BASIC_STUDIES_PACKAGE_NAME]||[]);f&&"custom"!==f||(d=this._studies.Script$USER||[]);f&&"published"!==f||(e=this._studies.Script$PUB||[]);var g=$.Deferred();window.scriptLib&&
d.length?scriptLib.requestUserScripts(function(a){for(var b=d.length;b--;){var c=d[b].scriptIdPart;if(c){delete d[b].scriptName;for(var e=null,f=a.length;f--;)if(a[f].scriptIdPart===c){e=a[f];break}e?d[b].scriptName=a[f].scriptName:d.splice(b,1)}else d.splice(b,1)}g.resolve()}):g.resolve();var h=$.Deferred();e.length?TradingView.PublishedScript.list().done(function(a){for(var b=e.length;b--;){var c=e[b].scriptIdPart;if(c){delete e[b].scriptName;for(var d=null,f=a.length;f--;)if(a[f].scriptIdPart===
c){d=a[f];break}d?(e[b].author=d.author,e[b].scriptName=d.scriptName):e.splice(b,1)}else e.splice(b,1)}h.resolve()}):h.resolve();b=$.when(g,h)}b.done(function(){var b=[].concat(c,d,e);b.length||"custom"!=f?b.length||"published"!=f?studyMarket.preparePageStudies(a,[].concat(c,d,e)):studyMarket.appendPubScriptBtn(a):studyMarket.appendTVScriptBtn(a)})}};
TradingView.StudyMarket.prototype.prepareFundamentalsPage=function(a,b){var c=this;a=this.addPage("Fundamentals",{packageName:"Script$EDGR"});this.studiesReady.done(function(){function b(){for(var a=[],d=$.map(e,function(a){return a.id}),f=0;f<c._options.popularFundamentals.length;f++){var g=c._options.popularFundamentals[f];g.studies=g.studies.filter(function(a){return-1!=d.indexOf(a)}).map(function(a){return e.filter(function(b){return a===b.id})[0]});g.studies.length&&a.push(g)}return a}var e=
this._studies.Script$EDGR;if("undefined"!==e){var f=a,g=b();a.addClass("page-with-popular");if(g.length){var f=$("<div></div>"),h=$("<div></div>"),k=$('<div><div class="header-container"><div class="group-header">Key Stats</div></div><div class="column column-left"></div><div class="column column-right"></div></div>'),m=k.find(".column-left").css("width","50%"),n=k.find(".column-right").css("width","50%"),q=function(){for(var a=0,b=0;b<g.length;b++)a+=g[b].studies.length;return a}(),l=function(a){var b=
$('<div class="insert-study-items"></div>');c.fillStudies(b,a.studies,null,1);b.prepend('<div class="subgroup-header">'+a.name+"</div>");return b};a.append(h);h.append('<div class="header-container with-divider"><div class="group-header">All Metrics</div></div>');h.append(f);a.prepend(k);a.append(h);for(k=h=0;h<g.length;h++){var s=g[h],u=l(s);k<q/2?m.append(u):n.append(u);k+=s.studies.length}}this.preparePageStudies(f,e)}}.bind(this))};
TradingView.StudyMarket.prototype.appendTVScriptBtn=function(a){var b=this;if(a){var c=$('<br><a class="add-custom-script-btn"> Create your first script now!</a>').on("click",function(a){b.hide();scriptEditor.show();a.stopPropagation()});a.empty();a.append("<p>Welcome to the TradingView custom scripting engine. It allows you to create your own custom studies or modify existing. You do not have any scripts created.</p>");a.find("p").append(c)}};
TradingView.StudyMarket.prototype.appendPubScriptBtn=function(a){var b=this;a&&(a.html('<p>You haven\'t added scripts yet.<br><a class="search-link">Search Scripts</a></p>'),a.find(".search-link").on("click",function(a){a.preventDefault();b._openSearch()}).css("cursor","pointer"))};
TradingView.StudyMarket.prototype.prepareMarketPages=function(){this._options.hideMarketPages||this.studiesReady.done(function(){var a,b;this._market.order.forEach(function(c){b="tv-volumebyprice"!=c;a=this._market.products[c];a.$page=this.addPage(a.name,{market:b,packageName:c});a.$page.addClass("offer-page")},this);this.selectPage(TVSettings.getValue(this._PAGE_KEY,"Technical Analysis"));this.marketPagesReady.resolve()}.bind(this))};
TradingView.StudyMarket.prototype.addSearchPage=function(){var a=this;a._tabs.search=$('<div class="search"><div class="left-border"></div><div class="right-border"></div><input type="text" name="q" value="" autocomplete="off" placeholder="'+$.t("Search")+'"><div></div><a class="input-reset"></a></div>').data("title","search");a._pages.search=$('<div class="page-search"></div>').data("title","search");var b=a._tabs.search.find("input"),c=a._tabs.search.find(".input-reset");a._search_value=null;a._search_input=
b;this._widget.find(".insert-study-tabs").prepend(a._tabs.search);a._w_pages.prepend(a._pages.search);c.on("click",function(){b.val("").trigger("input").focus()});b.focus(function(){a.search(b.val())});b.on("input",function(){c.toggle(""!==this.value);a.search($(this).val())})};
TradingView.StudyMarket.prototype.search=function(a,b,c){if(this._search_value!==a||b){b=this._pages.search;var d=[];""!==a&&(d.push({re:RegExp("("+a.split("").map(function(a){return RegExpEscape(a)}).join(")(.*?)(")+")","i"),fuzzyHighlight:!0}),a.toLowerCase()in this.DEFAULT_OPTIONS.searchKeywords&&d.push({re:this.DEFAULT_OPTIONS.searchKeywords[a.toLowerCase()],fuzzyHighlight:!1}));this._search_value=a;b.html("");a=Object.keys(this._studies).sort();for(var e=[this._BASIC_STUDIES_PACKAGE_NAME,"Script$USER",
"Script$PUB"],f=e.length;f--;){var g=e[f],h=a.indexOf(g);-1!==h&&(a.splice(h,1),a.unshift(g))}for(e=0;e<a.length;e++){for(var g=a[e],k=this._studies[g],h=[],f=0;f<k.length;f++){var m=k[f];if(d.length)for(var n=0;n<d.length;n++){var q=d[n].re;q.lastIndex=0;q.test(m.description)&&h.push(m)}else h.push(m)}if(h.length){f=$('<div class="insert-study-items"><div>');k=g;switch(g){case this._BASIC_STUDIES_PACKAGE_NAME:k="Technical Analysis: Built-ins";break;case "Script$USER":k="Technical Analysis: Custom Scripts";
break;case "Script$PUB":k="Technical Analysis: Added Scripts";break;default:g in this._packagesWithTabNames&&(k=this._packagesWithTabNames[k])}b.append('<div class="search-header">'+k+"</div>");b.append(f);this.fillStudies(f,h,d)}}b.is(":has(li)")||b.append('<p class="not-found">'+$.t("No indicators matched your criteria.")+"</p>");this.layoutChanged.fire()}c||this.selectPage("search")};
TradingView.StudyMarket.prototype.updateSearchPage=function(){var a=this._tabs.search.find("input").val();this.search(a,!0,!0)};TradingView.StudyMarket.prototype.updateMarketPages=function(){$.when(this.marketPagesReady).done(function(){var a;this._market.order.forEach(function(b){a=this._market.products[b];pro.hasPackage(a.id)?(b=this._studies[a.id])?this.preparePageStudies(a.$page,b,a):console.warn("Subscripted study package "+a.id+" absent in metaInfo."):this.preparePageOffer(a.$page,a)},this)}.bind(this))};
TradingView.StudyMarket.prototype.preparePageStudies=function(a,b,c){var d=$('<div class="insert-study-items"/>');a.empty();a.append(d);c&&a.find(".insert-study-items").css({width:199,"float":"left"}).end().append('<div class="insert-study-offer-container">'+pro.prepareProductPage(c)+"</div>");b=this.sortStudies(b);this.fillStudies(d,b,null,c?1:3)};TradingView.StudyMarket.prototype.preparePageOffer=function(a,b){a.html(pro.prepareProductOfferPage(b));a.data("offer",b)};
TradingView.StudyMarket.prototype.addPage=function(a,b){b=$.extend({},b);var c=$.t(a),d=a.toLowerCase(),e=$("<div></div>").data("title",d),c=$("<li></li>").text(c).data("title",d),f=$('<div class="insert-study-header"></div>').data("title",d).appendTo(this._w_headers).hide();b.beta&&c.append('<span class="beta-sign">Beta</span>');b.packageName&&(this._packagesWithTabNames[b.packageName]=a);this._pages[d]=e;this._tabs[d]=c;this._headers[d]=f;b.market?(this._w_market_tabs||(f=!0,"undefined"!=typeof TVSettings.getBool(this._MARKET_TAB_IS_OPEN_KEY)&&
(f=TVSettings.getBool(this._MARKET_TAB_IS_OPEN_KEY)),this._w_market_tabs=$('<li class="market-tabs"><div class="text open">Marketplace Add-ons</div><ul></ul></li>'),this._w_tabs.append(this._w_market_tabs),this.toggleMarketTabs(f)),this._w_market_tabs.find("ul").append(c)):this._w_market_tabs?c.insertBefore(this._w_market_tabs):this._w_tabs.append(c);this._w_pages.append(e);e.toggle(d===this._currentPageTitle);return e};
TradingView.StudyMarket.prototype.hide=function(){this._widget.hide();this.visibilityChanged.fire(!1);TradingView.keyboardBinder.removeListener("StudyMarket")};
TradingView.StudyMarket.prototype.show=function(){this._widget.show();this._widget.css("z-index",TVDialogs.dialogs.length+110);this._widget.on("mousedownoutside",function(a){$(a.target).parents().andSelf().is(".script-search-dialog, .colorpicker, .charts-popup-list, .tvcolorpicker-popup, .symbol-edit-popup, .tv-dialog-shadowbox")||(this._widget.unbind("mousedownoutside"),this.hide())}.bind(this));this._widget.on("keyup.hideDialogStudy",function(a){"27"==a.which&&(this._widget.unbind("keyup.hideDialogStudy"),
this.hide())}.bind(this));this._clearInput();this.loadFavorites();this._scroll.scrollTo(0);this.updateLayout(!0);this.visibilityChanged.fire(!0);this.focusAddSymbolInput(this._currentPageTitle);TradingView.keyboardBinder.registerListener("StudyMarket",function(a){if(a.ctrlKey||"47"==a.which)return!1;if(a.which&&13===a.which)return this._insertStudyByShortDescription(),!0;if(!a.charCode||!a.which||32>=a.which||/^(input|textarea)$/i.test(a.target.tagName))return!1;a.preventDefault();this._search_input.focus();
this._search_input[0].value=String.fromCharCode(a.charCode);return!0}.bind(this))};TradingView.StudyMarket.prototype.isVisible=function(){return this._widget.is(":visible")};
TradingView.StudyMarket.prototype.updateLayout=function(a){var b=568;this._w_pages.css("height","");this._widget.css("width","");var c=this._w_pages.find(".insert-study-offer-container");c.css("height","");for(var d=this._w_pages.children(),e=0;e<d.length;e++){var f=$(d[e]);f.hasClass("offer-page")&&(f=f.actual("height"),f>b&&(b=f))}d=this._w_headers.outerHeight();this._w_pages.height(b-d);TVDialogs.resizeContent(this._widget.height(),this._w_pages);TVDialogs.resizeContentWidth(this._widget.width(),
this._widget);c.height()<this._w_pages.height()&&c.css("height","100%");this._w_tabs_container.height(this._widget.find(".insert-study-main").outerHeight()-this._widget.find(".search").outerHeight());b=Math.min($(window).height(),$("body").height());c=$(window).width();d=this._widget.outerWidth();e=$("body").hasClass("on-cme-widget")?10:20;f=this._widget.height();a&&this._widget.css({left:Math.max(0,c-d)/2,top:Math.max(e,b-f)/2})};
TradingView.StudyMarket.prototype.getPage=function(a){a=a.toLowerCase();return this._pages[a]};TradingView.StudyMarket.prototype.focusAddSymbolInput=function(a){a==this._ECONOMY_TAB.toLowerCase()&&this.addSymbolWidget.focus()};
TradingView.StudyMarket.prototype.selectPage=function(a){this.focusAddSymbolInput(a);var b="";"string"===typeof a?b=a.toLowerCase():a instanceof $&&(b=a.data("title"));if(this._currentPageTitle!==b)if(b in this._pages&&b in this._tabs&&("favorites"!=b||this.hasVisibleFavorites())){for(_title in this._pages)this._headers[_title]&&this._headers[_title].toggle(b===_title),this._pages[_title].toggle(b===_title),this._tabs[_title].toggleClass("active",b===_title);this._currentPageTitle=b;this.layoutChanged.fire();
TVSettings.setValue(this._PAGE_KEY,b)}else this.selectPage("Technical Analysis")};
TradingView.StudyMarket.prototype.attachHandlers=function(){var a=Modernizr.touch?"touchend":"click";this._w_tabs.on(a,"li",this.selectThisPage.bind(this));this._w_tabs.on(a,"li.market-tabs",this.marketTabsClickHandler.bind(this));this._w_pages.on(a,".insert-study-items .fav",this.toggleItem.bind(this));this._w_pages.on(a,".insert-study-items .source",this.viewSourceCode.bind(this));this._w_pages.on(a,".insert-study-items .remove",this.removeItem.bind(this));this._w_pages.on(a,".insert-study-items li",
this.insertThisStudy.bind(this));this._widget.on(a,function(a){a.stopPropagation()});this._widget.on(a,".insert-study-subscribe-button",this.subscribePackage.bind(this));this.favsChanged.subscribe(this,this.updateFavorites);this.layoutChanged.subscribe(this,this.updateLayout);loginStateChange.subscribe(this,this.onLoginStateChange);this._w_title.on(a,"a",this.hide.bind(this));this._widget.on("click",".insert-study-offer-info-screenshots",function(a){a.currentTarget.getAttribute("data-fancybox-inited")||
(a.currentTarget.setAttribute("data-fancybox-inited",!0),$(this).find("a").fancybox({type:"image",live:!1,afterShow:function(){$(".fancybox-overlay").on("click",function(a){a.stopPropagation()})}}),setTimeout(function(){$(a.target).click()},0));a.preventDefault()})};TradingView.StudyMarket.prototype.selectThisPage=function(a){var b=$(a.currentTarget).data("title");b&&"search"!=b&&this.selectPage(b);a.stopPropagation()};
TradingView.StudyMarket.prototype.marketTabsClickHandler=function(a){a.stopPropagation();this.toggleMarketTabs()};
TradingView.StudyMarket.prototype.toggleMarketTabs=function(a){var b=this,c=this._w_market_tabs.find("ul"),d=this._w_market_tabs.find(".text"),e=function(){TVSettings.setValue(b._MARKET_TAB_IS_OPEN_KEY,d.hasClass("open"));b.layoutChanged.fire()};"boolean"===typeof a?a?(c.is(":visible")?c.slideDown(50,e):(c.css("display","block"),e()),d.addClass("open")):(c.is(":visible")?c.slideUp(50,e):(c.css("display","none"),e()),d.removeClass("open")):(d.toggleClass("open"),c.slideToggle(50,e))};
TradingView.StudyMarket.prototype.toggleItem=function(a){a=$(a.target).parent().data("study");this.toggleFavorite(a);this.toggleEverywhere(a);return!1};TradingView.StudyMarket.prototype.removeItem=function(a){var b=$(a.target).parent().data("study");this.studyIsPublishedScript(b)&&TVDialogs.showConfirm("Remove Added Script","Are you sure you want to remove this script?",function(){TradingView.PublishedScript.remove(b.scriptIdPart)});return!1};
TradingView.StudyMarket.prototype.toggleEverywhere=function(a){var b=this.isFavorite(a);this._widget.find(".insert-study-items li").filter(function(b,d){return $(d).data("study")==a}).find(".fav").toggleClass("in-fav",b).attr("title",this.favTitle(b))};TradingView.StudyMarket.prototype.toggleFavorite=function(a){this.isFavorite(a)?this.removeFavorite(a):this.addFavorite(a)};TradingView.StudyMarket.prototype.isFavorite=function(a){return-1!=this._favs.indexOf(a)};
TradingView.StudyMarket.prototype.addFavorite=function(a){if(this.isFavorite(a))return!1;this._favs.push(a);this.saveFavorites();this.favsChanged.fire();return!0};TradingView.StudyMarket.prototype.removeFavorite=function(a){return this.isFavorite(a)?(this._favs.splice(this._favs.indexOf(a),1),this.saveFavorites(),this.favsChanged.fire(),!0):!1};
TradingView.StudyMarket.prototype.updateFavorites=function(){if(this.hasVisibleFavorites()){var a=this.getVisibleFavorites();this.preparePageStudies(this._pages.favorites,a);this._widget.find(".insert-study-items li").find(".fav").removeClass("in-fav");a.forEach(this.toggleEverywhere,this);this._tabs.favorites.show()}else"favorites"===this._currentPageTitle&&this.selectPage("Technical Analysis"),this._widget.find(".insert-study-items li .fav").removeClass("in-fav"),this._tabs.favorites.hide()};
TradingView.StudyMarket.prototype.hasFavorites=function(){return!!this._favs.length};TradingView.StudyMarket.prototype.hasVisibleFavorites=function(){return!!this.getVisibleFavorites().length};TradingView.StudyMarket.prototype.getVisibleFavorites=function(){return this.checkExcludePackageStudies(this._favs)};
TradingView.StudyMarket.prototype.viewSourceCode=function(a){a.stopPropagation();this.hide();var b=$(a.target).parent().data("study");scriptLib.requestBuiltinAndUserScripts(function(a){for(var d=a.length;d--;)a[d].scriptIdPart===b.scriptIdPart&&window.scriptEditor.show(a[d])})};
TradingView.StudyMarket.prototype.checkExcludePackageStudies=function(a){return a.filter(function(a){a=a.id.split("@")[1];return a===this._BASIC_STUDIES_PACKAGE_NAME||a===this._SCRIPTING_PACKAGE_NAME||pro.hasPackage(a)&&a in this._studies},this)};TradingView.StudyMarket.prototype.sortStudies=function(a){return a.sort(function(a,c){a=a.scriptName||a.description;c=c.scriptName||c.description;return a>c?1:a<c?-1:0})};
TradingView.StudyMarket.prototype.fillStudies=function(a,b,c,d){d||(d=3);a.empty();for(var e=[],f=0;f<d||1>f;f++){var g=document.createElement("ul");g.className="column";e.push(g)}var h=Math.ceil(b.length/d),k;b.forEach(function(a,b){a?k=this.createStudyListItem(a,c):(k=document.createElement("li"),k.className="placeholder");e[b/h>>0].appendChild(k)},this);for(f=0;f<e.length;f++)a.append(e[f])};
TradingView.StudyMarket.prototype.createStudyListItem=function(a,b){var c=document.createElement("li");$.data(c,"study",a);var d=$.t(a.scriptName||a.description||"",{context:"study"}),e=this.isFavorite(a),f=[];if(b&&d){var g=[];b instanceof RegExp?g.push({re:b,fuzzyHighlight:!1}):$.isArray(b)&&(g=b);for(var h=0;h<g.length;h++){var k=g[h].re;k.lastIndex=0;if(k=k.exec(d))if(g[h].fuzzyHighlight)for(var m=k.index,n=1;n<k.length;n++){var q=k[n].length;n%2&&(f[m]=!0);m+=q}else for(m=0;m<k[0].length;m++)f[k.index+
m]=!0}}d=d.replace(/./g,function(a,b){"<"===a?a="&lt;":"&"===a?a="&amp;":'"'===a&&(a="&quot;");f[b]&&(a='<span class="match">'+a+"</span>");return a});c.innerHTML='<span class="text">'+d+'</span><span class="fav'+(e?" in-fav":"")+'" title="'+this.favTitle(e)+'">';this.studyIsPublishedScript(a)?(c.className="published-script",a.author&&a.author.username&&$('<span class="author">').text(" by "+a.author.username).appendTo(c),$('<span class="remove" title="Remove"></span>').appendTo(c)):a.scriptIdPart&&
!TradingView.isMobileView&&(c.innerHTML+='<span class="source" title="Source code"></span>',c.className="custom-script");return c};TradingView.StudyMarket.prototype.favTitle=function(a){return a?$.t("Remove from favorites"):$.t("Add to favorites")};TradingView.StudyMarket.prototype.insertThisStudy=function(a){a=$(a.target).closest("li");if(!a.hasClass("placeholder"))return a.highlight(this.HIGHLIGHT_STUDY_NUM_FLICKS),a=a.data("study"),this.insertStudy(a),!1};
TradingView.StudyMarket.prototype.insertStudy=function(a){var b=this._chartWidgetCollection.activeChartWidget.value();b&&(a=StudyMetaInfo.replaceWithFullStudyMetaInfo(b.model().studiesMetaData(),a),b.insertStudyOrShowDialog(a),this._is_on_chart=!0)};TradingView.StudyMarket.prototype.subscribePackage=function(a){(a=$(a.target).closest(".insert-study-pages > div").data("offer"))&&TradingView.visitPaymentPage(a.id)};TradingView.StudyMarket.prototype.onLoginStateChange=function(a){a||this.setUser(window.user)};
TradingView.StudyMarket.prototype.getStudyList=function(a){if(!this.studiesReady.isResolved())return[];var b=[],c;for(c in this._studies)if(c==this._BASIC_STUDIES_PACKAGE_NAME||pro.hasPackage(c))this._studies[c].forEach(function(a){b.push(a)}),a&&b.push({separator:!0});a&&b.splice(b.length-1,1);return b};
TradingView.StudyMarket.prototype.getStudyPackageName=function(a){if(a&&a.id){var b=a.id.split("@");a=b[1];if(a!==this._SCRIPTING_PACKAGE_NAME)return a;b=b[0];if(0!==b.indexOf("Script$"))return a;a=b.indexOf("_");return-1!==a?b.substring(0,a):/^Script\$USER;/.test(b)?"Script$USER":/^Script\$PUB;/.test(b)?"Script$PUB":/^Script\$STD;/.test(b)?this._BASIC_STUDIES_PACKAGE_NAME:b}};TradingView.StudyMarket.prototype.studyIsUserTVScript=function(a){if(a&&a.id)return"Script$USER"===this.getStudyPackageName(a)};
TradingView.StudyMarket.prototype.studyIsPublishedScript=function(a){if(a&&a.id)return"Script$PUB"===this.getStudyPackageName(a)};TradingView.StudyMarket.prototype.selectSearchPage=function(){this.selectPage("search");this._clearInput()};
TradingView.StudyMarket.prototype._insertStudyByShortDescription=function(){for(var a=this._search_value,a=a.trim(),b=this._studies[this._BASIC_STUDIES_PACKAGE_NAME],c=0;c<b.length;c++){var d=b[c];if(d.shortDescription&&d.shortDescription.toUpperCase()===a.toUpperCase()){this.insertStudy(d);break}}};TradingView.StudyMarket.prototype._clearInput=function(){this._search_input.val("");"search"===this._currentPageTitle&&this._search_input.val("").trigger("input").focus()};TradingView.deleteStudyTemplate=function(a,b){$.post("/remove-study-template/",{name:a},b)};TradingView.StudyTemplates=function(a){this._options=a||{};this._chartWidgetCollection=this._options.chartWidgetCollection;this._SAVE_AS_TITLE="Save Study Template As...";this._list=[];this._loaded=!1;this._favoredList=this._$wrapper=null;this._onFirstLoad=new Delegate;this.refreshStudyTemplateList(function(){this._loaded=!0;this._onFirstLoad.fire()}.bind(this))};
TradingView.StudyTemplates.prototype.appendMenuButtonTo=function(a){if(a){var b=function(){this._$wrapper=a;this._generateFavoriteList()};this._loaded?b.call(this):this._onFirstLoad.subscribe(this,b);this.onFavoriteListResize=new Delegate}};TradingView.StudyTemplates.prototype.refreshStudyTemplateList=function(a){var b=this;TradingView.getStudyTemplatesList(function(c){b._list=c||[];"function"===typeof a&&a()})};
TradingView.StudyTemplates.prototype._generateFavoriteList=function(){this._favoredList=new TradingView.FavoredList("StudyTemplates",this._listPreparedForFavorite(),{addClass:"study-template-widget",popupAddClass:"study-template-popup",notShowActive:!0,popupSpacing:this._options.popupSpacing,notShowQuicks:this._options.notShowQuicks,tooltip:"Study Templates",addTooltipClass:"apply-common-tooltip"});this._favoredList.element().appendTo(this._$wrapper);this._favoredList.onSelect().subscribe(this,function(a){a!=
this._SAVE_AS_TITLE&&this.applyStudyTemplate(a)});this._favoredList.onSelect().subscribe(this,function(a){a===this._SAVE_AS_TITLE&&this.showSaveAsDiaolg()});this._favoredList.onResize().subscribe(this._chartWidgetCollection,this._chartWidgetCollection.updateLayout);this._favoredList.onResize().subscribe(this.onFavoriteListResize,this.onFavoriteListResize.fire)};
TradingView.StudyTemplates.prototype._listPreparedForFavorite=function(a){var b=this;a=this.plainList("default");var c=this.plainList("custom"),d=[{id:b._SAVE_AS_TITLE,title:b._SAVE_AS_TITLE,addClass:"special",toQuickButtonStyle:{display:"none"}},{separator:!0}],e=function(a,c){return $.map(a,function(a){var d={id:a,title:a,favoriteButton:{icon:{},title:a,addClass:"apply-common-tooltip"}};c&&(d.drop=function(){this.deleteStudyTemplate(a)}.bind(b));return d})};c.length&&(d=d.concat(e(c,!0)).concat([{separator:!0}]));
return d=d.concat(e(a))};TradingView.StudyTemplates.prototype.applyStudyTemplate=function(a){var b=this._chartWidgetCollection.activeChartWidget.value();TVSettings.setValue("defaultStudyTemplate",a);$.get("/study-template/?templateName="+encodeURIComponent(a),function(c){TradingView.trackEvent("GUI","Load Study Template");b.model().model().restoreStudyTemplate(JSON.parse(c.content),a)})};
TradingView.StudyTemplates.prototype.showSaveAsDiaolg=function(){var a=this,b=this._chartWidgetCollection.activeChartWidget.value(),c=function(c,d){c=clean(c);var g=d[0],g=JSON.stringify(b.model().model().studyTemplate(g)),h={name:c,content:g},g=function(){$.post("/save-study-template/",h,function(b){b.error||(TVSettings.setValue("defaultStudyTemplate",c),a.refreshFavoriteDropdownMenu())}).error(function(a){console.error(a.responseText)})};-1!=$.inArray(c,a.plainList())?TVDialogs.showConfirm("Confirm replace",
'Do you realy want to replace "'+c+"\"?<br><small>Note: default study templates won't be removed permanently</small>",g):g()},d=function(b){a.refreshStudyTemplateList(function(){b.find('[name="name"]').inputselectable({list:a.plainList().sort(),closeHandle:b})})};runOrSignIn(function(){TradingView.showChartNameDialog(c,"Save new study template","Template name",255,[{title:"Save Interval",name:"save_interval",type:"bool",hint:'When selecting this checkbox the study template will set "'+b.model().model().mainSeries().interval()+
'" interval on a chart'}],d)},!0)};TradingView.StudyTemplates.prototype.refreshFavoriteDropdownMenu=function(){var a=this,b=this._favoredList;b&&a.refreshStudyTemplateList(function(){b.reload(a._listPreparedForFavorite());b._container.hasClass("active")&&(b._container.trigger("click"),b._openMenu.call(b))})};
TradingView.StudyTemplates.prototype.deleteStudyTemplate=function(a){var b=this,c="Do you realy want to delete "+(a?'"'+a+'"':"")+" study template?";runOrSignIn(function(){TVDialogs.showConfirm("Study Template",c,function(){TradingView.deleteStudyTemplate(a,function(){setTimeout(function(){b.refreshFavoriteDropdownMenu()},0)})})})};TradingView.StudyTemplates.prototype.container=function(){return this._favoredList?this._favoredList._container:null};TradingView.StudyTemplates.prototype.list=function(){return this._list};
TradingView.StudyTemplates.prototype.plainList=function(a){return"default"===a?$.map(jQuery.grep(this._list,function(a){return!!a.is_default}),function(a){return a.name}):"custom"===a?$.map(jQuery.grep(this._list,function(a){return!a.is_default}),function(a){return a.name}):$.map(this._list,function(a){return a.name})};var Action=function(a){a||(a={});this.checkable=a.checkable||!1;this.checked=a.checked||null;this.enabled=void 0==a.enabled?!0:a.enabled;this.visible=a.visible||!0;this.font=a.font||"Arial";this.icon=a.icon||null;this.iconText=a.iconText||null;this.iconVisibleInMenu=a.iconVisibleMenu||!0;this.deleteButton=a.deleteButton||null;this.shortcut=null;this.setShortCut(a.shortcut);this.statusTip=a.statusTip||null;this.text=a.text||null;this.toolTip=a.toolTip||null;this.htmlclass=a.htmlclass||null;this._callbackContext=
a.callbackContext||this;this._callbacks=new Delegate;this.subActions=a.subActions||[]};Action.prototype.callbacks=function(){return this._callbacks};Action.prototype.callbackContext=function(){return this._callbackContext};Action.prototype.setCallbackContext=function(a){this._callbackContext=a};Action.prototype.hasSubActions=function(){return this.subActions&&this.subActions.length};Action.prototype.setChecked=function(a){this.checked=a};Action.prototype._toggleChecked=function(){this.checked=!this.checked};
Action.prototype.setVisible=function(a){this.visible=a};Action.prototype.setEnabled=function(a){this.enabled=a};Action.prototype.disable=function(){this.setEnabled(!1)};Action.prototype.enable=function(){this.setEnabled(!0)};Action.prototype.setShortCut=function(a){a&&(this.shortcut=a,this._bindShortCut())};
Action.prototype._bindShortCut=function(){var a=this,b="."+this.shortcut;$(document).unbind(b);$(document).bind("keydown"+b,this.shortcut,function(b){b.preventDefault();if(a.enabled)return a.executeCallback(),!1})};Action.prototype.setIconVisible=function(a){this.iconVisibleInMenu=a};Action.prototype.executeCallback=function(a){this._lastEvent=a;this._toggleChecked();this._callbacks.fire(this)};ActionSeparator=function(){Action.call(this);this.subActions=this.font=null;this.htmlclass="action-separator"};
inherit(ActionSeparator,Action);ActionPlaceholder=function(a){Action.call(this);this.deferred=a};inherit(ActionPlaceholder,Action);var ContextMenu={INSERT_AT_END:0,INSERT_AT_START:1,INSERT_AT_POS:2,WRAPPER_TAG:"div",WRAPPER_ATTRIBUTES:{"class":"context-menu-wrapper"},MENU_TAG:"table",ITEM_ROW_TAG:"tr",ICON_CELL_TAG:"td",TEXT_CELL_TAG:"td",RIGHT_CELL_TAG:"td",SUBMENU_CELL_TAG:"td",instances:[],createMenu:function(a,b,c){a=new ContextMenu.Menu(a,b,c);this.instances.push(a);return a},createMenuFromActions:function(a,b){var c=new ContextMenu.Items(a,b);this.instances.push(c);return c},hideAll:function(){for(instance in this.instances)this.instances[instance].hide()}};(function(a){function b(a){if(null==a._parentMenu)return null;a=a._parentMenu;a=null==a._parentMenuItem?a:b(a._parentMenuItem);return a}ContextMenu.Item=function(a,b){this.action=a;this._parentMenu=b};ContextMenu.Item.prototype._createIconTag=function(){var a=this._iconTagAttributes();this.jqIcon=HTMLHelper.Element.create(ContextMenu.ICON_CELL_TAG,a);this.jqIcon.addClass("context-menu");return this.jqIcon};ContextMenu.Item.prototype._createDeleteButton=function(){if(!this.action.deleteButton)return null;
var a=this,b=this.action.deleteButton.action,e=HTMLHelper.Element.create("span",{"class":"context-menu-delete-button"});b&&e.click(function(){b.call(a);return!1});this.jqSubmenu.addClass("delete-spacer");this.jqSubmenu.append(e)};ContextMenu.Item.prototype._createTextTag=function(){var a=this._textTagAttributes();this.jqText=HTMLHelper.Element.create(ContextMenu.TEXT_CELL_TAG,a);this.jqIcon.addClass("context-menu");return this.jqText};ContextMenu.Item.prototype._createRightTag=function(){var a=this._rightTagAttributes();
this.jqRight=HTMLHelper.Element.create(ContextMenu.RIGHT_CELL_TAG,a);this.jqIcon.addClass("context-menu");return this.jqRight};ContextMenu.Item.prototype._createSubmenuTag=function(){var a=this._submenuTagAttributes();this.jqSubmenu=HTMLHelper.Element.create(ContextMenu.SUBMENU_CELL_TAG,a);this.jqIcon.addClass("context-menu");return this.jqSubmenu};ContextMenu.Item.prototype._iconTagAttributes=function(){var a={},b=[];this.action&&(this.action.icon?(b.push("icon"),b.push(this.action.icon.replace(/\./,
"_"))):this.action.checkable?(b.push("icon"),this.action.checked?b.push("checked-icon"):b.push("unchecked-icon")):b.push("spacer"));a["class"]=b.join(" ");return a};ContextMenu.Item.prototype._textTagAttributes=function(){return{"class":"text",html:this.action?this.action.text:""}};ContextMenu.Item.prototype.highlight=function(a){a?(this.jqRow.addClass("context-menu-hover"),this.jqIcon.addClass("context-menu-hover")):(this.jqRow.removeClass("context-menu-hover"),this.jqIcon.removeClass("context-menu-hover"));
this.action&&this.action.hasSubActions()&&(a?this.jqSubmenu.addClass("expanded"):this.jqSubmenu.removeClass("expanded"))};ContextMenu.Item.prototype._rightTagAttributes=function(){var a={},b=["right"];this.action&&this.action.shortcut&&(b.push("shortcut"),a["class"]=b.join(" "),a.html=this.action.shortcut);return a};ContextMenu.Item.prototype._submenuTagAttributes=function(){var a={};this.action&&this.action.hasSubActions()?a["class"]="submenu-arrow":a["class"]="context-menu spacer";return a};ContextMenu.Item.prototype.render=
function(){this._createRow();this.jqRow.append(this._createIconTag());this.jqRow.append(this._createTextTag());this.jqRow.append(this._createRightTag());this.jqRow.append(this._createSubmenuTag());this._createDeleteButton();this.appendCallback();var a=this;this.jqRow.mouseenter(function(b){a.showSubmenu(b);a.highlight(!0);a._parentMenu&&a._parentMenu._parentMenuItem&&a._parentMenu._parentMenuItem.highlight(!0)});this.jqRow.mouseleave(function(){a.highlight(!1)});return this.jqRow};ContextMenu.Item.prototype._createRow=
function(){var a=this._rowTagAttributes();this.jqRow=HTMLHelper.Element.create(ContextMenu.ITEM_ROW_TAG,a);this.jqRow.addClass("context-menu");var b=this;if(this.action&&!this.action.hasSubActions()){var e=function(a){a.destroy();a._parentMenuItem&&e(a._parentMenuItem._parentMenu)};this.jqRow.click(function(a){e(b._parentMenu)})}};ContextMenu.Item.prototype.showSubmenu=function(a){this._parentMenu.closeOtherSubmenus(this);if(!this.action||this.action.hasSubActions())this._menu||(this._menu=ContextMenu.createMenu(this.action.subActions,
null,this)),this.jqRow.position(),this.jqRow.height(),this.jqRow.width(),this.jqRow.offset(),a.pageX=this._parentMenu.jqMenu.width()-2,a.pageY=this.jqSubmenu.offset().top-this._parentMenu.jqMenu.offset().top-1,this._menu.show(a,this._parentMenu.jqMenu)};ContextMenu.Item.prototype._rowTagAttributes=function(){var a=[];this.action&&(!1===this.action.enabled&&a.push("disabled"),!1===this.action.visible&&a.push("hidden"),this.action.font&&a.push("font_"+this.action.font),this.action.hasSubActions()&&
a.push("has_submenu"),this.action.htmlclass&&a.push(this.action.htmlclass));return{"class":a.join(" ")}};ContextMenu.Item.prototype.appendCallback=function(){var a=this;this.jqRow.click(function(b){a.action.enabled&&a.action.executeCallback(b)})};ContextMenu.Item.prototype.getTopLevelMenu=function(){return b(this)};ContextMenu.ItemPlaceholder=function(a,b){this.action=a;this._parentMenu=b};ContextMenu.ItemPlaceholder.prototype.render=function(a){this._createRow();var b=this;this.action.deferred.then(function(e){for(var f in e){var g=
b._parentMenu.addItem(e[f]);ContextMenu.Menu.renderItem(a,g)}}).always(function(){b.jqRow.hide()});return this.jqRow};ContextMenu.ItemPlaceholder.prototype._createIconTag=function(){var a=this._iconTagAttributes();this.jqIcon=HTMLHelper.Element.create(ContextMenu.ICON_CELL_TAG,a);this.jqIcon.addClass("context-menu");return this.jqIcon};ContextMenu.ItemPlaceholder.prototype._createRow=function(){var a=this._rowTagAttributes();this.jqRow=HTMLHelper.Element.create(ContextMenu.ITEM_ROW_TAG,a);this.jqRow.append(this._createIconTag());
this.jqRow.addClass("context-menu")};ContextMenu.ItemPlaceholder.prototype._rowTagAttributes=function(){var a=[];this.action&&a.push("spinner");return{"class":a.join(" ")}};ContextMenu.ItemPlaceholder.prototype.highlight=function(a){};ContextMenu.ItemPlaceholder.prototype._iconTagAttributes=function(){var a={},b=[];b.push("spacer");a["class"]=b.join(" ");a.colspan="10";return a}})(jQuery);(function(a){function b(a){var d=[];a=a.m_items;for(var e=0;e<a.length;e++)a[e]._menu&&(d.push(a[e]._menu),d=d.concat(b(a[e]._menu)));return d}ContextMenu.Menu=function(b,d,e){this.options={};this._parentMenuItem=e;a.extend(this.options,d);this.options["class"]&&(this.options.attributes["class"]=this.options["class"]);this.m_wrapper=this.jqMenu=null;this.m_items=[];for(var f in b)this.addItem(b[f])};ContextMenu.Menu.prototype.addItem=function(a){a=a instanceof ActionPlaceholder?new ContextMenu.ItemPlaceholder(a,
this):new ContextMenu.Item(a,this);this.m_items.push(a);return a};ContextMenu.Menu.renderItem=function(a,b){a.append(b.render(a))};ContextMenu.Menu.prototype.closeOtherSubmenus=function(a){for(a=0;a<this.m_items.length;++a)this.m_items[a].highlight(!1),this.m_items[a]._menu&&(this.m_items[a]._menu.destroy(),this.m_items[a]._menu=null)};ContextMenu.Menu.prototype.isShown=function(){return null!==this.jqMenu};ContextMenu.Menu.prototype.render=function(){var b=this.getAttributes();if(this._parentMenuItem){this.jqMenu=
b=a("<table>");b.attr("cellspacing","0");b.attr("cellpadding","0");b.addClass("context-menu");b.addClass("submenu");for(var d in this.m_items){var e=this.m_items[d];ContextMenu.Menu.renderItem(b,e)}}else for(d in this.jqMenu=b=HTMLHelper.Element.create(ContextMenu.MENU_TAG,b),this.m_items)e=this.m_items[d],ContextMenu.Menu.renderItem(b,e);return this.jqMenu};ContextMenu.Menu.prototype.getAttributes=function(){var a={},b=["context-menu"];this.options.attributes&&this.options.attributes["class"]&&b.push(this.options.attributes["class"]);
a.cellspacing=0;a.cellpadding=0;a["class"]=b.join();return a};ContextMenu.Menu.prototype.deploy=function(b,d){this.jqMenu=this.wrapper().append(this.render());d?(a(d).data("submenu",this.jqMenu),a(document.body).append(this.jqMenu),this.jqMenu.data("parent-menu",d),this.jqMenu.data("parent-item",b.currentTarget)):a(document.body).append(this.jqMenu);HTMLHelper.unbindContextMenu(this.jqMenu);this._setCoords(b);return this.jqMenu};ContextMenu.Menu.prototype.show=function(a,b){this.deploy(a,b).show()};
ContextMenu.Menu.prototype.hide=function(){this.isShown()&&this.destroy()};ContextMenu.Menu.prototype.destroy=function(){a.each(this.m_items,function(a,b){b._menu&&b._menu.destroy()});this.jqMenu&&(this.jqMenu.remove(),this.jqMenu=null);this.m_wrapper.empty()};ContextMenu.Menu.prototype._setCoords=function(b){var d=this.jqMenu;a(this.jqMenu.data("parent-menu"));var e=a(this.jqMenu.data("parent-item")),f=a(window).width(),g=Math.min(a(window).height(),a("body").height()),h=a(document).scrollTop(),
k=a(document).scrollLeft();this.jqMenu.css({maxWidth:f-10,maxHeight:g-10});var m=d.outerWidth(),d=d.outerHeight(),n;e.size()?(n=e.offset(),n={top:n.top-1,left:n.left+e.outerWidth()}):n={top:b.pageY,left:b.pageX};this.jqMenu.offset(n);e={};e.top=Math.min(n.top,g+h-d-5);e.left=Math.min(n.left,f+k-m-5);for(b=b.target;b&&b!==document;b=b.parentNode)if("fixed"===a(b).css("position")){this.jqMenu.css("position","fixed");break}this.jqMenu.offset(e)};ContextMenu.Menu.prototype._wrapper=function(){var c=this,
d=ContextMenu.WRAPPER_ATTRIBUTES;this._parentMenuItem?this.m_wrapper=HTMLHelper.Element.create(ContextMenu.WRAPPER_TAG,d):(this.m_wrapper=HTMLHelper.createPopup(d,void 0,{mouseDownOutsideEvent:function(d){var f=a();a.each(b(c),function(){f=f.add(this.m_wrapper)});a(d.target).parents().andSelf().is(f)||c.hide()}}),this.m_wrapper.addClass("topmenu"));return this.m_wrapper};ContextMenu.Menu.prototype.wrapper=function(a){return this.m_wrapper||this._wrapper()}})(jQuery);TradingView._defaultChartSymbol="FX:SPX500";
TradingView.ChartWidget=function(a){var b=this;TradingView.drawingState.init();var c=this;TradingView.drawingState.tool.subscribe(function(a){if(c._model){c._model.model().setCurrentTool(a);if(TradingView.isMobile.any()){var b=c._paneWidgets[0];if(LineDataSource.isLineTool(a)&&"LineToolBrush"!==a){a=0.5*c._model.model().timeScale().width();var d=0.5*b._state.defaultPriceScale().height();c._model.model().setCurrentPosition(a,d,b._state);b._updateTooltip(a,d)}else b._hideTooltip()}c._model&&TradingView.isMobile.any()&&
c._model.model().crossHairSource().updateAllViews()}});this._options=a=a||{};var d=a.jqParent,e=a.sizeFunc,f=a.content,g=a.readOnly,h=a.containsData,k=a.defSymbol,m=a.defInterval,n=a.defStyle,q=a.onWidget,l=a.onCmeWidget,s=a.timezone,u=a.withDateRanges,z=a.hideSymbolSearch;this._chartWidgetCollection=a.chartWidgetCollection||null;this._withDateRanges="undefined"===typeof u?!g:!!u;this._jqParent=void 0!==d?d:$(document.body);this.setContent(f);this._readOnly=g;this._containsData=h;this._defSymbol=
k;this._onCmeWidget=(this._onWidget=!!q)?!!l:!1;this._sizeFunc=e||function(){var a=b._jqParent.width(),c=b._jqParent.height()-(b._withDateRanges?22:0);return new TradingView.Rect(0,0,a,c)};this._hideSymbolSearch=z;this._jqMainDiv=null;this._rect=this._sizeFunc();this._jqMainTable=null;this._paneWidgets=[];this._paneSeparators=[];this._timeAxisWidget=null;this._frameTime=30;this._model=null;this._metaInfo={};this._properties=new DefaultProperty("chartproperties");this._properties.mainSeriesProperties.merge(defaults("chartproperties.mainSeriesProperties"));
this._properties.mainSeriesProperties.merge({visible:!0,symbol:k||TradingView._defaultChartSymbol,timeframe:"",onWidget:this._onWidget,interval:m||"D",style:n||void 0,lineStyle:{styleType:factoryDefaults("chartproperties.mainSeriesProperties.lineStyle.styleType")}});s&&TradingView.timezoneIsAvailable(s)&&this._properties.timezone.setValue(s);this.onCmeWidget()&&this._properties.timezone.setValue("exchange");this._tagsChanged=new Delegate;this._modelCreated=new Delegate;this._disconnected=new Delegate;
this._reconnectBailout=new Delegate;this._connected=new Delegate;this._redrawPanes=new Delegate;this.chartWidgetInitialized=new Delegate;this._studiesMetaData=new List;this._studiesMigrations=new List;this._chartSession=new ChartSession(ChartApiInstance);this.lhsPriceAxisWidthChanged=new Delegate;this.rhsPriceAxisWidthChanged=new Delegate};TradingView.ChartWidget._nextMetadataId=1;
TradingView.ChartWidget.prototype._onStudiesMetadata=function(a){var b=this;if("studies_metadata"===a.method){this._studiesMigrations=new List;for(var c=a.params[1].migrations,d=0;d<c.length;d++)this._studiesMigrations.append(c[d]);var e=a.params[1].metainfo,e=e.concat(this.privateMetaInfo(TradingView.FundamentalsGenerator)),e=e.concat(this.privateMetaInfo(TradingView.EotProGenerator)),e=e.concat(this.privateMetaInfo(TradingView.ESDTimelineGenerator));a=window.scriptLib?window.scriptLib.requestBuiltinAndUserScripts():
$.Deferred().resolve([]);var f=TradingView.PublishedScript?TradingView.PublishedScript.list():$.Deferred().resolve([]);a.done(function(a){f.done(function(c){c=a.concat(c);b._onScriptSources(c,e)})})}};TradingView.ChartWidget.prototype.privateMetaInfo=function(a){return a?(new a(StudyMetaInfo.CURRENT_METAINFO_FORMAT_VERSION)).generateMetaInfo():[]};
TradingView.ChartWidget.prototype._onScriptSources=function(a,b){if(!this.onWidget()){for(var c=null,d=0;d<b.length;++d){var e=b[d];if(e.id.startsWith("Script@tv-scripting-")){c=StudyMetaInfo.parseIdString(e.id).version;break}}if(null!=c)for(this.studyScriptingPkgVers=c,d=0;d<a.length;++d)try{var f=a[d].scriptName;TradingView.logDebug("Loading script: '"+f+"'.");var g=StudyMetaInfo.createMetaInfoStub(a[d],c);b.push(g)}catch(h){console.error("Could not process script (skipped): "+f+" ("+h.message+
")")}else console.error("Could not find tv-scripting package in metadata response");TradingView.PublishedScript&&TradingView.PublishedScript.setSyncMetaInfo(this._studiesMetaData,c)}for(d=0;d<b.length;d++)StudyMetaInfo.addStudyMetaInfo(this._studiesMetaData,b[d]);StudyMetaInfo.sortStudiesMetainfo(this._studiesMetaData);this._init();this.chartWidgetInitialized.fire()};
TradingView.ChartWidget.prototype._init=function(){var a=this;this._containsData||!this._content||this._content.timeScale.m_lastVisibleBar||(this._content.timeScale.m_rightOffset=this._properties.timeScale.rightOffset.value());this.initColors();this._makeDefaultGui();this._makeDefaultModel();this._chartSession&&this._chartSession.connected()&&this._model.restart();this._content&&(this.initColors(),this._updateGui(),this.update(),this.paint());a._model.mainSeries().marketStatus.subscribe(function(b){a.indicatorImage&&
a._updateDataAndMarketStatus(b,a._model.mainSeries().status())},{callWithLast:!0});this._resizeHandler=function(){this._rect=this._sizeFunc();TradingView.setAbsoluteRect(this._jqMainDiv,this._rect);this._adjustSize();this._model&&this._model.mainSeries().requestMoreData();this.paint()}.bind(this);this.chartWidgetInitialized.subscribe(this,this._resizeHandler);$(window).keydown(function(a){27==a.which&&a.preventDefault()});this._containsData||this._jqMainDiv.mousewheel(function(a,c,d,e){if(!(!TradingView.onWidget()&&
parent&&parent!==window&&parent.IS_DEMO_PAGE||!this.model()||this.noScroll||this.model().timeScale().isEmpty())){a=a.pageX-5;c=this._paneWidgets[0].lhsPriceAxisWidget.size.w;var f=this._timeAxisWidget.size.w;c&&(a=Math.max(0,a-c));a=Math.min(a,f);a=2*(a/f-0.5);c=Math.min(1,Math.abs(e));0<e?this.model().zoomIn(a,c):0>e&&this.model().zoomOut(a,c);d&&this.model().scrollChart(-80*d);return!1}}.bind(this));this._initBarsMarksSources();TradingView.isFeatureEnabled("esdindicatorfeature")&&this.initESDTimelineWidget();
this.setAutoScaleOnSymbolChange();this.readOnly()||this._hideSymbolSearch||TradingView.SymbolSearch.registerDialogKeypressHandler(this)};TradingView.ChartWidget.prototype._initBarsMarksSources=function(){var a=this;this.withModel(this,function(){this.model().barsMarksSources().map(function(b){b.onNeedRepaint.subscribe(a,a.paint)})})};TradingView.ChartWidget.prototype.initESDTimelineWidget=function(){new TradingView.ESDTimelineWidget(this)};
TradingView.ChartWidget.prototype.setAutoScaleOnSymbolChange=function(){this.withModel(this,function(){this.model().mainSeries().onStartLoading().subscribe(this,function(){(!this.model().mainSeries()instanceof TradingView.Series||!this.model().mainSeries().properties().lockScale.value())&&0==this.model().mainSeries().data().size()&&this.model().mainSeries().priceScale().setAutoScale(!0)})})};
TradingView.ChartWidget.prototype.initColors=function(){this._properties.paneProperties.background.listeners().subscribe(this,TradingView.ChartWidget.prototype.setBackgroundColor);this._properties.paneProperties.gridProperties.color.listeners().subscribe(this,TradingView.ChartWidget.prototype.redrawPanes);this._properties.scalesProperties.lineColor.listeners().subscribe(this,TradingView.ChartWidget.prototype.setScaleLineColor);this._properties.scalesProperties.textColor.listeners().subscribe(this,
TradingView.ChartWidget.prototype.setScaleTextColor)};TradingView.ChartWidget.prototype.paneWidgets=function(){return new List(this._paneWidgets)};TradingView.ChartWidget.prototype.paneByCanvas=function(a){for(var b=0;b<this._paneWidgets.length;b++)if(this._paneWidgets[b].canvas===a||this._paneWidgets[b].top_canvas===a)return this._paneWidgets[b];return null};
TradingView.ChartWidget.prototype.paneByState=function(a){for(var b=0;b<this._paneWidgets.length;b++)if(this._paneWidgets[b]._state===a)return this._paneWidgets[b];return null};TradingView.ChartWidget.prototype.priceAxisByCanvas=function(a){for(var b=0;b<this._paneWidgets.length;b++){var c=this._paneWidgets[b].priceAxisByCanvas(a);if(c)return c}return null};
TradingView.ChartWidget.prototype.timeAxisByCanvas=function(a){return a===this._timeAxisWidget.canvas||a===this._timeAxisWidget.top_canvas?this._timeAxisWidget:null};TradingView.ChartWidget.prototype.properties=function(){return this._properties};TradingView.ChartWidget.prototype.emulateCriticalError=function(){this._chartSession.removeSeries(-1,null)};TradingView.ChartWidget.prototype.readOnly=function(){return this._readOnly};TradingView.ChartWidget.prototype.onDisconnected=function(){return this._disconnected};
TradingView.ChartWidget.prototype.onReconnectBailout=function(){return this._reconnectBailout};TradingView.ChartWidget.prototype.onConnected=function(){return this._connected};TradingView.ChartWidget.prototype.onRedrawPanes=function(){return this._redrawPanes};TradingView.ChartWidget.prototype.modelCreated=function(){return this._modelCreated};
TradingView.ChartWidget.prototype.setResolution=function(a){if(this._model){var b=this._model.mainSeries().properties().interval;this._model.setScreenChartProperty(b,a,this,$.t("Change Resolution"))}else this._properties.mainSeriesProperties.merge({interval:a})};TradingView.ChartWidget.prototype.getResolution=function(){return this._model?this._model.mainSeries().properties().interval.value():this._properties.mainSeriesProperties.interval.value()};
TradingView.ChartWidget.prototype.addSymbol=function(a,b){var c=this.model(),d=c.studiesMetaData(),e=c.mainSeries().properties().style.value()==TradingView.Series.STYLE_CANDLES?TradingView.Series.STYLE_BARS:TradingView.Series.STYLE_CANDLES;props={inputs:{symbol:a},style:e};study=d.find(function(a){return"Overlay@tv-basicstudies"==a.id});c.insertStudy(study,props,b)};TradingView.ChartWidget.prototype.addSymbolDialog=function(){TVDialogs.showAddSymbolDialog(this,{overlayOption:!0,callback:this.addSymbol.bind(this)})};
TradingView.ChartWidget.prototype.updateActions=function(){function a(a){function d(){TradingView.showChartNameDialog(function(a){if(a){var c={name:a,content:JSON.stringify(b._model.model().theme())};$.post("/save-theme/",c).error(function(a){document.write(a.responseText)});b._model._lastLoadedTheme=a}},"Save theme as...","Theme name",128)}c.applyColorTheme.subActions||(c.applyColorTheme.subActions=[]);var e=c.applyColorTheme.subActions;e.splice(0,e.length);if(is_authenticated){var f=new Action({text:$.t("Save As...")});
f.callbacks().subscribe(null,d);e.push(f);e.push(new ActionSeparator)}a&&a.length?$.each(a,function(a,c){function d(a){return function(){TVDialogs.showConfirm("Theme","Do you realy want to delete "+(a?'"'+a+'"':"")+" theme?",function(){$.post("/remove-theme/",{name:a}).error(function(a){document.write(a.responseText)})});this._parentMenu._parentMenuItem._parentMenu.destroy();return!1}}var f=new Action({text:c});f.callbacks().subscribe(null,function(){$.getJSON("/theme/?themeName="+encodeURIComponent(c),
function(a){b.model().model().restoreTheme(JSON.parse(a.content))})});is_authenticated&&(f.deleteButton={action:d(f.text)});e.push(f)}):e.push(new Action({text:"No color themes saved",enabled:!1}))}for(var b=this,c=this.actions(),d=this._model.dataSources(),e=!1,f=!1,g=0,h=d.size();g<h;g++){var k=d.item(g);isInherited(k.constructor,LineDataSource)&&(e=!0);isInherited(k.constructor,TradingView.Study)&&k.removeByRemoveAllStudies()&&(f=!0)}this._readOnly||(c.paneRemoveAllStudies&&c.paneRemoveAllStudies.setEnabled(f),
c.paneRemoveAllDrawingTools&&c.paneRemoveAllDrawingTools.setEnabled(e));a(TradingView.getThemesList(a));if(window.studyTemplates){d=studyTemplates.plainList("custom");e=studyTemplates.plainList("default");c.applyStudyTemplate.subActions||(c.applyStudyTemplate.subActions=[]);var m=c.applyStudyTemplate.subActions;m.splice(0,m.length);f=new Action({text:studyTemplates._SAVE_AS_TITLE});f.callbacks().subscribe(studyTemplates,studyTemplates.showSaveAsDiaolg);m.push(f);m.push(new ActionSeparator);d.length||
e.length?(d.length&&($.each(d,function(a,b){var c=new Action({text:b});c.callbacks().subscribe(studyTemplates,function(){this.applyStudyTemplate(b)});c.deleteButton={action:function(a){return function(){studyTemplates.deleteStudyTemplate(a);this._parentMenu._parentMenuItem._parentMenu.destroy();return!1}}(c.text)};m.push(c)}),m.push(new ActionSeparator)),$.each(e,function(a,b){var c=new Action({text:b});c.callbacks().subscribe(studyTemplates,function(){this.applyStudyTemplate(b)});m.push(c)})):m.push(new Action({text:"No study templates saved",
enabled:!1}))}var n=[];TradingView.availableTimezones.forEach(function(a){var b=this,c=function(){return a.id===b.model().model().properties().timezone.value()};if(a.separator)indicatorSubActions.push(new ActionSeparator);else{var d=new Action({text:a.title,checkable:!0,checked:c()});d.callbacks().subscribe(this,function(){var c;c||(c=setTimeout(function(){b.model().setProperty(b.model().model().properties().timezone,a.id,"Changed Time Zone");c=!1},300))});b.model().model().properties().timezone.subscribe(null,
function(){d.setChecked(c())});n.push(d)}},this);c.applyTimeZone.subActions=n;this.updateActionForIntradayOnly(c.sessionBreaks);this.updateActionForIntradayOnly(c.extendedHours)};TradingView.ChartWidget.prototype.actions=function(){this._actions||this._setActions();return this._actions};
TradingView.ChartWidget.prototype._setActions=function(){var a=this;if(!this._readOnly)for(var b=[new Action({text:$.t("Eraser"),callbackContext:"eraser"}),new ActionSeparator,new Action({text:$.t("Trend Line"),callbackContext:"LineToolTrendLine"}),new Action({text:$.t("Horizontal Line"),callbackContext:"LineToolHorzLine"}),new Action({text:$.t("Vertical Line"),callbackContext:"LineToolVertLine"}),new Action({text:$.t("Arrow"),callbackContext:"LineToolArrow"}),new Action({text:$.t("Ray"),callbackContext:"LineToolRay"}),
new Action({text:$.t("Extended"),callbackContext:"LineToolExtended"}),new Action({text:$.t("Parallel Channel"),callbackContext:"LineToolParallelChannel"}),new ActionSeparator,new Action({text:$.t("Pitchfork"),callbackContext:"LineToolPitchfork"}),new Action({text:$.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork"}),new Action({text:$.t("Pitchfan"),callbackContext:"LineToolPitchfan"}),new Action({text:$.t("Gann Square"),callbackContext:"LineToolGannSquare"}),new Action({text:$.t("Gann Fan"),
callbackContext:"LineToolGannFan"}),new Action({text:$.t("Fib Retracement"),callbackContext:"LineToolFibRetracement"}),new Action({text:$.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension"}),new Action({text:$.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan"}),new Action({text:$.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone"}),new Action({text:$.t("Circle Lines"),callbackContext:"LineToolCircleLines"}),new Action({text:$.t("Fib Circles"),
callbackContext:"LineToolFibCircles"}),new Action({text:$.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs"}),new ActionSeparator,new Action({text:$.t("Rectangle"),callbackContext:"LineToolRectangle"}),new Action({text:$.t("Ellipse"),callbackContext:"LineToolEllipse"}),new Action({text:$.t("Triangle"),callbackContext:"LineToolTriangle"}),new Action({text:$.t("Polyline"),callbackContext:"LineToolPolyline"}),new Action({text:$.t("Arc"),callbackContext:"LineToolArc"}),new ActionSeparator,
new Action({text:$.t("Text"),callbackContext:"LineToolText"}),new Action({text:$.t("Anchored Text"),callbackContext:"LineToolTextAbsolute"}),new Action({text:$.t("Balloon"),callbackContext:"LineToolBalloon"}),new Action({text:$.t("Price Label"),callbackContext:"LineToolPriceLabel"}),new ActionSeparator,new Action({text:$.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette"}),new Action({text:$.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor"}),new Action({text:$.t("Elliott Wave Circle"),
callbackContext:"LineToolElliottCircle"}),new Action({text:$.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr"}),new Action({text:$.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr"}),new ActionSeparator,new Action({text:$.t("Brush"),callbackContext:"LineToolBrush"}),new ActionSeparator,new Action({text:$.t("Forecast"),callbackContext:"LineToolPrediction"})],a=this,c=0;c<b.length;c++)b[c].callbacks().subscribe(null,function(a){TradingView.drawingState.tool.setValue(a.callbackContext())});
c=new Action({text:$.t("Reset Chart")});c.callbacks().subscribe(this,this.GUIResetScales);var d=new Action({text:$.t("Undo"),shortcut:"ctrl+z"});d.callbacks().subscribe(null,function(){TradingView.trackEvent("GUI","Undo");TradingView.UndoHistory.undo()});d.disable();var e=new Action({text:$.t("Redo"),shortcut:"ctrl+y"});e.callbacks().subscribe(null,function(){TradingView.trackEvent("GUI","Redo");TradingView.UndoHistory.redo()});e.disable();TradingView.UndoHistory.undoStack().onChange().subscribe(this,
this.updateUndoRedo);TradingView.UndoHistory.redoStack().onChange().subscribe(this,this.updateUndoRedo);var f=new Action({text:$.t("Color Theme")}),g=new Action({text:$.t("TimeZone")}),h=new Action({text:$.t("Change Symbol...")});TVSettings.setValue("symboledit.dialog_last_entry","");h.callbacks().subscribe(this,function(){TradingView.SymbolSearch.showDialog({callback:this.setSymbol.bind(this)})});var k=new Action({text:$.t("Add To Watchlist")});k.callbacks().subscribe(this,function(){for(var a=widgetbar.setPage("Watchlist, details and news"),
b,c=0;c<a.widgets.length;c++)if("watchlist"==a.widgets[c].type){b=a.widgets[c].widgetObject;break}b&&b.addHighlight(this.getSymbol())});var m=new Action({text:$.t("Study Template")}),n=new Action({shortcut:"ctrl+alt+q",text:$.t("Reset Scale")});n.callbacks().subscribe(null,function(b){a.model().resetTimeScale()});var b=new Action({text:$.t("Insert Drawing Tool"),subActions:b}),q=new Action({text:$.t("Remove All Indicators")}),l=new Action({text:$.t("Remove All Drawing Tools")}),s=new Action({text:$.t("Insert Indicator...")}),
u=new Action({text:$.t("Script Editor...")}),z=new Action({text:$.t("Compare or Add Symbol...")}),t=new Action({text:$.t("Compare...")}),B=new Action({text:$.t("Objects Tree...")}),A=new Action({text:$.t("Properties..."),callback:function(b,c){a.showChartProperties()}}),w=new Action({text:$.t("Scales Properties...")}),v=new Action({text:$.t("Lock/Unlock")});v.callbacks().subscribe(this,TradingView.ChartWidget.prototype.toggleLockSelectedObject);var C=new Action({text:$.t("Hide")});C.callbacks().subscribe(this,
TradingView.ChartWidget.prototype.hideSelectedObject);var H=new Action({text:$.t("Format...")});H.callbacks().subscribe(this,TradingView.ChartWidget.prototype.editSelectedObject);var D=new Action({text:$.t("Source Code...")});D.callbacks().subscribe(this,this.openSelectedObjectSource);var F=new Action({text:$.t("Show Left Axis"),checkable:!0});F.binder=new ActionBinder(F,this._properties.scalesProperties.showLeftScale,this.model(),"Show Left Scale");var I=new Action({text:$.t("Show Right Axis"),checkable:!0});
I.binder=new ActionBinder(I,this._properties.scalesProperties.showRightScale,this.model(),"Show Right Scale");this._properties.scalesProperties.showLeftScale.listeners().subscribe(this,TradingView.ChartWidget.prototype._updateScalesActions);this._properties.scalesProperties.showRightScale.listeners().subscribe(this,TradingView.ChartWidget.prototype._updateScalesActions);var E=new Action({text:$.t("Scale Series only"),checkable:!0});E.binder=new ActionBinder(E,this._properties.scalesProperties.scaleSeriesOnly,
this.model(),"Scale Series Only");var P=this.model().model();this._properties.scalesProperties.scaleSeriesOnly.listeners().subscribe(null,function(){P.recalculateAllPanes();P.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))});var O=new Action({text:$.t("Magnet Mode"),checkable:!0});O.binder=new ActionBinder(O,TradingView.drawingState.properties().magnet,this.model(),"Magnet");var r=new Action({text:$.t("Stay In Drawing Mode"),checkable:!0});r.binder=new ActionBinder(r,
TradingView.drawingState.properties().stayInDrawingMode,this.model(),"Stay In Drawing Mode");var S=new Action({text:$.t("Lock All Drawing Tools"),checkable:!0});S.binder=new ActionBinder(S,TradingView.drawingState.lockDrawings(),this.model(),"Lock drawings",function(){TradingView.drawingState.lockDrawings().setValue(this.binder.value())}.bind(S));var J=new Action({text:$.t("Hide All Drawing Tools"),checkable:!0});J.binder=new ActionBinder(J,TradingView.drawingState.hideAllDrawings(),this.model(),
"Hide All Drawing Tools",function(){TradingView.drawingState.hideAllDrawings().setValue(this.binder.value())}.bind(J));var K=new Action({text:$.t("Extended Hours"),checkable:!0});K.binder=new ActionBinder(K,this.model().mainSeries().properties().extendedHours,this.model(),"Change Extended Hours");this._actions={chartProperties:A,timeScaleReset:n,chartReset:c,compareOrAdd:z,compare:t,scalesProperties:w,paneObjectTree:B,insertIndicator:s,insertDrawingTool:b,applyColorTheme:f,applyStudyTemplate:m,symbolSearch:h,
addToWatchlist:k,seriesHide:C,studyHide:C,lineToggleLock:v,lineHide:C,showLeftAxis:F,showRightAxis:I,scaleSeriesOnly:E,magnetAction:O,stayInDrawingModeAction:r,lockDrawingsAction:S,hideAllDrawingsAction:J,applyTimeZone:g,extendedHours:K,undo:d,redo:e,viewSourceCode:D};TradingView.isRunningChartingLibrary||(this._actions.scriptEditor=u);this.createSessionBreaksActions();this.readOnly()?(this._actions.paneResetAction=new Action({text:$.t("Reset")}),this._actions.paneLoadNewBarsAction=new Action({text:$.t("Load New Bars")}),
this._actions.paneMakeItMineAction=new Action({text:this._containsData?$.t("Make It Mine"):$.t("Copy")}),this._actions.paneFullScreenAction=new Action({text:$.t("Full Screen")}),this._actions.paneResetAction.callbacks().subscribe(this,function(){resetScales()}),this._actions.paneLoadNewBarsAction.callbacks().subscribe(this,function(){requestData()}),this._actions.paneMakeItMineAction.callbacks().subscribe(this,function(a){return a._containsData?function(){submitChartGoToRealTimeForm()}:function(){open("/e/?clone="+
a.metaInfo().uid,"_blank")}}(this)),this._actions.paneFullScreenAction.callbacks().subscribe(this,function(a){if(a._containsData)return function(){toggleFullscreen()};var b=new TradingView.FullscreenWidget;return function(){b.startFullscreen()}}(this))):(c=new Action({text:$.t("Remove"),shortcut:"del"}),c.callbacks().subscribe(this,function(){var a;this._chartWidgetCollection&&(a=this._chartWidgetCollection.activeChartWidget.value());a||(a=this);a.removeSelectedSource()}),this._actions.insertDrawingTool=
b,this._actions.paneRemoveAllStudies=q,this._actions.paneRemoveAllDrawingTools=l,this._actions.seriesRemove=c,this._actions.studyRemove=c,this._actions.lineRemove=c,this._actions.format=H,this._actions.lockDrawingsAction=S,this._actions.hideAllDrawingsAction=J,this._actions.paneRemoveAllStudies.callbacks().subscribe(this,TradingView.ChartWidget.prototype.removeAllStudies),this._actions.paneRemoveAllDrawingTools.callbacks().subscribe(this,TradingView.ChartWidget.prototype.removeAllDrawingTools));this._actions.paneObjectTree.callbacks().subscribe(this,
TradingView.ChartWidget.prototype.showSourceProperties);this._actions.chartProperties.callbacks().subscribe(this,TradingView.ChartWidget.prototype.showChartProperties);this._actions.insertIndicator.callbacks().subscribe(this,TradingView.ChartWidget.prototype.showIndicators);this._actions.scriptEditor&&this._actions.scriptEditor.callbacks().subscribe(this,TradingView.ChartWidget.prototype.showScriptEditor);this._actions.compareOrAdd.callbacks().subscribe(this,TradingView.ChartWidget.prototype.showCompareOrAdd);
this._actions.compare.callbacks().subscribe(this,TradingView.ChartWidget.prototype.showCompareOrAdd);this._actions.scalesProperties.callbacks().subscribe(this,TradingView.ChartWidget.prototype.showScalesProperties);this._updateScalesActions()};
TradingView.ChartWidget.prototype._updateScalesActions=function(){if(this._actions){this._actions.showRightAxis.setEnabled(this._properties.scalesProperties.showLeftScale.value());this._actions.showLeftAxis.setEnabled(this._properties.scalesProperties.showRightScale.value());for(var a=0;a<this._paneWidgets.length;a++)this._paneWidgets[a].updateScalesVisibility();this._timeAxisWidget.updatePriceScalesVisibility();this._update(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE))}};
TradingView.ChartWidget.prototype.removeAllStudies=function(){this._model.removeAllStudies()};TradingView.ChartWidget.prototype.removeAllDrawingTools=function(){this._model.removeAllDrawingTools()};TradingView.ChartWidget.prototype.model=function(){return this._model};TradingView.ChartWidget.prototype.connect=function(){this._handler=function(a){this._onData(a)}.bind(this);this._chartSession.connect(this._handler)};
TradingView.ChartWidget.prototype.finishInitWithoutConnect=function(){this._chartSession.disable();this._init();this.chartWidgetInitialized.fire()};TradingView.ChartWidget.prototype.update=function(){if(this._model){for(var a=0;a<this._paneWidgets.length;a++)this._paneWidgets[a].update();this._timeAxisWidget.update()}};
TradingView.ChartWidget.prototype.paint=function(a){a||(a=new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));for(var b=0;b<this._paneWidgets.length;b++)this._paneWidgets[b].paint(a.invalidateForPane(b),!1);this._timeAxisWidget&&this._timeAxisWidget.paint(a.fullInvalidation());this._redrawPanes.fire()};
TradingView.ChartWidget.prototype._makeDefaultGui=function(){this._makeChartWidget();this._makeLoadingScreen();this._makeMasterTable();this._addPaneWidget(new TradingView.PaneWidget(this,null,this._onWidget));this._makeTimeAxisWidget();this._adjustSize();this._updateScalesActions();$("*",this._jqMainTable).selectable(!1);this.update();this.paint()};TradingView.ChartWidget.prototype.widget=function(){return this._jqMainDiv};
TradingView.ChartWidget.prototype.restoreState=function(a,b){this._adjustSize();this._model.restoreState(this._content,b);this._setActions()};TradingView.ChartWidget.prototype.redrawPanes=function(a){$.each(this._paneWidgets,function(a){this.paint()});this._redrawPanes.fire()};TradingView.ChartWidget.prototype.setBackgroundColor=function(a){this.scaleBackgroundColor=a.value();$.each(this._paneWidgets,function(a){this.paint();this.setCursorForTool()});this.update();this.paint()};
TradingView.ChartWidget.prototype.setScaleLineColor=function(a){this.scaleLineColor=a.value();$.each(this._paneSeparators,function(){this.update()});this.update();this.paint()};TradingView.ChartWidget.prototype.setScaleTextColor=function(a){this.scaleTextColor=a.value();this.update();this.paint()};
TradingView.ChartWidget.prototype._update=function(a){if(!a||a.fullInvalidation()===TradingView.InvalidateMask.FULL_UPDATE){if(this._model){var b=!1;if(this._paneWidgets.length!==this._model.panes().size())b=!0;else for(var c=this._model.panes(),d=this._paneWidgets.length;d--;)if(this._paneWidgets[d].state()!==c.item(d)){b=!0;break}b&&this._updateGui()}this._adjustSize();this._timeAxisWidget.update();for(d=0;d<this._paneWidgets.length;d++)this._paneWidgets[d]._state=this._model.panes().item(d),this._paneWidgets[d].statusWidget().updateLayout();
this._dataWindowWidget&&this._dataWindowWidget.updateAll()}else if(a.fullInvalidation()===TradingView.InvalidateMask.LIGHT_UPDATE){this._timeAxisWidget.update();this.paint(new TradingView.InvalidateMask(TradingView.InvalidateMask.UPDATE_CURSOR_ONLY));for(d=0;d<this._paneWidgets.length;d++)this._paneWidgets[d].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}else if(a.fullInvalidation()===TradingView.InvalidateMask.UPDATE_CURSOR_ONLY){for(d=0;d<this._paneWidgets.length;d++)this._paneWidgets[d].statusWidget().update();
this._dataWindowWidget&&this._dataWindowWidget.update()}this.paint(a)};
TradingView.ChartWidget.prototype._makeDefaultModel=function(){function a(){b._draw_planned=!1;!b._inLoadingState&&b._invalidateMask&&(b._invalidateMask=b._update(b._invalidateMask))}var b=this;if(this._content&&this._content.timeScale.points)var c={startDate:this._content.timeScale.points.items[0]};if(!this._studiesMetaData)throw Error("Cannot create chart model: studies metainfo is absent");this._model=makeDefaultChartModel(this._chartSession,function(c){if(!(c instanceof TradingView.InvalidateMask))throw new "Invalid mask";
b._invalidateMask?b._invalidateMask.merge(c):b._invalidateMask=c;b._draw_planned||(b._draw_planned=!0,requestAnimationFrame(a))},this._properties,this.readOnly(),c,this._studiesMetaData,this._studiesMigrations,this);this._options.addVolume&&!this._content&&this._model.mainSeries().onSymbolResolved().subscribe(this,function(){var a=this._model.model().mainSeries().symbolInfo(),a=!a.hasOwnProperty("has_no_volume")||!a.has_no_volume;!this.containsVolume()&&a?this.insertStudy("Volume@tv-basicstudies",
!1):!a&&this.containsVolume()&&(a=this.model().dataSources().find(function(a){return a instanceof TradingView.Study&&"Volume"==a.metaInfo().shortId}),this._model.model().removeSource(a))},!TradingView.isRunningChartingLibrary);this._content?this.restoreState(this._content,this._containsData):this._setActions();this._model.onTagsChanged().subscribe(this,TradingView.ChartWidget.prototype.onModelTagsChanged);this._updateGui();this._modelCreated.fire(this._model);this._tagsChanged.fire();b=this;setTimeout(function(){for(var a=
0;a<b._paneWidgets.length;a++)b._paneWidgets[a].adjustLegendPosition()},500);var d=this._model.mainSeries();this._model.lineCancelled().subscribe(this,this.onLineCancelled);d.onSymbolNotPermitted().subscribe(null,function(a){d.properties().symbol.setValue(a)});this._options.handleSessionErrors&&(d.chartTypeNotPermitted.subscribe(null,function(){d.properties().interval.setValue("D");b._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"kagiRenko"})}),d.intradaySpreadNotPermitted.subscribe(null,
function(){d.properties().interval.setValue("D");b._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"intradaySpread"})}),d.customIntervalNotPermitted.subscribe(null,function(){d.properties().interval.setValue("D");b._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"customIntervals"})}),d.intradayExchangeNotPermitted.subscribe(null,function(){d.properties().interval.setValue("D");b._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"intradayExchange",exchangesButton:window.user.is_pro&&
"pro_realtime_trial"!=window.user.pro_plan,exchange:d.symbolInfo().listed_exchange})}),d.requestingIntradayWhenNotSupported.subscribe(null,function(){d.properties().interval.setValue("D");b._options.muteSessionErrors||TVDialogs.showIntervalMismatchDialog()}),d.requestingResolutionWhenNotSupported.subscribe(null,function(a){d.properties().interval.setValue(a)}),b._options.muteSessionErrors||d.onExtendedHoursChanged().subscribe(null,function(){d.onExtendedHoursNotPermitted().subscribe(null,function(a){TVDialogs.showGoProDialog({feature:"extendedHours"})})},
!0))};TradingView.ChartWidget.prototype._updateGui=function(){this._model&&(this._makePaneWidgetsAndSeparators(),this._makeTimeAxisWidget(),$("*",this._jqMainTable).selectable(!1),this._adjustSize())};TradingView.ChartWidget.prototype._dateRangeResolutions=function(){return ChartApiInstance.availableTimeFrames(this._model.mainSeries().symbolInfo(),this._model.mainSeries().status())||[]};
TradingView.ChartWidget.prototype._makeChartWidget=function(){this._jqMainDiv=$(document.createElement("div"));this._jqMainDiv.appendTo(this._jqParent);this._jqMainDiv.addClass("chart-widget");TradingView.setAbsoluteRect(this._jqMainDiv,this._rect);this._withDateRanges&&(this._chartControlsBar=$(document.createElement("div")).attr("class","chart-controls-bar").appendTo(this._jqParent),this._seriesControlWidget=new TradingView.SeriesControlWidget({parent:this._chartControlsBar,chartWidget:this}));
this._options.controlBar&&(this._controlBarNavigation=new TradingView.ControlBarNavigation(this,this._jqMainDiv,!0));this._containsData||this.createIndicatorImage()};TradingView.ChartWidget.prototype._makeLoadingScreen=function(){this.screen=new TradingView.ChartWidget.LoadingScreen(this)};
TradingView.ChartWidget.prototype.setSymbol=function(a){if(this._model){var b=this._model.mainSeries();b.symbolSameAsCurrent(a)||(this._model.setSelectedSource(null),b=b.properties().symbol,this._model.setScreenChartProperty(b,a,this,"Change Symbol"))}else this._properties.mainSeriesProperties.merge({symbol:a})};TradingView.ChartWidget.prototype.getSymbol=function(){return this._model?this._model.mainSeries().properties().symbol.value():this._properties.mainSeriesProperties.symbol.value()};
TradingView.ChartWidget.LoadingScreen=function(a){this._cw=a;this.$element=$('<div class="chart-loading-screen">');this.$shield=$('<div class="chart-loading-screen-shield">').appendTo(this.$element);this.$element.appendTo(this._cw._jqMainDiv);this._showed=!1;this._cw.withModel(this,this._connectToModel)};
TradingView.ChartWidget.LoadingScreen.prototype._connectToModel=function(){this._cw.model().mainSeries().onDataLoaded().subscribe(this,function(a){switch(a.method){case "symbol_error":"permission denied"!==a.params[1]&&this.hide();break;case "series_completed":this.hide()}})};TradingView.ChartWidget.LoadingScreen.prototype.show=function(){this._cw._inLoadingState=!0;this._showed||this._cw.isDetached||(this._showed=!0,this._show());return $.Deferred().resolve()};
TradingView.ChartWidget.LoadingScreen.prototype._show=function(){var a=this._cw.properties().paneProperties.background.value();this.$shield.css("background",a);this.$element.addClass("fade")};TradingView.ChartWidget.LoadingScreen.prototype.hide=function(){delete this._cw._inLoadingState;this._showed&&this._hide()};TradingView.ChartWidget.LoadingScreen.prototype._hide=function(){this._showed=!1;this.$element.removeClass("fade")};TradingView.ChartWidget.LoadingScreen.prototype.$canvas=null;
TradingView.ChartWidget.LoadingScreen.prototype.context=null;TradingView.ChartWidget.prototype._makeMasterTable=function(){this._jqMainTable=$(document.createElement("table"));this._jqMainTable.appendTo(this._jqMainDiv);this._jqMainTable.addClass("chart-markup-table");this._jqMainTable.attr("cellpading","0");this._jqMainTable.attr("cellspacing","0")};TradingView.ChartWidget.prototype._addPaneWidget=function(a){a.jqRow.appendTo(this._jqMainTable);this._paneWidgets.push(a)};
TradingView.ChartWidget.prototype._makePaneWidgetsAndSeparators=function(){for(;this._paneWidgets.length;)this._paneWidgets.pop().destroy();this._jqMainTable.find("*").remove();this._jqMainDiv.find("table.pane-legend, div.pane-controls, input.symbol-edit").find("*").andSelf().remove();for(var a=this._model.panes().size(),b=0;b<a;++b)this._addPaneWidget(new TradingView.PaneWidget(this,this.model().panes().item(b),this._onWidget));a-=1;this._paneSeparators=[];for(b=0;b<a;++b){var c=new TradingView.PaneSeparator(this,
b,b+1);c.jqRow.insertAfter(this._paneWidgets[b].jqRow);this._paneSeparators.push(c)}};TradingView.ChartWidget.prototype._makeTimeAxisWidget=function(){this._timeAxisWidget=new TradingView.TimeAxisWidget(this,this._onWidget);this._timeAxisWidget.jqRow.appendTo(this._jqMainTable)};
TradingView.ChartWidget.prototype.insertStudyOrShowDialog=function(a){if(this.isSymbolicStudy(a)){var b=defaults("study_"+a.id).description;TVDialogs.showAddSymbolDialog(this,{title:b,okButtonTitle:$.t("Apply"),callback:function(b,d){var e={inputs:{symbol:b}};TradingView.trackEvent("GUI","Add Study");this.model().insertStudy(a,e,d)}.bind(this)})}else TradingView.Study.isPointsBasedStudy(a.id)?(b=TradingView.Study.lineToolNameForPointsBasedStudy(a.id),TradingView.drawingState.tool.setValue(b)):(TradingView.trackEvent("GUI",
"Add Study"),this.insertStudy(a.id,!0))};TradingView.ChartWidget.prototype.isSymbolicStudy=function(a){switch(a.id){case "Overlay@tv-basicstudies":case "CorrelationCoefficient@tv-basicstudies":return!0;default:return!1}};TradingView.ChartWidget.prototype.isPointsBasedStudy=function(a){return TradingView.Study.isPointsBasedStudy(a.id)};
TradingView.ChartWidget.prototype.insertStudy=function(a,b,c){a=StudyMetaInfo.findStudyMetaInfo(this._studiesMetaData,a);a=StudyMetaInfo.replaceWithFullStudyMetaInfo(this._studiesMetaData,a);b?this._model.insertStudy(a,void 0,c):this._model.model().insertStudy(a,void 0,c)};
TradingView.ChartWidget.prototype._adjustSize=function(){var a=0,b=0,c=0;$.each(this._paneWidgets,function(){a=Math.max(this.lhsPriceAxisWidget.optimalWidth(),a);b=Math.max(this.rhsPriceAxisWidget.optimalWidth(),b);c+=this.stretchFactor()});var d=new TradingView.Size(this._jqMainDiv.width(),this._jqMainDiv.height()),e=d.w-a-b,f=this._paneSeparators.length,g=TradingView.PaneSeparator.HEIGHT,h=this._timeAxisWidget.optimalHeight(),k=(d.h-g*f-h)/c;this._jqMainTable.width(d.w);this._jqMainTable.height(d.h);
var m=this;$.each(this._paneWidgets,function(c){m._model&&(this._state=m._model.panes().item(c));c=Math.max(Math.round(this.stretchFactor()*k),2);this.setPriceAxisSize(TradingView.PriceAxisWidget.LHS,new TradingView.Size(a,c));this.setPriceAxisSize(TradingView.PriceAxisWidget.RHS,new TradingView.Size(b,c));this.setSize(new TradingView.Size(e,c));m._model&&this.state()&&m._model.setPaneHeight(this.state(),c)});this._timeAxisWidget.setSize(new TradingView.Size(e,h),new TradingView.Size(a,h),new TradingView.Size(b,
h));this._model&&this._model.setWidth(e);this.maxLhsPriceAxisWidth!==a&&(this.maxLhsPriceAxisWidth=a,this.lhsPriceAxisWidthChanged.fire(a));this.maxRhsPriceAxisWidth!==b&&(this.maxRhsPriceAxisWidth=b,this.rhsPriceAxisWidthChanged.fire(b))};
TradingView.ChartWidget.prototype._onData=function(a){switch(a.method){case "connected":this._onConnection();break;case "disconnected":this._onDisconnect();break;case "reconnect_bailout":this._reconnectBailout.fire();break;case "connection_error":this._onConnectionError(a.params[0]);break;case "critical_error":this._disconnected.fire(!0);break;default:this._model.onData(a)}};TradingView.ChartWidget.prototype._nextMetadataId=1;
TradingView.ChartWidget.prototype._onConnection=function(){this._online=!0;this._model?(this._model.restart(),this._updateGui(),this.update(),this.paint(),this._connected.fire()):(TradingView.isRunningChartingLibrary?this._chartSession.requestMetadata("metadata_"+TradingView.ChartWidget._nextMetadataId,function(a){a=a.params[1];for(var b=0;b<a.length;++b)StudyMetaInfo.addStudyMetaInfo(this._studiesMetaData,a[b]);this._init();this.chartWidgetInitialized.fire()}.bind(this)):this._chartSession.requestMetadata("metadata_"+
TradingView.ChartWidget._nextMetadataId,function(a){this._onStudiesMetadata(a)}.bind(this)),TradingView.ChartWidget._nextMetadataId++)};TradingView.ChartWidget.prototype._onDisconnect=function(){this._model&&this._model.disconnect();this._online=!1;this.update();this.paint();this._disconnected.fire()};TradingView.ChartWidget.prototype.studiesMetaData=function(){return this._model.studiesMetaData()};TradingView.ChartWidget.prototype._onConnectionError=function(a){this._disconnected.fire()};
TradingView.ChartWidget.prototype.getTimeScale=function(){return this._timeAxisWidget};TradingView.ChartWidget.prototype.setSeriesStyle=function(a,b){this._model.setProperty(a.properties().style,b)};TradingView.ChartWidget.prototype.showSourceProperties=function(a){(new ObjectTreeDialog({chartWidget:this},this._model)).show()};TradingView.ChartWidget.prototype.showChartProperties=function(a){return(new EditObjectDialog(this._model.mainSeries(),this._model)).show()};
TradingView.ChartWidget.prototype.showScriptEditor=function(){window.scriptEditor.show()};TradingView.ChartWidget.prototype.showCompareOrAdd=function(){(new CompareDialog(this._chartWidgetCollection)).show()};TradingView.ChartWidget.prototype.showIndicators=function(){studyMarket.isVisible()?studyMarket.hide():studyMarket.show()};TradingView.ChartWidget.prototype.showScalesProperties=function(a){return(new EditObjectDialog(this._model.mainSeries(),this._model)).show({selectScales:!0})};
TradingView.ChartWidget.prototype.removeSelectedSource=function(){var a=this._model.selectedSource();!a||a===this._model.mainSeries()||a===this._model.lineBeingCreated()||a instanceof BarsMarksContainer||a instanceof TradingView.ESDStudyBase||this._model.removeSelectedSource()};TradingView.ChartWidget.prototype.hideSelectedObject=function(){var a=this._model.selectedSource();a&&this._model.setProperty(a.properties().visible,!1,"Hide "+a.title())};
TradingView.ChartWidget.prototype.toggleLockSelectedObject=function(){var a=this._model.selectedSource();if(a){var b=a.properties().frozen.value();this._model.setProperty(a.properties().frozen,!b,(b?"Unlock":"Lock")+" "+a.title())}};TradingView.ChartWidget.prototype.editSelectedObject=function(a){if(a=this._model.selectedSource())return(new EditObjectDialog(a,this._model)).show()};
TradingView.ChartWidget.prototype.openSelectedObjectSource=function(a){(a=this._model.selectedSource())&&a.metaInfo&&(a=a.metaInfo())&&a.TVScriptSourceCode&&a.scriptIdPart&&"undefined"!==typeof scriptEditor&&scriptEditor.show({scriptSource:a.TVScriptSourceCode,scriptIdPart:a.scriptIdPart})};TradingView.ChartWidget.prototype.resetPriceAxisOptimalWidth=function(a){$.each(this._paneWidgets,function(){this.resetPriceAxisOptimalWidth(a)});this._redrawPanes.fire()};
TradingView.ChartWidget.prototype.adjustPriceAxisWidth=function(a){this.resetPriceAxisOptimalWidth(a);this._adjustSize()};TradingView.ChartWidget.prototype.setPriceAxisVisible=function(a,b){$.each(this._paneWidgets,function(){this.setPriceAxisVisible(a,b)});this._timeAxisWidget.setStubVisible(a,b);this._adjustSize();this._redrawPanes.fire()};TradingView.ChartWidget.prototype.setTimeAxisVisible=function(a){this._timeAxisWidget.setVisible(a);this._adjustSize()};
TradingView.ChartWidget.prototype.isTextTool=function(a){switch(a){case "LineToolBalloon":case "LineToolText":case "LineToolTextAbsolute":case "LineToolCallout":return!0}return!1};TradingView.ChartWidget.prototype.tags=function(){return this._model?this._model.calculateDefaultTags():[]};TradingView.ChartWidget.prototype.state=function(a){return this._model.state(a)};
TradingView.ChartWidget.prototype.metaInfo=function(){var a=this._metaInfo;this._model&&(a.systemTags=this._model.calculateDefaultTags());return a};
TradingView.ChartWidget.prototype.images=function(){TradingView.printing=!0;var a=this._model.selectedSource();this._model.setSelectedSource(null);for(var b=[],c=0;c<this._paneWidgets.length;c++){var d=this._paneWidgets[c],e=d.image(this._onWidget);e.containsMainSeries=this._paneWidgets[c].containsMainSeries();e.studies=[];for(var d=d.state().dataSources(),f=0;f<d.size();f++){var g=d.item(f);g instanceof TradingView.Study?g.properties().visible.value()&&g.statusView()&&e.studies.push(g.statusView().text()):
g instanceof TradingView.Series&&(e.mainSeriesText=g.statusView().text())}b.push(e);c<this._paneWidgets.length-1&&b.push(this._paneSeparators[c].image())}c=this._timeAxisWidget.image();TradingView.printing=!1;this._model.setSelectedSource(a);var h,k,m,n=this._model.mainSeries();if(n){a=function(a){return null==a?"":n.formatter().format(a)+""};h={resoluton:n.interval(),symbol:n.symbol()};if(e=n.symbolInfo())h.symbol=e.full_name,h.description=e.description,h.exchange=e.exchange;(e=n.bars().last())&&
(k=e.value.slice(1,5).map(a));n.quoteData&&(m={change:a(n.quoteData.change),changePercent:null==n.quoteData.change_percent?"":n.quoteData.change_percent+"",last:a(n.quoteData.last_price)})}return{panes:b,timeAxis:c,colors:{text:this.properties().scalesProperties.textColor.value(),bg:this.properties().paneProperties.background.value(),scales:this.properties().scalesProperties.lineColor.value()},meta:h,ohlc:k,quotes:m}};TradingView.ChartWidget.prototype.onTagsChanged=function(){return this._tagsChanged};
TradingView.ChartWidget.prototype.onModelTagsChanged=function(){this._tagsChanged.fire()};TradingView.ChartWidget.prototype.destroy=function(){$(window).unbind("resize",this._resizeHandler)};TradingView.ChartWidget.prototype.title=function(){return $.t("Chart Properties")};TradingView.ChartWidget.prototype.symbolProperty=function(){return this._model.mainSeries().properties().shortName?this._model.mainSeries().properties().shortName:this._model.mainSeries().properties().symbol};
TradingView.ChartWidget.prototype.setContent=function(a){a&&a.panes.forEach(function(a){a.sources=a.sources.filter(function(a){return"MainSeries"==a.type?!0:a.points&&a.points.some(function(a){return null===a.time_t||!isFinite(a.time_t)})?(TradingView.logNormal("Dropped invalid "+a.type+". Reason: non-numeric point time"),!1):!0});var c=function(c){return a.sources&&a.sources.some(function(a){return a.id==c})};a.leftAxisSources&&(a.leftAxisSources=a.leftAxisSources.filter(c));a.rightAxisSources&&
(a.rightAxisSources=a.rightAxisSources.filter(c))});this._content=a};TradingView.ChartWidget.prototype.updateUndoRedo=function(){TradingView.UndoHistory.undoStack().isEmpty()?this.actions().undo.setEnabled(!1):this.actions().undo.setEnabled(!0);TradingView.UndoHistory.redoStack().isEmpty()?this.actions().redo.setEnabled(!1):this.actions().redo.setEnabled(!0)};
TradingView.ChartWidget.prototype.createSessionBreaksActions=function(a){var b,c=this,d=function(){b=new Action({text:$.t("Session Breaks"),checkable:!0});b.binder=new ActionBinder(b,c.model().mainSeries().sessionsStudy().properties().graphics.vertlines.sessBreaks.visible,c.model(),"Session Breaks");c._actions.sessionBreaks=b};c.model().mainSeries().sessionsStudy()?d():c.model().mainSeries().onSessionsStudyCreated().subscribe(c,function(){d()})};
TradingView.ChartWidget.prototype.updateActionForIntradayOnly=function(a){!a||!a instanceof Action||a.setEnabled(!!this.model().mainSeries().isIntradayInterval())};TradingView.ChartWidget.prototype.withModel=function(a,b){this.model()?b.call(a):this.modelCreated().subscribe(a,b,!0)};TradingView.ChartWidget.prototype.containsVolume=function(){return!!this.model().dataSources().find(function(a){return a instanceof TradingView.Study&&"Volume"==a.metaInfo().shortId})};
TradingView.ChartWidget.prototype.containsStudy=function(a){return this._model?!!this._model.dataSources().find(function(b){if(!(b instanceof TradingView.Study))return!1;b=b.metaInfo();return b.id===a||b.fullId===a}):!1};TradingView.ChartWidget.prototype.containsSessions=function(){return!!this.model().dataSources().find(function(a){return a instanceof TradingView.Study&&"Sessions"==a.metaInfo().shortId})};TradingView.ChartWidget.prototype.isSmall=function(a){return this.constructor.isSmall(this._jqParent)};
TradingView.ChartWidget.isSmall=function(a){return 550>a.width()||300>a.height()};TradingView.ChartWidget.prototype.onWidget=function(){return this._onWidget};TradingView.ChartWidget.prototype.onCmeWidget=function(){return this._onCmeWidget};TradingView.ChartWidget.prototype.resize=function(){this._resizeHandler&&this._resizeHandler()};TradingView.ChartWidget.prototype.chartSession=function(){return this._chartSession};TradingView.ChartWidget.prototype.maxLhsPriceAxisWidth=0;
TradingView.ChartWidget.prototype.maxRhsPriceAxisWidth=0;TradingView.ChartWidget.prototype.GUIResetScales=function(){TradingView.trackEvent("GUI","Reset Scales");this.model()&&(this._containsData?this.model().chartModel().restoreAxisState(this._content):this._controlBarNavigation.resetButtons(),this.model().resetScales())};TradingView.ChartWidget.prototype.onLineCancelled=function(){TradingView.drawingState.resetToCursor()};
TradingView.ChartWidget.prototype.createIndicatorImage=function(){var a=this;this.indicatorImage=$('<span class="chart-status-picture"></span>').appendTo(this._jqMainDiv);$('<span class="bats-warning"></span>').appendTo(this.indicatorImage).on("click",function(){a.onWidget()||TradingView.isProRealtime()||(location.href="/gopro/")}).blueTooltip("<p><b>Warning:</b> This symbol is provided by BATS electronic exchange.</p><p>BATS real-time data is different from the &ldquo;official&rdquo; data and offers approximate volumes with fewer price updates.</p><p>If those differences are important to your analysis then you'll want to use our PRO service which allows you to access realtime data from exchanges.</p>",
"bottom","double-width").css("cursor",a.onWidget()?"default":"");this.indicatorText=$('<span class="series-status-text"><span class="dot"></span>&nbsp;<span class="text"></span>&nbsp;<span class="market-status"></span></span>').appendTo(this.indicatorImage);a.withModel(null,function(){var b=a._model.mainSeries();b.onStatusChanged().subscribe(null,a.updateIndicatorImage.bind(a));b.marketStatus.subscribe(a.updateIndicatorImage.bind(a));a.updateIndicatorImage()});a.rhsPriceAxisWidthChanged.subscribe(a,
a.updateIndicatorImagePosition);a.updateIndicatorImagePosition()};
TradingView.ChartWidget.prototype.updateIndicatorImage=function(){var a=this.indicatorImage;if(this.indicatorImage){var b=this._model;if(b){var b=b.mainSeries(),c=b.status(),d=this._statusDetails(),e=null,e=d.hasOwnProperty(c)?d[c]:d.defaults,c=e.hasOwnProperty("showBatsWarn")?e.showBatsWarn:!0,d=(d=b.symbolInfo())&&d.full_name,c=!!(c&&d&&TradingView.SymbolParser.hasBatsSymbols(d));a.find(".bats-warning").toggleClass("warn-bats",c);a.attr("title",e.hasOwnProperty("title")?e.title:"");this._updateDataAndMarketStatus(b.marketStatus.value(),
b.status())}}};
TradingView.ChartWidget.prototype._statusDetails=function(){this.__statusDetails||(this.__statusDetails={},this.__statusDetails[TradingView.Series.STATUS_SNAPSHOT]={className:"snapshot",text:$.t(""),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_LOADING]=this.__statusDetails[TradingView.Series.STATUS_RESOLVING]={className:"loading",text:$.t("loading data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_INVALID_SYMBOL]={className:"invalid",text:$.t("invalid symbol"),showBatsWarn:!1,
priority:1},this.__statusDetails[TradingView.Series.STATUS_OFFLINE]={className:"connecting",text:$.t("retrying"),priority:1},this.__statusDetails[TradingView.Series.STATUS_EOD]=this.__statusDetails[TradingView.Series.STATUS_PULSE]={className:"eod",text:$.t("eod data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED]={className:"delayed",title:$.t("Quotes are delayed by 10 min and updated every 30 seconds"),text:$.t("eod delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED_STREAMING]=
{className:"delayed-streaming",text:$.t("delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_READY]=this.__statusDetails.defaults={className:"realtime",text:$.t("realtime"),priority:-1},this.__statusDetails.pre_market={text:$.t("pre-market"),className:"pre-market",priority:0},this.__statusDetails.post_market={text:$.t("post-market"),className:"post-market",priority:0},this.__statusDetails.out_of_session={text:$.t("closed"),className:"out-of-session",priority:0},this.__statusDetails.market=
this.__statusDetails.defaults);return this.__statusDetails};TradingView.ChartWidget.prototype._updateDataAndMarketStatus=function(a,b){var c=this._resultingStatusRecord(a,b);this.indicatorText.removeClass().addClass("series-status-text "+c.className);this.indicatorText.find(".text").html(c.text)};
TradingView.ChartWidget.prototype._resultingStatusRecord=function(a,b){if(a){var c=this._statusDetails()[a],d=this._statusDetails()[b];d||(d=this._statusDetails().defaults);return d.priority>c.priority?d:c}return this._statusDetails()[b]};TradingView.ChartWidget.prototype.updateIndicatorImagePosition=function(){var a=this.indicatorImage;this.indicatorImage&&a.css("marginRight",this.maxRhsPriceAxisWidth)};TradingView.ChartWidgetCollection=function(a){function b(){R&&R(K);var a=w||{};w={width:K.width(),height:K.height()};var b=!1;a.height===w.height&&a.width===w.width&&v||(b=!0);if(b)if(O)c(A);else for(a=0;a<v.count;a++)c(a)}function c(a){var b=B[a];if(b){var c=O?TradingView.ChartWidgetCollection.LayoutTemplates.s.sizer(0,w,s,u):v.sizer(a,w,s,u);B[a].wrap.css({width:c.width||0,height:c.height||0,top:c.top||0,left:c.left||0});b.metrics&&b.metrics.width===c.width&&b.metrics.height===c.height||(b.metrics=
c,b.chartWidget&&b.chartWidget.resize())}}function d(a){a=$.extend({chartWidgetCollection:l},a||{});var b,d=$(document.createElement("div")).addClass("chart-container").appendTo(K).css("position","absolute");d.on("mousedown touchstart",function(){z.setValue(b)});var e=B.length,h={wrap:d};B.push(h);c(e);a.jqParent=d;h.chartWidget=b=new TradingView.ChartWidget(a);l.firstWidgetInitialized||b.chartWidgetInitialized.subscribe(null,function(){try{JsBridge.sendEvent("chart_widget_initialized")}catch(a){}l.firstWidgetInitialized=
!0},!0);a.containsData?b.finishInitWithoutConnect():b.connect();f();g();return b}function e(a,b){C=a;O=b;r.setValue(O);v=TradingView.ChartWidgetCollection.LayoutTemplates[a];var e=v.count;w={width:K.width(),height:K.height()};for(var g=0;g<e||g<B.length;g++)(b?A===g:g<e)?(B[g]?(K.append(B[g].wrap),B[g].chartWidget.isDetached=!1):d($.extend({},S,H.shift()||(z.value()?{content:z.value().state()}:null)||{})),B[g].wrap.toggleClass("multiple",1<e),c(g)):B[g]&&(B[g].chartWidget.isDetached=!0,B[g].wrap.detach());
f()}function f(){var a=Math.min(v.count,B.length)-1;if(0>a)z.deleteValue();else{var b=A;0>b&&(b=0);b>a&&(b=a);z.setValue(B[b].chartWidget)}}function g(){for(var a=B.length;a--;){var b=a===A;B[a].wrap.toggleClass("active",b).toggleClass("inactive",!b)}}function h(a){var b=a.mainSeries().properties();b.style.subscribe(null,k);k(b.style);a.model().onSelectedSourceChanged().subscribe(null,m);m(a.selectedSource())}function k(a){N.setValue(a.value())}function m(a){T.setValue(a)}function n(a){for(var b=
!1,c=0;c<B.length;c++){var d=B[c].chartWidget;d.model().mainSeries().properties().symbol.value()!==a&&(b||(TradingView.UndoHistory.beginUndoMacro("Change Symbol"),b=!0),d.setSymbol(a))}b&&TradingView.UndoHistory.endUndoMacro()}function q(a){if("s"===a||window.user&&user.is_pro||S.containsData||t)return a;TVDialogs.showGoProDialog({feature:"multipleCharts"});return"s"}var l=this,s=2,u=0,z=new WatchedValue,t=!1,B=[],A=0,w=null,v=null,C="s",H=[],D=new WatchedValue(!1),F=new WatchedValue(!1),I=new WatchedValue(TVSettings.getBool("chart.syncCrosshair",
!0)),E=I.value();I.subscribe(function(a){E=a=!!a;TVSettings.setValue("chart.syncCrosshair",a)});var P=new WatchedValue(C),O=!1,r=new WatchedValue(O);a=a||{};"padding"in a&&(s=a.padding);"edge"in a&&(u=a.edge);var S=a.widgetOptions||{};S.readOnly&&(t=!0);var J=a.metaInfo||{},J={id:new WatchedValue(J.id),name:new WatchedValue(J.name),description:new WatchedValue(J.description),username:new WatchedValue(J.username),uid:new WatchedValue(J.uid)},K=$(a.jqParent).eq(0),R=a.onResize;this.updateLayout=b;var N=
new WatchedValue,T=new WatchedValue;N.subscribe(function(a){var b=z.value();if(b&&(b=b.model())){var c=b.mainSeries().properties().style;c.value()!==a&&b.setChartStyleProperty(c,a,"Change Series Style")}});var L=null;z.subscribe(function(a){if(a){for(var b,c=B.length;c--;)if(B[c].chartWidget===a){b=c;break}if(!isFinite(b))throw Error("Cannot make detached ChartWidget active");A!==b&&(A=b,g());L!==a&&(L&&(L.modelCreated().unsubscribe(null,h),b=L.model())&&(b.mainSeries().properties().style.unsubscribe(null,
k),b.model().onSelectedSourceChanged().unsubscribe(null,m),L=null),a&&((b=a.model())?h(b):a.modelCreated().subscribe(null,h),L=a))}},{callWithLast:!0});$.extend(this,{createChartWidget:d,getAll:function(){return B.map(function(a){return a.chartWidget})},destroy:function(){return B.forEach(function(a){a.chartWidget.destroy()})},layout:P,maximizeCurrentChart:r,activeChartWidget:z,activeChartStyle:N,selectedSource:T.readonly(),metaInfo:J,state:function(a){for(var b=[],c=TradingView.ChartWidgetCollection.LayoutTemplates[C].count,
d=0;d<c;d++)b.push(B[d].chartWidget.state(a));a={layout:C,charts:b};D.value()&&(a.symbolLock=1);F.value()&&(a.intervalLock=1);return a},readOnly:function(){return t},lock:{symbol:D,setSymbolLockWithUndo:function(a){if(a!==D.value()){TradingView.UndoHistory.beginUndoMacro("Symbol Lock");if(a)for(var b=z.value(),c=b.getSymbol(),d=0;d<B.length;d++){var e=B[d].chartWidget;e!==b&&e.getSymbol()!==c&&e.setSymbol(c)}TradingView.UndoHistory.setWatchedValue(D,a,"Symbol Lock");TradingView.UndoHistory.endUndoMacro()}},
interval:F,setIntervalLockWithUndo:function(a){if(a!==F.value()){TradingView.UndoHistory.beginUndoMacro("Interval Lock");if(a)for(var b=z.value(),c=b.getResolution(),d=0;d<B.length;d++){var e=B[d].chartWidget;e!==b&&e.getResolution()!==c&&e.setResolution(c)}TradingView.UndoHistory.setWatchedValue(F,a,"Resolution Lock");TradingView.UndoHistory.endUndoMacro()}},crosshair:I},setSymbol:function(a){D.value()?n(a):z.value().setSymbol(a)},setResolution:function(a){if(F.value()){for(var b=!1,c=0;c<B.length;c++){var d=
B[c].chartWidget;d.model().mainSeries().properties().interval.value()!==a&&(b||(TradingView.UndoHistory.beginUndoMacro("Change Resolution"),b=!0),d.setResolution(a))}b&&TradingView.UndoHistory.endUndoMacro()}else z.value().setResolution(a)},updateLayout:b,images:function(a){if(a&&a.onlyActiveChart||O)return{layout:"s",hidpiRatio:window.hidpiCanvasRatio||1,charts:[z.value().images()]};a=[];for(var b=v.count,c=0;c<B.length&&c<b;c++)a.push(B[c].chartWidget.images());return{layout:C,hidpiRatio:window.hidpiCanvasRatio||
1,charts:a}},syncCrosshair:function(a,b){if(E&&!O)for(var c=v.count,d=0;d<B.length&&d<c;d++){var e=B[d].chartWidget;e!==b&&(e=e.model())&&e.model().setExternalPosition(a)}},setSymbolAll:n});if(a=a.content){a.charts||(a={layout:"s",charts:[a]});C=q(a.layout||"s");for(I=0;I<a.charts.length;I++)H.push({content:a.charts[I]});a.symbolLock&&D.setValue(!0);a.intervalLock&&F.setValue(!0);a=null}P.setValue(C);e(C,O);H.splice(0,H.length);P.subscribe(function(a){e(a,!1)});P.hook=function(a){return a===this.value()?
a:q(a)};t&&(P.writeLock=!0);r.subscribe(function(a){a!==O&&e(C,a)});$(window).on("resize",b)};
TradingView.ChartWidgetCollection.LayoutTemplates={s:{title:"1 chart",count:1,sizer:function(a,b,c,d){return{width:b.width-d-d,height:b.height-d-d,top:d,left:d}}},"2h":{title:"2-up Horizontal",count:2,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=e-c>>1;switch(a){case 0:return{width:f,height:b,top:d,left:d};case 1:return a=c+f,{width:e-a,height:b,top:d,left:d+a}}}},"2v":{title:"2-up Vertical",count:2,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=b-c>>1;switch(a){case 0:return{width:e,
height:f,top:d,left:d};case 1:return a=c+f,{width:e,height:b-a,top:a+d,left:d}}}},"3h":{title:"3-up Horizontal",count:3,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=(e-c-c)/3|0;switch(a){case 0:return{width:f,height:b,top:d,left:d};case 1:return{width:f,height:b,top:d,left:c+f+d};case 2:return a=2*(c+f),{width:e-a,height:b,top:d,left:a+d}}}},"3v":{title:"3-up Vertical",count:3,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=(b-c-c)/3|0;switch(a){case 0:return{width:e,
height:f,top:d,left:d};case 1:return{width:e,height:f,top:c+f+d,left:d};case 2:return a=2*(c+f),{width:e,height:b-a,top:a+d,left:d}}}},"3s":{title:"3-up Stacked",count:3,sizer:function(a,b,c,d){var e=b.height-d-d,f=e-c>>1;b=b.width-d-d-c>>1;switch(a){case 0:return{width:b,height:e,left:d,top:d};case 1:return{width:b,height:f,left:b+c+d,top:d};case 2:return a=c+f,{width:b,height:e-a,left:b+c+d,top:a+d}}}},4:{title:"4-up",count:4,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=b-c>>1,
g=e-c>>1;switch(a){case 0:return{width:g,height:f,left:d,top:d};case 1:return a=f+c,{width:g,height:b-a,left:d,top:a+d};case 2:return c=g+c,{width:e-c,height:f,left:c+d,top:d};case 3:return a=f+c,c=g+c,{width:e-c,height:b-a,left:c+d,top:a+d}}}},6:{title:"6-up",count:6,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=b-c>>1,g=(e-c-c)/3|0;switch(a){case 0:return{width:g,height:f,left:d,top:d};case 1:return a=f+c,{width:g,height:b-a,left:d,top:a+d};case 2:return{width:g,height:f,left:g+
c+d,top:d};case 3:return a=f+c,{width:g,height:b-a,left:g+c+d,top:a+d};case 4:return g=g+c+g+c,{width:e-g,height:f,left:g+d,top:d};case 5:return g=g+c+g+c,a=f+c,{width:e-g,height:b-a,left:g+d,top:a+d}}}},8:{title:"8-up",count:8,sizer:function(a,b,c,d){var e=b.width-d-d;b=b.height-d-d;var f=b-c>>1,g=e-3*c>>2;switch(a){case 0:return{width:g,height:f,left:d,top:d};case 1:return a=f+c,{width:g,height:b-a,left:d,top:a+d};case 2:return{width:g,height:f,left:g+c+d,top:d};case 3:return a=f+c,{width:g,height:b-
a,left:g+c+d,top:a+d};case 4:return{width:g,height:f,left:g+c+g+c+d,top:d};case 5:return a=f+c,{width:g,height:b-a,left:g+c+g+c+d,top:a+d};case 6:return g=3*(g+c),{width:e-g,height:f,left:g+d,top:d};case 7:return g=3*(g+c),a=f+c,{width:e-g,height:b-a,left:g+d,top:a+d}}}}};function CompareWidget(a){this._chartWidgetCollection=a;this.predefines={"":{"S&P 500 Trust":"AMEX:SPY","Nasdaq Composite":"INDEX:NASX","Diamonds Trust":"AMEX:DIA","Gold Trust":"AMEX:GLD","Euro Currency Trust":"AMEX:FXE","Nasdaq 100":"INDEX:IUXX","Nasdaq Financial 100":"INDEX:IXF"}};this.symbolAlias={"BATS:SPY":"AMEX:SPY","BATS:DIA":"AMEX:DIA","BATS:GLD":"AMEX:GLD","BATS:FXE":"AMEX:FXE"}}
CompareWidget.prototype.addCompareSymbol=function(a,b,c){if(b=this._chartWidgetCollection.activeChartWidget.value())if(b=b.model()){for(var d=b.mainSeries().interval(),e=b.studiesMetaData(),f,g=0;g<e.size();g++)"Compare@tv-basicstudies"===e.item(g).id&&(f=e.item(g));a={exchange:c,inputs:{symbol:a,resolution:d}};TradingView.trackEvent("GUI","Add Compare");b.insertStudy(f,a)}};
CompareWidget.prototype.removeCompareSymbol=function(a){var b=this._chartWidgetCollection.activeChartWidget.value();if(b&&(b=b.model()))for(var c=b.dataSources(),d=0;d<c.size();d++){var e=c.item(d);if(e._metaInfo&&"Compare@tv-basicstudies"===e._metaInfo.id){var f=e.properties().inputs.symbol.value();(f===a||this.symbolAlias[f]&&this.symbolAlias[f]===a)&&b.removeSource(e)}}};
CompareWidget.prototype._createPredefinesList_normal=function(){var a=this;for(p in this.predefines)for(i in predefine=$('<div class="predefine-section">').appendTo(this._widget),this.predefines[p])line=$('<div class="predefine-line"></div>').appendTo(predefine),checkbox=$('<input type="checkbox" id="predefine-checkbox-'+this.symbolToId(this.predefines[p][i])+'"/>').appendTo(line),checkbox.change({symbol:this.predefines[p][i]},function(b){$(this).is(":checked")?a.addCompareSymbol(b.data.symbol):a.removeCompareSymbol(b.data.symbol)}),
$('<label for="predefine-checkbox-'+this.symbolToId(this.predefines[p][i])+'">'+i+"</label>").appendTo(line);$('<div class="clear"></div>').appendTo(this._widget)};
CompareWidget.prototype.init=function(){var a=this;this._widget=$('<div class="compare-widget"></div>');var b=$('<div class="symbol-edit-widget">');this.input=$('<input type="text" class="symbol-edit with-plus single" placeholder="'+$.t("Company Comparison")+'" autocomplete="off">').appendTo(b);var c=$('<a class="symbol-edit-plus" title="'+$.t("Company Comparison")+'"><span></span></a>').appendTo(b),d=TradingView.SymbolSearch.bindToInput(this.input,{callback:function(b){a.addCompareSymbol(b)},keepFocus:!0,
clearAfterAccept:!0});c.click(function(){d.acceptTypeIn()});b.appendTo(this._widget);TradingView.isRunningChartingLibrary||this._createPredefinesList_normal()};
CompareWidget.prototype.show=function(){var a=this._chartWidgetCollection.activeChartWidget.value();if(a&&(a=a.model()))for(p in a=a.dataSources(),this.init(),this._widget.find('input[id^="predefine-checkbox"]').attr("checked",!1),this.predefines)for(i in this.predefines[p])for(var b=this._widget.find("#predefine-checkbox-"+this.symbolToId(this.predefines[p][i])),c=0;c<a.size();c++){var d=a.item(c);if(d._metaInfo&&"Compare@tv-basicstudies"===d._metaInfo.id){var e=this.predefines[p][i],d=d.properties().inputs.symbol.value();
(d===e||this.symbolAlias[d]&&this.symbolAlias[d]===e)&&b.attr("checked",!0)}}};CompareWidget.prototype.symbolToId=function(a){return a.replace(/[^a-z0-9]/gi,"_")};CompareWidget.prototype.focus=function(){Modernizr.touch||this.input.focus()};function CompareDialog(a){this.chartWidgetCollection=a}CompareDialog.prototype.tabChanged=function(a){0===a?this.compareTab.focus():this.addSymbolTab.focus()};
CompareDialog.prototype.show=function(){TradingView.trackEvent("GUI","Compare Add");var a=TVDialogs.createDialog("Compare Add",{hideTitle:!0,dragHandle:".properties-tabs"}),b=a.find(".tv-dialog-content");a.css("min-width",0);b.css("min-width",0);var c=$('<div class="properties-tabs"></div>').appendTo(b);$('<a href="#" class="properties-tabs-label"></a>').text($.t("Compare")).appendTo(c);$('<a href="#" class="properties-tabs-label"></a>').text($.t("Add Symbol")).appendTo(c);var b=$("<div>").appendTo(b),
d=$('<div class="main-tree-page compare active">').appendTo(b),e=$('<div class="main-tree-page compare">').appendTo(b);this.compareTab=new CompareWidget(this.chartWidgetCollection);this.addSymbolTab=new AddSymbolWidget(this.chartWidgetCollection);this.compareTab.show();d.append(this.compareTab._widget);this.addSymbolTab.show();e.append(this.addSymbolTab._widget);this.tabs=new TradingView.Tabs(c,b,{saveTab:"CompareAddDialog.tab"});this.tabs.tabChanged.subscribe(this,this.tabChanged);TVDialogs.applyHandlers(a);
TVDialogs.positionDialog(a,this.position);return a};function AddSymbolWidget(a){this._chartWidgetCollection=a;this.init()}
AddSymbolWidget.prototype.init=function(){var a=this;this._widget=$('<div class="addsymbol-widget"></div>');var b=$('<div class="symbol-edit-widget">'),c=$('<input type="text" class="symbol-edit with-plus single" placeholder="'+$.t("Symbol")+'" autocomplete="off">').appendTo(b);this._input=c;var d=$('<a class="symbol-edit-plus"><span></span></a>').appendTo(b),e=TradingView.SymbolSearch.bindToInput(c,{callback:function(b){var c=a._chartWidgetCollection.activeChartWidget.value();c&&c.addSymbol(b,a._checkbox.is(":checked"))},
keepFocus:!0,clearAfterAccept:!0});d.on("click",function(){e.acceptTypeIn()});b.appendTo(this._widget);b=$('<div class="opts-line">').appendTo(this._widget);this._checkbox=$('<input type="checkbox" id="addsymbol-widget-overlay">').appendTo(b);this._checkbox.on("click",function(){TVSettings.setValue("showAddSymbolDialog.checkboxState",$(this).is(":checked"))});$('<label for="addsymbol-widget-overlay">'+$.t("Overlay the main chart")+"</label>").appendTo(b)};
AddSymbolWidget.prototype.show=function(){this.focus();this._checkbox.attr("checked",TVSettings.getBool("showAddSymbolDialog.checkboxState",!0))};AddSymbolWidget.prototype.focus=function(){Modernizr.touch||this._input.focus()};TradingView.SYMBOL_SEARCH_MAX_LENGTH=100;TradingView.ChartHeaderWidgetBase=function(){};TradingView.ChartHeaderWidgetBase.prototype._createBackButton=function(a){var b=a.createGroup().appendTo(a._$left);a._backButton=$('<div class="mobile-back-button"><i></i></div>').click(function(){1<window.history.length&&window.history.back();window.location.pathname="/"}).appendTo(b)};
TradingView.ChartHeaderWidgetBase.prototype._createBarsGroup=function(a){var b=this.createGroup({single:!0});a._style_list.element().appendTo(b);return b};
TradingView.ChartHeaderWidgetBase.prototype._createPropertiesGroup=function(a,b){var c=this.createGroup({single:!0});if(!this._onWidget){var d=$("<span>").addClass("button iconed properties apply-common-tooltip").append($("<i>")).appendTo(c);d.on(a,function(a){a.pageX=d.offset().left;a.pageY=d.offset().top+d.height()+15;a=b.activeChartWidget.value().showChartProperties({_lastEvent:a});d.addClass("active");a.on("destroy",function(){d.removeClass("active")})});d.attr("title",$.t("Chart Properties"))}return c};
TradingView.ChartHeaderWidgetBase.prototype._createCompareGroup=function(a,b,c){a=this.createGroup({single:!0});var d=$('<a class="button iconed toggle-caption compare apply-common-tooltip">').append($("<i>")).append($('<span class="caption">Compare</span>')).appendTo(a);this._compareButton=d;this._compareButton.on(c,function(a){a.preventDefault();a=(new CompareDialog(b)).show();d.addClass("active");a.on("destroy",function(){d.removeClass("active")})});this._compareButton.attr("title",$.t("Compare or Add Symbol"));
return a};
TradingView.ChartHeaderWidgetBase.prototype._createIndicatorsGroup=function(a,b){var c=this.createGroup({single:!0});this._indicatorsButton=$('<a class="button iconed toggle-caption indicators'+(this._onWidget?" no-last":"")+' apply-common-tooltip">').append($("<i>")).append($('<span class="caption">Indicators</span>')).appendTo(c);this._indicatorsButton.attr("title",$.t("Indicators, Fundamentals, Economy and Add-ons"));this._indicatorsButton.on(a,function(a){a.stopPropagation();a.preventDefault();studyMarket.isVisible()?
studyMarket.hide():studyMarket.show()});TradingView.keyboardBinder.registerListener("IndicatorsHotkey",function(a){if("47"==a.which&&$(a.target).is("body")&&!studyMarket.isVisible())return studyMarket.show(),studyMarket.selectSearchPage(),a.preventDefault(),a.stopPropagation(),!0});studyMarket.visibilityChanged.subscribe(this,function(a){this._indicatorsButton.toggleClass("active",a)});if(!this._onWidget&&!TradingView.isRunningChartingLibrary){var d=$('<a class="button iconed searchscript apply-common-tooltip">').append($("<i>")).appendTo(c);
this._scriptSearchButton=d;this._scriptSearchButton.attr("title",$.t("Get Script"));this._scriptSearchButton.on(a,function(a){a.stopPropagation();a.preventDefault();a=TVDialogs.showScriptSearchDialog({onTry:b&&function(a){var b=studyMarket._chartWidgetCollection.activeChartWidget.value();b.studyScriptingPkgVers&&studyMarket.insertStudy(StudyMetaInfo.createMetaInfoStub(a,b.studyScriptingPkgVers))}});d.addClass("active");a.on("destroy",function(){d.removeClass("active")})})}return c};
TradingView.ChartHeaderWidgetBase.prototype.createGroup=function(a){a||(a={});var b=$("<div>").addClass("group");a.right&&b.addClass("right");a.single?b.addClass("space-single"):null;return b};TradingView.ChartHeaderWidgetBase.prototype.bindToModel=function(){var a=this._chartWidget.model();a.mainSeries().properties();this._model=a};TradingView.ChartHeaderWidgetBase.prototype.backButton=function(){return this._backButton};
TradingView.ChartHeaderWidgetBase.prototype.saveLoadWidget=function(){return this._saveLoad||console.warn("No save-load widget created in footer")};TradingView.ChartHeaderWidgetBase.prototype.styleIconPosition=function(a){return"-%1px 0".replace("%1",19*~~a)};TradingView.ChartHeaderWidgetBase.styleIconPosition=TradingView.ChartHeaderWidgetBase.prototype.styleIconPosition;TradingView.ChartHeaderWidgetRestricted=function(a){a=a||{};var b=this._chartWidgetCollection=a.chartWidgetCollection,c=this._chartWidget=b.activeChartWidget.value(),d=this._onWidget=c.onWidget(),e=this,f=Modernizr.touch?"touchstart":"click",g=$(".header-chart-panel").eq(0);this._$right=g.find(".right");this._$left=g.find(".left");TradingView.isMobileView&&!TradingView.winMobileMode&&this._createBackButton(this);if(!b.readOnly()){if(!a.hideSymbolSearch){var g=this.createGroup().appendTo(this._$left),
g=$('<div class="symbol-edit-widget no-last"></div>').appendTo(g),h=$('<div class="symbol-edit-wrap">').appendTo(g),g=null;TradingView.isRunningChartingLibrary||(g=$('<div class="symbol-edit-buttonswrap">').appendTo(h),g=$('<div class="spread-actions">').appendTo(g).on("mousedown",function(a){a.preventDefault()}));var k=$('<div class="symbol-edit-inputspacer">').appendTo(h),m=$('<input type="text" class="symbol-edit" maxlenght="'+TradingView.SYMBOL_SEARCH_MAX_LENGTH+'">').appendTo(k);TradingView.SymbolSearch.bindToInput(m,
{syncWithChartWidget:!0,spreadActions:g});(function(){var a=!1;m.on("focus",function(){a=!0;h.addClass("expanded")});m.on("blur",function(){a=!1;setTimeout(function(){a||h.removeClass("expanded")},40)})})()}g=this.createGroup({single:!0}).appendTo(this._$left);k={onWidget:d,submenuBtnAddClass:"apply-common-tooltip"};TradingView.isMobileView&&$.extend(k,{notShowQuicks:!0,popupSpacing:1});this._interval=new TradingView.IntervalWidget(k);if(TradingView.isRunningChartingLibrary)ChartApiInstance.on("configuration_received",
function(){e._interval.forceUpdate()});this._interval.element().addClass("no-first").appendTo(g);this._interval.onResize.subscribe(b,b.updateLayout);g=TradingView.isRunningChartingLibrary?[{id:TradingView.Series.STYLE_BARS,title:$.t("Bars")},{id:TradingView.Series.STYLE_CANDLES,title:$.t("Candles")},{id:TradingView.Series.STYLE_HOLLOW_CANDLES,title:$.t("Hollow Candles")},{id:TradingView.Series.STYLE_LINE,title:$.t("Line")},{id:TradingView.Series.STYLE_AREA,title:$.t("Area")},{id:TradingView.Series.STYLE_HEIKEN_ASHI,
title:$.t("Heiken Ashi")}]:[{id:TradingView.Series.STYLE_BARS,title:$.t("Bars")},{id:TradingView.Series.STYLE_CANDLES,title:$.t("Candles")},{id:TradingView.Series.STYLE_HOLLOW_CANDLES,title:$.t("Hollow Candles")},{id:TradingView.Series.STYLE_HEIKEN_ASHI,title:$.t("Heiken Ashi")},{id:TradingView.Series.STYLE_LINE,title:$.t("Line")},{id:TradingView.Series.STYLE_AREA,title:$.t("Area")},{id:TradingView.Series.STYLE_RENKO,title:$.t("Renko")},{id:TradingView.Series.STYLE_PB,title:$.t("Line Break")},{id:TradingView.Series.STYLE_KAGI,
title:$.t("Kagi")},{id:TradingView.Series.STYLE_PNF,title:$.t("Point & Figure")}];e=this;k=[1,4,5,6];TradingView.isMobileView&&(k=[]);d&&(k=[1,3]);this._style_list=new TradingView.FavoredList("StyleWidget",$.map(g,function(a){var b=a.id,c={image:TradingView.wrapUrl("url('/static/chart-client/css/images/bartype-icons.png')"),offset:e.styleIconPosition(b),quickOffset:TradingView.isMobileView?"-%1px -38px".replace("%1",19*~~b):e.styleIconPosition(b),offsetActive:"-%1px -19px".replace("%1",19*~~b)};return{id:b,
title:a.title,icon:c,favoriteButton:{icon:c,title:a.title,addClass:"apply-common-tooltip"}}}),{defaultFavorites:k,addClass:"chart-style-widget",popupAddClass:"chart-style-popup",notShowQuicks:!!TradingView.isMobileView,tooltip:$.t("Bar's Style"),addTooltipClass:"apply-common-tooltip"});b.activeChartStyle.subscribe(function(a){e._style_list.setValue(a)},{callWithLast:!0});e._style_list.onChange().subscribe(this,function(a){b.activeChartStyle.setValue(a)});e._style_list.onResize().subscribe(b,b.updateLayout);
window.studyMarket=new TradingView.StudyMarket(b,window.user,{onWidget:d});this._createLayout(a,e,f)}this._chartWidget.readOnly()||TradingView.isMobileView||(this._undoRedo=new TradingView.UndoRedoWidget(this._$right,this._chartWidget),this._undoRedo.undoElement().addClass("apply-common-tooltip"),this._undoRedo.redoElement().addClass("apply-common-tooltip"));TradingView.isMobileView||TradingView.isRunningChartingLibrary||d||(this._fullscreen=new TradingView.FullscreenWidget,this._fullscreen.element().addClass("apply-common-tooltip").appendTo(this._$right));
c.withModel(this,TradingView.ChartHeaderWidgetBase.prototype.bindToModel)};inherit(TradingView.ChartHeaderWidgetRestricted,TradingView.ChartHeaderWidgetBase);
TradingView.ChartHeaderWidgetRestricted.prototype._createLayout=function(a,b,c){var d=null,d=this._createBarsGroup(b),e=this._createPropertiesGroup(c,a.chartWidgetCollection),f=this._createIndicatorsGroup(c);a=this._createCompareGroup(b,a.chartWidgetCollection,c);d={bars:d,properties:e,indicators:f,compare:a};[d.bars,d.properties,d.indicators,d.compare].forEach(function(a){a.appendTo(this._$left)},this)};TradingView.LineToolPropertiesWidget=function(a){this._chartWidgetCollection=a;this._bindings=new List;this.init();this.attachHandlers()};TradingView.LineToolPropertiesWidget.prototype._POSITION_KEY="properties_toolbar.position";TradingView.LineToolPropertiesWidget.prototype.activeChartWidget=function(){return this._chartWidgetCollection.activeChartWidget.value()};TradingView.LineToolPropertiesWidget.prototype.selectedSource=function(){return this._chartWidgetCollection.selectedSource.value()};
TradingView.LineToolPropertiesWidget.prototype.init=function(){var a=this,b=$('<div class="properties-toolbar"><div class="drag-handler"><i></i></div></div>').hide().appendTo("body").draggable({handle:".drag-handler",stop:function(){TVSettings.setJSON(a._POSITION_KEY,b.offset())}});$(window).resize(function(){a._updatePositoin()});this._$widget=b;this._$templates=$('<div class="tools-group">').hide().appendTo(b);this._$properties=$('<div class="tools-group properties-tools-group">').hide().appendTo(b);
this._$sourceActions=$('<div class="tools-group">').hide().appendTo(b);this.createSourceActions()};TradingView.LineToolPropertiesWidget.prototype.attachHandlers=function(){TradingView.drawingState.tool.subscribe(function(a){this.onToolChanged(a)}.bind(this),{callWithLast:!0});this._chartWidgetCollection.selectedSource.subscribe(function(a){this.onSourceChanged(a)}.bind(this))};
TradingView.LineToolPropertiesWidget.prototype.onToolChanged=function(a,b){if(a&&-1!=a.toLowerCase().indexOf("linetool"))b=b instanceof DefaultProperty?b:new DefaultProperty(a.toLowerCase()),this.hideSourceActions(),this.showPropertiesOf(a,b),this.showTemplatesOf({tool:a,properties:b}),this.updateVisibility();else if(this.selectedSource())this.onSourceChanged(this.selectedSource());else this.hide()};
TradingView.LineToolPropertiesWidget.prototype.findSourceOnWidget=function(a){for(var b=0;b<this.activeChartWidget().model().panes().size();b++)for(var c=this.activeChartWidget().model().panes().item(b).orderedSources(),d=0;d<c.length;d++)if(c[d]===a)return c[d]};
TradingView.LineToolPropertiesWidget.prototype.onSourceChanged=function(a){a?(a instanceof LineDataSource&&!(a instanceof BarsMarksContainer)&&this.findSourceOnWidget(a)?(!a.userEditEnabled()||"LineToolBrush"!==a.toolname&&this.activeChartWidget().model().lineBeingCreated()?this.hideSourceActions():this.showSourceActions(),this.showPropertiesOf(a.getConstructor(),a.properties()),this.showTemplatesOf({source:a}),this.updateVisibility()):this.hide(),this._setupToggleLockButton(a)):this.hide()};
TradingView.LineToolPropertiesWidget.prototype.showTemplatesOf=function(a){var b=a.source,c,d;b?(c=b.getConstructor(),d=b.properties()):(c=a.tool,d=a.properties);this._$templates.hide().empty();var e=this;a=new TradingView.LinetoolTemplatesList(c,function(a){b?(b.restoreTemplate(a),e.activeChartWidget().model().model().updateSource(this._linetool),e.onSourceChanged(b)):(d.merge(a),d.listeners().fire(this),d.saveDefaults(),e.onToolChanged(c,d))},{buttonInner:" ",buttonClass:"button icon-list with-arrow apply-common-tooltip",
defaultsCallback:function(){d.restoreFactoryDefaults();e.showPropertiesOf(c,d)},saveAsText:"Save Drawing Template As...",applyDefaultText:"Apply Default Drawing Template",getDataForSaveAs:b?function(){return b.template()}:null});var f=a.createButton().attr("title","Templates");this.templatesList=a;this._$templates.append(f);TradingView.isRunningChartingLibrary||this._$templates.show();this._templatesVisible=!0};
TradingView.LineToolPropertiesWidget.prototype.createSourceActions=function(){function a(a,b,c){return $('<div class="button icon-'+a.toLocaleLowerCase()+' apply-common-tooltip" title="'+b+'"></div>').click(function(a){a.stopPropagation();c(a)})}var b=this,c=a("Settings",$.t("Settings"),function(){(new EditObjectDialog(b.selectedSource(),b.activeChartWidget().model())).show()});this.$zOrder=a("ZOrder",$.t("Visual Order"),function(){b.zOrderButtonHandler()});this.$zOrder.addClass("with-arrow");TradingView.bindPopupMenu(this.$zOrder,
null,{direction:"down",event:"button-popup",reverse:!1,notCloseOnButtons:!0});this.$clone=a("Clone",$.t("Clone"),function(){b.activeChartWidget().paneWidgets().item(0).cloneLineTool(b.selectedSource())});this.$lock=a("Lock",$.t("Lock"),function(){b.activeChartWidget().toggleLockSelectedObject()});this._lockChangeListener=function(a){b.$lock.toggleClass("active",a.value())};var d=a("Hide",$.t("Hide"),function(){b.activeChartWidget().hideSelectedObject()}),e=a("Remove",$.t("Remove"),function(){b.activeChartWidget().model().removeSelectedSource()});
this._$sourceActions.append(c,this.$zOrder,this.$clone,this.$lock,d,e)};TradingView.LineToolPropertiesWidget.prototype.zOrderButtonHandler=function(){this.$zOrder.hasClass("active")||this.$zOrder.trigger("button-popup",[this._getZOrderActions()])};
TradingView.LineToolPropertiesWidget.prototype._getZOrderActions=function(){var a=[],b=this.selectedSource(),c=this.activeChartWidget().model(),d={title:$.t("Bring to Front"),action:function(){c.bringToFront(b)}},e={title:$.t("Send to Back"),action:function(){c.sendToBack(b)}},f={title:$.t("Bring Forward"),action:function(){c.changeZOrder(b,1)}},g={title:$.t("Send Backward"),action:function(){c.changeZOrder(b,-1)}},h=c.paneForSource(this.selectedSource()).getZOrderMinMax();b.zorder()===h.minZOrder&&
(e.disabled=!0,g.disabled=!0);b.zorder()===h.maxZOrder&&(f.disabled=!0,d.disabled=!0);a.push(d,e,f,g);return a};TradingView.LineToolPropertiesWidget.prototype._getPossibleProperty=function(a){for(var b=[],c=this._defaultToolProperties(),d=!0,e=!1,f=0;f<c.length;f++){var g=c[f];g.name in a?(d=!1,b.push(g)):g.divider&&(b.push(g),e=!0)}2===b.length&&e&&(b=$.grep(b,function(a){return!a.divider}));return d?[]:b};
TradingView.LineToolPropertiesWidget.prototype.showPropertiesOf=function(a,b){this._toolExceptionCases||(this._toolExceptionCases=this._createToolExceptionCases());var c=this._toolExceptionCases[a]||this._getPossibleProperty(b);this._$properties.empty();this._propertiesVisible=!1;if(c.length){for(var d=0;d<c.length;d++){var e=c[d];if(e.divider)this._$properties.append('<div class="divider"></div>');else{var f=b[e.name];if("function"!=typeof e.showIf||e.showIf(f,b))e=new this.propertyControl(this,
f,e,b),this._$properties.append(e.el),this._propertiesVisible=!0}}this._$properties.toggle(this._propertiesVisible)}else this._$properties.hide()};TradingView.LineToolPropertiesWidget.prototype.showSourceActions=function(){var a=TradingView.className(this.selectedSource().constructor);this.activeChartWidget().model().model().isSingleInstanceLineTool(a)?this.$clone.hide():this.$clone.show();this._$sourceActions.show();this._sourceActionsVisible=!0};
TradingView.LineToolPropertiesWidget.prototype.hideSourceActions=function(){this._$sourceActions.hide();this._sourceActionsVisible=!1};TradingView.LineToolPropertiesWidget.prototype.updateVisibility=function(){this._propertiesVisible||this._sourceActionsVisible||this._templatesVisible?this.show():this.hide()};TradingView.LineToolPropertiesWidget.prototype.hide=function(){this._$widget.hide();this._setupToggleLockButton()};
TradingView.LineToolPropertiesWidget.prototype.show=function(){this._$widget.show();this._updatePositoin()};
TradingView.LineToolPropertiesWidget.prototype._setupToggleLockButton=function(a){a!=this._selectedSourceBk&&(this._selectedSourceBk&&this._selectedSourceBk.properties().frozen&&this._selectedSourceBk.properties().frozen.unsubscribe(this,this._lockChangeListener),a&&a.properties().frozen&&(a.properties().frozen.subscribe(this,this._lockChangeListener),this.$lock.toggleClass("active",a.properties().frozen.value())),this._selectedSourceBk=a)};
TradingView.LineToolPropertiesWidget.prototype._updatePositoin=function(){var a=this._$widget,b=$(window),c=b.height()-a.outerHeight(),b=b.width()-a.outerWidth(),d=TVSettings.getJSON(this._POSITION_KEY,{left:b/2,top:headerChartPanel.outerHeight()+15}),d={top:Math.min(c,Math.max(d.top,0)),left:Math.min(b,Math.max(d.left,0))};a.css(d);a.draggable("option","containment",[0,0,b,c])};TradingView.LineToolPropertiesWidget.prototype.bindControl=function(a){this._bindings.append(a)};
TradingView.LineToolPropertiesWidget.prototype.clearBindings=function(a){for(a=this._bindings.size();a--;)this._bindings.item(a).destroy();this._bindings.clear()};
TradingView.LineToolPropertiesWidget.prototype.propertyControl=function(a,b,c,d){if(b&&c&&a&&c.inputType){"combobox"!==c.inputType||c.comboboxOptions||console.warn('inputType combobox, needs "comboboxOptions" option');this._toolbarWidget=a;var e=c.inputType,f;"colorPicker"===e?(f=PropertyPage.prototype.createColorPicker(),c.icon&&f.addClass("icon-"+c.icon),a.bindControl(new ColorBinding(f,b,!0,a.activeChartWidget().model()))):"combobox"===e&&(f=$.map(c.comboboxOptions,function(a){return{value:a.value,
html:'<div class="combobox-icon icon-'+a.icon+'"></div>'}}),e=new HTMLHelper.Combobox(f,{horizontal:!0}),f=e.render(),f.find(".items").width(32*c.comboboxOptions.length+14),c.propertyProxy&&(b=c.propertyProxy(d,a.activeChartWidget().model())),a.bindControl(new SimpleComboBinder(e,b,null,!0,a.activeChartWidget().model())));c.title&&f.attr("title",c.title);f.addClass("apply-common-tooltip");this.el=f}};
TradingView.LineToolPropertiesWidget.prototype.createLineEndPropertyProxy=function(a,b){return function(c,d){var e;e=c[b].value()?TradingView.LineToolPropertiesWidget.LINE_EXTEND:c[a].value();e=new Property(e);e.subscribe(this,function(e){e=e.value();2>e?(d.beginUndoMacro(""),c[a].setValue(e),c[b].setValue(!1)):(d.beginUndoMacro(""),c[a].setValue(LineDataSource.LINEEND_NORMAL),c[b].setValue(!0));d.endUndoMacro()});return e}};TradingView.LineToolPropertiesWidget.LINE_EXTEND=42;
TradingView.LineToolPropertiesWidget.prototype._defaultToolProperties=function(){return[{name:"color",inputType:"colorPicker",icon:"pencil",title:$.t("Color")},{name:"linecolor",inputType:"colorPicker",icon:"pencil",title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",icon:"bucket",title:$.t("Background Color")},{divider:!0},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}],
title:$.t("Width")},{name:"linestyle",title:$.t("Style"),inputType:"combobox",comboboxOptions:[{value:0,icon:"line"},{value:1,icon:"line-dotted"},{value:2,icon:"line-dashed"}]},{name:"leftEnd",title:$.t("Left End"),inputType:"combobox",comboboxOptions:[{value:LineDataSource.LINEEND_NORMAL,icon:"line-left-normal"},{value:LineDataSource.LINEEND_ARROW,icon:"line-left-arrow"},{value:TradingView.LineToolPropertiesWidget.LINE_EXTEND,icon:"line-left-extend"}],propertyProxy:this.createLineEndPropertyProxy("leftEnd",
"extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:LineDataSource.LINEEND_NORMAL,icon:"line-right-normal"},{value:LineDataSource.LINEEND_ARROW,icon:"line-right-arrow"},{value:TradingView.LineToolPropertiesWidget.LINE_EXTEND,icon:"line-right-extend"}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]};
TradingView.LineToolPropertiesWidget.prototype._riskPropertiesExceptionCases=function(){return[{name:"textcolor",title:$.t("Text color"),inputType:"colorPicker",icon:"font"},{name:"profitBackground",title:$.t("Profit Background Color"),inputType:"colorPicker",icon:"bucket"},{name:"stopBackground",title:$.t("Stop Background Color"),inputType:"colorPicker",icon:"bucket"},{name:"linecolor",title:$.t("Border color"),inputType:"colorPicker",icon:"pencil"}]};
TradingView.LineToolPropertiesWidget.prototype._elliottPropertiesExceptionCases=function(){return[{name:"color",inputType:"colorPicker",icon:"pencil"}]};
TradingView.LineToolPropertiesWidget.prototype._textPropertiesExceptionCases=function(){return[{name:"color",title:$.t("Text color"),inputType:"colorPicker",icon:"font"},{name:"backgroundColor",title:$.t("Background Color"),inputType:"colorPicker",icon:"bucket",showIf:function(a,b){return b&&b.fillBackground?!!b.fillBackground.value():!0}},{name:"borderColor",title:$.t("Border Color"),inputType:"colorPicker",icon:"pencil"},{name:"bordercolor",title:$.t("Border Color"),inputType:"colorPicker",icon:"pencil"}]};
TradingView.LineToolPropertiesWidget.prototype._brushPropertiesExceptionCases=function(){return[{name:"linecolor",inputType:"colorPicker",icon:"pencil",title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",icon:"bucket",showIf:function(a,b){return b.fillBackground.value()},title:$.t("Background Color")},{divider:!0},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}],
title:$.t("Line Width")}]};
TradingView.LineToolPropertiesWidget.prototype._createToolExceptionCases=function(){return{LineToolRegressionTrend:[],LineToolGannSquare:[],LineToolFibTimeZone:[],LineToolBrush:TradingView.LineToolPropertiesWidget.prototype._brushPropertiesExceptionCases(),LineToolPolyline:TradingView.LineToolPropertiesWidget.prototype._brushPropertiesExceptionCases(),LineToolText:TradingView.LineToolPropertiesWidget.prototype._textPropertiesExceptionCases(),LineToolTextAbsolute:TradingView.LineToolPropertiesWidget.prototype._textPropertiesExceptionCases(),LineToolBalloon:TradingView.LineToolPropertiesWidget.prototype._textPropertiesExceptionCases(),
LineToolCallout:TradingView.LineToolPropertiesWidget.prototype._textPropertiesExceptionCases(),LineToolPriceLabel:TradingView.LineToolPropertiesWidget.prototype._textPropertiesExceptionCases(),LineToolArrowMarkLeft:[],LineToolArrowMarkRight:[],LineToolArrowMarkUp:[],LineToolArrowMarkDown:[],LineToolFlagMark:[],LineToolThumbUp:[],LineToolThumbDown:[],LineToolElliottCircle:TradingView.LineToolPropertiesWidget.prototype._elliottPropertiesExceptionCases(),LineToolElliottSubminuette:TradingView.LineToolPropertiesWidget.prototype._elliottPropertiesExceptionCases(),
LineToolElliottMinor:TradingView.LineToolPropertiesWidget.prototype._elliottPropertiesExceptionCases(),LineToolElliottMinorRetr:TradingView.LineToolPropertiesWidget.prototype._elliottPropertiesExceptionCases(),LineToolElliottMajorRetr:TradingView.LineToolPropertiesWidget.prototype._elliottPropertiesExceptionCases(),LineToolIcon:[{name:"color",title:$.t("Color"),inputType:"colorPicker",icon:"bucket"}],LineToolThreeDrivers:[{name:"color",title:$.t("Text color"),inputType:"colorPicker",icon:"pencil"}],
LineToolRiskRewardLong:TradingView.LineToolPropertiesWidget.prototype._riskPropertiesExceptionCases(),LineToolRiskRewardShort:TradingView.LineToolPropertiesWidget.prototype._riskPropertiesExceptionCases(),LineToolBarsPattern:[{name:"color",title:$.t("Color"),inputType:"colorPicker",icon:"bucket"}],LineToolProjection:[{name:"color1",title:$.t("Background color 1"),inputType:"colorPicker",icon:"bucket"},{name:"color2",title:$.t("Background color 2"),inputType:"colorPicker",icon:"bucket"},{divider:!0},
{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}]}]}};TradingView.ChartSideToolbarWidget=function(a){var b=this;a=a||{};TradingView.drawingState.init();var c=this._container=a.container;this._chartWidgetCollection=a.chartWidgetCollection;this._container.on("contextmenu",function(a){a.preventDefault()});if(!a.onWidget&&!TradingView.isMobileView){var d=$("<span>").addClass("main-menu apply-common-tooltip common-tooltip-vertical");c.append($("<div>").addClass("tools-group").append(d));this._mainMenuWidget=new TradingView.MainMenuWidget(d)}this._allToolGroups=
[];this._enabledTools=a.enabledDrawings;this._disabledTools=a.disabledDrawings;if(!a.readOnly){this._main=d=$("<div>").addClass("tools-group no-delimiter").appendTo(c);this.appendToolsGroup([{tool:"cursor",name:"Cross"},{tool:"dot",name:"Dot"},{tool:"arrow",name:"Arrow"},{tool:"eraser",name:"Eraser"}]);this.appendToolsGroup([{tool:"LineToolTrendLine",name:"Trend Line"},{tool:"LineToolTrendAngle",name:"Trend Angle"},{tool:"LineToolHorzLine",name:"Horizontal Line"},{tool:"LineToolHorzRay",name:"Horizontal Ray"},
{tool:"LineToolVertLine",name:"Vertical Line"},{tool:"LineToolArrow",name:"Arrow"},{tool:"LineToolRay",name:"Ray"},{tool:"LineToolExtended",name:"Extended"},{tool:"LineToolParallelChannel",name:"Parallel Channel"},{tool:"LineToolDisjointAngle",name:"Disjoint Angle"},{tool:"LineToolFlatBottom",name:"Flat Top/Bottom"},{tool:"LineToolRegressionTrend",name:"Regression Trend"}]);this.appendToolsGroup([{tool:"LineToolPitchfork",name:"Pitchfork"},{tool:"LineToolSchiffPitchfork2",name:"Schiff Pitchfork"},
{tool:"LineToolSchiffPitchfork",name:"Modified Schiff Pitchfork"},{tool:"LineToolInsidePitchfork",name:"Inside Pitchfork"},{tool:"LineToolPitchfan",name:"Pitchfan"},{tool:"LineToolGannSquare",name:"Gann Box"},{tool:"LineToolGannComplex",name:"Gann Square"},{tool:"LineToolGannFan",name:"Gann Fan"},{tool:"LineToolFibRetracement",name:"Fib Retracement"},{tool:"LineToolTrendBasedFibExtension",name:"Trend-Based Fib Extension"},{tool:"LineToolFibSpeedResistanceFan",name:"Fib Speed Resistance Fan"},{tool:"LineToolFibTimeZone",
name:"Fib Time Zone"},{tool:"LineToolTrendBasedFibTime",name:"Trend-Based Fib Time"},{tool:"LineToolCircleLines",name:"Cyclic Lines"},{tool:"LineToolFibCircles",name:"Fib Circles"},{tool:"LineToolFibSpiral",name:"Fib Spiral"},{tool:"LineToolFibSpeedResistanceArcs",name:"Fib Speed Resistance Arcs"},{tool:"LineToolFibWedge",name:"Fib Wedge"},{tool:"LineToolFibChannel",name:"Fib Channel"}]);this.appendToolsGroup([{tool:"LineToolBrush",name:"Brush"},{tool:"LineToolRectangle",name:"Rectangle"},{tool:"LineToolRotatedRectangle",
name:"Rotated Rectangle"},{tool:"LineToolEllipse",name:"Ellipse"},{tool:"LineToolTriangle",name:"Triangle"},{tool:"LineToolPolyline",name:"Polyline"},{tool:"LineToolArc",name:"Arc"}]);this.appendToolsGroup([{tool:"LineToolText",name:"Text"},{tool:"LineToolTextAbsolute",name:"Anchored Text"},{tool:"LineToolBalloon",name:"Balloon"},{tool:"LineToolCallout",name:"Callout"},{tool:"LineToolPriceLabel",name:"Price Label"},{tool:"LineToolArrowMarkLeft",name:"Arrow Mark Left"},{tool:"LineToolArrowMarkRight",
name:"Arrow Mark Right"},{tool:"LineToolArrowMarkUp",name:"Arrow Mark Up"},{tool:"LineToolArrowMarkDown",name:"Arrow Mark Down"},{tool:"LineToolFlagMark",name:"Flag Mark"}]);this.appendToolsGroup([{tool:"LineTool5PointsPattern",name:"XABCD Pattern"},{tool:"LineToolABCD",name:"ABCD Pattern"},{tool:"LineToolTrianglePattern",name:"Triangle Pattern"},{tool:"LineToolThreeDrivers",name:"Three Drivers Pattern"},{tool:"LineToolHeadAndShoulders",name:"Head & Shoulders"},{tool:"LineToolElliottSubminuette",
name:"Elliott Wave Subminuette"},{tool:"LineToolElliottMinor",name:"Elliott Wave Minor"},{tool:"LineToolElliottCircle",name:"Elliott Wave Cycle"},{tool:"LineToolElliottMinorRetr",name:"Elliott Minor Retracement"},{tool:"LineToolElliottMajorRetr",name:"Elliott Major Retracement"}]);this.appendToolsGroup([{tool:"LineToolRiskRewardLong",name:"Long Position"},{tool:"LineToolRiskRewardShort",name:"Short Position"},{tool:"LineToolPrediction",name:"Forecast"},{tool:"LineToolDateRange",name:"Date Range"},
{tool:"LineToolPriceRange",name:"Price Range"},{tool:"LineToolBarsPattern",name:"Bars Pattern"},{tool:"LineToolProjection",name:"Projection"}]);if(this.isToolEnabled("Font Icons")){var e=new this.Button(this.createIconActions(),{addClass:"font-awesome line-tool-icons-popup",buttonClass:"font-awesome"},!0);this._icons=e;d.append(e.element());this._allToolGroups.push(e)}if(!TradingView.isMobileView){d=$("<div>").addClass("tools-group").appendTo(c);e=new this.Button({tool:"zoom",name:"Zoom In",action:function(){TradingView.drawingState.tool.setValue("zoom")}});
d.append(e.element());this._allToolGroups.push(e);if(b._chartWidgetCollection){var f=new this.Button({tool:"zoom-out",name:"Zoom Out",action:function(){var a=b._chartWidgetCollection;a&&(a=a.activeChartWidget.value().model())&&a.zoomFromViewport()}});d.append(f.element());f.element().addClass("hidden");(function(){function a(){var d=b._chartWidgetCollection.activeChartWidget.value(),e=d.model(),g=!1;e?(c!==e&&(c&&c.zoomStack().onChange().unsubscribe(null,a),e.zoomStack().onChange().subscribe(null,
a),c=e),g=!e.zoomStack().isEmpty()):d.withModel(null,a);f.element().toggleClass("hidden",!g)}var c=null;b._chartWidgetCollection.activeChartWidget.subscribe(a,{callWithLast:!0})})()}e=new this.Button({tool:"measure",name:"Measure (Shift + Click on the chart)",action:function(){TradingView.drawingState.tool.setValue("measure")}});d.append(e.element());this._allToolGroups.push(e)}var d=$("<div>").addClass("tools-group").appendTo(c),e=!!TradingView.drawingState.properties().magnet.value(),g=new this.Button({tool:"magnet",
name:"Magnet Mode",action:function(){g.activate(!g.activated);TradingView.saveDefaultProperties(!0);TradingView.drawingState.properties().magnet.setValue(g.activated);TradingView.saveDefaultProperties(!1)}.bind(this)});d.append(g.element());g.activate(e);TradingView.drawingState.properties().magnet.subscribe(this,function(a){g.activate(a.value())});if(!TradingView.isMobileView){e=!!TradingView.drawingState.properties().stayInDrawingMode.value();drawingmode=new this.Button({tool:"drawginmode",name:"Stay in Drawing Mode",
action:function(){drawingmode.activate(!drawingmode.activated);TradingView.saveDefaultProperties(!0);TradingView.drawingState.properties().stayInDrawingMode.setValue(drawingmode.activated);TradingView.saveDefaultProperties(!1)}.bind(this)});d.append(drawingmode.element());drawingmode.activate(e);TradingView.drawingState.properties().stayInDrawingMode.subscribe(this,function(a){drawingmode.activate(a.value())});var e=!!TradingView.drawingState.lockDrawings().value(),h=new this.Button({tool:"lockAllDrawings",
name:"Lock All Drawing Tools",action:function(){h.activate(!h.activated);TradingView.drawingState.lockDrawings().setValue(h.activated)}.bind(this)});d.append(h.element());h.activate(e);TradingView.drawingState.lockDrawings().subscribe(this,function(a){h.activate(a.value())});var e=!!TradingView.drawingState.hideAllDrawings().value(),k=new this.Button({tool:"hideAllDrawings",name:"Hide All Drawing Tools",action:function(){k.activate(!k.activated);TradingView.drawingState.hideAllDrawings().setValue(k.activated)}.bind(this)});
d.append(k.element());k.activate(e);TradingView.drawingState.hideAllDrawings().subscribe(this,function(a){k.activate(a.value())});if(!a.onWidget||TradingView.isRunningChartingLibrary)d=$("<div>").addClass("tools-group").appendTo(c),e=$("<span>").addClass("button objects-tree apply-common-tooltip common-tooltip-vertical").attr("title",$.t("Show Objects Tree")).append($("<i>")),e.on("click",function(a){this._chartWidgetCollection.activeChartWidget.value().showSourceProperties();a.preventDefault()}.bind(this)),
d.append(e)}TVSettings.getValue("chart.cursorPreference","cursor")}var m;a.onWidget||TradingView.isMobileView||(m=$("<div>").addClass("help-button-container").appendTo(this._container),d=$("<span>").addClass("help-button").appendTo(m),e=null,a.withWizard&&a.chartWidgetCollection&&(e=a.chartWidgetCollection.activeChartWidget.value()),new TradingView.ChartHelpMenu(d,!!a.withWizard,e));a.readOnly||TradingView.drawingState.tool.subscribe(function(a){this._syncView(a)}.bind(this),{callWithLast:!0});$(document).bind("keydown",
"esc",function(){TradingView.drawingState.resetToCursor(!0)});this.displayChanged=new Delegate;this._twoColumnLayout=!1;if(!TradingView.isMobileView){var n=c.find(".tools-group"),q;$(window).load(function(){var a=n.last();q=a.offset().top+a.outerHeight();$(window).resize()});$(window).resize(function(){var a=m?m.offset().top<q+10:$(window).height()<q+10;a!=b._twoColumnLayout&&(c.toggleClass("two-column",a),b._twoColumnLayout=a,$(window).resize())})}this._hidden=!1};
TradingView.ChartSideToolbarWidget.prototype.appendToolsGroup=function(a){a=this.filterEnabledTools(this.applyActions(a));0<a.length&&(a=new this.Button(a),this._main.append(a.element()),this._allToolGroups.push(a))};TradingView.ChartSideToolbarWidget.prototype.filterEnabledTools=function(a){var b=this;return a.filter(function(a){return b.isToolEnabled(a.name)})};
TradingView.ChartSideToolbarWidget.prototype.isToolEnabled=function(a){var b=!!this._enabledTools&&0<this._enabledTools.length,c=!!this._disabledTools&&0<this._disabledTools.length;if(b&&c)throw"Unable to use enabled drawings list and disabled drawings one together. Please use just one of them.";return!c&&!b||b&&0<=this._enabledTools.indexOf(a)||c&&0>this._disabledTools.indexOf(a)};TradingView.ChartSideToolbarWidget.prototype.element=function(){return this._container};
TradingView.ChartSideToolbarWidget.prototype._syncView=function(a){if(this._allToolGroups)for(var b=this._allToolGroups.length;b--;){var c=this._allToolGroups[b];if(c.textAsIcon)c.activate("LineToolIcon"==a);else{for(var d=!1,e=c.tools.length;e--;)c.tools[e].tool===a&&(c.setCurrent(e),d=!0);c.activate(d)}}};
TradingView.ChartSideToolbarWidget.prototype.applyActions=function(a){var b=this;return $.map(a,function(a){return{tool:a.tool,name:a.name,action:function(){TradingView.drawingState.tool.value()!==a.tool&&(TradingView.supportTouch()&&b._chartWidgetCollection.selectedSource.value()&&b._chartWidgetCollection.activeChartWidget.value().model().lineBeingCreated()&&b._chartWidgetCollection.activeChartWidget.value().model().cancelCreatingLine(),TradingView.drawingState.tool.setValue(a.tool))}}})};
TradingView.ChartSideToolbarWidget.prototype.createIconActions=function(a){var b=this;a=TradingView.LineToolIcon.availIcons;var c=TVSettings.getJSON("linetoolicon.recenticons");c&&(a=c.concat(["separator"]).concat(a));return $.map(a,function(a){return"separator"===a?{separator:!0}:{tool:"LineToolIcon",name:String.fromCharCode(a),action:function(){var c=defaults("linetoolicon");c.icon=a;saveDefaults("linetoolicon",c);TradingView.drawingState.tool.setValue("LineToolIcon");b._icons.setTools(b.createIconActions());
c=TVSettings.getJSON("linetoolicon.recenticons")||[];c=$.grep(c,function(b){return b!=a});c.unshift(a);10<c.length&&(c=c.slice(0,10));TVSettings.setJSON("linetoolicon.recenticons",c)}}})};TradingView.ChartSideToolbarWidget.prototype.changeTool=function(a){a?this._chartWidget.setCurrentTool(a):this._chartWidget.setCurrentTool(this._chartWidget.currentCursorTool())};
TradingView.ChartSideToolbarWidget.prototype.fold=function(a){a=!!a;this._container.toggleClass("hidden",a);this._hidden=a;$(window).resize();this.displayChanged.fire(a)};TradingView.ChartSideToolbarWidget.prototype.toggleFold=function(){this.fold(!this._hidden)};TradingView.ChartSideToolbarWidget.prototype.isHidden=function(){return this._hidden};
TradingView.ChartSideToolbarWidget.prototype.Button=function(a,b,c){a=isArray(a)?a:[a];this.isGroup=1<a.length;this.textAsIcon=c;this.setTools(a);this._e=$("<span>").addClass("button").addClass("apply-common-tooltip common-tooltip-vertical");this.isGroup?(this._main=$("<span>").addClass("main"),c?this._main.text($.t(a[0].name)).addClass("text-as-icon"):this._main.append("<i>"),this._side=$("<span>").addClass("side"),this._e.append(this._main).append(this._side),this._e.addClass("subgroup")):this._e.append($("<i>")).attr("title",
$.t(a[0].name));c||this._e.hover($.proxy(this,"_hover"),$.proxy(this,"_unhover"));b=$.extend({direction:TradingView.isMobileView?"up":"right",event:"button-popup",addClass:"",reverse:!1,popupSpacing:TradingView.isMobileView?15:4,upAction:!0},b||{});c||(b.addClass+=" iconed");this.isGroup&&TradingView.bindPopupMenu(this._e,null,b);this.activated=a.activated||!1;this.setCurrent(0);this.isGroup?(Modernizr.touch?(this._main.bind("touchstart",$.proxy(this,"_startclick")),this._main.bind("touchend",$.proxy(this,
"_stopclick"))):(this._main.mousedown($.proxy(this,"_startclick")),this._main.mouseup($.proxy(this,"_stopclick"))),this._side.click($.proxy(this,"_submenu")),this._e.click(function(){return!1})):this._e.click($.proxy(this,"action"))};TradingView.ChartSideToolbarWidget.prototype.Button.prototype.element=function(){return this._e};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype.setTools=function(a){if(isArray(a)){var b=this;this.tools=$.map(a,$.proxy(function(a,d){return a.separator?{separator:!0}:{icon:b.textAsIcon?a.name:a.tool,name:a.name,localizedName:$.t(a.name),tool:a.tool,action:"function"===typeof a.action?a.action:b._defaultAction}},this))}};TradingView.ChartSideToolbarWidget.prototype.Button.prototype._getBackgroundByTile=function(a,b){return[b?33:1,32*a+1]};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype._getBackgroundPosition=function(a){return"-"+a[0]+"px -"+a[1]+"px"};
TradingView.ChartSideToolbarWidget.prototype.Button.iconIndices={LineToolTextAbsolute:0,LineToolArc:1,LineToolArrowMarkDown:2,LineToolArrowMarkUp:3,LineToolCircleLines:4,LineToolArrowMarkLeft:5,LineToolArrowMarkRight:6,LineToolFibSpeedResistanceArcs:7,arrow:8,LineToolBalloon:9,LineToolBrush:10,LineToolFibSpeedResistanceFan:11,LineToolArrow:12,cursor:13,LineToolHorzLine:14,LineToolFibRetracement:15,LineToolPitchfork:16,LineToolText:17,LineToolTrendLine:18,LineToolTrendAngle:82,LineToolFibTimeZone:19,
LineToolVertLine:20,dot:21,LineToolEllipse:22,LineToolFlagMark:23,eraser:24,LineToolExtended:25,LineToolFibCircles:26,LineToolFibSpiral:74,LineToolGannFan:27,LineToolGannSquare:28,LineToolGannComplex:67,LineToolParallelChannel:29,LineToolDisjointAngle:75,LineToolFlatBottom:76,LineToolPolyline:30,LineToolRectangle:31,LineToolRotatedRectangle:81,LineToolCallout:32,LineToolPriceLabel:77,LineToolRay:33,LineToolSchiffPitchfork:72,LineToolSchiffPitchfork2:34,LineToolTrendBasedFibExtension:37,LineToolTrendBasedFibTime:66,
LineToolTriangle:38,modes:39,LineToolElliottSubminuette:40,LineToolElliottMinor:41,LineToolElliottCircle:42,LineToolElliottMajorRetr:43,LineToolElliottMinorRetr:44,LineToolRegressionTrend:45,LineToolFibWedge:46,zoom:47,LineToolPitchfan:48,LineToolHorzRay:49,LineToolPrediction:50,"zoom-out":51,LineToolPriceRange:52,LineToolDateRange:53,LineToolRiskRewardLong:54,LineToolRiskRewardShort:55,"":56,"":57,"":58,LineToolBarsPattern:59,LineToolProjection:60,LineTool5PointsPattern:61,LineToolABCD:62,LineToolTrianglePattern:63,
LineToolThreeDrivers:64,LineToolHeadAndShoulders:65,LineToolInsidePitchfork:68,measure:69,magnet:70,drawginmode:71,LineToolFibChannel:73,lockAllDrawings:78,hideAllDrawings:79};TradingView.ChartSideToolbarWidget.prototype.Button.prototype._setIcon=function(a,b,c){a=this._getBackgroundByTile(TradingView.ChartSideToolbarWidget.prototype.Button.iconIndices[a],b);c||this._e.find("i").css("background-position",this._getBackgroundPosition(a))};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype._setTextAsIcon=function(a){this._e.find(".main").text(a)};TradingView.ChartSideToolbarWidget.prototype.Button.prototype.setIcon=function(a){this.icon=a;this.textAsIcon?this._setTextAsIcon(a):this._setIcon(a,this.activated)};TradingView.ChartSideToolbarWidget.prototype.Button.prototype._hover=function(){this._setIcon(this.icon,!0,!0)};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype._unhover=function(){this._setIcon(this.icon,this.activated||!1)};TradingView.ChartSideToolbarWidget.prototype.Button.prototype._getPopupIcon=function(a){a=TradingView.ChartSideToolbarWidget.prototype.Button.iconIndices[a];return offset={image:TradingView.wrapUrl("url('/static/images/sidetoolbar/instruments.png')"),offset:{x:-64,y:32*-a}}};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype._getPopupMenuItems=function(){var a=this;return $.map(this.tools,function(b,c){return b.separator?b:{title:""+b.localizedName,action:function(){a.setCurrent(c);a.getCurrent().action.call(a,b);$(document).trigger("click");$(document).trigger("touch")},active:c==a.current,icon:a.textAsIcon?null:a._getPopupIcon(b.icon)}})};TradingView.ChartSideToolbarWidget.prototype.Button.prototype._defaultAction=function(){this.activate()};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype._startclick=function(){this._e.hasClass("active")?($(document).trigger("click"),this.action()):this._delay=setTimeout($.proxy(function(){this._delay=null;this.openSubmenu()},this),200)};TradingView.ChartSideToolbarWidget.prototype.Button.prototype._stopclick=function(){this._delay&&(clearTimeout(this._delay),this._delay=null,this.action())};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype._submenu=function(){this._e.hasClass("active")?$(document).trigger("click"):this.openSubmenu()};TradingView.ChartSideToolbarWidget.prototype.Button.prototype.activate=function(a){(this.activated=a=void 0!==a?!!a:!0)?this._e.addClass("selected"):this._e.removeClass("selected");this._setIcon(this.icon,a)};TradingView.ChartSideToolbarWidget.prototype.Button.prototype.action=function(){this.getCurrent().action.call(this,this.getCurrent())};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype.openSubmenu=function(){this._e.trigger("button-popup",[this._getPopupMenuItems()])};TradingView.ChartSideToolbarWidget.prototype.Button.prototype.setCurrent=function(a){0<=a&&a<this.tools.length&&(this.setIcon(this.tools[a].icon),this.current=a)};TradingView.ChartSideToolbarWidget.prototype.Button.prototype.getCurrent=function(){return this.tools[this.current]};
TradingView.ChartSideToolbarWidget.prototype.Button.prototype.setCurrentTool=function(a,b){var c=this;if("LineToolIcon"===a){var d=String.fromCharCode(defaults("linetoolicon").icon);$.each(this.tools,function(a,b){if(b.icon==d)return c.setCurrent(a),c.activate(),!1})}else $.each(this.tools,function(b,d){if(d.tool==a)return c.setCurrent(b),c.activate(),!1})};TradingView.UndoRedoWidget=function(a,b){a=$(a);this._chartWidget=b;this._undo=$("<span>").addClass("button undo iconed disabled").attr("title","").append("<i>").appendTo(a);this._redo=$("<span>").addClass("button redo iconed disabled").attr("title","").append("<i>").appendTo(a);var c=this;this._undo.click(function(){c.undo()});this._redo.click(function(){c.redo()});TradingView.UndoHistory.undoStack().onChange().subscribe(this,this.update);TradingView.UndoHistory.redoStack().onChange().subscribe(this,
this.update)};
TradingView.UndoRedoWidget.prototype.update=function(){var a=TradingView.UndoHistory.undoStack(),b=TradingView.UndoHistory.redoStack();a.isEmpty()?(this._undo.addClass("disabled"),this._undo.attr("title",null)):(this._undo.removeClass("disabled"),this._undo.attr("title",$.t("Undo {0}").format(a.head().text()||"")));b.isEmpty()?(this._redo.addClass("disabled"),this._redo.attr("title",null)):(this._redo.removeClass("disabled"),this._redo.attr("title",$.t("Redo {0}").format(b.head().text()||"")))};
TradingView.UndoRedoWidget.prototype.undo=function(){this._undo.hasClass("disabled")||(TradingView.trackEvent("GUI","Undo"),TradingView.UndoHistory.undo())};TradingView.UndoRedoWidget.prototype.redo=function(){this._redo.hasClass("disabled")||(TradingView.trackEvent("GUI","Redo"),TradingView.UndoHistory.redo())};TradingView.UndoRedoWidget.prototype.undoElement=function(){return this._undo};TradingView.UndoRedoWidget.prototype.redoElement=function(){return this._redo};TradingView.PaneWidget=function(a,b,c){this._chart=a;this.dialog=a.dialog;this._state=b;this._disableContextMenu=!!c;this.lhsPriceAxisWidget=new TradingView.PriceAxisWidget(this,TradingView.PriceAxisWidget.LHS);this.rhsPriceAxisWidget=new TradingView.PriceAxisWidget(this,TradingView.PriceAxisWidget.RHS);this.jqPane=$(document.createElement("td"));this.jqPane.addClass("chart-markup-table");this.jqPane.addClass("pane");this._dv=$("<div>");this._dv.css("width","100%");this._dv.css("height","100%");this._dv.css("position",
"relative");this._dv.css("overflow","hidden");this._dv.appendTo(this.jqPane);this.canvas=TradingView.addCanvasTo(this._dv,new TradingView.Size(16,16));$(this.canvas).css("position","absolute");$(this.canvas).css("z-order","2");$(this.canvas).css("left",0);$(this.canvas).css("top",0);this.ctx=this.canvas.getContext("2d");this.top_canvas=TradingView.addCanvasTo(this._dv,new TradingView.Size(16,16));$(this.top_canvas).css("position","absolute");$(this.top_canvas).css("z-order","1");$(this.top_canvas).css("left",
0);$(this.top_canvas).css("top",0);this.top_ctx=this.top_canvas.getContext("2d");this._zoomSelector=$("<div>");this._zoomSelector.addClass("zoom-selector");this._zoomSelector.css("display","none");this._zoomSelector.appendTo(this._dv);this._tooltipSelector=$("<div>");this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden");this._tooltipSelector.appendTo(this._dv);this.legendWidget=new TradingView.LegendWidget(this,this._chart.model(),this._chart._jqMainDiv);this.jqRow=$(document.createElement("tr"));
this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow);this.jqPane.appendTo(this.jqRow);this.legendWidget.jqTable.appendTo(this._chart._jqMainDiv);this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow);this.setCursorForTool();TradingView.setMouseEventHandler($(this.top_canvas),this,!0);b&&b!==this._chart.model().panes().item(0)&&!this._chart.readOnly()&&(this.paneControls=new TradingView.PaneControls(this,this._chart.model(),this._chart._jqMainDiv));this.updateScalesVisibility();this.actions=[];this.readonlyActions=
[];this._onKeyUpListener=this._onKeyUpListener.bind(this);this._lineCancelledCallback=this._lineCancelledCallback.bind(this);$(window).on("keyup.panewidget",this._onKeyUpListener);this._chart.withModel(this,this._lineCancelledCallback);this._overlays={};this._contextMenuY=this._contextMenuX=0;this._lockDrawingsProperty=TradingView.drawingState.lockDrawings()};
TradingView.PaneWidget.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener);this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)});for(var a in this)delete this[a]};
TradingView.PaneWidget.prototype._onKeyUpListener=function(a){27==a.keyCode&&(this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._chart.model().model().crossHairSource().clearMeasure(),this.setCursorForTool(),this._hideTooltip())};TradingView.PaneWidget.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(a){}};TradingView.PaneWidget.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()};
TradingView.PaneWidget.prototype.priceAxisByCanvas=function(a){return a===this.lhsPriceAxisWidget.canvas||a===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:a===this.rhsPriceAxisWidget.canvas||a===this.rhsPriceAxisWidget.canvas?this.rhsPriceAxisWidget:null};TradingView.PaneWidget.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value());this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())};
TradingView.PaneWidget.prototype.chart=function(){return this._chart};TradingView.PaneWidget.prototype.state=function(){return this._state};TradingView.PaneWidget.prototype.stretchFactor=function(){return this._state?this._state._stretchFactor:Pane.DEFAULT_STRETCH_FACTOR};TradingView.PaneWidget.prototype.setStretchFactor=function(a){this._state&&(this._state._stretchFactor=a)};TradingView.PaneWidget.prototype.mouseEnterEvent=function(a){if(a=this._chart.model())a.crossHairSource().visible=!0};
TradingView.PaneWidget.prototype.isLineTool=function(a){a=TradingView[a];return"function"===typeof a&&a.prototype instanceof LineDataSource};TradingView.PaneWidget.prototype.hideInplaceEditor=function(){return this._inplaceEditor?(this._inplaceEditor.remove(),this._inplaceEditor=void 0,!0):!1};
TradingView.PaneWidget.prototype._processMouseMoveWhileZoom=function(a){this._state.defaultPriceScale().coordinateToPrice(a.localY);var b=Math.floor(this._chart.model().timeScale().coordinateToIndex(a.localX)),b=this._chart.model().timeScale().indexToCoordinate(b)-0.5*this._chart.model().timeScale().barSpacing(),c=a.localY,d=Math.abs(b-this._firstZoomPoint.x),c=Math.abs(c-this._firstZoomPoint.y);b<this._firstZoomPoint.x?this._zoomSelector.css("left",b):this._zoomSelector.css("left",this._firstZoomPoint.x);
a.localY<this._firstZoomPoint.y?this._zoomSelector.css("top",a.localY):this._zoomSelector.css("top",this._firstZoomPoint.y);this._zoomSelector.width(d);this._zoomSelector.height(c)};
TradingView.PaneWidget.prototype._finishZoom=function(a){var b=this._state.defaultPriceScale().coordinateToPrice(a.localY);a=Math.round(this._chart.model().timeScale().coordinateToIndex(a.localX));a!==this._firstZoomPoint.index&&this._chart.model().zoomToViewport(this._firstZoomPoint.index,a,this._firstZoomPoint.price,b,this.state());this._zoomSelector.css("display","none");this._firstZoomPoint=null;TradingView.drawingState.resetToCursor()};
TradingView.PaneWidget.EvironmentState=function(a){a.shiftKey&&(this.shift=!0);a.ctrlKey&&(this.control=!0)};
TradingView.PaneWidget.prototype.mouseDownEvent=function(a){$("input").blur();$(window).focus();var b=this._chart.model(),c=new TradingView.PaneWidget.EvironmentState(a);this.hideInplaceEditor();TradingView.supportTouch()&&(this._skipFirstMove=!0);var d=this._state.defaultPriceScale();if(!d.isEmpty()&&!b.timeScale().isEmpty()){var e=b.crossHairSource();TradingView.supportTouch()&&"LineToolBrush"!=TradingView.drawingState.tool.value()||b.setCurrentPosition(a.localX,a.localY,this._state);var d=e.price,
f=e.index;e.startMeasurePoint()&&e.endMeasurePoint()&&e.clearMeasure();c.shift&&TradingView.drawingState.toolIsCursor(TradingView.drawingState.tool.value())&&TradingView.drawingState.tool.setValue("measure");if("measure"!==TradingView.drawingState.tool.value()||e.startMeasurePoint())if(e.startMeasurePoint()&&!e.endMeasurePoint())e.finishMeasure({price:d,index:f,x:a.localX,y:a.localY}),TradingView.drawingState.resetToCursor();else if(this._firstZoomPoint)this._finishZoom(a);else if("zoom"===TradingView.drawingState.tool.value())b=
b.timeScale().indexToCoordinate(f)-0.5*b.timeScale().barSpacing(),this._firstZoomPoint={price:d,index:f,x:b,y:a.localY},this._zoomSelector.css("display","block"),this._zoomSelector.css("left",b),this._zoomSelector.css("top",a.localY),this._zoomSelector.width(0),this._zoomSelector.height(0);else if(b.createUndoCheckpoint(),this.isLineTool(TradingView.drawingState.tool.value())||b.lineBeingCreated())this._mouseDownEventForLineTool(a,c,f,d);else{e=this.dataSourceAtPoint(a.localX,a.localY);if(!this._chart.readOnly()){e&&
b.setSelectedSource(e.source,e.hittest&&e.hittest.data());if(e.source&&"eraser"===TradingView.drawingState.tool.value()&&(isInherited(e.source.constructor,LineDataSource)||isInherited(e.source.constructor,TradingView.Study))){f=e.hittest.eraseMarker();a.ctrlKey&&void 0!==f&&e.source.processErase?e.source.processErase(b,f):b.removeSource(e.source);return}d=e.source&&isInherited(e.source.constructor,LineDataSource)&&e.source.isLocked();if(!this._lockDrawingsProperty.value()&&!d){if(e.source&&e.source.userEditEnabled&&
!e.source.userEditEnabled())return;if(e.hittest&&e.hittest.result()===HitTestResult.CHANGEPOINT){d=e.source.priceScale();d=d.coordinateToPrice(a.localY);b.startChangingLinetool(e.source,{index:f,price:d},e.hittest.data(),c);this._updateTooltip(a.localX,a.localY);return}if(e.hittest&&e.hittest.result()==HitTestResult.MOVEPOINT&&b.selectedSource()==e.source){e.source.isFixed&&e.source.isFixed()?b.startMovingSource(e.source,new MathEx.Point(a.localX,a.localY)):(d=e.source.priceScale(),d=d.coordinateToPrice(a.localY),
b.startMovingSource(e.source,{index:f,price:d}));return}}if(e.source&&isInherited(e.source.constructor,PriceDataSource)){this._chart.draggingSource=e.source;return}}e.hittest&&e.hittest.result()==HitTestResult.REGULAR||(this._processing=!0)}else e.startMeasuring({price:d,index:f,x:a.localX,y:a.localY},this._state)}};
TradingView.PaneWidget.prototype._finishTool=function(a){var b=this._chart.model(),c=TradingView.drawingState.tool.value();TradingView.drawingState.resetToCursor();this._hideTooltip();b.setSelectedSource(a);this._chart.isTextTool(c)&&(c=b.createUndoCheckpoint(),a=new EditObjectDialog(a,b,c),a.show(),a.focusOnText())};
TradingView.PaneWidget.prototype._mouseDownEventForLineTool=function(a,b,c,d){var e=this._chart.model(),f=!1,g=null,h=a.localX,k=a.localY,m=this._chart.model().model().crossHairSource(),n=TradingView.drawingState.tool.value();TradingView.drawingState.hideAllDrawings().setValue(!1);TradingView.drawingState.lockDrawings().setValue(!1);TradingView.supportTouch()&&this.isLineTool(n)&&"LineToolBrush"!==n&&!e.lineBeingCreated()&&(this._startTouchPoint=new MathEx.Point(h,k),this._initCrossHairPosition=m.currentPoint(),
this._skipFirstMove=!0);if(!e.lineBeingCreated()||e.lineBeingCreated()instanceof TradingView.LineToolBrush)TradingView.supportTouch()&&"LineToolBrush"!=n||(g=e.createLineTool(this._state,{index:c,price:d},n),e.lineBeingCreated()||(f=!0));else if(TradingView.supportTouch()){if(this._skipFirstMove=!0,!this._startTouchPoint){this._startTouchPoint=new MathEx.Point(h,k);d=e.lineBeingCreated().points();d=d.item(d.size()-1);a=e.timeScale().indexToCoordinate(d.index);d=d.price;b=e.lineBeingCreated().priceScale();
b.isPercent()&&(e=e.lineBeingCreated().ownerSource().firstValue(),d=b.priceRange().convertToPercent(d,e));e=b.priceToCoordinate(d);this._lastDrawingPoint=new MathEx.Point(a,e);return}}else g=e.lineBeingCreated(),f=e.paneForSource(g),f!==this._state&&(d=this._dv.offset(),h=a.localX+d.left,k=a.localY+d.top,d=this._chart.paneByState(f)._dv.offset(),h-=d.left,k-=d.top,d=g.priceScale().coordinateToPrice(k),c=Math.round(e.timeScale().coordinateToIndex(h))),f=e.coninueCreatingLine({index:c,price:d},b);e.setSelectedSource(g);
f?this._finishTool(g):TradingView.supportTouch()&&"LineToolBrush"!=n||this._updateTooltip(a.localX,a.localY)};TradingView.PaneWidget.prototype._equalsCursorCache=function(a,b){return TradingView.drawingState.toolIsCursor(a.tool)?a.tool===b.tool&&a.theme===b.theme&&a.crosshair===b.crosshair:a.tool===b.tool&&a.theme===b.theme};
TradingView.PaneWidget.prototype._setCursor=function(a){this._cursorCache&&this._equalsCursorCache(this._cursorCache,a)||(this._cursorCache=a,TradingView.drawingState.toolIsCursor(a.tool)?this.jqPane.css("cursor",a.crosshair):this.jqPane.css("cursor",cursorCss(a.state.name,a.state.hotspot,a.theme)))};
TradingView.PaneWidget.prototype.setCursorForTool=function(a,b){var c={_default:{name:"cursor_cross",hotspot:"11 11"},zoom:{name:"zoom",hotspot:"5 5"},pointer:{name:"cursor_pointinghand",hotspot:"13 7"},dragger:{name:"cursor_closed_hand",hotspot:"8 8"}},d=TradingView.drawingState.tool.value();TradingView.drawingState.toolIsCursor(d)&&(this._chart.draggingSource||this._isScrolling||this._chart.model()&&this._chart.model().sourceBeingMoved()?d="dragger":a&&(d="pointer"));this._chart.model()&&this._chart.model().lineBeingEdited()?
d=this._chart.model().lineBeingEdited()._constructor:b==HitTestResult.CHANGEPOINT&&(d=a._constructor);var e=c._default;d in c&&(e=c[d]);this._setCursor({tool:d,theme:"light",state:e,crosshair:this.defaultPaneCursor("light")})};TradingView.PaneWidget.prototype.setDragToAnotherPaneCursor=function(){this._setCursor({tool:"dragger",theme:"light",state:{name:"cursor_closed_hand_move",hotspot:"8 8"},crosshair:this.defaultPaneCursor("light")})};
TradingView.PaneWidget.prototype.defaultPaneCursor=function(a){var b={cursor:{name:"cursor_cross",hotspot:"11 11"},dot:{name:"cursor_dot",hotspot:"11 11"},crosshair:{name:"cursor_cross",hotspot:"11 11"},eraser:{name:"cursor_eraser",hotspot:"5 5"}},c=b[TradingView.drawingState.tool.value()];c||(c=b[TradingView.drawingState.cursorTool.value()]);return c?cursorCss(c.name,c.hotspot,a):"default"};TradingView.PaneWidget.prototype.gestureStartEvent=function(a){this._prev_pinch_scale=1;this._pinching=!0};
TradingView.PaneWidget.prototype.gestureChangeEvent=function(a){var b=(a.originalEvent.pageX||a.originalEvent.offsetX)-5,c=this._chart._paneWidgets[0].lhsPriceAxisWidget.size.w,d=this._chart.model().timeScale().width();c&&(b=Math.max(0,b-c));b=Math.min(b,d);b=2*(b/d-0.5);c=5*(a.scale-this._prev_pinch_scale);0<c?this._chart.model().zoomIn(b,c):this._chart.model().zoomOut(b,-c);this._prev_pinch_scale=a.scale};TradingView.PaneWidget.prototype.gestureEndEvent=function(a){this._pinching=!1};
TradingView.PaneWidget.prototype.mouseMoveEvent=function(a){var b=this._chart.model();if(b){var c=a.localX,d=a.localY,e=new TradingView.PaneWidget.EvironmentState(a);if(this._firstZoomPoint)this._processMouseMoveWhileZoom(a);else{if(!(this._chart.readOnly()||this._editDialog&&this._editDialog.isVisible())){this.setCursorForTool();var f=TradingView.drawingState.tool.value();if(!this._processing&&(TradingView.drawingState.toolIsCursor(f)||"eraser"===f)){var g=this.dataSourceAtPoint(a.localX,a.localY);
this.setCursorForTool(g.source,g.hittest?g.hittest.result():null);g?!g.source||"eraser"===f&&g.source.constructor===TradingView.Series?b.setHoveredSource(null):b.setHoveredSource(g.source,g.hittest.data()):b.setHoveredSource(null)}}this._chart.readOnly()&&(g=this.dataSourceAtPoint(a.localX,a.localY),b.hoveredSource(),null!==g.source?b.setHoveredSource(g.source,g.hittest.data()):b.setHoveredSource(null,null));if(this._chart.model().lineBeingCreated()&&(a=this._chart.model().lineBeingCreated(),a=this._chart.model().paneForSource(a),
a!==this._state)){e=this._dv.offset();c+=e.left;d+=e.top;e=this._chart.paneByState(a)._dv.offset();c-=e.left;d-=e.top;b.setCurrentPosition(c,d,a);return}f=TradingView.drawingState.tool.value();TradingView.supportTouch()&&this.isLineTool(f)||(b.setCurrentPosition(c,d,this._state,e),this._updateTooltip(c,d))}}};
TradingView.PaneWidget.prototype.pressedMouseMoveEvent=function(a){if(!this._pinching){this._skipFirstMove?(delete this._skipFirstMove,delete this._touchMove):this._touchMove=!0;var b=new TradingView.PaneWidget.EvironmentState(a),c=this._chart.model(),d=a.localX,e=a.localY;if(this._firstZoomPoint)this._processMouseMoveWhileZoom(a),this._firstZoomPoint.draggingMode=!0;else{var f=TradingView.drawingState.tool.value();if(TradingView.supportTouch()&&this._startTouchPoint&&this.isLineTool(f)&&"LineToolBrush"!==
f&&!c.lineBeingCreated())this._chart.model().model().crossHairSource(),c=this._initCrossHairPosition,a=(new MathEx.Point(d,e)).substract(this._startTouchPoint),c=c.add(a),this._chart.model().setCurrentPosition(c.x,c.y,this._state),this._updateTooltip(c.x,c.y);else if(!TradingView.supportTouch()||!c.lineBeingCreated()||c.lineBeingCreated()instanceof TradingView.LineToolBrush){if(c.setCurrentPosition(d,e,this._state,b),this._updateTooltip(d,e),currentTool=TradingView.drawingState.tool.value(),!this.isLineTool(currentTool)||
"LineToolBrush"===f)if(0===a.button||Modernizr.touch)if("LineToolBrush"===currentTool)f=this._state.defaultPriceScale(),f.isEmpty()||(f=f.coordinateToPrice(a.localY),b=Math.round(this._chart.model().timeScale().coordinateToIndex(a.localX)),this._chart.model().coninueCreatingLine({index:b,price:f}));else{if(this._chart.draggingSource){var f=a.target,g=this._chart.paneByCanvas(f);g&&(g!==this?g.setDragToAnotherPaneCursor():g.setCursorForTool());(g=this._chart.priceAxisByCanvas(f))&&g.jqCell.css("cursor",
cursorCss("cursor_closed_hand","8 8"));(f=this._chart.timeAxisByCanvas(f))&&f.jqCell.css("cursor",cursorCss("cursor_closed_hand_move","8 8"))}c.timeScale().isEmpty()||(c.lineBeingEdited()?(c.changeLinePoint({x:d,y:e},b),this._updateTooltip(d,e),this.setCursorForTool()):c.sourceBeingMoved()?(f=c.sourceBeingMoved().priceScale(),f.isEmpty()||(b=this._chart.model().timeScale().coordinateToIndex(a.localX),f=f.coordinateToPrice(a.localY),a=c.sourceBeingMoved(),this.setCursorForTool(),isInherited(a.constructor,
LineDataSource)&&a.isFixed()?c.moveSource(new MathEx.Point(d,e)):c.moveSource({index:b,price:f}))):(f=this._state.defaultPriceScale(),this._startScrollingPos||(this._startScrollingPos={x:a.clientX,y:a.clientY}),!this._startScrollingPos||this._startScrollingPos.x===a.clientX&&this._startScrollingPos.y===a.clientY||this._isScrolling||(c.beginUndoMacro("scroll"),f.isEmpty()||c.startScrollPrice(this._state,f,a.localY),c.startScrollTime(a.localX),this._isScrolling=!0,this.setCursorForTool(),TradingView.trackEvent("GUI",
"Scrolling by pane content dragging")),this._isScrolling&&(f.isEmpty()||c.scrollPriceTo(this._state,f,a.localY),c.scrollTimeTo(a.localX))))}}else this._startTouchPoint&&(e=c.lineBeingCreated(),d=this._lastDrawingPoint.x+(a.localX-this._startTouchPoint.x),a=this._lastDrawingPoint.y+(a.localY-this._startTouchPoint.y),e=this._chart.model().paneForSource(e),c.setCurrentPosition(d,a,e),this._updateTooltip(d,a))}}};
TradingView.PaneWidget.prototype.mouseUpEvent=function(a){var b=this._chart.model(),c=this._touchMove;delete this._touchMove;var d=TradingView.drawingState.tool.value();if(TradingView.supportTouch()&&!c&&"LineToolBrush"!==d&&this.isLineTool(d)&&!b.lineBeingCreated()){var e=b.crossHairSource().currentPoint(),c=this._state.defaultPriceScale(),c=c.coordinateToPrice(e.y),f=Math.round(b.timeScale().coordinateToIndex(e.x)),f=b.createLineTool(this._state,{index:f,price:c},d);b.setSelectedSource(f);b.lineBeingCreated()||
this._finishTool(f);this._updateTooltip(e.x,e.y);delete this._startTouchPoint}else if(!b.lineBeingCreated()||b.lineBeingCreated()instanceof TradingView.LineToolBrush||!this._startTouchPoint)if(this._firstZoomPoint&&this._firstZoomPoint.draggingMode)this._finishZoom(a);else{if(0===a.button||TradingView.supportTouch()){this._processing=!1;b=this._chart.model();if(b.lineBeingEdited()){b.endChangingLinetool();this._hideTooltip();return}if("LineToolBrush"===d){b.lineBeingCreated().finish();c=this._state.defaultPriceScale();
if(c.isEmpty())return;c=c.coordinateToPrice(a.localY);f=Math.round(this._chart.model().timeScale().coordinateToIndex(a.localX));this._chart.model().coninueCreatingLine({index:f,price:c});return}if(b.sourceBeingMoved()){b.endMovingSource();this._hideTooltip();return}f=this._isScrolling&&TradingView.UndoHistory.undoStack().head()instanceof UndoMacroCommand;if(this._isScrolling){c=this._state.defaultPriceScale();b.endScrollPrice(this._state,c);var g=this,h=function(){b.endScrollTime();b.endUndoMacro();
g._startScrollingPos=void 0;g._isScrolling=!1;g.setCursorForTool()};if(TradingView.supportTouch()){var c=b.timeScale().m_scrollStartPoint,k=0.05*(a.localX-c),m=null,n=function(c){null===m&&(m=c);c=0.01*Math.min(100,3*(c-m));c=Math.sqrt(c);b.scrollTimeTo(a.localX+k*c);1<=c?h():requestAnimationFrame(n)};requestAnimationFrame(n)}else h()}if(this._chart.draggingSource){d=a.target;(e=this._chart.paneByCanvas(d))&&e!=this&&(c=e._state.findSuitableScale(this._chart.draggingSource),f&&(f=!1,TradingView.UndoHistory.undo()),
this._chart.model().move(this._chart.draggingSource,e._state,c));if(c=this._chart.priceAxisByCanvas(d))e=c.pane,c=c._isLeft?e._state.leftPriceScale():e._state.rightPriceScale(),f&&(f=!1,TradingView.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,e._state,c);if(c=this._chart.timeAxisByCanvas(d))f&&(f=!1,TradingView.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,null,null),c.jqCell.css("cursor","");this._chart.draggingSource=null;f=this.dataSourceAtPoint(a.localX,
a.localY);this.setCursorForTool(f.source,f.hittest||null)}}delete this._touchMove}else{d=!1;delete this._startTouchPoint;if(!c){f=b.lineBeingCreated();d=f.points().last();c=d.price;e=f.priceScale();if(e.isPercent())var q=b.lineBeingCreated().ownerSource().firstValue(),c=e.priceRange().convertToPercent(c,q);d=b.coninueCreatingLine({index:d.index,price:c},{});delete this._lastDrawingPoint}d&&this._finishTool(f)}};
TradingView.PaneWidget.prototype.mouseLeaveEvent=function(a){(a=this._chart.model())&&(TradingView.isMobile.any()||a.model().clearCurrentPosition())};TradingView.PaneWidget.prototype.mouseClickEvent=function(a){if(this._chart.model().hoveredSource()instanceof BarsMarksContainer)this._chart.model().hoveredSource().onClicked()};
TradingView.PaneWidget.prototype.showEditDialogForSource=function(a){this.chart().onWidget()||a.userEditEnabled&&!a.userEditEnabled()||(this._editDialog=new EditObjectDialog(a,this._chart.model()),this._editDialog.show())};
TradingView.PaneWidget.prototype.mouseDoubleClickEvent=function(a){a=this.dataSourceAtPoint(a.localX,a.localY);this._chart.readOnly()||!a||!a.source||a.source instanceof BarsMarksContainer||this.isLineTool(TradingView.drawingState.tool.value())||(a=a.source,a._metaInfo&&"Sessions@tv-basicstudies"==a._metaInfo.id&&(a=this._chart.model().mainSeries()),this.showEditDialogForSource(a))};
TradingView.PaneWidget.prototype.showContextMenuForSource=function(a,b){a.hasContextMenu()&&(this._chart.model().setSelectedSource(a),a.constructor===TradingView.Series?this._seriesContextMenu(a).show(b):isInherited(a.constructor,TradingView.ESDStudyBase)?this._studyEsdContextMenu(a).show(b):isInherited(a.constructor,TradingView.Study)?this._studyContextMenu(a).show(b):isInherited(a.constructor,PublishedChartsTimeline)?this._publishedChartsContextMenu(a).show(b):isInherited(a.constructor,LineDataSource)&&
this._lineContextMenu(a).show(b))};
TradingView.PaneWidget.prototype.contextMenuEvent=function(a,b){if(this._chart.model().crossHairSource().startMeasurePoint())this._chart.model().crossHairSource().clearMeasure();else if(!(this._pinching||this._disableContextMenu||this.chart().readOnly()||(this._firstZoomPoint&&(this._zoomSelector.css("display","none"),delete this._firstZoomPoint),this._chart.model().mainSeries().createSessStudy(),this._chart.updateActions(),this.hideInplaceEditor())))if(TradingView.drawingState.toolIsCursor(TradingView.drawingState.tool.value())){this._contextMenuX=a.localX;
this._contextMenuY=a.localY;var c=this.dataSourceAtPoint(a.localX,a.localY),c=c?c.source:null;null===c?(this._contextMenu().show(a),this._chart.model().setSelectedSource(null)):this.showContextMenuForSource(c,a);this.paint()}else TradingView.isMobile.any()||(TradingView.drawingState.resetToCursor(!0),this.setCursorForTool(),this._hideTooltip(),this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine())};
TradingView.PaneWidget.prototype._contextMenu=function(){this.actions.length||this._initActions();return ContextMenu.createMenu(this.actions)};
TradingView.PaneWidget.prototype._initActions=function(){var a=this._chart.actions();this.actions=[];this.actions.push(a.chartReset);this.actions.push(a.symbolSearch);TradingView.isRunningChartingLibrary||this.actions.push(a.addToWatchlist);this.actions.push(new ActionSeparator);this.actions.push(a.paneObjectTree);this.actions.push(a.insertIndicator);TradingView.isMobile.any()||TradingView.isRunningChartingLibrary||this.actions.push(a.scriptEditor);this.actions.push(a.compareOrAdd);TradingView.isRunningChartingLibrary||
this.actions.push(a.applyStudyTemplate);this.actions.push(a.paneRemoveAllStudies);this.actions.push(a.paneRemoveAllDrawingTools);this.actions.push(a.lockDrawingsAction);this.actions.push(a.hideAllDrawingsAction);this.actions.push(new ActionSeparator);this.actions.push(a.applyTimeZone);TradingView.isRunningChartingLibrary||(this.actions.push(a.sessionBreaks),this.actions.push(a.extendedHours));this.actions.push(new ActionSeparator);TradingView.isRunningChartingLibrary||this.actions.push(a.applyColorTheme);
this.actions.push(a.chartProperties);pro.hasPackage("mtp-mtpredictor")&&(this.actions.push(new ActionSeparator),this.actions.push(this._createMTPredictorActions()))};
TradingView.PaneWidget.prototype._seriesContextMenu=function(a){var b=this._chart.actions(),c=a.properties().visible.value(),d=null;if(this._chart.readOnly())a=[c?b.seriesHide:this.createActionShow(a),new ActionSeparator,this.createActionShowLastValueLabels(a),this.createActionShowCountdown(a),new ActionSeparator,this.createActionScaleLeft(a),this.createActionScaleRight(a),this.createActionNoScale(a)],TradingView.isRunningChartingLibrary&&a.splice(3,1),d=ContextMenu.createMenu(a);else{d=this._mergeContentMenuItems(a);
c=[b.compare,c?b.seriesHide:this.createActionShow(a),this.createVisualOrderAction(a),new ActionSeparator,this.createActionShowLastValueLabels(a),this.createActionShowCountdown(a),new ActionSeparator];TradingView.isRunningChartingLibrary&&c.splice(5,1);this.chart().onWidget()||c.unshift(b.format);if(b=this.createActionLockScale(a))c.push(b),c.push(new ActionSeparator);if(0<d.length){for(b=0;b<d.length;b++)c.push(d[b]);c.push(new ActionSeparator)}c.push(this.createActionScaleLeft(a));c.push(this.createActionScaleRight(a));
c.push(this.createActionNoScale(a));pro.hasPackage("mtp-mtpredictor")&&(c.push(new ActionSeparator),c.push(this._createMTPredictorActions()));d=ContextMenu.createMenu(c)}return d};
TradingView.PaneWidget.prototype._createMTPredictorActions=function(){var a=this,b=function(b,d,e){b=new Action({text:b});b.callbacks().subscribe(a,function(){var a=this._chart.model(),b=a.timeScale(),c=this._state.defaultPriceScale();b.isEmpty()||c.isEmpty()||(e?(c=c.coordinateToPrice(this._contextMenuY),b=Math.round(b.coordinateToIndex(this._contextMenuX)),a.createLineTool(this._state,{index:b,price:c},d)):TradingView.drawingState.tool.setValue(d))});return b};return new Action({text:"MTPredictor",
subActions:[b("Apply Manual Risk/Reward","LineStudyMtpRiskReward",!1),b("Apply Manual Decision Point","LineStudyMtpDecisionPoint",!0),b("Analyze Trade Setup","LineStudyMtpAnalysis",!0),new Action({text:"Apply Elliot Wave",subActions:[b("Apply Elliot Wave Intermediate","LineStudyMtpElliotWaveMain",!0),b("Apply Elliot Wave Major","LineStudyMtpElliotWaveMajor",!0),b("Apply Elliot Wave Minor","LineStudyMtpElliotWaveMinor",!0)]}),new Action({text:"Apply WPT Up Wave",subActions:[b("Up Wave 1 or A","LineStudyMtpUpWave1OrA",
!1),b("Up Wave 2 or B","LineStudyMtpUpWave2OrB",!1),b("Up Wave C","LineStudyMtpUpWaveC",!1),b("Up Wave 3","LineStudyMtpUpWave3",!1),b("Up Wave 4","LineStudyMtpUpWave4",!1),b("Up Wave 5","LineStudyMtpUpWave5",!1)]}),new Action({text:"Apply WPT Down Wave",subActions:[b("Down Wave 1 or A","LineStudyMtpDownWave1OrA",!1),b("Down Wave 2 or B","LineStudyMtpDownWave2OrB",!1),b("Down Wave C","LineStudyMtpDownWaveC",!1),b("Down Wave 3","LineStudyMtpDownWave3",!1),b("Down Wave 4","LineStudyMtpDownWave4",!1),
b("Down Wave 5","LineStudyMtpDownWave5",!1)]})]})};TradingView.PaneWidget.prototype.createEarningsShow=function(a){var b=this._chart.model().mainSeries().properties().esdShowEarnings;a=new Action({checkable:!0,text:"Show Earnings",enabled:!0,checked:b.value()});a.callbacks().subscribe(this,function(a){this._chart.model().beginUndoMacro("Show Earnings");this._chart.model().setProperty(b,a.checked,"Show Earnings");this._chart.model().endUndoMacro()});return a};
TradingView.PaneWidget.prototype.createDividendsShow=function(a){var b=this._chart.model().mainSeries().properties().esdShowDividends;a=new Action({checkable:!0,text:"Show Dividends",enabled:!0,checked:b.value()});a.callbacks().subscribe(this,function(a){this._chart.model().beginUndoMacro("Show Dividends");this._chart.model().setProperty(b,a.checked,"Show Dividends");this._chart.model().endUndoMacro()});return a};
TradingView.PaneWidget.prototype.createSplitsShow=function(a){var b=this._chart.model().mainSeries().properties().esdShowSplits;a=new Action({checkable:!0,text:"Show Splits",enabled:!0,checked:b.value()});a.callbacks().subscribe(this,function(a){this._chart.model().beginUndoMacro("Show Splits");this._chart.model().setProperty(b,a.checked,"Show Splits");this._chart.model().endUndoMacro()});return a};
TradingView.PaneWidget.prototype._studyEsdContextMenu=function(a){var b=[];this._chart.readOnly()||(b.push(this.createDividendsShow(a)),b.push(this.createSplitsShow(a)),b.push(this.createEarningsShow(a)));return ContextMenu.createMenu(b)};
TradingView.PaneWidget.prototype._studyContextMenu=function(a){var b=this._chart.actions(),c=a.properties().visible.value(),d=[],e=null;if(!a.userEditEnabled())return e=ContextMenu.createMenu(d);if(a.properties().linkedToSeries&&a.properties().linkedToSeries.value())if(this._chart.readOnly())d.push(c?b.studyHide:this.createActionShow(a));else{d.push(b.format);d.push(c?b.studyHide:this.createActionShow(a));d.push(this.createVisualOrderAction(a));c=a instanceof TradingView.study_PivotPointsStandard;
if(0<a.properties().inputs.childCount()||c)d.push(new ActionSeparator),0<a.properties().inputs.childCount()&&d.push(this.createActionShowStudyArguments(a)),c&&d.push(this.createActionShowLastValueLabels(a));d.push(new ActionSeparator);d.push(b.studyRemove)}else this._chart.readOnly()?d=[c?b.studyHide:this.createActionShow(a),new ActionSeparator,this.createActionShowLastValueLabels(a),this.createActionShowStudyArguments(a),new ActionSeparator,this.createActionScaleLeft(a),this.createActionScaleRight(a),
this.createActionNoScale(a)]:(e=[],d=a.metaInfo(),d.TVScriptSourceCode&&d.scriptIdPart&&(e=[b.viewSourceCode]),d=[],d=d.concat([b.format]),d=d.concat(e),d=d.concat([c?b.studyHide:this.createActionShow(a),this.createVisualOrderAction(a),new ActionSeparator,this.createActionShowLastValueLabels(a),this.createActionShowStudyArguments(a),new ActionSeparator]),c=this._mergeContentMenuItems(a),c.length&&c.push(new ActionSeparator),d=d.concat(c),d.push(this.createActionScaleLeft(a)),d.push(this.createActionScaleRight(a)),
d.push(this.createActionNoScale(a)),d.push(new ActionSeparator),d.push(b.studyRemove));return e=ContextMenu.createMenu(d)};
TradingView.PaneWidget.prototype.createLineToolTemplateAction=function(a){var b=a.properties(),c=window.lineToolPropertiesToolbar.templatesList,d=new Action({text:$.t("Templates")});d.subActions||(d.subActions=[]);var e=d.subActions,f=new Action({text:$.t("Save As...")});f.callbacks().subscribe(this,function(){c.showSaveDialog(a)});e.push(f);f=new Action({text:$.t("Apply Default")});f.callbacks().subscribe(this,function(){b.restoreFactoryDefaults();window.lineToolPropertiesToolbar.onSourceChanged(a)});
e.push(f);var g=$.Deferred();c.templatesLoaded().then(function(){var a=c.getData(),b=[];0!=a.length&&b.push(new ActionSeparator);$.each(a,function(a,d){var e=new Action({text:d});e.callbacks().subscribe(this,function(){c.loadTemplate(d)});e.deleteButton={action:function(a){return function(){var b=this.getTopLevelMenu();b&&b.hide();c.deleteAction(a);return!0}}(e.text)};b.push(e)});g.resolve(b)});f=new ActionPlaceholder(g);e.push(f);return d};
TradingView.PaneWidget.prototype._publishedChartsContextMenu=function(a){a=this._chart.actions();var b=[];b.push(a.lineHide);return ContextMenu.createMenu(b)};
TradingView.PaneWidget.prototype._lineContextMenu=function(a){var b=this._chart.actions(),c=[];if(this._chart.readOnly())c.push(b.lineHide);else if(a.userEditEnabled()){PropertyPagesFactory.hasStylesPropertyPage(a,this._chart.model())&&c.push(b.format);c.push(b.lineHide);TradingView.isRunningChartingLibrary||c.push(this.createLineToolTemplateAction(a));c.push(this.createVisualOrderAction(a));c.push(new ActionSeparator);c.push(b.lineRemove);if(a.properties().clonable){c.push(new ActionSeparator);var d=
new Action({text:$.t("Clone"),callbackContext:{target:a}});d.callbacks().subscribe(this,TradingView.PaneWidget.prototype.cloneLineTool.bind(this,a));c.push(d)}if(a.additionalActions)for(c.push(new ActionSeparator),b=a.additionalActions(this._chart.model()),d=0;d<b.length;d++)c.push(b[d])}this._state.dataSources();b=new List;if(1<b.size()){for(var e=[],d=0;d<b.size();d++){var f=b.item(d),f=new Action({checked:f===a.ownerSource(),checkable:!0,text:f.title(),callbackContext:{target:a,owner:f}});f.callbacks().subscribe(null,
this._lineContextMenu._actionCallback);e.push(f)}a=new Action({subActions:e,text:$.t("Link To")});c.push(new ActionSeparator);c.push(a)}return ContextMenu.createMenu(c)};
TradingView.PaneWidget.prototype._lineContextMenu._actionCallback=function(a){a=a.callbackContext();var b=[],c=a.target.priceScale();if(c.isPercent())var d=a.target.ownerSource().firstValue();for(var e=a.target.points().toArray(),f=this._chart,g=0;g<e.length;g++){var h=e[g].price;c.isPercent()&&(h=c.priceRange().convertToPercent(h,d));h=c.priceToCoordinate(h);b.push(h)}a.target.setOwnerSource(a.owner);c=a.owner.priceScale();f.model().move(a.target,that._state,c);for(g=0;g<b.length;g++)h=c.coordinateToPrice(b[g]),
d=e[g],d.price=h,a.target.setPoint(g,d);f.model().model().recalculateAllPanes()};TradingView.PaneWidget.prototype.cloneLineTool=function(a){this._chart.model().cloneLineTool(a)};TradingView.PaneWidget.prototype.adjustLegendPosition=function(){var a=this.jqPane.position().left,b=this.jqPane.position().top;TradingView.setAbsolutePos(this.legendWidget.jqTable,new TradingView.Point(a+5,b+5));this.paneControls&&this.paneControls.jqDiv.css({top:b+5,right:this.rhsPriceAxisWidget.size.w+5})};
TradingView.PaneWidget.prototype.setPriceAxisSize=function(a,b){this._priceAxisWidget(a).setSize(b)};TradingView.PaneWidget.prototype.setPriceAxisVisible=function(a,b){this._priceAxisWidget(a).setVisible(b);this._cachedStatus=null};TradingView.PaneWidget.prototype.resetPriceAxisOptimalWidth=function(a){this._priceAxisWidget(a).resetOptimalWidth();this._cachedStatus=null};
TradingView.PaneWidget.prototype.setSize=function(a){this.size&&this.size.equals(a)||(this.size=a,TradingView.setCanvasSize(this.canvas,a),TradingView.setCanvasSize(this.top_canvas,a),this.ctx=this.canvas.getContext("2d"),this.jqPane.width(a.w),this.jqPane.height(a.h),this.adjustLegendPosition(),this._cachedStatus=null,this.legendWidget.updateLayout())};
TradingView.PaneWidget.prototype.dataSourceAtPoint=function(a,b){var c=null,d=null;if(!this._state)return null;for(var e=new List(this._state.hitTestSources()),f=e.size();0<f--;){var g=e.item(f),h=g.paneViews(this._state);if(h){for(var k=h.size();0<k--;){var m=h.item(k).renderer();if(m&&m.hitTest&&(m=m.hitTest(new MathEx.Point(a,b)))){d=m;c=g;break}}if(c)break}}if(this.containsMainSeries())for(e=this._chart.model().barsMarksSources(),f=0;f<e.length;++f)for(g=e[f],h=g.paneViews(),f=0;f<h.size();f++)if(m=
h.item(f).renderer(),k=m.hitTest(new MathEx.Point(a,b))){d=k;c=g;break}null===c&&(c=this.legendWidget.dataSourceAtPoint(a,b));return{source:c,hittest:d}};TradingView.PaneWidget.prototype.update=function(){this.lhsPriceAxisWidget.update();this.rhsPriceAxisWidget.update();this.legendWidget.update()};TradingView.PaneWidget.prototype.drawBackground=function(a,b){clearRect(a,0,0,this.size.w,this.size.h,b)};
TradingView.PaneWidget.prototype.drawGrid=function(a){for(var b=this._chart.model().gridSource().paneViews(this._state),c=0;c<b.size();c++){a.save();var d=b.item(c).renderer();d&&d.draw(a);a.restore()}};TradingView.PaneWidget.prototype.drawWatermark=function(a){for(var b=this._chart.model().watermarkSource().paneViews(this._state),c=0;c<b.size();c++){a.save();var d=b.item(c).renderer();d&&d.draw(a);a.restore()}};
TradingView.PaneWidget.prototype.drawCrossHair=function(a){var b=this._chart.model().crossHairSource();this._drawSource(b,a)};TradingView.PaneWidget.prototype._drawSource=function(a,b){var c=a.paneViews(this._state);if(c)for(var d=0;d<c.size();d++){var e=c.item(d).renderer();e&&(b.save(),e.draw(b),b.restore())}};
TradingView.PaneWidget.prototype._drawSourceBackground=function(a,b){var c=a.paneViews(this._state);if(c)for(var d=0;d<c.size();d++){var e=c.item(d).renderer();e&&e.drawBackground&&(b.save(),e.drawBackground(b),b.restore())}};
TradingView.PaneWidget.prototype.drawActiveLineTool=function(a){for(var b=[this._chart.model().lineBeingCreated(),this._chart.model().sourceBeingMoved(),this._chart.model().lineBeingEdited()],c=0;c<b.length;c++){var d=b[c];d&&this._chart.model().paneForSource(d)===this._state&&this._drawSource(d,a)}};TradingView.PaneWidget.prototype.disableDrawOnTop=function(a){return a&&a.hasOwnProperty("_metaInfo")&&"Volume@tv-basicstudies"===a._metaInfo.id};
TradingView.PaneWidget.prototype.drawSources=function(a){var b=this._state.orderedSources(),c=this._state.model(),d=this._chart.model().hoveredSource(),c=c.crossHairSource(),e=[this._chart.model().lineBeingCreated(),this._chart.model().sourceBeingMoved(),this._chart.model().lineBeingEdited()];this.disableDrawOnTop(d)&&(d=void 0);for(var f=0;f<b.length;f++)this._drawSourceBackground(b[f],a);for(f=0;f<b.length;f++){var g=b[f];g!==c&&g!==d&&-1===e.indexOf(g)&&this._drawSource(g,a)}d&&-1===e.indexOf(d)&&
-1!==b.indexOf(d)&&this._drawSource(d,a)};TradingView.PaneWidget.prototype.recalculatePriceScale=function(){var a=this._state;a.recalculatePriceScale(a.m_rightPriceScale);a.recalculatePriceScale(a.m_leftPriceScale);for(var b=0;b<a.dataSources().size();++b){var c=a.dataSources().item(b);a.isOverlay(c)&&a.recalculatePriceScale(c.priceScale())}};TradingView.PaneWidget.prototype.containsMainSeries=function(){return this._state.containsMainSeries()};
TradingView.PaneWidget.prototype.drawBarsMarks=function(a,b){if(this.containsMainSeries()&&!b){var c=this;this._chart.model().barsMarksSources().map(function(b){c._drawSource(b,a)})}};
TradingView.PaneWidget.prototype._syncOverlays=function(){var a=this._state.orderedSources(),b={},c=this;$.each(a,function(){var a=this.paneViews(c._state);if(a)for(var d=0;d<a.size();d++){var g=a.item(d);g.uid&&(b[g.uid()]=g)}});for(var d in this._overlays)b[d]||(this._dv.remove(this._overlays[d]),this._overlays[d]=void 0);for(d in b)this._overlays[d]||(a=b[d].overlay(),this._dv.append(a),this._overlays[d]=a)};
TradingView.PaneWidget.prototype.paint=function(a,b){if(a&&this._chart.model())if(this.lhsPriceAxisWidget.paint(a),this.rhsPriceAxisWidget.paint(a),a===TradingView.InvalidateMask.FULL_UPDATE&&(this._cachedStatus=null),a===TradingView.InvalidateMask.UPDATE_CURSOR_ONLY)this.top_ctx.clearRect(0,0,this.size.w,this.size.h),this.drawCrossHair(this.top_ctx),this.drawActiveLineTool(this.top_ctx);else{var c=this.ctx;this.top_ctx.clearRect(0,0,this.size.w,this.size.h);this.drawBackground(c,this.backgroundColor());
this._state&&(this.recalculatePriceScale(),this.drawGrid(c),this.drawWatermark(c),this.drawSources(c),this.drawBarsMarks(c,b),this.drawCrossHair(this.top_ctx),this.drawActiveLineTool(this.top_ctx))}};TradingView.PaneWidget.prototype.leftPriceAxisWidget=function(){return this.lhsPriceAxisWidget};TradingView.PaneWidget.prototype.rightPriceAxisWidget=function(){return this.rhsPriceAxisWidget};
TradingView.PaneWidget.prototype._priceAxisWidget=function(a){return TradingView.PriceAxisWidget.isLeft(a)?this.lhsPriceAxisWidget:this.rhsPriceAxisWidget};TradingView.PaneWidget.prototype.statusWidget=function(){return this.legendWidget};TradingView.PaneWidget.prototype.onScaleLeft=function(a){a=a.callbackContext();this._state.leftPriceScale().dataSources().contains(a)||this.chart().model().move(a,this._state,this._state.leftPriceScale())};
TradingView.PaneWidget.prototype.onScaleRight=function(a){a=a.callbackContext();this._state.rightPriceScale().dataSources().contains(a)||this.chart().model().move(a,this._state,this._state.rightPriceScale())};TradingView.PaneWidget.prototype.onNoScale=function(a){a=a.callbackContext();this._state.isOverlay(a)||this.chart().model().move(a,this._state,null)};TradingView.PaneWidget.prototype.onRiskReward=function(a){a.callbackContext()};
TradingView.PaneWidget.prototype.createActionRiskReward=function(a){var b=new Action({checkable:!1,text:"Risk/Reward",enabled:!0});b.setCallbackContext(a);b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onRiskReward);return b};
TradingView.PaneWidget.prototype.createActionScaleLeft=function(a){var b=new Action({checkable:!0,text:$.t("Scale Left"),enabled:!0});b.setCallbackContext(a);b.setChecked(this._state.leftPriceScale().dataSources().contains(a));b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onScaleLeft);return b};
TradingView.PaneWidget.prototype.createActionScaleRight=function(a){var b=new Action({checkable:!0,text:$.t("Scale Right"),enabled:!0});b.setCallbackContext(a);b.setChecked(this._state.rightPriceScale().dataSources().contains(a));b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onScaleRight);return b};
TradingView.PaneWidget.prototype.createActionNoScale=function(a){var b=this._chart.model().paneForSource(a).actionNoScaleIsEnabled(a),b=new Action({checkable:!0,text:$.t("Screen (No Scale)"),enabled:b});b.setCallbackContext(a);b.setChecked(this._state.isOverlay(a));b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onNoScale);return b};
TradingView.PaneWidget.prototype.createActionShowStudyArguments=function(a){var b=new Action({checkable:!0,text:$.t("Show Arguments in Header"),enabled:!0});b._binding=new ActionBinder(b,a.properties().showStudyArguments,this._chart.model(),b.text);b._binding.setValue(a.properties().showStudyArguments.value());return b};
TradingView.PaneWidget.prototype.createActionShowLastValueLabels=function(a){var b=new Action({checkable:!0,text:$.t("Last Value on Price Scale"),enabled:!0});b._binding=new ActionBinder(b,a.properties().showLastValue,this._chart.model(),b.text);b._binding.setValue(a.properties().showLastValue.value());return b};
TradingView.PaneWidget.prototype.createActionShowCountdown=function(a){a=new Action({checkable:!0,text:"Show Countdown",enabled:!0});var b=this._chart.model().mainSeries().properties();a._binding=new ActionBinder(a,b.showCountdown,this._chart.model(),a.text);a._binding.setValue(b.showCountdown.value());return a};
TradingView.PaneWidget.prototype.createActionLockScale=function(a){if(!(a instanceof TradingView.Series))return null;var b=new Action({checkable:a.properties().lockScale.value(),text:$.t("Lock Scale"),enabled:!0});b._binding=new ActionBinder(b,a.properties().lockScale,this._chart.model(),b.text,function(b){this._undoModel.setLockScaleProperty(this._property,b.checked,a,this._undoText)});return b};
TradingView.PaneWidget.prototype.createActionMergeUp=function(a){if(this._chart.model().paneForSource(a)===this._chart.model().panes().item(0))return null;var b=new Action({checkable:!1,text:$.t("Merge Up"),enabled:!0});b.setCallbackContext(a);b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onMergeUp);return b};
TradingView.PaneWidget.prototype.onMergeUp=function(a){a=a.callbackContext();var b=this._chart.model().paneForSource(a),b=this._chart.model().panes().indexOf(b),b=this._chart.model().panes().item(b-1),c=b.findSuitableScale(a);this._chart.model().move(a,b,c)};
TradingView.PaneWidget.prototype.createActionUnmergeUp=function(a){if(!(1<this._chart.model().paneForSource(a).dataSources().count(function(a){return isInherited(a.constructor,PriceDataSource)&&a.showInObjectTree()})))return null;var b=new Action({checkable:!1,text:$.t("Unmerge Up"),enabled:!0});b.setCallbackContext(a);b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onUnmergeUp);return b};
TradingView.PaneWidget.prototype.onUnmergeUp=function(a){a=a.callbackContext();var b=this._chart.model().paneForSource(a),b=this._chart.model().panes().indexOf(b),b=this._chart.model().createPane(b),c=b.findSuitableScale(a);this._chart.model().move(a,b,c)};
TradingView.PaneWidget.prototype.createActionMergeDown=function(a){var b=this._chart.model().paneForSource(a),c=this._chart.model().panes();if(b===c.item(c.size()-1))return null;b=new Action({checkable:!1,text:$.t("Merge Down"),enabled:!0});b.setCallbackContext(a);b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onMergeDown);return b};
TradingView.PaneWidget.prototype.onMergeDown=function(a){a=a.callbackContext();var b=this._chart.model().paneForSource(a),b=this._chart.model().panes().indexOf(b),b=this._chart.model().panes().item(b+1),c=b.findSuitableScale(a);this._chart.model().move(a,b,c)};
TradingView.PaneWidget.prototype.createActionUnmergeDown=function(a){if(!(1<this._chart.model().paneForSource(a).dataSources().count(function(a){return isInherited(a.constructor,PriceDataSource)&&a.showInObjectTree()})))return null;var b=new Action({checkable:!1,text:$.t("Unmerge Down"),enabled:!0});b.setCallbackContext(a);b.callbacks().subscribe(this,TradingView.PaneWidget.prototype.onUnmergeDown);return b};
TradingView.PaneWidget.prototype.onUnmergeDown=function(a){a=a.callbackContext();var b=this._chart.model().paneForSource(a),b=this._chart.model().panes().indexOf(b),b=this._chart.model().createPane(b+1),c=b.findSuitableScale(a);this._chart.model().move(a,b,c)};
TradingView.PaneWidget.prototype._mergeContentMenuItems=function(a){var b=[],c=this.createActionMergeUp(a);c&&b.push(c);(c=this.createActionUnmergeUp(a))&&b.push(c);(c=this.createActionMergeDown(a))&&b.push(c);(c=this.createActionUnmergeDown(a))&&b.push(c);return b};
TradingView.PaneWidget.prototype.createActionShow=function(a){var b=new Action({checkable:!0,text:$.t("Show"),enabled:!0});b._binding=new ActionBinder(b,a.properties().visible,this._chart.model(),b.text);b._binding.setValue(a.properties().visible.value());return b};TradingView.PaneWidget.prototype.bringObjectForward=function(a){(a=this._chart.model().selectedSource())&&this._chart.model().changeZOrder(a,1)};
TradingView.PaneWidget.prototype.sendObjectToBack=function(a){(a=this._chart.model().selectedSource())&&this._chart.model().sendToBack(a)};TradingView.PaneWidget.prototype.bringObjectToFront=function(a){(a=this._chart.model().selectedSource())&&this._chart.model().bringToFront(a)};TradingView.PaneWidget.prototype.sendObjectBackward=function(a){(a=this._chart.model().selectedSource())&&this._chart.model().changeZOrder(a,-1)};
TradingView.PaneWidget.prototype.createVisualOrderAction=function(a){var b=new Action({text:$.t("Visual Order")});b.subActions||(b.subActions=[]);var c=new Action({text:$.t("Bring to Front")});c.callbacks().subscribe(this,TradingView.PaneWidget.prototype.bringObjectToFront);b.subActions.push(c);var d=new Action({text:$.t("Send to Back")});d.callbacks().subscribe(this,TradingView.PaneWidget.prototype.sendObjectToBack);b.subActions.push(d);var e=new Action({text:$.t("Bring Forward")});e.callbacks().subscribe(this,
TradingView.PaneWidget.prototype.bringObjectForward);b.subActions.push(e);var f=new Action({text:$.t("Send Backward")});f.callbacks().subscribe(this,TradingView.PaneWidget.prototype.sendObjectBackward);b.subActions.push(f);var g=this._chart.model().paneForSource(a).getZOrderMinMax();d.setEnabled(!0);e.setEnabled(!0);f.setEnabled(!0);c.setEnabled(!0);a.zorder()===g.minZOrder&&(d.setEnabled(!1),f.setEnabled(!1));a.zorder()===g.maxZOrder&&(e.setEnabled(!1),c.setEnabled(!1));return b};
TradingView.PaneWidget.prototype.image=function(a){var b={};b.leftAxis=this.leftPriceAxisWidget().image();b.rightAxis=this.rightPriceAxisWidget().image();var c=this.statusWidget().image();this.ctx.drawImage(c,5.5,5.5);this.paint(TradingView.InvalidateMask.FULL_UPDATE,!0);b.content=this.canvas.toDataURL();b.contentWidth=this.size.w;b.contentHeight=this.size.h;this.paint(TradingView.InvalidateMask.FULL_UPDATE,a);return b};
TradingView.PaneWidget.prototype._updateTooltip=function(a,b){if(!this._rafSet){var c=this;requestAnimationFrame(function(){c._updateTooltipImpl(a,b);c._rafSet=!1});this._rafSet=!0}};
TradingView.PaneWidget.prototype._updateTooltipImpl=function(a,b){function c(c){TradingView[f].getTooltipText&&(c=TradingView[f].getTooltipText(g)||c);d._tooltipSelector.html(c).removeClass("tooltip-selector-hidden").css(TradingView.isMobile.any()?{left:a-d._tooltipSelector.outerWidth()-16,top:b-d._tooltipSelector.outerHeight()-16}:{left:a+16,top:b+16})}if(this._chart){for(var d=this,e=this._chart._paneWidgets,f=TradingView.drawingState.tool.value(),g=this._state.model().lineBeingCreated(),h=e.length-
1;0<=h;h--)e[h]._hideTooltip();TradingView.Study.isStudyLineTool(f)&&!TradingView.isMobile.any()?c($.t("Click to set a point")):TradingView.isMobile.any()&&"LineToolBrush"!=f&&d.isLineTool(f)&&!d._chart.model().lineBeingCreated()?c($.t("1. Slide your finger to select location for first anchor<br>2. Tap anywhere to place the first anchor")):TradingView.isMobile.any()&&"LineToolBrush"!=f&&d.isLineTool(f)&&c($.t("1. Slide your finger to select location for next anchor<br>2. Tap anywhere to place the next anchor"))}};
TradingView.PaneWidget.prototype._hideTooltip=function(){this._tooltipSelector.addClass("tooltip-selector-hidden")};function EditObjectDialog(a,b,c){this._source=a;this._model=b;this._undoCheckpoint=c}$.extend(EditObjectDialog,{TAB_PRIORITY_COORDINATES:100,TAB_PRIORITY_DISPLAY:100,TAB_PRIORITY_STYLE:200,TAB_PRIORITY_INPUTS:300,TAB_NAME_COORDINATES:"Coordinates",TAB_NAME_DISPLAY:"Properties",TAB_NAME_STYLE:"Style",TAB_NAME_INPUTS:"Inputs",TAB_NAME_GRAPHICS:"Graphics",TAB_OPEN_DEFAULT:100,TAB_OPEN_USERSAVE:200,TAB_OPEN_OVERRIDE:300});
EditObjectDialog.prototype.hide=function(){TVDialogs.destroy(this._dialogTitle);$(window).unbind("keyup.hidePropertyDialog");if(window.lineToolPropertiesToolbar)window.lineToolPropertiesToolbar.onSourceChanged(this._source)};EditObjectDialog.prototype.isVisible=function(){return this._dialog&&this._dialog.is(":visible")};EditObjectDialog.prototype.focusOnText=function(){this._dialog.find('input[type="text"]').focus().select()};
EditObjectDialog.prototype.switchTab=function(a,b){if(this._tabs){var c=null;a?a=a.valueOf():null===a&&(a=void 0);"string"==typeof a&&$.each(this._tabs,function(b,d){if(d.name==a)return c=d,!1});"object"==typeof a&&$.each(this._tabs,function(b,d){if(a==d||$(d.labelObject).is(a)||$(d.wrapperObject).is(a))return c=d,!1});c||(c=this._tabs[~~a]);if(!c)return!1;$.each(this._tabs,function(a,b){var d=b==c;$(b.wrapperObject)[d?"show":"hide"]();$(b.labelObject)[d?"addClass":"removeClass"]("active")});if(b){var d=
this.activeTabSettingsName();d&&TVSettings.setValue(d,c.name)}return!0}};
EditObjectDialog.prototype.appendToTab=function(a,b,c,d){if(!$(a).is("table")||$(a).find("tr").size()){var e;this._tabs||(this._tabs=[]);$.each(this._tabs,function(a,c){if(c.name==b)return e=a,!1});void 0===e&&(this._tabs.push({name:b,localizedName:$.t(b),objects:$(),displayPriority:0,defaultOpen:0}),e=this._tabs.length-1);var f=this._tabs[e];f.objects=f.objects.add(a);f.displayPriority=Math.max(f.displayPriority||0,c||0);f.defaultOpen=Math.max(f.defaultOpen||0,d||0)}};
EditObjectDialog.prototype.insertTabs=function(){if(this._tabs){this._tabs.sort(function(a,b){return(b.displayPriority||0)-(a.displayPriority||0)});var a=this,b=null,c=this.activeTabSettingsName();if(c)var d=TVSettings.getValue(c);$.each(this._tabs,function(c,f){d&&d===f.name&&(f.defaultOpen=Math.max(~~f.defaultOpen,EditObjectDialog.TAB_OPEN_USERSAVE));if(!b||~~b.defaultOpen<~~f.defaultOpen)b=f;f.labelObject=$('<a href="#" class="properties-tabs-label"></a>').text(f.localizedName).appendTo(a._tabContainer);
f.labelObject.bind("click",function(){a.switchTab(this,!0)});var g=$('<div class="main-properties"></div>');f.wrapperObject=$().add(g);f.objects.each(function(a,b){var c=$(b);c.is("table")?(c.data("layout-separated")&&(f.wrapperObject=f.wrapperObject.add('<div class="properties-separator"></div>').add(g=$('<div class="main-properties"></div>')),c.removeData("layout-separated")),g.append(c),c.children("tbody").each(function(a,c){if(0!==a&&$(c).data("layout-separated")){f.wrapperObject=f.wrapperObject.add('<div class="properties-separator"></div>').add(g=
$('<div class="main-properties"></div>'));var d=$(b).clone(!0,!1).appendTo(g);d.children().remove();d.append(c);$(c).removeData("layout-separated")}})):g.append(c)});f.wrapperObject.appendTo(a._container)});2>this._tabs.length?(this._tabContainer.remove(),$(".main-properties .property-page:first-child tbody:first-child tr:first-child td:last-child").css("padding-right","30px"),$(".main-properties").addClass("main-properties-tabless")):this.switchTab(b)}};
EditObjectDialog.prototype.activeTabSettingsName=function(){var a=this._source;if(a){if(a instanceof TradingView.Series||a instanceof TradingView.ChartWidget)return"properties_dialog.active_tab.chart";if(a instanceof LineDataSource)return"properties_dialog.active_tab.drawing";if(a instanceof TradingView.Study)return"properties_dialog.active_tab.study"}};
EditObjectDialog.prototype.show=function(a){function b(){f._model.undoToCheckpoint(f._undoCheckpoint?f._undoCheckpoint:q);f.hide()}a=a||{};isInherited(this._source.constructor,TradingView.ChartWidget)&&TradingView.trackEvent("GUI","Chart Properties");isInherited(this._source.constructor,TradingView.Study)&&TradingView.trackEvent("GUI","Study Properties");isInherited(this._source.constructor,DataSource)&&this._model.setSelectedSource(this._source);var c=PropertyPagesFactory.createInputsPropertyPage(this._source,
this._model),d=PropertyPagesFactory.createStylesPropertyPage(this._source,this._model),e=PropertyPagesFactory.createDisplayPropertyPage(this._source,this._model);if(c||d){var f=this,g=null!==c,h=this._source.title(),k=TVDialogs.createDialog(h,{hideTitle:!0,dragHandle:".properties-tabs"}),m=k.find(".tv-dialog-content"),n=$('<div class="properties-tabs"></div>').appendTo(m),q=this._model.createUndoCheckpoint();this._tabs=[];this._dialog=k;this._dialogTitle=h;this._dialog=k;this._container=m;this._tabContainer=
n;k.on("destroy",function(){c&&c.destroy();d&&d.destroy();e&&e.destroy()});a.selectScales&&d.setScalesOpenTab&&d.setScalesOpenTab();this._model.readOnly()||!g||c.widget().is(":empty")||c.widget().each(function(a,b){var d=c instanceof LineToolInputsPropertyPage,e=+$(b).data("layout-tab-priority");isNaN(e)&&(e=d?EditObjectDialog.TAB_PRIORITY_COORDINATES:EditObjectDialog.TAB_PRIORITY_INPUTS);var g=~~$(b).data("layout-tab-open"),h=$(b).data("layout-tab");void 0===h&&(h=d?EditObjectDialog.TAB_NAME_COORDINATES:
EditObjectDialog.TAB_NAME_INPUTS);f.appendToTab(b,h,e,g)});d&&d.widget().each(function(a,b){var c=+$(b).data("layout-tab-priority");isNaN(c)&&(c=EditObjectDialog.TAB_PRIORITY_STYLE);var e=~~$(b).data("layout-tab-open");!e&&d instanceof TemplatesLineToolPropertyPage&&(e=EditObjectDialog.TAB_OPEN_DEFAULT);var g=$(b).data("layout-tab");void 0===g&&(g=EditObjectDialog.TAB_NAME_STYLE);f.appendToTab(b,g,c,e)});e&&e.widget().each(function(a,b){var c=+$(b).data("layout-tab-priority");isNaN(c)&&(c=EditObjectDialog.TAB_PRIORITY_DISPLAY);
var d=~~$(b).data("layout-tab-open"),e=$(b).data("layout-tab");void 0===e&&(e=EditObjectDialog.TAB_NAME_DISPLAY);f.appendToTab(b,e,c,d)});this.insertTabs();this._source instanceof TradingView.Study&&this._source.metaInfo().isTVScript&&!TradingView.isMobileView&&this._createOpenTVScriptEditor();this._helpItemRequired()&&this._createHelp();a=$('<div class="main-properties main-properties-aftertabs"></div>').appendTo(m);a=$('<div class="dialog-buttons">').appendTo(a);g=function(){var a=[];d&&"function"==
typeof d.defaultProperties&&(a=a.concat(d.defaultProperties()));c&&"function"==typeof c.defaultProperties&&(a=a.concat(c.defaultProperties()));0===a.length&&f._source.properties?a=[f._source.properties()]:f._source._sessionsStudy&&(a=a.concat(f._source._sessionsStudy.properties()));if(a.length){var b=function(a){a._childs&&a._childs.length&&$.each(a._childs,function(c,d){"percentage"==d?a.percentage.listeners().fire(a.percentage):b(a[d])})};$.each(a,function(a,c){f._model.restoreFactoryDefaults(c);
b(c)});f._source.properties().minTick&&f._source.properties().minTick.listeners().fire(f._source.properties().minTick);f._source.properties().precision&&f._source.properties().precision.listeners().fire(f._source.properties().precision);c&&c.loadData();if(d.onResoreDefaults)d.onResoreDefaults();d&&d.loadData()}};d&&"function"==typeof d.createTemplateButton&&!TradingView.isRunningChartingLibrary?d.createTemplateButton({defaultsCallback:g}).addClass("tv-left").appendTo(a):$('<a class="tv-button tv-left">'+
$.t("Defaults")+"</a>").appendTo(a).click(g);$('<a class="tv-button ok">'+$.t("OK")+"</a>").appendTo(a).click(function(){f.hide()});$('<a class="tv-button cancel">'+$.t("Cancel")+"</a>").appendTo(a).on("click",b);k.find(".tv-dialog-title a").on("click",b);$(window).bind("keyup.hidePropertyDialog",function(a){"13"==a.keyCode&&"textarea"!==a.target.tagName.toLowerCase()&&(f.hide(),$(window).unbind("keyup.hidePropertyDialog"))});$("select",m).each(function(){var a=$(this),b="tv-select-container dialog";
a.hasClass("tv-select-container-fontsize")&&(b+=" tv-select-container-fontsize");a.selectbox({speed:100,classHolder:b})});$('input[type="text"]',m).addClass("tv-text-input inset dialog");$("input.ticker",m).TVTicker();k.css("min-width","400px");TVDialogs.applyHandlers(k);m={top:($(window).height()-k.height())/2,left:($(window).width()-k.width())/2};d&&"function"==typeof d.dialogPosition&&(m=d.dialogPosition(m,k)||m);TVDialogs.positionDialog(k,m);window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.hide();
return k}};EditObjectDialog.prototype._helpItemRequired=function(){return this._source._metaInfo&&!!this._source._metaInfo.helpURL};EditObjectDialog.prototype._createHelp=function(){var a=$('<a class="help" href="#" target="_blank" title="'+$.t("Help")+'"></a>');a.attr("href",this._source._metaInfo.helpURL);this._tabContainer.prepend(a)};
EditObjectDialog.prototype._createOpenTVScriptEditor=function(){var a=this;$('<a href="#" class="properties-tabs-label"></a>').text("Source Code").appendTo(this._tabContainer).bind("click",function(){a.hide();var b=this._source.metaInfo();window.scriptEditor.show({scriptSource:b.TVScriptSourceCode,scriptIdPart:b.scriptIdPart})}.bind(this))};function ObjectTreeDialog(a,b){this._defaultOptions={maxHeight:600,padding:20,minHeight:258};this.options=$.extend({},this._defaultOptions,a||{});this._model=b}
ObjectTreeDialog.prototype.getSourceProperties=function(){for(var a={groups:[],model:this._model,drawings:[]},b=0;b<this._model.panes().size();b++){for(var c=this._model.panes().item(b),d=[],e=c.orderedSources(),f=0;f<e.length;f++){var g=e[f];g.showInObjectTree()&&d.push({datasource:g,name:g.title()})}c=c.dataSources();for(f=0;f<c.size();f++)g=c.item(f),isInherited(g.constructor,LineDataSource)&&a.drawings.push({datasource:g,name:g.title(),symbol:TradingView.SymbolParser.shortName(g.symbol())});d.length&&
a.groups.push({children:d})}return a};ObjectTreeDialog.prototype.calcHeight=function(a,b){for(var c=0,d=0;d<a.length;d++)if(a[d]>b){c=0===d?a[0]:a[d-1];break}else c=a[d];c<this.options.minHeight&&(c=this.options.minHeight);return c};ObjectTreeDialog.prototype.tabChanged=function(a){0===a?this.objectsTreeTab.tabChanged():this.manageDrawingsTab.tabChanged()};ObjectTreeDialog.prototype.onDestroy=function(){this.objectsTreeTab.unsubscribeListeners();this.manageDrawingsTab.unsubscribeListeners()};
ObjectTreeDialog.prototype.show=function(){this.title="Objects Tree";TradingView.trackEvent("GUI","Objects Tree");var a=TVDialogs.createDialog("Objects Tree",{hideTitle:!0,dragHandle:".properties-tabs"}),b=a.find(".tv-dialog-content"),c=$('<div class="properties-tabs"></div>').appendTo(b);$('<a href="#" class="properties-tabs-label"></a>').text($.t("Objects Tree")).appendTo(c);$('<a href="#" class="properties-tabs-label"></a>').text($.t("Manage Drawings")).appendTo(c);var b=$("<div>").appendTo(b),
d=$(window).height(),d=d>this.options.maxHeight?this.options.maxHeight:d,d=d-c.height(),d=d-this.options.padding,e=$('<div class="main-tree-page active">').appendTo(b),f=$('<div class="main-tree-page active">').appendTo(b);this.objectsTreeTab=new ObjectsTreeTab(this,this.options,this._model);this.manageDrawingsTab=new ManageDrawingsTab(this,this.options,this._model);this.objectsTreeTab.createView(e,d);this.manageDrawingsTab.createView(f,d);this.tabs=new TradingView.Tabs(c,b,{saveTab:"ObjectsTreeDialog.tab"});
this.tabs.tabChanged.subscribe(this,this.tabChanged);TVDialogs.applyHandlers(a);TVDialogs.positionDialog(a);var g=this;a.on("destroy",this.onDestroy.bind(this));setTimeout(function(){a.unbind("mousedownoutside");a.on("mousedownoutside",function(b){$(b.target).parents().andSelf().is(".tv-dialog, .properties-toolbar, .colorpicker, .charts-popup-list, .tv-dialog, .tvcolorpicker-popup, .symbol-edit-popup, .context-menu")||(TVDialogs.destroy(g.title),a.unbind("mousedownoutside"))})})};
ObjectTreeDialog._getBackgroundByTile=function(a){a=TradingView.ChartSideToolbarWidget.prototype.Button.iconIndices[a];return void 0!==a?[1,32*a+1]:null};ObjectTreeDialog._getBackgroundPosition=function(a){return"-"+a[0]+"px -"+a[1]+"px"};ObjectTreeDialog.List=function(a,b,c,d){this.model=a;this.datasources={};this.contentHeights=[];this.content=b;this.dialog=c;this.options=d};ObjectTreeDialog.List.prototype.setDefaultItemClass=function(a){this.defaultItemClass=a};
ObjectTreeDialog.List.prototype.setActiveListener=function(a){this.activeListener=a};ObjectTreeDialog.List.prototype.setActive=function(a){this.content.find(".tv-dialog-tree-item").removeClass("active");a.addClass("active");this.activeListener&&this.activeListener(a);a=this.datasources[a.attr("id")];this.model.setSelectedSource(a.datasource);this.model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))};
ObjectTreeDialog.List.prototype.createItem=function(a,b){var c=this,d=$('<a class="tv-dialog-tree-item"></a>').appendTo(b),e=$('<span class="tree-icon-container">').appendTo(d);d.attr("id",a.datasource.id());this.defaultItemClass&&d.addClass(this.defaultItemClass);this.datasources[a.datasource.id()]=a;this.contentHeights.push(this.content.height());var f=$('<div class="name-column"></div>').appendTo(d);$('<span class="name">'+$.t(a.name)+"</span>").appendTo(f);this.setIcon(d,a);this.setVisible(d,
a);d.mousedown(function(a){c.setActive(d)});if(a.datasource.userEditEnabled()){if(isInherited(a.datasource.constructor,LineDataSource)){var g=$('<a class="button icon-lock" title="'+$.t("Lock/Unlock")+'">');g.click(function(b){b=a.datasource.properties().frozen.value();c.model.setProperty(a.datasource.properties().frozen,!b,"Lock/Unlock "+a.datasource.title())});g.appendTo(e);$('<span class="icon">').appendTo(g);a.datasource.properties().frozen.value()&&(d.addClass("locked"),g.addClass("active"));
a.datasource.properties().frozen.subscribe(this,function(a){a=a.value();d.toggleClass("locked",a);g.toggleClass("active",a)})}else this.dialog.getSourceProperties().drawings.length&&$('<div class="button hidden">&nbsp;</div>').appendTo(e);var h=$('<a class="button icon-hide" title="'+$.t("Show/Hide")+'">');h.click(function(b){b=a.datasource.properties().visible.value();d.toggleClass("hidden",b);h.toggleClass("active",b);c.model.setProperty(a.datasource.properties().visible,!b,"Show/Hide "+a.datasource.title())});
h.appendTo(e);$('<span class="icon">').appendTo(h);a.datasource.properties().visible.value()||(d.addClass("hidden"),h.addClass("active"));a.datasource.properties().visible.subscribe(this,function(a){a=a.value();d.toggleClass("hidden",!a);h.toggleClass("active",!a)});this.createPropertyIcon(a,e,d)}return d};ObjectTreeDialog.List.prototype.contextMenuEvent=function(a,b){this.options.chartWidget.paneByState(this.model.paneForSource(b)).showContextMenuForSource(b,a)};
ObjectTreeDialog.List.prototype.createPropertyIcon=function(a,b,c){var d=this;if(a.datasource instanceof LineDataSource&&!a.datasource.isActualSymbol())$('<div class="button hidden">&nbsp;</div>').appendTo(b);else if(a.datasource===this.model.mainSeries()&&this.options.chartWidget&&this.options.chartWidget.onWidget())$('<div class="button hidden">&nbsp;</div>').appendTo(b);else if(PropertyPagesFactory.hasStylesPropertyPage(a.datasource)||PropertyPagesFactory.hasInputsPropertyPage(a.datasource))b=
$('<a class="button format" title="'+$.t("Format")+'">').click(function(b){(new EditObjectDialog(a.datasource,d.model)).show()}).appendTo(b),$('<span class="icon">').appendTo(b),c.dblclick(function(b){(new EditObjectDialog(a.datasource,d.model)).show()}),c.on("contextmenu",function(b){d.contextMenuEvent(b,a.datasource);b.preventDefault();b.stopPropagation()})};
ObjectTreeDialog.List.prototype.updateItem=function(a){var b=this.content.find("#"+a.datasource.id());b.find(".name").text($.t(a.name));this.setIcon(b,a);this.setVisible(b,a)};ObjectTreeDialog.List.prototype.findItem=function(a){return this.content.find("#"+a.id())};ObjectTreeDialog.List.prototype.removeItem=function(a){this.findItem(a).remove()};
ObjectTreeDialog.List.prototype.setIcon=function(a,b){var c=a.find(".name-column");c.find(".instrument").remove();if(b.datasource.getType){var d=ObjectTreeDialog._getBackgroundByTile(b.datasource.getType());if(d){var e=$('<span class="instrument linetool">').appendTo(c);e.css("background-position",ObjectTreeDialog._getBackgroundPosition(d))}}b.datasource instanceof TradingView.LineToolIcon&&(e=b.datasource.properties().icon.value(),e=String.fromCharCode(e),$('<span class="instrument lineicon">'+e+
"</span>").appendTo(c));b.datasource===this.model.mainSeries()&&(e=$('<span class="instrument series">').appendTo(c),c=this.model.mainSeries().properties().style.value(),d=TradingView.ChartHeaderWidgetBase.styleIconPosition(c),e.css("background-position",d))};ObjectTreeDialog.List.prototype.setVisible=function(a,b){b.datasource.properties().visible.value()?a.removeClass("hidden"):a.addClass("hidden")};function ManageDrawingsTab(a,b,c){this.dialog=a;this.options=b||{};this.model=c}ManageDrawingsTab.prototype.toolCompare=function(a,b){var c=$(a).find(".name").text(),d=$(b).find(".name").text();return c.localeCompare(d)};ManageDrawingsTab.prototype.symbolCompare=function(a,b){var c=$(a).find(".symbol").text(),d=$(b).find(".symbol").text();return c.localeCompare(d)};ManageDrawingsTab.prototype.activeListener=function(a){this.selectedId=a.attr("id")};
ManageDrawingsTab.prototype.addItemControls=function(a,b){var c=this,d=b.find(".tree-icon-container");$('<span class="symbol">'+a.symbol+"</span>").appendTo(b);a.datasource.userEditEnabled()&&(d=$('<a class="button delete" title="'+$.t("Delete")+'">').click(function(d){d.stopPropagation();d=c.itemList.find(".tv-dialog-tree-item");var f=d.index(b),g=d.length;0<g&&(f!==g-1?c.selectedId=$(d[f+1]).attr("id"):0!==f&&(c.selectedId=$(d[f-1]).attr("id")));c.items.model.removeSource(a.datasource)}).appendTo(d),
$('<span class="icon">').appendTo(d))};ManageDrawingsTab.prototype.setActiveHeader=function(a){this.itemHeader.find(".item .label").removeClass("active");$.each(this.itemHeader.find(".item .label"),function(){$(this).data("sort")===a&&$(this).addClass("active")})};
ManageDrawingsTab.prototype.sortList=function(){var a=TVSettings.getValue("manageDrawingsDialog.sort.field")||"symbol",b=TVSettings.getBool("manageDrawingsDialog.sort.asc")||!1,c;c="tool"===a?this.toolSort:this.symbolSort;c.setIsAscending(b);this.itemList.find(".tv-dialog-tree-item").sort(c.getPredicate()).appendTo(this.itemList);this.setActiveHeader(a)};
ManageDrawingsTab.prototype.sortClick=function(a){a=$(a.target).data("sort");var b;b="tool"===a?this.toolSort:this.symbolSort;b.inverse();TVSettings.setValue("manageDrawingsDialog.sort.field",a);TVSettings.setValue("manageDrawingsDialog.sort.asc",b.isAscending);this.sortList()};
ManageDrawingsTab.prototype.createView=function(a,b){this.items=this.dialog.getSourceProperties();this.maxHeight=b;var c=$("<div>").appendTo(a);this.itemHeader=$('<div class="tv-dialog-tree-item-list-header">').appendTo(c);this.contentContainer=$('<div class="main-tree-container">').appendTo(c);this.noDrawings=$('<div class="no-drawings">'+$.t("No drawings yet")+"</div>").appendTo(c);this.contentWrap=$('<div class="main-tree-wrap"></div>').appendTo(this.contentContainer);this.content=$('<div class="main-tree"></div>').appendTo(this.contentWrap);
var c=$('<div class="item tool">').appendTo(this.itemHeader),d=$('<div class="item symbol">').appendTo(this.itemHeader);this.itemList=$('<div class="tv-dialog-tree-item-list">').appendTo(this.content);this.symbolSort=new LoadChartDialog.SortObject(this.symbolCompare);this.toolSort=new LoadChartDialog.SortObject(this.toolCompare);this.list=new ObjectTreeDialog.List(this.items.model,this.content,this.dialog,this.options);this.list.setActiveListener(this.activeListener.bind(this));this.items.model.selectedSource()&&
(this.selectedId=this.items.model.selectedSource().id());$('<span class="label">'+$.t("TOOL")+"</span>").data("sort","tool").appendTo(c).click($.proxy(this,"sortClick"));$('<span class="label">'+$.t("SYMBOL")+"</span>").data("sort","symbol").appendTo(d).click($.proxy(this,"sortClick"));this.fillList();c=this.dialog.calcHeight(this.list.contentHeights,this.maxHeight-this.itemHeader.height());this.contentContainer.height(c);this.noDrawings.height(c);this.addScroll();var e=this;this.updateListListener=
function(){e.updateList()};this.fillListListener=function(){e.fillList()};this.removeSourceListener=function(a){e.list.removeItem(a);e.updateList()};this.model.on("setProperty",this.updateListListener);this.model.on("removeSource",this.removeSourceListener);this.model.on("cloneLineTool",this.fillListListener);return this.contentContainer};
ManageDrawingsTab.prototype.unsubscribeListeners=function(){this.model.removeListener("setProperty",this.updateListListener);this.model.removeListener("removeSource",this.removeSourceListener);this.model.removeListener("cloneLineTool",this.fillListListener)};ManageDrawingsTab.prototype.updateList=function(){for(var a=this.dialog.getSourceProperties(),b=0;b<a.drawings.length;b++)this.list.updateItem(a.drawings[b])};
ManageDrawingsTab.prototype.updateList=function(){0===this.itemList.children().length?(this.noDrawings.show(),this.contentContainer.hide(),this.itemHeader.hide()):(this.noDrawings.hide(),this.contentContainer.show(),this.itemHeader.show())};
ManageDrawingsTab.prototype.fillList=function(){this.itemList.empty();for(var a=this.dialog.getSourceProperties(),b=0;b<a.drawings.length;b++){var c=a.drawings[b],d=this.list.createItem(c,this.itemList);d.unbind("contextmenu");d.unbind("dblclick");c.datasource.id()===this.selectedId&&this.list.setActive(d);this.addItemControls(c,d)}this.sortList();this.updateList()};
ManageDrawingsTab.prototype.addScroll=function(){this._scroll=new TradingView.SidebarCustomScroll(this.contentContainer,this.contentWrap,{showBottomShadow:!1})};ManageDrawingsTab.prototype.tabChanged=function(){};function ObjectsTreeTab(a,b,c){this.dialog=a;this.options=b||{};this.model=c}ObjectsTreeTab.prototype.activeListener=function(a){this.selectedId=a.attr("id")};ObjectsTreeTab.prototype.changeZOrder=function(a){this.model.removeListener("changeZOrder",this.changeZorderListener);a();this.model.on("changeZOrder",this.changeZorderListener)};
ObjectsTreeTab.prototype.addSortable=function(a){var b=0,c=this;a.sortable({scroll:!0,scrollSensitivity:100,scrollSpeed:100,axis:"y",helper:"clone",start:function(a,c){b=c.item.index()},stop:function(a,e){var f=e.item.index();if(0!==b-f){var g=c.list.datasources[e.item.attr("id")],h=0<b-f?1:-1;c.changeZOrder(function(){c.items.model.beginUndoMacro("Change "+g.datasource.title()+" Z order");for(var a=0;a<Math.abs(b-f);a++)c.items.model.changeZOrder(g.datasource,h);c.items.model.endUndoMacro()})}},
sort:function(a,b){var c=b.helper;c.find(".button.down").css("visibility","visible");c.find(".button.up").css("visibility","visible");var g=$(this).find(".tv-dialog-tree-item:visible"),h=g.index(b.placeholder);0===h&&c.find(".button.up").css("visibility","hidden");h===g.length-2&&c.find(".button.down").css("visibility","hidden")}})};
ObjectsTreeTab.prototype.addItemControls=function(a,b,c,d,e){var f=this;c=b.find(".tree-icon-container");d=$('<div class="button up" title="'+$.t("Move Up")+'">').click(function(c){c.stopPropagation();c.preventDefault();0!==b.prev().length&&b.insertBefore(b.prev());f.changeZOrder(function(){f.items.model.changeZOrder(a.datasource,1)});f._scroll.scrollTo(b)}).prependTo(c);$('<span class="icon">').appendTo(d);d=$('<a class="button down" title="'+$.t("Move Down")+'">').click(function(c){c.stopPropagation();
c.preventDefault();0!==b.next().length&&b.insertAfter(b.next());f.changeZOrder(function(){f.items.model.changeZOrder(a.datasource,-1)});f._scroll.scrollTo(b)}).prependTo(c);$('<span class="icon">').appendTo(d);a.datasource!==f.items.model.mainSeries()&&a.datasource.userEditEnabled()?(c=$('<a class="button delete" title="'+$.t("Delete")+'">').click(function(c){c.stopPropagation();c=f.content.find(".tv-dialog-tree-item");var d=c.index(b),e=c.length;0<e&&(d!==e-1?f.selectedId=$(c[d+1]).attr("id"):0!==
d&&(f.selectedId=$(c[d-1]).attr("id")));f.items.model.removeSource(a.datasource)}).appendTo(c),$('<span class="icon">').appendTo(c)):$('<div class="button hidden">&nbsp;</div>').appendTo(c)};
ObjectsTreeTab.prototype.createView=function(a,b){this.items=this.dialog.getSourceProperties();this.maxHeight=b;this.contentContainer=$('<div class="main-tree-container">').appendTo(a);this.contentWrap=$('<div class="main-tree-wrap"></div>').appendTo(this.contentContainer);this.content=$('<div class="main-tree"></div>').appendTo(this.contentWrap);this.list=new ObjectTreeDialog.List(this.items.model,this.content,this.dialog,this.options);this.list.setDefaultItemClass("objects");this.list.setActiveListener(this.activeListener.bind(this));
this.items.model.selectedSource()&&(this.selectedId=this.items.model.selectedSource().id());this.fillList();var c=this.dialog.calcHeight(this.list.contentHeights,this.maxHeight);this.contentContainer.height(c);this.addScroll();var d=this;this.updateListListener=function(){d.updateList()};this.fillListListener=function(){d.fillList()};this.changeZorderListener=function(a){d.fillList();d._scroll.scrollTo(d.list.findItem(a))};this.model.on("setProperty",this.updateListListener);this.model.on("removeSource",
this.fillListListener);this.model.on("cloneLineTool",this.fillListListener);this.model.on("setChartStyleProperty",this.updateListListener);this.model.on("changeZOrder",this.changeZorderListener);this.model.on("moveSource",this.fillListListener);return this.contentContainer};
ObjectsTreeTab.prototype.unsubscribeListeners=function(){this.model.removeListener("setProperty",this.updateListListener);this.model.removeListener("removeSource",this.fillListListener);this.model.removeListener("cloneLineTool",this.fillListListener);this.model.removeListener("setChartStyleProperty",this.updateListListener);this.model.removeListener("changeZOrder",this.changeZorderListener);this.model.removeListener("moveSource",this.fillListListener)};
ObjectsTreeTab.prototype.updateList=function(){this.items=this.dialog.getSourceProperties();for(var a=0;a<this.items.groups.length;a++){var b=this.items.groups[a];if(b.children.length)for(var c=b.children.length-1;0<=c;c--)this.list.updateItem(b.children[c])}};
ObjectsTreeTab.prototype.fillList=function(){this.content.empty();this.items=this.dialog.getSourceProperties();for(var a=0;a<this.items.groups.length;a++){var b=this.items.groups[a];if(b.children.length){var c=$('<div class="tv-dialog-tree-group">').appendTo(this.content);0<a&&c.append('<div class="tv-dialog-tree-head">');var d=$('<div class="tv-dialog-tree-item-list">').appendTo(c);Modernizr.touch||this.addSortable(d);for(var e=b.children.length-1;0<=e;e--){var f=b.children[e],g=this.list.createItem(f,
d);f.datasource.id()===this.selectedId&&this.list.setActive(g);this.addItemControls(f,g,c,e,b)}}}};ObjectsTreeTab.prototype.addScroll=function(){this._scroll=new TradingView.SidebarCustomScroll(this.contentContainer,this.contentWrap,{showBottomShadow:!1})};ObjectsTreeTab.prototype.tabChanged=function(){};TradingView.LegendWidget=function(a,b,c){this._model=b;this._paneWidget=a;this._chart=a._chart;this._mainDiv=c;this.jqTable=$(document.createElement("table"));TradingView.setAbsolutePos(this.jqTable,new TradingView.Point(10,10));this.jqTable.addClass("pane-legend");this._itemsBinding=new List;this.updateLayout()};TradingView.LegendWidget.prototype.contextMenuEvent=function(a,b){this._model.chartModel().readOnly()||this._paneWidget.showContextMenuForSource(b.source,a)};
TradingView.LegendWidget.prototype.updateLayout=function(){this._itemsBinding.clear();this.jqTable.empty();var a=this._paneWidget.state();if(a&&this._model){var b=new List,c=a.orderedSources().slice(),a=c.indexOf(this._model.mainSeries());-1<a&&(c.splice(a,1),c.push(this._model.mainSeries()));for(a=c.length-1;0<=a;a--){var d=c[a],e=d.statusView();e&&b.append({view:e,source:d})}for(a=0;a<b.size();++a){var e=b.item(a).view,d=b.item(a).source,c=$("<tr>"),f=$("<td>"),g=this._paneWidget.jqPane.width();
f.css("max-width",g-85);c.appendTo(this.jqTable);f.addClass("pane-legend-line");d==this._model.mainSeries()?(f.addClass("main"),this._updateFollowSymbol(f,d)):f.addClass("study");d.properties().visible.value()||f.addClass("disabled");f.appendTo(c);f.source=d;this._generateItemsForRow(f,e);TradingView.setMouseEventHandler(f,this,!0)}this.update();this.updateTitle()}};
TradingView.LegendWidget.prototype._updateFollowSymbol=function(a,b){if(!this._chart.onWidget()&&!TradingView.isRunningChartingLibrary){var c=$(document.createElement("span")).data("alive",!0).appendTo(a);TradingView.FollowSymbols.makeButton(b.properties().symbol.value(),"iconed").done(function(a){if(c.data("alive")){a.removeAttr("title");var b=TradingView.SymbolParser.ticker(a.data("symbol")||"");a.blueTooltip("<strong>Follow "+b+".</strong> If you follow a symbol you will receive notifications when new ideas about that symbol are published.",
"bottom");c.replaceWith(a)}})}};
TradingView.LegendWidget.prototype._generateItemsForRow=function(a,b){var c=$("<span>");c.addClass("pane-legend-line");var d=a.source,e=this,f=d==this._model.mainSeries();f&&c.addClass("main");d.properties().visible.value()||c.addClass("disabled");c.css({color:this._chart.properties().scalesProperties.textColor.value(),"font-weight":b.bold()?"bold":"normal","font-size":b.size()});c.click(function(b){e.contextMenuEvent(b,a)});c.appendTo(a);this._itemsBinding.append({value:b,cell:c,source:a.source});
if(!this._chart.readOnly()&&d.userEditEnabled()){c=$('<span class="pane-legend-icon-container">').appendTo(a);$('<a class="pane-legend-icon apply-common-tooltip icon-hide" title="'+$.t("Show/Hide")+'">').appendTo(c).on("click touchend",this._generateItemsForRow._onShowhideClick.bind(this,d));$('<a class="pane-legend-icon apply-common-tooltip format" title="'+$.t("Format")+'">').appendTo(c).on("click touchend",this._generateItemsForRow._onFormatClick.bind(this,d));if(d instanceof TradingView.Study&&
d.metaInfo().isTVScript&&!TradingView.isMobileView){var g=$('<a class="pane-legend-icon apply-common-tooltip source" title="Show Source Code">').appendTo(c).on("click touchend",this._generateItemsForRow._onViewSorceClick.bind(this,d));if(window.scriptEditor){var h=window.scriptEditor.loadedScriptIdPart();h&&d.metaInfo().scriptIdPart===h&&g.addClass("active")}}if(!f)$('<a class="pane-legend-icon apply-common-tooltip delete" title="'+$.t("Delete")+'">').appendTo(c).on("click touchend",this._generateItemsForRow._onDeleteClick.bind(this,
d))}c=d.dataWindowView();c=d.dataWindowView();if(this.isDataWindowValuesVisible(c)){var g=[],h=[],k=$("<div>");k.addClass("pane-legend-item-value-container");for(var m=0;m<c.items().size();m++){c.items().item(m);var n=f?$("<span class='pane-legend-item-value-title pane-legend-line'>").appendTo(k):null,q=$("<span class='pane-legend-item-value pane-legend-line'>").appendTo(k);f&&q.addClass("main");d.properties().visible.value()||(q.addClass("disabled"),n&&n.addClass("disabled"));g.push(q);n&&h.push(n)}k.appendTo(a);
this._itemsBinding.append({value:c,cell:g,titleCells:h.length?h:null,source:d})}};TradingView.LegendWidget.prototype.isDataWindowValuesVisible=function(a){return this._chart.onWidget()?!!a&&!this._chart.isSmall():!!a};TradingView.LegendWidget.prototype._generateItemsForRow._onShowhideClick=function(a){this._model.setProperty(a.properties().visible,!a.properties().visible.value(),"Show/Hide "+a.title())};
TradingView.LegendWidget.prototype._generateItemsForRow._onFormatClick=function(a,b){a.userEditEnabled()&&(new EditObjectDialog(a,this._model)).show()};TradingView.LegendWidget.prototype._generateItemsForRow._onDeleteClick=function(a){a.isUserDeletable()&&this._model.removeSource(a)};TradingView.LegendWidget.prototype._generateItemsForRow._onViewSorceClick=function(a){var b=a.metaInfo();a={scriptSource:a.metaInfo().TVScriptSourceCode,scriptIdPart:b.scriptIdPart};window.scriptEditor&&window.scriptEditor.show(a)};
TradingView.LegendWidget.prototype.setItemEnabled=function(a,b){var c=!a.hasClass("disabled");b&&!c?a.removeClass("disabled"):!b&&c&&a.addClass("disabled")};
TradingView.LegendWidget.prototype.updateTitle=function(){for(var a=this._itemsBinding.size(),b,c;a--;)if(c=this._itemsBinding.item(a),!isArray(c.cell)){b=c.source.properties().visible.value();this.setItemEnabled(c.cell,b);b=c.value.color();var d=c.source!=this._model.mainSeries()&&c.source===this._model.selectedSource()?"bold":"normal";c.cell.html(c.value.text()).css({color:b,"font-weight":d})}};
TradingView.LegendWidget.prototype.update=function(){this.updateTitle();for(var a,b,c,d,e,f,g=this._itemsBinding.size();g--;)if(d=this._itemsBinding.item(g),a=d.cell,b=d.titleCells,c=d.source.properties().visible.value(),isArray(a))for(d=d.value.items(),e=0;e<a.length;e++)f=d.item(e),this.setItemEnabled(a[e],c),a[e][0].textContent=f.text(),f.color()&&a[e].css("color",f.color()),b&&(this.setItemEnabled(b[e],c),b[e][0].textContent=f.title())};
TradingView.LegendWidget.prototype.dataSourceAtPoint=function(a,b){return null};
TradingView.LegendWidget.prototype.image=function(){var a=$('<canvas width="'+this.jqTable.width()+'" height="'+this.jqTable.height()+'">')[0],b=a.getContext("2d"),c,d,e;b.fillStyle=this._chart.properties().scalesProperties.textColor.value();b.textBaseline="middle";b.translate(1,0.5);for(var f=0;f<this._itemsBinding.size();++f)c=this._itemsBinding.item(f).cell,d=this._itemsBinding.item(f).value,e=this._itemsBinding.item(f).source,e=e==this._model.mainSeries()?12:8,isArray(c)||(b.font=d.size()+" Verdana, Arial",
b.fillText(d.text(),0,c.position().top+e));return a};TradingView.PaneSeparator=function(a,b,c){this.chart=a;this.paneA=a._paneWidgets[b];this.paneB=a._paneWidgets[c];this.jqRow=$(document.createElement("tr"));this.jqRow.height(TradingView.PaneSeparator.HEIGHT);this.jqCell=$(document.createElement("td"));this.jqCell.appendTo(this.jqRow);this.jqCell.addClass("pane-separator");this.jqCell.attr("colspan","3");this.jqCell.css("background",this.chart.properties().scalesProperties.lineColor.value());this.jqCell.click(function(){});this.handle=$('<div class="handle">').appendTo(this.jqCell);
$(this.handle).css("cursor",cursorCss("cursor_size_vertical","16 15"));TradingView.setMouseEventHandler(this.handle,this)};TradingView.PaneSeparator.HEIGHT=1;
TradingView.PaneSeparator.prototype.mouseDownEvent=function(a){if(0===a.button||Modernizr.touch)this.startY=a.pageY,this.deltaY=0,this.totalHeight=this.paneA.size.h+this.paneB.size.h,this.totalStretch=this.paneA.stretchFactor()+this.paneB.stretchFactor(),this.prevStretchA=this.paneA.stretchFactor(),this.minPaneHeight=30,this.maxPaneHeight=this.totalHeight-this.minPaneHeight,this.pixelStretchFactor=this.totalStretch/this.totalHeight};
TradingView.PaneSeparator.prototype.pressedMouseMoveEvent=function(a){if(0===a.button||Modernizr.touch){a.preventDefault();this.deltaY=a.pageY-this.startY;var b=this.paneA.size.h,c=MathEx.clamp(b+this.deltaY,this.minPaneHeight,this.maxPaneHeight)*this.pixelStretchFactor,d=this.totalStretch-c;this.paneA.setStretchFactor(c);this.paneB.setStretchFactor(d);this.chart._adjustSize();this.paneA.size.h!==b&&(this.startY=a.pageY);this.chart.paint()}};
TradingView.PaneSeparator.prototype.mouseUpEvent=function(a){if(0===a.button||Modernizr.touch)this.chart._model.addPaneStretchFactorUndoCommand(this.paneA._state,this.paneB._state,this.prevStretchA,this.paneA.stretchFactor()),this.pixelStretchFactor=this.maxPaneHeight=this.minPaneHeight=this.totalStretch=this.totalHeight=this.deltaY=this.startY=0};TradingView.PaneSeparator.prototype.update=function(){this.jqCell.css("background",this.chart.properties().scalesProperties.lineColor.value())};
TradingView.PaneSeparator.prototype.paint=function(){};
TradingView.PaneSeparator.prototype.image=function(){var a={},b=TradingView.PaneSeparator.HEIGHT,c=this.paneA.lhsPriceAxisWidget.size.w,d=this.paneA.size.w,e=this.paneA.rhsPriceAxisWidget.size.w,f,g;f=$('<canvas width="'+c+'" height="'+b+'">')[0];g=f.getContext("2d");g.fillStyle=this.chart.properties().scalesProperties.lineColor.value();g.fillRect(0,0,c,b);a.leftAxis={content:f.toDataURL(),contentWidth:c,contentHeight:b};f=$('<canvas width="'+d+'" height="'+b+'">')[0];g=f.getContext("2d");g.fillStyle=
this.chart.properties().scalesProperties.lineColor.value();g.fillRect(0,0,d,b);a.content=f.toDataURL();a.contentWidth=d;a.contentHeight=b;f=$('<canvas width="'+e+'" height="'+b+'">')[0];g=f.getContext("2d");g.fillStyle=this.chart.properties().scalesProperties.lineColor.value();g.fillRect(0,0,e,b);a.rightAxis={content:f.toDataURL(),contentWidth:e,contentHeight:b};return a};TradingView.PaneControls=function(a,b,c){this._model=b;this._paneWidget=a;this._chart=a._chart;this._pane=a.state();this._mainDiv=c;this.jqDiv=$('<div class="pane-controls">').appendTo(c);this.jqDiv.css({position:"absolute",right:"5px",top:"5px"});this.updateLayout()};
TradingView.PaneControls.prototype.updateLayout=function(){var a=this,b=this._model.panes().indexOf(this._pane),c=0,d=0;0<b&&$('<a class="pane-legend-icon up" title="Move Up">').click(function(){a._model.rearrangePanes(a._chart,b,"up")}).appendTo(this.jqDiv);for(b<this._model.panes().size()-1&&$('<a class="pane-legend-icon down" title="Move Down">').click(function(){a._model.rearrangePanes(a._chart,b,"down")}).appendTo(this.jqDiv);d<this._pane.dataSources().size();++d)this._pane.dataSources().item(d).constructor===
TradingView.Study&&++c;1<c&&!this._paneWidget.containsMainSeries()&&$('<a class="pane-legend-icon delete" title="Delete">').click(function(){a._model.removePane(a._chart,b)}).appendTo(this.jqDiv)};TradingView.PaneControls.prototype.update=function(){};TradingView.PriceAxisWidget=function(a,b,c){this.pane=a;this._isLeft=TradingView.PriceAxisWidget.isLeft(b);this._disableContextMenu=!!c;this.jqCell=$(document.createElement("td"));this.jqCell.addClass("chart-markup-table");this.jqCell.addClass("price-axis");this.jqCell.width(25);this._dv=$("<div>");this._dv.css("width","100%");this._dv.css("height","100%");this._dv.css("position","relative");this._dv.css("overflow","hidden");this._dv.appendTo(this.jqCell);this.canvas=TradingView.addCanvasTo(this._dv,
new TradingView.Size(16,16));$(this.canvas).css("position","absolute");$(this.canvas).css("z-order","2");$(this.canvas).css("left",0);$(this.canvas).css("top",0);this.ctx=this.canvas.getContext("2d");this.top_canvas=TradingView.addCanvasTo(this._dv,new TradingView.Size(16,16));$(this.top_canvas).css("position","absolute");$(this.top_canvas).css("z-order","1");$(this.top_canvas).css("left",0);$(this.top_canvas).css("top",0);this.top_ctx=this.top_canvas.getContext("2d");this._optimalWidth=40;this.setFont(11,
"Arial","");this.restoreDefaultCursor();this.update();TradingView.setMouseEventHandler(this.jqCell,this,!0);this.dialog=this.pane.chart().dialog;this.contextMenu=null;this.actions={};this._isVisible=!0};TradingView.PriceAxisWidget.prototype._BORDER_SIZE=1;TradingView.PriceAxisWidget.prototype._MAJOR_TICK_LENGTH=4;TradingView.PriceAxisWidget.prototype._MINOR_TICK_LENGTH=2;TradingView.PriceAxisWidget.LHS=1;TradingView.PriceAxisWidget.RHS=2;
TradingView.PriceAxisWidget.isLeft=function(a){if(a===TradingView.PriceAxisWidget.LHS)return!0;a!==TradingView.PriceAxisWidget.RHS&&TradingView.logDebug("PriceAxisWidget.isLeft: wrong side");return!1};TradingView.PriceAxisWidget.prototype.backgroundColor=function(){return this.pane.chart().model().model().properties().paneProperties.background.value()};TradingView.PriceAxisWidget.prototype.lineColor=function(){return this.pane.chart().model().model().properties().scalesProperties.lineColor.value()};
TradingView.PriceAxisWidget.prototype.textColor=function(){return this.pane.chart().model().model().properties().scalesProperties.textColor.value()};TradingView.PriceAxisWidget.prototype.mouseDownEvent=function(a){if(!this.priceScale().isEmpty()){var b=this.pane.chart().model(),c=this.pane.state();this._mousedown=!0;this.jqCell.css("cursor",cursorCss("cursor_size_vertical","15 15"));b.startScalePrice(c,this.priceScale(),a.localY);TradingView.trackEvent("GUI","Scaling price scale")}};
TradingView.PriceAxisWidget.prototype.pressedMouseMoveEvent=function(a){var b=this.pane.chart().model(),c=this.pane.state(),d=this.priceScale();b.scalePriceTo(c,d,a.localY)};TradingView.PriceAxisWidget.prototype.mouseDownOutsideEvent=function(a){a=this.pane.chart().model();var b=this.pane.state(),c=this.priceScale();this._mousedown&&(this._mousedown=!1,a.endScalePrice(b,c),this.restoreDefaultCursor())};
TradingView.PriceAxisWidget.prototype.mouseUpEvent=function(a){a=this.pane.chart().model();var b=this.pane.state(),c=this.priceScale();this._mousedown=!1;a.endScalePrice(b,c);this.restoreDefaultCursor()};
TradingView.PriceAxisWidget.prototype._initActions=function(a){if(this.pane.state()){var b=this;this.actions.reset=new Action({text:$.t("Reset Scale")});this.actions.reset.callbacks().subscribe(this,TradingView.PriceAxisWidget.prototype.reset);a=function(a){this._undoModel.setLockScaleProperty(this._property,a.checked,b.priceScale().mainSource(),this._undoText)};delete this.actions.setLockScale;this.priceScale().mainSource()instanceof TradingView.Series&&(this.actions.setLockScale=new Action({text:$.t("Lock Scale"),
checkable:!0,checked:this.priceScale().mainSource().properties().lockScale.value()}),this._lockScaleBinding=new ActionBinder(this.actions.setLockScale,this.priceScale().mainSource().properties().lockScale,this.pane.chart().model(),"Undo LockScale",a),this._lockScaleBinding.setValue(this.priceScale().mainSource().properties().lockScale.value()));this.actions.setAutoScale=new Action({text:$.t("Auto Scale"),checkable:!0,checked:!0});this._autoScaleBinding=new ActionBinder(this.actions.setAutoScale,this.priceScale().properties().autoScale,
this.pane.chart().model(),"Undo AutoScale",function(){this._undoModel.setAutoScaleProperty(this._property,this.value(),b.priceScale(),this._undoText)});this._autoScaleBinding.setValue(this._autoScaleBinding.property().value());this.actions.setPercentage=new Action({text:$.t("Percentage",{context:"scale_menu"}),checkable:!0,checked:!1});this.actions.setPercentage.binding=new ActionBinder(this.actions.setPercentage,this.priceScale().properties().percentage,this.pane.chart().model(),"Undo Percentage",
function(){this._undoModel.setPercentProperty(this._property,this.value(),b.priceScale(),this._undoText)});this.actions.setLog=new Action({text:$.t("Log Scale",{context:"scale_menu"}),checkable:!0,checked:!1});this.actions.setLog.binding=new ActionBinder(this.actions.setLog,this.priceScale().properties().log,this.pane.chart().model(),"Undo Log Scale");this.actions.showSymbolNames=new Action({text:$.t("Show Symbol Labels",{context:"scale_menu"}),checkable:!0,checked:!1});this.actions.showSymbolNames.binding=
new ActionBinder(this.actions.showSymbolNames,this.priceScale().properties().showSymbolLabels,this.pane.chart().model(),"Undo Show Symbol Labels");this._updateScalesActions()}};
TradingView.PriceAxisWidget.prototype._updateScalesActions=function(){var a=this.priceScale(),b=a.mainSource()instanceof TradingView.Series,c=a.mainSource().properties();this.actions.setPercentage.setEnabled(!a.isLog()&&!(b&&c.lockScale.value())&&!(b&&c.style.value()===TradingView.Series.STYLE_PNF));this.actions.setLog.setEnabled(!a.isPercent()&&!(b&&c.lockScale.value())&&!(b&&c.style.value()===TradingView.Series.STYLE_PNF));this.actions.setAutoScale.setChecked(a._properties.autoScale.value());this.actions.setAutoScale.setEnabled(!a.properties().autoScaleDisabled.value())};
TradingView.PriceAxisWidget.prototype.mouseClickEvent=function(a){};TradingView.PriceAxisWidget.prototype.mouseDoubleClickEvent=function(a){this.reset();TradingView.trackEvent("GUI","Double click price scale")};TradingView.PriceAxisWidget.prototype.contextMenuEvent=function(a,b){this._disableContextMenu||this._createContextMenu().show(a)};
TradingView.PriceAxisWidget.prototype._createContextMenu=function(){this._initActions();var a=this.pane.chart().actions(),b=[this.actions.reset,new ActionSeparator,a.showLeftAxis,a.showRightAxis,new ActionSeparator,this.actions.setAutoScale,a.scaleSeriesOnly,new ActionSeparator,this.actions.setPercentage,this.actions.setLog,new ActionSeparator,this.actions.showSymbolNames];TradingView.onWidget()||(b.push(new ActionSeparator),b.push(a.scalesProperties));this.actions.setLockScale&&b.splice(6,0,this.actions.setLockScale);
return ContextMenu.createMenu(b)};
TradingView.PriceAxisWidget.prototype.backLabels=function(a){var b=new List,c=this.priceScale().orderedSources().clone().toArray(),d=this.pane,e=d.chart().model(),d=d.state(),f=[],g=e.sourceBeingMoved()||e.lineBeingEdited()||e.lineBeingCreated();g&&f.push(g);e.selectedSource()&&f.push(e.selectedSource());e.hoveredSource()&&f.push(e.hoveredSource());if(this.priceScale()===d.defaultPriceScale())for(g=this.pane.state().dataSources(),e=0;e<g.size();e++)d.isOverlay(g.item(e))&&c.push(g.item(e));for(e=
0;e<c.length;++e)g=c[e],(a||-1===f.indexOf(g))&&(g=g.priceAxisViews(d,g.priceScale()))&&b.appendAll(g);return b};
TradingView.PriceAxisWidget.prototype.optimalWidth=function(){if(!this.isVisible())return 0;var a=0;if(this.pane.state()){var b=this.ctx,c=this.priceScale().marks();b.textBaseline="middle";b.textAlign=this._isLeft?"right":"left";try{b.font=this.baseFont}catch(d){}$.each(c,function(){var c=Math.round(b.measureText(this.label).width+10);c>a&&(a=c)});try{b.font=this.labelFont}catch(e){}for(var c=this.backLabels(!0),f=0;f<c.size();f++){if(c.item(f).font){var g=b.font;b.font=c.item(f).font()}var h=Math.round(b.measureText(c.item(f).text()).width+
10);h>a&&(a=h);c.item(f).font&&(b.font=g)}}return this._optimalWidth=this._BORDER_SIZE+this._MAJOR_TICK_LENGTH+a+-1};TradingView.PriceAxisWidget.prototype.resetOptimalWidth=function(){this._optimalWidth=0};TradingView.PriceAxisWidget.prototype.setFont=function(a,b,c){this.labelFont=this.baseFont=makeFont(a,b,c);this.fontSize=a};
TradingView.PriceAxisWidget.prototype.setSize=function(a){this.size&&this.size.equals(a)||(this.size=a,TradingView.setCanvasSize(this.canvas,a),TradingView.setCanvasSize(this.top_canvas,a),this.ctx=this.canvas.getContext("2d"),this.top_ctx=this.top_canvas.getContext("2d"),this.jqCell.css({width:a.w,"min-width":a.w,height:a.h}))};TradingView.PriceAxisWidget.prototype.update=function(){};
TradingView.PriceAxisWidget.prototype._hightlightBackground=function(a,b,c){for(var d=b.item(0).price,e=b.item(0).price,f=1;f<b.size();f++)d=Math.min(d,b.item(f).price),e=Math.max(e,b.item(f).price);b=this.priceScale();b.isPercent()&&c&&(c=c.firstValue(),d=b.priceRange().convertToPercent(d,c),e=b.priceRange().convertToPercent(e,c));d=this.priceScale().priceToCoordinate(d);e=this.priceScale().priceToCoordinate(e);clearRect(a,1,d,this.size.w-1,e-d,"rgba(109, 158, 235, 0.3)")};
TradingView.PriceAxisWidget.prototype.drawBackground=function(a){clearRect(a,0,0,this.size.w,this.size.h,this.backgroundColor());var b=this.pane.chart().model(),c=b.model().selectedSource();if(c&&c.priceScale()==this.priceScale()&&c instanceof LineDataSource){var d=c.points();if(0==d.size())return;this._hightlightBackground(a,d,c.ownerSource())}b=b.model().crossHairSource();b.startMeasurePoint()&&this._hightlightBackground(a,b.measurePoints(),this.pane.state().mainDataSource())};
TradingView.PriceAxisWidget.prototype.drawBorder=function(a){a.save();a.fillStyle=this.lineColor();var b=this.size.h;if(this._isLeft){a.translate(-0.5,-0.5);var c=this.size.w-this._BORDER_SIZE-1,d=this.size.w-1}else a.translate(0.5,-0.5),c=0,d=c+this._BORDER_SIZE;a.fillRect(c,0,d-c,b);a.restore()};
TradingView.PriceAxisWidget.prototype.drawTickMarks=function(a){a.save();a.strokeStyle=this.lineColor();var b=this.priceScale().marks();a.textBaseline="middle";a.textAlign=this._isLeft?"right":"left";a.fillStyle=this.textColor();try{a.font=this.baseFont}catch(c){}var d=this.size.w-1;a.translate(-0.5,-0.5);var e=b.length,f;if(this._isLeft){f=d-this._BORDER_SIZE;for(a.fillStyle=this.lineColor();e--;)d=b[e].major?this._MAJOR_TICK_LENGTH:this._MINOR_TICK_LENGTH,a.fillRect(f-d,b[e].coord,d,1);a.fillStyle=
this.textColor();for(e=b.length;e--;)a.fillText(b[e].label,f-this._MAJOR_TICK_LENGTH,b[e].coord)}else{f=this._BORDER_SIZE+1;for(a.fillStyle=this.lineColor();e--;)d=b[e].major?this._MAJOR_TICK_LENGTH:this._MINOR_TICK_LENGTH,a.fillRect(f,b[e].coord,d+1,1);a.fillStyle=this.textColor();for(e=b.length;e--;)a.fillText(b[e].label,f+this._MAJOR_TICK_LENGTH+1,b[e].coord)}a.restore()};
TradingView.PriceAxisWidget.prototype.drawBackLabels=function(a){a.save();try{a.font=this.labelFont}catch(b){}for(var c=this.backLabels(),d=0;d<c.size();d++)c.item(d).renderer().draw(a,this._isLeft,this.size.w,this.size.h);a.restore()};
TradingView.PriceAxisWidget.prototype.drawCrossHairLabel=function(a){var b=this.pane.chart().model().model(),c=[],d=b.sourceBeingMoved()||b.lineBeingEdited()||b.lineBeingCreated();d&&c.push({source:d,scale:d.priceScale()});b.selectedSource()&&c.push({source:b.selectedSource(),scale:b.selectedSource().priceScale()});b.hoveredSource()&&c.push({source:b.hoveredSource(),scale:b.hoveredSource().priceScale()});c.push({source:b.crossHairSource(),scale:this.priceScale()});for(b=0;b<c.length;b++)if(d=c[b],
d=d.source.priceAxisViews(this.pane.state(),d.scale)){a.save();try{a.font=this.labelFont}catch(e){}for(var f=0;f<d.size();f++)d.item(f).renderer().draw(a,this._isLeft,this.size.w,this.size.h);a.restore()}};TradingView.PriceAxisWidget.prototype.priceScale=function(){var a=this.pane.state(),b=[],b=this._isLeft?[a.leftPriceScale(),a.rightPriceScale()]:[a.rightPriceScale(),a.leftPriceScale()];return null===b[0].mainSource()?null===b[1].mainSource()?b[0]:b[1]:b[0]};
TradingView.PriceAxisWidget.prototype.isVisible=function(){return this._isVisible};TradingView.PriceAxisWidget.prototype.setVisible=function(a){a?this.jqCell.show():this.jqCell.hide();this._isVisible=!!a};TradingView.PriceAxisWidget.prototype.setAutoScale=function(a){var b=this.pane.state,c=this.priceScale();this.pane.chart().model().setPriceAutoScale(b,c,a)};
TradingView.PriceAxisWidget.prototype.reset=function(){var a=this.pane.state(),b=this.priceScale();this.pane.chart().model().resetPriceScale(a,b)};
TradingView.PriceAxisWidget.prototype.paint=function(a){this._isVisible&&a&&(a===TradingView.InvalidateMask.UPDATE_CURSOR_ONLY?(this.top_ctx.clearRect(0,0,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx)):(this.drawBackground(this.ctx),this.drawBorder(this.ctx),this.pane.state()&&(this.drawTickMarks(this.ctx),this.drawBackLabels(this.ctx),this.top_ctx.clearRect(0,0,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx))))};
TradingView.PriceAxisWidget.prototype.restoreDefaultCursor=function(){this.jqCell.css("cursor","default")};TradingView.PriceAxisWidget.prototype.image=function(){var a={};a.content=this.canvas.toDataURL();a.contentWidth=this.size.w;a.contentHeight=this.size.h;return a};TradingView.TimeAxisWidget=function(a,b){this.chart=a;this.contextMenu=null;this._disableContextMenu=!!b;this.jqRow=$(document.createElement("tr"));this.jqLhsTimeAxisStub=$(document.createElement("td"));this.jqLhsTimeAxisStub.addClass("chart-markup-table");this.jqLhsTimeAxisStub.appendTo(this.jqRow);this.jqLhsStub=$("<div>");this.jqLhsStub.css("width","100%");this.jqLhsStub.css("height","100%");this.jqLhsStub.css("position","relative");this.jqLhsStub.css("overflow","hidden");this.jqLhsStub.appendTo(this.jqLhsTimeAxisStub);
this.lhsCanvas=TradingView.addCanvasTo(this.jqLhsStub,new TradingView.Size(16,16));$(this.lhsCanvas).css("position","absolute");$(this.lhsCanvas).css("z-order","2");$(this.lhsCanvas).css("left",0);$(this.lhsCanvas).css("top",0);this.lhsCtx=this.lhsCanvas.getContext("2d");this.jqCell=$(document.createElement("td"));this.jqCell.appendTo(this.jqRow);this.jqCell.addClass("chart-markup-table");this.jqCell.addClass("time-axis");this.jqCell.height(25);this._dv=$("<div>");this._dv.css("width","100%");this._dv.css("height",
"100%");this._dv.css("position","relative");this._dv.css("overflow","hidden");this._dv.appendTo(this.jqCell);this.canvas=TradingView.addCanvasTo(this._dv,new TradingView.Size(16,16));$(this.canvas).css("position","absolute");$(this.canvas).css("z-order","2");$(this.canvas).css("left",0);$(this.canvas).css("top",0);this.ctx=this.canvas.getContext("2d");this.top_canvas=TradingView.addCanvasTo(this._dv,new TradingView.Size(16,16));$(this.top_canvas).css("position","absolute");$(this.top_canvas).css("z-order",
"1");$(this.top_canvas).css("left",0);$(this.top_canvas).css("top",0);this.top_ctx=this.top_canvas.getContext("2d");this.jqRhsTimeAxisStub=$(document.createElement("td"));this.jqRhsTimeAxisStub.addClass("chart-markup-table");this.jqRhsTimeAxisStub.appendTo(this.jqRow);this.jqRhsStub=$("<div>");this.jqRhsStub.css("width","100%");this.jqRhsStub.css("height","100%");this.jqRhsStub.css("position","relative");this.jqRhsStub.css("overflow","hidden");this.jqRhsStub.appendTo(this.jqRhsTimeAxisStub);this.rhsCanvas=
TradingView.addCanvasTo(this.jqRhsStub,new TradingView.Size(16,16));$(this.rhsCanvas).css("position","absolute");$(this.rhsCanvas).css("z-order","2");$(this.rhsCanvas).css("left",0);$(this.rhsCanvas).css("top",0);this.rhsCtx=this.rhsCanvas.getContext("2d");this.setFont(11,"Arial","");this.restoreDefaultCursor();this.update();this._minVisibleSpan=MINUTE_SPAN;TradingView.setMouseEventHandler(this.jqCell,this,!0);this.updatePriceScalesVisibility()};TradingView.TimeAxisWidget.prototype.BORDER_SIZE=1;
TradingView.TimeAxisWidget.prototype.MAJOR_TICK_LENGTH=4;TradingView.TimeAxisWidget.prototype.MINOR_TICK_LENGTH=2;TradingView.TimeAxisWidget.prototype.backgroundColor=function(){var a=this.chart.model();return a?a.model().properties().paneProperties.background.value():"#ffffff"};TradingView.TimeAxisWidget.prototype.lineColor=function(){var a=this.chart.model();return a?a.model().properties().scalesProperties.lineColor.value():"#ffffff"};
TradingView.TimeAxisWidget.prototype.textColor=function(){var a=this.chart.model();return a?a.model().properties().scalesProperties.textColor.value():"#ffffff"};TradingView.TimeAxisWidget.prototype.updatePriceScalesVisibility=function(){this.chart.properties().scalesProperties.showLeftScale.value()?this.jqLhsTimeAxisStub.show():this.jqLhsTimeAxisStub.hide();this.chart.properties().scalesProperties.showRightScale.value()?this.jqRhsTimeAxisStub.show():this.jqRhsTimeAxisStub.hide()};
TradingView.TimeAxisWidget.prototype.mouseDownEvent=function(a){if(this._mousedown)return!0;this._mousedown=!0;var b=this.chart.model();b.timeScale().isEmpty()||($(this.jqCell).css("cursor",cursorCss("cursor_size_horizontal","15 15")),b.startScaleTime(a.localX))};TradingView.TimeAxisWidget.prototype.mouseDownOutsideEvent=function(a){a=this.chart.model();!a.timeScale().isEmpty()&&this._mousedown&&(this._mousedown=!1,a.endScaleTime(),this.restoreDefaultCursor())};
TradingView.TimeAxisWidget.prototype.pressedMouseMoveEvent=function(a){var b=this.chart.model();if(!b.timeScale().isEmpty()){var c=!1,d=(new Date).valueOf();this._lastScrollScaleTime&&100>d-this._lastScrollScaleTime&&(c=!0);c||(TradingView.trackEvent("GUI","Scaling time scale"),b.scaleTimeTo(a.localX),this._lastScrollScaleTime=d)}};TradingView.TimeAxisWidget.prototype.mouseUpEvent=function(a){this._mousedown=!1;a=this.chart.model();a.timeScale().isEmpty()||(a.endScaleTime(),this.restoreDefaultCursor())};
TradingView.TimeAxisWidget.prototype.contextMenuEvent=function(a,b){this._disableContextMenu||this._createContextMenu().show(a)};TradingView.TimeAxisWidget.prototype._createContextMenu=function(){var a=this.chart;a.model().mainSeries().createSessStudy();a.updateActions();a=a.actions();a=TradingView.isRunningChartingLibrary?[a.timeScaleReset,new ActionSeparator,a.applyTimeZone,a.extendedHours]:[a.timeScaleReset,new ActionSeparator,a.applyTimeZone,a.sessionBreaks,a.extendedHours];return ContextMenu.createMenu(a)};
TradingView.TimeAxisWidget.prototype.mouseClickEvent=function(a){};TradingView.TimeAxisWidget.prototype.mouseDoubleClickEvent=function(a){TradingView.trackEvent("GUI","Double click time scale");this.chart.model().resetTimeScale()};TradingView.TimeAxisWidget.prototype.optimalHeight=function(){return this.isVisible()?this.BORDER_SIZE+this.MAJOR_TICK_LENGTH+this.maxFontSize+6:0};
TradingView.TimeAxisWidget.prototype.setFont=function(a,b,c){this.baseFont=makeFont(a,b,c);this.baseBoldFont=makeFont(a,b,c+" bold ");this.labelFont=this.baseFont;this.maxFontSize=a};
TradingView.TimeAxisWidget.prototype.setSize=function(a,b,c){this.size&&this.size.equals(a)||(this.lhsStubSize=b,TradingView.setCanvasSize(this.lhsCanvas,b),this.lhsCtx=this.lhsCanvas.getContext("2d"),this.jqLhsTimeAxisStub.width(b.w),this.jqLhsTimeAxisStub.height(b.h),this.rhsStubSize=c,TradingView.setCanvasSize(this.rhsCanvas,c),this.rhsCtx=this.rhsCanvas.getContext("2d"),this.jqRhsTimeAxisStub.width(c.w),this.jqRhsTimeAxisStub.height(c.h),this.size=a,TradingView.setCanvasSize(this.canvas,a),TradingView.setCanvasSize(this.top_canvas,
a),this.ctx=this.canvas.getContext("2d"),this.jqCell.width(a.w),this.jqCell.height(a.h))};TradingView.TimeAxisWidget.prototype._spanIndex=function(a){for(var b=[MINUTE_SPAN,HOUR_SPAN,DAY_SPAN,MONTH_SPAN,YEAR_SPAN],c=b.length-1;0<c&&!(b[c]<=a);)c--;return c};TradingView.TimeAxisWidget.prototype._spanOffset=function(a,b){if(b<a)throw new Exception("actual span cuold not be less then base");return this._spanIndex(b)-this._spanIndex(a)};
TradingView.TimeAxisWidget.prototype.update=function(){if(this.chart.model()){var a=this.chart.model().timeScale().marks();if(a){var b=this;this._minVisibleSpan=YEAR_SPAN;$.each(a,function(){b._minVisibleSpan=Math.min(this.span,b._minVisibleSpan)})}}};
TradingView.TimeAxisWidget.prototype._hightlightBackground=function(a,b){for(var c=this.chart.model().timeScale(),d=b.item(0).index,e=b.item(0).index,f=1;f<b.size();f++)d=Math.min(d,b.item(f).index),e=Math.max(e,b.item(f).index);d=c.indexToCoordinate(d);c=c.indexToCoordinate(e);clearRect(a,d,1,c-d,this.size.h-1,"rgba(109, 158, 235, 0.3)")};
TradingView.TimeAxisWidget.prototype.drawBackground=function(a){clearRect(a,0,0,this.size.w,this.size.h,this.backgroundColor());var b=this.chart.model();if(b){var c=b.timeScale(),d=b.model().selectedSource();if(d&&d instanceof LineDataSource&&!c.isEmpty()){c=d.points();if(0==c.size())return;this._hightlightBackground(a,c)}b=b.model().crossHairSource();b.startMeasurePoint()&&this._hightlightBackground(a,b.measurePoints())}};
TradingView.TimeAxisWidget.prototype.drawBorder=function(a){a.save();a.fillStyle=this.lineColor();a.fillRect(-0.5,0.5,this.size.w+0.5,this.BORDER_SIZE);a.restore()};
TradingView.TimeAxisWidget.prototype.drawStubs=function(){var a=this.BORDER_SIZE,b=2*this.BORDER_SIZE,c=this.lhsCtx;clearRect(c,0,0,this.lhsStubSize.w,this.lhsStubSize.h,this.backgroundColor());c.fillStyle=this.lineColor();c.fillRect(this.lhsStubSize.w-b-0.5,0.5,b,a);c.fillRect(this.lhsStubSize.w-b-0.5,-0.5,a,a);c=this.rhsCtx;clearRect(c,0,0,this.rhsStubSize.w,this.rhsStubSize.h,this.backgroundColor());c.fillStyle=this.lineColor();c.fillRect(-0.5,0.5,b,a);c.fillRect(0.5,-0.5,a,a)};
TradingView.TimeAxisWidget.prototype.drawTickMarks=function(a){var b=this.chart.model().timeScale().marks();if(b&&0!=b.length){var c=b.reduce(function(a,b){return a.span>b.span?a:b}).span;30<c&&40>c&&(c=30);a.save();a.strokeStyle=this.lineColor();a.textBaseline="top";a.textAlign="center";a.translate(0.5,0.5);a.fillStyle=this.lineColor();for(var d=b.length;d--;)a.fillRect(b[d].coord,this.BORDER_SIZE,1,b[d].major?this.MAJOR_TICK_LENGTH:this.MINOR_TICK_LENGTH);a.fillStyle=this.textColor();for(d=b.length;d--;)a.font=
b[d].span>=c?this.baseBoldFont:this.baseFont,a.fillText(b[d].label,b[d].coord,this.BORDER_SIZE+this.MAJOR_TICK_LENGTH-1);a.restore()}};
TradingView.TimeAxisWidget.prototype.drawBackLabels=function(a){a.save();try{a.font=this.labelFont}catch(b){}for(var c=this.chart.model().dataSources(),d=this.chart.model(),d=d.sourceBeingMoved()||d.lineBeingEdited()||d.lineBeingCreated(),e=0;e<c.size();e++){var f=c.item(e);if(f!==this.chart.model().crossHairSource()&&f!==d&&f.timeAxisViews&&(f=f.timeAxisViews()))for(var g=0;g<f.size();g++)f.item(g).renderer().draw(a,this.size.w,this.size.h)}a.restore()};
TradingView.TimeAxisWidget.prototype.drawCrossHairLabel=function(a){var b=this.chart.model();if(b=b.sourceBeingMoved()||b.lineBeingEdited()||b.lineBeingCreated()){if(a.save(),b.timeAxisViews&&(b=b.timeAxisViews()))for(var c=0;c<b.size();c++)b.item(c).renderer().draw(a,this.size.w,this.size.h)}else{a.save();try{a.font=this.labelFont}catch(d){}if(b=this.chart.model().crossHairSource().timeAxisView())for(c=0;c<b.size();c++)b.item(c).renderer().draw(a,this.size.w,this.size.h)}a.restore()};
TradingView.TimeAxisWidget.prototype.paint=function(a){try{this.top_ctx.font=this.labelFont}catch(b){}0!==a&&(a===TradingView.InvalidateMask.UPDATE_CURSOR_ONLY?(this.top_ctx.clearRect(-0.5,-0.5,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx)):(a=this.ctx,this.drawBackground(a),this.drawBorder(a),this.drawStubs(),this.chart.model()&&(this.drawTickMarks(a),this.drawBackLabels(a),this.drawCrossHairLabel(this.top_ctx))))};
TradingView.TimeAxisWidget.prototype.setStubVisible=function(a,b){var c=TradingView.PriceAxisWidget.isLeft(a)?this.jqLhsTimeAxisStub:this.jqRhsTimeAxisStub;b?c.show():c.hide()};TradingView.TimeAxisWidget.prototype.isVisible=function(){return this.jqRow.is(":visible")};TradingView.TimeAxisWidget.prototype.setVisible=function(a){a?this.jqRow.show():this.jqRow.hide()};TradingView.TimeAxisWidget.prototype.restoreDefaultCursor=function(){this.jqCell.css("cursor","default")};
TradingView.TimeAxisWidget.prototype.image=function(){var a={};a.content=this.canvas.toDataURL();a.contentWidth=this.size.w;a.contentHeight=this.size.h;a.lhsStub={};a.lhsStub.content=this.lhsCanvas.toDataURL();a.lhsStub.contentWidth=this.lhsStubSize.w;a.lhsStub.contentHeight=this.lhsStubSize.h;a.rhsStub={};a.rhsStub.content=this.rhsCanvas.toDataURL();a.rhsStub.contentWidth=this.rhsStubSize.w;a.rhsStub.contentHeight=this.rhsStubSize.h;return a};function StudyInputsPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._study=c;this.prepareLayout()}inherit(StudyInputsPropertyPage,PropertyPage);
StudyInputsPropertyPage.prototype._addSessionEditor=function(a,b,c,d){if("session"!==c.type)TradingView.logError("Session editor adding FAILED: wrong input type.");else{c=function(a,b){var c=$("<td/>");c.appendTo(a);c.css("padding-left","0px");c.css("padding-right","0px");var d=$("<input>");d.attr("type","text");d.addClass("ticker");d.css("width","40px");d.attr("id",b);d.appendTo(c)};var e=function(a,b,c){var d=$("<td/>");d.css("padding-left",c);d.css("padding-right",c);d.appendTo(a);a=$("<div/>");
a.appendTo(d);a.append(b);a.css("font-size","150%")},f=$("<table/>");f.appendTo(a);a=$("<tr/>");a.appendTo(f);editorIds=["start_hours","start_minutes","end_hours","end_minutes"];c.call(this,a,editorIds[0]);e.call(this,a,":",0);c.call(this,a,editorIds[1]);e.call(this,a,"-",4);c.call(this,a,editorIds[2]);e.call(this,a,":",0);c.call(this,a,editorIds[3]);this.bindControl(new SessionBinder(a,editorIds,b,!1,this.model(),d))}};
StudyInputsPropertyPage.prototype.prepareLayoutImpl=function(a,b){for(var c=0;c<a.inputs.length;c++){var d=a.inputs[c],e=d.id;if("first_visible_bar_time"!=e&&"last_visible_bar_time"!=e&&"time"!=d.type&&!d.isHidden){var f=d.name||e.toLowerCase().replace(/\b\w/g,function(a){return a.toUpperCase()}),g="Change "+f,h=$("<tr/>");h.appendTo(b);var k=$("<td/>");k.appendTo(h);k.addClass($.t("propertypage-name-label",{context:"css_class"}));k.text($.t(f,{context:"input"}));f=$("<td/>");f.appendTo(h);h=null;
if("resolution"===d.type)h=$('<select><option value="1">1</option><option value="3">3</option><option value="5">5</option><option value="15">15</option><option value="30">30</option><option value="45">45</option><option value="60">1h</option><option value="120">2h</option><option value="180">3h</option><option value="D">1d</option><option value="W">1w</option></select>');else if("symbol"===d.type)h=$('<input class="symbol-edit single">'),TradingView.SymbolSearch.bindToInput(h);else if("session"===
d.type)this._addSessionEditor(f,this._property.inputs[e],d,g);else if(d.options)for(h=$("<select/>"),k=0;k<d.options.length;k++){var m=d.options[k];$("<option value='"+m+"'>"+m+"</option>").appendTo(h)}else h=$("<input/>"),"bool"===d.type?h.attr("type","checkbox"):h.attr("type","text");h&&(h.appendTo(f),h.is(":checkbox")||h.css("width","100px"));d.options?this.bindControl(new SimpleComboBinder(h,this._property.inputs[e],null,!0,this.model(),g)):"bar_time"===d.type?(this.bindControl(new BarTimeBinder(h,
this._property.inputs[e],!0,this.model(),g,this.model().mainSeries(),10)),h.addClass("ticker")):"integer"===d.type?(k=[ToIntTransformer(d.defval)],(0===d.min||d.min)&&k.push(GreateTransformer(d.min)),(0===d.max||d.max)&&k.push(LessTransformer(d.max)),this.bindControl(new SimpleStringBinder(h,this._property.inputs[e],k,!1,this.model(),g)),h.addClass("ticker")):"float"===d.type?(k=[ToFloatTransformer(d.defval)],(0===d.min||d.min)&&k.push(GreateTransformer(d.min)),(0===d.max||d.max)&&k.push(LessTransformer(d.max)),
this.bindControl(new SimpleStringBinder(h,this._property.inputs[e],k,!1,this.model(),g)),h.addClass("ticker")):"text"===d.type?this.bindControl(new SimpleStringBinder(h,this._property.inputs[e],null,!1,this.model(),g)):"bool"===d.type?this.bindControl(new BooleanBinder(h,this._property.inputs[e],!0,this.model(),g)):"resolution"===d.type?this.bindControl(new SimpleComboBinder(h,this._property.inputs[e],UppercaseTransformer,!0,this.model(),"Change Interval")):"symbol"===d.type&&this.bindControl(new SymbolBinder(h,
this._property.inputs[e],!0,this.model(),"Change Symbol"))}}this._property.offset&&(f=this._property.offset.title?this._property.offset.title.value():"Offset",h=this.addOffsetEditorRow(b,f),k=[ToIntTransformer(this._property.offset.val)],k.push(GreateTransformer(this._property.offset.min)),k.push(LessTransformer(this._property.offset.max)),this.bindControl(new SimpleStringBinder(h,this._property.offset.val,k,!1,this.model(),"Undo "+f)));this._property.offsets&&$.each(this._study.metaInfo().plots,
function(a,c){if(this._property.offsets[c.id]){var d=this._property.offsets[c.id];if(void 0==d.isHidden||!d.isHidden.value()){var e=d.title.value(),f=this.addOffsetEditorRow(b,e),g=[ToIntTransformer(d.val)];g.push(GreateTransformer(d.min));g.push(LessTransformer(d.max));this.bindControl(new SimpleStringBinder(f,d.val,g,!1,this.model(),"Undo "+e))}}}.bind(this))};
StudyInputsPropertyPage.prototype.prepareLayout=function(){this._table=$("<table/>");this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=this._study.metaInfo();this.prepareLayoutImpl(a,this._table);this.loadData()};StudyInputsPropertyPage.prototype.widget=function(){return this._table};function StudyStylesPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._study=c;this.prepareLayout()}inherit(StudyStylesPropertyPage,PropertyPage);
StudyStylesPropertyPage.prototype.prepareLayout=function(){this._table=$("<table/>");this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");for(var a=0;a<this._study.metaInfo().plots.length;++a)if(!this._study.isSelfColorerPlot(a)&&!this._study.isDataOffsetPlot(a)){var b=this._study.metaInfo().plots[a];this._study.isLinePlot(a)||this._study.isBarColorerPlot(a)||this._study.isBgColorerPlot(a)?this._prepareLayoutForPlot(a,b):this._study.isPlotArrowsPlot(a)?
this._prepareLayoutForArrowsPlot(a,b):this._study.isPlotCharsPlot(a)?this._prepareLayoutForCharsPlot(a,b):this._study.isPlotShapesPlot(a)?this._prepareLayoutForShapesPlot(a,b):console.error("Unknown plot type: "+b.type)}if(a=this._study.properties().transparency){var c=$('<tr class="line"/>');c.appendTo(this._table);$("<td/>").appendTo(c);b=$("<td/>");b.appendTo(c);b.addClass("propertypage-name-label");b.html($.t("Transparency"));b=$("<td/>");b.attr("colspan","3");b.appendTo(c);c=TradingView.createTransparencyEditor().width(270);
c.appendTo(b);this.bindControl(new SliderBinder(c,a,!0,this.model(),"Change Study Transparency"))}var d=this._study.properties().bands;if(d&&0<d.childCount())for(a=0;a<d.childCount();a++){b=d[a];c=$('<tr class="line"/>');c.appendTo(this._table);var e=$("<td/>");e.appendTo(c);var f=$("<input type='checkbox' class='visibility-switch'/>");f.appendTo(e);e=b.name.value();this.createLabeledCell(e,f).appendTo(c).addClass($.t("propertypage-name-label",{context:"css_class"}));e=$("<td/>");e.appendTo(c);e.addClass("colorpicker-cell");
var e=TradingView.addColorPicker(e),g=$("<td/>");g.appendTo(c);var h=TradingView.createLineWidthEditor();h.appendTo(g);var k=$('<td colspan="4">').css({whiteSpace:"nowrap"});k.appendTo(c);g=TradingView.createLineStyleEditor();g.render().appendTo(k);var m=$("<input class='property-page-bandwidth' type='text'/>");m.appendTo(k);k=[ToFloatTransformer(b.value.value())];c="Change band";this.bindControl(new SimpleStringBinder(m,b.value,k,!1,this.model(),c));this.bindControl(new BooleanBinder(f,b.visible,
!0,this.model(),c));this.bindControl(new ColorBinding(e,b.color,!0,this.model(),c));this.bindControl(new SimpleComboBinder(g,b.linestyle,parseInt,!0,this.model(),c));this.bindControl(new SliderBinder(h,b.linewidth,!0,this.model(),c))}this._study.properties().bandsBackground&&(b=this._study.properties().bandsBackground,f=$.t("Background"),c=this._prepareFilledAreaBackground(b.fillBackground,b.backgroundColor,b.transparency,f,"Change band background"),c.appendTo(this._table));this._study.properties().areaBackground&&
(b=this._study.properties().areaBackground,f=$.t("Background"),c=this._prepareFilledAreaBackground(b.fillBackground,b.backgroundColor,b.transparency,f,"Change area background"),c.appendTo(this._table));d=this._study.metaInfo().filledAreas;if(void 0!=d)for(a=0;a<d.length;++a)c=d[a],b=this._study.properties().filledAreasStyle[c.id],f=c.title||$.t("Background"),c="Change "+f,c=this._prepareFilledAreaBackground(b.visible,b.color,b.transparency,f,c),c.appendTo(this._table);for(var n in this._study.metaInfo().graphics){var a=
this._study.metaInfo().graphics[n],q;for(q in a)b=this._property.graphics[n][q],StudyStylesPropertyPage["_createRow_"+n].call(this,this._table,b)}1==this._table.find("tr").length&&(e=this._table.find(".visibility-cell"),e.css("display","none"),b=this._table.find(".propertypage-name-label"),b.css("padding-left",0));n=this._prepareStudyPropertiesLayout();this._table=this._table.add(n);this.loadData()};
StudyStylesPropertyPage.prototype._prepareLayoutForPlot=function(a,b){var c=b.id,d=this._study.properties().styles[c],e=this._findPlotPalette(a,b),f=e.palette,g=e.paletteProps,e="Change "+c;if(f)this._prepareLayoutForPalette(a,b,f,g,e);else{f=$('<tr class="line"/>');f.appendTo(this._table);var h=$("<td/>");h.appendTo(f);h.addClass("visibility-cell");g=$("<input type='checkbox' class='visibility-switch'/>");g.appendTo(h);c=this._study.properties().styles[c].title.value();this.createLabeledCell(c,g).appendTo(f).addClass($.t("propertypage-name-label",
{context:"css_class"}));c=$("<td/>");c.appendTo(f);c.addClass("colorpicker-cell");var c=TradingView.addColorPicker(c),k=$("<td/>");k.appendTo(f);h=TradingView.createLineWidthEditor();h.appendTo(k);var m=$("<td>");m.appendTo(f);k=TradingView.createPlotEditor();k.appendTo(m);var n=$("<td>");n.appendTo(f);var q=TradingView.createTransparencyEditor(c);q.appendTo(n);m=d.plottype.value();n.css("display",this._isStyleNeedsTransparency(m)?"block":"none");m=$("<td>");m.appendTo(f);var l=$("<input type='checkbox'>");
l.appendTo(m);this.createLabeledCell("Price Line",l).appendTo(f);this.bindControl(new BooleanBinder(g,d.visible,!0,this.model(),e));this.bindControl(new ColorBinding(c,d.color,!0,this.model(),e));this.bindControl(new SliderBinder(h,d.linewidth,!0,this.model(),e));this.bindControl(new SimpleComboBinder(k,d.plottype,parseInt,!0,this.model(),e));this.bindControl(new SliderBinder(q,d.transparency,!0,this.model(),e));this.bindControl(new BooleanBinder(l,d.trackPrice,!0,this.model(),"Change Price Line"));
e=function(){var a=d.plottype.value();n.css("display",this._isStyleNeedsTransparency(a)?"table-cell":"none");q.css("display",this._isStyleNeedsTransparency(a)?"inline-block":"none")}.bind(this);e();d.plottype.listeners().subscribe(null,e)}};
StudyStylesPropertyPage.prototype._prepareLayoutForShapesPlot=function(a,b){var c=b.id,d=this._study.properties().styles[c],e=this._findPlotPalette(a,b),f=e.palette,g=e.paletteProps,e="Change "+c,h=$('<tr class="line"/>');h.appendTo(this._table);var k=$("<td/>");k.appendTo(h);k.addClass("visibility-cell");var m=$("<input type='checkbox' class='visibility-switch'/>");m.appendTo(k);this.bindControl(new BooleanBinder(m,d.visible,!0,this.model(),e));c=this._study.properties().styles[c].title.value();
this.createLabeledCell(c,m).appendTo(h).addClass($.t("propertypage-name-label",{context:"css_class"}));c=$("<td/>");c.appendTo(h);m=TradingView.createShapeStyleEditor();m.appendTo(c);this.bindControl(new SimpleComboBinder(m,d.plottype,null,!0,this.model(),e));c=$("<td/>");c.appendTo(h);h=TradingView.createShapeLocationEditor();h.appendTo(c);this.bindControl(new SimpleComboBinder(h,d.location,null,!0,this.model(),e));f?this._prepareLayoutForPalette(a,b,f,g,e):(h=$('<tr class="line"/>'),h.appendTo(this._table),
$("<td/>").appendTo(h),$("<td/>").appendTo(h),f=$("<td/>"),f.appendTo(h),f.addClass("colorpicker-cell"),g=TradingView.addColorPicker(f),this.bindControl(new ColorBinding(g,d.color,!0,this.model(),e)),f=$("<td>"),f.appendTo(h),h=TradingView.createTransparencyEditor(g),h.appendTo(f),this.bindControl(new SliderBinder(h,d.transparency,!0,this.model(),e)))};
StudyStylesPropertyPage.prototype._prepareLayoutForCharsPlot=function(a,b){var c=b.id,d=this._study.properties().styles[c],e=this._findPlotPalette(a,b),f=e.palette,g=e.paletteProps,e="Change "+c,h=$('<tr class="line"/>');h.appendTo(this._table);var k=$("<td/>");k.appendTo(h);k.addClass("visibility-cell");var m=$("<input type='checkbox' class='visibility-switch'/>");m.appendTo(k);this.bindControl(new BooleanBinder(m,d.visible,!0,this.model(),e));c=this._study.properties().styles[c].title.value();this.createLabeledCell(c,
m).appendTo(h).addClass($.t("propertypage-name-label",{context:"css_class"}));c=$("<td/>");c.appendTo(h);m=TradingView.createTextEditor();m.appendTo(c);m.keyup(function(){var a=$(this),b=a.val();b&&(a.val(b.split("")[b.length-1]),a.change())});this.bindControl(new SimpleStringBinder(m,d["char"],null,!1,this.model(),e));c=$("<td/>");c.appendTo(h);h=TradingView.createShapeLocationEditor();h.appendTo(c);this.bindControl(new SimpleComboBinder(h,d.location,null,!0,this.model(),e));f?this._prepareLayoutForPalette(a,
b,f,g,e):(h=$('<tr class="line"/>'),h.appendTo(this._table),$("<td/>").appendTo(h),$("<td/>").appendTo(h),f=$("<td/>"),f.appendTo(h),f.addClass("colorpicker-cell"),g=TradingView.addColorPicker(f),this.bindControl(new ColorBinding(g,d.color,!0,this.model(),e)),f=$("<td>"),f.appendTo(h),h=TradingView.createTransparencyEditor(g),h.appendTo(f),this.bindControl(new SliderBinder(h,d.transparency,!0,this.model(),e)))};
StudyStylesPropertyPage.prototype._isStyleNeedsTransparency=function(a){return 0<=[TradingView.Study.PLOT_AREA,TradingView.Study.PLOT_AREA_WITH_BREAKS,TradingView.Study.PLOT_COLUMNS].indexOf(a)};StudyStylesPropertyPage.prototype._isStyleNeedsConnectPoints=function(a){return 0<=[TradingView.Study.PLOT_CROSS,TradingView.Study.PLOT_CIRCLES].indexOf(a)};
StudyStylesPropertyPage.prototype._prepareLayoutForPalette=function(a,b,c,d,e){b=b.id;var f=this._study.properties().styles[b];b=0;for(var g in c.colors){var h=d.colors[g];c=$('<tr class="line"/>');c.appendTo(this._table);$("<td/>").appendTo(c);var k=$("<td/>");k.appendTo(c);k.addClass($.t("propertypage-name-label",{context:"css_class"}));k.html($.t(h.name.value()));k=$("<td/>");k.appendTo(c);k.addClass("colorpicker-cell");k=TradingView.addColorPicker(k);this.bindControl(new ColorBinding(k,h.color,
!0,this.model(),e));if(0===b&&(this._study.isBgColorerPlot(a)||this._study.isPlotCharsPlot(a)||this._study.isPlotShapesPlot(a))){var m=$("<td>");m.appendTo(c);var n=TradingView.createTransparencyEditor(k);n.appendTo(m);this.bindControl(new SliderBinder(n,f.transparency,!0,this.model(),e))}if(this._study.isLinePlot(a)){m=$("<td/>");m.appendTo(c);var q=TradingView.createLineWidthEditor();q.appendTo(m);this.bindControl(new SliderBinder(q,h.width,!0,this.model(),e));h=$("<td>");h.appendTo(c);0===b&&(m=
TradingView.createPlotEditor(),m.appendTo(h),this.bindControl(new SimpleComboBinder(m,f.plottype,parseInt,!0,this.model(),e)),m=$("<td>"),m.appendTo(c),n=TradingView.createTransparencyEditor(k),n.appendTo(m),this.bindControl(new SliderBinder(n,f.transparency,!0,this.model(),e)),h=function(){var a=f.plottype.value();n.css("display",this._isStyleNeedsTransparency(a)?"block":"none")}.bind(this),h(),f.plottype.listeners().subscribe(null,h),h=$("<input type='checkbox'>"),k=$('<td colspan="4">').css({whiteSpace:"nowrap"}),
m=$("<span>").html($.t("Price Line")),q=$("<span>"),q.append(h),k.append(q).append(m).appendTo(c),this.bindControl(new BooleanBinder(h,f.trackPrice,!0,this.model(),"Change Price Line")))}b++}};
StudyStylesPropertyPage.prototype._prepareLayoutForArrowsPlot=function(a,b){var c=b.id,d=this._study.properties().styles[c],e="Change "+c,f=$('<tr class="line"/>');f.appendTo(this._table);var g=$("<td/>");g.appendTo(f);g.addClass("visibility-cell");var h=$("<input type='checkbox' class='visibility-switch'/>");h.appendTo(g);c=this._study.properties().styles[c].title.value();this.createLabeledCell(c,h).appendTo(f).addClass($.t("propertypage-name-label",{context:"css_class"}));c=$("<td/>");c.appendTo(f);
c.addClass("colorpicker-cell");c=TradingView.addColorPicker(c);g=$("<td/>");g.appendTo(f);g.addClass("colorpicker-cell");var g=TradingView.addColorPicker(g),k=$("<td>");k.appendTo(f);f=TradingView.createTransparencyEditor();f.appendTo(k);this.bindControl(new BooleanBinder(h,d.visible,!0,this.model(),e));this.bindControl(new ColorBinding(c,d.colorup,!0,this.model(),e));this.bindControl(new ColorBinding(g,d.colordown,!0,this.model(),e));this.bindControl(new SliderBinder(f,d.transparency,!0,this.model(),
e))};StudyStylesPropertyPage.prototype._findPlotPalette=function(a,b){var c=b.id,d=null,e=null,f=this._study.metaInfo().plots;if(this._study.isBarColorerPlot(a)||this._study.isBgColorerPlot(a))d=this._study.metaInfo().palettes[b.palette],e=this._study.properties().palettes[b.palette];else for(var g=0;g<f.length;g++)if(this._study.isSelfColorerPlot(g)&&f[g].target===c){d=this._study.metaInfo().palettes[f[g].palette];e=this._study.properties().palettes[f[g].palette];break}return{palette:d,paletteProps:e}};
StudyStylesPropertyPage.prototype._prepareStudyPropertiesLayout=function(){var a=$('<table class="property-page study-properties" cellspacing="0" cellpadding="2">');if(!this._study.metaInfo().is_price_study){var b=this.createPrecisionEditor(),c=$("<tr>");c.appendTo(a);$("<td>"+$.t("Precision")+"</td>").appendTo(c);$("<td>").append(b).appendTo(c);this.bindControl(new SimpleComboBinder(b,this._study.properties().precision,null,!0,this.model(),"Change Precision"))}"Compare@tv-basicstudies"==this._study.metaInfo().id&&
(b=this.createSeriesMinTickEditor(),c=$("<tr>"),c.appendTo(a),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(c),$("<td>").append(b).appendTo(c),this.bindControl(new SimpleComboBinder(b,this._study.properties().minTick,null,!0,this.model(),"Change MinTick")));return a};StudyStylesPropertyPage.prototype.widget=function(){return this._table};
StudyStylesPropertyPage.prototype._prepareFilledAreaBackground=function(a,b,c,d,e){var f=$('<tr class="line"/>'),g=$("<td/>");g.appendTo(f);var h=$("<input type='checkbox' class='visibility-switch'/>");h.appendTo(g);this.createLabeledCell(d,h).appendTo(f).addClass($.t("propertypage-name-label",{context:"css_class"}));d=$("<td/>");d.appendTo(f);d.addClass("colorpicker-cell");d=TradingView.addColorPicker(d);g=$("<td/>");g.attr("colspan","3");g.appendTo(f);var k=TradingView.createTransparencyEditor(d).width(230);
k.appendTo(g);this.bindControl(new BooleanBinder(h,a,!0,this.model(),e+" visibility"));this.bindControl(new ColorBinding(d,b,!0,this.model(),e+" color"));this.bindControl(new SliderBinder(k,c,!0,this.model(),e+" transparency"));return f};
function StudyDisplayPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._study=c;this._property=a;var d=null;$.each(b.m_model.panes().toArray(),function(a,b){$.each(b.dataSources().toArray(),function(a,e){if(e==c)return d=b,!1})});this._pane=d;this.prepareLayout()}inherit(StudyDisplayPropertyPage,PropertyPage);
StudyDisplayPropertyPage.prototype.prepareLayout=function(){if(this._study.properties().linkedToSeries&&this._study.properties().linkedToSeries.value())this._table=$();else{var a=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b=$('<input type="checkbox" class="visibility-switch">'),c=this.addLabeledRow(a,"Last Value on Price Scale",b);$("<td>").prependTo(c).append(b);this.bindControl(new BooleanBinder(b,this._property.showLastValue,!0,this.model(),"Change Last Value on Price Scale Visibility"));
"undefined"!==typeof this._property.showStudyArguments&&(b=$('<input type="checkbox" class="visibility-switch">'),c=this.addLabeledRow(a,"Arguments in Header",b),$("<td>").prependTo(c).append(b),this.bindControl(new BooleanBinder(b,this._property.showStudyArguments,!0,this.model(),"Change Arguments in Header Visibility")));c=this._prepareStudyAttachmentLayout();this._table=a=a.add(c)}};
StudyDisplayPropertyPage.prototype._prepareStudyAttachmentLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b;this._pane&&(this._pane.leftPriceScale().dataSources().contains(this._study)?b="left":this._pane.rightPriceScale().dataSources().contains(this._study)?b="right":this._pane.isOverlay(this._study)&&(b="none"));if(b){var c=this;b=this.createKeyCombo({left:$.t("Scale Left"),right:$.t("Scale Right"),none:$.t("Screen (No Scale)")}).val(b).change(function(){switch(this.value){case "left":c._model.move(c._study,
c._pane,c._pane.leftPriceScale());break;case "right":c._model.move(c._study,c._pane,c._pane.rightPriceScale());break;case "none":c._model.move(c._study,c._pane,null)}});var d=this.addRow(a);$("<td>").appendTo(d).append(b)}return a};StudyDisplayPropertyPage.prototype.widget=function(){return this._table};
StudyStylesPropertyPage._createRow_horizlines=function(a,b){var c=this.addRow(a),d=b.name.value(),e=$("<input type='checkbox' class='visibility-switch'/>"),f=this.createColorPicker(),g=TradingView.createLineWidthEditor(),h=TradingView.createLineStyleEditor();$("<td>").append(e).appendTo(c);this.createLabeledCell(d,e).appendTo(c);$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);$("<td>").append(h.render()).appendTo(c);this.bindControl(new BooleanBinder(e,b.visible,!0,this.model(),"Change "+
d+" visibility"));this.bindControl(new ColorBinding(f,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SimpleComboBinder(h,b.style,parseInt,!0,this.model(),"Change "+d+" style"));this.bindControl(new SliderBinder(g,b.width,!0,this.model(),"Change "+d+" width"))};
StudyStylesPropertyPage._createRow_vertlines=function(a,b){var c=this.addRow(a),d=b.name.value(),e=$("<input type='checkbox' class='visibility-switch'/>"),f=this.createColorPicker(),g=TradingView.createLineWidthEditor(),h=TradingView.createLineStyleEditor();$("<td>").append(e).appendTo(c);this.createLabeledCell(d,e).appendTo(c);$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);$("<td>").append(h.render()).appendTo(c);this.bindControl(new BooleanBinder(e,b.visible,!0,this.model(),"Change "+
d+" visibility"));this.bindControl(new ColorBinding(f,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SimpleComboBinder(h,b.style,parseInt,!0,this.model(),"Change "+d+" style"));this.bindControl(new SliderBinder(g,b.width,!0,this.model(),"Change "+d+" width"))};
StudyStylesPropertyPage._createRow_lines=function(a,b){var c=this.addRow(a),d=b.title.value(),e=$("<input type='checkbox' class='visibility-switch'/>"),f=this.createColorPicker(),g=TradingView.createLineWidthEditor(),h=TradingView.createLineStyleEditor();$("<td>").append(e).appendTo(c);this.createLabeledCell(d,e).appendTo(c);$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);$("<td>").append(h.render()).appendTo(c);this.bindControl(new BooleanBinder(e,b.visible,!0,this.model(),"Change "+
d+" visibility"));this.bindControl(new ColorBinding(f,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SimpleComboBinder(h,b.style,parseInt,!0,this.model(),"Change "+d+" style"));this.bindControl(new SliderBinder(g,b.width,!0,this.model(),"Change "+d+" width"))};
StudyStylesPropertyPage._createRow_hlines=function(a,b){var c=this.addRow(a),d=b.name.value(),e=$("<input type='checkbox' class='visibility-switch'/>"),f=this.createColorPicker(),g=TradingView.createLineWidthEditor(),h=TradingView.createLineStyleEditor(),k=$("<input type='checkbox'>");$("<td>").append(e).appendTo(c);this.createLabeledCell(d,e).appendTo(c);$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);$("<td>").append(h.render()).appendTo(c);$("<td>").appendTo(c);$("<td>").append(k).appendTo(c);
this.createLabeledCell("Show Price",k).appendTo(c);this.bindControl(new BooleanBinder(e,b.visible,!0,this.model(),"Change "+d+" visibility"));this.bindControl(new ColorBinding(f,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SimpleComboBinder(h,b.style,parseInt,!0,this.model(),"Change "+d+" style"));this.bindControl(new SliderBinder(g,b.width,!0,this.model(),"Change "+d+" width"));this.bindControl(new BooleanBinder(k,b.showPrice,!0,this.model(),"Change "+d+" show price"));b.enableText.value()&&
(c=this.addRow(a),$('<td colspan="2">').appendTo(c),e=$("<input type='checkbox'>"),$('<td class="text-center">').append(e).appendTo(c),this.createLabeledCell("Show Text",e).appendTo(c),this.bindControl(new BooleanBinder(e,b.showText,!0,this.model(),"Change "+d+" show text")),e=TradingView.createTextPosEditor(),$("<td>").append(e.render()).appendTo(c),this.bindControl(new SimpleComboBinder(e,b.textPos,parseInt,!0,this.model(),"Change "+d+" text position")),e=this.createFontSizeEditor(),$('<td colspan="2">').append(e).appendTo(c),
this.bindControl(new SimpleComboBinder(e,b.fontSize,parseInt,!0,this.model(),"Change "+d+" font size")))};
StudyStylesPropertyPage._createRow_hhists=function(a,b){var c=b.title.value(),d=[],e=[],f=[],g=this.addRow(a),h=TradingView.createVisibilityEditor();$("<td>").append(h).appendTo(g);this.createLabeledCell(c,h).appendTo(g);this.bindControl(new BooleanBinder(h,b.visible,!0,this.model(),"Change "+c+" Visibility"));g=this.addRow(a);h=$("<input/>");h.attr("type","text");h.addClass("ticker");this.createLabeledCell("Width (% of the Box)",h).appendTo(g);$("<td>").append(h).appendTo(g);g=[ToIntTransformer(40)];
g.push(GreateTransformer(0));g.push(LessTransformer(100));this.bindControl(new SimpleStringBinder(h,b.percentWidth,g,!1,this.model(),"Change Percent Width"));g=this.addLabeledRow(a,"Placement");h=TradingView.createHHistDirectionEditor();$("<td>").append(h).appendTo(g);this.bindControl(new SimpleComboBinder(h,b.direction,null,!0,this.model(),"Change "+c+" Placement"));g=this.addRow(a);h=$("<input type='checkbox'>");$("<td>").append(h).appendTo(g);this.createLabeledCell("Show Values",h).appendTo(g);
this.bindControl(new BooleanBinder(h,b.showValues,!0,this.model(),"Change "+c+" Show Values"));g=this.addRow(a);h=this.createColorPicker();this.createLabeledCell("Text Color",h).appendTo(g);$("<td>").append(h).appendTo(g);this.bindControl(new ColorBinding(h,b.valuesColor,!0,this.model(),"Change "+c+" Text Color"));for(var k in b.colors)isNumber(parseInt(k,10))&&(g=this.addRow(a),d[k]=b.titles[k].value(),e[k]=this.createColorPicker(),f[k]=TradingView.createTransparencyEditor(e[k]),$("<td>").append(d[k]).appendTo(g),
$("<td>").append(e[k]).appendTo(g),$("<td>").append(f[k]).appendTo(g),this.bindControl(new ColorBinding(e[k],b.colors[k],!0,this.model(),"Change "+d[k]+" color")),this.bindControl(new SliderBinder(f[k],b.transparencies[k],!0,this.model(),"Change "+d[k]+" transparency")))};
StudyStylesPropertyPage._createRow_backgrounds=function(a,b){var c=this.addRow(a),d=$("<input type='checkbox' class='visibility-switch'/>"),e=b.name.value(),f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f);$("<td>").append(d).appendTo(c);this.createLabeledCell(e,d).appendTo(c);$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);this.bindControl(new BooleanBinder(d,b.visible,!0,this.model(),"Change "+e+" visibility"));this.bindControl(new ColorBinding(f,b.color,!0,this.model(),
"Change "+e+" color"));this.bindControl(new SliderBinder(g,b.transparency,!0,this.model(),"Change "+e+" transparency"))};
StudyStylesPropertyPage._createRow_polygons=function(a,b){var c=this.addRow(a),d=b.name.value(),e=this.createColorPicker(),f=TradingView.createTransparencyEditor(e);$("<td>").append(d).appendTo(c);$("<td>").append(e).appendTo(c);$("<td>").append(f).appendTo(c);this.bindControl(new ColorBinding(e,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SliderBinder(f,b.transparency,!0,this.model(),"Change "+d+" transparency"))};
StudyStylesPropertyPage._createRow_trendchannels=function(a,b){var c=this.addRow(a),d=b.name.value(),e=this.createColorPicker(),f=TradingView.createTransparencyEditor(e);$("<td>").append(d).appendTo(c);$("<td>").append(e).appendTo(c);$("<td>").append(f).appendTo(c);this.bindControl(new ColorBinding(e,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SliderBinder(f,b.transparency,!0,this.model(),"Change "+d+" transparency"))};
StudyStylesPropertyPage._createRow_textmarks=function(a,b){var c=this.addLabeledRow(a),d=b.name.value(),e=this.createColorPicker(),f=this.createColorPicker(),g=this.createFontEditor(),h=this.createFontSizeEditor(),k=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),m=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),n=TradingView.createTransparencyEditor(e);$("<td>").append(d).appendTo(c);$("<td>").append(e).appendTo(c);
$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);$("<td>").append(h).appendTo(c);$("<td>").append(k).appendTo(c);$("<td>").append(m).appendTo(c);$("<td>").append(n).appendTo(c);this.bindControl(new ColorBinding(e,b.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new ColorBinding(f,b.fontColor,!0,this.model(),"Change "+d+" text color"));this.bindControl(new SimpleComboBinder(h,b.fontSize,parseInt,!0,this.model(),"Change "+d+" font size"));this.bindControl(new SimpleComboBinder(g,
b.fontFamily,null,!0,this.model(),"Change "+d+" font"));this.bindControl(new BooleanBinder(k,b.fontBold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(m,b.fontItalic,!0,this.model(),"Change Text Font Italic"));this.bindControl(new SliderBinder(n,b.transparency,!0,this.model(),"Change "+d+" transparency"))};
StudyStylesPropertyPage._createRow_shapemarks=function(a,b){var c=this.addRow(a),d=$("<input type='checkbox' class='visibility-switch'/>"),e=b.name.value(),f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),h=$("<input/>");h.attr("type","text");h.addClass("ticker");$("<td>").append(d).appendTo(c);this.createLabeledCell(e,d).appendTo(c);$("<td>").append(f).appendTo(c);$("<td>").append(g).appendTo(c);this.createLabeledCell("Size",h).appendTo(c);$("<td>").append(h).appendTo(c);this.bindControl(new BooleanBinder(d,
b.visible,!0,this.model(),"Change "+e+" visibility"));this.bindControl(new ColorBinding(f,b.color,!0,this.model(),"Change "+e+" back color"));this.bindControl(new SliderBinder(g,b.transparency,!0,this.model(),"Change "+e+" transparency"));this.bindControl(new SimpleStringBinder(h,b.size,null,!1,this.model(),"Change size"))};function ChartStylesPropertyPage(a,b,c){a=b.m_model.properties();PropertyPage.call(this,a,b);var d=this._series=b.mainSeries();this._chart=b.m_model;this._model=b;this._source=c;this._property=a;this._seriesProperty=d.properties();this._scaleProperty=d.m_priceScale.properties();this._mainAxisProperty=d.properties().priceAxisProperties;var e=null;$.each(b.m_model.panes().toArray(),function(a,b){$.each(b.dataSources().toArray(),function(a,c){if(c==d)return e=b,!1})});this._pane=e;this.prepareLayout();
this._themes=TradingView.getThemesList()||[]}inherit(ChartStylesPropertyPage,PropertyPage);inherit(ChartStylesPropertyPage,SeriesStylePropertyPageMixin);ChartStylesPropertyPage.prototype.setScalesOpenTab=function(){this.scalesColumnLeft.data("layout-tab-open",EditObjectDialog.TAB_OPEN_OVERRIDE)};
ChartStylesPropertyPage.prototype.prepareLayout=function(){var a=this,b=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),c=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),d=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),f=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}).data("layout-separated",
!0),g=$('<div class="property-page-column-2">').data("layout-tab",$.t("Scales"));this.scalesColumnLeft=g;var h=$('<div class="property-page-column-2">').data("layout-tab",$.t("Scales")),k=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Timezone/Sessions")),m=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Events"));this._source instanceof TradingView.ESDStudyBase&&m.data("layout-tab-open",EditObjectDialog.TAB_OPEN_OVERRIDE);
var n=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),q=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),l=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),s=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Background")),u=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",
$.t("Drawings")),z=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),t=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),B=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales"));this._prepareSeriesStyleLayout(b,c,d,this._seriesProperty);var A=$('<input type="checkbox">'),w=this.addLabeledRow(z,"Price Line",A);$("<td>").append(A).prependTo(w);var v=TradingView.createLineWidthEditor();
$("<td>").append(v).appendTo(w);var C=this.createSeriesMinTickEditor(),H=$("<tr>");H.appendTo(t);$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(H);$("<td>").append(C).appendTo(H);this.bindControl(new SimpleComboBinder(C,this._seriesProperty.minTick,null,!0,this.model(),"Change MinTick"));TradingView.isFeatureEnabled("esdindicatorfeature")&&!TradingView.isRunningChartingLibrary&&this.createEventsTable(m);this.bindControl(new BooleanBinder(A,this._seriesProperty.showPriceLine,!0,this.model(),"Change Price Price Line"));
this.bindControl(new SliderBinder(v,this._seriesProperty.priceLineWidth,!0,this.model(),"Change Price Line Width"));var A=$("<tr>").appendTo(s),C=$('<table class="property-page" cellspacing="0" cellpadding="2">').appendTo($("<td>").appendTo(A)),D=this.createColorPicker(),w=this.createColorPicker(),F=TradingView.createLineStyleEditor(),I=TradingView.createTransparencyEditor(w),E=TradingView.createLineWidthEditor(),P=this.createColorPicker(),O=TradingView.createLineStyleEditor(),r=this.createColorPicker(),
H=this.createColorPicker(),A=this.createColorPicker(),v=TradingView.createTransparencyEditor(A),S=this.addLabeledRow(C,"Background");$('<td colspan="4">').append(D).appendTo(S);this.bindControl(new ColorBinding(D,this._property.paneProperties.background,!0,this.model(),"Change Chart Background Color"));D=this.addLabeledRow(C,"Crosshair");$("<td>").append(w).appendTo(D);$("<td>").append(F.render()).appendTo(D);$("<td>").append(E).appendTo(D);$("<td>").append(I).appendTo(D);this.bindControl(new ColorBinding(w,
this._property.paneProperties.crossHairProperties.color,!0,this.model(),"Change Crosshair Color"));this.bindControl(new SimpleComboBinder(F,this._property.paneProperties.crossHairProperties.style,parseInt,!0,this.model(),"Change Crosshair Style"));this.bindControl(new SliderBinder(E,this._property.paneProperties.crossHairProperties.width,!0,this.model(),"Change Crosshair Width"));this.bindControl(new SliderBinder(I,this._property.paneProperties.crossHairProperties.transparency,!0,this.model(),"Change Crosshair Transparency"));
w=this.addLabeledRow(C,"Grid Lines");$("<td>").append(P).appendTo(w);$('<td colspan="3">').append(O.render()).appendTo(w);this.bindControl(new ColorBinding(P,this._property.paneProperties.gridProperties.color,!0,this.model(),"Change Grid Lines Color"));this.bindControl(new SimpleComboBinder(O,this._property.paneProperties.gridProperties.style,parseInt,!0,this.model(),"Change Grid Lines Style"));P=this.addLabeledRow(C,"Scales Text");$('<td colspan="4">').append(r).appendTo(P);this.bindControl(new ColorBinding(r,
this._property.scalesProperties.textColor,!0,this.model(),"Change Scales Text Color"));r=this.addLabeledRow(C,"Scales Lines");$('<td colspan="4">').append(H).appendTo(r);this.bindControl(new ColorBinding(H,this._property.scalesProperties.lineColor,!0,this.model(),"Change Scales Lines Color"));C=this.addLabeledRow(C,"Watermark");$("<td>").append(A).appendTo(C);$('<td colspan="3">').append(v).appendTo(C);this.bindControl(new ColorBinding(A,this._property.symbolWatermarkProperties.color,!0,this.model(),
"Change Symbol Watermark Color"));this.bindControl(new SliderBinder(v,this._property.symbolWatermarkProperties.transparency,!0,this.model(),"Change Symbol Watermark Transparency"));A=$('<input type="checkbox">');v=$('<input type="checkbox">');C=$('<input type="checkbox">');C.change(function(){this.checked&&setTimeout(function(){a._model.m_model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))},0)});H=$('<input type="checkbox">');H.change(function(){this.checked&&
setTimeout(function(){a._model.m_model.invalidate(new TradingView.InvalidateMask(TradingView.InvalidateMask.LIGHT_UPDATE))},0)});var F=$("<input type='checkbox'>"),r=$("<input type='checkbox' />"),P=$("<input type='checkbox' />"),J=$(r).add(P).change(function(a){J.filter(":checked").size()||($(this).attr("checked",!0),a.stopImmediatePropagation())}),O=$("<input type='checkbox' />"),K;this._pane&&(this._pane.leftPriceScale().dataSources().contains(this._series)?K="left":this._pane.rightPriceScale().dataSources().contains(this._series)?
K="right":this._pane.isOverlay(this._series)&&(K="none"));K&&(w={left:$.t("Scale Left"),right:$.t("Scale Right")},a._pane.actionNoScaleIsEnabled(a._series)&&(w.none=$.t("Screen (No Scale)")),K=this.createKeyCombo(w).val(K).change(function(){switch(this.value){case "left":a._model.move(a._series,a._pane,a._pane.leftPriceScale());break;case "right":a._model.move(a._series,a._pane,a._pane.rightPriceScale());break;case "none":a._model.move(a._series,a._pane,null)}}),w=this.addRow(l),$("<td>").appendTo(w).append(K));
this.bindControl(new BooleanBinder(F,this._seriesProperty.showCountdown,!0,this.model(),"Change Show Countdown"));w=this.addLabeledRow(n,"Auto Scale",C);$("<td>").append(C).prependTo(w);w=this.addLabeledRow(n,"Scale Series Only",H);$("<td>").append(H).prependTo(w);w=this.addLabeledRow(q,"Percentage",A);$("<td>").append(A).prependTo(w);w=this.addLabeledRow(q,"Log Scale",v);$("<td>").append(v).prependTo(w);w=this.addLabeledRow(n,"Show Left Axis",r);$("<td>").append(r).prependTo(w);w=this.addLabeledRow(n,
"Show Right Axis",P);$("<td>").append(P).prependTo(w);w=this.addLabeledRow(n,"Show Symbol Labels",O);$("<td>").append(O).prependTo(w);TradingView.isRunningChartingLibrary||(w=this.addLabeledRow(q,"Show Countdown",F),$("<td>").append(F).prependTo(w));w=$("<tr>").appendTo(k);K=$("<td>").appendTo(w);K=$('<table cellspacing="0" cellpadding="0">').appendTo(K);w=$(document.createElement("tr"));w.appendTo(K);K=$(document.createElement("td"));K.appendTo(w);K.text($.t("Time Zone"));K=$(document.createElement("td")).attr("colspan",
2);K.appendTo(w);for(var R,w="",F=0;F<TradingView.availableTimezones.length;F++)w+='<option value="'+TradingView.availableTimezones[F].id+'">'+TradingView.availableTimezones[F].title+"</option>";w=$("<select>"+w+"</select>").change(function(){var b=$(this).val();R||(R=setTimeout(function(){a._chart._chartApi.switchTimezone(b);R=!1},300))});w.appendTo(K);this.bindControl(new SimpleComboBinder(w,this._property.timezone,null,!0,this.model(),"Change Timezone"));TradingView.isRunningChartingLibrary||(this._series.createSessStudy(),
this.createSessTable(k));K=$('<input type="checkbox">');w=this.addLabeledRow(q,"Last Value on Price Scale",K);$("<td>").append(K).prependTo(w);var F=$("<input type='checkbox'/>"),N=this.addLabeledRow(q,"Lock scale",F);$("<td>").append(F).prependTo(N);this._seriesProperty.style.listeners().subscribe(this,function(a){N.toggle(a.value()==TradingView.Series.STYLE_PNF)});I=$('<input type="text" class="ticker">');w=this.addLabeledRow(B,"Top Margin",I);$("<td>").appendTo(w).append(I);$("<td>%</td>").appendTo(w);
w=[ToIntTransformer(this._property.paneProperties.topMargin.value())];w.push(LessTransformer(25));w.push(GreateTransformer(0));this.bindControl(new SimpleStringBinder(I,this._property.paneProperties.topMargin,w,!0,this.model(),"Top Margin"));I=$('<input type="text" class="ticker">');w=this.addLabeledRow(B,"Bottom Margin",I);$("<td>").appendTo(w).append(I);$("<td>%</td>").appendTo(w);w=[ToIntTransformer(this._property.paneProperties.bottomMargin.value())];w.push(LessTransformer(25));w.push(GreateTransformer(0));
this.bindControl(new SimpleStringBinder(I,this._property.paneProperties.bottomMargin,w,!0,this.model(),"Bottom Margin"));I=$('<input type="text" class="ticker">');w=this.addLabeledRow(B,"Right Margin",I);$("<td>").appendTo(w).append(I);$("<td>"+$.t("bars",{context:"margin"})+"</td>").appendTo(w);w=[ToIntTransformer(this._property.timeScale.rightOffset.value())];w.push(LessTransformer(~~this._chart.m_timeScale.maxOffset()));w.push(GreateTransformer(-200));this.bindControl(new SimpleStringBinder(I,
this._property.timeScale.rightOffset,w,!0,this.model(),"Right Margin"));this.bindControl(new BooleanBinder(r,this._property.scalesProperties.showLeftScale,!0,this.model(),"Show Left Axis"));this.bindControl(new BooleanBinder(P,this._property.scalesProperties.showRightScale,!0,this.model(),"Show Right Axis"));this.bindControl(new BooleanBinder(O,this._scaleProperty.showSymbolLabels,!0,this.model(),"Show Symbol Labels"));this.bindControl(new BooleanBinder(C,this._scaleProperty.autoScale,!0,this.model(),
"Auto Scale",function(b){this._undoModel.setAutoScaleProperty(this._property,b,a._series.priceScale(),this._undoText)}));this.bindControl(new DisabledBinder(C,this._scaleProperty.autoScaleDisabled,!0,this.model(),"Auto Scale"));this.bindControl(new BooleanBinder(H,this._property.scalesProperties.scaleSeriesOnly,!0,this.model(),"Scale Series Only"));this.bindControl(new BooleanBinder(A,this._mainAxisProperty.percentage,!0,this.model(),"Scale Percentage",function(b){this._undoModel.setPercentProperty(this._property,
b,a._series.priceScale(),this._undoText)}));this.bindControl(new DisabledBinder(A,this._mainAxisProperty.percentageDisabled,!0,this.model(),"Scale Percentage"));this.bindControl(new BooleanBinder(v,this._mainAxisProperty.log,!0,this.model(),"Log Scale",function(b){this._undoModel.setLogProperty(this._property,b,a._series.priceScale(),this._undoText)}));this.bindControl(new DisabledBinder(v,this._mainAxisProperty.logDisabled,!0,this.model(),"Log Scale"));this.bindControl(new BooleanBinder(K,this._seriesProperty.showLastValue,
!0,this.model(),"Change Last Value on Price Scale Visibility"));this.bindControl(new BooleanBinder(F,this._seriesProperty.lockScale,!0,this.model(),"Change lock scale",function(b){this._undoModel.setLockScaleProperty(this._property,b,a._series,this._undoText)}));this._table=b.add(c).add(d).add(e).add(f).add(z).add(t).add(s).add(g).add(h).add(u).add(k).add(m);h.append(l);h.append(n);g.append(q);g.append(B);this.loadData()};ChartStylesPropertyPage.prototype.widget=function(){return this._table};
ChartStylesPropertyPage.prototype.loadData=function(){this.superclass.prototype.loadData.call(this);this.switchStyle()};ChartStylesPropertyPage.prototype.loadTheme=function(a){var b=this;$.get("/theme/?themeName="+encodeURIComponent(a),function(c){b._model._lastLoadedTheme=a;b.applyTheme(JSON.parse(c.content))})};
ChartStylesPropertyPage.prototype.applyTheme=function(a){var b=this._seriesProperty.extendedHours.value();this._model.model().restoreTheme(a);this._seriesProperty.extendedHours.value()!==b&&this._seriesProperty.extendedHours.listeners().fire(this._seriesProperty.extendedHours);this.loadData()};
ChartStylesPropertyPage.prototype.createTemplateButton=function(a){if(TradingView.isRunningChartingLibrary)return $("<span />");var b=this;a||(a={});var c=function(){var c=[];c.push({title:"Save As...",action:function(){runOrSignIn(function(){TradingView.showChartNameDialog(function(a){if(a){var c={name:a,content:JSON.stringify(b._model.model().theme())};$.post("/save-theme/",c).error(function(a){document.write(a.responseText)});b._themes.push(a);b._model._lastLoadedTheme=a}},"Save theme as...","Theme name")},
!0)},addClass:"special"});"function"===typeof a.defaultsCallback&&c.push({title:"Apply Defaults",action:a.defaultsCallback,addClass:"special"});var d=[];$.each(b._themes,function(a,c){d.push({title:c,action:function(){b.loadTheme(c)},deleteAction:is_authenticated?function(){var a=this;TVDialogs.showConfirm("Theme","Do you realy want to delete "+(c?'"'+c+'"':"")+" theme?",function(){a instanceof $&&a.remove();$.post("/remove-theme/",{name:c}).error(function(a){document.write(a.responseText)});for(var d=
b._themes.length;d--;)b._themes[d]==c&&b._themes.splice(d,1)})}:void 0})});d.length&&(d.sort(function(a,b){a=a.title.toUpperCase();b=b.title.toUpperCase();return a==b?0:a>b?1:-1}),c.push({separator:!0}),c=c.concat(d));return c},d=$('<a href="#" class="tv-button">Themes<span class="icon-dropdown"></span></a>');TradingView.bindPopupMenu(d,null,{direction:"up",event:"button-popup",notCloseOnButtons:!0});d.bind("click",function(){var a=$(this);a.is(".active")||(a.trigger("button-popup",[c()]),TradingView.getThemesList(function(d){b._themes=
d;a.is(".active")&&a.trigger("button-popup",[c(),!0])}))});return d};
ChartStylesPropertyPage.prototype.switchStyle=function(){toggledTbodies=$(this._barsTbody).add(this._barsColorerTbody).add(this._renkoTbody).add(this._pbTbody).add(this._kagiTbody).add(this._pnfTbody).add(this._candlesTbody).add(this._candlesColorerTbody).add(this._hollowCandlesTbody).add(this._lineTbody).add(this._areaTbody).add(this._haTbody).add(this._haColorerTbody).css("display","none");switch(this._seriesProperty.style.value()){case TradingView.Series.STYLE_BARS:this._barsTbody.css("display","table-row-group");
this._barsColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_CANDLES:this._candlesTbody.css("display","table-row-group");this._candlesColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_HOLLOW_CANDLES:this._hollowCandlesTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_LINE:this._lineTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_AREA:this._areaTbody.css("display","table-row-group");break;
case TradingView.Series.STYLE_RENKO:this._renkoTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_PB:this._pbTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_KAGI:this._kagiTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_PNF:this._pnfTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_HEIKEN_ASHI:this._haTbody.css("display","table-row-group"),this._haColorerTbody.css("display","table-row-group")}};
ChartStylesPropertyPage.prototype.onResoreDefaults=function(){var a=this._model.model().properties().paneProperties.topMargin,b=this._model.model().properties().paneProperties.bottomMargin;a.listeners().fire(a);b.listeners().fire(b)};
ChartStylesPropertyPage.prototype.defaultProperties=function(){var a=this,b=[a._seriesProperty.extendedHours,a._property.scalesProperties.showLeftScale,a._property.scalesProperties.showRightScale,a._property.timeScale.rightOffset].map(function(a){return{property:a,previousValue:a.value()}});setTimeout(function(){b.forEach(function(a){a.property.value()!==a.previousValue&&a.property.listeners().fire(a.property)});var c=new DefaultProperty("chartproperties.paneProperties.rightAxisProperties");$.each(["autoScale",
"percentage","log"],function(b,e){var f=a._scaleProperty[e],g=c[e].value();g!==f.value()&&f.setValue(g)})},0);return[this._property,this._seriesProperty]};
ChartStylesPropertyPage.prototype.createEventsTable=function(a){var b=$("<tr>").appendTo(a),c=$('<input type="checkbox" />'),d=this.addLabeledRow(b,"Show Dividends on Chart",c);$("<td>").append(c).prependTo(d);d.append("<td>");var e=this._seriesProperty.esdShowDividends;this.bindControl(new BooleanBinder(c,this._seriesProperty.esdShowDividends,!0,this.model(),"Change Show or Hide Dividends",function(a){this._model.beginUndoMacro("Show Dividends");this._model.setProperty(e,a,"Show Dividends");this._model.endUndoMacro()}.bind(this)));
c=$('<input type="checkbox" />');d=this.addLabeledRow(b,"Show Splits on Chart",c);$("<td>").append(c).prependTo(d);d.append("<td>");var f=this._seriesProperty.esdShowSplits;this.bindControl(new BooleanBinder(c,this._seriesProperty.esdShowSplits,!0,this.model(),"Change Show or Hide Splits",function(a){this._model.beginUndoMacro("Show Splits");this._model.setProperty(f,a,"Show Splits");this._model.endUndoMacro()}.bind(this)));c=$('<input type="checkbox" />');d=this.addLabeledRow(b,"Show Earnings on Chart",
c);$("<td>").append(c).prependTo(d);d.append("<td>");var g=this._seriesProperty.esdShowEarnings;this.bindControl(new BooleanBinder(c,this._seriesProperty.esdShowEarnings,!0,this.model(),"Change Show or Hide Earnings",function(a){this._model.beginUndoMacro("Show Earnings");this._model.setProperty(g,a,"Show Earnings");this._model.endUndoMacro()}.bind(this)));var d=this.createTableInTable(a),h=$('<input type="checkbox" />');a=TradingView.createLineStyleEditor();b=TradingView.addColorPicker();c=TradingView.createLineWidthEditor();
d=this.addLabeledRow(d,"Earnings breaks",h);$("<td>").append(h).prependTo(d);$("<td>").append(b).appendTo(d);$("<td>").append(a.render()).appendTo(d);$("<td>").append(c).appendTo(d);d.addClass("offset-row");d.append("<td>");this.bindControl(new BooleanBinder(h,this._seriesProperty.esdShowBreaks,!0,this.model(),"Change Show or Hide Earnings"));this.bindControl(new ColorBinding(b,this._seriesProperty.esdBreaksStyle.color,!0,this.model(),"Change earnings color"));this.bindControl(new SimpleComboBinder(a,
this._seriesProperty.esdBreaksStyle.style,parseInt,!0,this.model(),"Change style"));this.bindControl(new SliderBinder(c,this._seriesProperty.esdBreaksStyle.width,!0,this.model(),"Change width"));this._seriesProperty.esdShowEarnings.listeners().subscribe(this,function(a){h.prop("disabled",!a.value())})};
ChartStylesPropertyPage.prototype.createSessTable=function(a){var b=this._series.sessionsStudy().properties(),c=this.createTableInTable(a),d=b.name.value(),e=$("<input type='checkbox' />"),c=this.addLabeledRow(c,"Session Breaks",e),f=TradingView.createLineStyleEditor(),g=TradingView.addColorPicker(),h=TradingView.createLineWidthEditor();$("<td>").append(e).prependTo(c);$("<td>").append(g).appendTo(c);$("<td>").append(f.render()).appendTo(c);$("<td>").append(h).appendTo(c);this.bindControl(new BooleanBinder(e,
b.graphics.vertlines.sessBreaks.visible,!0,this.model(),"Change "+d+" visibility"));this.bindControl(new ColorBinding(g,b.graphics.vertlines.sessBreaks.color,!0,this.model(),"Change "+d+" color"));this.bindControl(new SimpleComboBinder(f,b.graphics.vertlines.sessBreaks.style,parseInt,!0,this.model(),"Change "+d+" style"));this.bindControl(new SliderBinder(h,b.graphics.vertlines.sessBreaks.width,!0,this.model(),"Change "+d+" width"));c=this.createTableInTable(a);d=this._extendedHoursEditor=$('<input type="checkbox" />');
c=this.addLabeledRow(c,"Extended Hours (Intraday Only)",d);$("<td>").append(d).prependTo(c);this.bindControl(new ExtendedHoursBinder(d,this._seriesProperty.extendedHours,this._seriesProperty.interval,!0,this.model(),"Change Extended Hours"));this._seriesProperty.sessVis=b.graphics.vertlines.sessBreaks.visible;var c=this.createTableInTable(a),k=this._createStudySessRow(c,"Extended Hours",b.graphics.backgrounds.outOfSession),m=this._createStudySessRow(c,"In Session",b.graphics.backgrounds.inSession);
this._seriesProperty.extendedHours.listeners().subscribe(this,function(a){k.prop("disabled",!a.value());m.prop("disabled",!a.value())});a=this._series.isIntradayInterval();b=!a||!this._seriesProperty.extendedHours.value();e.prop("disabled",!a);d.prop("disabled",!a);k.prop("disabled",b);m.prop("disabled",b);return c};
ChartStylesPropertyPage.prototype._createStudySessRow=function(a,b,c){var d=$("<input type='checkbox' />");a=this.addLabeledRow(a,b,d);var e=TradingView.addColorPicker($("<td>").appendTo(a)),f=TradingView.createTransparencyEditor(e);this.bindControl(new BooleanBinder(d,c.visible,!0,this.model(),"Change "+b+" visibility"));this.bindControl(new ColorBinding(e,c.color,!0,this.model(),b+" color"));this.bindControl(new SliderBinder(f,c.transparency,!0,this.model(),b+" transparency"));$("<td>").append(d).prependTo(a);
a.addClass("offset-row");$("<td>").append(f).appendTo(a);return d};function StudyCompareInputsPropertyPage(a,b){PropertyPage.call(this,a,b);this.prepareLayout()}inherit(StudyCompareInputsPropertyPage,PropertyPage);
StudyCompareInputsPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=this.createKeyCombo({open:$.t("Open"),high:$.t("High"),low:$.t("Low"),close:$.t("Close")}),b=this.addLabeledRow(this._table,$.t("Source",{context:"compare"}));$("<td>").appendTo(b).append(a);this.bindControl(new SimpleComboBinder(a,this._property.inputs.source,null,!0,this.model(),
"Change Price Source"));this.loadData()};StudyCompareInputsPropertyPage.prototype.widget=function(){return this._table};function LineToolInputsPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._linetool=c;this.prepareLayout()}inherit(LineToolInputsPropertyPage,PropertyPage);
LineToolInputsPropertyPage.prototype._createPointRow=function(a,b,c){a=$("<tr>");var d=$("<td>");d.html($.t("Price")+c);d.appendTo(a);d=$("<td>");d.appendTo(a);c=$("<input type='text'>");c.appendTo(d);d=$("<td>");d.html($.t("Bar #"));d.appendTo(a);barEditCell=$("<td>");barEditCell.appendTo(a);d=$("<input type='text'>");d.appendTo(barEditCell);d.addClass("ticker");var e=[ToFloatTransformer(b.price.value())];this.bindControl(new SimpleStringBinder(c,b.price,e,!1,this.model(),"Change "+this._linetool+
" point price"));e=[ToIntTransformer(b.bar.value()),GreateTransformer(-5E4),LessTransformer(15E3)];this.bindControl(new SimpleStringBinder(d,b.bar,e,!1,this.model(),"Change "+this._linetool+" point bar index"));return a};
LineToolInputsPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");for(var a=this._linetool.points(),b=a.size(),c=0;c<a.size();c++){var d=a.item(c),e=this._linetool.properties().points[c];e&&this._createPointRow(d,e,(c||1<b?" "+(c+1):"")+"").appendTo(this._table)}this.loadData()};LineToolInputsPropertyPage.prototype.widget=function(){return this._table};function LineToolBarsPatternStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolBarsPatternStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolBarsPatternStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=$("<tbody>").appendTo(this._table),b=this.createColorPicker(),c=this.addLabeledRow(a,"Color");$("<td>").append(b).appendTo(c);var d=$('<select><option value="0">'+$.t("Bars")+'</option><option value="1">'+$.t("Line")+"</option></select>"),c=this.addLabeledRow(a,"Mode");
$("<td>").append(d).appendTo(c);c=$("<tr>").appendTo(a);$("<td>"+$.t("Mirrored")+"</td>").appendTo(c);var e=$("<input type='checkbox'>");$("<td>").append(e).appendTo(c);c=$("<tr>").appendTo(a);$("<td>"+$.t("Flipped")+"</td>").appendTo(c);a=$("<input type='checkbox'>");$("<td>").append(a).appendTo(c);this.bindControl(new BooleanBinder(e,this._linetool.properties().mirrored,!0,this.model(),"Change Bars Pattern Mirroring"));this.bindControl(new BooleanBinder(a,this._linetool.properties().flipped,!0,
this.model(),"Change Bars Pattern Flipping"));this.bindControl(new ColorBinding(b,this._linetool.properties().color,!0,this.model(),"Change Bars Pattern Color"));this.bindControl(new SimpleComboBinder(d,this._linetool.properties().mode,null,!0,this.model(),"Change Bars Pattern Mode"));this.loadData()};LineToolBarsPatternStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolBarsPatternInputsPropertyPage(a,b,c){LineToolInputsPropertyPage.call(this,a,b,c)}
inherit(LineToolBarsPatternInputsPropertyPage,LineToolInputsPropertyPage);
LineToolBarsPatternInputsPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this._linetool.points().item(0);var a=$("<tr>");a.appendTo(this._table);var b=$("<td>");b.html($.t("Price"));b.appendTo(a);var c=$("<td>");c.appendTo(a);b=$("<input type='text'>");b.appendTo(c);c=$("<td>");c.html($.t("Bar #"));c.appendTo(a);barEditCell=$("<td>");barEditCell.appendTo(a);
a=$("<input type='text'>");a.appendTo(barEditCell);a.addClass("ticker");var c=this._linetool.properties().points[0],d=[ToFloatTransformer(c.price.value())];this.bindControl(new SimpleStringBinder(b,c.price,d,!1,this.model(),"Change "+this._linetool+" point price"));d=[ToIntTransformer(c.bar.value()),GreateTransformer(-5E3),LessTransformer(15E3)];this.bindControl(new SimpleStringBinder(a,c.bar,d,!1,this.model(),"Change "+this._linetool+" point bar index"));this.loadData()};function LineToolCalloutStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolCalloutStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolCalloutStylesPropertyPage.prototype.prepareLayout=function(){var a=this.createColorPicker(),b=this.createFontSizeEditor(),c=this.createFontEditor(),d=this.createTextEditor(350,200),e=this.createColorPicker(),f=TradingView.createTransparencyEditor(e),g=TradingView.createLineWidthEditor(),h=this.createColorPicker(),k=$('<input type="checkbox">'),m=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');
this.bindControl(new ColorBinding(a,this._linetool.properties().color,!0,this.model(),"Change Text Color"));this.bindControl(new SimpleComboBinder(b,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(c,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new SimpleStringBinder(d,this._linetool.properties().text,null,!0,this.model(),"Change Text"));this.bindControl(new ColorBinding(e,
this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background"));this.bindControl(new SliderBinder(f,this._linetool.properties().transparency,!0,this.model(),"Change Text Background Transparency"));this.bindControl(new ColorBinding(h,this._linetool.properties().bordercolor,!0,this.model(),"Change Text Color"));this.bindControl(new SliderBinder(g,this._linetool.properties().linewidth,!0,this.model(),"Change Border Width"));this.bindControl(new BooleanBinder(k,this._linetool.properties().wordWrap,
!0,this.model(),"Change Text Wrap"));this.bindControl(new BooleanBinder(m,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var q=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab-open",EditObjectDialog.TAB_OPEN_OVERRIDE),l=$('<table class="property-page" cellspacing="0" cellpadding="2">'),s=$('<table class="property-page" cellspacing="0" cellpadding="2">');
this._table=q.add(s).add(l);$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(a)).append($(document.createElement("td")).attr({width:1}).append(c)).append($(document.createElement("td")).attr({width:1}).append(b)).append($(document.createElement("td")).attr({width:1}).append(m)).append($(document.createElement("td")).append(n)).appendTo(q);$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(d)).appendTo(q);a=this.addLabeledRow(l,
"Text Wrap",k);$("<td>").append(k).prependTo(a);a=this.addLabeledRow(s,"Background");$("<td>").append(e).appendTo(a);$("<td>").append(f).appendTo(a);a=this.addLabeledRow(s,"Border");$("<td>").append(h).appendTo(a);$("<td>").append(g).appendTo(a);this.loadData();setTimeout(function(){d.select();d.focus()},20)};LineToolCalloutStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolTrendLineStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolTrendLineStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolTrendLineStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),d=this.createColorPicker(),a=this.addLabeledRow(a,"Line");$("<td>").append(d).appendTo(a);$("<td>").append(b).appendTo(a);$('<td colspan="3">').append(c.render()).appendTo(a);var e=$("<tbody>").appendTo(this._table),f=$("<label>"+$.t("Extend")+
" </label>").css({"margin-left":"8px"}),g=$('<input type="checkbox">').appendTo(f),h=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),k=$('<input type="checkbox">').appendTo(h),m=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),a=this.addLabeledRow(e,"Left End");$('<td colspan="3">').appendTo(a).append(m).append(f);
a=this.addLabeledRow(e,"Right End");$('<td colspan="3">').appendTo(a).append(n).append(h);var a=this.addLabeledRow(e,"Text:"),f=this.createColorPicker(),h=this.createFontSizeEditor(),q=this.createFontEditor(),l=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),s=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(f).appendTo(a);$("<td>").append(q).appendTo(a);$("<td>").append(h).appendTo(a);
$("<td>").append(l).appendTo(a);$("<td>").append(s).appendTo(a);this.bindControl(new SimpleComboBinder(h,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(q,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(f,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color"));this.bindControl(new BooleanBinder(l,this._linetool.properties().bold,!0,this.model(),
"Change Text Font Bold"));this.bindControl(new BooleanBinder(s,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));f=$('<input type="checkbox">');$('<input type="checkbox">');h=$('<input type="checkbox">');q=$('<input type="checkbox">');l=$('<input type="checkbox">');a=this.addLabeledRow(e,"Show Price Range");$('<td colspan="3">').appendTo(a).append(f);a=this.addLabeledRow(e,"Show Bars Range");$('<td colspan="3">').appendTo(a).append(h);a=this.addLabeledRow(e,"Show Date/Time Range");
$('<td colspan="3">').appendTo(a).append(q);a=this.addLabeledRow(e,"Show Distance");$('<td colspan="3">').appendTo(a).append(l);this.bindControl(new BooleanBinder(g,this._linetool.properties().extendLeft,!0,this.model(),"Change Trend Line Extending Left"));this.bindControl(new BooleanBinder(k,this._linetool.properties().extendRight,!0,this.model(),"Change Trend Line Extending Right"));this.bindControl(new ColorBinding(d,this._linetool.properties().linecolor,!0,this.model(),"Change Trend Line Color"));
this.bindControl(new SimpleComboBinder(c,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Trend Line Style"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Trend Line Width"));this.bindControl(new SimpleComboBinder(m,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Trend Line Left End"));this.bindControl(new SimpleComboBinder(n,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Trend Line Right End"));
this.bindControl(new BooleanBinder(f,this._linetool.properties().showPriceRange,!0,this.model(),"Change Trend Line Show Price Range"));this.bindControl(new BooleanBinder(h,this._linetool.properties().showBarsRange,!0,this.model(),"Change Trend Line Show Bars Range"));this.bindControl(new BooleanBinder(q,this._linetool.properties().showDateTimeRange,!0,this.model(),"Change Trend Line Show Date/Time Range"));this.bindControl(new BooleanBinder(l,this._linetool.properties().showDistance,!0,this.model(),
"Change Trend Line Show Distance"));this.loadData()};LineToolTrendLineStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolHorzLineStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolHorzLineStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolHorzLineStylesPropertyPage.prototype.prepareLayout=function(){this._res=$("<div>");this._table=$('<table class="property-page" cellspacing="0" cellpadding="2" style="width:100%"></table>').appendTo(this._res);var a=TradingView.createLineWidthEditor(),b=TradingView.createLineStyleEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Line");$("<td>").append(c).appendTo(d);$("<td>").append(a).appendTo(d);$('<td colspan="3">').append(b.render().css("display","block")).appendTo(d);
var e=$("<input type='checkbox' class='visibility-switch'>"),d=$("<tr>").appendTo(this._table);$('<td colspan="3">').append($("<label>").append(e).append($.t("Show Price"))).prependTo(d);var f=$("<input type='checkbox'>"),d=$("<tr>").appendTo(this._table);$('<td colspan="3">').append($("<label>").append(f).append($.t("Show Text"))).prependTo(d);var d=this.addLabeledRow(this._table,"Text:"),g=this.createColorPicker(),h=this.createFontSizeEditor(),k=this.createFontEditor(),m=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),
n=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(g).appendTo(d);$("<td>").append(k).appendTo(d);$("<td>").append(h).appendTo(d);$("<td>").append(m).appendTo(d);$("<td>").append(n).appendTo(d);d=$("<tr>").appendTo(this._table);$("<td colspan='2'>").append($.t("Text Alignment:")).appendTo(d);var q=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+
"</option></select>"),l=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>").data("selectbox-css",{display:"block"});$("<td>").append(q).appendTo(d);$("<td colspan='3'>").append(l).appendTo(d);var s=$("<textarea rows='7' cols='60'>").css("width","100%"),d=$("<tr>").appendTo(this._table);$("<td colspan='7'>").append(s).appendTo(d);this.bindControl(new BooleanBinder(f,this._linetool.properties().showLabel,
!0,this.model(),"Change Horz Line Text Visibility"));this.bindControl(new SimpleComboBinder(q,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Horz Line Labels Alignment"));this.bindControl(new SimpleComboBinder(l,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Horz Line Labels Alignment"));this.bindControl(new SimpleStringBinder(s,this._linetool.properties().text,null,!0,this.model(),"Change Text"));this.bindControl(new BooleanBinder(e,this._linetool.properties().showPrice,
!0,this.model(),"Change Horz Line Price Visibility"));this.bindControl(new ColorBinding(c,this._linetool.properties().linecolor,!0,this.model(),"Change Horz Line Color"));this.bindControl(new SimpleComboBinder(b,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Horz Line Style"));this.bindControl(new SliderBinder(a,this._linetool.properties().linewidth,!0,this.model(),"Change Horz Line Width"));this.bindControl(new SimpleComboBinder(h,this._linetool.properties().fontsize,parseInt,
!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(k,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(g,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color"));this.bindControl(new BooleanBinder(m,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));this.loadData()};
LineToolHorzLineStylesPropertyPage.prototype.widget=function(){return this._res};function LineToolHorzLineInputsPropertyPage(a,b,c){LineToolInputsPropertyPage.call(this,a,b,c)}inherit(LineToolHorzLineInputsPropertyPage,LineToolInputsPropertyPage);
LineToolHorzLineInputsPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');if(this._linetool.points().item(0)){var a=$('<input type="text">'),b=$("<tr>").appendTo(this._table);$("<td>"+$.t("Price")+"</td>").appendTo(b);$("<td>").append(a).appendTo(b);var b=this._linetool.properties().points[0],c=[ToFloatTransformer(b.price.value())];this.bindControl(new SimpleStringBinder(a,b.price,c,!1,this.model(),"Change "+this._linetool+
" point price"));this.loadData()}};function LineToolVertLineStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolVertLineStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolVertLineStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=TradingView.createLineWidthEditor(),b=TradingView.createLineStyleEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Line");$("<td>").prependTo(d);$("<td>").append(c).appendTo(d);$("<td>").append(a).appendTo(d);$("<td>").append(b.render()).appendTo(d);
var e=$("<input type='checkbox' class='visibility-switch'>"),d=$("<tr>").appendTo(this._table);$("<td>").append(e).prependTo(d);this.createLabeledCell(2,"Show Time",e).appendTo(d);this.bindControl(new BooleanBinder(e,this._linetool.properties().showTime,!0,this.model(),"Change Vert Line Time Visibility"));this.bindControl(new ColorBinding(c,this._linetool.properties().linecolor,!0,this.model(),"Change Vert Line Color"));this.bindControl(new SimpleComboBinder(b,this._linetool.properties().linestyle,
parseInt,!0,this.model(),"Change Vert Line Style"));this.bindControl(new SliderBinder(a,this._linetool.properties().linewidth,!0,this.model(),"Change Vert Line Width"));this.loadData()};LineToolVertLineStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolVertLineInputsPropertyPage(a,b,c){LineToolInputsPropertyPage.call(this,a,b,c)}inherit(LineToolVertLineInputsPropertyPage,LineToolInputsPropertyPage);
LineToolVertLineInputsPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');if(this._linetool.points().item(0)){var a=$('<input type="text" class="ticker">'),b=$("<tr>").appendTo(this._table);$("<td>"+$.t("Bar #")+"</td>").appendTo(b);$("<td>").append(a).appendTo(b);var b=this._linetool.properties().points[0],c=[ToIntTransformer(b.bar.value()),GreateTransformer(-5E3),LessTransformer(15E3)];this.bindControl(new SimpleStringBinder(a,
b.bar,c,!1,this.model(),"Change "+this._linetool+" point bar index"));this.loadData()}};function LineToolPitchforkStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolPitchforkStylesPropertyPage,TemplatesLineToolPropertyPage);LineToolPitchforkStylesPropertyPage.prototype.onResoreDefaults=function(){this._linetool.properties().style.listeners().fire(this._linetool.properties().style)};
LineToolPitchforkStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){c=$("<tr>");c.appendTo(this._table);if(a){var d=$("<td>");d.appendTo(c);a=$("<input type='checkbox' class='visibility-switch'>");a.appendTo(d);d=$("<td>");d.appendTo(c);var e=$("<input type='text'>");e.appendTo(d);e.css("width","70px");this.bindControl(new BooleanBinder(a,b.visible,!0,this.model(),"Change Pitchfork Line Visibility"));this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,
this.model(),"Change Pitchfork Line Coeff"))}else $("<td></td>").appendTo(c),$("<td>"+$.t("Median")+"</td>").appendTo(c);a=$("<td class='colorpicker-cell'>");a.appendTo(c);a=TradingView.addColorPicker(a);e=$("<td>");e.appendTo(c);d=TradingView.createLineWidthEditor();d.appendTo(e);e=$("<td>");e.appendTo(c);c=TradingView.createLineStyleEditor();c.render().appendTo(e);this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Pitchfork Line Color"));this.bindControl(new SimpleComboBinder(c,
b.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style"));this.bindControl(new SliderBinder(d,b.linewidth,!0,this.model(),"Change Pitchfork Line Width"))};
LineToolPitchforkStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().median,!1);for(var a=0;8>=a;a++){var b="level"+a;this.addLevelEditor($.t("Level {0}").format(a+1),this._linetool.properties()[b],!1)}a=$("<tr>");a.appendTo(this._table);b=$("<input type='checkbox' class='visibility-switch'>");
$("<td>").append(b).appendTo(a);this.createLabeledCell("Background",b).appendTo(a);var c=TradingView.createTransparencyEditor();$('<td colspan="3">').append(c).appendTo(a);var d=$("<select><option value='0'>"+$.t("Original")+"</option><option value='3'>"+$.t("Schiff")+"</option><option value='1'>"+$.t("Modified Schiff")+"</option><option value='2'>"+$.t("Inside")+"</option></select>"),a=$("<tr>");a.appendTo(this._table);$("<td>"+$.t("Style")+"</td>").appendTo(a);$("<td>").append(d).appendTo(a);this.bindControl(new SimpleComboBinder(d,
this._linetool.properties().style,parseInt,!0,this.model(),"Change Pitchfork Style"));this.bindControl(new BooleanBinder(b,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfork Background Visibility"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfork Background Transparency"));this.loadData()};LineToolPitchforkStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolPitchfanStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolPitchfanStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolPitchfanStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){c=$("<tr>");c.appendTo(this._table);if(a){var d=$("<td>");d.appendTo(c);a=$("<input type='checkbox' class='visibility-switch'>");a.appendTo(d);d=$("<td>");d.appendTo(c);var e=$("<input type='text'>");e.appendTo(d);e.css("width","70px");this.bindControl(new BooleanBinder(a,b.visible,!0,this.model(),"Change Pitchfork Line Visibility"));this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,
this.model(),"Change Pitchfork Line Coeff"))}else $("<td colspan='2'>"+$.t("Median")+"</td>").appendTo(c);a=$("<td class='colorpicker-cell'>");a.appendTo(c);a=TradingView.addColorPicker(a);e=$("<td>");e.appendTo(c);d=TradingView.createLineWidthEditor();d.appendTo(e);e=$("<td>");e.appendTo(c);c=TradingView.createLineStyleEditor();c.render().appendTo(e);this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Pitchfork Line Color"));this.bindControl(new SimpleComboBinder(c,b.linestyle,parseInt,
!0,this.model(),"Change Pitchfan Line Style"));this.bindControl(new SliderBinder(d,b.linewidth,!0,this.model(),"Change Pitchfan Line Width"))};
LineToolPitchfanStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().median,!1);for(var a=0;8>=a;a++){var b="level"+a;this.addLevelEditor("Level "+(a+1),this._linetool.properties()[b],!1)}a=$("<tr>");a.appendTo(this._table);b=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(b).appendTo(a);
this.createLabeledCell("Background",b).appendTo(a);var c=TradingView.createTransparencyEditor();$('<td colspan="3">').append(c).appendTo(a);this.bindControl(new BooleanBinder(b,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfan Background Visibility"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfan Background Transparency"));this.loadData()};LineToolPitchfanStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolTextInplaceEditor(a,b){this._chartWidget=a;this._undoModel=b}
LineToolTextInplaceEditor.prototype.attachSource=function(a,b){this._source=a;this._edit=$("<textarea>");this._edit.css("width","300");this._edit.css("height","150");this._edit.appendTo(this._chartWidget._jqMainDiv);TradingView.setAbsolutePos(this._edit,b);this._edit.val(a.properties().text.value());this._edit.focus();var c=this._edit;c.select();this._binding=new SimpleStringBinder(c,a.properties().text,null,!0,this._undoModel,"change line tool text");this._edit.focusout(function(){a.properties().text.setValue(c.val())});
this._edit.mousedown(function(a){return!0});return c};function LineToolTextStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolTextStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolTextStylesPropertyPage.prototype.prepareLayout=function(){var a=this.createColorPicker(),b=this.createColorPicker(),c=this.createFontSizeEditor(),d=this.createFontEditor(),e=this.createTextEditor(350,200),f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),h=$('<input type="checkbox" class="visibility-switch">'),k=$('<input type="checkbox" class="visibility-switch">'),m=$('<input type="checkbox">'),n=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),
q=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new ColorBinding(a,this._linetool.properties().color,!0,this.model(),"Change Text Color"));this.bindControl(new SimpleComboBinder(c,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(d,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new SimpleStringBinder(e,this._linetool.properties().text,
null,!0,this.model(),"Change Text"));this.bindControl(new ColorBinding(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background"));this.bindControl(new SliderBinder(g,this._linetool.properties().backgroundTransparency,!0,this.model(),"Change Text Background Transparency"));this.bindControl(new BooleanBinder(h,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill"));this.bindControl(new BooleanBinder(k,this._linetool.properties().drawBorder,
!0,this.model(),"Change Text Border"));this.bindControl(new ColorBinding(b,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color"));this.bindControl(new BooleanBinder(m,this._linetool.properties().wordWrap,!0,this.model(),"Change Text Wrap"));this.bindControl(new BooleanBinder(n,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(q,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var l=
$('<table class="property-page" cellspacing="0" cellpadding="2">'),s=$('<table class="property-page" cellspacing="0" cellpadding="2">'),u=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=l.add(u).add(s);$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(a)).append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(c)).append($(document.createElement("td")).attr({width:1}).append(n)).append($(document.createElement("td")).append(q)).appendTo(l);
$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(e)).appendTo(l);a=this.addLabeledRow(s,"Text Wrap",m);$("<td>").append(m).prependTo(a);a=this.addLabeledRow(u,"Background",h);$("<td>").append(h).prependTo(a);$("<td>").append(f).appendTo(a);$("<td>").append(g).appendTo(a);a=this.addLabeledRow(u,"Border",k);$("<td>").append(k).prependTo(a);$("<td>").append(b).appendTo(a);this.loadData();setTimeout(function(){e.select();e.focus()},20)};
LineToolTextStylesPropertyPage.prototype.widget=function(){return this._table};
LineToolTextStylesPropertyPage.prototype.dialogPosition=function(a,b){var c=0,d=this._linetool,e=d._model.paneForSource(d);$.each(this._model._chartWidget._paneWidgets,function(a,b){if(b._state==e)return c=$(b.canvas).offset().top,!1});a||(a={});var f=a.left,g=a.top,h=this._linetool.paneViews().item(0);if(h)var k=h._floatPoints.item(0);k&&(f=k.x,g=k.y+c);h=$(b).outerHeight();k=$(window).height();d=d.properties().fontsize.value();return{top:g+h+d+5<=k?g+d+5:g-h-5,left:f}};function LineToolRectangleStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolRectangleStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolRectangleStylesPropertyPage.prototype.prepareLayout=function(){function a(){g.slider("option","disabled",!h.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Border");d.prepend("<td>");$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var e=$('<input type="checkbox" class="visibility-switch">'),
f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),d=this.addLabeledRow(this._table,"Background",e);$("<td>").append(e).prependTo(d);$("<td>").append(f).appendTo(d);$("<td>").append(g).appendTo(d);var h=this._linetool.properties().fillBackground;a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(e,this._linetool.properties().fillBackground,!0,this.model(),"Change Rectangle Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().color,
!0,this.model(),"Change Rectangle Line Color"));this.bindControl(new ColorBinding(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Rectangle Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Rectangle Border Width"));this.bindControl(new SliderBinder(g,this._linetool.properties().transparency,!0,this.model(),"Change Rectangle Background Transparency"));this.loadData()};
LineToolRectangleStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolEllipseStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolEllipseStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolEllipseStylesPropertyPage.prototype.prepareLayout=function(){function a(){g.slider("option","disabled",!h.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Border");d.prepend("<td>");$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var e=$('<input type="checkbox" class="visibility-switch">'),
f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),d=this.addLabeledRow(this._table,"Background",e);$("<td>").append(e).prependTo(d);$("<td>").append(f).appendTo(d);$("<td>").append(g).appendTo(d);var h=this._linetool.properties().fillBackground;a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(e,this._linetool.properties().fillBackground,!0,this.model(),"Change Ellipse Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().color,
!0,this.model(),"Change Ellipse Line Color"));this.bindControl(new ColorBinding(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Ellipse Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Ellipse Border Width"));this.bindControl(new SliderBinder(g,this._linetool.properties().transparency,!0,this.model(),"Change Ellipse Background Transparency"));this.loadData()};
LineToolEllipseStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolArcStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolArcStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolArcStylesPropertyPage.prototype.prepareLayout=function(){function a(){g.slider("option","disabled",!h.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Border");d.prepend("<td>");$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var e=$('<input type="checkbox" class="visibility-switch">'),
f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),d=this.addLabeledRow(this._table,"Background",e);$("<td>").append(e).prependTo(d);$("<td>").append(f).appendTo(d);$("<td>").append(g).appendTo(d);var h=this._linetool.properties().fillBackground;a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(e,this._linetool.properties().fillBackground,!0,this.model(),"Change Arc Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().color,
!0,this.model(),"Change Arc Line Color"));this.bindControl(new ColorBinding(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Arc Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Arc Border Width"));this.bindControl(new SliderBinder(g,this._linetool.properties().transparency,!0,this.model(),"Change Arc Background Transparency"));this.loadData()};LineToolArcStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolTriangleStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolTriangleStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolTriangleStylesPropertyPage.prototype.prepareLayout=function(){function a(){g.slider("option","disabled",!h.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Border");d.prepend("<td>");$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var e=$('<input type="checkbox" class="visibility-switch">'),
f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),d=this.addLabeledRow(this._table,"Background",e);$("<td>").append(e).prependTo(d);$("<td>").append(f).appendTo(d);$("<td>").append(g).appendTo(d);var h=this._linetool.properties().fillBackground;a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(e,this._linetool.properties().fillBackground,!0,this.model(),"Change Triangle Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().color,
!0,this.model(),"Change Triangle Line Color"));this.bindControl(new ColorBinding(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Triangle Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Triangle Border Width"));this.bindControl(new SliderBinder(g,this._linetool.properties().transparency,!0,this.model(),"Change Triangle Background Transparency"));this.loadData()};
LineToolTriangleStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolParallelChannelStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolParallelChannelStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolParallelChannelStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),d=this.createColorPicker(),e=$("<tr>").appendTo(a);$("<td></td><td>"+$.t("Channel")+"</td>").appendTo(e);$("<td>").append(d).appendTo(e);$("<td>").append(b).appendTo(e);
$("<td>").append(c.render()).appendTo(e);var e=$("<tr>").appendTo(a),f=$("<td>").appendTo(e),g=$("<input type='checkbox' class='visibility-switch'>");g.appendTo(f);this.createLabeledCell("Middle",g).appendTo(e);var f=TradingView.createLineWidthEditor(),h=TradingView.createLineStyleEditor(),k=this.createColorPicker();$("<td>").append(k).appendTo(e);$("<td>").append(f).appendTo(e);$("<td>").append(h.render()).appendTo(e);var e=$("<tr>").appendTo(a),m=$("<td>").appendTo(e),a=$("<input type='checkbox' class='visibility-switch'>");
a.appendTo(m);this.createLabeledCell("Background",a).appendTo(e);m=this.createColorPicker();$("<td>").append(m).appendTo(e);var n=TradingView.createTransparencyEditor(m);$('<td colspan="2">').append(n).appendTo(e);var q=$("<tbody>").appendTo(this._table),e=this.addEditorRow(q,"Extend Left",$("<input type='checkbox'>"),2),q=this.addEditorRow(q,"Extend Right",$("<input type='checkbox'>"),2),l=this._linetool.properties();this.bindControl(new BooleanBinder(a,l.fillBackground,!0,this.model(),"Change Parallel Channel Fill Background"));
this.bindControl(new BooleanBinder(g,l.showMidline,!0,this.model(),"Change Parallel Channel Show Center Line"));this.bindControl(new BooleanBinder(e,l.extendLeft,!0,this.model(),"Change Parallel Channel Extending Left"));this.bindControl(new BooleanBinder(q,l.extendRight,!0,this.model(),"Change Parallel Channel Extending Right"));this.bindControl(new ColorBinding(d,l.linecolor,!0,this.model(),"Change Parallel Channel Color"));this.bindControl(new SimpleComboBinder(c,l.linestyle,parseInt,!0,this.model(),
"Change Parallel Channel Style"));this.bindControl(new SliderBinder(b,l.linewidth,!0,this.model(),"Change Parallel Channel Width"));this.bindControl(new ColorBinding(k,l.midlinecolor,!0,this.model(),"Change Parallel Channel Middle Color"));this.bindControl(new SimpleComboBinder(h,l.midlinestyle,parseInt,!0,this.model(),"Change Parallel Channel Middle Style"));this.bindControl(new SliderBinder(f,l.midlinewidth,!0,this.model(),"Change Parallel Channel Middle Width"));this.bindControl(new ColorBinding(m,
l.backgroundColor,!0,this.model(),"Change Parallel Channel Back Color"));this.bindControl(new SliderBinder(n,l.transparency,!0,this.model(),"Change Parallel Channel Background Transparency"));this.loadData()};LineToolParallelChannelStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolArrowMarkStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolArrowMarkStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolArrowMarkStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">').css({width:"100%"});var a=$("<input type='text'>").css({width:"100%"}),b=$('<div class="property-page-fullwidth-wrapper">').append(a),c=this.createColorPicker(),d=this.createFontEditor(),e=$("<tr>").appendTo(this._table);$("<td>").css({width:"0"}).html($.t("Text")).appendTo(e);$('<td colspan="2">').append(b).appendTo(e);e=this.addLabeledRow(this._table,
"Text Font");e.children().css({whiteSpace:"nowrap"});$("<td>").append(c).appendTo(e).css({width:"0"});$("<td>").append(d).appendTo(e);this.bindControl(new ColorBinding(c,this._linetool.properties().color,!0,this.model(),"Change Arrow Mark Text Color"));this.bindControl(new SimpleStringBinder(a,this._linetool.properties().text,null,!0,this.model(),"Change Arrow Mark Text"));this.bindControl(new SimpleComboBinder(d,this._linetool.properties().font,null,!0,this.model(),"Change Arrow Mark Font"));this.loadData();
setTimeout(function(){a.select();a.focus()},20)};LineToolArrowMarkStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolPriceLabelStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolPriceLabelStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolPriceLabelStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=this.createColorPicker(),b=this.createColorPicker(),c=this.createColorPicker(),d=TradingView.createTransparencyEditor(c),e=this.addLabeledRow(this._table,"Text Color");$("<td>").append(a).appendTo(e);e=this.addLabeledRow(this._table,"Border Color");$("<td>").append(b).appendTo(e);
e=this.addLabeledRow(this._table,"Background");$("<td>").append(c).appendTo(e);$("<td>").append(d).appendTo(e);this.bindControl(new ColorBinding(a,this._linetool.properties().color,!0,this.model(),"Change Price Text Color"));this.bindControl(new ColorBinding(b,this._linetool.properties().borderColor,!0,this.model(),"Change Border Color"));this.bindControl(new ColorBinding(c,this._linetool.properties().backgroundColor,!0,this.model(),"Change Background Color"));this.bindControl(new SliderBinder(d,
this._linetool.properties().transparency,!0,this.model(),"Change Background Transparency"));this.loadData()};LineToolPriceLabelStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolBalloonStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolBalloonStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolBalloonStylesPropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="0">').css({width:"100%"}).data("layout-tab-open",EditObjectDialog.TAB_OPEN_OVERRIDE),b=$('<table class="property-page" cellspacing="0" cellpadding="0">');this._table=a.add(b);var c=this.createColorPicker(),d=this.createColorPicker(),e=this.createColorPicker(),f=TradingView.createTransparencyEditor(e),g=$("<input type='text'>").css({width:"100%"}),a=$("<tr>").appendTo(a),
h=$('<div class="property-page-fullwidth-wrapper">').append(g);$("<td>").css({width:"0"}).append(c).appendTo(a);$("<td>").append(h).appendTo(a);a=this.addLabeledRow(b,"Background");$("<td>").appendTo(a).append(e);$("<td>").appendTo(a).append(f);a=this.addLabeledRow(b,"Border Color");$("<td>").appendTo(a).append(d);$("<td>");this.bindControl(new ColorBinding(c,this._linetool.properties().color,!0,this.model(),"Change Balooon Text Color"));this.bindControl(new ColorBinding(d,this._linetool.properties().borderColor,
!0,this.model(),"Change Balloon Border Color"));this.bindControl(new ColorBinding(e,this._linetool.properties().backgroundColor,!0,this.model(),"Change Balloon Background Color"));this.bindControl(new SliderBinder(f,this._linetool.properties().transparency,!0,this.model(),"Change Balloon Background Transparency"));this.bindControl(new SimpleStringBinder(g,this._linetool.properties().text,null,!0,this.model(),"Change Balloon Text"));this.loadData();setTimeout(function(){g.select();g.focus()},0)};
LineToolBalloonStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolBrushStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolBrushStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolBrushStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=TradingView.createLineWidthEditor(),b=this.createColorPicker(),c=$('<input type="checkbox" class="visibility-switch">'),d=this.createColorPicker(),e=TradingView.createTransparencyEditor(d),f=this.addLabeledRow(this._table,"Line");$("<td>").prependTo(f);$("<td>").append(b).appendTo(f);$("<td>").append(a).appendTo(f);f=this.addLabeledRow(this._table,
"Background",c);$("<td>").append(c).prependTo(f);$("<td>").append(d).appendTo(f);$("<td>").append(e).appendTo(f);this.bindControl(new ColorBinding(b,this._linetool.properties().linecolor,!0,this.model(),"Change Brush Color"));this.bindControl(new SliderBinder(a,this._linetool.properties().linewidth,!0,this.model(),"Change Brush Line Width"));this.bindControl(new BooleanBinder(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Brush Filling"));this.bindControl(new ColorBinding(d,
this._linetool.properties().backgroundColor,!0,this.model(),"Change Brush Background Color"));this.bindControl(new SliderBinder(e,this._linetool.properties().transparency,!0,this.model(),"Change Brush Background Transparency"));this.loadData()};LineToolBrushStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolPredictionStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolPredictionStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolPredictionStylesPropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),c=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=a.add(b).add(c);var d=this.createColorPicker(),e=TradingView.createLineWidthEditor(),a=this.addLabeledRow(a,"Line");$("<td>").append(d).appendTo(a);$("<td>").append(e).appendTo(a);
var a=$("<tr>").appendTo(b),b=$("<td>").appendTo(a).css({"vertical-align":"top",width:"50%"}),a=$("<td>").appendTo(a).css({"vertical-align":"top",width:"50%"}),f=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo(b),g=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo(a),b=this.addColorPickerRow(f,"Source back color"),a=this.addColorPickerRow(f,"Source text color"),h=this.addColorPickerRow(f,"Source border color"),k=this.addColorPickerRow(f,"Success back color"),
f=this.addColorPickerRow(f,"Success text color"),m=this.addColorPickerRow(g,"Target back color"),n=this.addColorPickerRow(g,"Target text color"),q=this.addColorPickerRow(g,"Target border color"),l=this.addColorPickerRow(g,"Failure back color"),g=this.addColorPickerRow(g,"Failure text color"),s=TradingView.createTransparencyEditor(m);this.addEditorRow(c,"Transparency",s);this.bindControl(new ColorBinding(d,this._linetool.properties().linecolor,!0,this.model(),"Forecast Line Color"));this.bindControl(new SliderBinder(e,
this._linetool.properties().linewidth,!0,this.model(),"Forecast Line Width"));this.bindControl(new ColorBinding(b,this._linetool.properties().sourceBackColor,!0,this.model(),"Forecast Source Background Color"));this.bindControl(new ColorBinding(h,this._linetool.properties().sourceStrokeColor,!0,this.model(),"Forecast Source Border Color"));this.bindControl(new ColorBinding(a,this._linetool.properties().sourceTextColor,!0,this.model(),"Forecast Source Text Color"));this.bindControl(new ColorBinding(m,
this._linetool.properties().targetBackColor,!0,this.model(),"Forecast Target Background Color"));this.bindControl(new ColorBinding(q,this._linetool.properties().targetStrokeColor,!0,this.model(),"Forecast Target Border Color"));this.bindControl(new ColorBinding(n,this._linetool.properties().targetTextColor,!0,this.model(),"Forecast Target Text Color"));this.bindControl(new ColorBinding(k,this._linetool.properties().successBackground,!0,this.model(),"Forecast Success Back Color"));this.bindControl(new ColorBinding(f,
this._linetool.properties().successTextColor,!0,this.model(),"Forecast Success Text Color"));this.bindControl(new ColorBinding(l,this._linetool.properties().failureBackground,!0,this.model(),"Forecast Failure Back Color"));this.bindControl(new ColorBinding(g,this._linetool.properties().failureTextColor,!0,this.model(),"Forecast Failure Text Color"));this.bindControl(new SliderBinder(s,this._linetool.properties().transparency,!0,this.model(),"Change Forecast Background Transparency"));this.loadData()};
LineToolPredictionStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolPolylineStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolPolylineStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolPolylineStylesPropertyPage.prototype.prepareLayout=function(){function a(){g.slider("option","disabled",!h.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Border");d.prepend("<td>");$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var e=$('<input type="checkbox" class="visibility-switch">'),
f=this.createColorPicker(),g=TradingView.createTransparencyEditor(f),d=this.addLabeledRow(this._table,"Background",e);$("<td>").append(e).prependTo(d);$("<td>").append(f).appendTo(d);$("<td>").append(g).appendTo(d);var h=this._linetool.properties().fillBackground;a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(e,this._linetool.properties().fillBackground,!0,this.model(),"Change Polyline Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().linecolor,
!0,this.model(),"Change Polyline Line Color"));this.bindControl(new ColorBinding(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Polyline Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Polyline Border Width"));this.bindControl(new SliderBinder(g,this._linetool.properties().transparency,!0,this.model(),"Change Polyline Background Transparency"));this.loadData()};
LineToolPolylineStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolGannSquareStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolGannSquareStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolGannSquareStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){b=$("<tr>");b.appendTo(a);var d=$("<td>");d.appendTo(b);a=$("<input type='checkbox' class='visibility-switch'>");a.appendTo(d);d=$("<td>");d.appendTo(b);var e=$("<input type='text'>");e.appendTo(d);e.css("width","70px");this.bindControl(new BooleanBinder(a,c.visible,!0,this.model(),"Change Gann Square Line Visibility"));this.bindControl(new SimpleStringBinder(e,c.coeff,ToFloatTransformer(c.coeff.value()),!1,this.model(),
"Change Pitchfork Line Coeff"));a=$("<td class='colorpicker-cell'>");a.appendTo(b);b=TradingView.addColorPicker(a);this.bindControl(new ColorBinding(b,c.color,!0,this.model(),"Change Gann Square Line Color"))};
LineToolGannSquareStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page property-page-unpadded");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this._table.css({width:"100%"});var a=$("<tbody>").appendTo(this._table),b=$("<tr>");b.appendTo(a);var c=$('<td width="50%">');c.appendTo(b);a=$('<td width="50%">');a.appendTo(b);b=$('<table cellspacing="0" cellpadding="2">');b.appendTo(c);b.addClass("property-page");
c=$('<table cellspacing="0" cellpadding="2">');c.appendTo(a);c.addClass("property-page");$("<tr><td align='center' colspan='4'>"+$.t("Price Levels")+"</td></tr>").appendTo(b);$("<tr><td align='center' colspan='4'>"+$.t("Time Levels")+"</td></tr>").appendTo(c);for(a=1;7>=a;a++){var d="hlevel"+a;this.addLevelEditor(b,"Level "+a,this._linetool.properties()[d])}for(a=1;7>=a;a++)d="vlevel"+a,this.addLevelEditor(c,"Level "+a,this._linetool.properties()[d]);var c=$("<input type='checkbox' class='visibility-switch'>"),
d=$("<input type='checkbox' class='visibility-switch'>"),e=$("<input type='checkbox' class='visibility-switch'>"),f=$("<input type='checkbox' class='visibility-switch'>"),g=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),b=$("<tr>").appendTo(g),h=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(b)),b=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(b)),
a=this.addLabeledRow(h,"Left Labels",c);$("<td>").append(c).prependTo(a);a=this.addLabeledRow(b,"Right Lables",d);$("<td>").append(d).prependTo(a);a=this.addLabeledRow(h,"Top Labels",e);$("<td>").append(e).prependTo(a);a=this.addLabeledRow(b,"Bottom Lables",f);$("<td>").append(f).prependTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().showLeftLabels,!0,this.model(),"Change Gann Square Left Labels Visibility"));this.bindControl(new BooleanBinder(d,this._linetool.properties().showRightLabels,
!0,this.model(),"Change Gann Square Right Labels Visibility"));this.bindControl(new BooleanBinder(e,this._linetool.properties().showTopLabels,!0,this.model(),"Change Gann Square Top Labels Visibility"));this.bindControl(new BooleanBinder(f,this._linetool.properties().showBottomLabels,!0,this.model(),"Change Gann Square Bottom Labels Visibility"));this._table=this._table.add(g);a=$("<tr>");a.appendTo(h);c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(a);d=TradingView.createTransparencyEditor();
$("<td>").append(d).appendTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().fillHorzBackground,!0,this.model(),"Change Gann Square Background Visibility"));this.bindControl(new SliderBinder(d,this._linetool.properties().horzTransparency,!0,this.model(),"Change Gann Square Background Transparency"));a=$("<tr>");a.appendTo(b);c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(a);d=TradingView.createTransparencyEditor();$("<td>").append(d).appendTo(a);
this.bindControl(new BooleanBinder(c,this._linetool.properties().fillVertBackground,!0,this.model(),"Change Gann Square Background Visibility"));this.bindControl(new SliderBinder(d,this._linetool.properties().vertTransparency,!0,this.model(),"Change Gann Square Background Transparency"));this.loadData()};LineToolGannSquareStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolGannComplexStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolGannComplexStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolGannComplexStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page property-page-unpadded");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this._table.css({width:"100%"});var a=$("<tr>");a.appendTo(this._table);var b=this._linetool.properties(),c=$("<table>");$("<td valign='top'>").append(c).appendTo(a);var d=$("<tr>");$("<td colspan='3'>"+$.t("Levels")+"</td>").appendTo(d);d.appendTo(c);
for(var e in b.levels._childs){var f=b.levels[e],g=$("<tr>");g.appendTo(c);$("<td>"+e+"</td>").appendTo(g);d=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(d).appendTo(g);var h=$("<td class='colorpicker-cell'>");h.appendTo(g);var h=TradingView.addColorPicker(h),k=$("<td>");k.appendTo(g);g=TradingView.createLineWidthEditor();g.appendTo(k);this.bindControl(new BooleanBinder(d,f.visible,!0,this.model(),"Change Gann Line Visibility"));this.bindControl(new ColorBinding(h,f.color,
!0,this.model(),"Change Gann Line Color"));this.bindControl(new SliderBinder(g,f.width,!0,this.model(),"Change Gann Line Width"))}c=$("<table>");$("<td valign='top'>").append(c).appendTo(a);d=$("<tr>");$("<td colspan='4'>"+$.t("Fans")+"</td>").appendTo(d);d.appendTo(c);for(e in b.fanlines._childs)f=b.fanlines[e],g=$("<tr>"),g.appendTo(c),d=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(d).appendTo(g),h=f.x.value()+"x"+f.y.value(),$("<td>"+h+"</td>").appendTo(g),h=$("<td class='colorpicker-cell'>"),
h.appendTo(g),h=TradingView.addColorPicker(h),k=$("<td>"),k.appendTo(g),g=TradingView.createLineWidthEditor(),g.appendTo(k),this.bindControl(new BooleanBinder(d,f.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new ColorBinding(h,f.color,!0,this.model(),"Change Gann Fan Color")),this.bindControl(new SliderBinder(g,f.width,!0,this.model(),"Change Gann Line Width"));c=$("<table>");$("<td valign='top'>").append(c).appendTo(a);a=$("<tr>");$("<td colspan='4'>"+$.t("Arcs")+"</td>").appendTo(a);
a.appendTo(c);for(e in b.arcs._childs)a=b.arcs[e],g=$("<tr>"),g.appendTo(c),d=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(d).appendTo(g),h=a.x.value()+"x"+a.y.value(),$("<td>"+h+"</td>").appendTo(g),h=$("<td class='colorpicker-cell'>"),h.appendTo(g),h=TradingView.addColorPicker(h),k=$("<td>"),k.appendTo(g),g=TradingView.createLineWidthEditor(),g.appendTo(k),this.bindControl(new BooleanBinder(d,a.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new ColorBinding(h,
a.color,!0,this.model(),"Change Gann Arc Color")),this.bindControl(new SliderBinder(g,a.width,!0,this.model(),"Change Gann Line Width"));a=$("<tbody>").appendTo(this._table);b=$('<input type="checkbox" class="visibility-switch">');e=TradingView.createTransparencyEditor();a=$("<tr>").appendTo(a);d=$("<table>");$('<td colspan="3">').append(d).appendTo(a);a=$("<tr>").appendTo(d);$("<td>"+$.t("Background")+"</td>").appendTo(a);$("<td>").append(b).appendTo(a);$("<td>").append(e).appendTo(a);this.bindControl(new BooleanBinder(b,
this._linetool.properties().arcsBackground.fillBackground,!0,this.model(),"Change Gann Square Filling"));this.bindControl(new SliderBinder(e,this._linetool.properties().arcsBackground.transparency,!0,this.model(),"Change Gann Square Background Transparency"))};LineToolGannComplexStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolGannFanStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolGannFanStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolGannFanStylesPropertyPage.prototype.addLevelEditor=function(a,b,c,d){var e=$("<tr>");e.appendTo(this._tbody);d="control-level-"+c+"-"+d;var f=$("<td>");f.appendTo(e);c=$("<input type='checkbox' class='visibility-switch' id='"+d+"'>");c.appendTo(f);this.createLabeledCell(a).appendTo(e).find("label").attr("for",d);a=$("<td class='colorpicker-cell'>");a.appendTo(e);a=TradingView.addColorPicker(a);f=$("<td>");f.appendTo(e);d=TradingView.createLineWidthEditor();d.appendTo(f);f=$("<td>");f.appendTo(e);
e=TradingView.createLineStyleEditor();e.render().appendTo(f);this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Gann Fan Line Visibility"));this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Gann Fan Line Color"));this.bindControl(new SimpleComboBinder(e,b.linestyle,parseInt,!0,this.model(),"Change Gann Fan Line Style"));this.bindControl(new SliderBinder(d,b.linewidth,!0,this.model(),"Change Gann Fan Line Width"))};
LineToolGannFanStylesPropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._tbody=$("<tbody>").appendTo(a);for(var c=1;9>=c;c++){var d="level"+c,d=this._linetool.properties()[d],e=d.coeff1.value(),f=d.coeff2.value();this.addLevelEditor("<sup>"+e+"</sup>&frasl;<sub>"+f+"</sub>",d,e,f)}d=$("<input type='checkbox' class='visibility-switch'>");c=this.addLabeledRow(b,
"Labels",d);$("<td>").append(d).prependTo(c);this.bindControl(new BooleanBinder(d,this._linetool.properties().showLabels,!0,this.model(),"Change Gann Fan Labels Visibility"));this._table=a.add(b);c=$("<tr>");c.appendTo(this._table);a=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(a).appendTo(c);this.createLabeledCell("Background",a).appendTo(c);b=TradingView.createTransparencyEditor();$('<td colspan="3">').append(b).appendTo(c);this.bindControl(new BooleanBinder(a,this._linetool.properties().fillBackground,
!0,this.model(),"Change Pitchfan Background Visibility"));this.bindControl(new SliderBinder(b,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfan Background Transparency"));this.loadData()};LineToolGannFanStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibCirclesStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibCirclesStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibCirclesStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);if(a){e=$("<td>");e.appendTo(d);var f=$("<input type='text'>");f.appendTo(e);f.css("width","70px");this.bindControl(new SimpleStringBinder(f,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))}else this.createLabeledCell("Trend Line",c).appendTo(d);
e=$("<td class='colorpicker-cell'>");e.appendTo(d);var e=TradingView.addColorPicker(e),g=$("<td>");g.appendTo(d);f=TradingView.createLineWidthEditor();f.appendTo(g);a||(a=$("<td>"),a.appendTo(d),d=TradingView.createLineStyleEditor(),d.render().appendTo(a),this.bindControl(new SimpleComboBinder(d,b.linestyle,parseInt,!0,this.model(),"Change Fib Circle Style")));this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Fib Circle Visibility"));this.bindControl(new ColorBinding(e,b.color,
!0,this.model(),"Change Fib Circle Line Color"));this.bindControl(new SliderBinder(f,b.linewidth,!0,this.model(),"Change Fib Circle Width"))};
LineToolFibCirclesStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}var c=$("<input type='checkbox' class='visibility-switch'>"),a=this.addLabeledRow(this._table,"Levels",
c);$("<td>").append(c).prependTo(a);b=$("<input type='checkbox' class='visibility-switch'>");a=this.addLabeledRow(this._table,"Coeffs As Percents",b);$("<td>").append(b).prependTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Circle Levels Visibility"));a=$("<tr>");a.appendTo(this._table);c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(a);this.createLabeledCell("Background",c).appendTo(a);var d=TradingView.createTransparencyEditor();
$('<td colspan="3">').append(d).appendTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfork Background Visibility"));this.bindControl(new SliderBinder(d,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfork Background Transparency"));this.bindControl(new BooleanBinder(b,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents"));this.loadData()};
LineToolFibCirclesStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibRetracementStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibRetracementStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibRetracementStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);a?(a=$("<td>"),a.appendTo(d),e=$("<input type='text'>"),e.appendTo(a),e.css("width","70px"),this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",c).appendTo(d);
a=$("<td class='colorpicker-cell'>");a.appendTo(d);a=TradingView.addColorPicker(a);var f=$("<td>");f.appendTo(d);e=TradingView.createLineWidthEditor();e.appendTo(f);f=$("<td>");f.appendTo(d);d=TradingView.createLineStyleEditor();d.render().appendTo(f);this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Pitchfork Line Visibility"));this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Pitchfork Line Color"));this.bindControl(new SimpleComboBinder(d,b.linestyle,parseInt,
!0,this.model(),"Change Pitchfork Line Style"));this.bindControl(new SliderBinder(e,b.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))};
LineToolFibRetracementStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}var c=$("<input type='checkbox' class='visibility-switch'>"),d=$("<input type='checkbox' class='visibility-switch'>"),
a=$("<input type='checkbox' class='visibility-switch'>"),b=$("<input type='checkbox' class='visibility-switch'>"),e=$("<input type='checkbox' class='visibility-switch'>"),f=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),g=$("<tr>").appendTo(f),h=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(g)),g=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(g)),
h=this.addLabeledRow(h,"Levels",c);$("<td>").append(c).prependTo(h);h=this.addLabeledRow(g,"Prices",d);$("<td>").append(d).prependTo(h);h=this.addLabeledRow(this._table,"Extend Lines",a);$("<td>").append(a).prependTo(h);h=this.addLabeledRow(this._table,"Reverse",b);$("<td>").append(b).prependTo(h);h=this.addLabeledRow(this._table,"Coeffs As Percents",e);$("<td>").append(e).prependTo(h);this.bindControl(new BooleanBinder(d,this._linetool.properties().showPrices,!0,this.model(),"Change Gann Fan Prices Visibility"));
this.bindControl(new BooleanBinder(c,this._linetool.properties().showCoeffs,!0,this.model(),"Change Gann Fan Levels Visibility"));c=$("<table cellspacing='0' cellpadding='0'>");d=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>");g=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>");
h=$("<tr>");h.append("<td>"+$.t("Labels")+"</td>").append(d).append("<td>&nbsp</td>").append(g);h.appendTo(c);h=$("<tr>");$("<td colspan='5'>").append(c).appendTo(h);h.appendTo(this._table);this.bindControl(new SimpleComboBinder(d,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Retracement Labels Alignment"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Retracement Labels Alignment"));this._table=
this._table.add(f);h=$("<tr>");h.appendTo(this._table);f=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(f).appendTo(h);this.createLabeledCell("Background",f).appendTo(h);c=TradingView.createTransparencyEditor();$('<td colspan="3">').append(c).appendTo(h);this.bindControl(new BooleanBinder(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,
!0,this.model(),"Change Fib Retracement Background Transparency"));this.bindControl(new BooleanBinder(a,this._linetool.properties().extendLines,!0,this.model(),"Change Fib Retracement Extend Lines"));this.bindControl(new BooleanBinder(b,this._linetool.properties().reverse,!0,this.model(),"Change Fib Retracement Reverse"));this.bindControl(new BooleanBinder(e,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents"));this.loadData()};
LineToolFibRetracementStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibChannelStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibChannelStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibChannelStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);a?(a=$("<td>"),a.appendTo(d),e=$("<input type='text'>"),e.appendTo(a),e.css("width","70px"),this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",c).appendTo(d);a=$("<td class='colorpicker-cell'>");
a.appendTo(d);a=TradingView.addColorPicker(a);var f=$("<td>");f.appendTo(d);e=TradingView.createLineWidthEditor();e.appendTo(f);f=$("<td>");f.appendTo(d);d=TradingView.createLineStyleEditor();d.render().appendTo(f);this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Pitchfork Line Visibility"));this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Pitchfork Line Color"));this.bindControl(new SimpleComboBinder(d,b.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style"));
this.bindControl(new SliderBinder(e,b.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))};
LineToolFibChannelStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}var c=$("<input type='checkbox' class='visibility-switch'>"),d=$("<input type='checkbox' class='visibility-switch'>"),a=$("<input type='checkbox' class='visibility-switch'>"),
b=$("<input type='checkbox' class='visibility-switch'>"),e=$("<input type='checkbox' class='visibility-switch'>"),f=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),g=$("<tr>").appendTo(f),h=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(g)),g=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(g)),h=this.addLabeledRow(h,
"Levels",c);$("<td>").append(c).prependTo(h);h=this.addLabeledRow(g,"Prices",d);$("<td>").append(d).prependTo(h);h=this.addLabeledRow(this._table,"Extend Left",a);$("<td>").append(a).prependTo(h);h=this.addLabeledRow(this._table,"Extend Right",b);$("<td>").append(b).prependTo(h);h=this.addLabeledRow(this._table,"Coeffs As Percents",e);$("<td>").append(e).prependTo(h);this.bindControl(new BooleanBinder(d,this._linetool.properties().showPrices,!0,this.model(),"Change Gann Fan Prices Visibility"));this.bindControl(new BooleanBinder(c,
this._linetool.properties().showCoeffs,!0,this.model(),"Change Gann Fan Levels Visibility"));c=$("<table cellspacing='0' cellpadding='0'>");d=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>");g=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>");h=$("<tr>");h.append("<td>"+$.t("Labels")+
"</td>").append(d).append("<td>&nbsp</td>").append(g);h.appendTo(c);h=$("<tr>");$("<td colspan='5'>").append(c).appendTo(h);h.appendTo(this._table);this.bindControl(new SimpleComboBinder(d,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Retracement Labels Alignment"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Retracement Labels Alignment"));this._table=this._table.add(f);h=$("<tr>");h.appendTo(this._table);
f=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(f).appendTo(h);this.createLabeledCell("Background",f).appendTo(h);c=TradingView.createTransparencyEditor();$('<td colspan="3">').append(c).appendTo(h);this.bindControl(new BooleanBinder(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency"));
this.bindControl(new BooleanBinder(a,this._linetool.properties().extendLeft,!0,this.model(),"Change Fib Retracement Extend Lines"));this.bindControl(new BooleanBinder(b,this._linetool.properties().extendRight,!0,this.model(),"Change Fib Retracement Extend Lines"));this.bindControl(new BooleanBinder(e,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents"));this.loadData()};LineToolFibChannelStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolTrendBasedFibExtensionStylesPropertyPage(a,b,c){LineToolFibRetracementStylesPropertyPage.call(this,a,b,c)}inherit(LineToolTrendBasedFibExtensionStylesPropertyPage,LineToolFibRetracementStylesPropertyPage);function LineToolTrendBasedFibTimeStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolTrendBasedFibTimeStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolTrendBasedFibTimeStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);a?(a=$("<td>"),a.appendTo(d),e=$("<input type='text'>"),e.appendTo(a),e.css("width","70px"),this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",c).appendTo(d);
a=$("<td class='colorpicker-cell'>");a.appendTo(d);a=TradingView.addColorPicker(a);var f=$("<td>");f.appendTo(d);e=TradingView.createLineWidthEditor();e.appendTo(f);f=$("<td>");f.appendTo(d);d=TradingView.createLineStyleEditor();d.render().appendTo(f);this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Pitchfork Line Visibility"));this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Pitchfork Line Color"));this.bindControl(new SimpleComboBinder(d,b.linestyle,parseInt,
!0,this.model(),"Change Pitchfork Line Style"));this.bindControl(new SliderBinder(e,b.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))};
LineToolTrendBasedFibTimeStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}a=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"});
a=$("<tr>").appendTo(a);$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(a));$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(a));a=$("<input type='checkbox' class='visibility-switch'>");b=this.addLabeledRow(this._table,"Show Labels",a);$("<td>").append(a).prependTo(b);var c=$("<table cellspacing='0' cellpadding='0'>"),d=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+
$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),e=$("<select><option value='top'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='bottom'>"+$.t("bottom")+"</option></select>"),b=$("<tr>");b.append("<td>"+$.t("Labels")+"</td>").append(d).append("<td>&nbsp</td>").append(e);b.appendTo(c);b=$("<tr>");$("<td colspan='5'>").append(c).appendTo(b);b.appendTo(this._table);this.bindControl(new SimpleComboBinder(d,this._linetool.properties().horzLabelsAlign,
null,!0,this.model(),"Change Trend-Based Fib Time Labels Alignment"));this.bindControl(new SimpleComboBinder(e,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Trend-Based Fib Time Labels Alignment"));b=$("<tr>");b.appendTo(this._table);c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(b);this.createLabeledCell("Background",c).appendTo(b);d=TradingView.createTransparencyEditor();$('<td colspan="3">').append(d).appendTo(b);this.bindControl(new BooleanBinder(c,
this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility"));this.bindControl(new SliderBinder(d,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency"));this.bindControl(new BooleanBinder(a,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Retracement Extend Lines"));this.loadData()};LineToolTrendBasedFibTimeStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibSpeedResistanceFanStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibSpeedResistanceFanStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibSpeedResistanceFanStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){b=$("<tr>");b.appendTo(a);var d=$("<td>");d.appendTo(b);a=$("<input type='checkbox' class='visibility-switch'>");a.appendTo(d);d=$("<td>");d.appendTo(b);var e=$("<input type='text'>");e.appendTo(d);e.css("width","70px");this.bindControl(new BooleanBinder(a,c.visible,!0,this.model(),"Change Gann Square Line Visibility"));this.bindControl(new SimpleStringBinder(e,c.coeff,ToFloatTransformer(c.coeff.value()),!1,this.model(),
"Change Pitchfork Line Coeff"));a=$("<td class='colorpicker-cell'>");a.appendTo(b);b=TradingView.addColorPicker(a);this.bindControl(new ColorBinding(b,c.color,!0,this.model(),"Change Gann Square Line Color"))};
LineToolFibSpeedResistanceFanStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page property-page-unpadded");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this._table.css({width:"100%"});var a=$("<tbody>").appendTo(this._table),b=$("<tr>");b.appendTo(a);var c=$('<td width="50%">');c.appendTo(b);a=$('<td width="50%">');a.appendTo(b);b=$('<table cellspacing="0" cellpadding="2">');b.appendTo(c);
b.addClass("property-page");c=$('<table cellspacing="0" cellpadding="2">');c.appendTo(a);c.addClass("property-page");$("<tr><td align='center' colspan='4'>"+$.t("Price Levels")+"</td></tr>").appendTo(b);$("<tr><td align='center' colspan='4'>"+$.t("Time Levels")+"</td></tr>").appendTo(c);for(a=1;7>=a;a++){var d="hlevel"+a;this.addLevelEditor(b,"Level "+a,this._linetool.properties()[d])}for(a=1;7>=a;a++)d="vlevel"+a,this.addLevelEditor(c,"Level "+a,this._linetool.properties()[d]);var c=$("<input type='checkbox' class='visibility-switch'>"),
d=$("<input type='checkbox' class='visibility-switch'>"),e=$("<input type='checkbox' class='visibility-switch'>"),f=$("<input type='checkbox' class='visibility-switch'>"),b=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),a=$("<tr>").appendTo(b),g=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(a)),h=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(a)),
a=this.addLabeledRow(g,"Left Labels",c);$("<td>").append(c).prependTo(a);a=this.addLabeledRow(h,"Right Lables",d);$("<td>").append(d).prependTo(a);a=this.addLabeledRow(g,"Top Labels",e);$("<td>").append(e).prependTo(a);a=this.addLabeledRow(h,"Bottom Lables",f);$("<td>").append(f).prependTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().showLeftLabels,!0,this.model(),"Change Gann Square Left Labels Visibility"));this.bindControl(new BooleanBinder(d,this._linetool.properties().showRightLabels,
!0,this.model(),"Change Gann Square Right Labels Visibility"));this.bindControl(new BooleanBinder(e,this._linetool.properties().showTopLabels,!0,this.model(),"Change Gann Square Top Labels Visibility"));this.bindControl(new BooleanBinder(f,this._linetool.properties().showBottomLabels,!0,this.model(),"Change Gann Square Bottom Labels Visibility"));d=$('<table class="property-page" cellspacing="0" cellpadding="2">');e=TradingView.createLineWidthEditor();f=TradingView.createLineStyleEditor();g=this.createColorPicker();
c=$("<input type='checkbox' class='visibility-switch'>");a=this.addLabeledRow(d,"Grid",c);$("<td>").append(c).prependTo(a);$("<td>").append(g).appendTo(a);$("<td>").append(e).appendTo(a);$("<td>").append(f.render()).appendTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().grid.visible,!0,this.model(),"Change Fib Speed Resistance Fan Grid Visibility"));this.bindControl(new ColorBinding(g,this._linetool.properties().grid.color,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Color"));
this.bindControl(new SimpleComboBinder(f,this._linetool.properties().grid.linestyle,parseInt,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Style"));this.bindControl(new SliderBinder(e,this._linetool.properties().grid.linewidth,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Width"));this._table=this._table.add(b).add(d);a=$("<tr>");a.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(a);this.createLabeledCell("Background",c).appendTo(a);
b=TradingView.createTransparencyEditor();$('<td colspan="3">').append(b).appendTo(a);this.bindControl(new BooleanBinder(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Speed/Resistance Fan Background Visibility"));this.bindControl(new SliderBinder(b,this._linetool.properties().transparency,!0,this.model(),"Change Fib Speed/Resistance Fan Background Transparency"));this.loadData()};LineToolFibSpeedResistanceFanStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibSpeedResistanceArcsStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibSpeedResistanceArcsStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibSpeedResistanceArcsStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);if(a){e=$("<td>");e.appendTo(d);var f=$("<input type='text'>");f.appendTo(e);f.css("width","70px");this.bindControl(new SimpleStringBinder(f,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))}else $("<td>"+$.t("Trend Line")+"</td>").appendTo(d);
e=$("<td class='colorpicker-cell'>");e.appendTo(d);var e=TradingView.addColorPicker(e),g=$("<td>");g.appendTo(d);f=TradingView.createLineWidthEditor();f.appendTo(g);a||(a=$("<td>"),a.appendTo(d),d=TradingView.createLineStyleEditor(),d.render().appendTo(a),this.bindControl(new SimpleComboBinder(d,b.linestyle,parseInt,!0,this.model(),"Change Fib Speed Resistance Arcs Style")));this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Fib Speed Resistance Arcs Visibility"));this.bindControl(new ColorBinding(e,
b.color,!0,this.model(),"Change Fib Speed Resistance Arcs Line Color"));this.bindControl(new SliderBinder(f,b.linewidth,!0,this.model(),"Change Fib Speed Resistance Arcs Width"))};
LineToolFibSpeedResistanceArcsStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}b=$("<input type='checkbox' class='visibility-switch'>");a=this.addLabeledRow(this._table,
"Levels");$("<td>").append(b).prependTo(a);this.bindControl(new BooleanBinder(b,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Speed Resistance Arcs Levels Visibility"));a=$("<tr>");a.appendTo(this._table);b=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(b).appendTo(a);$("<td>"+$.t("Background")+"</td>").appendTo(a);var c=TradingView.createTransparencyEditor();$('<td colspan="3">').append(c).appendTo(a);this.bindControl(new BooleanBinder(b,this._linetool.properties().fillBackground,
!0,this.model(),"Change Fib Arcs Background Visibility"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,!0,this.model(),"Change Fib Arcs Background Transparency"));this.loadData()};LineToolFibSpeedResistanceArcsStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibSpiralStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibSpiralStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibSpiralStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),d=this.createColorPicker(),a=this.addLabeledRow(a,"Line");$("<td>").append(d).appendTo(a);$("<td>").append(b).appendTo(a);$('<td colspan="3">').append(c.render()).appendTo(a);this.bindControl(new ColorBinding(d,this._linetool.properties().linecolor,
!0,this.model(),"Change Fib Spiral Line Color"));this.bindControl(new SimpleComboBinder(c,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Fib Spiral Line Style"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Fib Spiral Line Width"));this.loadData()};LineToolFibSpiralStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibTimeZoneStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibTimeZoneStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibTimeZoneStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);a?(a=$("<td>"),a.appendTo(d),e=$("<input type='text'>"),e.appendTo(a),e.css("width","70px"),this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",c).appendTo(d);a=$("<td class='colorpicker-cell'>");
a.appendTo(d);a=TradingView.addColorPicker(a);var f=$("<td>");f.appendTo(d);e=TradingView.createLineWidthEditor();e.appendTo(f);f=$("<td>");f.appendTo(d);d=TradingView.createLineStyleEditor();d.render().appendTo(f);this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Pitchfork Line Visibility"));this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Pitchfork Line Color"));this.bindControl(new SimpleComboBinder(d,b.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style"));
this.bindControl(new SliderBinder(e,b.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))};
LineToolFibTimeZoneStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}var a=TradingView.createLineWidthEditor(),b=TradingView.createLineStyleEditor(),c=this.createColorPicker(),d=$("<input type='checkbox' class='visibility-switch'>"),e=
this.addLabeledRow(this._table,"Show Labels",d);$("<td>").append(d).prependTo(e);var f=$("<table cellspacing='0' cellpadding='0'>"),g=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),h=$("<select><option value='top'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='bottom'>"+$.t("bottom")+"</option></select>"),e=$("<tr>");e.append("<td>"+$.t("Labels")+
"</td>").append(g).append("<td>&nbsp</td>").append(h);e.appendTo(f);e=$("<tr>");$("<td colspan='5'>").append(f).appendTo(e);e.appendTo(this._table);this.bindControl(new SimpleComboBinder(g,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Time Zone Labels Alignment"));this.bindControl(new SimpleComboBinder(h,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Time Zone Labels Alignment"));e=$("<tr>");e.appendTo(this._table);f=$("<input type='checkbox' class='visibility-switch'>");
$("<td>").append(f).appendTo(e);this.createLabeledCell("Background",f).appendTo(e);g=TradingView.createTransparencyEditor();$('<td colspan="3">').append(g).appendTo(e);this.bindControl(new BooleanBinder(d,this._linetool.properties().showLabels,!0,this.model(),"Change Fib Time Zone Labels Visibility"));this.bindControl(new ColorBinding(c,this._linetool.properties().linecolor,!0,this.model(),"Change Fib Time Zone Color"));this.bindControl(new SimpleComboBinder(b,this._linetool.properties().linestyle,
parseInt,!0,this.model(),"Change Fib Time Zone Style"));this.bindControl(new SliderBinder(a,this._linetool.properties().linewidth,!0,this.model(),"Change Fib Time Zone Width"));this.bindControl(new BooleanBinder(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility"));this.bindControl(new SliderBinder(g,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency"));this.loadData()};
LineToolFibTimeZoneStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFibWedgeStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFibWedgeStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFibWedgeStylesPropertyPage.prototype.addLevelEditor=function(a,b,c){var d=$("<tr>");d.appendTo(this._table);var e=$("<td>");e.appendTo(d);c=$("<input type='checkbox' class='visibility-switch'>");c.appendTo(e);a?(a=$("<td>"),a.appendTo(d),e=$("<input type='text'>"),e.appendTo(a),e.css("width","70px"),this.bindControl(new SimpleStringBinder(e,b.coeff,ToFloatTransformer(b.coeff.value()),!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",c).appendTo(d);a=$("<td class='colorpicker-cell'>");
a.appendTo(d);a=TradingView.addColorPicker(a);e=$("<td>");e.appendTo(d);d=TradingView.createLineWidthEditor();d.appendTo(e);this.bindControl(new BooleanBinder(c,b.visible,!0,this.model(),"Change Fib Wedge Visibility"));this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Fib Wedge Line Color"));this.bindControl(new SliderBinder(d,b.linewidth,!0,this.model(),"Change Fib Wedge Width"))};
LineToolFibWedgeStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var a=1;11>=a;a++){var b="level"+a;this.addLevelEditor("Level "+a,this._linetool.properties()[b],!1)}b=$("<input type='checkbox' class='visibility-switch'>");a=this.addLabeledRow(this._table,"Levels",b);
$("<td>").append(b).prependTo(a);this.bindControl(new BooleanBinder(b,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Wedge Levels Visibility"));a=$("<tr>");a.appendTo(this._table);b=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(b).appendTo(a);this.createLabeledCell("Background",b).appendTo(a);var c=TradingView.createTransparencyEditor();$('<td colspan="3">').append(c).appendTo(a);this.bindControl(new BooleanBinder(b,this._linetool.properties().fillBackground,
!0,this.model(),"Change Wedge Background Visibility"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,!0,this.model(),"Change Wedge Background Transparency"));this.loadData()};LineToolFibWedgeStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolCircleLinesStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolCircleLinesStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolCircleLinesStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=TradingView.createLineWidthEditor(),b=TradingView.createLineStyleEditor(),c=this.createColorPicker(),d=this.addLabeledRow(this._table,"Lines");$("<td>").append(c).appendTo(d);$("<td>").append(a).appendTo(d);$("<td>").append(b.render()).appendTo(d);this.bindControl(new ColorBinding(c,
this._linetool.properties().linecolor,!0,this.model(),"Change Circle Lines Color"));this.bindControl(new SimpleComboBinder(b,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Circle Lines Style"));this.bindControl(new SliderBinder(a,this._linetool.properties().linewidth,!0,this.model(),"Change Circle Lines Width"));this.loadData()};LineToolCircleLinesStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolRegressionTrendInputsPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._linetool=c;this.prepareLayout()}inherit(LineToolRegressionTrendInputsPropertyPage,LineToolInputsPropertyPage);
LineToolRegressionTrendInputsPropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="0">'),b=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({"layout-tab":EditObjectDialog.TAB_NAME_INPUTS,"layout-tab-priority":EditObjectDialog.TAB_PRIORITY_INPUTS});this._table=a.add(b);for(var c=this._linetool.points(),d=0;d<c.size();d++){c.item(d);var e=$("<tr>");e.appendTo(a);var f=$("<td>");f.html("Point "+(d+1)+" Bar #");f.appendTo(e);
barEditCell=$("<td>");barEditCell.appendTo(e);e=$("<input type='text'>");e.appendTo(barEditCell);e.addClass("ticker");var f=this._linetool.properties().points[d],g=[ToIntTransformer(f.bar.value()),GreateTransformer(-5E3),LessTransformer(15E3)];this.bindControl(new SimpleStringBinder(e,f.bar,g,!1,this.model(),"Change "+this._linetool+" point bar index"))}a=StudyMetaInfo.findStudyMetaInfo(this._model.studiesMetaData(),"RegressionTrend@tv-basicstudies");StudyInputsPropertyPage.prototype.prepareLayoutImpl.call(this,
a,b)};LineToolRegressionTrendInputsPropertyPage.prototype.widget=function(){return this._table};function LineToolDateRangeStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolDateRangeStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolDateRangeStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(a,"Line");$("<td>").prependTo(d);$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var d=this.createColorPicker(),e=this.createColorPicker(),f=this.createFontSizeEditor(),g=this.createFontEditor();this.createTextEditor(350,
200);var h=this.createColorPicker(),k=TradingView.createTransparencyEditor(h),m=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),q=TradingView.createTransparencyEditor(n),l=$('<input type="checkbox" class="visibility-switch">');this.bindControl(new ColorBinding(d,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color"));this.bindControl(new SimpleComboBinder(f,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));
this.bindControl(new SimpleComboBinder(g,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(h,this._linetool.properties().labelBackgroundColor,!0,this.model(),"Change Text Background"));this.bindControl(new SliderBinder(k,this._linetool.properties().labelBackgroundTransparency,!0,this.model(),"Change Text Background Transparency"));this.bindControl(new BooleanBinder(m,this._linetool.properties().fillLabelBackground,!0,this.model(),"Change Text Background Fill"));
this.bindControl(new ColorBinding(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background"));this.bindControl(new SliderBinder(q,this._linetool.properties().backgroundTransparency,!0,this.model(),"Change Text Background Transparency"));this.bindControl(new BooleanBinder(l,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill"));this.bindControl(new ColorBinding(e,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color"));
e=this.addLabeledRow(a,"Background",l);$("<td>").append(l).prependTo(e);$("<td>").append(n).appendTo(e);$('<td colspan="2">').append(q).appendTo(e);n=this.addLabeledRow(a,"Label");$("<td>").prependTo(n);$("<td>").append(d).appendTo(n);$("<td>").append(g).appendTo(n);$("<td>").append(f).appendTo(n);e=this.addLabeledRow(a,"Label Background",m);$("<td>").append(m).prependTo(e);$("<td>").append(h).appendTo(e);$('<td colspan="2">').append(k).appendTo(e);this.bindControl(new ColorBinding(c,this._linetool.properties().linecolor,
!0,this.model(),"Change Date Range Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Date Range Line Width"));this.loadData()};LineToolDateRangeStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolProjectionStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolProjectionStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolProjectionStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=this.createColorPicker(),b=this.createColorPicker(),c=TradingView.createTransparencyEditor(a),d=this.addLabeledRow(this._table,"Background");$("<td>").append(a).appendTo(d);$("<td>").append(b).appendTo(d);$("<td>").append(c).appendTo(d);var e=TradingView.createLineWidthEditor(),
f=this.createColorPicker(),d=this.addLabeledRow(this._table,"Border");$("<td>").append(f).appendTo(d);$("<td>").appendTo(d);$("<td>").append(e).appendTo(d);this.bindControl(new ColorBinding(f,this._linetool.properties().trendline.color,!0,this.model(),"Change Projection Line Color"));this.bindControl(new ColorBinding(a,this._linetool.properties().color1,!0,this.model(),"Change Projection Background Color"));this.bindControl(new ColorBinding(b,this._linetool.properties().color2,!0,this.model(),"Change Projection Background Color"));
this.bindControl(new SliderBinder(e,this._linetool.properties().linewidth,!0,this.model(),"Change Projection Border Width"));this.bindControl(new SliderBinder(c,this._linetool.properties().transparency,!0,this.model(),"Change Projection Background Transparency"));this.loadData()};LineToolProjectionStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolLineTool5PointsPatternStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolLineTool5PointsPatternStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolLineTool5PointsPatternStylesPropertyPage.prototype.prepareLayout=function(){function a(){q.slider("option","disabled",!l.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.createColorPicker(),e=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),
g=this.createFontSizeEditor(),h=this.createFontEditor(),k=this.addLabeledRow(this._table,"Border");k.prepend("<td>");$("<td>").append(c).appendTo(k);$("<td>").append(b).appendTo(k);var m=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),q=TradingView.createTransparencyEditor(n),h=this.createFontEditor(),k=this.addLabeledRow(this._table,"Background",m);$("<td>").append(m).prependTo(k);$("<td>").append(n).appendTo(k);$("<td>").append(q).appendTo(k);var l=this._linetool.properties().fillBackground;
a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(m,this._linetool.properties().fillBackground,!0,this.model(),"Change Pattern Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color"));this.bindControl(new ColorBinding(d,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color"));this.bindControl(new ColorBinding(n,this._linetool.properties().backgroundColor,
!0,this.model(),"Change Pattern Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width"));this.bindControl(new SliderBinder(q,this._linetool.properties().transparency,!0,this.model(),"Change Pattern Background Transparency"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(h,this._linetool.properties().font,
null,!0,this.model(),"Change Text Font"));this.bindControl(new BooleanBinder(e,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));b=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(h)).append($(document.createElement("td")).attr({width:1}).append(g)).append($(document.createElement("td")).css("vertical-align",
"top").attr({width:1}).append(e)).append($(document.createElement("td")).css("vertical-align","top").append(f)).append($("</tr></table>"));k=this.addLabeledRow(this._table,"");$('<td colspan="5">').append(b).appendTo(k);this.loadData()};LineToolLineTool5PointsPatternStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolABCDPatternStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolABCDPatternStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolABCDPatternStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=TradingView.createLineWidthEditor(),b=this.createColorPicker(),c=this.createColorPicker(),d=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),e=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),
f=this.createFontSizeEditor(),g=this.createFontEditor(),g=this.addLabeledRow(this._table,"Border");g.prepend("<td>");$("<td>").append(b).appendTo(g);$("<td>").append(a).appendTo(g);g=this.createFontEditor();this.bindControl(new ColorBinding(b,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color"));this.bindControl(new ColorBinding(c,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color"));this.bindControl(new SliderBinder(a,this._linetool.properties().linewidth,
!0,this.model(),"Change Pattern Border Width"));this.bindControl(new SimpleComboBinder(f,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new BooleanBinder(d,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(e,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));
a=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(c)).append($(document.createElement("td")).attr({width:1}).append(g)).append($(document.createElement("td")).attr({width:1}).append(f)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(d)).append($(document.createElement("td")).css("vertical-align","top").append(e)).append($("</tr></table>"));g=this.addLabeledRow(this._table,
"");$('<td colspan="5">').append(a).appendTo(g);this.loadData()};LineToolABCDPatternStylesPropertyPage.prototype.widget=function(){return this._table};function StudyLineDataSourcePropertyPage(a,b,c){PropertyPage.call(this,a,b);this._linetool=c;this.prepareLayout()}inherit(StudyLineDataSourcePropertyPage,LineToolInputsPropertyPage);
StudyLineDataSourcePropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="0">'),b=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({"layout-tab":EditObjectDialog.TAB_NAME_INPUTS,"layout-tab-priority":EditObjectDialog.TAB_PRIORITY_INPUTS});this._table=a.add(b);for(var c=this._linetool.points(),d=0;d<c.size();d++){c.item(d);var e=$("<tr>");e.appendTo(a);var f=$("<td>");f.html("Point "+(d+1)+" Bar #");f.appendTo(e);barEditCell=
$("<td>");barEditCell.appendTo(e);e=$("<input type='text'>");e.appendTo(barEditCell);e.addClass("ticker");var f=this._linetool.properties().points[d],g=[ToIntTransformer(f.bar.value()),GreateTransformer(-5E3),LessTransformer(15E3)];this.bindControl(new SimpleStringBinder(e,f.bar,g,!1,this.model(),"Change "+this._linetool+" point bar index"))}a=StudyMetaInfo.findStudyMetaInfo(this._model.studiesMetaData(),this._linetool.studyId());StudyInputsPropertyPage.prototype.prepareLayoutImpl.call(this,a,b)};
StudyLineDataSourcePropertyPage.prototype.widget=function(){return this._table};function StudyOverlayStylesPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._study=c;this.prepareLayout()}inherit(StudyOverlayStylesPropertyPage,PropertyPage);inherit(StudyOverlayStylesPropertyPage,SeriesStylePropertyPageMixin);
StudyOverlayStylesPropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b=$('<table class="property-page" cellspacing="0" cellpadding="2">'),c=$('<table class="property-page" cellspacing="0" cellpadding="2">'),d=$('<table class="property-page" cellspacing="0" cellpadding="2">'),e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),f=this._study.properties();this._prepareSeriesStyleLayout(a,b,c,f);this._table=a.add(b).add(c).add(d).add(e);
a=$('<input type="checkbox">');d=this.addLabeledRow(d,"Price Line",a);$("<td>").append(a).prependTo(d);this.bindControl(new BooleanBinder(a,f.showPriceLine,!0,this.model(),"Change Price Price Line"));d=this.createSeriesMinTickEditor();a=$("<tr>");a.appendTo(e);$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(a);$("<td>").append(d).appendTo(a);this.bindControl(new SimpleComboBinder(d,f.minTick,null,!0,this.model(),"Change MinTick"))};
StudyOverlayStylesPropertyPage.prototype.loadData=function(){this.superclass.prototype.loadData.call(this);this.switchStyle()};
StudyOverlayStylesPropertyPage.prototype.switchStyle=function(){$(this._barsTbody).add(this._barsColorerTbody).add(this._candlesTbody).add(this._candlesColorerTbody).add(this._hollowCandlesTbody).add(this._lineTbody).add(this._areaTbody).css("display","none");switch(this._study.properties().style.value()){case TradingView.Series.STYLE_BARS:this._barsTbody.css("display","table-row-group");this._barsColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_CANDLES:this._candlesTbody.css("display",
"table-row-group");this._candlesColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_HOLLOW_CANDLES:this._hollowCandlesTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_LINE:this._lineTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_AREA:this._areaTbody.css("display","table-row-group")}};StudyOverlayStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolElliottStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolElliottStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolElliottStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=[],a=6===this._linetool.pointsCount()?"Subminuette Minuette Minute Minor Intermediate Primary Cycle SuperCycle GrandSuperCycle".split(" ").map(function(a){return $.t(a)}):["Minor","Major"].map(function(a){return $.t(a)});waveTypeEditor=this.createKeyCombo(a);waveTypeEditor.width(300);this.createFontEditor();a=this.createFontSizeEditor();$('<span class="property-page-small-select">').append(a);
var a=this.createColorPicker(),b=$('<input type="checkbox" class="visibility-switch">'),c=$('<input type="checkbox" class="visibility-switch">'),d=this.addLabeledRow(this._table,"Wave Size");$("<td>").prependTo(d);$("<td>").append(waveTypeEditor).appendTo(d);d=this.addLabeledRow(this._table,"Color");$("<td>").prependTo(d);$("<td>").append(a).appendTo(d);d=this.addLabeledRow(this._table,"Show Wave",c);$("<td>").append(c).prependTo(d);d=this.addLabeledRow(this._table,"Show Background",b);$("<td>").append(b).prependTo(d);
this.bindControl(new BooleanBinder(b,this._linetool.properties().showBackground,!0,this.model(),"Change Elliott Labels Background"));this.bindControl(new ColorBinding(a,this._linetool.properties().color,!0,this.model(),"Change Elliott Label Color"));this.bindControl(new SimpleComboBinder(waveTypeEditor,this._linetool.properties().wavesize,parseInt,!0,this.model(),"Change Elliott Wave Size"));this.bindControl(new BooleanBinder(c,this._linetool.properties().showWave,!0,this.model(),"Change Elliott Labels Background"));
this.loadData()};LineToolElliottStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolRiskRewardInputsPropertyPage(a,b,c){LineToolInputsPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolRiskRewardInputsPropertyPage,LineToolInputsPropertyPage);
LineToolRiskRewardInputsPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=this.addLabeledRow(a,"Stop Level. Ticks:"),c=$("<input type='text'>");$("<td>").append(c).appendTo(b);c.addClass("ticker");var d=$("<input type='text'>");$("<td>"+$.t("Price:")+"</td>").appendTo(b);$("<td>").append(d).appendTo(b);var e=this.addLabeledRow(a,"Entry price:"),f=$("<input type='text'>");$('<td colspan="2">').append(f).appendTo(e);
var g=this.addLabeledRow(a,"Profit Level. Ticks:"),e=$("<input type='text'>");$("<td>").append(e).appendTo(g);e.addClass("ticker");var h=$("<input type='text'>");$("<td>"+$.t("Price:")+"</td>").appendTo(g);$("<td>").append(h).appendTo(g);"LineToolRiskRewardLong"==this._linetool.getConstructor()&&(b.detach().appendTo(a),g.detach().prependTo(a));a=[ToIntTransformer(this._linetool.properties().stopLevel.value()),GreateTransformer(0),LessTransformer(1E9)];this.bindControl(new SimpleStringBinder(c,this._linetool.properties().stopLevel,
a,!1,this.model(),"Change "+this._linetool+" stop level"));a=[ToIntTransformer(this._linetool.properties().profitLevel.value()),GreateTransformer(0),LessTransformer(1E9)];this.bindControl(new SimpleStringBinder(e,this._linetool.properties().profitLevel,a,!1,this.model(),"Change "+this._linetool+" profit level"));a=[ToFloatTransformer(this._linetool.properties().entryPrice.value())];this.bindControl(new SimpleStringBinder(f,this._linetool.properties().entryPrice,a,!1,this.model(),"Change "+this._linetool+
" entry price"));var k=this,a=[ToFloatTransformer(this._linetool.properties().stopPrice.value()),function(a){return k._linetool.preparseStopPrice(a)}];this.bindControl(new SimpleStringBinder(d,this._linetool.properties().stopPrice,a,!1,this.model(),"Change "+this._linetool+" stop price"));a=[ToFloatTransformer(this._linetool.properties().targetPrice.value()),function(a){return k._linetool.preparseProfitPrice(a)}];this.bindControl(new SimpleStringBinder(h,this._linetool.properties().targetPrice,a,
!1,this.model(),"Change "+this._linetool+" stop price"))};LineToolRiskRewardInputsPropertyPage.prototype.widget=function(){return this._table};function LineToolRiskRewardStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolRiskRewardStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolRiskRewardStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.addLabeledRow(a,"Lines");$("<td>").append(c).appendTo(d);$("<td>").append(b).appendTo(d);var d=this.addLabeledRow(a,"Stop Color:"),e=this.createColorPicker();$("<td>").append(e).appendTo(d);var f=TradingView.createTransparencyEditor(e);$('<td colspan="2">').append(f).appendTo(d);
var d=this.addLabeledRow(a,"Target Color:"),g=this.createColorPicker();$("<td>").append(g).appendTo(d);var h=TradingView.createTransparencyEditor(g);$('<td colspan="2">').append(h).appendTo(d);var d=this.addLabeledRow(a,"Text:"),a=this.createColorPicker(),k=this.createFontSizeEditor(),m=this.createFontEditor();$("<td>").append(a).appendTo(d);$("<td>").append(m).appendTo(d);$("<td>").append(k).appendTo(d);this.bindControl(new ColorBinding(c,this._linetool.properties().linecolor,!0,this.model(),"Change Risk/Reward line Color"));
this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Risk/Reward line width"));this.bindControl(new ColorBinding(e,this._linetool.properties().stopBackground,!0,this.model(),"Change stop color"));this.bindControl(new SliderBinder(f,this._linetool.properties().stopBackgroundTransparency,!0,this.model(),"Change Stop Background Transparency"));this.bindControl(new ColorBinding(g,this._linetool.properties().profitBackground,!0,this.model(),"Change target color"));
this.bindControl(new SliderBinder(h,this._linetool.properties().profitBackgroundTransparency,!0,this.model(),"Change Profit Background Transparency"));this.bindControl(new SimpleComboBinder(k,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(m,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(a,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color"));
this.loadData()};LineToolRiskRewardStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolTrianglePatternStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolTrianglePatternStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolTrianglePatternStylesPropertyPage.prototype.prepareLayout=function(){function a(){q.slider("option","disabled",!l.value())}this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var b=TradingView.createLineWidthEditor(),c=this.createColorPicker(),d=this.createColorPicker(),e=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),
g=this.createFontSizeEditor(),h=this.createFontEditor(),k=this.addLabeledRow(this._table,"Border");k.prepend("<td>");$("<td>").append(c).appendTo(k);$("<td>").append(b).appendTo(k);var m=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),q=TradingView.createTransparencyEditor(n),h=this.createFontEditor(),k=this.addLabeledRow(this._table,"Background",m);$("<td>").append(m).prependTo(k);$("<td>").append(n).appendTo(k);$("<td>").append(q).appendTo(k);var l=this._linetool.properties().fillBackground;
a();this._linetool.properties().fillBackground.subscribe(null,a);this.bindControl(new BooleanBinder(m,this._linetool.properties().fillBackground,!0,this.model(),"Change Pattern Filling"));this.bindControl(new ColorBinding(c,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color"));this.bindControl(new ColorBinding(d,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color"));this.bindControl(new ColorBinding(n,this._linetool.properties().backgroundColor,
!0,this.model(),"Change Pattern Background Color"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width"));this.bindControl(new SliderBinder(q,this._linetool.properties().transparency,!0,this.model(),"Change Pattern Background Transparency"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(h,this._linetool.properties().font,
null,!0,this.model(),"Change Text Font"));this.bindControl(new BooleanBinder(e,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));b=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(h)).append($(document.createElement("td")).attr({width:1}).append(g)).append($(document.createElement("td")).css("vertical-align",
"top").attr({width:1}).append(e)).append($(document.createElement("td")).css("vertical-align","top").append(f)).append($("</tr></table>"));k=this.addLabeledRow(this._table,"");$('<td colspan="5">').append(b).appendTo(k);this.loadData()};LineToolTrianglePatternStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolDisjointAngleStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolDisjointAngleStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolDisjointAngleStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),d=this.createColorPicker(),e=this.addLabeledRow(a,"Line");$("<td>").append(d).appendTo(e);$("<td>").append(b).appendTo(e);$('<td colspan="3">').append(c.render()).appendTo(e);var e=this.addLabeledRow(a,"Text:"),a=this.createColorPicker(),
f=this.createFontSizeEditor(),g=this.createFontEditor(),h=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),k=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(a).appendTo(e);$("<td>").append(g).appendTo(e);$("<td>").append(f).appendTo(e);$("<td>").append(h).appendTo(e);$("<td>").append(k).appendTo(e);var e=$("<tbody>").appendTo(this._table),m=$('<input type="checkbox" class="visibility-switch">'),
n=this.createColorPicker(),q=TradingView.createTransparencyEditor(n),e=this.addLabeledRow(e,"Background",m),l=$("<table>");$('<td colspan="5">').append(l).appendTo(e);e=$("<tr>").appendTo(l);$("<td>").append(m).appendTo(e);$("<td>").append(n).appendTo(e);$("<td>").append(q).appendTo(e);var s=$("<tbody>").appendTo(this._table),u=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),l=$('<input type="checkbox">').appendTo(u),z=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),
t=$('<input type="checkbox">').appendTo(z),B=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),A=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),e=this.addLabeledRow(s,"Left End");$('<td colspan="3">').appendTo(e).append(B).append(u);e=this.addLabeledRow(s,"Right End");$('<td colspan="3">').appendTo(e).append(A).append(z);var w=$("<tbody>").appendTo(this._table),e=$("<tr>").appendTo(w),
s=$("<input type='checkbox'>"),u=$("<label style='display:block'>").append(s).append($.t("Show Prices"));$("<td colspan='2'>").append(u).appendTo(e);e=$("<tr>").appendTo(w);z=$("<input type='checkbox'>");u=$("<label style='display:block'>").append(z).append($.t("Show Price Range"));$("<td colspan='2'>").append(u).appendTo(e);var e=$("<tr>").appendTo(w),v=$("<input type='checkbox'>"),u=$("<label style='display:block'>").append(v).append($.t("Show Bars Range"));$("<td colspan='2'>").append(u).appendTo(e);
e=$("<tr>").appendTo(w);w=$("<input type='checkbox'>");u=$("<label style='display:block'>").append(w).append($.t("Show Date/Time Range"));$("<td colspan='2'>").append(u).appendTo(e);this.bindControl(new SimpleComboBinder(f,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(a,this._linetool.properties().textcolor,
!0,this.model(),"Change Text Color"));this.bindControl(new BooleanBinder(h,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(k,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));this.bindControl(new BooleanBinder(s,this._linetool.properties().showPrices,!0,this.model(),"Change Disjoint Angle Show Prices"));this.bindControl(new BooleanBinder(z,this._linetool.properties().showPriceRange,!0,this.model(),"Change Disjoint Angle Show Price Range"));
this.bindControl(new BooleanBinder(w,this._linetool.properties().showDateTimeRange,!0,this.model(),"Change Disjoint Angle Show Date Range"));this.bindControl(new BooleanBinder(v,this._linetool.properties().showBarsRange,!0,this.model(),"Change Disjoint Angle Show Bars Range"));this.bindControl(new BooleanBinder(l,this._linetool.properties().extendLeft,!0,this.model(),"Change Disjoint Angle Extending Left"));this.bindControl(new BooleanBinder(t,this._linetool.properties().extendRight,!0,this.model(),
"Change Disjoint Angle Extending Right"));this.bindControl(new ColorBinding(d,this._linetool.properties().linecolor,!0,this.model(),"Change Disjoint Angle Color"));this.bindControl(new SimpleComboBinder(c,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Disjoint Angle Style"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Disjoint Angle Width"));this.bindControl(new SimpleComboBinder(B,this._linetool.properties().leftEnd,parseInt,
!0,this.model(),"Change Disjoint Angle Left End"));this.bindControl(new SimpleComboBinder(A,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Disjoint Angle Right End"));this.bindControl(new BooleanBinder(m,this._linetool.properties().fillBackground,!0,this.model(),"Change Disjoint Angle Filling"));this.bindControl(new ColorBinding(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Disjoint Angle Background Color"));this.bindControl(new SliderBinder(q,this._linetool.properties().transparency,
!0,this.model(),"Change Disjoint Angle Background Transparency"));this.loadData()};LineToolDisjointAngleStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolFlatBottomStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolFlatBottomStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolFlatBottomStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),d=this.createColorPicker(),e=this.addLabeledRow(a,"Line");$("<td>").append(d).appendTo(e);$("<td>").append(b).appendTo(e);$('<td colspan="3">').append(c.render()).appendTo(e);var e=this.addLabeledRow(a,"Text:"),a=this.createColorPicker(),
f=this.createFontSizeEditor(),g=this.createFontEditor(),h=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),k=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(a).appendTo(e);$("<td>").append(g).appendTo(e);$("<td>").append(f).appendTo(e);$("<td>").append(h).appendTo(e);$("<td>").append(k).appendTo(e);var e=$("<tbody>").appendTo(this._table),m=$('<input type="checkbox" class="visibility-switch">'),
n=this.createColorPicker(),q=TradingView.createTransparencyEditor(n),e=this.addLabeledRow(e,"Background",m),l=$("<table>");$('<td colspan="5">').append(l).appendTo(e);e=$("<tr>").appendTo(l);$("<td>").append(m).appendTo(e);$("<td>").append(n).appendTo(e);$("<td>").append(q).appendTo(e);var s=$("<tbody>").appendTo(this._table),u=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),l=$('<input type="checkbox">').appendTo(u),z=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),
t=$('<input type="checkbox">').appendTo(z),B=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),A=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),e=this.addLabeledRow(s,"Left End");$('<td colspan="3">').appendTo(e).append(B).append(u);e=this.addLabeledRow(s,"Right End");$('<td colspan="3">').appendTo(e).append(A).append(z);var w=$("<tbody>").appendTo(this._table),e=$("<tr>").appendTo(w),
s=$("<input type='checkbox'>"),u=$("<label style='display:block'>").append(s).append($.t("Show Prices"));$("<td colspan='2'>").append(u).appendTo(e);e=$("<tr>").appendTo(w);z=$("<input type='checkbox'>");u=$("<label style='display:block'>").append(z).append($.t("Show Price Range"));$("<td colspan='2'>").append(u).appendTo(e);var e=$("<tr>").appendTo(w),v=$("<input type='checkbox'>"),u=$("<label style='display:block'>").append(v).append($.t("Show Bars Range"));$("<td colspan='2'>").append(u).appendTo(e);
e=$("<tr>").appendTo(w);w=$("<input type='checkbox'>");u=$("<label style='display:block'>").append(w).append($.t("Show Date/Time Range"));$("<td colspan='2'>").append(u).appendTo(e);this.bindControl(new SimpleComboBinder(f,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(a,this._linetool.properties().textcolor,
!0,this.model(),"Change Text Color"));this.bindControl(new BooleanBinder(h,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(k,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));this.bindControl(new BooleanBinder(s,this._linetool.properties().showPrices,!0,this.model(),"Change Disjoint Angle Show Prices"));this.bindControl(new BooleanBinder(z,this._linetool.properties().showPriceRange,!0,this.model(),"Change Disjoint Angle Show Price Range"));
this.bindControl(new BooleanBinder(w,this._linetool.properties().showDateTimeRange,!0,this.model(),"Change Disjoint Angle Show Date Range"));this.bindControl(new BooleanBinder(v,this._linetool.properties().showBarsRange,!0,this.model(),"Change Disjoint Angle Show Bars Range"));this.bindControl(new BooleanBinder(l,this._linetool.properties().extendLeft,!0,this.model(),"Change Disjoint Angle Extending Left"));this.bindControl(new BooleanBinder(t,this._linetool.properties().extendRight,!0,this.model(),
"Change Disjoint Angle Extending Right"));this.bindControl(new ColorBinding(d,this._linetool.properties().linecolor,!0,this.model(),"Change Disjoint Angle Color"));this.bindControl(new SimpleComboBinder(c,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Disjoint Angle Style"));this.bindControl(new SliderBinder(b,this._linetool.properties().linewidth,!0,this.model(),"Change Disjoint Angle Width"));this.bindControl(new SimpleComboBinder(B,this._linetool.properties().leftEnd,parseInt,
!0,this.model(),"Change Disjoint Angle Left End"));this.bindControl(new SimpleComboBinder(A,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Disjoint Angle Right End"));this.bindControl(new BooleanBinder(m,this._linetool.properties().fillBackground,!0,this.model(),"Change Disjoint Angle Filling"));this.bindControl(new ColorBinding(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Disjoint Angle Background Color"));this.bindControl(new SliderBinder(q,this._linetool.properties().transparency,
!0,this.model(),"Change Disjoint Angle Background Transparency"));this.loadData()};LineToolFlatBottomStylesPropertyPage.prototype.widget=function(){return this._table};function LineToolIconStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolIconStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolIconStylesPropertyPage.prototype.prepareLayout=function(){this._table=$(document.createElement("table"));this._table.addClass("property-page");this._table.attr("cellspacing","0");this._table.attr("cellpadding","2");var a=this.createColorPicker(),b=this.addLabeledRow(this._table,"Color:");$("<td>").append(a).appendTo(b);b=this._linetool.properties();this._div=$("<div>").append(this._table);this.bindControl(new ColorBinding(a,b.color,!0,this.model(),"Change Icon Color"));this.loadData()};
LineToolIconStylesPropertyPage.prototype.widget=function(){return this._div};function LineToolTrendAngleStylesPropertyPage(a,b,c){TemplatesLineToolPropertyPage.call(this,a,b,c);this.prepareLayout()}inherit(LineToolTrendAngleStylesPropertyPage,TemplatesLineToolPropertyPage);
LineToolTrendAngleStylesPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=$("<tbody>").appendTo(this._table),b=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),d=this.createColorPicker(),a=this.addLabeledRow(a,"Line");$("<td>").append(d).appendTo(a);$("<td>").append(b).appendTo(a);$('<td colspan="3">').append(c.render()).appendTo(a);var e=$("<tbody>").appendTo(this._table),a=this.addLabeledRow(e,
"Text:"),f=this.createColorPicker(),g=this.createFontSizeEditor(),h=this.createFontEditor(),k=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),m=$('<span class="tv-button tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(f).appendTo(a);$("<td>").append(h).appendTo(a);$("<td>").append(g).appendTo(a);$("<td>").append(k).appendTo(a);$("<td>").append(m).appendTo(a);var n=$('<input type="checkbox">'),q=$('<input type="checkbox">'),
a=this.addLabeledRow(e,"Extend Right End");$('<td colspan="3">').appendTo(a).append(n);a=this.addLabeledRow(e,"Extend Left End");$('<td colspan="3">').appendTo(a).append(q);var l=$('<input type="checkbox">'),s=$('<input type="checkbox">'),a=this.addLabeledRow(e,"Show Price Range");$('<td colspan="3">').appendTo(a).append(l);a=this.addLabeledRow(e,"Show Bars Range");$('<td colspan="3">').appendTo(a).append(s);this.bindControl(new BooleanBinder(l,this._linetool.properties().showPriceRange,!0,this.model(),
"Change Trend Line Show Price Range"));this.bindControl(new BooleanBinder(s,this._linetool.properties().showBarsRange,!0,this.model(),"Change Trend Line Show Bars Range"));this.bindControl(new SimpleComboBinder(g,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size"));this.bindControl(new SimpleComboBinder(h,this._linetool.properties().font,null,!0,this.model(),"Change Text Font"));this.bindControl(new ColorBinding(f,this._linetool.properties().textcolor,!0,this.model(),
"Change Text Color"));this.bindControl(new BooleanBinder(k,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold"));this.bindControl(new BooleanBinder(m,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));this.bindControl(new ColorBinding(d,this._linetool.properties().linecolor,!0,this.model(),"Change Trend Line Color"));this.bindControl(new SimpleComboBinder(c,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Trend Line Style"));this.bindControl(new SliderBinder(b,
this._linetool.properties().linewidth,!0,this.model(),"Change Trend Line Width"));this.bindControl(new BooleanBinder(n,this._linetool.properties().extendRight,!0,this.model(),"Change Trend Angle Extending Right"));this.bindControl(new BooleanBinder(q,this._linetool.properties().extendLeft,!0,this.model(),"Change Trend Angle Extending Left"));this.loadData()};LineToolTrendAngleStylesPropertyPage.prototype.widget=function(){return this._table};
function LineToolTrendAngleInputsPropertyPage(a,b,c){LineToolInputsPropertyPage.call(this,a,b,c)}inherit(LineToolTrendAngleInputsPropertyPage,LineToolInputsPropertyPage);
LineToolTrendAngleInputsPropertyPage.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var a=this._linetool.points().item(0),b=this._linetool.properties().points[0];if(a&&b){var c=this._createPointRow(a,b,"");this._table.append(c);c=$("<tr>").appendTo(this._table);$("<td>").append($.t("Angle:")).appendTo(c);a=$("<input type='text'>");$("<td>").append(a).appendTo(c);b=[ToFloatTransformer(b.price.value()),GreateTransformer(-360),LessTransformer(360)];
this.bindControl(new SimpleStringBinder(a,this._linetool.properties().angle,b,!1,this.model(),"Change angle"));this.loadData()}};LineToolTrendAngleInputsPropertyPage.prototype.widget=function(){return this._table};function StudyLinearRegressionStylesPropertyPage(a,b,c){PropertyPage.call(this,a,b);this._study=c;this.prepareLayout()}inherit(StudyLinearRegressionStylesPropertyPage,PropertyPage);
StudyLinearRegressionStylesPropertyPage.prototype.prepareLayout=function(){var a=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=a.add(b);for(var c=this._study.properties(),d=[["Base",c.styles.baseLine],["Up",c.styles.upLine],["Down",c.styles.downLine]],e,f=0;f<d.length;f++){var g=d[f],h=$("<input type='checkbox' class='visibility-switch'/>"),k=this.createColorPicker(),m=TradingView.createLineWidthEditor(),
n=TradingView.createLineStyleEditor(),q=this.addLabeledRow(a,g[0],h);f||(e=k);$("<td>").append(h).prependTo(q);$("<td>").append(k).appendTo(q);$("<td>").append(m).appendTo(q);$("<td>").append(n.render()).appendTo(q);q="Change "+g[0];this.bindControl(new BooleanBinder(h,g[1].visible,!0,this.model(),q));this.bindControl(new ColorBinding(k,g[1].color,!0,this.model(),q));this.bindControl(new SliderBinder(m,g[1].linewidth,!0,this.model(),q));this.bindControl(new SimpleComboBinder(n,g[1].linestyle,parseInt,
!0,this.model(),q))}a=$("<input type='checkbox' class='visibility-switch'/>");d=$("<input type='checkbox'/>");q=$("<tr>").appendTo(b);$("<td>").append(a).appendTo(q);this.createLabeledCell("Pearson's R",a).appendTo(q);q=$("<tr>").appendTo(b);$("<td>").append(d).appendTo(q);this.createLabeledCell("Extend Lines",d).appendTo(q);q=$("<tr>").appendTo(b);$("<td>").appendTo(q);$("<td>Background</td>").appendTo(q);b=TradingView.createTransparencyEditor(e);$("<td>").append(b).appendTo(q);this.bindControl(new BooleanBinder(a,
c.styles.showPearsons,!0,this.model(),"Change show Pearson's R"));this.bindControl(new BooleanBinder(d,c.styles.extendLines,!0,this.model(),"Change Extend Lines"));this.bindControl(new SliderBinder(b,c.styles.transparency,!0,this.model(),"Change Background Transparency"))};StudyLinearRegressionStylesPropertyPage.prototype.widget=function(){return this._table};function VolumePropertyPage(a,b,c){PropertyPage.call(this,a,b);this._study=c;this.prepareLayout()}inherit(VolumePropertyPage,PropertyPage);
VolumePropertyPage.prototype.prepareLayout=function(){var a=this._study.properties();this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var b=this.addLabeledRow(this._table,"Volume"),c=TradingView.createPlotEditor();$("<td>").append(c).appendTo(b);this.bindControl(new SimpleComboBinder(c,a.styles.vol.plottype,parseInt,!0,this.model(),"Change Volume Plot Style"));c=this.createColorPicker();$("<td>").append(c).appendTo(b);this.bindControl(new ColorBinding(c,a.palettes.volumePalette.colors[0].color,
!0,this.model(),"Change Up Volume color"));c=this.createColorPicker();$("<td>").append(c).appendTo(b);this.bindControl(new ColorBinding(c,a.palettes.volumePalette.colors[1].color,!0,this.model(),"Change Down Volume color"));c=TradingView.createTransparencyEditor();$("<td>").append(c).appendTo(b);this.bindControl(new SliderBinder(c,a.transparency,!0,this.model(),"Change Volume Transparency"));c=$("<input type='checkbox'>");$("<td>").appendTo(b);$("<td>").append(c).appendTo(b);$("<td>"+$.t("Price Line")+
"</td>").appendTo(b);this.bindControl(new BooleanBinder(c,a.styles.vol.trackPrice,!0,this.model(),"Change Price Line"));a=a.styles.vol_ma;b=this.addLabeledRow(this._table,"Volume MA");c=TradingView.createPlotEditor();$("<td>").append(c).appendTo(b);this.bindControl(new SimpleComboBinder(c,a.plottype,parseInt,!0,this.model(),"Change Volume MA Plot Style"));$("<td>").html("&nbsp;").appendTo(b);c=this.createColorPicker();$("<td>").append(c).appendTo(b);this.bindControl(new ColorBinding(c,a.color,!0,
this.model(),"Change Volume MA color"));c=TradingView.createTransparencyEditor(c);$("<td>").append(c).appendTo(b);this.bindControl(new SliderBinder(c,a.transparency,!0,this.model(),"Change Volume MA Transparency"));c=TradingView.createLineWidthEditor();$("<td>").append(c).appendTo(b);this.bindControl(new SliderBinder(c,a.linewidth,!0,this.model(),"Change Volume MA Line Width"));c=$("<input type='checkbox'>");$("<td>").append(c).appendTo(b);$("<td>"+$.t("Price Line")+"</td>").appendTo(b);this.bindControl(new BooleanBinder(c,
a.trackPrice,!0,this.model(),"Change Price Line"))};VolumePropertyPage.prototype.widget=function(){return this._table};TradingView.BaseWidget=function(a){this._$container=$(a);this._$header=this._$container.parent().find(".header").eq(0)};TradingView.BaseWidget.prototype.setSelectableHeader=function(a){var b=this._$container.parent().find(".header");b.addClass("selectable").append($("<span>").addClass("dropdown"));this._title=b.find(".title");b=b.find(".title, .dropdown");b.on("click",a);TradingView.bindPopupMenu(b,null,{event:"show-popup",addClass:"narrow",careBottomBorder:!0})};
TradingView.BaseWidget.prototype.updateTitleFull=function(a,b){this._notification_count||(this._notification_count=0);b&&(this._notification_count+=b);0<=this._notification_count||(this._notification_count=0);var c=this._$container.parent().find(".header .title");c.text(a);this._notification_count&&c.prepend($("<span>").addClass("ch-new-counter").text(this._notification_count))};TradingView.BaseWidget.prototype.clearNotifications=function(){this._notification_count=0;this.updateTitle()};
TradingView.BaseWidget.prototype.HIGHLIGHT_NUM_FLICKS=5;TradingView.BaseWidget.prototype.resize=$.noop;TradingView.SidebarWidget=function(a,b,c,d){var e=this;this._options=d||{};this._readonly=!!this._options.readonly;this._container=a;this._chart=b;this._panes=c;this._pane_header_height=34;this._hidden_panes_count=0;this.prepareLayout();setInterval(function(){e.paint()},66)};
TradingView.SidebarWidget.prototype.prepareLayout=function(){var a=this;this._widget=$('<div class="chart-sidebar">').appendTo(this._container);this._widget.toggleClass("hidden",void 0!=this._options.hidden?this._options.hidden:TVSettings.getBool("sidebar.hidden",!1));this._separator=$('<div class="separator"><div class="separator-bar"><div class="separator-icon"></div></div></div>').appendTo(this._widget);this._separator.click(function(){a._widget.toggleClass("hidden");a._readonly||TVSettings.setValue("sidebar.hidden",
a._widget.is(".hidden"));$(window).resize()});this._panes.forEach(function(b,c){void 0===b.ratio&&(b.ratio=TVSettings.getFloat("sidebar.pane."+b.id+".ratio",1));void 0===b.state&&(b.state=TVSettings.getBool("sidebar.pane."+b.id+".state",!0),this._hidden_panes_count+=b.state?0:1);b.$pane=$('<div class="chart-sidebar-pane">').addClass("tv-"+b.id).appendTo(this._widget);b.$header=$('<div class="header"><span class="icon"></span><span class="title">'+b.title+"</span></div>").click(function(){b.state=
!b.state;a._readonly||TVSettings.setValue("sidebar.pane."+b.id+".state",b.state);a._hidden_panes_count+=b.state?-1:1;a.resize()}).appendTo(b.$pane);b.index=c;b.$container=$('<div class="container">').appendTo(b.$pane);b.widgetObject=new b.widget(b.$container,this._chart,b.options);c<this._panes.length-1&&$('<div class="chart-sidebar-vseparator"><div class="handle"></div></div>').on("mousedown touchstart",function(b){var c=$(this),f=c.prevAll(".chart-sidebar-pane:not(.minimized)").first(),g=c.nextAll(".chart-sidebar-pane:not(.minimized)").first();
if(!f.length||!g.length)return!1;a._drag_start=b.pageY||b.originalEvent.pageY||b.originalEvent.touches&&b.originalEvent.touches[0].pageY||0;a._drag_prev_h=f.height();a._drag_next_h=g.height();$(window).on("mousemove.sidebarDrag touchmove.sidebarDrag",function(b){b=(b.pageY||b.originalEvent.pageY||b.originalEvent.touches&&b.originalEvent.touches[0].pageY||0)-a._drag_start;f.height(a._drag_prev_h+b).data("paneObj").widgetObject.resize();g.height(a._drag_next_h-b).data("paneObj").widgetObject.resize()});
$(window).one("mouseup touchend",function(b){$(window).unbind("mousemove.sidebarDrag touchmove.sidebarDrag");var d=c.prevAll(".chart-sidebar-pane:not(.minimized)").first();b=c.nextAll(".chart-sidebar-pane:not(.minimized)").first();var f=(a._widget.height()-a._hidden_panes_count*a._pane_header_height-(a._panes.length-1))/(a._panes.length-a._hidden_panes_count),g=(d.height()+a._pane_header_height)/f,d=d.data("paneObj");d.ratio=g;f=(b.height()+a._pane_header_height)/f;d=b.data("paneObj");d.ratio=f;a.resize()});
b.preventDefault()}).appendTo(this._widget);b.$pane.data("paneObj",b)},this);$(window).resize(function(){a.resize()});this.resize()};TradingView.SidebarWidget.prototype.normalizeRatios=function(){var a=this,b=this._panes.length-this._hidden_panes_count,c=0,d=0;this._panes.forEach(function(a){a.state&&(c+=a.ratio)});d=(c-b)/b;this._panes.forEach(function(b){b.state&&(b.ratio-=d,a._readonly||TVSettings.setValue("sidebar.pane."+b.id+".ratio",b.ratio.toFixed(2)))})};
TradingView.SidebarWidget.prototype.resize=function(){this.normalizeRatios();var a=(this._widget.height()-this._hidden_panes_count*this._pane_header_height-(this._panes.length-1))/(this._panes.length-this._hidden_panes_count);this._panes.forEach(function(b,c){b.state?b.$pane.height(a*b.ratio-this._pane_header_height):b.$pane.height(0);b.widgetObject.resize(!0);b.$pane.toggleClass("minimized",!b.state);b.$container.trigger("paneStateChange",[b.state])},this)};
TradingView.SidebarWidget.prototype.getPaneIndexById=function(a){for(var b=0;b<this._panes.length;b++)if(this._panes[b].id===a)return b;return null};TradingView.SidebarWidget.prototype.getPaneById=function(a){a=this.getPaneIndexById(a);return null===a?null:this._panes[a]};TradingView.SidebarWidget.prototype.highlightPane=function(a,b,c){this._panes[a].$header.highlight(b,c)};TradingView.SidebarWidget.prototype.highlightWidget=function(a,b,c){this.highlightPane(this.getPaneIndexById(a),b,c)};
TradingView.SidebarWidget.prototype.paint=function(){this._panes.forEach(function(a,b){a.widgetObject.paint&&a.widgetObject.paint()},this)};TradingView.SidebarWidget.prototype.setPaneState=function(a,b,c){a&&(a.state=!!b,b=c&&c.doNotSave,this._readonly||b||TVSettings.setValue("sidebar.pane."+a.id+".state",a.state),this._hidden_panes_count=this._panes.filter(function(a){return!a.state}).length,this.resize())};
TradingView.SidebarCustomScroll=function(a,b,c){var d=this;this._options=$.extend({},this._defaultOptions,c||{});this._$wrapper=a;this._$content=b;this._scroll_speed=40;this._shadow_offset=10;this._scroll_target_top=this._header_height=this._options.headerHeight;this.scrolled=new Delegate;this.scrolltoend=new Delegate;Modernizr.touch||navigator.msMaxTouchPoints?this._$wrapper.css({"overflow-y":"scroll","-webkit-overflow-scrolling":"touch","-ms-overflow-style":"-ms-autohiding-scrollbar"}).scroll(function(){d.scrolled.fire();
d._$wrapper.scrollTop()>d._$content.height()-d._$wrapper.height()-10&&d.scrolltoend.fire()}):(this._$wrapper.css("overflow","hidden"),this._$wrapper.mouseenter(function(){d._dragging||(d.updateScrollBar(),d._options.alwaysVisible||d._$scrollBar.addClass("active"))}).mouseleave(function(){d._dragging||d._options.alwaysVisible||d._$scrollBar.removeClass("active")}).mousewheel(function(a,b){return d.scroll(b)}),this._$shadowTop=$('<div class="sb-inner-shadow top">').appendTo(this._$wrapper),this._$shadowTop.hide(),
this._$shadowBottom=$('<div class="sb-inner-shadow">').appendTo(this._$wrapper),this._header_height&&this._$shadowTop.css("top",this._header_height-this._shadow_offset),this._$scrollBar=$('<div class="sb-scrollbar'+(this._options.additionalClass?" "+this._options.additionalClass:"")+(this._options.alwaysVisible?" active-always":"")+'"><span class="icon sb-scrollbar-top"></span><span class="sb-scrollbar-body"></span><span class="icon sb-scrollbar-bottom"></span></div>').appendTo(this._$wrapper),this.updateScrollBar())};
TradingView.SidebarCustomScroll.prototype._defaultOptions={headerHeight:0,additionalClass:"",alwaysVisible:!1,showBottomShadow:!0};
TradingView.SidebarCustomScroll.prototype.initDraggable=function(){var a=this,b=this._$wrapper.offset();this._$scrollBar.draggable("destroy").draggable({axis:"y",containment:[0,b.top+this._header_height+1,0,b.top+this._$wrapper.height()-this._$scrollBar.show().height()-1],start:function(){a._dragging=!0},stop:function(){a._dragging=!1},drag:function(b,d){a.updateScroll()}});return this};
TradingView.SidebarCustomScroll.prototype.updateScroll=function(){if(Modernizr.touch||navigator.msMaxTouchPoints)return this;var a=Math.ceil(this._$scrollBar.position().top-1-this._header_height),b=this._$wrapper.height()-this._header_height,c=this._$content.height();if(0>=b)return this;this._scroll_target_top=0>=c-b-1?this._header_height:-a*c/b+this._header_height;this._$content.css("top",this._scroll_target_top+"px");a=0.993>Math.ceil(1E3*((1+a+this._$scrollBar.height())/b))/1E3;this._$shadowTop.toggle(this._scroll_target_top!==
this._header_height);this._$shadowBottom.toggle(c>b&&a&&this._options.showBottomShadow);this.scrolled.fire();c>b&&!a&&this.scrolltoend.fire(!0);return this};
TradingView.SidebarCustomScroll.prototype.updateScrollBar=function(){var a=this._scroll_target_top-this._header_height,b=this._$content.height(),c=this._$wrapper.height()-this._header_height,d=b-c-1,e;0>=d&&(this._scroll_target_top=this._header_height,this._$content.css("top",this._scroll_target_top+"px"));if(Modernizr.touch||navigator.msMaxTouchPoints||0>=c)return this;0>=d?(this._$scrollBar.hide(),this._$wrapper.removeClass("sb-scroll-active")):(e=c*c/b,a=Math.round(Math.min(c-e,-(c-e)*(a/d))+this._header_height),
this._$scrollBar.show().height(Math.floor(e)).css("top",a+1+"px"),this._$wrapper.addClass("sb-scroll-active"),this.initDraggable());d=Math.round(this._scroll_target_top)>-d+this._header_height;this._$shadowTop.toggle(this._scroll_target_top!==this._header_height);this._$shadowBottom.toggle(b>c&&d&&this._options.showBottomShadow);b>c&&!d&&this.scrolltoend.fire();return this};
TradingView.SidebarCustomScroll.prototype.scroll=function(a,b){if(Modernizr.touch||navigator.msMaxTouchPoints)return this;var c=this._$content.position().top,d=this._$content.height(),e=this._$wrapper.height()-this._header_height,d=d-e-1;if(0>=d)return!0;this._scroll_target_top=Math.max(-d+this._header_height,Math.min(this._header_height,c+a*(b||this._scroll_speed)));this._$content.css("top",this._scroll_target_top+"px");this.scrolled.fire();this.updateScrollBar();return!1};
TradingView.SidebarCustomScroll.prototype.animateTo=function(a){if(Modernizr.touch||navigator.msMaxTouchPoints)return this;this._$content.position();var b=this._$content.height(),c=this._$wrapper.height()-this._header_height,b=b-c-1;if(0>=b)return!0;this._scroll_target_top=Math.max(-b+this._header_height,Math.min(this._header_height,-a));this._$content.animate({top:this._scroll_target_top},500,function(){this.scrolled.fire();this.updateScrollBar()}.bind(this))};
TradingView.SidebarCustomScroll.prototype.resize=function(){this.updateScrollBar().updateScroll()};TradingView.SidebarCustomScroll.prototype.resizeHeader=function(a){var b=a-this._header_height;this._header_height=a;this._scroll_target_top+=b;Modernizr.touch||navigator.msMaxTouchPoints||this._$shadowTop.css("top",this._header_height-this._shadow_offset);this.resize()};
TradingView.SidebarCustomScroll.prototype.scrollTo=function(a,b){b=$.extend({position:"visible",areaHeight:a instanceof $?a.height():0},b);a instanceof $&&(a=a.position().top);var c=this._$content.position().top,d=this._$content.height(),e=this._$wrapper.height()-this._header_height;if(0>=d-e-1)return!0;c=-1*(c-this._header_height);e=c+e;d=0;if("visible"==b.position){if(a>c&&a+b.areaHeight<e)return!1;d=a+b.areaHeight>e?e-a-b.areaHeight:c-a}else"top"==b.position&&(d=c-a);this.scroll(d,1);this.updateScrollBar();
return!1};TradingView.ControlBarNavigation=function(a,b,c){this._chart=a;this._parent=b;this.zoom_active=!1;this._real=c;this._state="stop";this.init();c&&this.initToRealChart();this.initHandlers()};
TradingView.ControlBarNavigation.prototype.init=function(){this._widget=$('<div class="control-bar-wrapper">').appendTo(this._parent);$('<div class="control-bar"><span class="move-left-button-control-bar"></span><span class="zoom-out-right-button-control-bar"></span><span class="turn-button-control-bar"></span><span class="zoom-in-button-control-bar"></span><span class="move-right-button-control-bar"></span></div>').appendTo(this._widget);this._buttons={zoomIn:this._widget.find(".zoom-in-button-control-bar"),
zoomOut:this._widget.find(".zoom-out-right-button-control-bar"),moveLeft:this._widget.find(".move-left-button-control-bar"),moveRight:this._widget.find(".move-right-button-control-bar"),turn:this._widget.find(".turn-button-control-bar")}};
TradingView.ControlBarNavigation.prototype.initToRealChart=function(){var a=this;this._back=$('<span class="back-to-present"></span>').appendTo(this._parent).addClass("hidden");this._back.on("click",function(){a._chart.model().timeScale().scrollToRealtime(!0);a._chart.model().model()._invalidateHandler(new TradingView.InvalidateMask(TradingView.InvalidateMask.FULL_UPDATE));a._back.addClass("hidden")});var b=function(){var b=a._chart.maxRhsPriceAxisWidth+4;b&&a._back.css("marginRight",b)};this._chart.rhsPriceAxisWidthChanged.subscribe(this,
b);b();setInterval(function(){a.check()},1E3)};TradingView.ControlBarNavigation.prototype.check=function(){this._chart.model()&&0>this._chart.model().timeScale().rightOffset()?this._back.removeClass("hidden"):this._back.addClass("hidden")};
TradingView.ControlBarNavigation.prototype._move=function(a){"stop"==this._state&&this._chart.model().beginUndoMacro(1==a?"Move Left":"Move Right");this._state="moving";this._deferredFinishTimeout&&(clearTimeout(this._deferredFinishTimeout),this._deferredFinishTimeout=0);this._finishingTimeout&&(clearTimeout(this._finishingTimeout),this._finishingTimeout=0);this._startTime=+new Date;if(!this._movingTimeout){var b=this._startTime;this._movingTimeout=setTimeout(function d(){this._moveStep.call(this,
b,0,50*a,1E3);this._movingTimeout=setTimeout(d.bind(this),10)}.bind(this),10)}};TradingView.ControlBarNavigation.prototype._moveStep=function(a,b,c,d){if(!this._chart.model().timeScale().isEmpty())return a=1-(Math.max(0,a+d-+new Date)/d||0),1>a&&(d=jQuery.easing.easeOutCubic(null,d*a,0,1,d),this.currentDistance=(c-b)*d+b),this._chart.model().scrollChart(this.currentDistance),a};
TradingView.ControlBarNavigation.prototype._finishMove=function(a){clearTimeout(this._movingTimeout);this._deferredFinishTimeout=this._movingTimeout=0;var b=this.currentDistance,c=+new Date;this._finishingTimeout=setTimeout(function e(){1>this._moveStep.call(this,c,b,0,700)?this._finishingTimeout=setTimeout(e.bind(this),10):(this._state="stop",this.currentDistance=this._movingTimeout=0,this._chart.model().endUndoMacro())}.bind(this),10);this._incrementInterval=0};
TradingView.ControlBarNavigation.prototype._stopMove=function(a){"moving"==this._state&&(this._state="wait_finishing",200>(new Date).getTime()-this._startTime?this._deferredFinishTimeout=setTimeout(this._finishMove.bind(this),200-((new Date).getTime()-this._startTime)):this._finishMove())};
TradingView.ControlBarNavigation.prototype.initHandlers=function(){var a=this._chart;$(".control-bar span");var b=Modernizr.touch?"touchstart":"mousedown",c=Modernizr.touch?"touchend":"mouseup mouseout";this._buttons.moveLeft.on(b,this._move.bind(this,1));this._buttons.moveLeft.on(c,this._stopMove.bind(this,1));this._buttons.moveRight.on(b,this._move.bind(this,-1));this._buttons.moveRight.on(c,this._stopMove.bind(this,-1));this._buttons.turn.on("click",function(){a.GUIResetScales()});this._buttons.zoomOut.on("click",
function(){a.model()&&a.model().zoomOut()});this._buttons.zoomIn.on("click",function(){a.model()&&a.model().zoomIn()});a.withModel(this,function(){var b=function(){var b=!a.model().canZoomIn(),c=!a.model().canZoomOut();this.makeBtnDisabled(this._buttons.zoomIn,b);this.makeBtnDisabled(this._buttons.zoomOut,c)};a.model().onSimpleZoomIn().subscribe(this,function(){b.call(this)});a.model().onSimpleZoomOut().subscribe(this,function(){b.call(this)})});var d={};$("body").on("keydown",function(a){if(!($(a.target).closest("input, textarea").length||
a.which in d))switch(d[a.which]=!0,a.which){case 37:this._move.call(this,1);break;case 39:this._move.call(this,-1)}}.bind(this)).on("keyup",function(a){if(!$(a.target).closest("input, textarea").length)switch(delete d[a.which],a.which){case 37:case 39:this._stopMove.call(this)}}.bind(this))};
TradingView.ControlBarNavigation.prototype.makeBtnDisabled=function(a,b){a instanceof $?a.toggleClass("disabled",!!b):"string"===typeof a&&(this._buttons[a]?this._buttons[a].toggleClass("disabled",!!b):console.warn("No btn "+a+" in ControlBarNavigation"))};TradingView.ControlBarNavigation.prototype.resetButtons=function(){if(this._buttons)for(btnName in this._buttons)this._buttons[btnName].removeClass("disabled")};TradingView.SeriesControlWidget=function(){function a(a){var c=this,d=this._chartWidget=a.chartWidget;this._$seriesControls=$(document.createElement("div")).attr("class","chart-controls-bar-buttons chart-series-controls").appendTo(a.parent);this._$percButton=$(document.createElement("a")).text("%").attr("title",$.t("Percentage",{context:"scale_menu"})).addClass("apply-common-tooltip").appendTo(this._$seriesControls);this._$logButton=$(document.createElement("a")).text($.t("log")).attr("title",$.t("Log Scale")).addClass("apply-common-tooltip").appendTo(this._$seriesControls);
this._$fullscreenChartButton=$(document.createElement("a")).attr("title","Maximize Chart").addClass("apply-common-tooltip").appendTo(this._$seriesControls);d.onWidget()||TradingView.isRunningChartingLibrary?this._$extendedHoursButton=null:this._$extendedHoursButton=$(document.createElement("a")).attr("title","Extended Hours").addClass("apply-common-tooltip").appendTo(this._$seriesControls);var e=$(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr({width:14,height:14}).css({"stroke-width":"1px",
fill:"none"});e.get(0).setAttribute("viewBox","0 0 14 14");$(document.createElementNS("http://www.w3.org/2000/svg","desc")).text("EH").appendTo(e);$(document.createElementNS("http://www.w3.org/2000/svg","circle")).attr({cx:7,cy:7,r:6.5}).appendTo(e);$(document.createElementNS("http://www.w3.org/2000/svg","polyline")).attr({points:"6.5 3.5 6.5 7.5 8.5 9.5"}).appendTo(e);this._$extendedHoursButton&&this._$extendedHoursButton.append(e);e=$(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr({width:12,
height:12}).css({fill:"currentColor",stroke:"none",margin:"1px"});e.get(0).setAttribute("viewBox","0 0 24 24");$(document.createElementNS("http://www.w3.org/2000/svg","desc")).text("FS").appendTo(e);$(document.createElementNS("http://www.w3.org/2000/svg","path")).attr({d:"M0 0v9l3.5-3.5 4.5 4.5h2v-2l-4.5-4.5 3.5-3.5h-9zm15 0l3.5 3.5-4.5 4.5v2h2l4.5-4.5 3.5 3.5v-9h-9zm-7 14l-4.5 4.5-3.5-3.5v9h9l-3.5-3.5 4.5-4.5v-2h-2zm6 0v2l4.5 4.5-3.5 3.5h9v-9l-3.5 3.5-4.5-4.5h-2z"}).appendTo(e);this._$fullscreenChartButton.append(e);
this._$percButton.on("click",function(a){a.preventDefault();a=d.model();var b=a.mainSeries(),c=b.priceScale(),e=c.properties();b.properties().lockScale.value()||(a.beginUndoMacro("Percentage"),e.log.value()&&a.setLogProperty(e.log,!1,c,"Log Scale"),a.setPercentProperty(e.percentage,!e.percentage.value(),c,"Percentage"),a.endUndoMacro())});this._$logButton.on("click",function(a){a.preventDefault();a=d.model();var b=a.mainSeries(),c=b.priceScale(),e=c.properties();b.properties().lockScale.value()||
(a.beginUndoMacro("Log Scale"),e.percentage.value()&&a.setPercentProperty(e.percentage,!1,c,"Percentage"),a.setLogProperty(e.log,!e.log.value(),c,"Log Scale"),a.endUndoMacro())});if(this._$extendedHoursButton)this._$extendedHoursButton.on("click",function(a){a.preventDefault();a=d.model();if(1440>a.mainSeries().properties().interval.value()){var b=a.mainSeries().properties().extendedHours;a.setProperty(b,!b.value(),"Extended Hours")}});this._$dateRanges=$(document.createElement("div")).attr("class",
"chart-controls-bar-buttons date-range-wrapper").appendTo(a.parent);d.withModel(null,function(a){a=a.mainSeries();c.updateScaleButtons();a.priceScaleChanged.subscribe(c,c.updateScaleButtons);c.updateDateRangeButtons();a.onStatusChanged().subscribe(c,c.updateDateRangeButtons);TradingView.isRunningChartingLibrary&&a.onSymbolResolved().subscribe(c,c.updateDateRangeButtons);a.properties().lockScale.subscribe(c,c.updateDateRangeButtons);c.updateExtendedHoursButton();a.properties().extendedHours.subscribe(c,
c.updateExtendedHoursButton);a.properties().interval.subscribe(c,c.updateExtendedHoursButton)});c.updateFullscreenChartButton();var f=this._chartWidget._chartWidgetCollection;f&&(f.layout.subscribe(this.updateFullscreenChartButton.bind(this)),f.maximizeCurrentChart.subscribe(this.updateFullscreenChartButton.bind(this)),this._$fullscreenChartButton.on("click",function(){f.activeChartWidget.setValue(d);f.maximizeCurrentChart.setValue(!f.maximizeCurrentChart.value())}))}a.prototype.updateScaleButtons=
function(){var a=this._chartWidget.model().mainSeries().priceScale().properties(),c=a.log.value(),a=a.percentage.value();this._$logButton.toggleClass("active",c);this._$percButton.toggleClass("active",a)};a.prototype.updateDateRangeButtons=function(){var a=this._chartWidget;if(a.model().mainSeries().status()!=TradingView.Series.STATUS_LOADING){var c=a._dateRangeResolutions();if(c.length){this._$dateRanges.empty();for(var d=0;d<c.length;d++){var e=c[d],f=$(document.createElement("a")).text(e.text);
f.appendTo(this._$dateRanges);f.click({val:e.value,res:e.targetResolution},function(c){a.model().loadRange(c.data)})}}}};a.prototype.updateExtendedHoursButton=function(){this._$extendedHoursButton&&(1440>this._chartWidget.model().mainSeries().properties().interval.value()?this._$extendedHoursButton.removeClass("disabled").toggleClass("active",!!this._chartWidget.model().mainSeries().extendedHours.value()).attr("title","Extended Hours"):this._$extendedHoursButton.removeClass("active").addClass("disabled").attr("title",
"Extended Hours are available for intraday only"))};a.prototype.updateFullscreenChartButton=function(){var a=this._chartWidget._chartWidgetCollection;a&&"s"!==a.layout.value()?(this._$fullscreenChartButton.show(),this._$fullscreenChartButton.toggleClass("active",a.maximizeCurrentChart.value())):this._$fullscreenChartButton.hide()};return a}();TradingView.SymbolSearch=function(){function a(b){if(!(this instanceof a))throw new TypeError("SymbolSearch is a constructor");this._inputParserMixin=TradingView.isRunningChartingLibrary?void 0:new TradingView.SymbolSearchInputParserMixin(this);b=b||{};this._inputElement=$(b.input).get(0);if(!this._inputElement)throw new TypeError("options.input must be a DOM element, jQuery object or selector");this.$list=$(b.list).eq(0);0===this.$list.size()&&delete this.$list;if(void 0!==b.callback){if("function"!==
typeof b.callback)throw new TypeError("options.callback must be function");this._callback=b.callback}if(void 0!==b.onValueChanged){if("function"!==typeof b.onValueChanged)throw new TypeError("options.onValueChanged must be function");this._onValueChanged=b.onValueChanged}if(void 0!==b.onEmptyApply){if("function"!==typeof b.onEmptyApply)throw new TypeError("options.onEmptyApply must be function");this._onEmptyApply=b.onEmptyApply}b.hidePro&&(this._hidePro=!0);b.allowMultipleSymbols&&(this._allowMultipleSymbols=
!0);if(void 0!==b.onParse){if("function"!==typeof b.onParse)throw new TypeError("options.onParse must be function");this._onParse=b.onParse}this._state={};$(this._inputElement).data("symbol-search-instance",this);for(var c=this._boundListener=this._eventListener.bind(this),d=this.boundTimeoutListener=function(a){setTimeout(function(){c(a)},0)},k=0;k<e.length;k++)if(e[k].immediate)$(this._inputElement).on(e[k].name,c);else $(this._inputElement).on(e[k].name,d);this._boundOnKeyDown=this._onKeyDown.bind(this);
this._boundOnKeyPress=this._onKeyPress.bind(this);$(this._inputElement).on("keydown",this._boundOnKeyDown).on("keypress",this._boundOnKeyPress);this._eventListener();b.autoFocus&&a.registerAutoFocus(this)}function b(a,b){var c=ChartApiInstance.supportedSymbolsTypes(),d=TVSettings.getValue("symboledit.filter");!c.some(function(a){return a.value===d})&&0<c.length&&(d=c[0].value);0!=c.length&&(c.forEach(function(c){var e=c.value;c=$('<a class="type-filter">').attr("href","#"+e).text($.t(c.name));e===
d&&c.addClass("active");c.on("click",function(c){c.preventDefault();b.find(".type-filter").removeClass("active");$(this).addClass("active");a.typeFilter(e);TVSettings.setValue("symboledit.filter",e)});c.appendTo(b)}),a.typeFilter(d))}function c(a,b){var c=ChartApiInstance.supportedExchangesList(),d=TVSettings.getValue("symboledit.exchangefilter");!c.some(function(a){return a.value===d})&&0<c.length&&(d=c[0].value);if(0!=c.length){var e=$("<select>").appendTo(b);c.forEach(function(a){var b=a.value,
c=a.name||b,f=a.desc||c,b=$("<option>").attr("value",b).text($.t(c)).data("custom-option-text",$.t(f)).appendTo(e);a.value===d&&b.attr("selected",!0)});e.change(function(){var b=$(this).val()||"";TVSettings.setValue("symboledit.exchangefilter",b);a.exchangeFilter(b)});e.selectbox({speed:0,classHolder:"tv-unstyled-select-container tv-symbol-select"});a.exchangeFilter(d)}}function d(a){return a.ctrlKey||a.metaKey||!a.charCode||!a.which||32>=a.which||/^(input|textarea)$/i.test(a.target.tagName)||TVDialogs.modalDialog?
!1:!0}var e=[{name:"input",immediate:!0},{name:"sync",immediate:!0},{name:"keypress"},{name:"keydown"},{name:"keyup"},{name:"mousedown"},{name:"mouseup"},{name:"cut"},{name:"paste"}];a.registerAutoFocus=function(b){b instanceof jQuery&&(b=b.data("symbol-search-instance"));if(!(b instanceof a))throw new TypeError("arg must be an SymbolSearch instance of jQuery input with bound SymbolSearch object");TradingView.keyboardBinder.registerListener("symbolEdit",function(a){d(a)&&(a.preventDefault(),this.resetState(),
this._skipAutoFocus=!0,this._inputElement.focus(),this._inputElement.value=String.fromCharCode(a.charCode),this._eventListener())}.bind(b))};a.prototype.resetState=function(){this._state={}};a.prototype.typeFilter=function(a){if(0<arguments.length)a!==this._state.typeFilter&&(null==a?delete this._state.typeFilter:this._state.typeFilter=a+"",delete this._state.keepListFor,this._onSelectionChanged());else return this._state.typeFilter};a.prototype.exchangeFilter=function(a){if(0<arguments.length)a!==
this._state.exchangeFilter&&(null==a?delete this._state.exchangeFilter:this._state.exchangeFilter=a+"",delete this._state.keepListFor,this._onSelectionChanged());else return this._state.exchangeFilter};a.prototype._moveSelection=function(a){this._state.suggestOptions&&0!==this._state.suggestOptions.length&&(a=void 0===this._state.highlightIndex?0:Math.max(0,Math.min(this._state.highlightIndex+a,this._state.suggestOptions.length-1)),this._highlightOption(a,!0))};a.prototype._onKeyDown=function(a){if(40===
a.keyCode||38===a.keyCode)this._moveSelection(40===a.keyCode?1:-1),a.preventDefault()};a.prototype._onKeyPress=function(a){if(40===a.keyCode||38===a.keyCode){if(a.charCode)return;if(this._boundOnKeyDown){$(this._inputElement).off("keydown",this._boundOnKeyDown);delete this._boundOnKeyDown;a.preventDefault();return}this._moveSelection(40===a.keyCode?1:-1);a.preventDefault()}13===a.keyCode&&this.acceptTypeIn()};a.prototype._eventListener=function(a){a=this._inputElement;var b=a.value.toUpperCase(),
c=!1;this._state.value!==b&&(this._state.hasOwnProperty("value")&&this._onValueChanged&&this._onValueChanged(b),this._state.value=b,c=!0,this._inputParserMixin&&this._inputParserMixin.parse());this._state.selectionStart!==a.selectionStart&&(this._state.selectionStart=a.selectionStart,c=!0);this._state.selectionEnd!==a.selectionEnd&&(this._state.selectionEnd=a.selectionEnd,c=!0);this._state.selectionDirection!==a.selectionDirection&&(this._state.selectionDirection=a.selectionDirection,c=!0);c&&(this._onSelectionChanged(),
b=!1,a.value!==this._state.value&&(a.value=this._state.value,b=!0),(b||this._state.selectionStart!==a.selectionStart||this._state.selectionEnd!==a.selectionEnd)&&a.setSelectionRange(this._state.selectionStart,this._state.selectionEnd,this._state.selectionDirection))};a.prototype._onSelectionChanged=function(){function a(c,d,e,f){b._state.contextTicker=c;b._state.contextExchange=d;b._state.contextType=e;b._state.keepListFor&&b._state.keepListFor===f||(b._getSuggestList(),delete b._state.keepListFor)}
var b=this;if(this._inputParserMixin)this._inputParserMixin.onSelectionChanged(a);else{var c=this._state.value;a(c,this._state.exchangeFilter,this._state.typeFilter,this._state._selectedTicker||c)}};a.prototype._clearSelectionState=function(){delete this._state.contextTicker;delete this._state.contextExchange;delete this._state.contextType;delete this._state.contextToken;delete this._state.keepListFor};a.prototype._getSuggestList=function(){var a=this,b=this._state.contextTicker||"",c=this._state.contextExchange||
this._state.exchangeFilter||"",d=this._state.typeFilter||"";this._showLoading();ChartApiInstance.searchSymbolsByName(b,c,d,"undefined"!=typeof chartWidget?chartWidget:void 0,function(e){b===(a._state.contextTicker||"")&&c===(a._state.contextExchange||a._state.exchangeFilter||"")&&d===(a._state.typeFilter||"")&&a._renderSuggestList(e)})};a.prototype._showLoading=function(){this.$list&&(this._clearSuggestList(),$('<div class="symbol-search-loading">').appendTo(this.$list))};a.prototype._renderSuggestList=
function(a){if(this.$list){var b=this,c=this._state;this._clearSuggestList();var d=c.suggestOptions=[],e=RegExpEscape(c.contextTicker).trim(),n=RegExp(e.replace(" ","|"),"i"+(1<e.length?"g":""));delete c.highlightIndex;this._hidePro&&(a=a.filter(function(a){return!a.params||-1===a.params.indexOf("pro")}));if(0===a.length)this.$list.html('<div style="text-align: center; padding: 7px 0; font-style: italic;">'+$.t("No symbols matched your criteria")+"</div>");else{var q,l=$('<table class="symbol-edit-popup">').appendTo(this.$list);
a.forEach(function(a,b){a.ticker||(a.ticker=a.full_name);d.push(a);var e=$('<tr class="symbol-edit-popup">');e.attr("data-index",b);var f=$('<td class="symbol-edit-popup-td name">');f.html(a.symbol.replace(n,"<strong>$&</strong>"));f.appendTo(e);$('<td class="symbol-edit-popup-td desc">').html(n.test(a.symbol)?a.description:a.description.replace(n,"<strong>$&</strong>")).appendTo(e);f=$('<td class="symbol-edit-popup-td type">').appendTo(e);~a.params.indexOf("eod")&&$("<i>").text("eod").addClass("eod").prependTo(f);
switch(a.type){case "index":f.append($.t(a.type));break;default:f.append($.t(a.type)+" - "+a.exchange)}f.appendTo(e);e.appendTo(l);a.ticker===c.contextTicker&&a.exchange===c.contextExchange&&void 0===q&&(q=b);a._$tr=e});void 0!==q&&this._highlightOption(q);l.on("click","tr",function(a){a.preventDefault();b._state.suggestOptions&&(a=b._state.suggestOptions[+this.getAttribute("data-index")])&&a.full_name&&b.accept(a.full_name,a.ticker)})}}};a.prototype._highlightOption=function(a,b){var c=this._state;
c.highlightIndex!==a&&(void 0!==c.highlightIndex&&c.suggestOptions[this._state.highlightIndex]._$tr.removeClass("symbol-edit-popup-active"),c.highlightIndex=a,c.suggestOptions[a]._$tr.addClass("symbol-edit-popup-active"),b&&this._replaceCurrentSymbol())};a.prototype._clearSuggestList=function(){delete this._state.suggestOptions;this.$list&&this.$list.empty()};a.prototype._showErrorNotice=function(){this.$list&&(this._clearSuggestList(),this.$list.text("Invalid expression"))};a.prototype._replaceCurrentSymbol=
function(){var a=this._state;if(a.suggestOptions&&void 0!==a.highlightIndex){var b=a.suggestOptions[a.highlightIndex],c="",d=0;if(this._inputParserMixin){b=this._inputParserMixin.replaceCurrentSymbol(b);if(!b.ok)return;c=b.newValue;d=b.newCaretPos;a.keepListFor=b.keepListFor}else c=b.symbol,d=c.length,this._state._selectedTicker=a.keepListFor=b.ticker||b.symbol;this._inputElement.value=c;this._inputElement.setSelectionRange(d,d);this._eventListener()}};a.prototype.splitAndAcceptUserInput=function(){for(var a=
this._inputElement.value.split(","),b=0;b<a.length;b++)this.acceptSymbolIn(a[b])};a.prototype.acceptSymbolIn=function(a){var b,c;this._inputParserMixin?b=this._inputParserMixin.parseSymbol(a):(b=a,c=this._state._selectedTicker||a);this.accept(b,c)};a.prototype.acceptTypeIn=function(){this._allowMultipleSymbols?this.splitAndAcceptUserInput():this.acceptSymbolIn(this._inputElement.value)};a.prototype.accept=function(a,b){b=b||a;delete this._state.keepListFor;this._inputElement.value=a;this._eventListener();
this._callback&&this._callback(b);$(this._inputElement).trigger("accept-symbol",[b])};a.prototype.bindListWrapper=function(a){a=$(a).eq(0);if(0===a.size())throw new TypeError("element must be a DOM element, jQuery object or selector");this.$list=a;this._clearSelectionState();this._eventListener()};a.prototype.removeListWrapper=function(){delete this.$list;this._clearSuggestList();this._clearSelectionState();this._eventListener()};a.showDialog=function(d){d=d||{};if(!TVDialogs.get("Symbol Search")){var e=
TVDialogs.createDialog("Symbol Search",{hideTitle:!0,hideCloseCross:!0,dragHandle:".filter",width:"650px",content:TradingView.templates.dialogs.symbolSearch});TVDialogs.positionDialog(e);var h=e.find(".tv-dialog-content").addClass("symbol-search-dialog"),k=h.find(".results");k.mousewheel(function(a,b){var c=$(this);0<b?c.scrollTop(c.scrollTop()-15):c.scrollTop(c.scrollTop()+15)});var m=h.find("input").get(0);m.value=d.initialValue?d.initialValue:TVSettings.getValue("symboledit.dialog_last_entry",
"");m.selectionStart=m.selectionEnd=m.value.length;m.focus();if(TradingView.SymbolSearchInputParserMixin)var n=TradingView.SymbolSearchInputParserMixin.addSpreadActions(h.find(".spread-actions"),m);n=new a({input:m,list:h.find(".results").get(0),callback:function(a){d.callback&&d.callback(a);TVDialogs.destroy("Symbol Search")},onParse:n});h=h.find(".filter");b(n,h);h=$('<div class="exchange-filter">').appendTo(h);c(n,h);TVDialogs.resizeContent(e.height(),k);TVDialogs.applyHandlers(e);TVDialogs.positionDialog(e);
e.on("destroy",function(){TVSettings.setValue("symboledit.dialog_last_entry",m.value)});return e}};a.bindToInput=function(d,e){function h(){l&&(z.removeListWrapper(),l.off(),l.remove(),l=null)}function k(a){a.preventDefault()}e=e||{};d=$(d).eq(0);var m=e.callback,n=null,q=null,l=null,s=void 0,u=e.spreadActions&&$(e.spreadActions).eq(0);u&&u.size()&&TradingView.SymbolSearchInputParserMixin&&(s=TradingView.SymbolSearchInputParserMixin.addSpreadActions(u,d.get(0),z));var z=new a({input:d,onValueChanged:function(){if(!l){var a=
z,d=$('<div class="symbol-edit-popup">').appendTo(document.body),e=$('<div class="filter">').appendTo(d);b(a,e);var f=$('<div class="exchange-filter">').appendTo(e);c(a,f);var f=$('<div class="table-wrapper">').appendTo(d),g=$(a._inputElement),a=g.offset();leftOffset=Math.max(0,Math.min(a.left+0,$(window).width()-d.outerWidth()));d.css("left",leftOffset+"px");d.css("top",a.top+g.outerHeight()+1);var h=parseInt($(window).height(),10),e=e.outerHeight(),m=$(window).scrollTop(),g=g.height();f.css("maxHeight",
h-(a.top-m)-g/2-g-e+"px");l=d;z.bindListWrapper(f);l.on("focus","*",k);l.on("click","*",k);l.on("mousedown","*",k)}},callback:function(a){h();"function"===typeof q&&q(a)||("function"===typeof m&&m(a),"function"===typeof n&&n(a));e.clearAfterAccept&&d.val("");e.keepFocus?d.get(0).focus():d.get(0).blur();z.resetState()},hidePro:e.hidePro,autoFocus:e.autoFocus,onEmptyApply:e.onEmptyApply,onParse:s,allowMultipleSymbols:e.allowMultipleSymbols}),t=!1;d.on("focus",function(a,b){t=!0;z._skipAutoFocus?delete z._skipAutoFocus:
setTimeout(function(){t&&d.get(0).select()},0)});d.on("blur",function(a){t=!1;setTimeout(function(){t||h()},0)});if(e.syncWithChartWidget){var B=function(a){symbol=a&&TradingView.Linking.seriesShortSymbol.value()||TradingView.Linking.symbol.value()||"";d.val(symbol);z.resetState()};B(!0);TradingView.Linking.seriesShortSymbol.subscribe(function(){B(!0)});n=function(a){TradingView.Linking.symbol.setValue(a)};q=function(a){if(a===TradingView.Linking.symbol.value()||a===TradingView.Linking.seriesShortSymbol.value())return!0};
d.on("keypress",function(a){27===a.keyCode&&(d.get(0).blur(),B(!1))});d.on("keydown",function(a){27===a.keyCode&&(d.get(0).blur(),B(!1))})}return z};a.registerDialogKeypressHandler=function(b){if(!b)throw new TypeError("chartWidget is required");TradingView.keyboardBinder.pushBackListener("symbolEdit",function(b){d(b)&&(b.preventDefault(),a.showDialog({initialValue:String.fromCharCode(b.charCode),callback:function(a){TradingView.Linking.symbol.setValue(a)}}))})};return a}();function LoadChartDialog(){this.title="Load Chart";this.options={};this.inputDelegate=new Delegate;this.matchedItems=[];this.itemsData=[];this.qs=new LoadChartDialog.QuickSearch(this.inputDelegate,this.fieldsExtractor,this.searchResult.bind(this));this.sortObj=new LoadChartDialog.SortObject(this.modifiedCompare);this.nameSort=new LoadChartDialog.SortObject(this.nameCompare);this.symbolSort=new LoadChartDialog.SortObject(this.symbolCompare);this.toolsSort=new LoadChartDialog.SortObject(this.toolsCompare)}
LoadChartDialog.QuickSearch=function(a,b,c){this.fieldsExtractor=b;this.callback=c;this.regExps=[];a.subscribe(this,this.onInput)};LoadChartDialog.QuickSearch.prototype.onInput=function(a){this.query=a;this.createRegexps(a);this.search()};LoadChartDialog.QuickSearch.prototype.createRegexps=function(a){this.regExps=[];this.regExps.push(RegExp("("+a.split("").map(function(a){return RegExpEscape(a)}).join(")(.*)(")+")","i"))};
LoadChartDialog.QuickSearch.prototype.match=function(a){for(var b=0;b<this.regExps.length;b++){var c=this.regExps[b];c.lastIndex=0;for(var d=this.fieldsExtractor(a),e=0;e<d.length;e++)if(c.test(d[e]))return!0}return!1};LoadChartDialog.QuickSearch.prototype.search=function(){for(var a=[],b=0;b<this.items.length;b++){var c=this.items[b];this.match(c)&&a.push(c)}this.callback(a,this.regExps)};LoadChartDialog.QuickSearch.prototype.setItems=function(a){this.items=a};
LoadChartDialog.SortObject=function(a,b){this.isAscending=!1;this.sortingFunc=a;this.getPredicate=function(){return function(a,b){var e=this.sortingFunc(a,b);this.isAscending&&(e*=-1);return e}.bind(this)};this.inverse=function(){this.isAscending=!this.isAscending};this.setIsAscending=function(a){"boolean"==typeof a&&(this.isAscending=a);return this.isAscending};this.reset=function(){this.isAscending=!1}};
LoadChartDialog.prototype.fieldsExtractor=function(a){var b=LoadChartDialog.symbolWrap(a);return[a.title,b]};LoadChartDialog.prototype.saveFavorite=function(a,b){b?this.favorites[a]=b:delete this.favorites[a]};LoadChartDialog.prototype.filterFavorites=function(){var a={};this.itemsData.map(function(b){this.favorites.hasOwnProperty(b.id)&&(a[b.id]=!0)}.bind(this));this.favorites=a};LoadChartDialog.prototype.getFavorite=function(a){return this.favorites.hasOwnProperty(a)};
LoadChartDialog.prototype._appendListItem=function(a){var b=$('<div class="item">').appendTo(this.itemsList);a.active&&b.addClass("active");var c=moment.unix(a.modified),d=$('<div class="value name first">').appendTo(b),e=$('<div class="icon-favorite">').appendTo(d).click(function(b){this.saveFavorite(a.id,!this.getFavorite(a.id));this.filterFavorites();this.fillList();a.favoriteAction(this.favorites);b.stopPropagation()}.bind(this));this.getFavorite(a.id)&&e.addClass("active");$('<span class="text">').text(a.title).appendTo(d);
d=$('<div class="actions">').appendTo(b);$('<div class="icon-delete">').appendTo(d).click(function(b){var c=this,d=$.Deferred();a.deleteAction(d);d.then(function(){c.removeItem(a)});b.stopPropagation()}.bind(this));$('<div class="value modified">').text(c.format("L LT")).appendTo(b);c=""===a.symbol?"multiple charts":a.symbol+", "+a.interval;$('<div class="value symbol last">').text(c).appendTo(b);b.click(function(b){a.openAction()}.bind(this))};
LoadChartDialog.prototype.removeItem=function(a){a=this.itemsData.indexOf(a);-1<a&&this.itemsData.splice(a,1);this.setChartsData(this.itemsData)};LoadChartDialog.prototype.modifiedCompare=function(a,b){var c=a.modified;return moment(b.modified).diff(moment(c))};LoadChartDialog.prototype.nameCompare=function(a,b){return a.title.localeCompare(b.title)};LoadChartDialog.symbolWrap=function(a){return""===a.symbol?"multiple charts":a.symbol+" "+a.interval};
LoadChartDialog.prototype.symbolCompare=function(a,b){return LoadChartDialog.symbolWrap(a).localeCompare(LoadChartDialog.symbolWrap(b))};LoadChartDialog.prototype.toolsCompare=function(a,b){var c=a.toolsCount,d=b.toolsCount;return c<d?-1:c==d?0:1};LoadChartDialog.prototype.sortClick=function(a){this.setSort($(a.target).data("sort"),!0);this.fillList()};
LoadChartDialog.prototype.setSort=function(a,b){var c=TVSettings.getValue("loadChartDialog.sort.field")||"modified",d=TVSettings.getValue("loadChartDialog.sort.asc")||"0",e=a||c,f=b?"0"==d?"1":"0":d,g;if(!this.currentSortObj||(g=e!=c))this.currentSortObj="name"==e?this.nameSort:"symbol"==e?this.symbolSort:"tools"==e?this.toolsSort:this.sortObj,g&&TVSettings.setValue("loadChartDialog.sort.field",e);this.currentSortObj.setIsAscending("1"==f);f!=d&&TVSettings.setValue("loadChartDialog.sort.asc",f);$.each(this.header.children(".item"),
function(){$(this).data("sort");$(this)[$(this).data("sort")==e?"addClass":"removeClass"]("active")})};LoadChartDialog.prototype.sortList=function(){var a=[],b=[];this.matchedItems.map(function(c){this.favorites.hasOwnProperty(c.id)?a.push(c):b.push(c)}.bind(this));if(void 0!==this.currentSortObj){var c=this.currentSortObj.getPredicate();b.sort(c);a.sort(c)}this.matchedItems=a.concat(b)};
LoadChartDialog.prototype.fillList=function(){var a=this;this.sortList();this.itemsList.children(".item").remove();$.each(this.matchedItems,function(){a._appendListItem(this)});this.highlightOccurrences(this.qs.regExps)};LoadChartDialog.prototype.searchResult=function(a,b){this.matchedItems=a;this.fillList()};LoadChartDialog.prototype.updateChartsData=function(a){this.setChartsData(a)};LoadChartDialog.prototype.updateFavoritesData=function(a){this.favorites=a;this.itemsList&&this.inputDelegate.fire(this.input.val())};
LoadChartDialog.prototype.setChartsData=function(a){this.itemsList&&(this.itemsData=a,this.qs.setItems(a),this.inputDelegate.fire(this.input.val()))};
LoadChartDialog.prototype.layoutHeader=function(){var a=$('<div class="list-header">').appendTo(this.content);$('<div class="item name first">').text("Chart Name").data("sort","name").appendTo(a);$('<div class="item modified">').text("Last Modified").data("sort","modified").appendTo(a);$('<div class="item symbol last">').text("Active Symbol").data("sort","symbol").appendTo(a);return a};
LoadChartDialog.prototype.resetSort=function(){this.sortObj.reset();this.nameSort.reset();this.symbolSort.reset();this.toolsSort.reset();this.currentSortObj=this.sortObj};LoadChartDialog.prototype.resetSearchClick=function(){this.input.val("").trigger("input").focus()};
LoadChartDialog.prototype.show=function(a,b){this.options.width="654px";this.options.content='<div class="load-chart"><a class="button new-chart">NEW CHART</a><div class="chart-search"><input type="text" name="q" value="" autocomplete="off" placeholder="Search"><a class="input-reset"></a><div class="search-icon"></div></div></div>';var c=TVDialogs.createDialog(this.title,this.options);TVDialogs.positionDialog(c);this.input=c.find(".chart-search input");this.inputReset=c.find(".chart-search .input-reset");
this.content=$('<div class="list-content"></div>').appendTo(c.find(".load-chart"));this.header=this.layoutHeader();this.setSort();this.itemsListContainer=$('<div class="charts-list-container">').appendTo(this.content);this.itemsList=$('<div class="charts-list">').appendTo(this.itemsListContainer);this._scroll=new TradingView.SidebarCustomScroll(this.itemsListContainer,this.itemsList,{showBottomShadow:!1});c.find(".new-chart").click(function(){open("/e/","_blank")});this.header.children(".item").click($.proxy(this,
"sortClick"));this.inputReset.click($.proxy(this,"resetSearchClick"));this.input.on("input propertychange",function(){this._scroll.scrollTo(0);this.inputDelegate.fire(this.input.val());""!==this.input.val()?this.inputReset.show():this.inputReset.hide()}.bind(this));var d;is_authenticated||(this.content.hide(),d=$('<div class="please-log-in"></div>').appendTo(c.find(".load-chart")),$('<a href="#" class="link">You are not logged in. Please sign in.</a>').appendTo(d).click(function(a){a.preventDefault();
TVDialogs.destroy(this.title);TVDialogs.showSignInDialog(null,{mode:"signin"})}.bind(this)));this.favorites=b;this.setChartsData(a);TVDialogs.applyHandlers(c,!0);var e=this.itemsListContainer;d&&(e=d);TVDialogs.resizeContent(c.height(),e);TVDialogs.positionDialog(c)};
LoadChartDialog.prototype.highlightOccurrences=function(a){this.itemsList.children(".item").each(function(){var b=$(this).find(".value.name").find("span"),c=b.text(),c=LoadChartDialog.highlightText(c,a);b.html(c);b=$(this).find(".value.symbol");c=b.text();c=LoadChartDialog.highlightText(c,a);b.html(c)})};
LoadChartDialog.highlightText=function(a,b){a=$("<div>").text(a).html();if(0===b.length)return a;for(var c=0;c<b.length;c++){var d=b[c];d.lastIndex=0;var e="",f="";if((f=d.exec(a))&&f.length)for(var g=1;g<f.length;g++)e=g%2?e+('<span class="match">$'+g+"</span>"):e+("$"+g);if((f=a.replace(d,e))&&f!==a)return f}};TVXWindowEvents=function(){var a={};$(window).on("storage",function(b){if(null!==b.originalEvent.newValue){var c=b.originalEvent.key;c.startsWith("tvxwevents.")&&(c=c.substr(11),$.browser.msie&&TVXWindowEvents._emitting?TVXWindowEvents._emitting=!1:a[c]&&a[c].forEach(function(a){a.call(b.originalEvent.newValue,b.originalEvent.newValue)}))}});return{on:function(b,c){a[b]||(a[b]=[]);a[b].push(c)},off:function(b,c){if(a[b]){var d=a[b].indexOf(c);-1!==d&&(1===a[b].length?delete a[b]:a[b].splice(d,1))}},
emit:function(a,c){void 0===c&&(c=+new Date);c!=localStorage.getItem("tvxwevents."+a)&&($.browser.msie&&(TVXWindowEvents._emitting=!0),localStorage.setItem("tvxwevents."+a,c))}}}();function clean(a){return a&&a.replace?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):a}function cleanButAmpersand(a){return a&&a.replace?a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):a}function strip_tags(a){return a&&a.replace?a.replace(/(<([^>]+)>)/ig,""):a}function encodeSpread(a){return encodeURIComponent(a)}
function truncate(a,b){if(!a)return a;b=void 0===b?140:b;return a.length>b?a.substr(0,a.indexOf(" ",b))+"\u2026":a}"undefined"!=typeof module&&module&&module.exports&&(module.exports={clean:clean,cleanButAmpersand:cleanButAmpersand});$(document).ajaxSend(function(a,b,c){"POST"==c.type&&(b.setRequestHeader("X-CSRFToken",$.cookie("csrftoken")),b.setRequestHeader("sessionid",$.cookie("sessionid")))});String.prototype.format||(String.prototype.format=function(){var a=arguments;return this.replace(/{(\d+)}/g,function(b,c){return"undefined"!=typeof a[c]?a[c]:b})});
"string"===typeof $.cookie("csrftoken")&&""!=$.cookie("csrftoken")?$("#update-status-li").append('<a href="#" onclick="TradingView.showChangeUserStatusDialog(); return false;">Update Status</a>'):$("#update-status-li").empty();
$(document).ready(function(){$(".tv-select").selectbox({speed:100,classHolder:"tv-select-container"});Modernizr.canvas&&Modernizr.canvastext||"undefined"!=typeof FlashCanvas||TVDialogs.showNotice("Oops, your browser can't display our charts!",'It appears that your browser does not support <strong>Canvas</strong> technology, which is needed for TradingView to work.<br/>Please use one of the following browsers:<ul><li><a href="http://www.google.com/chrome/" target="_blank">Chrome</a></li><li><a href="http://www.mozilla.com" target="_blank">Firefox</a></li><li><a href="http://www.apple.com/safari/" target="_blank">Safari</a></li><li><a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home" target="_blank">Internet Explorer 9+</a></li></ul>',"slim",
!0);"WebSocket"in window||swfobject.hasFlashPlayerVersion("9.0.0")||TVDialogs.showNotice("TradingView Notice",'It appears that your browser does not support <strong>WebSocket</strong> technology and does not have <strong>Adobe Flash</strong> plugin installed, one of which is essential for our portal.<br/>Please, <a href="http://get.adobe.com/flashplayer/" target="_blank">install Flash plugin</a> or consider updating to one of these modern browsers with WebSocket support:<ul><li><a href="http://www.google.com/chrome/" target="_blank">Chrome</a></li><li><a href="http://www.apple.com/safari/" target="_blank">Safari</a></li></ul>',
"slim",!0)});var loginStateChange=new Delegate;loginStateChange.subscribe(this,onLoginStateChange);TVXWindowEvents.on("loginStateChange",function(){var a=JSON.parse(this);user=a.user;is_authenticated=!!a.is_authenticated;loginStateChange.fire()});TradingView.trackEvent=function(a,b){window._UNIT_TESTS||"undefined"===typeof _gaq||_gaq.push(["_trackEvent",a,b])};var assert=function(a,b){if(!a)throw Error("Assertion failed"+(b?": "+b:""));};
function changeLoginState(a){is_authenticated=a?!0:!1;TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:is_authenticated,user:user}));loginStateChange.fire()}function loginUser(a){user=$.extend({},a);changeLoginState(!0);"function"==typeof TVDialogs.onSigninSuccess&&(TVDialogs.onSigninSuccess(),TVDialogs.onSigninSuccess=void 0);TVDialogs.modalDialog&&"Log in"==TVDialogs.modalDialog.data("title")&&TVDialogs.destroy()}
function signOut(){$.get("/accounts/logout/",function(){changeLoginState(!1)})}function runOrSignIn(a){is_authenticated?a():TVDialogs.showSignInDialog(a)}function runOrGoPro(a,b){user&&user.is_pro?a():TVDialogs.showGoProDialog(b)}function following(){runOrSignIn(function(){document.location="/following/"})}function followers(){runOrSignIn(function(){document.location="/followers/"})}function handleIfNotError(a,b){a.error?console.log(a.error):b(a)}
function handleIfNotErrorFunc(a){return function(b){handleIfNotError(b,a)}}
function relationChange(a,b,c){var d=$(a);runOrSignIn(function(){var a;a=void 0===d.data("type")?b:d.data("type");$.post("/social/follow-the-user/",{targetId:c,follow:a},function(b){a?(d.addClass("unfollow").removeClass("follow"),user.following++):(d.removeClass("unfollow").addClass("follow"),user.following--);d.mouseleave();d.hasClass("follow-big")||followButtonTooltip(d);$(".following_count").text(user.following);d.data("type",1-a)},"json")})}
function followButtonsHandler(a){a.on("click",".follow-big",function(){var a=$(this);a.hasClass("unfollow")?relationChange(a,0,a.data("userid")):(relationChange(a,1,a.data("userid")),a.hover())}).on("mouseenter",".follow-big",function(){$(this).hasClass("unfollow")&&$(this).text("Unfollow")}).on("mouseleave",".follow-big",function(){$(this).hasClass("unfollow")&&$(this).text("Following")})}
function bindIdeasStreamFilter(a,b){b=b||{};var c=a.find(".filter").map(function(){function a(d,f){var g=$(this),h=g.data("name");if(!0===t||t[h])d&&d.preventDefault();else{n&&z.find(".temp").remove();if(!is_authenticated&&g.hasClass("authorization-required"))return TVDialogs.showSignInDialog(null,0),!1;var q=h?k.filter("[name="+h+"]"):k,u=g.data("value");if(q&&q.val()!=u||b.forceChange)s.filter(".active").filter(h?"[data-name="+h+"]":"*").removeClass("active").find(".active-underline").remove(),
g.addClass("active"),q.val(u).change(),f||"function"!=typeof b.onChange||setTimeout(function(){b.onChange(d,q.attr("name"),u)},0);var B=g.data("hook");if(B)for(key in B)c.forEach(function(a){-1<a.inputs.indexOf(key)&&a.obj.setValue(B[key],key)});n&&0==z.find("a[data-value="+u+"]").length&&g.clone(!0).addClass("temp item").append('<span class="active-underline"></span>').appendTo(z);!b.notPreventDefault&&b.onChange&&d&&d.preventDefault();if(!n){var I=s.filter(".active[data-filter-title]:first").data("filter-title")||
l;I?s.filter(".active").each(function(){I=I.replace("%"+$(this).data("name")+"%",$(this).contents(":first").text())}):I=g.contents(":first").text();m.text(I)}e(!0)}}function e(a){"boolean"!=typeof a&&(a=h);a?(g.stop(!0,!1).fadeOut(q),f.unbind("clickoutside").removeClass("active"),h=!1):(g.stop(!0,!1).fadeIn(q),f.one("clickoutside",e).addClass("active"),h=!0)}var f=$(this),g=f.find(".dropdown"),h=!1,k=f.find("input"),m=f.find(".selected"),n=!1,q="undefined"==typeof b.speed?50:b.speed,l=f.data("filter-title");
f.find(".selected").on("click",e);g.on("click","a",a);var s=g.find("a"),u=f.parent(".filter-tabbed"),z;u.length&&(n=!0,z=u.find(".tabs"),s=s.add(z.find("a:not(.temp)")),z.on("click","a",a));var t={};f.find(".sub-group.inactive").find("a:first").each(function(a,b){t[$(b).data("name")]=!0}.bind(this));var B={setValue:function(b,c){var e=s.filter("a[data-value="+b+"]"+(1<k.length&&c?"[data-name="+c+"]":""));a.apply(e,[void 0,!0])},getActiveTitle:function(){return m.text()},disabled:function(a,b){b?$("[data-name="+
b+"]",f).closest(".sub-group").addClass("inactive"):n?u.addClass("inactive "):f.addClass("inactive ");a||(b?("object"!=typeof t&&(t={}),t[b]=!0):t=!0)},enabled:function(a){a?($("[data-name="+a+"]",f).closest(".sub-group").removeClass("inactive"),"object"==typeof t&&(t[a]=!1)):(n?u.removeClass("inactive "):f.removeClass("inactive "),t=!1)}};f.data("interface",B);return{inputs:k.map(function(a,b){return $(b).attr("name")}).get(),obj:B}}).get()}bindProfileTabsFilter=bindIdeasStreamFilter;
TradingView.GoToChartField=function(a,b){function c(a){a?(a=a.toUpperCase(),location.href="/e/?symbol="+encodeSpread(a)):location.href=d.options&&d.options.defaultSymbol?"/e/?symbol="+encodeSpread(d.options.defaultSymbol):"/e/"}this.$element=a;this.$field=this.$element.find("input");this.$button=this.$element.find("span");this.options=b;this.$button.on("click",function(){this.symbolSearch.acceptTypeIn()}.bind(this));this.$element.on("keyup",function(){this.$element.toggleClass("not-empty",!!this.$field.val().length)}.bind(this));
this.symbolSearch=TradingView.SymbolSearch.bindToInput(this.$field,$.extend((this.options||{}).symbolSearch,{callback:c,onEmptyApply:c}));var d=this};TradingView.GoToChartField.prototype.updateOptions=function(a){$.extend(this.options,a)};
TradingView.SearchChartField=function(a){this.$element=a;this.$field=this.$element.find("input");this.$button=this.$element.find(".button");this.symbolSearch=TradingView.SymbolSearch.bindToInput(this.$field,{callback:function(a){a&&(a=a.toUpperCase(),location.href="/s/?q="+encodeSpread(a))}});this.$field.placeholder();this.$field.on("focus",function(){this.$element.addClass("active")}.bind(this)).on("blur",function(){this.$element.removeClass("active")}.bind(this)).on("keyup",function(){this.$element.toggleClass("not-empty",
!!this.$field.val().length)}.bind(this));this.$button.on("click",function(){this.symbolSearch.acceptTypeIn()}.bind(this))};function chartWithCover(a){a.find(".date").each(function(){var a=$(this),c=new Date(a.text());TradingView.agoDateFormatter(a,c)});a.find(".desc").each(function(){var a=$(this);a.height(a.parent().outerHeight()-a.position().top-5)}).ellipsis()}
function deleteChart(a,b){var c=[a];TVDialogs.showConfirm("Confirmation","Are you sure you want to delete this chart?",function(){$.post("/deletechart/",{uid:c},function(a){a.error||("string"===typeof b?document.location=b:"function"===typeof b?b():window.location.reload())})})}function recommendChart(a,b){var c=b?$(b):$("#chart-recommend-button");c.toggleClass("active");$.post("/recommend/",{id:a,type:"recommend"},function(a){c.toggleClass("active",!!a.state)})}
function bullseyeChart(a,b){var c=b?$(b):$("#chart-bullseye-button");c.hasClass("disabled")||(c.toggleClass("active"),$.post("/recommend/",{id:a,type:"bullseye"},function(a){c.toggleClass("active",!!a.state)}))}
function featuredChart(a,b){var c=b?$(b):$("#chart-featured-button");c.toggleClass("active");$.post("/recommend/",{id:a,type:"featured"},function(a){c.toggleClass("active",!!a.state);var b=c.next(".bullseye-button");!a.state&&b.hasClass("active")&&b.click();b.toggleClass("disabled",!a.state)})}function chartTogglePublic(a,b){var c=b?$(b):$("#chart-public-button");c.toggleClass("active");$.post("/togglepublic/",{id:a},function(a){c.toggleClass("active",!!a.state)})}
function chartToggleIOTD(a,b){function c(){d.toggleClass("active",e)}var d=b?$(b):$("#chart-iotd-button");if(!d.is(".disabled")){var e=d.hasClass("active");d.toggleClass("active",!e);var f=$.post("/toggle-iotd/",{id:a});f.done(function(a){if(a.error)return c();$("#chart-iotd-button").toggleClass("active",!!a.state).toggleClass("disabled",!!a.disabled)});f.fail(c)}}
function trendingPeople(a){a.on("click",".column-trending-people .tabs a",function(b){var c=$(this);if(c.hasClass("active"))return!1;c.addClass("active").siblings("a").removeClass("active");a.find(".top-user-group").hide().filter("."+c.attr("href").slice(1)).show();b.preventDefault()})}
$.fn.TVTicker=function(){var a=$('<div class="tv-ticker">').appendTo(this.parent());$('<div class="icon up">').appendTo(a);$('<div class="icon down">').appendTo(a);this.each(function(){var a=$(this);a.next().find(".up").click(function(){a.is(":disabled")||(a.val(parseInt(a.val(),10)+1),a.change())});a.next().find(".down").click(function(){a.is(":disabled")||(a.val(parseInt(a.val(),10)-1),a.change())});a.keydown(function(c){a.is(":disabled")||(38==c.keyCode?a.next().find(".up").addClass("active"):
40==c.keyCode&&a.next().find(".down").addClass("active"))});a.keyup(function(c){a.is(":disabled")||(38==c.keyCode?(a.val(parseInt(a.val(),10)+1),a.change(),a.next().find(".up").removeClass("active")):40==c.keyCode&&(a.val(parseInt(a.val(),10)-1),a.change(),a.next().find(".down").removeClass("active")))});a.mousewheel(function(c,d){0<d?a.next().find(".up").click():a.next().find(".down").click()})});return this};
function showDisconnectedMessage(){"MozWebSocket"in window&&WEB_SOCKET_WAS_CONNECTED?setTimeout("showDisconnectedMessageImpl()","15000"):showDisconnectedMessageImpl()}
function showDisconnectedMessageImpl(){TradingView.trackEvent("System","Disconnect");TVDialogs.showNotice("Connection is lost",'<p class="tv-dialog-left">Connection to server was lost<br/><br/>How to fix:<ol class="tv-dialog-left"><li>Check firewall settings and make sure access to websocket ('+WEBSOCKET_HOST+" port "+WEBSOCKET_PORT+') is open. Then click Reconnect or press F5.</li><li>Your browser doesn\u2019t support <strong>WebSocket</strong> technology and does not have <strong>Adobe Flash</strong> plugin installed.<br/>Please, <a href="http://get.adobe.com/flashplayer/" target="_blank">install Flash plugin</a> or consider updating to one of these modern browsers with WebSocket support:<ul><li><a href="http://www.google.com/chrome/" target="_blank">Chrome</a></li><li><a href="http://www.apple.com/safari/" target="_blank">Safari</a></li></ul></li><li>Server broke the connection. Click Reconnect or press F5.</li></ol></p><input class="tv-button xwide" type="button" value="Reconnect" onclick="TVDialogs.destroy();"/>',
"",!0).on("destroy",function(){ChartApiInstance.connect()})}function showCriticalErrorMessage(){TradingView.trackEvent("System","Critical Error");TVDialogs.showNotice("Critical error appeared",'<input class="tv-dialog-button" type="button" value="Retry" onclick="TVDialogs.destroy();"/>',"",!0).on("destroy",function(){ChartApiInstance.connect()})}
function toggleUserSavedCharts(a){var b=$(a).toggleClass("active");$(".my-saved-charts").toggle();b.is(".active")?$(document).bind("click.toggleUserSavedCharts",function(b){$(b.target).is(".saved-charts-button")||toggleUserSavedCharts(a)}):$(document).unbind("click.toggleUserSavedCharts")}function makeDirectionName(){return function(a,b){var c=b(a);return"0"==c?"Neutral":"1"==c?"Long":"Short"}}function gotochart(a){location.href="/v/"+a+"/"}
$.fn.ellipsis=function(){return this.each(function(a,b){var c=$(this),d=c.text(),e=d,f=$(this.cloneNode(!0)).hide().css("position","absolute").css("overflow","visible").width(c.width()).height("auto");a=a||c.height();c.after(f);for(var g=f.height()-a;0<g;)e=e.substr(0,e.length-g),f.text(e+"\u2026"),g=f.height()-a;c.html(f.text());b&&d!=f.text()&&c.attr("title",d);f.remove()},arguments)};
(function(a){var b=a('<div class="blue-tooltip-icon icon" />'),c=a('<div class="blue-tooltip-text" />'),d=a('<div class="blue-tooltip blue-tooltip-hidden" />').append(b).append(c);a.fn.blueTooltip=function(e,f,g){d.parent().length||d.appendTo(document.body);return this.each(function(){var h=a(this);h.data("tooltip",e);h.off("mouseenter.tooltip").on("mouseenter.tooltip",function(){if(!Modernizr.touch){g=g||"";c.html(h.data("tooltip"));d.attr("class","blue-tooltip");d.addClass("blue-tooltip-"+f).addClass(g);
var a=(h.outerWidth()-d.outerWidth())/2,e=0,n=a+h.offset().left+d.outerWidth(),q=a+h.offset().left,l=document.body.clientWidth-5;5>q?e=5-q:n>l&&(e=l-n);a=h.offset().left+a+e;n=0;q="";"top"===f?(n=h.offset().top-d.outerHeight()-10,q="-=10"):"bottom"==f&&(n=h.offset().top+h.outerHeight()+10,q="+=10");d.css({left:a,top:n,opacity:0});b.css({left:Math.round(d.width()/2)-e});d.stop().animate({top:q,opacity:1},200)}}).off("mouseleave.tooltip").on("mouseleave.tooltip",function(a){d.addClass("blue-tooltip-hidden").removeClass(g)})})}})(jQuery);
$(function(){function a(d){if(!Modernizr.touch){var m=d.data("commonTooltipText"),n=d.attr("title");if(m)n&&(m=n,d.data("commonTooltipText",m),d.removeAttr("title"));else{if(!n)return;m=n;d.data("commonTooltipText",m);d.removeAttr("title");d.on("mouseleave mousedown",function(){clearTimeout(g);clearTimeout(h);jQuery.contains(document.body,e[0])&&(e.css("opacity","0"),h=setTimeout(e.detach.bind(e),c/2))})}n=jQuery.contains(document.body,e[0]);clearTimeout(g);clearTimeout(h);n?(f.text(m),b(d),e.css("opacity",
"1")):g=setTimeout(function(){e.appendTo(document.body);a(d)},c)}}function b(a){e.attr("class","common-tooltip-wrapper").css({top:"auto",right:"auto",bottom:"auto",left:"auto"});Modernizr.pointerevents||e.addClass("no-pointer-events");f.css({top:"auto",right:"auto",bottom:"auto",left:"auto"});var b=a.offset().top-$(window).scrollTop(),c=a.offset().left-$(window).scrollLeft(),g=a.outerWidth(),h=a.outerHeight(),s=$(window).width(),u=$(window).height();((a=a.hasClass("common-tooltip-vertical"))&&20>
g||!a&&20>h)&&e.addClass("farther");a?(e.addClass("vertical").css({left:c+g,top:b-(e.outerHeight()-h)/2}),f.offset().left+f.outerWidth()+d>s?e.addClass("otl").css({left:"auto",right:s-c}):e.addClass("otr")):(e.css({bottom:u-b,left:c-(e.outerWidth()-g)/2}),f.offset().top<d?e.addClass("below").css({bottom:"auto",top:b+h}):e.addClass("above"),0>f.offset().left-d?f.css("left",Math.abs(f.offset().left)+d):f.offset().left+f.outerWidth()+d>s&&f.css("left",s-(f.offset().left+f.outerWidth()+d)))}var c=500,
d=10,e=$("<div />").css("opacity","0"),f=$('<div class="common-tooltip-body" />').appendTo(e),g,h;$(document).on("mouseenter",".apply-common-tooltip",function(){a($(this))})});
TradingView.GlobalNotification=function(a,b){this._options=b||{};var c=this;this.id=a.id;var d=this._lastId();if(!d)this._setLastId(this.id);else if(!(this.id<=d||(c=this,this.container=$(Mustache.render(TradingView.templates.globalNotification,a)).prependTo($("body")),c.container.show(),this._options.addClass&&this.container.addClass(this._options.addClass),c.container.css("top",0),this._options.notShiftBody||$("body").addClass("padding-animate").css({paddingTop:c.container.outerHeight()}),this.container.find(".icon-notification-close").on("click",
function(){c.close()}),$.browser.msie)))TVXWindowEvents.on(this.KEY+"-close",this._onCloseInAnotherTab.bind(this))};TradingView.GlobalNotification.prototype.KEY="globalNotification";
TradingView.GlobalNotification.prototype._lastId=function(){var a=TVSettings.getInt(this.KEY,0,!0),b=TVSettings.getInt(this.KEY,0),c=Math.max(b,a);a!=b&&TVSettings.setValue(this.KEY,c);!c&&$.cookie("notification_id")&&(c=~~$.cookie("notification_id"),TVSettings.setValue(this.KEY,c),$.cookie("notification_id",0,{expires:-1,path:"/"}));return c};TradingView.GlobalNotification.prototype._setLastId=function(a){TVSettings.setValue(this.KEY,a)};
TradingView.GlobalNotification.prototype.close=function(a){var b=this;this.container&&(a?(this.container.remove(),this.container=null):(b.container.css("top",-1*this.container.outerHeight()+"px"),setTimeout(function(){b.container.remove();b.container=null;$(window).resize();b._options.notShiftBody||$("body").removeClass("padding-animate")},1500),TVXWindowEvents.emit(b.KEY+"-close",JSON.stringify([b.id,+new Date])),this._setLastId(b.id)),this._options.notShiftBody||$("body").css({paddingTop:0}))};
TradingView.GlobalNotification.prototype._onCloseInAnotherTab=function(a){a=JSON.parse(a);this.id<=a[0]&&this.close(!0)};function closeGlobalNotification(a){$.cookie("notification_id",a,{expires:365,path:"/"});$(".tv-global-notification").slideUp(400,function(){$(window).resize()})}
TradingView.RequestCache=function(a){if(TradingView.isRunningChartingLibrary)return function(a){"function"==typeof a&&a([]);return a};var b,c=!1,d=!1;return function(e){if(e||!c&&!d)d=!0,$.getJSON(a,function(a){d=!1;c=!0;b=a;"function"==typeof e&&e(a)});return b}};TradingView.getStudyTemplatesList=new TradingView.RequestCache("/study-templates-ext/");TradingView.getThemesList=new TradingView.RequestCache("/themes/");
function getImage(a,b){b=b||{};TVDialogs.createModalDialog($.t("Image URL"));dialog=TVDialogs.modalDialog;var c=dialog.find(".tv-dialog-content"),d=$("<p><img src="+TradingView.wrapUrl('"/static/images/loading-small.gif"')+"/></p>").css({textAlign:"center",position:"absolute",width:"100%"}).appendTo(c),e=$('<div class="main">').css({visibility:"hidden"}).appendTo(c),f=$("<a>").text($.t("Save image")).attr({target:"_blank"}).css("text-decoration","underline"),g=$("<input>").attr({type:"text",readonly:!0}).bind("click focus",
function(){this.select&&this.select()});$("<p>").appendTo(e).append(f," "+$.t("or copy url:"));$("<p>").appendTo(e).append($("<form>").append(g));var h=$('<p class="tv-dialog-socials">').appendTo(e);TVDialogs.positionDialog();TVDialogs.applyHandlers();TradingView.trackEvent("GUI","Get image button");takeSnapshot(a,function(c){c=TradingView.isRunningChartingLibrary?(b.snapshotUrl?"":"http://www.tradingview.com/x/")+c:window.location.protocol+"//"+window.location.host+"/x/"+c;f.attr({href:c});g.val(c);
d.remove();e.css({visibility:"visible"});setTimeout(function(){var a=g.get(0);a.focus&&a.focus();a.select&&a.select()},0);c=ShareTwitterSnapshot.getStatus(a.activeChartWidget.value().symbolProperty().value(),c);$('<a class="twitter-share-button tv-dialog-social tv-dialog-social-twitter"></a>').attr({href:"https://twitter.com/share?count=none&text="+encodeURIComponent(c)+"&url=%20"}).appendTo(h);$('<script src="//platform.twitter.com/widgets.js">\x3c/script>').appendTo(h)},function(){dialog.find(".tv-dialog-error").text("URL cannot be recieved.").show()},
{snapshotUrl:b.snapshotUrl});return!1}
function onLoginStateChange(a){$("html").toggleClass("is-authenticated",is_authenticated).toggleClass("is-not-authenticated",!is_authenticated).toggleClass("is-pro",is_authenticated&&user&&!!user.is_pro).toggleClass("is-not-pro",!(is_authenticated&&user&&user.is_pro)).toggleClass("is-trial",is_authenticated&&user&&"pro_realtime_trial"===user.pro_plan).toggleClass("is-not-trial",!(is_authenticated&&user&&"pro_realtime_trial"===user.pro_plan)).toggleClass("is-mobile",!!TradingView.isMobileView);if(is_authenticated){a||
($(".header-item-profile strong.user-badge").remove(),$(".header-item-profile > a").append(userBadge(user,!0,"strong")));$(".user-info-username").html(user.username);$(".following_count").html(user.following);$(".followers_count").html(user.followers);$(".saved_charts_count").html(user.saved_charts);$(".published_charts_count").html(user.published_charts);$(".favorite_charts_count").html(user.favorite_charts_count);$(".treated_charts_count").html(user.treated_charts_count);$("img.user-picture, .user-picture img").attr("src",
user.userpic);$(".trial-days-left").html(user.trial_days_left||"");$(".header-item-profile").find("a").each(function(a,b){b=$(b);var e=b.attr("rel");e&&b.attr("href",e.replace("%u",user.username))});if("undefined"!==typeof carouselModels)for(var b in carouselModels)carouselModels[b].reload();user.fastpass_script&&eval(user.fastpass_script);TVSettings.merge(user.settings);user.is_first_login&&(TradingView.trackEvent("Conversion","First login"),user.prort_trial_started&&(TVDialogs.showTrialMessageSuccess(),
delete user.prort_trial_started),delete user.is_first_login);setTrialAvailiable(user.trial_availiable)}else user={username:"Guest",following:"0",followers:"0",ignore_list:{}},$(".user-info-username").html(user.username),window.localStorage&&localStorage.removeItem("trial_availiable");a&&TVSettings.moveFromLocalStorage();window.studyTemplates&&(studyTemplates.refreshStudyTemplateList(),studyTemplates.refreshFavoriteDropdownMenu())}
function markNewsAsRead(){$(".user-picture .notifications-counter").hide().addClass("hide");$(".notifications-counter.counter").removeClass("new").text("0");TVXWindowEvents.emit("zero-notification-counter")}function followButtonTooltip(a){var b=a.hasClass("unfollow")?"Unfollow":"Follow";a.attr("title",b)}function followButtonToolipAll(){$(".follow-link").each(function(a,b){b=$(b);b.data("tv_tooltip")||followButtonTooltip(b)})}function getSavedChartsList(a){return $.getJSON("/my-charts/",a)}
function isOnChartEditPage(){return"/e/"==location.pathname.substr(0,3)}
function refreshChartMenuState(){if(is_authenticated&&user.saved_charts){var a=$("div.header-item-chart");a.addClass("with-sub");a=a.find(".popup-subblock").eq(0);a.find("ul").remove();getSavedChartsList(function(b){b={charts:b,has_charts:!0};a.append(Mustache.render(TradingView.templates.lists.savedCharts,b));var c=new TradingView.SidebarCustomScroll(a,a.find("ul").eq(0),{additionalClass:"gray",alwaysVisible:!0});a.parent().one("hover",function(){c.updateScrollBar()});isOnChartEditPage()&&a.find(".new-chart").attr("target",
"_blank");a.find("li").slice(2).each(function(c,e){e=$(e);var f=e.find(".name").text();20<f.length&&e.attr("title",f);var g=b.charts[c].image_url;$("span.icon",e).click(function(b){a.mouseleave();deleteChart(g,function(){user.saved_charts--;var a=$(b.target).parent().attr("href");$(b.target).parent().parent().remove();!isOnChartEditPage()||user.saved_charts&&"/e/"+chartWidget.metaInfo().uid+"/"!=a?refreshChartMenuState():location.href="/e/"});return!1})})})}else $("div.header-item-chart").removeClass("with-sub")}
function urlize(a){var b,c=a.match(/(http:\/\/|www\.|http:\/\/www\.|https:\/\/www\.|https:\/\/)[^ <\n]{2,200}/g),d=[],e=0;if(c)for(b=0;b<c.length;b++){var f=0===c[b].indexOf("http://")||0===c[b].indexOf("https://")?"":"http://";a=a.replace(c[b],"<"+e++ +">");d.push("<a target='_blank' href='"+f+c[b]+"'>"+c[b]+"</a>")}if(c=a.match(/(\$)[^0-9][a-z0-9\._-]{2,20}/gi))for(b=0;b<c.length;b++)a=a.replace(RegExp("\\"+c[b],"gi"),"<"+e++ +">"),d.push("<a target='_blank' href='/s/?q="+c[b].substr(1)+"'>"+c[b]+
"</a>");if(c=a.match(/\@[a-z0-9\._-\u00A0]{2,50}/gi))for(b=0;b<c.length;b++)a=a.replace(RegExp(c[b],"gi"),"<"+e++ +">"),d.push("<a target='_blank' href='/u/"+c[b].substr(1).replace("\u00a0"," ")+"/'>"+c[b]+"</a>");0<d.length&&(a=a.replace(/<(\d+)>/g,function(a,b){return d[b]?d[b]:""}));return a}
(function(a){jQuery.fn.putCursorAtEnd=function(){return this.each(function(){a(this).focus();if(this.setSelectionRange){var b=2*a(this).val().length;this.setSelectionRange(b,b)}else a(this).val(a(this).val());this.scrollTop=999999})}})(jQuery);
function ShareTwitterSnapshot(a){function b(a,b){return"https://twitter.com/intent/tweet?&status="+encodeURIComponent(ShareTwitterSnapshot.getStatus(a,window.location.protocol+"//"+window.location.host+"/x/"+b+"/"))}if(TradingView.winMobileMode)this.onSuccess=function(c){try{JsBridge.sendEvent(b(a,c),"sharing_ready")}catch(e){}},this.onFailure=function(){try{JsBridge.sendEvent("sharing_error")}catch(a){}};else{var c=open("about:blank","snapshot_tweet","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+
Math.round(screen.width/2-275)+",top="+Math.round(screen.height/2-210));this.onSuccess=function(d){c.location.href=b(a,d)};this.onFailure=function(){c.close()}}}ShareTwitterSnapshot.getStatus=function(a,b){return TradingView.isCmeWidget?b+" from cmegroup.com via @tradingview $"+a:"$"+a+" chart "+b+" via http://www.tradingview.com"};
function ShareStocktwitsSnapshot(a){function b(a,b){return"https://stocktwits.com/widgets/share?body="+encodeURIComponent(ShareStocktwitsSnapshot.getStatus(a,window.location.protocol+"//"+window.location.host+"/x/"+b+"/"))}if(TradingView.winMobileMode)this.onSuccess=function(c){try{JsBridge.sendEvent(b(a,c),"sharing_ready")}catch(e){}},this.onFailure=function(){try{JsBridge.sendEvent("sharing_error")}catch(a){}};else{var c=open("about:blank","snapshot_tweet","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+
Math.round(screen.width/2-275)+",top="+Math.round(screen.height/2-210));this.onSuccess=function(d){c.location.href=b(a,d)};this.onFailure=function(){c.close()}}}ShareStocktwitsSnapshot.getStatus=function(a,b){return"$"+a+" chart "+b+" via http://www.tradingview.com"};
function authInStocktwits(a){runOrSignIn(function(){user.has_stocktwits?"function"===typeof a&&a():("function"===typeof a&&(user.on_stocktwits_auth_success=function(){a.apply(this,Array.prototype.slice.call(arguments));this.user.on_stocktwits_auth_success&&delete this.user.on_stocktwits_auth_success}.bind(window)),window.open("https://api.stocktwits.com/api/2/oauth/authorize?client_id="+stocktwits_consumer_key+"&response_type=code&redirect_uri="+location.protocol+"//"+location.host+"/accounts/return/stocktwits/&scope=publish_messages",
"stocktwits_permission_request","scrollbars=yes,height=400,width=700").focus())})}TradingView.agoDateFormatter=function(a,b,c){c||(c=TradingView.agoDateFormatter.fullFormat);var d=c(new Date-b),e=d.text,d=d.timeout;a.attr("title",b.toString()).text(e);e=null;d&&(a.attr("data-ago-date-timer")&&clearTimeout(+a.attr("data-ago-date-timer")),e=setTimeout(function(){TradingView.agoDateFormatter(a,b,c)},d));a.attr("data-ago-date-timer",e)};TradingView.agoDateFormatter.destroy=function(a){$(a).find("*").andSelf().filter("[data-ago-date-timer]").each(function(){clearTimeout(+$(this).attr("data-ago-date-timer"))})};
TradingView.agoDateFormatter.nextMinuteThrough=function(a){return 6E4-a%6E4};TradingView.agoDateFormatter.nextHourThrough=function(a){return 36E5-a%36E5};TradingView.agoDateFormatter.nextDayThrough=function(a){return 864E5-a%864E5};
TradingView.agoDateFormatter.fullFormat=function(a){var b=Math.floor(a/6E4),c="",d=!1;60>b?(c=1>b?"less than a minute":b+" minute"+(1<b?"s":""),d=TradingView.agoDateFormatter.nextMinuteThrough(a)):1440>b?(b=Math.floor(b/60),c=b+" hour"+(1<b?"s":""),d=TradingView.agoDateFormatter.nextHourThrough(a)):43200>b?(b=Math.floor(b/1440),c=b+" day"+(1<b?"s":""),d=TradingView.agoDateFormatter.nextDayThrough(a)):15768E3>b?(b=Math.floor(b/43200),c=b+" month"+(1<b?"s":"")):(b=Math.floor(b/15768E3),c=b+" year"+
(1<b?"s":""));d&&(d+=200);return{text:c+" ago",timeout:d}};TradingView.agoDateFormatter.shortFormat=function(a){var b=Math.floor(a/6E4),c="",d=!1;60>b?(c=(1>b?0:b)+"m",d=TradingView.agoDateFormatter.nextMinuteThrough(a)):1440>b?(b=Math.floor(b/60),c=b+"h",d=TradingView.agoDateFormatter.nextHourThrough(a)):43200>b?(b=Math.floor(b/1440),c=b+"d",d=TradingView.agoDateFormatter.nextDayThrough(a)):15768E3>b?(b=Math.floor(b/43200),c=b+"mn"):(b=Math.floor(b/15768E3),c=b+"y");d&&(d+=200);return{text:c,timeout:d}};
function userlink(a,b){return Mustache.render(TradingView.templates.userlink,{username:a,is_pro:function(){return!!b},is_realtime:function(){return"pro_realtime"==b},is_premium:function(){return"pro_premium"==b},is_trial:function(){return"pro_realtime_trial"==b}},TradingView.templates)}function proBadge(a,b){return void 0===a||a?Mustache.render(TradingView.templates.proBadge,{is_realtime:"pro_realtime"==a,is_premium:"pro_premium"==a,is_trial:"pro_realtime_trial"==a,large_badge:!!b}):""}
function userBadge(a,b,c){return Mustache.render(TradingView.templates.userBadge,{is_moderator:a.is_moderator,is_pro:a.is_pro,is_realtime:"pro_realtime"==a.pro_plan,is_premium:"pro_premium"==a.pro_plan,is_trial:"pro_realtime_trial"==a.pro_plan,large_badge:!!b,badge_tag:c},TradingView.templates)}
TradingView.Common={publishChart:function(){runOrSignIn(function(){TVDialogs.showPublishIntroDialog().done(function(){saver.publishChart()})})},createTrendingSymbols:function(){function a(a){function g(a,b){e[b]=a;quoteSessionMultiplexerInstance.simple.subscribe("trending_symbols_retry",[a],function(a){a.symbolname=b;h(a)})}function h(a){c[a.symbolname]||(c[a.symbolname]={});$.extend(c[a.symbolname],a.values);var b=c[a.symbolname],d=$("#trending-symbols-item-"+TradingView.symbol2id(a.symbolname)+
" .change");a=$("#trending-symbols-item-"+TradingView.symbol2id(a.symbolname)+" .last");var e=new PriceFormatter(b.pricescale||100,b.minmov||1,b.fractional,b.minmove2);a.text(e.format(b.last_price||""));0<b.change_percent?d.removeClass("minus").addClass("plus").text("+"+b.change_percent+"%"):0>b.change_percent?d.removeClass("plus").addClass("minus").text(b.change_percent+"%"):0==b.change_percent&&d.removeClass("plus minus").text(b.change_percent+"%")}var k=d.splice(0,d.length);a.forEach(function(a){var c=
$("#trending-symbols-item-"+TradingView.symbol2id(a.name));c.length?(c.attr("title",a.sessions+" watching "+a.short_name),c.find(".sessions-count").text(a.sessions)):c=$('<a class="trending-symbols-item clearfix" id="trending-symbols-item-'+TradingView.symbol2id(a.name)+'" title="'+a.sessions+" watching "+a.short_name+'" href="/chart/'+a.short_name+"/"+(a.full_name_required?"?exg="+a.exchange:"")+'" target="_blank"><div class="sessions"><span class="sessions-count">'+a.sessions+'</span> <span class="icon icon-people-watching"></span></div><div class="symbol">'+
a.short_name+'</div><div class="last"></div><div class="change"></div></a>').data("symbol",a.name);c.appendTo(b);d.push(a.name)});b.find(".trending-symbols-item").each(function(){-1==d.indexOf($(this).data("symbol"))&&$(this).remove()});a=[];for(var m=0;m<d.length;m++){var n=d[m],q=k.indexOf(n);-1===q?a.push(n):k.splice(q,1)}for(m=0;m<k.length;m++)n=k[m],quoteSessionMultiplexerInstance.simple.unsubscribe("trending_symbols",n),e[n]&&(quoteSessionMultiplexerInstance.simple.unsubscribe("trending_symbols_retry",
e[n]),delete e[n]);a.length&&quoteSessionMultiplexerInstance.simple.subscribe("trending_symbols",a,function(a){"permission_denied"==a.status?g(a.values.alternative,a.symbolname):h(a)});k=a=null}var b=$(".trending-symbols-table"),c={},d=[],e={};a(initialData.trendingSymbols);setInterval(function(){$.getJSON("/index/popular/",function(b){a(b)})},3E4)}};TradingView.symbol2id=function(a){return a.replace(/[^a-z0-9]/gi,"_")};TradingView.tokenInitialized=$.Deferred();TradingView.tokenExpiration=6E5;
TradingView.registerAuthToken=function(a){var b=this.tokenInitialized,c=new Date(1E3*user.auth_token_timestamp),d=new Date;loginStateChange.subscribe(TradingView,function(e){e&&user?(user.auth_token&&(d-c<this.tokenExpiration?(a.setAuthToken(user.auth_token),b.resolve()):this.requestAndSetAuthToken(a).done(function(){b.resolve();console.info("Token expired and recreated.")})),delete user.auth_token):this.isProRealtime()&&this.requestAndSetAuthToken(a).done(function(){b.resolve()})}.bind(this));setTimeout(b.resolve.bind(b),
5E3)};TradingView.requestAndSetAuthToken=function(a,b){var c=$.Deferred();this.requestAuthToken().done(function(d){a.setAuthToken(d,b);c.resolve()});return c};TradingView.requestAuthToken=function(){function a(){d=$.post("/quote_token/",null,"json").done(function(a){b.resolve(a)}).fail(function(){if(!b.isRejected()&&!b.isResolved()){var d=Math.min(1E3*c,3E4);c++;setTimeout(a,d)}})}var b=$.Deferred(),c=0,d;a();b.always(function(){d&&d.abort()});return b};
TradingView.isPro=function(){return is_authenticated&&user.is_pro};TradingView.isProRealtime=function(){return this.isPro()&&("pro_realtime"==user.pro_plan||"pro_realtime_trial"==user.pro_plan)};function updateChartActiveLabel(a,b){null==a&&(a=$(".chart-activity-label"));a=$(a);a.each(function(){var a=$(this),d;null==b?d=a.hasClass("chart-activity-label-active"):(d=b,a.toggleClass("chart-activity-label-active",d));a.find(".chart-activity-label-plate").text(d?"Active":"Closed")})}
TradingView.centerBlock=function(a){var b=$(window),c=a.width(),d=a.height(),e=b.width(),b=b.height();a.css({left:Math.round((e-c)/2)+"px",top:Math.round((b-d)/2)+"px"})};
TradingView.visitPaymentPageSwreg=function(a,b){if(!a.product_ids.hasOwnProperty(b))throw new TypeError("Unknown product");runOrSignIn(function(){if(!(b in{pro:1,pro_yearly:1,pro_realtime:1,pro_realtime_yearly:1}&&user.is_pro&&user.pro_plan==b)){var c={s:a.shop_id,q:1,d:0,v:0,bb:1,clr:1,clro:1,a:user.id,fn:user.first_name,sn:user.last_name,em:user.email,p:a.product_ids[b]},d=Object.keys(c).map(function(a){return encodeURIComponent(a)+"="+encodeURIComponent(c[a])});location.href=a.shop_url.replace(/(\?.*|$)/,
"?"+d.join("&"))}},!0)};
TradingView.visitPaymentPage=function(a,b,c){b=b||"y";c=c||{};runOrSignIn(function(){$('<form action="/order/" method="post"'+(c.newWindow?' target="_blank"':"")+'><input type="hidden" name="product" value="'+a+'"/><input type="hidden" name="billing_cycle" value="'+b+'"/><input type="hidden" name="fixed_billing_cycle" value="'+(c.fixedCycle?"true":"")+'"/><input type="hidden" name="exchanges_only" value="'+(c.exchangesOnly?"true":"")+'"/></form>').appendTo(document.body).submit()},!0)};
function hash(a){var b=0;if(0==a.length)return b;for(i=0;i<a.length;i++)code=a.charCodeAt(i),b=(b<<5)-b+code,b&=b;return b}function uniq(a){return a.reduce(function(a,c,d){return~a.indexOf(c)?null:a.push(c),a},[])}function bindLate(a,b){return function(){return a[b].apply(a,arguments)}}function debounce(a,b){var c;return function(){clearTimeout(c);c=setTimeout(a.bind.apply(a,[this].concat(Array.prototype.slice.call(arguments))),b)}}
function isLatin(a){return!/[^\u0000-\u0080\u00A0\u2013-\u2122]/g.test(a)}function RegExpEscape(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}
function loadMorePeople(a,b,c){var d=b.$loading||$(),e=b.$button||$(),f=b.$container;d.show();e.hide();var g=c?0:f.children().length;a.data||(a.data={});a.data=$.extend({},a.data,{offset:g});$.ajax(a).done(function(a){var d=a.total,g=a.items;c&&(f.data("loaded",!1),f.empty());0<g.length?g.forEach(function(a){a.follow_button=!is_authenticated||user.id!=a.id;a.links=a.profile.location||a.profile.twitter_username||a.profile.website;a.badge=userBadge(a,!0);a.reputation_delta&&(a.reputation_delta=Math.round(a.reputation_delta));
$(Mustache.render(h,a)).appendTo(f)}):c&&b.empty&&f.append($('<div class="empty"></div>').text(b.empty));f.children().length<d&&e.show();a.thats_all&&f.data("loaded",!0)}).always(function(){d.hide()});var h="<div class='item follow-list-item'>\t<a href='/u/{{ username }}/'><img src='{{ mid_picture_url}}'></a>\t<div class='indent'>\t<div class='description'>\t\t<div class='user-stats'>\t\t\t<span class='user-stats-followers' title='Followers'><a href='/u/{{ username }}/#followers'>{{ followers_count }}</a></span>\t\t\t<span class='user-stats-charts' title='Charts'><a href='/u/{{ username }}/#charts'>{{ charts_count }}</a></span>\t\t\t<span class='user-stats-reputation' title='Reputation'>{{ reputation }}{{# reputation_delta }} (+{{reputation_delta}}){{/ reputation_delta }}</span>\t\t</div>\t\t<div class='username'><a href='/u/{{ username }}/' class='userlink'>{{ username }}</a>{{& badge }}</div>\t\t{{# links }}\t\t<div class='links'>\t\t\t{{# profile.location }}<span class='contact location'>{{ profile.location }}</span>{{/ profile.location }}\t\t\t{{# profile.twitter_username }}<span class='contact twitter'><a href='//twitter.com/{{ profile.twitter_username }}' target='_blank'>{{ profile.twitter_username }}</a></span>{{/ profile.twitter_username }}\t\t\t{{# profile.website }}<span class='contact webpage'><a href='{{ profile.website }}' target='_blank'>{{ profile.website }}</a></span>{{/ profile.website }}\t\t</div>\t\t{{/ links }}\t\t{{# profile.about }}\t\t<div class='about'>{{ profile.about }}</div>\t\t{{/ profile.about }}\t\t{{# follow_button }}\t</div>\t\t<div class='action-buttons'>\t\t\t<button class='follow-user follow-user-{{ id }}{{# follow_status }} active{{/ follow_status }}' title='{{#follow_status}}Unfollow{{/follow_status}}{{^follow_status}}Follow{{/follow_status}}' data-id='{{ id }}'>\t\t\t\t<span class='follow'>Follow</span>\t\t\t\t<span class='following'>Followed</span>\t\t\t\t<span class='unfollow'>Unfollow</span>\t\t\t</button> \t\t\t<button class='message-user message active' title='Send message' data-id='{{ id }}' data-username='{{ username }}'><span class='message'>Message</span></button>\t\t</div>\t\t{{/ follow_button }}\t</div></div>"}
function follow(a){runOrSignIn(function(){var b=$(a.currentTarget),c=b.data("id");if(!b.is(".self")){var d=b.is(".active")?0:1;$.ajax({url:"/social/follow-the-user/",type:"POST",data:{targetId:c,follow:d}}).done(function(){$(".follow-user-"+c).toggleClass("active").attr("title",d?"Unfollow":"Follow")})}})}$("body").on("click","button.follow-user",follow);
TradingView.keyboardBinder=function(){function a(a){c.forEach(function(b,f){b.name===a&&c.splice(f,1)})}function b(a){for(var b=0;b<c.length;b++)if(c[b].name===a)return b}var c=[];$(window).on("keypress",function(a){for(var b=c.length-1;0<=b&&!0!==c[b].func(a);b--);});return{registerListener:function(a,e){var f={name:a,func:e},g=b(f.name);g?c[g]=f:c.push(f)},removeListener:function(b){a(b)},pushBackListener:function(a,e){var f={name:a,func:e},g=b(f.name);g&&c.splice(g,1);c.unshift(f)}}}();
function chartRelationButtons(a){var b=a.closest("[data-chart-id]").data("chart-id");if(!b)throw Error("chartRelationButtons can`t find data-chart-id attribute");a.on("click",".agree",function(a){function d(){e.toggleClass("active",f)}a.preventDefault();var e=$(this),f=e.hasClass("active");runOrSignIn(function(){e.toggleClass("active",!f);$.post("/vote-for-chart/",{id:b,vote:1}).done(function(a){if(a.error)return d();void 0!==a.result_score&&e.text(a.result_score||"").toggleClass("with-counter",0!==
a.result_score)}).fail(d)})});a.on("click",".fav",function(a){function d(){e.toggleClass("active",f)}a.preventDefault();var e=$(this),f=e.hasClass("active");runOrSignIn(function(){e.toggleClass("active",!f);$.post(f?"/remove-from-favorites/":"/add-to-favorites/",{id:b}).done(function(a){if(a.error)return d();void 0!==a.followers&&e.text(a.followers||"").toggleClass("with-counter",0!==a.followers)}).fail(d)})})}
function makeTextContainerEditable(a,b,c){function d(b){a.removeClass("tv-editable-active").on("click",function(){f(c)}).off("mousedownoutside");b&&a.empty().text(b)}function e(b){a.addClass("tv-editable-active").off("click").on("mousedownoutside",function(){d(b)})}function f(c){var f={okButtonText:$.t("OK"),okButtonClass:"tv-button ok",cancelButtonText:$.t("Cancel"),cancelButtonClass:"tv-button cancel"};c=$.extend({},f,c);var k=a.text(),f=Modernizr.touch?"":k,m="textarea"===c.replaceWith?$("<textarea"+
(c.inputClass?'class="'+c.inputClass+'" ':"")+"></textarea>"):$('<input type="text" '+(c.inputClass?'class="'+c.inputClass+'" ':"")+'value="">');m.val(f);var f=$('<div class="buttons"></div>'),n=$('<div class="'+c.okButtonClass+'">'+c.okButtonText+"</div>").appendTo(f),q=$('<div class="'+c.cancelButtonClass+'">'+c.cancelButtonText+"</div>").appendTo(f);e(k);var l="function"===typeof c.onCancel?function(){c.onCancel();d()}:function(){d(k)},s=function(a,c,e){/^\s+$/.test(c)&&(c="");m.attr("disabled",
"disabled");n.addClass("process");b(a,c,e,function(){d()})};n.click(function(b){b.preventDefault();b.stopPropagation();s(a,m.val(),k)});q.click(function(a){a.preventDefault();a.stopPropagation();l()});m.keyup(function(b){b.preventDefault();b.stopPropagation();13!=b.keyCode||b.shiftKey?27==b.keyCode&&l():s(a,m.val(),k)});a.empty().append(m,f);m.select()}!a instanceof $?console.error("$container should be jQuery object"):b?"function"!=typeof b?console.error("onOk should be function"):(a.addClass("tv-editable"),
d()):console.error("onOk required")}
function changeUserProfileField(a){function b(a){var b=Array.prototype.slice.call(arguments);b.shift();"function"===typeof a&&a.apply(this,b)}if(a&&a.name&&"string"==typeof a.value){var c={};c[a.name]=a.value;$.post("/accounts/change_any_data/",c,function(c){c.ok?(c=c[a.name],user[a.name]=c,b(a.onSuccess,c)):c.error&&b(a.onError,c.error)}).error(function(c){b(a.onError,c.responseText)}).always(function(){b(a.onComplete)})}else console.warn("Required options.name and options.value")}
TradingView.timezoneIsAvailable=function(a){for(var b=0;b<TradingView.availableTimezones.length;b++)if(a===TradingView.availableTimezones[b].id)return!0;return!1};TradingView.showChangeUserStatusDialog=function(){runOrSignIn(function(){TVDialogs.showChangeUserStatusDialog()});return!1};
TradingView.getUrlParams=function(){for(var a,b=/\+/g,c=/([^&=]+)=?([^&]*)/g,d=window.location.search.substring(1),e={};a=c.exec(d);)e[decodeURIComponent(a[1].replace(b," "))]=decodeURIComponent(a[2].replace(b," "));return e};function setTrialAvailiable(a){window.localStorage&&(window.localStorage.trial_availiable=a?1:0)}function translatedIntervalString(a){var b=a.match(/(.*)([DWM])/);return b?b[1]+$.t(b[2],{context:"dates"}):a}
function capitalizeFirstLetter(a){return a.charAt(0).toUpperCase()+a.slice(1)}TradingView.formatDollarValue=function(a){a=a.toFixed(2);return 0<=a?"$"+a:"-$"+Math.abs(a)};GlobalEventsStorage=new function(){this._delegates={};this._delegateByName=function(a){this._delegates.hasOwnProperty(a)||(this._delegates[a]=new Delegate);return this._delegates[a]};this.subscribe=function(a,b){this._delegateByName(a).subscribe(null,b)};this.emit=function(a,b){this._delegateByName(a).fire(b)}};var TVSettings=function(){function a(a,b,c){a=c?localStorage[s+"."+a]:u[a];return void 0===a||null===a?b:a}function b(a){delete u[a];e(a);localStorage.removeItem(s+"."+a);return this}function c(){t=void 0;!B&&z.length&&(f(),B=setTimeout(d,l))}function d(){B=void 0;z.length&&!t&&c()}function e(a){window.is_authenticated&&(z.push(a),t&&clearTimeout(t),t=setTimeout(c,q))}function f(){if(window.is_authenticated&&0!==z.length){var a=z;z=[];for(var b={},c=a.length;c--;){var d=a[c],f=u[d];void 0===f&&(f=
null);b[d]=f}$.post("/savesettings/",{delta:JSON.stringify(b)},function(b){b.error&&a.forEach(e)}).fail(function(){a.forEach(e)})}}function g(a){if(!a)return Object.keys(u);a=[];for(var b=s+".",c=localStorage.length;c--;){var d=localStorage.key(c);d.substring(0,b.length)===b&&a.push(d.substring(b.length))}return a}var h=!1;try{h=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(k){}if(h){var m={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},
h=function(a,b,c){a=m[a];return null===a||void 0===a?b:a},n=new Function;return{loaded:!1,loadedModel:!1,getValue:h,getJSON:h,getBool:h,getFloat:h,getInt:h,setValue:n,setJSON:n,remove:n,moveFromLocalStorage:n,restoreDefaults:n,keys:function(){return Object.keys(m)},keysMask:function(){return[]},merge:n}}var q=500,l=5E3,s="tradingview",u={},z=[],t,B;g(!0).forEach(function(a){/^study_Script\$USER.*@tv-scripting$/.test(a)&&!/^study_Script\$USER;[0-9a-zA-Z]{32}@tv-scripting$/.test(a)&&b(a)});return{loaded:!1,
loadedModel:!1,getValue:a,getJSON:function(c,d,e){e=a(c,void 0,e);if(void 0===e||null===e)return d;try{return JSON.parse(e)}catch(f){return b(c),d}},getBool:function(b,c,d){d=a(b,void 0,d);if(void 0===d||null===d)return c;if("true"!==d&&"false"!==d)throw new TypeError('"'+d+'" is not bool (key: "'+b+'")');return"true"===d},getFloat:function(b,c,d){d=a(b,void 0,d);if(void 0===d||null===d)return c;c=parseFloat(d);if(!isFinite(c))throw new TypeError('"'+d+'" is not float (key: "'+b+'")');return c},getInt:function(b,
c,d){d=a(b,void 0,d);if(void 0===d||null===d)return c;c=parseInt(d,10);if(!isFinite(c))throw new TypeError('"'+d+'" is not int (key: "'+b+'")');return c},setValue:function(a,b){strValue=""+b;u[a]!==strValue&&(u[a]=strValue,e(a),localStorage[s+"."+a]=b);return this},setJSON:function(a,b){var c=JSON.stringify(b);u[a]!==c&&(u[a]=c,e(a),localStorage[s+"."+a]=c);return this},remove:b,moveFromLocalStorage:function(){var a=s.length,b,c;if(Modernizr.localstorage)for(var d=0;d<localStorage.length;d++)b=localStorage.key(d),
c=b.substring(a+1),b.substring(0,a+1)===s+"."&&null==u[c]&&(e(c),u[c]=localStorage.getItem(b))},restoreDefaults:function(){for(var a=0;a<localStorage.length;a++){var b=localStorage.key(a);b.substring(0,s.length+1)===s+"."&&(z=[],localStorage.removeItem(b))}$.post("/restoredefaults/",{},function(a){TVDialogs.showNotice("Success","Defaults has been successfully restored")}).error(function(a){})},keys:g,keysMask:function(a,b){var c=g(b),d=[];a=RegExp("^"+RegExpEscape(a).replace(/\\\*\\\*/gi,".+").replace(/\\\*/gi,
"[^.]+")+"$","gi");for(var e=c.length-1;0<=e;e--)a.test(c[e])&&d.push(c[e]),a.lastIndex=0;return d},merge:function(a){for(var c=g(!0),d=c.length;d--;){var e=c[d];/^savedwatch\./.test(e)&&(delete u[e],localStorage.removeItem(s+"."+e))}for(e in a)/^study_Script\$USER.*@tv-scripting$/.test(e)&&!/^study_Script\$USER;[0-9a-zA-Z]{32}@tv-scripting$/.test(e)&&(delete a[e],b(e));for(var f in a)u[f]=a[f],c=s+"."+f,localStorage.getItem(c)!==a[f]&&localStorage.setItem(c,a[f])}}}();TradingView.Environment=function(){if("www.tradingview.com"==location.host||"dwq4do82y8xi7.cloudfront.net"==location.host)return"battle";if("beta.tradingview.com"==location.host||"beta2.tradingview.com"==location.host)return"staging";if(location.host.match(/webcharts/))return"staging_local";location.host.match(/^localhost(:\d+)?$/);return"local"};TradingView.Environment.isLocal=function(){return"local"==this()};TradingView.Environment.isProd=function(){return"battle"==this()};
TradingView.Environment.isDebug=function(){return!this.isProd()};TradingView.LOGLEVEL_NORMAL=1;TradingView.LOGLEVEL_DEBUG=2;TradingView.LOGHISTORY=[];TradingView.LOGHISTORY_LENGTH=50;TradingView.getLogLevel=function(){return TVSettings.getInt("log_level",TradingView.LOGLEVEL_NORMAL)};TradingView.loggingOn=function(){TVSettings.setValue("log_level",TradingView.LOGLEVEL_DEBUG);TradingView.logNormal("Debug logging enabled")};TradingView.loggingOff=function(){TVSettings.setValue("log_level",TradingView.LOGLEVEL_NORMAL);TradingView.logNormal("Debug logging disabled")};
TradingView.log=function(){var a;setInterval(function(){a=null},1E3);return function(b,c){c!=a&&("\n"!=c&&TradingView.LOGHISTORY.unshift(c),TradingView.LOGHISTORY.length>TradingView.LOGHISTORY_LENGTH&&TradingView.LOGHISTORY.pop(),"undefined"!==typeof console&&console.log&&b<=TradingView.getLogLevel()&&(a=c,console.log(c)))}}();TradingView.logNormal=function(a){TradingView.log(TradingView.LOGLEVEL_NORMAL,a)};TradingView.logDebug=function(a){TradingView.log(TradingView.LOGLEVEL_DEBUG,a)};
TradingView.remoteDebug=function(){var a={arguments:JSON.stringify(Array.prototype.slice.call(arguments))};$.ajax("/remote_debug/",{data:a})};TradingView.remoteDebugTouch=function(){Modernizr.touch&&this.remoteDebug.apply(this,arguments)};if(TradingView.Environment.isProd()&&"undefined"!==typeof console){var noop=function(){};TradingView.remoteDebug=noop};(function(a){function b(b,d){this.container=a(b);this.options=d||{};!this.options.callbacks&&(this.options.callbacks={});this.column_num=0;this.items=[];this.init();a(window).on("resize",a.proxy(this.resize,this))}b.prototype.fireCallback=function(a,b){if("function"===typeof this.options.callbacks[a])this.options.callbacks[a](b)};b.prototype.resize=function(){this.columnsCount!=this.calculateColumnsCount()&&(this.options.fixHeightOnRecalculate&&this.container.css({height:this.container.height()}),
this.removeColumns(),this.init(!0),this.options.fixHeightOnRecalculate&&this.container.css({height:"auto"}))};b.prototype.getItems=function(){return this.container.find("> "+this.options.itemsSelector).toArray()};b.prototype.addItems=function(a,b){this.items=this.items.concat(a);this.balance(a,b)};b.prototype.balance=function(a,b){switch(this.options.balanceType){case "height":this.balanceHeight(a,b);break;default:this.balanceSimple(a,b)}};b.prototype.balanceHeight=function(b,d){var e=this;this.columns.forEach(function(a){!a.fragment&&
(a.fragment=document.createDocumentFragment())});a.each(b,function(b,c){var h=a(c),k=h.data("cb-height")||h.outerHeight(!0);if(k)h.data("cb-height",k);else throw"Cant get item height";var m=null;if(h.hasClass("two-columns-item")){e.columns.sort(TradingView.sortMultipleFunction("index"));if(2<this.columnsCount)for(var m=null,n,h=this.columns.length-1;0<h;h--){var q=Math.abs(this.columns[h].height-this.columns[h-1].height);if(null===m||q<=m)m=q,n=h-1}else n=0;m=this.columns[n];n=this.columns[n+1];h=
k;q=0;m.height>n.height?h+=m.height-n.height:q=n.height-m.height;var l=document.createElement("div");l.style.height=h+"px";l.className="empty-space";n.fragment.appendChild(l);n.height+=h;q&&(l=document.createElement("div"),l.style.height=q+"px",l.className="empty-space",m.fragment.appendChild(l),m.height+=q)}else e.columns.sort(TradingView.sortMultipleFunction("height","index")),m=e.columns[0];!e.options.maxRow||this.row_num<e.options.maxRow?(m.height+=k,m.fragment.appendChild(c)):d&&e.container[0].removeChild(c)}.bind(this))};
b.prototype.balanceSimple=function(b,d){var e=this;a.each(b,function(a,b){var c=e.columns[this.column_num];!c.fragment&&(c.fragment=document.createDocumentFragment());!e.options.maxRow||this.row_num<e.options.maxRow?(c.fragment.appendChild(b),c.count++):d&&e.container[0].removeChild(b);++this.column_num>=e.columnsCount&&(this.row_num++,this.column_num=0)}.bind(this))};b.prototype.init=function(a){this.row_num=this.column_num=0;this.columnsCount=this.calculateColumnsCount();this.createLayout(this.columnsCount);
a?this.balance(this.items,!1):this.addItems(this.getItems(),!0);this.pushFragmentsToColumns()};b.prototype.calculateColumnsCount=function(){var a=this.container.width(),b=this.options;if(!a)throw"Can't get container width.";for(var e=Math.floor(a/b.columnWidth);0<=e&&e*b.columnWidth+(e-1)*b.gap>a;)e--;return e};b.prototype.createLayout=function(b){this.columns=[];for(var d=document.createDocumentFragment(),e=0;e<b;e++){var f=a('<div class="cb-column"></div>');this.columns.push({target:f,count:0,height:0,
index:e});d.appendChild(f[0])}this.container.prepend(d)};b.prototype.pushFragmentsToColumns=function(a){for(var b=this.columns.length,e=0;e<b;e++){var f=this.columns[e];if(a)for(var g=0;g<f.fragment.childNodes.length;g++)f.fragment.childNodes[g].className+=" show-animate animate-init";f.target.append(f.fragment);delete f.fragment}var h=this;a&&setTimeout(function(){h.container.find(".animate-init").removeClass("animate-init")},1)};b.prototype.removeColumns=function(){this.columns.forEach(function(a){a.target.detach()})};
b.prototype.rescan=function(){this.addItems(this.getItems(),!0);this.pushFragmentsToColumns()};b.prototype.reset=function(){this.items=[];this.removeColumns();this.init()};a.fn.columnsBalancer=function(c){if(a(this).length)return new b(a(this),c);var d=[];a(this).each(function(){d.push(new b(a(this),c))});return d}})(jQuery);TVDialogs={modalDialog:null,dialogs:[],messageInterval:null,messageDelay:4E3,NOTIFICATION_ANIMATION_START_OFFSET:"-33px",_constrainDraggableOptionsIfNeeded:function(a){TradingView.isRunningChartingLibrary&&(a.containment=".chart-page");return a},showIntervalMismatchDialog:function(a){var b;b=!1;TVDialogs.createModalDialog("Interval is not applicable");var c=TVDialogs.modalDialog;c.css({zIndex:1E3});c.find(".tv-dialog").css("width","400px");c=TVDialogs.modalDialog.find(".tv-dialog-content");c.html('<div class="main"><div class="caption-big"><p>Only <b>D, W, M</b> intervals are supported for this symbol/exchange. You will be automatically switched to a D interval. Intraday intervals are not available because of exchange policies.</p></div><div class="main-properties"></div></div>');
c=c.find(".main-properties");c=$('<div class="dialog-buttons"></div>').appendTo(c);if(a){var d=$('<label class="dialog-trail-checkbox"><input type="checkbox" /> Do not show this message again</label>').appendTo(c).find("input");d.attr("checked",a.silentIntervalChange.value());d.bind("click",function(){a.silentIntervalChange.setValue(this.checked)})}$('<a class="tv-button ok">OK</a>').appendTo(c).bind("click",function(){TVDialogs.destroy()});TVDialogs.positionDialog();TVDialogs.applyHandlers(!1,b)},
showSignInDialog:function(a,b){function c(a){switch(a){case "signup":case "register":break;case "signup-trial":a="signup-trial";break;case "recover":a="recover";break;default:a="signin"}d.find('[name="signup_trial"]').val("signup-trial"==a?1:0);d.find(".show-if-signin, .show-if-signup, .show-if-recover, .show-if-signup-trial").not(".show-if-"+a).hide();d.find(".show-if-"+a).show().find("input:eq(0)").focus();TVDialogs.positionDialog()}if(!is_authenticated){"function"==typeof a?TVDialogs.onSigninSuccess=
a:delete TVDialogs.onSigninSuccess;TVDialogs.createModalDialog("Log in",{noHeader:!0,addClass:"auth-dialog",appearance:"flat"});var d=TVDialogs.modalDialog.find(".tv-dialog-content");d.html(TradingView.templates.dialogs.auth);c(b&&b.mode);d.find(".recover-link").on("click",function(a){c("recover");a.preventDefault()});d.find(".signup-link").on("click",function(a){c("signup");a.preventDefault()});d.find(".signin-link").on("click",function(a){c("signin");a.preventDefault()});d.find(".auth-dialog-field").each(function(){function a(){c.toggleClass("empty",
!c.val());d=!1}var b=$(this).find(".auth-dialog-field-placeholder"),c=$(this).find("input"),d=!1;a();c.on("blur",function(){b.toggleClass("disabled",!!this.value)});c.on("keypress keydown keyup input paste",function(){d||(d=!0,setTimeout(function(b){a()},0))})});"stocktwits google facebook twitter linkedin yahoo".split(" ").forEach(function(a){var c="/accounts/signin/"+a+"/";d.find(".auth-dialog-social-"+a).on("click",function(a){b&&"signup-trial"==b.mode&&$.cookie("will_start_trial",1,{path:"/"});
a.preventDefault();window.open(c,"_blank")})});d.find("#signin-form").on("submit",function(a){a.preventDefault();var b=$(this).find('[type="submit"]').addClass("process");TVDialogs.submit(function(a){""!==a.error?TVDialogs.showError("Error: "+a.error):(TVDialogs.destroy(),user=a.user,changeLoginState(!0),"function"==typeof TVDialogs.onSigninSuccess&&(TVDialogs.onSigninSuccess(),delete TVDialogs.onSigninSuccess),"undefined"!==typeof next&&next&&(location.href=next));b.removeClass("process")},this)});
d.find("#signup-form").on("submit",function(a){var b=this;a.preventDefault();var c=$(b).find('[type="submit"]').addClass("process");TVDialogs.submit(function(a){$(".tv-dialog input").removeClass("error");$(".tv-dialog-field-error").hide();if(""!==a.errors)if("object"==typeof a.errors){for(var d in a.errors)$(b).find("input[name^="+d+"]").addClass("error").data("error",a.errors[d][0]);$(".tv-dialog input.error").first().focus();TVDialogs.showError($(".tv-dialog input.error").first().data("error"))}else TVDialogs.showError("Error: "+
a.errors);else TVDialogs.showNotice("Activate Your Account",a.message);c.removeClass("process")},b)});d.find("#recover-form").on("submit",function(a){a.preventDefault();var b=TVDialogs.modalDialog;TVDialogs.submit(function(a){""!==a.error?TVDialogs.showError("Failed: "+a.error):(TVDialogs.showMessage("New password is sent to your email."),setTimeout(function(){TVDialogs.modalDialog===b&&TVDialogs.destroy()},TVDialogs.messageDelay))},this)});TVDialogs.positionDialog();TVDialogs.applyHandlers(null)}},
showPublishIntroDialog:function(a){var b=$.Deferred(),c=TVSettings.getBool("publish.showIntroText",!0);if(a||c){a=TVDialogs.createDialog("Please read before publishing");var d=!1;a.css({width:"750px","z-index":130});a.find(".tv-dialog-content").html(Mustache.render(TradingView.templates.dialogs.publishIntro,{do_not_show:!c}));a.draggable(TVDialogs._constrainDraggableOptionsIfNeeded({handle:".tv-dialog-title"}));a.find('input[name="donotshow"]').on("change",function(a){TVSettings.setValue("publish.showIntroText",
!$(this).is(":checked"))});$("#publish-intro-continue").click(function(){TVDialogs.destroy("Please read before publishing");b.resolve()});a.on("destroy",function(){d=!0;setTimeout(b.resolve,0)});b.always(function(){d||TVDialogs.destroy("Please read before publishing")});TVDialogs.positionDialog(a);TVDialogs.applyHandlers(a)}else b.resolve();return b},showPublishChartDialog:function(a){function b(){e.find(".publish-related").tvtags("extractTags");var b={name:e.find('[name="name"]').val(),description:e.find('[name="description"]').val(),
tags:e.find(".publish-tags").tvtags("extractTags").tvtags("tagsWithPending").join(","),twitter:e.find('input[name="twitter"]').is(":checked")?"1":"",stocktwits:e.find('input[name="stocktwits"]').is(":checked")?"1":"",chat:e.find('input[name="chat"]').is(":checked")?"1":"",direction:e.find('input[name="direction"]').val(),is_public:e.find('input[name="public"]').is(":checked")?"1":"",related_charts:e.find(".publish-related").tvtags("extractTags").tvtags("tagsWithPending").join(",")},c={publishAllLayout:e.find('[name="publish_entire_layout"]').is(":checked")};
if(!b.name.trim())TVDialogs.showError("Chart title is required",e),e.find('[name="name"]').focus();else if(!b.description.trim())TVDialogs.showError("Chart description is required",e),e.find('[name="description"]').focus();else if(!isLatin(b.name)||!isLatin(b.description))TVDialogs.showError(m);else if(!isLatin(b.tags))TVDialogs.showError("Please use only English in tags");else if(a.onPublish)a.onPublish(b,c)}function c(){e.show();var b=TVSettings.getJSON("publishchart.size",{w:s,h:u});e.height(Math.max(Math.min(b.h,
0.9*$(window).height()),u));e.width(Math.max(Math.min(b.w,0.9*$(window).width()),s));k();TVDialogs.positionDialog(e);if(a.onShow)a.onShow()}function d(){e.hide();if(a.onMinimize)a.onMinimize()}var e=TVDialogs.createDialog("Publish Idea",{addClass:"publish-dialog",hideCloseCross:!0});e.css("width","700px");var f=e.find(".tv-dialog-content");f.html(Mustache.render(TradingView.templates.dialogs.publishChart,user));var g=e.find(".tv-dialog-title"),h=$('<a class="tv-dialog-title-minimize"></a>').appendTo(g);
$('<span class="tv-dialog-readbefore"><a>Read before publishing</a></span>').appendTo(g);e.draggable(TVDialogs._constrainDraggableOptionsIfNeeded({handle:g}));var k=function(){var a=f.find('textarea[name="description"]'),b=e.find(".tv-dialog-title").outerHeight();f.children(".main, *[class^=main-]").eq(0);return function(){a.css("height",e.height()-b-f.height()+a.height())}}();e.on("resize",function(a){a.stopPropagation();a.preventDefault();k()});var m="TradingView is only for English-language content at this time.";
$("#publish-chart-form").submit(function(a){a.preventDefault();b()});$("#publish-dialog-do-publish").click(function(a){a.preventDefault();b()});e.find('input[name="public"]').on("change",function(a){$(this).is(":checked")||(user.is_pro?(n.prop("checked",!1).change(),q.prop("checked",!1).change()):($(this).attr("checked",!0),TVDialogs.showGoProDialog({feature:"privateCharts"})))});var n=e.find('input[name="twitter"]'),q=e.find('input[name="stocktwits"]');n.change(function(){n.is(":checked")&&(q.prop("checked",
!1).change(),user.has_twitter||window.open("/accounts/permission/twitter/","twitter_permission_request","scrollbars=yes,height=400,width=700").focus())});q.change(function(){q.is(":checked")&&(n.prop("checked",!1).change(),authInStocktwits())});f.on("mousedown",".publish-direction-buttons .tv-button",function(){var a=$(this);$(".publish-direction-buttons .tv-button").removeClass("active");a.addClass("active");e.find('input[name="direction"]').val(a.data("val"))});e.find(".tv-dialog-readbefore a").on("click",
function(a){a.preventDefault();TVDialogs.showPublishIntroDialog(!0)});(function(){function b(a){a=new Date(a);return[a.getFullYear(),("0"+a.getMonth()).substr(-2),("0"+a.getDate()).substr(-2)].join("-")}function c(a){return(/([0-9A-Za-z-]+)\/?$/.exec(a)||0)[1]}var d={},f=e.find(".publish-related");a.related&&f.val([].concat(a.related).join(","));f.tvtags("init",{suggest:function(a,b){var e=location.protocol+"//"+location.host+"/v/";a.substr(0,e.length)===e&&(a=c(a)||a);$.ajax("/ideas-json/",{data:{search:a},
dataType:"json"}).done(function(a){a=a||[];a.forEach(function(a){d[a.image_url]=a;a.str=e+a.image_url+"/"});b(a)}).error(function(){b(null)})},formatSuggest:function(a){var c=$(document.createElement("span")).addClass("date").text(b(1E3*a.created)+" "),d=$(document.createElement("strong")).text(a.name);a=$(document.createTextNode(" "+[a.short_name||a.pro_symbol,a.resolution].join(", ")));return{content:$().add(c).add(d).add(a)}},validate:function(a,b){var e=c(a);e?d[e]?b(!0):$.ajax("/ideas-json/"+
e+"/",{dataType:"json"}).done(function(a){a&&a.length?(d[a[0].image_url]=a[0],b(!0)):b(!1)}).error(function(){b(!1)}):b(!1)},transform:c,format:function(a){a=a.str;var b=d[a];return b&&a?b.name:"Idea"},keys:["\n",",",/\s/,";"],separator:","}).on("change",k)})();e.find(".publish-tags").tvtags("init",{keys:["\n",",",/\s/,";"],separator:",",addClass:"no-arrow with-ears",format:function(a){return{str:a.str,addClass:"tag"}},suggest:function(a,b){a||b(null);$.ajax("/tags-json/",{data:{search:a},dataType:"json"}).done(function(a){b(a)}).error(function(){b(null)})},
maxLength:64}).on("change",k);var l=[];a.chartWidgetCollection&&function(){function b(){var a=h.value().model();return a?(a=a.mainSeries(),(a.properties().shortName.value()||a.symbol())+" ("+a.interval()+")"):"Active Chart"}function c(){d.toggleClass("hidden",!("s"!==g.value()&&!k.value()));q.is(":checked")?(s.text("All Charts"),n.attr({"class":"tv-dialog-layout-button tv-dialog-layout-"+g.value()})):(s.text(b()),n.attr({"class":"tv-dialog-layout-button tv-dialog-layout-s"}))}var d=f.find(".tv-dialog-layoutpicker"),
g=a.chartWidgetCollection.layout.spawn(),h=a.chartWidgetCollection.activeChartWidget.spawn(),k=a.chartWidgetCollection.maximizeCurrentChart.spawn(),m=TradingView.Linking.symbol.spawn();l=[g,h,k,m];var n=$('<span class="tv-dialog-layout-button">'),q=$('<input type="checkbox" name="publish_entire_layout">').hide().appendTo(n);$('<i class="icon"></i>').appendTo(n);var s=$("<span></span>").appendTo(n);$('<span class="arrow-icon"></span>').appendTo(n);g.subscribe(c);h.subscribe(c);k.subscribe(c);m.subscribe(c);
c();TradingView.bindPopupMenu(n,function(){var a=q.is(":checked");return[{addClass:"tv-dialog-layout-popup tv-dialog-layout-s",title:"Publish Only "+b(),action:function(){q.attr("checked",!1);c()},active:!a,icon:!0},{addClass:"tv-dialog-layout-popup tv-dialog-layout-"+g.value(),title:"Publish All Charts",action:function(){q.attr("checked",!0);c()},active:a,icon:!0}]},{direction:"up"});n.appendTo(d);e.on("destroy",function(){for(var a=0;a<l.length;a++)l[a].destroy()})}();e.find(".tv-dialog-cancel-button").on("click",
function(a){a.preventDefault();TVDialogs.showConfirm("Cancel publication","Are you sure you want to abandon your post?",function(){TVDialogs.destroy("Publish Idea")})});if(a.onDestroy)e.on("destroy",a.onDestroy);var s=e.width(),u=e.height();e.resizable({handles:"se",minHeight:u,minWidth:s,stop:function(){TVSettings.setJSON("publishchart.size",{w:e.width(),h:e.height()})}});TVDialogs.applyHandlers(e,!0,!0,!0);h.on("click",function(a){a.preventDefault();d()});c();return{dialog:e,show:c,hide:d,close:function(){TVDialogs.destroy("Publish Idea")}}},
showGoProDialog:function(a){a||(a={});TVDialogs.createModalDialog("",{noHeader:!0,addClass:"gopro-dialog ",appearance:"flat"});var b=TVDialogs.modalDialog;b.css({zIndex:1E3});b=b.find(".tv-dialog-content");b.html(Mustache.render(TradingView.templates.dialogs.goPro.layout,{trialButton:TradingView.Conversion&&TradingView.Conversion.trialAvailable&&TradingView.Conversion.trialAvailable(),exchangesButton:a.exchangesButton,exchange:a.exchange}));var c=b.find(".col-main .col-copy");a=a.feature?Mustache.render(TradingView.templates.dialogs.goPro.features[a.feature],
{exchangesButton:a.exchangesButton,exchange:a.exchange}):TradingView.templates.dialogs.goPro.defaultCopy;c.html(a);b.find(".yes-button").on("click",function(a){this.href===location.href&&a.preventDefault();TVDialogs.destroy()});b.find(".no-button").on("click",function(a){a.preventDefault();TVDialogs.destroy()});TVDialogs.positionDialog();TVDialogs.applyHandlers(null)},showAddSymbolDialog:function(a,b){b=$.extend({},{title:"Add Symbol",callback:function(a,b){},overlayOption:!1,overlayOptionChecked:TVSettings.getBool("showAddSymbolDialog.checkboxState",
!0),okButtonTitle:"Add Symbol"},b||{});var c=TVDialogs.createDialog(b.title);c.css("min-width",0);c.find(".tv-dialog-content").html(Mustache.render(TradingView.templates.dialogs.addSymbol,b)).css("min-width",0);TVDialogs.applyHandlers(c);var d=$('<div class="symbol-edit-widget"></div>'),e=$('<input type="text" class="symbol-edit single" placeholder="Symbol" maxlength="30" style="text-transform: none; font-weight: normal;" autocomplete="off">').appendTo(d),f=TradingView.SymbolSearch.bindToInput(e,
{callback:function(a){var d=c.find("#tv-dialog-addsymbol-overlay-checkbox").is(":checked");if(a){var e=b.callback;e(a,d);$(window).off("keyup.addOverlay");TVDialogs.destroy(c.data("title"))}}});c.find("div.symbol-edit-place").replaceWith(d);c.find(".tv-dialog").draggable(TVDialogs._constrainDraggableOptionsIfNeeded({handle:".tv-dialog-title"}));c.find("input[type=checkbox]").on("change",function(a){TVSettings.setJSON("showAddSymbolDialog.checkboxState",a.target.checked)});c.find(".ok").on("click",
function(){f.acceptTypeIn()});c.show();TVDialogs.positionDialog(c);e.focus()},showProRTTrialOffer:function(a){TVDialogs.createModalDialog("",{noHeader:!0,addClass:"prorttrial-dialog ",appearance:"flat"});var b=TVDialogs.modalDialog;b.css({zIndex:1E3}).find(".tv-dialog");b=b.find(".tv-dialog-content");b.html(Mustache.render(TradingView.templates.dialogs.proRTTrialOffer));b.find("a.trial").on("click",function(b){b.preventDefault();if(a&&a.callbacks&&a.callbacks.onAccept)a.callbacks.onAccept()});b.find("a.nothanks").on("click",
function(b){b.preventDefault();if(a&&a.callbacks&&a.callbacks.onDecline)a.callbacks.onDecline()});b.find("a.ordernow").on("click",function(b){b.preventDefault();if(a&&a.callbacks&&a.callbacks.onOrder)a.callbacks.onOrder()});b.find("a.later").on("click",function(b){b.preventDefault();if(a&&a.callbacks&&a.callbacks.onRemindLater)a.callbacks.onRemindLater()});TVDialogs.positionDialog();TVDialogs.applyHandlers(null,!0,!0)},showTrialMessage:function(a){TVDialogs.createModalDialog("",{noHeader:!0,addClass:"prorttrial-dialog ",
appearance:"flat"});var b=TVDialogs.modalDialog;b.css({zIndex:1E3}).find(".tv-dialog");b=b.find(".tv-dialog-content");b.html('<div class="main"><h3 class="title"></h3><div class="copy"></div><div class="big-buttons"><a href="javascript://" class="big-button ok">OK</a></div></div>');var c=b.find(".title"),d=b.find(".copy"),e=b.find(".big-button.ok"),f=b.find(".big-buttons");a&&a.title?c.html(a.title):c.remove();a&&a.copy?d.html(a.copy):d.remove();a&&a.closeButtonCopy&&e.html(a.closeButtonCopy);a&&
a.replaseCloseBtn&&f.html(a.replaseCloseBtn);b.find("a.ok").on("click",function(b){a&&a.replaseCloseBtnFunc?a.replaseCloseBtnFunc(b):(b.preventDefault(),TVDialogs.destroy())});TVDialogs.positionDialog();TVDialogs.applyHandlers(null)},showTrialMessageSuccess:function(){TVDialogs.showTrialMessage({title:"PRO Plus Trial",copy:"<p>Your 30-day free PRO Plus accout has been activated. You are now part of a community of 2 million+ ideas that have been created within TradingView charts. To help get the ball rolling, we'd suggest you spend a few minutes familiarizing yourself with our online <a href='/stock-charts-support/'>help section</a>. We hope you enjoy working with TradingView and wish you good trading!</p>",
replaseCloseBtn:"<a href='/e/' class='big-button ok'>LAUNCH CHART</a>",replaseCloseBtnFunc:function(){}})},showTrialConfirmationDialog:function(a){a=a||{};TVDialogs.createModalDialog("",{noHeader:!0,addClass:"trialconfirm-dialog ",appearance:"flat"});var b=TVDialogs.modalDialog;b.css({zIndex:1E3});var c=b.find(".tv-dialog-content");c.html('<div class="main"><h3 class="title">'+(a.title||"Trial confirmation dialog")+'</h3><div class="copy">'+(a.text||"Trial confirmation text")+'</div><div class="actions-block"><a class="no-button">'+
(a.noText||"No, thank you")+'</a><a class="yes-button">START TRIAL</a></div></div>');b=c.find(".no-button");c=c.find(".yes-button");b.on("click",function(b){b.preventDefault();if("function"==typeof a.onCancel)return a.onCancel(b);TVDialogs.destroy()});c.on("click",function(b){if("function"==typeof a.onSubmit)return a.onSubmit(b);b.preventDefault()});TVDialogs.positionDialog();TVDialogs.applyHandlers(null)},showEarlyAccessDialog:function(a){TVDialogs.createModalDialog("",{noHeader:!0,addClass:"prorttrial-dialog ",
appearance:"flat"});var b=TVDialogs.modalDialog;b.css({zIndex:1E3}).find(".tv-dialog");var b=b.find(".tv-dialog-content"),c={};switch(a&&a.reason){case "after 1 week":c.is_1wk=!0;break;case "after 2 weeks":c.is_2wk=!0;break;case "finished":c.is_finished=!0;break;default:c.is_manual=!0}b.html(Mustache.render(TradingView.templates.dialogs.earlyAccess,c));c=null;b.find("a.nothanks").on("click",function(b){b.preventDefault();if(a&&a.callbacks&&a.callbacks.onDecline)a.callbacks.onDecline()});b.find("a.ordernow").on("click",
function(b){b.preventDefault();if(a&&a.callbacks&&a.callbacks.onOrder)a.callbacks.onOrder()});TVDialogs.positionDialog();TVDialogs.applyHandlers(null,!0,!0)},showUnsubscribeConfirmationDialog:function(a,b,c){TVDialogs.createModalDialog(a);TVDialogs.modalDialog.find(".tv-dialog").css("width","450px");TVDialogs.modalDialog.find(".tv-dialog-content").html('<div class="main"><div class="caption-big">Aww, we are sorry to see you go! If you cancel, you will no longer be billed after your current subscription period ends. Your subscription service will continue to be active until the end of the period that you paid for. Sorry, there are no refunds.<br/><br/>If you are sure you want to cancel, click Cancel, otherwise choose Do Not Cancel. If you cancel, we\u2019d really like to know the reason why you are cancelling so we can make things better.</div><textarea style="width: 398px; height: 100px;"></textarea></div><div class="tv-dialogs-bottom tv-dialog-center"><input class="tv-button wide yes" type="button" value="Cancel '+
b+' and send feedback" style="margin-right: 10px;"/><input class="tv-button wide no" type="button" value="Do Not Cancel"/></div>');var d=TVDialogs.modalDialog.find(".yes");d.click(function(){var a=TVDialogs.modalDialog.find("textarea").val();a?(d.addClass("process"),c(a)):TVDialogs.showError("Please enter your feedback")});TVDialogs.modalDialog.find(".no").click(function(){TVDialogs.destroy()});TVDialogs.positionDialog();TVDialogs.applyHandlers()},showChangeUserStatusDialog:function(){var a=TVDialogs.createDialog("Update status");
a.find(".tv-dialog").css("width","400px");a.find(".tv-dialog-content").html('<form><div class="main"><input type="text" name="status" value="'+("string"==typeof window.user.status?window.user.status.replace(/"/g,"&quot;"):"")+'"></div><div class="tv-dialogs-bottom tv-dialog-center"><input class="tv-button wide ok" type="submit" value="OK" style="margin-right: 10px;"/><input class="tv-button wide cancel" type="button" value="Cancel"/></div></form>');var b=a.find(".ok"),c=a.find('[name="status"]');
a.find("form").submit(function(){b.addClass("process");changeUserProfileField({name:"status",value:String(c.val()).replace(/^\s+|\s+$/g,""),onSuccess:function(a){var b=$("#change-profile-status"),c=a?a:"Add status...";b.hasClass("tv-editable-active")?b.find('input[type="text"], textarea').val(c):b.text(c);$('[name="status"]').val(a);TVDialogs.destroy("Update status")},onError:function(a){TVDialogs.showError("We'are sorry, something went wrong. Try to reload page.");console.warn(a)},onComplete:function(){b.removeClass("process")}});
return!1});a.find(".cancel").click(function(){TVDialogs.destroy("Update status")});Modernizr.touch&&c.val("");TVDialogs.positionDialog(a,{considerScroll:!0});TVDialogs.applyHandlers(a);c.focus().select()},showScriptSearchDialog:function(a){function b(){value=e.val();if(value!==h){h=value;f.toggle(!!value);k&&(k.abort&&k.abort(),k=null);g.html('<div class="loading"></div>');var a=TradingView.PublishedScript.suggest(h);k=a;TradingView.PublishedScript.list().done(function(b){a.done(function(d){a===k&&
c(d,b)})})}}function c(a,b){g.empty();a&&(a.length||$('<p class="nothing">No scripts matched your criteria</p>').appendTo(g),a.forEach(function(a){if(a){var c=$('<div class="item">');if(a.author){var e=$('<div class="item-avatar">').appendTo(c);$("<img>").attr({src:"/avatar/"+a.author.id+"/","class":"avatar userlink",alt:a.author.username,"data-username":a.author.username}).appendTo(e)}e=$('<div class="item-buttons"></div>').appendTo(c);$(Mustache.render(TradingView.templates.publishedScriptButton,
{script_id_part:a.scriptIdPart,script_install_count:a.scriptInstallCount,show_script_install_count:!!a.scriptInstallCount,script_in_library:b.some(function(b){return b.scriptIdPart==a.scriptIdPart})})).appendTo(e);if(d){var f=$('<a class="pubscript-try-button" title="Add this study to active chart"><span class="label">Try</span></a>');f.on("click",function(b){b.preventDefault();d(a)});f.appendTo(e)}e=$('<div class="item-main">').appendTo(c);f=$('<div class="item-title">').appendTo(e);$("<a>").attr({href:"/v/"+
a.imageUrl+"/",target:"_blank"}).text(a.scriptName||a.scriptTitle||"Study").appendTo(f);$('<div class="item-desc">').text(a.description||"").appendTo(e);g.append(c)}}))}var d=a.onTry;a=TVDialogs.createDialog("Search for scripts published by community",{width:815,content:TradingView.templates.dialogs.scriptSearch,addClass:"script-search-dialog"});var e=a.find("input[name=q]"),f=a.find(".input-reset"),g=a.find(".script-search-results");f.on("click",function(){e.val("");b()});var h=void 0,k=null;e.on("input keyup change",
b);b();TVDialogs.positionDialog(a);TVDialogs.applyHandlers(a);return a},showPrioritySupportDialog:function(){TVDialogs.showCustomDialog({title:"Priority Support",html:TradingView.templates.dialogs.proiritySupport,noButtons:!0})},showNotice:function(a,b,c,d){c=c||"";d=d||!1;TVDialogs.createModalDialog(a);TVDialogs.modalDialog.find(".tv-dialog").css("width","400px");TVDialogs.modalDialog.find(".tv-dialog-content").html('<div class="main"><div class="caption-big-center '+c+'">'+b+"</div></div>");TVDialogs.positionDialog();
TVDialogs.applyHandlers(!1,d);return TVDialogs.modalDialog},showConfirm:function(a,b,c,d,e){e=e||{};e.dontAskSetting&&TVSettings.getBool(e.dontAskSetting)?c():(TVDialogs.createModalDialog(a,e),TVDialogs.modalDialog.find(".tv-dialog").css("width","400px"),TVDialogs.modalDialog.find(".tv-dialog-content").html('<div class="main"><div class="caption-big">'+b+"</div>"+(e.dontAskSetting?'<input type="checkbox" id="confirm-dialog-checkbox" style="margin: 0; vertical-align: middle;"> <label for="confirm-dialog-checkbox" style="font-size: 11px;">Do not ask again</label>':
"")+'</div><div class="tv-dialogs-bottom tv-dialog-center"><input class="tv-button wide ok" type="button" value="YES" style="margin-right: 10px;"/><input class="tv-button wide cancel" type="button" value="NO"/></div>'),e.okButtonText&&TVDialogs.modalDialog.find(".ok").val(e.okButtonText),e.cancelButtonText&&TVDialogs.modalDialog.find(".cancel").val(e.cancelButtonText),TVDialogs.modalDialog.find(".ok").click(function(){e.dontAskSetting&&$("#confirm-dialog-checkbox").is(":checked")&&TVSettings.setValue(e.dontAskSetting,
!0);c();TVDialogs.destroy()}),TVDialogs.modalDialog.find(".cancel").click(function(){d&&d();TVDialogs.destroy()}),TVDialogs.positionDialog(),TVDialogs.applyHandlers())},showPrompt:function(a,b,c,d,e){function f(){var a=k.val();if(h){var b=h(a);if(b){!0===b&&(b="Wrong value");TVDialogs.showError(b,TVDialogs.modalDialog);return}}TVDialogs.destroy();c&&c(a)}var g=e&&e.defaultValue,h=e&&e.validate;TVDialogs.createModalDialog(a,e);TVDialogs.modalDialog.find(".tv-dialog").css("width","400px");TVDialogs.modalDialog.find(".tv-dialog-content").html('<div class="main"><form><div class="caption-big-center slim">'+
b+': <input type="text" name="prompt-value" class="prompt-value"/></div></form></div><div class="tv-dialogs-bottom tv-dialog-center"><input class="tv-button wide ok" type="button" value="OK" style="margin-right: 10px;"/><input class="tv-button wide cancel" type="button" value="Cancel"/></div>');var k=TVDialogs.modalDialog.find('[name="prompt-value"]');g&&k.val(g);TVDialogs.modalDialog.find("form").submit(function(a){f();a.preventDefault()});TVDialogs.modalDialog.find(".ok").click(function(a){f();
a.preventDefault()});TVDialogs.modalDialog.find(".cancel").click(function(){TVDialogs.destroy();d&&d(value)});TVDialogs.positionDialog();TVDialogs.applyHandlers();setTimeout(function(){k.focus().select()},0)},showCustomDialog:function(a){function b(b){var d=a.action(TVDialogs.modalDialog);d&&!d.error||void 0===d?TVDialogs.destroy():d.error&&TVDialogs.showError(d.error);b.preventDefault()}TVDialogs.createModalDialog(a.title||"Dialog");TVDialogs.modalDialog.find(".tv-dialog").css("width",a.width||"400px");
TVDialogs.modalDialog.find(".tv-dialog-content").html('<div class="main">'+(a.html||"Content")+"</div>"+(a.noButtons?"":'<div class="tv-dialogs-bottom tv-dialog-center">'+(a.noButtonOk?"":'<input class="tv-button wide ok" type="button" value="OK" style="margin-right: 10px;"/>')+(a.noButtonCnacel?"":'<input class="tv-button wide cancel" type="button" value="Cancel"/>')+"</div>"));a.okButtonText&&TVDialogs.modalDialog.find(".ok").val(a.okButtonText);a.cancelButtonText&&TVDialogs.modalDialog.find(".cancel").val(a.cancelButtonText);
TVDialogs.modalDialog.find(".ok").click(b);TVDialogs.modalDialog.find("form").submit(b);TVDialogs.modalDialog.find(".cancel").click(function(){TVDialogs.destroy()});TVDialogs.positionDialog();TVDialogs.applyHandlers();return TVDialogs.modalDialog},createModalDialog:function(a,b){b=b||{};null!==TVDialogs.modalDialog&&TVDialogs.destroy();TVDialogs.modalDialog=$('<div class="tv-dialog-shadowbox"><div class="tv-dialog tv-dialog-modal'+(b.addClass?" "+b.addClass:"")+'">'+(b.noHeader?"":'<div class="tv-dialog-title">'+
(b.noClose?"":'<a class="tv-dialog-title-close"></a>')+'<span class="tv-dialog-title-text">'+a+"</span></div>")+'<div class="tv-dialog-error"></div><div class="tv-dialog-message"></div><div class="tv-dialog-content"></div></div></div>').appendTo($("body")).data("title",a);b.noShadowBox&&TVDialogs.modalDialog.addClass("transparent");b.width&&TVDialogs.modalDialog.find(".tv-dialog").css({width:b.width});b.content&&TVDialogs.modalDialog.find(".tv-dialog-content").html(b.content);b.zIndex&&TVDialogs.modalDialog.css("z-index",
b.zIndex)},createDialog:function(a,b){if(TVDialogs.isOpen(a)){var c=TVDialogs.get(a);c.find(".tv-dialog-content").html("");c.data("new",!1);return c}b=b||{};c=$('<div class="tv-dialog tv-dialog-nonmodal'+(b.addClass?" "+b.addClass:"")+'">'+(b.hideTitle?'<div class="tv-dialog-title tv-dialog-title-hidden">'+(b.hideCloseCross?"":'<a class="tv-dialog-title-close"></a>')+"</div>":'<div class="tv-dialog-title">'+(b.hideCloseCross?"":'<a class="tv-dialog-title-close"></a>')+a+"</div>")+'<div class="tv-dialog-error"></div><div class="tv-dialog-message"></div><div class="tv-dialog-content"></div></div>').appendTo($("body"));
b.width&&c.css({width:b.width});b.content&&c.find(".tv-dialog-content").html(b.content);c.css("z-index",TVDialogs.dialogs.length+110);c.data("new",!0);c.data("title",a);c.data("id",TVDialogs.dialogs.length+1);TVDialogs.dialogs.push({title:a,dialog:c,id:TVDialogs.dialogs.length+1});var d={start:function(a,b){for(var c=b.helper.css("z-index"),d=0,k=null,m=0;m<TVDialogs.dialogs.length;m++){var n=TVDialogs.dialogs[m].dialog.css("z-index");n>d&&(d=n,k=TVDialogs.dialogs[m].dialog)}b.helper.css("z-index",
d);k.css("z-index",c)}};b.dragHandle?d.handle=b.dragHandle:b.hideTitle||(d.handle=".tv-dialog-title");c.draggable(TVDialogs._constrainDraggableOptionsIfNeeded(d));return c},positionDialog:function(a,b){if(a){var c=a.width(),d=a.height(),e=$(window).width(),f=$(window).height();if(b&&b.top&&b.left)a.css({left:Math.max(2,Math.min(e-c-4,b.left))+"px",top:Math.max(2,Math.min(f-d-4,b.top))+"px"});else if(b&&b.considerScroll){var g=$(document);a.css({left:Math.round((e-c)/2+g.scrollLeft())+"px",top:Math.round((f-
d)/2+g.scrollTop())+"px"})}else a.css({left:Math.round((e-c)/2)+"px",top:Math.round((f-d)/2)+"px"})}else a=TVDialogs.modalDialog,c=a.find(".tv-dialog"),c.css("margin-left",-Math.round(c.outerWidth()/2)+"px"),c.css("margin-top",-Math.round(c.outerHeight()/2)+"px")},applyHandlers:function(a,b,c,d){var e=a&&a!==this.modalDialog?function(){TVDialogs.destroy(a.data("title"))}:function(){TVDialogs.destroy()};a||(a=TVDialogs.modalDialog.find(".tv-dialog"));a.find(".tv-dialog-title .tv-dialog-title-close").on("click",
e);setTimeout(function(){a.on("mousedownoutside",function(c){c=$(c.target).parents().andSelf();d||b&&c.is(".tv-dialog-shadowbox")||c.is(".colorpicker, .charts-popup-list, .tv-dialog, .tvcolorpicker-popup, .symbol-edit-popup")||(a.unbind("mousedownoutside"),e())})},0);a.find('input[type="checkbox"]').change(function(){var a=$(this);a.next(".tv-dialog-checkbox-mask").toggleClass("disabled",a.prop("disabled")).toggleClass("tv-dialog-checkbox-mask-active",a.is(":checked"))});var f=a.find('input[type="text"]').focus(function(){$(this).addClass("tv-dialog-content-textactive")}).blur(function(){$(this).removeClass("tv-dialog-content-textactive")}).first();
Modernizr.touch||f.focus();a.find('input[type="password"]').focus(function(){$(this).addClass("tv-dialog-content-textactive")}).blur(function(){$(this).removeClass("tv-dialog-content-textactive")});a.find("textarea").focus(function(){$(this).addClass("tv-dialog-content-textareaactive")}).blur(function(){$(this).removeClass("tv-dialog-content-textareaactive")});a.find(".tv-dialog-checkbox-mask").click(function(){var a=$(this).prev();a.prop("disabled")||(a.prop("checked",!a[0].checked),a.change())});
$(".tv-dialog .tv-dialog-error").mouseenter(function(){$(this).animate({marginTop:TVDialogs.NOTIFICATION_ANIMATION_START_OFFSET,opacity:0},"fast",function(){$(".tv-dialog .tv-dialog-error").hide()});clearInterval(TVDialogs.messageInterval)});$(".tv-dialog .tv-dialog-message").mouseenter(function(){$(this).animate({marginTop:TVDialogs.NOTIFICATION_ANIMATION_START_OFFSET,opacity:0},"fast",function(){$(".tv-dialog .tv-dialog-message").hide()});clearInterval(TVDialogs.messageInterval)});c||$(window).bind("keyup.hideDialog",
function(b){if("27"==b.keyCode)return a?TVDialogs.destroy(a.data("title")):TVDialogs.destroy(),!1})},showError:function(a,b){var c;b?(c=b.find(".tv-dialog-error"),b.width()):(c=$(".tv-dialog .tv-dialog-error"),$(".tv-dialog").width());c.text(a).css({marginTop:TVDialogs.NOTIFICATION_ANIMATION_START_OFFSET,left:"10px",right:"10px",opacity:"0"}).show().animate({marginTop:0,opacity:1},"fast");clearInterval(TVDialogs.messageInterval);TVDialogs.messageInterval=setInterval(function(){$(".tv-dialog .tv-dialog-error").animate({marginTop:TVDialogs.NOTIFICATION_ANIMATION_START_OFFSET,
opacity:0},"fast",function(){$(".tv-dialog .tv-dialog-error").hide()});clearInterval(TVDialogs.messageInterval)},TVDialogs.messageDelay)},showMessage:function(a){$(".tv-dialog .tv-dialog-message").text(a).css({marginTop:TVDialogs.NOTIFICATION_ANIMATION_START_OFFSET,left:"10px",right:"10px",opacity:"0"}).show().animate({marginTop:0,opacity:1},"fast");clearInterval(TVDialogs.messageInterval);TVDialogs.messageInterval=setTimeout(function(){$(".tv-dialog .tv-dialog-message").animate({marginTop:TVDialogs.NOTIFICATION_ANIMATION_START_OFFSET,
opacity:0},"fast",function(){$(".tv-dialog .tv-dialog-message").hide()});clearInterval(TVDialogs.messageInterval)},TVDialogs.messageDelay)},showStocktwitsDialog:function(a,b){return TVDialogs.showCustomDialog({title:"Send Message to stocktwits",html:Mustache.render('<textarea style="width: 100%" maxLength="120">{{text}}</textarea>',{text:a}),action:b})},isOpen:function(a){for(var b=0;b<TVDialogs.dialogs.length;b++)if(TVDialogs.dialogs[b].title==a)return!0;return!1},get:function(a){for(var b=0;b<TVDialogs.dialogs.length;b++)if(TVDialogs.dialogs[b].title==
a)return TVDialogs.dialogs[b].dialog},submit:function(a,b){var c=b?$(b):$(".tv-dialog form").first(),d=c.serialize(),c=c.attr("action");$.post(c,d,function(b){void 0!==a&&a(b)},"json")},destroy:function(a){void 0!==TVDialogs.chart&&(TVDialogs.chart.destroy(),delete TVDialogs.chart);$(window).unbind("keyup.hideDialog");if(a)for(var b=0;b<TVDialogs.dialogs.length;b++)TVDialogs.dialogs[b].title==a&&(TVDialogs.dialogs[b].dialog.trigger("destroy"),$(document).unbind("mouseup.hideDialog"+TVDialogs.dialogs[b].id),
$("input",TVDialogs.dialogs[b].dialog).blur(),TVDialogs.dialogs[b].dialog.remove(),TVDialogs.dialogs.splice(b,1));else TVDialogs.modalDialog&&(TVDialogs.modalDialog.trigger("destroy"),TVDialogs.modalDialog.remove(),TVDialogs.modalDialog=null)},changeTitle:function(a,b){if(a)for(var c=0;c<TVDialogs.dialogs.length;c++)if(TVDialogs.dialogs[c].title==a){var c=TVDialogs.dialogs[c],d=c.dialog,e=d.find(".tv-dialog-title");c.title=b;d.data("title",b);e.html(e.html().replace(a,b));e.find("a").on("click",function(){TVDialogs.destroy(b)});
break}},resizeContent:function(a,b,c){null==c&&(c=20);a+=c;c=parseInt($(window).height(),10);var d=b.height();a>c&&(d=Math.max(0,d-(a-c)),b.height(d))},resizeContentWidth:function(a,b,c){null==c&&(c=20);a+=c;c=parseInt($(window).width(),10);var d=b.width();a>c&&(d=Math.max(0,d-(a-c)),b.width(d))}};function ChartSaver(a){this._chartWidgetCollection=a}ChartSaver.prototype.saveToJSON=function(){return this._fillSavingInfo(!1,!0)};
ChartSaver.prototype._fillSavingInfo=function(a,b){a||(b=!0);var c={publish_request_id:Math.random().toString(36).substring(2)},d=this._chartWidgetCollection,e=d.activeChartWidget.value(),f=d.metaInfo,g=e.model().mainSeries(),h=g.properties(),k=g.symbolInfo();if(!(g&&g.symbolInfo()&&f&&k))throw new ReferenceError("Missed required data");f.id.value()&&(c.id=f.id.value());c.name=f.name.value()||"";c.description=f.description.value()||"";c.resolution=g.properties().interval.value();c.symbol_type=k.type||
"";c.exchange=k.exchange||"";c.listed_exchange=k.listed_exchange||"";g.isSpread()?(h=k.legs[0],f=k.base_name[0],f=f.split(":")[1],c.symbol=h,c.short_name=this.verifiedShortName(h,f,e),c.expression=k.full_name):(f=h.symbol.value(),h=h.shortName.value(),c.symbol=f,c.short_name=this.verifiedShortName(f,h,e));h=[];f=0;for(g=k.legs.length;f<g;f++)h.push({symbol:k.legs[f],pro_symbol:k.base_name[f]});c.legs=JSON.stringify(h);c.content=b?JSON.stringify(d.state(!!a)):JSON.stringify(e.state(!!a));a&&(c.image=
JSON.stringify(d.images({onlyActiveChart:!b})));c.is_realtime=a?"0":"1";return c};
ChartSaver.prototype.publishChart=function(){function a(a,d){b.onPublish(a,$.extend({},d,{closeForm:function(){b._dialogCtl.close()},showError:function(a){TVDialogs.showError(a,b._dialogCtl.dialog)}}))}var b=this;TradingView.trackEvent("GUI","Publish Chart");$(".publish-chart-button").removeClass("inprogress");b._dialogCtl?b._dialogCtl.show():b._dialogCtl=TVDialogs.showPublishChartDialog({chartWidgetCollection:this._chartWidgetCollection,onPublish:a,onMinimize:function(){$(".publish-chart-button").addClass("inprogress")},
onDestroy:function(){delete b._dialogCtl;$(".publish-chart-button").removeClass("inprogress")},related:b._lastPublishUrl})};
ChartSaver.prototype.onPublish=function(a,b){function c(a){d.publishInProgress=!1;a=a.responseText;"ok:"===a.substr(0,3)?(a=a.substr(3),a=JSON.parse(a),d._chartWidgetCollection.metaInfo.id.value()||d._chartWidgetCollection.metaInfo.id.setValue(a.id),b.closeForm&&b.closeForm(),d._lastPublishUrl=a.publishUrl,d.hWnd&&(d.hWnd.location=a.publishUrl)):(b.showError&&b.showError(a||"Error occured while publishing"),d.hWnd&&(d.hWnd.close(),d.hWnd=null))}var d=this;if(!d.publishInProgress){var e=d._fillSavingInfo(!0,
b&&b.publishAllLayout);$.ajax({url:"/publishchart/",type:"post",dataType:"text",data:$.extend({},e,a),complete:c});d.publishInProgress=!0;""!==a.name&&""!==a.description&&4E3>=a.description.length&&64>=a.name.length&&($.cookie("publish_request_id",e.publish_request_id,{path:"/"}),d.hWnd=window.open("/loading/","_blank"))}};
ChartSaver.prototype.verifiedShortName=function(a,b,c){b||(b="");c=c.model().mainSeries();var d;if(d=!c.isSpread()){var e=b,f=/^[1-9]\//;d=a.replace(f,"");e=e.replace(f,"");d=-1==d.indexOf(e)}d&&(b=a.substr(a.indexOf(":")+1),c.properties().shortName.setValue(b),TradingView.trackEvent("Chart","short_name differs from full_name"),console.error("short_name differs from full_name"));return b};
ChartSaver.prototype.saveChartSilently=function(a,b,c){var d=this._chartWidgetCollection.metaInfo;b=this._fillSavingInfo(b);$(window).on("beforeunload.savechart",function(){return $.t("Your chart is being saved, please wait a moment before you leave this page.")});$.post("/savechart/",b,function(b){"ok:"===b.substr(0,3)?(json=b.substr(3),res=JSON.parse(json),d.id.value()||(d.id.setValue(res.id),d.uid.setValue(res.uid)),"function"==typeof a&&a({uid:d.uid.value()},res.count||0)):"saved_chart_limit_reached"==
b||""==b?("function"==typeof c&&c(),TVDialogs.showGoProDialog({feature:"savedChartsLimit"})):("function"==typeof c&&c(),$("#error").html(b));$(window).off("beforeunload.savechart")}).fail(function(){})};
function takeSnapshot(a,b,c,d){d=d||{};var e={wl:d.wl,images:JSON.stringify(a.images()),previews:d.previews};if(d.cme||a.activeChartWidget.value().onCmeWidget())e.cme=!0;$.post(TradingView.isRunningChartingLibrary?d.snapshotUrl||"https://www.tradingview.com/snapshot/":"/snapshot/",e,function(a){a?b(a):c()}).fail(function(){c()})};TradingView.Tabs=function(a,b,c){this._$tabs=a;this._$pages=b;this.options=$.extend({},this._DEFAULT_OPTIONS,c||{});this.tabChanged=new Delegate;this.initActivePage();this.initHandlers()};TradingView.Tabs.prototype._DEFAULT_OPTIONS={saveTab:!1};TradingView.Tabs.prototype.initActivePage=function(){var a=0;this.options.saveTab&&(a=TVSettings.getInt(this.options.saveTab,0));this.setActivePage(a)};
TradingView.Tabs.prototype.setActivePage=function(a){this._$tabs.children().removeClass("active").eq(a).addClass("active");this._$pages.children().removeClass("active").eq(a).addClass("active");this.options.saveTab&&TVSettings.setValue(this.options.saveTab,a);this.tabChanged.fire(a)};TradingView.Tabs.prototype.initHandlers=function(){this._$tabs.on("click","*",this._onTabClick.bind(this))};TradingView.Tabs.prototype._onTabClick=function(a){a=$(a.currentTarget).index();this.setActivePage(a)};
TradingView.Tabs.prototype.addPage=function(a,b){var c=this.count();this._$tabs.append(a);this._$pages.append(b);c||this.setActivePage(0);return c};TradingView.Tabs.prototype.removePage=function(a){this._$tabs.children().eq(a).remove();this._$pages.children().eq(a).remove();a=this._$tabs.children().filter(".active").length?this._$tabs.children().filter(".active").index():0<=a-1?a-1:0;this.setActivePage(a)};TradingView.Tabs.prototype.count=function(){return this._$tabs.children().length};
TradingView.Tabs.prototype.index=function(){return this._$tabs.children().filter(".active:eq(0)").index()};TradingView.postMessageWrapper=function(){var a={},b={},c={},d,e=0,f=0;window.addEventListener&&window.addEventListener("message",function(c){var e;try{e=JSON.parse(c.data)}catch(f){return}e.provider&&"TradingView"==e.provider&&("get"==e.type&&b[e.name]?b[e.name].call(e,e.data,function(a){d.postMessage(JSON.stringify({id:e.id,type:"on",name:e.name,client_id:e.client_id,data:a,provider:"TradingView"}),"*")}):"on"==e.type?a[e.client_id]&&a[e.client_id][e.id]&&(a[e.client_id][e.id].call(e,e.data),delete a[e.client_id][e.id]):
"post"==e.type&&"function"===typeof b[e.name]&&b[e.name].call(e,e.data,function(){}))});return function(g,h){a[h]={};d=c[h]=g;return{on:function(a,c){b[a]=c},get:function(b,d,f){b={id:e++,type:"get",name:b,client_id:h,data:d,provider:"TradingView"};a[h][b.id]=f;c[h].postMessage(JSON.stringify(b),"*")},post:function(a,b,c){b={id:f++,type:"post",name:b,data:c,provider:"TradingView"};a&&"function"===typeof a.postMessage&&a.postMessage(JSON.stringify(b),"*")}}}}();TradingView.Linking=function(){function a(a,k){function q(l){function u(b){C.value()!==b&&(k?k.setSymbol(b):a.setSymbol(b))}function z(){b.setValue(C.value())}function t(){c.setValue(v.shortName.value());var a=w.symbolInfo();a?(e.setValue(!!a.has_intraday),a.hasOwnProperty("supported_resolutions")?f.setValue(a.supported_resolutions):f.setValue(void 0)):e.deleteValue()}function B(b){H.value()!==b&&(k?k.setResolution(b):a.setResolution(b))}function A(){d.setValue(H.value())}a.modelCreated().unsubscribe(null,
q);var w=a.model().mainSeries(),v=w.properties(),C=v.symbol;C.subscribe(null,z);b.setValue(C.value());b.subscribe(u);w.onSymbolResolved().subscribe(null,t);w.onSymbolError().subscribe(null,t);t();var H=v.interval;H.subscribe(null,A);d.setValue(H.value());d.subscribe(B);a.readOnly()&&(b.writeLock=!0);g=function(){C.unsubscribe(null,z);b.unsubscribe(u);w.onSymbolResolved().unsubscribe(null,t);w.onSymbolError().unsubscribe(null,t);H.unsubscribe(null,A);d.unsubscribe(B);delete b.writeLock;g=new Function;
h=new Function}}g();h=function(){return a};var l=a.model();l?q(l):(a.modelCreated().subscribe(null,q),g=function(){a.modelCreated().unsubscribe(null,q);g=new Function;h=new Function})}var b=new WatchedValue,c=new WatchedValue,d=new WatchedValue,e=new WatchedValue,f=new WatchedValue,g=new Function,h=new Function,k=new Function;return{symbol:b,seriesShortSymbol:c.readonly(),interval:d,intraday:e.readonly(),supportedResolutions:f.readonly(),bindToChartWidget:a,unbindFromChartWidget:function(){g()},getChartWidget:function(){return h()},
bindToSearchCharts:function(a){function c(a){e=!0;b.setValue(a.resolved_symbol);e=!1}function d(b){e||a.search(b)}k();var e=!1;a.onSearchBySymbol.subscribe(null,c);b.subscribe(d);k=function(){a.onSearchBySymbol.unsubscribe(null,c);b.unsubscribe(d);k=new Function}},unbindFromSearchCharts:function(){k()},bindToChartWidgetCollection:function(b){g();b.activeChartWidget.subscribe(function(c){g();a(c,b)},{callWithLast:!0})}}}();
function linkingSetSymbol(a){a&&"string"===typeof a&&($(".header-chart-panel .symbol-edit-wrap input").val(TradingView.SymbolParser.shortName(a)),TradingView.Linking.symbol.setValue(a))};TradingView.FeatureToggle={force_prefix:"forcefeaturetoggle.",enableFeature:function(a){localStorage[this.force_prefix+a]="true"},disableFeature:function(a){localStorage.removeItem(this.force_prefix+a)}};
TradingView.isFeatureEnabled=function(a){if(TradingView.pushStreamMultiplexer)TradingView.pushStreamMultiplexer.on("featuretoggle",function(b){a[b.name]=b.state;localStorage["featuretoggle."+b.name]=Math.random()<=a[b.name]});return function(b){if("true"===localStorage[TradingView.FeatureToggle.force_prefix+b])return!0;if(!a[b])return!1;if(1===a[b])return!0;var c=localStorage["featuretoggle."+b];return void 0===c||null===c?localStorage["featuretoggle."+b]=Math.random()<=a[b]:"true"===c}}(window.featureToggleState||
{});(function(a){if(document.createElement("canvas")&&document.createElement("canvas").getContext){var b=function(b){return(a.devicePixelRatio||1)/(b.backingStorePixelRatio||b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1)}(document.createElement("canvas").getContext("2d"));if(/hidpi/.test(location.hash)||2==b&&/Macintosh/.test(navigator.userAgent)&&TradingView.isFeatureEnabled("hidpi_canvas")&&!(2880<a.innerWidth*
b))a.hidpiCanvasRatio=b,function(a){(function(a,b){for(var c in a)a.hasOwnProperty(c)&&b(a[c],c)})({fillRect:"all",clearRect:"all",strokeRect:"all",moveTo:"all",lineTo:"all",arc:[0,1,2],arcTo:"all",bezierCurveTo:"all",isPointinPath:"all",isPointinStroke:"all",quadraticCurveTo:"all",rect:"all",translate:"all",createRadialGradient:"all",createLinearGradient:"all",drawImage:[1,2,3,4]},function(d,e){var f=a[e];a[e]=function(){var a,c;if("all"===d)for(c=[],a=arguments.length;0<a--;)c[a]=arguments[a]*b;
else for(c=Array.prototype.slice.call(arguments),a=d.length;0<a--;)c[d[a]]&&(c[d[a]]*=b);return f.apply(this,c)}});a.fillText=function(a){return function(){var c=Array.prototype.slice.call(arguments);c[1]*=b;c[2]*=b;this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c*b+d});a.apply(this,c);this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c/b+d})}}(a.fillText);a.strokeText=function(a){return function(){var c=Array.prototype.slice.call(arguments);c[1]*=
b;c[2]*=b;this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c*b+d});a.apply(this,c);this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c/b+d})}}(a.strokeText)}(CanvasRenderingContext2D.prototype),function(a){a.getContext=function(a){return function(c){var f=a.call(this,c);"2d"===c&&(this.style.height=this.height+"px",this.style.width=this.width+"px",this.width*=b,this.height*=b);return f}}(a.getContext)}(HTMLCanvasElement.prototype)}})(window);TradingView.PublishedScript=function(){function a(a){a&&a.scriptIdPart&&($(".pubscript-button").each(function(){$(this).data("script-id-part")===a.scriptIdPart&&e(this,!0)}),k&&k.done(function(){g[a.scriptIdPart]||(h.push(a),g[a.scriptIdPart]=a,f(),q.fire())}))}function b(b){if(!window.is_authenticated||!b)return $.Deferred().reject().promise();if("number"===typeof b||/^\d+$/.test(b))b="PUB;"+b;var c=$.Deferred();$.ajax({url:"/pubscripts-add/",type:"POST",data:{scriptIdPart:b},dataType:"json"}).done(function(a){a&&
!a.error?c.resolve(a):c.reject(a)});c.done(function(b){a(b);TVXWindowEvents.emit("PublishedScript",JSON.stringify({action:"added",args:b}))});return c.promise()}function c(a){a&&($(".pubscript-button").each(function(){$(this).data("script-id-part")===a&&e(this,!1)}),k&&k.done(function(){var b=g[a];if(b){var c=h.indexOf(b);-1!==c&&h.splice(c,1);delete g[b.scriptIdPart];f();q.fire()}}))}function d(a){if(!window.is_authenticated||!a)return $.Deferred().reject().promise();if("number"===typeof a||/^\d+$/.test(a))a=
"PUB;"+a;var b=$.Deferred();$.ajax({url:"/pubscripts-remove/",type:"POST",data:{scriptIdPart:a},dataType:"json"}).done(function(a){a?b.resolve(a):b.reject(a)});b.done(function(){c(a);TVXWindowEvents.emit("PublishedScript",JSON.stringify({action:"removed",args:a}))});return b.promise()}function e(a,b){var c=$(a),d=c.hasClass("active");b=1 in arguments?!!b:!d;b!==d&&(c.toggleClass("active",b),c.find(".label").text(b?"Added":"Add to my scripts"))}function f(){m.forEach(function(a){var b=a.studiesMetaInfo;
a=a.studyScriptingPkgVers;for(var c={},d=b.size()-1;0<=d;d--){var e=b.item(d);/^PUB;/.test(e.scriptIdPart)&&(g[e.scriptIdPart]?c[e.scriptIdPart]=!0:StudyMetaInfo.removeStudyMetaInfo(b,e.id))}for(d=h.length-1;0<=d;d--)e=h[d],c[e.scriptIdPart]||(e=StudyMetaInfo.createMetaInfoStub(e,a),StudyMetaInfo.addStudyMetaInfo(b,e))})}var g={},h=[],k=null,m=[],n={},q=new Delegate;(function(){$(document.body).on("click",".pubscript-button",function(a){a.preventDefault();var c=$(this);runOrSignIn(function(){var a=
c.hasClass("active"),f=!a,g=c.data("script-id-part");if(g){var h;h=f?b(g):d(g);$(".pubscript-button").each(function(){var b=this;$(b).data("script-id-part")===g&&(e(b,f),h.fail(function(){e(b,a)}))})}})});TVXWindowEvents.on("PublishedScript",function(b){b=JSON.parse(b);switch(b.action){case "added":a(b.args);break;case "removed":c(b.args)}})})();return{onListChange:q,list:function(){if(!window.is_authenticated)return $.Deferred().resolve([]).promise();k||(k=$.getJSON("/pubscripts-list-json/").done(function(a){h=
a||[];for(a=h.length;a--;)g[h[a].scriptIdPart]=h[a],n[h[a].scriptIdPart]=h[a]}).fail(function(){k=null}));var a=$.Deferred();k.done(function(){a.resolve(TradingView.clone(h))});return a.promise()},add:b,remove:d,setSyncMetaInfo:function(a,b){m.push({studiesMetaInfo:a,studyScriptingPkgVers:b})},suggest:function(a){null==a&&(a="");a=$.ajax({url:"/pubscripts-suggest-json/",type:"GET",data:{search:a},dataType:"json"});a.done(function(a){if(a)for(var b=0;b<a.length;b++)n[a[b].scriptIdPart]=TradingView.clone(a[b])});
return a},info:function(a){if("number"===typeof a||/^\d+$/.test(a))a="PUB;"+a;if(n[a])return $.Deferred().resolve(TradingView.clone(n[a]));a=$.ajax({url:"/pubscripts-get/",type:"GET",data:{scriptIdPart:a},dataType:"json"});a.done(function(a){a&&(n[a.scriptIdPart]=TradingView.clone(a))});return a}}}();(function(){TradingView.Telemetry={};TradingView.Telemetry.sendReport=function(a,b){var c=window.chartWidget||_exposed_chartWidgetCollection.activeChartWidget.value();if(c&&(!c.onWidget()||TradingView.isCmeWidget)){b=b||{};var d={event:a||"error",user:window.user&&window.user.username||"Guest",websocketAddress:ChartApiInstance._socket?ChartApiInstance._socket.host+":"+ChartApiInstance._socket.options.port:"",log:JSON.stringify(TradingView.LOGHISTORY),ws_reason:b.reason||"",ws_code:b.code||"",js_errors:__tv_js_errors.slice(0,
10)},e="";switch(TradingView.Environment()){case "battle":e="https://telemetry.tradingview.com";break;case "local":e="http://localhost:7373"}e&&setTimeout(function(){$.post(e+"/report",d)},2E3)}}})();JSServer.ChartapiMessager=function(a,b){this._server=a;this._session=b;this._timezone=null};JSServer.ChartapiMessager.prototype.setTimezone=function(a){this._timezone="exchange"==a?"exchange":PineJsCalendar.get_timezone(a)};JSServer.ChartapiMessager.prototype.onRequestMetadata=function(a,b){this._server.receiveLocalResponse({method:"studies_metadata",params:[this._session,a,b]})};
JSServer.ChartapiMessager.prototype.onSymbolResolved=function(a,b){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,a,b]})};JSServer.ChartapiMessager.prototype.onSymbolError=function(a,b){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,a,b]})};JSServer.ChartapiMessager.prototype.onStudyError=function(a,b){this._server.receiveLocalResponse({method:"study_error",params:[this._session,a,b]})};
JSServer.ChartapiMessager.prototype.onSeriesLoading=function(a,b){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,a,b]})};JSServer.ChartapiMessager.prototype.onSeriesCompleted=function(a,b,c){this._server.receiveLocalResponse({method:"series_completed",params:[this._session,a,c,b]})};JSServer.ChartapiMessager.prototype.onSeriesError=function(a,b){this._server.receiveLocalResponse({method:"series_error",params:[this._session,a,b]})};
JSServer.ChartapiMessager.prototype.onSeriesClearData=function(a,b){var c={};c[a]={series:[],turnaround:b};this._server.receiveLocalResponse({method:"timescale_update",params:[this._session,c,{index:0,zoffset:0,changes:[],marks:[]}]})};JSServer.ChartapiMessager.prototype.onStudyCompleted=function(a,b){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,a,b]})};
JSServer.ChartapiMessager.prototype.onStudyLoading=function(a,b){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,a,b]})};
JSServer.ChartapiMessager.prototype.onTickmarksUpdated=function(a,b,c){b=b.slice(0);var d=PineJsCalendar.get_timezone(c.timezone);for(c=0;c<b.length;++c)b[c]=this._fixTimezone(b[c],d);var d=[],e=[],f;for(c=0;c<b.length;++c){var g=b[c];d.push([this._spanByTime(g,f),g,a+c]);e.push(g);f=g}this._server.receiveLocalResponse({method:"tickmark_update",params:[this._session,{index:a,zoffset:0,changes:e,marks:d}]})};
JSServer.ChartapiMessager.prototype.onTimescaleUpdate=function(a,b,c,d){c=c.slice(0);var e=PineJsCalendar.get_timezone(d.timezone);for(d=0;d<c.length;++d)c[d].value[0]=this._fixTimezone(c[d].value[0],e);e={};e[a]={series:c,turnaround:b};a=[];b=[];var f;for(d=0;d<c.length;++d){var g=c[d].value[0];a.push([this._spanByTime(g,f),g,d]);b.push(g);f=g}this._server.receiveLocalResponse({method:"timescale_update",params:[this._session,e,{index:0,zoffset:0,changes:b,marks:a}]})};
JSServer.ChartapiMessager.prototype.onSeriesTimeframeUpdate=function(a,b,c){this._server.receiveLocalResponse({method:"series_timeframe",params:[this._session,a,b,0,c]})};JSServer.ChartapiMessager.prototype.onPointsetDataUpdate=function(a,b,c,d){this._onDataUpdate(a,b,c,void 0,d,1)};JSServer.ChartapiMessager.prototype.onDataUpdate=function(a,b,c,d,e){this._onDataUpdate(a,b,c,d,e,0)};
JSServer.ChartapiMessager.prototype._onDataUpdate=function(a,b,c,d,e,f){c=c.slice(0);e=PineJsCalendar.get_timezone(e.timezone);for(var g=0;g<c.length;++g)c[g].value[f]=this._fixTimezone(c[g].value[f],e);f={};d=d?JSON.stringify({offsets:d}):"";f[a]={s:c,ns:{d:d,indexes:[]},turnaround:b};this._server.receiveLocalResponse({method:"data_update",params:[this._session,f]})};
JSServer.ChartapiMessager.prototype._fixTimezone=function(a,b){return"exchange"==this._timezone?parseInt(PineJsCalendar.utc_to_cal(b,1E3*a).valueOf()/1E3):parseInt(PineJsCalendar.utc_to_cal(this._timezone,1E3*a).valueOf()/1E3)};
JSServer.ChartapiMessager.prototype._spanByTime=function(a,b){var c=[{divisor:1,span:20},{divisor:300,span:21},{divisor:1800,span:22},{divisor:3600,span:30},{divisor:10800,span:31},{divisor:21600,span:32},{divisor:43200,span:33},{divisor:86400,span:40},{divisor:604800,span:50}];if(b){var d=new Date(1E3*b),e=new Date(1E3*a);if(e.getYear()!=d.getYear())return 70;if(e.getMonth()!=d.getMonth())return 60}for(d=c.length-1;0<=d;--d)if(0==a%c[d].divisor)return c[d].span;throw"This should never happen";};
ChartapiMessagerInstance={};JSServer.ChartApi=function(a){this._notificationHandlers=[];this._sessions=[];this.studyCounter=0;this._enabled=this._connected=!1;this._studyEngine=new JSServer.JSStudyEngine(a);this._callbacks={};this._symbolIdCache={};this._seriesIdCache={};this._recentSeriesId=null;this._enableLogging=!1;this._enabledStudiesList=[];this._disabledStudiesList=[];var b=this;this._studyEngine.on("configuration_received",function(){b._fireEvent("configuration_received")});this._studyEngine.on("realtime_tick",function(a){b._fireEvent("realtime_tick",
{time:a.value[0]/1E3,open:a.value[1],high:a.value[2],low:a.value[3],close:a.value[4],volume:a.value[5]})});this._autosavePause=void 0;this._setupAutoSave();TradingView.availableTimezones=[{id:"UTC",title:$.t("UTC")},{id:"exchange",title:$.t("Exchange")}].concat([{id:"Europe/Athens",title:"Athens"},{id:"Europe/Berlin",title:"Berlin"},{id:"America/Bogota",title:"Bogota"},{id:"Asia/Bangkok",title:"Bangkok"},{id:"America/Argentina/Buenos_Aires",title:"Buenos Aires"},{id:"America/Chicago",title:"Chicago"},
{id:"Asia/Hong_Kong",title:"Hong Kong"},{id:"Asia/Kolkata",title:"Kolkata"},{id:"Europe/London",title:"London"},{id:"America/Los_Angeles",title:"Los Angeles"},{id:"Europe/Madrid",title:"Madrid"},{id:"Europe/Moscow",title:"Moscow"},{id:"America/New_York",title:"New York"},{id:"Europe/Paris",title:"Paris"},{id:"Asia/Seoul",title:"Seoul"},{id:"Asia/Shanghai",title:"Shanghai"},{id:"Asia/Singapore",title:"Singapore"},{id:"Australia/Sydney",title:"Sydney"},{id:"Asia/Taipei",title:"Taipei"},{id:"Asia/Tokyo",
title:"Tokyo"},{id:"America/Toronto",title:"Toronto"},{id:"America/Vancouver",title:"Vancouver"},{id:"Europe/Warsaw",title:"Warsaw"}].map(function(a){a.title=$.t(a.title);return a}).sort(function(a,b){return a.title.localeCompare(b.title)}))};
JSServer.ChartApi.prototype._setupAutoSave=function(){var a=this,b=!1;TradingView.UndoHistory.undoStack().onChange().subscribe(this,function(){a._autosavePause?b=!0:(a._fireEvent("onAutoSaveNeeded",void 0,!0),a._autosavePause=setTimeout(function(){b&&a._fireEvent("onAutoSaveNeeded",void 0,!0);a._autosavePause=void 0;b=!1},5E3))})};
JSServer.ChartApi.prototype.availableTimeFrames=function(a,b){var c=[{text:"5{0}".format($.t("y",{context:"dates",count:5})),value:"60m",targetResolution:"W"},{text:"1{0}".format($.t("y",{context:"dates",count:1})),value:"12m",targetResolution:"D"}];if(a&&a.has_intraday)var d=[{text:"6{0}".format($.t("m",{context:"dates"})),value:"6m",targetResolution:"120"},{text:"3{0}".format($.t("m",{context:"dates"})),value:"3m",targetResolution:"60"},{text:"1{0}".format($.t("m",{context:"dates"})),value:"1m",
targetResolution:"30"},{text:"5{0}".format($.t("d",{context:"dates"})),value:"5d",targetResolution:"5"},{text:"1{0}".format($.t("d",{context:"dates"})),value:"1d",targetResolution:"1"}],c=a.supported_resolutions?c.concat(d.filter(function(b){return 0<=a.supported_resolutions.indexOf(b.targetResolution)})):c.concat(d);return c};JSServer.ChartApi.prototype.defaultResolutions=function(){return this._studyEngine.supportedResolutions()||{1:1,3:1,5:1,15:1,30:1,45:1,60:1,120:1,180:1,240:1,D:1,W:1,M:1}};
JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()};JSServer.ChartApi.prototype.supportedExchangesList=function(){return this._studyEngine.supportedExchangesList()};JSServer.ChartApi.prototype.start=function(){this._enabled=!0;this._fireEvent("start_enabled")};JSServer.ChartApi.prototype._logMessage=function(a){this._enableLogging&&console.log(a)};
JSServer.ChartApi.prototype.on=function(a,b){this._callbacks.hasOwnProperty(a)||(this._callbacks[a]=[]);this._callbacks[a].push(b);return this};JSServer.ChartApi.prototype._fireEvent=function(a,b,c){if(this._callbacks.hasOwnProperty(a)){for(var d=this._callbacks[a],e=0;e<d.length;++e)d[e](b);c||(this._callbacks[a]=[])}};JSServer.ChartApi.prototype.setAuthToken=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype.authTokenRequired=function(a){return!1};
JSServer.ChartApi.prototype.chartCreateSession=function(a,b){};JSServer.ChartApi.prototype.chartDeleteSession=function(a){};JSServer.ChartApi.prototype.createSession=function(a,b){ChartapiMessagerInstance=new JSServer.ChartapiMessager(this,a);this._sessions[a]=b;this._notificationHandlers[a]=b;if(this.connected())b.onMessage({method:"connected",params:[]})};JSServer.ChartApi.prototype.removeSession=function(a){delete this._sessions[a];delete this._notificationHandlers[a];this.chartDeleteSession(a)};
JSServer.ChartApi.prototype.connected=function(){return this._connected};JSServer.ChartApi.prototype._getHost=function(a){return a};JSServer.ChartApi.prototype._isSafari5=function(){return!!navigator.appVersion.match(/\/5\.[^\/]*?Safari\//)};JSServer.ChartApi.prototype._isIE9=function(){return!!navigator.appVersion.match(/MSIE 9/)};JSServer.ChartApi.prototype._isIOS5=function(){return!!navigator.appVersion.match(/iPad, CPU 5/)};
JSServer.ChartApi.prototype._getPort=function(a){return this._isSafari5()||this._isIE9()?8081:a};JSServer.ChartApi.prototype.connect=function(){if(this._enabled)this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]}));else{var a=this;this.on("start_enabled",function(){a.connect()})}};JSServer.ChartApi.prototype.disconnect=function(){throw"This method is not implemented";};
JSServer.ChartApi.prototype.switchTimezone=function(a,b){ChartapiMessagerInstance.setTimezone(b);if(this._recentSeriesId){var c=this;this._doWhenSeriesSymbolIdIsReady(this._recentSeriesId,function(b){c._studyEngine.recreateSources(b.name,c._seriesIdCache[c._recentSeriesId].resolution,a);c._doWhenSeriesDataReceived(function(){var a=c._seriesIdCache[c._recentSeriesId].resolution,f=chartWidget.model().mainSeries().data().last();c._studyEngine.rebuildExtrapolatedData(b.name,a,b.info,f.value[0])})})}};
JSServer.ChartApi.prototype.receiveLocalResponse=function(a){this._logMessage(a);this._dispathNotification(a)};JSServer.ChartApi.prototype.getMarks=function(a,b,c,d,e){this._studyEngine.getMarks(a,b,c,d,e)};
JSServer.ChartApi.prototype.resolveSymbol=function(a,b,c,d,e){function f(a,b){ChartapiMessagerInstance.onSymbolError(a,b);g._symbolIdCache[a]={name:c,status:"invalid_symbol"};g._fireEvent(a+"_resolve_fail");g._fireEvent("resolve_fail",a)}this._notificationHandlers[a][b]=new HandlerInfo(d,b);delete this._symbolIdCache[b];var g=this;this._studyEngine.resolveSymbol(c,function(a){a.errmsg?f(b,a.errmsg):(g._symbolIdCache[b]={name:c,info:a,status:"ok"},g._fireEvent(b+"_resolved",a),g._fireEvent("symbol_resolved",
{symbolInfo:a,symbolId:b}),ChartapiMessagerInstance.onSymbolResolved(b,a))},function(a){f(b,a)})};JSServer.ChartApi.prototype._doWhenSymbolIdIsReady=function(a,b){function c(){e&&(b({name:d._symbolIdCache[a].name,info:d._symbolIdCache[a].info}),e=!1)}var d=this,e=!0;this._symbolIdCache.hasOwnProperty(a)?c():(this.on(a+"_resolved",function(a){c()}),this.on(a+"_resolve_fail",function(){c()}))};
JSServer.ChartApi.prototype._doWhenSeriesDataReceived=function(a){function b(){chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,b);a()}chartWidget.model().mainSeries().onDataLoaded().subscribe(null,b)};
JSServer.ChartApi.prototype._doWhenSeriesSymbolIdIsReady=function(a,b){function c(){if(e){var c=d._symbolIdCache[d._seriesIdCache[a].symbolId];b({name:c.name,info:c.info});e=!1}}var d=this,e=!0;this._symbolIdCache.hasOwnProperty(this._seriesIdCache[a].symbolId)?c():(this.on("symbol_resolved",function(b){b.symbolId==d._seriesIdCache[a].symbolId&&c()}),this.on("resolve_fail",function(b){b==d._seriesIdCache[a].symbolId&&c()}))};
JSServer.ChartApi.prototype.createSeries=function(a,b,c,d,e,f,g){c=c||"";this._notificationHandlers[a][b]=new HandlerInfo(g,b);this._recentSeriesId=b;var h=this;this._seriesIdCache[b]={symbolId:d,resolution:e};this._doWhenSeriesSymbolIdIsReady(b,function(d){h._studyEngine.createSeries(d.name,e,a,b,c)})};JSServer.ChartApi.prototype.removeSeries=function(a,b,c){this._notificationHandlers[a][b]=new HandlerInfo(c,b);this._studyEngine.removeSeries(b)};
JSServer.ChartApi.prototype.modifySeries=function(a,b,c,d,e,f){c=c||"";var g=this._seriesIdCache[b]?this._seriesIdCache[b].resolution:void 0;this._notificationHandlers[a][b]=new HandlerInfo(function(a){if("series_completed"==a.method){var d=chartWidget.model().mainSeries().bars().size(),h=PineJS.Symbol.parsePeriod(g),q=PineJS.Symbol.parsePeriod(e);if(q.range&&h.range!=q.range)ChartapiMessagerInstance.onSeriesTimeframeUpdate(b,c,d)}f(a)},b);this._recentSeriesId=b;this._studyEngine.updateSeriesTurnaround(b,
c);var h=this;this._seriesIdCache[b]={symbolId:d,resolution:e};this._doWhenSeriesSymbolIdIsReady(b,function(c){h._studyEngine.purgeGuardData(b);h._studyEngine.recreateSources(c.name,e,a,!0)})};JSServer.ChartApi.prototype.requestMoreData=function(a,b,c,d){this._notificationHandlers[a][b]=new HandlerInfo(d,b);this._studyEngine.extendSeriesRange(b,a,c)};JSServer.ChartApi.prototype.setEnabledStudiesList=function(a){this._enabledStudiesList=a.slice(0)};
JSServer.ChartApi.prototype.setDisabledStudiesList=function(a){this._disabledStudiesList=a.slice(0)};
JSServer.ChartApi.prototype.requestMetadata=function(a,b,c){this._notificationHandlers[a][b]=new HandlerInfo(c,b);a=[];var d=this;a=0<this._enabledStudiesList.length?this._studyEngine.studiesMetadata().filter(function(a){return a.is_hidden_study||0<=d._enabledStudiesList.indexOf(a.description)}):0<this._disabledStudiesList.length?this._studyEngine.studiesMetadata().filter(function(a){return a.is_hidden_study||-1==d._disabledStudiesList.indexOf(a.description)}):this._studyEngine.studiesMetadata();
ChartapiMessagerInstance.onRequestMetadata(b,a)};JSServer.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounter<STUDY_COUNT_LIMIT};
JSServer.ChartApi.prototype.createStudy=function(a,b,c,d,e,f,g){if(this.isCanCreateStudy()){c=c||"";this._notificationHandlers[a][b]=new HandlerInfo(g,b);var h=this,k=this._seriesIdCache[d].resolution;this._doWhenSymbolIdIsReady(this._seriesIdCache[d].symbolId,function(d){h._studyEngine.createStudy(d.name,k,a,b,c,e,f);h.studyCounter++})}else TVDialogs.showNotice("Error","Exceeded the limit of studies")};
JSServer.ChartApi.prototype.removeStudy=function(a,b,c){this._notificationHandlers[a][b]=new HandlerInfo(c,b);this._studyEngine.removeStudy(b);this.studyCounter--};JSServer.ChartApi.prototype.modifyStudy=function(a,b,c,d,e){c=c||"";this._notificationHandlers[a][b]=new HandlerInfo(e,b);[a,b,c].concat(d);this._studyEngine.recomputeStudy(b,d,a,c)};
JSServer.ChartApi.prototype.createPointset=function(a,b,c,d,e,f,g){this._notificationHandlers[a][b]=new HandlerInfo(g,b);var h=this;this._doWhenSymbolIdIsReady(d,function(a){h._studyEngine.createPointset(b,a.info.full_name,a.info,e,f)})};JSServer.ChartApi.prototype.modifyPointset=function(a,b,c,d,e){throw"This call is not implemented";};JSServer.ChartApi.prototype.removePointset=function(a,b,c){this._notificationHandlers[a][b]=new HandlerInfo(c,b);this._studyEngine.removePointset(b)};
JSServer.ChartApi.prototype.requestMoreTickmarks=function(a,b,c,d){this._notificationHandlers[a][b]=new HandlerInfo(d,b);var e=this;this._doWhenSeriesSymbolIdIsReady(b,function(a){e._studyEngine.onMoreTickmarksRequested(a.name,a.info,e._seriesIdCache[b].resolution,c)})};JSServer.ChartApi.prototype.requestFirstBarTime=function(a,b,c,d){this._notificationHandlers[a][b]=new HandlerInfo(d,b)};JSServer.ChartApi.prototype._invokeHandler=function(a,b){a&&a(b)};
JSServer.ChartApi.prototype._sendRequest=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype._onMessage=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype._convertTimescaleResponse=function(a){for(var b=a.marks,c=0;c<b.length;++c)b[c]={span:b[c][0],time:b[c][1],index:b[c][2]};return a};
JSServer.ChartApi.prototype._dispathNotification=function(a){var b=a.params.shift();if(this._notificationHandlers[b])switch(a.method){case "timescale_update":var c=a.params[0];a=a.params[1];var d=this._convertTimescaleResponse(a);d.clear=0===a.changes.length&&0===a.marks.length;this._notificationHandlers[b].onMessage({method:"timescale_update",params:d});for(var e in c)d={},d.customId=e,d.plots=c[e].series,c[e].ns&&(d.nonseries=c[e].ns),d.turnaround=c[e].turnaround,d={method:"data_update",params:d},
this._invokeNotificationHandler(b,e,d);break;case "tickmark_update":d=this._convertTimescaleResponse(a.params[0]);d.changes=[];this._notificationHandlers[b].onMessage({method:"timescale_update",params:d});break;case "data_update":for(e in a.params[0]){var f=a.params[0][e],d={};d.customId=e;d.plots=f.series?f.series:f.plots;d.turnaround=f.turnaround;"s"in f&&"ns"in f&&(d.plots=f.s,d.nonseries=f.ns);for(c in d.plots)for(var g in d.plots[c].value)1E100===d.plots[c].value[g]&&(d.plots[c].value[g]=void 0);
d={method:"data_update",params:d};this._invokeNotificationHandler(b,e,d)}break;case "index_update":for(e in a.params[0])d={method:"index_update",params:a.params[0][e]},this._invokeNotificationHandler(b,e,d);break;case "critical_error":TradingView.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+a.params[0]);this._notificationHandlers[b].onMessage({method:"critical_error",params:a.params});break;case "quote_symbol_data":case "quote_list_fields":case "depth_symbol_error":case "depth_symbol_success":case "dd":case "dpu":case "depth_bar_last_value":this._notificationHandlers[b].onMessage({method:a.method,
params:a.params});break;default:this._invokeNotificationHandler(b,a.params[0],a)}};JSServer.ChartApi.prototype._invokeNotificationHandler=function(a,b,c){if(void 0!==b){var d=this._notificationHandlers[a][b];void 0!==d&&this._invokeHandler(d.handler,c);"series_deleted"!=c.method&&"study_deleted"!=c.method||delete this._notificationHandlers[a][b]}};
JSServer.ChartApi.prototype.searchSymbolsByName=function(a,b,c,d,e){0==a.length&&0==b.length&&0==c.length&&e([]);this._studyEngine.searchSymbolsByName(a,b,c,e)};JSServer.ChartApi.prototype._notifySessions=function(a){for(var b in this._sessions){if(!this._sessions.hasOwnProperty(b))break;var c=this._sessions[b];if("function"===typeof c.onMessage)c.onMessage(a)}};JSServer.ChartApi.prototype.unpack=function(a){throw"This method is not implemented";};
JSServer.ChartApi.prototype.reconnectTimeout=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype.quoteCreateSession=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype.quoteDeleteSession=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype.quoteAddSymbols=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype.quoteRemoveSymbols=function(a,b){throw"This method is not implemented";};
JSServer.ChartApi.prototype.quoteListFields=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype.quoteFireTick=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype.quoteFastSymbols=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype.setFields=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype.depthCreateSession=function(a,b,c){throw"This method is not implemented";};
JSServer.ChartApi.prototype.depthDeleteSession=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype.depthSetSymbol=function(a,b){throw"This method is not implemented";};JSServer.ChartApi.prototype.depthClearSymbol=function(a){throw"This method is not implemented";};JSServer.ChartApi.prototype.depthSetScale=function(a,b){throw"This method is not implemented";};requireFullInterfaceImplementation(JSServer.ChartApi,"JSServer.ChartApi",ChartApiInterface,"ChartApiInterface");JSServer.DatafeedInterface=function(){};JSServer.DatafeedInterface.prototype.getConfigurationData=function(){};JSServer.DatafeedInterface.prototype.searchSymbolsByName=function(a,b){};JSServer.DatafeedInterface.prototype.resolveSymbol=function(a,b,c){};JSServer.DatafeedInterface.prototype.getBars=function(a,b,c,d,e,f){};JSServer.DatafeedInterface.prototype.getBarsByRange=function(a,b,c,d,e,f){};JSServer.DatafeedInterface.prototype.subscribeBars=function(a,b,c){};
JSServer.DatafeedInterface.prototype.unsubscribeBars=function(a){};declareClassAsPureInterface(JSServer.DatafeedInterface,"JSServer.DatafeedInterface");(function(){var a={"America/New_York":{time:[-2717668562,-1633298400,-1615154400,-1601848800,-1583704800,-1577923200,-1570399200,-1551650400,-1536530400,-1523224800,-1504476E3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372E3,-1347228E3,-1333922400,-1315173600,-1301868E3,-1283724E3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462E4,-1125871200,-1112565600,-1094421600,-1081116E3,-1062972E3,
-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-883612800,-880236E3,-76941E4,-765410400,-757382400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612E3,-620863200,-608162400,-589413600,-576108E3,-557964E3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836E3,-400111200,-384386400,-368661600,-352936800,-337212E3,-321487200,-305762400,-289432800,
-273708E3,-257983200,-242258400,-226533600,-210808800,-195084E3,-179359200,-163634400,-147909600,-13158E4,-11646E4,-100130400,-94694400,-84405600,-68680800,-52956E3,-37231200,-21506400,-5781600,9943200,25668E3,41392800,57722400,73447200,89172E3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924E3,325648800,341373600,357098400,372823200,388548E3,404877600,419997600,436327200,452052E3,467776800,483501600,499226400,
514951200,530676E3,544586400,562125600,576036E3,59418E4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788E3,814932E3,828842400,846381600,860292E3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684E3,1049594400,1067133600,1081044E3,1099188E3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028E3,1225591200,1236477600,1257040800,1268532E3,1289095200,
1299981600,1320544800,1331431200,1351994400,1362880800,1383444E3,1394330400,1414893600,142578E4,1446343200,1457834400,1478397600,1489284E3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196E3,1615687200,1636250400,1647136800,16677E5,1678586400,1699149600,1710036E3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452E3,1899338400,1919901600,315569527201],offset:[-17762,-18E3,-14400,-18E3,-14400,-18E3,-18E3,-14400,
-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-18E3,-14400,-14400,-18E3,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,
-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,
-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3]},"America/Los_Angeles":{time:[-2717668378,-1633298400,-1615154400,-1601848800,-1583704800,-880236E3,
-769420800,-765410400,-757382400,-687996E3,-662680800,-620863200,-608162400,-589413600,-576108E3,-557964E3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,-368661600,-355356E3,-337212E3,-323906400,-305762400,-292456800,-273708E3,-261007200,-242258400,-226533600,-210808800,-195084E3,-179359200,-163634400,-147909600,-13158E4,-11646E4,-100130400,-94694400,-84405600,-68680800,-52956E3,-37231200,-21506400,-5781600,9943200,25668E3,
41392800,57722400,73447200,89172E3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924E3,325648800,341373600,357098400,372823200,388548E3,404877600,419997600,436327200,452052E3,467776800,483501600,499226400,514951200,530676E3,544586400,562125600,576036E3,59418E4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788E3,814932E3,828842400,846381600,
860292E3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684E3,1049594400,1067133600,1081044E3,1099188E3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028E3,1225591200,1236477600,1257040800,1268532E3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444E3,1394330400,1414893600,142578E4,1446343200,1457834400,1478397600,1489284E3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196E3,
1615687200,1636250400,1647136800,16677E5,1678586400,1699149600,1710036E3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452E3,1899338400,1919901600,315569527201],offset:[-28378,-28800,-25200,-28800,-25200,-28800,-25200,-25200,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,
-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,
-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Chicago":{time:[-2717668236,-1633298400,
-1615154400,-1601848800,-1583704800,-1577923200,-1563746400,-1551650400,-1538949600,-1520200800,-1504476E3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372E3,-1347228E3,-1333922400,-1315173600,-1301868E3,-1283724E3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462E4,-1125871200,-1112565600,-1094421600,-1081116E3,-1067810400,-1045432800,-1031522400,-1018216800,-1000072800,-986767200,-968018400,
-955317600,-936568800,-923263200,-905119200,-891813600,-883612800,-880236E3,-769413600,-765410400,-757382400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612E3,-620863200,-608162400,-589413600,-576108E3,-557964E3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836E3,-400111200,-384386400,-368661600,-352936800,-337212E3,-321487200,-305762400,-289432800,-273708E3,-257983200,-242258400,-226533600,-210808800,-195084E3,-179359200,
-163634400,-147909600,-13158E4,-11646E4,-100130400,-94694400,-84405600,-68680800,-52956E3,-37231200,-21506400,-5781600,9943200,25668E3,41392800,57722400,73447200,89172E3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924E3,325648800,341373600,357098400,372823200,388548E3,404877600,419997600,436327200,452052E3,467776800,483501600,499226400,514951200,530676E3,544586400,562125600,576036E3,59418E4,607485600,625629600,
638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788E3,814932E3,828842400,846381600,860292E3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684E3,1049594400,1067133600,1081044E3,1099188E3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028E3,1225591200,1236477600,1257040800,1268532E3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444E3,1394330400,
1414893600,142578E4,1446343200,1457834400,1478397600,1489284E3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196E3,1615687200,1636250400,1647136800,16677E5,1678586400,1699149600,1710036E3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452E3,1899338400,1919901600,315569527201],offset:[-21036,-21600,-18E3,-21600,-18E3,-21600,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,
-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-21600,-18E3,-18E3,-21600,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,
-18E3,-21600,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,
-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600,-18E3,-21600]},"America/Toronto":{time:[-2366755200,-1632088800,-1615154400,-1609459200,-1601771400,-1583712E3,-1567375200,-1554681600,-1534716E3,-1524088800,-1503266400,
-149238E4,-1471816800,-1460930400,-1440972E3,-1428876E3,-1409522400,-1397426400,-1378072800,-1365976800,-1346623200,-1333922400,-1315173600,-1301868E3,-1283724E3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1188770400,-1176069600,-1157320800,-1144015200,-1125871200,-1112565600,-1094421600,-1081116E3,-1062972E3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-880232400,-76941E4,-765410400,-757382400,-747266400,-733960800,-715824E3,-702518400,
-684374400,-671068800,-652924800,-634176E3,-620863200,-602719200,-589413600,-576108E3,-557964E3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-384386400,-368661600,-352936800,-337212E3,-321487200,-305762400,-289432800,-273708E3,-257983200,-242258400,-226533600,-210808800,-195084E3,-179359200,-163634400,-147909600,-13158E4,-11646E4,-100130400,-84405600,-68680800,-52956E3,-37231200,-21506400,-5781600,9943200,25668E3,41392800,57722400,73447200,
89172E3,104896800,120621600,126230400,136346400,152071200,167796E3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924E3,325648800,341373600,357098400,372823200,388548E3,404877600,419997600,436327200,452052E3,467776800,483501600,499226400,514951200,530676E3,544586400,562125600,576036E3,59418E4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788E3,814932E3,828842400,846381600,860292E3,877831200,
891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684E3,1049594400,1067133600,1081044E3,1099188E3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028E3,1225591200,1236477600,1257040800,1268532E3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444E3,1394330400,1414893600,142578E4,1446343200,1457834400,1478397600,1489284E3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196E3,1615687200,1636250400,
1647136800,16677E5,1678586400,1699149600,1710036E3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452E3,1899338400,1919901600,315569527201],offset:[-19052,-18E3,-14400,-18E3,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,
-18E3,-14400,-18E3,-14400,-14400,-14400,-18E3,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,
-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,
-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3,-14400,-18E3]},"America/Vancouver":{time:[-2713910400,-1632088800,-1615154400,-880236E3,-769420800,-765410400,-747266400,-732751200,-715816800,-702511200,-684367200,-671061600,-652917600,-639612E3,-620863200,-608162400,-589413600,-576108E3,-557964E3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,
-368661600,-355356E3,-337212E3,-323906400,-305762400,-292456800,-273708E3,-261007200,-242258400,-226533600,-210808800,-195084E3,-179359200,-163634400,-147909600,-13158E4,-11646E4,-100130400,-84405600,-68680800,-52956E3,-37231200,-21506400,-5781600,9943200,25668E3,41392800,57722400,73447200,89172E3,104896800,120621600,136346400,152071200,167796E3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924E3,325648800,341373600,357098400,372823200,388548E3,404877600,419997600,
436327200,452052E3,467776800,483501600,499226400,514951200,530676E3,536457600,544586400,562125600,576036E3,59418E4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788E3,814932E3,828842400,846381600,860292E3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684E3,1049594400,1067133600,1081044E3,1099188E3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,
1205028E3,1225591200,1236477600,1257040800,1268532E3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444E3,1394330400,1414893600,142578E4,1446343200,1457834400,1478397600,1489284E3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196E3,1615687200,1636250400,1647136800,16677E5,1678586400,1699149600,1710036E3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452E3,1899338400,1919901600,315569527201],
offset:[-29548,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,
-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,
-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Argentina/Buenos_Aires":{time:[-2372112E3,-1567468800,-1233446400,-1222992E3,-1205971200,-1194048E3,-117288E4,-1162512E3,-1141344E3,-1130976E3,-1109808E3,-109944E4,-1078272E3,-1067817600,-1046649600,-1036281600,-1015113600,-1004745600,-983577600,
-973209600,-952041600,-941587200,-931046400,-900892800,-890352E3,-83376E4,-82728E4,-752284800,-733795200,-197337600,-190857600,-184204800,-164505600,-152668800,-132969600,-121132800,-101433600,-86832E3,-71107200,-54777600,-39052800,-23328E3,-7603200,128131200,136598400,596937600,605059200,624412800,636508800,656467200,667958400,687916800,699408E3,719366400,731462400,938908800,952041600,1198972800,1205625600,1224374400,1237075200,315569527201],offset:[-14028,-15408,-14400,-10800,-14400,-10800,-14400,
-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-10800,-10800,-7200,-10800,-7200,-10800]},"America/Bogota":{time:[-2707689600,-1739059200,704851200,733881600,315569527201],offset:[-17776,-17776,-18E3,-14400,-18E3]},
"Europe/Moscow":{time:[-2840140800,-1688256E3,-165681E4,-1641340800,-1627956E3,-1618700400,-1596416400,-1593813600,-1589846400,-1542416400,-1539478800,-1525305600,-1522713600,-1491177600,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532E3,528260400,543981600,55971E4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701823600,717548400,733284E3,749012400,764733600,780462E3,796183200,811911600,
828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036E3,972788400,985485600,1004238E3,101754E4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788E3,1193540400,1206842400,122499E4,1238292E3,1256439600,1269741600,1288494E3,1301191200,315569527201],offset:[9020,9E3,9048,12648,9048,16248,12648,16248,14400,10800,14400,18E3,14400,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,
14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400]},"Europe/Athens":{time:[-2344636800,-1686095940,-1182988800,-1178150400,-906854400,-904867200,-85725E4,-844473600,-828230400,-812419200,-552355200,-541641600,166492800,186195600,198036E3,213764400,228880800,
244090800,260330400,275457600,291805200,307418400,323395200,338947200,347155200,354682800,370411200,386132400,401860800,417582E3,433310400,449031600,465364800,481086E3,496814400,512535600,528264E3,543985200,559713600,575434800,591163200,606884400,622612800,638334E3,654667200,670388400,686116800,701838E3,717566400,733287600,749016E3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288E3,92259E4,941342400,954039600,972792E3,985489200,1004241600,1017543600,
1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342E3,1162094400,1174791600,1193544E3,1206846E3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296E3,1427598E3,1445745600,1459047600,14778E5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835E4,1667102400,1679799600,1698552E3,1711854E3,1730001600,1743303600,1761451200,
1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102E3,1887854400,1901156400,1919304E3,315569527201],offset:[5692,5692,7200,10800,7200,10800,7200,3600,7200,3600,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,
7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Berlin":{time:[-2422051200,-1693702800,-1680476400,-1663452E3,-1650142800,-1632002400,-1618693200,-938901600,-85725E4,-844552800,-828219600,-812498400,-79677E4,-781048800,-776556E3,
-765925200,-761173200,-757382400,-748476E3,-733266E3,-717627600,-714603600,-71037E4,-701902800,-684972E3,-670453200,-654127200,-639003600,315532800,323834400,338958E3,354679200,370407600,386128800,401857200,417578400,433306800,449028E3,465361200,481082400,496810800,512532E3,528260400,543981600,55971E4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284E3,749012400,764733600,780462E3,796183200,811911600,828237600,846385200,859687200,877834800,
891136800,909284400,922586400,941338800,954036E3,972788400,985485600,1004238E3,101754E4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788E3,1193540400,1206842400,122499E4,1238292E3,1256439600,1269741600,1288494E3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742E3,1459044E3,1477796400,1490493600,1509246E3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,
1648346400,1667098800,1679796E3,1698548400,1711850400,1729998E3,17433E5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,315569527201],offset:[3208,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,10800,7200,3600,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,3600,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,
3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/London":{time:[-3852662400,-1691964E3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034E3,
-1570399200,-1552165200,-1538344800,-152253E4,-15075E5,-1490562E3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732E3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314E3,-1315778400,-1301259600,-1284328800,-126981E4,-1253484E3,-1238360400,-1221429600,-1206910800,-118998E4,-1175461200,-1159135200,-1143406800,-1126476E3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058E3,-1032127200,-1017608400,-1001282400,-986158800,-969228E3,-950475600,-942012E3,-904514400,-896043600,-875484E3,
-864594E3,-844034400,-832539600,-812584800,-798066E3,-781048800,-772059600,-764802E3,-748476E3,-733352400,-719445600,-717026400,-706741200,-699483600,-687996E3,-668034E3,-654732E3,-636584400,-622072800,-605739600,-590623200,-57429E4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422E4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298E3,-306972E3,-291848400,-276732E3,-257979600,-245282400,-22653E4,-213228E3,-195080400,-182383200,-163630800,
-150933600,-132181200,-119484E3,-100731600,-88034400,-68677200,-59004E3,-37238400,57726E3,69818400,89175600,101268E3,120625200,132717600,152074800,164167200,183524400,196221600,214974E3,227671200,246423600,259120800,278478E3,290570400,309927600,32202E4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676E3,543978E3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,
733280400,751428E3,76473E4,782877600,796179600,814327200,820454400,828234E3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482E3,1004234400,1017536400,1035684E3,1048986E3,1067133600,1080435600,1099188E3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436E3,1269738E3,1288490400,1301187600,131994E4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,
149049E4,1509242400,1521939600,1540692E3,1553994E3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444E3,1774746E3,1792893600,1806195600,1824948E3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,315569527201],offset:[75,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,
7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,
0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Madrid":{time:[-2177452800,-1661734800,-1648425600,-1631926800,-1616889600,-1601254800,-1585353600,-1442451600,-1427673600,-1379293200,-1364774400,-1348448400,-1333324800,-1316394E3,-1301270400,-1284339600,-1269820800,-1029114E3,-1017619200,-1002848400,-986169600,-969238800,-954115200,-940208400,-873075600,-862531200,-842835600,-828230400,-811386E3,
-796003200,-779936400,-765414E3,-748486800,-733881600,-652323600,-639183600,135126E3,150253200,167180400,181702800,196815600,212547600,22887E4,243997200,260406E3,276051600,283996800,29178E4,307508400,323834400,338958E3,354679200,370407600,386128800,401857200,417578400,433306800,449028E3,465361200,481082400,496810800,512532E3,528260400,543981600,55971E4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284E3,749012400,764733600,780462E3,796183200,
811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036E3,972788400,985485600,1004238E3,101754E4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788E3,1193540400,1206842400,122499E4,1238292E3,1256439600,1269741600,1288494E3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742E3,1459044E3,1477796400,1490493600,1509246E3,1521943200,1540695600,1553997600,
1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796E3,1698548400,1711850400,1729998E3,17433E5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,315569527201],offset:[884,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,3600,7200,3600,7200,3600,7200,3600,
7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Paris":{time:[-2486678340,
-1855958340,-1689814800,-1680393600,-1665363600,-1648339200,-1635123600,-1616889600,-1604278800,-158544E4,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1470618E3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224E3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394E3,-1301270400,-1284339600,-1269820800,-1253494800,-1238371200,-1221440400,-1206921600,-1191200400,-1175472E3,-1160355600,-1143417600,-1127696400,-1111968E3,-1096851600,-1080518400,-1063587600,-1049068800,
-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942012E3,-932432400,-85725E4,-844552800,-828219600,-812498400,-800064E3,-796258800,-781048800,-766616400,196822800,212547600,220924800,228880800,244004400,260330400,276058800,29178E4,307508400,323834400,338958E3,354679200,370407600,386128800,401857200,417578400,433306800,449028E3,465361200,481082400,496810800,512532E3,528260400,543981600,55971E4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,
717562800,733284E3,749012400,764733600,780462E3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036E3,972788400,985485600,1004238E3,101754E4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788E3,1193540400,1206842400,122499E4,1238292E3,1256439600,1269741600,1288494E3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742E3,1459044E3,1477796400,
1490493600,1509246E3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796E3,1698548400,1711850400,1729998E3,17433E5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,315569527201],offset:[561,561,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,
3600,7200,3600,7200,3600,7200,3600,3600,7200,3600,7200,3600,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,
7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Warsaw":{time:[-2840140800,-1717027200,-1693702800,-1680476400,-1663452E3,-1650142800,-1632002400,-1618693200,-1600466400,-1587157200,-1501718400,-931730400,-857253600,-844552800,-828219600,-812498400,-796867200,-796600800,-778723200,-762652800,-748483200,-733266E3,-715212E3,-701902800,-684972E3,-670453200,-654127200,-639003600,-397090800,-386805600,-371084400,-355356E3,-334191600,-323301600,
-307580400,-291852E3,-271292400,-260402400,-239842800,-228952800,-208393200,-197503200,-176338800,-166053600,220924800,228877200,244000800,260326800,276055200,291776400,307504800,323830800,338954400,354675600,370404E3,386125200,401853600,417574800,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978E3,559706400,567993600,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284E3,749012400,764733600,780462E3,796183200,811911600,
828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036E3,972788400,985485600,1004238E3,101754E4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788E3,1193540400,1206842400,122499E4,1238292E3,1256439600,1269741600,1288494E3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742E3,1459044E3,1477796400,1490493600,1509246E3,1521943200,1540695600,1553997600,1572145200,
1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796E3,1698548400,1711850400,1729998E3,17433E5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,315569527201],offset:[5040,5040,3600,7200,3600,7200,3600,7200,7200,10800,7200,3600,3600,3600,7200,3600,7200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,3600,7200,3600,7200,
3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,
3600,7200,3600,7200,3600]},"Europe/Istanbul":{time:[-2840140800,-1869868800,-1693699200,-168048E4,-1570406400,-1552176E3,-1538352E3,-1522540800,-1507507200,-1490572800,-1440201600,-1428019200,-1409702400,-1396483200,-931132800,-922752E3,-917827200,-892425600,-875836800,-857347200,-781056E3,-764726400,-744336E3,-733795200,-716428800,-701913600,-684979200,-670464E3,-654134400,-639014400,-621820800,-60696E4,-590025600,-575424E3,-235612800,-228268800,-177724800,-165715200,10540800,23846400,41990400,55296E3,
74044800,87350400,107917200,12123E4,133927200,152686800,165369600,183513600,202435200,215568E3,228873600,245808E3,260323200,277257600,291783600,308793600,323838E3,340243200,354682800,371692800,386132400,403142400,428457600,433900800,482803200,496713600,512532E3,528260400,543981600,55971E4,575431200,591159600,606880800,622609200,638330400,654663600,670381200,686109600,701830800,717559200,733280400,749008800,76473E4,780458400,796179600,811908E3,828234E3,846381600,859683600,877831200,891133200,909280800,
922582800,941335200,954032400,972784800,985482E3,1004234400,1017536400,1035684E3,1048986E3,1067133600,1080435600,1099188E3,1111885200,1130637600,1143334800,1162087200,1167609600,1174791600,1193544E3,1206846E3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1301281200,1319943600,1332644400,1351396800,1364698800,1382846400,1396148400,1414296E3,1427598E3,1445745600,1459047600,14778E5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,
1635652800,164835E4,1667102400,1679799600,1698552E3,1711854E3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102E3,1887854400,1901156400,1919304E3,315569527201],offset:[6952,7016,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,
10800,7200,10800,7200,10800,14400,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,7200,10800,7200,10800,7200,10800,7200,10800,7200,7200,7200,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,
7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Australia/Sydney":{time:[-2364076800,-1672531140,-1665352800,-883605600,-876088800,-860364E3,-844639200,-828309600,-813189600,31536E3,57722400,68007600,89172E3,100062E3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924E3,320814E3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,
478666800,499226400,511326E3,530071200,542775600,562125600,57483E4,59418E4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932E3,828241200,846381600,859690800,877831200,891140400,909280800,92259E4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684E3,1048993200,1067133600,1080442800,1099188E3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172E3,1238900400,1254621600,
127035E4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924E3,1459652400,1475373600,1491102E3,1506823200,1522551600,1538877600,1554606E3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676E3,1680404400,1696125600,1712458800,172818E4,1743908400,1759629600,1775358E3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,315569530801],offset:[36292,36E3,39600,36E3,39600,
36E3,39600,36E3,39600,36E3,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,
39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600,36E3,39600]},"Asia/Tokyo":{time:[-2587678861,-2335219200,-1009843200,-683762400,-672357600,-654732E3,-640908E3,-620258400,-609458400,-588808800,-578008800,315569527201],offset:[33539,32400,32400,32400,36E3,32400,36E3,32400,36E3,32400,36E3,32400]},"Asia/Taipei":{time:[-2335219200,-778550400,-765331200,-747014400,-733795200,-715478400,
-702259200,-683856E3,-670636800,-65232E4,-639100800,-620784E3,-607564800,-589248E3,-576028800,-562896E3,-541728E3,-528681600,-510192E3,-497145600,-478656E3,-465609600,-449798400,-433987200,-418176E3,-402451200,-38664E4,-370915200,-355104E3,-339379200,-323568E3,-302486400,-291945600,-270950400,-260409600,134006400,149817600,165542400,181353600,299548800,307497600,315569527201],offset:[29160,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,
28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Singapore":{time:[-2177452800,-2038176E3,-1167609600,-1073001600,-894153600,-879638400,-766972800,-138758400,378691200,315569527201],offset:[24925,24925,25200,25200,26400,27E3,32400,27E3,27E3,28800]},"Asia/Shanghai":{time:[-1325462400,-933465600,-923097600,-908755200,-891561600,-662688E3,515548800,52704E4,545184E3,558489600,576633600,589939200,608688E3,
621993600,640137600,653443200,671587200,684892800,315569527201],offset:[29157,28800,32400,28800,32400,28800,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Seoul":{time:[-2524521600,-2053900800,-1325462400,-1199232E3,-498096E3,-303955200,-293500800,-264902400,-39484800,547603200,560908800,579052800,592358400,315569527201],offset:[30472,30600,32400,30600,32400,28800,32400,28800,30600,32400,36E3,32400,36E3,32400]},"Asia/Bangkok":{time:[-2840140800,-1570060800,315569527201],
offset:[24124,24124,25200]},"Asia/Jerusalem":{time:[-2840140800,-1640995200,-933638400,-857347200,-844293600,-825811200,-812678400,-794188800,-779846400,-762645600,-748303200,-731116800,-681955200,-673228800,-667951200,-65232E4,-636415200,-62208E4,-608936400,-59184E4,-572475600,-558568800,-542840400,-527724E3,-514414800,-490838400,-482976E3,-459468E3,-451526400,-428544E3,-418251600,-400024800,-387417600,142387200,150854400,167184E3,178675200,482284800,495590400,516758400,526435200,545443200,558489600,
576547200,589248E3,609897600,620784E3,638323200,651628800,669772800,683683200,701827200,715737600,733708800,747187200,765158400,778032E3,796608E3,810086400,826848E3,842832E3,858902400,874195200,890352E3,90504E4,923018400,936324E3,955677600,970794E3,986778E3,1001293200,1017363600,1033952400,1048813200,1065142800,1081299600,1095814800,1112320800,1128823200,1143770400,1159668E3,117522E4,1189908E3,1206669600,1223172E3,1238119200,1254016800,1269568800,1284256800,1301623200,1317520800,1333072800,1348365600,
1364522400,1382839200,1395972E3,1414288800,1427421600,1445738400,1458871200,1477792800,1490320800,1509242400,1521770400,1540692E3,1553824800,1572141600,1585274400,1603591200,1616724E3,1635645600,1648173600,1667095200,1679623200,1698544800,1711677600,1729994400,1743127200,1761444E3,1774576800,1792893600,1806026400,1824948E3,1837476E3,1856397600,1868925600,1887847200,190098E4,1919296800,315569527201],offset:[8454,8440,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,14400,10800,7200,10800,
7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,
7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Asia/Kolkata":{time:[-2840140800,-891561600,-872035200,-862617600,-764121600,315569527201],offset:[21208,21200,23400,19800,19800,19800]},"Asia/Hong_Kong":{time:[-2056665600,-907360200,-891635400,-884217600,-766713600,-747952200,-728512200,-717021E3,-694470600,-683757E3,-668032200,-654726600,-636582600,-623277E3,-605133E3,-591827400,-573683400,-559773E3,-542320200,-528323400,-510179400,
-498083400,-478729800,-466633800,-446675400,-435184200,-415225800,-403129800,-383776200,-371680200,-352326600,-340230600,-320877E3,-308781E3,-288822600,-277331400,-257373E3,-245881800,-225923400,-213827400,-194473800,-182377800,-163024200,-148509E3,-132784200,-117059400,-101334600,-85609800,-69280200,-53555400,-37830600,-22105800,-6381E3,9343800,25068600,40793400,56518200,72243E3,88572600,104297400,120022200,126070200,135747E3,151471800,167196600,182921400,198646200,214371E3,295414200,309324600,315569527201],
offset:[27402,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,32400,28800,32400,28800,32400,28800,32400,28800]}};"undefined"!==typeof module&&module.exports?module.exports=a:this.TzData=
a})(this);(function(){function a(a){var c=b[a];c||("UTC"!==a&&"Etc/UTC"!==a&&console.error("unknown timezone: "+a),c={time:[],offset:[]});c.time.length!==c.offset.length&&(console.error("timezone transition table doesn't match offset table"),c={time:[],offset:[]});if(!c.time_utc){a=c.time;for(var f=c.offset,g=a.length,h=Array(g),k=0;k<g;k++)a[k]*=1E3,f[k]*=1E3,h[k]=a[k]-f[k];c.time_utc=h}this.tz=c}var b=this.TzData?this.TzData:require("./tzdata.js");a.prototype.offset_utc=function(b){return a._offset(this.tz.time_utc,
this.tz.offset,b)};a.prototype.offset_loc=function(b){return a._offset(this.tz.time,this.tz.offset,b)};a._offset=function(a,b,c){a:{var g=a.length;if(0===g)a=-1;else{for(var h=0,k=g-1,m=(h+k)/2|0;;){if(a[m]>c){if(k=m-1,k<h){a=m;break a}}else if(h=m+1,k<h){a=m<g-1?m+1:-1;break a}m=(h+k)/2|0}a=void 0}}return-1===a?0:b[a]};var c={SUNDAY:1,MONDAY:2,TUESDAY:3,WEDNESDAY:4,THURSDAY:5,FRIDAY:6,SATURDAY:7,JANUARY:0,DECEMBER:11,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,
MINUTE:12,SECOND:13,minutesPerDay:1440,secondsPerDay:864E5,get_year:function(a){return a.getUTCFullYear()},get_month:function(a){return a.getUTCMonth()},get_hours:function(a){return a.getUTCHours()},get_minutes:function(a){return a.getUTCMinutes()},get_seconds:function(a){return a.getUTCSeconds()},get_day_of_month:function(a){return a.getUTCDate()},get_day_of_week:function(a){return a.getUTCDay()+1},get_day_of_year:function(a){var b=Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0);return((a.getTime()-b)/
c.secondsPerDay|0)+1},get_week_of_year:function(a){var b=Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0);a=c.clone(a);c.set_hms(a,0,0,0,0);a.setUTCDate(a.getUTCDate()+4-(a.getUTCDay()||7));return((a.getTime()-b)/c.secondsPerDay+1)/7|0},get_minutes_from_midnight:function(a){return 60*c.get_hours(a)+c.get_minutes(a)},set_hms:function(a,b,c,g,h){a.setUTCHours(b);a.setUTCMinutes(c);a.setUTCSeconds(g);a.setUTCMilliseconds(h)},add_date:function(a,b){a.setTime(a.getTime()+b*c.secondsPerDay)},clone:function(a){return new Date(a.getTime())},
get_days_per_year:function(a){a=a.getUTCFullYear();return this.days_per_year(a)},days_per_year:function(a){return 0!==a%4||0===a%100&&0!==a%400?365:366},get_part:function(a,b){switch(b){case c.YEAR:return c.get_year(a);case c.MONTH:return c.get_month(a);case c.DAY_OF_MONTH:return c.get_day_of_month(a);case c.WEEK_OF_YEAR:return c.get_week_of_year(a);case c.DAY_OF_WEEK:return c.get_day_of_week(a);case c.HOUR_OF_DAY:return c.get_hours(a);case c.MINUTE:return c.get_minutes(a);case c.DAY_OF_YEAR:return c.get_day_of_year(a);
case c.SECOND:return c.get_seconds(a);default:return a.getTime()}},time_minutes:function(a){return 6E4*a},time_minutes_diff:function(a,b){return((a/1E3|0)-(b/1E3|0))/60|0},utc_to_cal:function(a,b){var c=a.offset_utc(b);return new Date(b+c)},get_cal:function(a,b,c,g){return new Date(Date.UTC(b,c,g))},cal_to_utc:function(a,b){var c=b.getTime(),g=a.offset_loc(c);return c-g},get_timezone:function(b){return new a(b)}};"undefined"!==typeof module&&module.exports?module.exports=c:this.PineJsCalendar=c})(this);(function(){function a(a,b){switch(a){case "D":return new l(b);case "W":return new s;case "M":return new u}console.error("unknown dwm resolution: "+a);return null}function b(a,b,c,d){var e=b;a.moveTo(e);for(var f=[],g=0,h=0;!d(f,e);){if(20<g)throw"Internal error 0x10 while extrapolating "+c;e=a.indexOfBar(e);if(e===C)e=a.startOfBar("front"==c?0:C);else if(e===H)e=a.startOfBar("front"==c?H:0);else{var k=a.startOfBar(e);if(k!=b){if(h&&h==k)throw"Internal error 0x11 while extrapolating "+c;h=k;g=0;f.push(k)}e=
"front"==c?a.startOfBar(e+1):a.startOfBar(e-1)}a.moveTo(e);g++}return"front"==c?f:f.reverse()}function c(a){if(isNaN(a))return NaN;var b=this.indexOfBar(a);b===H&&(this.moveTo(a),b=this.indexOfBar(a));return 0>b?NaN:this.startOfBar(b)}function d(a,b){this.period=a;this.session=b;this.sessionEnd=this.sessionStart=Number.MIN_VALUE}function e(a,b,c,d){this.period=c;this.sessionTgt=a;this.sessionSrc=b||a;this.builder=d;this.periodStart=-Number.MAX_VALUE;this.periodEnd=-Number.MAX_VALUE;this.periodLastBarStart=
-Number.MAX_VALUE}function f(a,b,c){c=c||"front";var d=D.get_day_of_week(b),e=D.get_minutes_from_midnight(b);a=a.findSession(d,e);var e=a.start(),f=a.dayOfWeek(),g=a.isOvernight(),h=0;"front"==c?h=(f-d+7)%7-(g?1:0):(h=-(g?1:0),f!=d&&(1==d?h-=2:7==d&&(h-=1)));0!==h&&D.add_date(b,h);D.set_hms(b,e/60|0,e%60,0,0);return a.length()}function g(a,b){var c=D.get_day_of_week(b),d=D.get_minutes_from_midnight(b);a.findSession(c,d).isOvernight()&&D.add_date(b,1);D.set_hms(b,0,0,0,0);return b}function h(a,b,c,
d){c=D.clone(c);f(b,c,d);return D.cal_to_utc(a,c)}function k(a){a=D.get_day_of_week(a)-D.MONDAY;return 0>a?6:a}function m(a,b){var c=D.get_day_of_year(a)-1,d=k(a)-c%7;if(0===d)return c;0>d&&(d+=7);b&&(d-=7);return d+c}function n(){}function q(){}function l(a){this.session=a}function s(){}function u(){}function z(a,b,c){this._dayOfWeek=a;this._start=b;this._length=c}function t(a,b){return a.compareTo(b)}function B(a){a=a||"0000-0000";this.entries=[];if("24x7"===a.toLowerCase())this.isTradedOnWeekEnds=
!0,I.forEach(function(a){this.addSessionEntry(a,0,0)},this);else{var b=this.isTradedOnWeekEnds=!1,c={};a.split("|").forEach(function(a){var d=a.split(":");1!==d.length&&2!==d.length&&console.error("bad session section: "+a);var e=1===d.length;e&&(b&&console.error("duplicated default section: "+a),b=!0);(e?F:A(d[1])).forEach(function(a){e&&c[a]||(c[a]=d[0])},this)},this);F.forEach(function(b){var d=c[b];void 0===d&&(console.error("no session defined for weekday (1-Sunday ... 7-Saturday): "+b),d="0000-0000");
d.split(",").forEach(function(c){var d=c.split("-");2!==d.length&&(console.error("bad sessions spec: "+a),d=["0000","0000"]);c=parseInt(d[0]);d=parseInt(d[1]);this.addSessionEntry(b,c%100+60*(c/100|0),d%100+60*(d/100|0))},this)},this)}this.entries.sort(t)}function A(a){for(var b=[],c=0;c<a.length;c++){var d=a.charAt(c)-0;(d<D.MONDAY||d>D.FRIDAY)&&console.error("bad day of week (valid 2-Monday ... 6-Friday): "+d);-1===b.indexOf(d)&&b.push(d)}return b}function w(){}function v(a,b,c){var d=a.length;
if(0===d)return-1;for(var e=0,f=d-1,g=(e+f)/2|0;;){var h=c(a[g],b);if(0===h||0<h){if(f=g-1,f<e)return g}else if(e=g+1,f<e)return g<d-1?g+1:-1;g=(e+f)/2|0}}var C=-1,H=-2,D=this.PineJsCalendar?this.PineJsCalendar:require("./calendar.js");d.prototype.alignTime=c;d.prototype.indexOfBar=function(a){return a<this.sessionStart?C:a>=this.sessionEnd?H:D.time_minutes_diff(a,this.sessionStart)/this.period|0};d.prototype.startOfBar=function(a){return a===H?this.sessionEnd:0>a?this.prevSessionEnd+D.time_minutes(this.period*
a):this.sessionStart+D.time_minutes(this.period*a)};d.prototype.isLastBar=function(a,b){var c=this.sessionStart+D.time_minutes(this.period*(a+1)-1);return b>=c};d.prototype.moveTo=function(a){var b=this.session.timezone,c=D.utc_to_cal(b,a);a=this.session.spec;var d=f(a,c);this.sessionStart=D.cal_to_utc(b,c);this.sessionEnd=this.sessionStart+D.time_minutes(d);c=D.utc_to_cal(b,this.sessionStart-D.time_minutes(this.period));a=f(a,c,"back");b=D.cal_to_utc(b,c);this.prevSessionEnd=b+D.time_minutes(a);
if(b==this.sessionStart)throw"Internal error 0x12";};e.prototype.alignTime=c;e.prototype.indexOfBar=function(a){return a<this.periodStart?C:a>=this.periodEnd?H:0};e.prototype.startOfBar=function(a){return a===H||0<a?this.periodEnd:-3===a?this.periodLastBarStart:a===C?this.prevPeriodStart:this.periodStart};e.prototype.isLastBar=function(a,b){return b>=this.periodLastBarStart};e.prototype.moveTo=function(a){a=D.utc_to_cal(this.sessionSrc.timezone,a);a=g(this.sessionSrc.spec,a);var b=D.get_year(a),c=
(this.builder.indexOfPeriod(a)/this.period|0)*this.period,d=c+this.period;a=this.sessionTgt.spec;var e=this.sessionTgt.timezone;this.periodStart=h(e,a,this.builder.startOfPeriod(e,c,b));this.prevPeriodStart=h(e,a,this.builder.startOfPeriod(e,c-this.period,b),"back");b=this.builder.startOfPeriod(e,d,b);this.periodEnd=h(e,a,b);c=1;if(!a.isTradedOnWeekEnds)switch(k(b)){case 0:c+=2;break;case 6:c+=1}D.add_date(b,-c);this.periodLastBarStart=h(e,a,b);if(this.periodLastBarStart<this.periodStart||this.periodLastBarStart===
this.periodEnd)this.periodLastBarStart=this.periodStart};n.prototype.indexOfPeriod=function(a){return D.get_day_of_year(a)-1};n.prototype.startOfPeriod=function(a,b,c){a=D.get_cal(a,c,D.JANUARY,1);c=D.get_days_per_year(a);D.add_date(a,Math.min(b,c));return a};q.prototype.uber=new n;q.prototype.indexOfPeriod=function(a){var b=this.uber.indexOfPeriod(a);a=m(a,!1);return b-(2*(a/7|0)+(6===a%7?1:0))};q.prototype.startOfPeriod=function(a,b,c){var d=D.get_cal(a,c,D.JANUARY,1),d=(k(d)+b)/5;return this.uber.startOfPeriod(a,
b+2*(d|0),c)};l.prototype.indexOfPeriod=function(a){return this.builder().indexOfPeriod(a)};l.prototype.startOfPeriod=function(a,b,c){return this.builder().startOfPeriod(a,b,c)};l.prototype.builder=function(){this._builder||(this._builder=this.session.spec.isTradedOnWeekEnds?new n:new q);return this._builder};s.prototype.indexOfPeriod=function(a){return m(a,!0)/7|0};s.prototype.startOfPeriod=function(a,b,c){var d=D.get_cal(a,c,D.JANUARY,1),e=k(d);b=0===e?7*b:7*(b+1)-e;e=D.get_days_per_year(d);if(b>
e)return this.startOfPeriod(a,0,c+1);D.add_date(d,b);return d};u.prototype.indexOfPeriod=function(a){return D.get_month(a)};u.prototype.startOfPeriod=function(a,b,c){if(0>b){var d=(-b+11)/12|0;c-=d;b+=12*d}if(b>D.DECEMBER)return D.get_cal(a,c+1,D.JANUARY,1);a=D.get_cal(a,c,b,1);b=k(a);4<b&&D.add_date(a,7-b);return a};z.prototype.start=function(){return 0>this._start?this._start+D.minutesPerDay:this._start};z.prototype.isOvernight=function(){return 0>this._start};z.prototype.dayOfWeek=function(){return this._dayOfWeek};
z.prototype.length=function(){return this._length};z.prototype.weight=function(){return this._dayOfWeek*D.minutesPerDay+this._start};z.prototype.compareTo=function(a){var b=this.weight(),c=b+this._length;a=a.weight();return b<=a&&a<c?0:b>a?1:-1};var F=[D.MONDAY,D.TUESDAY,D.WEDNESDAY,D.THURSDAY,D.FRIDAY],I=[D.SUNDAY,D.MONDAY,D.TUESDAY,D.WEDNESDAY,D.THURSDAY,D.FRIDAY,D.SATURDAY];B.prototype.addSessionEntry=function(a,b,c){c<=b&&0!=b&&(b-=D.minutesPerDay);this.entries.push(new z(a,b,c==b?D.minutesPerDay:
c-b))};B.prototype.indexOfSession=function(a,b){var c=v(this.entries,new z(a,b,0),t);return-1===c?0:c};B.prototype.findSession=function(a,b){return this.entries[this.indexOfSession(a,b)]};w.prototype.init=function(a,b){this.timezone=a;this.spec=new B(b);return this};var E={PRE_SESSION:C,POST_SESSION:H,LASTBAR_SESSION:-3,newBarBuilder:function(b,c,f,g){return""===b?new d(c,f):new e(f,g,c,a(b,f))},Session:w,alignDWMPeriodsBack:function(b,c,d,e,f){b=D.get_timezone(b);var k=(new w).init(b,c);c=k.spec;
d=a(d,k);f=D.utc_to_cal(b,f);k=g(c,f);f=D.get_year(k);e=d.indexOfPeriod(k)-e;return h(b,c,d.startOfPeriod(b,e,f))},extrapolateBarsBackByCount:function(a,c,d){return b(a,c,"back",function(a,b){return a.length>=d})},extrapolateBarsFrontByCount:function(a,c,d){return b(a,c,"front",function(a,b){return a.length>=d})},extrapolateBarsFrontToTime:function(a,c,d){return b(a,c,"front",function(a,b){return b>d})},lower_bound:v};"undefined"!==typeof module&&module.exports?module.exports=E:this.PineJsBarBuilder=
E}).call(this);(function(){function a(a,b,c,d,e){c=e;e=0;if(isNaN(a.get(b-1)))return{index:NaN,value:NaN};for(var f=0;f<b;++f)d(a.get(f),c)&&(e=f,c=a.get(f));return{index:e,value:c}}function b(a,b){return 100*a/b}function c(a,b,c,d,e){this._areaRight=a;this._areaLeft=b;this._pivotType=c;this._series=d;this._currentIndex=e.new_var(0);this._currentValue=e.new_var(NaN);this._pivotIndex=e.new_var(-1);this._index=t.n(e);this._isNewBar=e.symbol.isNewBar;a=this._currentIndex.get(1);b=this._currentValue.get(1);c=this._pivotIndex.get(1);
1<this._index&&(this._currentIndex.set(a),this._currentValue.set(b),this._pivotIndex.set(c))}function d(a,b,d){this._deviation=a;a=d.new_var(t.high(d));var e=d.new_var(t.low(d));a.get(2*b+1);e.get(2*b+1);this._pivotHigh=new c(b,b,c.HIGH,a,d);this._pivotLow=new c(b,b,c.LOW,e,d);this._lastVal=d.new_var(NaN);this._lastIndex=d.new_var(-1);this._lastType=d.new_var();this._index=t.n(d);this._isNewBar=d.symbol.isNewBar;this._isBarClosed=d.symbol.isBarClosed;b=this._lastIndex.get(1);d=this._lastVal.get(1);
a=this._lastType.get(1);1<this._index&&this.addPivot(b,d,a);this.processPivot(this._pivotHigh);this.processPivot(this._pivotLow)}function e(a){this.symbol=a;this.vars=[];this.vars_index=0;this.ctx=[];this.ctx_index=0}function f(a){this.mindepth=0;this.original=NaN;this.modified=!1;this.symbol=a}function g(a,b,c,d){this.periodBase=c;this.tickerid=a;this.period=b;this.index=-1;this.updatetime=this.volume=this.close=this.low=this.high=this.open=this.time=NaN;this.isBarClosed=this.isNewBar=!1;this.session=
new z.Session;this.other_sessions={};this.script=d;this.ticker=g.parseTicker(a);a=g.parsePeriod(b);this.resolution=a.resolution;this.interval=a.interval;this.bb_cache={}}function h(a,b,c,d,f,g,h){this.body=f;this.symbols=[];this.runner=d;this.inputCallback=h;this.out=g;this.ctx=new e(this.add_sym(a,b,c));this.init()}function k(a){this.symbols=[];this.barsets=[];this.subscription=[];this.host=a;this.isRecalculated=!1;this.start()}function m(a){this.runner=new k(a)}function n(a,b){this.info=a;this.bars=
b||[];this.isBarClosed=!0}function q(a,b){this.period=a;this.generateEmptyBars=!!b}function l(){}function s(){}var u=this.PineJsCalendar?this.PineJsCalendar:require("./calendar.js"),z=this.PineJsBarBuilder?this.PineJsBarBuilder:require("./barbuilder.js"),t={max_series_size:5E3,n:function(a){return a.symbol.index+1},nz:function(a,b){b=b||0;return isFinite(a)?a:b},na:function(a){return 0==arguments.length?NaN:isNaN(a)?1:0},isZero:function(a){return 1E-10>=Math.abs(a)},toBool:function(a){return isFinite(a)&&
!t.isZero(a)},eq:function(a,b){return t.isZero(a-b)},neq:function(a,b){return!t.eq(a,b)},ge:function(a,b){return t.isZero(a-b)||a>b},gt:function(a,b){return!t.isZero(a-b)&&a>b},lt:function(a,b){return!t.isZero(a-b)&&a<b},le:function(a,b){return t.isZero(a-b)||a<b},and:function(a,b){return isNaN(a)||isNaN(b)?NaN:t.isZero(a)||t.isZero(b)?0:1},or:function(a,b){return isNaN(a)||isNaN(b)?NaN:t.isZero(a)&&t.isZero(b)?0:1},not:function(a){return isNaN(a)?NaN:t.isZero(a)?1:0}};t.max=Math.max;t.min=Math.min;
t.pow=Math.pow;t.abs=Math.abs;t.log=Math.log;t.log10=function(a){return Math.log(a)/Math.LN10};t.sqrt=Math.sqrt;t.sign=function(a){return isNaN(a)?NaN:t.isZero(a)?0:0<a?1:-1};t.exp=Math.exp;t.sin=Math.sin;t.cos=Math.cos;t.tan=Math.tan;t.asin=Math.asin;t.acos=Math.acos;t.atan=Math.atan;t.floor=Math.floor;t.ceil=Math.ceil;t.round=Math.round;t.avg=function(a,b,c,d,e,f){if(2===arguments.length)return(a+b)/2;for(var g=0,h=0;h<arguments.length;h++)g+=arguments[h];return g/arguments.length};t.open=function(a){return a.symbol.open};
t.high=function(a){return a.symbol.high};t.low=function(a){return a.symbol.low};t.close=function(a){return a.symbol.close};t.hl2=function(a){return(a.symbol.high+a.symbol.low)/2};t.hlc3=function(a){return(a.symbol.high+a.symbol.low+a.symbol.close)/3};t.ohlc4=function(a){return(a.symbol.open+a.symbol.high+a.symbol.low+a.symbol.close)/4};t.volume=function(a){return a.symbol.volume};t.time=function(a,b,c){return a.symbol.bartime(b,c)};t.period=function(a){return a.symbol.period};t.tickerid=function(a){return a.symbol.tickerid};
t.ticker=function(a){return a.symbol.ticker};t.interval=function(a){return a.symbol.interval};t.isdwm=function(a){return a.symbol.isdwm()};t.isintraday=function(a){return!a.symbol.isdwm()};t.isdaily=function(a){return"D"===a.symbol.resolution};t.isweekly=function(a){return"W"===a.symbol.resolution};t.ismonthly=function(a){return"M"===a.symbol.resolution};t.year=function(a,b){return t.timepart(a.symbol,u.YEAR,b)};t.month=function(a,b){return t.timepart(a.symbol,u.MONTH,b)};t.weekofyear=function(a,
b){return t.timepart(a.symbol,u.WEEK_OF_YEAR,b)};t.dayofmonth=function(a,b){return t.timepart(a.symbol,u.DAY_OF_MONTH,b)};t.dayofweek=function(a,b){return t.timepart(a.symbol,u.DAY_OF_WEEK,b)};t.hour=function(a,b){return t.timepart(a.symbol,u.HOUR_OF_DAY,b)};t.minute=function(a,b){return t.timepart(a.symbol,u.MINUTE,b)};t.second=function(a,b){return t.timepart(a.symbol,u.SECOND,b)};t.timepart=function(a,b,c){a=u.utc_to_cal(a.timezone,c||a.bartime());return u.get_part(a,b)};t.rsi=function(a,b){return t.isZero(b)?
100:t.isZero(a)?0:100-100/(1+a/b)};t.sum=function(a,b,c){c=c.new_var();a=t.nz(a.get())+t.nz(c.get(1))-t.nz(a.get(b));c.set(a);return a};t.sma=function(a,b,c){c=t.sum(a,b,c);return t.na(a.get(b-1))?NaN:c/b};t.rma=function(a,b,c){var d=t.sum(a,b,c),e=b-1,f=a.get(e);c=c.new_var();var g=c.get(1);a=a.get();b=t.na(f)?NaN:t.na(g)?d/b:(a+g*e)/b;c.set(b);return b};t.fixnan=function(a,b){var c=b.new_var();if(isNaN(a))return c.get(1);c.set(a);return a};t.tr=function(a){var b=a.new_var(t.close(a));return t.max(t.max(t.high(a)-
t.low(a),t.abs(t.high(a)-b.get(1))),t.abs(t.low(a)-b.get(1)))};t.atr=function(a,b){var c=b.new_var(t.tr(b));return t.sma(c,a,b)};t.ema=function(a,b,c){var d=t.sum(a,b,c);c=c.new_var();var e=a.get(0);a=a.get(b-1);var f=c.get(1);b=t.na(a)?NaN:t.na(f)?d/b:2*(e-f)/(b+1)+f;c.set(b);return b};t.wma=function(a,b,c){c=0;for(var d=b=Math.round(b);0<=d;d--)c+=(b-d)*a.get(d);return 2*c/(b*(b+1))};t.vwma=function(a,b,c){var d=c.new_var(t.volume(c));a=c.new_var(a.get(0)*t.volume(c));return t.sma(a,b,c)/t.sma(d,
b,c)};t.swma=function(a,b){return(a.get(0)+2*a.get(1)+2*a.get(2)+a.get(3))/6};t.lowestbars=function(b,c,d){return-a(b,c,d,function(a,b){return t.lt(a,b)},Number.MAX_VALUE).index};t.lowest=function(b,c,d){return a(b,c,d,function(a,b){return t.lt(a,b)},Number.MAX_VALUE).value};t.highestbars=function(b,c,d){return-a(b,c,d,function(a,b){return t.gt(a,b)},Number.MIN_VALUE).index};t.highest=function(b,c,d){return a(b,c,d,function(a,b){return t.gt(a,b)},Number.MIN_VALUE).value};t.cum=function(a,b){var c=
b.new_var(),d=t.nz(c.get(1))+a;c.set(d);return d};t.accdist=function(a){t.open(a);var b=t.high(a),c=t.low(a),d=t.close(a),e=t.volume(a);return t.cum(d==b&&d==c||b==c?0:e*(2*d-c-b)/(b-c),a)};t.correlation=function(a,b,c,d){var e=t.sma(a,c,d),f=t.sma(b,c,d),g=d.new_var(a.get()*b.get());return(t.sma(g,c,d)-e*f)/Math.sqrt(t.variance2(a,e,c)*t.variance2(b,f,c))};t.stoch=function(a,c,d,e,f){c=t.highest(c,e);d=t.lowest(d,e);return t.fixnan(b(a.get()-d,c-d),f)};t.tsi=function(a,b,c,d){var e=d.new_var(t.change(a));
a=d.new_var(t.abs(t.change(a)));e=d.new_var(t.ema(e,c,d));c=d.new_var(t.ema(a,c,d));e=t.ema(e,b,d);b=t.ema(c,b,d);return e/b};t.cross=function(a,b,c){if(isNaN(a)||isNaN(b))return!1;a=c.new_var(0>a-b?-1:0==a-b?0:1);return!isNaN(a.get(1))&&a.get(1)!=a.get()};t.linreg=function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0;h<b;++h)var k=a.get(h),l=b-1-h+1,d=d+l,e=e+k,f=f+l*l,g=g+k*l;a=(b*g-d*e)/(b*f-d*d);return e/b-a*d/b+a+a*(b-1-c)};t.sar=function(a,b,c,d){function e(b,c){var d=n.get();q.set(b);n.set(c);s.set(1E3*
a);u.set(d);return d}var f=t.high(d),g=t.low(d),h=t.close(d),k=d.new_var(f),l=d.new_var(g),m=d.new_var(h).get(1),l=l.get(1),k=k.get(1),n=d.new_var(),q=d.new_var(),s=d.new_var(),u=d.new_var();d=u.get(1);if(isNaN(m))return NaN;isNaN(d)&&(t.ge(h,m)?(q.set(1),n.set(Math.max(f,k)),d=Math.min(g,l)):(q.set(-1),d=Math.max(f,k),n.set(Math.min(g,l))),s.set(1E3*a));if(1==q.get()){if(t.gt(f,n.get())&&(n.set(f),s.set(Math.min(s.get()+1E3*b,1E3*c))),t.le(g,d))return e(-1,g)}else if(t.lt(g,n.get())&&(n.set(g),s.set(Math.min(s.get()+
1E3*b,1E3*c))),t.ge(f,d))return e(1,f);b=d+s.get()*(n.get()-d)/1E3;1==q.get()?t.ge(b,g)&&(b=g-1E-7):t.le(b,f)&&(b=f+1E-7);u.set(b);return b};t.alma=function(a,b,c,d){c=Math.floor(c*(b-1));var e=b/d*(b/d);d=[];for(var f=0,g=0;g<b;++g){var h=Math.exp(-1*Math.pow(g-c,2)/(2*e)),f=f+h;d.push(h)}for(g=0;g<b;++g)d[g]/=f;for(g=c=0;g<b;++g)c+=d[g]*a.get(b-g-1);return c};t.wvap=function(a,b){return a.get()-a.get(1)};t.change=function(a){return a.get()-a.get(1)};t.roc=function(a,b){var c=a.get(b);return 100*
(a.get()-c)/c};t.dev=function(a,b,c){c=t.sma(a,b,c);return t.dev2(a,b,c)};t.dev2=function(a,b,c){for(var d=0,e=0;e<b;e++)var f=a.get(e),f=t.abs(f-c),d=d+f;return d/b};t.stdev=function(a,b,c){a=t.variance(a,b,c);return t.sqrt(a)};t.variance=function(a,b,c){c=t.sma(a,b,c);return t.variance2(a,c,b)};t.variance2=function(a,b,c){for(var d=0,e=0;e<c;e++)var f=a.get(e),f=t.abs(f-b),d=d+f*f;return d/c};t.percentrank=function(a,b){if(t.na(a.get(b-1)))return NaN;for(var c=0,d=a.get(),e=1;e<b;e++){var f=a.get(e);
t.ge(d,f)&&c++}return 100*c/b};c.LOW=0;c.HIGH=1;c.prototype.isPivotFound=function(){return-1!=this._pivotIndex.get()};c.prototype.pivotIndex=function(){return this._pivotIndex.get()};c.prototype.currentValue=function(){return this._currentValue.get()};c.prototype.pivotType=function(){return this._pivotType};c.prototype.reset=function(){this._currentValue.set(NaN);this._currentIndex.set(0);this._pivotIndex.set(-1)};c.prototype.isRightSideOk=function(a){return a-this._currentIndex.get()==this._areaRight};
c.prototype.isViolate=function(a,b){if(1>a||isNaN(this._currentValue.get()))return!0;var d=this._series.get(this._index-a);return isNaN(d)?!0:d===this._currentValue.get()?b:this._pivotType==c.HIGH?d>this._currentValue.get():d<this._currentValue.get()};c.prototype.processPoint=function(a){this.isViolate(a,!1)&&(this._currentValue.set(this._series.get()),this._currentIndex.set(a))};c.prototype.isRestartNeeded=function(a){return a-this._currentIndex.get()>this._areaRight};c.prototype.update=function(){this._isNewBar&&
this.isPivotFound()&&this.reset();this.processPoint(this._index);if(this.isRightSideOk(this._index)){if(-1==this._pivotIndex.get()){for(var a=!0,b=0;b<this._areaLeft;++b)if(this.isViolate(this._currentIndex.get()-1-b,!0)){a=!1;break}a&&this._pivotIndex.set(this._currentIndex.get())}}else-1!=this._pivotIndex.get()&&this._pivotIndex.set(-1);if(this.isRestartNeeded(this._index))for(this.reset(),b=0;b<=this._areaRight;++b)this.processPoint(this._index-this._areaRight+b)};d.prototype.addPivot=function(a,
b,c){this._lastIndex.set(a);this._lastVal.set(b);this._lastType.set(c)};d.prototype.updatePivot=function(a,b){this._lastIndex.set(a);this._lastVal.set(b)};d.prototype.lastPrice=function(){return this._lastVal.get()};d.prototype.lastIndex=function(){return this._lastIndex.get()};d.prototype.addPoint=function(a,b,d){if(isNaN(this._lastVal.get()))this.addPivot(a,b,d);else{var e=this._lastVal.get();this._lastType.get()==d?(d===c.HIGH?b>e:b<e)&&this.updatePivot(a,b):Math.abs(e-b)/b>this._deviation&&this.addPivot(a,
b,d)}};d.prototype.processPivot=function(a){a.update();this._isBarClosed&&a.isPivotFound()&&this.addPoint(a.pivotIndex(),a.currentValue(),a.pivotType())};t.zigzag=function(a,b,c){return(new d(a,b,c)).lastPrice()};t.zigzagbars=function(a,b,c){a=new d(a,b,c);return-1==a.lastIndex()?NaN:a.lastIndex()-t.n(c)};e.prototype.new_sym=function(a,b,c){return this.symbol.script.add_sym(a,b,c)};e.prototype.select_sym=function(a){this.symbol=this.symbol.script.get_sym(a)};e.prototype.new_var=function(a){var b=
this.vars;b.length<=this.vars_index&&b.push(new f(this.symbol));b=b[this.vars_index++];0<arguments.length&&b.set(a);return b};e.prototype.new_ctx=function(){this.ctx.length<=this.ctx_index&&this.ctx.push(new e(this.symbol));return this.ctx[this.ctx_index++]};e.prototype.prepare=function(a){for(var b=this.vars_index=this.ctx_index=0;b<this.vars.length;b++)this.vars[b].prepare(a);for(b=0;b<this.ctx.length;b++)this.ctx[b].prepare(a)};f.prototype.get=function(a){a=a||0;return this.hist?a>=this.hist.length?
(console.error("not enough depth: "+this),NaN):this._get(a):(this.mindepth=t.max(this.mindepth,a),NaN)};f.prototype._get=function(a){a=this.hist_pos-a;0>a&&(a+=this.hist.length);return this.hist[a]};f.prototype.set=function(a){this.hist&&(this.hist[this.hist_pos]=a,this.modified=!0)};f.prototype.prepare=function(a){a===this.symbol&&(a.isNewBar?(this.original=this.get(0),!this.modified&&this.hist||this.add_hist()):this.set(this.original),this.modified=!1)};f.prototype.add_hist=function(){if(!this.hist){for(var a=
t.na(this.mindepth)?t.max_series_size:t.min(this.mindepth+1,t.max_series_size),a=Math.round(a),b=Array(a),c=0;c<a;c++)b[c]=NaN;this.hist=b;this.hist_pos=-1}this.hist_pos=(this.hist_pos+1)%this.hist.length;this.hist[this.hist_pos]=this.original};f.prototype.adopt=function(a,b,c){this.hist||(this.mindepth=NaN);var d=b.get(),d=a.indexOf(d);0!==c&&(b=b.get(1),t.na(b)||(a=a.indexOf(b),d=d===a?-1:d));return 0>d?NaN:this._get(d)};f.prototype.indexOf=function(a){if(!this.hist)return this.mindepth=NaN,-1;
if(t.na(a))return-1;for(var b=this.symbol.index+1,c=this.hist.length,d=0,b=(b>c?c:b)-1,c=(b+d)/2|0;;){if(this._get(c)>a){if(d=c+1,d>b)return c+1}else if(b=c-1,d>b)return c;c=(b+d)/2|0}};g.parseTicker=function(a){var b=a.indexOf(":");return-1===b?a:a.substr(b+1)};g.parsePeriod=function(a){var b=a.slice(0),c;0<=b.indexOf(",")&&(a=b.split(","),c=g.parsePeriod(a[1]),b=a[0]);a=!1;var d=b[b.length-1];-1==="DWM".indexOf(d)&&(a=!0,d="");b=parseInt(a?b:1<b.length?b.slice(0,b.length-1):1);return{resolution:d,
interval:b,isIntraday:a,range:c}};g.newBarBuilder=function(a,b,c){a=g.parsePeriod(a);return z.newBarBuilder(a.resolution,a.interval,b,c)};g.newSession=function(a,b){var c=u.get_timezone(a);return(new z.Session).init(c,b)};g.prototype.set_symbolinfo=function(a){a||console.error("WARN: symbolinfo isn't defined for "+this.tickerid);this.info=a;this.timezone=u.get_timezone(a.timezone);this.session.init(this.timezone,a.session);for(var b in this.other_sessions)this.other_sessions.hasOwnProperty(b)&&this.other_sessions[b].init(this.timezone,
b)};g.prototype.get_session=function(a){if(!a)return this.session;var b=this.other_sessions[a];b||(b=new z.Session,this.other_sessions[a]=b);return b};g.prototype.isdwm=function(){return""!==this.resolution};g.prototype.enable_dwm_aligning=function(a,b){this.dwm_aligner=g.newBarBuilder(this.period,a,b)};g.prototype.bartime=function(a,b){var c=this.time;if(a){var d=a;b&&(d+=b);var e=this.bb_cache[d];e||(e=this.get_session(b),e=g.newBarBuilder(a,e),this.bb_cache[d]=e);c=e.alignTime(c)}if(!this.isdwm()||
isNaN(c))return c;var d=u.utc_to_cal(this.timezone,c),f=this.session.spec,h=u.get_day_of_week(d),e=u.get_minutes_from_midnight(d),h=f.findSession(h,e),f=h.isOvernight(),e=h.start()<=e;if(!f||!e)return c;u.add_date(d,1);return u.cal_to_utc(this.timezone,d)};g.prototype.lastbar=function(a){if(!isNaN(a.time)){var b=a.time;this.dwm_aligner&&(this.dwm_aligner.moveTo(b),b=this.dwm_aligner.startOfBar(0));var c=this.time!==b;c&&0<=this.index&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this));
this.time=b;this.open=a.open;this.high=a.high;this.low=a.low;this.close=a.close;this.volume=a.volume;this.updatetime=a.updatetime;this.isNewBar=c;this.isBarClosed=a.isBarClosed;this.isNewBar&&this.index++;this.script.calc(this)}};h.prototype.calc=function(a){var b=this.ctx,c=this.body;b.prepare(a);a=c.main(b,this.inputCallback);!isNaN(b.symbol.time)&&this.out&&this.out(b.symbol,a)};h.prototype.init=function(){var a=this.ctx,b=this.body;b.init&&b.init(a,this.inputCallback);b.main(a,this.inputCallback)};
h.prototype.add_sym=function(a,b,c){a=this.runner.add_sym(a,b,c,this);this.symbols.push(a);a.isdwm()&&(g.inputSessionForDWM||1<this.symbols.length)&&a.enable_dwm_aligning(this.symbols[0].session,g.inputSessionForDWM||a.session);return a};h.prototype.get_sym=function(a){return this.symbols[a]};k.prototype.add_sym=function(a,b,c,d){a=new g(a,b,c,d);this.symbols.push(a);return a};k.prototype.get_sym=function(a){return this.symbols[a]};k.prototype.start=function(){var a=this.host;new h(a.tickerid,a.period,
a.periodBase||a.period,this,a.body,a.out,a.input);for(var b=this,c=[],d=this.symbols,e=0;e<d.length;e++)(function(){var f=d[e],g=e,f=k.feed.subscribe(f.tickerid,f.period,f.periodBase,function(a){b.update(g,a)},a.onErrorCallback,a.symbolInfo,a.rangeExtension);c.push(f)})();this.subscription=c};k.prototype.stop=function(){for(var a=this.subscription,b=0;b<a.length;b++)k.feed.unsubscribe(a[b])};k.prototype.update=function(a,b){if(b){var c=this.symbols[a];if(this.isRecalculated){var d=b.bar(b.count()-
1);d.isBarClosed=b.isLastBarClosed();c.lastbar(d)}else this.barsets[a]||(this.barsets[a]=b,c.set_symbolinfo(b.symbolinfo()),this.recalc())}else console.error("Unexpected barset = null")};k.prototype.recalc=function(){for(var a=this.symbols,b=0;b<a.length;b++)if(!this.barsets[b])return;for(b=a.length-1;0<=b;b--)for(var c=a[b],d=this.barsets[b],e=d.count(),f=0;f<e;f++){var g=d.bar(f);g.isBarClosed=f===e-1?d.isLastBarClosed():!0;c.lastbar(g)}this.isRecalculated=!0;this.host.recalc()};k.feed={subscribe:function(a,
b,c,d){console.error("must be initialized with setupFeed")},unsubscribe:function(a){console.error("must be initialized with setupFeed")}};m.prototype.stop=function(){this.runner.stop()};n.prototype.symbolinfo=function(){return this.info};n.prototype.isLastBarClosed=function(){return this.isBarClosed};n.prototype.bar=function(a){return this.bars[a]};n.prototype.count=function(){return this.bars.length};n.prototype.add=function(a,b){var c=this.bars,d=c.length,e=a.time,f=0===d?NaN:c[d-1].time;0===d||
f<e?c.push(a):f===e?c[d-1]=a:console.error("time order violation, prev: "+(new Date(f)).toUTCString()+", cur: "+(new Date(e)).toUTCString());this.isBarClosed=!!b};q.prototype.init=function(a){this.bb=g.newBarBuilder(this.period,a.symbol.session);this.bbEmptyBars=this.generateEmptyBars?g.newBarBuilder(this.period,a.symbol.session):void 0};q.prototype.extrapolate=function(a,b){return isNaN(a)||isNaN(b)?void 0:z.extrapolateBarsFrontToTime(this.bbEmptyBars,a,b)};q.prototype.main=function(a){var b=a.symbol.time,
c=this.bb.alignTime(b),d=a.new_var(c),e=t.na(c),f=d.get(1),g=t.na(f)?1:t.neq(c,f),d=a.new_var(),h=a.new_var(),k=a.new_var(),l=a.new_var(),m=d.get(1),n=h.get(1),q=k.get(1),s=l.get(1),m=e?NaN:g?t.open(a):m,n=e?NaN:g?t.high(a):t.max(t.high(a),n),q=e?NaN:g?t.low(a):t.min(t.low(a),q),u=e?NaN:t.close(a),s=e?NaN:g?t.volume(a):t.volume(a)+s,e=e?NaN:b,b=a.symbol.isBarClosed&&this.bb.isLastBar(b),f=this.generateEmptyBars&&g?this.extrapolate(f,c):void 0;a=a.new_var(t.close(a)).get(1);a=f instanceof Array?a:
NaN;d.set(m);h.set(n);k.set(q);l.set(s);return[c,m,n,q,u,s,e,b,f,a]};l.prototype.main=function(a){var b=a.new_var(t.open(a)),c=a.new_var(t.close(a)),d=b.get(1),e=c.get(1),c=t.ohlc4(a),d=t.na(b.get(1))?(t.open(a)+t.close(a))/2:(d+e)/2;b.set(d);var b=t.max(t.high(a),t.max(d,c)),e=t.min(t.low(a),t.min(d,c)),f=t.volume(a);a=a.symbol;return[a.time,d,b,e,c,f,a.updatetime,a.isBarClosed]};s.prototype.main=function(a){var b=t.open(a),c=t.high(a),d=t.low(a),e=t.close(a);a=t.volume(a);return[b,c,d,e,a]};var B=
{Std:t,Series:f,Symbol:g,SymbolInfo:function(a,b){this.timezone=a||"America/New_York";this.session=b||"0000-0000"},StudyEngine:m,BarSet:n,OHLCV:s,BarBuilder:q,HeikenAshi:l,setupFeed:function(a,b){k.feed=a;b&&(g.inputSessionForDWM=g.newSession("UTC","24x7"))}};"undefined"!==typeof module&&module.exports?module.exports=B:this.PineJS=B})(this);(function(){function a(a){this.host=a;this.cache={}}function b(a){return a.has_empty_bars||a.force_session_rebuild}var c=this.PineJS?this.PineJS:require("./iljs.js"),d=this.PineJsBarBuilder?this.PineJsBarBuilder:require("./barbuilder.js"),e=c.Symbol,f=c.StudyEngine,g=c.BarBuilder,h=c.BarSet;a.prototype.getCache=function(a){return this.cache[a]};a.prototype.putCache=function(a,b){this.cache[a]=b};a.prototype.subscribe=function(a,c,d,e,f,g){var h;h=b(g)?"_":"";h=a+c+d+h;var k=this.getCache(h);k||(k=
this.createItem(a,c,d,g),this.putCache(h,k));k.listeners.addListener(e,f);return{key:h,listener:e}};a.prototype.unsubscribe=function(a){var b=this.getCache(a.key);b&&b.listeners.removeListener(a.listener)};a.prototype.removeUnused=function(){var a=[],b;for(b in this.cache)this.cache.hasOwnProperty(b)&&0===this.cache[b].listeners.listenersCount()&&a.push(b);if(0!==a.length){for(b=0;b<a.length;b++){var c=a[b],d=this.cache[c];delete this.cache[c];d.stop()}this.removeUnused()}};a.prototype.rebuildFrom=
function(a,b,c){a=e.parsePeriod(a);b=e.parsePeriod(b);if(""!==a.resolution){if(c.has_weekly_and_monthly)return a.resolution;if("undefined"===typeof c.has_daily||c.has_daily)return"D";""!==b.resolution&&(b.resolution="",b.interval=c.intraday_multipliers?c.intraday_multipliers[0]:1)}if("undefined"!==typeof c.has_intraday&&!c.has_intraday)return"";b=""!==a.resolution?b.interval:""===b.resolution?Math.min(a.interval,b.interval):a.interval;if(c.intraday_multipliers&&(c=c.intraday_multipliers,-1===c.indexOf(b))){for(a=
c.length-1;0<=a;a--){var d=c[a];if(0===b%d)return""+d}return""}return""+b};a.prototype.createItem=function(a,d,e,f){var h=new n;0!==a.indexOf("=")?a={symbol:a}:(a=JSON.parse(a.slice(1)),a.type&&(0===a.type.indexOf("BarSetHeikenAshi@tv-basicstudies-")?a.builder=new c.HeikenAshi:console.error("unknown builder type: "+a.type)));if(a.builder)return new m(h,a.symbol,d,e,a.builder,f);var q=this.rebuildFrom(d,e,f),A=b(f);return d!==q||A?(e=f.has_empty_bars,f=$.extend({},f),A&&(f.has_empty_bars=!1,f.force_session_rebuild=
!1),new m(h,a.symbol,d,q,new g(d,e),f)):new k(h,a.symbol,d,e,a.session&&"extended"!==a.session,this.host,f)};var k=function(a,b,c,d,e,f,g){this.listeners=a;this.host=f;var h=this;this.host.resolve(b,function(a){e&&a.regular_session&&(a.session=a.regular_session);var f=h.calculateFromTo(a.timezone,a.session,d||c,b);h.subs=h.host.subscribe(a,c,f,function(a){h.listeners.fire(a)},function(a){h.listeners.onError(a)})},function(a){h.listeners.onError(a)})};k.prototype.stop=function(){this.host.unsubscribe(this.subs)};
k.prototype.calculateFromTo=function(a,b,c,f){var g=e.parsePeriod(c),h=(new Date).valueOf(),k,m;""===g.resolution?(k=g.interval,m="D"):(k=12*("D"===g.resolution?1:"W"===g.resolution?5:30)*g.interval,m="M");g.range?(k=g.range.interval,m=g.range.resolution):this.host.calculateHistoryDepth&&(g=this.host.calculateHistoryDepth(c,m,k))&&(g.intervalBack&&(k=g.intervalBack),g.resolutionBack&&(m=g.resolutionBack));k=d.alignDWMPeriodsBack(a,b,m,k,h);this.host.getRangeExtension&&(f=this.host.getRangeExtension(f,
c),0<f&&(a=PineJS.Symbol.newSession(a,b),c=PineJS.Symbol.newBarBuilder(c,a),k=PineJsBarBuilder.extrapolateBarsBackByCount(c,k,f)[0]));return{from:k,to:h+6E4}};var m=function(a,b,c,d,e,g){this.listeners=a;this.isRecalculated=!1;if(""===d)console.error("unsupported resolution for rebuild: "+c),this.listeners.onError("unsupported resolution for rebuild: "+c);else{var h=this;this.engine=new f({tickerid:b,period:d,periodBase:c,body:e,symbolInfo:g,recalc:function(){h._recalc()},out:function(a,b){h._out(a,
b)},onErrorCallback:function(a){h.listeners.onError(a)}})}};m.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")};m.prototype._recalc=function(){this.isRecalculated&&console.error("recalc called twice!");this.barset&&this.listeners.fire(this.barset);this.isRecalculated=!0};m.prototype._out=function(a,b){var c=b[0];if(!isNaN(c)){var c={time:c,open:b[1],high:b[2],low:b[3],close:b[4],volume:b[5],updatetime:b[6]},d=b[7];this.barset||(this.barset=new h(a.info));
var e=b[8];if(e instanceof Array)for(var f=0;f<e.length;f++){var g=b[9],k=e[f];this.barset.add({time:k,open:g,high:g,low:g,close:g,volume:0,updatetime:k},!0);this.isRecalculated&&this.listeners.fire(this.barset)}this.barset.add(c,d);this.isRecalculated&&this.listeners.fire(this.barset)}};var n=function(){this.listeners=[]};n.prototype.listenersCount=function(){return this.listeners.reduce(function(a,b){return a+(b?1:0)},0)};n.prototype.addListener=function(a,b){this.listeners.push({dataListener:a,
onErrorCallback:b});this.barset&&a(this.barset);this.errorMsg&&b(this.errorMsg)};n.prototype.removeListener=function(a){var b=this.listeners.filter(function(b){return b.dataListener==a});0!=b.length&&(b=this.listeners.indexOf(b[0]),delete this.listeners[b])};n.prototype.onError=function(a){this.errorMsg=a||"unspecified error";for(var b=this.listeners,c=b.length,d=0;d<c;d++){var e=b[d];if(e&&e.onErrorCallback)e.onErrorCallback(a)}};n.prototype.fire=function(a){this.barset=a;for(var b=this.listeners,
c=b.length,d=0;d<c;d++){var e=b[d];e&&e.dataListener(a)}};var q={setupFeed:function(b,d){a.instance=new a(b);c.setupFeed(a.instance,d)},unsubscribeUnused:function(){a.instance.removeUnused()}};"undefined"!==typeof module&&module.exports?module.exports=q:this.PineJSFeed=q})(this);JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1"},
constructor:function(){this.f_0=function(a,b,c,d){return PineJS.Std.or(PineJS.Std.and(PineJS.Std.eq(a,b),PineJS.Std.eq(a,c)),PineJS.Std.eq(b,c))?0:(2*a-c-b)/(b-c)*d};this.main=function(a,b){this._context=a;this._input=b;var c=this.f_0(PineJS.Std.close(this._context),PineJS.Std.high(this._context),PineJS.Std.low(this._context),PineJS.Std.volume(this._context));return[PineJS.Std.cum(c,this._context)]}}},{name:"Aroon",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,
linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF6A00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0094FF"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",
min:1,max:1E12}],id:"Aroon@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return 100*(a+b)/b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.high(this._context),e=c+1,d=this._context.new_var(d),d=PineJS.Std.highestbars(d,e,this._context),d=this.f_0(d,c),f=PineJS.Std.low(this._context),f=this._context.new_var(f),e=PineJS.Std.lowestbars(f,e,this._context),c=this.f_0(e,c);return[d,c]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:23,
isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1E12}],id:"Advance/Decline@tv-basicstudies-1"},constructor:function(){this.f_0=
function(a,b){return PineJS.Std.gt(a,b)};this.f_1=function(a,b){return PineJS.Std.lt(a,b)};this.f_2=function(a,b){return a/b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this.f_0(PineJS.Std.close(this._context),PineJS.Std.open(this._context)),d=this._context.new_var(d),d=PineJS.Std.sum(d,c,this._context),e=this.f_1(PineJS.Std.close(this._context),PineJS.Std.open(this._context)),e=this._context.new_var(e),c=PineJS.Std.sum(e,c,this._context);return[this.f_2(d,c)]}}},
{name:"Average True Range",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1E12}],
id:"Average True Range@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.tr(this._context),d=this._context.new_var(d);return[PineJS.Std.sma(d,c,this._context)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,palettes:{palette_0:{colors:{0:{color:"#FF0000",
width:1,style:0},1:{color:"#008000",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a-b};this.f_1=function(a){return PineJS.Std.le(a,
0)?0:1};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.hl2(this._context),d=this._context.new_var(c),d=PineJS.Std.sma(d,5,this._context),c=this._context.new_var(c),c=PineJS.Std.sma(c,34,this._context),d=this.f_0(d,c),c=this._context.new_var(d),c=PineJS.Std.change(c),c=this.f_1(c);return[d,c]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,
transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1E12},{id:"in_1",name:"mult",defval:2,type:"float",min:0.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a*b};this.f_1=
function(a,b){return a+b};this.f_2=function(a,b){return a-b};this.f_3=function(a,b,c){return(a-b)/c};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),f=this._context.new_var(c),f=PineJS.Std.sma(f,d,this._context),c=this._context.new_var(c),d=PineJS.Std.stdev(c,d,this._context),d=this.f_0(e,d),e=this.f_1(f,d),d=this.f_2(f,d);return[this.f_3(e,d,f)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,
is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c,d){return(a-b)/(c-d)};this.main=function(a,b){this._context=a;
this._input=b;return[this.f_0(PineJS.Std.close(this._context),PineJS.Std.open(this._context),PineJS.Std.high(this._context),PineJS.Std.low(this._context))]}}},{name:"BB",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,
plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,
filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1E12},{id:"in_1",name:"mult",defval:2,type:"float",min:0.001,max:50}],id:"BB@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a*b};this.f_1=function(a,b){return a+b};this.f_2=function(a,b){return a-b};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),
e=this._input(1),f=this._context.new_var(c),f=PineJS.Std.sma(f,d,this._context),c=this._context.new_var(c),d=PineJS.Std.stdev(c,d,this._context),d=this.f_0(e,d),e=this.f_1(f,d),d=this.f_2(f,d);return[f,e,d]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,
value:1},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#008080",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],
inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1E12},{id:"in_1",name:"mult",defval:2,type:"float",min:0.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a*b};this.f_1=function(a,b){return a+b};this.f_2=function(a,b){return a-b};this.f_3=function(a,b,c){return(a-b)/(c-b)};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),f=this._context.new_var(c),
f=PineJS.Std.sma(f,d,this._context),g=this._context.new_var(c),d=PineJS.Std.stdev(g,d,this._context),d=this.f_0(e,d),e=this.f_1(f,d),f=this.f_2(f,d);return[this.f_3(c,f,e)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},
plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1E12}],id:"Chaikin Money Flow@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c,d){return PineJS.Std.or(PineJS.Std.and(PineJS.Std.eq(a,b),PineJS.Std.eq(a,c)),PineJS.Std.eq(b,c))?0:(2*a-c-b)/(b-c)*d};this.f_1=function(a,
b){return a/b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this.f_0(PineJS.Std.close(this._context),PineJS.Std.high(this._context),PineJS.Std.low(this._context),PineJS.Std.volume(this._context)),d=this._context.new_var(d),d=PineJS.Std.sum(d,c,this._context),e=PineJS.Std.volume(this._context),e=this._context.new_var(e),c=PineJS.Std.sum(e,c,this._context);return[this.f_1(d,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,
is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",
min:1,max:1E12},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:1E12}],id:"Chaikin Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a-b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=PineJS.Std.accdist(this._context),f=this._context.new_var(e),c=PineJS.Std.ema(f,c,this._context),e=this._context.new_var(e),d=PineJS.Std.ema(e,d,this._context);return[this.f_0(c,d)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:23,
isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",
shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:1E12},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1E12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1E12}],id:"Chande Kroll Stop@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return a-b*c};this.f_1=function(a,b,c){return a+b*c};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2),f=PineJS.Std.high(this._context),
g=this._context.new_var(f),h=PineJS.Std.highest(g,c,this._context),g=PineJS.Std.atr(c,this._context),h=this.f_0(h,d,g),f=this._context.new_var(f),c=PineJS.Std.lowest(f,c,this._context),d=this.f_1(c,d,g),c=this._context.new_var(h),c=PineJS.Std.highest(c,e,this._context),d=this._context.new_var(d);return[PineJS.Std.lowest(d,e,this._context),c]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,
linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1E12}],id:"Chande Momentum Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=function(a){return PineJS.Std.ge(a,0)?a:0};this.f_1=
function(a){return PineJS.Std.ge(a,0)?0:-a};this.f_2=function(a,b){return 100*a/b};this.f_3=function(a,b){return this.f_2(a-b,a+b)};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.close(this._context),d=this._context.new_var(d),d=PineJS.Std.change(d),e=this.f_0(d),d=this.f_1(d),e=this._context.new_var(e),e=PineJS.Std.sum(e,c,this._context),d=this._context.new_var(d),c=PineJS.Std.sum(d,c,this._context);return[this.f_3(e,c)]}}},{name:"Commodity Channel Index",
metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#808000",transparency:90,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,
joinPoints:!1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1E12}],id:"Commodity Channel Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return(a-b)/(0.015*c)};this.main=function(a,b){this._context=
a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._context.new_var(c),e=PineJS.Std.sma(e,d,this._context),f=this._context.new_var(c),d=PineJS.Std.dev(f,d,this._context);return[this.f_0(c,e,d)]}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,
visible:!0,value:61.8},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#008000",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],
inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1E12}],id:"Choppiness Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c,d){return 100*PineJS.Std.log10(a/(b-c))/d};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.atr(1,this._context),d=this._context.new_var(d),d=PineJS.Std.sum(d,c,this._context),e=PineJS.Std.high(this._context),e=this._context.new_var(e),e=PineJS.Std.highest(e,c,this._context),f=PineJS.Std.low(this._context),
f=this._context.new_var(f),f=PineJS.Std.lowest(f,c,this._context),c=PineJS.Std.log10(c);return[this.f_0(d,e,f,c)]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,
transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"ADX",histogramBase:0,joinPoints:!1}},description:"Directional Movement Index",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:1E12},{id:"in_1",
name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a){return-a};this.f_1=function(a,b){return PineJS.Std.and(PineJS.Std.gt(a,b),PineJS.Std.gt(a,0))?a:0};this.f_2=function(a,b){return 100*a/b};this.f_3=function(a,b){return a+b};this.f_4=function(a,b,c){return PineJS.Std.abs(a-b)/(PineJS.Std.eq(c,0)?1:c)};this.f_5=function(a){return 100*a};this.main=function(a,b){this._context=a;this._input=b;var c=
this._input(0),d=this._input(1),e=PineJS.Std.high(this._context),e=this._context.new_var(e),f=PineJS.Std.change(e),e=PineJS.Std.low(this._context),e=this._context.new_var(e),e=PineJS.Std.change(e),g=this.f_0(e),e=PineJS.Std.tr(this._context),e=this._context.new_var(e),h=PineJS.Std.rma(e,c,this._context),e=this.f_1(f,g),e=this._context.new_var(e),e=PineJS.Std.rma(e,c,this._context),e=this.f_2(e,h),e=PineJS.Std.fixnan(e,this._context),f=this.f_1(g,f),f=this._context.new_var(f),c=PineJS.Std.rma(f,c,
this._context),c=this.f_2(c,h),c=PineJS.Std.fixnan(c,this._context),f=this.f_3(e,c),f=this.f_4(e,c,f),f=this._context.new_var(f),d=PineJS.Std.rma(f,d,this._context),d=this.f_5(d);return[e,c,d]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:40,visible:!0,color:"#800080"}},precision:4,inputs:{in_0:"AAPL",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",
histogramBase:0,joinPoints:!1}},description:"Correlation Coeff",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"AAPL",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:1E12}],id:"Correlation Coeff@tv-basicstudies-1"},constructor:function(){this.init=function(a,b){this._context=a;this._input=b;this._context.new_sym(this._input(0),PineJS.Std.period(this._context),PineJS.Std.period(this._context))};this.main=function(a,b){this._context=a;this._input=
b;var c=this._context.new_var(this._context.symbol.time);this._input(0);PineJS.Std.period(this._context);var d=PineJS.Std.close(this._context),e=this._input(1);this._context.select_sym(1);var f=this._context.new_var(this._context.symbol.time),g=PineJS.Std.close(this._context),g=this._context.new_var(g);this._context.select_sym(0);c=g.adopt(f,c,0);d=this._context.new_var(d);c=this._context.new_var(c);return[PineJS.Std.correlation(d,c,e,this._context)]}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:23,
isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"},
{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Plot",histogramBase:0,joinPoints:!1},plot_2:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1E12}],id:"Donchian Channels@tv-basicstudies-1"},
constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.low(this._context),d=this._context.new_var(d),d=PineJS.Std.lowest(d,c,this._context),e=PineJS.Std.high(this._context),e=this._context.new_var(e),c=PineJS.Std.highest(e,c,this._context),e=PineJS.Std.avg(c,d);return[d,c,e]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,
plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double Exponential Moving Average",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1E12}],id:"Double Exponential Moving Average@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return 2*a-b};this.main=function(a,b){this._context=
a;this._input=b;var c=this._input(0),d=PineJS.Std.close(this._context),d=this._context.new_var(d),d=PineJS.Std.ema(d,c,this._context),e=this._context.new_var(d),c=PineJS.Std.ema(e,c,this._context);return[this.f_0(d,c)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,inputs:{in_0:1E4,in_1:14}},plots:[{id:"plot_0",
type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1E4,type:"integer",min:1,max:1E12},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:1E12}],id:"Ease of Movement@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c,d,e){return a*b*(c-d)/e};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=PineJS.Std.hl2(this._context),
e=this._context.new_var(e),e=PineJS.Std.change(e),c=this.f_0(c,e,PineJS.Std.high(this._context),PineJS.Std.low(this._context),PineJS.Std.volume(this._context)),c=this._context.new_var(c);return[PineJS.Std.sma(c,d,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800000"}},precision:4,bands:[{color:"#808080",linestyle:2,
linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Elders Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:1E12}],id:"Elders Force Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a*b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),
d=PineJS.Std.close(this._context),d=this._context.new_var(d),d=PineJS.Std.change(d),d=this.f_0(d,PineJS.Std.volume(this._context)),d=this._context.new_var(d);return[PineJS.Std.sma(d,c,this._context)]}}},{name:"Envelope",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,
color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:20,in_1:10,in_2:!1}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelope",
shortDescription:"Env",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:1E12},{id:"in_1",name:"percent",defval:10,type:"float",min:-1E12,max:1E12},{id:"in_2",name:"exponential",defval:!1,type:"bool"}],id:"Envelope@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return a?b:c};this.f_1=function(a,b){return a*(1+b)};this.f_2=function(a,b){return a*
(1-b)};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),f=this._input(2),g=this._context.new_var(c),g=PineJS.Std.ema(g,d,this._context),c=this._context.new_var(c),d=PineJS.Std.sma(c,d,this._context),f=this.f_0(f,g,d),d=e/100,e=this.f_1(f,d),d=this.f_2(f,d);return[f,e,d]}}},{name:"Ichimoku Cloud",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,
plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,filledAreasStyle:{fill_0:{color:"#000080",
transparency:90,visible:!0}},inputs:{in_0:9,in_1:26,in_2:52,in_3:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"Tenkan-sen",histogramBase:0,joinPoints:!1},plot_1:{title:"Kijun-sen",histogramBase:0,joinPoints:!1},plot_2:{title:"Chikou span",histogramBase:0,joinPoints:!1},plot_3:{title:"Senkou A",histogramBase:0,joinPoints:!1},plot_4:{title:"Senkou B",histogramBase:0,joinPoints:!1}},
description:"Ichimoku Cloud",shortDescription:"Ichimoku",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_3",objBId:"plot_4",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:1E12},{id:"in_1",name:"Middle",defval:26,type:"integer",min:1,max:1E12},{id:"in_2",name:"Long",defval:52,type:"integer",min:1,max:1E12},{id:"in_3",name:"displacement",defval:26,type:"integer",min:1,max:1E12}],id:"Ichimoku Cloud@tv-basicstudies-1"},constructor:function(){this.f_0=
function(a){return-a};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2),f=this._input(3),g=PineJS.Std.low(this._context),h=this._context.new_var(g),k=PineJS.Std.lowest(h,c,this._context),h=PineJS.Std.high(this._context),m=this._context.new_var(h),c=PineJS.Std.highest(m,c,this._context),c=PineJS.Std.avg(k,c),k=this._context.new_var(g),k=PineJS.Std.lowest(k,d,this._context),m=this._context.new_var(h),d=PineJS.Std.highest(m,d,this._context),
d=PineJS.Std.avg(k,d),k=PineJS.Std.avg(c,d),g=this._context.new_var(g),g=PineJS.Std.lowest(g,e,this._context),h=this._context.new_var(h),e=PineJS.Std.highest(h,e,this._context),e=PineJS.Std.avg(g,e),h=PineJS.Std.close(this._context);return[c,d,{value:h,offset:this.f_0(f)},{value:k,offset:f},{value:e,offset:f}]}}},{name:"Klinger Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,
visible:!0,color:"#000080"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Klinger Oscillator",shortDescription:"Klinger Oscillator",is_price_study:!1,inputs:[],id:"Klinger Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=
function(a,b){return PineJS.Std.ge(a,0)?b:-b};this.f_1=function(a,b){return a-b};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.hlc3(this._context),c=this._context.new_var(c),c=PineJS.Std.change(c),d=this.f_0(c,PineJS.Std.volume(this._context)),c=this._context.new_var(d),c=PineJS.Std.ema(c,34,this._context),d=this._context.new_var(d),d=PineJS.Std.ema(d,55,this._context),c=this.f_1(c,d),d=this._context.new_var(c),d=PineJS.Std.ema(d,13,this._context);return[c,d]}}},{name:"Hull MA",
metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Hull MA",shortDescription:"HMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1E12}],id:"Hull MA@tv-basicstudies-1"},constructor:function(){this.f_0=
function(a,b){return 2*a-b};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=d/2,f=this._context.new_var(c),e=PineJS.Std.wma(f,e,this._context),c=this._context.new_var(c),c=PineJS.Std.wma(c,d,this._context),c=this.f_0(e,c),d=PineJS.Std.sqrt(d),d=PineJS.Std.round(d),c=this._context.new_var(c);return[PineJS.Std.wma(c,d,this._context)]}}},{name:"Keltner Channels",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,
defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:!0,in_1:20,in_2:1}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",
type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Middle",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Keltner Channels",shortDescription:"KC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"useTrueRange",defval:!0,type:"bool"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:1E12},{id:"in_2",name:"mult",
defval:1,type:"float",min:-1E12,max:1E12}],id:"Keltner Channels@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c,d){return a?b:c-d};this.f_1=function(a,b,c){return a+b*c};this.f_2=function(a,b,c){return a-b*c};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),f=this._input(2),c=this._context.new_var(c),c=PineJS.Std.ema(c,e,this._context),d=this.f_0(d,PineJS.Std.tr(this._context),PineJS.Std.high(this._context),
PineJS.Std.low(this._context)),d=this._context.new_var(d),d=PineJS.Std.ema(d,e,this._context),e=this.f_1(c,d,f),f=this.f_2(c,d,f);return[e,c,f]}}},{name:"Linear Regression Curve",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},
description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1E12}],id:"Linear Regression Curve@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),c=this._context.new_var(c);return[PineJS.Std.linreg(c,d,0)]}}},{name:"Know Sure Thing",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,
defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:15,in_2:20,in_3:30,in_4:10,in_5:10,in_6:10,in_7:15,in_8:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"KST",histogramBase:0,joinPoints:!1},
plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Know Sure Thing",shortDescription:"KST",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:1E12},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:1E12},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:1E12},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:1E12},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:1E12},
{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:1E12},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:1E12},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:1E12},{id:"in_8",name:"siglen",defval:9,type:"integer",min:1,max:1E12}],id:"Know Sure Thing@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c,d){return a+2*b+3*c+4*d};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2),f=this._input(3),
g=this._input(4),h=this._input(5),k=this._input(6),m=this._input(7),n=this._input(8),q=PineJS.Std.close(this._context),l=this._context.new_var(q),c=PineJS.Std.roc(l,c),c=this._context.new_var(c),g=PineJS.Std.sma(c,g,this._context),c=this._context.new_var(q),d=PineJS.Std.roc(c,d),d=this._context.new_var(d),h=PineJS.Std.sma(d,h,this._context),d=this._context.new_var(q),e=PineJS.Std.roc(d,e),e=this._context.new_var(e),k=PineJS.Std.sma(e,k,this._context),q=this._context.new_var(q),f=PineJS.Std.roc(q,
f),f=this._context.new_var(f),m=PineJS.Std.sma(f,m,this._context),m=this.f_0(g,h,k,m),f=this._context.new_var(m),n=PineJS.Std.sma(f,n,this._context);return[m,n]}}},{name:"MA Cross",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_2:{linestyle:0,
linewidth:4,plottype:3,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA Cross",shortDescription:"MA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,
max:1E12},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:1E12}],id:"MA Cross@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a?b:PineJS.Std.na()};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=PineJS.Std.close(this._context),f=this._context.new_var(e),c=PineJS.Std.sma(f,c,this._context),e=this._context.new_var(e),d=PineJS.Std.sma(e,d,this._context),e=PineJS.Std.cross(c,d,this._context),e=this.f_0(e,c);return[c,d,e]}}},
{name:"Money Flow",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#459915"}},precision:4,bands:[{color:"#c0c0c0",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#c0c0c0",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#9915ff",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",
histogramBase:0,joinPoints:!1}},description:"Money Flow",shortDescription:"MFI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:2E3}],id:"Money Flow@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return a*(PineJS.Std.le(b,0)?0:c)};this.f_1=function(a,b,c){return a*
(PineJS.Std.ge(b,0)?0:c)};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.hlc3(this._context),e=this._context.new_var(d),f=PineJS.Std.change(e),e=this.f_0(PineJS.Std.volume(this._context),f,d),e=this._context.new_var(e),e=PineJS.Std.sum(e,c,this._context),d=this.f_1(PineJS.Std.volume(this._context),f,d),d=this._context.new_var(d),c=PineJS.Std.sum(d,c,this._context);return[PineJS.Std.rsi(e,c)]}}},{name:"Mass Index",metainfo:{_metainfoVersion:23,isTVScript:!1,
isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Mass Index",shortDescription:"Mass Index",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1E12}],id:"Mass Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,
b){return a-b};this.f_1=function(a,b){return a/b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this.f_0(PineJS.Std.high(this._context),PineJS.Std.low(this._context)),d=this._context.new_var(d),d=PineJS.Std.ema(d,9,this._context),e=this._context.new_var(d),e=PineJS.Std.ema(e,9,this._context),d=this.f_1(d,e),d=this._context.new_var(d);return[PineJS.Std.sum(d,c,this._context)]}}},{name:"Moving Avarage Exponentional",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,
is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Avarage Exponentional",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1E12}],id:"Moving Avarage Exponentional@tv-basicstudies-1"},constructor:function(){this.main=
function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),c=this._context.new_var(c);return[PineJS.Std.ema(c,d,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},
description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return PineJS.Std.gt(a,0)?b:PineJS.Std.lt(c,0)?-b:0*b};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),c=this._context.new_var(c),c=PineJS.Std.change(c);return[this.f_0(c,PineJS.Std.volume(this._context),c)]}}},{name:"Moving Average Convergence/Divergence",metainfo:{_metainfoVersion:23,isTVScript:!1,
isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:12,in_1:26,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Histogram",
histogramBase:0,joinPoints:!1},plot_1:{title:"MACD",histogramBase:0,joinPoints:!1},plot_2:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Moving Average Convergence/Divergence",shortDescription:"MACD",is_price_study:!1,inputs:[{id:"in_0",name:"fastLength",defval:12,type:"integer",min:1,max:1E12},{id:"in_1",name:"slowLength",defval:26,type:"integer",min:1,max:1E12},{id:"in_2",name:"signalLength",defval:9,type:"integer",min:1,max:1E12}],id:"Moving Average Convergence/Divergence@tv-basicstudies-1"},
constructor:function(){this.f_0=function(a,b){return a-b};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),f=this._input(2),g=this._context.new_var(c),d=PineJS.Std.ema(g,d,this._context),c=this._context.new_var(c),e=PineJS.Std.ema(c,e,this._context),e=this.f_0(d,e),c=this._context.new_var(e),f=PineJS.Std.sma(c,f,this._context);return[this.f_0(e,f),e,f]}}},{name:"Moving Average",metainfo:{_metainfoVersion:23,isTVScript:!1,
isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average",shortDescription:"MA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1E12}],id:"Moving Average@tv-basicstudies-1"},constructor:function(){this.main=function(a,
b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),c=this._context.new_var(c);return[PineJS.Std.sma(c,d,this._context)]}}},{name:"Moving Avarage Weighted",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,
joinPoints:!1}},description:"Moving Avarage Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1E12}],id:"Moving Avarage Weighted@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),c=this._context.new_var(c);return[PineJS.Std.wma(c,d,this._context)]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,
is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:0.02,in_1:0.02,in_2:0.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:0.02,type:"float",min:-1E12,max:1E12},{id:"in_1",name:"increment",defval:0.02,type:"float",min:-1E12,max:1E12},
{id:"in_2",name:"maximum",defval:0.2,type:"float",min:-1E12,max:1E12}],id:"Parabolic SAR@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2);return[PineJS.Std.sar(c,d,e,this._context)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},
precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[],id:"On Balance Volume@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return PineJS.Std.gt(a,0)?b:PineJS.Std.lt(c,0)?-b:0*b};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),c=this._context.new_var(c),c=PineJS.Std.change(c),c=this.f_0(c,
PineJS.Std.volume(this._context),c);return[PineJS.Std.cum(c,this._context)]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,
inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:1E12},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:1E12}],id:"Price Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return 100*((a-b)/b)};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),f=this._context.new_var(c),d=PineJS.Std.sma(f,d,this._context),c=this._context.new_var(c),e=PineJS.Std.sma(c,e,this._context);
return[this.f_0(d,e)]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#800080",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",
type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:1E12}],id:"Relative Strength Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a){return PineJS.Std.max(a,
0)};this.f_1=function(a){return-PineJS.Std.min(a,0)};this.f_2=function(a,b){return PineJS.Std.eq(a,0)?100:PineJS.Std.eq(b,0)?0:100-100/(1+b/a)};this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),c=this._context.new_var(c),e=PineJS.Std.change(c),c=this.f_0(e),c=this._context.new_var(c),c=PineJS.Std.rma(c,d,this._context),e=this.f_1(e),e=this._context.new_var(e),d=PineJS.Std.rma(e,d,this._context);return[this.f_2(d,c)]}}},{name:"Relative Vigor Index",
metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},
description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:1E12}],id:"Relative Vigor Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a-b};this.f_1=function(a,b){return a/b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this.f_0(PineJS.Std.close(this._context),PineJS.Std.open(this._context)),d=this._context.new_var(d),d=PineJS.Std.swma(d,this._context),
d=this._context.new_var(d),d=PineJS.Std.sum(d,c,this._context),e=this.f_0(PineJS.Std.high(this._context),PineJS.Std.low(this._context)),e=this._context.new_var(e),e=PineJS.Std.swma(e,this._context),e=this._context.new_var(e),c=PineJS.Std.sum(e,c,this._context),c=this.f_1(d,c),d=this._context.new_var(c),d=PineJS.Std.swma(d,this._context);return[c,d]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,
linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#808000",transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",
name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1E12}],id:"Relative Volatility Index@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return PineJS.Std.le(a,0)?0:b};this.f_1=function(a,b){return PineJS.Std.gt(a,0)?0:b};this.f_2=function(a,b){return 100*(a/(a+b))};this.main=function(a,b){this._context=a;
this._input=b;var c=this._input(0),d=PineJS.Std.close(this._context),e=this._context.new_var(d),c=PineJS.Std.stdev(e,c,this._context),d=this._context.new_var(d),e=PineJS.Std.change(d),d=this.f_0(e,c),d=this._context.new_var(d),d=PineJS.Std.ema(d,14,this._context),c=this.f_1(e,c),c=this._context.new_var(c),c=PineJS.Std.ema(c,14,this._context);return[this.f_2(d,c)]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,
linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",
histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:1E12},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:1E12},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:1E12}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a-b};
this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2),f=PineJS.Std.close(this._context),f=this._context.new_var(f),c=PineJS.Std.tsi(f,c,d,this._context),d=this._context.new_var(c),e=PineJS.Std.ema(d,e,this._context),d=this.f_0(c,e);return[c,e,d]}}},{name:"Stochastic",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,
color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#800080",transparency:75,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%D",histogramBase:0,joinPoints:!1},plot_1:{title:"%K",
histogramBase:0,joinPoints:!1}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1E12},{id:"in_1",name:"smoothK",defval:1,type:"integer",min:1,max:1E12},{id:"in_2",name:"smoothD",defval:3,type:"integer",min:1,max:1E12}],id:"Stochastic@tv-basicstudies-1"},
constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2),f=PineJS.Std.close(this._context),g=PineJS.Std.high(this._context),h=PineJS.Std.low(this._context),f=this._context.new_var(f),g=this._context.new_var(g),h=this._context.new_var(h),c=PineJS.Std.stoch(f,g,h,c,this._context),c=this._context.new_var(c),d=PineJS.Std.sma(c,d,this._context),c=this._context.new_var(d),e=PineJS.Std.sma(c,e,this._context);return[d,e]}}},{name:"TRIX",
metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",
name:"length",defval:18,type:"integer",min:1,max:1E12}],id:"TRIX@tv-basicstudies-1"},constructor:function(){this.f_0=function(a){return PineJS.Std.log(a)};this.f_1=function(a){return 1E4*a};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this.f_0(PineJS.Std.close(this._context)),d=this._context.new_var(d),d=PineJS.Std.ema(d,c,this._context),d=this._context.new_var(d),d=PineJS.Std.ema(d,c,this._context),d=this._context.new_var(d),c=PineJS.Std.ema(d,c,this._context),c=this._context.new_var(c),
c=PineJS.Std.change(c);return[this.f_1(c)]}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#808080",linestyle:2,linewidth:1,visible:!0,
value:20}],filledAreasStyle:{fill_0:{color:"#800080",transparency:80,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%D",histogramBase:0,joinPoints:!1},plot_1:{title:"%K",histogramBase:0,joinPoints:!1}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",
type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1E12},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1,max:1E12},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1E12},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1E12}],id:"Stochastic RSI@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=
this._input(1),f=this._input(2),g=this._input(3),h=PineJS.Std.rsi(c,d),c=this._context.new_var(h),d=this._context.new_var(h),h=this._context.new_var(h),e=PineJS.Std.stoch(c,d,h,e,this._context),e=this._context.new_var(e),f=PineJS.Std.sma(e,f,this._context),e=this._context.new_var(f),g=PineJS.Std.sma(e,g,this._context);return[f,g]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,
transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1E12}],id:"Triple EMA@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return 3*(a-b)+c};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.close(this._context),
d=this._context.new_var(d),d=PineJS.Std.ema(d,c,this._context),e=this._context.new_var(d),e=PineJS.Std.ema(e,c,this._context),f=this._context.new_var(e),c=PineJS.Std.ema(f,c,this._context);return[this.f_0(d,e,c)]}}},{name:"VWMA",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",
histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1E12}],id:"VWMA@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),c=this._context.new_var(c);return[PineJS.Std.vwma(c,d,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,
defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,
max:1E12},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:1E12}],id:"Volume Oscillator@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return 100*(a-b)/b};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=PineJS.Std.volume(this._context),f=this._context.new_var(e),c=PineJS.Std.ema(f,c,this._context),e=this._context.new_var(e),d=PineJS.Std.ema(e,d,this._context);return[this.f_0(c,d)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:23,
isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:21,in_1:13,in_2:8}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],
styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"jawLength",defval:21,type:"integer",min:1,max:1E12},{id:"in_1",name:"teethLength",defval:13,type:"integer",min:1,max:1E12},{id:"in_2",name:"lipsLength",defval:8,type:"integer",min:1,max:1E12}],id:"Williams Alligator@tv-basicstudies-1"},
constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=this._input(2),f=PineJS.Std.hl2(this._context),g=this._context.new_var(f),c=PineJS.Std.ema(g,c,this._context),g=this._context.new_var(f),d=PineJS.Std.ema(g,d,this._context),f=this._context.new_var(f),e=PineJS.Std.ema(f,e,this._context);return[{value:c,offset:8},{value:d,offset:5},{value:e,offset:3}]}}},{name:"Willams %R",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,
is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Willams %R",shortDescription:"%R",
is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1E12}],id:"Willams %R@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b,c){return 100*(a-b)/(b-c)};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.high(this._context),d=this._context.new_var(d),
d=PineJS.Std.highest(d,c,this._context),e=PineJS.Std.low(this._context),e=this._context.new_var(e),c=PineJS.Std.lowest(e,c,this._context);return[this.f_0(PineJS.Std.close(this._context),d,c)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",
histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1E12,max:1E12},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:-1E12,max:1E12},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:-1E12,max:1E12}],id:"Coppock Curve@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return a+b};this.main=function(a,b){this._context=a;this._input=
b;var c=this._input(0),d=this._input(1),e=this._input(2),f=PineJS.Std.close(this._context),g=this._context.new_var(f),d=PineJS.Std.roc(g,d),f=this._context.new_var(f),e=PineJS.Std.roc(f,e),e=this.f_0(d,e),e=this._context.new_var(e);return[PineJS.Std.wma(e,c,this._context)]}}},{name:"Least Squares Moving Average",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},
precision:4,inputs:{in_0:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:-1E12,max:1E12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1E12,max:1E12}],id:"Least Squares Moving Average@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=
this._input(0),d=this._input(1),e=PineJS.Std.close(this._context),e=this._context.new_var(e);return[PineJS.Std.linreg(e,c,d)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9,in_1:0.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},
description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:-1E12,max:1E12},{id:"in_1",name:"Offset",defval:0.85,type:"float",min:-1E12,max:1E12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1E12,max:1E12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=PineJS.Std.close(this._context),d=this._input(0),e=this._input(1),
f=this._input(2),c=this._context.new_var(c);return[PineJS.Std.alma(c,d,e,f)]}}},{name:"True Strength Indicator",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:25,in_1:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"True Strength Indicator",shortDescription:"True Strength Indicator",
is_price_study:!1,inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:-1E12,max:1E12},{id:"in_1",name:"short",defval:13,type:"integer",min:-1E12,max:1E12}],id:"True Strength Indicator@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),e=PineJS.Std.close(this._context),e=this._context.new_var(e);return[PineJS.Std.tsi(e,d,c,this._context)]}}}];JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:15,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",
name:"Source",options:"open high low close hl2 hlc3 ohlc4".split(" "),type:"text"},{id:"symbol",name:"Symbol",type:"symbol"}],id:"Compare@tv-basicstudies-1"},constructor:function(){this.init=function(a,b){this._context=a;this._context.new_sym(b(1),PineJS.Std.period(this._context),PineJS.Std.period(this._context))};this.main=function(a,b){this._context=a;var c=this._context.new_var(this._context.symbol.time);PineJS.Std.period(this._context);this._context.select_sym(1);var d=this._context.new_var(this._context.symbol.time),
e=PineJS.Std[b(0)](this._context),e=this._context.new_var(e);this._context.select_sym(0);return[e.adopt(d,c,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:15,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,
inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0}],id:"Overlay@tv-basicstudies-1"},constructor:function(){this.init=function(a,b){this._context=a;this._context.new_sym(b(0),PineJS.Std.period(this._context),PineJS.Std.period(this._context))};this.main=function(a,b){this._context=a;var c=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var d=this._context.new_var(this._context.symbol.time),e=this._context.new_var(PineJS.Std.open(this._context)),f=this._context.new_var(PineJS.Std.high(this._context)),
g=this._context.new_var(PineJS.Std.low(this._context)),h=this._context.new_var(PineJS.Std.close(this._context));this._context.select_sym(0);return[e.adopt(d,c,0),f.adopt(d,c,0),g.adopt(d,c,0),h.adopt(d,c,0)]}}},{name:"Volume",metainfo:{_metainfoVersion:15,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,transparency:65,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:65,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:65,
visible:!0,color:"#0496FF"}},precision:0,palettes:{volumePalette:{colors:{0:{color:"#FF0000",width:1,style:0},1:{color:"#008000",width:1,style:0}}}},inputs:{showMA:!0}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"}],styles:{vol:{title:"Volume MA",histogramBase:0},vol_ma:{title:"Volume",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Color 0"},
1:{name:"Color 1"}}}},inputs:[{id:"showMA",name:"showMA",defval:!1,type:"bool"}],id:"Volume@tv-basicstudies-1"},constructor:function(){this.f_0=function(a,b){return PineJS.Std.gt(a,b)?0:1};this.f_1=function(a,b){return a?b:PineJS.Std.na()};this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=PineJS.Std.volume(this._context),e=this.f_0(PineJS.Std.open(this._context),PineJS.Std.close(this._context)),f=PineJS.Std.volume(this._context),f=this._context.new_var(f),f=PineJS.Std.sma(f,
20,this._context),c=this.f_1(c,f);return[d,e,c]}}},{name:"ZigZag",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"ZigZag",shortDescription:"ZigZag",is_price_study:!0,
classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"integer",min:1,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1E3}],id:"ZigZag@tv-basicstudies-1"},constructor:function(){this.main=function(a,b){this._context=a;this._input=b;var c=this._input(0),d=this._input(1),c=c/100,e=d/2,d=PineJS.Std.zigzag(c,e,this._context),c=PineJS.Std.zigzagbars(c,e,this._context);return[d,c]}}}]);JSServer.PointsetManager=function(){this._sets={}};JSServer.PointsetManager.prototype._cacheKey=function(a,b){return a};JSServer.PointsetManager.prototype.createPointset=function(a,b,c,d,e,f){b=this._cacheKey(b,c);this._sets.hasOwnProperty(b)||(this._sets[b]=[]);c=[];for(var g=0;g<d.length;++g)if(0!=d[g][1]){var h=e.getPointTime(d[g][0],d[g][1],f);c.push(h)}else c.push(d[g][0]);this._sets[b].push({guid:a,points:c})};
JSServer.PointsetManager.prototype.removePointset=function(a){for(var b in this._sets)for(var c=this._sets[b],d=0;d<c.length;++d)if(c[d].guid==a){c.splice(d,1);return}};JSServer.PointsetManager.prototype._refreshPointsetData=function(a,b,c,d){for(var e=[],f=0;f<a.points.length;++f){var g=a.points[f],h=this._indexOfTime(b,g,c,d);e.push({index:f,value:[h,g]})}return e};
JSServer.PointsetManager.prototype.broadcastPointsetsUpdates=function(a,b,c,d,e,f){a=this._cacheKey(a,b);if(this._sets.hasOwnProperty(a)){b=this._sets[a].length;for(var g=0;g<b;++g){var h=this._sets[a][g],k=this._refreshPointsetData(h,c,d,e);f(h.guid,k)}}};JSServer.PointsetManager.prototype._indexOfTime=function(a,b,c,d){var e=PineJsBarBuilder.lower_bound(a,1E3*b,function(a,b){return a.value[0]>b?1:a.value[0]<b?-1:0});return 0<=e&&b<a[a.length-1].value[0]?a[e].index:c.indexOfBar(b,d)};JSServer.ExtrapolationManager=function(){this._storages={}};JSServer.ExtrapolationManager.prototype.remove=function(a,b){delete this._storages[a+","+b]};JSServer.ExtrapolationManager.prototype.storage=function(a,b){var c=a+","+b,d;for(d in this._storages)if(0<=d.indexOf(c))return this._storages[d];this._storages[c]=new JSServer.Extrapolator(b);return this._storages[c]};
JSServer.Extrapolator=function(a){this._lastRealBarIndex=this._lastRealBarTime=null;this._resolution=a;this._extrapolatedBars=[];this._onReadyCallbacks=[]};JSServer.Extrapolator.prototype.ready=function(){return!!this._lastRealBarTime};JSServer.Extrapolator.prototype.rebuild=function(a,b){this._lastRealBarTime=a;this.ensureExtrapolatedToBar(b,this._lastRealBarIndex+this._extrapolatedBars.length)};
JSServer.Extrapolator.prototype.getPointTime=function(a,b,c){a=this.indexOfBar(a,c)-this._lastRealBarIndex;this.ensureExtrapolatedToBar(c,a+b+1);return this._extrapolatedBars[a+b]};JSServer.Extrapolator.prototype.indexOfBar=function(a,b){this.ensureExtrapolatedToTime(b,a);var c=PineJsBarBuilder.lower_bound(this._extrapolatedBars,a,function(a,b){return a>b?1:a<b?-1:0});return this._lastRealBarIndex+c};
JSServer.Extrapolator.prototype._extrapolateData=function(a,b){if(!this.ready())throw"No real bars known, so cannot extrapolate anything";var c=0<this._extrapolatedBars.length?1E3*this._extrapolatedBars[this._extrapolatedBars.length-1]:this._lastRealBarTime,d=b(c);if(d){d[0]==c&&d.splice(0,1);for(c=0;c<d.length;++c)d[c]/=1E3;this._extrapolatedBars=this._extrapolatedBars.concat(d);for(c=0;c<this._extrapolatedBars.length;++c)this._extrapolatedBars.indexOf(this._extrapolatedBars[c])!=c&&console.error("Duplicating extrapolated bars: duplicated "+
new Date(1E3*this._extrapolatedBars[c]))}ChartapiMessagerInstance.onTickmarksUpdated(this._lastRealBarIndex+1,this._extrapolatedBars,a)};JSServer.Extrapolator.prototype.onTickmarksNeeded=function(a,b){if(this.ready())this.ensureExtrapolatedToBar(a,b);else{var c=this;this._onReadyCallbacks.push(function(){c.ensureExtrapolatedToBar(a,b)})}};
JSServer.Extrapolator.prototype.ensureExtrapolatedToBar=function(a,b){var c=this;return this._extrapolateData(a,function(d){if(c._extrapolatedBars.length>=b||!c._shouldExtrapolateMore())return null;var e=b-c._extrapolatedBars.length;return PineJsBarBuilder.extrapolateBarsFrontByCount(c.newBarBuilder(a),d,e)})};
JSServer.Extrapolator.prototype.ensureExtrapolatedToTime=function(a,b){var c=this;return this._extrapolateData(a,function(d){return d>=b||!c._shouldExtrapolateMore()?null:PineJsBarBuilder.extrapolateBarsFrontToTime(c.newBarBuilder(a),d,b)})};JSServer.Extrapolator.prototype.newBarBuilder=function(a){a=PineJS.Symbol.newSession(a.timezone,a.session);return PineJS.Symbol.newBarBuilder(this._resolution,a)};JSServer.Extrapolator.prototype._shouldExtrapolateMore=function(){return 100>this._extrapolatedBars.length};
JSServer.Extrapolator.prototype.setLastBarTime=function(a,b){this._lastRealBarTime=b;this._lastRealBarIndex=a;for(var c=0;c<this._onReadyCallbacks.length;++c)this._onReadyCallbacks[c]();this._onReadyCallbacks=[]};JSServer.JSStudyEngine=function(a){var b=this;this._studiesCache={};this._metainfoCache=[];this._symbolInfoCache={};this._extrapolationManager=new JSServer.ExtrapolationManager;this._externalDatafeed=window.parent[a];this._datafeedConfiguration=null;this._callbacks={};this._externalDatafeed.setup({},function(a){b._datafeedConfiguration=b._adoptConfigurationData(a);b._fireEvent("configuration_received")});this._pointsetsManager=new JSServer.PointsetManager;this._rangeExtensionData={};this._extendedRange=
function(a,d){var e=a+d;return b._rangeExtensionData[e]?b._rangeExtensionData[e].summary:0};PineJSFeed.setupFeed({resolve:function(a,d,e){b.resolveSymbol(a,d,e)},subscribe:function(a,d,e,f,g){var h=a.ticker+","+d;b._externalDatafeed.getBars(a,d,parseInt(e.from/1E3),parseInt(e.to/1E3),function(e){var g=new PineJS.BarSet(a,e);f(g);b._externalDatafeed.subscribeBars(a,d,function(a){g.add(a);f(g)},h)},g);return h},unsubscribe:function(a){b._externalDatafeed.unsubscribeBars(a)},calculateHistoryDepth:this._externalDatafeed.calculateHistoryDepth,
getRangeExtension:this._extendedRange},!0)};JSServer.JSStudyEngine.prototype._extendRange=function(a,b,c){a+=b;this._rangeExtensionData.hasOwnProperty(a)||(this._rangeExtensionData[a]={summary:0,last:0});this._rangeExtensionData[a].summary+=c;this._rangeExtensionData[a].last=c};JSServer.JSStudyEngine.prototype.on=function(a,b){this._callbacks.hasOwnProperty(a)||(this._callbacks[a]=[]);this._callbacks[a].push(b);return this};
JSServer.JSStudyEngine.prototype._fireEvent=function(a,b){if(this._callbacks.hasOwnProperty(a)){for(var c=this._callbacks[a],d=0;d<c.length;++d)c[d](b);this._callbacks[a]=[]}};JSServer.JSStudyEngine.prototype._adoptConfigurationData=function(a){a=TradingView.merge({},a);var b=a.supportedResolutions;if(!b||0==b.length)return a.supportedResolutions=void 0,a;for(var c={},d=0;d<b.length;d++){var e=b[d];if(c.hasOwnProperty(e))throw"Duplicating resolution `"+e+"`";c[e]=1}a.supportedResolutions=c;return a};
JSServer.JSStudyEngine.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supportedResolutions};JSServer.JSStudyEngine.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbolsTypes||[]};JSServer.JSStudyEngine.prototype.supportedExchangesList=function(){return this._datafeedConfiguration.exchanges||[]};
JSServer.JSStudyEngine.prototype._createStudyLogicObject=function(a){var b=JSServer.studyLibrary.filter(function(b){return b.metainfo.id==a});if(0==b.length)throw"Study `"+a+"` not found";return new b[0].constructor};
JSServer.JSStudyEngine.prototype.getMarks=function(a,b,c,d,e){function f(a){function b(c,d){return isArray(a[c])?a[c][d]:a[c]}if(isArray(a))return a;for(var c=[],d=0;d<a.id.length;++d)c.push({id:b("id",d),time:b("time",d),color:b("color",d),text:b("text",d)});return c}var g={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._externalDatafeed.getMarks(a,b,c,function(a){a=f(a);a.map(function(a){a.tickmark=a.time;a.direction=g[a.color];a.onClicked=function(){GlobalEventsStorage.emit("onMarkClick",
a.id)};delete a.color});d(a)},e)};
JSServer.JSStudyEngine.prototype._computeStudy=function(a,b,c,d,e,f,g,h){var k=!0,m=[],n={},q=0,l=this;this.resolveSymbol(b,function(s){if(PineJS.Symbol.parsePeriod(c).isIntraday&&!s.has_intraday)h("Unsupported resolution");else{var u=new PineJS.StudyEngine({tickerid:b,symbolInfo:s,period:c,body:a,onErrorCallback:h,input:function(a){return e[a]},out:function(a,b){for(var c=b,d=a.time,e="number"===typeof c?[c]:c,f=0;f<e.length;++f)(c=e[f])&&"object"==typeof c&&(n["plot_"+f]=c.offset,c=c.value,q++),
"number"===typeof c&&isNaN(c)&&(c=void 0),e[f]=c;c=m.length-1;(f=0>c||d>m[c].value[0])?m.push({index:m.length,value:[d].concat(e)}):m[c].value=[d].concat(e);k||g([m[m.length-1]],f,c,n,s)},recalc:function(){k=!1;f(m,0<q?n:void 0,s)}});l._studiesCache[d].engine=u}},function(a){h(a)})};
JSServer.JSStudyEngine.prototype._createStudy=function(a,b,c,d,e,f,g){var h=this;$.Deferred(function(){ChartapiMessagerInstance.onStudyLoading(e,f);h._computeStudy(c,a,b,e,g,function(c,d,g){ChartapiMessagerInstance.onDataUpdate(e,f,h._convertBarsTimeToUnix(c),d,g,h._extendedRange(a,b));ChartapiMessagerInstance.onStudyCompleted(e,f)},function(c,d,g,q,l){ChartapiMessagerInstance.onDataUpdate(e,f,h._convertBarsTimeToUnix(c),q,l,h._extendedRange(a,b))},function(a){ChartapiMessagerInstance.onStudyError(e,
a)})})};JSServer.JSStudyEngine.prototype.purgeGuardData=function(a){this._studiesCache[a]&&delete this._studiesCache[a].firstBarTime};
JSServer.JSStudyEngine.prototype.recreateSources=function(a,b,c,d){for(var e in this._studiesCache){var f=this._studiesCache[e];f.engine&&f.engine.stop()}PineJSFeed.unsubscribeUnused();for(e in this._studiesCache)f=this._studiesCache[e],f.symbol=a,f.resolution=b,"series"==f.type&&this.createSeries(a,b,c,e,f.turnaround,d);for(e in this._studiesCache)f=this._studiesCache[e],"study"==f.type&&this._createStudy(a,b,f.studyObject,c,e,f.turnaround,f.inputs)};
JSServer.JSStudyEngine.prototype.removeStudy=function(a){this._studiesCache[a].engine&&(this._studiesCache[a].engine.stop(),PineJSFeed.unsubscribeUnused());delete this._studiesCache[a]};JSServer.JSStudyEngine.prototype.removeSeries=function(a){this.removeStudy(a)};JSServer.JSStudyEngine.prototype.recomputeStudy=function(a,b,c,d){var e=this._studiesCache[a];e.inputs=b;e.engine&&e.engine.stop();this._createStudy(e.symbol,e.resolution,e.studyObject,c,a,d,b)};
JSServer.JSStudyEngine.prototype._convertBarsTimeToUnix=function(a){for(var b=[],c=0;c<a.length;++c){var d={index:a[c].index,value:[].concat(a[c].value)};d.value[0]/=1E3;b.push(d)}return b};JSServer.JSStudyEngine.prototype.createStudy=function(a,b,c,d,e,f,g){f=this._createStudyLogicObject(f);this._studiesCache[d]={studyObject:f,symbol:a,resolution:b,guid:d,type:"study",inputs:g,turnaround:e};this._createStudy(a,b,f,c,d,e,g)};
JSServer.JSStudyEngine.prototype.extendSeriesRange=function(a,b,c){a=this._studiesCache[a];this._extendRange(a.symbol,a.resolution,c+10);this.recreateSources(a.symbol,a.resolution,b,!0)};JSServer.JSStudyEngine.prototype.updateSeriesTurnaround=function(a,b){this._studiesCache[a].turnaround=b};
JSServer.JSStudyEngine.prototype.createSeries=function(a,b,c,d,e,f){c=new PineJS.OHLCV;var g=this._studiesCache[d];this._studiesCache[d]={symbol:a,resolution:b,studyObject:c,guid:d,type:"series",turnaround:e};ChartapiMessagerInstance.onSeriesLoading(d,e);var h=this;this._computeStudy(c,a,b,d,[],function(a,c,n){c=h._convertBarsTimeToUnix(a);var q=1E3*c[0].value[0];if((g&&g.firstBarTime)===q)ChartapiMessagerInstance.onSeriesCompleted(d,e,n.data_status);else{h._studiesCache[d].firstBarTime=q;var q=c[c.length-
1],l=h._extrapolationManager.storage(n.full_name,b);l.setLastBarTime(q.index,1E3*q.value[0]);if(f)ChartapiMessagerInstance.onSeriesClearData(d,e);ChartapiMessagerInstance.onTimescaleUpdate(d,e,c,n);ChartapiMessagerInstance.onSeriesCompleted(d,e,n.data_status);h._pointsetsManager.broadcastPointsetsUpdates(n.full_name,b,a,l,n,function(a,b){ChartapiMessagerInstance.onPointsetDataUpdate(a,e,b,n)})}},function(a,c,f,g,l){f=h._convertBarsTimeToUnix(a);if(c)ChartapiMessagerInstance.onTimescaleUpdate(d,e,
f,l),c=f[f.length-1],h._extrapolationManager.storage(l.full_name,b).setLastBarTime(c.index,1E3*c.value[0]);else ChartapiMessagerInstance.onDataUpdate(d,e,f,void 0,l);h._fireEvent("realtime_tick",a[a.length-1])},function(a){ChartapiMessagerInstance.onSeriesError(d,a)})};JSServer.JSStudyEngine.prototype.onMoreTickmarksRequested=function(a,b,c,d){this._extrapolationManager.storage(b.full_name,c).onTickmarksNeeded(b,d)};JSServer.JSStudyEngine.prototype.removePointset=function(a){this._pointsetsManager.removePointset(a)};
JSServer.JSStudyEngine.prototype.rebuildExtrapolatedData=function(a,b,c,d){this._extrapolationManager.storage(c.full_name,b).rebuild(d,c)};JSServer.JSStudyEngine.prototype.createPointset=function(a,b,c,d,e){var f=this._extrapolationManager.storage(c.full_name,d);this._pointsetsManager.createPointset(a,b,d,e,f,c)};
JSServer.JSStudyEngine.prototype.studiesMetadata=function(){if(0==this._metainfoCache.length)for(var a=0;a<JSServer.studyLibrary.length;++a)this._metainfoCache.push(JSServer.studyLibrary[a].metainfo);return this._metainfoCache};JSServer.JSStudyEngine.prototype.searchSymbolsByName=function(a,b,c,d){this._externalDatafeed.searchSymbolsByName(a,b,c,d)};
JSServer.JSStudyEngine.prototype.resolveSymbol=function(a,b,c){var d=a;0==a.indexOf("=")&&(d=JSON.parse(a.slice(1)).symbol);var e=this;this._symbolInfoCache.hasOwnProperty(d)?b(this._symbolInfoCache[d]):this._externalDatafeed.resolveSymbol(d,function(a){a.base_name||(a.base_name=[a.name]);a.legs||(a.legs=[a.name]);a.exchange||(a.exchange=a["exchange-listed"]);a.full_name||(a.full_name=a.exchange+":"+a.name);a.data_status||(a.data_status="streaming");e._symbolInfoCache[d]=a;b(a)},c)};function PublishedChartsTimeline(){}LinearRegressionPaneView=function(){};TradingView.study_PivotPointsStandard=function(){};TradingView.study_PivotPointsHighLow=function(){};TradingView.study_ZigZag=function(){};TradingView.study_LinearRegression=function(){};TradingView.study_ElliottWave=function(){};TradingView.ESDStudyBase=function(){};TradingView.Pro=function(){this.hasPackage=function(){return!1}};TradingView.Pro.prototype.getStudies=function(){return[]};
TradingView.Pro.prototype.getProduct=function(){return{}};TradingView.Pro.prototype.getStudiesOrder=function(){return[]};TradingView.LineToolRegressionTrend=function(){};
TradingView.templates={dialogs:{addSymbol:' <div class="main"> <div class="symbol-edit-place"></div>{{#overlayOption}} <div class="tv-dialog-relative">\t<input id="tv-dialog-addsymbol-overlay-checkbox" type="checkbox" name="addsymbol-overlay" {{#overlayOptionChecked}}checked="checked"{{/overlayOptionChecked}} />\t<span class="tv-dialog-checkbox-mask tv-dialog-checkbox-mask{{#overlayOptionChecked}}-active{{/overlayOptionChecked}}"></span>\t<label for="tv-dialog-addsymbol-overlay-checkbox"> Overlay the main chart</label> </div>{{/overlayOption}} <div class="tv-dialogs-bottom-button"> <span class="tv-button tv-right tv-uppercase ok">{{okButtonTitle}}</span> </div> </div>',symbolSearch:'<div class="symbol-block"><div class="spread-actions"></div><div class="symbol-block-inputspacer"><input maxlength="'+
TradingView.SYMBOL_SEARCH_MAX_LENGTH+'" /><div class="search-cion"></div></div></div><div class="filter"></div><div class="results"></div>'}};