@barchart/chart-lib 2.106.1 → 2.183.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/barchart.chart.js DELETED
@@ -1,15 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Charts=e():(t.Barchart=t.Barchart||{},t.Barchart.RealtimeWidgets=t.Barchart.RealtimeWidgets||{},t.Barchart.RealtimeWidgets.Charts=e())}(window,(function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=44)}([function(t,e,i){(function(t){!function(i,n){"use strict";var s={};i.PubSub=s,function(t){var e={},i=-1;function n(t,e,i){try{t(e,i)}catch(t){setTimeout(function(t){return function(){throw t}}(t),0)}}function s(t,e,i){t(e,i)}function r(t,i,r,o){var a,l=e[i],c=o?s:n;if(Object.prototype.hasOwnProperty.call(e,i))for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&c(l[a],t,r)}function o(t){var i=String(t);return Boolean(Object.prototype.hasOwnProperty.call(e,i)&&function(t){var e;for(e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}(e[i]))}function a(t,e,i,n){var s=function(t,e,i){return function(){var n=String(t),s=n.lastIndexOf(".");for(r(t,t,e,i);-1!==s;)s=(n=n.substr(0,s)).lastIndexOf("."),r(t,n,e,i);r(t,"*",e,i)}}(t="symbol"==typeof t?t.toString():t,e,n);return!!function(t){for(var e=String(t),i=o(e)||o("*"),n=e.lastIndexOf(".");!i&&-1!==n;)n=(e=e.substr(0,n)).lastIndexOf("."),i=o(e);return i}(t)&&(!0===i?s():setTimeout(s,0),!0)}t.publish=function(e,i){return a(e,i,!1,t.immediateExceptions)},t.publishSync=function(e,i){return a(e,i,!0,t.immediateExceptions)},t.subscribe=function(t,n){if("function"!=typeof n)return!1;t="symbol"==typeof t?t.toString():t,Object.prototype.hasOwnProperty.call(e,t)||(e[t]={});var s="uid_"+String(++i);return e[t][s]=n,s},t.subscribeAll=function(e){return t.subscribe("*",e)},t.subscribeOnce=function(e,i){var n=t.subscribe(e,(function(){t.unsubscribe(n),i.apply(this,arguments)}));return t},t.clearAllSubscriptions=function(){e={}},t.clearSubscriptions=function(t){var i;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&0===i.indexOf(t)&&delete e[i]},t.countSubscriptions=function(t){var i,n,s=0;for(i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&0===i.indexOf(t)){for(n in e[i])s++;break}return s},t.getSubscriptions=function(t){var i,n=[];for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&0===i.indexOf(t)&&n.push(i);return n},t.unsubscribe=function(i){var n,s,r,o="string"==typeof i&&(Object.prototype.hasOwnProperty.call(e,i)||function(t){var i;for(i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&0===i.indexOf(t))return!0;return!1}(i)),a=!o&&"string"==typeof i,l="function"==typeof i,c=!1;if(!o){for(n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(s=e[n],a&&s[i]){delete s[i],c=i;break}if(l)for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&s[r]===i&&(delete s[r],c=!0)}return c}t.clearSubscriptions(i)}}(s),void 0!==t&&t.exports&&(e=t.exports=s),e.PubSub=s,t.exports=e=s}("object"==typeof window&&window||this)}).call(this,i(34)(t))},function(t,e,i){"use strict";t.exports=i(35)},,function(t,e){t.exports=(()=>{"use strict";return{number:t=>"number"==typeof t&&!isNaN(t),nan:t=>"number"==typeof t&&isNaN(t),integer:t=>"number"==typeof t&&!isNaN(t)&&(0|t)===t,large:t=>"number"==typeof t&&!isNaN(t)&&isFinite(t)&&Math.floor(t)===t,positive(t){return this.number(t)&&t>0},negative(t){return this.number(t)&&t<0},iterable(t){return!this.null(t)&&!this.undefined(t)&&this.fn(t[Symbol.iterator])},string:t=>"string"==typeof t,date:t=>t instanceof Date,fn:t=>"function"==typeof t,array:t=>Array.isArray(t),boolean:t=>"boolean"==typeof t,object:t=>"object"==typeof t&&null!==t,null:t=>null===t,undefined:t=>void 0===t,zeroLengthString(t){return this.string(t)&&0===t.length},extension(t,e){return this.fn(t)&&this.fn(e)&&e.prototype instanceof t}}})()},function(t,e,i){const n=i(3),s=i(29),r=i(9);t.exports=(()=>{"use strict";class t{constructor(){}static getIsConcrete(t){return n.string(t)&&!this.getIsReference(t)}static getIsReference(t){return n.string(t)&&a.futures.alias.test(t)}static getIsFuture(t){return n.string(t)&&(a.futures.concrete.test(t)||a.futures.alias.test(t))}static getIsFutureSpread(t){return n.string(t)&&a.futures.spread.test(t)}static getIsFutureOption(t){return n.string(t)&&(a.futures.options.short.test(t)||a.futures.options.long.test(t)||a.futures.options.historical.test(t))}static getIsForex(t){return n.string(t)&&a.forex.test(t)}static getIsIndex(t){return n.string(t)&&a.indicies.external.test(t)}static getIsSector(t){return n.string(t)&&a.indicies.sector.test(t)}static getIsCanadianFund(t){return n.string(t)&&a.funds.canadian.test(t)}static getIsCmdty(t){return n.string(t)&&(a.cmdty.stats.test(t)||a.cmdty.internal.test(t)||a.cmdty.external.test(t))}static getIsCmdtyStats(t){return n.string(t)&&a.cmdty.stats.test(t)}static getIsBats(t){return n.string(t)&&o.bats.test(t)}static getIsEquityOption(t){return n.string(t)&&a.equities.options.test(t)}static getIsExpired(e){const n=t.parseInstrumentType(e);let s=!1;if(null!==n&&n.year&&n.month){const t=u();if(n.year<t)s=!0;else if(n.year===t&&i.hasOwnProperty(n.month)){(new Date).getMonth()+1>i[n.month]&&(s=!0)}}return s}static getIsC3(t){return n.string(t)&&(a.c3.concrete.test(t)||a.c3.alias.test(t))}static getIsPlatts(t){return n.string(t)&&(a.platts.concrete.test(t)||a.platts.alias.test(t))}static getIsPit(t,e){return n.string(t)&&n.string(e)&&o.pit.test(e)}static parseInstrumentType(t){if(!n.string(t))return null;let e=null;for(let i=0;i<l.length&&null===e;i++){e=(0,l[i])(t)}return e}static getProducerSymbol(t){if(!n.string(t))return null;let e=null;for(let i=0;i<c.length&&null===e;i++){e=(0,c[i])(t)}return e}static getFuturesOptionPipelineFormat(e){const i=t.parseInstrumentType(e);let n=null;if("future_option"===i.type){const t=p(i.option_type);n=`${i.root}${i.month}${h(i.year,1)}|${i.strike}${t}`}return n}static getFuturesExplicitFormat(e){let i=null;if(t.getIsFuture(e)&&t.getIsConcrete(e)){const n=t.parseInstrumentType(e);i=`${n.root}${n.month}${s.padLeft(Math.floor(n.year%100).toString(),2,"0")}`}return i}static displayUsingPercent(t){return n.string(t)&&o.percent.test(t)}toString(){return"[SymbolParser]"}}const e={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},i={F:1,G:2,H:3,J:4,K:5,M:6,N:7,Q:8,U:9,V:10,X:11,Z:12},o={bats:/^(.*)\.BZ$/i,percent:/(\.RT)$/,pit:/\(P(it)?\)/},a={c3:{}};a.c3.alias=/^(C3:)(.*)$/i,a.c3.concrete=/(\.C3)$/i,a.cmdty={},a.cmdty.stats=/(\.CS)$/i,a.cmdty.internal=/(\.CM)$/i,a.cmdty.external=/(\.CP)$/i,a.equities={},a.equities.options=/^([A-Z\$][A-Z\-]{0,}(\.[A-Z]{1})?)([0-9]?)(\.[A-Z]{2})?\|([[0-9]{4})([[0-9]{2})([[0-9]{2})\|([0-9]+\.[0-9]+)[P|W]?(C|P)/i,a.forex=/^\^([A-Z]{3})([A-Z]{3})$/i,a.funds={},a.funds.canadian=/(.*)(\.CF)$/i,a.futures={},a.futures.alias=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1,2})$/i,a.futures.concrete=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,a.futures.spread=/^_S_/i,a.futures.options={},a.futures.options.historical=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,a.futures.options.long=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,a.futures.options.short=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,a.indicies={},a.indicies.external=/^\$(.*)$/i,a.indicies.sector=/^\-(.*)$/i,a.platts={},a.platts.alias=/^(PLATTS:)(.*)$/i,a.platts.concrete=/^(.*)(\.PT)$/i;const l=[];l.push(t=>{let e=null;return a.futures.spread.test(t)&&(e={},e.symbol=t,e.type="future_spread"),e}),l.push(t=>{let e=null;const i=t.match(a.futures.concrete);return null!==i&&(e={},e.symbol=t,e.type="future",e.asset=r.FUTURE,e.dynamic=!1,e.root=i[1],e.month=i[2],e.year=d(i[3])),e}),l.push(t=>{let e=null;const i=t.match(a.futures.alias);return null!==i&&(e={},e.symbol=t,e.type="future",e.asset=r.FUTURE,e.dynamic=!0,e.root=i[1],e.dynamicCode=i[3]),e}),l.push(t=>{let e=null;return a.forex.test(t)&&(e={},e.symbol=t,e.type="forex",e.asset=r.FOREX),e}),l.push(t=>{let e=null;const i=t.match(a.equities.options);if(null!==i){const n=void 0!==i[4]?i[4]:"";e={},e.symbol=t,e.type="equity_option",e.asset=r.STOCK_OPTION,e.option_type="C"===i[9]?"call":"put",e.strike=parseFloat(i[8]),e.root=`${i[1]}${n}`,e.month=parseInt(i[6]),e.day=parseInt(i[7]),e.year=parseInt(i[5]),e.adjusted=""!==i[3]}return e}),l.push(t=>{let e=null;return a.indicies.external.test(t)&&(e={},e.symbol=t,e.type="index"),e}),l.push(t=>{let e=null;return a.indicies.sector.test(t)&&(e={},e.symbol=t,e.type="sector"),e}),l.push(t=>{let e=null;const i=t.match(a.futures.options.short);if(null!==i){e={};const n=i[4].charCodeAt(0),s=80,o=67;let a,l;n<s?(a="call",l=n-o):(a="put",l=n-s),e.symbol=t,e.type="future_option",e.asset=r.FUTURE_OPTION,e.option_type=a,e.strike=parseInt(i[3]),e.root=i[1],e.month=i[2],e.year=u()+l}return e}),l.push(t=>{let i=null;const n=t.match(a.futures.options.long)||t.match(a.futures.options.historical);var s;return null!==n&&(i={},i.symbol=t,i.type="future_option",i.asset=r.FUTURE_OPTION,i.option_type="C"===n[5]?"call":"put",i.strike=parseInt(n[4]),i.root=n[1],i.month=(s=n[2],e[s]||s),i.year=d(n[3])),i});const c=[];function u(){return(new Date).getFullYear()}function h(t,e){const i=t.toString();return i.substring(i.length-e,i.length)}function d(t){const e=u();let i=parseInt(t);if(i<10&&1===t.length){const t=i<e%10?1:0;i=10*Math.floor(e/10)+i+10*t}else if(i<100&&(i=100*Math.floor(e/100)+i,i<e)){const t=i+100;e-i>t-e&&(i=t)}return i}function p(t){return"call"===t?"C":"put"===t?"P":null}return c.push(e=>{let i=null;return t.getIsFuture(e)&&t.getIsConcrete(e)&&(i=e.replace(/(.{1,3})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,"$1$2$4")||null),i}),c.push(e=>{let i=null;if(t.getIsFutureOption(e)){const n=t.parseInstrumentType(e),s=p(n.option_type);if(n.root.length<3){const t=s.charCodeAt(0);i=`${n.root}${n.month}${n.strike}${String.fromCharCode(t+n.year-u())}`}else i=`${n.root}${n.month}${h(n.year,1)}|${n.strike}${s}`}return i}),c.push(t=>{let e=null;return a.c3.alias.test(t)&&(e=t.replace(a.c3.alias,"$2.C3")),e}),c.push(t=>{let e=null;return a.platts.alias.test(t)&&(e=t.replace(a.platts.alias,"$2.PT")),e}),c.push(t=>t),t})()},,,function(t,e,i){"use strict";var n,s,r,o=i(36),a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){r=!1}function c(t){if(t){if(t!==n){if(t.length!==a.length)throw new Error("Custom alphabet for shortid must be "+a.length+" unique characters. You submitted "+t.length+" characters: "+t);var e=t.split("").filter((function(t,e,i){return e!==i.lastIndexOf(t)}));if(e.length)throw new Error("Custom alphabet for shortid must be "+a.length+" unique characters. These characters were not unique: "+e.join(", "));n=t,l()}}else n!==a&&(n=a,l())}function u(){return r||(r=function(){n||c(a);for(var t,e=n.split(""),i=[],s=o.nextValue();e.length>0;)s=o.nextValue(),t=Math.floor(s*e.length),i.push(e.splice(t,1)[0]);return i.join("")}())}t.exports={get:function(){return n||a},characters:function(t){return c(t),n},seed:function(t){o.seed(t),s!==t&&(l(),s=t)},lookup:function(t){return u()[t]},shuffled:u}},function(t,e,i){const n=i(3),s=i(10),r=i(13),o=i(30);t.exports=(()=>{"use strict";return function(t,e,i,a,l,c){if(!n.number(t))return"";const u=o.parse(e);if(null===u)return"";if((!n.string(i)||i.length>1)&&(i="."),a=n.boolean(a)&&a,c=n.boolean(c)&&c,u.supportsFractions&&"."!==i){const e=u.getFractionFactor(a),n=u.getFractionDigits(a);return r(t,e,n,i,c)}return s(t,u.decimalDigits,l,c)}})()},function(t,e,i){const n=i(12);t.exports=(()=>{"use strict";class t extends n{constructor(t,e,i){super(t,e),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(t){return n.fromCode(UnitCode,t)}static fromId(e){return n.getItems(t).find(t=>t.id===e)||null}static get STOCK(){return e}static get STOCK_OPTION(){return i}static get FUTURE(){return s}static get FUTURE_OPTION(){return r}static get FOREX(){return o}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}const e=new t("STK","U.S. Equity",1),i=new t("STKOPT","Equity Option",34),s=new t("FUT","Future",2),r=new t("FUTOPT","Future Option",12),o=new t("FOREX","FOREX",10);return t})()},function(t,e,i){const n=i(3);t.exports=(()=>{"use strict";return function(t,e,i,s){if(!n.number(t))return"";(!n.string(i)||i.length>1)&&(i="");const r=t<0&&!0===s;r&&(t=0-t);let o=t.toFixed(e);if(i&&(t<-999||t>999)){const n=t<0;let s=0===e,a=0;const l=[];for(let t=o.length-1;!(t<0);t--){3!==a||n&&0===t||(l.unshift(i),a=0);const e=o.charAt(t);l.unshift(e),s?a+=1:"."===e&&(s=!0)}r&&(l.unshift("("),l.push(")")),o=l.join("")}else r&&(o="("+o+")");return o}})()},function(t,e,i){const n=i(3);t.exports=(()=>{"use strict";function t(t,i,s,r,o){s===String?n.string(t)||e(i,"string",o):s===Number?n.number(t)||e(i,"number",o):s===Function?n.fn(t)||e(i,"function",o):s===Boolean?n.boolean(t)||e(i,"boolean",o):s===Date?n.date(t)||e(i,"date",o):s===Array?n.array(t)||e(i,"array",o):t instanceof(s||Object)||e(i,r,o)}function e(t,e,i){let n;throw n="number"==typeof i?`The argument [ ${t||"unspecified"} ], at index [ ${i.toString()} ] must be a [ ${e||"unknown"} ]`:`The argument [ ${t||"unspecified"} ] must be a [ ${e||"Object"} ]`,new Error(n)}function i(t,e){throw new Error(`The argument [ ${t||"unspecified"} ] failed a validation check [ ${e||"No description available"} ]`)}return{argumentIsRequired(e,i,n,s){t(e,i,n,s)},argumentIsOptional(e,s,r,o,a,l){null!=e&&(t(e,s,r,o),n.fn(a)&&!a(e)&&i(s,l))},argumentIsArray(e,i,n,s){if(this.argumentIsRequired(e,i,Array),n){let r;r="function"==typeof n&&n!==Function?(t,e)=>void 0!==n.prototype&&t instanceof n||n(t,`${i}[${e}]`):(e,r)=>t(e,i,n,s,r),e.forEach((t,e)=>{r(t,e)})}},argumentIsValid(t,e,n,s){n(t)||i(e,s)},areEqual(t,e,i,n){if(t!==e)throw new Error(`The objects must be equal [${i||t.toString()}] and [${n||e.toString()}]`)},areNotEqual(t,e,i,n){if(t===e)throw new Error(`The objects cannot be equal [${i||t.toString()}] and [${n||e.toString()}]`)}}})()},function(t,e,i){const n=i(11);t.exports=(()=>{"use strict";const t=new Map;class e{constructor(i,s){n.argumentIsRequired(i,"code",String),n.argumentIsRequired(s,"description",String),this._code=i,this._description=s;const r=this.constructor;t.has(r)||t.set(r,[]);null===e.fromCode(r,i)&&t.get(r).push(this)}get code(){return this._code}get description(){return this._description}equals(t){return t===this||t instanceof e&&t.constructor===this.constructor&&t.code===this.code}toJSON(){return this.code}static fromCode(t,i){return e.getItems(t).find(t=>t.code===i)||null}static getItems(e){return t.get(e)||[]}toString(){return"[Enum]"}}return e})()},function(t,e,i){const n=i(3);t.exports=(()=>{"use strict";return function(t,e,i,s,r){if(!n.number(t))return"";if(!n.number(e))return"";if(!n.number(i))return"";(!n.string(s)||s.length>1)&&(s=".");const o=Math.abs(t),a=function(t,e){const i=Math.floor(t);return 0===i&&""===e?"":i}(o,s),l=function(t){return t-Math.floor(t)}(o)*e,c=function(t,e){return["000",Math.floor(t)].join("").substr(-1*e)}(Math.floor(parseFloat(l.toFixed(1))),i);let u,h;return t<0?(r=n.boolean(r)&&r)?(u="(",h=")"):(u="-",h=""):(u="",h=""),[u,a,s,c,h].join("")}})()},function(t,e){t.exports=(()=>{"use strict";const t={},e={};function i(i,n,s){t[i]=n,e[i]=s}return i("F","January",1),i("G","February",2),i("H","March",3),i("J","April",4),i("K","May",5),i("M","June",6),i("N","July",7),i("Q","August",8),i("U","September",9),i("V","October",10),i("X","November",11),i("Z","December",12),i("Y","Cash",0),{getCodeToNameMap:()=>Object.assign({},t),getCodeToNumberMap:()=>Object.assign({},e)}})()},function(t,e,i){const n=i(4),s=i(31),r=i(9);t.exports=(()=>{"use strict";let t={},e=s("-",!0,",");class i{constructor(e,i,s,o,a,l,c,u){this.symbol=e,this.name=i,this.exchange=s,this.exchangeRef=c||null,this.unitCode=o,this.pointValue=a,this.tickIncrement=l;const h=n.parseInstrumentType(this.symbol),d=null!==h&&h.asset===r.FUTURE,p=null!==h&&h.asset===r.FUTURE_OPTION;if((d||p)&&(this.root=h.root,d&&(this.month=h.month,this.year=h.year,this.expiration=null,this.firstNotice=null)),this.asset=null,h&&h.asset&&(this.asset=h.asset),"object"==typeof u&&null!==u)for(let t in u)this[t]=u[t];t[e]=this}formatPrice(t){return e(t,this.unitCode,this)}static setPriceFormatter(t,i,n){e=s(t,i,n)}static setPriceFormatterCustom(t){e=t}static PriceFormatter(t,e,n){i.setPriceFormatter(t,e,n)}static get Profiles(){return t}toString(){return`[Profile (symbol=${this.symbol})]`}}return i})()},function(t,e,i){const n=i(9),s=i(13),r=i(8);t.exports=(()=>{"use strict";const t={};return t.ZB=/^BB\d$/,t.ZT=/^BT\d$/,t.ZF=/^BF\d$/,t.ZN=/^BN\d$/,function(e,i,o){if(o.asset===n.FUTURE_OPTION){const i=o.root;if("ZB"===i||"ZN"===i||t.ZB.test(i)||t.ZN.test(i))return s(e,64,2,"-",!1);if("ZT"===i||"ZF"===i||t.ZT.test(i)||t.ZF.test(i))return s(e,640,3,"-",!1)}return r(e,i,"-",!0,",")}})()},function(t){t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart HTML5 Charts","definitions":{"color":{"type":"string","pattern":"^(#([0-9a-fA-F]{3}){1,2})|(rgba\\\\((\\\\s*\\\\d{1,3}\\\\s*,){3}\\\\s*[01]+(\\\\.\\\\d+)?\\\\))|(rgb\\\\((\\\\s*\\\\d{1,3}\\\\s*)(,\\\\s*\\\\d{1,3}\\\\s*){2}\\\\))$"},"orientationChoice":{"type":"string","enum":["vertical","horizontal","both","none"]},"dashStyle":{"type":"string","enum":["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","SparseDot","Dot","Dash","LongDash","DashDot","LongDashDot","LongDashDotDot"]},"aggUnit":{"type":"string","enum":["Tick","Intraday","Day","Week","Month","Quarter","Year"]},"aggSpec":{"type":"string","enum":["None","Nearest","Continue","FormT","PerCount","PerVolume","PerRange","PerSeconds"]},"period":{"type":"string","pattern":"^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$"},"density":{"type":"integer","minimum":5},"curveAttr":{"type":"string","enum":["ChangeBased","OpenVsClose"]},"paddingPercent":{"type":"number","minimum":0.001,"maximum":0.999},"detachedScale":{"type":"object","additionalProperties":false,"properties":{"marginTop":{"$ref":"#/definitions/paddingPercent","default":0.01},"marginBottom":{"$ref":"#/definitions/paddingPercent","default":0.01}}},"fundamental":{"type":"string","enum":["AccountsPayable","AccruedExpenses","Cash","CommonShares","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["MA","MA1","MA2","MA3","MA4","MA5","MA6","MA7","MA8","MA9","MA10","MAS","MAL","EMA","MAHI","MALO","MACD","MACDS","MACDH","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","STORSI","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLBW","BOLLBP","OBVOL","ATR","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","KCEUP","KCEMID","KCELOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","GPMI","CTLTM","CTLTMF","DEMA","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRHI","REATRLO","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","GTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","BOLLSQ","TTMSQZON","TTMSQZOFF","TTMSQZOSC"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","Symbol","Change","PercentChange","PreviousOpen","PreviousClose","PreviousHigh","PreviousLow","WeekPreviousClose","WeekPreviousHigh","WeekPreviousLow","MonthPreviousClose","MonthPreviousHigh","MonthPreviousLow","Projection","BarIndex"]},"eventField":{"type":"string","enum":["Dividends","Splits","Earnings","Buy","Sell","Custom"]},"curveField":{"anyOf":[{"$ref":"#/definitions/generalField"},{"$ref":"#/definitions/studyField"},{"$ref":"#/definitions/fundamental"}]},"curveStyle":{"type":"string","enum":["OHLC","Line","Candlestick","Area","Column","Dots","HLC","HL","Ribbon","Step","HollowCandles","HeikinAshi","ElderImpulseSystem","Renko","LineBreak","Kagi","PointAndFigure"]},"paneHeight":{"type":"number","minimum":0.01},"plotPlacement":{"type":"string","enum":["WithSeries","TimeAxis"],"default":"WithSeries"},"comparison":{"type":"string","enum":["None","Value","Percent"],"default":"None"},"scale":{"type":"string","enum":["Linear","Logarithmic"],"default":"Linear"},"study":{"type":"string","enum":["MA","MACDSIG","MASIG","MAEXP","MAHLC","MACD","MACDEXP","VOL","MAENV","MAENVEXP","MAENVSMO","MASMO","MATRI","MAWEI","MAVOL","OSCI","OSCIVOL","RSI","RSIMOD","RSISTO","STOCHF","STOCHS","WPERCR","HHLL","WGCL","BBANDS","BWIDTH","BPERC","BSQUEEZE","OBVOL","ATR","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELEXP","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","GPMI","DEMA","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRHI","REATRLO","LINRCHN","CSHO","CSHB","GTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ"]},"annId":{"type":"string","enum":["Line","Ray","GannLine","VerticalLine","HorizontalLine","FiftyPercentLine","LongPosition","ShortPosition","FibonacciRetracement","TrendBasedFibExtension","FibonacciFan","FibonacciArcs","GannFan","SpeedResistanceFan","SpeedResistanceArcs","AndrewsPitchfork","Rectangle","Ellipse","TrendChannel","SymbolArrowUp","SymbolArrowDown","SymbolArrowRight","SymbolArrowLeft","SymbolArcDown","SymbolArcUp","SymbolThumbsUp","SymbolThumbsDown","SymbolZero","SymbolOne","SymbolTwo","SymbolThree","SymbolFour","SymbolFive","SymbolSix","SymbolSeven","SymbolEight","SymbolNine","SymbolQuestion","SymbolFishHook","FibonacciTimeZones","Text","ComputedText"]},"aggregation":{"type":"object","additionalProperties":false,"properties":{"size":{"type":"integer","minimum":1,"multipleOf":1,"default":1},"unit":{"$ref":"#/definitions/aggUnit","default":"Day"},"spec":{"$ref":"#/definitions/aggSpec","default":"None"},"isContractVolume":{"type":"boolean","default":false},"dividendsAdjust":{"type":"boolean","default":false},"backAdjust":{"type":"boolean","default":false},"daysToExpiration":{"type":"integer","minimum":0,"maximum":60,"default":1},"contractRoll":{"type":"string","enum":["expiration","combined"],"default":"expiration"}},"required":["unit"]},"gridLines":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean","default":true},"color":{"type":"string","default":"#d8d8d8"},"lineWidth":{"type":"number","default":1},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"range":{"type":"object","additionalProperties":false,"properties":{"from":{"type":"number"},"to":{"type":"number"}}},"crosshair":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean","default":true},"snap":{"type":"boolean","default":false},"showValue":{"type":"boolean","default":true},"color":{"$ref":"#/definitions/color","default":"#c0c0c0"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"},"format":{"type":"string"}}},"displayAxis":{"type":"object","properties":{"visible":{"type":"boolean","default":true},"gridLines":{"$ref":"#/definitions/gridLines"},"minorGridLines":{"$ref":"#/definitions/gridLines"},"textColor":{"$ref":"#/definitions/color","default":"#000"},"crosshair":{"$ref":"#/definitions/crosshair"},"fontSize":{"type":"number","default":12}}},"displayChart":{"type":"object","additionalProperties":false,"properties":{"backgroundColor":{"$ref":"#/definitions/color","default":"#fff"},"plotBorderColor":{"$ref":"#/definitions/color"},"fontFamily":{"type":"string","default":"\\"Lucida Grande\\", \\"Lucida Sans Unicode\\", Verdana, Arial, Helvetica, sans-serif"},"fontSize":{"type":"number","default":13},"previous":{"$ref":"#/definitions/previous"},"exportUrl":{"type":"string"},"showMinMaxArc":{"type":"boolean","default":true},"showGoToLatest":{"type":"boolean","default":false},"showNoDataText":{"type":"boolean"},"newPaneHeight":{"$ref":"#/definitions/paneHeight","default":1},"plotHover":{"type":"boolean","default":false},"bar":{"$ref":"#/definitions/barMetrics"},"zooming":{"$ref":"#/definitions/orientationChoice","default":"both"}}},"barMetrics":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number"},"spacing":{"type":"number"}}},"previous":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color","default":"#000"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"},"forceVisible":{"type":"boolean","default":false}}},"scrollbar":{"type":"object","additionalProperties":false,"properties":{"barColor":{"$ref":"#/definitions/color","default":"#bfc8d1"},"buttonColor":{"$ref":"#/definitions/color","default":"#ebe7e8"},"trackColor":{"$ref":"#/definitions/color","default":"#eee"},"visible":{"type":"boolean","default":true}}},"tooltip":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean","default":true},"mode":{"type":"string","enum":["standard","cards","bubble","external"],"default":"standard"},"showMainPlot":{"type":"boolean","default":false},"backgroundColor":{"$ref":"#/definitions/color","default":"rgba(255, 255, 255, 0.85)"},"borderColor":{"$ref":"#/definitions/color","default":"#000"}}},"data":{"type":"object","additionalProperties":false,"properties":{"aggregation":{"$ref":"#/definitions/aggregation"},"maxDataPoints":{"type":"number"},"range":{"$ref":"#/definitions/range"},"checkRange":{"type":"boolean"}},"required":["aggregation"]},"display":{"type":"object","additionalProperties":false,"properties":{"period":{"$ref":"#/definitions/period"},"density":{"$ref":"#/definitions/density"},"chart":{"$ref":"#/definitions/displayChart"},"scrollbar":{"$ref":"#/definitions/scrollbar"},"scrollBehavior":{"type":"string","enum":["wheel","wheel+shift","none"],"default":"wheel"},"tooltip":{"$ref":"#/definitions/tooltip"},"yAxis":{"allOf":[{"$ref":"#/definitions/displayAxis"},{"properties":{"showLastValue":{"type":"string","enum":["None","All","Main"],"default":"All"},"preventLabelOverlap":{"type":"boolean","default":false},"snapAnnotationsToPrices":{"type":"boolean","default":false}}}]},"xAxis":{"allOf":[{"$ref":"#/definitions/displayAxis"},{"properties":{"format":{"type":"string","minLength":1},"minTickInterval":{"type":"number","default":0},"tickPixelInterval":{"type":"number","default":0},"visibleRange":{"$ref":"#/definitions/range"},"equidistant":{"type":"boolean","default":true},"marginBars":{"type":"number","minimum":0,"default":0},"zoom":{"type":"number","default":0},"resizeHandles":{"type":"boolean","default":false},"forceTicksVisible":{"type":"boolean"},"panning":{"type":"boolean"}}}]},"annotationTraits":{"$ref":"#/definitions/annTraits"},"curveTraits":{"type":"array","items":{"$ref":"#/definitions/curveTrait"}}}},"curveZone":{"type":"object","additionalProperties":false,"properties":{"value":{"type":"number"},"colors":{"type":"number"},"gradient":{"type":"string","enum":["linLighten","linDarken"]}}},"curveNonStrict":{"type":"object","additionalProperties":false,"properties":{"attributes":{"type":"array","items":{"$ref":"#/definitions/curveAttr"}},"colors":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/color"}},"fields":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curveField"}},"style":{"$ref":"#/definitions/curveStyle","default":"Line"},"lineWidth":{"type":"number","default":2},"varyColorPerBar":{"type":"boolean","default":false},"visible":{"type":"boolean","default":true},"zones":{"type":"array","items":{"$ref":"#/definitions/curveZone"}},"shift":{"type":"integer"}}},"curve":{"allOf":[{"$ref":"#/definitions/curveNonStrict"}],"required":["colors","fields"]},"plotEventDividends":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#037c27"},"title":{"type":"string","default":"D"}},"required":["show"]},"plotEventEarnings":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#08a0c9"},"title":{"type":"string","default":"E"}},"required":["show"]},"plotEventSplits":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false},"color":{"$ref":"#/definitions/color","default":"#de7726"},"title":{"type":"string","default":"S"}},"required":["show"]},"plotEventCustom":{"type":"object","additionalProperties":false,"properties":{"show":{"type":"boolean","default":false}},"required":["show"]},"plotEvents":{"type":"object","additionalProperties":false,"properties":{"dividends":{"$ref":"#/definitions/plotEventDividends"},"earnings":{"$ref":"#/definitions/plotEventEarnings"},"splits":{"$ref":"#/definitions/plotEventSplits"},"custom":{"$ref":"#/definitions/plotEventCustom"},"placement":{"$ref":"#/definitions/plotPlacement","default":"WithSeries"}}},"fundamentalFrequency":{"type":"string","enum":["Quarter","Year"]},"numberInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"number"}}},"stringInput":{"additionalProperties":false,"properties":{"name":{"type":"string"},"value":{"type":"string"}}},"input":{"type":"object","oneOf":[{"$ref":"#/definitions/numberInput"},{"$ref":"#/definitions/stringInput"}]},"inputs":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/input"}},"curves":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/curve"}},"symbolType":{"type":"string","pattern":"Symbol"},"symbolPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"symbol":{"type":"string"},"events":{"$ref":"#/definitions/plotEvents"},"showPrevious":{"type":"boolean","default":false},"type":{"$ref":"#/definitions/symbolType"},"main":{"type":"boolean","default":false},"inputs":{"$ref":"#/definitions/inputs"}},"required":["curves","symbol","type"]},"fundamentalType":{"type":"string","enum":["BalanceSheet","IncomeStatement"]},"fundamentalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"symbol":{"type":"string"},"fundamental":{"$ref":"#/definitions/fundamentalFrequency","default":"Quarter"},"type":{"$ref":"#/definitions/fundamentalType"}},"required":["curves","symbol","type"]},"studyLevels":{"type":"array","items":{"$ref":"#/definitions/studyLevel"}},"studyLevel":{"type":"object","additionalProperties":false,"properties":{"value":{"type":"number"},"line":{"$ref":"#/definitions/lineTrait"},"name":{"type":"string"}},"required":["value","line"]},"studyBands":{"type":"array","items":{"$ref":"#/definitions/studyBand"}},"studyBand":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"#/definitions/range"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["range","fill"]},"studyType":{"type":"string","pattern":"Study"},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"type":"string","default":"$main"},"study":{"$ref":"#/definitions/study"},"source":{"$ref":"#/definitions/curveField"},"inputs":{"$ref":"#/definitions/inputs"},"type":{"$ref":"#/definitions/studyType"},"levels":{"$ref":"#/definitions/studyLevels"},"bands":{"$ref":"#/definitions/studyBands"},"detachedScale":{"$ref":"#/definitions/detachedScale"}},"required":["study","type"]},"exprType":{"type":"string","pattern":"Expression"},"exprPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"expression":{"type":"string"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false}},"required":["expression","type"]},"forwardType":{"type":"string","pattern":"Forward"},"intOffset":{"type":"integer","minimum":0,"multipleOf":1},"intOffsets":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/intOffset"}},"forwardPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"forward":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"}},"required":["forward","type"]},"annualType":{"type":"string","pattern":"Annual"},"annualPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"colors":["#00b04b"],"fields":["Close","Change"],"style":"Line","lineWidth":2,"visible":true,"varyColorPerBar":false},{"colors":["#8b6038"],"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"varyColorPerBar":false}]},"annual":{"type":"string"},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/annualType"}},"required":["annual","type"]},"seasonalType":{"type":"string","pattern":"Seasonal"},"seasonalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"seasonal":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"}},"required":["seasonal","type"]},"annPoint":{"type":"object","additionalProperties":false,"properties":{"price":{"type":"number"},"time":{"type":"number"}},"required":["price","time"]},"lineTrait":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number","minimum":0,"default":1},"color":{"$ref":"#/definitions/color","default":"#000"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"fillTrait":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"#/definitions/color"}}},"markerTrait":{"type":"object","additionalProperties":false,"properties":{"vertex":{"enum":["start","end","both","none"]},"kind":{"enum":["arrow"],"default":"arrow"}},"required":["vertex"]},"curveTrait":{"type":"object","additionalProperties":false,"properties":{"curveStyle":{"$ref":"#/definitions/curveStyle"},"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["curveStyle"]},"annTraits":{"type":"object","additionalProperties":true,"properties":{"line":{"$ref":"#/definitions/lineTrait"},"fill":{"$ref":"#/definitions/fillTrait"},"marker":{"$ref":"#/definitions/markerTrait"},"zIndex":{"type":"number","minimum":1}}},"annotation":{"type":"object","additionalProperties":false,"properties":{"id":{"$ref":"#/definitions/annId"},"visible":{"type":"boolean","default":true},"points":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/annPoint"}},"traits":{"$ref":"#/definitions/annTraits"}},"required":["id","points"]},"plot":{"type":"object","oneOf":[{"$ref":"#/definitions/annualPlot"},{"$ref":"#/definitions/seasonalPlot"},{"$ref":"#/definitions/forwardPlot"},{"$ref":"#/definitions/exprPlot"},{"$ref":"#/definitions/symbolPlot"},{"$ref":"#/definitions/fundamentalPlot"},{"$ref":"#/definitions/studyPlot"}]},"annCacheEntry":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"},"annotations":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/annotation"}}},"required":["symbol","annotations"]},"axis":{"type":"object","additionalProperties":false,"properties":{"comparison":{"$ref":"#/definitions/comparison","default":"None"},"plots":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/plot"}},"annotations":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/annotation"}},"scale":{"$ref":"#/definitions/scale","default":"Linear"},"annCache":{"type":"array","minItems":0,"items":{"$ref":"#/definitions/annCacheEntry"}}},"required":["plots"]},"pane":{"type":"object","additionalProperties":false,"properties":{"axes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/axis"}},"height":{"$ref":"#/definitions/paneHeight","default":1}},"required":["axes"]}},"type":"object","additionalProperties":false,"properties":{"data":{"$ref":"#/definitions/data"},"display":{"$ref":"#/definitions/display"},"panes":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/pane"}},"version":{"type":"integer","minimum":34,"multipleOf":1}},"required":["panes","version"]}')},function(t){t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart studies for HTML5 Charts","definitions":{"studyMetadata":{"type":"object","additionalProperties":false,"properties":{"title":{"type":"string"},"caption":{"type":"string"},"overlay":{"type":"boolean","default":true},"decimals":{"type":"number"},"shiftable":{"type":"boolean"},"range":{"type":"object","additionalProperties":false,"properties":{"min":{"type":"number"},"max":{"type":"number"}}},"enumerations":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/enumeration"}}},"required":["title","caption"]},"enumeration":{"type":"object","additionalProperties":false,"properties":{"input":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}}},"studyDefaults":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"chart.schema.json#/definitions/curves"},"source":{"$ref":"chart.schema.json#/definitions/curveField"},"inputs":{"$ref":"chart.schema.json#/definitions/inputs"},"levels":{"$ref":"chart.schema.json#/definitions/studyLevels"},"bands":{"$ref":"chart.schema.json#/definitions/studyBands"}},"required":["curves"]},"studyDefinition":{"type":"object","additionalProperties":false,"properties":{"id":{"$ref":"chart.schema.json#/definitions/study"},"meta":{"$ref":"#/definitions/studyMetadata"},"defaults":{"$ref":"#/definitions/studyDefaults"}},"required":["id","meta","defaults"]}},"type":"array","minItems":1,"items":{"$ref":"#/definitions/studyDefinition"}}')},function(t){t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart fields for HTML5 Charts","definitions":{"valueType":{"type":"string","enum":["Number","String","Date"],"default":"Number"},"fieldCategory":{"type":"string","enum":["Common","Study","BalanceSheet","IncomeStatement","Event"],"default":"Common"},"fieldFormat":{"type":"string","enum":["FromMetaData","AsInteger","UseMetricUnit","AsPercent"],"default":"FromMetaData"},"fieldDefinition":{"type":"object","additionalProperties":false,"properties":{"id":{"anyOf":[{"$ref":"chart.schema.json#/definitions/curveField"},{"$ref":"chart.schema.json#/definitions/eventField"}]},"type":{"$ref":"#/definitions/valueType"},"category":{"$ref":"#/definitions/fieldCategory"},"name":{"type":"string","default":null},"shortName":{"type":"string","default":null},"format":{"$ref":"#/definitions/fieldFormat"}},"required":["id"]}},"type":"array","minItems":1,"items":{"$ref":"#/definitions/fieldDefinition"}}')},function(t){t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema","title":"JSON schema for the Barchart API of the HTML5 Charts","definitions":{"curvesNonStrict":{"type":"array","maxItems":1,"items":{"$ref":"chart.schema.json#/definitions/curveNonStrict"}},"mainPlotSymbolContext":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"}},"required":["symbol"]},"mainPlotExpressionContext":{"type":"object","additionalProperties":false,"properties":{"expression":{"type":"string"}},"required":["expression"]},"mainPlotForwardContext":{"type":"object","additionalProperties":false,"properties":{"forward":{"type":"string"}},"required":["forward"]},"mainPlotSeasonalContext":{"type":"object","additionalProperties":false,"properties":{"seasonal":{"type":"string"}},"required":["seasonal"]},"mainPlotAnnualContext":{"type":"object","additionalProperties":false,"properties":{"annual":{"type":"string"}},"required":["annual"]},"mainPlotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MainPlot"},"context":{"oneOf":[{"$ref":"#/definitions/mainPlotSymbolContext"},{"$ref":"#/definitions/mainPlotExpressionContext"},{"$ref":"#/definitions/mainPlotForwardContext"},{"$ref":"#/definitions/mainPlotSeasonalContext"},{"$ref":"#/definitions/mainPlotAnnualContext"}]}},"required":["id","context"]},"aggregationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Aggregation"},"context":{"$ref":"chart.schema.json#/definitions/aggregation"}},"required":["id","context"]},"periodContext":{"type":"object","additionalProperties":false,"properties":{"period":{"$ref":"chart.schema.json#/definitions/period"}},"required":["period"]},"rangeContext":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"chart.schema.json#/definitions/range"}},"required":["range"]},"densityContext":{"type":"object","additionalProperties":false,"properties":{"density":{"$ref":"chart.schema.json#/definitions/density"}},"required":["density"]},"periodAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Period"},"context":{"oneOf":[{"$ref":"#/definitions/periodContext"},{"$ref":"#/definitions/rangeContext"},{"$ref":"#/definitions/densityContext"}]}},"required":["id","context"]},"crosshairProperties":{"type":"object","additionalProperties":false,"properties":{"color":{"$ref":"chart.schema.json#/definitions/color"},"dashStyle":{"$ref":"chart.schema.json#/definitions/dashStyle"}},"required":["color"]},"crosshairAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Crosshair"},"context":{"type":"object","additionalProperties":false,"properties":{"crosshair":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"horizontal":{"$ref":"#/definitions/crosshairProperties"},"vertical":{"$ref":"#/definitions/crosshairProperties"}},"required":["crosshair"]}},"required":["id","context"]},"tooltipAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Tooltip"},"context":{"type":"object","additionalProperties":false,"properties":{"visible":{"type":"boolean"},"mode":{"type":"string","enum":["standard","cards","external"]}},"required":["visible"]}},"required":["id","context"]},"eventsAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Events"},"context":{"type":"object","additionalProperties":false,"properties":{"dividends":{"type":"boolean"},"earnings":{"type":"boolean"},"splits":{"type":"boolean"},"custom":{"type":"boolean"}}}},"required":["id","context"]},"axisPadding":{"type":"number","minimum":0.001,"maximum":1},"scaleAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Scale"},"context":{"type":"object","additionalProperties":false,"properties":{"scale":{"type":"string","enum":["Linear","Logarithmic"]},"marginBars":{"type":"number","minimum":0},"minPadding":{"$ref":"#/definitions/axisPadding"},"maxPadding":{"$ref":"#/definitions/axisPadding"},"preventLabelOverlap":{"type":"boolean"},"snapAnnotationsToPrices":{"type":"boolean"}}}},"required":["id","context"]},"otherAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Other"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"percentChange":{"type":"boolean"},"comparisonMode":{"type":"string","enum":["None","Percent","Value"]},"showLastValue":{"type":"string","enum":["None","All","Main"]},"gridLines":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"minorGridLines":{"$ref":"chart.schema.json#/definitions/orientationChoice"},"newPaneHeight":{"type":"number","minimum":0.01},"showNavigator":{"type":"boolean"},"plotHover":{"type":"boolean"}}}},"required":["id","context"]},"placement":{"type":"string","enum":["overlay","standalone","withMain","clone"]},"plotAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Plot"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Add","Get","Delete","Update"]},"type":{"type":"string","enum":["Symbol","Study","IncomeStatement","BalanceSheet","Expression","Forward","Seasonal","Annual"]},"main":{"type":"boolean"},"index":{"$ref":"chart.schema.json#/definitions/intOffset"},"studyId":{"$ref":"chart.schema.json#/definitions/study"},"fundamentalId":{"$ref":"chart.schema.json#/definitions/fundamental"},"expression":{"type":"string"},"forward":{"type":"string"},"seasonal":{"type":"string"},"annual":{"type":"string"},"frequency":{"$ref":"chart.schema.json#/definitions/fundamentalFrequency","default":"Quarter"},"inputs":{"$ref":"chart.schema.json#/definitions/inputs"},"curves":{"$ref":"#/definitions/curvesNonStrict"},"levels":{"$ref":"chart.schema.json#/definitions/studyLevels"},"bands":{"$ref":"chart.schema.json#/definitions/studyBands"},"placement":{"$ref":"#/definitions/placement"},"cloneIndex":{"$ref":"chart.schema.json#/definitions/intOffset"},"offsets":{"$ref":"chart.schema.json#/definitions/intOffsets"}},"required":["id"]}},"required":["id","context"]},"curveOptional":{},"compareSymbol":{"type":"object","additionalProperties":false,"properties":{"symbol":{"type":"string"},"leftScale":{"type":"boolean","default":false},"curves":{"$ref":"#/definitions/curvesNonStrict"}},"required":["symbol"]},"compareAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Compare"},"context":{"type":"object","additionalProperties":false,"properties":{"symbols":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/compareSymbol"}}}}},"required":["id","context"]},"annotationAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Annotation"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Delete","Update","Duplicate","List"]},"uid":{"type":"string","default":""},"visible":{"type":"boolean"},"traits":{"$ref":"chart.schema.json#/definitions/annTraits"},"extras":{"type":"object","additionalProperties":true},"points":{"type":"array","items":{"$ref":"chart.schema.json#/definitions/annPoint"}}},"required":["id"]}},"required":["id","context"]},"movePaneAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"MovePane"},"context":{"type":"object","additionalProperties":false,"properties":{"from":{"$ref":"chart.schema.json#/definitions/intOffset"},"to":{"$ref":"chart.schema.json#/definitions/intOffset"}},"required":["from","to"]}},"required":["id","context"]},"templateAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Template"},"context":{"type":"object","additionalProperties":false,"properties":{"strip":{"type":"object","additionalProperties":false,"properties":{"main":{"type":"boolean","default":true},"annotations":{"type":"boolean","default":false},"compare":{"type":"boolean","default":false}}}},"required":["strip"]}},"required":["id","context"]},"outlineAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Outline"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Get"}},"required":["id"]}},"required":["id","context"]},"themeAccessor":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","pattern":"Theme"},"context":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","enum":["Get","Update"],"default":"Update"},"backgroundColor":{"$ref":"chart.schema.json#/definitions/color"},"axis":{"type":"object","additionalProperties":false,"properties":{"gridLinesColor":{"$ref":"chart.schema.json#/definitions/color"},"gridLinesStyle":{"$ref":"chart.schema.json#/definitions/dashStyle"},"textColor":{"$ref":"chart.schema.json#/definitions/color"},"crosshairColor":{"$ref":"chart.schema.json#/definitions/color"}}},"fontSize":{"type":"object","additionalProperties":false,"properties":{"chart":{"type":"number"},"xAxis":{"type":"number"},"yAxis":{"type":"number"}}}}}}}},"type":"object","oneOf":[{"$ref":"#/definitions/mainPlotAccessor"},{"$ref":"#/definitions/aggregationAccessor"},{"$ref":"#/definitions/periodAccessor"},{"$ref":"#/definitions/crosshairAccessor"},{"$ref":"#/definitions/tooltipAccessor"},{"$ref":"#/definitions/eventsAccessor"},{"$ref":"#/definitions/scaleAccessor"},{"$ref":"#/definitions/otherAccessor"},{"$ref":"#/definitions/plotAccessor"},{"$ref":"#/definitions/compareAccessor"},{"$ref":"#/definitions/annotationAccessor"},{"$ref":"#/definitions/movePaneAccessor"},{"$ref":"#/definitions/templateAccessor"},{"$ref":"#/definitions/outlineAccessor"},{"$ref":"#/definitions/themeAccessor"}]}')},function(t){t.exports=JSON.parse('[{"id":"MA","meta":{"title":"Moving Average","caption":"Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#808080"],"fields":["MA"]}]}},{"id":"CSHO","meta":{"title":"Cash Overlay","caption":"Cash Overlay","overlay":true},"defaults":{"source":"Symbol","curves":[{"colors":["#834c3f"],"fields":["CSHO"]}]}},{"id":"CSHB","meta":{"title":"Cash Basis","caption":"Cash Basis","overlay":false},"defaults":{"source":"Symbol","curves":[{"colors":["#b2b900"],"fields":["CSHB"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","caption":"Volume Moving Average","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#9075d6"],"fields":["VOLMA"]},{"attributes":["ChangeBased"],"colors":["#ef4226","#00b04b","#1f4bb6"],"fields":["Volume"],"style":"Column","varyColorPerBar":true}]}},{"id":"OSCI","meta":{"title":"Oscillator","caption":"Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","caption":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","caption":"Moving Average Envelope","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVU"]},{"colors":["#25329b"],"fields":["ENVD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVU","ENVD"],"style":"Ribbon","lineWidth":0}]}},{"id":"LINRCHN","meta":{"title":"Linear Regression Channel","caption":"Linear Regression Channel","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","caption":"Moving Average Envelope Exponential","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVEXPU"]},{"colors":["#25329b"],"fields":["ENVEXPD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVEXPU","ENVEXPD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVSMO","meta":{"title":"Moving Average Envelope Smoothed","caption":"Moving Average Envelope Smoothed","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVSMOU"]},{"colors":["#25329b"],"fields":["ENVSMOD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVSMOU","ENVSMOD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAEXP","meta":{"title":"Moving Average Exponential","caption":"Moving Average Exponential","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#ae272d"],"fields":["EMA"]}]}},{"id":"MASMO","meta":{"title":"Moving Average Smoothed","caption":"Moving Average Smoothed","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":9}],"curves":[{"colors":["#743800"],"fields":["SMA"]}]}},{"id":"MATRI","meta":{"title":"Moving Average Triangular","caption":"Moving Average Triangular","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#888"],"fields":["TMA"]}]}},{"id":"MAWEI","meta":{"title":"Moving Average Weighted","caption":"Moving Average Weighted","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Offset","value":0}],"curves":[{"colors":["#bc41ce"],"fields":["WMA"]}]}},{"id":"MAHLC","meta":{"title":"Moving Average High/Low","caption":"Moving Average High/Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":8}],"curves":[{"colors":["#00b04b"],"fields":["MAHI"]},{"colors":["#ef4226"],"fields":["MALO"]}]}},{"id":"MACD","meta":{"title":"MACD Oscillator","caption":"MACD Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["MACD"]},{"colors":["#9326ff"],"fields":["MACDS"]},{"colors":["#711","#0aa"],"fields":["MACDH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"MACDEXP","meta":{"title":"MACD Oscillator Exponential","caption":"MACD Oscillator Exponential","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["MACD"]},{"colors":["#bc41ce"],"fields":["MACDS"]},{"colors":["#711","#0aa"],"fields":["MACDH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"VOL","meta":{"title":"Volume","caption":"Volume","overlay":false},"defaults":{"curves":[{"attributes":["ChangeBased"],"colors":["#ef4226","#00b04b","#1f4bb6"],"fields":["Volume"],"style":"Column","varyColorPerBar":true},{"colors":["#bb45cc"],"fields":["OpenInterest"]}]}},{"id":"OPINT","meta":{"title":"Open Interest","caption":"Open Interest","overlay":false},"defaults":{"curves":[{"colors":["#bb45cc"],"fields":["OpenInterest"]}]}},{"id":"RSI","meta":{"title":"Relative Strength Index","caption":"Relative Strength Index","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSI"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSIMOD","meta":{"title":"Relative Strength Index Modified","caption":"Relative Strength Index Modified","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["RSI"],"zones":[{"value":30,"colors":1},{"value":70,"colors":2},{"colors":1}]}],"levels":[{"value":30,"name":"Oversold","line":{"color":"#444"}},{"value":50,"line":{"color":"#444","dashStyle":"DashDot"}},{"value":70,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"RSISTO","meta":{"title":"Stochastic RSI","caption":"Stochastic RSI","overlay":false,"decimals":2,"range":{"min":0,"max":1}},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14},{"name":"Range","value":20}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#00b04b","rgba(12, 50, 255, 0.3)"],"fields":["STORSI"],"zones":[{"value":0.2,"colors":1},{"value":0.8,"colors":2},{"colors":1}]}],"levels":[{"value":0.2,"name":"Oversold","line":{"color":"#444"}},{"value":0.5,"line":{"color":"#444","dashStyle":"DashDot"}},{"value":0.8,"name":"Overbought","line":{"color":"#444"}}]}},{"id":"HHLL","meta":{"title":"Highest High Lowest Low","caption":"Highest High Lowest Low","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":10}],"curves":[{"colors":["#00b04b"],"fields":["HH"]},{"colors":["#ef4226"],"fields":["LL"]}]}},{"id":"WGCL","meta":{"title":"Weighted Close","caption":"Weighted Close","overlay":true},"defaults":{"curves":[{"colors":["#f18900"],"fields":["WGCL"]}]}},{"id":"WPERCR","meta":{"title":"Percent R","caption":"Percent R","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#ff6e00"],"fields":["PercR"]}],"levels":[{"value":-80,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":-20,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(152, 21, 255, 0.1)"},"range":{"from":-80,"to":-20}}]}},{"id":"STOCHF","meta":{"title":"Stochastic, Fast","caption":"Stochastic, Fast","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"Period1","value":14},{"name":"Period2","value":3},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#f18900"],"fields":["PercK"]},{"colors":["#00b04b"],"fields":["PercD"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"STOCHS","meta":{"title":"Stochastic, Slow","caption":"Stochastic, Slow","overlay":false,"decimals":2,"range":{"min":0,"max":100},"enumerations":[{"input":"Smoothing","values":["MA","EMA","SMA"]}]},"defaults":{"inputs":[{"name":"Period1","value":14},{"name":"Period2","value":3},{"name":"Period3","value":3},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#808080"],"fields":["PercK"]},{"colors":["#f18900"],"fields":["PercD"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":80,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"BBANDS","meta":{"title":"Bollinger Bands","caption":"Bollinger Bands","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Offset","value":0}],"curves":[{"colors":["#9075d6"],"fields":["BOLLBU"]},{"colors":["#89211e"],"fields":["BOLLBM"]},{"colors":["#00aaab"],"fields":["BOLLBL"]},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["BOLLBU","BOLLBL"],"style":"Ribbon","lineWidth":0}]}},{"id":"BWIDTH","meta":{"title":"Bollinger Width","caption":"Bollinger Width","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLBW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","caption":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLBP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","caption":"On Balance Volume","overlay":false},"defaults":{"curves":[{"colors":["#2284dd"],"fields":["OBVOL"]}]}},{"id":"ATR","meta":{"title":"Average True Range","caption":"Average True Range","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"id":"ADJATR","meta":{"title":"Average True Range Adjusted","caption":"Average True Range Adjusted","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Smoothing","value":"MA"}],"curves":[{"colors":["#ffaf1c"],"fields":["ADJATR"]}]}},{"id":"COTR","meta":{"title":"Change over True Range","caption":"Change over True Range","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]},{"input":"TypeOfATR","values":["ATR","ADJATR"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"SMA"},{"name":"TypeOfATR","value":"ATR"}],"curves":[{"colors":["#ffaf1c"],"fields":["COTR"]}]}},{"id":"ADX","meta":{"title":"Average Directional Index","caption":"Average Directional Index","overlay":false},"defaults":{"inputs":[{"name":"AdxSmoothing","value":14},{"name":"DiLength","value":14}],"curves":[{"colors":["#bc41ce"],"fields":["MDI"]},{"colors":["#ffaf1c"],"fields":["PDI"]},{"colors":["#00aaab"],"fields":["ADX"]}]}},{"id":"ADXMOD","meta":{"title":"Average Directional Index Modified","caption":"Average Directional Index Modified","overlay":false},"defaults":{"inputs":[{"name":"AdxSmoothing","value":14},{"name":"DiLength","value":14}],"curves":[{"colors":["#25329b"],"fields":["MDI"]},{"colors":["#ffaf1c"],"fields":["PDI"]},{"colors":["#9326ff"],"fields":["ADXM"]}]}},{"id":"ADL","meta":{"title":"Chaikin Accumulation Distribution","caption":"Chaikin Accumulation Distribution","overlay":false},"defaults":{"curves":[{"colors":["#f18900"],"fields":["ADL"]}]}},{"id":"ADWM","meta":{"title":"Accumulation/Distribution Williams","caption":"Accumulation/Distribution Williams","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#f18900"],"fields":["ADWM"]},{"colors":["#00aaab"],"fields":["ADWMMA"]}]}},{"id":"CHAOSC","meta":{"title":"Chaikin Oscillator","caption":"Chaikin Oscillator","overlay":false},"defaults":{"curves":[{"colors":["#2284dd"],"fields":["CHAOSC"]}]}},{"id":"TP","meta":{"title":"Typical Price","caption":"Typical Price","overlay":true},"defaults":{"curves":[{"colors":["#bc41ce"],"fields":["TP"]}]}},{"id":"KELCHN","meta":{"title":"Keltner Channel","caption":"Keltner Channel","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#f18900"],"fields":["KCUP"]},{"colors":["#2284dd"],"fields":["KCMID"]},{"colors":["#480048"],"fields":["KCLOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KCUP","KCLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"KELEXP","meta":{"title":"Keltner Channel Exponential","caption":"Keltner Channel Exponential","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#f18900"],"fields":["KCEUP"]},{"colors":["#2284dd"],"fields":["KCEMID"]},{"colors":["#480048"],"fields":["KCELOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KCEUP","KCELOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"KELBND","meta":{"title":"Keltner Bands","caption":"Keltner Bands","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Multiplier","value":2.5}],"curves":[{"colors":["#f18900"],"fields":["KBUP"]},{"colors":["#2284dd"],"fields":["KBMID"]},{"colors":["#480048"],"fields":["KBLOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KBUP","KBLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"DONCHN","meta":{"title":"Donchian Channel","caption":"Donchian Channel","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#00b04b"],"fields":["DONUP"]},{"colors":["#ff6a00"],"fields":["DONMID"]},{"colors":["#0c32ff"],"fields":["DONLOW"]},{"colors":["rgba(12, 50, 255, 0.1)"],"fields":["DONUP","DONLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"DONWIDTH","meta":{"title":"Donchian Width","caption":"Donchian Width","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#480048"],"fields":["DONW"]}]}},{"id":"PVT","meta":{"title":"Price Volume Trend","caption":"Price Volume Trend","overlay":false},"defaults":{"curves":[{"colors":["#ae272d"],"fields":["PVT"]}]}},{"id":"ROC","meta":{"title":"Rate Of Change","caption":"Rate Of Change","overlay":false,"decimals":2},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#2284dd"],"fields":["ROC"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"TRIX","meta":{"title":"Triple Exponential","caption":"Triple Exponential","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15}],"curves":[{"colors":["#743800"],"fields":["TRIX"]}]}},{"id":"DEMA","meta":{"title":"Moving Average Exponential 2X","caption":"Moving Average Exponential 2X","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential 3X","caption":"Moving Average Exponential 3X","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":15},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["TEMA"]}]}},{"id":"TSI","meta":{"title":"True Strength Index","caption":"True Strength Index","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":25},{"name":"Period2","value":13},{"name":"Period3","value":7}],"curves":[{"colors":["#3bb3e4"],"fields":["TSI"]},{"colors":["#ff006e"],"fields":["TSISIG"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"PPMOV","meta":{"title":"Pivot Points Bands","caption":"Pivot Points Bands","overlay":true},"defaults":{"curves":[{"colors":["#ffaf1c"],"fields":["PVPTR"]},{"colors":["#f18900"],"fields":["PVPT"]},{"colors":["#00aaab"],"fields":["PVPTS"]}]}},{"id":"ARNUPDW","meta":{"title":"Aroon Up/Down","caption":"Aroon Up/Down","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":25}],"curves":[{"colors":["#005716"],"fields":["ARNUP"]},{"colors":["#ae272d"],"fields":["ARNLOW"]}]}},{"id":"ARNOSC","meta":{"title":"Aroon Oscillator","caption":"Aroon Oscillator","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":25}],"curves":[{"colors":["#808080"],"fields":["ARNOSC"]}]}},{"id":"TCHN","meta":{"title":"Turtle Channel","caption":"Turtle Channel","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodUpper","value":14},{"name":"PeriodLower","value":14},{"name":"Range","value":"High/Low"}],"curves":[{"colors":["#005716"],"fields":["TCHNUP"]},{"colors":["#ae272d"],"fields":["TCHNLOW"]}]}},{"id":"TCHRE","meta":{"title":"Turtle Channel Retracement","caption":"Turtle Channel Retracement","overlay":true,"enumerations":[{"input":"Range","values":["High/Low","Close"]},{"input":"Retracement","values":["Long","Short"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Retracement","value":"Long"},{"name":"Adjustment","value":5},{"name":"Range","value":"High/Low"}],"curves":[{"colors":["#2799f6"],"fields":["TCHRE"]}]}},{"id":"ALLG","meta":{"title":"Alligator","caption":"Alligator","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":13},{"name":"Period2","value":8},{"name":"Period3","value":5}],"curves":[{"colors":["#25329b"],"fields":["ALJAW"],"shift":8},{"colors":["#7f8000"],"fields":["ALTEETH"],"shift":5},{"colors":["#9326ff"],"fields":["ALLIPS"],"shift":3}]}},{"id":"PLTLN","meta":{"title":"Plot Line","caption":"Plot Line","overlay":true},"defaults":{"inputs":[{"name":"Position","value":700}],"curves":[{"colors":["#808080"],"fields":["PLTLN"]}]}},{"id":"AWEOSC","meta":{"title":"Awesome Oscillator","caption":"Awesome Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":5},{"name":"Period2","value":34},{"name":"Period3","value":10}],"curves":[{"colors":["#711","#0aa"],"fields":["AWOS"],"style":"Column","varyColorPerBar":true},{"colors":["#ef4226"],"fields":["AWOSMA"]}]}},{"id":"CLV","meta":{"title":"Close Location Value","caption":"Close Location Value","overlay":false},"defaults":{"curves":[{"colors":["#00aaab"],"fields":["CLV"]}]}},{"id":"CHAMF","meta":{"title":"Chaikin Money Flow","caption":"Chaikin Money Flow","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#25329b"],"fields":["CHAMF"],"style":"Column"}]}},{"id":"CHAVOL","meta":{"title":"Chaikin Volatility","caption":"Chaikin Volatility","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":10}],"curves":[{"colors":["#808080"],"fields":["CHAVOL"]}]}},{"id":"DPO","meta":{"title":"Detrended Price Oscillator","caption":"Detrended Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#888"],"fields":["DPO"],"style":"Area"}]}},{"id":"MCGD","meta":{"title":"McGinley Dynamic","caption":"McGinley Dynamic","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#3bb3e4"],"fields":["MCGD"],"style":"Line"}]}},{"id":"HMA","meta":{"title":"Hull Moving Average","caption":"Hull Moving Average","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#674ea7"],"fields":["HMA"],"style":"Line"}]}},{"id":"COPP","meta":{"title":"Coppock Curve","caption":"Coppock Curve","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodWma","value":10},{"name":"PeriodRocLong","value":14},{"name":"PeriodRocShort","value":11}],"curves":[{"colors":["#2284dd"],"fields":["COPP"],"style":"Line"}]}},{"id":"CCI","meta":{"title":"Commodity Channel Index","caption":"Commodity Channel Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#7f8000"],"fields":["CCI"]}],"levels":[{"value":-100,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":100,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(127, 128, 0, 0.1)"},"range":{"from":-100,"to":100}}]}},{"id":"EMV","meta":{"title":"Ease Of Movement","caption":"Ease Of Movement","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#9326ff"],"fields":["EMV"]},{"colors":["#808080"],"fields":["EMVMA"]}]}},{"id":"ERBLPOW","meta":{"title":"Elder Ray Bull Power","caption":"Elder Ray Bull Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#005716"],"fields":["ERBLPOW"],"style":"Column"}]}},{"id":"ERBRPOW","meta":{"title":"Elder Ray Bear Power","caption":"Elder Ray Bear Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","caption":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["FI"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"MI","meta":{"title":"Mass Index","caption":"Mass Index","overlay":false},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["MI"]}]}},{"id":"MOM","meta":{"title":"Momentum","caption":"Momentum","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Movement","value":20}],"curves":[{"colors":["#808080"],"fields":["MOM"]},{"colors":["#505050"],"fields":["MOMMA"]}]}},{"id":"MFI","meta":{"title":"Money Flow Index","caption":"Money Flow Index","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#480048"],"fields":["MFI"]}]}},{"id":"MSD","meta":{"title":"Moving Standard Deviation","caption":"Moving Standard Deviation","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","caption":"Percent Change","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","caption":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","caption":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","caption":"Percentage Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["PPO"]},{"colors":["#bc41ce"],"fields":["PPOS"]},{"colors":["#2284dd"],"fields":["PPOH"],"style":"Column"}]}},{"id":"PVO","meta":{"title":"Percentage Volume Oscillator","caption":"Percentage Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["PVO"]},{"colors":["#bc41ce"],"fields":["PVOS"]},{"colors":["#9075d6"],"fields":["PVOH"],"style":"Column"}]}},{"id":"HV","meta":{"title":"Historical Volatility","caption":"Historical Volatility","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","caption":"Price Performance","overlay":false,"decimals":2},"defaults":{"source":"Close","curves":[{"colors":["#00aaab"],"fields":["PERF"]}]}},{"id":"WASI","meta":{"title":"Wilder Accumulative Swing Index","caption":"Wilder Accumulative Swing Index","overlay":false},"defaults":{"inputs":[{"name":"Limit","value":3}],"curves":[{"colors":["#bc41ce"],"fields":["WASI"]}]}},{"id":"WWVOL","meta":{"title":"Welles Wilder Volatility","caption":"Welles Wilder Volatility","overlay":true},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Constant","value":3}],"curves":[{"colors":["#9326ff"],"fields":["WWVSARD"],"style":"Dots"},{"colors":["#f18900"],"fields":["WWVSARU"],"style":"Dots"}]}},{"id":"PARTP","meta":{"title":"Parabolic Time/Price (SAR)","caption":"Parabolic Time/Price (SAR)","overlay":true},"defaults":{"inputs":[{"name":"Acceleration","value":50},{"name":"Limit","value":5}],"curves":[{"colors":["#25329b"],"fields":["PARSARS"],"style":"Dots"},{"colors":["#00aaab"],"fields":["PARSARL"],"style":"Dots"}]}},{"id":"REATRHI","meta":{"title":"Retracement ATR High","caption":"Retracement ATR High","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#25329b"],"fields":["REATRHI"],"style":"Dots"}]}},{"id":"REATRLO","meta":{"title":"Retracement ATR Low","caption":"Retracement ATR Low","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#b25900"],"fields":["REATRLO"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","caption":"Moving Linear Regression","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Offset","value":0}],"curves":[{"colors":["#480048"],"fields":["MOVLR"]}]}},{"id":"TRSP","meta":{"title":"TrendSpotter","caption":"TrendSpotter","overlay":true},"defaults":{"curves":[{"colors":["#24ad54"],"fields":["TRSP1"],"style":"Dots"},{"colors":["#ec4533"],"fields":["TRSP2"],"style":"Dots"}]}},{"id":"COTLC","meta":{"title":"Commitment of Traders","caption":"Commitment of Traders","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTLCCMSP"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTLCLGSP"],"style":"Step"},{"colors":["#403daf"],"fields":["COTLCSMSP"],"style":"Step"}]}},{"id":"COTDAG","meta":{"title":"Commitment of Traders Disaggregated","caption":"Commitment of Traders Disaggregated","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTDAGPRO"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTDAGSPD"],"style":"Step"},{"colors":["#403daf"],"fields":["COTDAGMNM"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTDAGOTH"],"style":"Step"}]}},{"id":"COTFTR","meta":{"title":"Commitment of Traders Financial","caption":"Commitment of Traders Financial","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTFTRDLI"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTFTRASM"],"style":"Step"},{"colors":["#403daf"],"fields":["COTFTRLVF"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTFTROTH"],"style":"Step"}]}},{"id":"PIVPTS","meta":{"title":"Pivot Points","caption":"Pivot Points","overlay":true,"enumerations":[{"input":"Previous","values":["Day","Week","Month"]}]},"defaults":{"inputs":[{"name":"Previous","value":"Day"}],"curves":[{"colors":["#79a2e3"],"fields":["PPTR3"]},{"colors":["#f08f4c"],"fields":["PPTR2"]},{"colors":["#492c6e"],"fields":["PPTR1"]},{"colors":["#28adcc"],"fields":["PPTPIV"]},{"colors":["#8f040a"],"fields":["PPTS1"]},{"colors":["#8cba32"],"fields":["PPTS2"]},{"colors":["#0e2339"],"fields":["PPTS3"]}]}},{"id":"CPP","meta":{"title":"Camarilla Pivot Points","caption":"Camarilla Pivot Points","overlay":true},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["CPPH4"]},{"colors":["#00b04b"],"fields":["CPPH3"]},{"colors":["#00b04b"],"fields":["CPPH2"]},{"colors":["#00b04b"],"fields":["CPPH1"]},{"colors":["#d47928"],"fields":["CPPL1"]},{"colors":["#d47928"],"fields":["CPPL2"]},{"colors":["#d47928"],"fields":["CPPL3"]},{"colors":["#d47928"],"fields":["CPPL4"]}]}},{"id":"IMPVOL","meta":{"title":"Implied Volatility (Futures)","caption":"Implied Volatility (Futures)","overlay":false},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"Cycle Trading Momentum","caption":"Cycle Trading Momentum","overlay":false,"decimals":2},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#00b04b"],"fields":["CTM"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]},{"colors":["#9326ff"],"fields":["CTLTM"]}]}},{"id":"GPMI","meta":{"title":"GBE Principal Momentum Indicator","caption":"GBE Principal Momentum Indicator","overlay":false},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#00b04b"],"fields":["GPMI"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}]}},{"id":"GTPI","meta":{"title":"GBE Turning Point Indicator","caption":"GBE Turning Point Indicator","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"curves":[{"colors":["#ef4226","#2642ef"],"fields":["GTPI"],"zones":[{"value":50,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}],"levels":[{"value":25,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":75,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"GMMA","meta":{"title":"Guppy Multiple Moving Average","caption":"Guppy MMA","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":3},{"name":"Period2","value":5},{"name":"Period3","value":8},{"name":"Period4","value":10},{"name":"Period5","value":12},{"name":"Period6","value":15},{"name":"Period7","value":30},{"name":"Period8","value":35},{"name":"Period9","value":40},{"name":"Period10","value":45},{"name":"Period11","value":50},{"name":"Period12","value":60}],"curves":[{"colors":["#008ae6"],"fields":["GMMA3"]},{"colors":["#008ae6"],"fields":["GMMA5"]},{"colors":["#008ae6"],"fields":["GMMA8"]},{"colors":["#008ae6"],"fields":["GMMA10"]},{"colors":["#008ae6"],"fields":["GMMA12"]},{"colors":["#008ae6"],"fields":["GMMA15"]},{"colors":["#b32400"],"fields":["GMMA30"]},{"colors":["#b32400"],"fields":["GMMA35"]},{"colors":["#b32400"],"fields":["GMMA40"]},{"colors":["#b32400"],"fields":["GMMA45"]},{"colors":["#b32400"],"fields":["GMMA50"]},{"colors":["#b32400"],"fields":["GMMA60"]}]}},{"id":"STOMOMIX","meta":{"title":"Stochastic Momentum Index","caption":"Stochastic Momentum Index","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":3}],"curves":[{"colors":["#3bb4e5"],"fields":["STOMOMIX"]}],"levels":[{"value":-40,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":40,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CHDMOMOSC","meta":{"title":"Chande Momentum Oscillator","caption":"Chande Momentum Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":9}],"curves":[{"colors":["#27c6da"],"fields":["CHDMOMOSC"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"VSTOP","meta":{"title":"Volatility Stop","caption":"Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Multiplier","value":2}],"curves":[{"colors":["#50cc52"],"fields":["VSTOPUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["VSTOPLOW"],"style":"Dots"}]}},{"id":"SUPTR","meta":{"title":"Supertrend","caption":"Supertrend","overlay":true},"defaults":{"inputs":[{"name":"Period","value":7},{"name":"Multiplier","value":3}],"curves":[{"colors":["#ff5252","#4cb050"],"fields":["SUPTR"],"style":"Line","varyColorPerBar":true}]}},{"id":"ICHCLD","meta":{"title":"Ichimoku Clouds","caption":"Ichimoku Clouds","overlay":true},"defaults":{"inputs":[{"name":"PeriodConversionLine","value":9},{"name":"PeriodBaseLine","value":26},{"name":"PeriodLaggingSpan2","value":52},{"name":"Displacement","value":26}],"curves":[{"colors":["#0080cd"],"fields":["CONVLN"],"style":"Line"},{"colors":["#cd0000"],"fields":["BASELN"],"style":"Line"},{"colors":["#009900"],"fields":["LAGGSP"],"style":"Line"},{"colors":["#00cd00"],"fields":["LEADSP1"],"style":"Line"},{"colors":["#ff0000"],"fields":["LEADSP2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["LEADSP1","LEADSP2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"VWAP","meta":{"title":"VWAP","caption":"VWAP","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","HLC/3","OHLC/4"]},{"input":"AnchorPeriod","values":["Session","Week","Month","Quarter","Year","Decade","Century"]}]},"defaults":{"inputs":[{"name":"Source","value":"HLC/3"},{"name":"AnchorPeriod","value":"Session"},{"name":"Stdev1stMultiplier","value":1},{"name":"Stdev2ndMultiplier","value":2},{"name":"Offset","value":0}],"curves":[{"colors":["#ee762f"],"fields":["VWAP"],"style":"Line"},{"colors":["#ffe44e"],"fields":["VWAPSD1U"],"style":"Line"},{"colors":["#ffe44e"],"fields":["VWAPSD1L"],"style":"Line"},{"colors":["#4aa34e"],"fields":["VWAPSD2U"],"style":"Line"},{"colors":["#4aa34e"],"fields":["VWAPSD2L"],"style":"Line"}]}},{"id":"MACDSIG","meta":{"title":"MA vs MA Buy/Sell Signal","caption":"MA vs MA Buy/Sell Signal","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":9},{"name":"Period2","value":18}],"curves":[{"colors":["#ae4ac7"],"fields":["MAS"]},{"colors":["#3479df"],"fields":["MAL"]}]}},{"id":"MASIG","meta":{"title":"Close vs MA Buy/Sell Signal","caption":"Close vs MA Buy/Sell Signal","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#ffb347"],"fields":["MA"]}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","caption":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#60b1df"],"fields":["PLVI"]},{"colors":["#ea336f"],"fields":["MNVI"]}]}},{"id":"DIFA","meta":{"title":"Distance From Average","caption":"Distance From Average","overlay":false,"decimals":2,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200},{"name":"Average","value":"MA"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["DIFA"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","caption":"Derivative Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14},{"name":"PeriodEma1","value":5},{"name":"PeriodEma2","value":3},{"name":"PeriodMa","value":9},{"name":"PeriodSig","value":9}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BSQUEEZE","meta":{"title":"Bollinger Bands Squeeze","caption":"Bollinger Bands Squeeze","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#3d8283"],"fields":["BOLLSQ"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","caption":"Moving Average Ribbon","overlay":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Period","value":20},{"name":"Increment","value":5},{"name":"Count","value":10}],"curves":[{"colors":["#c4291c"],"fields":["MA1"]},{"colors":["#ea3323"],"fields":["MA2"]},{"colors":["#ef8433"],"fields":["MA3"]},{"colors":["#f3cc46"],"fields":["MA4"]},{"colors":["#fffd55"],"fields":["MA5"]},{"colors":["#75f94c"],"fields":["MA6"]},{"colors":["#41904f"],"fields":["MA7"]},{"colors":["#86338b"],"fields":["MA8"]},{"colors":["#ea3df7"],"fields":["MA9"]},{"colors":["#2e72b8"],"fields":["MA10"]}]}},{"id":"HASMO","meta":{"title":"Heikin-Ashi Smoothed","caption":"Heikin-Ashi Smoothed","overlay":true,"enumerations":[{"input":"Smoothing1","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Smoothing2","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Smoothing1","value":"EMA"},{"name":"Period1","value":10},{"name":"Smoothing2","value":"EMA"},{"name":"Period2","value":10}],"curves":[{"colors":["#b63400","#007f3e","#1664db","#333","#777"],"fields":["Open","High","Low","Close","Change"],"style":"Candlestick","varyColorPerBar":true,"lineWidth":1}]}},{"id":"TTMSQZ","meta":{"title":"TTM Squeeze","caption":"TTM Squeeze","overlay":false},"defaults":{"inputs":[{"name":"PeriodBollinger","value":20},{"name":"WidthBollinger","value":2},{"name":"PeriodEmaKeltner","value":20},{"name":"MultiplierKeltner","value":1.5},{"name":"PeriodAtrKeltner","value":20},{"name":"PeriodMomentum","value":20}],"curves":[{"colors":["rgba(204,0,204,0.7)","rgba(255,155,255,0.7)","rgba(85,136,255,0.7)","rgba(153,204,255,0.7)"],"fields":["TTMSQZOSC"],"style":"Column","varyColorPerBar":true},{"colors":["#24ad54"],"fields":["TTMSQZOFF"],"style":"Dots","lineWidth":4},{"colors":["#ec4533"],"fields":["TTMSQZON"],"style":"Dots","lineWidth":4}]}}]')},function(t,e,i){t.exports=i(32)},function(t,e,i){"use strict";function n(t,e,i,s){this.message=t,this.expected=e,this.found=i,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,n)}!function(t,e){function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i}(n,Error),n.buildMessage=function(t,e){var i={literal:function(t){return'"'+s(t.text)+'"'},class:function(t){var e,i="";for(e=0;e<t.parts.length;e++)i+=t.parts[e]instanceof Array?r(t.parts[e][0])+"-"+r(t.parts[e][1]):r(t.parts[e]);return"["+(t.inverted?"^":"")+i+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function s(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function r(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}return"Expected "+function(t){var e,n,s,r=new Array(t.length);for(e=0;e<t.length;e++)r[e]=(s=t[e],i[s.type](s));if(r.sort(),r.length>0){for(e=1,n=1;e<r.length;e++)r[e-1]!==r[e]&&(r[n]=r[e],n++);r.length=n}switch(r.length){case 1:return r[0];case 2:return r[0]+" or "+r[1];default:return r.slice(0,-1).join(", ")+", or "+r[r.length-1]}}(t)+" but "+function(t){return t?'"'+s(t)+'"':"end of input"}(e)+" found."},t.exports={SyntaxError:n,parse:function(t,e){e=void 0!==e?e:{};var i,s={},r={expr:R},o=R,a=O("+",!1),l=O("-",!1),c=function(t,e){return function(t,e){return t.reduce((function(t,e){var i=e.filter(t=>"ws"!==t.op);return{op:i[0],left:t,right:i[1]}}),e)}(e,t)},u=O("*",!1),h=O("/",!1),d=O("^",!1),p=O("(",!1),f=O(")",!1),m=/^[0-9]/,g=D([["0","9"]],!1,!1),y=O(".",!1),v=O("{",!1),b=/^[A-Z0-9\^*$-.|:]/,T=D([["A","Z"],["0","9"],"^","*",["$","."],"|",":"],!1,!1),S=O("}",!1),A=/^[ \t\r\n]/,P=D([" ","\t","\r","\n"],!1,!1),w=0,C=0,x=[{line:1,column:1}],M=0,E=[];if("startRule"in e){if(!(e.startRule in r))throw new Error("Can't start parsing from rule \""+e.startRule+'".');o=r[e.startRule]}function O(t,e){return{type:"literal",text:t,ignoreCase:e}}function D(t,e,i){return{type:"class",parts:t,inverted:e,ignoreCase:i}}function L(e){var i,n=x[e];if(n)return n;for(i=e-1;!x[i];)i--;for(n={line:(n=x[i]).line,column:n.column};i<e;)10===t.charCodeAt(i)?(n.line++,n.column=1):n.column++,i++;return x[e]=n,n}function I(t,e){var i=L(t),n=L(e);return{start:{offset:t,line:i.line,column:i.column},end:{offset:e,line:n.line,column:n.column}}}function _(t){w<M||(w>M&&(M=w,E=[]),E.push(t))}function N(t,e,i){return new n(n.buildMessage(t,e),t,e,i)}function R(){return k()}function k(){var e,i,n,r,o,u,h;if(e=w,(i=H())!==s){if(n=[],r=w,(o=V())!==s?(43===t.charCodeAt(w)?(u="+",w++):(u=s,_(a)),u===s&&(45===t.charCodeAt(w)?(u="-",w++):(u=s,_(l))),u!==s&&(h=H())!==s?r=o=[o,u,h]:(w=r,r=s)):(w=r,r=s),r!==s)for(;r!==s;)n.push(r),r=w,(o=V())!==s?(43===t.charCodeAt(w)?(u="+",w++):(u=s,_(a)),u===s&&(45===t.charCodeAt(w)?(u="-",w++):(u=s,_(l))),u!==s&&(h=H())!==s?r=o=[o,u,h]:(w=r,r=s)):(w=r,r=s);else n=s;n!==s?(C=e,e=i=c(i,n)):(w=e,e=s)}else w=e,e=s;return e===s&&(e=H()),e}function H(){var e,i,n,r,o,a,l;if(e=w,(i=B())!==s){if(n=[],r=w,(o=V())!==s?(42===t.charCodeAt(w)?(a="*",w++):(a=s,_(u)),a===s&&(47===t.charCodeAt(w)?(a="/",w++):(a=s,_(h))),a!==s&&(l=B())!==s?r=o=[o,a,l]:(w=r,r=s)):(w=r,r=s),r!==s)for(;r!==s;)n.push(r),r=w,(o=V())!==s?(42===t.charCodeAt(w)?(a="*",w++):(a=s,_(u)),a===s&&(47===t.charCodeAt(w)?(a="/",w++):(a=s,_(h))),a!==s&&(l=B())!==s?r=o=[o,a,l]:(w=r,r=s)):(w=r,r=s);else n=s;n!==s?(C=e,e=i=c(i,n)):(w=e,e=s)}else w=e,e=s;return e===s&&(e=B()),e}function F(){var e,i,n,r;return e=w,(i=U())!==s&&V()!==s?(94===t.charCodeAt(w)?(n="^",w++):(n=s,_(d)),n!==s&&V()!==s&&(r=U())!==s?(C=e,e=i={op:"^",left:i,right:r}):(w=e,e=s)):(w=e,e=s),e===s&&(e=U()),e}function U(){var e,i,n,r;return(e=function(){var e,i,n,r,o,a,l,c;if(e=w,(i=V())!==s){if(n=w,r=[],m.test(t.charAt(w))?(o=t.charAt(w),w++):(o=s,_(g)),o!==s)for(;o!==s;)r.push(o),m.test(t.charAt(w))?(o=t.charAt(w),w++):(o=s,_(g));else r=s;if(r!==s){if(o=w,46===t.charCodeAt(w)?(a=".",w++):(a=s,_(y)),a===s&&(a=null),a!==s){for(l=[],m.test(t.charAt(w))?(c=t.charAt(w),w++):(c=s,_(g));c!==s;)l.push(c),m.test(t.charAt(w))?(c=t.charAt(w),w++):(c=s,_(g));l!==s?o=a=[a,l]:(w=o,o=s)}else w=o,o=s;o===s&&(o=null),o!==s?n=r=[r,o]:(w=n,n=s)}else w=n,n=s;n!==s?(C=e,i={op:"num",left:parseFloat(t.substring(C,w))},e=i):(w=e,e=s)}else w=e,e=s;return e}())===s&&(e=function(){var e,i,n,r,o;if(e=w,(i=V())!==s)if(123===t.charCodeAt(w)?(n="{",w++):(n=s,_(v)),n!==s){if(r=[],b.test(t.charAt(w))?(o=t.charAt(w),w++):(o=s,_(T)),o!==s)for(;o!==s;)r.push(o),b.test(t.charAt(w))?(o=t.charAt(w),w++):(o=s,_(T));else r=s;r!==s?(125===t.charCodeAt(w)?(o="}",w++):(o=s,_(S)),o!==s?(C=e,i={op:"sym",left:r.join("")},e=i):(w=e,e=s)):(w=e,e=s)}else w=e,e=s;else w=e,e=s;return e}())===s&&(e=w,V()!==s?(40===t.charCodeAt(w)?(i="(",w++):(i=s,_(p)),i!==s&&V()!==s&&(n=k())!==s&&V()!==s?(41===t.charCodeAt(w)?(r=")",w++):(r=s,_(f)),r!==s?(C=e,e={op:"grp",left:n}):(w=e,e=s)):(w=e,e=s)):(w=e,e=s)),e}function B(){var e,i,n;return e=w,V()!==s?(45===t.charCodeAt(w)?(i="-",w++):(i=s,_(l)),i!==s&&V()!==s&&(n=F())!==s?(C=e,e={op:i,left:n}):(w=e,e=s)):(w=e,e=s),e===s&&(e=F()),e}function V(){var e,i,n;for(e=w,i=[],A.test(t.charAt(w))?(n=t.charAt(w),w++):(n=s,_(P));n!==s;)i.push(n),A.test(t.charAt(w))?(n=t.charAt(w),w++):(n=s,_(P));return i!==s&&(C=e,i={op:"ws"}),e=i}if((i=o())!==s&&w===t.length)return i;throw i!==s&&w<t.length&&_({type:"end"}),N(E,M<t.length?t.charAt(M):null,M<t.length?I(M,M+1):I(M,M))}}},function(t,e,i){t.exports=i(33)},function(t){t.exports=JSON.parse('[{"id":"DateTime","type":"Date"},{"id":"Open"},{"id":"High"},{"id":"Low"},{"id":"Close"},{"id":"TradeSize","format":"AsInteger"},{"id":"Volume","format":"UseMetricUnit","shortName":"VOL"},{"id":"OpenInterest","format":"UseMetricUnit","shortName":"OI"},{"id":"Last"},{"id":"Symbol","type":"String"},{"id":"Change"},{"id":"PercentChange","format":"AsPercent"},{"id":"PreviousClose"},{"id":"PreviousOpen"},{"id":"PreviousHigh"},{"id":"PreviousLow"},{"id":"WeekPreviousClose"},{"id":"WeekPreviousHigh"},{"id":"WeekPreviousLow"},{"id":"MonthPreviousClose"},{"id":"MonthPreviousHigh"},{"id":"MonthPreviousLow"},{"id":"Projection","name":"Projection"},{"id":"BarIndex","name":"Bar Index"},{"id":"Dividends","type":"String","category":"Event","name":"Dividend","shortName":"D"},{"id":"Splits","type":"String","category":"Event","name":"Split","shortName":"S"},{"id":"Earnings","type":"String","category":"Event","shortName":"E"},{"id":"Buy","category":"Event","name":"BuySignal","shortName":"B"},{"id":"Sell","category":"Event","name":"SellSignal","shortName":"S"},{"id":"Custom","category":"Event","name":"CustomEvent","shortName":"Z"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"STORSI","category":"Study","name":"StochRSI","shortName":"STOCHRSI"},{"id":"HH","category":"Study","name":"HighestHigh","shortName":"HHIGH"},{"id":"LL","category":"Study","name":"LowestLow","shortName":"LLOW"},{"id":"PercK","category":"Study","name":"%K","shortName":"PCNTK"},{"id":"PercD","category":"Study","name":"%D","shortName":"PCNTD"},{"id":"PercR","category":"Study","name":"%R","shortName":"PCNTR"},{"id":"WGCL","category":"Study","name":"WeightedClose","shortName":"WTCL"},{"id":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-Width","shortName":"BOLLW"},{"id":"BOLLBP","category":"Study","name":"Bollinger-Percent","shortName":"%B"},{"id":"BOLLSQ","category":"Study","name":"Bollinger-Squeeze","shortName":"BOLL(S)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"PDI","category":"Study","name":"+DI","shortName":"+DI"},{"id":"MDI","category":"Study","name":"-DI","shortName":"-DI"},{"id":"PLVI","category":"Study","name":"+VI","shortName":"+VI"},{"id":"MNVI","category":"Study","name":"-VI","shortName":"-VI"},{"id":"ADX","category":"Study","name":"ADX","shortName":"ADX"},{"id":"ADXM","category":"Study","name":"ADX-Modified","shortName":"ADXM"},{"id":"ADL","category":"Study","format":"UseMetricUnit","name":"AccDist","shortName":"ACCDIS"},{"id":"ADWM","category":"Study","name":"AccDistWill","shortName":"ACCDISWIL"},{"id":"ADWMMA","category":"Study","name":"AccDistWillMovAvg","shortName":"ACCDISWILMA"},{"id":"MCGD","category":"Study","name":"McGinleyDyn","shortName":"MCGD"},{"id":"HMA","category":"Study","name":"HullMovAvg","shortName":"HMA"},{"id":"COPP","category":"Study","name":"CoppCurve","shortName":"COPP"},{"id":"CHAOSC","category":"Study","format":"UseMetricUnit","name":"ChaikinOsc","shortName":"CHAIKOSC"},{"id":"TP","category":"Study","name":"TypicalPrice","shortName":"TP"},{"id":"KCUP","category":"Study","name":"KeltChan-Up","shortName":"KELT(UP)"},{"id":"KCMID","category":"Study","name":"KeltChan-Mid","shortName":"KELT(MID)"},{"id":"KCLOW","category":"Study","name":"KeltChan-Low","shortName":"KELT(LO)"},{"id":"KBUP","category":"Study","name":"KeltBands-Up","shortName":"KELB(UP)"},{"id":"KBMID","category":"Study","name":"KeltBands-Mid","shortName":"KELB(MID)"},{"id":"KBLOW","category":"Study","name":"KeltBands-Low","shortName":"KELB(LO)"},{"id":"KCEUP","category":"Study","name":"KeltChanExp-Up","shortName":"KELE(UP)"},{"id":"KCEMID","category":"Study","name":"KeltChanExp-Mid","shortName":"KELE(MID)"},{"id":"KCELOW","category":"Study","name":"KeltChanExp-Low","shortName":"KELE(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRHI","category":"Study","name":"RetraceATRHigh","shortName":"REATRHI"},{"id":"REATRLO","category":"Study","name":"RetraceATRLow","shortName":"REATRLO"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSpotter","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSpotter","shortName":"TREND"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"GPMI","category":"Study","name":"Principal Momentum","shortName":"GPMI"},{"id":"GTPI","category":"Study","name":"Turning Point","shortName":"GTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LagginSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"}]')},function(t,e,i){"use strict";(function(t){var i=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var i=-1;return t.some((function(t,n){return t[0]===e&&(i=n,!0)})),i}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var i=t(this.__entries__,e),n=this.__entries__[i];return n&&n[1]},e.prototype.set=function(e,i){var n=t(this.__entries__,e);~n?this.__entries__[n][1]=i:this.__entries__.push([e,i])},e.prototype.delete=function(e){var i=this.__entries__,n=t(i,e);~n&&i.splice(n,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var i=0,n=this.__entries__;i<n.length;i++){var s=n[i];t.call(e,s[1],s[0])}},e}()}(),n="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,s=void 0!==t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),r="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(s):function(t){return setTimeout((function(){return t(Date.now())}),1e3/60)};var o=["top","right","bottom","left","width","height","size","weight"],a="undefined"!=typeof MutationObserver,l=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var i=!1,n=!1,s=0;function o(){i&&(i=!1,t()),n&&l()}function a(){r(o)}function l(){var t=Date.now();if(i){if(t-s<2)return;n=!0}else i=!0,n=!1,setTimeout(a,e);s=t}return l}(this.refresh.bind(this),20)}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,i=e.indexOf(t);~i&&e.splice(i,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter((function(t){return t.gatherActive(),t.hasActive()}));return t.forEach((function(t){return t.broadcastActive()})),t.length>0},t.prototype.connect_=function(){n&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){n&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,i=void 0===e?"":e;o.some((function(t){return!!~i.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),c=function(t,e){for(var i=0,n=Object.keys(e);i<n.length;i++){var s=n[i];Object.defineProperty(t,s,{value:e[s],enumerable:!1,writable:!1,configurable:!0})}return t},u=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||s},h=y(0,0,0,0);function d(t){return parseFloat(t)||0}function p(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.reduce((function(e,i){return e+d(t["border-"+i+"-width"])}),0)}function f(t){var e=t.clientWidth,i=t.clientHeight;if(!e&&!i)return h;var n=u(t).getComputedStyle(t),s=function(t){for(var e={},i=0,n=["top","right","bottom","left"];i<n.length;i++){var s=n[i],r=t["padding-"+s];e[s]=d(r)}return e}(n),r=s.left+s.right,o=s.top+s.bottom,a=d(n.width),l=d(n.height);if("border-box"===n.boxSizing&&(Math.round(a+r)!==e&&(a-=p(n,"left","right")+r),Math.round(l+o)!==i&&(l-=p(n,"top","bottom")+o)),!function(t){return t===u(t).document.documentElement}(t)){var c=Math.round(a+r)-e,f=Math.round(l+o)-i;1!==Math.abs(c)&&(a-=c),1!==Math.abs(f)&&(l-=f)}return y(s.left,s.top,a,l)}var m="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof u(t).SVGGraphicsElement}:function(t){return t instanceof u(t).SVGElement&&"function"==typeof t.getBBox};function g(t){return n?m(t)?function(t){var e=t.getBBox();return y(0,0,e.width,e.height)}(t):f(t):h}function y(t,e,i,n){return{x:t,y:e,width:i,height:n}}var v=function(){function t(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=y(0,0,0,0),this.target=t}return t.prototype.isActive=function(){var t=g(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},t}(),b=function(t,e){var i,n,s,r,o,a,l,u=(n=(i=e).x,s=i.y,r=i.width,o=i.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),c(l,{x:n,y:s,width:r,height:o,top:s,right:n+r,bottom:o+s,left:n}),l);c(this,{target:t,contentRect:u})},T=function(){function t(t,e,n){if(this.activeObservations_=[],this.observations_=new i,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof u(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new v(t)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof u(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach((function(e){e.isActive()&&t.activeObservations_.push(e)}))},t.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map((function(t){return new b(t.target,t.broadcastRect())}));this.callback_.call(t,e,t),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),S="undefined"!=typeof WeakMap?new WeakMap:new i,A=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=l.getInstance(),n=new T(e,i,this);S.set(this,n)};["observe","unobserve","disconnect"].forEach((function(t){A.prototype[t]=function(){var e;return(e=S.get(this))[t].apply(e,arguments)}}));var P=void 0!==s.ResizeObserver?s.ResizeObserver:A;e.a=P}).call(this,i(43))},function(t){t.exports=JSON.parse('{"major":2,"minor":106,"patch":1,"prerelease":false}')},,function(t,e,i){const n=i(11),s=i(3);t.exports=(()=>{"use strict";const t={camel:{}};return t.camel.violations=/\b[A-Z]/g,{startCase:t=>t.split(" ").reduce((t,e)=>(0!==e.length&&t.push(e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()),t),[]).join(" "),camelCase:e=>(n.argumentIsRequired(e,"s",String),e.replace(t.camel.violations,t=>t.toLocaleLowerCase())),truncate:(t,e)=>s.string(t)&&t.length>e?t.substring(0,e)+" ...":t,padLeft(t,e,i){if(n.argumentIsRequired(t,"s",String),n.argumentIsRequired(e,"length",Number),n.argumentIsRequired(i,"character",String),1!==i.length)throw new Error('The "character" argument must be one character in length.');return i.repeat(e-t.length)+t},format:(t,...e)=>(n.argumentIsRequired(t,"s",String),t.replace(/{(\d+)}/g,(t,i)=>{let n;if(i<e.length){const r=e[i];n=s.undefined(r)||s.null(r)?t:r.toString()}else n=t;return n}))}})()},function(t,e,i){const n=i(12);t.exports=(()=>{"use strict";class t extends n{constructor(t,e,i,n,s,r,o,a){super(t,t),this._baseCode=e,this._decimalDigits=i,this._supportsFractions=n,n?(this._fractionFactor=s,this._fractionDigits=r,this._fractionFactorSpecial=o||s,this._fractionDigitsSpecial=a||r):(this._fractionFactor=void 0,this._fractionDigits=void 0,this._fractionFactorSpecial=void 0,this._fractionDigitsSpecial=void 0)}get baseCode(){return this._baseCode}get unitCode(){return this._code}get decimalDigits(){return this._decimalDigits}get supportsFractions(){return this._supportsFractions}get fractionFactor(){return this._fractionFactor}get fractionDigits(){return this._fractionDigits}get fractionFactorSpecial(){return this._fractionFactorSpecial}get fractionDigitsSpecial(){return this._fractionDigitsSpecial}getFractionFactor(t){return!0===t?this._fractionFactorSpecial:this._fractionFactor}getFractionDigits(t){return!0===t?this._fractionDigitsSpecial:this._fractionDigits}toString(){return`[UnitCode (code=${this.code})]`}static parse(e){return n.fromCode(t,e)}static fromBaseCode(e){return n.getItems(t).find(t=>t.baseCode===e)||null}}new t("2",-1,3,!0,8,1),new t("3",-2,4,!0,16,2),new t("4",-3,5,!0,32,2),new t("5",-4,6,!0,64,2,320,3),new t("6",-5,7,!0,128,3,320,3),new t("7",-6,8,!0,256,3,320,3),new t("8",0,0,!1),new t("9",1,1,!1),new t("A",2,2,!1),new t("B",3,3,!1),new t("C",4,4,!1),new t("D",5,5,!1),new t("E",6,6,!1),new t("F",7,7,!1);return t})()},function(t,e,i){const n=i(8);t.exports=(()=>{"use strict";return function(t,e,i,s){return(r,o)=>n(r,o,t,e,i,s)}})()},function(t,e,i){"use strict";var n;!function(){var s=1,r=2,o=3,a=4,l=5,c=6,u=7,h=8,d=9,p=10,f=11,m=function(){var t,e,i,n,m=1,g=2,y=3,v=4,b=5,T=6,S=7,A='Unexpected token "%0"',P="Unexpected end of path";function w(){for(var t,e=C();N("|");)V(),(t||(t=[e])).push(C());return t?{type:h,args:t}:e}function C(){return N("(")?x():E()}function x(){F("(");var t=w();F(")");for(var e,i=[];e=M();)i.push(e);return i.length?t.type===s?(t.parts=t.parts.concat(i),t):(i.unshift(t),{type:s,parts:i}):t}function M(){return N("[")?function(){F("[");var t=function(){if(N(":"))return V(),{type:p,toIdx:_()};var t=_();if(N(":"))return V(),N("]")?{type:p,fromIdx:t}:{type:p,fromIdx:t,toIdx:_()};return{type:p,idx:t}}();return F("]"),{type:a,arg:t}}():N("{")?function(){F("{");var t=O();return F("}"),{type:o,arg:t}}():N("(")?x():void 0}function E(){R()||z(V());var t,e=!1;N("^")?(V(),e=!0):H()&&(t=V().val.substr(1));for(var i,n=[];i=k()?function(){var t,e=V().val,i=U();(N("*")||i.type===m||i.type===y)&&(t=V().val);return{type:r,selector:e,prop:t}}():M();)n.push(i);return{type:s,fromRoot:e,subst:t,parts:n}}function O(){for(var t,e=D();N("||");)V(),(t||(t=[e])).push(D());return t?{type:l,op:"||",args:t}:e}function D(){for(var t,e=L();N("&&");)V(),(t||(t=[e])).push(L());return t?{type:l,op:"&&",args:t}:e}function L(){for(var t=function t(){var e=function(){var t=I();for(;N("+")||N("-");)t={type:u,op:V().val,args:[t,I()]};return t}();for(;N("<")||N(">")||N("<=")||N(">=");)e={type:c,op:V().val,args:[e,t()]};return e}();N("==")||N("!=")||N("===")||N("!==")||N("^==")||N("==^")||N("^=")||N("=^")||N("$==")||N("==$")||N("$=")||N("=$")||N("*==")||N("==*")||N("*=")||N("=*");)t={type:c,op:V().val,args:[t,L()]};return t}function I(){for(var t=_();N("*")||N("/")||N("%");)t={type:u,op:V().val,args:[t,I()]};return t}function _(){return N("!")||N("-")?{type:d,op:V().val,arg:_()}:function(){var t=U().type;if(t===y||t===g||t===v||t===b)return{type:f,val:V().val};if(R())return E();if(N("("))return function(){F("(");var t=O();return F(")"),t}();return z(V())}()}function N(t){var e=U();return e.type===T&&e.val===t}function R(){return k()||H()||N("^")}function k(){var t=U();if(t.type===T){var e=t.val;return"."===e||".."===e}return!1}function H(){var t=U();return t.type===m&&"$"===t.val[0]}function F(t){var e=V();e.type===T&&e.val===t||z(e)}function U(){if(null!==i)return i;var t=e;return i=B(),e=t,i}function B(){for(;i=t[e]," \r\n\t".indexOf(i)>-1;)++e;var i;if(e>=n)return{type:S,range:[e,e]};var s=function(){var i=e,n=t[e],s=t[e+1];if("."===n){if(W(s))return;return"."===t[++e]?{type:T,val:"..",range:[i,++e]}:{type:T,val:".",range:[i,e]}}if("="===s){var r=t[e+2];if("="===r){if("=!^$*".indexOf(n)>=0)return{type:T,val:n+s+r,range:[i,e+=3]}}else if("^$*".indexOf(r)>=0){if("="===n)return{type:T,val:n+s+r,range:[i,e+=3]}}else if("=!^$*><".indexOf(n)>=0)return{type:T,val:n+s,range:[i,e+=2]}}else if("="===n&&"^$*".indexOf(s)>=0)return{type:T,val:n+s,range:[i,e+=2]};if(n===s&&("|"===n||"&"===n))return{type:T,val:n+s,range:[i,e+=2]};if(":{}()[]^+-*/%!><|".indexOf(n)>=0)return{type:T,val:n,range:[i,++e]}}();if(s||(s=function(){var i=t[e];if(!j(i))return;var s=e,r=i;for(;++e<n&&G(i=t[e]);)r+=i;switch(r){case"true":case"false":return{type:v,val:"true"===r,range:[s,e]};case"null":return{type:b,val:null,range:[s,e]};default:return{type:m,val:r,range:[s,e]}}}())||(s=function(){if('"'!==t[e]&&"'"!==t[e])return;var i,s=t[e],r=++e,o="",a=!1;for(;e<n;){if("\\"===(i=t[e++]))i=t[e++];else if(('"'===i||"'"===i)&&i===s){a=!0;break}o+=i}if(a)return{type:y,val:o,range:[r,e]}}())||(s=function(){var i=e,s=t[e],r="."===s;if(r||W(s)){for(var o=s;++e<n;){if("."===(s=t[e])){if(r)return;r=!0}else if(!W(s))break;o+=s}return{type:g,val:r?parseFloat(o):parseInt(o,10),range:[i,e]}}}()))return s;s={range:[e,e]},e>=n?s.type=S:s.val=t[e],z(s)}function V(){var t;return i?(e=i.range[1],t=i,i=null,t):B()}function W(t){return"0123456789".indexOf(t)>=0}function j(t){return"$"===t||"@"===t||"_"===t||t>="a"&&t<="z"||t>="A"&&t<="Z"}function G(t){return j(t)||t>="0"&&t<="9"}function z(t){t.type===S&&Y(t,P),Y(t,A,t.val)}function Y(t,e){var i=Array.prototype.slice.call(arguments,2),n=e.replace(/%(\d)/g,(function(t,e){return i[e]||""})),s=new Error(n);throw s.column=t.range[0],s}return function(s){t=s.split(""),e=0,i=null,n=t.length;var r=w(),o=V();return o.type!==S&&z(o),r}}(),g=function(){var t,e,i,n;function p(){if(n.length)return n.shift();var t="v"+ ++i;return e.push(t),t}function m(){for(var t=arguments,e=t.length;e--;)n.push(t[e])}function g(e,i,n){if(e.prop){var s=P(e.prop),r=p(),o=p(),a=p(),l=p(),c=p(),u=p(),h=p();t.push(r,"= [];",o,"= 0;",a,"=",n,".length;",h,"= [];","while(",o,"<",a,") {",l,"=",n,"[",o,"++];","if(",l,"!= null) {"),"*"===e.prop?(t.push("if(typeof ",l,'=== "object") {',"if(isArr(",l,")) {",r,"=",r,".concat(",l,");","}","else {","for(",c," in ",l,") {","if(",l,".hasOwnProperty(",c,")) {",u,"=",l,"[",c,"];"),w(r,u),t.push("}","}","}","}")):(t.push(u,"=",l,"[",s,"];"),w(r,u,h,a)),t.push("}","}",i,"=",a,"> 1 &&",h,".length?",h,".length > 1?","concat.apply(",r,",",h,") :",r,".concat(",h,"[0]) :",r,";"),m(r,o,a,l,c,u,h)}}function y(e,i,n){var s=e.prop,r=p(),o=p(),a=p(),l=p(),c=p(),u=p(),h=p(),d=p();t.push(r,"=",n,".slice(),",d,"= [];","while(",r,".length) {",o,"=",r,".shift();"),s?t.push("if(typeof ",o,'=== "object" &&',o,") {"):t.push("if(typeof ",o,"!= null) {"),t.push(a,"= [];","if(isArr(",o,")) {",l,"= 0,",h,"=",o,".length;","while(",l,"<",h,") {",u,"=",o,"[",l,"++];"),s&&t.push("if(typeof ",u,'=== "object") {'),w(a,u),s&&t.push("}"),t.push("}","}","else {"),s?"*"!==s&&(t.push(u,"=",o,'["'+s+'"];'),w(d,u)):(w(d,o),t.push("if(typeof ",o,'=== "object") {')),t.push("for(",c," in ",o,") {","if(",o,".hasOwnProperty(",c,")) {",u,"=",o,"[",c,"];"),w(a,u),"*"===s&&w(d,u),t.push("}","}"),s||t.push("}"),t.push("}",a,".length &&",r,".unshift.apply(",r,",",a,");","}","}",i,"=",d,";"),m(r,o,a,l,c,u,h,d)}function v(e,i,n){var s=p(),r=p(),o=p(),a=p(),l=p();t.push(s,"= [];",r,"= 0;",o,"=",n,".length;","while(",r,"<",o,") {",l,"=",n,"[",r,"++];"),T(e.arg,a,l),t.push(x(e.arg,a),"&&",s,".push(",l,");","}",i,"=",s,";"),m(s,r,o,l,a)}function b(e,i,n){var s,r,o=e.arg;if(o.idx){var a=p();return T(o.idx,a,n),t.push(a,"< 0 && (",a,"=",n,".length +",a,");",i,"=",n,"[",a,"] == null? [] : [",n,"[",a,"]];"),m(a),!1}o.fromIdx?o.toIdx?(T(o.fromIdx,s=p(),n),T(o.toIdx,r=p(),n),t.push(i,"=",n,".slice(",s,",",r,");"),m(s,r)):(T(o.fromIdx,s=p(),n),t.push(i,"=",n,".slice(",s,");"),m(s)):(T(o.toIdx,r=p(),n),t.push(i,"=",n,".slice(0,",r,");"),m(r))}function T(e,i,n){switch(e.type){case s:!function(e,i,n){var s=e.parts,l=0,c=s.length;for(t.push(i,"=",e.fromRoot?"data":e.subst?"subst."+e.subst:n,";","isArr("+i+") || ("+i+" = ["+i+"]);");l<c;){var u=s[l++];switch(u.type){case r:".."===u.selector?y(u,i,i):g(u,i,i);break;case o:v(u,i,i);break;case a:b(u,i,i);break;case h:A(u,i,i)}}}(e,i,n);break;case h:A(e,i,n);break;case c:!function(e,i,n){var r=p(),o=p(),a=p(),l=p(),c=p(),u=p(),h=p(),d=p(),g=e.args[0],y=e.args[1];t.push(i,"= false;"),T(g,r,n),T(y,o,n);var v=g.type===s,b=y.type===f;t.push(a,"="),v?t.push("true;"):t.push("isArr(",r,");"),t.push(l,"="),b?t.push("false;"):t.push("isArr(",o,");"),t.push("if("),v||t.push(a,"&&"),t.push(r,".length === 1) {",r,"=",r,"[0];",a,"= false;","}"),b||t.push("if(",l,"&&",o,".length === 1) {",o,"=",o,"[0];",l,"= false;","}"),t.push(c,"= 0;","if(",a,") {",h,"=",r,".length;"),b||(t.push("if(",l,") {",d,"=",o,".length;","while(",c,"<",h,"&& !",i,") {",u,"= 0;","while(",u,"<",d,") {"),S(e.op,[r,"[",c,"]"].join(""),[o,"[",u,"]"].join("")),t.push(i,"= true;","break;","}","++",u,";","}","++",c,";","}","}","else {"));t.push("while(",c,"<",h,") {"),S(e.op,[r,"[",c,"]"].join(""),o),t.push(i,"= true;","break;","}","++",c,";","}"),b||t.push("}"),t.push("}"),b||(t.push("else if(",l,") {",d,"=",o,".length;","while(",c,"<",d,") {"),S(e.op,r,[o,"[",c,"]"].join("")),t.push(i,"= true;","break;","}","++",c,";","}","}"));t.push("else {",i,"=",N[e.op](r,o),";","}"),m(r,o,a,l,c,u,h,d)}(e,i,n);break;case u:!function(e,i,n){var s=p(),r=p(),o=e.args;T(o[0],s,n),T(o[1],r,n),t.push(i,"=",N[e.op](M(o[0],s),M(o[1],r)),";"),m(s,r)}(e,i,n);break;case l:!function(e,i,n){var s,r=[],o=e.args,a=o.length,l=0;switch(t.push(i,"= false;"),e.op){case"&&":for(;l<a;)r.push(s=p()),T(o[l],s,n),t.push("if(",x(o[l++],s),") {");t.push(i,"= true;");break;case"||":for(;l<a;)r.push(s=p()),T(o[l],s,n),t.push("if(",x(o[l],s),") {",i,"= true;","}"),1+l++<a&&t.push("else {");--a}for(;a--;)t.push("}");m.apply(null,r)}(e,i,n);break;case d:!function(e,i,n){var s=p(),r=e.arg;switch(T(r,s,n),e.op){case"!":t.push(i,"= !",x(r,s)+";");break;case"-":t.push(i,"= -",M(r,s)+";")}m(s)}(e,i,n);break;case f:t.push(i,"="),w=e.val,t.push("string"==typeof w?P(w):null===w?"null":w),t.push(";")}var w}function S(e,i,n){t.push("if(",N[e](i,n),") {")}function A(e,i,n){for(var s=[],r=e.args,o=r.length,a=0;a<o;)s.push(p()),T(r[a],s[a++],n);t.push(i,"= concat.call(",s.join(","),");"),m.apply(null,s)}function P(t){return"'"+t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"}function w(e,i,n,s){t.push("if(typeof ",i,'!== "undefined") {',"if(isArr(",i,")) {"),n&&(t.push(s,"> 1?"),C(n,i),t.push(":")),t.push(e,"=",e,".length?",e,".concat(",i,") :",i,".slice()",";","}","else {"),n&&t.push("if(",n,".length) {",e,"= concat.apply(",e,",",n,");",n,"= [];","}"),C(e,i),t.push(";","}","}")}function C(e,i){t.push(e,".length?",e,".push(",i,") :",e,"[0] =",i)}function x(t,e){switch(t.type){case l:return e;case f:return"!!"+e;case s:return e+".length > 0";default:return["(typeof ",e,'=== "boolean"?',e,":","isArr(",e,")?",e,".length > 0 : !!",e,")"].join("")}}function M(t,e){switch(t.type){case f:return e;case s:return e+"[0]";default:return["(isArr(",e,")?",e,"[0] : ",e,")"].join("")}}function E(t,e){return["typeof ",t,'=== "string" && typeof ',e,'=== "string" &&',t,".indexOf(",e,") === 0"].join("")}function O(t,e){return[t,"!= null &&",e,"!= null &&",t,".toString().toLowerCase().indexOf(",e,".toString().toLowerCase()) === 0"].join("")}function D(t,e){return["typeof ",t,'=== "string" && typeof ',e,'=== "string" &&',t,".length >=",e,".length &&",t,".lastIndexOf(",e,") ===",t,".length -",e,".length"].join("")}function L(t,e){return[t,"!= null &&",e,"!= null &&","(",t,"=",t,".toString()).length >=","(",e,"=",e,".toString()).length &&","(",t,".toLowerCase()).lastIndexOf(","(",e,".toLowerCase())) ===",t,".length -",e,".length"].join("")}function I(t,e){return["typeof ",t,'=== "string" && typeof ',e,'=== "string" &&',t,".indexOf(",e,") > -1"].join("")}function _(t,e){return[t,"!= null && ",e,"!= null &&",t,".toString().toLowerCase().indexOf(",e,".toString().toLowerCase()) > -1"].join("")}var N={"===":function(t,e){return t+"==="+e},"==":function(t,e){return["typeof ",t,'=== "string" && typeof ',e,'=== "string"?',t,".toLowerCase() ===",e,".toLowerCase() :"+t,"==",e].join("")},">=":function(t,e){return t+">="+e},">":function(t,e){return t+">"+e},"<=":function(t,e){return t+"<="+e},"<":function(t,e){return t+"<"+e},"!==":function(t,e){return t+"!=="+e},"!=":function(t,e){return t+"!="+e},"^==":E,"==^":function(t,e){return E(e,t)},"^=":O,"=^":function(t,e){return O(e,t)},"$==":D,"==$":function(t,e){return D(e,t)},"$=":L,"=$":function(t,e){return L(e,t)},"*==":I,"==*":function(t,e){return I(e,t)},"=*":function(t,e){return _(e,t)},"*=":_,"+":function(t,e){return t+"+"+e},"-":function(t,e){return t+"-"+e},"*":function(t,e){return t+"*"+e},"/":function(t,e){return t+"/"+e},"%":function(t,e){return t+"%"+e}};return function(r){if(t=[],e=["res"],i=0,n=[],T(r,"res","data"),t.unshift("var ",Array.isArray?"isArr = Array.isArray":'toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }',", concat = Array.prototype.concat",",",e.join(","),";"),r.type===s){var o=r.parts[r.parts.length-1];o&&o.type===a&&"idx"in o.arg&&t.push("res = res[0];")}return t.push("return res;"),t.join("")}}();function y(t){return Function("data,subst",g(m(t)))}var v={},b=[],T={cacheSize:100},S={cacheSize:function(t,e){if(e<t&&b.length>e)for(var i=b.splice(0,b.length-e),n=i.length;n--;)delete v[i[n]]}},A=function(t,e,i){return v[t]||(v[t]=y(t),b.push(t)>T.cacheSize&&delete v[b.shift()]),v[t](e,i||{})};A.version="0.3.4",A.params=function(t){if(!arguments.length)return T;for(var e in t)t.hasOwnProperty(e)&&(S[e]&&S[e](T[e],t[e]),T[e]=t[e])},A.compile=y,A.apply=A,"object"==typeof t.exports?t.exports=A:"object"==typeof modules?modules.define("jspath",(function(t){t(A)})):void 0===(n=function(t,e,i){i.exports=A}.call(e,i,e,t))||(t.exports=n)}()},function(t,e,i){var n;(function(){var s=function(t){if(null===t||"object"!=typeof t)return t;var e;if(t instanceof Date)return(e=new Date).setTime(t.getTime()),e;if(t instanceof RegExp)return e=new RegExp(t);if(t instanceof Array){e=[];for(var i=0,n=t.length;i<n;i++)e[i]=s(t[i]);return e}if(t instanceof Object){for(var r in e={},t)t.hasOwnProperty(r)&&(e[r]=s(t[r]));return e}throw new Error("Unable to clone object!")},r=function(t){for(var e=[s(t[0])],i=e[0].key,n=e[0].object,r=1,o=t.length;r<o;r++)n=n[i],i=t[r].key,e.push({object:n,key:i});return e},o=function(t,e){var i=t.length-1,n=t[i].key;e[i].object[n]=t[i].object[n]},a={type:!0,not:!0,anyOf:!0,allOf:!0,oneOf:!0,$ref:!0,$schema:!0,id:!0,exclusiveMaximum:!0,exclusiveMininum:!0,properties:!0,patternProperties:!0,additionalProperties:!0,items:!0,additionalItems:!0,required:!0,default:!0,title:!0,description:!0,definitions:!0,dependencies:!0},l={null:function(t){return null===t},string:function(t){return"string"==typeof t},boolean:function(t){return"boolean"==typeof t},number:function(t){return"number"==typeof t&&t==t},integer:function(t){return"number"==typeof t&&t%1==0},object:function(t){return t&&"object"==typeof t&&!Array.isArray(t)},array:function(t){return Array.isArray(t)},date:function(t){return t instanceof Date}},c={alpha:function(t){return/^[a-zA-Z]+$/.test(t)},alphanumeric:function(t){return/^[a-zA-Z0-9]+$/.test(t)},identifier:function(t){return/^[-_a-zA-Z0-9]+$/.test(t)},hexadecimal:function(t){return/^[a-fA-F0-9]+$/.test(t)},numeric:function(t){return/^[0-9]+$/.test(t)},"date-time":function(t){return!isNaN(Date.parse(t))&&-1===t.indexOf("/")},uppercase:function(t){return t===t.toUpperCase()},lowercase:function(t){return t===t.toLowerCase()},hostname:function(t){return t.length<256&&/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/.test(t)},uri:function(t){return/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/.test(t)},email:function(t){return/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/.test(t)},ipv4:function(t){if(/^(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)$/.test(t)&&t.split(".").sort()[3]<=255)return!0;return!1},ipv6:function(t){return/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/.test(t)}},u={readOnly:function(t,e){return!1},minimum:function(t,e,i){return!(t<e||i.exclusiveMinimum&&t<=e)},maximum:function(t,e,i){return!(t>e||i.exclusiveMaximum&&t>=e)},multipleOf:function(t,e){return t/e%1==0||"number"!=typeof t},pattern:function(t,e){return"string"!=typeof t||("string"==typeof e?i=e:(i=e[0],n=e[1]),new RegExp(i,n).test(t));var i,n},minLength:function(t,e){return t.length>=e||"string"!=typeof t},maxLength:function(t,e){return t.length<=e||"string"!=typeof t},minItems:function(t,e){return t.length>=e||!Array.isArray(t)},maxItems:function(t,e){return t.length<=e||!Array.isArray(t)},uniqueItems:function(t,e){for(var i,n={},s=0,r=t.length;s<r;s++){if(i=JSON.stringify(t[s]),n.hasOwnProperty(i))return!1;n[i]=!0}return!0},minProperties:function(t,e){if("object"!=typeof t)return!0;var i=0;for(var n in t)t.hasOwnProperty(n)&&(i+=1);return i>=e},maxProperties:function(t,e){if("object"!=typeof t)return!0;var i=0;for(var n in t)t.hasOwnProperty(n)&&(i+=1);return i<=e},constant:function(t,e){return JSON.stringify(t)==JSON.stringify(e)},enum:function(t,e){var i,n,s;if("object"==typeof t){for(s=JSON.stringify(t),i=0,n=e.length;i<n;i++)if(s===JSON.stringify(e[i]))return!0}else for(i=0,n=e.length;i<n;i++)if(t===e[i])return!0;return!1}},h=function(t){return-1===t.indexOf("://")?t:t.split("#")[0]},d=function(t,e,i){var n,s,r,o;if(-1===(r=i.indexOf("#")))return t.schema.hasOwnProperty(i)?[t.schema[i]]:null;if(r>0)if(o=i.substr(0,r),i=i.substr(r+1),t.schema.hasOwnProperty(o))e=[t.schema[o]];else{if(!e||e[0].id!==o)return null;e=[e[0]]}else{if(!e)return null;i=i.substr(1)}if(""===i)return[e[0]];if("/"===i.charAt(0)){for(i=i.substr(1),n=e[0],s=i.split("/");s.length>0;){if(!n.hasOwnProperty(s[0]))return null;n=n[s[0]],e.push(n),s.shift()}return e}return null},p=function(t,e){var i,n,s,r,o=t.length-1,a=/^(\d+)/.exec(e);if(a){if(e=e.substr(a[0].length),(s=parseInt(a[1],10))<0||s>o)return;if(r=t[o-s],"#"===e)return r.key}else r=t[0];if(n=r.object[r.key],""===e)return n;if("/"===e.charAt(0)){for(i=(e=e.substr(1)).split("/");i.length>0;){if(i[0]=i[0].replace(/~1/g,"/").replace(/~0/g,"~"),!n.hasOwnProperty(i[0]))return;n=n[i[0]],i.shift()}return n}},f=function(t,e,i,n){var s,l,c,u,h,m,g,y,v,b,T,S,A,P=!1,w={},C=e[e.length-1],x=i.length-1,M=i[x].object,E=i[x].key,O=M[E];if(C.hasOwnProperty("$ref"))return(e=d(t,e,C.$ref))?f(t,e,i,n):{$ref:C.$ref};if(C.hasOwnProperty("type"))if("string"==typeof C.type){if(n.useCoerce&&t.coerceType.hasOwnProperty(C.type)&&(O=M[E]=t.coerceType[C.type](O)),!t.fieldType[C.type](O))return{type:C.type}}else{for(P=!0,s=0,l=C.type.length;s<l&&P;s++)t.fieldType[C.type[s]](O)&&(P=!1);if(P)return{type:C.type}}if(C.hasOwnProperty("allOf"))for(s=0,l=C.allOf.length;s<l;s++)if(y=f(t,e.concat(C.allOf[s]),i,n))return y;if(n.useCoerce||n.useDefault||n.removeAdditional){if(C.hasOwnProperty("oneOf")){for(A=1/0,s=0,l=C.oneOf.length,c=0;s<l;s++)if(T=r(i),y=f(t,e.concat(C.oneOf[s]),T,n))(S=y.schema?Object.keys(y.schema).length:1)<A&&(A=S,w=y);else{if((c+=1)>1)break;o(T,i)}if(c>1)return{oneOf:!0};if(c<1)return w;w={}}if(C.hasOwnProperty("anyOf")){for(w=null,A=1/0,s=0,l=C.anyOf.length;s<l;s++){if(T=r(i),!(y=f(t,e.concat(C.anyOf[s]),T,n))){o(T,i),w=null;break}(S=y.schema?Object.keys(y.schema).length:1)<A&&(A=S,w=y)}if(w)return w}if(C.hasOwnProperty("not")&&(T=r(i),!(y=f(t,e.concat(C.not),T,n))))return{not:!0}}else{if(C.hasOwnProperty("oneOf")){for(A=1/0,s=0,l=C.oneOf.length,c=0;s<l;s++)if(y=f(t,e.concat(C.oneOf[s]),i,n))(S=y.schema?Object.keys(y.schema).length:1)<A&&(A=S,w=y);else if((c+=1)>1)break;if(c>1)return{oneOf:!0};if(c<1)return w;w={}}if(C.hasOwnProperty("anyOf")){for(w=null,A=1/0,s=0,l=C.anyOf.length;s<l;s++){if(!(y=f(t,e.concat(C.anyOf[s]),i,n))){w=null;break}(S=y.schema?Object.keys(y.schema).length:1)<A&&(A=S,w=y)}if(w)return w}if(C.hasOwnProperty("not")&&!(y=f(t,e.concat(C.not),i,n)))return{not:!0}}if(C.hasOwnProperty("dependencies"))for(m in C.dependencies)if(C.dependencies.hasOwnProperty(m)&&O.hasOwnProperty(m))if(Array.isArray(C.dependencies[m])){for(s=0,l=C.dependencies[m].length;s<l;s++)if(!O.hasOwnProperty(C.dependencies[m][s]))return{dependencies:!0}}else if(y=f(t,e.concat(C.dependencies[m]),i,n))return y;if(Array.isArray(O)){if(C.hasOwnProperty("items"))if(Array.isArray(C.items)){for(s=0,l=C.items.length;s<l;s++)null!==(y=f(t,e.concat(C.items[s]),i.concat({object:O,key:s}),n))&&(w[s]=y,P=!0);if(O.length>l&&C.hasOwnProperty("additionalItems"))if("boolean"==typeof C.additionalItems){if(!C.additionalItems)return{additionalItems:!0}}else for(s=l,l=O.length;s<l;s++)null!==(y=f(t,e.concat(C.additionalItems),i.concat({object:O,key:s}),n))&&(w[s]=y,P=!0)}else for(s=0,l=O.length;s<l;s++)null!==(y=f(t,e.concat(C.items),i.concat({object:O,key:s}),n))&&(w[s]=y,P=!0);else if(C.hasOwnProperty("additionalItems")&&"boolean"!=typeof C.additionalItems)for(s=0,l=O.length;s<l;s++)null!==(y=f(t,e.concat(C.additionalItems),i.concat({object:O,key:s}),n))&&(w[s]=y,P=!0);if(P)return{schema:w}}else{for(m in v=[],w={},O)O.hasOwnProperty(m)&&v.push(m);if(n.checkRequired&&C.required)for(s=0,l=C.required.length;s<l;s++)O.hasOwnProperty(C.required[s])||(w[C.required[s]]={required:!0},P=!0);if(u=C.hasOwnProperty("properties"),h=C.hasOwnProperty("patternProperties"),u||h)for(s=v.length;s--;){if(b=!1,u&&C.properties.hasOwnProperty(v[s])&&(b=!0,null!==(y=f(t,e.concat(C.properties[v[s]]),i.concat({object:O,key:v[s]}),n))&&(w[v[s]]=y,P=!0)),h)for(m in C.patternProperties)C.patternProperties.hasOwnProperty(m)&&v[s].match(m)&&(b=!0,null!==(y=f(t,e.concat(C.patternProperties[m]),i.concat({object:O,key:v[s]}),n))&&(w[v[s]]=y,P=!0));b&&v.splice(s,1)}if(n.useDefault&&u&&!P)for(m in C.properties)C.properties.hasOwnProperty(m)&&!O.hasOwnProperty(m)&&C.properties[m].hasOwnProperty("default")&&(O[m]=C.properties[m].default);if(n.removeAdditional&&u&&!0!==C.additionalProperties&&"object"!=typeof C.additionalProperties)for(s=0,l=v.length;s<l;s++)delete O[v[s]];else if(C.hasOwnProperty("additionalProperties"))if("boolean"==typeof C.additionalProperties){if(!C.additionalProperties)for(s=0,l=v.length;s<l;s++)w[v[s]]={additional:!0},P=!0}else for(s=0,l=v.length;s<l;s++)null!==(y=f(t,e.concat(C.additionalProperties),i.concat({object:O,key:v[s]}),n))&&(w[v[s]]=y,P=!0);if(P)return{schema:w}}for(g in C)C.hasOwnProperty(g)&&!a.hasOwnProperty(g)&&("format"===g?t.fieldFormat.hasOwnProperty(C[g])&&!t.fieldFormat[C[g]](O,C,i,n)&&(w[g]=!0,P=!0):t.fieldValidate.hasOwnProperty(g)&&!t.fieldValidate[g](O,C[g].hasOwnProperty("$data")?p(i,C[g].$data):C[g],C,i,n)&&(w[g]=!0,P=!0));return P?w:null},m={useDefault:!1,useCoerce:!1,checkRequired:!0,removeAdditional:!1};function g(){if(!(this instanceof g))return new g;this.coerceType={},this.fieldType=s(l),this.fieldValidate=s(u),this.fieldFormat=s(c),this.defaultOptions=s(m),this.schema={}}g.prototype={validate:function(t,e,i){var n=[t],s=null,r=[{object:{__root__:e},key:"__root__"}];if("string"==typeof t&&!(n=d(this,null,t)))throw new Error("jjv: could not find schema '"+t+"'.");if(i)for(var o in this.defaultOptions)this.defaultOptions.hasOwnProperty(o)&&!i.hasOwnProperty(o)&&(i[o]=this.defaultOptions[o]);else i=this.defaultOptions;return(s=f(this,n,r,i))?{validation:s.hasOwnProperty("schema")?s.schema:s}:null},resolveRef:function(t,e){return d(this,t,e)},addType:function(t,e){this.fieldType[t]=e},addTypeCoercion:function(t,e){this.coerceType[t]=e},addCheck:function(t,e){this.fieldValidate[t]=e},addFormat:function(t,e){this.fieldFormat[t]=e},addSchema:function(t,e){if(!e&&t&&(e=t,t=void 0),e.hasOwnProperty("id")&&"string"==typeof e.id&&e.id!==t){if("/"===e.id.charAt(0))throw new Error("jjv: schema id's starting with / are invalid.");this.schema[h(e.id)]=e}else if(!t)throw new Error("jjv: schema needs either a name or id attribute.");t&&(this.schema[h(t)]=e)}},void 0!==t.exports?t.exports=g:void 0===(n=function(){return g}.call(e,i,e,t))||(t.exports=n)}).call(this)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){"use strict";var n=i(7),s=i(37),r=i(41),o=i(42)||0;function a(){return s(o)}t.exports=a,t.exports.generate=a,t.exports.seed=function(e){return n.seed(e),t.exports},t.exports.worker=function(e){return o=e,t.exports},t.exports.characters=function(t){return void 0!==t&&n.characters(t),n.shuffled()},t.exports.isValid=r},function(t,e,i){"use strict";var n=1;t.exports={nextValue:function(){return(n=(9301*n+49297)%233280)/233280},seed:function(t){n=t}}},function(t,e,i){"use strict";var n,s,r=i(38);i(7);t.exports=function(t){var e="",i=Math.floor(.001*(Date.now()-1567752802062));return i===s?n++:(n=0,s=i),e+=r(7),e+=r(t),n>0&&(e+=r(n)),e+=r(i)}},function(t,e,i){"use strict";var n=i(7),s=i(39),r=i(40);t.exports=function(t){for(var e,i=0,o="";!e;)o+=r(s,n.get(),1),e=t<Math.pow(16,i+1),i++;return o}},function(t,e,i){"use strict";var n,s="object"==typeof window&&(window.crypto||window.msCrypto);n=s&&s.getRandomValues?function(t){return s.getRandomValues(new Uint8Array(t))}:function(t){for(var e=[],i=0;i<t;i++)e.push(Math.floor(256*Math.random()));return e},t.exports=n},function(t,e){t.exports=function(t,e,i){for(var n=(2<<Math.log(e.length-1)/Math.LN2)-1,s=-~(1.6*n*i/e.length),r="";;)for(var o=t(s),a=s;a--;)if((r+=e[o[a]&n]||"").length===+i)return r}},function(t,e,i){"use strict";var n=i(7);t.exports=function(t){return!(!t||"string"!=typeof t||t.length<6)&&!new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(t)}},function(t,e,i){"use strict";t.exports=0},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";function n(...t){let e={};return t.forEach((t,i)=>{e[t]=i,e[i]=t}),e}i.r(e),i.d(e,"initFeed",(function(){return em})),i.d(e,"getFeed",(function(){return im})),i.d(e,"getChartOutline",(function(){return sm})),i.d(e,"BaseDataFeed",(function(){return rm})),i.d(e,"BarchartSiteDataFeed",(function(){return om})),i.d(e,"MiniWidgetDataFeed",(function(){return am})),i.d(e,"MarketDataFeed",(function(){return lm})),i.d(e,"parseExpression",(function(){return dn})),i.d(e,"evaluateExpression",(function(){return pn})),i.d(e,"ExpressionSeries",(function(){return dh})),i.d(e,"formatPriceWithDecimals",(function(){return pe})),i.d(e,"BaseRecordSource",(function(){return Fr})),i.d(e,"Field",(function(){return Bn})),i.d(e,"Fields",(function(){return Wn})),i.d(e,"TimeSeriesContainer",(function(){return Vr})),i.d(e,"TimeSeriesQuery",(function(){return jl})),i.d(e,"Aggregation",(function(){return Ji})),i.d(e,"asyncReady",(function(){return Qt})),i.d(e,"getTaxonomies",(function(){return Oi})),i.d(e,"getStudies",(function(){return Ci})),i.d(e,"getStudy",(function(){return xi})),i.d(e,"getStudyOptions",(function(){return nd})),i.d(e,"makeStudy",(function(){return Sh})),i.d(e,"Topics",(function(){return jn})),i.d(e,"PubSub",(function(){return ya.a})),i.d(e,"ChunkPart",(function(){return x})),i.d(e,"SeriesKind",(function(){return b})),i.d(e,"AggregationSpec",(function(){return h})),i.d(e,"AggregationUnit",(function(){return u}));n("1D","5D","1M","3M","6M","1Y","5Y","Max"),n("WithSeries","TimeAxis");const s=n("UsePrevious","UseNext","UseNone"),r=n("Minimum","Everything"),o=n("NoAction","IgnoreTimelineOnly","ModelTransformRequired"),a=n("Down","Up","Same"),l=n("ChangeBased","OpenVsClose"),c=n("OHLC","Line","Candlestick","Area","Column","Dots","HLC","HL","Ribbon","Step","HollowCandles","HeikinAshi","ElderImpulseSystem","Renko","LineBreak","Kagi","PointAndFigure"),u=n("Tick","Intraday","Day","Week","Month","Quarter","Year"),h=n("None","Nearest","Continue","FormT","PerCount","PerVolume","PerRange","PerSeconds"),d=(n("Png","Jpeg","Pdf","Svg"),n("Number","String","Date")),p=n("FromMetaData","AsInteger","UseMetricUnit","AsPercent"),f=n("Common","Study","BalanceSheet","IncomeStatement","Forward","Seasonal","Event"),m=n("Unknown","Equity","Future","Option","Currency","Index","Fund","Asset","Expression"),g=n("None","Value","Percent"),y=n("Linear","Logarithmic"),v=n("Symbol","Expression","Study","Forward","BalanceSheet","IncomeStatement","Seasonal","Annual"),b=n("Normal","Forward","HistoricalForward","Study","BalanceSheet","IncomeStatement","Events"),T=n("Left","Center","Right"),S=n("Arrow","Crosshair","Move","Hand","ResizeVertical","Grabbing"),A=n("NotApplicable","Left","Middle","Right"),P=n("Shift","Alt","Control","Meta"),w=n("None","Horizontal","Vertical","Both"),C=n("Unspecified","GBE","cmdtyView","DemoSite","InternalFeed"),x=n("Unspecified","Head","Tail"),M=n("wheel","wheel+shift","none"),E=n("Auto","Draggable"),O=n("Page","Application");function D(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(this,e.concat(Array.prototype.slice.call(arguments,0)))}}function L(...t){const e=t?t.length:0;return function(...i){let n=0,s=e?t[n].apply(this,i):i[0];for(;++n<e;)s=t[n].call(this,s);return s}}function I(t){return t}function _(t){return t.reduce((t,e)=>t+e,0)}function N(t){return _(t)/t.length}function R(t){return t.every(t=>null!==t)}function k(t,e){return Array.from(Array(e)).map((e,i)=>i+t)}function H(t,e){let i=[],n=[];return t.forEach(t=>{e(t)?i.push(t):n.push(t)}),{yes:i,no:n}}function F(t,e){if(!(t.length<1))for(let i=t.length-1;i>=0;--i)if(e(t[i]))return t[i]}function U(t,e){return t.filter(t=>!e.includes(t))}function B(t,e,i=I){let n=[];return t.forEach(t=>{const s=i(t);!n.map(i).includes(s)&&e.map(i).includes(s)&&n.push(t)}),n}function V(t,e=0){if(!(t.length<e+1))return t[t.length-e-1]}function W(t){if(!(t.length<1))return t[0]}const j=(t,e)=>t[e];function G(t,e,i=(t=>t),n=j,s=0,r=t.length-1){for(;s<r;){const l=s+r>>>1,c=n(t,l);((o=i(c))<(a=e)?-1:o>a?1:o>=a?0:NaN)<0?s=l+1:r=l}var o,a;return s}function z(t,e=0,i=t.length-1,n=(t=>t)){if(e<0||i>=t.length)return[null,null];let s=null,r=null;for(let o=e;o<=i;o++){const e=n(t[o]);null!=e&&e>=e&&(null==s?s=r=e:(s>e&&(s=e),r<e&&(r=e)))}return[s,r]}function Y(t,e){const i=K;if(!i(t)||!i(e))return;const[n,s]=t,[r,o]=e;(i(r,n)&&n<r||i(n)&&!i(r))&&(e[0]=n),(i(o,s)&&s>o||i(s)&&!i(o))&&(e[1]=s)}Array.prototype.flat||(Array.prototype.flat=function(t,e){return e=this.concat.apply([],this),t>1&&e.some(Array.isArray)?e.flat(t-1):e},Array.prototype.flatMap=function(t,e){return this.map(t,e).flat()});let q=null;function $(){return null===q&&(q="ontouchstart"in globalThis),q}function X(t,e){return"ArrowLeft"===t||37===e}function K(...t){return t.every(t=>null!=t)}function Z(t,e){return i="round",n=t,void 0===(s=-e)||0==+s?Math[i](n):(n=+n,s=+s,isNaN(n)||"number"!=typeof s||s%1!=0?NaN:(n=n.toString().split("e"),+((n=(n=Math[i](+(n[0]+"e"+(n[1]?+n[1]-s:-s)))).toString().split("e"))[0]+"e"+(n[1]?+n[1]+s:s))));var i,n,s}function Q(t){return K(t)&&Number.isFinite(t)}function J(t){let e="both"===t;return[e||"vertical"===t,e||"horizontal"===t]}function tt(t,e,...i){if(!K(t))return e;let n=t;for(let t=0;t<i.length;++t){const s=i[t];if(!K(n)||!n.hasOwnProperty(s))return e;n=n[s]}return n}function et(t){return null==t?t:JSON.parse(JSON.stringify(t))}function it(t,e,i=!0){let n=Object.keys(e),s=Object.keys(t);for(let o of n)if(r=o,!i||s.includes(r)){const i=t[o];void 0===i||"object"!=typeof i||Array.isArray(i)?t[o]=e[o]:nt(t[o],e[o])}var r}function nt(t,e){it(t,e)}function st(t,e){let i=Object.keys(e);for(let n of i)t[n]=t[n]||e[n]}function rt(t=[]){return t.reduce((t,e)=>(t[e.name]=e.value,t),{})}function ot(t){return t?new Date(t):null}function at(t){let e="";for(let i in t){let n="".concat(i,"=").concat(encodeURIComponent(t[i]));e+=(e.length>0?"&":"")+n}return e}function lt(t,e){it(t,e,!1)}const ct=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,ut=[1e3,60,60,24,7,30/7,12];function ht(t){const e=ct.exec(t);if(!K(e))return null;const i=e.slice(2,9).map(t=>K(t)?parseFloat(t):0).reverse();return ut.forEach((t,e)=>{for(let n=e;n<i.length;n++)i[n]=i[n]*t}),Math.floor(_(i))}function dt(t,e,i,n){let s=t,r=e;return 0===s||0===r?(s=i,r=s/2):s>n?(r*=n/s,s=n):s<i&&(r*=i/s,s=i),[s,r]}var pt=i(4),ft=i.n(pt),mt=i(14),gt=i.n(mt);function yt(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function vt(t){yt(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function bt(t){yt(1,arguments);var e=vt(t);return e.setHours(0,0,0,0),e}function Tt(t,e){yt(2,arguments);var i=bt(t),n=bt(e);return i.getTime()===n.getTime()}function St(t){yt(1,arguments);var e=vt(t);return e.setDate(1),e.setHours(0,0,0,0),e}function At(t){yt(1,arguments);var e=vt(t),i=e.getFullYear();return i}function Pt(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function wt(t,e){yt(2,arguments);var i=vt(t),n=Pt(e);if(isNaN(n))return new Date(NaN);if(!n)return i;var s=i.getDate(),r=new Date(i.getTime());r.setMonth(i.getMonth()+n+1,0);var o=r.getDate();return s>=o?r:(i.setFullYear(r.getFullYear(),r.getMonth(),s),i)}function Ct(t,e){yt(2,arguments);var i=Pt(e);return wt(t,12*i)}function xt(t){return ft.a.parseInstrumentType(t)}const Mt=new Map;async function Et(t){if(!Rt(t))return t;const{root:e,dynamic:i,dynamicCode:n}=xt(t);if(!K(e,i,n))return null;if(!Mt.has(e)||!function(t){return yt(1,arguments),Tt(t,Date.now())}(Mt.get(e).savedAt)){var s;const t=await Ft(e);if(!Array.isArray(t))return null;const i=(null===(s=t.find(t=>t.isNearest))||void 0===s?void 0:s.name)||"";Mt.set(e,{symbols:t.map(t=>t.name),savedAt:new Date,nearest:i})}const{symbols:r,nearest:o}=Mt.get(e),a=parseInt(n);if(0===a)return o;const l=a-1;return l<r.length?r[l]:null}function Ot(t){return ft.a.getIsFuture(t)}const Dt=/^([A-Z]{2}(?:B|P)(?:F|G|H|J|K|M|N|Q|U|V|X|Z))(1[4-9]|[2-9][0-9])([A-Z]+\.CM)$/;function Lt(t){return Dt.test(t)}function It(t){return ft.a.getIsEquityOption(t)}function _t(t){return String(t%100).padStart(2,"0")}function Nt(t,e=!1){if(!Ot(t))return t;const i=xt(t);return function(t,e,i,n=!1){return"".concat(t).concat(e).concat(n?i:_t(i))}(i.root,i.month,i.year,e)}function Rt(t){const e=xt(t);return K(e)&&!0===e.dynamic}function kt(t){const e=Ot(t)||function(t){return ft.a.getIsFutureOption(t)}(t),i="_S_"===t.substring(0,2);return(e||It(t))&&!i}function Ht(t){return Ot(t)?"America/Chicago":"America/New_York"}async function Ft(t){const e=await Qf("futures","?root=".concat(t));return JSON.parse(e)[t].contracts.filter(t=>"Y"!==t.month).sort((t,e)=>t.expires-e.expires).map(e=>({month:e.month,year:e.year,expires:new Date(e.expires),isNearest:e.isnearest,name:"".concat(t).concat(e.month).concat(e.year%100)}))}function Ut(t){if(!Ot(t))return null;return xt(t).root}function Bt(t){if(!Ot(t))return null;const e=xt(t),i=gt.a.getCodeToNumberMap()[e.month];return St(new Date(e.year,i-1))}function Vt(t,e){const i=Ot(t),n=Lt(t);return i||n?i?function(t,e){const i=xt(t),n=(i.year+e)%100;return"".concat(i.root).concat(i.month).concat(_t(n))}(t,e):function(t,e){const i=Dt.exec(t),n=Number.parseInt(i[2]),s=At(Ct(new Date(n+(n>79?1900:2e3),0,1),e));return"".concat(i[1]).concat(_t(s)).concat(i[3])}(t,e):null}function Wt(t,e=document){const i=jt(t,e);return K(i)?i.innerHTML:null}function jt(t,e=document){return Xt(t,e)[0]}function Gt(t,e){for(const i in e)t.style[i]=e[i]}function zt(t,e){for(const i in e)t.setAttribute(i,e[i])}function Yt(t,e,i){const n=jt("#".concat(t),e);if(K(n))return n;const s=$t(e,i);return s.id=t,s}function qt(t,e){"string"==typeof t&&(t=jt(t)),"string"==typeof e?t.className=e:Array.isArray(e)?t.className=e.join(" "):"object"==typeof e&&(t.className="",Object.keys(e).forEach(i=>{e[i]&&t.classList.add(i)}))}function $t(t,e){return t.appendChild(document.createElement(e))}function Xt(t,e=document){return e.querySelectorAll(t)}function Kt(t,e,i=document){let n=t;"string"==typeof t&&(n=jt(t,i)),n&&(n.innerHTML=e)}function Zt(t){return new Promise(e=>{const i=()=>{t&&void 0!==t.naturalWidth&&0!==t.naturalWidth&&t.complete?e():setTimeout(i,150)};i()})}async function Qt(t,e="asyncReadyWork"){K(this[e])||(this[e]={});const i=this[e];return K(i.result)?Promise.resolve(i.result):(K(i.promise)||(i.promise=t.call(this),i.promise.then(t=>{i.result=t})),i.promise)}const Jt=globalThis.devicePixelRatio||1,te={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:$()?20*Jt:5*Jt,HALF_ANN_POINT_DIMENSION:$()?10:6,OUT_OF_SCREEN:8192,DEFAULT_SYMBOL_WIDTH_HEIGHT:18,PARTIAL_FIBONACCI_SEQUENCE:[0,1,2,3,5,8,13,21,34,55,89,144],PANE_SPLITTER_PERCENT_HEIGHT:.75,BASIS_MAIN:"$main",INPUT_PERIOD:"Period",INPUT_PERIOD1:"Period1",INPUT_PERIOD2:"Period2",INPUT_PERIOD3:"Period3",INPUT_SMOOTHING:"Smoothing",INPUT_SOURCE:"Source",INPUT_WIDTH:"Width",EMPTY_ARRAY:[],CHART_DEFINITION:"chart.def.json",CHART_SCHEMA:"chart.schema.json",STUDIES_SCHEMA:"studies.schema.json",STUDIES_LIST:"studies.lst.json",FIELDS_SCHEMA:"fields.schema.json",FIELDS_LIST:"fields.lst.json",ACCESSOR_SCHEMA:"accessor.schema.json",EVENTS:["dividends","earnings","splits","custom"],PLACEHOLDER_SYMBOL_NAME:"PLACEHOLDER",REALTIME_INITIAL_QUOTE:"REFRESH_QUOTE",REALTIME_TRADE:"TRADE",REALTIME_VOLUME:"VOLUME",TOOLTIP_X_OFFSET:15,TOOLTIP_Y_OFFSET:30,TOOLTIP_TOGGLE_SIDE_ANIM_MS:300,TOOLTIP_TOGGLE_DISTANCE_TOLERANCE:10,CARDS_X_OFFSET:5,CARDS_Y_OFFSET:5,PANE_CAP_MAX_PADDING_PERCENT:.15,PANE_CAP_MIN_PADDING_PERCENT:.075,STANDARD_VISIBLE_BARS:130,ACTION_GET:"Get",ACTION_DELETE:"Delete",ACTION_TEMPLATE:"Template",ACTION_AGGREGATION:"Aggregation",ACTION_PLOT:"Plot",MINIMUM_BAR_WIDTH:.02,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,COLOR_TRANSPARENT:"rgba(0, 0, 0, 0)",AT_LINE:"line",AT_LINE_2:"line2",AT_FILL:"fill",AT_FILL2:"fill2",AT_FILL_TEXT:"fillText",AT_COMPACT:"compact",AT_ACCOUNT_SIZE:"accountSize",AT_RISK:"risk",AT_RISK_IS_PERCENT:"riskIsPercent",AT_SHOW_PRICES:"showPrices",AT_SHOW_BARCOUNT:"showBarCount",AT_EXTEND_PT_1:"extendPoint1",AT_EXTEND_PT_2:"extendPoint2",AT_TEXT_LINES:"textLines",AT_SHOW_TIMESTAMPS:"showTimestamps",AT_SHOW_TRENDLINE:"showTrendline",AT_SHOW_PERCENTDIFF:"showPercentDiff",AT_FACTORS:"factors",AT_MARKER:"marker",AT_DRAW_LINES:"drawLines",AT_ALLOW_PRICES_CHANGE_UI:"allowPricesChangeUI",AT_PRICES_ON_SCALE:"pricesOnScale",ANN_ACTION_ID:"Annotation",ANN_DUPLICATE_OFFSET:20,DEFAULT_ADORN_OFFSET:{x:-5,y:-10},ZOOM_DEBOUNCE_DELAY:3e3,MINIMUM_PANE_HEIGHT:10,DEBUG_TIME_FORMAT:"yyyy-LL-dd HH:mm:ss.SSS",DEBUG_SYMBOL:"NOTASYMBOL",DEBUG_CHART_ID:"root",COLOR_DEFAULT_OHLC:"#808080",COLOR_DEFAULT_VARY:["#d33e32","#19ab52"],COLOR_DEFAULT_AREA:"#2d76b3",TOOLTIP_STD:"standard",TOOLTIP_CARDS:"cards",TOOLTIP_BUBBLE:"bubble",TOOLTIP_EXTERNAL:"external",NS_SVG:"http://www.w3.org/2000/svg",NS_XLINK:"http://www.w3.org/1999/xlink",NULL_OBJECT:{magic:0x64646f746c6964},CROSSHAIR_ID:"crosshair_elem_id",ZOOM_X_AXIS_PERCENT:.02,DEFAULT_MAX_RECORDS:640,TICK_CUSTOM_AGG_MULTIPLIER:5,SNAP_PROXIMITY_PIXELS:18,LONG_PRESS_TIMEOUT_MILLIS:750,LONG_PRESS_DELAY_MILLIS:750,MINIMUM_THROTTLE:25,BACKGROUND_TAB_THROTTLE:2e3,INTERNAL_GC_MILLIS:3e5,US_TRADING_DAYS_PER_YEAR:251,INLINE_DATA_ELEMENT_ID:"barchart-www-inline-data",META_DATA_GET_TIMETOUT:3e3,FMT_US_DATE_ONLY:"LL/dd/yyyy",FMT_ISO_DATE_ONLY:"yyyy-LL-dd",FMT_HIST_FEED_PARAM_DATE_ONLY:"yyyyLLdd",FMT_HIST_FEED_PARAM_DATE_TIME:"yyyyLLddHHmmss",FMT_HIST_FEED_INTRADAY:"yyyy-LL-dd HH:mm",FMT_HIST_FEED_TICK:"yyyy-LL-dd HH:mm:ss.SSS",FMT_EXPORT_ALL_BUT_MILLIS:"yyyy-LL-dd HH:mm:ss",LINE_HEIGHT_MULTIPLIER:1.2,SVG_ICONS_DOM_NODE:"bchart-svg-icons-placeholder",DEFAULT_BAR_WIDTH:10,DEFAULT_BAR_SPACING:5,LINE_DASH_PROP_NAME:"lineDash",MARKER_ARROW_ANGLE:45,MARKER_ARROW_LENGTH:20,TIMELINE_PROLOG_PADDING_BARS:5e3,TIMELINE_EPILOG_PADDING_BARS:1e3,NO_DATA_TEXT:"No data to display",DEFAULT_PRICE_AXIS_WIDTH:70,SPECIAL_BUILDER_REQUIRED:[c.Renko,c.Kagi,c.PointAndFigure],INTRA_THRESHOLD:ht("P30D"),ONE_DAY_MILLIS:ht("P1D"),TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:ht("P50Y"),BC_EVENT_LOGGED_IN:"login success",BC_EVENT_DISCONNECTED:"disconnect",BC_EVENT_FEED_PAUSED:"feed paused",BC_EVENT_FEED_RESUMED:"feed resumed",BC_EVENT_DISCONNECTING:"disconnecting",HEADER_SIZE_PLACEHOLDER_ID:"header_size_helper_placeholder",CURVE_STYLE_DOTS_RADIUS:2,DEFAULT_ACCESSOR_SUBACTION:"Update",MIN_EVENT_RADIUS:8,PHP_TO_UNICODE_TS_35_MAP:{a:"EEE",A:"EEEE",d:"dd",e:"d",w:"c",b:"MMM",B:"MMMM",m:"MM",y:"yy",Y:"yyyy",H:"HH",k:"H",I:"hh",l:"h",M:"mm",p:"aaa",P:"aaaaa",S:"ss",L:"SSS"},AUTOFIT_PERIOD:"P50Y",BARCHART_HIST_SRV_TICKS_PAGE_NAME:"queryticks.ashx",BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:"queryminutes.ashx",BARCHART_HIST_SRV_FORMT_INTRADAY_PAGE_NAME:"queryformtminutes.ashx",BARCHART_HIST_SRV_EOD_PAGE_NAME:"queryeod.ashx",DOUBLE_CLICK_DURATION_MILLIS:500,TOOLTIP_STD_LEGACY_CLASS:"highcharts-tooltip",TOOLTIP_STD_CLASS:"bcharts-tooltip",TOOLTIP_BUBBLE_CLASS:"bcharts-bubble",TOOLTIP_BUBBLE_OFFSET:30,EVENTS_BUILT_IN:["dividends","earnings","splits"],NOT_APPLICABLE:"N/A",BARCHART_INTERNAL_FEED_DATA_ENDPOINT:"https://barchart.websol.barchart.com",DEFAULT_RENKO_INPUTS:[{name:"Method",value:"ATR"},{name:"Period",value:14},{name:"Source",value:"Close"},{name:"BrickSize",value:10}],RENKO_MAX_BARS:35e3,RENKO_NAMES:{ATR:"ATR",TRD:"Traditional",CLS:"Close",HL:"High/Low"}};var ee=i(8),ie=i.n(ee),ne=i(10),se=i.n(ne),re=i(15),oe=i.n(re),ae=i(16),le=i.n(ae);const ce=[{min:0,divider:1,suffix:"",decimals:0},{min:1e5,divider:1e3,suffix:"K",decimals:0},{min:1e6,divider:1e6,suffix:"M",decimals:2},{min:1e9,divider:1e9,suffix:"B",decimals:3}];function ue(t){if(K(t)){const e=tt(im().config,null,"overrides","symbology","translateSymbol");if(K(e)&&"function"==typeof e)try{const i=e(t);if(K(i))return i}catch(e){Kf("Failed translating the symbol '".concat(t,"', error is ").concat(e.message),"warn")}}return t}function he(t,e,i){if(null==t)return"";if(!this.isReady)return t.toFixed(0);if(e.format===p.FromMetaData)return function(t,e,i){const n=im().config;return n.mode===C[C.cmdtyView]&&null!=i?le()(t,e,i):ie()(t,e,"-",n.isAlt64,",")}(t,this.unitCode,this._profile);switch(e.format){case p.AsInteger:return t.toFixed();case p.UseMetricUnit:{i=i||{};const e=Object.assign({},{range:[t,t],allDigits:!1},i);if(i.allDigits)return pe(t,0);Array.isArray(e.range)&&e.range.length||(e.range=[t,t]);const n=Math.max(Math.abs(e.range[0]),Math.abs(e.range[1])),s=F(ce,t=>n>t.min)||ce[0];return"".concat((t/s.divider).toFixed(s.decimals)).concat(s.suffix)}case p.AsPercent:return"".concat((100*t).toFixed(2),"%");default:return""}}class de{constructor(t){this.symbolType=m.Unknown,this.exchange="",this.name="",this.unitCode="",this.pointValue=1,this.expiration="",this.resolved=this.symbol=t,this.timeZone=Ht(ue(this.symbol)),this._profile=null}initialize(t){nt(this,t),this._profile=new oe.a(this.resolved,null,null,this.unitCode)}get isReady(){return this.unitCode.length>0}format(t,e,i){return he.call(this,t,e,i)}parse(t){throw new Error("Not implemented yet")}shutdown(){}}function pe(t,e){return se()(t,e,",")}function fe(t){const e=Wt("#".concat(te.INLINE_DATA_ELEMENT_ID));if(!K(e))return te.NULL_OBJECT;const i=JSON.parse(e);let n=t;const s=t=>t in i;return s(n)||(n=function(t,e){if(!Ot(t))return t;const i=xt(t);return e.find(t=>xt(t).root===i.root)||t}(t,Object.keys(i)),s(n))?i[n].instrument:te.NULL_OBJECT}class me extends de{async ready(){return Qt.call(this,async()=>{const t=ue(this.symbol);let e=await ge(t);return this.initialize(e),!0})}getCacheableEntities(t){t.add(this)}}async function ge(t){let e=fe(t);if(e===te.NULL_OBJECT)try{const i=await Qf("ondemand","/getInstrumentDefinition.json?symbols=".concat(t)),n=JSON.parse(i);if(200===n.status.code&&1===n.results.length){const t=n.results[0];e={name:t.symbolName,exchange:t.exchange,unitCode:t.baseCode,pointValue:t.pointValue}}}catch(i){Kf("Failed fetching the metadata for ".concat(t,", error is ").concat(i.message),"warn"),e={name:t,exchange:"",unitCode:"A",pointValue:1}}return e}class ye extends de{async ready(){return Qt.call(this,async()=>{const t=ue(this.symbol);if(It(t))return this.initialize({name:this.symbol,exchange:"",unitCode:"A",pointValue:1,symbolType:m.Option}),!0;const e=Rt(t),i=await(e?Et(t):t);this.resolved=Nt(i);const[n,s,r]=await async function(t){const e=Ot(t),i=Lt(t),n=t=>[t,!1,!1];if(!e&&!i)return n(t);if(e){const e=await Et("".concat(Ut(t),"*1"));if(!Rt(t)){const e=xt(t),i=Mt.get(e.root).symbols;if(i.includes(t))return[t,!0,!1];for(let t of i){if(xt(t).month===e.month)return[t,!0,!0]}}return[e,!0,!0]}if(i){const e=Dt.exec(t);return n("".concat(e[1]).concat(_t(At(new Date))).concat(e[3]))}return n(t)}(this.resolved),o=new Promise((function(t,e){setTimeout(t,te.META_DATA_GET_TIMETOUT,te.NULL_OBJECT)}));let a=await Promise.race([o,im().connection.getMarketState().getProfile(n)]);if(!function(t){return t===te.NULL_OBJECT||!K(t)||!K(t.unitCode)||0===t.unitCode.length}(a)?delete a.symbol:a=await ge(n),a.symbolType=s?m.Future:m.Equity,r){const t=xt(this.resolved);K(a.expiration)&&(a.expiration=a.expiration.replace(""+a.year,""+t.year)),a.year=t.year}return this.initialize(a),!0})}getCacheableEntities(t){t.add(this)}}class ve{constructor(t){this._decimals=t}get isReady(){return!0}async ready(){return!0}format(t,e,i){return null==t?"":pe(t,this._decimals)}getCacheableEntities(t){}}class be{async ready(){return!1}get isReady(){return!1}format(t,e,i){return null==t?"":K(t)?t.toFixed(0):""}getCacheableEntities(t){}}class Te{constructor(t){const e=im().getMetaDataSource();this.inner=t.map(t=>e.getMetaData(t)),this.unitCode=null}get isReady(){return null!=this.unitCode}async ready(){return Qt.call(this,async()=>{const t=(await Promise.all(this.inner.map(t=>t.ready()))).every(I);if(t){const t=t=>parseInt(t,16),e=e=>t(e.unitCode),{yes:i,no:n}=H(this.inner,t=>e(t)>=8),s=this.inner.length,r=t=>Math.max(...t).toString(16).toUpperCase();if(i.length===s||n.length===s)this.unitCode=r(this.inner.map(e));else{const s="B".charCodeAt(0),o=i.map(e).concat(n.map(e).map(t=>String.fromCharCode(t-2+s)).map(t));this.unitCode=r(o)}}return t})}format(t,e,i){return he.call(this,t,e,i)}getCacheableEntities(t){this.inner.forEach(e=>t.add(e))}}class Se{constructor(){this.metaDataCache=new Map}makeAndCacheMetaData(t,e){if(t===te.PLACEHOLDER_SYMBOL_NAME)return new be;if(this.metaDataCache.has(t))return this.metaDataCache.get(t);{const i=e(t);return this.metaDataCache.set(t,i),i}}evictUnused(t){for(const[e,i]of this.metaDataCache)t.has(i)||(i.shutdown(),this.metaDataCache.delete(e))}}class Ae extends Se{getMetaData(t){return this.makeAndCacheMetaData(t,()=>new me(t))}}class Pe extends Se{getMetaData(t){return this.makeAndCacheMetaData(t,()=>new ye(t))}}const we=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,Ce=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,xe=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,Me={r:255,g:255,b:255,a:1},Ee={r:0,g:0,b:0,a:1};function Oe(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function De(t,e){const i=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y);return Math.sqrt(i*i+n*n)}function Le(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ie(t,e){return{x:t.x+e.x,y:t.y+e.y}}function _e(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function Ne(t,e,i){const[n,s]=t,r=s.x-n.x,o=s.y-n.y,a=e.x-n.x,l=e.y-n.y;if(0===r&&0===o)return Math.abs(a)<=i&&Math.abs(l)<=i;const c=Math.atan2(o,r),u=Math.sqrt(r*r+o*o),h=Math.atan2(l,a),d=Math.sqrt(a*a+l*l),p=d*Math.cos(h-c),f=d*Math.sin(h-c);return Math.abs(f)<=i&&-i<=p&&p<=u+i}function Re(t){return t.toLowerCase().replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace("sparsedot","1,8,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").replace("solid","").split(",").map(Number).filter(I)}function ke(t){return function(t){let e=t=>{let e=t.toString(16);return 2===e.length?e:"0"+e};return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))}(Be(t))}function He(t,e,i,n=!1){const s=t.a,r=n=>Math.floor(t[n]+(e[n]-t[n])*i);return{r:r("r"),g:r("g"),b:r("b"),a:Math.min(1,(1+(n?i:0))*s)}}const Fe=(t,e=!1)=>L(Be,i=>He(i,Ee,t,e),Ve);function Ue(t,e=!1){return L(Be,i=>He(i,Me,t,e),Ve)}function Be(t){if(["r","g","b","a"].map(e=>t[e]).every(t=>K(t)))return t;const e=K(t.linearGradient)?t._refColor:t,i=we.exec(e);if(null!==i){const t=K(i[2]),e=i[1]+(i[2]||""),n=i=>t?parseInt(e.substr(2*i,2),16):17*parseInt(e.charAt(i),16);return{r:n(0),g:n(1),b:n(2),a:1}}{const t=xe.exec(e),i=Ce.exec(e),n=(t,e)=>K(t)&&t.length===e,s=n(t,5),r=n(i,4);if(!s&&!r)throw new Error("Color is neither a hex color nor a rgba one.");const o=s?t:i;let a=t=>parseInt(o[t]),l=parseFloat(o[4]);return{r:a(1),g:a(2),b:a(3),a:s?l:1}}}function Ve(t){return"rgba(".concat(t.r,", ").concat(t.g,", ").concat(t.b,", ").concat(t.a,")")}function We(t,e){t.beginPath(),t.rect(e.x,e.y,e.width,e.height),t.clip()}class je{constructor(t,e,i,n){this.x=t,this.y=e,this.width=i,this.height=n}contains(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}duplicate(){return new je(this.x,this.y,this.width,this.height)}}class Ge{constructor(t,e,i,n){this.cx=t,this.cy=e,this.radiusX=i,this.radiusY=n}contains(t){const e=Math.abs(t.x-this.cx)/this.radiusX,i=Math.abs(t.y-this.cy)/this.radiusY;return Math.sqrt(e*e+i*i)<=1}}function ze(t,e=te.LINE_HEIGHT_MULTIPLIER){return e*t.measureText("M").width}function Ye(t,e,i,n=T.Left,s=null,r=null){t.save();const o=Array.isArray(e)?e:[e],a=ze(t,1);if(K(r)){const e=Math.max(...o.map(e=>t.measureText(e).width)),s=a*o.length;let l=i.x;n===T.Right&&(l-=e),n===T.Center&&(l-=e/2);const c=i.y-a,u=function(t,e,i){return t.x-=e,t.y-=i,t.width+=2*e,t.height+=2*i,t}(new je(l,c,e,s),4,4);t.fillStyle=r,qe(t,u,!1)}K(s)&&(t.fillStyle=s);let l=i.x,c=i.y;o.forEach(e=>{t.textAlign=T[n].toLowerCase(),t.fillText(e,l,c),c+=a}),t.restore()}function qe(t,e,i=!0){t.beginPath(),t.rect(e.x,e.y,e.width,e.height),i&&t.stroke(),t.fill()}function $e(t,e,i,n=0,s=Math.PI,r=!1){t.beginPath(),t.arc(e.x,e.y,Math.abs(i),n,s,r),t.stroke()}function Xe(t,{x:e,y:i},{x:n,y:s}){t.beginPath(),t.moveTo(e,i),t.lineTo(n,s),t.stroke()}function Ke(t,e,i,n){Xe(t,{x:e,y:i},{x:e,y:n})}function Ze(t,e,i,n){Xe(t,{x:i,y:e},{x:n,y:e})}function Qe(t,e,i){switch(e){case"zero":Je(t,i,"0");break;case"one":Je(t,i,"1");break;case"two":Je(t,i,"2");break;case"three":Je(t,i,"3");break;case"four":Je(t,i,"4");break;case"five":Je(t,i,"5");break;case"six":Je(t,i,"6");break;case"seven":Je(t,i,"7");break;case"eight":Je(t,i,"8");break;case"nine":Je(t,i,"9");break;case"question":Je(t,i,"?");break;case"fish_hook":!function(t,e){t.save(),t.translate(e.x,e.y);const i=Math.min(e.width,e.height)/560;t.scale(i,i),t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4,t.save(),t.save(),t.miterLimit=10,t.beginPath(),t.moveTo(377.8,354.8),t.bezierCurveTo(377.8,354.8,401.8,517.8,290.6,507),t.bezierCurveTo(173.2,495.5,171.5,50.39,171.5,50.39),t.bezierCurveTo(171.5,50.39,191.7,252.59,212.3,351),t.bezierCurveTo(212.3,351,230.9,472.8,286.7,488.7),t.bezierCurveTo(350.4,507,369.5,452.7,377.8,354.79),t.closePath(),t.fill(),t.stroke(),t.restore(),t.save(),t.miterLimit=10,t.beginPath(),t.moveTo(378.3,351.1),t.lineTo(341.1,446.6),t.lineTo(371.2,436.7),t.lineTo(378.3,351.1),t.closePath(),t.fill(),t.stroke(),t.restore(),t.restore(),t.restore()}(t,i);break;case"arrow_up":!function(t,e){t.save();const{cx:i,cy:n,left:s,right:r,top:o,bottom:a,halfBaseSize:l}=ti(e);t.beginPath(),t.moveTo(r,n),t.lineTo(i,o),t.lineTo(s,n),t.lineTo(Math.floor(i-l),n),t.lineTo(Math.floor(i-l),a),t.lineTo(Math.floor(i+l),a),t.lineTo(Math.floor(i+l),n),t.closePath(),t.fill(),t.stroke(),t.restore()}(t,i);break;case"arrow_down":!function(t,e){t.save();const{cx:i,cy:n,left:s,right:r,top:o,bottom:a,halfBaseSize:l}=ti(e);t.beginPath(),t.moveTo(r,n),t.lineTo(i,a),t.lineTo(s,n),t.lineTo(Math.floor(i-l),n),t.lineTo(Math.floor(i-l),o),t.lineTo(Math.floor(i+l),o),t.lineTo(Math.floor(i+l),n),t.closePath(),t.fill(),t.stroke(),t.restore()}(t,i);break;case"arrow_right":!function(t,e){t.save();const{cx:i,cy:n,left:s,right:r,top:o,bottom:a,halfBaseSize:l}=ti(e);t.beginPath(),t.moveTo(i,o),t.lineTo(r,n),t.lineTo(i,a),t.lineTo(i,Math.floor(n+l)),t.lineTo(s,Math.floor(n+l)),t.lineTo(s,Math.floor(n-l)),t.lineTo(i,Math.floor(n-l)),t.closePath(),t.fill(),t.stroke(),t.restore()}(t,i);break;case"arrow_left":!function(t,e){t.save();const{cx:i,cy:n,left:s,right:r,top:o,bottom:a,halfBaseSize:l}=ti(e);t.beginPath(),t.moveTo(i,o),t.lineTo(s,n),t.lineTo(i,a),t.lineTo(i,Math.floor(n+l)),t.lineTo(r,Math.floor(n+l)),t.lineTo(r,Math.floor(n-l)),t.lineTo(i,Math.floor(n-l)),t.closePath(),t.fill(),t.stroke(),t.restore()}(t,i);break;case"arc_down":!function(t,e){const{cx:i,cy:n,left:s,right:r,deflection:o,arcWidth:a}=ei(e);t.save(),t.beginPath(),t.moveTo(r,n);const l=i+o,c=n+o,u=i-o,h=n+o;t.bezierCurveTo(l,c,u,h,s,n),t.lineTo(s,n+a),t.bezierCurveTo(u,h+a,l,c+a,r,n+a),t.closePath(),t.fill(),t.stroke(),t.restore()}(t,i);break;case"arc_up":!function(t,e){const{cx:i,cy:n,left:s,right:r,deflection:o,arcWidth:a}=ei(e);t.save(),t.beginPath(),t.moveTo(r,n);const l=i+o,c=n-o,u=i-o,h=n-o;t.bezierCurveTo(l,c,u,h,s,n),t.lineTo(s,n-a),t.bezierCurveTo(u,h-a,l,c-a,r,n-a),t.closePath(),t.fill(),t.stroke(),t.restore()}(t,i);break;case"thumbs_up":!function(t,e){t.save(),t.translate(e.x,e.y),t.lineWidth=.05;const i=Math.min(e.width,e.height)/18;t.scale(i,i),t.lineCap="butt",t.save(),t.save(),t.beginPath(),t.moveTo(3.23,8.96),t.lineTo(4.17,8.96),t.bezierCurveTo(4.73,8.81,5.91,6.45,6.45,5.82),t.bezierCurveTo(6.88,5.33,7.66,5.09,8.48,3.7),t.bezierCurveTo(9.11,2.78,8.38,1.49,10.06,1.17),t.bezierCurveTo(10.9,1.01,11.86,2.61,11.58,4.11),t.bezierCurveTo(11.49,4.6,11.25,5.14,11.07,5.54),t.bezierCurveTo(10.63,6.5,10.05,6.58,10.17,7.23),t.bezierCurveTo(10.98,7.25,11.79,7.32,12.67,7.27),t.bezierCurveTo(14.33,7.17,15.55,9.08,14.43,10.38),t.bezierCurveTo(14.9,11.12,14.79,12.33,14.14,12.81),t.bezierCurveTo(14.42,13.58,14.25,14.45,13.67,14.8),t.bezierCurveTo(14.13,16.77,12.36,16.87,11.77,16.84),t.lineTo(4.65,16.84),t.bezierCurveTo(3.87,16.77,3.95,16.28,3.5,16.27),t.bezierCurveTo(3.39,16.26,3.3,16.26,3.3,16.26),t.bezierCurveTo(3.18,16.26,3.19,15.7,3.28,15.7),t.bezierCurveTo(3.36,15.69,3.61,15.68,3.87,15.71),t.bezierCurveTo(4.03,15.79,4.4,16.26,4.75,16.27),t.lineTo(12.12,16.26),t.bezierCurveTo(13.13,16.27,13.67,15.11,12.8,14.56),t.bezierCurveTo(13.85,14.53,13.98,12.98,13.19,12.6),t.bezierCurveTo(14.35,12.49,14.5,10.65,13.44,10.41),t.bezierCurveTo(14.8,9.97,14.39,7.59,12.35,7.83),t.bezierCurveTo(11.42,7.77,9.87,7.94,9.68,7.62),t.bezierCurveTo(9.41,6.82,9.684,6.45,10.17,5.88),t.bezierCurveTo(10.5,5.46,11.02,4.6,11.04,3.64),t.bezierCurveTo(11.05,2.5,10.41,1.23,9.58,1.98),t.bezierCurveTo(9.38,2.21,9.36,3.47,8.94,4.02),t.bezierCurveTo(8.09,5.52,7.3,5.66,6.95,6.15),t.bezierCurveTo(6.27,6.86,4.93,9.52,4.36,9.52),t.bezierCurveTo(3.98,9.52,3.243,9.52,3.24,9.52),t.bezierCurveTo(3.12,9.52,3.08,8.98,3.22,8.95),t.closePath(),t.fill(),t.stroke(),t.restore(),t.restore(),t.restore()}(t,i);break;case"thumbs_down":!function(t,e){t.save(),t.translate(e.x,e.y),t.lineWidth=.05;const i=Math.min(e.width,e.height)/18;t.scale(i,i),t.lineCap="butt",t.save(),t.save(),t.beginPath(),t.moveTo(14.77,9.04),t.lineTo(13.82,9.04),t.bezierCurveTo(13.27,9.18,12.09,11.55,11.54,12.17),t.bezierCurveTo(11.12,12.66,10.34,12.9,9.52,14.29),t.bezierCurveTo(8.88,15.21,9.62,16.51,7.93,16.82),t.bezierCurveTo(7.1,16.98,6.13,15.39,6.42,13.88),t.bezierCurveTo(6.51,13.4,6.75,12.855,6.93,12.46),t.bezierCurveTo(7.37,11.49,7.95,11.41,7.82,10.76),t.bezierCurveTo(7.02,10.75,6.21,10.68,5.33,10.73),t.bezierCurveTo(3.66,10.83,2.44,8.91,3.57,7.62),t.bezierCurveTo(3.09,6.88,3.2,5.67,3.85,5.19),t.bezierCurveTo(3.57,4.42,3.74,3.55,4.33,3.2),t.bezierCurveTo(3.87,1.22,5.64,1.13,6.22,1.16),t.lineTo(13.35,1.16),t.bezierCurveTo(14.12,1.22,14.04,1.71,14.49,1.73),t.bezierCurveTo(14.6,1.73,14.7,1.73,14.7,1.73),t.bezierCurveTo(14.82,1.74,14.8,2.29,14.72,2.3),t.bezierCurveTo(14.63,2.31,14.39,2.32,14.12,2.28),t.bezierCurveTo(13.96,2.21,13.6,1.74,13.25,1.73),t.lineTo(5.88,1.73),t.bezierCurveTo(4.86,1.73,4.33,2.88,5.19,3.44),t.bezierCurveTo(4.14,3.47,4.01,5.02,4.8,5.39),t.bezierCurveTo(3.64,5.5,3.49,7.35,4.55,7.58),t.bezierCurveTo(3.19,8.02,3.6,10.4,5.64,10.16),t.bezierCurveTo(6.57,10.23,8.12,10.05,8.32,10.37),t.bezierCurveTo(8.58,11.17,8.32,11.54,7.82,12.11),t.bezierCurveTo(7.49,12.54,6.97,13.39,6.96,14.36),t.bezierCurveTo(6.94,15.49,7.59,16.76,8.41,16.01),t.bezierCurveTo(8.62,15.78,8.63,14.52,9.05,13.97),t.bezierCurveTo(9.9,12.47,10.69,12.33,11.04,11.84),t.bezierCurveTo(11.72,11.13,13.06,8.47,13.637,8.47),t.bezierCurveTo(14.01,8.47,14.75,8.47,14.75,8.47),t.bezierCurveTo(14.87,8.47,14.91,9.01,14.77,9.04),t.closePath(),t.fill(),t.stroke(),t.restore(),t.restore(),t.restore()}(t,i)}}function Je(t,e,i){t.save();const n=e.centerX,s=e.centerY,r=Math.floor(Math.min(e.width/2,e.height/2));t.strokeStyle=t.fillStyle,t.lineWidth=Math.max(1,.1*r),$e(t,{x:n,y:s},r,0,2*Math.PI),t.textAlign="center",t.font="".concat(2*r,"px Arial"),t.textBaseline="middle",t.fillText(i,n,s+.15*r),t.restore()}function ti(t){const e=Math.floor(t.centerX),i=Math.floor(t.centerY),{width:n,height:s}=t;let r=Math.floor(Math.min(n,s));r*=.9;return{cx:e,cy:i,left:Math.floor(e-r/2),right:Math.floor(e+r/2),top:Math.floor(i-r/2),bottom:Math.floor(i+r/2),halfBaseSize:.21*r}}function ei(t){const e=Math.floor(t.centerX),i=Math.floor(t.centerY),{width:n,height:s}=t;let r=Math.floor(Math.min(n,s));r*=.9;return{cx:e,cy:i,left:Math.floor(e-r/2),right:Math.floor(e+r/2),arcWidth:.075*r,deflection:.3*r}}function ii(){const t=im().config.bypassSmoothing||!1;return{prolog:e=>{t&&e.translate(.5,.5)},adjust:e=>t?Z(e,0):e,epilog:e=>{t&&e.translate(-.5,-.5)}}}function ni(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function si(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const ri={width:1,color:"#000",dashStyle:"Solid"},oi={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},ai={color:te.COLOR_TRANSPARENT};function li(t,e){const i=tt(t,ri,"annotationTraits","line"),n=tt(t,oi,"annotationTraits","line2"),s=tt(t,ai,"annotationTraits","fill"),r=tt(t,9,"annotationTraits","zIndex"),o=gi[e],a=o.defaults||{},l=o.editable.includes(te.AT_LINE_2);let c=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ni(Object(i),!0).forEach((function(e){si(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ni(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({line:i,fill:s,zIndex:r},a);return l&&(c.line2=n),c}function ci(t,e){Object.keys(e).forEach(i=>{i===te.LINE_DASH_PROP_NAME?t.setLineDash(e[i]):t[i]=e[i]})}function ui(t){const e=L(Be,Ve);return{lineWidth:t.line.width,strokeStyle:e(t.line.color),fillStyle:e(t.fill.color),lineDash:Re(t.line.dashStyle)}}const hi=[te.AT_LINE,te.AT_ALLOW_PRICES_CHANGE_UI],di=[te.AT_FILL],pi=[te.AT_LINE,te.AT_FILL],fi=[te.AT_LINE,te.AT_LINE_2,te.AT_SHOW_PRICES,te.AT_ALLOW_PRICES_CHANGE_UI,te.AT_SHOW_TRENDLINE,te.AT_FACTORS,te.AT_PRICES_ON_SCALE],mi=t=>({[te.AT_SHOW_PRICES]:!0,[te.AT_SHOW_TRENDLINE]:!0,[te.AT_FACTORS]:[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236].map(e=>({shown:0<=e&&e<=t,value:e})),[te.AT_PRICES_ON_SCALE]:!1}),gi={Line:{editable:[te.AT_LINE,te.AT_SHOW_PRICES,te.AT_ALLOW_PRICES_CHANGE_UI,te.AT_SHOW_BARCOUNT,te.AT_SHOW_PERCENTDIFF,te.AT_EXTEND_PT_1,te.AT_EXTEND_PT_2,te.AT_MARKER],defaults:{[te.AT_SHOW_PRICES]:!1,[te.AT_SHOW_BARCOUNT]:!1,[te.AT_SHOW_PERCENTDIFF]:!1,[te.AT_EXTEND_PT_1]:!1,[te.AT_EXTEND_PT_2]:!1}},Ray:{editable:[te.AT_LINE,te.AT_SHOW_PRICES,te.AT_ALLOW_PRICES_CHANGE_UI,te.AT_SHOW_BARCOUNT,te.AT_SHOW_PERCENTDIFF,te.AT_EXTEND_PT_1,te.AT_EXTEND_PT_2,te.AT_MARKER],defaults:{[te.AT_SHOW_PRICES]:!1,[te.AT_SHOW_BARCOUNT]:!1,[te.AT_SHOW_PERCENTDIFF]:!1,[te.AT_EXTEND_PT_1]:!1,[te.AT_EXTEND_PT_2]:!0}},GannLine:{editable:[te.AT_LINE,te.AT_SHOW_PRICES,te.AT_ALLOW_PRICES_CHANGE_UI,te.AT_SHOW_BARCOUNT,te.AT_SHOW_PERCENTDIFF,te.AT_EXTEND_PT_1,te.AT_EXTEND_PT_2,te.AT_MARKER],defaults:{[te.AT_SHOW_PRICES]:!1,[te.AT_SHOW_BARCOUNT]:!1,[te.AT_SHOW_PERCENTDIFF]:!1,[te.AT_EXTEND_PT_1]:!1,[te.AT_EXTEND_PT_2]:!0}},LongPosition:{editable:[te.AT_LINE,te.AT_FILL,te.AT_FILL2,te.AT_FILL_TEXT,te.AT_COMPACT,te.AT_ACCOUNT_SIZE,te.AT_RISK,te.AT_RISK_IS_PERCENT,te.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[te.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[te.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[te.AT_FILL_TEXT]:{color:"#fff"},[te.AT_COMPACT]:!1,[te.AT_ACCOUNT_SIZE]:1e3,[te.AT_RISK]:25,[te.AT_RISK_IS_PERCENT]:!0}},ShortPosition:{editable:[te.AT_LINE,te.AT_FILL,te.AT_FILL2,te.AT_FILL_TEXT,te.AT_COMPACT,te.AT_ACCOUNT_SIZE,te.AT_RISK,te.AT_RISK_IS_PERCENT,te.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[te.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[te.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[te.AT_FILL_TEXT]:{color:"#fff"},[te.AT_COMPACT]:!1,[te.AT_ACCOUNT_SIZE]:1e3,[te.AT_RISK]:25,[te.AT_RISK_IS_PERCENT]:!0}},VerticalLine:{editable:[te.AT_LINE,te.AT_SHOW_TIMESTAMPS,te.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[te.AT_SHOW_TIMESTAMPS]:!0}},HorizontalLine:{editable:[te.AT_LINE,te.AT_SHOW_PRICES,te.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[te.AT_SHOW_PRICES]:!0}},FiftyPercentLine:{editable:[te.AT_LINE,te.AT_LINE_2,te.AT_SHOW_PRICES,te.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[te.AT_SHOW_PRICES]:!0}},FibonacciRetracement:{editable:fi,defaults:mi(1)},TrendBasedFibExtension:{editable:fi,defaults:mi(5)},FibonacciFan:{editable:hi},FibonacciArcs:{editable:hi},GannFan:{editable:hi},SpeedResistanceFan:{editable:hi},SpeedResistanceArcs:{editable:hi},AndrewsPitchfork:{editable:hi},Rectangle:{editable:pi},Ellipse:{editable:pi},TrendChannel:{editable:hi},SymbolArrowUp:{editable:di},SymbolArrowDown:{editable:di},SymbolArrowRight:{editable:di},SymbolArrowLeft:{editable:di},SymbolArcDown:{editable:di},SymbolArcUp:{editable:di},SymbolThumbsUp:{editable:di},SymbolThumbsDown:{editable:di},SymbolZero:{editable:di},SymbolOne:{editable:di},SymbolTwo:{editable:di},SymbolThree:{editable:di},SymbolFour:{editable:di},SymbolFive:{editable:di},SymbolSix:{editable:di},SymbolSeven:{editable:di},SymbolEight:{editable:di},SymbolNine:{editable:di},SymbolQuestion:{editable:di},SymbolFishHook:{editable:di},FibonacciTimeZones:{editable:[te.AT_LINE]},Text:{editable:di},ComputedText:{editable:[te.AT_LINE,te.AT_FILL,te.AT_ALLOW_PRICES_CHANGE_UI]}};function yi(t){return t?gi[t].editable:gi}var vi=i(17),bi=i(18),Ti=i(19),Si=i(20),Ai=i(21);function Pi(t){switch(t){case te.CHART_SCHEMA:return vi;case te.STUDIES_SCHEMA:return bi;case te.FIELDS_SCHEMA:return Ti;case te.ACCESSOR_SCHEMA:return Si;default:throw new Error("Unknown schema name: ".concat(t))}}let wi=null;function Ci(){return wi||(wi=Hn(Ai,te.STUDIES_SCHEMA))}function xi(t){return et(Ci().find(e=>e.id===t))}function Mi(t){const e=[Wn.Open,Wn.High,Wn.Low,Wn.Close].map(t=>t.id),i=t.defaults.source&&!e.includes(t.defaults.source);return["CHAMF","EMV","FI","MFI","CLV","OBVOL","PVT","NVI","PVI","VOL"].includes(t.id)||i}function Ei(t,e){const i=e.id;if(["GPMI","GTPI","CTM"].includes(i)&&t!==C.GBE)return!1;return t===C.DemoSite||!["MACDSIG","MASIG"].includes(i)}function Oi(){const t=[f.Study,f.BalanceSheet,f.IncomeStatement];let e=t.reduce((t,e)=>(t[e]=[],t),{});Object.keys(Wn).map(t=>Wn[t]).filter(e=>t.includes(e.category)).map(t=>{e[t.category].push({id:t.id,name:t.name})});const i=Object.keys(c).filter(t=>{const e=parseInt(t);if(Number.isFinite(e)&&e<=c.Renko)return c[e]}),n=im(),s=K(n)?C[n.config.mode]:C.Unspecified,r=et(Ci()).filter(D(Ei,s)).sort((t,e)=>t.meta.overlay===e.meta.overlay?t.meta.title<e.meta.title?-1:1:t.meta.overlay<e.meta.overlay?1:-1),o=yi(),a=Object.keys(o).map(t=>({id:t,options:o[t].editable}));return{studies:r,incomeStatements:e[f.IncomeStatement],balanceSheets:e[f.BalanceSheet],studyFields:e[f.Study],curveStyles:i,annotations:a}}var Di=i(22),Li=i.n(Di);function Ii(t,e,i){return[].concat(Li()(e,t,i))}var _i=function(t,e,i){let n=et(t),s=Ii(n,e),r=s.map(i);if(r.some(t=>void 0===t))throw new Error("Forgot to return transformed value from accessor ".concat(i));return function t(e,i,n){if(function(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t}(e))return e;if(Array.isArray(e))return e.map(e=>t(e,i,n)).filter(t=>t!==te.NULL_OBJECT);{let s=i.indexOf(e);if(-1!==s)return n[s];let r={};for(let s in e){const o=e[s];r[s]=t(o,i,n)}return r}}(n,s,r)};const Ni=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function Ri(t){return 1===t.length}function ki(t){return 1===t.length}const Hi={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"};const Fi={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}};const Ui={_3to4:function(t){const e=t.data.period;if(null!==e){const i="Max"===e?te.AUTOFIT_PERIOD:"P".concat(e),n=Ni.findIndex(t=>t===e);let s={unit:"Day"};n<2?s={unit:"Intraday",size:15}:n>5&&(s={unit:"Month"}),delete t.data.period,t.display.period=i,t.data.aggregation=s,t.version=4}return t},_4to5:function(t){const e=Ii(t,'..panes[0]..plots{.type === "Symbol"}[0].curves{.style === "Candlestick" && .attributes === "Hollow" }');if(1===e.length){const t=e[0];t.attributes.splice(t.attributes.indexOf("Hollow"),1),0===t.attributes.length&&delete t.attributes,t.style="HollowCandles",t.colors=et(te.COLOR_DEFAULT_VARY)}return t.version=5,t},_5to6:function(t){const e=Ii(t,'..panes[0]..plots{.type === "Symbol"}[0]');if(1===e.length){e[0].main=!0}return t.version=6,t},_6to7:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["MAENV","BBANDS","KELCHN","KELEXP","DONCHN"]});return e.length>0&&e.forEach(t=>{if(t.curves&&t.curves.length>1){const e=t.curves.length-1,i=Be(t.curves[e].colors[0]);i.a=.1,t.curves.push({colors:[Ve(i)],fields:t.curves[0].fields.concat(t.curves[e].fields),lineWidth:0,style:c[c.Ribbon]})}}),t.version=7,t},_7to8:function(t){const e=Ii(t,'..plots{.type === "Study" && (.study === "ADX" || .study === "ADXMOD")}');return e.length>0&&e.forEach(t=>{if(t.inputs&&1===t.inputs.length&&t.inputs[0].name===te.INPUT_PERIOD){const e=t.inputs[0].value;t.inputs=[{name:"AdxSmoothing",value:e},{name:"DiLength",value:e}]}}),t.version=8,t},_8to9:function(t){const e=Ii(t,".display.yAxis");if(Ri(e)){if(!Ri(Ii(e,".minorGridLines"))){const t=Ii(im().template,".display.yAxis.minorGridLines");Ri(t)&&(e[0].minorGridLines=t[0])}}return t.version=9,t},_9to10:function(t){const e=".display.navigator",i=Ii(t,e);if(ki(i)){if(!ki(Ii(i,".enabled"))){const t=Ii(im().template,e+".enabled");ki(t)&&(i[0].enabled=t[0])}}return t.version=10,t},_10to11:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === "TCHN"}');return e.length>0&&e.forEach(t=>{if(t.inputs&&1===t.inputs.length&&t.inputs[0].name===te.INPUT_PERIOD){const e=t.inputs[0].value;t.inputs=[{name:"PeriodUpper",value:e},{name:"PeriodLower",value:e},{name:"Range",value:"High/Low"}]}}),t.version=11,t},_11to12:function(t){const e=Ii(t,".display.navigator");if(1===e.length){const t=e[0];t.visible=t.enabled&&t.visible||!1,delete t.enabled}return t.version=12,t},_12to13:function(t){return Ii(t,"..annotations").forEach(t=>{if("AndrewsPitchfork"===t.id){const[e,i,n]=t.points;t.points=[i,e,n]}}),t.version=13,t},_13to14:function(t){const e=Ii(t,".display");if(1===e.length){const t=e[0];t.scrollbar.visible=t.navigator.visible||!1,delete t.navigator}return t.version=14,t},_14to15:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=t=>Hi.hasOwnProperty(t)?Hi[t]:t;return e.length>0&&e.forEach(t=>{t.curves&&t.curves[0].fields&&(t.curves[0].fields=t.curves[0].fields.map(i)),t.inputs&&(t.inputs=t.inputs.map(t=>(t.name=i(t.name),t))),t.study=i(t.study)}),t.version=15,t},_15to16:function(t){const e=Ii(t,"..annotations"),i=t=>({shown:!1,value:t}),n=[-.618,-.236].map(i),s=[1.272,1.618,2.618].map(i);return e.forEach(t=>{if("FibonacciRetracement"===t.id){const e=t.traits;if(K(e)&&K(e[te.AT_FACTORS])){const t=li(null,"FibonacciRetracement")[te.AT_FACTORS],i=e[te.AT_FACTORS].map((e,i)=>{const n=!K(e);return{shown:!n,value:n?t[i+2].value:e}});e[te.AT_FACTORS]=n.concat(i).concat(s)}}}),t.version=16,t},_16to17:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return e.length>0&&e.forEach(t=>{const e="STOCHM"===t.study,i=xi(e?"STOCHS":t.study);K(t.inputs)?t.inputs.push({name:"Smoothing",value:e?"EMA":"MA"}):t.inputs=i.defaults.inputs.map(t=>("Smoothing"===t.name&&e&&(t.value="EMA"),t)),e&&(t.study="STOCHS")}),t.version=17,t},_17to18:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return e.length>0&&e.forEach(t=>{if(K(t.curves)&&3===t.curves.length){const e=et(Fi[t.study]);t.curves.push(e)}}),t.version=18,t},_18to19:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["REATRHI","REATRLO"]});return e.length>0&&e.forEach(t=>{t.inputs&&4===t.inputs.length&&t.inputs.push({name:"FactorATR",value:2})}),t.version=19,t},_19to20:function(t){const e=Ii(t,".display.yAxis");if(1===e.length){const t=e[0];K(t.showLastValue)&&(t.showLastValue=t.showLastValue?"All":"None")}return t.version=20,t},_20to21:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["CTMF","TPI"]});return e.length>0&&e.forEach(t=>{const e="CTMF"===t.study?"GPMI":"GTPI";t.study=e,t.curves&&t.curves.length>0&&(t.curves.splice(1,1),t.curves[0].fields=[e])}),t.version=21,t},_21to22:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === "AWEOSC"}');return e.length>0&&e.forEach(t=>{if(t.curves&&t.curves.length>0&&t.curves[0].zones){const e=t.curves[0];delete e.zones,e.varyColorPerBar=!0}}),t.version=22,t},_22to23:function(t){const e=t.display.yAxis;return delete e.minPadding,delete e.maxPadding,t.version=23,t},_23to24:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === "GTPI"}');return e.length>0&&e.forEach(t=>{if(t.curves&&t.curves.length>0){const e=t.curves[0];e.colors=["#ef4226","#2642ef"],e.zones=[{value:50,colors:1,gradient:"linDarken"},{colors:1,gradient:"linLighten"}]}}),t.version=24,t},_24to25:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === "MOM"}');if(e.length>0){const t=xi("MOM");e.forEach(e=>{e.curves&&1===e.curves.length&&2===t.defaults.curves.length&&e.curves.push(t.defaults.curves[1]),e.inputs&&1===e.inputs.length&&2===t.defaults.inputs.length&&e.inputs.push(t.defaults.inputs[1])})}return t.version=25,t},_25to26:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:["MA","MAEXP"]});return e.length>0&&e.forEach(t=>{t.source&&delete t.source,t.inputs&&1===t.inputs.length?t.inputs.push({name:"Source",value:"Close"}):t.inputs=xi(t.study).defaults.inputs}),t.version=26,t},_26to27:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === "ATR"}');if(e.length>0){const t=xi("ATR");e.forEach(e=>{e.curves&&1===e.curves.length&&2===t.defaults.curves.length&&e.curves.push(t.defaults.curves[1]),e.inputs&&2===e.inputs.length&&3===t.defaults.inputs.length&&e.inputs.push(t.defaults.inputs[2])})}return t.version=27,t},_27to28:function(t){const e=Ii(t,'..plots{.type === "Study"}'),i=xi("ALLG");return e.length>0&&e.forEach(t=>{delete t.shift,"ALLG"===t.study&&t.curves&&t.curves.forEach(t=>{const e=(t=>{const e=i.defaults.curves.find(e=>e.fields[0]===t.fields[0]);return K(e)?e.shift:null})(t);K(e)&&(t.shift=e)})}),t.version=28,t},_28to29:function(t){const e=Fn(_i(t,'..plots{.type === "Study" && .study === "DEMARK"}',t=>te.NULL_OBJECT));return e.version=29,e},_29to30:function(t){const e=Fn(_i(t,'..plots{.type === "Study" && .study === "ULTOSC"}',t=>te.NULL_OBJECT));return e.version=30,e},_30to31:function(t){const e=Ii(t,"..annotations"),i=te.AT_LINE_2;return e.forEach(t=>{if("FibonacciRetracement"===t.id){const[e,n]=t.points;e.time>n.time&&(t.points=[n,e]);const s=t.traits;if(K(s)){const t=li(null,"FibonacciRetracement");s[i]=t[i]}}}),t.version=31,t},_31to32:function(t){return t.version=32,t},_32to33:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === $studies}',{studies:Oi().studies.filter(t=>!0===t.meta.shiftable).map(t=>t.id)});return e.length>0&&e.forEach(t=>{const e=t.curves[0].shift||0;t.curves.forEach(t=>delete t.shift),t.inputs&&t.inputs.push({name:"Offset",value:e})}),t.version=33,t},_33to34:function(t){const e=Ii(t,'..plots{.type === "Study" && .study === "VWAP"}'),i=xi("VWAP");return e.length>0&&e.forEach(t=>{K(t.inputs)||(t.inputs=i.defaults.inputs.slice()),1===t.curves.length&&t.curves.push(...i.defaults.curves.slice(1))}),t.version=34,t}};function Bi(t,e){if(e===te.CHART_SCHEMA){const i=Ii(Pi(e),".properties.version.minimum")[0],n=t.version;if(n<i)return function(t,e,i){let n=t;for(;e<i;){n=(0,Ui["_".concat(e,"to").concat(e+1)])(n),e+=1}return n}(t,n,i)}return t}function Vi(t,e){yt(2,arguments);var i=vt(t),n=vt(e);return i.getFullYear()===n.getFullYear()}function Wi(t,e){yt(1,arguments);var i=e||{},n=i.locale,s=n&&n.options&&n.options.weekStartsOn,r=null==s?0:Pt(s),o=null==i.weekStartsOn?r:Pt(i.weekStartsOn);if(!(o>=0&&o<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var a=vt(t),l=a.getDay(),c=(l<o?7:0)+l-o;return a.setDate(a.getDate()-c),a.setHours(0,0,0,0),a}function ji(t,e,i){yt(2,arguments);var n=Wi(t,i),s=Wi(e,i);return n.getTime()===s.getTime()}function Gi(t,e){yt(2,arguments);var i=vt(t),n=vt(e);return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()}function zi(t){yt(1,arguments);var e=vt(t),i=e.getMonth(),n=i-i%3;return e.setMonth(n,1),e.setHours(0,0,0,0),e}function Yi(t,e){yt(2,arguments);var i=zi(t),n=zi(e);return i.getTime()===n.getTime()}function qi(t){let e=function(t){return{unit:tt(t,"Day","unit"),size:tt(t,1,"size"),spec:tt(t,"None","spec"),isContractVolume:tt(t,!1,"isContractVolume"),dividendsAdjust:tt(t,!1,"dividendsAdjust"),backAdjust:tt(t,!1,"backAdjust"),daysToExpiration:tt(t,1,"daysToExpiration"),contractRoll:tt(t,"expiration","contractRoll")}}(t);return new Ji(u[e.unit],e.size,h[e.spec],e.isContractVolume,e.dividendsAdjust,e.backAdjust,e.daysToExpiration,e.contractRoll)}function $i(t,e){return Tt(t,e)&&Ki(t,e)}function Xi(t,e){return ji(t,e)&&Ki(t,e)}function Ki(t,e){return Gi(t,e)&&Vi(t,e)}function Zi(t,e){return Yi(t,e)&&Vi(t,e)}function Qi(t,e){return+t==+e}class Ji{constructor(t=u.Day,e=1,i=h.None,n=!1,s=!1,r=!1,o=1,a="expiration"){this.unit=t,this.size=e,this.spec=i,this.isContractVolume=n,this.dividendsAdjust=s,this.backAdjust=r,this.daysToExpiration=o,this.contractRoll=a}isKnownMinute(t){return-1!==Ji.KNOWN_MINUTES.indexOf(t)}getHashKey(){return"[".concat(this.unit,":").concat(this.size,":").concat(this.spec,":").concat(this.isContractVolume,":").concat(this.dividendsAdjust,":").concat(this.backAdjust,":").concat(this.daysToExpiration,":").concat(this.contractRoll,"]")}unitToString(){let t="";switch(this.unit){case u.Tick:t="Tick";break;case u.Intraday:t=this.isKnownMinute(this.size)?60===this.size?"Hourly":"".concat(this.size<10?" ":"").concat(this.size," minute").concat(this.size>1?"s":""):"Custom Intraday";break;case u.Day:t="Daily";break;case u.Week:t="Weekly";break;case u.Month:t="Monthly";break;case u.Quarter:t="Quarterly";break;case u.Year:t="Yearly"}return t}describe(){let t=this.unitToString();switch(this.spec){case h.Nearest:t+=" Nearest";break;case h.Continue:t+=" Continue";break;case h.PerCount:t="Ticks Per Bar";break;case h.PerVolume:t="Volume Per Bar";break;case h.PerRange:t="Range Per Bar";break;case h.PerSeconds:t="Seconds Per Bar";break;case h.None:case h.FormT:}return t}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===u.Tick}get isIntraday(){return this.unit===u.Intraday}get isMultiContract(){return this.isEndOfDay&&(this.spec===h.Nearest||this.spec===h.Continue)}}function tn(t){delete t.display.chart.bar}function en(t){K(t.display.xAxis.visibleRange)&&delete t.display.xAxis.visibleRange,K(t.data.range)&&delete t.data.range,delete t.checkRange}function nn(t){In(t.display.period)&&delete t.display.period}function sn(t){K(t.display.density)&&delete t.display.density}Ji.KNOWN_MINUTES=[1,2,3,5,10,15,30,60];function rn(t){switch(c[t]){case c.OHLC:case c.HLC:case c.Candlestick:case c.HollowCandles:case c.HeikinAshi:case c.ElderImpulseSystem:return!0;default:return!1}}function on(t,e){switch(t){case v.Symbol:case v.Expression:return function(t,e){const i=im().getDefaultMultiFieldCurve();if(null!==i&&i.style===t)return i;const n=t=>t.id,s=[Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Change].map(n);c[t]===c.HLC&&s.splice(0,1);const r=[Wn.Close].map(n),o=et(te.COLOR_DEFAULT_AREA),a=et(te.COLOR_DEFAULT_OHLC),l=et(te.COLOR_DEFAULT_VARY);let u={fields:s,colors:l,lineWidth:1,visible:!0};switch(c[t]){case c.OHLC:case c.HLC:case c.Renko:u.colors=e?l:[a];break;case c.Candlestick:case c.HollowCandles:case c.HeikinAshi:break;case c.ElderImpulseSystem:u.colors=l.concat(o);break;case c.Line:u.fields=r,u.colors=[a];break;case c.Area:{u.fields=r;let t=Be(o);t.a=.5,u.colors=[Ve(t),o];break}case c.Column:u.fields=r;break;default:throw new Error('Curve style "'.concat(t,'" is not supported here.'))}return u}(e.style||c[c.Candlestick],e.varyColorPerBar);case v.Forward:case v.Seasonal:return{fields:["Close","Change"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};case v.Annual:return{colors:["#00b04b"],fields:["Close","Change"],style:"Line",lineWidth:2,visible:!0,varyColorPerBar:!1};default:throw new Error("Unexpected plot type '".concat(v[t],"', don't know its default curve."))}}function an(t,e){var i;Object.keys(t).length>0&&(t.varyColorPerBar=t.varyColorPerBar||function(t){switch(c[t]){case c.Candlestick:case c.HollowCandles:case c.HeikinAshi:case c.ElderImpulseSystem:case c.Column:case c.Renko:return!0;default:return!1}}(t.style)||void 0!==(i=t.attributes)&&i.length>0&&i.some(t=>t===l[l.ChangeBased]||t===l[l.OpenVsClose]));const n=on(v[e],t);return lt(n,t),n}var ln=function(t,e){const i=e.curves[0],n=An(t),s=an(i,e.type);n.curves=[s],e.type===v[v.Annual]&&n.curves.push({colors:["#8b6038"],fields:["Close"],style:"Line",lineWidth:2,visible:!0,varyColorPerBar:!1}),e.type===v[v.Symbol]&&K(i)&&i.style===c[c.Renko]&&K(e.inputs)&&(n.inputs=e.inputs);const{mainAxis:r}=Pn(t);return rn(i.style)&&(r.comparison=g[g.None]),t},cn=i(23);let un=new Map;const hn=/\w[:]\w/;function dn(t,e=!1,i=!0){const n=t.trim();if(e&&un.has(n))return et(un.get(n));try{const s=cn.parse(n);let r=gn(s);i&&function(t,e){if(t.some(t=>t.includes(":"))){return fn(e,(t,e,i)=>{const n=(t,e=null,i="sym")=>({op:i,left:t,right:e});if("sym"!==t.op||!hn.test(e))return;const s=e.split(":");t.op="grp",t.left=n(n(s[0]),n(s[1]),"-")}),!0}return!1}(r,s)&&(r=gn(s));const o={text:t,model:s,clean:mn(s),symbols:r};return e&&un.set(n,o),o}catch(e){const i=e.location.start;return{text:t,error:"".concat(e.message," \nLocation: line ").concat(i.line,", column ").concat(i.column,".")}}}function pn(t,e){return fn(t,function(t){return(e,i,n)=>{if(bn(e))switch(e.op){case"-":return-i;case"grp":return i;case"sym":return t(i);case"num":return i;default:throw new Error("Unrecognized unary operator ".concat(e.op))}else switch(e.op){case"+":return i+n;case"-":return i-n;case"*":return i*n;case"/":return i/n;case"^":return Math.pow(i,n);default:throw new Error("Unrecognized binary operator ".concat(e.op))}}}(e))}function fn(t,e){if(!K(t))return null;const i=typeof t;if("number"===i||"string"===i)return t;return e(t,fn(t.left,e),fn(t.right,e))}function mn(t){return fn(t,Tn)}function gn(t){let e=new Set;return fn(t,(t,i,n)=>{"sym"===t.op&&e.add(i)}),Array.from(e)}function yn(t){let e=0;const i=["+","-","*","/","^"];return fn(t,(t,n,s)=>{i.includes(t.op)&&e++}),e>0}function vn(t,e){const i=et(t);return fn(i,(t,i,n)=>{"sym"===t.op&&(t.left=e(i))}),i}function bn(t){return!K(t.right)}function Tn(t,e,i){if(bn(t))switch(t.op){case"-":return"".concat(t.op).concat(e);case"grp":return"(".concat(e,")");case"sym":return"{".concat(e,"}");case"num":return e.toString();default:throw new Error("Unrecognized unary operator ".concat(t.op))}else switch(t.op){case"+":case"-":case"*":case"/":case"^":return"".concat(e," ").concat(t.op," ").concat(i);default:throw new Error("Unrecognized binary operator ".concat(t.op))}}const Sn="..plots{.main === true}";function An(t){return Ii(t,Sn)[0]}function Pn(t){const e=Ii(t,"..panes{".concat(Sn,"}"))[0];return{mainPane:e,mainAxis:Ii(e,"..axes{".concat(Sn,"}"))[0]}}const wn="Symbol",Cn="Expression",xn="Forward",Mn="Seasonal",En="Annual",On=[wn,Cn,xn,Mn,En];function Dn(t){const{error:e,clean:i,symbols:n}=dn(t),s=K(e),r=s?0:n.length;return{clean:i,hasErrors:s,symbolCount:r,firstSymbol:r>0?n[0]:null,error:e}}var Ln=function(t,e){const i=An(t),n=t=>i.type===t,s=t=>K(e[t.toLowerCase()]),r=On.find(t=>s(t)),o=r.toLowerCase();let a=e[o];const l=a===te.PLACEHOLDER_SYMBOL_NAME,c=s(Cn)||s(xn)||s(Mn),u=On.some(t=>s(t)&&!n(t)),h=im().config.cachedAnnotationsCount||0,d=h>0,{mainAxis:p}=Pn(t);u&&(p.comparison=g[s(En)?g.Value:g.None]);const f=Dn(a),m=t=>{throw new Error(t)};l||(c?(f.hasErrors&&m('[Main Plot] "'.concat(a,'" is an invalid expression.\n').concat(f.error)),a=f.clean):f.hasErrors||m('[Main Plot] "'.concat(a,'" is an expression, unsupported for ').concat(e.plotType,".")));const y=(t,e)=>t.findIndex(t=>t.symbol===e),v=t=>{const e=p.annotations||[],i=p.annCache||[],n=y(i,t);if(-1!==n&&i.splice(n,1),e.length>0){const n={symbol:t,annotations:e};i.length+1>h&&i.splice(0,i.length+1-h),i.push(n)}p.annCache=i},b=t=>{const e=p.annCache||[],i=y(e,t);-1!==i&&(p.annotations=e[i].annotations)};if(d){if(n(wn))v(i.symbol);else if(n(Mn)){const t=Dn(i.seasonal);1===t.symbolCount&&v(t.firstSymbol)}delete p.annotations,s(wn)?b(e.symbol):s(Mn)&&1===f.symbolCount&&b(e.seasonal)}const T=s(Cn)&&n(wn)||s(wn)&&n(Cn);let S=_i(t,Sn,t=>(u&&(delete t.expression,delete t.symbol,delete t.showPrevious,delete t.forward,delete t.offsets,delete t.seasonal,delete t.annual,t.type=r,T||(t.curves=[{}]),(s(xn)||s(Mn))&&(t.offsets=[0])),t[o]=a,t));if(u)if(s(xn))S.data.aggregation={unit:"Month"},S.display.period="P10Y";else if(!s(Mn)&&!s(En)||S.data.aggregation.isEndOfDay){if(n(xn)||n(Mn)||n(En)){S.data.aggregation=im().getDefaultAggregation(),S.data.maxDataPoints=te.DEFAULT_MAX_RECORDS;const t=im().getDefaultPeriod();K(t)&&(S.display.period=t)}}else S.data.aggregation={unit:"Day"},s(En)&&(S.data.maxDataPoints=te.US_TRADING_DAYS_PER_YEAR),S.display.period=s(Mn)?"P9M":"P1Y10D";const A=new Map([['..plots{.type === "Study"}',t=>{const e=Mi(xi(t.study));return s(xn)||s(Mn)||s(En)||s(Cn)&&e?te.NULL_OBJECT:t}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',t=>s(wn)?(t.symbol=a,t):te.NULL_OBJECT],["..plots{..events}",t=>(s(wn)||delete t.events,t)]]);for(const[t,e]of A)S=_i(S,t,e);return u&&!T&&(S=ln(S,{type:r,curves:[{}]})),S=Fn(S),S};function In(t){return K(t)&&t!==te.AUTOFIT_PERIOD}var _n=function(t){const e=Ii(t,"..axes{.annotations{.points{!.price || !.time}}}");e.length>0&&e.forEach(t=>{const e=t.annotations.map(t=>{const e=t.points.find(t=>K(t.price)),i=t.points.find(t=>K(t.time));return K(e)&&K(i)?(t.points.forEach(t=>{K(t.price)||(t.price=e.price),K(t.time)||(t.time=i.time)}),t):null}).filter(t=>K(t));e.length>0?t.annotations=e:delete t.annotations});const i=Ii(t,"..panes"),n=t=>K(t.height)?t.height:1,s=i.map(t=>n(t)),r=Math.min(...s),o=r<.01?5/r:1;i.forEach(t=>t.height=Z(o*n(t),4));const a=im().config.showResizeHandles||!1;t.display.xAxis.resizeHandles=a;let l=im().config.scrollBehavior||"wheel+shift";Object.values(M).filter(t=>"string"==typeof t).includes(l)||(l="wheel+shift"),t.display.scrollBehavior=l;const u=Ii(t,'..plots{.type === "Study" && .study === "RSI"}');var h;return u.length>0&&u.forEach(t=>{if(K(t.bands)&&t.bands.length>0){const e=t.inputs&&1===t.inputs.length&&t.inputs[0].name===te.INPUT_PERIOD?t.inputs[0].value:null,i=xi("RSI").defaults;t.curves=i.curves,t.inputs=i.inputs,K(e)&&(t.inputs[0].value=e),delete t.bands,t.levels=i.levels}}),(h=t).display.density?(nn(h),en(h)):In(h.display.period)&&en(h),function(t){const e=tt(t.display,null,"chart","bar");if(K(e)){const[t,i]=dt(e.width||0,e.spacing||0,te.MINIMUM_BAR_WIDTH,te.MAXIMUM_BAR_WIDTH);e.width=t,e.spacing=i}}(t),function(t){t.display.period&&"YTD"===t.display.period&&delete t.display.period}(t),function(t){const e=Ii(t,"..annotations{.traits.fill.color === null}");e.length>0&&e.forEach(t=>{t.traits.fill.color="rgba(0, 0, 0, 0)"})}(t),function(t){const{from:e,to:i}=t.display.xAxis.visibleRange||{},n=null===e,s=null===i;n&&delete t.display.xAxis.visibleRange.from,s&&delete t.display.xAxis.visibleRange.to,n&&s&&delete t.display.xAxis.visibleRange}(t),function(t){const e=Ii(t,"..panes[0].axes[0].scale");if(1===e.length){const i=e[0],n=Ii(t,"..panes[0]..axes");n.length>0&&n.forEach(t=>t.scale=i)}}(t),function(t){const[e]=Ii(t,Sn);K(e)&&e.type===v[v.Symbol]&&e.curves[0].style!==c[c.Renko]&&K(e.inputs)&&delete e.inputs}(t),t},Nn=i(24),Rn=i.n(Nn);let kn=null;function Hn(t,e){null===kn&&(kn=Rn()(),kn.defaultOptions.useDefault=!0,[te.CHART_SCHEMA,te.STUDIES_SCHEMA,te.FIELDS_SCHEMA,te.ACCESSOR_SCHEMA].forEach(t=>{kn.addSchema(t,Pi(t))}));let i=Bi(t,e);(function(t){return t===te.CHART_SCHEMA})(e)&&(Ii(i,'..plots{.type==="'.concat(v[v.Study],'"}')).forEach(t=>{const e=xi(t.study);K(e)&&st(t,e.defaults)}),i=_n(i));let n=kn.validate(e,i);if(!!n)throw new Error("Document not valid according to schema ".concat(e,"; error is ").concat(JSON.stringify(n,null,4)));return function(t){return t===te.ACCESSOR_SCHEMA}(e)&&function(t){const{id:e,context:i}=t,n=t=>K(i[t]),s=(t,e)=>{if(!K(i[t]))throw new Error("".concat(e," plot accessor: you must provide '").concat(t,"'"))},r=t=>{if(n("placement")&&"clone"===i.placement&&!n("cloneIndex"))throw new Error("".concat(t," plot accessor: when placement is 'clone', you must provide 'cloneIndex'."))};if("Plot"===e)switch(i.id){case"Add":switch(s("type","Add"),i.type){case"Study":s("studyId","Add"),r("Add");break;case"IncomeStatement":case"BalanceSheet":s("fundamentalId","Add");break;case"Expression":s("expression","Add")}break;case"Get":if(!n("main")&&!n("type"))throw new Error("Get plot accessor: you must provide either 'main' or 'type'");break;case"Delete":s("type","Delete"),s("index","Delete");break;case"Update":switch(s("type","Update"),n("main")||s("index","Update"),r("Update"),i.type){case"Forward":if(!K(i.forward)){if(!K(i.curves)||!K(i.offsets))throw new Error("Update forward plot accessor: you must provide either 'forward' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length)throw new Error("Update forward plot accessor: you must provide same number of elements for 'curves' and 'offsets'")}break;case"Seasonal":if(!K(i.seasonal)){if(!K(i.curves)||!K(i.offsets))throw new Error("Update seasonal plot accessor: you must provide either 'seasonal' or 'curves' and 'offsets'");if(i.curves.length!==i.offsets.length&&i.curves.length!==i.offsets.length+1)throw new Error("Update seasonal plot accessor: you must provide either same number of elements for 'curves' and 'offsets' or one curve more")}break;case"Study":{s("studyId","Update"),r("Update");const t=t=>t.reduce((t,e)=>t.concat(e.fields),[]),e=xi(i.studyId),n=t=>"Update study plot accessor: you must provide same number of elements for '".concat(t,"' of the study as defined in the taxonomy"),o=t=>"Update study plot accessor: incoming list of ".concat(t," is different from the ").concat(t," as defined in the taxonomy");if(!K(i.curves)||i.curves.length!==e.defaults.curves.length)throw new Error(n("curves"));const a=t(i.curves);if(0!==U(t(e.defaults.curves),a).length)throw new Error(o("fields"));break}}}}(i),i}function Fn(t){let e=_i(t,"..axes{!.plots}",t=>te.NULL_OBJECT);return _i(e,"..panes{!.axes}",t=>te.NULL_OBJECT)}var Un=i(25);class Bn{constructor(t,e=d.Number,i=f.Common,n=null,s=p.FromMetaData,r=null){this.id=t,this.type=e,this.category=i,this.name=n,this.format=s,null===n&&(this.name=this.id.replace(/([A-Z])/g," $1").trim()),this.shortName=r||this.name}}let Vn=null;const Wn=function(){if(!Vn){Vn={};Hn(Un,te.FIELDS_SCHEMA).map(t=>new Bn(t.id,d[t.type],f[t.category],t.name,p[t.format],t.shortName)).forEach(t=>{Vn[t.id]=t})}return Vn}(),jn={CH_ALL:"ch",CH_RECREATED:"ch.recreated",CH_ANNOTATIONCHANGED:"ch.annotationchanged",CH_ANNNEEDSCONTEXTMENU:"ch.annneedscontextmenu",CH_CHTNEEDSCONTEXTMENU:"ch.chtneedscontextmenu",CH_ANNSELECTIONCHANGED:"ch.annselectionchanged",CH_ANNPOINTPICKED:"ch.annpointpicked",CH_PANEHEIGHTSCHANGED:"ch.paneheightschanged",CH_PANESREORDERED:"ch.panesreordered",CH_NODATAFORMAINSYMBOL:"ch.nodataformainsymbol",CH_CARDPLOTCLICKED:"ch.cardplotclicked",CH_CARDPLOTREMOVED:"ch.cardplotremoved",CH_TOOLTIPCHANGED:"ch.tooltipchanged",CH_LOGOCLICKED:"ch.logoclicked",CH_SHUTDOWN:"ch.shutdown",CH_ZOOMCHANGED:"ch.zoomchanged",CH_ALL_DATA_PROJECTED:"ch.all.data.projected",CH_API_ACTIONS_RECEIVED:"ch.api.actions.received",DF_ALL:"df",DF_STREAMRECONNECTED:"df.streamreconnected",TS_ALL:"ts",TS_LOADING:"ts.loading",TS_MANYCHANGED:"ts.manychaged",TS_DATAPOINTADDED:"ts.datapointadded",TS_DATAPOINTCHANGED:"ts.datapointchanged",TS_EVENTSCHANGED:"ts.eventschanged",MD_ALL:"md",MD_CHANGED:"md.changed",RT_ALL:"rt",RT_QUOTE:"rt.quote",RT_TRADE:"rt.trade",RT_VOLUME:"rt.volume",TL_CHANGED:"tl.changed",ME_ALL:"me",ME_MOUSE_OUT_SERIES:"me.mouse.out.series",ME_MOUSE_OVER_SERIES:"me.mouse.over.series"},Gn=[Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Volume,Wn.Change,Wn.PercentChange,Wn.PreviousClose].reduce((t,e,i)=>(t.set(e.id,1<<i),t),new Map);function zn(...t){return t.reduce((t,e)=>Gn.has(e.id)?t|Gn.get(e.id):t,0)}class Yn{constructor(){this.storage=new Map,this.isValid=!1,this.resetUpdated()}get updated(){return this._updated}resetUpdated(){this._updated=0}addFields(...t){this.fields=function(t,e){let i=t?t.slice():new Array;return e.forEach(t=>{i.includes(t)||i.push(t)}),i}(this.fields,t),this.fields.forEach(t=>{this.storage.has(t.id)||this.storage.set(t.id,null)})}update(t,e){if(this.hasField(t)){const i=t.id,n=this.storage.get(i);this.storage.set(i,e);const s=n!==e;return s&&Gn.has(i)&&(this._updated=this._updated|Gn.get(i)),s}}computeWellKnown(){const t=this.getValue(Wn.Close),e=this.getValue(Wn.PreviousClose);K(t,e)&&(this.hasField(Wn.Change)&&this.update(Wn.Change,t-e),this.hasField(Wn.PercentChange)&&this.update(Wn.PercentChange,(t-e)/e))}hasField(t){return K(this.fields)&&this.fields.includes(t)}hasSymbol(t){return!1}getValue(t){return this.hasField(t)?this.storage.get(t.id):null}shutdown(){}}class qn extends Yn{constructor(t){super(),this.symbol=t,this.translated=ue(this.symbol)}hasSymbol(t){return this.symbol===t}}class $n extends Yn{async ready(){return!1}}const Xn={previousClose:Wn.PreviousClose,previousHigh:Wn.PreviousHigh,previousLow:Wn.PreviousLow,weeklyPreviousClose:Wn.WeekPreviousClose,weeklyPreviousHigh:Wn.WeekPreviousHigh,weeklyPreviousLow:Wn.WeekPreviousLow,monthlyPreviousClose:Wn.MonthPreviousClose,monthlyPreviousHigh:Wn.MonthPreviousHigh,monthlyPreviousLow:Wn.MonthPreviousLow},Kn=Object.values(Xn),Zn=Object.keys(Xn);class Qn extends qn{async ready(){return Qt.call(this,async()=>{const t=im().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await t.ready(),this.isValid})}shutdown(){}getValue(t){return this.hasField(t)&&Kn.includes(t)&&null===super.getValue(t)&&!K(this.triedFetchingPreviousValues)&&this.supplementPreviousValues(),super.getValue(t)}supplementPreviousValues(){this.triedFetchingPreviousValues=!0,Qf("ondemand","/getQuote.json?symbols=".concat(this.translated,"&fields=").concat(Zn.join(","))).then(t=>{try{const e=JSON.parse(t);if(200===e.status.code&&1===e.results.length){const t=e.results[0];Zn.forEach(e=>this.update(Xn[e],t[e])),im().getRecordSource().subject.next({topic:jn.RT_QUOTE,data:{symbol:this.symbol}})}}catch(t){}})}}class Jn extends qn{addOptionalField(t,e){K(e)&&(this.addFields(t),this.update(t,e))}async ready(){return Qt.call(this,async()=>{const t=Wt("#".concat(te.INLINE_DATA_ELEMENT_ID));if(K(t)){const e=JSON.parse(t);if(this.translated in e){const t=e[this.translated].quote;this.update(Wn.Open,t.open),this.update(Wn.High,t.high),this.update(Wn.Low,t.low),this.update(Wn.Close,t.close),this.update(Wn.PreviousClose,t.previousClose),this.update(Wn.Volume,t.volume),Zn.filter(t=>"previousClose"!==t).forEach(e=>{this.addOptionalField(Xn[e],t[e])}),this.isValid=!0}else this.isValid=!1}else this.valid=!1;return this.isValid})}}const ts=[Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.PreviousClose];class es extends Yn{constructor(t,e){super();this.resolved=t.map(([t,e])=>e),this.mapping=new Map(t.map(([t,e])=>{return[t,(i=e,im().getRecordSource().getRecord(i))];var i})),this.model=e;const i=ts.concat(Wn.Change,Wn.PercentChange);this.addFields(...i.filter(t=>t!==Wn.Volume))}async ready(){return Qt.call(this,async()=>{const t=Array.from(this.mapping.values).map(t=>t.ready());return this.isValid=(await Promise.all(t)).every(t=>t),this.isValid&&this.evaluate(),this.isValid})}hasSymbol(t){return this.resolved.includes(t)}getOneValue(t){return e=>this.mapping.get(e).getValue(t)}evaluate(){ts.forEach(t=>{const e=pn(this.model,this.getOneValue(t));this.update(t,Number.isFinite(e)?e:null)}),this.computeWellKnown()}}function is(t,e){return i=>i.topic===t&&i.data.symbol===e}
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var ns=function(t,e){return(ns=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function ss(t,e){function i(){this.constructor=t}ns(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function rs(t){return"function"==typeof t}var os=!1,as={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;os=t},get useDeprecatedSynchronousErrorHandling(){return os}};function ls(t){setTimeout((function(){throw t}),0)}var cs={closed:!0,next:function(t){},error:function(t){if(as.useDeprecatedSynchronousErrorHandling)throw t;ls(t)},complete:function(){}},us=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function hs(t){return null!==t&&"object"==typeof t}var ds=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),ps=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var i=this._parentOrParents,n=this._ctorUnsubscribe,s=this._unsubscribe,r=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var o=0;o<i.length;++o){i[o].remove(this)}if(rs(s)){n&&(this._unsubscribe=void 0);try{s.call(this)}catch(t){e=t instanceof ds?fs(t.errors):[t]}}if(us(r)){o=-1;for(var a=r.length;++o<a;){var l=r[o];if(hs(l))try{l.unsubscribe()}catch(t){e=e||[],t instanceof ds?e=e.concat(fs(t.errors)):e.push(t)}}}if(e)throw new ds(e)}},t.prototype.add=function(e){var i=e;if(!e)return t.EMPTY;switch(typeof e){case"function":i=new t(e);case"object":if(i===this||i.closed||"function"!=typeof i.unsubscribe)return i;if(this.closed)return i.unsubscribe(),i;if(!(i instanceof t)){var n=i;(i=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var s=i._parentOrParents;if(null===s)i._parentOrParents=this;else if(s instanceof t){if(s===this)return i;i._parentOrParents=[s,this]}else{if(-1!==s.indexOf(this))return i;s.push(this)}var r=this._subscriptions;return null===r?this._subscriptions=[i]:r.push(i),i},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var i=e.indexOf(t);-1!==i&&e.splice(i,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function fs(t){return t.reduce((function(t,e){return t.concat(e instanceof ds?e.errors:e)}),[])}var ms=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),gs=function(t){function e(i,n,s){var r=t.call(this)||this;switch(r.syncErrorValue=null,r.syncErrorThrown=!1,r.syncErrorThrowable=!1,r.isStopped=!1,arguments.length){case 0:r.destination=cs;break;case 1:if(!i){r.destination=cs;break}if("object"==typeof i){i instanceof e?(r.syncErrorThrowable=i.syncErrorThrowable,r.destination=i,i.add(r)):(r.syncErrorThrowable=!0,r.destination=new ys(r,i));break}default:r.syncErrorThrowable=!0,r.destination=new ys(r,i,n,s)}return r}return ss(e,t),e.prototype[ms]=function(){return this},e.create=function(t,i,n){var s=new e(t,i,n);return s.syncErrorThrowable=!1,s},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(ps),ys=function(t){function e(e,i,n,s){var r,o=t.call(this)||this;o._parentSubscriber=e;var a=o;return rs(i)?r=i:i&&(r=i.next,n=i.error,s=i.complete,i!==cs&&(rs((a=Object.create(i)).unsubscribe)&&o.add(a.unsubscribe.bind(a)),a.unsubscribe=o.unsubscribe.bind(o))),o._context=a,o._next=r,o._error=n,o._complete=s,o}return ss(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;as.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,i=as.useDeprecatedSynchronousErrorHandling;if(this._error)i&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)i?(e.syncErrorValue=t,e.syncErrorThrown=!0):ls(t),this.unsubscribe();else{if(this.unsubscribe(),i)throw t;ls(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var i=function(){return t._complete.call(t._context)};as.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,i),this.unsubscribe()):(this.__tryOrUnsub(i),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),as.useDeprecatedSynchronousErrorHandling)throw t;ls(t)}},e.prototype.__tryOrSetError=function(t,e,i){if(!as.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,i)}catch(e){return as.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(ls(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(gs);var vs=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function bs(t){return t}function Ts(t){return 0===t.length?bs:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var Ss=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var i=new t;return i.source=this,i.operator=e,i},t.prototype.subscribe=function(t,e,i){var n=this.operator,s=function(t,e,i){if(t){if(t instanceof gs)return t;if(t[ms])return t[ms]()}return t||e||i?new gs(t,e,i):new gs(cs)}(t,e,i);if(n?s.add(n.call(s,this.source)):s.add(this.source||as.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),as.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){as.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,i=e.closed,n=e.destination,s=e.isStopped;if(i||s)return!1;t=n&&n instanceof gs?n:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var i=this;return new(e=As(e))((function(e,n){var s;s=i.subscribe((function(e){try{t(e)}catch(t){n(t),s&&s.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[vs]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:Ts(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=As(t))((function(t,i){var n;e.subscribe((function(t){return n=t}),(function(t){return i(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function As(t){if(t||(t=as.Promise||Promise),!t)throw new Error("no Promise impl found");return t}var Ps=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.scheduler=e,n.work=i,n.pending=!1,n}return ss(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var i=this.id,n=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(n,i,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,i){return void 0===i&&(i=0),setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,e,i){if(void 0===i&&(i=0),null!==i&&this.delay===i&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,e);if(i)return i;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var i=!1,n=void 0;try{this.work(t)}catch(t){i=!0,n=!!t&&t||new Error(t)}if(i)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,i=e.actions,n=i.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&i.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,i){return t.call(this)||this}return ss(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(ps)),ws=function(){function t(e,i){void 0===i&&(i=t.now),this.SchedulerAction=e,this.now=i}return t.prototype.schedule=function(t,e,i){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(i,e)},t.now=function(){return Date.now()},t}(),Cs=new(function(t){function e(i,n){void 0===n&&(n=ws.now);var s=t.call(this,i,(function(){return e.delegate&&e.delegate!==s?e.delegate.now():n()}))||this;return s.actions=[],s.active=!1,s.scheduled=void 0,s}return ss(e,t),e.prototype.schedule=function(i,n,s){return void 0===n&&(n=0),e.delegate&&e.delegate!==this?e.delegate.schedule(i,n,s):t.prototype.schedule.call(this,i,n,s)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var i;this.active=!0;do{if(i=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,i){for(;t=e.shift();)t.unsubscribe();throw i}}},e}(ws))(Ps);function xs(t,e){var i;return void 0===t&&(t=0),void 0===e&&(e=Cs),(us(i=t)||!(i-parseFloat(i)+1>=0)||t<0)&&(t=0),e&&"function"==typeof e.schedule||(e=Cs),new Ss((function(i){return i.add(e.schedule(Ms,t,{subscriber:i,counter:0,period:t})),i}))}function Ms(t){var e=t.subscriber,i=t.counter,n=t.period;e.next(i),this.schedule({subscriber:e,counter:i+1,period:n},n)}var Es=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Os=function(t){function e(e,i){var n=t.call(this)||this;return n.subject=e,n.subscriber=i,n.closed=!1,n}return ss(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var i=e.indexOf(this.subscriber);-1!==i&&e.splice(i,1)}}},e}(ps),Ds=function(t){function e(e){var i=t.call(this,e)||this;return i.destination=e,i}return ss(e,t),e}(gs),Ls=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return ss(e,t),e.prototype[ms]=function(){return new Ds(this)},e.prototype.lift=function(t){var e=new Is(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new Es;if(!this.isStopped)for(var e=this.observers,i=e.length,n=e.slice(),s=0;s<i;s++)n[s].next(t)},e.prototype.error=function(t){if(this.closed)throw new Es;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,i=e.length,n=e.slice(),s=0;s<i;s++)n[s].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new Es;this.isStopped=!0;for(var t=this.observers,e=t.length,i=t.slice(),n=0;n<e;n++)i[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new Es;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new Es;return this.hasError?(t.error(this.thrownError),ps.EMPTY):this.isStopped?(t.complete(),ps.EMPTY):(this.observers.push(t),new Os(this,t))},e.prototype.asObservable=function(){var t=new Ss;return t.source=this,t},e.create=function(t,e){return new Is(t,e)},e}(Ss),Is=function(t){function e(e,i){var n=t.call(this)||this;return n.destination=e,n.source=i,n}return ss(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):ps.EMPTY},e}(Ls);function _s(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var Ns=_s();var Rs=function(t){if(t&&"function"==typeof t[vs])return r=t,function(t){var e=r[vs]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if((s=t)&&"number"==typeof s.length&&"function"!=typeof s)return n=t,function(t){for(var e=0,i=n.length;e<i&&!t.closed;e++)t.next(n[e]);t.complete()};if(function(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}(t))return i=t,function(t){return i.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,ls),t};if(t&&"function"==typeof t[Ns])return e=t,function(t){for(var i=e[Ns]();;){var n=void 0;try{n=i.next()}catch(e){return t.error(e),t}if(n.done){t.complete();break}if(t.next(n.value),t.closed)break}return"function"==typeof i.return&&t.add((function(){i.return&&i.return()})),t};var e,i,n,s,r,o=hs(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+o+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")},ks=function(t){function e(e){var i=t.call(this)||this;return i.parent=e,i}return ss(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(gs),Hs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ss(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(gs);var Fs=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new Us(t,this.closingSelector))},t}(),Us=function(t){function e(e,i){var n=t.call(this,e)||this;return n.closingSelector=i,n.subscribing=!1,n.openBuffer(),n}return ss(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},e.prototype.notifyNext=function(){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,i=this.buffer;this.buffer&&this.destination.next(i),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new ps,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(function(t,e){if(!e.closed){if(t instanceof Ss)return t.subscribe(e);var i;try{i=Rs(t)(e)}catch(t){e.error(t)}return i}}(e,new ks(this))),this.subscribing=!1},e}(Hs);function Bs(t,e){return function(i){return i.lift(new Vs(t,e))}}var Vs=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Ws(t,this.predicate,this.thisArg))},t}(),Ws=function(t){function e(e,i,n){var s=t.call(this,e)||this;return s.predicate=i,s.thisArg=n,s.count=0,s}return ss(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(gs);function js(t){yt(1,arguments);var e=vt(t);return!isNaN(e)}var Gs={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function zs(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.width?String(e.width):t.defaultWidth,n=t.formats[i]||t.formats[t.defaultWidth];return n}}var Ys={date:zs({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:zs({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:zs({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},qs={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function $s(t){return function(e,i){var n,s=i||{};if("formatting"===(s.context?String(s.context):"standalone")&&t.formattingValues){var r=t.defaultFormattingWidth||t.defaultWidth,o=s.width?String(s.width):r;n=t.formattingValues[o]||t.formattingValues[r]}else{var a=t.defaultWidth,l=s.width?String(s.width):t.defaultWidth;n=t.values[l]||t.values[a]}return n[t.argumentCallback?t.argumentCallback(e):e]}}function Xs(t){return function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(t.matchPattern);if(!n)return null;var s=n[0],r=e.match(t.parsePattern);if(!r)return null;var o=t.valueCallback?t.valueCallback(r[0]):r[0];o=i.valueCallback?i.valueCallback(o):o;var a=e.slice(s.length);return{value:o,rest:a}}}function Ks(t){return function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.width,s=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],r=e.match(s);if(!r)return null;var o,a=r[0],l=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?Qs(l,(function(t){return t.test(a)})):Zs(l,(function(t){return t.test(a)}));o=t.valueCallback?t.valueCallback(c):c,o=i.valueCallback?i.valueCallback(o):o;var u=e.slice(a.length);return{value:o,rest:u}}}function Zs(t,e){for(var i in t)if(t.hasOwnProperty(i)&&e(t[i]))return i}function Qs(t,e){for(var i=0;i<t.length;i++)if(e(t[i]))return i}var Js={code:"en-US",formatDistance:function(t,e,i){var n;return i=i||{},n="string"==typeof Gs[t]?Gs[t]:1===e?Gs[t].one:Gs[t].other.replace("{{count}}",e),i.addSuffix?i.comparison>0?"in "+n:n+" ago":n},formatLong:Ys,formatRelative:function(t,e,i,n){return qs[t]},localize:{ordinalNumber:function(t,e){var i=Number(t),n=i%100;if(n>20||n<10)switch(n%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:$s({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:$s({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return Number(t)-1}}),month:$s({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:$s({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:$s({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:Xs({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}}),era:Ks({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Ks({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Ks({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Ks({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ks({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function tr(t,e){yt(2,arguments);var i=vt(t).getTime(),n=Pt(e);return new Date(i+n)}function er(t,e){yt(2,arguments);var i=Pt(e);return tr(t,-i)}function ir(t,e){for(var i=t<0?"-":"",n=Math.abs(t).toString();n.length<e;)n="0"+n;return i+n}var nr={y:function(t,e){var i=t.getUTCFullYear(),n=i>0?i:1-i;return ir("yy"===e?n%100:n,e.length)},M:function(t,e){var i=t.getUTCMonth();return"M"===e?String(i+1):ir(i+1,2)},d:function(t,e){return ir(t.getUTCDate(),e.length)},a:function(t,e){var i=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];case"aaaa":default:return"am"===i?"a.m.":"p.m."}},h:function(t,e){return ir(t.getUTCHours()%12||12,e.length)},H:function(t,e){return ir(t.getUTCHours(),e.length)},m:function(t,e){return ir(t.getUTCMinutes(),e.length)},s:function(t,e){return ir(t.getUTCSeconds(),e.length)},S:function(t,e){var i=e.length,n=t.getUTCMilliseconds();return ir(Math.floor(n*Math.pow(10,i-3)),e.length)}};function sr(t){yt(1,arguments);var e=1,i=vt(t),n=i.getUTCDay(),s=(n<e?7:0)+n-e;return i.setUTCDate(i.getUTCDate()-s),i.setUTCHours(0,0,0,0),i}function rr(t){yt(1,arguments);var e=vt(t),i=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(i+1,0,4),n.setUTCHours(0,0,0,0);var s=sr(n),r=new Date(0);r.setUTCFullYear(i,0,4),r.setUTCHours(0,0,0,0);var o=sr(r);return e.getTime()>=s.getTime()?i+1:e.getTime()>=o.getTime()?i:i-1}function or(t){yt(1,arguments);var e=rr(t),i=new Date(0);i.setUTCFullYear(e,0,4),i.setUTCHours(0,0,0,0);var n=sr(i);return n}function ar(t){yt(1,arguments);var e=vt(t),i=sr(e).getTime()-or(e).getTime();return Math.round(i/6048e5)+1}function lr(t,e){yt(1,arguments);var i=e||{},n=i.locale,s=n&&n.options&&n.options.weekStartsOn,r=null==s?0:Pt(s),o=null==i.weekStartsOn?r:Pt(i.weekStartsOn);if(!(o>=0&&o<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var a=vt(t),l=a.getUTCDay(),c=(l<o?7:0)+l-o;return a.setUTCDate(a.getUTCDate()-c),a.setUTCHours(0,0,0,0),a}function cr(t,e){yt(1,arguments);var i=vt(t,e),n=i.getUTCFullYear(),s=e||{},r=s.locale,o=r&&r.options&&r.options.firstWeekContainsDate,a=null==o?1:Pt(o),l=null==s.firstWeekContainsDate?a:Pt(s.firstWeekContainsDate);if(!(l>=1&&l<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=new Date(0);c.setUTCFullYear(n+1,0,l),c.setUTCHours(0,0,0,0);var u=lr(c,e),h=new Date(0);h.setUTCFullYear(n,0,l),h.setUTCHours(0,0,0,0);var d=lr(h,e);return i.getTime()>=u.getTime()?n+1:i.getTime()>=d.getTime()?n:n-1}function ur(t,e){yt(1,arguments);var i=e||{},n=i.locale,s=n&&n.options&&n.options.firstWeekContainsDate,r=null==s?1:Pt(s),o=null==i.firstWeekContainsDate?r:Pt(i.firstWeekContainsDate),a=cr(t,e),l=new Date(0);l.setUTCFullYear(a,0,o),l.setUTCHours(0,0,0,0);var c=lr(l,e);return c}function hr(t,e){yt(1,arguments);var i=vt(t),n=lr(i,e).getTime()-ur(i,e).getTime();return Math.round(n/6048e5)+1}var dr="midnight",pr="noon",fr="morning",mr="afternoon",gr="evening",yr="night";function vr(t,e){var i=t>0?"-":"+",n=Math.abs(t),s=Math.floor(n/60),r=n%60;if(0===r)return i+String(s);var o=e||"";return i+String(s)+o+ir(r,2)}function br(t,e){return t%60==0?(t>0?"-":"+")+ir(Math.abs(t)/60,2):Tr(t,e)}function Tr(t,e){var i=e||"",n=t>0?"-":"+",s=Math.abs(t);return n+ir(Math.floor(s/60),2)+i+ir(s%60,2)}var Sr={G:function(t,e,i){var n=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})}},y:function(t,e,i){if("yo"===e){var n=t.getUTCFullYear(),s=n>0?n:1-n;return i.ordinalNumber(s,{unit:"year"})}return nr.y(t,e)},Y:function(t,e,i,n){var s=cr(t,n),r=s>0?s:1-s;return"YY"===e?ir(r%100,2):"Yo"===e?i.ordinalNumber(r,{unit:"year"}):ir(r,e.length)},R:function(t,e){return ir(rr(t),e.length)},u:function(t,e){return ir(t.getUTCFullYear(),e.length)},Q:function(t,e,i){var n=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ir(n,2);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,i){var n=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ir(n,2);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,i){var n=t.getUTCMonth();switch(e){case"M":case"MM":return nr.M(t,e);case"Mo":return i.ordinalNumber(n+1,{unit:"month"});case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,i){var n=t.getUTCMonth();switch(e){case"L":return String(n+1);case"LL":return ir(n+1,2);case"Lo":return i.ordinalNumber(n+1,{unit:"month"});case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,i,n){var s=hr(t,n);return"wo"===e?i.ordinalNumber(s,{unit:"week"}):ir(s,e.length)},I:function(t,e,i){var n=ar(t);return"Io"===e?i.ordinalNumber(n,{unit:"week"}):ir(n,e.length)},d:function(t,e,i){return"do"===e?i.ordinalNumber(t.getUTCDate(),{unit:"date"}):nr.d(t,e)},D:function(t,e,i){var n=function(t){yt(1,arguments);var e=vt(t),i=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),s=i-n;return Math.floor(s/864e5)+1}(t);return"Do"===e?i.ordinalNumber(n,{unit:"dayOfYear"}):ir(n,e.length)},E:function(t,e,i){var n=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,i,n){var s=t.getUTCDay(),r=(s-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return ir(r,2);case"eo":return i.ordinalNumber(r,{unit:"day"});case"eee":return i.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(s,{width:"short",context:"formatting"});case"eeee":default:return i.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,i,n){var s=t.getUTCDay(),r=(s-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return ir(r,e.length);case"co":return i.ordinalNumber(r,{unit:"day"});case"ccc":return i.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(s,{width:"narrow",context:"standalone"});case"cccccc":return i.day(s,{width:"short",context:"standalone"});case"cccc":default:return i.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,i){var n=t.getUTCDay(),s=0===n?7:n;switch(e){case"i":return String(s);case"ii":return ir(s,e.length);case"io":return i.ordinalNumber(s,{unit:"day"});case"iii":return i.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(n,{width:"short",context:"formatting"});case"iiii":default:return i.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,i){var n=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(t,e,i){var n,s=t.getUTCHours();switch(n=12===s?pr:0===s?dr:s/12>=1?"pm":"am",e){case"b":case"bb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(t,e,i){var n,s=t.getUTCHours();switch(n=s>=17?gr:s>=12?mr:s>=4?fr:yr,e){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(t,e,i){if("ho"===e){var n=t.getUTCHours()%12;return 0===n&&(n=12),i.ordinalNumber(n,{unit:"hour"})}return nr.h(t,e)},H:function(t,e,i){return"Ho"===e?i.ordinalNumber(t.getUTCHours(),{unit:"hour"}):nr.H(t,e)},K:function(t,e,i){var n=t.getUTCHours()%12;return"Ko"===e?i.ordinalNumber(n,{unit:"hour"}):ir(n,e.length)},k:function(t,e,i){var n=t.getUTCHours();return 0===n&&(n=24),"ko"===e?i.ordinalNumber(n,{unit:"hour"}):ir(n,e.length)},m:function(t,e,i){return"mo"===e?i.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):nr.m(t,e)},s:function(t,e,i){return"so"===e?i.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):nr.s(t,e)},S:function(t,e){return nr.S(t,e)},X:function(t,e,i,n){var s=(n._originalDate||t).getTimezoneOffset();if(0===s)return"Z";switch(e){case"X":return br(s);case"XXXX":case"XX":return Tr(s);case"XXXXX":case"XXX":default:return Tr(s,":")}},x:function(t,e,i,n){var s=(n._originalDate||t).getTimezoneOffset();switch(e){case"x":return br(s);case"xxxx":case"xx":return Tr(s);case"xxxxx":case"xxx":default:return Tr(s,":")}},O:function(t,e,i,n){var s=(n._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+vr(s,":");case"OOOO":default:return"GMT"+Tr(s,":")}},z:function(t,e,i,n){var s=(n._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+vr(s,":");case"zzzz":default:return"GMT"+Tr(s,":")}},t:function(t,e,i,n){var s=n._originalDate||t;return ir(Math.floor(s.getTime()/1e3),e.length)},T:function(t,e,i,n){return ir((n._originalDate||t).getTime(),e.length)}};function Ar(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}}function Pr(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}}var wr={p:Pr,P:function(t,e){var i,n=t.match(/(P+)(p+)?/),s=n[1],r=n[2];if(!r)return Ar(t,e);switch(s){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"})}return i.replace("{{date}}",Ar(s,e)).replace("{{time}}",Pr(r,e))}};function Cr(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}var xr=["D","DD"],Mr=["YY","YYYY"];function Er(t){return-1!==xr.indexOf(t)}function Or(t){return-1!==Mr.indexOf(t)}function Dr(t,e,i){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(i,"`; see: https://git.io/fxCyr"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(i,"`; see: https://git.io/fxCyr"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(i,"`; see: https://git.io/fxCyr"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(i,"`; see: https://git.io/fxCyr"))}var Lr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ir=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_r=/^'([^]*?)'?$/,Nr=/''/g,Rr=/[a-zA-Z]/;function kr(t,e,i){yt(2,arguments);var n=String(e),s=i||{},r=s.locale||Js,o=r.options&&r.options.firstWeekContainsDate,a=null==o?1:Pt(o),l=null==s.firstWeekContainsDate?a:Pt(s.firstWeekContainsDate);if(!(l>=1&&l<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=r.options&&r.options.weekStartsOn,u=null==c?0:Pt(c),h=null==s.weekStartsOn?u:Pt(s.weekStartsOn);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!r.localize)throw new RangeError("locale must contain localize property");if(!r.formatLong)throw new RangeError("locale must contain formatLong property");var d=vt(t);if(!js(d))throw new RangeError("Invalid time value");var p=Cr(d),f=er(d,p),m={firstWeekContainsDate:l,weekStartsOn:h,locale:r,_originalDate:d},g=n.match(Ir).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,wr[e])(t,r.formatLong,m):t})).join("").match(Lr).map((function(i){if("''"===i)return"'";var n=i[0];if("'"===n)return Hr(i);var o=Sr[n];if(o)return!s.useAdditionalWeekYearTokens&&Or(i)&&Dr(i,e,t),!s.useAdditionalDayOfYearTokens&&Er(i)&&Dr(i,e,t),o(f,i,r.localize,m);if(n.match(Rr))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return i})).join("");return g}function Hr(t){return t.match(_r)[1].replace(Nr,"'")}class Fr{constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}get subject(){if(!K(this._subject)){const e=xs(Math.max(te.MINIMUM_THROTTLE,im().config.throttleMillis||0)),i=xs(te.BACKGROUND_TAB_THROTTLE),n=()=>{var t;return null!==(t=globalThis.document)&&void 0!==t&&t.hidden?i:e};this._subject=(new Ls).pipe((t=n,function(e){return e.lift(new Fs(t))}),Bs(t=>t.length>0))}var t;return this._subject}addRecordForSymbol(t,e){const i=ue(t);i!==t&&this.translateSymbolBack.set(i,t),this.recordCache.set(t,e)}removeRecordForSymbol(t){this.recordCache.delete(t);const e=ue(t);this.translateSymbolBack.has(e)&&this.translateSymbolBack.delete(e)}findRecordForSymbol(t){const e=this.translateSymbolBack.has(t)?this.translateSymbolBack.get(t):t;return this.recordCache.get(e)}makeAndCacheRecord(t,e){if(t===te.PLACEHOLDER_SYMBOL_NAME)return new $n(te.PLACEHOLDER_SYMBOL_NAME);if(this.recordCache.has(t))return this.recordCache.get(t);const i=e(t);return i.addFields(Wn.Open,Wn.High,Wn.Low,Wn.Last,Wn.Close,Wn.PreviousClose,Wn.PreviousHigh,Wn.PreviousLow,Wn.PreviousOpen,Wn.Volume,Wn.Change,Wn.PercentChange),this.addRecordForSymbol(t,i),i.ready().then(t=>{this.postInit(t,i)}),i}evictUnused(t,e){for(const[i,n]of this.recordCache)t.has(n)||(e(n),this.removeRecordForSymbol(i))}postInit(t,e){}}class Ur extends Fr{getRecord(t){return this.makeAndCacheRecord(t,()=>new Jn(t))}evictUnused(t){super.evictUnused(t,t=>t.shutdown())}}class Br extends Fr{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(t){super.evictUnused(t,t=>{t.shutdown(),im().connection.off("marketUpdate",this.onMarketUpdate,t.translated)})}getRecord(t){return this.makeAndCacheRecord(t,()=>new Qn(t))}postInit(t,e){t&&im().connection.on("marketUpdate",this.onMarketUpdate,e.translated)}onMarketUpdate(t){if(t.type===te.REALTIME_INITIAL_QUOTE){const e=this.updateFromQuote(t,!0);this.subject.next({topic:jn.RT_QUOTE,data:t,updated:e})}else if(t.type===te.REALTIME_TRADE){let e=im().connection.getMarketState().getQuote(t.symbol);const i=this.updateFromQuote(e);this.subject.next({topic:jn.RT_TRADE,data:t,updated:i}),t.symbol===te.DEBUG_SYMBOL&&console.log("Trade\nSymbol: ".concat(t.symbol," \t%cPrice: ").concat(t.tradePrice," \t%cSize: ").concat(t.tradeSize," \t%cTime: ").concat(kr(t.time,te.DEBUG_TIME_FORMAT)," \t%cSession: ").concat(t.session),"color:#0f0","color:#a7a","color:#f96","color:#bee")}else if(t.type===te.REALTIME_VOLUME){const e=this.updateFromVolume(t);0!==e&&(this.subject.next({topic:jn.RT_VOLUME,data:t,updated:e}),t.symbol===te.DEBUG_SYMBOL&&console.log("Volume\n Symbol: ".concat(t.symbol," \t%cValue: ").concat(t.value," \t%cSession: ").concat(t.session),"color:#a7a","color:#bee"))}}updateFromQuote(t,e=!1){const i=this.findRecordForSymbol(t.symbol);i.resetUpdated(),i.update(Wn.Open,t.openPrice),i.update(Wn.High,t.highPrice),i.update(Wn.Low,t.lowPrice),i.update(Wn.Last,t.lastPrice),i.update(Wn.Close,t.lastPrice);const n=(t,e)=>{e&&i.update(t,e)};return n(Wn.Volume,t.volume),i.update(Wn.PreviousClose,t.previousPrice),e&&(n(Wn.PreviousOpen,t.previousOpenPrice),n(Wn.PreviousHigh,t.previousHighPrice),n(Wn.PreviousLow,t.previousLowPrice)),i.computeWellKnown(),i.updated}updateFromVolume(t){const e=this.findRecordForSymbol(t.symbol);return e.resetUpdated(),e.update(Wn.Volume,t.value),e.updated}}class Vr{constructor(t){this.fields=t,this.clear()}clear(){this.storage={},this.fields.forEach(t=>{this.storage[t.id]=[]})}fixupTransition(t,e){if(t!==Wn.Change||!this.hasField(Wn.Close)||e<1)return;const i=this.storage[t.id],n=this.storage[Wn.Close.id];i[e]=n[e]-n[e-1]}concat(t,e,i){this.storage[t.id]=e.concat(i),this.fixupTransition(t,e.length)}prependData(t,e){this.checkField(t),this.concat(t,e,this.getData(t))}prepend(t){const e=t.getLastDataPoint(Wn.DateTime).getTime()===this.getData(Wn.DateTime)[0].getTime(),i=t.size;t.fields.forEach(n=>{e&&t.getData(n).splice(i-1,1),this.prependData(n,t.getData(n))})}appendData(t,e){this.checkField(t),this.concat(t,this.getData(t),e)}append(t){const e=t.getData(Wn.DateTime)[0].getTime()===this.getLastDataPoint(Wn.DateTime).getTime(),i=this.size;return t.fields.forEach(n=>{e&&this.getData(n).splice(i-1,1),this.appendData(n,t.getData(n))}),t.size-(e?1:0)}getTimeData(){return this.getData(Wn.DateTime)}getData(t){return this.storage[t.id]}setData(t,e){this.checkField(t),this.storage[t.id]=e}hasField(t){return-1!==this.fields.findIndex(e=>e.id===t.id)}get size(){return 0===this.fields.length?0:this.getData(this.fields[0]).length}get isEmpty(){return 0===this.size}checkField(t){if(!this.hasField(t))throw new Error("This container does not store values for field ".concat(t.id))}addDataPoint(t,e){this.checkField(t);this.getData(t).push(e)}getLastDataPoint(t){this.checkField(t);return V(this.getData(t))}setLastDataPoint(t,e){this.checkField(t);const i=this.getData(t);i[i.length-1]=e}keepOnlyLast(t){if(this.size<=t)return;const e=this.size-t;this.fields.forEach(t=>this.getData(t).splice(0,e))}}class Wr extends Vr{constructor(){super([])}get size(){return 0}}class jr extends Vr{constructor(t,e){super(t),this.wrapper=e}isWrapped(t){return this.wrapper.hasOwnProperty(t.id)}hasField(t){return this.isWrapped(t)||super.hasField(t)}getData(t){return this.isWrapped(t)?this.wrapper[t.id]():super.getData(t)}}const Gr=[Wn.DateTime,Wn.Last,Wn.TradeSize,Wn.Change],zr=[Wn.DateTime,Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Volume,Wn.Change],Yr=[Wn.DateTime,Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Volume,Wn.OpenInterest,Wn.Change],qr=[Wn.Symbol,Wn.DateTime,Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Volume,Wn.OpenInterest,Wn.Change],$r=[Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Change];function Xr(t,e){const i=kt(t),n=e.isMultiContract;return e.isTick?Gr:e.isIntraday||!i&&!n?zr:n?qr:Yr}function Kr(t,e){yt(2,arguments);var i=vt(t),n=vt(e);return i.getTime()<n.getTime()}function Zr(t,e){yt(2,arguments);var i=vt(t),n=vt(e);return i.getTime()===n.getTime()}function Qr(t,e,i){return(i=i||[]).length>=e?t.apply(null,i.slice(0,e).reverse()):function(){var n=Array.prototype.slice.call(arguments);return Qr(t,e,i.concat(n))}}var Jr=Qr((function(t,e){yt(2,arguments);var i=Pt(e);return tr(t,1e3*i)}),2);var to=Qr((function(t,e){yt(2,arguments);var i=Pt(e);return tr(t,6e4*i)}),2);function eo(t,e){yt(2,arguments);var i=vt(t),n=Pt(e);return isNaN(n)?new Date(NaN):n?(i.setDate(i.getDate()+n),i):i}var io=Qr(eo,2);var no=Qr((function(t,e){yt(2,arguments);var i=Pt(e),n=7*i;return eo(t,n)}),2),so=Qr(wt,2);var ro=Qr((function(t,e){yt(2,arguments);var i=Pt(e),n=3*i;return wt(t,n)}),2),oo=Qr(Ct,2),ao=Qr(kr,2);function lo(t){return t.size-1}class co{constructor(t){this.container=t}process(t){const e=this.container.size>0?this.container.getLastDataPoint(Wn.Last):null,i=this.container.getLastDataPoint(Wn.DateTime);let n=t.time;return void 0!==i&&n<=i&&(n=tr(i,1)),this.container.addDataPoint(Wn.DateTime,n),this.container.addDataPoint(Wn.Last,t.tradePrice),this.container.addDataPoint(Wn.TradeSize,t.tradeSize),this.container.addDataPoint(Wn.Change,K(e)?t.tradePrice-e:null),{isUpdate:!1,time:n.getTime(),index:lo(this.container)}}}class uo{constructor(t,e,i){this.agg=e,this.processRetrieved(t,i)}processRetrieved(t,e){if(this.agg.unit===u.Tick&&this.agg.spec!==h.None)switch(this.container=new Vr(Xr(e,new Ji(u.Intraday,5))),this.agg.spec){case h.PerSeconds:for(let e=0;e<t.size;e++){const i={time:t.getData(Wn.DateTime)[e],tradeSize:t.getData(Wn.TradeSize)[e],tradePrice:t.getData(Wn.Last)[e]};this.process(i)}break;case h.PerCount:case h.PerVolume:case h.PerRange:default:throw new Error("Custom tick aggregation ".concat(this.agg.describe()," has not been implemented yet"))}else this.container=t}isSameBar(t,e,i){switch(this.agg.unit){case u.Tick:case u.Intraday:return Kr(e,i(t));case u.Day:return Tt(t,e);case u.Week:return ji(t,e);case u.Month:return Gi(t,e);case u.Quarter:return Yi(t,e);case u.Year:return Vi(t,e);default:throw new Error("Unexpected aggregation unit ".concat(u[this.agg.unit]))}}getBarDurationAdder(){switch(this.agg.unit){case u.Tick:return Jr(this.agg.size);case u.Intraday:return to(this.agg.size);case u.Day:return io(1);case u.Week:return no(1);case u.Month:return so(1);case u.Quarter:return ro(1);case u.Year:return oo(1);default:throw new Error("Unexpected aggregation unit ".concat(u[this.agg.unit]))}}getPosition(t){if(0===this.container.size){const e=t.time;return{lastTimeStamp:null,newTimestamp:e,nextTimestamp:e,isUpdate:!1}}const e=this.container.getLastDataPoint(Wn.DateTime),i=t.time;if(Kr(i,e))throw new Error("Currently not handling data corrections (updates of the past historical data)");const n=this.getBarDurationAdder();let s=e;for(;!this.isSameBar(s,i,n);)s=n(s);return{lastTimestamp:e,newTimestamp:i,nextTimestamp:s,isUpdate:Zr(s,e)}}addBar(t,e){const{nextTimestamp:i}=e,n=this.container.size>0?this.container.getLastDataPoint(Wn.Close):null;return this.container.addDataPoint(Wn.DateTime,i),this.container.addDataPoint(Wn.Open,t.tradePrice),this.container.addDataPoint(Wn.High,t.tradePrice),this.container.addDataPoint(Wn.Low,t.tradePrice),this.container.addDataPoint(Wn.Close,t.tradePrice),this.container.addDataPoint(Wn.Change,K(n)?t.tradePrice-n:null),this.container.addDataPoint(Wn.Volume,t.tradeSize),this.container.hasField(Wn.OpenInterest)&&this.container.addDataPoint(Wn.OpenInterest,null),{isUpdate:!1,time:i.getTime(),index:lo(this.container)}}updateLastBar(t,e,i,n){if(K(t)&&t>this.container.getLastDataPoint(Wn.High)&&this.container.setLastDataPoint(Wn.High,t),K(e)&&e<this.container.getLastDataPoint(Wn.Low)&&this.container.setLastDataPoint(Wn.Low,e),K(i)){this.container.setLastDataPoint(Wn.Close,i);const t=this.container.getData(Wn.Close)[this.container.size-2];this.container.setLastDataPoint(Wn.Change,i-t)}if(K(n)){const t=this.container.getLastDataPoint(Wn.Volume)+n;this.container.setLastDataPoint(Wn.Volume,t)}}changeLastBar(t,e){const{lastTimestamp:i}=e,n=t.tradePrice;return this.updateLastBar(n,n,n,t.tradeSize),{isUpdate:!0,time:i.getTime(),index:this.lastBarIndex}}process(t){const e=this.getPosition(t),i=ao(te.DEBUG_TIME_FORMAT);return e.isUpdate?(t.symbol===te.DEBUG_SYMBOL&&console.log("Adding ".concat(this.agg.describe()," Bar\n")+"Bars %cnot same %c".concat(i(e.lastTimestamp)," < ").concat(i(e.newTimestamp)," %cnext is %c").concat(i(e.nextTimestamp)),"color:#f00","color:#f96","","color:#fff"),this.changeLastBar(t,e)):K(t.tradePrice)?(t.symbol===te.DEBUG_SYMBOL&&console.log("Updating ".concat(this.agg.describe()," Bar\n")+"Bars %csame %c".concat(i(e.lastTimestamp)," == ").concat(i(e.newTimestamp)),"color:#0f0","color:#f96"),this.addBar(t,e)):null}alignToQuote(t){if(K(t.lastPrice,t.time))return this.updateLastBar(t.highPrice,t.lowPrice,t.lastPrice,null),{isUpdate:!0,time:t.time.getTime(),index:this.lastBarIndex}}}const ho=te.RENKO_NAMES;function po(t,e,i){return e.includes(t)?t:i}function fo(t){let{Method:e,Period:i,Source:n,BrickSize:s}=rt(t);return{method:po(e,[ho.ATR,ho.TRD],ho.ATR),period:Number.isFinite(i)?i:14,source:po(n,[ho.CLS,ho.HL],ho.CLS),brickSize:Number.isFinite(s)?s:10}}const mo=t=>Wn[t],go=["DateTime","Open","High","Low","Close","Volume"].map(mo),yo=go.concat(["Change","Projection","BarIndex"].map(mo));class vo{constructor(t,e){this.innerBuilder=t,this.inputs=et(e.inputs),this.brickSize=null,this.container=new Vr(yo),this.processRetrieved()}get base(){return this.innerBuilder.container}baseVal(t,e){return this.base.getData(t)[e]}trueRangeAt(t){const[e,i]=[Wn.High,Wn.Low].map(e=>this.baseVal(e,t)),n=this.baseVal(Wn.Close,t-1);return Math.max(e-i,Math.abs(e-n),Math.abs(i-n))}computeBrickSize(t){if(this.base.size<t)return null;const e=t-1,i=[];i.push(this.baseVal(Wn.High,0)-this.baseVal(Wn.Low,0));for(let e=1;e<t;++e)i.push(this.trueRangeAt(e));let n=N(i);for(let i=t;i<this.base.size;++i){n=(n*e+this.trueRangeAt(i))/t}return n}isLastBase(t){return t===this.base.size-1}getValuesAt(t,e){const[i,n,s,r,o,a]=go.map(i=>e.getData(i)[t]);return{date:i,open:n,high:s,low:r,close:o,volume:a}}getBrickAt(t){return this.getValuesAt(t,this.container)}getBarAt(t){return this.getValuesAt(t,this.base)}getBricksCount(t){return Math.floor(t/this.brickSize)}getMove(t,e,i){const[n,s]=this.refPrices(e.close,e.high,e.low),r=n-t.high,o=t.low-s;return{climbing:(i&&r>0||r>=this.brickSize)&&r>=o,falling:(i&&o>0||o>=this.brickSize)&&o>r,moveUp:r,moveDown:o}}initFirstBrick(t,e){const i=Math.max(this.brickSize,Z(e.close-e.close%this.brickSize,4));t.open=t.high=t.low=t.close=i,t.date=e.date,t.volume=t.change=0}findSafeStartIndex(){let t=0,e=this.base.size-1;const i=2*te.RENKO_MAX_BARS;for(;e>0&&t<i;){const i=this.trueRangeAt(e);t+=Math.floor(i/this.brickSize),e--}return e}processRetrieved(){const t=fo(this.inputs),{method:e,period:i,source:n}=t;if(this.brickSize=t.brickSize,e===ho.ATR&&(this.brickSize=this.computeBrickSize(i)),!K(this.brickSize))return;this.refPrices=n===ho.HL?(t,e,i)=>[e,i]:(t,e,i)=>[t,t];let s={};const r=this.findSafeStartIndex();for(let t=r;t<this.base.size;t++){const e=this.getBarAt(t);if(t===r){this.initFirstBrick(s,e);continue}const i=this.isLastBase(t),{climbing:n,falling:o,moveUp:a,moveDown:l}=this.getMove(s,e,i);if(!n&&!o){s.volume+=e.volume;continue}s.proj=Number(i),s.barIndex=t;const c=e.date.getTime();if(n){const t=this.getBricksCount(a);for(let e=0;e<t;++e)this.constructClimbing(s,c,e,this.brickSize);i&&(this.constructClimbing(s,c,t,a%this.brickSize),this.projectionCount=t+1)}else if(o){const t=this.getBricksCount(l);for(let e=0;e<t;++e)this.constructFalling(s,c,e,this.brickSize);i&&(this.constructFalling(s,c,t,l%this.brickSize),this.projectionCount=t+1)}i||(this.lastFinalBrick=this.container.size-1,s.volume=0)}this.container.keepOnlyLast(te.RENKO_MAX_BARS)}constructClimbing(t,e,i,n,s=!0){const r=t.high,o=t.close;t.open=t.low=r,t.high=t.close=r+n,t.date=new Date(e+i),t.change=t.close-o,s?this.addToContainer(t):this.updateLastDataPoint(t)}constructFalling(t,e,i,n,s=!0){const r=t.low,o=t.close;t.open=t.high=r,t.low=t.close=r-n,t.date=new Date(e+i),t.change=t.close-o,s?this.addToContainer(t):this.updateLastDataPoint(t)}process(t){const e=this.innerBuilder.process(t);return this.processUpdate(e)}alignToQuote(t){const e=this.innerBuilder.alignToQuote(t);return this.processUpdate(e)}rebuild(){return this.container.clear(),this.processRetrieved(),{isUpdate:!1,time:0,index:-1}}processUpdate(t){if(!Number.isFinite(this.lastFinalBrick))return null;const e=this.base.size-1,i=this.getBarAt(e),n=this.getBrickAt(this.lastFinalBrick),{climbing:s,falling:r,moveUp:o,moveDown:a}=this.getMove(n,i,!0),l=1===this.container.getLastDataPoint(Wn.Projection);if(!s&&!r)return l?this.rebuild():null;const c=s?o:a,u=this.getBricksCount(c)+1;if(l&&this.projectionCount===u){const t=this.getBrickAt(this.container.size-1),n=this.getBrickAt(Math.min(this.container.size-2,0));return t.proj=1,t.barIndex=e,t.open===t.high?t.low=t.close=i.close:t.open===t.low&&(t.high=t.close=i.close),t.change=t.close-n.close,this.updateLastDataPoint(t),{isUpdate:!0,time:t.date.getTime(),index:this.container.size-1}}return this.rebuild()}addToContainer(t){this.container.addDataPoint(Wn.DateTime,t.date),this.container.addDataPoint(Wn.Open,t.open),this.container.addDataPoint(Wn.Close,t.close),this.container.addDataPoint(Wn.High,t.high),this.container.addDataPoint(Wn.Low,t.low),this.container.addDataPoint(Wn.Change,t.change),this.container.addDataPoint(Wn.Volume,t.volume),this.container.addDataPoint(Wn.Projection,t.proj),this.container.addDataPoint(Wn.BarIndex,t.barIndex)}updateLastDataPoint(t){this.container.setLastDataPoint(Wn.DateTime,t.date),this.container.setLastDataPoint(Wn.Open,t.open),this.container.setLastDataPoint(Wn.Close,t.close),this.container.setLastDataPoint(Wn.High,t.high),this.container.setLastDataPoint(Wn.Low,t.low),this.container.setLastDataPoint(Wn.Change,t.change),this.container.setLastDataPoint(Wn.Volume,t.volume),this.container.setLastDataPoint(Wn.Projection,t.proj),this.container.setLastDataPoint(Wn.BarIndex,t.barIndex)}}function bo(t,e){if(null==t)throw new TypeError("assign requires that input parameter not be null or undefined");for(var i in e=e||{})Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}function To(t,e,i){yt(2,arguments);var n=i||{},s=n.locale,r=s&&s.options&&s.options.weekStartsOn,o=null==r?0:Pt(r),a=null==n.weekStartsOn?o:Pt(n.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var l=vt(t),c=Pt(e),u=l.getUTCDay(),h=c%7,d=(h+7)%7,p=(d<a?7:0)+c-u;return l.setUTCDate(l.getUTCDate()+p),l}var So=/^(1[0-2]|0?\d)/,Ao=/^(3[0-1]|[0-2]?\d)/,Po=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,wo=/^(5[0-3]|[0-4]?\d)/,Co=/^(2[0-3]|[0-1]?\d)/,xo=/^(2[0-4]|[0-1]?\d)/,Mo=/^(1[0-1]|0?\d)/,Eo=/^(1[0-2]|0?\d)/,Oo=/^[0-5]?\d/,Do=/^[0-5]?\d/,Lo=/^\d/,Io=/^\d{1,2}/,_o=/^\d{1,3}/,No=/^\d{1,4}/,Ro=/^-?\d+/,ko=/^-?\d/,Ho=/^-?\d{1,2}/,Fo=/^-?\d{1,3}/,Uo=/^-?\d{1,4}/,Bo=/^([+-])(\d{2})(\d{2})?|Z/,Vo=/^([+-])(\d{2})(\d{2})|Z/,Wo=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,jo=/^([+-])(\d{2}):(\d{2})|Z/,Go=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function zo(t,e,i){var n=e.match(t);if(!n)return null;var s=parseInt(n[0],10);return{value:i?i(s):s,rest:e.slice(n[0].length)}}function Yo(t,e){var i=e.match(t);return i?"Z"===i[0]?{value:0,rest:e.slice(1)}:{value:("+"===i[1]?1:-1)*(36e5*(i[2]?parseInt(i[2],10):0)+6e4*(i[3]?parseInt(i[3],10):0)+1e3*(i[5]?parseInt(i[5],10):0)),rest:e.slice(i[0].length)}:null}function qo(t,e){return zo(Ro,t,e)}function $o(t,e,i){switch(t){case 1:return zo(Lo,e,i);case 2:return zo(Io,e,i);case 3:return zo(_o,e,i);case 4:return zo(No,e,i);default:return zo(new RegExp("^\\d{1,"+t+"}"),e,i)}}function Xo(t,e,i){switch(t){case 1:return zo(ko,e,i);case 2:return zo(Ho,e,i);case 3:return zo(Fo,e,i);case 4:return zo(Uo,e,i);default:return zo(new RegExp("^-?\\d{1,"+t+"}"),e,i)}}function Ko(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function Zo(t,e){var i,n=e>0,s=n?e:1-e;if(s<=50)i=t||100;else{var r=s+50;i=t+100*Math.floor(r/100)-(t>=r%100?100:0)}return n?i:1-i}var Qo=[31,28,31,30,31,30,31,31,30,31,30,31],Jo=[31,29,31,30,31,30,31,31,30,31,30,31];function ta(t){return t%400==0||t%4==0&&t%100!=0}var ea={G:{priority:140,parse:function(t,e,i,n){switch(e){case"G":case"GG":case"GGG":return i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"});case"GGGGG":return i.era(t,{width:"narrow"});case"GGGG":default:return i.era(t,{width:"wide"})||i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"})}},set:function(t,e,i,n){return e.era=i,t.setUTCFullYear(i,0,1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(t,e,i,n){var s=function(t){return{year:t,isTwoDigitYear:"yy"===e}};switch(e){case"y":return $o(4,t,s);case"yo":return i.ordinalNumber(t,{unit:"year",valueCallback:s});default:return $o(e.length,t,s)}},validate:function(t,e,i){return e.isTwoDigitYear||e.year>0},set:function(t,e,i,n){var s=t.getUTCFullYear();if(i.isTwoDigitYear){var r=Zo(i.year,s);return t.setUTCFullYear(r,0,1),t.setUTCHours(0,0,0,0),t}var o="era"in e&&1!==e.era?1-i.year:i.year;return t.setUTCFullYear(o,0,1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(t,e,i,n){var s=function(t){return{year:t,isTwoDigitYear:"YY"===e}};switch(e){case"Y":return $o(4,t,s);case"Yo":return i.ordinalNumber(t,{unit:"year",valueCallback:s});default:return $o(e.length,t,s)}},validate:function(t,e,i){return e.isTwoDigitYear||e.year>0},set:function(t,e,i,n){var s=cr(t,n);if(i.isTwoDigitYear){var r=Zo(i.year,s);return t.setUTCFullYear(r,0,n.firstWeekContainsDate),t.setUTCHours(0,0,0,0),lr(t,n)}var o="era"in e&&1!==e.era?1-i.year:i.year;return t.setUTCFullYear(o,0,n.firstWeekContainsDate),t.setUTCHours(0,0,0,0),lr(t,n)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(t,e,i,n){return Xo("R"===e?4:e.length,t)},set:function(t,e,i,n){var s=new Date(0);return s.setUTCFullYear(i,0,4),s.setUTCHours(0,0,0,0),sr(s)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(t,e,i,n){return Xo("u"===e?4:e.length,t)},set:function(t,e,i,n){return t.setUTCFullYear(i,0,1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(t,e,i,n){switch(e){case"Q":case"QQ":return $o(e.length,t);case"Qo":return i.ordinalNumber(t,{unit:"quarter"});case"QQQ":return i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(t,{width:"wide",context:"formatting"})||i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,i){return e>=1&&e<=4},set:function(t,e,i,n){return t.setUTCMonth(3*(i-1),1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(t,e,i,n){switch(e){case"q":case"qq":return $o(e.length,t);case"qo":return i.ordinalNumber(t,{unit:"quarter"});case"qqq":return i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(t,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(t,{width:"wide",context:"standalone"})||i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"})}},validate:function(t,e,i){return e>=1&&e<=4},set:function(t,e,i,n){return t.setUTCMonth(3*(i-1),1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(t,e,i,n){var s=function(t){return t-1};switch(e){case"M":return zo(So,t,s);case"MM":return $o(2,t,s);case"Mo":return i.ordinalNumber(t,{unit:"month",valueCallback:s});case"MMM":return i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(t,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(t,{width:"wide",context:"formatting"})||i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,i){return e>=0&&e<=11},set:function(t,e,i,n){return t.setUTCMonth(i,1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(t,e,i,n){var s=function(t){return t-1};switch(e){case"L":return zo(So,t,s);case"LL":return $o(2,t,s);case"Lo":return i.ordinalNumber(t,{unit:"month",valueCallback:s});case"LLL":return i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(t,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(t,{width:"wide",context:"standalone"})||i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"})}},validate:function(t,e,i){return e>=0&&e<=11},set:function(t,e,i,n){return t.setUTCMonth(i,1),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(t,e,i,n){switch(e){case"w":return zo(wo,t);case"wo":return i.ordinalNumber(t,{unit:"week"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=1&&e<=53},set:function(t,e,i,n){return lr(function(t,e,i){yt(2,arguments);var n=vt(t),s=Pt(e),r=hr(n,i)-s;return n.setUTCDate(n.getUTCDate()-7*r),n}(t,i,n),n)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(t,e,i,n){switch(e){case"I":return zo(wo,t);case"Io":return i.ordinalNumber(t,{unit:"week"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=1&&e<=53},set:function(t,e,i,n){return sr(function(t,e){yt(2,arguments);var i=vt(t),n=Pt(e),s=ar(i)-n;return i.setUTCDate(i.getUTCDate()-7*s),i}(t,i,n),n)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(t,e,i,n){switch(e){case"d":return zo(Ao,t);case"do":return i.ordinalNumber(t,{unit:"date"});default:return $o(e.length,t)}},validate:function(t,e,i){var n=ta(t.getUTCFullYear()),s=t.getUTCMonth();return n?e>=1&&e<=Jo[s]:e>=1&&e<=Qo[s]},set:function(t,e,i,n){return t.setUTCDate(i),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(t,e,i,n){switch(e){case"D":case"DD":return zo(Po,t);case"Do":return i.ordinalNumber(t,{unit:"date"});default:return $o(e.length,t)}},validate:function(t,e,i){return ta(t.getUTCFullYear())?e>=1&&e<=366:e>=1&&e<=365},set:function(t,e,i,n){return t.setUTCMonth(0,i),t.setUTCHours(0,0,0,0),t},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(t,e,i,n){switch(e){case"E":case"EE":case"EEE":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,i){return e>=0&&e<=6},set:function(t,e,i,n){return(t=To(t,i,n)).setUTCHours(0,0,0,0),t},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(t,e,i,n){var s=function(t){var e=7*Math.floor((t-1)/7);return(t+n.weekStartsOn+6)%7+e};switch(e){case"e":case"ee":return $o(e.length,t,s);case"eo":return i.ordinalNumber(t,{unit:"day",valueCallback:s});case"eee":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeeee":return i.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,i){return e>=0&&e<=6},set:function(t,e,i,n){return(t=To(t,i,n)).setUTCHours(0,0,0,0),t},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(t,e,i,n){var s=function(t){var e=7*Math.floor((t-1)/7);return(t+n.weekStartsOn+6)%7+e};switch(e){case"c":case"cc":return $o(e.length,t,s);case"co":return i.ordinalNumber(t,{unit:"day",valueCallback:s});case"ccc":return i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"ccccc":return i.day(t,{width:"narrow",context:"standalone"});case"cccccc":return i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(t,{width:"wide",context:"standalone"})||i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"})}},validate:function(t,e,i){return e>=0&&e<=6},set:function(t,e,i,n){return(t=To(t,i,n)).setUTCHours(0,0,0,0),t},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(t,e,i,n){var s=function(t){return 0===t?7:t};switch(e){case"i":case"ii":return $o(e.length,t);case"io":return i.ordinalNumber(t,{unit:"day"});case"iii":return i.day(t,{width:"abbreviated",context:"formatting",valueCallback:s})||i.day(t,{width:"short",context:"formatting",valueCallback:s})||i.day(t,{width:"narrow",context:"formatting",valueCallback:s});case"iiiii":return i.day(t,{width:"narrow",context:"formatting",valueCallback:s});case"iiiiii":return i.day(t,{width:"short",context:"formatting",valueCallback:s})||i.day(t,{width:"narrow",context:"formatting",valueCallback:s});case"iiii":default:return i.day(t,{width:"wide",context:"formatting",valueCallback:s})||i.day(t,{width:"abbreviated",context:"formatting",valueCallback:s})||i.day(t,{width:"short",context:"formatting",valueCallback:s})||i.day(t,{width:"narrow",context:"formatting",valueCallback:s})}},validate:function(t,e,i){return e>=1&&e<=7},set:function(t,e,i,n){return(t=function(t,e){yt(2,arguments);var i=Pt(e);i%7==0&&(i-=7);var n=1,s=vt(t),r=s.getUTCDay(),o=i%7,a=(o+7)%7,l=(a<n?7:0)+i-r;return s.setUTCDate(s.getUTCDate()+l),s}(t,i,n)).setUTCHours(0,0,0,0),t},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:{priority:80,parse:function(t,e,i,n){switch(e){case"a":case"aa":case"aaa":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}},set:function(t,e,i,n){return t.setUTCHours(Ko(i),0,0,0),t},incompatibleTokens:["b","B","H","K","k","t","T"]},b:{priority:80,parse:function(t,e,i,n){switch(e){case"b":case"bb":case"bbb":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}},set:function(t,e,i,n){return t.setUTCHours(Ko(i),0,0,0),t},incompatibleTokens:["a","B","H","K","k","t","T"]},B:{priority:80,parse:function(t,e,i,n){switch(e){case"B":case"BB":case"BBB":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}},set:function(t,e,i,n){return t.setUTCHours(Ko(i),0,0,0),t},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(t,e,i,n){switch(e){case"h":return zo(Eo,t);case"ho":return i.ordinalNumber(t,{unit:"hour"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=1&&e<=12},set:function(t,e,i,n){var s=t.getUTCHours()>=12;return s&&i<12?t.setUTCHours(i+12,0,0,0):s||12!==i?t.setUTCHours(i,0,0,0):t.setUTCHours(0,0,0,0),t},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(t,e,i,n){switch(e){case"H":return zo(Co,t);case"Ho":return i.ordinalNumber(t,{unit:"hour"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=0&&e<=23},set:function(t,e,i,n){return t.setUTCHours(i,0,0,0),t},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(t,e,i,n){switch(e){case"K":return zo(Mo,t);case"Ko":return i.ordinalNumber(t,{unit:"hour"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=0&&e<=11},set:function(t,e,i,n){return t.getUTCHours()>=12&&i<12?t.setUTCHours(i+12,0,0,0):t.setUTCHours(i,0,0,0),t},incompatibleTokens:["a","b","h","H","k","t","T"]},k:{priority:70,parse:function(t,e,i,n){switch(e){case"k":return zo(xo,t);case"ko":return i.ordinalNumber(t,{unit:"hour"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=1&&e<=24},set:function(t,e,i,n){var s=i<=24?i%24:i;return t.setUTCHours(s,0,0,0),t},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(t,e,i,n){switch(e){case"m":return zo(Oo,t);case"mo":return i.ordinalNumber(t,{unit:"minute"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=0&&e<=59},set:function(t,e,i,n){return t.setUTCMinutes(i,0,0),t},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(t,e,i,n){switch(e){case"s":return zo(Do,t);case"so":return i.ordinalNumber(t,{unit:"second"});default:return $o(e.length,t)}},validate:function(t,e,i){return e>=0&&e<=59},set:function(t,e,i,n){return t.setUTCSeconds(i,0),t},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(t,e,i,n){return $o(e.length,t,(function(t){return Math.floor(t*Math.pow(10,3-e.length))}))},set:function(t,e,i,n){return t.setUTCMilliseconds(i),t},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(t,e,i,n){switch(e){case"X":return Yo(Bo,t);case"XX":return Yo(Vo,t);case"XXXX":return Yo(Wo,t);case"XXXXX":return Yo(Go,t);case"XXX":default:return Yo(jo,t)}},set:function(t,e,i,n){return e.timestampIsSet?t:new Date(t.getTime()-i)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(t,e,i,n){switch(e){case"x":return Yo(Bo,t);case"xx":return Yo(Vo,t);case"xxxx":return Yo(Wo,t);case"xxxxx":return Yo(Go,t);case"xxx":default:return Yo(jo,t)}},set:function(t,e,i,n){return e.timestampIsSet?t:new Date(t.getTime()-i)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(t,e,i,n){return qo(t)},set:function(t,e,i,n){return[new Date(1e3*i),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(t,e,i,n){return qo(t)},set:function(t,e,i,n){return[new Date(i),{timestampIsSet:!0}]},incompatibleTokens:"*"}},ia=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,na=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sa=/^'([^]*?)'?$/,ra=/''/g,oa=/\S/,aa=/[a-zA-Z]/;function la(t,e,i,n){yt(3,arguments);var s=String(t),r=String(e),o=n||{},a=o.locale||Js;if(!a.match)throw new RangeError("locale must contain match property");var l=a.options&&a.options.firstWeekContainsDate,c=null==l?1:Pt(l),u=null==o.firstWeekContainsDate?c:Pt(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=a.options&&a.options.weekStartsOn,d=null==h?0:Pt(h),p=null==o.weekStartsOn?d:Pt(o.weekStartsOn);if(!(p>=0&&p<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===r)return""===s?vt(i):new Date(NaN);var f,m={firstWeekContainsDate:u,weekStartsOn:p,locale:a},g=[{priority:10,subPriority:-1,set:ca,index:0}],y=r.match(na).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,wr[e])(t,a.formatLong,m):t})).join("").match(ia),v=[];for(f=0;f<y.length;f++){var b=y[f];!o.useAdditionalWeekYearTokens&&Or(b)&&Dr(b,r,t),!o.useAdditionalDayOfYearTokens&&Er(b)&&Dr(b,r,t);var T=b[0],S=ea[T];if(S){var A=S.incompatibleTokens;if(Array.isArray(A)){for(var P=void 0,w=0;w<v.length;w++){var C=v[w].token;if(-1!==A.indexOf(C)||C===T){P=v[w];break}}if(P)throw new RangeError("The format string mustn't contain `".concat(P.fullToken,"` and `").concat(b,"` at the same time"))}else if("*"===S.incompatibleTokens&&v.length)throw new RangeError("The format string mustn't contain `".concat(b,"` and any other token at the same time"));v.push({token:T,fullToken:b});var x=S.parse(s,b,a.match,m);if(!x)return new Date(NaN);g.push({priority:S.priority,subPriority:S.subPriority||0,set:S.set,validate:S.validate,value:x.value,index:g.length}),s=x.rest}else{if(T.match(aa))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if("''"===b?b="'":"'"===T&&(b=ua(b)),0!==s.indexOf(b))return new Date(NaN);s=s.slice(b.length)}}if(s.length>0&&oa.test(s))return new Date(NaN);var M=g.map((function(t){return t.priority})).sort((function(t,e){return e-t})).filter((function(t,e,i){return i.indexOf(t)===e})).map((function(t){return g.filter((function(e){return e.priority===t})).sort((function(t,e){return e.subPriority-t.subPriority}))})).map((function(t){return t[0]})),E=vt(i);if(isNaN(E))return new Date(NaN);var O=er(E,Cr(E)),D={};for(f=0;f<M.length;f++){var L=M[f];if(L.validate&&!L.validate(O,L.value,m))return new Date(NaN);var I=L.set(O,D,L.value,m);I[0]?(O=I[0],bo(D,I[1])):O=I}return O}function ca(t,e){if(e.timestampIsSet)return t;var i=new Date(0);return i.setFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),i.setHours(t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()),i}function ua(t){return t.match(sa)[1].replace(ra,"'")}var ha=Qr(la,3),da=Qr(tr,2);class pa{constructor(t,e,i){this.symbol=t,this.aggregation=e,this.offset=i||0,this.previousTime=new Date(0),this.dateFormat=this.getDateFormat(),this.timeZone=this.getTimeZone(),this.hasOpenInterest=kt(t)}makeContainer(){return new Vr(Xr(this.symbol,this.aggregation))}parse(t){this.container=this.makeContainer();const e=t.split("\n"),i=this.getParseFunc();if(null!==i){const t=i.bind(this);e.forEach(e=>{const i=e.trim();if(i){const e=i.split(",");t(e)}})}return this.container}getParseFunc(){return this.aggregation.isTick?this.parseTick:this.aggregation.isIntraday?this.parseMinutes:this.parseEod}parseTick(t){const e=t.length-5;0!==e&&1!==e||(this.container.addDataPoint(Wn.DateTime,this.parseDate(t[0+e])),this.container.addDataPoint(Wn.Last,parseFloat(t[3+e])),this.container.addDataPoint(Wn.TradeSize,parseInt(t[4+e])),this.container.addDataPoint(Wn.Change,this.calculateChange(Wn.Last)))}nullify(t){return 0===t?null:t}parseMinutes(t){let e=this.symbol.includes("*")?1:0;t.length===7+e&&(this.container.addDataPoint(Wn.DateTime,this.parseDate(t[0+e])),this.container.addDataPoint(Wn.Open,parseFloat(t[2+e])),this.container.addDataPoint(Wn.High,parseFloat(t[3+e])),this.container.addDataPoint(Wn.Low,parseFloat(t[4+e])),this.container.addDataPoint(Wn.Close,parseFloat(t[5+e])),this.container.addDataPoint(Wn.Volume,this.nullify(parseInt(t[6+e]))),this.container.addDataPoint(Wn.Change,this.calculateChange()))}parseEod(t){const e=this.aggregation.isMultiContract,i=7+(this.hasOpenInterest?1:0);t.length===i&&(e&&this.container.addDataPoint(Wn.Symbol,t[0]),this.container.addDataPoint(Wn.DateTime,this.parseDate(t[1])),this.container.addDataPoint(Wn.Open,parseFloat(t[2])),this.container.addDataPoint(Wn.High,parseFloat(t[3])),this.container.addDataPoint(Wn.Low,parseFloat(t[4])),this.container.addDataPoint(Wn.Close,parseFloat(t[5])),this.container.addDataPoint(Wn.Volume,this.nullify(parseInt(t[6]))),this.hasOpenInterest&&this.container.addDataPoint(Wn.OpenInterest,this.nullify(parseInt(t[7]))),this.container.addDataPoint(Wn.Change,this.calculateChange()))}calculateChange(t=Wn.Close){const e=this.container.size;if(e>1){const i=this.container.getData(t);return i[e-1]-i[e-2]}return 0}getDateFormat(){switch(this.aggregation.unit){case u.Tick:return te.FMT_HIST_FEED_TICK;case u.Intraday:return te.FMT_HIST_FEED_INTRADAY;default:return te.FMT_ISO_DATE_ONLY}}parseDate(t){const e=ha(new Date,this.dateFormat);if(this.aggregation.isEndOfDay)return L(e,oo(this.offset))(t);{const i=e(t);return!function(t,e){yt(2,arguments);var i=vt(t),n=vt(e);return i.getTime()>n.getTime()}(i,this.previousTime)?this.previousTime=da(1)(this.previousTime):this.previousTime=i,this.previousTime}}getTimeZone(){return Ht(this.symbol)}}class fa{getPageNameFor(t){switch(t.unit){case u.Tick:return te.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case u.Intraday:return t.spec===h.FormT?te.BARCHART_HIST_SRV_FORMT_INTRADAY_PAGE_NAME:te.BARCHART_HIST_SRV_INTRADAY_PAGE_NAME;case u.Day:case u.Week:case u.Month:case u.Quarter:case u.Year:return te.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(t){}makeUrl(t){let e={};const i=ue(t.symbol);e.symbol=i;let n=this.getDataParam(t.aggregation);n.length>0&&(e.data=n),t.aggregation.size>1&&t.aggregation.unit===u.Intraday&&(e.interval=t.aggregation.size.toString());const[s,r]=t.range;if(null!==s)e.start=this.toHistoricalFeedDate(s,t.aggregation);else{let i=t.barsToFetch||te.DEFAULT_MAX_RECORDS;t.aggregation.unit===u.Tick&&t.aggregation.spec!==h.None&&(i*=te.TICK_CUSTOM_AGG_MULTIPLIER),e.maxrecords=i.toString()}null!==r&&(e.end=this.toHistoricalFeedDate(r,t.aggregation)),e.volume=t.aggregation.isContractVolume?"contract":"total",e.order="asc",e.dividends=t.aggregation.dividendsAdjust.toString(),e.backadjust=t.aggregation.backAdjust.toString(),e.daystoexpiration=t.aggregation.daysToExpiration.toString(),e.contractroll=t.aggregation.contractRoll,t.aggregation.isTick&&(e.type="T",e.skipOldEmulation="true"),this.addExtraParams(e);let o=at(e),a=this.getPageNameFor(t.aggregation);return"/".concat(a,"?").concat(o)}toHistoricalFeedDate(t,e){return kr(t,e.isTick||e.isIntraday?te.FMT_HIST_FEED_PARAM_DATE_TIME:te.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(t){let e="";const i=this.getSpecPart(t);switch(t.unit){case u.Tick:case u.Intraday:break;case u.Day:e="daily".concat(i);break;case u.Week:e="weekly".concat(i);break;case u.Month:e="monthly".concat(i);break;case u.Quarter:e="quarterly".concat(i);break;case u.Year:e="yearly".concat(i)}return e}getSpecPart(t){return t.isMultiContract?t.spec===h.Continue?"continue":"nearest":""}getParser(t){const e=ue(t.symbol);return new pa(e,t.aggregation,t.offset)}async retrieve(t){const e=this.makeUrl(t),i=t.aggregation.unit===u.Tick?"timeseriesNew":"timeseries",n=await Qf(i,e);return this.getParser(t).parse(n)}}class ma{async retrieve(t){const e=ue(t.symbol),i=()=>new Vr(Xr(e,t.aggregation));if(t.aggregation.unit!==u.Day)return i();const n="/getEquityOptionsHistory.json?".concat(at({symbol:e})),s=await Qf("ondemand",n);try{const t=JSON.parse(s);if(200===t.status.code){const e=t.results,n=i();let s=null;return e.forEach(t=>{n.addDataPoint(Wn.DateTime,la(t.date,te.FMT_ISO_DATE_ONLY,0)),n.addDataPoint(Wn.Open,t.open),n.addDataPoint(Wn.High,t.high),n.addDataPoint(Wn.Low,t.low),n.addDataPoint(Wn.Close,t.close),n.addDataPoint(Wn.Volume,t.volume),n.addDataPoint(Wn.OpenInterest,t.openInterest);const e=null===s?null:Z(t.close-s,2);n.addDataPoint(Wn.Change,e),s=t.close}),n}}catch(t){Kf("Failed parsing the equity option JSON historical data result, error is ".concat(t.message))}return i()}}var ga=i(0),ya=i.n(ga);function va(t,e){return function(i){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return i.lift(new ba(t,e))}}var ba=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Ta(t,this.project,this.thisArg))},t}(),Ta=function(t){function e(e,i,n){var s=t.call(this,e)||this;return s.project=i,s.count=0,s.thisArg=n||s,s}return ss(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(gs);var Sa=Qr((function(t,e){yt(2,arguments);var i=Pt(e);return eo(t,-i)}),2);class Aa{constructor(t){this.query=t,this.container=null,this.canLoadMoreData=!0,this.alignToQuote=!1,this.record=new $n(t.symbol)}refresh(){this.query.aggregation.isEndOfDay?this.alignToQuote=!0:this.loadMoreData(!1)}makeInnerBuilder(t){const e=this.query.aggregation;if(!e.isTick)return new uo(t,e,this.query.symbol);switch(e.spec){case h.None:return new co(t);case h.PerSeconds:return new uo(t,e,this.query.symbol);case h.PerCount:case h.PerVolume:case h.PerRange:default:throw new Error("Custom tick aggregation ".concat(e.describe()," has not been implemented yet"))}}makeBuilder(t){const e=this.makeInnerBuilder(t);return this.query.curveStyle===c.Renko?new vo(e,this.query):e}onStreamingUpdates(t){if(this.isLoading)return;t.map(t=>{if(t.isTrade)return this.builder.process(t);if(t.isQuote&&this.alignToQuote){const e=this.builder.alignToQuote(t);return this.alignToQuote=!1,e}return null}).filter(t=>K(t)).filter((t,e,i)=>{if(0===e)return!0;const n=i[e-1];return n.isUpdate!==t.isUpdate||n.time!==t.time}).forEach(t=>{if(-1===t.index)ya.a.publish(jn.TS_MANYCHANGED,{series:this,part:x.Unspecified});else{const e={series:this,index:t.index};ya.a.publish(t.isUpdate?jn.TS_DATAPOINTCHANGED:jn.TS_DATAPOINTADDED,e)}})}get hasData(){return null!==this.container}getRetriever(){return It(this.query.symbol)?new ma:new fa}getStreamingSubscription(){return im().getRecordSource().subject.pipe(va(t=>{const e=this.query.aggregation.isEndOfDay,i=is(jn.RT_TRADE,this.record.symbol),n=t.filter(i).filter(t=>K(t.data.time)).filter(t=>e||"T"!==t.data.session).map(t=>{const i={isTrade:!0,tradePrice:t.data.tradePrice,tradeSize:t.data.tradeSize,time:t.data.time};return(t=>e&&"T"===t.data.session)(t)&&delete i.tradePrice,i}).reduce((t,e)=>{const i=V(t);var n;return K(i)&&K(i.tradePrice)&&K(e.tradePrice)&&i.tradePrice===e.tradePrice&&i.time.getTime()===e.time.getTime()?i.tradeSize+=e.tradeSize:t.push((n=e,Object.assign({},n))),t},[]),s=is(jn.RT_QUOTE,this.record.symbol);return n.concat(t.filter(s).map(t=>({isQuote:!0,openPrice:t.data.openPrice,highPrice:t.data.highPrice,lowPrice:t.data.lowPrice,lastPrice:t.data.lastPrice,time:t.data.tradeTime})))}),Bs(t=>t.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async loadMoreData(t=!0){if(this.isLoading)return Promise.resolve();this.isLoading=!0,t?await this.loadHeadChunk():await this.loadTailChunk(),this.isLoading=!1}async loadTailChunk(){this.query.range=[this.container.getLastDataPoint(Wn.DateTime),null];const t=await this.retriever.retrieve(this.query),e=this.container.size,i=this.container.append(t);ya.a.publish(jn.TS_MANYCHANGED,{series:this,part:x.Tail,count:i,index:e})}async loadHeadChunk(){this.query.range=[null,this.container.getData(Wn.DateTime)[0]];const t=await this.retriever.retrieve(this.query);this.canLoadMoreData=t.size===this.query.barsToFetch,t.size>0&&(this.container.prepend(t),ya.a.publish(jn.TS_MANYCHANGED,{series:this,part:x.Head}))}async applyNearbyFixup(t){const e=this.query.aggregation,i=e.spec===h.Nearest,n=this.query.symbol,s=Ot(n);return!s||!e.isMultiContract||!i||t.size<1||this.isCotSeries?s&&Rt(n)?await Et(n):n:t.getLastDataPoint(Wn.Symbol)}async ready(){return Qt.call(this,async()=>{this.retriever=this.getRetriever();const t=await this.retriever.retrieve(this.query),e=await this.applyNearbyFixup(t);return this.record=im().getRecordSource().getRecord(e),this.canLoadMoreData=t.size===this.query.barsToFetch,this.builder=this.makeBuilder(t),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0})}getCacheableEntities(t){t.add(this)}shutdown(){K(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class Pa{constructor(t){this.query=t,this.container=new Wr}get hasData(){return!1}async ready(){return!1}getCacheableEntities(t){}shutdown(){}}class wa{constructor(t){this.query=t,this.container=null}get hasData(){return null!==this.container}shutdown(){}parseEvents(t){var e=new Vr([Wn.DateTime,Wn.Dividends,Wn.Earnings,Wn.Splits,Wn.Custom]);let i=t.split("\n");const n=(t,i,n,s)=>{const r=i===n?s:null;e.addDataPoint(t,r)};return i.forEach(t=>{if(""===t.trim())return;let i=t.split(",");if(4===i.length){var s=la(i[1],te.FMT_ISO_DATE_ONLY,new Date);e.addDataPoint(Wn.DateTime,s),n(Wn.Dividends,"Dividend",i[2],i[3]),n(Wn.Earnings,"Earnings",i[2],i[3]),n(Wn.Splits,"Split",i[2],i[3]),n(Wn.Custom,"Custom","Custom","Z")}}),e}makeUrl(){let t={};t.symbols=this.query.symbol,t.start="19700102",t.end="20501230",te.EVENTS_BUILT_IN.forEach(e=>t[e]=this.query[e]);let e=at(t);return"/queryevents.ashx?".concat(e)}async retrieve(){const t=this.makeUrl(),e=await Qf("timeseries",t);return this.parseEvents(e)}async ready(){return Qt.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(t){t.add(this)}}class Ca{constructor(t){this.query=t,this.container=null}get hasData(){return null!==this.container}shutdown(){}parseFundamental(t){let e=JSON.parse(t);const i=e.status.code,n=204===i;if(200!==i&&!n)return null;let s=new Vr(this.query.fields.concat(Wn.DateTime));if(n)return s;let r=this.query.fields[0],o=r.id.substring(0,1).toLowerCase()+r.id.substring(1);return e.results.reverse().forEach(t=>{s.addDataPoint(Wn.DateTime,la(t.date,te.FMT_ISO_DATE_ONLY,new Date)),s.addDataPoint(r,parseInt(t[o]))}),s}makeUrl(){let t={count:0,rawData:1};t.symbols=this.query.symbol,t.frequency=this.query.aggregation.unit===u.Quarter?"Quarter":"Annual";let e=at(t),i=this.query.seriesKind===b.BalanceSheet?"getBalanceSheets":"getIncomeStatements";return"/".concat(i,".json?").concat(e)}async retrieve(){const t=this.makeUrl(),e=await Qf("ondemand",t);return this.parseFundamental(e)}async ready(){return Qt.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(t){t.add(this)}}function xa(t,e){const i=t.findIndex(t=>t>e);return Math.max(i<0?t.length:i,0)}class Ma{constructor(t){this.query=t;const e=im().getRecordSource();this.records=t.symbols.reduce((t,i)=>{const n=e.getRecord(i);return n.addFields(Wn.DateTime,Wn.Symbol),n.update(Wn.DateTime,Bt(i)),n.update(Wn.Symbol,i),t[i]=n,t},{}),this.dataPoints=t.symbols.length,this.container=null,this.fields=[Wn.DateTime,Wn.Close,Wn.Symbol]}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}getStreamingSubscription(){return im().getRecordSource().subject.pipe(Bs(t=>t.length>0)).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(t){t.map(t=>{const e=t.data,i=this.records[e.symbol];return K(i)?this.setDataFor(i):null}).filter(t=>K(t)).reduce((t,e)=>(t.add(e),t),new Set);ya.a.publish(jn.TS_MANYCHANGED,{series:this,part:x.Unspecified})}findOrAddIndex(t){let e=this.container.getData(Wn.Symbol).indexOf(t.symbol);if(e<0){const i=this.container.getData(Wn.DateTime),n=Bt(t.symbol);e=xa(i,n),this.fields.forEach(t=>this.container.getData(t).splice(e,0,null))}return e}setDataFor(t,e=!0){if(!this.fields.every(e=>K(t.getValue(e))))return;const i=this.findOrAddIndex(t);return this.fields.forEach(e=>this.container.getData(e)[i]=t.getValue(e)),e?i:null}async retrieve(){const t=Object.values(this.records);return(await Promise.all(t.map(t=>t.ready()))).every(I)&&(this.container=new Vr(this.fields),t.forEach(t=>this.setDataFor(t,!1)),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return Qt.call(this,async()=>await this.retrieve())}getCacheableEntities(t){t.add(this)}shutdown(){K(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class Ea{constructor(t){this.query=t,this.fields=[Wn.DateTime,Wn.Close,Wn.Symbol],this.container=null}get hasData(){return null!==this.container}insertValues(t,e,i){const n=(e,i,n)=>t.getData(i).splice(e,0,n),s=t.getData(Wn.DateTime),r=Bt(e),o=xa(s,r);n(o,Wn.DateTime,r),n(o,Wn.Close,i),n(o,Wn.Symbol,e)}parseHistoricalForward(t){const e=new Vr(this.fields);return t.split("\n").filter(t=>t.trim().length>0).forEach(t=>{const i=t.split(","),n=i[0];this.insertValues(e,n,parseFloat(i[5]))}),e}makeUrl(){let t={};t.symbols=this.query.symbols.join(","),t.maxrecords=1,t.data="daily",t.end=L(Sa(this.query.offset),ao(te.FMT_HIST_FEED_PARAM_DATE_ONLY))(new Date);let e=at(t);return"/querylatesteod.ashx?".concat(e)}async retrieve(){const t=this.makeUrl(),e=await Qf("timeseries",t);return this.parseHistoricalForward(e)}async ready(){return Qt.call(this,async()=>(this.container=await this.retrieve(),!0))}getCacheableEntities(t){t.add(this)}}class Oa{constructor(t=!1){this.cacheSeries=t,this.seriesCache=new Map}getTimeSeries(t){return K(t.symbol)&&t.symbol===te.PLACEHOLDER_SYMBOL_NAME?new Pa(t):this.getSeries(t)}evictUnused(t){for(const[e,i]of this.seriesCache)!t.has(i)&&i.isCached&&(i.isCached=!1,i.shutdown(),this.seriesCache.delete(e))}refresh(){for(const t of this.seriesCache.values())"function"==typeof t.refresh&&t.refresh()}getSeries(t){const e=t.cacheMe&&this.cacheSeries,i=t.getHashKey();if(e&&this.seriesCache.has(i))return this.seriesCache.get(i);var n=this.makeSeries(t);return n.isCached=e,e&&this.seriesCache.set(i,n),n}makeSeries(t){switch(t.seriesKind){case b.Normal:return new Aa(t);case b.BalanceSheet:case b.IncomeStatement:return new Ca(t);case b.Events:return new wa(t);case b.Forward:return new Ma(t);case b.HistoricalForward:return new Ea(t);default:case b.Study:throw new Error("The series kind '".concat(b[t.seriesKind],"' is not supported yet."))}}}var Da=i(1),La=i.n(Da),Ia={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}};var _a={date:zs({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:zs({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:zs({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Na={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"};var Ra={code:"fr",formatDistance:function(t,e,i){var n;return i=i||{},n="string"==typeof Ia[t]?Ia[t]:1===e?Ia[t].one:Ia[t].other.replace("{{count}}",e),i.addSuffix?i.comparison>0?"dans "+n:"il y a "+n:n},formatLong:_a,formatRelative:function(t,e,i,n){return Na[t]},localize:{ordinalNumber:function(t,e){var i=Number(t),n=String((e||{}).unit);return 0===i?i:i+("year"===n||"hour"===n||"week"===n?1===i?"ère":"ème":1===i?"er":"ème")},era:$s({values:{narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},defaultWidth:"wide"}),quarter:$s({values:{narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},defaultWidth:"wide",argumentCallback:function(t){return Number(t)-1}}),month:$s({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},defaultWidth:"wide"}),day:$s({values:{narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},defaultWidth:"wide"}),dayPeriod:$s({values:{narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},defaultWidth:"wide"})},match:{ordinalNumber:Xs({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}}),era:Ks({matchPatterns:{narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^av/i,/^ap/i]},defaultParseWidth:"any"}),quarter:Ks({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](er|ème|e)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Ks({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Ks({matchPatterns:{narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ks({matchPatterns:{narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:4}};function ka(t){yt(1,arguments);var e=vt(t);return e.setMinutes(0,0,0),e}function Ha(t,e){yt(2,arguments);var i=ka(t),n=ka(e);return i.getTime()===n.getTime()}function Fa(t){yt(1,arguments);var e=vt(t);return e.setSeconds(0,0),e}function Ua(t,e){yt(2,arguments);var i=vt(t),n=vt(e);return i.getTime()-n.getTime()}function Ba(t){yt(1,arguments);var e=vt(t),i=e.getDay();return i}const Va=/{value:([^}]+)}/,Wa=/%([aAdewbBmyYHkIlMpPSL])+/g,ja={Second:{Period:"PT1S",Multipliers:[.01,.02,.05,.1,.2,.5,1,2,5,10,15,30]},Minute:{Period:"PT1M",Multipliers:[1,2,5,10,15,30]},Hour:{Period:"PT1H",Multipliers:[1,2,3,4,6,8,12]},Day:{Period:"P1D",Multipliers:[1,2]},Week:{Period:"P1W",Multipliers:[1,2]},Month:{Period:"P1M",Multipliers:[1,2,3,4,6]},Year:{Period:"P1Y",Multipliers:[1,2,5,10,25,50,100,250]}};const Ga=new Map;function za(t){if(!K(t))return null;if(!Ga.has(t)){const i=K(e=t)?e.replace(Va,(t,e)=>e.replace(Wa,(t,e)=>te.PHP_TO_UNICODE_TS_35_MAP[e])):e;Ga.set(t,i)}var e;return Ga.get(t)}class Ya{constructor({barWidth:t,unitWidth:e,formatString:i,minTickInterval:n,duration:s},r){this.size=r,this.barWidth=t,this.unitWidth=e,this.minTickInterval=n,this.duration=s,this.format=za(i),this.prevDate=null}get noPrevDate(){return!K(this.prevDate)}formatDate(t,e){return rl(t,this.format||e)}asTick(t,e,i){return this.prevDate=t,{date:t,priority:e,text:this.formatDate(t,i)}}checkPrev(t){return!!this.noPrevDate&&(this.prevDate=t,!0)}}const qa=()=>function(){switch(sl()){case"fr":return!0;default:return!1}}()?"d LLL":"LLL d";class $a extends Ya{constructor(t){super(t),this.repeatEach=te.TIME_SCALE_MAX_SPACE_NO_TICKS/this.barWidth,this.repeatCounter=0}asTick(t,e,i){return this.repeatCounter=0,super.asTick(t,e,i)}getTick(t){if(!Tt(this.prevDate,t))return this.asTick(t,1,"EEE");if(!Ha(this.prevDate,t))return this.asTick(t,2,"HH:mm");this.repeatCounter++;const e=this.repeatCounter===this.repeatEach;return!function(t,e){yt(2,arguments);var i=Fa(t),n=Fa(e);return i.getTime()===n.getTime()}(this.prevDate,t)||e?this.asTick(t,e?4:3,"HH:mm"):null}}const Xa=t=>function(t,e){yt(2,arguments);var i=Ua(t,e)/1e3;return i>0?Math.floor(i):Math.ceil(i)}(t,bt(t));class Ka extends Ya{getTick(t){const e=this.checkPrev(t),i=0===this.minTickInterval||0==Xa(t)%(this.minTickInterval/1e3),n=!Tt(this.prevDate,t),s=function(t){yt(1,arguments);var e=vt(t),i=e.getMinutes();return i}(t),r=!Ha(this.prevDate,t)||e&&0===s;if(i){if(n)return this.asTick(t,1,qa());if(r)return this.asTick(t,2,"HH:mm");if(0==s%30&&this.size<15)return this.asTick(t,3,"HH:mm");if(0==s%15&&this.size<=5)return this.asTick(t,4,"HH:mm")}return null}}class Za extends Ya{constructor(t){super(t),this.monthDay=this.duration<22*ja.Day.One,this.monthYear=this.duration>22*ja.Day.One&&this.duration<7*ja.Month.One,this.year=this.duration>7*ja.Month.One}useTuesday(t){return!!this.noPrevDate||2===Ba(t)&&Ua(t,this.prevDate)>1728e5}getTick(t){this.checkPrev(t);const e=!Gi(t,this.prevDate),i=!Vi(t,this.prevDate);return this.monthDay?1===Ba(t)||this.useTuesday(t)?this.asTick(t,1,qa()):null:this.monthYear?e?this.asTick(t,1,"LLL ''yy"):null:this.year&&i?this.asTick(t,1,"yyyy"):null}}class Qa extends Ya{constructor(t){super(t),this.monthDay=this.duration<4*ja.Week.One,this.monthYear=this.duration>4*ja.Week.One&&this.duration<6*ja.Month.One,this.year=this.duration>6*ja.Month.One}getTick(t){this.checkPrev(t);const e=!Gi(t,this.prevDate),i=!Vi(t,this.prevDate);return this.monthDay?this.asTick(t,1,qa()):this.monthYear?e?this.asTick(t,1,"LLL ''yy"):null:this.year&&i?this.asTick(t,1,"yyyy"):null}}class Ja extends Ya{constructor(t){super(t),this.showMonths=this.duration<7*ja.Month.One}getTick(t){this.checkPrev(t);const e=!Vi(t,this.prevDate);return this.showMonths?this.asTick(t,1,"LLL ''yy"):e?this.asTick(t,1,"yyyy"):null}}class tl extends Ya{constructor(t){super(t)}getTick(t){this.checkPrev(t);return!Vi(t,this.prevDate)?this.asTick(t,1,"yyyy"):null}}function el(t){return K(t)?"".concat(t.toFixed(2)," %"):""}function il(t,e,i=!1){if(t.comparison===g.Percent)return el(e);const n=t.plots[0],s=n.curves[0],r=K(s)&&s.fields.length>0?s.fields[0]:null;if(!K(r))return"";const o={range:t.fullDomain,allDigits:!1,forceTrailingZeros:i};return n.metaData.format(e,r,o)}function nl(t,e,i){const n=i||t.display.xAxis.format;if(K(n)){return rl(e,za(n))}const s=t.data.aggregation;return s.isEndOfDay?ol(s,e):al(s,e)}function sl(){const t=tt(im().config,null,"overrides","xAxis","getLocaleName");if(K(t)&&"function"==typeof t)try{return t()}catch(t){Kf("Failed retrieving the locale name, error is ".concat(t.message),"warn")}}function rl(t,e){return kr(t,e,function(){switch(sl()){case"fr":return{locale:Ra};default:return}}())}function ol(t,e){if(!js(e))return"";switch(t.unit){case u.Tick:case u.Intraday:case u.Day:case u.Week:default:return rl(e,"P");case u.Month:return rl(e,"LLL yyyy");case u.Quarter:return rl(e,"qqq yyyy");case u.Year:return rl(e,"yyyy")}}function al(t,e){if(!js(e))return"";return rl(e,t.isTick?"pp":"p")}const ll=(t,e)=>t.at(e);class cl{constructor(t){this.presenter=t,this._dates=[],this.invalidate()}checkRebuild(){this.pendingRebuild&&this.rebuild()}get withPrologLength(){return this.checkRebuild(),this._dates.length+te.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+te.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return te.TIMELINE_PROLOG_PADDING_BARS}get lastSeriesIndex(){return this.checkRebuild(),0===this._dates.length?0:this.withPrologLength-1}get withoutPrologEpilogLength(){return this.checkRebuild(),this._dates.length}at(t){if(this.checkRebuild(),t<0||t>=this.withPrologEpilogLength)return null;if(t<te.TIMELINE_PROLOG_PADDING_BARS){const e=W(this._dates),i=t-te.TIMELINE_PROLOG_PADDING_BARS;return this.getDateShift(i)(e)}if(t>=this.withPrologLength){const e=V(this._dates),i=t-this.withPrologLength+1;return this.getDateShift(i)(e)}return this._dates[t-te.TIMELINE_PROLOG_PADDING_BARS]}get length(){return this.checkRebuild(),this._dates.length>0?this.withPrologEpilogLength:0}slice(t,e){this.checkRebuild();const i=[];for(let n=t;n<e;++n)i.push(this.at(n));return i}mergeDateIntoTimeline(t,e=!0){e&&this.checkRebuild();const i=+t,n=G(this._dates,i,Number),s=+this._dates[n];if(s!==i){const e=n+(i>s?1:0);return this._dates.splice(e,0,t),e+this.firstSeriesIndex}return-1}invalidate(){this._dates.length=0,this.pendingRebuild=!0}rebuild(){if(this.presenter.isEmpty)return;const t=this.presenter.mainPlot.timeSeries;if(!t.hasData)return;const e=t.container.getTimeData();for(let t=e.length-1;t>=0;t--)this._dates[t]=e[t];this.presenter.allPlots.forEach(e=>{if(e.timeSeries===t)return;if(!e.timeSeries.hasData)return;e.timeSeries.container.getTimeData().forEach(t=>this.mergeDateIntoTimeline(t,!1))}),this.pendingRebuild=!1}getDateShift(t){const{unit:e,size:i}=this.presenter.data.aggregation;switch(e){case u.Year:return oo(t);case u.Quarter:return ro(t);case u.Month:return so(t);case u.Week:return no(t);case u.Day:return io(t);case u.Intraday:return to(i*t);case u.Tick:return Jr(t)}}}const ul={delete:'<path d="M5.293 6.707l5.293 5.293-5.293 5.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0l5.293-5.293 5.293 5.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-5.293-5.293 5.293-5.293c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-5.293 5.293-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"></path>',circle:'<circle cx="12" cy="12" r="12"/>',rectangle:'<rect width="24" height="24"/>',chevronUp:'<path d="M18.707 14.293l-6-6c-0.391-0.391-1.024-0.391-1.414 0l-6 6c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0l5.293-5.293 5.293 5.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"></path>',chevronDown:'<path d="M5.293 9.707l6 6c0.391 0.391 1.024 0.391 1.414 0l6-6c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-5.293 5.293-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"></path>'};function hl(t){return!0===im().config.useAllFieldsForComparison&&t.mainPlot.mainCurve.isOhlc&&t.mainAxis.comparison===g.None&&t.mainPane.axes.map(t=>t.plots).flat().reduce((t,e)=>t+(e.isSymbol?1:0),0)>1}function dl({plots:t,isMultiSymbol:e,isMultiContract:i,date:n,time:s}){const r=[vl("Date",n,null,"heading"),s?vl("Time",s,null,"heading"):""],o=t.map(t=>{if(0===t.values.length)return null;const n=(t=>(e||i)&&t.type===v.Symbol||e&&t.type===v.Expression&&t.isMain)(t)?bl(v[t.type],t.name,t.values[0].color):"",s=t.values.map(t=>vl(t.longName,t.value,t.color));if(t.events&&t.events.length){const e=t.events.map(t=>bl("".concat(t.field.name," (").concat(ol(u.Day,t.date),")"),t.value,t.color));s.push(...e)}return s.unshift(n),s}).flat(),a=r.concat(o).filter(t=>""!==t).join("");return'<table class="values-table">'.concat(a,"</table>")}function pl(t,{panes:e,date:i,time:n,isMultiSymbol:s},r=!1,o=!1,a=!1){return e.map((l,c)=>{const u=r?l.plots:l.plots.filter(t=>!t.isMain),h=t.mainPlot.axis.pane.id===l.id,d=a&&h?'<span class="field-name" style="padding-right:5px">'.concat(i," ").concat(n||"","</span>"):"",p=u.map(e=>function(t,e,i,n,s){const{id:r,name:o,type:a,error:l,description:c,values:u,events:h,isMain:d}=t,p=l||c,f="value-title".concat(d?" value-main":""),m=v[a],g=!["Study","BalanceSheet","IncomeStatement"].includes(m)&&("Expression"!==m||i)||s.hasLegend&&i?"":Sl(r),y=hl(s)&&t.type===v.Symbol,b=(d||y)&&(!n||t.values.length>1),T=e?u.map(t=>Tl((t=>b?t.abbreviation:null)(t),t.value,t.color)).join(" ")+yl(h):"",S=i&&n?'style="color:'.concat(t.values[0].color,'"'):"",A=n&&y?"".concat(c," (").concat(o,")"):"".concat(o);return'\n <div class="plot" style="flex: 0 0 auto">\n '.concat(g,"\n <a ").concat(S,' class="').concat(f,'" ').concat(p?'title="'.concat(p,'" '):"",'data-plot-id="').concat(r,'">').concat(A,"</a>\n ").concat(T,"\n </div>\n ").trim()}(e,o,h,s,t)),f="".concat(d).concat(p.join("")),m=function(t,e){const i=t<e-1;return["".concat(t>0?gl(!0,t):""),"".concat(i?gl(!1,t):"")].join(" ").trim()}(c,e.length);return{id:"bc-tip-".concat(l.id.substring(0,8)),isMainPane:h,content:f,moveContent:m,bounds:l.bounds}})}function fl(t){return"bchart-icon-".concat(t)}function ml(t,e=null,i=10){const n=K(e)?'style="fill:'.concat(e,'"'):"",s=fl(t);return'<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="'.concat(i,'px" height="').concat(i,'px" ').concat(n,'><use xlink:href="#').concat(s,'"></use></svg>')}function gl(t,e){const i=t?"up":"down";return'\n <span\n data-pane="'.concat(e,'" \n data-dir="').concat(i,'"\n title="Move ').concat(t?"Up":"Down",'" \n class="move-pane">\n ').concat(ml(t?"chevronUp":"chevronDown"),"\n </span>\n ")}function yl(t){if(t&&t.length){const e=t.map(t=>Tl("".concat(t.field.name," (").concat(ol(u.Day,t.date),")"),t.value,t.color)).join(" ");return"Event ".concat(e)}return""}function vl(t,e,i=null,n=[]){"string"==typeof n&&(n=n.split(" "));const s=["value-row",...n],r="string"==typeof i?' style="color: '.concat(i,'"'):"";return'\n <tr class="'.concat(s.join(" "),'">\n <td class="field-name">').concat(t,"</td>\n <td").concat(r,' class="field-value">').concat(e,"</td>\n </tr>\n ")}function bl(t,e,i=null){return vl(t,e,i,"value-title")}function Tl(t,e,i){const n="string"==typeof i?' style="color: '.concat(i,'"'):"",s=K(t)?'<span class="field-name">'.concat(t,"</span>"):"";return"".concat(s,"<span").concat(n,' class="field-value">').concat(e,"</span>")}function Sl(t){return'<a class="delete-plot" data-plot-id="'.concat(t,'">').concat(ml("delete"),"</a>")}function Al(t,e,i,n,s){const r=function(t,e){const i=t.data.aggregation;return{date:ol(i,e),time:i.isEndOfDay?null:al(i,e),isMultiSymbol:Cl(t),isMultiContract:i.isMultiContract}}(t,e);r.offset=i,r.lastBarRefresh=!!n||!1,r.chartId=t.elementId;const o=i=>i.axes.map(t=>t.plots).flat().filter(e=>!s||e===t.mainPlot).map(i=>function(t,e,{isMultiContract:i},n){const s=n.isStudy;if(!n.timeSeries.hasData)return null;const r=n.timeSeries.container,o=n.type===v.Expression,a=n.axis.comparison!==g.None,l=n.axis.comparison===g.Percent,u=(t,i)=>wl(t,i,e,a),h={isMain:n.main,type:n.type,typeName:v[n.type],name:n.title,description:s?xi(n.model.study).meta.title:n.metaData.name||"",exchange:n.metaData.exchange||"",error:n.errorText,id:n.id},d=n.curves[0];i&&n.type===v.Symbol&&r.hasField(Wn.Symbol)&&(h.name=u(d,Wn.Symbol)[0]);const p={},f={range:n.axis.yScale.domain(),allDigits:!0},m=(t,e)=>l?el(t):n.metaData.format(t,e,f),y=hl(t),b=new Set;return h.values=n.curves.filter(t=>t.visible).map(t=>(!n.main&&n.isSymbol&&y?$r:t.fields).map(e=>{if(b.has(e))return null;b.add(e);const[i,r]=u(t,e),a=n.axis.yScale.priceToY(i);p[e.id]=!0;const l=t.getColor(r,t.style!==c.HollowCandles);return{abbreviation:xl(e),shortName:e.shortName,id:e.id,name:e.name,longName:o&&!h.isMain?n.title:"".concat(e.shortName," ").concat(s?n.params:"").trim(),color:ke(l),val:i,y:a,value:"".concat(m(i,e)).trim()}})).flat().filter(t=>null!==t),h.events=n.findEvents(u(d,Wn.DateTime)[0]).filter(t=>t.field!==Wn.Custom),h}(t,e,r,i)).filter(t=>null!==t);return r.panes=t.panes.map(t=>({bounds:Pl(t),id:t.id,plots:o(t)})),r}function Pl(t){const{x:e,y:i,width:n,height:s}=t.getBounds(),{leftOffset:r,rightOffset:o}=t.presenter.view;return{top:i,left:e+r,right:o,bottom:i+s,width:n,height:s}}function wl(t,e,i,n=!1){const s=t.plot,r=s.timeSeries.container,o=s.axis.pane.presenter.timeline,a=G(o,+i,Number,ll),l=o.at(a-t.shift),c=r.getTimeData(),u=G(c,+l,Number);return[!c[u]||c[u].getTime()!==l.getTime()?null:t.dataAt(e,u,!n),u]}function Cl(t){const e=t.mainPlot.symbol;return 0<t.allPlots.filter(t=>t.type===v.Symbol&&t.symbol!==e).length}function xl(t){return t.id===Wn.Change.id?"Δ":t.id.substring(0,1)}class Ml{constructor(){this.id=La()(),this.plot=null}get shift(){return this._shift}set shift(t){this._shift=K(t)?t:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle)&&this.fields.includes(Wn.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===c.HeikinAshi}get isCandle(){return this.style===c.Candlestick||this.style===c.HollowCandles||this.style===c.HeikinAshi}get isHollowCandles(){return this.style===c.HollowCandles}get isElderImpulseSystemStyle(){return this.style===c.ElderImpulseSystem}get isOhlcStyle(){return this.style===c.OHLC}get isHlcStyle(){return this.style===c.HLC}get isRenko(){return this.style===c.Renko}get isLineLike(){return this.style===c.Line||this.style===c.Area}fromModel(t){t.attributes&&(this.attributes=t.attributes.map(t=>l[t])),this.colors=t.colors,this.fields=t.fields.map(t=>Wn[t]),this.style=c[t.style],this.lineWidth=t.lineWidth,this.varyColorPerBar=t.varyColorPerBar,this.visible=t.visible,t.zones&&(this.zones=t.zones),this.shift=t.shift}get axis(){return this.plot.axis}get pane(){return this.axis.pane}get timeSeries(){return this.plot.timeSeries}get presenter(){return this.pane.presenter}get view(){return this.presenter.view}timeToX(t){return this.view.xAxis.xScale.timeToX(t)}priceToY(t){return this.plot.priceToY(t)}dataAt(t,e,i=!0){const n=!i&&t===Wn.Change,s=n?Wn.Close:t,r=(t,e)=>{const i=this.timeSeries.container.getData(t)[e];return t.type!==d.Number?i:this.plot.priceMapper?this.plot.priceMapper(i):i},o=r(s,e);if(!n)return o;if(e<=1)return 0;return o-r(s,e-1)}timeSeriesAt(t){const e=this.timeSeries.container.getTimeData().length;return t<0||t>e-1?null:this.timeSeries.container.getTimeData()[t]}timelineAt(t){return this.presenter.timeline.at(t)}get shiftedTimeDomain(){const t=this.view.xAxis.xScale;if(!K(t.extent()))return null;return 0!==this.shift?t.extent().map(e=>t.timeline.at(e-this.shift)):t.domain()}getCore(){const t=this.timeSeries;if(!t.hasData||!this.visible)return te.NULL_OBJECT;const e=this.view.xAxis.xScale.extent();if(!K(e))return te.NULL_OBJECT;const i=this.axis.yScale,n=i.domain();if(!K(n))return te.NULL_OBJECT;return{ts:t,extent:e,domain:n,range:i.range()}}drawHover(t,e,i){if(!this.isLineLike)return;if(this.getCore()===te.NULL_OBJECT)return;t.save();const[n,s]=wl(this,this.pickMainField(),e);if(!K(n))return;t.fillStyle=ke(this.getColor(s));const r=2*te.CURVE_STYLE_DOTS_RADIUS,o=2*Math.PI;t.beginPath();const a=this.priceToY(n);t.moveTo(i+r,a),t.arc(i,a,r,0,o),t.fill(),t.restore()}draw(t){const e=this.getCore();if(e===te.NULL_OBJECT)return;const{ts:i,extent:n,domain:s,range:r}=e;t.save(),t.setLineDash([]);const o=i.container.getTimeData(),a=this.shiftedTimeDomain[0],l={bar:this.view.xAxis.xScale.bar,domain:s,range:r,slice:n,start:G(o,+a,Number)||0},u=K(this.zones);this.isOhlc?kl.call(this,t,l):this.isRenko?Il.call(this,t,l):this.style===c.Ribbon?this.varyColorPerBar?Vl.call(this,t,l):Bl.call(this,t,l,this.colors[0]):this.style===c.Area?u?Ll.call(this,t,l,Ol,!0):Ol.call(this,t,l,this.colors,!0):this.style===c.Column?_l.call(this,t,l):this.style===c.Step?u?Ll.call(this,t,l,Rl):Rl.call(this,t,l,this.colors[0]):this.style===c.Dots?Nl.call(this,t,l):this.style===c.Line?u?Ll.call(this,t,l,Fl):this.varyColorPerBar?Ul.call(this,t,l):Fl.call(this,t,l):Kf("Drawing of the curve style '".concat(this.style,"' is not implemented yet"),"error"),t.restore()}pickMainField(){return 1===this.fields.length?this.fields[0]:this.fields.includes(Wn.Last)?Wn.Last:this.fields.includes(Wn.Close)?Wn.Close:this.fields[0]}get zoneColors(){if(!K(this._zoneColors)){const t=this.colors.slice();this._zoneColors=this.zones.map(e=>t.splice(0,e.colors))}return this._zoneColors}getColorsFromZone(t){let e=this.zones.findIndex(e=>t<e.value);return-1===e&&(e=this.zones.length-1),this.zoneColors[e]}pickAreaStroke(t){return t.length<2?ke(t[0]):t[1]}getComputedColor(t){if(!this.timeSeries.container.hasField(Wn.BARCOLIX))return null;const e=this.dataAt(Wn.BARCOLIX,t);return e>=0&&e<this.colors.length?this.colors[e]:null}getColor(t,e=!0){if(this.varyColorPerBar){const i={};if(this.isOhlc||this.isRenko){const e=this.dataAt(Wn.Open,t),n=this.dataAt(Wn.High,t),s=this.dataAt(Wn.Low,t),r=this.dataAt(Wn.Close,t),o=this.dataAt(Wn.Change,t);i.open=e,i.high=n,i.low=s,i.close=r,i.change=o}else if(this.plot.isStudy&&!["VOL","MAVOL"].includes(this.plot.model.study)){const e=this.pickMainField(),n=this.dataAt(e,t-1),s=this.dataAt(e,t),r=K(n),o=K(s);i.change=r?o?s-n:-1:o?1:0}else i.change=this.dataAt(Wn.Change,t);let n;const s=function({open:t,close:e,change:i},n){const s=n.length>2,r=K(t,e),o=r&&e>t,a=r&&e===t,l=i>0,c=0===i;return{useSame:s,isUp:o,isSame:a,isUpPrev:l,isSamePrev:c,isDown:!o&&!a,isDownPrev:!l&&!c}}(i,this.colors),r=this.getComputedColor(t);switch(this.style){case c.Candlestick:case c.Renko:case c.HeikinAshi:case c.OHLC:case c.HLC:case c.Column:{if(K(r)){n=r;break}let t=s.useSame?s.isUp:s.isUp||s.isSame,e=s.isSame;const i=this.attributes||[],o=this.plot.isStudy&&"HASMO"!==this.plot.model.study;(i.includes(l.ChangeBased)||o)&&(t=s.useSame?s.isUpPrev:s.isUpPrev||s.isSamePrev,e=s.isSamePrev),n=this.colors[t?1:0],s.useSame&&e&&(n=this.colors[2]);break}case c.ElderImpulseSystem:n=this.colors[this.dataAt(Wn.BREL,t)];break;case c.HollowCandles:{const t=this.colors[s.isUpPrev||s.isSamePrev?1:0];n=e&&(s.isUp||s.isSame)?te.COLOR_TRANSPARENT:t;break}case c.Line:case c.Ribbon:if(K(r)){n=r;break}n=this.colors[0];break;default:throw new Error("Unexpected style ".concat(c[this.style]," for a curve with varying colors"))}return K(n)||(n=this.colors[0]),n}if(this.zones){const e=this.pickMainField(),i=this.dataAt(e,t),n=this.getColorsFromZone(i);return this.style===c.Area?this.pickAreaStroke(n):n.length>0?n[0]:this.colors[0]}return this.colors[0]}}function El([t,e],i,n){let s=i;const r=this.timeSeries.container.size;for(let i=t;i<=e;i++){for(;this.timeSeriesAt(s)<this.timelineAt(i-this.shift)&&s<r;)++s;if(s===r)break;const t=this.timeSeriesAt(s)>this.timelineAt(i-this.shift);n.call(this,s,t)}}function Ol(t,e,i,n=!1){Fl.call(this,t,e,this.pickAreaStroke(i)),Wl.call(this,t,e,i[0],n)}function Dl(t,e){const i=K(t),n=K(e);let s=null,r=null;const o=this.pane.getBounds();if(i)if(n){const i=this.priceToY(t),n=this.priceToY(e);s=(i+n)/2,r=new je(o.x,n,o.width,i-n)}else s=this.priceToY(t),r=new je(o.x,o.y,o.width,s-o.y);else s=this.priceToY(e),r=new je(o.x,s,o.width,o.y+o.height-s);return[s,r]}function Ll(t,e,i,n=!1){let s=null;this.zones.forEach((r,o)=>{const a=r.value,[l,c]=Dl.call(this,s,a);t.save(),We(t,c),n&&(e.range=[null,l]);let u=this.zoneColors[o];if(r.gradient){const e=((t,e)=>{const i=Fe(.6)(t),n=Ue(.6)(t),s="linLighten"===e;return[s?n:i,t,s?i:n]})(u,r.gradient),i=t.createLinearGradient(0,c.y,0,c.y+c.height);i.addColorStop(0,e[0]),i.addColorStop(.5,e[1]),i.addColorStop(1,e[2]),u=i}i.call(this,t,e,u),t.restore(),s=a})}function Il(t,{bar:e,slice:i,start:n}){let s=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2;El.call(this,i,n,(i,n)=>{if(!n){const[n,r]=[Wn.Open,Wn.Close].map(t=>this.dataAt(t,i)).map(this.priceToY,this),o=this.dataAt(Wn.Projection,i),a=Math.floor(e.totalWidth/2),l=this.getColor(i),c=1===o?Fe(.5,!0)(l):l;t.fillStyle=c,t.beginPath(),t.rect(s-a,n,e.totalWidth,r-n),t.fill()}s+=e.totalWidth})}function _l(t,{bar:e,slice:i,start:n}){let s=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2;const r=e.width,o=ii();o.prolog(t),El.call(this,i,n,(i,n)=>{if(!n){const e=this.pickMainField(),n=this.dataAt(e,i);if(K(n)){const e=this.priceToY(0),a=this.priceToY(n);t.fillStyle=this.getColor(i),t.beginPath(),t.rect(o.adjust(s-r/2),o.adjust(a),o.adjust(r),o.adjust(e-a)),t.fill()}}s+=e.totalWidth}),o.epilog(t)}function Nl(t,{bar:e,slice:i,start:n}){let s=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2;t.fillStyle=this.getColor(0);const r=Math.max(1,this.lineWidth||te.CURVE_STYLE_DOTS_RADIUS),o=2*Math.PI;t.beginPath(),El.call(this,i,n,(i,n)=>{if(!n){const e=this.pickMainField(),n=this.dataAt(e,i);if(K(n)){const e=this.priceToY(n);t.moveTo(s+r,e),t.arc(s,e,r,0,o)}}s+=e.totalWidth}),t.fill()}function Rl(t,{bar:e,slice:i,start:n},s){let r=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2;const o=ii();o.prolog(t),t.strokeStyle=s,t.lineWidth=this.lineWidth,t.beginPath();let a=!1,l=null;El.call(this,i,n,(i,n)=>{if(!n){const e=this.pickMainField(),n=this.dataAt(e,i);if(K(n)){const s=this.priceToY(n);if(a)t.lineTo(r,l),t.lineTo(r,s);else{const n=this.dataAt(e,i-1);if(K(n)){const e=this.priceToY(n);t.moveTo(-1,e),t.lineTo(r,e),t.lineTo(r,s)}else t.moveTo(r,s);a=!0}l=s}}r+=e.totalWidth}),t.stroke(),o.epilog(t)}function kl(t,{bar:e,slice:i,start:n}){const s=this.presenter.display.chart.showMinMaxArc;let r=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2;const o=ii();o.prolog(t);let a=null,l=null,c=null,u=null;const h=e=>{this.isCandle?(this.isHollowCandles?e.outlineColor=this.getColor(e.ix,!1):(this.colors.length>3&&(e.outlineColor=this.colors[3]),this.colors.length>4&&(e.wickColor=this.colors[4])),function(t,{x:e,adjust:i,width:n,y:[s,r,o,a],color:l,outlineColor:c,wickColor:u,isMin:h,isMax:d},p){const f=n/2;t.lineWidth=p,t.fillStyle=l,t.strokeStyle=c||l,t.beginPath(),t.rect(i(e-f),s,n,i(a-s)),t.fill(),t.stroke(),t.strokeStyle=u||c||l,t.beginPath(),t.moveTo(e,Math.min(a,s)),t.lineTo(e,r),t.moveTo(e,Math.max(a,s)),t.lineTo(e,o),t.stroke();const m=0===Be(l).a;t.strokeStyle=m?c:l,Hl(t,h,d,e,o,r,f)}(t,e,this.lineWidth)):(this.isOhlcStyle||this.isHlcStyle||this.isElderImpulseSystemStyle)&&function(t,{x:e,adjust:i,width:n,y:[s,r,o,a],color:l,isMin:c,isMax:u},h,d){const p=n/2;t.lineWidth=h,t.strokeStyle=l,t.beginPath(),t.moveTo(e,o),t.lineTo(e,r),d&&(t.moveTo(i(e-p),s),t.lineTo(e,s));t.moveTo(i(e+p),a),t.lineTo(e,a),t.stroke(),Hl(t,c,u,e,o,r,p)}(t,e,this.lineWidth,!this.isHlcStyle)};El.call(this,i,n,(t,i)=>{if(!i){const i=[Wn.Open,Wn.High,Wn.Low,Wn.Close].map(e=>this.dataAt(e,t)),[n,s,d,p]=i;if(K(n,s,d,p)){const f={x:o.adjust(r),adjust:o.adjust,width:e.width,y:[n,s,d,p].map(this.priceToY,this).map(o.adjust),isMin:!1,isMax:!1,ix:t,color:this.getColor(t)},m=Math.min(...i),g=Math.max(...i);(!K(a)||m<a)&&(a=m,c=f),(!K(l)||g>l)&&(l=g,u=f),h(f)}}r+=e.totalWidth}),s&&(K(c)&&(c.isMin=!0,h(c)),K(u)&&(u.isMax=!0,h(u))),o.epilog(t)}function Hl(t,e,i,n,s,r,o,a=3){e&&$e(t,{x:n,y:s+a},o,0,Math.PI),i&&$e(t,{x:n,y:r-a},o,0,Math.PI,!0)}function Fl(t,{bar:e,slice:i,start:n},s=null){t.strokeStyle=s||this.getColor(0),t.lineWidth=this.lineWidth,t.beginPath();let r=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2,o=!1;El.call(this,i,n,(i,n)=>{if(!n){const e=this.pickMainField(),n=this.dataAt(e,i);if(K(n)){const e=this.priceToY(n);o?t.lineTo(r,e):(t.moveTo(r,e),o=!0)}}r+=e.totalWidth}),t.stroke()}function Ul(t,{bar:e,slice:i,start:n}){t.lineWidth=this.lineWidth;let s=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2,r=null,o=null,a=[];const l=e=>{if(a.length>1){t.beginPath(),t.strokeStyle=e;const i=a[0];t.moveTo(i.x,i.y);for(let e=1;e<a.length;e++){const i=a[e];t.lineTo(i.x,i.y)}t.stroke()}};El.call(this,i,n,(t,i)=>{if(!i){const e=this.pickMainField(),i=this.dataAt(e,t);if(K(i)){const e=this.priceToY(i);o=this.getColor(t),r!==o?(l(r),a.length>0&&(a=[a.pop()]),r=o):a.push({x:s,y:e})}}s+=e.totalWidth}),l(o)}function Bl(t,{bar:e,slice:i,start:n},s){t.fillStyle=s;const[r,o]=this.fields;let a=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2;const l=[];if(El.call(this,i,n,(t,i)=>{if(!i){const e=this.dataAt(r,t),i=this.dataAt(o,t);K(e,i)&&l.push({x:a,upY:this.priceToY(e),downY:this.priceToY(i)})}a+=e.totalWidth}),l.length>0){t.beginPath(),t.moveTo(l[0].x,l[0].upY);for(let e=1;e<l.length;++e)t.lineTo(l[e].x,l[e].upY);const e=l.length-1;t.lineTo(l[e].x,l[e].downY);for(let i=e-1;i>=0;--i)t.lineTo(l[i].x,l[i].downY);t.closePath(),t.fill()}}function Vl(t,{bar:e,slice:i,start:n}){const[s,r]=this.fields;let o=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2,a=[];const l=e=>{if(a.length>1){t.beginPath(),t.fillStyle=e,t.moveTo(a[0].x,a[0].upY);for(let e=1;e<a.length;++e)t.lineTo(a[e].x,a[e].upY);const i=a.length-1;t.lineTo(a[i].x,a[i].downY);for(let e=i-1;e>=0;--e)t.lineTo(a[e].x,a[e].downY);t.closePath(),t.fill()}};let c=null,u=null;El.call(this,i,n,(t,i)=>{if(!i){const e=this.dataAt(s,t),i=this.dataAt(r,t);if(K(e,i)){const n=this.priceToY(e),s=this.priceToY(i);u=this.getColor(t),c!==u&&(l(c),a.length>0&&(a=[a.pop()]),c=u),a.push({x:o,upY:n,downY:s})}}o+=e.totalWidth}),l(u)}function Wl(t,{bar:e,slice:i,start:n,range:[s,r]},o,a){if(a){const e=t.createLinearGradient(0,s,0,r);e.addColorStop(0,o);const i=Be(o);i.a=0,e.addColorStop(1,Ve(i)),t.fillStyle=e}else t.fillStyle=o;t.beginPath();let l=null;const c=this.pickMainField();let u=this.view.xAxis.xScale.range()[0]+e.offset+e.width/2,h=!1,d=null,p=null,f=null;El.call(this,i,n,(i,n)=>{if(!n){const e=this.dataAt(c,i);if(!K(d)&&e>=0&&(d=!0),!K(p)&&e<0&&(p=!0),K(e)){const i=this.priceToY(e);h?t.lineTo(u,i):(t.moveTo(l=u,i),h=!0),f=u}}u+=e.totalWidth});const m=d&&p?this.priceToY(0):r;t.lineTo(f,m),t.lineTo(l,m),t.closePath(),t.fill()}class jl{constructor(t,e,i=b.Normal,n=[null,null]){this.symbol=t,this.aggregation=e,this.range=n,this.seriesKind=i,this.cacheMe=!0,this.barsToFetch=0,this.offset=0,this.chartId=null,this.curveStyle=null,this.fields=null,this.needsExtraKey=[b.BalanceSheet,b.IncomeStatement].includes(i)}getBuilderKey(){if(!K(this.curveStyle)||!te.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case c.Renko:{const{method:t,period:e,source:i,brickSize:n}=fo(this.inputs),s="ATR"===t?"ATR;".concat(e):"User;".concat(n);return"Renko;".concat(s,";").concat(i)}default:return c[this.curveStyle]}}getExtraKey(){return this.needsExtraKey&&K(this.fields)?"".concat(this.fields.map(t=>t.id).join(";")):""}getHashKey(){const t=this.aggregation.getHashKey(),e=this.getBuilderKey(),i=this.getExtraKey();return"".concat(this.symbol,"|").concat(t,"}|").concat(this.range,"|").concat(this.seriesKind,"|").concat(this.offset,"|").concat(e,"|").concat(i)}}function Gl(t,e){const i=(t.forStudies||t).query;return K(i)&&i.symbol!==te.PLACEHOLDER_SYMBOL_NAME&&"Standard"===i.getBuilderKey()?e(i):new Pa}function zl(t){return new Bn(t,d.Number,f.Study,t)}class Yl{constructor(t,...e){this.calcCtx=this.container=this._source=this.target=this.inputs=this.outFields=null,this.setOptions(t),this.innerSeries=e,this.calculable=!0,this.useNotifications=this.initialNotification=this.computedServerSide=!1,this.id=La()()}addInner(...t){this.innerSeries.push(...t)}setOptions(t){st(this,t);const e=t.outFields||[t.target];this.studyFields=this.helpers.concat(e).reduce((t,e)=>(t[e.id]=e,t),{})}get helpers(){return te.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(K(this._source))return this._source;const t=K(this.inputs)?this.inputs[te.INPUT_SOURCE]:null;return K(t)?Wn[t]:null}set source(t){this._source=t}async ready(){return Qt.call(this,async()=>{this.basisChangedToken=this.useNotifications?ya.a.subscribe(jn.TS_ALL,this.onBasisChanged.bind(this)):null;const t={tag:La()(),src:null},e=(await Promise.all(this.innerSeries.map(t=>t.ready()))).every(I);return e&&this.calculate(t),e})}shouldTriggerOurRecalc(t){return t===this.innerSeries[0]}onBasisChanged(t,e){if(t===jn.TS_EVENTSCHANGED||t===jn.TS_LOADING)return;if(!this.shouldTriggerOurRecalc(e.series)||null===this.base||this===e.series)return;const i={tag:La()(),src:e.series};switch(t){case jn.TS_MANYCHANGED:this.calculate(i);break;case jn.TS_DATAPOINTCHANGED:case jn.TS_DATAPOINTADDED:this.recalculateAt(i,e.index,t===jn.TS_DATAPOINTADDED);break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&ya.a.unsubscribe(this.basisChangedToken)}get base(){return this.innCont(0)}get period(){return this.inputs[te.INPUT_PERIOD]}calculateDataPoint(t,e){const i=this.calculateAt(t);if(null!==i){Object.keys(i).forEach(t=>{const n=i[t],s=this.studyFields[t];e?this.container.addDataPoint(s,n):this.container.setLastDataPoint(s,n)})}}notify(t,e){ya.a.publish(t,{series:this,index:e})}calculateCommon(t,e=null,i=-1,n=!0){const s=-1===i,r=s?e=>{!K(t.src)&&K(e.calcCtx)||e.calculate(t)}:e=>e.recalculateAt(t,i,n);if(null!==this.base&&!(this.calcCtx&&this.calcCtx.tag===t.tag||this===t.src)){if(this.calcCtx=t,this.innerSeries.filter(t=>t.calculable).forEach(r),s&&(this.container=this.makeContainer()),void 0!==this.calculateAt)if(s){const t=this.base.size;for(let e=0;e<t;++e)this.calculateDataPoint(e,!0)}else this.calculateDataPoint(i,n);e&&(K(t.src)||this.initialNotification)&&this.notify(e,i)}}calculate(t){this.calculateCommon(t,jn.TS_MANYCHANGED,-1,!0)}recalculateAt(t,e,i){this.computedServerSide||this.calculateCommon(t,i?jn.TS_DATAPOINTADDED:jn.TS_DATAPOINTCHANGED,e,i)}baseVal(t,e){return this.base.getData(t)[e]}innCont(t){const e=this.innerSeries[t];return(e.forStudies||e).container}innVal(t,e,i){const n=this.innCont(t),s=n.size;return i<0||i>s-1?null:n.getData(e)[i]}wrap(...t){return t.reduce((t,e)=>(t[e.f.id]=e.g,t),{})}wrapBaseFields(...t){return t.map(this.wrapBaseField,this)}wrapInner(t,e){return{f:t,g:()=>this.innCont(e).getData(t)}}wrapBaseField(t){return this.wrapInner(t,0)}get defaultWrappers(){return this.wrapBaseFields(Wn.DateTime,Wn.Symbol)}makeContainer(){const t=this.defaultWrappers.concat(this.getWrappers()),e=Object.keys(this.studyFields).map(t=>this.studyFields[t],this);return new jr(e,this.wrap(...t))}getWrappers(){return[]}atLeast(t,e){return t>=e-1}exactly(t,e){return t==e-1}past(t,e,i,n=this.base){return n.getData(i).slice(t-e+1,t+1)}getCacheableEntities(t){this.innerSeries.forEach(e=>{e.getCacheableEntities(t)})}}class ql extends Yl{constructor(t,...e){super(t,...e)}get _actual(){return this.innerSeries[0]}get canLoadMoreData(){return this._actual.canLoadMoreData}async loadMoreData(t=!0){this._actual.loadMoreData(t)}}class $l extends ql{constructor(t,e){super(t,e),this.query=e.query,this.useNotifications=!0,this.forStudies=e}calculateAt(t){const[e,i,n,s]=[Wn.Open,Wn.High,Wn.Low,Wn.Close].map(e=>this.baseVal(e,t),this);let r=null,o=null,a=null,l=null;const c=N([e,i,n,s]);if(t<1)r=N([e,s]),o=i,a=n,l=0;else{const[e,s]=[Wn.Open,Wn.Close].map(e=>this.container.getData(e)[t-1],this);r=N([e,s]),o=Math.max(i,r,c),a=Math.min(n,r,c),l=c-s}return{[Wn.Open.id]:r,[Wn.High.id]:o,[Wn.Low.id]:a,[Wn.Close.id]:c,[Wn.Change.id]:l}}getWrappers(){return this.wrapBaseFields(Wn.Volume,Wn.OpenInterest)}}class Xl extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;if(this.atLeast(t,this.period)&&this.innCont(0).hasField(this.source)){let i=this.past(t,this.period,this.source);R(i)&&(e=N(i))}return{[this.target.id]:e}}getWrappers(){return this.source===Wn.Volume?this.wrapBaseFields(Wn.Volume,Wn.Change):[]}}class Kl extends Yl{constructor(t,e,i){super(t,e),this.multiplier=i(this.period)}calculateAt(t){let e=null;if(this.atLeast(t,2)&&this.innCont(0).hasField(this.source)){let i=this.container.getData(this.target)[t-1];if(null!==i){e=(this.baseVal(this.source,t)-i)*this.multiplier+i}else if(this.atLeast(t,this.period)){let i=this.past(t,this.period,this.source);R(i)&&(e=N(i))}}return{[this.target.id]:e}}}class Zl extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;const i=Wn.OpenInterest;return this.base.hasField(i)&&(e=this.baseVal(i,t)),{[i.id]:e}}}const Ql={inField:Wn.MA,outFields:[Wn.ENVU,Wn.ENVD],func:Ph},Jl={inField:Wn.EMA,outFields:[Wn.ENVEXPU,Wn.ENVEXPD],func:wh},tc={inField:Wn.SMA,outFields:[Wn.ENVSMOU,Wn.ENVSMOD],func:Ch};class ec extends Yl{constructor(t,e,i){super(t,i),this.kind=e,this.perc=this.inputs.Percent/100;const n=e.func(i,this.inputs.Period,t.source);this.addInner(n)}calculateAt(t){let e=null,i=null,n=this.innVal(1,this.kind.inField,t);if(null!==n){let t=n*this.perc;e=n+t,i=n-t}return{[this.kind.outFields[0].id]:e,[this.kind.outFields[1].id]:i}}}class ic extends Yl{constructor(t,e){super(t,e);const i=Ph(e,this.inputs.Period1,this.source),n=Ph(e,this.inputs.Period2,this.source),s=kh(this.target,(t,e,i)=>e-i,i,n);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}}const nc={fields:[Wn.MACD,Wn.MACDS,Wn.MACDH],avgFunc:Ph,mapFunc:Hh},sc={fields:[Wn.MACD,Wn.MACDS,Wn.MACDH],avgFunc:wh,mapFunc:Hh},rc={fields:[Wn.MACD,Wn.CTLTM,Wn.CTM],avgFunc:wh,mapFunc:Hh},oc={fields:[Wn.MACD,Wn.CTLTMF,Wn.GPMI],avgFunc:wh,mapFunc:Hh},ac={fields:[Wn.PPO,Wn.PPOS,Wn.PPOH],avgFunc:wh,mapFunc:Fh},lc={fields:[Wn.PVO,Wn.PVOS,Wn.PVOH],avgFunc:wh,mapFunc:Fh};class cc extends Yl{constructor(t,e,i){super(t,i),this.fields=e.fields;let n=e.avgFunc(i,t.inputs.Period1,t.source,void 0),s=e.avgFunc(i,t.inputs.Period2,t.source,void 0),r=kh(this.fields[0],e.mapFunc,n,s),o=e.avgFunc(r,t.inputs.Period3,r.target,this.fields[1]),a=kh(this.fields[2],Hh,r,o);this.addInner(r,o,a)}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}}const uc=zl("_AVG_GAIN"),hc=zl("_AVG_LOSS");class dc extends Yl{constructor(t,e,i){super(t,i),this.isModified=e}get helpers(){return[uc,hc]}gain(t,e){return e[t]>e[t-1]?e[t]-e[t-1]:0}loss(t,e){return e[t]<e[t-1]?e[t-1]-e[t]:0}calculateAt(t){let e=null,i=null,n=null;const s=this.period;if(this.atLeast(t,s+1)){if(null===this.container.getData(this.target)[t-1]||this.isModified){let e=this.past(t,s+1,this.source);if(R(e)){const t=k(1,s),r=t.map(t=>this.gain(t,e)),o=t.map(t=>this.loss(t,e));i=N(r),n=N(o)}}else{const e=this.container.getData(uc)[t-1],r=this.container.getData(hc)[t-1],o=this.past(t,2,this.source);i=(e*(s-1)+this.gain(1,o))/s,n=(r*(s-1)+this.loss(1,o))/s}null!==i&&null!==n&&(e=100-100/(1+i/n))}return{[uc.id]:i,[hc.id]:n,[this.target.id]:e}}}class pc extends Yl{constructor(t,e,i,n){super(t,n),this.highest=e,this.index=i}calculateAt(t){let e=null;const i=this.inputs.Period;if(this.atLeast(t,i)){const n=this.past(t,i,this.source);R(n)&&(e=this.highest?Math.max(...n):Math.min(...n),this.index&&(e=i-n.indexOf(e)-1))}return{[this.target.id]:e}}}class fc extends Yl{constructor(t,e,i){super(t,i),this.toHighest=e;const n=Mh(i,t.inputs.Period,Wn.High,Wn.HH,!0),s=Mh(i,t.inputs.Period,Wn.Low,Wn.LL,!1);this.addInner(n,s)}calculateAt(t){let e=null;const i=this.baseVal(Wn.Close,t),n=this.innVal(1,Wn.HH,t),s=this.innVal(2,Wn.LL,t);if(R([i,n,s])){const t=this.toHighest?n:s,r=n-s;0!==r&&(e=(i-t)/r*100)}return{[this.target.id]:e}}}const mc=zl("RawPercK");class gc extends Yl{constructor(t,e,i,n){super(t,n);const s=(r=n,o=this.inputs.Period1,a=!1,new fc({target:e?mc:i,inputs:Th(o)},a,r));var r,o,a;const l=Bh(t,"MA"),c=l(s,this.inputs.Period2,s.target,e?i:Wn.PercD),u=e?l(c,this.inputs.Period3,c.target,Wn.PercD):c;this.kField=i,e?this.addInner(c,u):this.addInner(s,c)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(Wn.PercD,2)]}}class yc extends Yl{constructor(t,e,i){super(t,i),this.kind=e;const n=Nh(i,this.inputs.Period,this.source);this.addInner(n)}calculateAt(t){let e=null,i=null,n=null,s=null,r=null,o=null;const a=this.innVal(1,Wn.MSD,t);if(null!==a){r=this.innVal(1,Wn.MA,t);let l=this.inputs.Width*a;e=r+l,i=r-l,n=2*l,o=n/r*100,s=(this.baseVal(this.source,t)-i)/(e-i)}switch(this.kind){case"Regular":return{[Wn.BOLLBU.id]:e,[Wn.BOLLBL.id]:i,[Wn.BOLLBM.id]:r};case"Width":return{[Wn.BOLLBW.id]:n};case"Percent":return{[Wn.BOLLBP.id]:s};case"Squeeze":return{[Wn.BOLLSQ.id]:o};default:return null}}}const vc=zl("_ABS_CHG"),bc=zl("_MA_ABS_CHG"),Tc=zl("_CHG");const Sc=zl("_PDM"),Ac=zl("_MDM"),Pc=zl("_TRS"),wc=zl("_PDS"),Cc=zl("_MDS"),xc=zl("_DX");class Mc extends Yl{constructor(t,e,i,n){super(t,n),this.useEma=e,this.adxField=i,this.multiplier=2/(this.inputs.AdxSmoothing+1);const s=Eh(n,Wn.TR);this.addInner(s)}get helpers(){return[Sc,Ac,Pc,wc,Cc,xc]}sum(t,e,i,n){let s=null;if(this.atLeast(t-1,n-1)){let r=this.past(t-1,n-1,e,this.container);r.push(i),R(r)&&(s=r.reduce((t,e,i)=>t+e,0))}return s}smooth1(t,e,i,n){let s=null;const r=this.inputs.DiLength,o=this.container.getData(i)[t-1];return s=null!==o?o-o/r+n:this.sum(t,e,n,r),s}smooth2(t,e,i,n){const s=this.container.getData(i)[t-1],r=this.inputs.AdxSmoothing;if(null!==s)return this.useEma?(n-s)*this.multiplier+s:(s*(r-1)+n)/r;{const i=this.sum(t,e,n,r);if(null!==i)return i/r}return null}calculateAt(t){let e=null,i=null,n=null,s=null,r=null,o=null,a=null,l=null,c=null;if(t>0){const u=this.past(t,2,Wn.High),h=this.past(t,2,Wn.Low),d=Math.max(u[1]-u[0],0),p=Math.max(h[0]-h[1],0);e=d>p?d:0,i=p>d?p:0;const f=this.container.getData(Wn.TR)[t];s=this.smooth1(t,Sc,wc,e),r=this.smooth1(t,Ac,Cc,i),n=this.smooth1(t,Wn.TR,Pc,f),(s>0||r>0)&&0!==n&&(o=s/n*100,a=r/n*100,l=100*Math.abs(o-a)/(o+a),c=this.smooth2(t,xc,this.adxField,l))}return{[Sc.id]:e,[Ac.id]:i,[Pc.id]:n,[wc.id]:s,[Cc.id]:r,[Wn.PDI.id]:o,[Wn.MDI.id]:a,[xc.id]:l,[this.adxField.id]:c}}getWrappers(){return[this.wrapInner(Wn.TR,1)]}}class Ec extends Yl{constructor(t,e,...i){super(t,...i),this.calculateAtFunc=e}calculateAt(t){let e=this.innerSeries.map((e,i)=>{let n=e.target;if(!K(n)){n=e.container.hasField(Wn.Close)?Wn.Close:e.container.fields[0]}return this.innVal(i,n,t)}),i=null;return R(e)&&(i=this.calculateAtFunc(t,...e)),{[this.target.id]:i}}}function Oc(t,e){return{[t.id]:(this.baseVal(Wn.High,e)+this.baseVal(Wn.Low,e))/2}}function Dc(t,e){return{[t.id]:this.baseVal(Wn.High,e)-this.baseVal(Wn.Low,e)}}class Lc extends Yl{constructor(t,e,i){super(t,i),this.calculateAtFunc=e}calculateAt(t){return this.calculateAtFunc.call(this,t)}}const Ic=zl("_RANGE"),_c=zl("_MOV_RANGE"),Nc=t=>Dh(t,Wn.TP),Rc=t=>Rh(Ic,D(Dc,Ic),t),kc={fields:[Wn.KCUP,Wn.KCLOW,Wn.KCMID],midSeries:Nc,midTarget:Wn.TP,rangeSeries:Rc,rangeTarget:Ic,func:Ph,useMultiplier:!1},Hc={fields:[Wn.KCEUP,Wn.KCELOW,Wn.KCEMID],midSeries:Nc,midTarget:Wn.TP,rangeSeries:Rc,rangeTarget:Ic,func:wh,useMultiplier:!1},Fc={fields:[Wn.KBUP,Wn.KBLOW,Wn.KBMID],midSeries:t=>t,midTarget:Wn.Close,rangeSeries:t=>Eh(t,Wn.TR),rangeTarget:Wn.TR,func:wh,useMultiplier:!0};class Uc extends Yl{constructor(t,e,i){super(t,i),this.kind=e;const n=e.midSeries(i),s=e.func(n,this.inputs.Period,e.midTarget,e.fields[2]),r=e.rangeSeries(i),o=e.func(r,this.inputs.Period,e.rangeTarget,_c);this.addInner(s,o)}calculateAt(t){const e=this.innVal(1,this.kind.fields[2],t),i=this.innVal(2,_c,t),n=null!==e&&null!==i,s=this.kind.useMultiplier?this.inputs.Multiplier:1;return{[this.kind.fields[0].id]:n?e+i*s:null,[this.kind.fields[1].id]:n?e-i*s:null}}getWrappers(){return[this.wrapInner(this.kind.fields[2],1)]}}class Bc extends Yl{constructor(t,e,i){super(t,i),this.isWidth=e;const n=Mh(i,this.inputs.Period,Wn.High,Wn.DONUP,!0),s=Mh(i,this.inputs.Period,Wn.Low,Wn.DONLOW,!1);this.addInner(n,s)}calculateAt(t){const e=this.innVal(1,Wn.DONUP,t),i=this.innVal(2,Wn.DONLOW,t),n=null===e&&null===i;return this.isWidth?{[Wn.DONW.id]:n?null:e-i}:{[Wn.DONMID.id]:n?null:(e+i)/2}}getWrappers(){return[this.wrapInner(Wn.DONUP,1),this.wrapInner(Wn.DONLOW,2)]}}const Vc=zl("_HIND"),Wc=zl("_LIND");class jc extends Yl{constructor(t,e,i){super(t,i),this.justWidth=e;const n=this.inputs.Period,s=Mh(i,n,Wn.High,Vc,!0,!0),r=Mh(i,n,Wn.Low,Wc,!1,!0);this.addInner(s,r)}calculateAt(t){let e=null,i=null,n=null;const s=this.innVal(1,Vc,t),r=this.innVal(2,Wc,t);return null!==s&&null!==r&&(e=(this.period-s)/this.period*100,i=(this.period-r)/this.period*100,n=e-i),this.justWidth?{[Wn.ARNOSC.id]:n}:{[Wn.ARNUP.id]:e,[Wn.ARNLOW.id]:i}}}const Gc=zl("_MIDPOINT");const zc=zl("_MIDPOINT");class Yc extends Yl{constructor(t,e,i){super(t,i),this.multiplyVol=e}calculateAt(t){const e=[Wn.High,Wn.Low,Wn.Close,Wn.Volume],[i,n,s,r]=e.map(e=>this.baseVal(e,t));let o=i===n?0:(s-n-(i-s))/(i-n);return this.multiplyVol&&(o*=r),{[this.target.id]:o}}}const qc=zl("_RANGE");const $c=zl("_MATP");class Xc extends Yl{constructor(t,e,i){super(t,i),this.isBull=e;const n=wh(i,this.inputs.Period,this.source);this.addInner(n)}calculateAt(t){let e=null;const i=this.innVal(1,Wn.EMA,t);return null!==i&&(e=this.isBull?this.baseVal(Wn.High,t)-i:this.baseVal(Wn.Low,t)-i),{[this.isBull?Wn.ERBLPOW.id:Wn.ERBRPOW.id]:e}}}const Kc=zl("_FORCE");const Zc=zl("_RANGE"),Qc=zl("_EMA1"),Jc=zl("_EMA2"),tu=zl("_RATIO");const eu={isNegative:!1,fields:[Wn.PVI,Wn.PVIEMA]},iu={isNegative:!0,fields:[Wn.NVI,Wn.NVIEMA]};class nu extends Yl{constructor(t,e,i){super(t,i),this.kind=e;const n=Rh(this.kind.fields[0],D((function(t,e){let i=1e3;if(e>0){const n=[Wn.Close,Wn.Volume],[s,r]=n.map(t=>this.baseVal(t,e)),[o,a]=n.map(t=>this.baseVal(t,e-1)),l=this.container.getData(this.target)[e-1];if(t?r<a:r>a){i=l*((s-o)/o+1)}else i=l}return{[this.target.id]:i}}),this.kind.isNegative),i),s=wh(n,this.inputs.Period,this.kind.fields[0],this.kind.fields[1]);this.addInner(n,s)}getWrappers(){return[this.wrapInner(this.kind.fields[0],1),this.wrapInner(this.kind.fields[1],2)]}}const su=zl("_LOGPC");const ru=zl("_SWING_INDEX");const ou=zl("_MIN_CLOSE"),au=zl("_MAX_CLOSE");const lu=zl("_EP"),cu=zl("_AF"),uu=zl("_POS");class hu extends Aa{constructor(t){super(t)}getRetriever(){return new du}onStreamingUpdates(t){}}class du extends fa{addExtraParams(t){t.trend="y"}getPageNameFor(t){return t.unit===u.Intraday?te.BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:super.getPageNameFor(t)}getParser(t){return new pu(t.symbol,t.aggregation)}}class pu extends pa{constructor(t,e){super(t,e)}makeContainer(){return new Vr([Wn.DateTime,Wn.TRSP1,Wn.TRSP2])}getParseFunc(){return this.parseTrendSpotter}parseTrend(t){return"N/A"===t?null:parseFloat(t)}parseTrendSpotter(t){const e=this.aggregation.isEndOfDay?1:0;t.length===3+e&&(this.container.addDataPoint(Wn.DateTime,this.parseDate(t[e])),this.container.addDataPoint(Wn.TRSP1,this.parseTrend(t[e+1])),this.container.addDataPoint(Wn.TRSP2,this.parseTrend(t[e+2])))}}const fu={1:{param:"cot",func:"parseCotLineChart",fields:[Wn.DateTime,Wn.COTLCCMSP,Wn.COTLCLGSP,Wn.COTLCSMSP]},2:{param:"cotadv",func:"parseDisaggregated",fields:[Wn.DateTime,Wn.COTDAGPRO,Wn.COTDAGSPD,Wn.COTDAGMNM,Wn.COTDAGOTH]},3:{param:"cotfin",func:"parseFinancialTradersReport",fields:[Wn.DateTime,Wn.COTFTRDLI,Wn.COTFTRASM,Wn.COTFTRLVF,Wn.COTFTROTH]}};class mu extends Yl{constructor(t,e,i){super(t,Gl(i,t=>new gu(e,t))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=fu[e].fields.slice(1).map(t=>this.wrapInner(t,0))}getWrappers(){return this.wrappers}}class gu extends Aa{constructor(t,e){super(e),this.kind=t,this.isCotSeries=!0}getRetriever(){return new yu(this.kind)}onStreamingUpdates(t){}}class yu extends fa{constructor(t){super(),this.kind=t}addExtraParams(t){t[fu[this.kind].param]="y"}getParser(t){return new vu(t.symbol,t.aggregation,this.kind)}}class vu extends pa{constructor(t,e,i){super(t,e),this.kind=i}makeContainer(){return new Vr(fu[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[fu[this.kind].func]:null}parseCotLineChart(t){this.container.addDataPoint(Wn.DateTime,this.parseDate(t[1])),this.container.addDataPoint(Wn.COTLCCMSP,parseInt(t[2])),this.container.addDataPoint(Wn.COTLCLGSP,parseInt(t[3])),this.container.addDataPoint(Wn.COTLCSMSP,parseInt(t[4]))}parseDisaggregated(t){this.container.addDataPoint(Wn.DateTime,this.parseDate(t[1])),this.container.addDataPoint(Wn.COTDAGPRO,parseInt(t[2])),this.container.addDataPoint(Wn.COTDAGSPD,parseInt(t[3])),this.container.addDataPoint(Wn.COTDAGMNM,parseInt(t[4])),this.container.addDataPoint(Wn.COTDAGOTH,parseInt(t[5]))}parseFinancialTradersReport(t){this.container.addDataPoint(Wn.DateTime,this.parseDate(t[1])),this.container.addDataPoint(Wn.COTFTRDLI,parseInt(t[2])),this.container.addDataPoint(Wn.COTFTRASM,parseInt(t[3])),this.container.addDataPoint(Wn.COTFTRLVF,parseInt(t[4])),this.container.addDataPoint(Wn.COTFTROTH,parseInt(t[5]))}}const bu={Day:[Wn.PreviousHigh,Wn.PreviousLow,Wn.PreviousClose],Week:[Wn.WeekPreviousHigh,Wn.WeekPreviousLow,Wn.WeekPreviousClose],Month:[Wn.MonthPreviousHigh,Wn.MonthPreviousLow,Wn.MonthPreviousClose]};class Tu extends Yl{constructor(t,e,i){super(t,i),this.record=im().getRecordSource().getRecord(i.query.symbol),this.record.addFields(...e),this.streamingSubscription=this.getStreamingSubscription(),this.initialNotification=!0}getStreamingSubscription(){return im().getRecordSource().subject.pipe(va(t=>{const e=is(jn.RT_QUOTE,this.record.symbol);return t.filter(e)}),Bs(t=>t.length>0)).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return Qt.call(this,async()=>K(this.record)?await this.record.ready()&&await super.ready():await super.ready(),"asyncReadyWork2")}onStreamingUpdates(t){if(this.record){const t={tag:La()()};this.calculate(t)}}shutdown(){super.shutdown(),this.streamingSubscription.unsubscribe()}getValues(t){return bu[t].map(t=>this.record.getValue(t))}}class Su extends Aa{constructor(t){super(t)}getRetriever(){return new Au}onStreamingUpdates(t){}}class Au extends fa{addExtraParams(t){t.impl="y"}getParser(t){return new Pu(t.symbol,t.aggregation)}}class Pu extends pa{constructor(t,e){super(t,e)}makeContainer(){return new Vr([Wn.DateTime,Wn.IMPVOL])}getParseFunc(){return this.parseImpVol}parseImpVol(t){!this.aggregation.isEndOfDay||t.length<9||(this.container.addDataPoint(Wn.DateTime,this.parseDate(t[1])),this.container.addDataPoint(Wn.IMPVOL,parseFloat(t[8])))}}const wu=zl("_ABS_CHG"),Cu=zl("_DS1_EMA1"),xu=zl("_DS1_EMA2"),Mu=zl("_DS2_EMA1"),Eu=zl("_DS2_EMA2");const Ou=zl("_DIFF");const Du=zl("_SUM");const Lu=zl("_ABS_CHG"),Iu=zl("_HH_LL"),_u=zl("_MULMA");class Nu extends Yl{constructor(t,e,i){super(t,i);const n="Close"===t.inputs.TurtleChnField,s=Wh(i);if(!n&&s){const t=Rh(this.target,(t,e)=>null,i);this.addInner(t)}else{const t=Ph(Rh(Lu,D((t,e)=>({[Lu.id]:e>0?t*Math.abs(this.baseVal(Wn.Change,e)):null}),this.inputs.FactorATR),i),this.inputs.PeriodAdjATR,Lu,Wn.MA),s=e?Wn.High:Wn.Low,r=Mh(i,this.inputs.PeriodTurtleChn,n?Wn.Close:s,Iu,e),o=kh(_u,(t,e)=>this.inputs.FactorAdjATR*e,t),a=e?-1:1,l=(t,e,i)=>e+a*i,c=kh(this.target,l,r,o);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}}const Ru=zl("_DIFF");const ku=zl("_DIST"),Hu=zl("_EMA_DIST1"),Fu=zl("_EMA_DIST2"),Uu=zl("_DIFF"),Bu=zl("_EMA_DIFF1"),Vu=zl("_EMA_DIFF2");const Wu=zl("_CHG"),ju=zl("_M1"),Gu=zl("_M2");const zu=zl("_MAX"),Yu=zl("_MIN"),qu=zl("_ISUPTREND");const $u=zl("_TRENDUP"),Xu=zl("_TRENDDOWN"),Ku=zl("_TREND");function Zu(t){yt(1,arguments);var e=vt(t),i=new Date(0);return i.setFullYear(e.getFullYear(),0,1),i.setHours(0,0,0,0),i}function Qu(t,e){return e.getFullYear()-1-(e.getFullYear()-1)%t}function Ju(t){return Qu(10,t)}function th(t,e){return Qu(100,t)===Ju(e)}const eh=new Date(0),ih=zl("_AVG_PRICE"),nh=zl("_CUM_PRICE"),sh=zl("_CUM_VOL"),rh=zl("_PER_CHG");const oh=zl("_DIFF");class ah extends Yl{constructor(t,...e){super(t,...e)}get helpers(){return[oh,Wn.Buy,Wn.Sell]}calculateDiff(t,e,i){let n=null,s=null,r=null;K(e,i)&&(r=e-i);const o=t>0?this.container.getData(oh)[t-1]:null;return K(r,o)&&(n=r>0&&o<=0?1:null,s=r<0&&o>=0?-1:null),{[oh.id]:r,[Wn.Buy.id]:n,[Wn.Sell.id]:s}}}const lh=zl("_PVM"),ch=zl("_NVM");const uh=[Wn.Open,Wn.High,Wn.Low,Wn.Close],hh={mapper:t=>t.query.symbol,recompute:r.Minimum,missing:s.UseNext,stretch:t=>!1,fieldMap:new Map(uh.map(t=>[t,t])),noDataApproach:o.NoAction,modelTransform:(t,e)=>null};class dh{constructor(t,e,i=hh){this.exprModel=t,this.container=null,this.innerSeries=e,this.innerLookup=e.reduce((t,e)=>(t[i.mapper(e)]=e,t),{}),this.policy=i,this.exprSymbols=gn(t),this.onlyForTimeline=U(this.symbols,this.exprSymbols)}get isExprInError(){return!K(this.exprModel)}get hasData(){return null!==this.container}get sourceFields(){return this._sourceFields||(this._sourceFields=Array.from(this.policy.fieldMap.keys())),this._sourceFields}get targetFields(){return this._targetFields||(this._targetFields=Array.from(this.policy.fieldMap.values())),this._targetFields}async ready(){return Qt.call(this,async()=>{this.basisChangedToken=ya.a.subscribe(jn.TS_ALL,this.onBasisChanged.bind(this));const t=(await Promise.all(this.innerSeries.map(t=>t.ready()))).every(I);return t&&this.calculate(),t})}onBasisChanged(t,e){if(t===jn.TS_EVENTSCHANGED||t===jn.TS_LOADING)return;if(!this.innerSeries.includes(e.series)||this.innerSeries.some(t=>!K(t.container)))return;const i=this.policy.mapper(e.series);if(t===jn.TS_DATAPOINTCHANGED&&this.onlyForTimeline.includes(i))return;switch(this.policy.recompute===r.Everything?jn.TS_MANYCHANGED:t){case jn.TS_MANYCHANGED:this.calculate();break;case jn.TS_DATAPOINTCHANGED:case jn.TS_DATAPOINTADDED:this.recalculate(t===jn.TS_DATAPOINTADDED);break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&ya.a.unsubscribe(this.basisChangedToken)}calculateAt(t){return t.isNull?null:this.sourceFields.map((e,i)=>pn(this.exprModel,e=>t.inn[e].values[i]))}pickMainField(){let t=null;for(const e of this.policy.fieldMap.values())if(null==t)t=e;else if(e===Wn.Close){t=e;break}return t}calculateLastChange(){const t=this.container.size;if(t<=1)return;const e=this.pickMainField(),i=this.container,n=i.getData(e)[t-2],s=i.getData(e)[t-1];K(n,s)&&i.setLastDataPoint(Wn.Change,s-n)}calculateDataPoint(t,e){const i=this.calculateAt(t);e?(this.targetFields.forEach((t,e)=>this.container.addDataPoint(t,i[e])),this.container.addDataPoint(Wn.Change,null),this.container.addDataPoint(Wn.DateTime,new Date(t.timeStamp))):this.targetFields.forEach((t,e)=>this.container.setLastDataPoint(t,i[e])),this.calculateLastChange()}notify(t){ya.a.publish(t,{series:this,index:this.container.size-1})}fieldValueAt(t,e,i){const n=this.innerLookup[t].container.getData(i);return e<0||e>=n.length?null:n[e]}timeStampAt(t,e){return this.fieldValueAt(t,e,Wn.DateTime)}timeline(t){return t.container.getData(Wn.DateTime)}getRangeHelper(){switch(this.policy.missing){case s.UseNext:case s.UseNone:return Math.min;case s.UsePrevious:return Math.max;default:throw new Error("Unknow missing bar policy, likely forgot to implement it.")}}getRange(){const t=this.getRangeHelper();return{begin:t(...this.symbols.map(t=>W(this.timeline(this.innerLookup[t])))),end:t(...this.symbols.map(t=>V(this.timeline(this.innerLookup[t]))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(t,e){const i=this.timeline(this.innerLookup[t]);switch(this.policy.missing){case s.UseNext:case s.UseNone:return i.findIndex(t=>t>=e);case s.UsePrevious:return function(t,e){if(t.length<1)return-1;for(let i=t.length-1;i>=0;--i)if(e(t[i]))return i;return-1}(i,t=>t<=e);default:throw new Error("Unknow missing bar policy, likely forgot to implement it.")}}checkPos(t){t.isNull=Object.values(t.inn).some(t=>!K(t.timeStamp)&&!this.policy.stretch(t.symbol))}fillPosSymbolAt(t,e,i){t.index=e,t.timeStamp=this.timeStampAt(t.symbol,e);const n=this.policy.missing===s.UseNone&&t.timeStamp&&t.timeStamp.getTime()!==i.timeStamp;return t.values=this.sourceFields.map(i=>n?null:this.fieldValueAt(t.symbol,e,i)),t}skippable(t){return!!this.innerLookup[t].container.isEmpty&&(this.policy.noDataApproach===o.IgnoreTimelineOnly&&this.onlyForTimeline.includes(t)||this.policy.noDataApproach===o.ModelTransformRequired)}get symbols(){const t=Object.keys(this.innerLookup);if(!K(this.onlyForTimeline))return t;return t.filter(t=>!this.skippable(t))}getPos(t){let e={inn:{},timeStamp:t};return this.symbols.forEach(i=>{const n=this.findIndex(i,t);let s={symbol:i};e.inn[i]=this.fillPosSymbolAt(s,n,e)}),this.checkPos(e),e}getInner(t){return Object.values(t.inn)}moveNext(t){t.isNull||(this.getInner(t).forEach(e=>{for(;K(e.timeStamp)&&e.timeStamp<=t.timeStamp;)this.fillPosSymbolAt(e,e.index+1,t)}),this.checkPos(t),t.isNull||(t.timeStamp=Math.min(...this.getInner(t).map(t=>t.timeStamp).filter(t=>K(t))),this.policy.missing===s.UsePrevious?this.getInner(t).forEach(e=>{(e.timeStamp>t.timeStamp||!K(e.timeStamp)&&this.policy.stretch(e.symbol))&&this.fillPosSymbolAt(e,e.index-1,t)}):this.policy.missing===s.UseNone&&this.getInner(t).forEach(e=>this.fillPosSymbolAt(e,e.index,t))))}shouldAdd(t){return this.container.getLastDataPoint(Wn.DateTime)<t.timeStamp}calculateCommon(t=null,e=null,i=!0){if(e)this.calculateDataPoint(e,i);else if(this.container=this.makeContainer(),!this.isExprInError){let t=this.getFirstPos();for(;!t.isNull;)this.calculateDataPoint(t,!0),this.moveNext(t)}t&&this.notify(t)}calculate(){const{yes:t,no:e}=H(this.innerSeries,t=>!t.container.isEmpty);if(e.length>0&&this.policy.noDataApproach===o.ModelTransformRequired){const i=t=>t.map(this.policy.mapper),n=this.policy.modelTransform(i(t),i(e));null!==n&&(this.exprModel=n)}this.calculateCommon(jn.TS_MANYCHANGED)}recalculate(t){if(this.isExprInError)return;let e=this.getLastPos();const i=this.shouldAdd(e);this.calculateCommon(i?jn.TS_DATAPOINTADDED:jn.TS_DATAPOINTCHANGED,e,i)}makeContainer(){const t=[Wn.DateTime,Wn.Change].concat(this.targetFields);return new Vr(t)}getCacheableEntities(t){this.innerSeries.forEach(e=>{e.getCacheableEntities(t)})}}const ph=zl("_AVG");const fh=zl("_HAO"),mh=zl("_HAH"),gh=zl("_HAL"),yh=zl("_HAC");const vh=zl("_DELTA");const bh={_TR:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;const i=this.baseVal(Wn.High,t),n=this.baseVal(Wn.Low,t);if(t>0){const s=this.baseVal(Wn.Close,t-1);e=Math.max(i-n,Math.abs(i-s),Math.abs(n-s))}else e=i-n;return{[this.target.id]:e}}},MA:Xl,MAEXP:class extends Kl{constructor(t,e){super(t,e,t=>2/(t+1))}},MAHLC:class extends Yl{constructor(t,e){super(t,e);const i=Ph(e,this.inputs.Period1,Wn.High,Wn.MAHI),n=Ph(e,this.inputs.Period2,Wn.Low,Wn.MALO);this.addInner(i,n)}getWrappers(){return[this.wrapInner(Wn.MAHI,1),this.wrapInner(Wn.MALO,2)]}},VOL:class extends Zl{constructor(t,e){super(t,e)}getWrappers(){return this.wrapBaseFields(Wn.Volume,Wn.TradeSize,Wn.Change)}},MAENV:class extends ec{constructor(t,e){super(t,Ql,e)}},MAENVEXP:class extends ec{constructor(t,e){super(t,Jl,e)}},MAENVSMO:class extends ec{constructor(t,e){super(t,tc,e)}},MATRI:class extends Yl{constructor(t,e){super(t,e);let i=Ph(e,this.inputs.Period,this.source),n=Ph(i,this.inputs.Period,Wn.MA,Wn.TMA);this.addInner(i,n)}getWrappers(){return[this.wrapInner(Wn.TMA,2)]}},MAWEI:class extends Yl{constructor(t,e){super(t,e);const i=this.period;this.triangle=i*(i+1)/2}weightedAverage(t){return t.reduce((t,e,i)=>t+e*(i+1),0)/this.triangle}calculateAt(t){let e=null;if(this.atLeast(t,this.period)){let i=this.past(t,this.period,this.source);R(i)&&(e=this.weightedAverage(i))}return{[this.target.id]:e}}},MAVOL:Xl,MASMO:class extends Kl{constructor(t,e){super(t,e,t=>1/t)}},MACD:class extends cc{constructor(t,e){super(t,nc,e)}},MACDEXP:class extends cc{constructor(t,e){super(t,sc,e)}},GMMA:class extends Yl{constructor(t,e){super(t,e);for(var i=1;i<=12;++i){const n=t.inputs["Period".concat(i)];this.addInner(wh(e,n,Wn.Close,t.outFields[i-1]))}}getWrappers(){return k(1,12).map(t=>this.wrapInner(this.outFields[t-1],t))}},OSCI:ic,OSCIVOL:ic,RSI:class extends dc{constructor(t,e){super(t,!1,e)}},RSIMOD:class extends dc{constructor(t,e){super(t,!0,e)}},RSISTO:class extends Yl{constructor(t,e){super(t,e);const i=Ih(e,this.inputs.Period,this.source);this.addInner(i)}calculateAt(t){let e=null;if(this.atLeast(t,this.inputs.Range)){const i=this.past(t,this.inputs.Range,Wn.RSI,this.innCont(1)),n=function(t,e=0,i=t.length-1){return z(t,e,i)[0]}(i),s=function(t,e=0,i=t.length-1){return z(t,e,i)[1]}(i);e=(V(i)-n)/(s-n)}return{[this.target.id]:e}}},WPERCR:class extends fc{constructor(t,e){super(t,!0,e)}},HHLL:class extends Yl{constructor(t,e){super(t,e);const i=Mh(e,this.inputs.Period1,Wn.High,Wn.HH,!0),n=Mh(e,this.inputs.Period2,Wn.Low,Wn.LL,!1);this.addInner(i,n)}getWrappers(){return[this.wrapInner(Wn.HH,1),this.wrapInner(Wn.LL,2)]}},WGCL:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;const i=[Wn.Close,Wn.High,Wn.Low],[n,s,r]=i.map(e=>this.baseVal(e,t));return e=(2*n+s+r)/4,{[this.target.id]:e}}},STOCHF:class extends gc{constructor(t,e){super(t,!1,Wn.PercK,e)}},STOCHS:class extends gc{constructor(t,e){super(t,!0,Wn.PercK,e)}},BBANDS:class extends yc{constructor(t,e){super(t,"Regular",e)}},BWIDTH:class extends yc{constructor(t,e){super(t,"Width",e)}},BPERC:class extends yc{constructor(t,e){super(t,"Percent",e)}},OBVOL:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;if(t>0){const i=this.baseVal(Wn.Close,t),n=this.baseVal(Wn.Volume,t),s=this.baseVal(Wn.Close,t-1);let r=this.container.getData(this.target)[t-1];K(r)||(r=0),e=i>s?r+n:i<s?r-n:r}return{[this.target.id]:e}}},ATR:class extends Yl{constructor(t,e){super(t,e);const i=Eh(e,Wn.TR),n=Bh(t,"SMA")(i,this.inputs.Period,Wn.TR,this.target),s=Ph(n,this.inputs.Period2,Wn.ATR,Wn.ATRMA);this.addInner(n,s)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(Wn.ATRMA,2)]}},ADX:class extends Mc{constructor(t,e){super(t,!1,Wn.ADX,e)}},ADXMOD:class extends Mc{constructor(t,e){super(t,!0,Wn.ADXM,e)}},ADL:class extends Yl{constructor(t,e){super(t,e);const i=_h(e);this.addInner(i)}calculateAt(t){let e=null;return e=(t>0?this.container.getData(this.target)[t-1]:0)+this.innVal(1,Wn.MFMUL,t),{[this.target.id]:e}}},ADWM:class extends Yl{constructor(t,e){super(t,e);const i=Rh(Wn.ADWM,(function(t){let e=null,i=null;if(t>0){const n=this.baseVal(Wn.Close,t-1),s=Math.max(n,this.baseVal(Wn.High,t)),r=Math.min(n,this.baseVal(Wn.Low,t)),o=this.baseVal(Wn.Close,t);if(e=o>n?o-r:o<n?o-s:0,t>1){i=(t>2?this.container.getData(Wn.ADWM)[t-1]:0)+e}}return{[Wn.ADWM.id]:i}}),e),n=Ph(i,this.inputs.Period,Wn.ADWM,Wn.ADWMMA);this.addInner(i,n)}getWrappers(){return[this.wrapInner(Wn.ADWM,1),this.wrapInner(Wn.ADWMMA,2)]}},CHAOSC:class extends Yl{constructor(t,e){super(t,e);const i=Wn.ADL;let n=function(t,e=Wn.ADL){return Sh("ADL",{target:e},t)}(e,i),s=wh(n,3,i),r=wh(n,10,i),o=kh(t.target,(t,e,i)=>e-i,s,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;return e=N([Wn.Close,Wn.High,Wn.Low].map(e=>this.baseVal(e,t))),{[this.target.id]:e}}},KELCHN:class extends Uc{constructor(t,e){super(t,kc,e)}},KELEXP:class extends Uc{constructor(t,e){super(t,Hc,e)}},KELBND:class extends Uc{constructor(t,e){super(t,Fc,e)}},DONCHN:class extends Bc{constructor(t,e){super(t,!1,e)}},DONWIDTH:class extends Bc{constructor(t,e){super(t,!0,e)}},PVT:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;if(t>0){const i=this.baseVal(Wn.Close,t),n=this.baseVal(Wn.Volume,t),s=this.baseVal(Wn.Close,t-1);let r=this.container.getData(this.target)[t-1];K(r)||(r=0);e=r+(i-s)/s*n}return{[this.target.id]:e}}},ROC:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;if(this.atLeast(t,this.period+1)){const i=this.baseVal(this.source,t-this.period);if(null!==i&&0!==i){e=(this.baseVal(this.source,t)-i)/i*100}}return{[this.target.id]:e}}},TRIX:class extends Yl{constructor(t,e){super(t,e);const i=wh(e,this.inputs.Period,this.source),n=wh(i,this.inputs.Period,i.target),s=wh(n,this.inputs.Period,n.target),r=Lh(s,1,s.target,this.target);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends Yl{constructor(t,e){super(t,e);const i=Dh(e,Wn.PVPT);this.addInner(i)}calculateAt(t){const e=this.innVal(1,Wn.PVPT,t),i=this.baseVal(Wn.High,t),n=this.baseVal(Wn.Low,t);return{[Wn.PVPTR.id]:e+i-n,[Wn.PVPTS.id]:e-i+n}}getWrappers(){return[this.wrapInner(Wn.PVPT,1)]}},PIVPTS:class extends Tu{constructor(t,e){super(t,[].concat(...Object.values(bu)),e)}calculateAt(t){let e=null,i=null,n=null,s=null,r=null,o=null,a=null;const l=this.getValues(this.inputs.Previous);if(R(l)){const[t,c,u]=l;e=(t+c+u)/3;const h=2*e;i=h-c,n=h-t;const d=t-c;s=e+d,r=e-d,o=t+2*(e-c),a=c-2*(t-e)}return{[Wn.PPTPIV.id]:e,[Wn.PPTR1.id]:i,[Wn.PPTR2.id]:s,[Wn.PPTR3.id]:o,[Wn.PPTS1.id]:n,[Wn.PPTS2.id]:r,[Wn.PPTS3.id]:a}}},CPP:class extends Tu{constructor(t,e){super(t,bu.Day,e)}calculateAt(t){let e=null,i=null,n=null,s=null,r=null,o=null,a=null,l=null;const c=this.getValues("Day");if(R(c)){const[t,u,h]=c,d=t-u,[p,f,m,g]=[2,4,6,12].map(t=>1.1/t*d);a=h+p,r=h+f,n=h+m,e=h+g,i=h-g,s=h-m,o=h-f,l=h-p}return{[Wn.CPPH4.id]:a,[Wn.CPPH3.id]:r,[Wn.CPPH2.id]:n,[Wn.CPPH1.id]:e,[Wn.CPPL1.id]:i,[Wn.CPPL2.id]:s,[Wn.CPPL3.id]:o,[Wn.CPPL4.id]:l}}},ARNUPDW:class extends jc{constructor(t,e){super(t,!1,e)}},ARNOSC:class extends jc{constructor(t,e){super(t,!0,e)}},TCHN:class extends Yl{constructor(t,e){super(t,e);const i="Close"===t.inputs.Range,n=Wh(e);if(!i&&n){const t=Rh(Wn.TCHNUP,(t,e)=>null,e),i=Rh(Wn.TCHNLOW,(t,e)=>null,e);this.addInner(t,i)}else{let n=Mh(e,t.inputs.PeriodUpper,i?Wn.Close:Wn.High,Wn.TCHNUP,!0),s=Mh(e,t.inputs.PeriodLower,i?Wn.Close:Wn.Low,Wn.TCHNLOW,!1);this.addInner(n,s)}}getWrappers(){return[this.wrapInner(Wn.TCHNUP,1),this.wrapInner(Wn.TCHNLOW,2)]}},TCHRE:class extends Yl{constructor(t,e){super(t,e);const i=function(t,e,i){const n={PeriodUpper:e,PeriodLower:e,Range:i},s=Ah("TCHN");return Sh("TCHN",{inputs:n,outFields:s},t)}(e,t.inputs.Period,t.inputs.Range);this.addInner(i)}calculateAt(t){let e=null;const i=this.innVal(1,Wn.TCHNUP,t),n=this.innVal(1,Wn.TCHNLOW,t),s=this.inputs.Adjustment,r=this.inputs.Retracement;return"Long"===r?e=K(i)?i-s:null:"Short"===r&&(e=K(n)?n+s:null),{[this.target.id]:e}}},ALLG:class extends Yl{constructor(t,e){super(t,e);const i=Rh(Gc,D(Oc,Gc),e),n=Ch(i,t.inputs.Period1,Gc,Wn.ALJAW),s=Ch(i,t.inputs.Period2,Gc,Wn.ALTEETH),r=Ch(i,t.inputs.Period3,Gc,Wn.ALLIPS);this.addInner(n,s,r)}calculateAt(t){return{[Wn.ALJAW.id]:this.innVal(1,Wn.ALJAW,t),[Wn.ALTEETH.id]:this.innVal(2,Wn.ALTEETH,t),[Wn.ALLIPS.id]:this.innVal(3,Wn.ALLIPS,t)}}},PLTLN:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){return{[Wn.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends Yl{constructor(t,e){super(t,e);const i=Rh(zc,D(Oc,zc),e),n=Ph(i,this.inputs.Period1,zc),s=Ph(i,this.inputs.Period2,zc),r=kh(Wn.AWOS,(t,e,i)=>e-i,n,s),o=Ph(r,this.inputs.Period3,r.target,Wn.AWOSMA);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Wn.AWOS,1),this.wrapInner(Wn.AWOSMA,2)]}},MFV:class extends Yc{constructor(t,e){super(t,!0,e)}},CLV:class extends Yc{constructor(t,e){super(t,!1,e)}},CHAMF:class extends Yl{constructor(t,e){super(t,e);const i=_h(e);this.addInner(i)}calculateAt(t){let e=null;if(this.atLeast(t,this.period)){let i=this.past(t,this.period,Wn.Volume),n=this.past(t,this.period,Wn.MFMUL,this.innCont(1));R(i)&&R(n)&&(e=_(n)/_(i))}return{[this.target.id]:e}}},CHAVOL:class extends Yl{constructor(t,e){super(t,e);const i=Lh(wh(Rh(qc,D(Dc,qc),e),this.inputs.Period1,qc),this.inputs.Period2,Wn.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends Yl{constructor(t,e){super(t,e);const i=this.inputs.Period;this.shift=Math.floor(i/2)+1;const n=Ph(e,i,t.source);this.addInner(n)}calculateAt(t){let e=null;const i=this.shift,n=this.innVal(1,Wn.MA,t-i);return null!==n&&(e=this.baseVal(this.source,t)-n),{[this.target.id]:e}}},CCI:class extends Yl{constructor(t,e){super(t,e);const i=Dh(e),n=Ph(i,this.inputs.Period,i.target,$c);this.addInner(i,n)}calculateAt(t){let e=null;if(this.atLeast(t,this.period)){let i=this.past(t,this.period,Wn.TP,this.innCont(1));if(R(i)){const n=this.innVal(2,$c,t);if(null!==n){const s=i.reduce((t,e,i)=>t+Math.abs(n-e),0)/this.period;e=(this.innVal(1,Wn.TP,t)-n)/(.015*s)}}}return{[this.target.id]:e}}},EMV:class extends Yl{constructor(t,e){super(t,e);const i=Rh(Wn.EMV,(function(t){let e=null;if(t>0){const i=[Wn.High,Wn.Low,Wn.Volume],[n,s,r]=i.map(e=>this.baseVal(e,t)),o=[Wn.High,Wn.Low],[a,l]=o.map(e=>this.baseVal(e,t-1));e=((n+s)/2-(a+l)/2)/(r/1e6/(n-s))}return{[this.target.id]:e}}),e),n=Ph(i,this.inputs.Period,Wn.EMV,Wn.EMVMA);this.addInner(i,n)}getWrappers(){return[this.wrapInner(Wn.EMV,1),this.wrapInner(Wn.EMVMA,2)]}},ERBRPOW:class extends Xc{constructor(t,e){super(t,!1,e)}},ERBLPOW:class extends Xc{constructor(t,e){super(t,!0,e)}},FI:class extends Yl{constructor(t,e){super(t,e);const i=wh(Rh(Kc,(function(t){let e=null;if(t>0){const i=this.baseVal(Wn.Close,t),n=this.baseVal(Wn.Volume,t);e=(i-this.baseVal(Wn.Close,t-1))*n}return{[this.target.id]:e}}),e),this.inputs.Period,Kc,Wn.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(Wn.FI,1)]}},MI:class extends Yl{constructor(t,e){super(t,e);const i=wh(Rh(Zc,D(Dc,Zc),e),9,Zc,Qc),n=wh(i,9,Qc,Jc),s=kh(tu,(t,e,i)=>e/i,i,n);this.addInner(s)}calculateAt(t){let e=null;if(this.atLeast(t,25)){let i=this.past(t,25,tu,this.innCont(1));R(i)&&(e=_(i))}return{[this.target.id]:e}}},MOM:class extends Yl{constructor(t,e){super(t,e);const i=Rh(Wn.MOM,D((function(t,e){let i=null;if(this.atLeast(e,t+1)){const n=this.baseVal(Wn.Close,e-t);if(null!==n){i=this.baseVal(Wn.Close,e)-n}}return{[this.target.id]:i}}),this.inputs.Period),e),n=Ph(i,this.inputs.Movement,Wn.MOM,Wn.MOMMA);this.addInner(i,n)}getWrappers(){return[this.wrapInner(Wn.MOM,1),this.wrapInner(Wn.MOMMA,2)]}},MFI:class extends Yl{constructor(t,e){super(t,e);const i=Dh(e);this.addInner(i)}calculateAt(t){let e=null;const i=this.period+1;if(this.atLeast(t,i)){const n=this.past(t,i,Wn.TP,this.innCont(1)),s=this.past(t,i,Wn.Volume);if(R(n)&&R(s)){let t=0,r=0;for(let e=1;e<i;++e){const i=n[e]*s[e];n[e]>n[e-1]?t+=i:r+=i}e=100-100/(1+t/r)}}return{[this.target.id]:e}}},MSD:class extends Yl{constructor(t,e){super(t,e);const i=Ph(e,this.inputs.Period,this.source);this.addInner(i)}calculateAt(t){let e=null;const i=this.innVal(1,Wn.MA,t);if(null!==i){const n=this.inputs.Period;let s=this.past(t,n,this.source);s=s.map(t=>(t-i)*(t-i)),e=Math.sqrt(N(s))}return{[this.target.id]:e}}getWrappers(){return[this.wrapInner(Wn.MA,1)]}},NVI:class extends nu{constructor(t,e){super(t,iu,e)}},PVI:class extends nu{constructor(t,e){super(t,eu,e)}},PPO:class extends cc{constructor(t,e){super(t,ac,e)}},PVO:class extends cc{constructor(t,e){super(t,lc,e)}},HV:class extends Yl{constructor(t,e){super(t,e);const i=Math.sqrt(function(t){switch(t.unit){case u.Day:return 252;case u.Week:return 52;case u.Month:return 12;default:return 0}}(t.aggregation));if(0===i){const t=Rh(this.target,(t,e)=>null,e);this.addInner(t)}else{const n=function(t,e){let i=null;const n=this.baseVal(Wn.MSD,e);return null!==n&&(i=100*n*t),{[Wn.HV.id]:i}},s=Nh(Rh(su,D((function(t,e){let i=null;if(e>0){const n=this.baseVal(t,e),s=this.baseVal(t,e-1);null!==n&&null!==s&&(i=Math.log(n/s))}return{[su.id]:i}}),Wn.Close),e),t.inputs.Period,su,Wn.MSD),r=Rh(Wn.HV,D(n,i),s);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;const i=this.baseVal(this.source,0),n=this.baseVal(this.source,t);return null!==i&&null!==n&&(e=(n-i)/i*100),{[this.target.id]:e}}},WASI:class extends Yl{constructor(t,e){super(t,e)}get helpers(){return[ru]}ohlcVals(t){return[Wn.Open,Wn.High,Wn.Low,Wn.Close].map(e=>this.baseVal(e,t))}obtainR(t,e,i,n){const s=Math.abs(t-n),r=Math.abs(e-n),o=Math.abs(t-e),a=Math.max(s,r,o),l=.25*Math.abs(n-i);return a===s?s-.5*r+l:a===r?r-.5*s+l:o+l}calculateAt(t){let e=null,i=null;if(t>0){let n=this.container.getData(ru)[t-1];K(n)||(n=0);const[s,r,o,a]=this.ohlcVals(t),[l,c,u,h]=this.ohlcVals(t-1);if(R([s,r,o,a,l,h])){const t=Math.max(Math.abs(r-h),Math.abs(o-h)),c=this.inputs.Limit;e=(a-h+.5*(a-s)+.25*(h-l))/this.obtainR(r,o,l,h)*50*(t/c),i=n+e}}return{[ru.id]:e,[this.target.id]:i}}},WWVOL:class extends Yl{constructor(t,e){super(t,e);const i=Oh(e,t.inputs.Period);this.addInner(i)}get helpers(){return[au,ou]}calculateAt(t){let e=null,i=null,n=null,s=null,r=this.innVal(1,Wn.ATR,t);if(null!==r){const o=this.baseVal(Wn.Close,t),a=this.baseVal(Wn.Close,t-1),l=this.period;n=Math.max(...this.past(t,l,Wn.Close)),s=Math.min(...this.past(t,l,Wn.Close));const c=r*this.inputs.Constant;if(null===this.innVal(1,Wn.ATR,t-1)){o>a?e=n-c:i=s+c}else{const r=[Wn.WWVSARU,Wn.WWVSARD,au,ou],[a,l,u,h]=r.map(e=>this.container.getData(e)[t-1]);n=u,s=h;null!==a?o<a?(s=o,i=o+c):(n=Math.max(o,n),e=n-c):o>l?(n=o,e=o-c):(s=Math.min(o,s),i=s+c)}}return{[au.id]:n,[ou.id]:s,[Wn.WWVSARU.id]:e,[Wn.WWVSARD.id]:i}}},PARTP:class extends Yl{constructor(t,e){super(t,e)}get helpers(){return[lu,cu,uu]}hlcVals(t){return[Wn.High,Wn.Low,Wn.Close].map(e=>this.baseVal(e,t))}me(t,e){return this.container.getData(t)[e]}reciprocal(t){return 1/t}calculateAt(t){let e=null,i=null,n=null,s=null,r=null,o=null;if(t>0){const[a,l,c]=this.hlcVals(t),[u,h,d]=this.hlcVals(t-1),p=this.reciprocal(this.inputs.Acceleration),f=this.reciprocal(this.inputs.Limit);if(1===t){r=c>d?1:-1;const t=1===r;o=t?h:u,n=t?Math.max(a,u):Math.min(l,h),s=p,t?e=o:i=o}else{const c=[uu,Wn.PARSARS,Wn.PARSARL,lu,cu],[d,m,g,y,v]=c.map(e=>this.me(e,t-1)),b=1===d,T=b?g:m,S=v*Math.abs(y-T);r=b?T+S>l?-1:1:T-S<a?1:-1;const A=d===r;if(o=A?b?Math.min(T+S,h,this.baseVal(Wn.Low,t-2)):Math.max(T-S,u,this.baseVal(Wn.High,t-2)):y,n=A?b?Math.max(a,y):Math.min(l,y):1===r?a:l,s=v,A){(b?n>y:n<y)&&v<f&&(s=v+p)}else s=p;1===r?e=o:i=o}}return{[lu.id]:n,[cu.id]:s,[uu.id]:r,[Wn.PARSARS.id]:i,[Wn.PARSARL.id]:e}}},MOVLR:class extends Yl{constructor(t,e){super(t,e),this.xSum=this.period*(this.period+1)/2,this.xSum2=this.xSum*this.xSum,this.x2Sum=this.period*(this.period+1)*(2*this.period+1)/6}calculateAt(t){let e=null;if(this.atLeast(t,this.period)){let i=this.past(t,this.period,this.source);if(R(i)){const t=_(i),n=_(i.map((t,e)=>t*(e+1))),s=(this.period*n-this.xSum*t)/(this.period*this.x2Sum-this.xSum2);e=(t-s*this.xSum)/this.period+s*this.period}}return{[this.target.id]:e}}},TRSP:class extends Yl{constructor(t,e){super(t,Gl(e,t=>new hu(t))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(Wn.TRSP1,0),this.wrapInner(Wn.TRSP2,0)]}},COTLC:class extends mu{constructor(t,e){super(t,1,e)}},COTDAG:class extends mu{constructor(t,e){super(t,2,e)}},COTFTR:class extends mu{constructor(t,e){super(t,3,e)}},IMPVOL:class extends Yl{constructor(t,e){super(t,Gl(e,t=>new Su(t))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(Wn.IMPVOL,0)]}},CTM:class extends cc{constructor(t,e){t.inputs={Period1:5,Period2:21,Period3:34},super(t,rc,e)}},GPMI:class extends cc{constructor(t,e){t.inputs={Period1:3,Period2:5,Period3:8},super(t,oc,e)}},DEMA:class extends Yl{constructor(t,e){super(t,e);const i=wh(e,this.inputs.Period,this.source),n=wh(i,this.inputs.Period,i.target),s=kh(Wn.DEMA,(t,e,i)=>2*e-i,i,n);this.addInner(s)}getWrappers(){return[this.wrapInner(Wn.DEMA,1)]}},TEMA:class extends Yl{constructor(t,e){super(t,e);const i=wh(e,this.inputs.Period,this.source),n=wh(i,this.inputs.Period,i.target),s=wh(n,this.inputs.Period,n.target),r=kh(Wn.TEMA,(t,e,i,n)=>3*(e-i)+n,i,n,s);this.addInner(r)}getWrappers(){return[this.wrapInner(Wn.TEMA,1)]}},TSI:class extends Yl{constructor(t,e){super(t,e);const i=(t,e,i,n,s,r)=>{const o=wh(t,e,i,n);return wh(o,s,n,r)},n=Rh(wu,D((t,e)=>({[t.id]:Math.abs(this.baseVal(Wn.Change,e))}),wu),e),s=i(e,t.inputs.Period1,Wn.Change,Cu,t.inputs.Period2,xu),r=i(n,t.inputs.Period1,wu,Mu,t.inputs.Period2,Eu),o=kh(Wn.TSI,(t,e,i)=>100*e/i,s,r),a=wh(o,t.inputs.Period3,Wn.TSI,Wn.TSISIG);this.addInner(o,a)}getWrappers(){return[this.wrapInner(Wn.TSI,1),this.wrapInner(Wn.TSISIG,2)]}},ADJATR:class extends Yl{constructor(t,e){super(t,e);const i=Rh(vc,D((t,e)=>{let i=0;return e>0&&(i=this.baseVal(t,e)-this.baseVal(t,e-1)),{[vc.id]:Math.abs(i)}},this.source),e),n=Bh(t,"MA")(i,this.inputs.Period,vc,bc),s=kh(Wn.ADJATR,(t,e)=>2*e,n);this.addInner(s)}getWrappers(){return[this.wrapInner(Wn.ADJATR,1)]}},COTR:class extends Yl{constructor(t,e){super(t,e);const i=Rh(Tc,t=>{let e=0;return t>0&&(e=this.baseVal(Wn.Close,t)-this.baseVal(Wn.Close,t-1)),{[Tc.id]:e}},e),n=function(t){const e=t.inputs.TypeOfATR.toLowerCase();return Vh[e]}(t)(e,this.inputs.Period,this.inputs.Smoothing),s=kh(this.target,(t,e,i)=>K(e)&&K(i)?e/i:null,i,n);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends Yl{constructor(t,e){super(t,e);const i=wh(e,this.inputs.Period,Wn.Close);this.addInner(i)}calculateAt(t){let e=null;const i=t>0?this.container.getData(this.target)[t-1]:null;if(K(i)){const n=this.baseVal(this.source,t);e=i+(n-i)/(.6*this.period*Math.pow(n/i,4)),Number.isFinite(e)||(e=null)}else e=this.innVal(1,Wn.EMA,t);return{[this.target.id]:e}}},HMA:class extends Yl{constructor(t,e){super(t,e);const i=this.inputs.Period,n=xh(e,Math.floor(i/2),this.source),s=xh(e,i,this.source),r=xh(kh(Ou,(t,e,i)=>2*e-i,n,s),Math.floor(Math.sqrt(i)),Ou,this.target);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends Yl{constructor(t,e){super(t,e);const i=Lh(e,this.inputs.PeriodRocLong),n=Lh(e,this.inputs.PeriodRocShort),s=xh(kh(Du,(t,e,i)=>e+i,i,n),this.inputs.PeriodWma,Du,this.target);this.addInner(s)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRHI:class extends Nu{constructor(t,e){super(t,!0,e)}},REATRLO:class extends Nu{constructor(t,e){super(t,!1,e)}},LINRCHN:class extends Yl{constructor(t,e){super(t,e);const i=this.inputs.Period,n=Rh(Wn.LINRMID,D((function(t,e){let i=null;if(e>=this.base.size-t){const n=t*(t+1)/2,s=n*n,r=t*(t+1)*(2*t+1)/6;let o=0,a=0,l=1;for(let e=t-1;e>=0;--e){const t=this.baseVal(Wn.Close,this.base.size-1-e);o+=t,a+=l*t,l+=1}const c=(t*a-n*o)/(t*r-s);i=o/t-c*n/t+c*(e-this.base.size+t+1)}return{[Wn.LINRMID.id]:i}}),i),e),s=Rh(this.source,(function(t){return{[this.target.id]:this.baseVal(this.target,t)}}),e),r=Nh(kh(Ru,(t,e,i)=>e-i,s,n),i,Ru);this.addInner(n,r)}calculateAt(t){const e=this.innVal(1,Wn.LINRMID,t),i=V(this.innCont(2).getData(Wn.MSD));let n=null,s=null;return K(e,i)&&(n=e+this.inputs.Width*i,s=e-this.inputs.Width*i),{[Wn.LINRUP.id]:n,[Wn.LINRLOW.id]:s}}getWrappers(){return[this.wrapInner(Wn.LINRMID,1)]}},CSHO:class extends Yl{constructor(t,e){super(t,e,Gl(e,t=>{const e=et(t);var i;return e.symbol=Ot(i=t.symbol)?"".concat(Ut(i),"Y00"):null,K(e.symbol)?new Aa(e):new Pa(e)})),this.computedServerSide=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){const t=this.innCont(0);if(!K(t)||0===t.size)return;const e=this.innCont(1),i=t.getData(Wn.DateTime),n=e.getData(Wn.DateTime),s=e.getData(Wn.Close),r=Array(i.length).fill(null);let o=0;const a=t.size,l=e.size;for(let t=0;t<a;++t){for(;o<l&&n[o].getTime()<i[t].getTime();)o++;o<l&&n[o].getTime()===i[t].getTime()&&(r[t]=s[o])}this.container.setData(this.target,r)}calculate(t){this.computeDone||(this.container=this.makeContainer(),this.alignCashTimelineWithUnderlying(),this.computeDone=!0,this.notify(jn.TS_MANYCHANGED,-1))}},CSHB:class extends Yl{constructor(t,e){super(t,e,function(t,e=Wn.CSHO){return Sh("CSHO",{target:e},t)}(e))}shouldTriggerOurRecalc(t){const e=t=>K(t)&&t.size>0;return(super.shouldTriggerOurRecalc(t)||t===this.innerSeries[1])&&e(this.innCont(0))&&e(this.innCont(1))}calculateAt(t){const e=(e,i)=>K(this.innCont(e))?this.innVal(e,i,t):null,i=e(0,Wn.Close),n=e(1,Wn.CSHO);return{[this.target.id]:K(n)&&K(i)?n-i:null}}},GTPI:class extends gc{constructor(t,e){t.inputs={Period1:5,Period2:3,Period3:3},super(t,!0,Wn.GTPI,e)}},PCTCHG:class extends Yl{constructor(t,e){super(t,e)}calculateAt(t){let e=null;if(t>0){const i=this.baseVal(this.source,t-1);if(null!==i){e=100*(this.baseVal(this.source,t)-i)/i}}return{[this.target.id]:e}}},OPINT:class extends Zl{constructor(t,e){super(t,e)}getWrappers(){return this.wrapBaseFields(Wn.TradeSize,Wn.Change)}},STOMOMIX:class extends Yl{constructor(t,e){super(t,e);const i=Mh(e,t.inputs.Period1,Wn.High,Wn.HH,!0),n=Mh(e,t.inputs.Period1,Wn.Low,Wn.LL,!1),s=wh(kh(ku,(t,e,i)=>this.baseVal(Wn.Close,t)-(e+i)/2,i,n),t.inputs.Period2,ku,Hu),r=wh(s,t.inputs.Period2,Hu,Fu),o=wh(kh(Uu,(t,e,i)=>e-i,i,n),t.inputs.Period2,Uu,Bu),a=wh(o,t.inputs.Period2,Bu,Vu),l=kh(Wn.STOMOMIX,(t,e,i)=>100*e/i,r,a);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends Yl{constructor(t,e){super(t,e);const i=Rh(Wu,(function(t){const e=Wn.Close,i=t>0?this.baseVal(e,t)-this.baseVal(e,t-1):0;return{[Wu.id]:i}}),e),n=kh(ju,(t,e)=>e>=0?e:0,i),s=kh(Gu,(t,e)=>e>=0?0:-e,i);this.addInner(n,s)}perc(t,e){return 100*t/e}calculateAt(t){let e=null;if(this.atLeast(t,this.period+1)){const i=this.past(t,this.period,ju,this.innCont(1)),n=this.past(t,this.period,Gu,this.innCont(2));if(R(i)&&R(n)){const t=_(i),s=_(n);e=this.perc(t-s,t+s)}}return{[this.target.id]:e}}},VSTOP:class extends Yl{constructor(t,e){super(t,e);const i=Oh(e,t.inputs.Period);this.addInner(i)}get helpers(){return[zu,Yu,qu]}calculateAt(t){let e=null,i=null,n=null,s=null,r=null,o=null,a=1;const l=this.baseVal(Wn.Close,t),c=t=>((t,e)=>K(t)?t:e)(t,0),u=(t,e)=>this.container.getData(t)[e];t>0&&(n=Math.max(c(u(zu,t-1)),l),r=Math.min(c(u(Yu,t-1)),l),a=u(qu,t-1));const h=this.inputs.Multiplier,d=this.innVal(1,Wn.ATR,t);if(K(d)){const c=1===a,p=c?n-h*d:r+h*d;let f=u(c?Wn.VSTOPUP:Wn.VSTOPLOW,t-1);K(f)||(f=0);const m=c?Math.max(f,p):Math.min(f,p);o=l-m>=0?1:0;const g=o!=a;i=g?l:n,s=g?l:r,e=g?1===o?i-h*d:s+h*d:m}return{[Wn.VSTOPUP.id]:1===o?e:null,[Wn.VSTOPLOW.id]:1===o?null:e,[zu.id]:i,[Yu.id]:s,[qu.id]:o}}},SUPTR:class extends Yl{constructor(t,e){super(t,e);const i=Oh(e,t.inputs.Period);this.addInner(i)}get helpers(){return[$u,Xu,Ku,Wn.BARCOLIX]}calculateAt(t){let e=0,i=0,n=0,s=null,r=0;const o=this.innVal(1,Wn.ATR,t);if(K(o)){const a=(t,e)=>K(t)?t:e,l=[Wn.Close,Wn.High,Wn.Low],[c,u,h]=l.map(e=>this.baseVal(e,t)),d=(u+h)/2,p=this.baseVal(Wn.Close,t-1),f=this.inputs.Multiplier,m=d-f*o,g=d+f*o,y=[$u,Xu,Ku],[v,b,T]=y.map(e=>this.container.getData(e)[t-1]);e=p>v?Math.max(m,v):m,i=p<b?Math.min(g,b):g,n=c>b?1:c<v?-1:a(T,1);const S=1===n;s=S?e:i,r=S?1:0}return{[$u.id]:e,[Xu.id]:i,[Ku.id]:n,[Wn.SUPTR.id]:s,[Wn.BARCOLIX.id]:r}}},ICHCLD:class extends Yl{constructor(t,e){super(t,e);const i=(t,e,i)=>kh(i,(t,e,i)=>(e+i)/2,t,e),n=(t,n)=>i((t=>Mh(e,t,Wn.Low,Wn.LL,!1))(t),(t=>Mh(e,t,Wn.High,Wn.HH,!0))(t),n),s=n(t.inputs.PeriodConversionLine,Wn.CONVLN),r=n(t.inputs.PeriodBaseLine,Wn.BASELN),o=i(s,r,Wn.LEADSP1),a=n(t.inputs.PeriodLaggingSpan2,Wn.LEADSP2);this.addInner(s,r,o,a)}get helpers(){return[Wn.BARCOLIX]}calculateAt(t){const e=this.innVal(3,Wn.LEADSP1,t)>this.innVal(4,Wn.LEADSP2,t)?1:0;return{[Wn.LAGGSP.id]:this.baseVal(Wn.Close,t),[Wn.BARCOLIX.id]:e}}getWrappers(){return[this.wrapInner(Wn.CONVLN,1),this.wrapInner(Wn.BASELN,2),this.wrapInner(Wn.LEADSP1,3),this.wrapInner(Wn.LEADSP2,4)]}},VWAP:class extends Yl{constructor(t,e){super(t,e);const i=Rh(ih,D((function(t,e){const i=[Wn.Open,Wn.High,Wn.Low,Wn.Close],[n,s,r,o]=i.map(t=>this.baseVal(t,e));let a=null;switch(t){case"Open":a=n;break;case"High":a=s;break;case"Low":a=r;break;case"Close":a=o;break;case"HL/2":a=(s+r)/2;break;case"OHLC/4":a=(n+s+r+o)/4;break;case"HLC/3":default:a=(s+r+o)/3}return{[ih.id]:a}}),this.inputs.Source),e);this.addInner(i)}get helpers(){return[nh,sh,rh]}valueAt(t,e){return this.container.getData(t)[e]}dateAt(t){return this.container.getTimeData()[t]}isSame(t,e){switch(this.inputs.AnchorPeriod){case"Session":default:return Tt(t,e);case"Week":return ji(t,e);case"Month":return Gi(t,e);case"Quarter":return Yi(t,e);case"Year":return Vi(t,e);case"Decade":return function(t,e){return Ju(t)===Ju(e)}(t,e);case"Century":return th(t,e)}}findPrevPeriodChange(t){for(let e=t;e>0;e--)if(1===this.valueAt(rh,e))return e;return 0}calculateAt(t){let e=null,i=null,n=null,s=null,r=null;const o=t>0,a=o?this.dateAt(t-1):eh,l=this.dateAt(t),c=o&&this.isSame(a,l),u=c?this.valueAt(nh,t-1):0,h=c?this.valueAt(sh,t-1):0,d=this.innVal(0,Wn.Volume,t),p=u+this.innVal(1,ih,t)*d,f=h+d;if(e=p/f,c){const o=this.findPrevPeriodChange(t-1),a=this.container.getData(Wn.VWAP).slice(o,t);a.push(e);const l=N(a),c=a.map(t=>(t-l)*(t-l)),u=Math.sqrt(N(c)),h=this.inputs.Stdev1stMultiplier*u;i=e+h,n=e-h;const d=this.inputs.Stdev2ndMultiplier*u;s=e+d,r=e-d}else i=e,n=e,s=e,r=e;return{[nh.id]:p,[sh.id]:f,[rh.id]:c?0:1,[Wn.VWAP.id]:e,[Wn.VWAPSD1U.id]:i,[Wn.VWAPSD1L.id]:n,[Wn.VWAPSD2U.id]:s,[Wn.VWAPSD2L.id]:r}}},MACDSIG:class extends ah{constructor(t,e){super(t,e,Ph(e,t.inputs.Period1,Wn.Close,Wn.MAS),Ph(e,t.inputs.Period2,Wn.Close,Wn.MAL))}calculateAt(t){const e=this.innVal(1,Wn.MAS,t),i=this.innVal(2,Wn.MAL,t);return this.calculateDiff(t,e,i)}getWrappers(){return[this.wrapInner(Wn.MAS,1),this.wrapInner(Wn.MAL,2)]}},MASIG:class extends ah{constructor(t,e){super(t,e,Ph(e,t.inputs.Period,Wn.Close))}calculateAt(t){const e=this.innVal(1,Wn.MA,t),i=this.baseVal(Wn.Close,t);return this.calculateDiff(t,i,e)}getWrappers(){return[this.wrapInner(Wn.MA,1)]}},VOIN:class extends Yl{constructor(t,e){super(t,e);const i=Rh(lh,(function(t){return{[lh.id]:t>0?Math.abs(this.baseVal(Wn.High,t)-this.baseVal(Wn.Low,t-1)):null}}),e),n=Rh(ch,(function(t){return{[ch.id]:t>0?Math.abs(this.baseVal(Wn.Low,t)-this.baseVal(Wn.High,t-1)):null}}),e),s=Eh(e,Wn.TR);this.addInner(i,n,s)}calculateAt(t){let e=null,i=null;if(this.atLeast(t,this.period)){const n=this.past(t,this.period,lh,this.innCont(1)),s=this.past(t,this.period,ch,this.innCont(2)),r=this.past(t,this.period,Wn.TR,this.innCont(3));if(R(n)&&R(s)&&R(r)){const t=_(n),o=_(s),a=_(r);e=t/a,i=o/a}}return{[Wn.PLVI.id]:e,[Wn.MNVI.id]:i}}},DIFA:class extends Yl{constructor(t,e){super(t,e);const i=Bh(t,"MA","Average")(e,this.period,this.source,ph);this.addInner(i)}calculateAt(t){let e=null;const i=this.innVal(1,ph,t),n=this.baseVal(this.source,t);return null!=i&&0!==i&&(e=100*(n-i)/i),{[this.target.id]:e}}},DOSC:class extends Yl{constructor(t,e){super(t,e);const i=wh(Ih(e,this.inputs.PeriodRsi,this.source,Wn.RSI),this.inputs.PeriodEma1,Wn.RSI,Wn.EMA),n=wh(i,this.inputs.PeriodEma2,Wn.EMA,Wn.EMA),s=Ph(n,this.inputs.PeriodMa,Wn.EMA,Wn.MA);const r=kh(Wn.DOSCH,(t,e,i)=>e-i,n,s),o=Ph(r,this.inputs.PeriodSig,Wn.DOSCH,Wn.DOSCS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Wn.DOSCH,1),this.wrapInner(Wn.DOSCS,2)]}},BSQUEEZE:class extends yc{constructor(t,e){super(t,"Squeeze",e)}},MARIB:class extends Yl{constructor(t,e){super(t,e);const i=this.inputs.Period,n=this.inputs.Increment,s=Math.min(Math.max(0,this.inputs.Count),10);for(let t=0;t<s;++t){const s=Ph(e,i+t*n,this.source,this.outFields[t]);this.addInner(s)}}getWrappers(){const t=this.outFields,e=this.inputs.Count;return[this.wrapInner(t[0],1),this.wrapInner(t[1],2),this.wrapInner(t[2],3),this.wrapInner(t[3],4),this.wrapInner(t[4],5),this.wrapInner(t[5],6),this.wrapInner(t[6],7),this.wrapInner(t[7],8),this.wrapInner(t[8],9),this.wrapInner(t[9],10)].slice(0,e)}},HASMO:class extends Yl{constructor(t,e){super(t,e);const i=Bh(t,"EMA","Smoothing1"),n=t.inputs.Period1,s=i(e,n,Wn.Open),r=i(e,n,Wn.High),o=i(e,n,Wn.Low),a=i(e,n,Wn.Close),l=kh(yh,(t,e,i,n,s)=>(e+i+n+s)/4,s,r,o,a);const c=kh(fh,(function(t,e,i,n){let s=null;if(t>0){const n=this.container.getData(fh)[t-1],r=this.innVal(2,yh,t-1);K(n,r)?s=(n+r)/2:K(e,i)&&(s=(e+i)/2)}return s}),s,a,l),u=kh(mh,(t,e,i,n)=>K(e,i,n)?Math.max(e,Math.max(i,n)):null,r,c,l),h=kh(gh,(t,e,i,n)=>K(e,i,n)?Math.min(e,Math.min(i,n)):null,o,c,l),d=Bh(t,"EMA","Smoothing2"),p=t.inputs.Period2,f=d(c,p,fh,Wn.Open),m=d(u,p,mh,Wn.High),g=d(h,p,gh,Wn.Low),y=d(l,p,yh,Wn.Close),v=Rh(Wn.Change,(function(t){let e=null;if(t>0){const i=this.baseVal(Wn.Close,t),n=this.baseVal(Wn.Close,t-1);K(i,n)?e=i-n:K(i)&&!K(n)&&(e=0)}return{[Wn.Change.id]:e}}),y);this.addInner(f,m,g,y,v)}getWrappers(){return[this.wrapInner(Wn.Open,1),this.wrapInner(Wn.High,2),this.wrapInner(Wn.Low,3),this.wrapInner(Wn.Close,4),this.wrapInner(Wn.Change,5)]}},TTMSQZ:class extends Yl{constructor(t,e){super(t,e);const i=t.inputs,n=wh(e,i.PeriodEmaKeltner,Wn.Close),s=Oh(e,i.PeriodAtrKeltner);function r(t,e,i,n){return K(i,n)?i+t*n:null}const o=i.MultiplierKeltner,a=kh(Wn.KCUP,D(r,o),n,s),l=kh(Wn.KCLOW,D(r,-o),n,s),c=function(t,e,i,n=Wn.Close){const s=Ah("BBANDS"),r={[te.INPUT_PERIOD]:e,[te.INPUT_WIDTH]:i};return Sh("BBANDS",{source:n,inputs:r,outFields:s},t)}(e,i.PeriodBollinger,i.WidthBollinger),u=function(t,e){const i=Ah("DONCHN");return Sh("DONCHN",{inputs:Th(e),outFields:i},t)}(e,i.PeriodMomentum),h=Ph(e,i.PeriodMomentum,Wn.Close);const d=function(t,e,i,n=Wn.MOVLR){const s=Th(e);return Sh("MOVLR",{source:i,inputs:s,target:n},t)}(kh(vh,(function(t,e,i,n){let s=null;const r=this.innVal(1,Wn.DONMID,t);return K(r,n)&&(s=e-(r+n)/2),s}),e,u,h),i.PeriodMomentum,vh,Wn.TTMSQZOSC);this.addInner(a,l,c,d)}get helpers(){return[Wn.BARCOLIX]}calculateAt(t){let e=null,i=null,n=-1;const s=this.innVal(1,Wn.KCUP,t),r=this.innVal(2,Wn.KCLOW,t),[o,a]=[Wn.BOLLBU,Wn.BOLLBL].map(e=>this.innVal(3,e,t));o<s&&a>r?e=0:i=0;const l=this.innVal(4,Wn.TTMSQZOSC,t),c=t>0?this.innVal(4,Wn.TTMSQZOSC,t-1):null;if(K(l))if(K(c)){const t=c<l;n=l>=0?t?3:2:t?1:0}else n=2;return{[Wn.TTMSQZON.id]:e,[Wn.TTMSQZOFF.id]:i,[Wn.BARCOLIX.id]:n}}getWrappers(){return[this.wrapInner(Wn.TTMSQZOSC,4)]}}};function Th(t){return{[te.INPUT_PERIOD]:t}}function Sh(t,e,i){if(bh.hasOwnProperty(t))return new bh[t](e,i);throw new Error("Study ".concat(t," has not been implemented yet."))}function Ah(t){return xi(t).defaults.curves.reduce((t,e)=>t.concat(e.fields.filter(e=>!t.includes(e))),[]).map(t=>Wn[t])}function Ph(t,e,i,n=Wn.MA){return Sh("MA",{source:i,target:n,inputs:Th(e)},t)}function wh(t,e,i,n=Wn.EMA){return Sh("MAEXP",{source:i,target:n,inputs:Th(e)},t)}function Ch(t,e,i,n=Wn.SMA){return Sh("MASMO",{source:i,target:n,inputs:Th(e)},t)}function xh(t,e,i,n=Wn.WMA){return Sh("MAWEI",{source:i,target:n,inputs:Th(e)},t)}function Mh(t,e,i,n,s,r=!1){return new pc({source:i,target:n,inputs:Th(e)},s,r,t)}function Eh(t,e=Wn.TR){return Sh("_TR",{target:e},t)}function Oh(t,e,i="SMA",n=Wn.ATR){return Sh("ATR",{target:n,inputs:{[te.INPUT_PERIOD]:e,[te.INPUT_SMOOTHING]:i}},t)}function Dh(t,e=Wn.TP){return Sh("TP",{target:e},t)}function Lh(t,e,i=Wn.Close,n=Wn.ROC){return Sh("ROC",{source:i,target:n,inputs:Th(e)},t)}function Ih(t,e,i,n=Wn.RSI){return Sh("RSI",{source:i,target:n,inputs:Th(e)},t)}function _h(t,e=Wn.MFMUL){return Sh("MFV",{target:e},t)}function Nh(t,e,i,n=Wn.MSD){return Sh("MSD",{source:i,target:n,inputs:Th(e)},t)}function Rh(t,e,i){return new Lc({target:t},e,i)}function kh(t,e,...i){return new Ec({target:t},e,...i)}function Hh(t,e,i){return e-i}function Fh(t,e,i){return(e-i)/i*100}const Uh={sma:Ch,ma:Ph,ema:wh,wma:xh,hma:function(t,e,i,n=Wn.HMA){return Sh("HMA",{source:i,target:n,inputs:Th(e)},t)}};function Bh(t,e,i="Smoothing"){const n=(t.inputs[i]||e).toLowerCase();return Uh[n]}const Vh={atr:Oh,adjatr:function(t,e,i="MA",n=Wn.Close,s=Wn.ADJATR){return Sh("ADJATR",{source:n,target:s,inputs:{[te.INPUT_PERIOD]:e,[te.INPUT_SMOOTHING]:i}},t)}};function Wh(t){const e=[Wn.High,Wn.Low];return t instanceof dh&&2!==B(t.targetFields,e).length}class jh extends ql{constructor(t,e){super(t,e,wh(e,13,Wn.Close),function(t,e,i,n,s=Wn.Close){return Sh("MACDEXP",{source:s,inputs:{Period1:e,Period2:i,Period3:n},outFields:[Wn.MACD,Wn.MACDS,Wn.MACDH]},t)}(e,12,26,9,Wn.Close)),this.query=e.query,this.useNotifications=!0}calculateAt(t){let e=a.Same;const i=this.innVal(1,Wn.EMA,t),n=this.innVal(1,Wn.EMA,t-1),s=this.innVal(2,Wn.MACDH,t),r=this.innVal(2,Wn.MACDH,t-1);return K(i,n,s,r)&&(i>n&&s>r?e=a.Up:i<n&&s<r&&(e=a.Down)),{[Wn.BREL.id]:e}}getWrappers(){return this.wrapBaseFields(Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.Change,Wn.Volume,Wn.OpenInterest)}}function Gh(t,e){if(!K(e))return this[t];this[t]=e}class zh{constructor(){this._domain=this._range=null,this._padding=[0,0]}domain(){return Gh.call(this,"_domain",arguments[0])}range(){return Gh.call(this,"_range",arguments[0])}padding(){return Gh.call(this,"_padding",arguments[0])}get ready(){return K(this._domain,this._range)}}const Yh=1/Math.log2(10);function qh(t,e){const i=(n=t[0],s=t[1],(s-=n)>0?t=>(t-n)/s:t=>isNaN(s)?NaN:.5);var n,s;const r=((t,e)=>i=>t*(1-i)+e*i)(e[0],e[1]);return t=>r(i(t))}class $h extends zh{constructor(t){super(),this.scaleType=t}yToPrice(t){return this.mapValue(t)}symLog(t){return Math.sign(t)*Math.log10(1+Math.abs(t/Yh))}symPow(t){return Math.sign(t)*Yh*(-1+Math.pow(10,Math.abs(t)))}rangeWithPadding(){return[this._range[0]+this._padding[0],this._range[1]-this._padding[1]]}mapValue(t,e=!0){if(!this.ready)return null;let i=I,n=I;switch(this.scaleType){case y.Linear:break;case y.Logarithmic:i=this.symLog,n=this.symPow;break;default:throw new Error("Unexpected scale type (neither linear nor log)")}const s=this._domain.map(i),r=this.rangeWithPadding(),o=t=>r[1]-t+r[0];return(e?n:o)((e?qh(r,s):qh(s,r))((e?o:i)(t)))}priceToY(t){return this.mapValue(t,!1)}getTicks(t){if(!this.ready)return[];let[e,i]=this._range.map(t=>this.mapValue(t,!0));return e===i&&t>0?[e]:function(t,e,i){let n,s,r,o,a=-1;if(i=+i,(t=+t)===(e=+e)&&i>0)return[t];(n=e<t)&&(s=t,t=e,e=s);if(0===(o=function(t,e,i){const n=Math.sqrt(50),s=Math.sqrt(10),r=Math.sqrt(2);var o=(e-t)/Math.max(0,i),a=Math.floor(Math.log(o)/Math.LN10),l=o/Math.pow(10,a);return a>=0?(l>=n?10:l>=s?5:l>=r?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(l>=n?10:l>=s?5:l>=r?2:1)}(t,e,i))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),e=Math.floor(e/o),r=new Array(s=Math.ceil(e-t+1));++a<s;)r[a]=(t+a)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),r=new Array(s=Math.ceil(t-e+1));++a<s;)r[a]=(t-a)/o;n&&r.reverse();return r}(e,i,t)}}function Xh(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Kh(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Xh(Object(i),!0).forEach((function(e){Zh(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Xh(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Zh(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const Qh={color:te.COLOR_TRANSPARENT},Jh={color:te.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"};class td{constructor(){this.axis=null,this.id=La()(),this.record=new $n,this.metaData=new be,this.timeSeries=new Pa}get title(){return""}get showPrevious(){return!1}getPreviousValue(){return null}get mainCurve(){return this.curves[0]}get hasEvents(){return!1}findEvents(){return[]}get eventsSeries(){return null}get hasEventsData(){return this.hasEvents&&K(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(t){return null}get isSymbol(){return this.is(v.Symbol)}get isExpression(){return this.is(v.Expression)}get isStudy(){return this.is(v.Study)}get isForward(){return this.is(v.Forward)}get isSeasonal(){return this.is(v.Seasonal)}wrapIfAdvancedStyle(t){let e=t;return this.mainCurve.isHeikinAshiStyle?e=new $l({outFields:et(this.mainCurve.fields)},t):this.mainCurve.isElderImpulseSystemStyle&&(e=new jh({outFields:et(this.mainCurve.fields).concat(Wn.BREL)},t)),e}is(t){return this.type===t}getCacheableEntities(t){this.metaData.getCacheableEntities(t.metaData),this.timeSeries.getCacheableEntities(t.timeSeries)}fromModel(t){this.type=v[t.type],this.main=t.main,t.levels&&(this.levels=t.levels),t.bands&&(this.bands=t.bands),this.curves=t.curves.map(t=>{const e=new Ml;return e.plot=this,e.fromModel(t),e}),t.detachedScale&&(this.detachedScale=t.detachedScale,this.yScale=new $h(y.Linear))}initialize(){}shutdown(){K(this.timeSeries)&&K(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){const t=this.axis.pane.presenter,e=new jl(null,t.data.aggregation,b.Normal,[ot(tt(t.data,null,"range","from")),ot(tt(t.data,null,"range","to"))]);return e.barsToFetch=t.data.maxDataPoints||te.DEFAULT_MAX_RECORDS,e.chartId=t.elementId,e.curveStyle=this.curves[0].style,e}priceToY(t){return(this.hasDetachedScale?this.yScale:this.axis.yScale).priceToY(t)}get hasDetachedScale(){return K(this.detachedScale,this.yScale)}setViewBox(t){if(!this.hasDetachedScale)return;const{y:e,height:i}=t,{marginTop:n,marginBottom:s}=this.detachedScale;this.yScale.range([Math.floor(e+n*i),Math.floor(e+i-s*i)])}drawLevels(t){t.save();const e=te.OUT_OF_SCREEN;for(let i of this.levels){const n=this.priceToY(i.value);ci(t,ui({line:i.line,fill:Qh})),Xe(t,{x:-1,y:n},{x:e,y:n})}t.restore()}drawBands(t){t.save();const e=te.OUT_OF_SCREEN;for(let i of this.bands){const n=this.priceToY(i.range.to),s=this.priceToY(i.range.from);ci(t,ui({fill:i.fill,line:Jh}));qe(t,new je(-1,n,e,s-n),!1)}t.restore()}getEventFields(){return this.hasEvents&&this.hasEventsData?this.eventsSeries.container.fields.filter(t=>t!==Wn.DateTime):[]}getEventsAt(t){const e=this.eventsSeries.container,i=i=>e.getData(i)[t];return this.getEventFields().map(e=>{const n=i(e);if(!K(n))return null;const s=this.getEventFor(e);if(!K(s))return null;const r=e===Wn.Custom,o=t%2==0;return{field:e,value:r?o?"__news":"__video":n,date:i(Wn.DateTime),text:r?o?"N":"V":s.title,color:r?"#be7404":s.color}}).filter(t=>t)}getRefEventField(t,e,i){return e?t.isOhlc?Wn.High:i.isTick?Wn.Last:Wn.Close:t.fields[0]}getRefPlot(t){return this.axis.pane.isMain?t.mainPlot:this}drawEvents(t,e){const i=this.axis.pane.presenter,n=i.view.xAxis.xScale,s=n.domain();if(!K(s)||!K(s[0],s[1]))return;const r=(t,e=Wn.DateTime)=>t.container.getData(e),o=r(this.eventsSeries),a=this.getRefPlot(i),l=a.timeSeries,c=r(l),h=i.data.aggregation,d=a===i.mainPlot,p=r(l,this.getRefEventField(a.mainCurve,d,h)),{chart:{fontFamily:f}}=this.axis.pane.presenter.display,m=o.map((t,r)=>{if(!(t=>+t>=+s[0]&&+t<=+s[1])(t))return[];return this.getEventsAt(r).map(t=>{const s=function(t,e){const{unit:i}=t;return i===u.Year?Zu(e):i===u.Quarter?zi(e):i===u.Month?St(e):i===u.Week?Wi(e):i===u.Day?bt(e):e}(h,t.date),r=G(c,+s,Number),o=p[r];e.has(r)||e.set(r,-1);let a=e.get(r);e.set(r,++a);const l=n.timeToX(s),d=i.view.getEventRadius(),f=this.axis.yScale.priceToY(o)-a*(d+d+d);return Kh(Kh({visible:!0},t),{},{x:l,y:f,r:d})})}).flat();t.save();let g=!0;m.forEach(e=>{e.rect=function(t,{x:e,y:i,r:n,color:s,text:r},o){const a=n;t.fillStyle=s,t.beginPath();const l=n+n,c=l,u=new je(e-n,i-a-c,l,c);t.fillRect(u.x,u.y,u.width,u.height);const h=(1.6*n).toFixed(0);return t.font="700 ".concat(h,'px "').concat(o,'"'),t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle",t.beginPath(),t.fillText(r,e,i-.9*c),u}(t,e,f),this.customEventPopup.visible&&e.date===this.customEventPopup.date&&(this.showCustomEventPopup(e),g=!1)}),t.restore(),this._eventsData=m,this.customEventPopup.visible&&g&&this.hideCustomEventPopup()}get customEventPopup(){return this.axis.pane.presenter.view.customEventPopup}hideCustomEventPopup(){this.customEventPopup.hide()}showCustomEventPopup(t){const{x:e,y:i,r:n,date:s,value:r}=t;this.customEventPopup.show({x:e+2*n,y:i-2*n},s,r)}getCustomEventDataAt(t){if(!this._eventsData)return null;const e=this._eventsData.find(e=>e.rect.contains(t));return(null==e?void 0:e.field)===Wn.Custom?e:null}hitTestCustomEvent(t){return null!==this.getCustomEventDataAt(t)}tryHandleCustomEventClick(t){const e=this.getCustomEventDataAt(t);return!!K(e)&&(this.showCustomEventPopup(e),!0)}draw(t){K(this.levels)&&this.drawLevels(t),K(this.bands)&&this.drawBands(t);for(let e of this.curves)e.draw(t)}drawTopmost(t,e){this.hasEventsData&&this.drawEvents(t,e)}}class ed extends td{get symbol(){return this._symbol}set symbol(t){this._symbol!==t&&(this._symbol=t,this.getTimeSeries(),this.getMetaData())}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){return K(this.timeSeries)&&K(this.timeSeries.record)?this.timeSeries.record.getValue(Wn.PreviousClose):null}getTimeSeries(){const t=im().getTimeSeriesDataSource();let e=this.makeQuery();e.symbol=this.symbol,this.mainCurve.isRenko&&(e.barsToFetch=10100,e.inputs=this.inputs);let i=t.getTimeSeries(e);this.timeSeries=this.wrapIfAdvancedStyle(i),this.timeSeries.ready().then(t=>{t&&(ya.a.publish(jn.TS_MANYCHANGED,{series:this.timeSeries,part:x.Unspecified}),this.getEvents())})}getMetaData(){const t=im().getMetaDataSource();this.metaData=t.getMetaData(this.symbol),this.metaData.ready().then(t=>{t&&ya.a.publish(jn.MD_CHANGED,{plot:this})})}getEvents(){if(!this.hasEvents)return;const t=im().getTimeSeriesDataSource(),e={symbol:this.symbol,seriesKind:b.Events,getHashKey:function(){return Object.values(this).filter(t=>"function"!=typeof t).join("|")}};te.EVENTS.forEach(t=>{e[t]=tt(this.events,!1,t,"show")}),this._eventsSeries=t.getTimeSeries(e),this._eventsSeries.ready().then(t=>{t&&ya.a.publish(jn.TS_EVENTSCHANGED,{series:this.eventsSeries})})}get eventsSeries(){return this._eventsSeries}get hasEvents(){return!!K(this.events)&&te.EVENTS.some(t=>tt(this.events,!1,t,"show"))}findEvents(t){return this.hasEventsData?this.eventsSeries.container.getTimeData().map((e,i)=>this.compare(e,t)?this.getEventsAt(i):[]).flat():[]}fromModel(t){super.fromModel(t),this._showPrevious=t.showPrevious,this.events=t.events,this.inputs=t.inputs||[],this.compare=function(t){switch(t.unit){case u.Tick:case u.Intraday:return Qi;case u.Day:return $i;case u.Week:return Xi;case u.Month:return Ki;case u.Quarter:return Zi;case u.Year:return Vi;default:return Qi}}(this.axis.pane.presenter.data.aggregation),this.symbol=t.symbol}getEventFor(t){const e=this.events[t.id.toLowerCase()];return K(e)&&e.show?e:null}}class id extends ed{constructor(t){super(),this.seriesKind=t}get showPrevious(){return!1}get title(){return"".concat(this.curves[0].fields[0].name,"(").concat(u[this.fundamental].substring(0,1),")")}fromModel(t){this.fundamental=u[t.fundamental],super.fromModel(t)}makeQuery(){let t=new jl(this.symbol,new Ji(this.fundamental),this.seriesKind);return t.fields=this.curves[0].fields,t}}function nd(t,e,i){let n={};n.source=Wn[t.source],n.inputs=rt(t.inputs);const s=void 0!==t.target,r=K(i)?i:t.curves;return n.outFields=s?[Wn[t.target]]:r.reduce((t,e)=>t.concat(e.fields),[]),n.target=s?Wn[t.target]:n.outFields[0],n.aggregation=e,n}class sd extends td{get params(){if(!K(this._params)){let t=this.model.inputs||[];const e=t.length;if(0===e)return"";let i="";e>3&&(t=t.slice(0,3),i=", ..."),this._params=0===t.length?"":"(".concat(t.map(t=>t.value).join(", ")).concat(i,")")}return this._params}get shiftFmt(){if(!K(this._shiftFmt)){const t=this.curves.map(t=>Number(t.shift)).filter(t=>0!==t);this._shiftFmt=0===t.length?"":"[".concat(t.join(", "),"]")}return this._shiftFmt}get title(){if(!K(this._title)){const t=this.params,e=this.shiftFmt;this._title="".concat(this.model.study," ").concat(t," ").concat(e).trim()}return this._title}fromModel(t){this.model=t,super.fromModel(this.model)}getMetaData(){const t=xi(this.model.study),e=t.meta.decimals;this.metaData=void 0!==e?new ve(e):this.basePlot.metaData,K(t.meta.range)&&(this.range=t.meta.range)}applySpecifics(t){const e=this.model.study,i=xi(e);if("ICHCLD"===e){const e=t.inputs.Displacement;this.curves[2].shift=-e,this.curves[3].shift=e,this.curves[4].shift=e,this.curves[5].shift=e}else if("MARIB"===e){const e=Math.min(Math.max(0,t.inputs.Count),10);this.curves.forEach((t,i)=>t.visible=i<e)}else!0===i.meta.shiftable&&this.curves.forEach(e=>{Number.isFinite(t.inputs.Offset)&&(e.shift=t.inputs.Offset)})}get hasEvents(){return this._hasEvents}get eventsSeries(){return this.timeSeries}doesSeriesEmitEvents(){const t=this.timeSeries.helpers;return t.includes(Wn.Buy)||t.includes(Wn.Sell)}getEventFor(t){switch(t){case Wn.Buy:return{title:"B",color:"#03c03c"};case Wn.Sell:return{title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[Wn.Buy,Wn.Sell]:[]}initialize(){if(this.model.basis===te.BASIS_MAIN){this.basePlot=this.axis.pane.presenter.mainPlot,this.getMetaData();const t=this.axis.pane.presenter.data.aggregation,e=nd(this.model,t,this.curves);this.applySpecifics(e),this.timeSeries=Sh(this.model.study,e,this.basePlot.timeSeries),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;const i=this.title,n=this.basePlot.timeSeries instanceof Pa;this.timeSeries.ready().then(t=>{t||n||this.timeSeries.computedServerSide||console.error("Unable to calculate study values for ".concat(i))})}}}class rd{constructor(t,e,i){this.id=La()(),this.axis=t,this.passive=!1,void 0!==e&&void 0!==i&&(this.price=e,this.time=i,this.toPoint()),this.moveDirection=w.Both}get movable(){return this.moveDirection!==w.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){const t=this.axis.toPoint(this);K(t)&&Q(t.x)&&Q(t.y)&&(this.point=t)}update(t,e){this.price=t,this.time=e,this.toPoint()}updateFromPoint(t){const e=this.axis.toAnnotationPoint(t);this.price=e.price,this.time=e.time,this.point=t}hitTest(t){return this.distance(t)<=te.HIT_TEST_TOLERANCE}distance(t){const e=t.x-this.point.x,i=t.y-this.point.y;return Math.abs(Math.sqrt(e*e+i*i)-te.HALF_ANN_POINT_DIMENSION)}draw(t){if(K(this.point)){const e=te.HALF_ANN_POINT_DIMENSION;t.beginPath(),t.ellipse(this.point.x,this.point.y,e,e,0,0,2*Math.PI),t.stroke()}}}class od extends td{get title(){return this.expression}get expression(){return this._expression}set expression(t){this.parseExpression(t),this.getMetaData(),this.getTimeSeries()}parseExpression(t){const{model:e,error:i,clean:n,text:s,symbols:r}=dn(t);i?(this.errorText=i,this.exprModel=null):this.exprModel=e,this._expression=this.isValid?n:s,this.symbols=this.isValid?r:null}get isValid(){return!K(this.errorText)}getTimeSeries(){const t=this.getInnerSeries();let e=new dh(this.exprModel,t);this.timeSeries=this.wrapIfAdvancedStyle(e);const i=this.title;this.timeSeries.ready().then(t=>{t||console.error("Unable to calculate expression: ".concat(i))})}getInnerSeries(){const t=gn(this.exprModel),e=im().getTimeSeriesDataSource();return t.map(t=>{let i=this.makeQuery();return i.symbol=t,e.getTimeSeries(i)})}getRecord(){if(K(this.errorText))return;const t=this.metaData.inner.map(t=>[t.symbol,t.resolved]);this.record=new es(t,et(this.exprModel)),this.record.ready().then(t=>t)}getMetaData(){this.isValid&&(this.metaData=new Te(this.symbols),this.metaData.ready().then(t=>{t&&(this.getRecord(),ya.a.publish(jn.MD_CHANGED,{plot:this}))}))}fromModel(t){super.fromModel(t),this.expression=t.expression}}class ad{constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){const t=im().config.touchCrosshairDelayMillis;return K(t)&&Number.isFinite(t)?t:te.LONG_PRESS_DELAY_MILLIS}startLongPress(t,e,i){$()&&(this.longPressTimeout=setTimeout(()=>this.longPressTriggered(t,e,i),this.getTouchCrosshairDelayMillis()))}longPressTriggered(t,e,i){this.cancelLongPress(),this.performLongPress(t,e,i)}cancelLongPress(){$()&&K(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(t,e,i){}}class ld extends ad{constructor(t,e,i){super(),this.annotation=t,this.previous=e,this.cursorSet=!1,this.moved=!1,this.snapToSupported=!1,this.startLongPress(null,i)}performLongPress(t,e){Bd(this.annotation,e)}onMouseMove(t){this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1);const{point:e,view:i,offset:n}=t;i.drawCrosshair({ap:e,offset:n}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(S.Move),this.cursorSet=!0);const s=Le(e.point,this.previous.point);this.annotation.offset(s),this.annotation.wasModifiedByTool(),this.annotation.requestRedraw(),this.previous=e,this.moved=!0}onMouseUp(t){this.cancelLongPress(),Mp(this.annotation,this.moved)}}class cd{constructor(t,e){this.annotation=t,this.pointIndex=t.points.indexOf(e),this.snapToSupported=!0}onMouseMove(t){this.alignPointsMode=t.getModifier(P.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1);const{point:e,view:i,offset:n}=t;if(i.drawCrosshair({ap:e,offset:n}),K(e)){const t=this.annotation.points[this.pointIndex],i=Le(e.point,t.point);switch(t.moveDirection){case w.Both:t.update(e.price,e.time);break;case w.Horizontal:t.update(t.price,e.time);break;case w.Vertical:t.update(e.price,t.time)}t.moveDirection!==w.None&&this.annotation.wasPointMovedByTool(t,i)}this.annotation.requestRedraw()}onMouseUp(t){Mp(this.annotation)}}class ud{constructor(t,e,i){this.anchor=t,this.isVertical=e,this.axis=i}hitTest(t){return!!K(this.anchor)&&(this.isVertical?Math.abs(t.x-this.anchor.x)<=te.HIT_TEST_TOLERANCE:Math.abs(t.y-this.anchor.y)<=te.HIT_TEST_TOLERANCE)}draw(t){const e=te.OUT_OF_SCREEN;this.isVertical?Ke(t,this.anchor.x,-e,e):Ze(t,this.anchor.y,-e,e)}}function hd(t){return 0===Be(t.fill.color).a?t.line.color:t.fill.color}class dd{constructor(t,e){this.points=[],this.isSelected=!1,this.drawn=!0,this.axis=t,this.name=e,this.id=La()(),this.alignPointsSupported=!1,this.visible=!0}requestRedraw(){this.axis.pane.presenter.view.redraw()}prepareDraw(t,e){return this.drawPoints(t,e),this.readyToDraw()}readyToDraw(){return this.activePoints.every(t=>void 0!==t.point)}getPriceScaleAdornments(){return te.EMPTY_ARRAY}getTimeScaleAdornments(){return te.EMPTY_ARRAY}extractTraits(t=!0){let e=et(this.traits);const i=yi(this.name);return Object.keys(e).forEach(n=>{const s=i.includes(n);(t&&!s||!t&&s)&&delete e[n]}),t||["line","fill","zIndex"].forEach(t=>delete e[t]),e}extractPoints(){return this.activePoints.map(t=>({price:t.price,time:Z(t.time,4)}))}offset(t){this.points.filter(t=>t.movable).forEach(e=>{e.updateFromPoint(Ie(e.point,t))})}get traits(){return this._traits||(this._traits=et(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=hd(this._traits),this.adjustFill=!1),this._traits}set traits(t){void 0!==t&&lt(this.traits,t)}get activePoints(){return this.points.filter(t=>!t.passive)}get style(){return ui(this.traits)}get defaultTraits(){return li(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return ui(this.defaultTraits)}get adornStyle(){const t=et(this.defaultTraits);return t.fill.color=this.traits.line.color,t.line.width=0,t.line.color=te.COLOR_TRANSPARENT,ui(t)}get pointsStyle(){const t=et(this.defaultTraits);return t.line.dashStyle="Solid",ui(t)}wasModifiedByTool(){}wasPointMovedByTool(t,e){}drawPoints(t,e){this.points.forEach(i=>{void 0!==i.price&&(e&&i.toPoint(),K(t)&&(this.isSelected||this.drawn)&&(ci(t,this.pointsStyle),i.draw(t)))})}addPoints(t){for(let e=0;e<t;e++)this.points.push(new rd(this.axis))}toModel(){const t=this.extractPoints();return{id:this.name,visible:this.visible,points:t,traits:et(this.traits)}}canMove(t){return!0}updatePoints(t){}updateFrom(t,e,i,n){"boolean"==typeof n&&(this.visible=n);let s=K(t)?et(t):{};K(e)&&lt(s,e),this.traits=s,K(i)&&this.updatePoints(i)}}function pd(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function fd(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class md extends dd{constructor(t,e){super(t,e)}draw(t,e){if(this.prepareDraw(t,e)&&!this.drawn){const e=this.getElements();ci(t,this.style),e.forEach((e,i)=>{ci(t,this.getStyleForElement(e,i)),e.draw(t)}),ci(t,this.adornStyle),this.adornElements(e,t);const i=this.getMarkers();ci(t,this.style),i.forEach(e=>{e.draw(t)})}}getStyleForElement(t,e){return this.style}getAdornOffset(t,e=!1){const i=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?pd(Object(i),!0).forEach((function(e){fd(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):pd(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},te.DEFAULT_ADORN_OFFSET);return e&&(i.y=-(ze(t,1)+i.y)),i}adornElements(t,e){}hitTest(t){if(!this.drawn&&this.visible){const e=this.getElements(),i=this.getMarkers();return e.some(e=>e.hitTest(t))||i.some(e=>e.hitTest(t))}return!1}updatePointsFrom(t,e=0){t.forEach((t,i)=>this.points[e+i].update(t.price,t.time))}updatePoints(t){this.allowPricesChangeUI&&this.updatePointsFrom(t)}getMarkers(){return[]}get marker(){return this.traits[te.AT_MARKER]}get showPrices(){return this.traits[te.AT_SHOW_PRICES]}get showTimestamps(){return this.traits[te.AT_SHOW_TIMESTAMPS]}get showBarCount(){return this.traits[te.AT_SHOW_BARCOUNT]}get allowPricesChangeUI(){return yi(this.name).includes(te.AT_ALLOW_PRICES_CHANGE_UI)}}class gd extends rd{constructor(t,e,i){super(t),this.passive=!0,this.priceRef=e,this.timeRef=i}get price(){return this.priceRef.price}get time(){return this.timeRef.time}set price(t){this.priceRef.price=t}set time(t){this.timeRef.time=t}}class yd{constructor(t){this.points=t}get left(){return Math.min(this.points[0].point.x,this.points[1].point.x)}get top(){return Math.min(this.points[0].point.y,this.points[1].point.y)}get width(){return Math.abs(this.points[1].point.x-this.points[0].point.x)}get height(){return Math.abs(this.points[1].point.y-this.points[0].point.y)}getRect(){return K(this.points[0].point,this.points[1].point)?new je(this.left,this.top,this.width,this.height):null}}function vd(t){const e=new rd(t),i=new rd(t);return[e,i,new gd(t,e,i),new gd(t,i,e)]}class bd extends dd{constructor(t,e){super(t,e),this.points=vd(t),this.helper=new yd(this.points)}get left(){return this.helper.left}get top(){return this.helper.top}get width(){return this.helper.width}get height(){return this.helper.height}getRect(){return this.helper.getRect()}draw(t,e){return!!this.prepareDraw(t,e)&&(ci(t,this.style),!0)}}class Td{constructor(t,e,i,n){this.points=t,this.lines=e,this.axis=n,this.fixupBottomRight=i,this.helper=new yd(this.points),this.restoreScale=!1}hitTest(t){const e=this.getRect();return!!K(e)&&e.contains(t)}getRect(){return this.helper.getRect()}get fontSize(){if(0===this.lines.length)return 0;const{height:t}=this.getRect();return Math.floor(t/this.lines.length)}get defaultFontSize(){const{chart:{fontSize:t}}=this.axis.pane.presenter.display;return t||13}draw(t){if(0===this.lines.length)return;t.save();const{x:e,y:i}=this.helper.getRect(),{chart:{fontFamily:n}}=this.axis.pane.presenter.display;if(this.fixupBottomRight){let s=this.defaultFontSize;this.restoreScale&&this.lines.length>0&&(s=this.fontSize,t.font="".concat(s,"px ").concat(n));const r=Math.max(...this.lines.map(e=>t.measureText(e).width));this.points[1].updateFromPoint({x:e+r,y:i+this.lines.length*s}),this.fixupBottomRight=!1,this.restoreScale=!1}const s=this.fontSize;t.textAlign="left",t.textBaseline="top",t.font="".concat(s,"px ").concat(n),this.lines.forEach((n,r)=>{const o=i+s*r;t.fillText(n,e,o)}),t.restore()}}class Sd extends md{constructor(t,e){super(t,e),this.textEditable=!0,this.points=vd(t),this.adjustFill=!0,this.fixupBottomRight=!1}get textLines(){return this.traits[te.AT_TEXT_LINES]}set textLines(t){this.traits[te.AT_TEXT_LINES]=t,this._textAnnElement=null}get textElement(){return K(this._textAnnElement)||(this._textAnnElement=new Td(this.points,this.textLines,this.fixupBottomRight,this.axis)),this._textAnnElement}getElements(){return[this.textElement]}}class Ad extends Sd{constructor(t,e,i){super(t,e),this.textEditable=!1,K(i)&&(this.handleExtraPoints(i.points,!0),lt(this.traits,i),delete this.traits.points,this.fixupBottomRight=!0)}prepareDraw(t,e){return this.points.slice(4).forEach(t=>t.moveDirection=w.None),super.prepareDraw(t,e)}canMove(t){return!!this.visible&&this.textElement.hitTest(t)}updatePoints(t){this.handleExtraPoints(t.slice(2),!1)}handleExtraPoints(t,e){K(t)&&(e&&this.addPoints(t.length),this.updatePointsFrom(t,4))}get drawLines(){return this.traits[te.AT_DRAW_LINES]}updateFrom(t,e,i,n){super.updateFrom(t,e,i,n),K(e)&&K(e.textLines)&&(this.textLines=e.textLines,this.textElement.restoreScale=!0)}getElements(){const t=super.getElements();if(!this.drawLines)return t;const e=this.points.slice(4).map(t=>new ud(t.point,!1,this.axis));return t.concat(e)}getPriceScaleAdornments(){if(!this.drawLines)return super.getPriceScaleAdornments();const t=this.traits.line;return this.points.slice(4).map(e=>({price:e.price,color:t.color}))}}class Pd{constructor(t,e){this.factory=t,this.existing=e,this.isNew=!K(e),this.isNew||(this.anchor=this.existing.points[0]),this.clicks=0,this.snapToSupported=!1,this.isDrawingAnnotation=this.isNew}getChartParent(){return this.anchor.axis.pane.presenter.view.canvasContainer}styleProps(){if(this.isNew){return{height:100,fontSize:"100%",color:hd(li(this.anchor.axis.pane.presenter.display,"Text"))}}{const t=this.existing.textElement;return{height:1.05*t.getRect().height,fontSize:"".concat(Math.round(t.fontSize),"px"),color:this.existing.traits[te.AT_FILL].color}}}onMouseDown(t){const{point:e}=t;if(this.isNew)if(0===this.clicks){if(void 0===e)return void Op(t);e.axis.pane.presenter.clearSelection(),this.anchor=e,this.clicks++,this.startEditing()}else this.onEndEditing();else this.onEndEditing()}startEditing(){this.textArea=document.createElement("textarea");const{x:t,y:e}=this.anchor.point,i=this.anchor.axis.pane.getBounds(),n=i.x+i.width-this.anchor.point.x,{height:s,fontSize:r,color:o}=this.styleProps();Gt(this.textArea,{position:"absolute",top:"".concat(e,"px"),left:"".concat(t,"px"),border:"none",outline:"none",overflow:"hidden",height:"".concat(s,"px"),width:"".concat(n,"px"),resize:"none",backgroundColor:"rgba(255, 255, 255, 0.05)",zIndex:5,fontSize:r,color:o}),this.getChartParent().appendChild(this.textArea),this.textArea.onblur=this.onEndEditing.bind(this),this.isNew||(this.textArea.value=this.existing.textLines.join("\n"),this.existing.textLines="",this.existing.requestRedraw()),setTimeout(()=>this.textArea.focus(),100)}onEndEditing(){const t=this.anchor,e=this.isNew?this.factory(t.axis):this.existing,i=this.textArea.value.split("\n");if(this.isNew){const{actualWidth:n,actualHeight:s}=this.getTextDimensions(i);e.points[0].update(t.price,t.time);const{x:r,y:o}=e.points[0].point;e.points[1].updateFromPoint({x:r+n,y:o+s}),e.drawn=!1}e.textLines=i,this.textArea.onblur=null,this.getChartParent().removeChild(this.textArea),e.requestRedraw(),this.isNew||e.requestRedraw(),Mp(e,!0)}getTextDimensions(t){const e=globalThis.getComputedStyle(this.textArea).getPropertyValue("font-size"),i=parseFloat(e)*t.length;let n=0;const s=this.anchor.axis.pane.presenter,r=s.view.mainContext;r.save();const{chart:{fontFamily:o}}=s.display;r.font="".concat(e," ").concat(o);for(let e=0;e<t.length;e++){const i=r.measureText(t[e]).width;i>n&&(n=i)}return r.restore(),{actualWidth:n,actualHeight:i}}}function wd(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Cd(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?wd(Object(i),!0).forEach((function(e){xd(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):wd(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function xd(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Md(t){return im().config.tooltipMovement===t}function Ed(){return Md(E[E.Draggable])}function Od(){return Md(E[E.Auto])}const Dd=te.TOOLTIP_STD_LEGACY_CLASS,Ld=te.TOOLTIP_STD_CLASS,Id=te.TOOLTIP_BUBBLE_CLASS;class _d{constructor(t){this.view=t,this.tooltipElem=$t(t.el,"div"),zt(this.tooltipElem,{id:"".concat(t.presenter.elementId,"-global-tooltip"),class:"".concat(Ld," ").concat(Dd)}),this.leftSide=!0,Gt(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:Ed()?"move":"default",zIndex:20,top:"".concat(te.TOOLTIP_Y_OFFSET,"px"),left:"".concat(te.TOOLTIP_X_OFFSET,"px")}),this.setMode(t.presenter.display.tooltip.mode),this.isDrag=!1,this.startDrag=()=>{this.isDrag=!0},this.stopDrag=()=>{this.isDrag=!1},this.handleMouseMove=this.handleMouseMove.bind(this),this.view.el.addEventListener("mousemove",this.handleMouseMove),this.view.el.addEventListener("mouseleave",this.stopDrag),this.tooltipElem.addEventListener("mousedown",this.startDrag),this.tooltipElem.addEventListener("mouseup",this.stopDrag)}setMode(t){if(this.mode!==t)if(this.mode=t,t===te.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition=null,this.tooltipElem.classList.remove(Ld,Dd),this.tooltipElem.classList.add(Id),Gt(this.tooltipElem,{pointerEvents:"none"});else{this.canDrag=Ed(),this.tooltipElem.classList.remove(Id),this.tooltipElem.classList.add(Ld,Dd);const t=te.TOOLTIP_TOGGLE_SIDE_ANIM_MS;Gt(this.tooltipElem,{pointerEvents:"all",top:"".concat(te.TOOLTIP_Y_OFFSET,"px"),left:"".concat(te.TOOLTIP_X_OFFSET,"px"),transition:Od()?"left ".concat(t,"ms ease-out"):null})}}show(t,e){const i=this.tooltipElem;if(e){const{width:t,height:n,leftOffset:s,rightOffset:r}=this.view,o=i.getBoundingClientRect(),a=o.width/2,l=i.style,c=te.TOOLTIP_BUBBLE_OFFSET,u=e.yMin-o.height-c,h=e.x-a,d=e.yMax+c,p=d+o.height,f=u<0?p<n?d:0:u;let m=h;const g=t-r;m<s?m=s:m+o.width>g&&(m=g-o.width),l.top="".concat(f,"px"),l.left="".concat(m,"px")}"hidden"===i.style.visibility&&(i.style.visibility="visible"),Kt(i,t)}hide(){this.tooltipElem.style.visibility="hidden"}remove(){this.view.el.removeEventListener("mousemove",this.handleMouseMove),this.view.el.removeEventListener("mouseleave",this.stopDrag),this.tooltipElem.removeEventListener("mousedown",this.startDrag),this.tooltipElem.removeEventListener("mouseup",this.stopDrag),function(t,e=document){let i=t;"string"==typeof t&&(i=jt(t,e)),i&&i.parentNode.removeChild(i)}(this.tooltipElem)}reposition(t,e){Gt(this.tooltipElem,{left:"".concat(t,"px"),top:"".concat(e,"px")})}handleMouseMove(t){if(this.isDrag&&this.canDrag){const{movementX:e,movementY:i}=t,{top:n,left:s}=this.tooltipElem.style,r=parseInt(n)+i,o=parseInt(s)+e;this.reposition(o,r)}else if(Od()){const e=this.tooltipElem.getBoundingClientRect(),i=this.view.el.getBoundingClientRect(),n=t.pageX,s=te.TOOLTIP_TOGGLE_DISTANCE_TOLERANCE,r=i.width>2*e.width,o=n>e.x&&n<=e.right+s,a=n<e.x&&n>=e.x-s;r&&(o||a)&&this.toggleSide()}}repositionAuto(){if(Od()){const t=this.view.presenter.mainPane.getBoundsWithoutScales(),e=this.tooltipElem.offsetY,i=this.leftSide?te.TOOLTIP_X_OFFSET:t.x+t.width-this.tooltipElem.offsetWidth-te.TOOLTIP_X_OFFSET;this.reposition(i,e)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout(()=>this.isToggling=!1,te.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function Nd(t,e,i,n,s,r){Gt(t,{position:"absolute",display:"flex","flex-direction":e,"flex-wrap":"wrap",left:"".concat(i+te.CARDS_X_OFFSET,"px"),top:"".concat(s+te.CARDS_Y_OFFSET,"px"),maxWidth:"".concat(r-n-2*te.CARDS_X_OFFSET,"px")})}function Rd(t,e,i=!1,n=!1,s=!1,r=!1){const o=t.view.el;pl(t,e,i,n,s).forEach(({id:e,isMainPane:i,content:n,moveContent:s,bounds:{left:a,right:l,top:c,width:u}},h)=>{if(!(""===n||r&&i)){const s=Yt(e,o,"div");Nd(s,i&&hl(t)?"column":"row",a,l,c,u),qt(s,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===h}),s.innerHTML=n}let d=jt("#right-".concat(e),o);K(d)||(d=document.createElement("div"),d.id="right-".concat(e),o.appendChild(d),qt(d,"bcharts-card bcharts-card-move")),Gt(d,{position:"absolute",display:"block",right:"".concat(l+te.CARDS_X_OFFSET,"px"),top:"".concat(c+te.CARDS_Y_OFFSET,"px")}),d.innerHTML=s})}let kd=null;function Hd(){return null===kd&&(kd=im().config.hostingModel===O[O.Application]),kd}class Fd extends ad{constructor(t){super(),this.ap=t,this.presenter=t.presenter,this.panY=t.axis.isCustomDomain,this.snapToSupported=!1,this.panningXAxisAllowed=tt(this.presenter.display,!0,"xAxis","panning"),this.warmUp=!0,this.preventDefault=!1}activated(){}deactivated(){this.cancelLongPress()}startPan(t){this.startLongPress(this.presenter,this.ap,t),this.lastOffset=t,this.lastPanningExtremes=this.ap.axis.yScale.domain();const e=this.ap.presenter;e.enableTooltip(!1),e.view.tooltip.hide(),e.view.drawCrosshair({ap:void 0})}onMouseMove(t){if(t.pinchZoom)return void this.presenter.resetActiveTool();const{point:e,view:i,offset:n}=t;if(e&&e.axis!==this.ap.axis)return;const{x:s,y:r}=n,o=s-this.lastOffset.x,a=Math.abs(o),l=this.lastOffset.y,c=r-l,u=Math.abs(c);a>=1&&this.cancelLongPress();const h=Hd();if($()&&!h&&this.warmUp)return(a>7||u>7)&&(this.warmUp=!1,this.preventDefault=a>u),!1;if(this.preventDefault||!$()||h){if(this.panningXAxisAllowed&&(i.xAxis.pan(o),i.setPriceAxesDomains()),this.panY&&e&&e.axis){u>=1&&this.cancelLongPress();const t=function(t,e,i,n){const s=(i-e)/t.viewBox.height,[r,o]=n,a=s*(o-r);return[r+a,o+a]}(e.axis,l,r,this.lastPanningExtremes);this.lastPanningExtremes=t,e.axis.yScale.domain(t)}this.lastOffset=n,i.redraw(),e&&e.presenter.view.setCursor(S.Grabbing)}return h||this.preventDefault}finished(){xp(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:t,offset:e}){$()&&Vd(t,e)}performLongPress(t,e,i){t.enableTooltip(!0),t.resetActiveTool(),t.activeTool.startTouchCrosshairMode(t,e,i)}}let Ud=null;function Bd(t,e){const i=t.axis.pane.presenter;i.clearSelection(),ya.a.publish(jn.CH_ANNNEEDSCONTEXTMENU,{uid:t.id,id:t.name,offset:{x:e.x,y:e.y},traits:t.extractTraits(!0),extras:t.extractTraits(!1),points:t.extractPoints(),chart:i.accessor})}function Vd(t,e,i){ya.a.publish(jn.CH_CHTNEEDSCONTEXTMENU,{offset:{x:e.x,y:e.y},chart:t.accessor,originalEvent:i})}class Wd{constructor(t,e=!1){this.factory=t,this.thirdPoint=e,this.dragged=!1,this.snapToSupported=!0,this.isDrawingAnnotation=!0,this.forceAlignPoints=!1,this.indices=[0,1,e?2:null].filter(t=>null!==t)}onMouseDown(t){const{point:e,button:i}=t;if(void 0!==e)return i===A.Left&&(void 0!==this.annotation&&!this.dragged&&this.thirdPoint?(this.annotation.points[2].update(e.price,e.time),this.annotation.requestRedraw(),this.finish()):(this.dragged=!0,e.axis.pane.presenter.clearSelection(),this.annotation=this.factory(e.axis),this.annotation.drawn=!1,this.indices.forEach(t=>this.annotation.points[t].update(e.price,e.time)),this.annotation.requestRedraw())),!0}onMouseMove(t){const{point:e,view:i,offset:n}=t;return i.drawCrosshair({ap:e,offset:n}),K(this.annotation)&&(this.alignPointsMode=this.forceAlignPoints||t.getModifier(P.Shift),this.dragged?(this.annotation.points[1].update(e.price,e.time),this.annotation.requestRedraw()):this.thirdPoint&&!this.dragged&&(this.annotation.points[2].update(e.price,e.time),this.annotation.requestRedraw())),!0}finish(){Mp(this.annotation)}onMouseUp(t){void 0!==this.annotation?(this.dragged=!1,this.thirdPoint||this.finish()):Op(t)}}class jd extends Wd{constructor(t,e=!1){super(t,e),this.forceAlignPoints=!0}}class Gd{constructor(t,e){this.factory=t,this.maxClicks=e,this.clicks=0,this.snapToSupported=!0,this.isDrawingAnnotation=!0}onMouseMove(t){const{point:e,view:i,offset:n}=t;i.drawCrosshair({ap:e,offset:n})}onMouseDown(t){const{point:e}=t;if(0===this.clicks){if(void 0===e)return Op(t),!1;e.axis.pane.presenter.clearSelection(),this.annotation=this.factory(e.axis)}this.applyToPoints(e),this.clicks++,this.clicks===this.maxClicks&&void 0!==this.annotation?(this.annotation.drawn=!1,this.annotation.requestRedraw(),"function"==typeof this.annotation.updateOtherPoints&&this.annotation.updateOtherPoints(),Mp(this.annotation)):this.annotation.requestRedraw()}applyToPoints(t){this.annotation.points[this.clicks].update(t.price,t.time)}}class zd extends Gd{constructor(t){super(t,1)}applyToPoints(t){this.annotation.points[0].update(t.price,t.time),this.annotation.points[1].update(t.price,t.time)}}class Yd{constructor(t,e){setTimeout(()=>this.finalize(t,e),10),this.snapToSupported=!1}finalize(t,e){const i=t(e);e.pane.presenter.clearSelection(),i.drawn=!1,i.requestRedraw(),Mp(i)}}class qd{constructor(t,e,i,n,s){this.axis=s,K(t,e)&&(this.angle=_e(t,e),this.extent=this.getExtent(t,e),this.p1=i?this.extendPoint(e,-1):t,this.p2=n?this.extendPoint(t,1):e),this.style=null,this.extended=i||n}extendPoint(t,e){return{x:t.x+e*this.extent*Math.cos(this.angle),y:t.y+e*this.extent*Math.sin(this.angle)}}getExtent(t,e){const i=Math.max(Math.abs(t.x),Math.abs(e.x)),n=Math.max(Math.abs(t.y),Math.abs(e.y));return Math.sqrt(i*i+n*n)+te.OUT_OF_SCREEN}hitTest(t){return!!K(this.p1,this.p2)&&Ne([this.p1,this.p2],t,te.HIT_TEST_TOLERANCE)}draw(t){K(this.p1,this.p2)&&(Xe(t,this.p1,this.p2),this.extended)}}const $d=te.MARKER_ARROW_ANGLE*Math.PI/180/2;class Xd{constructor(t,e){this.p1=t[0].point,this.p2=t[1].point,this.vertex=e}hitTest(t){const{anchor:e,p1:i,p2:n}=this.getArrowPoints();return Ne([e,i],t,te.HIT_TEST_TOLERANCE)||Ne([e,n],t,te.HIT_TEST_TOLERANCE)}draw(t){const{anchor:e,p1:i,p2:n}=this.getArrowPoints();Xe(t,e,i),Xe(t,e,n)}getArrowPoints(){const t=_e(this.p1,this.p2),e="start"===this.vertex?0:Math.PI,i=t-$d+e,n=t+$d+e,s="start"===this.vertex?this.p1:this.p2;return{anchor:s,p1:{x:te.MARKER_ARROW_LENGTH*Math.cos(i)+s.x,y:te.MARKER_ARROW_LENGTH*Math.sin(i)+s.y},p2:{x:te.MARKER_ARROW_LENGTH*Math.cos(n)+s.x,y:te.MARKER_ARROW_LENGTH*Math.sin(n)+s.y}}}}class Kd{hitTest(){}draw(){}}class Zd extends md{constructor(t,e){super(t,e),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[te.AT_EXTEND_PT_1]}get extend2(){return this.traits[te.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[te.AT_SHOW_PERCENTDIFF]}getElements(){const t=this.points[0].point,e=this.points[1].point,i=new qd(t,e,this.extend1,this.extend2,this.axis),n=[];return this.extend1&&n.push(new qd(i.p1,t,!0,!1,this.axis)),n.push(new qd(t,e,!1,!1,this.axis)),this.extend2&&n.push(new qd(e,i.p2,!1,!0,this.axis)),n}getBarCount(t,e){if(void 0===this.countCache||this.countCache.time1!==t||this.countCache.time2!==e){const i=this.axis.pane.presenter.view,n=(Math.abs(i.toIndex(t)-i.toIndex(e))+1).toFixed(0);this.countCache={time1:t,time2:e,barCount:n}}return this.countCache.barCount}formatPercDiff(t,e){const i=(e-t)/t*100;return" (".concat(i>0?"+":"").concat(Z(i,2),"%)")}adornElements(t,e){if(!this.showBarCount&&!this.showPrices)return;const[i,n]=this.points,s=ze(e,1),r=function(t,e){return-(t.y-e.y)/(t.x-e.x)}(i.point,n.point);let o=this.getAdornOffset(e);if(r<0&&(o.y=s+5),this.showBarCount){const t=Ie(Oe(i.point,n.point),o);Ye(e,this.getBarCount(i.time,n.time).toString(),t,T.Right)}if(this.showPrices){Ye(e,il(this.axis,i.price),Ie(i.point,o),T.Right);const t=this.showPercentDiff?this.formatPercDiff(i.price,n.price):"";Ye(e,"".concat(il(this.axis,n.price)).concat(t),Ie(n.point,o),T.Right)}}getMarkers(){const t=this.marker;if(!t||"none"===t.vertex)return[];const{vertex:e,kind:i}=t;return("both"===e?["start","end"]:[e]).map(t=>"arrow"===i?new Xd(this.points,t):(console.warn("There is no markers of ".concat(i," kind")),new Kd))}}class Qd extends md{constructor(t,e){super(t,e),this.addPoints(1)}getElements(){return[new ud(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class Jd extends md{constructor(t,e){super(t,e),this.addPoints(1)}getElements(){return[new ud(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class tp extends md{constructor(t,e,i){super(t,e),this.addPoints(2),K(i)&&K(i.points)&&i.points.forEach((t,e)=>this.points[e].update(t.price,t.time))}allPoints(){const[t,e]=this.points;return K(t,t.point,e,e.point)?[t,this.axis.toAnnotationPoint(Oe(t.point,e.point)),e]:te.EMPTY_ARRAY}fiftyPercTraits(){return this.traits[te.AT_LINE_2]}getElements(){const t=this.allPoints();if(t===te.EMPTY_ARRAY)return te.EMPTY_ARRAY;return t.map(t=>new qd({x:-te.OUT_OF_SCREEN,y:t.point.y},{x:te.OUT_OF_SCREEN,y:t.point.y},!1,!1,this.axis))}getStyleForElement(t,e){const i=this.fiftyPercTraits();if(1!==e||!K(i))return super.getStyleForElement(t,e);let n=et(this.traits);return n.line=i,ui(n)}getPriceScaleAdornments(){const t=this.allPoints();if(!this.showPrices||t===te.EMPTY_ARRAY)return super.getPriceScaleAdornments();const e=this.traits.line,i=t.map(t=>({price:t.price,color:e.color})),n=this.fiftyPercTraits();return K(n)&&(i[1].color=n.color),i}}class ep extends md{constructor(t,e,i){super(t,e),this.addPoints(i)}get showTrendLine(){return this.traits[te.AT_SHOW_TRENDLINE]}get factors(){return this.traits[te.AT_FACTORS].filter(t=>t.shown).map(t=>t.value)}get pricesOnScale(){return this.traits[te.AT_PRICES_ON_SCALE]}get hasAllPoints(){return K(...this.points.map(t=>t.point))}get line2(){return this.traits[te.AT_LINE_2]}getStyleForElement(t,e){if(t.isTrend){let t=et(this.traits);return t.line=this.line2,ui(t)}return super.getStyleForElement(t,e)}get isExtended(){return 3===this.points.length}getElements(){let t=[],e=this.points[0].point,i=this.points[1].point;if(!this.hasAllPoints)return t;const n=this.isExtended?this.points[2].point:null,s=this.isExtended?n.y:i.y,r=this.isExtended?i.y-e.y:e.y-i.y,o=(e,i,n=!0,s=!1)=>{const r=new qd(e,i,!1,n,this.axis);r.isTrend=s,t.push(r)};return this.factors.forEach(t=>{const e=s+r*t;o({x:i.x,y:e},{x:i.x+1,y:e})}),this.showTrendLine&&(o(e,i,!1,!0),this.isExtended&&o(i,n,!1,!0)),t}adornElements(t,e){this.factors.forEach((i,n)=>{const s=t[n++].p1;let r=s.y-2;const o="".concat((100*i).toFixed(1),"%");if(Ye(e,o,{x:s.x+3,y:r}),this.showPrices&&!this.pricesOnScale){const t=e.measureText(o).width;Ye(e,il(this.axis,this.axis.toPrice(s.y)),{x:s.x+t+6,y:r})}})}getPriceScaleAdornments(){if(!this.showPrices||!this.pricesOnScale)return super.getPriceScaleAdornments();const t=this.getElements();if(0===t.length)return super.getPriceScaleAdornments();const e=this.traits.line.color;return this.factors.map((i,n)=>{const s=t[n++].p1;return{price:this.axis.toPrice(s.y),color:e}})}}class ip extends ep{constructor(t,e){super(t,e,2)}}class np extends ep{constructor(t,e){super(t,e,3)}}class sp extends md{constructor(t,e){super(t,e),this.addPoints(2)}getElements(){var t=[],e=this.points[0].point,i=this.points[1].point;t.push(new qd(e,i,!1,!1,this.axis));var n=i.y-e.y;return this.factors.forEach(s=>{var r=e.y+s*n;t.push(new qd({x:e.x,y:e.y},{x:i.x,y:r},!1,!0,this.axis))}),t}}class rp extends sp{constructor(t,e){super(t,e),this.factors=[.382,.5,.618]}}class op{constructor(t,e,i){this.center=t,this.rim=e,this.axis=i,this.radius=De(t,e),this.left={x:this.center.x-this.radius,y:this.center.y},this.right={x:this.center.x+this.radius,y:this.center.y}}hitTest(t){let e=999;if(this.center.y<this.rim.y&&t.y<=this.center.y||this.center.y>this.rim.y&&t.y>=this.center.y)e=Math.min(De(this.left,t),De(this.right,t));else{const i=Le(t,this.center);e=Math.abs(Math.sqrt(i.x*i.x+i.y*i.y)-this.radius)}return e<=te.HIT_TEST_TOLERANCE}draw(t){$e(t,this.center,this.radius,0,Math.PI,this.rim.y<=this.center.y)}}class ap extends md{constructor(t,e){super(t,e),this.addPoints(2)}getElements(){var t=[];if(!K(this.points[0].point,this.points[1].point))return t;var e=this.points[0].point,i=this.points[1].point;t.push(new qd(e,i,!1,!1,this.axis));var n=De(e,i),s=Le(i,e),r=s.y/n,o=s.x/n;return this.factors.forEach(s=>{var a=n*s,l=r*a,c=o*a,u={x:i.x-c,y:i.y-l};t.push(new op(e,u,this.axis))}),t}}class lp extends ap{constructor(t,e){super(t,e),this.factors=[.382,.5,.618]}}class cp extends md{constructor(t,e){super(t,e),this.factors=[8,4,3,2],this.addPoints(2)}getElements(){var t=[],e=this.points[0].point,i=this.points[1].point,{x:n,y:s}=Le(i,e);return this.factors.forEach(s=>{t.push(new qd(e,{x:e.x+n/s,y:i.y},!1,!0,this.axis))}),t.push(new qd(e,i,!1,!0,this.axis)),this.factors.slice().reverse().forEach(n=>{t.push(new qd(e,{x:i.x,y:e.y+s/n},!1,!0,this.axis))}),t}}class up extends sp{constructor(t,e){super(t,e),this.factors=[1/3,2/3]}}class hp extends ap{constructor(t,e){super(t,e),this.factors=[1/3,2/3]}}class dp extends md{constructor(t,e){super(t,e),this.addPoints(3)}getElements(){const t=this.points[0].point,e=this.points[1].point,i=this.points[2].point,n=(e.x+i.x)/2-t.x,s=(e.y+i.y)/2-t.y,r=[];return r.push(new qd(e,{x:e.x+n,y:e.y+s},!1,!0,this.axis)),r.push(new qd(t,{x:t.x+n,y:t.y+s},!1,!0,this.axis)),r.push(new qd(i,{x:i.x+n,y:i.y+s},!1,!0,this.axis)),r.push(new qd(e,i,!1,!1,this.axis)),r}}class pp extends bd{constructor(t,e){super(t,e)}hitTest(t){return!!this.visible&&this.getRect().contains(t)}draw(t,e){if(!super.draw(t,e))return!1;qe(t,this.getRect())}}class fp extends bd{constructor(t,e){super(t,e)}getEllipse(){var t=this.getRect();return new Ge(t.centerX,t.centerY,t.width/2,t.height/2)}hitTest(t){return!!this.visible&&this.getEllipse().contains(t)}draw(t,e){if(!super.draw(t,e))return!1;var i,n;i=t,n=this.getEllipse(),i.beginPath(),i.ellipse(n.cx,n.cy,n.radiusX,n.radiusY,0,0,2*Math.PI),i.stroke(),i.fill()}}class mp extends md{constructor(t,e){super(t,e),this.addPoints(3)}getLastPoint(){var t=De(this.points[0].point,this.points[1].point),e=_e(this.points[0].point,this.points[1].point);return{x:this.points[2].point.x+t*Math.cos(e),y:this.points[2].point.y+t*Math.sin(e)}}getElements(){var t=[];if(t.push(new qd(this.points[0].point,this.points[1].point,!1,!1,this.axis)),K(this.points[2].price)){var e=this.getLastPoint();t.push(new qd(this.points[2].point,e,!1,!1,this.axis))}return t}}class gp extends bd{constructor(t,e,i){super(t,e),this.kind=i,this.adjustFill=!0}hitTest(t){return!!this.visible&&this.getRect().contains(t)}get dimension(){const t="fish_hook"===this.kind?2:1;return te.DEFAULT_SYMBOL_WIDTH_HEIGHT*t}updateOtherPoints(){this.points[1].price||this.setBottomRight()}setBottomRight(){const t=this.dimension;let e=this.points[0].point;if(K(e)){const i=Ie(e,{x:t,y:t});this.points[1].updateFromPoint(i)}}draw(t,e){if(!super.draw(t,e))return!1;const i=this.getRect();return 0===i.width&&(i.width=this.dimension),Qe(t,this.kind,i),!0}}class yp extends md{constructor(t,e){super(t,e),this.addPoints(1),this.helper=new rd(t)}recalculatePoints(){const t=this.axis.pane.presenter.mainPlot.timeSeries.container.getTimeData(),{price:e,time:i}=this.points[0],n=G(t,i);this.elements=[],-1!==n&&(this.elements=te.PARTIAL_FIBONACCI_SEQUENCE.filter(e=>n+e<t.length).map(i=>(this.helper.update(e,t[n+i]),new ud(this.helper.point,!0,this.axis))))}getElements(){return this.recalculatePoints(),this.elements}adornElements(t,e){const i=te.PARTIAL_FIBONACCI_SEQUENCE;for(var n=3;n<t.length;n++){let s=t[n];Ye(e,i[n].toString(),Ie(s.anchor,{x:3,y:-2}))}}getTimeScaleAdornments(){return[{time:this.points[0].time,color:this.traits.line.color}]}}class vp{constructor(t){this.snapToSupported=!0,this.isDrawingAnnotation=!0}onMouseMove(t){const{point:e,view:i,offset:n}=t;i.drawCrosshair({ap:e,offset:n})}onMouseDown(t){const{point:e}=t,i=e.axis.pane.presenter;ya.a.publish(jn.CH_ANNPOINTPICKED,{chart:i.accessor,axis:e.axis,point:{time:e.time.getTime(),price:e.price}}),xp(i,null)}}class bp{constructor(t,e,i,n){this.axis=n,this.rect=new je(t.x,t.y,e,i),this.style=null}hitTest(t){return this.rect.contains(t)}draw(t,e){qe(t,this.rect)}}const Tp="Open",Sp="Closed";class Ap extends md{constructor(t,e,i){super(t,e),this.addPoints(4),this.isLong=i;const n=(t,e)=>this.points[t].moveDirection=e;n(1,w.Vertical),n(2,w.Vertical),n(3,w.Horizontal),this.twoDecMeta=new ve(2)}data(t){return this.presenter.mainPlot.timeSeries.container.getData(t)}get presenter(){return this.axis.pane.presenter}getDataWindow(t,e,i=!0,n=!0){const s=this.data(Wn.DateTime),r=G(s,+t,Number),o=G(s,+e,Number),a={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[l,c,u]=[Wn.High,Wn.Low,Wn.Close].map(t=>this.data(t)),h=t=>t-r;for(let t=r;t<=o;t++)i&&-1===a.refIndex&&K(this.entryPrice)&&this.entryPrice>=c[t]&&this.entryPrice<=l[t]&&(a.refIndex=h(t)),(!i||a.refIndex>=0&&h(t)>=a.refIndex)&&((!K(a.highest)||l[t]>a.highest)&&(a.highest=l[t]),(!K(a.lowest)||c[t]<a.lowest)&&(a.lowest=c[t])),i&&-1!==a.refIndex&&(-1===a.highestIndex&&l[t]>this.upperPrice&&(a.highestIndex=h(t)),-1===a.lowestIndex&&c[t]<this.lowerPrice&&(a.lowestIndex=h(t))),n&&a.data.push({high:l[t],low:c[t],close:u[t],time:s[t]});if(n&&a.data&&a.data.length>0){a.state=K(a.highest,a.lowest)&&(this.upperPrice<a.highest||this.lowerPrice>a.lowest)?Sp:Tp,a.special=-1===a.highestIndex&&-1===a.lowestIndex||a.highestIndex===a.lowestIndex;const t=V(a.data);if(a.toPrice=t.close,a.toTime=t.time,a.state===Sp)if(a.special){if(-1!==a.refIndex){const t=a.data[a.refIndex];a.toTime=t.time,a.toPrice=(this.isLong?this.lowerPrice<a.lowest:this.upperPrice<a.highest)?this.upperPrice:this.lowerPrice}}else{const t=-1!==a.highestIndex&&-1!==a.lowestIndex;t&&a.highestIndex<a.lowestIndex||-1===a.lowestIndex?(a.toPrice=this.upperPrice,a.toTime=a.data[a.highestIndex].time):(t&&a.lowestIndex<a.highestIndex||-1===a.highestIndex)&&(a.toPrice=this.lowerPrice,a.toTime=a.data[a.lowestIndex].time)}a.pAndL=Z(this.isLong?a.toPrice-this.entryPrice:this.entryPrice-a.toPrice,2)}return a}get dataWindow(){return K(this._dataWindow)||(this._dataWindow=this.getDataWindow(this.entryAnchor.time,this.exitAnchor.time)),this._dataWindow}getVisiblePriceRange(){const t=this.axis.yScale.domain();return t[1]-t[0]}getFutureTimestamp(){const t=this.data(Wn.DateTime),e=G(t,+this.points[0].time,Number);return t[Math.min(t.length-1,e+50)].getTime()}get entryPrice(){return this.entryAnchor.price}get entryAnchor(){return this.points[0]}get upperPrice(){return this.upperAnchor.price}get upperAnchor(){return this.points[1]}get lowerPrice(){return this.lowerAnchor.price}get lowerAnchor(){return this.points[2]}get exitAnchor(){return this.points[3]}get accountSize(){return this.traits[te.AT_ACCOUNT_SIZE]}get risk(){const t=this.traits[te.AT_RISK_IS_PERCENT],e=this.traits[te.AT_RISK];return Z(t?e/100*this.accountSize:e,2)}get pointValue(){return this._metaData||(this._metaData=this.presenter.mainPlot.metaData),this._metaData.pointValue}formatDollarValue(t){if(!Number.isFinite(t))return te.NOT_APPLICABLE;return"".concat(t<0?"-":"","$").concat(this.twoDecMeta.format(Math.abs(t)))}get qty(){return Math.floor(this.risk/(this.isLong?this.entryPrice-this.lowerPrice:this.upperPrice-this.entryPrice))}get upperDiff(){return Z(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return Z(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return Z(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[te.AT_COMPACT]}get upper(){const t=il(this.axis,this.upperPrice),e="(".concat(Z(this.upperDiff/this.entryPrice*100,2).toFixed(2),"%)");return this.isCompact,"".concat(t," ").concat(e)}get upperText(){const t="".concat(this.formatDollarValue(this.upperPandL));return this.isCompact?"".concat(this.upper," ").concat(t):"".concat(this.isLong?"Target":"Stop",": ").concat(this.upper,", P&L: ").concat(t)}get lowerDiff(){return Z(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return Z(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return Z(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){const t=il(this.axis,this.lowerPrice),e="(".concat(Z(this.lowerDiff/this.entryPrice*100,2).toFixed(2),"%)");return this.isCompact,"".concat(t," ").concat(e)}get lowerText(){const t="".concat(this.formatDollarValue(this.lowerPandL));return this.isCompact?"".concat(this.lower," ").concat(t):"".concat(this.isLong?"Stop":"Target",": ").concat(this.lower,", P&L: ").concat(t)}get riskReward(){return Z(this.isLong?this.upperDiff/this.lowerDiff:this.lowerDiff/this.upperDiff,2)}get state(){return this.dataWindow.state}get pAndL(){return this.dataWindow.pAndL}get pAndLValue(){return this.pAndL*this.pointValue}positionPoints(){const t=this.getVisiblePriceRange()/5,e=this.getFutureTimestamp();this.upperAnchor.update(this.entryPrice+t,this.entryAnchor.time),this.lowerAnchor.update(this.entryPrice-t,this.entryAnchor.time),this.exitAnchor.update(this.entryPrice,e)}fillOnlyStyle(t){return ui({line:{color:te.COLOR_TRANSPARENT,dashStyle:"Solid"},fill:this.traits[t]})}get lowerStyle(){return this.fillOnlyStyle(te.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(te.AT_FILL)}get textStyle(){return this.fillOnlyStyle(te.AT_FILL_TEXT)}get secondaryLineStyle(){return ui({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:te.COLOR_TRANSPARENT}})}wasModifiedByTool(){K(this.points[2].price)||this.positionPoints(),this._dataWindow=null}wasPointMovedByTool(t,e){if(t===this.entryAnchor){const e=(e,i,n)=>e.update(i?t.price:e.price,n?t.time:e.time);e(this.exitAnchor,!0,!1),e(this.upperAnchor,!1,!0),e(this.lowerAnchor,!1,!0)}this.wasModifiedByTool()}get isUpperPerPAndL(){const t=this.dataWindow;return this.isLong?t.pAndL>0:t.pAndL<=0}getStyleForElement(t,e){return t.style||this.defaultStyle}getElements(){const t=new qd(this.entryAnchor.point,this.exitAnchor.point,!1,!1,this.axis),e=this.exitAnchor.point.x<this.entryAnchor.point.x,i=Math.abs(this.exitAnchor.point.x-this.entryAnchor.point.x),n=(t,e)=>({x:t.x+e,y:t.y}),s=new bp(n(this.upperAnchor.point,e?-i:0),i,Math.abs(this.upperAnchor.point.y-this.entryAnchor.point.y),this.axis);s.style=this.upperStyle;const r=new bp(n(this.entryAnchor.point,e?-i:0),i,Math.abs(this.entryAnchor.point.y-this.lowerAnchor.point.y),this.axis);r.style=this.lowerStyle;const o=[t,s,r],a=this.dataWindow;if(-1!==a.refIndex){const t=a.data[a.refIndex],e=new rd(this.axis,this.entryPrice,t.time.getTime()),i=new rd(this.axis,a.toPrice,a.toTime.getTime()),n=new qd(e.point,i.point,!1,!1,this.axis);if(n.style=this.secondaryLineStyle,o.push(n),e.time!==i.time){const e=this.isUpperPerPAndL,i=new rd(this.axis,e?a.toPrice:this.entryPrice,t.time.getTime()),n=new rd(this.axis,e?this.entryPrice:a.toPrice,a.toTime.getTime()),s=new bp(i.point,n.point.x-i.point.x,Math.abs(n.point.y-i.point.y),this.axis);s.style=e?this.upperStyle:this.lowerStyle,o.push(s)}}return o}hitTest(t){if(!this.visible)return!1;const e=this.isHit||!1;return this.isHit=super.hitTest(t),this.isHit!==e&&this.requestRedraw(),this.isHit}get showTextAdornments(){return this.isHit||this.isSelected}getPriceScaleAdornments(){const t=t=>ke(this.traits[t].color);return[{price:this.upperPrice,color:t(te.AT_FILL)},{price:this.entryPrice,color:t(te.AT_LINE)},{price:this.lowerPrice,color:t(te.AT_FILL2)}]}adornElements(t,e){const[i,n,s]=t;if(this.showTextAdornments){const[t,r]=[!0,!1].map(t=>this.getAdornOffset(e,t).y),{x:o,y:a,width:l}=n.rect,c={x:o+l/2,y:a+t},u=this.textStyle.fillStyle;Ye(e,this.upperText,c,T.Center,u,ke(this.upperStyle.fillStyle));const{x:h,y:d,width:p,height:f}=s.rect,m={x:h+p/2,y:d+f+Math.abs(r)};Ye(e,this.lowerText,m,T.Center,u,ke(this.lowerStyle.fillStyle));const{p1:{x:g},p2:{x:y},p1:{y:v}}=i,b=this.isCompact?"".concat(this.formatDollarValue(this.pAndLValue)):"".concat(this.state||te.NOT_APPLICABLE," P&L: ").concat(this.formatDollarValue(this.pAndLValue)),S=this.isCompact?"".concat(this.riskReward.toFixed(2)):"Risk/Reward Ratio: ".concat(this.riskReward.toFixed(2)),A={x:g+(y-g)/2,y:v+t+5},P=ke(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);Ye(e,[b,S],A,T.Center,u,P)}}updatePoints(t){super.updatePoints(t),this.wasModifiedByTool()}}const Pp=new class{constructor(){this.resizingPanes=!1,this.stopResizingScale(),this.snapToSupported=!1,this.touchCrosshairMode=!1,this.previousTouchTimestamp=null,this.notifyZoomChanged=function(t,e){let i=null;return function(){const n=this,s=arguments;clearTimeout(i),i=setTimeout((function(){t.apply(n,s)}),e)}}(t=>{ya.a.publish(jn.CH_ZOOMCHANGED,t.accessor)},te.ZOOM_DEBOUNCE_DELAY)}startTouchCrosshairMode(t,e,i){this.touchCrosshairMode=!0,this.showCrosshairAndTooltips(t.view,e,i)}activated(){}deactivated(){}findHit(t){if(!t.point)return[];if(t.axis.pane.axes.some(e=>e.plots.some(e=>e.hitTestCustomEvent(t.point))))return te.EVENT_PIN_HIT;const e=t.presenter.selectedAnnotation;let i;void 0!==e&&(i=e.points.find(e=>e.hitTest(t.point)));let n=V(t.axis.annotations.filter(e=>e.hitTest(t.point)));return void 0!==i&&null==n&&(n=e),[n,i]}stopResizingScale(){this.resizingScale=!1,this.resizingScaleId=null,this.lastScaleResizingOffset=null,this.lastScaleResizingExtremes=null}onMouseDblClick({priceAxis:t,offset:e,ap:i,presenter:n,view:s}){const r=s.xAxis.viewBox.contains(e);if(K(t))this.stopResizingScale(),t.isCustomDomain=!1,t.setDomain(),s.redraw();else if(r)s.xAxis.resetZoom(),s.setPriceAxesDomains(),s.redraw(),this.notifyZoomChanged(n);else if($()){const t=n.selectedAnnotation;null!=t?Bd(t,e):Vd(n,e)}}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!$())return null;const t=(new Date).getTime(),e=K(this.previousTouchTimestamp)?t-this.previousTouchTimestamp:null;return this.previousTouchTimestamp=t,e}onMouseDown(t){const{point:e,button:i,splitter:n,offset:s,priceAxis:r,presenter:o,originalEvent:a}=t,l=i===A.Right||/^Mac/.test(globalThis.navigator.platform)&&i===A.Left&&t.getModifier(P.Control);this.touchCrosshairMode&&K(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);const c=this.computePreviousTouchStartDuration();if(K(c)&&c<te.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(t),!0;if(!l&&this.isLogoLink(s)&&ya.a.publish(jn.CH_LOGOCLICKED,{chart:o.accessor}),!l&&K(e)&&o.allPlots.some(t=>t.tryHandleCustomEventClick(e.point)))return!0;if(K(n))return this.resizingPanes=!0,this.lastResizingOffset=s,this.splitter=n,o.enableTooltip(!1),!0;if(K(r)){return J(o.display.chart.zooming)[0]&&this.startAxisScaling(r,s),!0}if(null!=e){const[t,i]=this.findHit(e);if(o.clearSelection(),null==t)return l?(Vd(o,s,a),!0):!!this.touchCrosshairMode||(o.activeTool=new Fd(e),o.activeTool.startPan(s),Hd());o.setSelection(t);const n=null!=i;return l?(Bd(t,s),$()):!(n&&!i.movable||!n&&!t.canMove(e.point))&&(o.activeTool=n?new cd(t,i):new ld(t,e,s),$())}return this.prevZoomingOffset=s,!1}onContextMenu(t){return!0}isLogoLink(t){const e=K(Ud)?Ud.rect:null;return K(e)&&e.contains(t)}onMouseMove(t){const{point:e,splitter:i,priceAxis:n,view:s,presenter:r,offset:o}=t;if(K(t.pinchZoom)&&t.pinchZoom&&K(t.pinchDistance))return K(this.prevPinchDistance)&&(t.delta=this.prevPinchDistance-t.pinchDistance,this.onWheel(t)),this.prevPinchDistance=t.pinchDistance,$();if(null!=i||this.resizingPanes)s.setCursor(S.ResizeVertical),this.resizingPanes&&this.resizePanes(s,o);else if(K(e)){const[t,i]=this.findHit(e);K(i)?e.presenter.view.setCursor(S.Crosshair):K(t)?t.isSelected?e.presenter.view.setCursor(S.Move):e.presenter.view.setCursor(S.Hand):e.presenter.view.setCursor(S.Arrow)}else if(K(n)){J(r.display.chart.zooming)[0]&&(s.setCursor(S.ResizeVertical),this.performAxisScaling(s,n,o))}else{if(this.prevZoomingOffset){const{x:t}=this.prevZoomingOffset,{x:e}=o,i=t-e;this.applyZoom(s.presenter,-i),this.prevZoomingOffset=o}s.setCursor(S.Arrow)}return!e||this.resizingPanes?(this.hideCrosshairAndTooltips(s),$()):(this.isLogoLink(o)&&s.setCursor(S.Hand),this.showCrosshairAndTooltips(s,e,o),$())}showCrosshairAndTooltips(t,e,i){!e.time||$()&&!this.touchCrosshairMode||(t.drawCrosshair({ap:e,offset:i}),function(t,{time:e,lastBarRefresh:i,justMain:n,offset:s}){const r=Al(t,e,s,i,n);if(t.showTooltip){const{mode:e,showMainPlot:i}=t.display.tooltip,{includeTimestamp:o,showMainPlot:a}=im().config.tooltipHeaders||{},l=K(a)?a:i,c=!!K(o)&&o;switch(e){case te.TOOLTIP_CARDS:n||Rd(t,r,l,!0,c);break;case te.TOOLTIP_BUBBLE:{const e=r.panes.find(t=>{const{top:e,left:i,width:n,height:r}=t.bounds;return new je(i,e,n,r).contains(s)}),i=e.plots.find(t=>t.isMain)||e.plots[0],n=i.values.find(t=>["Close","Last"].includes(t.id)),o=n?n.y:i.values[0].y,a=e.plots.map(t=>t.values.filter(t=>"Change"!==t.id&&t.y>0).map(t=>t.y)).flat(),c=dl(Cd(Cd({},r),{},{plots:e.plots})),u='<div class="bubble-box">'.concat(c,"</div>");t.view.tooltip.show(u,{x:s.x,y:o,yMin:Math.min(...a),yMax:Math.max(...a)}),Rd(t,r,l,!1,!1,t.hasLegend);break}case te.TOOLTIP_STD:{const e=dl(Cd(Cd({},r),{},{plots:r.panes.map(t=>t.plots).flat()}));t.view.tooltip.show(e),Rd(t,r,l,!1,!1,t.hasLegend);break}case te.TOOLTIP_EXTERNAL:ya.a.publish(jn.CH_TOOLTIPCHANGED,r);break;default:console.warn("Unknown tooltip mode requested: ".concat(e))}}}(t.presenter,{time:e.time,offset:i}))}hideCrosshairAndTooltips(t){t.drawCrosshair({ap:void 0}),t.tooltip.hide(),t.presenter.hideCards()}onMouseLeave(t){const{view:e,offset:i}=t;e.presenter.accessor.getPaneBounds().every(t=>{return!t.contains(i)||(e=t,(n=i).x===e.x||n.x===e.x+e.width||n.y===e.y||n.y===e.y+e.height);var e,n})&&(this.hideCrosshairAndTooltips(e),this.stopResizeZoom(e.presenter)),e.setCursor(S.Arrow),this.touchCrosshairMode=!1}stopResizeZoom(t){this.resizingPanes&&(this.resizingPanes=!1,t.enableTooltip(!0),t.onPaneHeightsUpdated()),this.resizingScale&&this.stopResizingScale(),this.prevZoomingOffset&&delete this.prevZoomingOffset}onMouseUp({presenter:t}){if(this.stopResizeZoom(t),$()){const e=function(){const t=im().config.touchCrosshairTimeoutMillis;return K(t)&&Number.isFinite(t)?t:te.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=setTimeout(()=>{this.hideCrosshairAndTooltips(t.view),this.touchCrosshairMode=!1},e)}}applyZoom(t,e,i=!0){if(!J(t.display.chart.zooming)[1])return;const n=Math.sign(e)*($()?2:10),s=t.view;s.xAxis.zoom(n)&&(s.setPriceAxesDomains(),s.redraw(),i&&this.notifyZoomChanged(t))}onWheel({view:t,presenter:e,getModifier:i,delta:n}){const{scrollBehavior:s}=e.display;return!(!($()?"none"!==s:"wheel"===s||"wheel+shift"===s&&i(P.Shift))||0===n)&&(t.drawCrosshair({ap:void 0}),t.tooltip.hide(),t.presenter.hideCards(),this.applyZoom(e,n),!0)}onKeyDown(t){const{key:e,code:i,presenter:n}=t;if(K(n.selectedAnnotation)&&function(t,e){return"Backspace"===t||"Delete"===t||8===e||46===e}(e,i)){const t=n.selectedAnnotation;t.axis.deleteAnnotation(t)}if(K(n.selectedAnnotation)&&(!function(t,e){return"Escape"===t||27===e}(e,i)?function(t,e){return"F2"===t||113===e}(e,i)&&n.selectedAnnotation instanceof Sd&&n.selectedAnnotation.textEditable&&(n.activeTool=new Pd(null,n.selectedAnnotation),n.activeTool.startEditing()):n.clearSelection()),X(e,i)||function(t,e){return"ArrowRight"===t||39===e}(e,i)){const t=X(e,i)?-1:1,s=n.view;s.xAxis.xScale.shiftBars(t),s.redraw()}}resizePanes(t,e){const i=e.y-this.lastResizingOffset.y;if(0===i)return;const n=t.presenter.panes,[s,r]=this.splitter,o=n.map((t,e)=>{const n=t.getBounds().height;return e===s?n+i:e===r?n-i:n});if(o.some(t=>t<te.MINIMUM_PANE_HEIGHT))return;const a=(t,e)=>t+e,l=o.reduce(a,0),c=n.map(t=>t.height).reduce(a,0);n.forEach((t,e)=>t.height=Z(o[e]/l*c,4)),this.lastResizingOffset=e,t.recalculateLayout(),t.redraw()}startAxisScaling(t,e){this.resizingScale=!0,this.resizingScaleId=t.id,this.lastScaleResizingOffset=e,this.lastScaleResizingExtremes=t.yScale.domain()}performAxisScaling(t,e,i){if(this.resizingScale&&this.resizingScaleId===e.id){const n=$()?4:5,s=function(t,e,i,n,s=1,r=1){const o=(i.y-e.y)/t.viewBox.height,[a,l]=n,c=o*(l-a)/10;return[a+c*s,l+c*r]}(e,this.lastScaleResizingOffset,i,this.lastScaleResizingExtremes,-n,n);e.isCustomDomain=!0,e.yScale.domain(s),t.redraw()}}},wp={Default:()=>function(){return Pp},Line:()=>Ep(Wd,Zd,!1),Ray:()=>Ep(Wd,Zd,!1),GannLine:()=>Ep(jd,Zd,!1),VerticalLine:()=>Ep(Gd,Qd,1),HorizontalLine:()=>Ep(Gd,Jd,1),LongPosition:()=>Ep(Gd,Ap,1,!0),ShortPosition:()=>Ep(Gd,Ap,1,!1),FiftyPercentLine:function(t,e){return K(t)?Ep(Yd,tp,t.axis||e.mainAxis,t):Ep(Gd,tp,2)},FibonacciRetracement:()=>Ep(Wd,ip,!1),TrendBasedFibExtension:()=>Ep(Wd,np,!0),FibonacciFan:()=>Ep(Wd,rp,!1),FibonacciArcs:()=>Ep(Wd,lp,!1),GannFan:()=>Ep(Wd,cp,!1),SpeedResistanceFan:()=>Ep(Wd,up,!1),SpeedResistanceArcs:()=>Ep(Wd,hp,!1),AndrewsPitchfork:()=>Ep(Gd,dp,3),Rectangle:()=>Ep(Wd,pp,!1),Ellipse:()=>Ep(Wd,fp,!1),TrendChannel:()=>Ep(Wd,mp,!0),SymbolArrowUp:()=>Ep(Gd,gp,1,"arrow_up"),SymbolArrowDown:()=>Ep(Gd,gp,1,"arrow_down"),SymbolArrowRight:()=>Ep(Gd,gp,1,"arrow_right"),SymbolArrowLeft:()=>Ep(Gd,gp,1,"arrow_left"),SymbolArcDown:()=>Ep(Gd,gp,1,"arc_down"),SymbolArcUp:()=>Ep(Gd,gp,1,"arc_up"),SymbolThumbsUp:()=>Ep(Gd,gp,1,"thumbs_up"),SymbolThumbsDown:()=>Ep(Gd,gp,1,"thumbs_down"),SymbolZero:()=>Ep(Gd,gp,1,"zero"),SymbolOne:()=>Ep(Gd,gp,1,"one"),SymbolTwo:()=>Ep(Gd,gp,1,"two"),SymbolThree:()=>Ep(Gd,gp,1,"three"),SymbolFour:()=>Ep(Gd,gp,1,"four"),SymbolFive:()=>Ep(Gd,gp,1,"five"),SymbolSix:()=>Ep(Gd,gp,1,"six"),SymbolSeven:()=>Ep(Gd,gp,1,"seven"),SymbolEight:()=>Ep(Gd,gp,1,"eight"),SymbolNine:()=>Ep(Gd,gp,1,"nine"),SymbolQuestion:()=>Ep(Gd,gp,1,"question"),SymbolFishHook:()=>Ep(Gd,gp,1,"fish_hook"),FibonacciTimeZones:()=>Ep(Gd,yp,1),Text:()=>Ep(Pd,Sd,null),PickPoint:()=>function(){return new vp},ComputedText:function(t){return Ep(zd,Ad,null,t)}};var Cp=function(t,e=!1,i=null,n=null,s=null){let r=wp[t];return r=r(n,s),r(t,e,i)};function xp(t,e=null){t.enableTooltip(!0),t.resetActiveTool(),K(e)&&t.onAnnotationsUpdated(e)}function Mp(t,e=!0){t.wasModifiedByTool();const i=t.axis;xp(i.pane.presenter,e?i:null)}function Ep(t,e,i,n){return function(s,r,o){const a=function(t,e,i,n){return function(s,r=!0){const o=new e(s,t,i);return r?s.addAnnotation(o):o.drawn=!1,K(n)&&(o.traits=n),o}}(s,e,n,o);return r?a:new t(a,i)}}function Op(t){t.button===A.Right&&xp(t.presenter)}class Dp extends td{get title(){return"".concat(this.forward).concat(this.suffix)}get forward(){return this._forward}fromModel(t){super.fromModel(t),this.offset=t.offset,this._forward=t.forward}async parseForward(){const{model:t,error:e,clean:i,text:n,symbols:s}=dn(this.forward);if(e?(this.errorText=e,this.fwdModel=null):this.fwdModel=t,this._forward=this.isValid?i:n,this.isValid){this.offset>0?(this.suffix=" (".concat(L(Sa(this.offset),ao(te.FMT_US_DATE_ONLY))(new Date),")"),this.outField=new Bn("Close_".concat(this.offset),d.Number,f.Forward,"Close (".concat(this.offset,")")),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=Wn.Close);const t=(await Promise.all(s.map(t=>Ft(t)))).map(t=>t.map(t=>t.name));this.roots=s.reduce((e,i,n)=>(e[i]=t[n],e),{})}else this.roots=null}get isValid(){return!K(this.errorText)}getMetaData(){if(this.isValid){const t=Object.values(this.roots).map(t=>V(t));this.metaData=new Te(t),this.metaData.ready().then(t=>{t&&ya.a.publish(jn.MD_CHANGED,{plot:this})})}}get forwardPolicy(){return{mapper:t=>t.query.root,recompute:r.Everything,missing:s.UseNext,stretch:t=>!1,fieldMap:new Map([[Wn.Close,this.outField]]),noDataApproach:o.NoAction,modelTransform:(t,e)=>null}}getTimeSeries(){const t=im().getTimeSeriesDataSource(),e=Object.keys(this.roots),i=0===this.offset?b.Forward:b.HistoricalForward,n=e.map(e=>{const n={seriesKind:i,root:e,offset:this.offset,symbols:this.roots[e],getHashKey:()=>"".concat(i,"|").concat(e,"|").concat(this.offset)};return t.getTimeSeries(n)});this.timeSeries=new dh(this.fwdModel,n,this.forwardPolicy),this.timeSeries.ready().then(t=>{t&&ya.a.publish(jn.TS_MANYCHANGED,{series:this.timeSeries,part:x.Unspecified})})}async initialize(){await this.parseForward(),this.isShutDown||(this.getMetaData(),this.getTimeSeries())}}function Lp(t){yt(1,arguments);var e=vt(t),i=e.getFullYear();return e.setFullYear(i+1,0,0),e.setHours(23,59,59,999),e}const Ip=t=>t.substr(0,t.lastIndexOf("::"));class _p extends td{get title(){var t;return this.isAverage?"Average".concat(this.isAnnual?" (prior)":""):!this.hasComputation&&(null===(t=this.symbols)||void 0===t?void 0:t.length)>0?this.outField.name:"".concat(this.seasonal).concat(this.suffix)}get seasonal(){return this._seasonal}fromModel(t){super.fromModel(t),this.offset=t.offset,this.offsets=t.offsets,this.usedInAverage=t.usedInAverage,this.isAverage=!K(t.offset),this.isAnnual=!0===t.isAnnual,this._seasonal=t.seasonal}constructSeasonal(t,e){return mn(vn(t,t=>this.applyOffset(t,e)))}constructAverage(t,e=null){const i=null===e?null:e.map(t=>this.symbolToOffset[t]),n=null===i,s=this.offsets.filter(t=>!!n||i.includes(t)).map(e=>"(".concat(this.constructSeasonal(t,e),")")),r=n?this.offsets.length:i.length;return"(".concat(s.join("+"),")/").concat(r)}prepareFields(){const t=this.isPlain?"".concat(this.yearFromOffset(this.offset)):"".concat(this.offset,"Y"),e=this.isAverage?"Avg":t;this.suffix=0===this.offset?"":" (".concat(e,")"),this.outField=new Bn("Close_".concat(e),d.Number,f.Seasonal,"Close".concat(this.suffix)),this.curves[0].fields[0]=this.outField}applyOffset(t,e){return this.isPlain?"".concat(t,"::").concat(e):Vt(t,-e)}createSymbolToOffsetMapping(t){this.symbolToOffset=t.reduce((t,e)=>(this.isPlain||(t[e]=null),t),{}),t.forEach(t=>{this.offsets.forEach(e=>{this.symbolToOffset[this.applyOffset(t,e)]=e})})}async parseSeasonal(){let{model:t,error:e,symbols:i}=dn(this.seasonal,!0);const n=t=>(this.errorText=t,this.seaModel=null,null);if(e)return n(e);this.prepareFields();const s=new Map;for(const t of i){const e=Nt(await Et(t));s.set(t,e)}t=vn(t,t=>s.get(t)),i=Array.from(s.values());const r=i.every(t=>Ot(t)),o=i.every(t=>Lt(t)),a=i.every(t=>!Ot(t)&&!Lt(t));if(!r&&!o&&!a)return n("Mixed types of symbols aren't supported yet");this.isPlain=a,this.isFutures=r,this.createSymbolToOffsetMapping(i),this.coreModel=this.isAverage?t:null,this.coreHasComputation=yn(t);const l=this.isAverage?this.constructAverage(t):this.constructSeasonal(t,this.offset),{model:c,clean:u,symbols:h}=dn(l,!0);this.seaModel=c,this.hasComputation=yn(c),this._seasonal=u,this.symbols=h,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!K(this.errorText)}getActualSymbols(){return this.isPlain?[...new Set(this.symbols.map(Ip))]:et(this.symbols)}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){if(this.isPlain){const t=Ip(this.symbols[0]);return"".concat(t," ").concat((new Date).getFullYear()-this.offset)}if(this.isFutures)return Nt(this.symbols[0],!0)}return this.title}getMetaData(){if(this.isValid){const t=this.getActualSymbols(),e=1===t.length&&!this.hasComputation&&!this.isAverage,i=im().getMetaDataSource();this.metaData=e?i.getMetaData(t[0]):new Te(t),this.metaData.ready().then(t=>{t&&ya.a.publish(jn.MD_CHANGED,{plot:this})})}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?o.ModelTransformRequired:this.hasComputation?o.NoAction:o.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:t=>t.query.surrogate||t.query.symbol,recompute:r.Everything,missing:this.hasComputation||this.usedInAverage?s.UsePrevious:s.UseNone,stretch:t=>this.shouldStretch(t),fieldMap:new Map([[Wn.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(t,e)=>{if(0===e.length)return this.seaModel;return dn(this.constructAverage(this.coreModel,t)).model}}}shouldStretch(t){return 0===this.symbolToOffset[t]&&(this.isAverage&&this.symbols.length>1||this.offset>0)}shiftYears(t){return Ct(new Date,-t)}yearFromOffset(t){return At(this.shiftYears(t))}getCmdtyRange(t){const e=this.shiftYears(t);return[Zu(e),Lp(e)]}getTimeSeries(){const t=im().getTimeSeriesDataSource(),e=Object.keys(this.symbolToOffset).map(e=>{const i=this.makeQuery();return i.surrogate=e,i.symbol=this.isPlain?Ip(e):e,i.offset=this.symbolToOffset[e],i.cacheMe=!this.isPlain||0===i.offset,this.isPlain&&(i.range=this.getCmdtyRange(i.offset),i.offset>0&&(i.disableStreamingUpdates=!0)),this.isFutures&&i.offset>0&&K(...i.range)&&(i.range=i.range.map(t=>Ct(t,-i.offset))),t.getTimeSeries(i)});this.timeSeries=new dh(this.seaModel,e,this.seasonalPolicy),this.timeSeries.ready().then(t=>{t&&ya.a.publish(jn.TS_MANYCHANGED,{series:this.timeSeries,part:x.Unspecified})})}async initialize(){await this.parseSeasonal(),this.isShutDown||(this.getMetaData(),this.getTimeSeries())}}const Np=["bottom","right","left"],Rp={bottom:"center",right:"start",left:"end"};class kp{constructor(t){this.lineWidth=1,this.arrowWidth=7,this.arrowLength=7,this.position="bottom",this.fontSize=12,this.fontFamily="Arial",this.padding=4,this.strokeColor="white",this.textColor="white",this.backgroundColor="black",t&&this.configure(t)}configure(t){Object.assign(this,t)}draw(t,e,i,n,s){if(s=s||this.fontSize+this.padding+this.padding,!Np.includes(this.position.toLowerCase()))return void console.error("Can not draw indicator in position [".concat(this.position,"]"));t.font="bold ".concat(this.fontSize,"px ").concat(this.fontFamily),t.textAlign=Rp[this.position],t.strokeStyle=this.strokeColor,t.fillStyle=ke(this.backgroundColor),t.lineWidth=this.lineWidth;const r=t.measureText(n).width,o=Math.round(r+this.padding+this.padding),a=Math.round(o/2),l=Math.round(s/2);t.setLineDash([]);const c="bottom"===this.position?Math.max(a+1,e):e;t.beginPath(),t.moveTo(c,i),"right"===this.position?(t.lineTo(c+this.arrowLength,i+l),t.lineTo(c+this.arrowLength+o,i+l),t.lineTo(c+this.arrowLength+o,i-l),t.lineTo(c+this.arrowLength,i-l)):"left"===this.position?(t.lineTo(c-this.arrowLength,i+l),t.lineTo(c-this.arrowLength-o,i+l),t.lineTo(c-this.arrowLength-o,i-l),t.lineTo(c-this.arrowLength,i-l)):"bottom"===this.position&&(t.lineTo(c+this.arrowWidth,i+this.arrowLength),t.lineTo(c+a,i+this.arrowLength),t.lineTo(c+a,i+s),t.lineTo(c-a,i+s),t.lineTo(c-a,i+this.arrowLength),t.lineTo(c-this.arrowWidth,i+this.arrowLength)),t.closePath(),t.stroke(),t.fill(),t.fillStyle=this.textColor,t.textBaseline="middle","bottom"===this.position?t.fillText(n,c,i+this.arrowLength+ze(t,1)):"right"===this.position?t.fillText(n,c+this.arrowLength+this.padding,i):"left"===this.position&&t.fillText(n,c-this.arrowLength-this.padding,i)}}const Hp=Array.from(Array(6),(t,e)=>++e).reverse();class Fp{constructor(t){this.annotations=[],this.id=La()(),this.isCustomDomain=!1,this.ticks=null,this.lastUsedOptions=null,this.pane=t;const{chart:{fontSize:e},yAxis:{fontSize:i}}=this.pane.presenter.display,n=i||e||12;this.config={innerTickSize:7,tickPadding:5,indicatorPadding:4,fontWeight:400,fontSize:n},this.crosshairIndicator=new kp({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(t){let e=null;switch(v[t.type]){case v.Symbol:e=new ed;break;case v.Expression:e=new od;break;case v.Study:e=new sd;break;case v.IncomeStatement:e=new id(b.IncomeStatement);break;case v.BalanceSheet:e=new id(b.BalanceSheet);break;case v.Forward:e=new Dp;break;case v.Seasonal:e=new _p;break;default:throw new Error("".concat(t.type," isn't supported yet"))}return e.axis=this,e.fromModel(t),e}toPrice(t){return this.yScale.yToPrice(t)}toTime(t){return this.pane.presenter.view.toTime(t)}toAnnotationPoint(t){const e=this.toPrice(t.y),i=this.toTime(t.x);return new rd(this,e,i)}toX(t){return this.pane.presenter.view.toX(t)}toY(t){return this.yScale.priceToY(t)}snapTo(t){const e={x:this.toX(t.time),y:this.toY(t.price)},i=this.pane.presenter,n=i.activeTool,s=n.annotation;return n.alignPointsMode&&s&&s.alignPointsSupported&&s.points.includes(t)?this.alignPoints(s,t,e):n.snapToSupported&&i.display.yAxis.snapAnnotationsToPrices&&(t.moveDirection===w.Both||t.moveDirection===w.Vertical)&&this.snapToPrices(t,e),e}snapToPrices(t,e){const i=this.plots.find(t=>t.main);if(i&&i.timeSeries&&i.timeSeries.hasData){const n=i.timeSeries.container,s=G(n.getTimeData(),+t.time,Number),r=[].concat(...i.curves.map(t=>t.fields)).filter(t=>n.hasField(t)).map(t=>{const i=n.getData(t)[s],r=this.toY(i);return{priceSnap:i,ySnap:r,dist:Math.abs(r-e.y)}}).filter(t=>t.dist<=te.SNAP_PROXIMITY_PIXELS).reduce((t,e)=>null===t||e.dist<t.dist?e:t,null);K(r)&&(t.price=r.priceSnap,e.y=r.ySnap,t.time=n.getTimeData()[s],e.x=this.toX(t.time))}}alignPoints(t,e,i){const n=t.points.find(t=>t!==e);if(e!==n&&n&&n.point){const t=n.point,s=(360+180*-_e(t,i)/Math.PI)%360,r=22.5,o=s>90-r&&s<90+r||s>270-r&&s<270+r;if(s>360-r||s<r||s>180-r&&s<180+r)i.y=t.y,e.price=this.toPrice(i.y);else if(o)i.x=t.x,e.time=this.toTime(i.x);else{const n=Math.abs(i.x-t.x),s=t.y>i.y?-1:1;i.y=t.y+n*s,e.price=this.toPrice(i.y)}}}toPoint(t){if(K(this.pane.presenter.view))return this.snapTo(t)}makeAnnotation(t){let e=Cp(t.id,!0,t.traits)(this,!1),i=e.activePoints,n=t.points.length-i.length;return n>0&&e.addPoints(n),e.activePoints.forEach((e,i)=>{let n=t.points[i];Q(n.price)&&Q(n.time)&&e.update(n.price,n.time)}),e.visible=t.visible,e}expand(t){let e=[];switch(v[t.type]){case v.Forward:{const i=t.curves,n=t.offsets;delete t.curves,delete t.offsets;for(let s=0;s<i.length;s++){let r=Object.assign({},t);r.curves=[i[s]],r.offset=n[s],e.push(r)}break}case v.Seasonal:{const i=t.curves,n=t.offsets;delete t.curves,delete t.offsets;const s=n.length;for(let r=0;r<i.length;r++){let o=Object.assign({},t);o.curves=[i[r]],o.offsets=n,o.usedInAverage=!1,o.offset=r===s?null:n[r],(K(o.offset)||s>1)&&e.push(o)}null===V(e).offset&&e.forEach(t=>t.usedInAverage=null!==t.offset);break}case v.Annual:{const i=t.curves;delete t.curves;const n="{".concat(t.annual,"}"),s=[...Array(5+1).keys()];let r={type:"Seasonal",isAnnual:!0,main:!0,seasonal:n,offsets:s,offset:0,curves:[i[0]]};e.push(r);let o={type:"Seasonal",isAnnual:!0,main:!0,seasonal:n,curves:[i[1]],offsets:s.slice(1),offset:null};e.push(o);break}default:e.push(t)}return e}fromModel(t){this.comparison=g[t.comparison],this.scale=y[t.scale],this.yScale=new $h(this.scale),this.plots=[].concat(...t.plots.map(t=>this.expand(t))).map(t=>this.makePlot(t));const e=t.annotations||[];this.annotations=e.map(t=>this.makeAnnotation(t));const{chart:{fontFamily:i,backgroundColor:n},yAxis:{textColor:s,crosshair:{color:r}}}=this.pane.presenter.display;this.crosshairIndicator.configure({position:this.primary?"right":"left",fontFamily:i,strokeColor:r,textColor:s,backgroundColor:Ue(.15)(n)})}findIndex(t){return this.annotations.findIndex(e=>e.id===t.id)}addAnnotation(t){-1===this.findIndex(t)&&this.annotations.push(t)}fireAnnotationsChanged(t=!1){this.pane.presenter.onAnnotationsUpdated(this,t)}deleteAnnotation(t){t.isSelected&&this.pane.presenter.clearSelection();const e=this.findIndex(t);-1!==e&&this.annotations.splice(e,1),this.fireAnnotationsChanged(!t.isSelected)}duplicateAnnotation(t){const e=t.axis;let i=this.makeAnnotation(t.toModel());i.drawPoints(null,!0),i.offset({x:te.ANN_DUPLICATE_OFFSET,y:te.ANN_DUPLICATE_OFFSET}),e.addAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(t,e){t.isSelected&&this.pane.presenter.clearSelection(),t.updateFrom(e.traits,e.extras,e.points,e.visible),t.requestRedraw(),this.fireAnnotationsChanged()}setViewBox(t){this.viewBox=t;const{y:e,height:i}=this.viewBox;this.yScale.range([Math.floor(e),Math.floor(e+i)]),this.plots.forEach(e=>e.setViewBox(t))}get fullDomain(){return K(this._fullDomain)||(this._fullDomain=this.getDataDomain()),this._fullDomain}updateFullDomain(t=null){if(null===t&&this.comparison!==g.None)return;const e=this.fullDomain;this._fullDomain=this.getDataDomain([t,t],e)}getPlotDataDomain(t,e,i){const n=t.timeSeries;if(!n.hasData)return;const s=n.container,r=s.getTimeData(),o=t=>G(r,+t,Number),a=K(e)?o(e):0,l=K(i)?o(i):r.length-1,c=this.comparison===g.Percent,u=this.comparison===g.Value;if(c||u){const e=t.curves[0].fields,i=e.find(t=>"Close"===t.id)||e[0],n=s.getData(i);let r=null,o=a;for(;null===r&&a<=l;)r=n[o++];const u=null!==r,h=t=>{if(!u||null===t)return null;return(t>=r?1:-1)*(100*Math.abs(t-r))/Math.abs(r)},d=t=>u&&null!==t?t-r:null;t.priceMapper=c?h:d}else t.priceMapper=t=>t;const h=t.curves.map(t=>t.fields).flat().filter(t=>t.id!==Wn.Change.id),d=K(t.targetFields);d&&h.push(t.targetFields);const p={};let f=[null,null];return B(s.fields,h,t=>t.id).forEach(e=>{const[i,n]=(e=>{const i=d?t.curves[0]:t.curves.find(t=>t.fields.includes(e));if(!K(i)||0===i.shift)return[a,l];if(!K(p[i.id])){const t=i.shiftedTimeDomain;if(!K(t))return[a,l];p[i.id]=[o(t[0]),o(t[1])]}return p[i.id]})(e);Y(z(s.getData(e),i,n,t.priceMapper),f)}),t.isStudy&&"VOL"===t.model.study&&(f[0]=0),f}getDataDomain([t,e]=[null,null],i=[null,null]){let n=et(i);if(this.plots.filter(t=>!t.hasDetachedScale).forEach(i=>{const s=this.getPlotDataDomain(i,t,e);K(s)&&Y(s,n)}),!K(n))return null;const[s,r]=n;if(!K(s,r))return null;let o=[Number(s),Number(r)];return o[0]===o[1]&&(o[0]-=1,o[1]+=1),o}setDomain(){const t=this.pane.presenter,e=t.view.xAxis.xScale.domain();if(!K(e))return;if(this.plots.filter(t=>t.hasDetachedScale).forEach(t=>{const i=this.getPlotDataDomain(t,e[0],e[1]);t.yScale.domain(i)}),this.isCustomDomain)return;let i=this.getDataDomain(e);if(this.pane===t.mainPlot.pane){const e=t.mainPlot.getPreviousValue(),n=tt(t.display,!1,"chart","previous","forceVisible");K(e,i)&&n&&(i[0]=Math.min(i[0],e),i[1]=Math.max(i[1],e))}if(this.yScale.domain(i),K(i)){const t=this.getPadding();K(t)&&this.yScale.padding(t)}}getInitialPadding(){let t=jt("#".concat(te.HEADER_SIZE_PLACEHOLDER_ID));if(!K(t)){t=$t(document.body,"div"),Gt(t,{display:"none"}),zt(t,{id:te.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});const{lineHeight:e}=getComputedStyle(t);isNaN(Number.parseFloat(e))&&Gt(t,{lineHeight:"120%"})}const{paddingTop:e,paddingBottom:i,marginTop:n,lineHeight:s}=getComputedStyle(t),r=this.pane.isMain?n:"0";if("cards"!==this.pane.presenter.display.tooltip.mode)return Number.parseFloat(r);return[e,i,r,s].map(Number.parseFloat).reduce((t,e)=>t+e,0)+te.CARDS_Y_OFFSET}getPadding(){const t=this.pane.presenter,e=this.getInitialPadding(),i=te.PANE_CAP_MIN_PADDING_PERCENT*this.viewBox.height;let n=[Math.max(i,Math.min(te.PANE_CAP_MAX_PADDING_PERCENT*this.viewBox.height,e)),i];const s=t.mainPlot;return s&&s.hasEvents&&(n[0]+=3*t.view.getEventRadius()),n}clearTicks(){this.ticks=null}getTicks(t,e=0){const{height:i}=this.viewBox,n=ze(t,1.3),s={height:i,approxLineHeight:n,domain:this.yScale.domain()};if(K(this.ticks)&&K(s.domain)&&K(this.lastUsedOptions)&&K(this.lastUsedOptions.domain)&&s.height===this.lastUsedOptions.height&&s.approxLineHeight===this.lastUsedOptions.approxLineHeight&&s.domain[0]===this.lastUsedOptions.domain[0]&&s.domain[1]===this.lastUsedOptions.domain[1])return this.ticks;this.lastUsedOptions=s;const r=Math.floor((i+40)/(n+40));let o=this.yScale.getTicks(r);const a=tt(im().config,null,"overrides","yAxis","tickProvider");if(K(a)&&"function"==typeof a&&s.height>0&&K(s.domain)){const t=et(s);t.autoTicks=et(o),o=a(t)}const{innerTickSize:l,tickPadding:c,fontSize:u}=this.config;return this.ticks=o.map(i=>{const n=il(this,i),s=t.measureText(n).width,r=Math.round(this.yScale.priceToY(i)),o={y1:r,y2:r,dy:0,label:n,labelY:r+.32*u};return this.primary?(o.x1=e,o.x2=o.x1+l,o.labelX=o.x2+s+c):(o.x1=e-l,o.x2=o.x1+l,o.labelX=o.x1-c),o}),this.ticks}widthNeeded(t){if(!K(this.fullDomain))return te.DEFAULT_PRICE_AXIS_WIDTH;t.save();const{fontWeight:e,fontSize:i}=this.config,{chart:{fontFamily:n}}=this.pane.presenter.display;t.font="".concat(e," ").concat(i,"px ").concat(n);const s=Math.max(...this.fullDomain.map(e=>t.measureText(il(this,e,!0)).width)),{innerTickSize:r,tickPadding:o}=this.config,a=s+r+2*o;return t.restore(),a}draw(t){const{chart:{fontFamily:e},yAxis:{gridLines:i,textColor:n,visible:s}}=this.pane.presenter.display;if(!s)return;t.save();const{x:r,y:o,width:a,height:l}=this.viewBox,{fontWeight:c,fontSize:u}=this.config;We(t,this.viewBox),t.font="".concat(c," ").concat(u,"px ").concat(e),t.lineWidth=2,t.strokeStyle=i.color,t.textAlign="end";const h=this.primary?r:a;t.setLineDash([]),Ke(t,h,o,o+l);const d=this.getTicks(t,h);this.drawTicks(t,d,n),this.drawPriceAdornments(t),t.restore()}drawTicks(t,e,i){t.fillStyle=i,e.forEach(e=>{t.fillText(e.label,e.labelX,e.labelY+e.dy)})}drawCrosshairIndicator(t,e){if(!this.pane.presenter.display.yAxis.crosshair.enabled)return;const i=this.primary?this.viewBox.x:this.viewBox.width,n=il(this,this.yScale.yToPrice(e));this.crosshairIndicator.draw(t,i,e,n)}get indicatorHeight(){return this.config.fontSize+this.config.indicatorPadding+this.config.indicatorPadding}drawPriceAdornments(t){const e=this.pane.presenter,{chart:{fontFamily:i,previous:n},yAxis:{showLastValue:s,preventLabelOverlap:r}}=e.display,o=e.view,a=[],l=(t,e,i,n,s)=>{if(null!=e){e=t.priceMapper?t.priceMapper(e):e;const r=t.hasDetachedScale?t.metaData.format(e,s):null;a.push({y:t.priceToY(e),formattedValue:r,value:e,color:i,halfHeight:Math.round(this.indicatorHeight/2),priority:n})}};this.plots.forEach(t=>{if(t.timeSeries&&t.timeSeries.hasData){if("All"===s||"Main"===s&&t.main){const e=e=>e.visible&&(t.type!==v.Study||e.style!==c.Ribbon);t.curves.filter(e).forEach(e=>{const i=e.pickMainField();let n=this.getLastValue(e.plot.timeSeries.container,i);const s=this.getLastColor(e);l(t,n,s,t.main?1:3,i)})}t.showPrevious&&l(t,t.getPreviousValue(),n.color,2)}}),this.annotations.forEach(t=>{a.push(...t.getPriceScaleAdornments().map(t=>({y:this.toY(t.price),value:t.price,color:t.color,halfHeight:Math.round(this.indicatorHeight/2),priority:4})))}),a.sort((t,e)=>t.y-e.y),r&&function(t){t.forEach((t,e,i)=>{if(e>0){const n=i[e-1],s=(({y:t,halfHeight:e})=>t-e)(t),r=(({y:t,halfHeight:e})=>t+e)(n);s<r&&(t.y=r+1+t.halfHeight)}})}(a);const u=({y:e,value:n,formattedValue:s,color:r})=>{const{leftOffset:a,rightOffset:l}=o,c=this.primary?this.pane.viewBox.width-l:a,u=new kp({position:this.primary?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:i,textColor:"#fff",strokeColor:r,backgroundColor:r}),h=s||il(this,n);u.draw(t,c,e,h)};r?a.forEach(u):Hp.forEach(t=>a.filter(e=>e.priority===t).forEach(u))}getLastValue(t,e){let i=t.getLastDataPoint(e);return null==i&&(i=F(t.getData(e),t=>null!==t)),i}getLastColor(t){const e=t.plot.timeSeries.container;return t.getColor(e.size-1)}}class Up{constructor(){this.id=La()()}fromModel(t){this.height=t.height,this.axes=t.axes.map((t,e)=>{const i=new Fp(this);return i.primary=0===e,i.fromModel(t),i},this)}getBounds(){return this.viewBox}setViewBox(t){this.viewBox=t}draw(t){this.drawAxes(t),t.save(),this.clipToNoScales(t),this.drawPrevious(t),this.drawGrid(t),this.drawPlots(t),this.drawAnnotations(t),this.drawLogo(t),t.restore()}drawLogo(t){this.isMain&&function(t,{x:e,y:i,height:n,width:s}){if(!K(Ud))return;const{img:r,width:o,height:a,rect:l}=Ud,c=s/8,u=Math.min(Math.max(50,c),o),h=a*u/o,d=e+5,p=i+n-h-5;l.x=d,l.y=p,l.width=u,l.height=h,t.drawImage(r,d,p,u,h)}(t,this.getBoundsWithoutScales())}drawAxes(t){for(let e of this.axes)e.draw(t)}drawPrevious(t){const e=this.presenter.mainPlot;if(e.showPrevious){const i=e.getPreviousValue();if(null!=i){const{leftOffset:n,rightOffset:s}=this.presenter.view,r=n,o=this.viewBox.width-s,a=e.axis.yScale.priceToY(i),{color:l,dashStyle:c}=this.presenter.display.chart.previous,u=Re(c);t.save(),t.strokeStyle=l,t.setLineDash(u),Ze(t,a,r,o),t.restore()}}}getBoundsWithoutScales(){const t=this.viewBox.duplicate(),e=this.presenter.view;return t.x=e.leftOffset,t.width-=e.leftOffset+e.rightOffset,t}clipToNoScales(t){We(t,this.getBoundsWithoutScales())}drawAnnotations(t){t.save(),this.axes.forEach(e=>{e.annotations.forEach(e=>e.draw(t,!0))}),t.restore()}drawGrid(t){const{chart:{fontFamily:e},yAxis:{gridLines:i,visible:n,minorGridLines:s}}=this.presenter.display;if(!n||!i.visible)return;const{lineWidth:r,color:o,dashStyle:a}=i;t.save();const l=this.axes[0],{fontWeight:c,fontSize:u}=l.config;t.font="".concat(c," ").concat(u,"px ").concat(e);const h=l.getTicks(t),{leftOffset:d,rightOffset:p}=this.presenter.view,f=d,m=this.viewBox.width-p,g=(e,i,n)=>{t.lineWidth=e,t.strokeStyle=i,t.setLineDash(Re(n)),t.beginPath()};if(g(r,o,a),h.forEach(e=>{t.moveTo(f,e.y1),t.lineTo(m,e.y2)}),t.stroke(),s&&s.visible&&h.length>=2){const{lineWidth:e,color:i,dashStyle:n}=s,r=(h[0].y1-h[1].y1)/5;g(e,i,n),h.forEach(e=>{for(let i=1;i<5;i++){const n=Math.ceil(e.y1+i*r);t.moveTo(f,n),t.lineTo(m,n)}}),t.stroke()}t.restore()}drawYCrosshair(t,e){const{yAxis:{crosshair:{enabled:i,showValue:n,color:s,dashStyle:r}}}=this.presenter.display;if(!i)return;const o=Re(r);t.strokeStyle=s,t.setLineDash(o);const a=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,c=ii();c.prolog(t),Ze(t,c.adjust(e.y),c.adjust(a),c.adjust(l)),c.epilog(t),n&&this.axes.forEach(i=>{i.drawCrosshairIndicator(t,e.y)})}drawNoData(t){t.save(),t.font="800 14px ".concat(this.presenter.display.chart.fontFamily),t.fillStyle="#f00";Ye(t,im().config.noDataText||te.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},T.Center),t.restore()}get isMain(){const t=this.presenter.mainPlot;return this.axes.some(e=>e.plots.includes(t))}drawPlots(t){t.save();const e=t=>t&&t.hasData&&t.container.isEmpty,i=this.presenter.mainPlot,n=this.presenter.display.chart.showNoDataText,s=!K(n)||n,r=new Map;let o=!0;const a=n=>{for(let t of this.axes){for(let s of t.plots){const t=e(s.timeSeries);o=o&&s.main&&t,s===i||t||n(s)}t.plots.includes(i)&&!e(i.timeSeries)&&n(i)}s&&o&&this.drawNoData(t)};a(e=>e.draw(t)),a(e=>e.drawTopmost(t,r)),t.restore()}}function Bp(t,e){return{width:t,spacing:e,get totalWidth(){return this.width+this.spacing},offset:0}}class Vp extends zh{constructor(t,e){super(),this.timeline=t;const i=t.presenter.display;this.marginBars=i.xAxis.marginBars||0,this.aggregation=e,this.bar=Bp(tt(i,te.DEFAULT_BAR_WIDTH,"chart","bar","width"),tt(i,te.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(){return Gh.call(this,"_extent",arguments[0])}get presenter(){return this.timeline.presenter}get display(){return this.presenter.display}scaleBarToFit(){if(this.wasZoomed)return;if(this.fitAllData)return this.scaleBarToFitDensity(this.timeline.withoutPrologEpilogLength);const t=this.display.xAxis.visibleRange;if(K(t))return this.scaleBarToFitRange([t.from,t.to]);const e=this.display.density;if(Number.isFinite(e))return this.scaleBarToFitDensity(e);const i=this.display.period;return Number.isFinite(i)?this.scaleBarToFitPeriod(i):void 0}deriveExtentsFromBarWidth(t){if(!K(this._range))return null;if(0===this.timeline.length)return null;const e=this._range[1]-this._range[0],i=e/t.totalWidth,n=Math.ceil(i);t.offset=e-n*t.totalWidth;let s=this.timeline.lastSeriesIndex+this.marginBars;const r=this._domain&&this._domain[1];r&&(s=G(this.timeline,+r,Number,ll));return[s-n+1,s]}adjustDomain(){if(K(this._range)){if(this.scaleBarToFit(),!K(this.display.xAxis.visibleRange)){const t=this.deriveExtentsFromBarWidth(this.bar);if(!K(t))return;this.extent(t)}this.setDomainFromExtent()}}xToTime(t){if(!this.ready)return null;const e=t-this._range[0]-this.bar.offset,i=Math.floor(e/this.bar.totalWidth),n=this._extent[0]+i;return this.timeline.at(n)}timeToIndex(t){return this.ready?(t="number"==typeof t?t:+t,G(this.timeline,t,Number,ll)):null}indexToX(t){const e=t-this._extent[0];return this.bar.width/2+this.range()[0]+this.bar.offset+e*this.bar.totalWidth}timeToX(t){if(!this.ready)return null;const e=this.timeToIndex(t);return this.indexToX(e)}zoom(t){const e=t,i=e*this.bar.width/100,n=this.bar.width-i,s=this.bar.spacing-e*this.bar.spacing/100;if(n>te.MAXIMUM_BAR_WIDTH||n<te.MINIMUM_BAR_WIDTH)return!1;const r=Bp(n,s),o=this.deriveExtentsFromBarWidth(r);return!!this.isUsableExtent(o)&&(this.setBar(n,s),this.adjustDomain(),this.wasZoomed=!0,!0)}scaleBarToFitRange(t){const e=(t,e,i,n)=>K(t)?G(this.timeline,t,Number,ll,i,n):e,{from:i,to:n}=this.presenter.data.range||{},s=t[0]===i&&t[1]===n,{firstSeriesIndex:r,lastSeriesIndex:o}=this.timeline,a=s?r:void 0,l=s?o:void 0,c=[e(t[0],r,a,l),e(t[1],o,a,l)];this.timeline.at(c[1])>t[1]&&(c[1]=Math.max(0,c[1]-1)),this.extent(c),this.scaleBarToFitDensity(c[1]-c[0]+1)}scaleBarToFitDensity(t){const e=Math.max(te.MINIMUM_BARS_VISIBLE,t),i=this.display.xAxis.marginBars||0,n=(this._range[1]-this._range[0])/(e+i);this.setBar(2/3*n,1/3*n,!1)}scaleBarToFitPeriod(t){const e=this.timeline.lastSeriesIndex;let i=this.timeline.at(e),n=i,s=e;const r=this.presenter.data.aggregation;if(r.isEndOfDay||r.isIntraday&&t>=te.INTRA_THRESHOLD)for(;s>0&&Ua(i,n)<t;)s--,n=this.timeline.at(s);else if(!r.isTick){let e=Math.floor(t/te.ONE_DAY_MILLIS);const n=t=>function(t,e){yt(2,arguments);var i=Ua(t,e)/6e4;return i>0?Math.floor(i):Math.ceil(i)}(t,bt(t)),r=n(i);let o=i;for(;s>0;){let t=this.timeline.at(s);const i=Tt(t,o);if(0===e){if(n(t)<=r||!i)break}else i||(e--,o=t);s--}}this.scaleBarToFitDensity(e-s+1)}setBar(t,e,i=!0){const[n,s]=dt(t,e,te.MINIMUM_BAR_WIDTH,te.MAXIMUM_BAR_WIDTH);this.bar.width=n,this.bar.spacing=s,this.wasZoomed||(this.resetBar={width:n,spacing:s}),i&&(this.presenter.model.display.chart.bar={width:t,spacing:e})}resetZoom(){K(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=te.DEFAULT_BAR_WIDTH,this.bar.spacing=te.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(t){return K(t)&&K(t[0],t[1])&&t[0]>=0&&t[1]<this.timeline.withPrologEpilogLength&&t[1]-t[0]>=te.MINIMUM_BARS_VISIBLE}shiftBars(t,e=null){const i=this._extent.map(e=>e+t);this.isUsableExtent(i)&&(K(e)&&(this.bar.offset=e),this.extent(i),this.setDomainFromExtent())}setDomainFromExtent(){this.domain(this.extent().map(t=>this.timeline.at(t)))}pan(t){if(!Number.isFinite(t)||0===t)return;const e=t%this.bar.totalWidth;let i=this.bar.offset+e;const n=Math.sign(t);let s=-(t<0?Math.ceil:Math.floor)(t/this.bar.totalWidth);(i>this.bar.totalWidth||i<-this.bar.totalWidth)&&(s+=i>0?-1:1,i-=n*this.bar.totalWidth),this.shiftBars(s,i)}getSeriesThatCouldLoadMoreData(){const t=this.domain();if(!K(t)||!K(t[0]))return[];const e=t[0].getTime();return this.timeline.presenter.allPlots.map(t=>t.timeSeries).filter(t=>!(!K(t)||!t.hasData||0===t.container.size||!0!==t.canLoadMoreData)&&e<=t.container.getTimeData()[0].getTime())}}class Wp{constructor(t){this.xScale=new Vp(t.presenter.timeline,t.presenter.data.aggregation),this.view=t,this.ticks=null,this.lastUsedOptions=null;const{chart:{fontFamily:e,backgroundColor:i,fontSize:n},xAxis:{textColor:s,visible:r,fontSize:o,crosshair:{color:a}}}=this.view.presenter.display,l=o||n||12;this.config={innerTickSize:5,tickPadding:5,indicatorPadding:5,fontWeight:200,fontSize:l},this.isVisible=r,this.crosshairIndicator=new kp({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:a,textColor:s,backgroundColor:Ue(.15)(i),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();const t=this.view.presenter.display.period===te.FIFTY_YEARS_MILLIS;K(this.xScale.extent())&&!t&&this.checkForMoreData()}zoom(t){const e=this.xScale.zoom(t);return this.checkForMoreData(),e}checkForMoreData(){this.xScale.getSeriesThatCouldLoadMoreData().forEach(t=>t.loadMoreData())}shouldScrollIntoView(t){const e=this.xScale.extent();return!!K(e)&&(t-this.xScale.timeline.lastSeriesIndex>=0&&t-e[1]<=1)}pan(t){this.xScale.pan(t),this.checkForMoreData()}resetZoom(){this.xScale.resetZoom()}get barsToLast(){const t=this.xScale.timeline.lastSeriesIndex,e=this.xScale.extent();return t-(e?e[1]:t)}canGoToLast(){return this.barsToLast>0}goToLatest(){this.canGoToLast()&&(this.xScale.shiftBars(this.barsToLast+this.xScale.marginBars+1),this.view.setPriceAxesDomains(),this.view.redraw())}setViewBox(t){this.viewBox=t;const{x:e,width:i}=this.viewBox;this.xScale.range([e,e+i])}heightNeeded(t){if(!this.isVisible)return 0;const e=this.view.presenter.display.chart.fontFamily,{fontWeight:i,fontSize:n}=this.config;t.save(),t.font="".concat(i," ").concat(n,"px ").concat(e);const{innerTickSize:s,tickPadding:r,indicatorPadding:o}=this.config,a=ze(t,1)+s+r+o;return t.restore(),a}getTicks(t){if(K(this.lastUsedOptions)&&(e=t.agg,i=this.lastUsedOptions.agg,e.unit===i.unit&&e.size===i.size&&e.spec===i.spec)&&t.unitWidth===this.lastUsedOptions.unitWidth&&t.barWidth===this.lastUsedOptions.barWidth&&t.extent[0]===this.lastUsedOptions.extent[0]&&t.extent[1]===this.lastUsedOptions.extent[1]&&t.formatString===this.lastUsedOptions.formatString&&t.minTickInterval===this.lastUsedOptions.minTickInterval&&K(this.ticks))return this.ticks;var e,i;this.lastUsedOptions=t;const n=function(t){switch(t.agg.unit){case u.Tick:return new $a(t);case u.Intraday:return new Ka(t,t.agg.size);case u.Day:return new Za(t);case u.Week:return new Qa(t);case u.Month:case u.Quarter:return new Ja(t);case u.Year:return new tl(t);default:throw new Error("Aggregation unit ".concat(u[t.agg.unit]," not supported."))}}(t),s=Math.max(0,t.extent[0]),r=Math.min(this.xScale.timeline.withPrologEpilogLength-1,t.extent[1]+1);return this.ticks=this.view.presenter.timeline.slice(s,r).map((t,e)=>{if(!K(t)||Number.isNaN(t.getTime()))return null;const i=n.getTick(t);return K(i)&&(i.index=s+e),i}).filter(t=>K(t)),this.ticks}normalizeDuration(t){const e=function(){const t=Object.keys(ja);return 1===ja.Day.Multipliers[0]&&t.forEach(t=>{const e=ja[t],i=ht(e.Period);e.One=1*i,e.Multipliers=e.Multipliers.map(t=>t*i)}),ja}();let i=e.Year;const n=Object.keys(e);for(let s=0;s<n.length-1;++s){const r=e[n[s]].Multipliers,o=e[n[s+1]].Multipliers,a=(V(r)+W(o))/2;if(t<=a){i=e[n[s]];break}}const s=i.Multipliers,r=s.findIndex(e=>t<e);let o=-1===r?V(s):s[r];return"P1M"===i.Period?o*=.9:"P1W"===i.Period&&(o*=.84),o}draw(t){if(!this.isVisible)return;const{xAxis:{gridLines:e,textColor:i,minTickInterval:n,tickPixelInterval:s,format:r,forceTicksVisible:o},chart:{fontFamily:a}}=this.view.presenter.display,{fontWeight:l,fontSize:c,innerTickSize:u,tickPadding:h}=this.config,{x:d,y:p,width:f}=this.viewBox,{lineWidth:m,color:g,dashStyle:y}=e,v=Re(y);t.textAlign="center",t.font="".concat(l," ").concat(c,"px ").concat(a),t.lineWidth=1,t.strokeStyle=g,t.fillStyle=i,t.setLineDash([]),Ze(t,p,d,d+f);const b=this.xScale.extent(),T=t=>!K(t)||!K(t[0],t[1]);if(T(b))return;const S=e=>t.measureText(e).width,A=s>0?s:120,P=this.xScale.domain();if(T(P))return;const w=(P[1].getTime()-P[0].getTime())*A*.6/f,C=this.normalizeDuration(w),x=this.view.presenter.data.aggregation.isEndOfDay,M=(t,e)=>{if(!K(t.date))return!0;if(i=t.date,s=e.date,(K(i)?Ua(s,i):te.FIFTY_YEARS_MILLIS)<n)return!1;var i,s;const r=e.x-t.x,o=e.date.getTime()-t.date.getTime()>=C,a=r>A;return!(t.x+t.textWidth/2>=e.x-e.textWidth/2)&&(a||!!x&&o)},E=d+f,O=({text:i,x:n,date:s,forced:r})=>{K(s)&&(r||Ke(t,n,p,p+u),t.fillText(i,n,p+u+h+.71*c),e.visible&&!r&&(t.save(),t.lineWidth=m,t.setLineDash(v),Ke(t,n,0,p),t.restore()))},D={agg:this.view.presenter.data.aggregation,unitWidth:S("M"),barWidth:this.xScale.bar.width,extent:b,formatString:r,minTickInterval:n||0,duration:w},L=this.getTicks(D);let I={date:null,priority:999,x:-999,text:null,index:-1,textWidth:0};L.forEach(t=>{t.x=this.xScale.indexToX(t.index),t.textWidth=S(t.text),(t=>{const{x:e,textWidth:i}=t;let n=e;if(o){const s=i/2;n=e-s<d?d+s:e,n=n+s>E?E-s:n,t.x=n,t.forced=e!==n}else t.forced=!1})(t),M(I,t)?(O(I),I=t):t.priority<I.priority&&(I=t)}),O(I),this.drawTimeAdornments(t)}drawTimeAdornments(t){const e=this.view.presenter,{chart:{fontFamily:i}}=e.display,n=[];this.view.presenter.allAnnotations.forEach(t=>{n.push(...t.getTimeScaleAdornments().map(t=>({x:this.xScale.timeToX(t.time),value:nl(e,t.time),color:t.color})))}),n.sort((t,e)=>t.x-e.x),n.forEach(e=>{new kp({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:te.COLOR_TRANSPARENT,textColor:"#fff",backgroundColor:e.color,arrowLength:this.config.innerTickSize}).draw(t,e.x,this.viewBox.y+1,e.value)})}drawCrosshair(t,{x:e}){const i=this.view.presenter,n=i.display.xAxis,{enabled:s,showValue:r,color:o,dashStyle:a,format:l}=n.crosshair;if(!s)return;const c=this.xScale.xToTime(e);e=this.xScale.timeToX(c);const u=Re(a);t.strokeStyle=o,t.setLineDash(u);const h=ii();if(h.prolog(t),Ke(t,h.adjust(e),0,h.adjust(this.viewBox.y)),h.epilog(t),!r||!n.visible)return;const d=K(n.format)?l:void 0,p=nl(i,c,d);this.crosshairIndicator.draw(t,e,this.viewBox.y+1,p,this.viewBox.height-2);const{plotHover:f}=i.display.chart;f&&i.allPlots.forEach(i=>i.curves.forEach(i=>i.drawHover(t,c,e)))}}const jp={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},Gp={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class zp{constructor(t){this.subscriptions=[],this.view=t}init(t){const e=$();Object.keys(jp).filter(t=>!(t=>t.startsWith("touch"))(t)||e).forEach(e=>{const i=t=>{const i=jp[e];!0===this.notifyActiveTool(i,t)&&t.preventDefault()};t.addEventListener(e,i),this.subscriptions.push(()=>{t.removeEventListener(e,i)})})}shutdown(){this.subscriptions.forEach(t=>t()),this.subscriptions=[]}notifyActiveTool(t,e){const i=this.view.presenter;if(void 0===i||null===i.activeTool)return!1;const n=this.getPayload(e,i),s=i.activeTool;let r=!1;return"function"==typeof s[t]&&(r=s[t](n)||!1),r}getPayload(t,e){const i=t instanceof MouseEvent,n=$()&&t instanceof TouchEvent;if(i||n){const s={x:0,y:0};if(n&&1===t.touches.length){const e=t.touches[0],{left:i,top:n}=t.target.getBoundingClientRect();s.x=e.clientX-i,s.y=e.clientY-n}else s.x=t.offsetX,s.y=t.offsetY;const r={button:i?t.which:A.Left,offset:s,view:e.view,presenter:e,originalEvent:t};if(t instanceof WheelEvent&&(r.delta=t.shiftKey?t.deltaX:t.deltaY),n&&2===t.touches.length){const[e,i]=t.touches;r.pinchZoom=!0;const n=e.clientX-i.clientX,s=e.clientY-i.clientY;r.pinchDistance=Math.sqrt(n*n+s*s)}return r.getModifier=e=>t[Gp[P[e]]],this.view.splitters.forEach((t,e)=>{t.contains(s)&&(r.splitter=[e,e+1])}),e.panes.forEach(t=>{if(t.getBounds().contains(s)){const e=t.axes.find(t=>t.viewBox.contains(s));if(e)r.priceAxis=e;else{const e=t.axes.find(t=>t.primary);r.point=e.toAnnotationPoint(s)}}}),r}if(t instanceof KeyboardEvent){let i={key:t.key||t.keyIdentifier,code:t.keyCode||t.charCode,repeat:t.repeat,presenter:e,getModifier:e=>t.getModifierState(P[e])};return i}}}const Yp=["style"];function qp(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function $p(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?qp(Object(i),!0).forEach((function(e){Xp(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):qp(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Xp(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Kp(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}class Zp{constructor(t){this.view=t,this.text=null,this.align="center",this.verticalAlign="top",this.x=0,this.y=0,this.style={color:"#333",fontSize:18}}update(t){let{style:e}=t,i=Kp(t,Yp);Object.assign(this,i),this.style=$p($p({},this.style),e)}read(){const t={};return Object.assign(t,this),delete t.view,t}draw(t){if(!this.text)return;const{fontFamily:e}=this.view.presenter.display.chart,{fontSize:i,color:n}=this.style,{x:s,y:r,width:o,height:a}=this.view.presenter.mainPlot.axis.pane.getBounds(),l=s+this.view.leftOffset,c=s+o-this.view.rightOffset;let u=l;u="center"===this.align?o/2:"right"===this.align?c:l;let h=r+i;"middle"===this.verticalAlign?h=r+i+a/2:"bottom"===this.verticalAlign&&(h=r+a),u+=this.x,h+=this.y,t.save(),t.font="".concat(i,"px ").concat(e),t.textAlign=this.align,t.textBaseline="bottom",t.fillStyle=n,t.fillText(this.text,u,h),t.restore()}}var Qp=i(26);const Jp=$r.concat(Wn.PercentChange);class tf{constructor(t){this.view=t,this.id="bc-legend-".concat(La()())}update(){const t=this.view.el,e=Yt(this.id,t,"div"),{left:i,right:n,top:s,width:r}=Pl(this.presenter.mainPane);Nd(e,"row",i,n,s,r),qt(e,{"bcharts-card":!0,"bcharts-legend":!0});const o=this.mainPlot.isSeasonal?this.getFirstColorBadge(this.mainPlot):"",a=this.getPlotTitle(this.mainPlot),l=this.maybeGetQuote(),c=this.div("".concat(o," ").concat(a," "))+this.div("".concat(l)),u=this.maybeGetAdditionalPlots(),h="".concat(c," ").concat(u);e.innerHTML=h}get presenter(){return this.view.presenter}get mainPlot(){return this.presenter.mainPlot}getAttributes(t){return Object.entries(t).map(([t,e])=>{if(null===e)return"";const i=Array.isArray(e)?e.join(" "):e;return"".concat(t,' = "').concat(i,'" ')}).join(" ")}span(t,e={}){return"<span ".concat(this.getAttributes(e),'}">').concat(t,"</span>")}div(t){return'<div class="plot" style="flex: 0 0 auto">'.concat(t,"</div>")}get meta(){return this.mainPlot.metaData}isSingleSymbolSeasonal(t){return t.isSeasonal&&!t.hasComputation}getQuoteFromRecord(t){const e=Jp.map(e=>t.getValue(e)),i=t=>this.span(xl(t),{class:"field-name"}),n=(t,e)=>'<span class="field-value '.concat(t,'">').concat(e,"</span>"),s=(t,e,s)=>"".concat(i(e)).concat(n(s,this.meta.format(t,e)));if(R(e)){const t=e[4],i="field-".concat(t>0?"up":t<0?"down":"same","-value"),r=e.slice(0,-1).map((t,e)=>s(t,Jp[e],i)).join(" "),o=n(i,"(".concat(this.meta.format(V(e),V(Jp)),")"));return"".concat(r," ").concat(o)}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries.record.isValid){const t=im().getRecordSource().getRecord(this.mainPlot.timeSeries.record.symbol);return this.getQuoteFromRecord(t)}if(this.mainPlot.isExpression&&this.mainPlot.record.isValid){const t=this.mainPlot.record;return t.evaluate(),this.getQuoteFromRecord(t)}return""}getTitle(t,e,i){const n=e?"value-main":null,s=this.span("".concat(t.name," (").concat(t.symbol,")"),{"data-plot-id":i,class:["value-title",n]}),r=e?" ".concat(this.span(t.exchange,{class:"value-subtitle"})):"";return"".concat(s).concat(r)}getPlotTitle(t){var e;if(t.isSymbol)return this.getTitle(t.metaData,t.main,t.id);if(this.isSingleSymbolSeasonal(t)&&0===t.offset&&(null===(e=t.symbols)||void 0===e?void 0:e.length)>0){const e=im().getMetaDataSource().getMetaData(t.symbols[0]);return this.getTitle(e,!0,t.id)}return this.span(t.title,{"data-plot-id":t.id,class:"value-title"})}getFirstColorBadge(t){return ml("rectangle",t.mainCurve.colors[0])}maybeGetAdditionalPlots(){const t=this.presenter.mainPane.axes.map(t=>t.plots).flat().filter((t,e)=>!t.main||t.isSeasonal&&e>0);return t.length>0?t.map(t=>{const e=this.getFirstColorBadge(t),i=this.getPlotTitle(t),n=t.isStudy?Sl(t.id):"";return this.div("".concat(n," ").concat(e," ").concat(i))}).join(" "):""}}const ef=globalThis.ResizeObserver||Qp.a;class nf{constructor(){this.listeners=[],this.leftOffset=0,this.rightOffset=0,this.title=new Zp(this),this.legend=new tf(this),this.draw=this.draw.bind(this)}updateLegend(){this.legend.update()}findSvgParentWithClass(t,e){return[t,t.parentElement,t.parentElement.parentElement].find(t=>K(t)&&t.className===e)}onNonToolHandledMouseDown({target:t}){const e=this.presenter;if("string"==typeof t.className&&t.className.split(" ").includes("value-title"))e.onCardClicked(t);else{const i=this.findSvgParentWithClass(t,"move-pane");if(K(i))return void e.onMovePaneClicked(i);const n=this.findSvgParentWithClass(t,"delete-plot");K(n)&&e.deletePlotClicked(n)}}initialize(t){this.presenter=t,this.el=this.presenter.hostElement;const e=new ef(t=>{for(let e of t){const{width:t,height:i}=e.contentRect;this.setSize(t,i),K(this.tooltip)&&this.tooltip.repositionAuto()}});e.observe(this.el.parentElement),this.listeners.push(()=>e.unobserve(this.el.parentElement));const i=t=>this.onNonToolHandledMouseDown(t);this.el.addEventListener("mousedown",i),this.listeners.push(()=>this.el.removeEventListener("mousedown",i)),Gt(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new _d(this),this.customEventPopup=new sf(this);const{clientHeight:n,clientWidth:s}=this.el;this.width=s,this.height=n,this.canvasContainer=$t(this.el,"div"),zt(this.canvasContainer,{class:"chart-canvas-container"}),Gt(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=$t(this.canvasContainer,"canvas");const r={height:"".concat(n,"px"),width:"".concat(s,"px"),"z-index":2,position:"absolute",top:0,left:0};Gt(this.mainCanvas,r),this.mouseCanvas=$t(this.canvasContainer,"canvas"),zt(this.mouseCanvas,{tabIndex:0}),r["z-index"]=3,r.outline="none",Gt(this.mouseCanvas,r),this.goToLatestButton=$t(this.el,"button"),Kt(this.goToLatestButton,'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n <path d="M13.707 17.707l5-5c0.391-0.391 0.391-1.024 0-1.414l-5-5c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l4.293 4.293-4.293 4.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0zM6.707 17.707l5-5c0.391-0.391 0.391-1.024 0-1.414l-5-5c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l4.293 4.293-4.293 4.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0z"></path>\n </svg>'),Gt(this.goToLatestButton,{position:"absolute",right:0,bottom:0,zIndex:3}),zt(this.goToLatestButton,{class:"go-to-latest"}),this.goToLatestButton.onclick=()=>{this.xAxis.goToLatest()},this.listeners.push(()=>{this.goToLatestButton.onclick=null}),this.mainContext=this.mainCanvas.getContext("2d"),this.mouseContext=this.mouseCanvas.getContext("2d"),this.splitters=[],this.xAxis=new Wp(this),this.eventCapture=new zp(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(s,n),K(jt(".".concat(te.SVG_ICONS_DOM_NODE)))||function(){const t=$t(document.body,"div");zt(t,{class:te.SVG_ICONS_DOM_NODE});const e=Object.keys(ul).map(t=>'<symbol id="'.concat(fl(t),'" viewBox="0 0 24 24">').concat(ul[t],"</symbol>")).join("");t.innerHTML='<svg style="display:none" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>'.concat(e,"</defs></svg>")}()}reinitialize(){this.el&&Xt(".bcharts-card",this.el).forEach(t=>t.remove()),this.customEventPopup.hide(),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.xAxis=new Wp(this),this.recalculateLayout(),this.redraw()}setSize(t,e,i=!1){this.setChartSize(t,e),this.redraw(i)}setChartSize(t,e){const i={width:"".concat(t,"px"),height:"".concat(e,"px")};Gt(this.el,i),this.width=t,this.height=e;const n=globalThis.devicePixelRatio||1,s={height:this.height*n,width:this.width*n};[this.mainCanvas,this.mouseCanvas].forEach(t=>{zt(t,s),Gt(t,i)}),this.mainContext.scale(n,n),this.mouseContext.scale(n,n),this.recalculateLayout()}widthNeeded(t,e){return Math.max(...this.presenter.allAxes.filter(t=>t.primary===e).map(e=>e.widthNeeded(t)))}recalculateLayout(){if(!this.isHostElementVisible)return;this.leftOffset=0,this.rightOffset=0,this.presenter.allAxes.forEach(t=>t.clearTicks()),this.splitters.length=0;const t=this.xAxis.heightNeeded(this.mainContext),e=this.widthNeeded(this.mainContext,!0),i=this.height-t,n=this.presenter.panes;let s=_(n.map(t=>t.height)),r=0;const o=te.PANE_SPLITTER_PERCENT_HEIGHT/100,a=Math.floor(o*i);if(s*=1+(n.length-1)*o,this.presenter.display.yAxis.visible){n.some(t=>t.axes.length>1)&&(this.leftOffset=this.widthNeeded(this.mainContext,!1)),this.rightOffset=e}n.forEach((t,n,o)=>{const l=n===o.length-1,c=Math.floor(i*t.height/s),u=new je(0,r,this.width,c);t.setViewBox(u);const h=new je(this.width-this.rightOffset,r,e,c);t.axes[0].setViewBox(h);const d=t.axes[1];if(d){const t=new je(0,r,this.leftOffset,c);d.setViewBox(t)}if(r+=c,!l){const t=new je(this.leftOffset,r,this.width-this.rightOffset-this.leftOffset,a);this.splitters.push(t),r+=a}});const l=new je(this.leftOffset,r,this.width-this.rightOffset-this.leftOffset,t);this.xAxis.setViewBox(l),Gt(this.goToLatestButton,{right:"".concat(e+5,"px"),bottom:"".concat(t+5,"px")}),this.presenter.hasLegend&&this.legend.update(),this.xAxis.setDomain(),this.setPriceAxesDomains()}setPriceAxesDomains(){this.presenter.allAxes.forEach(t=>{t.setDomain(),t.updateFullDomain()})}draw(){this.mainContext.save(),this.mainContext.miterLimit=1,this.drawBackground(this.mainContext),this.xAxis.draw(this.mainContext);for(let t of this.presenter.panes)t.draw(this.mainContext);this.drawSplitters(this.mainContext),this.title.draw(this.mainContext);const t=im().config.showGoToLatest,{showGoToLatest:e}=this.presenter.display.chart,i=K(t)?t:e;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return K(this.el)&&K(this.el.offsetParent)}redraw(t=!1){this.isHostElementVisible&&(t?this.draw():im().redraw(this.presenter.renderTo))}drawBackground(t){const e=this.presenter.display.chart.backgroundColor;t.clearRect(0,0,this.width,this.height),t.fillStyle=e,t.fillRect(0,0,this.width,this.height)}drawCrosshair({ap:t,offset:e}){const i=this.mouseContext;i.clearRect(0,0,this.width,this.height),t&&(this.xAxis.drawCrosshair(i,e),this.presenter.display.yAxis.visible&&t.axis.pane.drawYCrosshair(i,e))}drawSplitters(t){const e=(t=>{const e=Be(t);return Ve(He(function({r:t,g:e,b:i,a:n}){return{r:255-t,g:255-e,b:255-i,a:n}}(e),e,.7))})(this.presenter.display.chart.backgroundColor);t.stokeStyle=e,t.lineWidth=2,this.splitters.forEach(e=>{const{x:i,y:n,width:s,height:r}=e,o=n+r/2;t.beginPath(),t.moveTo(i,o),t.lineTo(i+s,o),t.stroke()})}toTime(t){return this.xAxis.xScale.xToTime(t)}toIndex(t){return this.xAxis.xScale.timeToIndex(t)}toX(t){return this.xAxis.xScale.timeToX(t)}setCursor(t){const e=function(t){switch(t){case S.Arrow:default:return"default";case S.Crosshair:return"crosshair";case S.Hand:return"pointer";case S.Move:return"move";case S.ResizeVertical:return"ns-resize";case S.Grabbing:return"grabbing"}}(t);Gt(this.el,{cursor:e})}shutdown(){this.listeners.forEach(t=>t()),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&Xt(".bcharts-card",this.el).forEach(t=>t.remove()),this.canvasContainer.remove()}getEventRadius(){const t=this.xAxis.xScale.bar.width/2;return Math.max(t,te.MIN_EVENT_RADIUS)}}class sf{constructor(t){this.view=t,this.date=null,this.value=null,this.visible=!1}construct(){this.popupElem=$t(this.view.el,"div"),zt(this.popupElem,{id:"".concat(this.view.presenter.elementId,"-custom-event-host")}),Gt(this.popupElem,{visibility:"hidden",position:"absolute",zIndex:30,top:"0px",left:"0px",padding:"5px 10px 10px 10px",display:"flex","flex-direction":"column",background:"var(--chartPopupElemBg, #999)",boxShadow:"0px 2px 10px rgba(0,0,0,.3)",borderRadius:"4px",border:"1px solid var(--chartPopupElemBorderColor, #888)",maxHeight:"400px",overflow:"auto"});const t=$t(this.popupElem,"a");Gt(t,{position:"absolute",right:"10px",top:"5px",fill:"var(--text-color,#888)",cursor:"pointer"}),t.innerHTML='<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="12px" height="12px"><use xlink:href="#bchart-icon-delete"></use></svg>',t.addEventListener("click",t=>this.hide()),this.news=$t(this.popupElem,"div"),this.news.innerHTML='<h3>Precious Metals Move Higher On Lower Global Bond Yields And A Slump In Stocks<h3>\n <i style="font-size:9px;">Rich Asplund - Barchart - 17 minutes ago</i><div style="font-size:10px;font-weight:400">\n <p>June gold (GCM21) this morning is up +4.50 (+0.26%), and May silver (SIK21) is up +0.018 (+0.07%).</p>\n <p>Gold and silver prices this morning are slightly higher on slumping stocks and falling global bond yields. Gains in gold were limited by a stronger dollar and the upside in silver was contained by concern a resurgence in the pandemic will lead to tighter pandemic restrictions that curb industrial metals demand.</p>\n <p>Lower global bond yields today are a bullish factor for gold prices. The 10-year T-note yield is down -4.8 np today to 1.557%, and the 10-year German bund yield is down -2.9 bp to -0.263%.</p></div>',Gt(this.news,{display:"none"}),this.video=$t(this.popupElem,"video"),zt(this.video,{controls:!0,width:290}),Gt(this.video,{display:"none",marginTop:"20px"}),this.source=$t(this.video,"source"),zt(this.source,{type:"video/mp4",src:"https://s3.amazonaws.com/videos1.aws.barchart.com/barchart.com/education/add-studies.mp4"})}show(t,e,i){this.source||this.construct(),this.date=e;const n=i.startsWith("__video");this.value!==i&&(this.value=i,Gt(n?this.video:this.news,{display:"block"}),Gt(n?this.news:this.video,{display:"none"})),Gt(this.popupElem,{visibility:"visible",top:"".concat(t.y,"px"),left:"".concat(t.x,"px"),width:"310px"}),this.visible=!0}hide(){this.video&&(this.video.pause(),Gt(this.popupElem,{visibility:"hidden"}),this.visible=!1)}}function rf(t,e){if(!((i=t).annotations&&i.annotations.length>0))return;var i;let n=e.annotations||[];e.annotations=n.concat(t.annotations)}class of{constructor(t){this.accessor=t,this.defaultTool=Cp("Default"),this._activeTool=this.defaultTool,this.tooltipEnabled=!0,this.timeline=new cl(this),this.sentInitialLoadNotification=!1,this._hostElement=null}getModel(){return this.model}get isEmpty(){return!K(this.model)}fromModel(t){K(this.model)&&this.allPlots.forEach(t=>t.shutdown()),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=t;let e=et(t);this.data=e.data,this.data.aggregation=qi(e.data.aggregation),this.display=e.display,K(this.display.period)&&(this.display.period=ht(this.display.period)),this.panes=e.panes.map(t=>{const e=new Up;return e.presenter=this,e.fromModel(t),e},this),this.allPlots.forEach(t=>t.initialize()),this.timeline.invalidate(),this.reinitializeView()}closeView(){K(this.view)&&(this.view.shutdown(),this.view=null)}reinitializeView(){K(this.view)?this.view.reinitialize():(this.view=new nf,this.view.initialize(this)),ya.a.publish(jn.CH_RECREATED,this.accessor.elementId)}getCacheableEntities(t){this.isEmpty||this.allPlots.map(e=>e.getCacheableEntities(t))}get activeTool(){return this._activeTool}set activeTool(t){K(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=t,K(this._activeTool.activated)&&this._activeTool.activated(this),ya.a.publish(jn.TL_CHANGED,this)}get mainPlot(){return this.allPlots.find(t=>t.main)}get mainAxis(){return this.mainPlot.axis}get mainPane(){return this.mainAxis.pane}get allAxes(){const t=[];return this.panes.forEach(e=>{e.axes.forEach(e=>{t.push(e)})}),t}get allAnnotations(){const t=[];return this.allAxes.forEach(e=>{e.annotations.forEach(e=>{t.push(e)})}),t}get allPlots(){const t=[];return this.allAxes.forEach(e=>{e.plots.forEach(e=>{t.push(e)})}),t}findAxis(t){return this.allAxes.find(e=>e.id===t)}findPlot(t){return this.allPlots.find(e=>e.id===t)}get allCurves(){const t=[];return this.allPlots.forEach(e=>{e.curves.forEach(e=>{t.push(e)})}),t}findCurve(t){return this.allCurves.find(e=>e.id===t)}fixupDensityForForwards(t){if(t.hasData){const e=t.container.size;e>0&&(this.display.density=e)}}onSeriesChanged(t,e){if(!this.view||!this.allPlots)return;const i=e.series,n=t=>t.timeSeries===i||t.eventsSeries===i,s=this.allPlots.find(n);if(!K(s))return;const r=K(s)&&s.main;let o=!1,a=!1;const l=K(e.index)?i.container.getTimeData()[e.index]:null,c=t===jn.TS_EVENTSCHANGED,u=this.view.xAxis.xScale;if(t===jn.TS_MANYCHANGED||c){if(r&&this.data.checkRange){if(K(this.display.xAxis.visibleRange))return void this.accessor.change({id:"Period",context:{range:this.display.xAxis.visibleRange}});delete this.data.checkRange}if(s.type===v.Forward&&this.fixupDensityForForwards(i),e.part===x.Tail){const t=G(this.timeline,l,Number,ll);this.view.xAxis.shouldScrollIntoView(t)&&u.shiftBars(e.count)}this.timeline.invalidate(),o=!0}else if(t===jn.TS_DATAPOINTADDED){const t=this.timeline.mergeDateIntoTimeline(l);-1!=t&&this.view.xAxis.shouldScrollIntoView(t)?(u.shiftBars(1),o=!0):a=!0}else t===jn.TS_DATAPOINTCHANGED&&(a=!0);if(!c&&n(this.mainPlot)&&i.hasData&&0===i.container.size&&ya.a.publish(jn.CH_NODATAFORMAINSYMBOL,this.accessor),o&&this.view.recalculateLayout(),a){o&&Kf("Performance : redundant call to recompute price domains (layout recalculation took care of this)","warn");this.allAxes.filter(t=>t.plots.includes(s)).forEach(t=>{t.setDomain(),K(l)&&t.updateFullDomain(l)})}if(!this.sentInitialLoadNotification&&t===jn.TS_MANYCHANGED){if(this.allPlots.every(t=>t.timeSeries&&t.timeSeries.hasData)){this.sentInitialLoadNotification=!0,ya.a.publish(jn.CH_ALL_DATA_PROJECTED,this.accessor);const t=this.display.period===te.FIFTY_YEARS_MILLIS;this.mainPlot&&(this.mainPlot.isAnnual||t)&&(u.fitAllData=!0,u.adjustDomain())}}this.view.redraw()}onMetaChanged(t,e){t===jn.MD_CHANGED&&this.view&&this.allPlots&&this.allPlots.find(t=>t.id===e.plot.id)&&(this.view.recalculateLayout(),this.view.redraw())}get previousMask(){return K(this._previousMask)||(this._previousMask=zn(Wn.PreviousClose)),this._previousMask}hasMatch(t,e){return t.some(t=>t.updated&&e)}get hasLegend(){return K(this._hasLegend)||(this._hasLegend=im().config.mode===C[C.cmdtyView]),this._hasLegend}onStreamingUpdates(t){K(this.view)&&(this.mainPlot.showPrevious&&this.hasMatch(t,this.previousMask)&&this.view.redraw(),this.hasLegend&&this.hasMatch(t,this.ohlcMask)&&this.view.updateLegend())}get ohlcMask(){return K(this._ohlcMask)||(this._ohlcMask=zn(Wn.Open,Wn.High,Wn.Low,Wn.Close,Wn.PreviousClose)),this._ohlcMask}updateMatches(t,e){if(0==(t&this.ohlcMask))return!1;const i=(t,e)=>t.isValid&&t.hasSymbol(e);return this.mainPlot.isSymbol?i(this.mainPlot.timeSeries.record,e):!!this.mainPlot.isExpression&&i(this.mainPlot.record,e)}getStreamingSubscription(){return im().getRecordSource().subject.pipe(va(t=>t.filter(t=>this.updateMatches(t.updated,t.data.symbol))),Bs(t=>t.length>0)).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return K(this._hostElement)?this._hostElement.id:null}initialize(t){if(this._hostElement=t instanceof HTMLElement?t:jt("#".concat(t)),!this._hostElement)throw new Error("There is no element ".concat(t," in the DOM"));this.renderTo=t,this.seriesChangedToken=ya.a.subscribe(jn.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=ya.a.subscribe(jn.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return ya.a.unsubscribe(this.seriesChangedToken),ya.a.unsubscribe(this.metaChangedToken),K(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach(t=>t.shutdown()),this.model=null,this.closeView(),ya.a.publish(jn.CH_SHUTDOWN,this.accessor.elementId),!0}fireSelectionChanged(){ya.a.publish(jn.CH_ANNSELECTIONCHANGED,this)}setSelection(t){this.selectedAnnotation=t,this.selectedAnnotation.isSelected=!0,this.selectedAnnotation.requestRedraw(),this.fireSelectionChanged()}clearSelection(){K(this.selectedAnnotation)&&(this.selectedAnnotation.isSelected=!1,this.selectedAnnotation.requestRedraw(),this.selectedAnnotation=void 0),this.fireSelectionChanged()}resetActiveTool(){this.activeTool=this.defaultTool}print(t={}){const e=$t(document.body,"iframe");e.src="",e.style.display="none",e.onload=()=>{const{title:i}=t,n=this.exportImage({title:i}),s=new Image;s.src=n.data,s.style.width="100%";e.contentDocument.body.appendChild(s),Zt(s).then(()=>{const t=e.contentWindow;e.focus(),t.print(),e.remove()})}}setTitle(t,e=!1){this.view.title.update(t),this.view.redraw(e)}enableTooltip(t){this.tooltipEnabled=t;const e=this.display.tooltip.mode===te.TOOLTIP_CARDS;!t&&e&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(){const t=this.display.tooltip;t.visible&&t.mode===te.TOOLTIP_CARDS&&Xt(".bcharts-card",this.hostElement).forEach(t=>{t.classList.contains("bcharts-legend")||(t.style.display="none")})}handleAnnotationChange(t){if("List"===t.id)return this.allAnnotations.map(t=>({id:t.name,uid:t.id,visible:t.visible}));const e=this.allAnnotations.find(e=>e.id===t.uid);if(void 0!==e){const i=e.axis,n=i["".concat(t.id.toLowerCase(),"Annotation")];if("function"==typeof n)return void n.call(i,e,t)}throw new Error("Unknown sub-action ".concat(t.id," for action ").concat(te.ANN_ACTION_ID))}getPlotInfoFromDomId(t){const e=t.attributes["data-plot-id"].value,i=this.allPlots,n=i.findIndex(t=>t.id===e);return{type:v[i[n].type],index:n}}getSimplePlot(t,e){return this.accessor.change({id:"Plot",context:{id:te.ACTION_GET,type:t,index:e}})[0]}onCardClicked(t){const e=this.getPlotInfoFromDomId(t),i=this.getSimplePlot(e.type,e.index);ya.a.publish(jn.CH_CARDPLOTCLICKED,{chart:this.accessor,plot:i})}deletePlotClicked(t){const e=this.getPlotInfoFromDomId(t),i=this.getSimplePlot(e.type,e.index);this.accessor.change({id:"Plot",context:{id:"Delete",type:e.type,index:e.index}}),ya.a.publish(jn.CH_CARDPLOTREMOVED,{chart:this.accessor,plot:i})}onMovePaneClicked(t){const e=parseInt(t.attributes["data-pane"].value),i="down"===t.attributes["data-dir"].value,n=e+(i?1:0),s=e-(i?0:1);setTimeout(()=>{this.accessor.change({id:"MovePane",context:{from:n,to:s}}),ya.a.publish(jn.CH_PANESREORDERED,this.accessor)})}onAnnotationsUpdated(t,e=!1){const i=this.allAxes.indexOf(t),n=t.annotations.map(t=>t.toModel());let s=function(t,e){const i="..axes[".concat(e.axisIndex,"]");return _i(t,i,t=>(t.annotations=e.annotations,t))}(this.model,{axisIndex:i,annotations:n});try{this.model=Hn(s,te.CHART_SCHEMA)}catch(t){Kf("Cannot update annotation (corrupts definition), error is: ".concat(t.message),"error")}e&&this.view.draw(),ya.a.publish(jn.CH_ANNOTATIONCHANGED,this.accessor)}onPaneHeightsUpdated(){const t=this.panes.map((t,e)=>({index:e,relativeHeight:t.height}));this.model=function(t,{paneHeights:e}){let i=t;return e.forEach(t=>{var e;i=_i(i,(e=t.index,"..panes[".concat(e,"]")),e=>(e.height=t.relativeHeight,e))}),i}(this.model,{paneHeights:t}),ya.a.publish(jn.CH_PANEHEIGHTSCHANGED,this.accessor)}exportData(t={excludeHeader:!1,numDecimals:null,excludeFields:[]}){const e=this.allPlots;if(!e.every(t=>K(t.timeSeries)&&t.timeSeries.hasData))return"No data to export";const{excludeHeader:i,numDecimals:n,excludeFields:s}=t,r=t=>{const e=new Set;t.main&&(e.add(Wn.DateTime),this.data.aggregation.isMultiContract&&e.add(Wn.Symbol));return t.curves.map(t=>t.fields.filter(t=>!s.includes(t.id))).flat().forEach(t=>e.add(t)),Array.from(e)},o=this.data.aggregation.isEndOfDay?te.FMT_ISO_DATE_ONLY:te.FMT_EXPORT_ALL_BUT_MILLIS,a=(t,e)=>t===Wn.DateTime?kr(e,o):(t=>K(n,t)?Z(t,n):t)(e),l={},c=this.timeline.firstSeriesIndex,u=this.timeline.lastSeriesIndex,h=(t,i)=>{const n=t-c,s=t=>{if(-2===n){const e=new Array(r(t).length).fill("");return e[0]=(t=>'"'.concat(v[t.type],": ").concat(t.title,'"'))(t),e.join(",")}if(-1===n)return r(t).map(t=>'"'.concat(t.name,'"'));{const e=t.timeSeries.container,n=e.getData(Wn.DateTime),s=l[t.id]||0,o=G(n,+i,Number,j,s),c=+i==+n[o];return c&&(l[t.id]=o),r(t).map(t=>c?a(t,e.getData(t)[o]):"")}};return[].concat(...e.map(t=>s(t))).join(",")};let d=[];for(let t=c-(i?0:2);t<=u;t++)d.push([h(t,this.timeline.at(t))]);return d.join("\n")}exportImage(t={}){const{width:e,height:i,mainCanvas:n}=this.view,{width:s,height:r,title:o}=t,a=K(o),l=K(s,r);let c=a?this.view.title.read():null;a&&this.setTitle(o,!l),l&&this.view.setSize(s,r,!0);const u=n.toDataURL();return a&&this.setTitle(c,!l),l&&this.view.setSize(e,i,!0),{width:s||e,height:r||i,data:u}}getDataStats(){const t=this.mainPlot.timeSeries.container;if(!K(t)||0===t.size)return null;const e=t.getTimeData();return{dataRange:{from:W(e).getTime(),to:V(e).getTime()},barCount:t.size}}}var af=function(t,e){if(0===e.plots.length)return t;let i=t;return e.plots.forEach(t=>{let e=uf(t.index);const n=hf(i,e);K(n)&&n.type===t.type&&(i=_i(i,e,t=>(t.MARKED_FOR_DELETION=!0,t)))}),i=_i(i,"..plots{.".concat("MARKED_FOR_DELETION"," === true}"),t=>te.NULL_OBJECT),Fn(i)};var lf=function(t,{main:e,type:i,index:n},s){const r=Ii(t,"..panes").map((t,e)=>{const i=1===Ii(t,"..plots{.main === true}").length;return Ii(t,"..axes").map((t,n)=>{const r=1===Ii(t,"..plots{.main === true}").length;return Ii(t,"..plots").map(t=>{const o=function(t,e,i,n){const s=v[t.type];let r={curves:et(t.curves),type:t.type};const o=(t,e)=>{K(t[e])?r[e]=t[e].map(t=>et(t)):r[e]=[]},a=(t,e)=>{!0===e.main&&(t.main=!0)};switch(s){case v.Symbol:r.title=t.symbol,r.curves[0].style===c[c.Renko]&&(o(t,"inputs"),0===r.inputs.length&&(r.inputs=et(te.DEFAULT_RENKO_INPUTS))),a(r,t);break;case v.Study:{o(t,"inputs");const n=xi(t.study),s=r.inputs,a=0===s.length?"":" (".concat(s.map(t=>t.value).join(", "),")"),l=r.curves.map(t=>Number(t.shift)).filter(t=>t>0),c=0===l.length?"":" [".concat(l.join(", "),"]");r.title="".concat(n.id).concat(a).concat(c),r.studyId=n.id,o(t,"levels"),o(t,"bands"),r.placement=e?i?"overlay":"withMain":"standalone";break}case v.BalanceSheet:case v.IncomeStatement:{const e=Wn[t.curves[0].fields[0]];r.title="".concat(e.name," (").concat(t.fundamental.substring(0,1),")"),r.fundamentalId=e.id,r.frequency=t.fundamental;break}case v.Expression:r.title=t.expression,a(r,t);break;case v.Forward:case v.Seasonal:r.title=s===v.Forward?t.forward:t.seasonal,K(n)&&(r.subtitles=n.allPlots.filter(t=>t.type===s).map(t=>t.title)),o(t,"offsets"),a(r,t);break;default:throw new Error("Unexpected plot type")}return r}(t,i,r,s);return o.paneIndex=e,o.axisIndex=n,o})})}).flat(2).map((t,e)=>(t.index=e,t));if(e)return r.filter(t=>t.main);if(K(i)){const t=r.filter(t=>t.type===i);return K(n)?t.filter(t=>t.index===n):t}return r};function cf(t,e){!function(t){const e=v[t.type];return e===v.Forward||e===v.Seasonal}(t)?function(t,e){if(i=e,void 0!==i&&e.length===t.length)for(let i=0;i<t.length;++i){nt(t[i],e[i]);const n=e[i].shift;K(n)&&(t[i].shift=n)}var i}(t.curves,e.curves):K(e.curves)&&(t.curves=e.curves);const i=v[e.type];i===v.Study?(!function(t,e,i){const n=rt(t),s=rt(e);nt(n,s);const r=(o=s,Object.keys(o).map(t=>({name:t,value:o[t]})));var o;r.length>0&&(i.inputs=r)}(t.inputs,e.inputs,t),["bands","levels","detachedScale"].forEach(i=>function(t,e,i){e[i]&&(t[i]=e[i])}(t,e,i))):i!==v.BalanceSheet&&i!==v.IncomeStatement||!e.frequency?i===v.Expression?K(e.expression)&&(t.expression=e.expression):i===v.Forward?(K(e.offsets)&&(t.offsets=e.offsets),K(e.forward)&&(t.forward=e.forward)):i===v.Seasonal&&(K(e.offsets)&&(t.offsets=e.offsets),K(e.seasonal)&&(t.seasonal=e.seasonal)):t.fundamental=e.frequency}const uf=t=>"..plots[".concat(t,"]");function hf(t,e){const i=Ii(t,e);return 1!==i.length?null:i[0]}const df=["withMain","overlay","standalone","clone"];function pf(t,e,i){let n=null;const{mainPane:s,mainAxis:r}=Pn(t);switch(e){case"withMain":n=Sf(s,r);break;case"overlay":n=r;break;case"standalone":{n={plots:[]};const e={axes:[],height:t.display.chart.newPaneHeight};e.axes.push(n),t.panes.push(e);break}case"clone":if("number"==typeof i){const e={main:!1,index:i,type:v[v.Study]},s=lf(t,e).find(t=>t.index===e.index);n=Ii(t,"..panes[".concat(s.paneIndex,"]..axes[").concat(s.axisIndex,"]"))[0]}}return n}const ff=[{fields:[Wn.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];let mf=0;const gf=["#0d223a","#8abc21","#910000","#2f7ed8"],yf="Symbol",vf="Expression";function bf(t,e){let i={curves:[{colors:gf.slice(mf,mf+1),fields:t?[Wn.Last.id]:[Wn.Close.id],style:"Line",varyColorPerBar:!1,lineWidth:2}]};return delete e.leftScale,st(i,e),K(e.curves)&&nt(i.curves,e.curves),mf+=1,i}const Tf='..plots{.type === "Symbol" && .main !== true}';function Sf(t,e){let i=t.axes.find(t=>t!==e);return K(i)||(i={plots:[]},t.axes.push(i)),i}const Af=()=>te.NULL_OBJECT;function Pf(t){return _i(t,"..annotations",Af)}function wf(t){return Fn(_i(t,'..plots{.type === "Symbol" && .main !== true}',Af))}function Cf(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function xf(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Cf(Object(i),!0).forEach((function(e){Mf(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Cf(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Mf(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}let Ef={Symbol:Ln,MainPlot:Ln,Aggregation:function(t,e){let i=qi(t.data.aggregation).isTick,n=qi(e).isTick,s=_i(t,"".concat(Sn,".curves[0]"),t=>{let e=[Wn.Open.id,Wn.High.id,Wn.Low.id,Wn.Close.id,Wn.Change.id].slice();if(!n&&i){const i=im().getDefaultMultiFieldCurve();if(null!==i)return i;t.fields=e,t.style!==c[c.Candlestick]&&t.style!==c[c.OHLC]&&t.style!==c[c.HLC]&&(t.style=c[c.Candlestick],t.colors=["#ff6961","#77dd77"],t.varyColorPerBar=!0),t.style===c[c.HLC]&&t.fields.splice(0,1)}else n&&!i&&(t.fields=[Wn.Last.id,Wn.Change.id],t.style=c[c.Line],t.colors=["#0055cc"],t.varyColorPerBar=!1);return t});return s=_i(s,'..plots{.type === "Study" && .study === "VOL"}.curves{.fields === "TradeSize" || .fields === "Volume"}',t=>(t.fields=n?[Wn.TradeSize.id]:[Wn.Volume.id],t)),lt(s.data.aggregation,e),nn(s),en(s),function(t){const e=im().getDefaultDensity();K(e)&&(t.display.density=e)}(s),tn(s),s},Period:function(t,e,i){const n=K(e.period),s=K(e.range),r=K(e.density),o=t=>t?1:0;if(o(n)+o(s)+o(r)>1)throw new Error("Cannot set more than one of: period, range, density.");if(n&&(t.display.period=e.period,en(t),sn(t)),s)if(K(t.display.period)&&!In(t.display.period)||(t.display.xAxis.visibleRange=e.range),nn(t),sn(t),K(i)){const n=function(t){const e=t.getDataStats();return null===e?null:e.dataRange}(i),s=qi(t.data.aggregation),r=i.data.aggregation,o=(l=r,(a=s).unit!==l.unit||a.size!==l.size||a.spec!==l.spec||!K(n));let c=o;if(!o){const{from:t,to:i}=n,{from:s,to:r}=e.range;c=s<t||s>i||r<t||r>i}c&&(t.data.range=e.range),delete t.data.checkRange}else t.data.checkRange=!0;var a,l;return r&&(t.display.density=e.density,en(t),nn(t),i&&(i.hasUserCustomizedRange=!1)),(n||s||r)&&tn(t),t},Crosshair:function(t,e){let[i,n]=J(e.crosshair);const{color:s,dashStyle:r}=e.horizontal||{},{color:o,dashStyle:a}=e.vertical||{},l=(t,e,i)=>{e&&(t.color=e),i&&(t.dashStyle=i)};let c=_i(t,".display.xAxis.crosshair",t=>(t.enabled=i,l(t,o,a),t));return _i(c,".display.yAxis.crosshair",t=>(t.enabled=n,l(t,s,r),t))},Tooltip:function(t,{visible:e,mode:i}){return _i(t,".display.tooltip",t=>(null!=e&&(t.visible=e),i&&(t.mode=i),t))},Events:function(t,e){return _i(t,Sn,t=>{if("Symbol"===t.type){if(!te.EVENTS.some(t=>!0===e[t]))return void 0!==t.events&&delete t.events,t;t.events=t.events||{},te.EVENTS.forEach(i=>{((t,e,i)=>{t[e]=t[e]||{},t[e].show=i})(t.events,i,e[i]||!1)})}return t})},Scale:function(t,e){let i=_i(t,"..panes[0]..axes",t=>(y.hasOwnProperty(e.scale)&&(t.scale=e.scale),t));i=_i(i,".display.xAxis",t=>(K(e.marginBars)&&(t.marginBars=e.marginBars),t));return i=_i(i,".display.yAxis",t=>((K(e.minPadding)||K(e.maxPadding))&&Kf("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn"),K(e.preventLabelOverlap)&&(t.preventLabelOverlap=e.preventLabelOverlap),K(e.snapAnnotationsToPrices)&&(t.snapAnnotationsToPrices=e.snapAnnotationsToPrices),t)),i},Other:{Update:function(t,e){let i=t;if(K(e.comparisonMode)&&"string"==typeof e.comparisonMode&&g.hasOwnProperty(e.comparisonMode)&&(i=_i(t,"..panes{".concat(Sn,"}.axes"),t=>(t.comparison=e.comparisonMode,t)),e.comparisonMode!==g[g.None]&&(i=_i(i,"..panes{".concat(Sn,'}..plots{.type === "Symbol"}.curves{.style !== "Line"}'),t=>an({style:"Line"},"Symbol")))),K(e.gridLines)){const[t,n]=J(e.gridLines);i=_i(i,".display.xAxis.gridLines",e=>(e.visible=t,e)),i=_i(i,".display.yAxis.gridLines",t=>(t.visible=n,t))}if(K(e.minorGridLines)){const[,t]=J(e.minorGridLines);i=_i(i,".display.yAxis.minorGridLines",e=>(e.visible=t,e))}return K(e.newPaneHeight)&&"number"==typeof e.newPaneHeight&&(i=_i(i,".display.chart{.newPaneHeight > 0}",t=>(t.newPaneHeight=e.newPaneHeight,t))),K(e.showNavigator)&&"boolean"==typeof e.showNavigator&&(i=_i(t,".display.scrollbar",t=>(t.visible=e.showNavigator,t))),K(e.plotHover)&&"boolean"==typeof e.plotHover&&(i=_i(t,".display.chart",t=>(t.plotHover=e.plotHover,t))),K(e.showLastValue)&&"string"==typeof e.showLastValue&&(i=_i(t,".display.yAxis",t=>(t.showLastValue=e.showLastValue,t))),K(e.showMinMaxArc)&&"boolean"==typeof e.showMinMaxArc&&(i=_i(t,".display.chart",t=>(t.showMinMaxArc=e.showMinMaxArc,t))),K(e.showGoToLatest)&&"boolean"==typeof e.showGoToLatest&&(i=_i(t,".display.chart",t=>(t.showGoToLatest=e.showGoToLatest,t))),i},Get:function(t,e,i){const n=Ii(t,"..panes{".concat(Sn,"}.axes.comparison"))[0],s=t.display,r=(t,e)=>tt(t,!1,e,"visible"),o=t=>function(t,e){const i=t=>K(t)&&"boolean"==typeof t&&t,n=i(t),s=i(e);return n&&s?"both":n?"vertical":s?"horizontal":"none"}(r(s.xAxis,t),r(s.yAxis,t));return{comparison:n,gridLines:o("gridLines"),minorGridLines:o("minorGridLines"),newPaneHeight:s.chart.newPaneHeight,showLastValue:s.yAxis.showLastValue}}},Plot:{Add:function(t,e){switch(v[e.type]){case v.Study:return function(t,e){const i=xi(e.studyId);if(void 0===i)throw new Error("Unknown study with id ".concat(e.studyId));const n=An(t),s=Mi(i);if(n.type===v[v.Expression]&&s)throw new Error('Cannot add study "'.concat(i.meta.title,'" because it cannot be based on an expression (current main plot); study needs more than "OHLC" fields to be calculated.'));const r=e.placement||(i.meta.overlay?"overlay":"standalone");let o={type:v[v.Study],study:e.studyId};void 0!==e.curves&&(o.curves=i.defaults.curves),cf(o,e);const a=pf(t,r,e.cloneIndex);return K(a)&&a.plots.push(o),t}(t,e);case v.IncomeStatement:case v.BalanceSheet:return function(t,e){const i=An(t);if(i.type!==v[v.Symbol])throw new Error("Cannot add fundamental to the chart whose main plot is not a Symbol plot.");let n=i.symbol,s={curves:[{fields:[e.fundamentalId],lineWidth:2,style:"Line",varyColorPerBar:!1,visible:!0,colors:["#888"]}],fundamental:u[u.Quarter],symbol:n,type:f[Wn[e.fundamentalId].category]};return cf(s,e),t.panes.push({axes:[{plots:[s]}]}),t}(t,e);case v.Expression:return function(t,e){const i=An(t);let n={curves:v[i.type]===v.Symbol?et(i.curves):ff,expression:"",type:v[v.Expression]};return cf(n,e),t.panes.push({axes:[{plots:[n]}]}),t}(t,e);default:throw new Error("Only fundamentals, studies and expressions can be added at the moment")}},Get:lf,Delete:af,Update:function(t,e,i){if(K(e.placement)&&!df.includes(e.placement))throw new Error("Unknown placement: ".concat(e.placement));const n=e.main?Sn:uf(e.index),s=hf(t,n);if(!K(s)||K(e.type)&&s.type!==e.type)return t;if(s.main&&function(t){const e=v[t.type];return e===v.Symbol||e===v.Expression}(s))return e.type||(e.type=s.type),ln(t,e);{let s=_i(t,n,t=>(cf(t,e),delete t.detachedScale,t));const r=lf(s,e,i).find(t=>t.index===e.index);if(!K(r))return t;if(!(e.type===v[v.Study]&&K(e.placement)&&e.placement!==r.placement))return s;const o=hf(s,n);s=af(s,{id:"Delete",plots:[{index:e.index,type:e.type}]});const a=pf(s,e.placement);return null!==a&&a.plots.push(o),s}}},Compare:function(t,e){const i=function(t){return K(t.symbols)?(Kf("Use of 'symbols' for Compare API is deprecated. Please see docs for the latest version which supports more plot types","warn"),t.symbols.map(t=>(t.type=yf,t))):t.plots}(e),{yes:n,no:s}=H(i,t=>t.leftScale),{mainPane:r,mainAxis:o}=Pn(t),a=Sf(r,o),l=t=>![yf,vf].includes(t.type);a.plots=a.plots.filter(l);const c=o.plots.filter(t=>t.main||l(t)),u="Tick"===t.data.aggregation.unit;mf=0;const h=D(bf,u);return o.plots=c.concat(s.map(h)),n.length>0&&(a.plots.push(...n.map(h)),a.comparison=o.comparison,a.scale=o.scale),Fn(t)},Annotation:{Get:function(t,e,i){const n=Ii(t,"..panes").map((t,e)=>Ii(t,"..axes").map((t,i)=>Ii(t,"..annotations").map(t=>xf(xf({},t),{},{paneIndex:e,axisIndex:i})))).flat(2).map((t,e)=>xf(xf({},t),{},{index:e}));return K(e.index)&&Number.isFinite(e.index)?e.index<n.length?[n[e.index]]:te.EMPTY_ARRAY:n}},MovePane:function(t,e){let i=t.panes;return i.splice(e.to,0,i.splice(e.from,1)[0]),t},Template:function(t,e){let i=et(t);if(e.strip.main){const t=An(i),e=t.type.toLowerCase();t[e]=te.PLACEHOLDER_SYMBOL_NAME}return e.strip.annotations&&(i=Pf(i)),e.strip.compare&&(i=wf(i)),i=_i(i,".data",t=>(t.range&&(delete t.range,t.checkRange=!0),t)),i},Outline:function(t,e,i){const n=lf(t,{main:!0},i)[0],s=n.title===te.PLACEHOLDER_SYMBOL_NAME,r="Symbol"===n.type,o="Expression"===n.type,{symbols:a}=o?dn(n.title):{symbols:s?[]:[n.title]};return{isTemplate:s,isDefinition:!s,main:{isSymbol:r,isExpression:o,symbols:a,title:s?null:n.title},compare:Ii(t,Tf).map(t=>t.symbol),annotations:Ii(t,"..annotations").map(t=>t.id),studies:lf(t,{type:"Study"}).map(t=>t.title)}},Theme:{Update:function(t,e){let i=t;const{backgroundColor:n,axis:{gridLinesColor:s,textColor:r,crosshairColor:o,gridLinesStyle:a},fontSize:l}=e,{chart:c,xAxis:u,yAxis:h}=l||{};if((n||c)&&(i=_i(t,".display.chart",t=>(n&&(t.backgroundColor=n),c&&(t.fontSize=c),t))),s){const t=t=>(t.color=s,t);i=_i(i,".display.xAxis.gridLines",t),i=_i(i,".display.yAxis.gridLines",t)}if(a){const t=t=>(t.dashStyle=a,t);i=_i(i,".display.xAxis.gridLines",t),i=_i(i,".display.yAxis.gridLines",t)}if(r){const t=t=>(t.textColor=r,t);i=_i(i,".display.xAxis",t),i=_i(i,".display.yAxis",t)}if(o){const t=t=>(t.color=o,t);i=_i(i,".display.xAxis.crosshair",t),i=_i(i,".display.yAxis.crosshair",t)}if(u||h){const t=t=>e=>(e.fontSize=t,e);u&&(i=_i(i,".display.xAxis",t(u))),h&&(i=_i(i,".display.yAxis",t(h)))}return i},Get:function(t,e,i){const{chart:n,xAxis:s,yAxis:r}=t.display||{},{fontSize:o,backgroundColor:a}=n||{},{fontSize:l,gridLines:c,textColor:u,crosshair:h}=s||{},{color:d,dashStyle:p}=c||{},{fontSize:f}=r||{},{color:m}=h||{};return{backgroundColor:a,axis:{gridLinesColor:d,textColor:u,crosshairColor:m,gridLinesStyle:p},fontSize:{chart:o,xAxis:l,yAxis:f}}}}};function Of(t){return"function"==typeof t}function Df(t,e,i){return function(t,e){"Symbol"===t&&Kf("This API ('Symbol') has been deprecated and will be removed in the future version of the API. Please use 'MainPlot' instead (functionally equivalent)","warn");let i=Ef[t];if(!Of(i)){let t=i[e];if(!Of(t)&&(t=i[te.DEFAULT_ACCESSOR_SUBACTION],!Of(t)))throw new Error("Invalid accesor id and/or sub id");return t}return i}(t.id,t.context.id)(e,t.context,i)}function Lf(t){return{id:"MainPlot",context:t}}class If{constructor(t=!1){this.headless=t,this.presenter=t?null:new of(this)}get elementId(){return this.headless?null:this.presenter.elementId}get hostElement(){return this.headless?null:this.presenter.hostElement}initialize(t,e){if(this.headless)console.error("You cannot initialize a headless chart.");else if(this.presenter.initialize(t),e){const t="string"==typeof e;t&&Kf("Initializing the chart with symbol name is deprecated. Please use object form instead (see docs for details). This API will be removed in the future.","warn"),e.template&&this.load(e.template),delete e.template;const i=t?{symbol:e}:e;this.change(Lf(i))}}shutdown(){if(!this.headless){const t=this.presenter.shutdown();return this.presenter=null,t}return!1}annotate(t,e=null,i=null){if(!this.headless)if(K(t)){const n=Cp(t,!1,e,i,this.presenter);n.isDrawingAnnotation&&this.presenter.view.setCursor(S.Crosshair),this.presenter.activeTool=n}else this.presenter.resetActiveTool()}getDefaultTemplate(){return et(im().template)}get model(){return(this.headless?this._model:this.presenter.getModel())||this.getDefaultTemplate()}asTemplate(t={main:!0,annotations:!1,compare:!1}){return this.change({id:te.ACTION_TEMPLATE,context:{strip:t}})}change(...t){ya.a.publish(jn.CH_API_ACTIONS_RECEIVED,{chart:this,actions:t});const e=im().config.validateInput,i=t.map(t=>e?Hn(t,te.ACCESSOR_SCHEMA):t);if(1===i.length){const t=i[0];if(t.id===te.ACTION_TEMPLATE||t.context.id===te.ACTION_GET)return Df(t,this.model,this.presenter);if(!this.headless&&t.id===te.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(t.context)}const{yes:n,no:s}=H(i,t=>t.id===te.ACTION_PLOT&&K(t.context)&&t.context.id===te.ACTION_DELETE);let r=this.model;const o=s;n.length>0&&o.push({id:te.ACTION_PLOT,context:{id:te.ACTION_DELETE,plots:n.map(t=>t.context)}}),o.forEach(t=>{if(r=Df(t,r,this.presenter),!K(r))throw new Error("Forgot to return model from accessor")}),this.fromModel(r)}fromModel(t){let e=Hn(t,te.CHART_SCHEMA);this.headless?this._model=e:this.presenter.fromModel(e)}load(t,e={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1}){let i=JSON.parse(t),n=this.model;if(e.keepNewAnnotations||(i=Pf(i)),e.keepOldAnnotations&&(i=function(t,e){const{mainAxis:i}=Pn(t),{mainAxis:n}=Pn(e);rf(i,n);const s=t=>Ii(t,'..plots{.type==="Study"}.study')[0],r=Ii(t,'..axes{..plots{.type==="Study"}}').filter(t=>t!==i),o=Ii(e,'..axes{..plots{.type==="Study"}}').filter(t=>t!==n);return r.forEach(t=>{const e=s(t),i=o.find(t=>e===s(t));K(i)&&rf(t,i)}),e}(n,i)),e.keepNewCompare||(i=wf(i)),e.keepOldCompare&&(i=function(t,e){const i=Ii(t,Tf),n=Ii(e,Tf),s=Math.max(0,4-n.length);if(0===s)return e;const r=i.filter(t=>!n.find(e=>t.symbol===e.symbol)).slice(0,s);if(0===r.length)return e;const{mainPane:o,mainAxis:a}=Pn(e),{mainAxis:l}=Pn(t);return r.forEach(t=>{if(l.plots.includes(t))a.plots.push(t);else{Sf(o,a).plots.push(t)}}),e}(n,i)),e.keepOldAggregation){const t={id:te.ACTION_AGGREGATION,context:n.data.aggregation},s=i.display.density;i=Df(t,i,this.presenter),e.keepNewBarWidth&&K(s)&&(i.display.density=s)}this.fromModel(i)}save(){return JSON.stringify(this.model)}reset(){const t=this.getDefaultTemplate();if(this.headless)this._model=t;else if(this.presenter.getModel()){const e=this.presenter.mainPlot;let i=null;if(e.isSymbol?i={symbol:e.symbol}:e.isExpression?i={expression:e.expression}:e.isForward?i={forward:e.forward}:e.isSeasonal&&(i={seasonal:e.seasonal}),K(i)){const e=Df(Lf(i),t,this.presenter);this.presenter.fromModel(e)}}}print(t={}){this.headless||this.presenter.print(t)}getSVGForExport(){Kf("Obsolete: please use 'exportImage' method instead.","warn")}setTitle(t){this.headless||this.presenter.setTitle(t)}getPaneBounds(){if(!this.headless)return this.presenter.panes.map(t=>t.getBounds())}exportData(){return this.headless?null:this.presenter.exportData()}exportImage(t={}){return this.headless?null:this.presenter.exportImage(t)}getDataStats(){return this.presenter.getDataStats()}}function _f(t){return t&&"function"==typeof t.schedule}var Nf=function(){function t(t,e,i,n){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=i,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new kf(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),Rf=function(){return function(){this.buffer=[]}}(),kf=function(t){function e(e,i,n,s,r){var o=t.call(this,e)||this;o.bufferTimeSpan=i,o.bufferCreationInterval=n,o.maxBufferSize=s,o.scheduler=r,o.contexts=[];var a=o.openContext();if(o.timespanOnly=null==n||n<0,o.timespanOnly){var l={subscriber:o,context:a,bufferTimeSpan:i};o.add(a.closeAction=r.schedule(Hf,i,l))}else{var c={subscriber:o,context:a},u={bufferTimeSpan:i,bufferCreationInterval:n,subscriber:o,scheduler:r};o.add(a.closeAction=r.schedule(Uf,i,c)),o.add(r.schedule(Ff,n,u))}return o}return ss(e,t),e.prototype._next=function(t){for(var e,i=this.contexts,n=i.length,s=0;s<n;s++){var r=i[s],o=r.buffer;o.push(t),o.length==this.maxBufferSize&&(e=r)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,i=this.destination;e.length>0;){var n=e.shift();i.next(n.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var i=this.bufferTimeSpan,n={subscriber:this,context:t,bufferTimeSpan:i};this.add(t.closeAction=this.scheduler.schedule(Hf,i,n))}},e.prototype.openContext=function(){var t=new Rf;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(gs);function Hf(t){var e=t.subscriber,i=t.context;i&&e.closeContext(i),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function Ff(t){var e=t.bufferCreationInterval,i=t.bufferTimeSpan,n=t.subscriber,s=t.scheduler,r=n.openContext();n.closed||(n.add(r.closeAction=s.schedule(Uf,i,{subscriber:n,context:r})),this.schedule(t,e))}function Uf(t){var e=t.subscriber,i=t.context;e.closeContext(i)}function Bf(){var t,e;const i=(null===(t=globalThis.parent)||void 0===t||null===(e=t.location)||void 0===e?void 0:e.hostname)||"";return["","localhost","127.0.0.1"].includes(i)||function(t){const e=t.split(".");if(!e||4!==e.length)return!1;const i=e.map(Number);if(!i.every(t=>Number.isFinite(t)&&t>=0&&t<=255))return!1;const[n,s]=i;return 10===n||172===n&&s>=16&&s<=31||192===n&&168===s}(i)}function Vf(){let t=document.domain;const e=t.split("."),i="__tld"+(new Date).getTime();let n=0;for(;n<e.length-1&&-1===document.cookie.indexOf("".concat(i,"=").concat(i));)t=e.slice(-1-++n).join("."),document.cookie="".concat(i,"=").concat(i,";domain=").concat(t,";");return document.cookie="".concat(i,"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=").concat(t,";"),t}function Wf(t,e){var i;i=e,Object.keys(i).forEach(t=>!K(i[t])&&delete i[t]);const n=new URLSearchParams(e);return"".concat(t,"/?").concat(n.toString())}function jf(t,e=null){return Wf(atob("aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ=="),{module:atob("YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy"),secret:e,referer:t})}function Gf(t,e){return t+Math.random()*(e-t)}const zf=new Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),Yf=new Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),qf=new Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function $f(t,e){if(e&&!qf(t.mode))return;let i=!1,n=0,s=25;for(;!i&&n<5;){const e=Bf()||"FreeWidget"===t.mode,r=e?t.apiKey:null;try{const s=jf(e?"":Vf(),r),o=await fetch(s);if(o.ok){const e=await o.json(),n=e[atob("YXV0aG9yaXplZA==")];t.knownSite=n,n?(t.dataEndpoint=(e[atob("ZGF0YS1lbmRwb2ludA==")]||"").replace(/\/$/g,""),t.allowCredentials=e[atob("YWxsb3dDcmVkZW50aWFscw==")]):(t.dataEndpoint="",t.allowCredentials=!1),i=!0;break}n++}catch(t){}n++,s*=2,await new Promise(t=>setTimeout(t,s))}i&&t.knownSite||(setTimeout(zf,Gf(2e3,3e3)),setTimeout(()=>Yf(im()),Gf(4e3,5e3)))}var Xf=i(27);function Kf(t,e="info"){const i=globalThis.console;i[void 0!==i[e]?e:"log"](t)}const Zf={validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:"/".concat(te.CHART_DEFINITION),cachedAnnotationsCount:0,showResizeHandles:!1,scrollBehavior:"wheel+shift",bypassSmoothing:!1,showGoToLatest:void 0,tooltipMovement:"Auto",tooltipHeaders:void 0,touchCrosshairTimeoutMillis:void 0,touchCrosshairDelayMillis:void 0,mode:C[C.Unspecified],hostingModel:"Page",overrides:void 0,logo:void 0,noDataText:void 0,useAllFieldsForComparison:void 0,baseUrl:{instruments:"/proxies/instruments",futures:"/proxies/futures",timeseries:"/proxies/timeseries",timeseriesNew:"/proxies/new-timeseries",ondemand:"/proxies/ondemand"},credentials:void 0,apiKey:void 0,async fetch(t,e){const i=this.baseUrl[t];let n="".concat(i).concat(e);if(qf(this.mode)&&this.knownSite){const{username:s,password:r}=this.credentials||{},o=K(s,r),a="timeseries"===t,l=a?"/historical":"",c=a&&o&&this.allowCredentials?"&username=".concat(s,"&password=").concat(r):"";n="https://".concat(this.dataEndpoint).concat(i).concat(l).concat(e).concat(c)}const s=await fetch(n);return await s.text()}};async function Qf(t,e){const i=im().config;return await i.fetch.call(i,t,e)}let Jf=!1,tm=null;function em(t,e={}){if(Jf)throw new Error("You should only call initFeed once during page's lifetime");Jf=!0;const i=Object.assign(Zf);return nt(i,e),tm=new t(i),tm.version=function(){const t=Xf,e=t.prerelease?"-".concat(t.prerelease.identifier,".").concat(t.prerelease.ordinal):"";return"".concat(t.major,".").concat(t.minor,".").concat(t.patch).concat(e)}(),Kf("Barchart HTML5 Streaming Chart version ".concat(tm.version," initialized."),"info"),tm.cachesData&&(tm.subject.subscribe(tm.onPerformInternalGc.bind(tm)),ya.a.subscribe(jn.CH_ALL,tm.onChartChanged.bind(tm))),tm}function im(){return tm}function nm(){return new If(!0)}function sm(t){const e=nm();return e.load(t),e.change({id:"Outline",context:{id:"Get"}})}class rm{constructor(t){this.config=t,this.timeSeriesSource=this.metaDataSource=this.recordSource=null,this.charts=new Map,this.pendingRedraw=new Set,this.ongoingAnimationCallbackId=null,this.drawCharts=this.drawCharts.bind(this),this.template=null,this.cachesData=!1}get subject(){return K(this._subject)||(this._subject=(new Ls).pipe(function(t){var e=arguments.length,i=Cs;_f(arguments[arguments.length-1])&&(i=arguments[arguments.length-1],e--);var n=null;e>=2&&(n=arguments[1]);var s=Number.POSITIVE_INFINITY;return e>=3&&(s=arguments[2]),function(e){return e.lift(new Nf(t,n,s,i))}}(te.INTERNAL_GC_MILLIS),Bs(t=>t.length>0))),this._subject}getTimeSeriesDataSource(){return this.timeSeriesSource}getMetaDataSource(){return this.metaDataSource}getRecordSource(){return this.recordSource}async ready(){return Qt.call(this,async()=>{const t=this instanceof lm||this instanceof om;await $f(this.config,t);let e=this.config.defaultTemplate;if("string"==typeof e){const t=await fetch(this.config.defaultTemplate);e=await t.json()}return this.template=Hn(e,te.CHART_SCHEMA),K(this.config.logo)&&await async function(t){const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg").getAttribute("viewBox");if(K(e)){const i=e.split(" ").map(Number);if(4===i.length&&i.every(Number.isFinite)){const[,,e,n]=i,s="data:image/svg+xml;utf8,".concat(t),r=$t(document.body,"img");zt(r,{src:s}),Gt(r,{display:"none"}),await Zt(r),Ud={img:r,width:e,height:n,rect:new je(0,0,0,0)}}}}(this.config.logo),!0})}getHeadlessChart(){return nm()}checkChart(t,e){if(e!==this.charts.has(t))throw new Error("There is ".concat(e?"no":"already a"," chart inside the element ").concat(t))}addChart(t,e=null){this.checkChart(t,!1);const i=new If;return this.charts.set(t,i),i.initialize(t,e),i}removeChart(t){this.checkChart(t,!0);this.charts.get(t).shutdown(),this.charts.delete(t)}removeAllCharts(){for(const t of this.charts.keys())this.removeChart(t)}getChart(t){return this.charts.has(t)?this.charts.get(t):null}redraw(t){this.checkChart(t,!0),K(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach(t=>{if(!this.charts.has(t))return;const e=this.charts.get(t).presenter.view;e.isHostElementVisible&&e.draw()}),this.pendingRedraw.clear()}get emptyEntities(){return{metaData:new Set,records:new Set,timeSeries:new Set}}getCacheableEntities(){const t=this.emptyEntities;for(const e of this.charts.values())e.presenter.getCacheableEntities(t);return t.timeSeries.forEach(e=>{K(e)&&(K(e.record)?t.records.add(e.record):K(e.records)&&Object.values(e.records).forEach(e=>t.records.add(e)))}),t}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){this.getTimeSeriesDataSource().refresh(),ya.a.publish(jn.DF_STREAMRECONNECTED,{})}evictUnused(t){this.getMetaDataSource().evictUnused(t.metaData),this.getRecordSource().evictUnused(t.records),this.getTimeSeriesDataSource().evictUnused(t.timeSeries)}onPerformInternalGc(t){const e=this.getCacheableEntities();this.evictUnused(e)}onChartChanged(t,e){t!==jn.CH_RECREATED&&t!==jn.CH_SHUTDOWN||this.subject.next()}getDefaultMultiFieldCurve(){if(!this.knowDefaultCurve){const t=An(this.template);1===t.curves.length&&rn(t.curves[0].style)?this.defaultOhlcCurve=et(t.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return this.knowDefaultAggregation||(this.defaultAggregation=et(this.template.data.aggregation),this.knowDefaultAggregation=!0),this.defaultAggregation}getDefaultPeriod(){return this.knowDefaultPeriod||(this.defaultPeriod=this.template.display.period||null,this.knowDefaultPeriod=!0),this.defaultPeriod}getDefaultDensity(){return this.knowDefaultDensity||(this.defaultDensity=this.template.display.density||null,this.knowDefaultDensity=!0),this.defaultDensity}}class om extends rm{constructor(t){super(t),this.timeSeriesSource=new Oa(!1),this.metaDataSource=new Ae,this.recordSource=new Ur}}class am extends rm{constructor(t){super(t),this.cachesData=!0,this.timeSeriesSource=new Oa(!0),this.metaDataSource=new Ae,this.recordSource=new Ur}}class lm extends rm{constructor(t){super(t),this.cachesData=!0,this.timeSeriesSource=new Oa(!0),this.metaDataSource=new Pe,this.recordSource=new Br,this.onEvents=this.onEvents.bind(this),this.onTimestamp=this.onTimestamp.bind(this),this.resetStreamingState()}resetStreamingState(){this.lastStreamingTimestamp=null,this._isActivelyStreaming=null,this.needToResubscribe=!1}get connection(){return this._connection}set connection(t){this._connection=t,this.initializeStreaming()}addChart(t,e=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(t,e)}set isActivelyStreaming(t){K(this._isActivelyStreaming)&&!this._isActivelyStreaming&&t&&this.refreshCaches(),this._isActivelyStreaming=t}get isActivelyStreaming(){return this._isActivelyStreaming}initializeStreaming(){this.resetStreamingState(),this.connection.on("events",this.onEvents),this.connection.on("timestamp",this.onTimestamp)}onTimestamp(t){this.isActivelyStreaming&&(this.lastStreamingTimestamp=t)}onEvents({event:t}){t===te.BC_EVENT_DISCONNECTED||t===te.BC_EVENT_FEED_PAUSED?this.isActivelyStreaming=!1:t===te.BC_EVENT_LOGGED_IN||t===te.BC_EVENT_FEED_RESUMED?this.isActivelyStreaming=!0:t===te.BC_EVENT_DISCONNECTING&&(this.clearCaches(),this.needToResubscribe=!0)}}}])}));